From 910886157da2d9e0abae08c8483fd2e44699fe97 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 25 Apr 2017 10:27:18 +0530 Subject: [PATCH] String changes --- src/calibre/devices/boeye/driver.py | 4 ++-- src/calibre/devices/cybook/driver.py | 6 +++--- src/calibre/devices/eb600/driver.py | 3 +-- .../ebooks/conversion/plugins/epub_output.py | 3 +-- src/calibre/ebooks/conversion/plumber.py | 16 ++++++++-------- src/calibre/ebooks/metadata/cli.py | 13 +++++++------ src/calibre/ebooks/metadata/sources/overdrive.py | 2 +- src/calibre/ebooks/oeb/polish/check/fonts.py | 2 +- src/calibre/ebooks/oeb/polish/check/links.py | 10 +++++----- src/calibre/ebooks/oeb/polish/check/opf.py | 6 +++--- src/calibre/ebooks/oeb/polish/check/parsing.py | 9 ++++++--- src/calibre/ebooks/oeb/polish/main.py | 12 +++++++----- src/calibre/gui2/add_filters.py | 2 +- src/calibre/gui2/main.py | 2 +- src/calibre/gui2/preferences/adding.ui | 4 ++-- 15 files changed, 49 insertions(+), 45 deletions(-) diff --git a/src/calibre/devices/boeye/driver.py b/src/calibre/devices/boeye/driver.py index 2cd616113b..99ccedad31 100644 --- a/src/calibre/devices/boeye/driver.py +++ b/src/calibre/devices/boeye/driver.py @@ -12,7 +12,7 @@ from calibre.devices.usbms.driver import USBMS class BOEYE_BEX(USBMS): name = 'BOEYE BEX reader driver' gui_name = 'BOEYE BEX' - description = _('Communicate with BOEYE BEX Serial eBook readers.') + description = _('Communicate with BOEYE BEX Serial e-book readers.') author = 'szboeye' supported_platforms = ['windows', 'osx', 'linux'] @@ -34,7 +34,7 @@ class BOEYE_BEX(USBMS): class BOEYE_BDX(USBMS): name = 'BOEYE BDX reader driver' gui_name = 'BOEYE BDX' - description = _('Communicate with BOEYE BDX serial eBook readers.') + description = _('Communicate with BOEYE BDX serial e-book readers.') author = 'szboeye' supported_platforms = ['windows', 'osx', 'linux'] diff --git a/src/calibre/devices/cybook/driver.py b/src/calibre/devices/cybook/driver.py index 46837675d8..d6c5abc38f 100644 --- a/src/calibre/devices/cybook/driver.py +++ b/src/calibre/devices/cybook/driver.py @@ -22,7 +22,7 @@ class CYBOOK(USBMS): name = 'Cybook Gen 3 / Opus Device Interface' gui_name = 'Cybook Gen 3/Opus' - description = _('Communicate with the Cybook Gen 3/Opus eBook reader.') + description = _('Communicate with the Cybook Gen 3/Opus e-book reader.') author = 'John Schember' supported_platforms = ['windows', 'osx', 'linux'] @@ -66,7 +66,7 @@ class ORIZON(CYBOOK): name = 'Cybook Orizon Device Interface' gui_name = 'Orizon' - description = _('Communicate with the Cybook Orizon eBook reader.') + description = _('Communicate with the Cybook Orizon e-book reader.') BCD = [0x319] @@ -118,7 +118,7 @@ class MUSE(CYBOOK): name = 'Cybook Muse Device Interface' gui_name = 'Muse' - description = _('Communicate with the Cybook Muse eBook reader.') + description = _('Communicate with the Cybook Muse e-book reader.') author = 'Kovid Goyal' FORMATS = ['epub', 'html', 'fb2', 'txt', 'pdf', 'djvu'] diff --git a/src/calibre/devices/eb600/driver.py b/src/calibre/devices/eb600/driver.py index 7652cafebd..51ba6c924f 100644 --- a/src/calibre/devices/eb600/driver.py +++ b/src/calibre/devices/eb600/driver.py @@ -23,7 +23,7 @@ class EB600(USBMS): name = 'Netronix EB600 Device Interface' gui_name = 'Netronix EB600' - description = _('Communicate with the EB600 eBook reader.') + description = _('Communicate with the EB600 e-book reader.') author = 'Kovid Goyal' supported_platforms = ['windows', 'osx', 'linux'] @@ -415,4 +415,3 @@ class PI2(EB600): WINDOWS_CARD_A_MEM = 'INFIBEAM_PI' DELETE_EXTS = ['.rec'] - diff --git a/src/calibre/ebooks/conversion/plugins/epub_output.py b/src/calibre/ebooks/conversion/plugins/epub_output.py index 1e30951c05..123c071467 100644 --- a/src/calibre/ebooks/conversion/plugins/epub_output.py +++ b/src/calibre/ebooks/conversion/plugins/epub_output.py @@ -59,7 +59,7 @@ class EPUBOutput(OutputFormatPlugin): recommended_value=False, level=OptionRecommendation.LOW, help=_('Turn off splitting at page breaks. Normally, input ' 'files are automatically split at every page break into ' - 'two files. This gives an output ebook that can be ' + 'two files. This gives an output e-book that can be ' 'parsed faster and with less resources. However, ' 'splitting is slow and if your source file contains a ' 'very large number of page breaks, you should turn off ' @@ -512,4 +512,3 @@ class EPUBOutput(OutputFormatPlugin): simplify_toc_entry(self.oeb.toc) # }}} - diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py index d9b8a244df..aef3da92db 100644 --- a/src/calibre/ebooks/conversion/plumber.py +++ b/src/calibre/ebooks/conversion/plumber.py @@ -345,7 +345,7 @@ OptionRecommendation(name='chapter_mark', OptionRecommendation(name='start_reading_at', recommended_value=None, level=OptionRecommendation.LOW, help=_('An XPath expression to detect the location in the document' - ' at which to start reading. Some ebook reading programs' + ' at which to start reading. Some e-book reading programs' ' (most prominently the Kindle) use this location as the' ' position at which to open the book. See the XPath tutorial' ' in the calibre User Manual for further help using this' @@ -486,7 +486,7 @@ OptionRecommendation(name='insert_blank_line_size', OptionRecommendation(name='remove_first_image', recommended_value=False, level=OptionRecommendation.LOW, - help=_('Remove the first image from the input ebook. Useful if the ' + help=_('Remove the first image from the input e-book. Useful if the ' 'input document has a cover image that is not identified as a cover. ' 'In this case, if you set a cover in calibre, the output document will ' 'end up with two cover images if you do not specify this option.' @@ -496,7 +496,7 @@ OptionRecommendation(name='remove_first_image', OptionRecommendation(name='insert_metadata', recommended_value=False, level=OptionRecommendation.LOW, help=_('Insert the book metadata at the start of ' - 'the book. This is useful if your ebook reader does not support ' + 'the book. This is useful if your e-book reader does not support ' 'displaying/searching metadata directly.' ) ), @@ -574,15 +574,15 @@ OptionRecommendation(name='cover', OptionRecommendation(name='comments', recommended_value=None, level=OptionRecommendation.LOW, - help=_('Set the ebook description.')), + help=_('Set the e-book description.')), OptionRecommendation(name='publisher', recommended_value=None, level=OptionRecommendation.LOW, - help=_('Set the ebook publisher.')), + help=_('Set the e-book publisher.')), OptionRecommendation(name='series', recommended_value=None, level=OptionRecommendation.LOW, - help=_('Set the series this ebook belongs to.')), + help=_('Set the series this e-book belongs to.')), OptionRecommendation(name='series_index', recommended_value=None, level=OptionRecommendation.LOW, @@ -818,7 +818,7 @@ OptionRecommendation(name='search_replace', html_pat = re.compile(r'\.(x){0,1}htm(l){0,1}$', re.IGNORECASE) html_files = [f for f in files if html_pat.search(f) is not None] if not html_files: - raise ValueError(_('Could not find an ebook inside the archive')) + raise ValueError(_('Could not find an e-book inside the archive')) html_files = [(f, os.stat(f).st_size) for f in html_files] html_files.sort(cmp=lambda x, y: cmp(x[1], y[1])) html_files = [f[0] for f in html_files] @@ -1110,7 +1110,7 @@ OptionRecommendation(name='search_replace', self.input_plugin.specialize(self.oeb, self.opts, self.log, self.output_fmt) - pr(0., _('Running transforms on ebook...')) + pr(0., _('Running transforms on e-book...')) self.oeb.plumber_output_format = self.output_fmt or '' diff --git a/src/calibre/ebooks/metadata/cli.py b/src/calibre/ebooks/metadata/cli.py index 762617c885..6d4367b61f 100644 --- a/src/calibre/ebooks/metadata/cli.py +++ b/src/calibre/ebooks/metadata/cli.py @@ -19,7 +19,7 @@ from calibre.utils.date import parse_date USAGE=_('%prog ebook_file [options]\n') + \ _(''' -Read/Write metadata from/to ebook files. +Read/Write metadata from/to e-book files. Supported formats for reading metadata: {0} @@ -50,13 +50,13 @@ def config(): c.add_opt('cover', ['--cover'], help=_('Set the cover to the specified file.')) c.add_opt('comments', ['-c', '--comments'], - help=_('Set the ebook description.')) + help=_('Set the e-book description.')) c.add_opt('publisher', ['-p', '--publisher'], - help=_('Set the ebook publisher.')) + help=_('Set the e-book publisher.')) c.add_opt('category', ['--category'], help=_('Set the book category.')) c.add_opt('series', ['-s', '--series'], - help=_('Set the series this ebook belongs to.')) + help=_('Set the series this e-book belongs to.')) c.add_opt('series_index', ['-i', '--index'], help=_('Set the index of the book in this series.')) c.add_opt('rating', ['-r', '--rating'], @@ -78,14 +78,14 @@ def config(): help=_('Set the published date.')) c.add_opt('get_cover', ['--get-cover'], - help=_('Get the cover from the ebook and save it at as the ' + help=_('Get the cover from the e-book and save it at as the ' 'specified file.')) c.add_opt('to_opf', ['--to-opf'], help=_('Specify the name of an OPF file. The metadata will ' 'be written to the OPF file.')) c.add_opt('from_opf', ['--from-opf'], help=_('Read metadata from the specified OPF file and use it to ' - 'set metadata in the ebook. Metadata specified on the ' + 'set metadata in the e-book. Metadata specified on the ' 'command line will override metadata read from the OPF file')) c.add_opt('lrf_bookid', ['--lrf-bookid'], @@ -221,5 +221,6 @@ def main(args=sys.argv): return 0 + if __name__ == '__main__': sys.exit(main()) diff --git a/src/calibre/ebooks/metadata/sources/overdrive.py b/src/calibre/ebooks/metadata/sources/overdrive.py index 4ae0b3fdf1..50f7625938 100755 --- a/src/calibre/ebooks/metadata/sources/overdrive.py +++ b/src/calibre/ebooks/metadata/sources/overdrive.py @@ -46,7 +46,7 @@ class OverDrive(Source): config_help_message = '

'+_('Additional metadata can be taken from Overdrive\'s book detail' ' page. This includes a limited set of tags used by libraries, comments, language,' - ' and the ebook ISBN. Collecting this data is disabled by default due to the extra' + ' and the e-book ISBN. Collecting this data is disabled by default due to the extra' ' time required. Check the download all metadata option below to' ' enable downloading this data.') diff --git a/src/calibre/ebooks/oeb/polish/check/fonts.py b/src/calibre/ebooks/oeb/polish/check/fonts.py index 0d3566fe53..628a63488b 100644 --- a/src/calibre/ebooks/oeb/polish/check/fonts.py +++ b/src/calibre/ebooks/oeb/polish/check/fonts.py @@ -21,7 +21,7 @@ from tinycss.fonts3 import parse_font_family class InvalidFont(BaseError): HELP = _('This font could not be processed. It most likely will' - ' not work in an ebook reader, either') + ' not work in an e-book reader, either') def fix_sheet(sheet, css_name, font_name): diff --git a/src/calibre/ebooks/oeb/polish/check/links.py b/src/calibre/ebooks/oeb/polish/check/links.py index d4b131fd3d..580497e43a 100644 --- a/src/calibre/ebooks/oeb/polish/check/links.py +++ b/src/calibre/ebooks/oeb/polish/check/links.py @@ -73,7 +73,7 @@ class BadDestinationType(BaseError): def __init__(self, link_source, link_dest, link_elem): BaseError.__init__(self, _('Link points to a file that is not a text document'), link_source, line=link_elem.sourceline) self.HELP = _('The link "{0}" points to a file {1} that is not a text (HTML) document.' - ' Many ebook readers will be unable to follow such a link. You should' + ' Many e-book readers will be unable to follow such a link. You should' ' either remove the link or change it to point to a text document.' ' For example, if it points to an image, you can create small wrapper' ' document that contains the image and change the link to point to that.').format( @@ -96,7 +96,7 @@ class BadDestinationFragment(BaseError): class FileLink(BadLink): - HELP = _('This link uses the file:// URL scheme. This does not work with many ebook readers.' + HELP = _('This link uses the file:// URL scheme. This does not work with many e-book readers.' ' Remove the file:// prefix and make sure the link points to a file inside the book.') @@ -115,7 +115,7 @@ class EmptyLink(BadLink): class UnreferencedResource(BadLink): HELP = _('This file is included in the book but not referred to by any document in the spine.' - ' This means that the file will not be viewable on most ebook readers. You should ' + ' This means that the file will not be viewable on most e-book readers. You should ' ' probably remove this file from the book or add a link to it somewhere.') def __init__(self, name): @@ -184,7 +184,7 @@ class Bookmarks(BadLink): HELP = _( 'This file stores the bookmarks and last opened information from' - ' the calibre ebook viewer. You can remove it if you do not' + ' the calibre e-book viewer. You can remove it if you do not' ' need that information, or don\'t want to share it with' ' other people you send this book to.') INDIVIDUAL_FIX = _('Remove this file') @@ -192,7 +192,7 @@ class Bookmarks(BadLink): def __init__(self, name): BadLink.__init__(self, _( - 'The bookmarks file used by the calibre ebook viewer is present'), name) + 'The bookmarks file used by the calibre e-book viewer is present'), name) def __call__(self, container): container.remove_item(self.name) diff --git a/src/calibre/ebooks/oeb/polish/check/opf.py b/src/calibre/ebooks/oeb/polish/check/opf.py index a8217714da..50f0f4edab 100644 --- a/src/calibre/ebooks/oeb/polish/check/opf.py +++ b/src/calibre/ebooks/oeb/polish/check/opf.py @@ -42,7 +42,7 @@ class IncorrectCover(BaseError): class NookCover(BaseError): HELP = _( - 'Some ebook readers such as the Nook fail to recognize covers if' + 'Some e-book readers such as the Nook fail to recognize covers if' ' the content attribute comes before the name attribute.' ' For maximum compatibility move the name attribute before the content attribute.') INDIVIDUAL_FIX = _('Move the name attribute before the content attribute') @@ -152,7 +152,7 @@ class NonLinearItems(BaseError): has_multiple_locations = True HELP = xml(_('There are items marked as non-linear in the .' - ' These will be displayed in random order by different ebook readers.' + ' These will be displayed in random order by different e-book readers.' ' Some will ignore the non-linear attribute, some will display' ' them at the end or the beginning of the book and some will' ' fail to display them at all. Instead of using non-linear items' @@ -255,7 +255,7 @@ class BadSpineMime(BaseError): BaseError.__init__(self, _('Incorrect media-type for spine item'), opf_name, lnum) self.HELP = _( 'The item {0} present in the spine has the media-type {1}. ' - ' Most ebook software cannot handle non-HTML spine items. ' + ' Most e-book software cannot handle non-HTML spine items. ' ' If the item is actually HTML, you should change its media-type to {2}.' ' If it is not-HTML you should consider replacing it with an HTML item, as it' ' is unlikely to work in most readers.').format(name, mt, XHTML_MIME) diff --git a/src/calibre/ebooks/oeb/polish/check/parsing.py b/src/calibre/ebooks/oeb/polish/check/parsing.py index 494087e307..f80776faf6 100644 --- a/src/calibre/ebooks/oeb/polish/check/parsing.py +++ b/src/calibre/ebooks/oeb/polish/check/parsing.py @@ -59,7 +59,7 @@ class XMLParseError(BaseError): is_parsing_error = True HELP = _('A parsing error in an XML file means that the XML syntax in the file is incorrect.' - ' Such a file will most probably not open in an ebook reader. These errors can ' + ' Such a file will most probably not open in an e-book reader. These errors can ' ' usually be fixed automatically, however, automatic fixing can sometimes ' ' "do the wrong thing".') @@ -125,7 +125,7 @@ class EscapedName(BaseError): self.sname = make_filename_safe(name) self.HELP = _( 'The filename {0} contains unsafe characters, that must be escaped, like' - ' this {1}. This can cause problems with some ebook readers. To be' + ' this {1}. This can cause problems with some e-book readers. To be' ' absolutely safe, use only the English alphabet [a-z], the numbers [0-9],' ' underscores and hyphens in your file names. While many other characters' ' are allowed, they may cause problems with some software.').format(name, qname) @@ -149,7 +149,7 @@ class TooLarge(BaseError): level = INFO MAX_SIZE = 260 *1024 HELP = _('This HTML file is larger than %s. Too large HTML files can cause performance problems' - ' on some ebook readers. Consider splitting this file into smaller sections.') % human_readable(MAX_SIZE) + ' on some e-book readers. Consider splitting this file into smaller sections.') % human_readable(MAX_SIZE) def __init__(self, name): BaseError.__init__(self, _('File too large'), name) @@ -243,6 +243,7 @@ def check_html_size(name, mt, raw): errors.append(TooLarge(name)) return errors + entity_pat = re.compile(br'&(#{0,1}[a-zA-Z0-9]{1,8});') @@ -325,6 +326,7 @@ class CSSError(BaseError): elem.set('style', force_unicode(container.parse_css(raw, is_declaration=True).cssText, 'utf-8').replace('\n', ' ')) return True + pos_pats = (re.compile(r'\[(\d+):(\d+)'), re.compile(r'(\d+), (\d+)\)')) @@ -472,6 +474,7 @@ def check_filenames(container): errors.append(EscapedName(name)) return errors + valid_id = re.compile(r'^[a-zA-Z][a-zA-Z0-9_:.-]*$') diff --git a/src/calibre/ebooks/oeb/polish/main.py b/src/calibre/ebooks/oeb/polish/main.py index 78cd6d6353..ed31c9748d 100644 --- a/src/calibre/ebooks/oeb/polish/main.py +++ b/src/calibre/ebooks/oeb/polish/main.py @@ -46,14 +46,14 @@ SUPPORTED = {'EPUB', 'AZW3'} HELP = {'about': _( '''\

Polishing books is all about putting the shine of perfection onto -your carefully crafted ebooks.

+your carefully crafted e-books.

-

Polishing tries to minimize the changes to the internal code of your ebook. +

Polishing tries to minimize the changes to the internal code of your e-book. Unlike conversion, it does not flatten CSS, rename files, change font sizes, adjust margins, etc. Every action performs only the minimum set of changes needed for the desired effect.

-

You should use this tool as the last step in your ebook creation process.

+

You should use this tool as the last step in your e-book creation process.

{0}

Note that polishing only works on files in the %s formats.

\ ''')%_(' or ').join(sorted('%s'%x for x in SUPPORTED)), @@ -124,6 +124,7 @@ def hfix(name, raw): raw = raw.replace('<', '<').replace('>', '>') return raw + CLI_HELP = {x:hfix(x, re.sub('<.*?>', '', y)) for x, y in HELP.iteritems()} # }}} @@ -229,6 +230,7 @@ def polish(file_map, opts, log, report): report('-'*70) report(_('Polishing took: %.1f seconds')%(time.time()-st)) + REPORT = '{0} REPORT {0}'.format('-'*30) @@ -273,7 +275,7 @@ def option_parser(): o('--embed-fonts', '-e', dest='embed', help=CLI_HELP['embed']) o('--subset-fonts', '-f', dest='subset', help=CLI_HELP['subset']) a('--cover', '-c', help=_( - 'Path to a cover image. Changes the cover specified in the ebook. ' + 'Path to a cover image. Changes the cover specified in the e-book. ' 'If no cover is present, or the cover is not properly identified, inserts a new cover.')) a('--opf', '-o', help=_( 'Path to an OPF file. The metadata in the book is updated from the OPF file.')) @@ -327,6 +329,6 @@ def main(args=None): log('Output written to:', outbook) + if __name__ == '__main__': main() - diff --git a/src/calibre/gui2/add_filters.py b/src/calibre/gui2/add_filters.py index bc1370bed7..0ada639c34 100644 --- a/src/calibre/gui2/add_filters.py +++ b/src/calibre/gui2/add_filters.py @@ -113,7 +113,7 @@ class Rules(RulesBase): ' when auto-adding. Click the "Add Rule" button' ' below to get started. The rules will be processed in order for every file until either an' ' "add" or an "ignore" rule matches. If no rules match, the file will be added only' - ' if its file extension is of a known ebook type.') + ' if its file extension is of a known e-book type.') class Tester(TesterBase): diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index fe3910ef67..b6836d914f 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -39,7 +39,7 @@ def option_parser(): parser = _option_parser(_('''\ %prog [options] [path_to_ebook] -Launch the main calibre Graphical User Interface and optionally add the ebook at +Launch the main calibre Graphical User Interface and optionally add the e-book at path_to_ebook to the database. ''')) parser.add_option('--with-library', default=None, action='store', diff --git a/src/calibre/gui2/preferences/adding.ui b/src/calibre/gui2/preferences/adding.ui index 0b6efa4b2f..9681f7ccfa 100644 --- a/src/calibre/gui2/preferences/adding.ui +++ b/src/calibre/gui2/preferences/adding.ui @@ -202,12 +202,12 @@ Title match ignores leading indefinite articles ("the", "a", - By default, calibre will auto-add only known ebook files. + By default, calibre will auto-add only known e-book files. This option tells calibre to add all file types, except those that have been explicitly ignored below. - Auto add files of &all types (not just ebooks) + Auto add files of &all types (not just e-books)