From 0b23eaf328bed89358c6737e22f2fab58cf309e4 Mon Sep 17 00:00:00 2001
From: un-pogaz <46523284+un-pogaz@users.noreply.github.com>
Date: Fri, 24 Jan 2025 11:14:21 +0100
Subject: [PATCH] code indentation (extra-edit)
---
recipes/20_minutos.recipe | 13 +-
recipes/20minutes.recipe | 3 +-
recipes/am730.recipe | 2 +-
setup/wincross.py | 3 +-
src/calibre/devices/jetbook/driver.py | 22 +--
.../devices/smart_device_app/driver.py | 66 +++----
.../ebooks/conversion/plugins/epub_output.py | 50 ++---
src/calibre/ebooks/lrf/html/color_map.py | 182 +++++++++---------
src/calibre/ebooks/lrf/html/convert_from.py | 44 ++---
src/calibre/ebooks/lrf/lrs/convert_from.py | 18 +-
src/calibre/ebooks/metadata/sources/amazon.py | 2 +-
src/calibre/ebooks/oeb/polish/embed.py | 4 +-
src/calibre/ebooks/oeb/polish/upgrade.py | 88 ++++-----
.../ebooks/unihandecode/unicodepoints.py | 146 +++++++-------
src/calibre/gui2/library/models.py | 14 +-
.../gui2/preferences/create_custom_column.py | 24 +--
.../gui2/store/config/chooser/models.py | 14 +-
src/calibre/gui2/store/search/models.py | 18 +-
.../gui2/store/stores/mobileread/models.py | 6 +-
src/calibre/library/custom_columns.py | 2 +-
src/calibre/library/database2.py | 8 +-
src/calibre/linux.py | 32 +--
src/calibre/utils/search_query_parser_test.py | 44 ++---
src/odf/namespaces.py | 82 ++++----
src/odf/odf2moinmoin.py | 12 +-
src/odf/odf2xhtml.py | 44 ++---
src/odf/opendocument.py | 32 +--
27 files changed, 486 insertions(+), 489 deletions(-)
diff --git a/recipes/20_minutos.recipe b/recipes/20_minutos.recipe
index 02e447c633..73698f3390 100644
--- a/recipes/20_minutos.recipe
+++ b/recipes/20_minutos.recipe
@@ -40,18 +40,17 @@ class AdvancedUserRecipe1294946868(BasicNewsRecipe):
]
remove_tags_before = dict(name='ul', attrs={'class': ['servicios-sub']})
- remove_tags_after = dict(
- name='div', attrs={'class': ['related-news', 'col']})
+ remove_tags_after = dict(name='div', attrs={'class': ['related-news', 'col']})
remove_tags = [
dict(name='ol', attrs={'class': ['navigation', ]}), dict(name='span', attrs={'class': ['action']}), dict(name='div', attrs={'class': ['twitter comments-list hidden', 'related-news', 'col', 'photo-gallery', 'photo-gallery side-art-block', 'calendario', 'article-comment', 'postto estirar', 'otras_vinetas estirar', 'kment', 'user-actions']}), dict( name='div', attrs={'id': ['twitter-destacados', 'eco-tabs', 'inner', 'vineta_calendario', 'vinetistas clearfix', 'otras_vinetas estirar', 'MIN1', 'main', 'SUP1', 'INT']}), dict(name='ul', attrs={'class': ['article-user-actions', 'stripped-list']}), dict(name='ul', attrs={'id': ['site-links']}), dict(name='li', attrs={'class': ['puntuacion', 'enviar', 'compartir']}) # noqa: E501
]
- extra_css = '''
- p{text-align: justify; font-size: 100%}
- body{ text-align: left; font-size:100% }
- h3{font-family: sans-serif; font-size:150%; font-weight:bold; text-align: justify; }
- '''
+ extra_css = '''
+ p{text-align: justify; font-size: 100%}
+ body{ text-align: left; font-size:100% }
+ h3{font-family: sans-serif; font-size:150%; font-weight:bold; text-align: justify; }
+ '''
preprocess_regexps = [(re.compile(
r'', re.DOTALL), lambda m: '')]
diff --git a/recipes/20minutes.recipe b/recipes/20minutes.recipe
index 0890b6f2c3..4baa4e1cd6 100644
--- a/recipes/20minutes.recipe
+++ b/recipes/20minutes.recipe
@@ -9,8 +9,7 @@ from calibre.web.feeds.recipes import BasicNewsRecipe
def classes(classes):
q = frozenset(classes.split(' '))
- return dict(attrs={
- 'class': lambda x: x and frozenset(x.split()).intersection(q)})
+ return dict(attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)})
class Minutes(BasicNewsRecipe):
diff --git a/recipes/am730.recipe b/recipes/am730.recipe
index f5bf33d378..80d52c1c43 100644
--- a/recipes/am730.recipe
+++ b/recipes/am730.recipe
@@ -89,7 +89,7 @@ class AM730(BasicNewsRecipe):
('體育','https://www.am730.com.hk/news/%E9%AB%94%E8%82%B2'),
('娛樂','https://www.am730.com.hk/news/%E5%A8%9B%E6%A8%82'),
('旅遊.飲食','https://www.am730.com.hk/news/%E6%97%85%E9%81%8A.%E9%A3%B2%E9%A3%9F')
- ] # articles =[]
+ ] # articles =[]
SectionsArticles=[]
for (title, url) in Sections:
if self.debug:
diff --git a/setup/wincross.py b/setup/wincross.py
index 00d0ae224d..ccc460169f 100644
--- a/setup/wincross.py
+++ b/setup/wincross.py
@@ -199,8 +199,7 @@ def download(dest_dir, manifest_version=17, manifest_type='release', manifest_pa
pkgs = Packages(manifest, crt_variant, arch)
os.makedirs(dest_dir, exist_ok=True)
total = sum(x.size for x in pkgs.files_to_download)
- print('Downloading', int(total/(1024*1024)), 'MB in', len(pkgs.files_to_download),
- 'files...')
+ print('Downloading', int(total/(1024*1024)), 'MB in', len(pkgs.files_to_download), 'files...')
with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor:
for _ in executor.map(partial(download_item, dest_dir), pkgs.files_to_download):
pass
diff --git a/src/calibre/devices/jetbook/driver.py b/src/calibre/devices/jetbook/driver.py
index 499ce3ed50..824467daa3 100644
--- a/src/calibre/devices/jetbook/driver.py
+++ b/src/calibre/devices/jetbook/driver.py
@@ -101,11 +101,11 @@ class MIBUK(USBMS):
class JETBOOK_MINI(USBMS):
'''
['0x4b8',
- '0x507',
- '0x100',
- 'ECTACO',
- 'ECTACO ATA/ATAPI Bridge (Bulk-Only)',
- 'Rev.0.20']
+ '0x507',
+ '0x100',
+ 'ECTACO',
+ 'ECTACO ATA/ATAPI Bridge (Bulk-Only)',
+ 'Rev.0.20']
'''
FORMATS = ['fb2', 'txt']
@@ -126,12 +126,12 @@ class JETBOOK_MINI(USBMS):
class JETBOOK_COLOR(USBMS):
'''
-set([('0x951',
- '0x160b',
- '0x0',
- 'Freescale',
- 'Mass Storage Device',
- '0802270905553')])
+ set(['0x951',
+ '0x160b',
+ '0x0',
+ 'Freescale',
+ 'Mass Storage Device',
+ '0802270905553'])
'''
FORMATS = ['epub', 'mobi', 'prc', 'fb2', 'rtf', 'txt', 'pdf', 'djvu']
diff --git a/src/calibre/devices/smart_device_app/driver.py b/src/calibre/devices/smart_device_app/driver.py
index 22196790c9..cae0266fe8 100644
--- a/src/calibre/devices/smart_device_app/driver.py
+++ b/src/calibre/devices/smart_device_app/driver.py
@@ -291,7 +291,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
'',
_('Use fixed network port') + '::: ' +
_('If checked, use the port number in the "Port" box, otherwise '
- 'the driver will pick a random port') + '
' + _('Enter the port number the driver is to use if the "fixed port" box is checked') + '
', _('Print extra debug information') + ':::' + @@ -300,52 +300,52 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): _('Comma separated list of metadata fields ' 'to turn into collections on the device.') + ':::
' + _('Possibilities include: series, tags, authors, etc' + - '. Three special collections are available: %(abt)s:%(abtv)s, ' - '%(aba)s:%(abav)s, and %(abs)s:%(absv)s. Add ' - 'these values to the list to enable them. The collections will be ' - 'given the name provided after the ":" character.')%dict( - abt='abt', abtv=ALL_BY_TITLE, aba='aba', abav=ALL_BY_AUTHOR, - abs='abs', absv=ALL_BY_SOMETHING), + '. Three special collections are available: %(abt)s:%(abtv)s, ' + '%(aba)s:%(abav)s, and %(abs)s:%(absv)s. Add ' + 'these values to the list to enable them. The collections will be ' + 'given the name provided after the ":" character.')%dict( + abt='abt', abtv=ALL_BY_TITLE, aba='aba', abav=ALL_BY_AUTHOR, + abs='abs', absv=ALL_BY_SOMETHING), '', _('Enable the no-activity timeout') + ':::
' + _('If this box is checked, calibre will automatically disconnect if ' - 'a connected device does nothing for %d minutes. Unchecking this ' - ' box disables this timeout, so calibre will never automatically ' - 'disconnect.')%(DISCONNECT_AFTER_N_SECONDS/60,) + '
', + 'a connected device does nothing for %d minutes. Unchecking this ' + ' box disables this timeout, so calibre will never automatically ' + 'disconnect.')%(DISCONNECT_AFTER_N_SECONDS/60,) + '', _('Use this IP address') + ':::' + _('Use this option if you want to force the driver to listen on a ' - 'particular IP address. The driver will listen only on the ' - 'entered address, and this address will be the one advertised ' - 'over mDNS (BonJour).') + '
', + 'particular IP address. The driver will listen only on the ' + 'entered address, and this address will be the one advertised ' + 'over mDNS (BonJour).') + '', _('Replace books with same calibre ID') + ':::' + _('Use this option to overwrite a book on the device if that book ' - 'has the same calibre identifier as the book being sent. The file name of the ' - 'book will not change even if the save template produces a ' - 'different result. Using this option in most cases prevents ' - 'having multiple copies of a book on the device.') + '
', + 'has the same calibre identifier as the book being sent. The file name of the ' + 'book will not change even if the save template produces a ' + 'different result. Using this option in most cases prevents ' + 'having multiple copies of a book on the device.') + '', _('Cover thumbnail compression quality') + ':::' + _('Use this option to control the size and quality of the cover ' - 'file sent to the device. It must be between 50 and 99. ' - 'The larger the number the higher quality the cover, but also ' - 'the larger the file. For example, changing this from 70 to 90 ' - 'results in a much better cover that is approximately 2.5 ' - 'times as big. To see the changes you must force calibre ' - 'to resend metadata to the device, either by changing ' - 'the metadata for the book (updating the last modification ' - 'time) or resending the book itself.') + '
', + 'file sent to the device. It must be between 50 and 99. ' + 'The larger the number the higher quality the cover, but also ' + 'the larger the file. For example, changing this from 70 to 90 ' + 'results in a much better cover that is approximately 2.5 ' + 'times as big. To see the changes you must force calibre ' + 'to resend metadata to the device, either by changing ' + 'the metadata for the book (updating the last modification ' + 'time) or resending the book itself.') + '', _('Use metadata cache') + ':::' + _('Setting this option allows calibre to keep a copy of metadata ' - 'on the device, speeding up device connections. Unsetting this ' - 'option disables keeping the copy, forcing the device to send ' - 'metadata to calibre on every connect. Unset this option if ' - 'you think that the cache might not be operating correctly.') + '
', + 'on the device, speeding up device connections. Unsetting this ' + 'option disables keeping the copy, forcing the device to send ' + 'metadata to calibre on every connect. Unset this option if ' + 'you think that the cache might not be operating correctly.') + '', '', _('Additional file extensions to send to the device') + ':::' + _('This is a comma-separated list of format file extensions you want ' - 'to be able to send to the device. For example, you might have ' - 'audio books in your library with the extension "m4b" that you ' - 'want to listen to on your device. Don\'t worry about the "extra ' - 'enabled extensions" warning.'), + 'to be able to send to the device. For example, you might have ' + 'audio books in your library with the extension "m4b" that you ' + 'want to listen to on your device. Don\'t worry about the "extra ' + 'enabled extensions" warning.'), _('Ignore device free space') + ':::
' +
_("Check this box to ignore the amount of free space reported by your "
"devices. This might be needed if you store books on an SD card and "
diff --git a/src/calibre/ebooks/conversion/plugins/epub_output.py b/src/calibre/ebooks/conversion/plugins/epub_output.py
index 5f06404363..d2554bedec 100644
--- a/src/calibre/ebooks/conversion/plugins/epub_output.py
+++ b/src/calibre/ebooks/conversion/plugins/epub_output.py
@@ -15,31 +15,31 @@ from calibre.ptempfile import TemporaryDirectory
from polyglot.builtins import as_bytes
block_level_tags = (
- 'address',
- 'body',
- 'blockquote',
- 'center',
- 'dir',
- 'div',
- 'dl',
- 'fieldset',
- 'form',
- 'h1',
- 'h2',
- 'h3',
- 'h4',
- 'h5',
- 'h6',
- 'hr',
- 'isindex',
- 'menu',
- 'noframes',
- 'noscript',
- 'ol',
- 'p',
- 'pre',
- 'table',
- 'ul',
+ 'address',
+ 'body',
+ 'blockquote',
+ 'center',
+ 'dir',
+ 'div',
+ 'dl',
+ 'fieldset',
+ 'form',
+ 'h1',
+ 'h2',
+ 'h3',
+ 'h4',
+ 'h5',
+ 'h6',
+ 'hr',
+ 'isindex',
+ 'menu',
+ 'noframes',
+ 'noscript',
+ 'ol',
+ 'p',
+ 'pre',
+ 'table',
+ 'ul',
)
diff --git a/src/calibre/ebooks/lrf/html/color_map.py b/src/calibre/ebooks/lrf/html/color_map.py
index 0260fd4ab4..1fc4464256 100644
--- a/src/calibre/ebooks/lrf/html/color_map.py
+++ b/src/calibre/ebooks/lrf/html/color_map.py
@@ -4,97 +4,97 @@ __copyright__ = '2008, Kovid Goyal ' + _('Check this box if this column contains names, '
- 'like the authors column. If checked, the item separator will be an ampersand '
- '(&) instead of a comma (,), sorting will be done using a computed value '
- 'that respects the author sort tweaks (for example converting "Firstname '
- 'Lastname" into "Lastname, Firstname"), and item order will be '
- 'preserved.')+'
' + _('If you check this box then the result of ' - "evaluating this column's template will be stored in the backup OPF " - 'stored in the library. The same is true when sending to a device, ' - 'assuming the format has an OPF. One reason to uncheck this box is ' - 'that the column contains large images.') + '
' + '' + - _('Note that some background functions require data for a column to ' - 'be in the OPF, for example book jackets. If you uncheck this box ' - 'and some function stops working then check the box.') + '
') + "evaluating this column's template will be stored in the backup OPF " + 'stored in the library. The same is true when sending to a device, ' + 'assuming the format has an OPF. One reason to uncheck this box is ' + 'that the column contains large images.') + '' + '' + + _('Note that some background functions require data for a column to ' + 'be in the OPF, for example book jackets. If you uncheck this box ' + 'and some function stops working then check the box.') + '
') l.addWidget(cmc) l.addStretch() add_row(None, l) diff --git a/src/calibre/gui2/store/config/chooser/models.py b/src/calibre/gui2/store/config/chooser/models.py index c4dd83dd18..04957c03e6 100644 --- a/src/calibre/gui2/store/config/chooser/models.py +++ b/src/calibre/gui2/store/config/chooser/models.py @@ -251,13 +251,13 @@ class SearchFilter(SearchQueryParser): all_locs = set(self.USABLE_LOCATIONS) - {'all'} locations = all_locs if location == 'all' else [location] q = { - 'affiliate': lambda x: x.affiliate, - 'description': lambda x: x.description.lower(), - 'drm': lambda x: not x.drm_free_only, - 'enabled': lambda x: not is_disabled(x), - 'format': lambda x: ','.join(x.formats).lower(), - 'headquarters': lambda x: x.headquarters.lower(), - 'name': lambda x : x.name.lower(), + 'affiliate': lambda x: x.affiliate, + 'description': lambda x: x.description.lower(), + 'drm': lambda x: not x.drm_free_only, + 'enabled': lambda x: not is_disabled(x), + 'format': lambda x: ','.join(x.formats).lower(), + 'headquarters': lambda x: x.headquarters.lower(), + 'name': lambda x : x.name.lower(), } q['formats'] = q['format'] upf = prefs['use_primary_find_in_search'] diff --git a/src/calibre/gui2/store/search/models.py b/src/calibre/gui2/store/search/models.py index ca8816cb4e..1a742b0eee 100644 --- a/src/calibre/gui2/store/search/models.py +++ b/src/calibre/gui2/store/search/models.py @@ -397,15 +397,15 @@ class SearchFilter(SearchQueryParser): all_locs = set(self.USABLE_LOCATIONS) - {'all'} locations = all_locs if location == 'all' else [location] q = { - 'affiliate': attrgetter('affiliate'), - 'author': lambda x: x.author.lower(), - 'cover': attrgetter('cover_url'), - 'drm': attrgetter('drm'), - 'download': attrgetter('downloads'), - 'format': attrgetter('formats'), - 'price': lambda x: comparable_price(x.price), - 'store': lambda x: x.store_name.lower(), - 'title': lambda x: x.title.lower(), + 'affiliate': attrgetter('affiliate'), + 'author': lambda x: x.author.lower(), + 'cover': attrgetter('cover_url'), + 'drm': attrgetter('drm'), + 'download': attrgetter('downloads'), + 'format': attrgetter('formats'), + 'price': lambda x: comparable_price(x.price), + 'store': lambda x: x.store_name.lower(), + 'title': lambda x: x.title.lower(), } for x in ('author', 'download', 'format'): q[x+'s'] = q[x] diff --git a/src/calibre/gui2/store/stores/mobileread/models.py b/src/calibre/gui2/store/stores/mobileread/models.py index bed3d263a0..94f1af96df 100644 --- a/src/calibre/gui2/store/stores/mobileread/models.py +++ b/src/calibre/gui2/store/stores/mobileread/models.py @@ -152,9 +152,9 @@ class SearchFilter(SearchQueryParser): all_locs = set(self.USABLE_LOCATIONS) - {'all'} locations = all_locs if location == 'all' else [location] q = { - 'author': lambda x: x.author.lower(), - 'format': attrgetter('formats'), - 'title': lambda x: x.title.lower(), + 'author': lambda x: x.author.lower(), + 'format': attrgetter('formats'), + 'title': lambda x: x.title.lower(), } for x in ('author', 'format'): q[x+'s'] = q[x] diff --git a/src/calibre/library/custom_columns.py b/src/calibre/library/custom_columns.py index 85043bc0f4..48c788e7b8 100644 --- a/src/calibre/library/custom_columns.py +++ b/src/calibre/library/custom_columns.py @@ -628,7 +628,7 @@ class CustomColumns: def clean_custom(self): st = ('DELETE FROM {table} WHERE (SELECT COUNT(id) FROM {lt} WHERE' - ' {lt}.value={table}.id) < 1;') + ' {lt}.value={table}.id) < 1;') statements = [] for data in self.custom_column_num_map.values(): if data['normalized']: diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index bce7e1f990..3ef24e6b0d 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -440,10 +440,10 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): lines.extend([custom_map[x] for x in custom_cols]) self.FIELD_MAP = {'id':0, 'title':1, 'authors':2, 'timestamp':3, - 'size':4, 'rating':5, 'tags':6, 'comments':7, 'series':8, - 'publisher':9, 'series_index':10, 'sort':11, 'author_sort':12, - 'formats':13, 'path':14, 'pubdate':15, 'uuid':16, 'cover':17, - 'au_map':18, 'last_modified':19, 'identifiers':20, 'languages':21} + 'size':4, 'rating':5, 'tags':6, 'comments':7, 'series':8, + 'publisher':9, 'series_index':10, 'sort':11, 'author_sort':12, + 'formats':13, 'path':14, 'pubdate':15, 'uuid':16, 'cover':17, + 'au_map':18, 'last_modified':19, 'identifiers':20, 'languages':21} for k,v in iteritems(self.FIELD_MAP): self.field_metadata.set_field_record_index(k, v, prefer_custom=False) diff --git a/src/calibre/linux.py b/src/calibre/linux.py index 1cffadeb35..1fa493421f 100644 --- a/src/calibre/linux.py +++ b/src/calibre/linux.py @@ -22,22 +22,22 @@ from polyglot.builtins import iteritems entry_points = { 'console_scripts': [ - 'ebook-device = calibre.devices.cli:main', - 'ebook-meta = calibre.ebooks.metadata.cli:main', - 'ebook-convert = calibre.ebooks.conversion.cli:main', - 'ebook-polish = calibre.ebooks.oeb.polish.main:main', - 'markdown-calibre = markdown.__main__:run', - 'web2disk = calibre.web.fetch.simple:main', - 'calibre-server = calibre.srv.standalone:main', - 'lrf2lrs = calibre.ebooks.lrf.lrfparser:main', - 'lrs2lrf = calibre.ebooks.lrf.lrs.convert_from:main', - 'calibre-debug = calibre.debug:main', - 'calibredb = calibre.db.cli.main:main', - 'calibre-parallel = calibre.utils.ipc.worker:main', - 'calibre-customize = calibre.customize.ui:main', - 'calibre-complete = calibre.utils.complete:main', - 'fetch-ebook-metadata = calibre.ebooks.metadata.sources.cli:main', - 'calibre-smtp = calibre.utils.smtp:main', + 'ebook-device = calibre.devices.cli:main', + 'ebook-meta = calibre.ebooks.metadata.cli:main', + 'ebook-convert = calibre.ebooks.conversion.cli:main', + 'ebook-polish = calibre.ebooks.oeb.polish.main:main', + 'markdown-calibre = markdown.__main__:run', + 'web2disk = calibre.web.fetch.simple:main', + 'calibre-server = calibre.srv.standalone:main', + 'lrf2lrs = calibre.ebooks.lrf.lrfparser:main', + 'lrs2lrf = calibre.ebooks.lrf.lrs.convert_from:main', + 'calibre-debug = calibre.debug:main', + 'calibredb = calibre.db.cli.main:main', + 'calibre-parallel = calibre.utils.ipc.worker:main', + 'calibre-customize = calibre.customize.ui:main', + 'calibre-complete = calibre.utils.complete:main', + 'fetch-ebook-metadata = calibre.ebooks.metadata.sources.cli:main', + 'calibre-smtp = calibre.utils.smtp:main', ], 'gui_scripts' : [ __appname__+' = calibre.gui_launch:calibre', diff --git a/src/calibre/utils/search_query_parser_test.py b/src/calibre/utils/search_query_parser_test.py index 41fbc289ff..58299a42c0 100644 --- a/src/calibre/utils/search_query_parser_test.py +++ b/src/calibre/utils/search_query_parser_test.py @@ -300,28 +300,28 @@ class Tester(SearchQueryParser): } tests = { - 'Dysfunction' : {348}, - 'title:Dysfunction' : {348}, - 'Title:Dysfunction' : {348}, - 'title:Dysfunction OR author:Laurie': {348, 444}, - '(tag:txt or tag:pdf)': {33, 258, 354, 305, 242, 51, 55, 56, 154}, - '(tag:txt OR tag:pdf) and author:Tolstoy': {55, 56}, - 'Tolstoy txt': {55, 56}, - 'Hamilton Amsterdam' : set(), - 'Beär' : {91}, - 'dysfunc or tolstoy': {348, 55, 56}, - 'tag:txt AND NOT tolstoy': {33, 258, 354, 305, 242, 154}, - 'not tag:lrf' : {305}, - 'london:thames': {13}, - 'publisher:london:thames': {13}, - '"(1977)"': {13}, - 'jack weatherford orc': {30}, - 'S\\"calzi': {343}, - 'author:S\\"calzi': {343}, - '"S\\"calzi"': {343}, - 'M\\\\cMurtry': {427}, - 'author:Tolstoy (tag:txt OR tag:pdf)': {55, 56}, - } + 'Dysfunction' : {348}, + 'title:Dysfunction' : {348}, + 'Title:Dysfunction' : {348}, + 'title:Dysfunction OR author:Laurie': {348, 444}, + '(tag:txt or tag:pdf)': {33, 258, 354, 305, 242, 51, 55, 56, 154}, + '(tag:txt OR tag:pdf) and author:Tolstoy': {55, 56}, + 'Tolstoy txt': {55, 56}, + 'Hamilton Amsterdam' : set(), + 'Beär' : {91}, + 'dysfunc or tolstoy': {348, 55, 56}, + 'tag:txt AND NOT tolstoy': {33, 258, 354, 305, 242, 154}, + 'not tag:lrf' : {305}, + 'london:thames': {13}, + 'publisher:london:thames': {13}, + '"(1977)"': {13}, + 'jack weatherford orc': {30}, + 'S\\"calzi': {343}, + 'author:S\\"calzi': {343}, + '"S\\"calzi"': {343}, + 'M\\\\cMurtry': {427}, + 'author:Tolstoy (tag:txt OR tag:pdf)': {55, 56}, + } fields = {'title':0, 'author':1, 'publisher':2, 'tag':3} _universal_set = set(texts.keys()) diff --git a/src/odf/namespaces.py b/src/odf/namespaces.py index 511e69ea08..93da190dc8 100644 --- a/src/odf/namespaces.py +++ b/src/odf/namespaces.py @@ -63,45 +63,45 @@ XSDNS = 'http://www.w3.org/2001/XMLSchema' XSINS = 'http://www.w3.org/2001/XMLSchema-instance' nsdict = { - ANIMNS: 'anim', - CHARTNS: 'chart', - CHARTOOONS: 'chartooo', - CONFIGNS: 'config', - CSS3TNS: 'css3t', - DBNS: 'db', - DCNS: 'dc', - DOMNS: 'dom', - DR3DNS: 'dr3d', - DRAWNS: 'draw', - FIELDNS: 'field', - FONS: 'fo', - FORMNS: 'form', - FORMXNS: 'formx', - GRDDLNS: 'grddl', - KOFFICENS: 'koffice', - MANIFESTNS: 'manifest', - MATHNS: 'math', - METANS: 'meta', - NUMBERNS: 'number', - OFFICENS: 'office', - OFNS: 'of', - OOONS: 'ooo', - OOOWNS: 'ooow', - OOOCNS: 'oooc', - PRESENTATIONNS: 'presentation', - RDFANS: 'rdfa', - RPTNS: 'rpt', - SCRIPTNS: 'script', - SMILNS: 'smil', - STYLENS: 'style', - SVGNS: 'svg', - TABLENS: 'table', - TABLEOOONS: 'tableooo', - TEXTNS: 'text', - XFORMSNS: 'xforms', - XLINKNS: 'xlink', - XHTMLNS: 'xhtml', - XMLNS: 'xml', - XSDNS: 'xsd', - XSINS: 'xsi', + ANIMNS: 'anim', + CHARTNS: 'chart', + CHARTOOONS: 'chartooo', + CONFIGNS: 'config', + CSS3TNS: 'css3t', + DBNS: 'db', + DCNS: 'dc', + DOMNS: 'dom', + DR3DNS: 'dr3d', + DRAWNS: 'draw', + FIELDNS: 'field', + FONS: 'fo', + FORMNS: 'form', + FORMXNS: 'formx', + GRDDLNS: 'grddl', + KOFFICENS: 'koffice', + MANIFESTNS: 'manifest', + MATHNS: 'math', + METANS: 'meta', + NUMBERNS: 'number', + OFFICENS: 'office', + OFNS: 'of', + OOONS: 'ooo', + OOOWNS: 'ooow', + OOOCNS: 'oooc', + PRESENTATIONNS: 'presentation', + RDFANS: 'rdfa', + RPTNS: 'rpt', + SCRIPTNS: 'script', + SMILNS: 'smil', + STYLENS: 'style', + SVGNS: 'svg', + TABLENS: 'table', + TABLEOOONS: 'tableooo', + TEXTNS: 'text', + XFORMSNS: 'xforms', + XLINKNS: 'xlink', + XHTMLNS: 'xhtml', + XMLNS: 'xml', + XSDNS: 'xsd', + XSINS: 'xsi', } diff --git a/src/odf/odf2moinmoin.py b/src/odf/odf2moinmoin.py index 56ec1f2594..f58e524309 100644 --- a/src/odf/odf2moinmoin.py +++ b/src/odf/odf2moinmoin.py @@ -161,12 +161,12 @@ class ODF2MoinMoin: # Tags self.elements = { - 'draw:page': self.textToString, - 'draw:frame': self.textToString, - 'draw:image': self.draw_image, - 'draw:text-box': self.textToString, - 'text:a': self.text_a, - 'text:note': self.text_note, + 'draw:page': self.textToString, + 'draw:frame': self.textToString, + 'draw:image': self.draw_image, + 'draw:text-box': self.textToString, + 'text:a': self.text_a, + 'text:note': self.text_note, } for tag in IGNORED_TAGS: self.elements[tag] = self.do_nothing diff --git a/src/odf/odf2xhtml.py b/src/odf/odf2xhtml.py index d70702b8f1..2cfbe333b0 100644 --- a/src/odf/odf2xhtml.py +++ b/src/odf/odf2xhtml.py @@ -347,26 +347,26 @@ class TagStack: special_styles = { - 'S-Emphasis':'em', - 'S-Citation':'cite', - 'S-Strong_20_Emphasis':'strong', - 'S-Variable':'var', - 'S-Definition':'dfn', - 'S-Teletype':'tt', - 'P-Heading_20_1':'h1', - 'P-Heading_20_2':'h2', - 'P-Heading_20_3':'h3', - 'P-Heading_20_4':'h4', - 'P-Heading_20_5':'h5', - 'P-Heading_20_6':'h6', -# 'P-Caption':'caption', - 'P-Addressee':'address', -# 'P-List_20_Heading':'dt', -# 'P-List_20_Contents':'dd', - 'P-Preformatted_20_Text':'pre', -# 'P-Table_20_Heading':'th', -# 'P-Table_20_Contents':'td', -# 'P-Text_20_body':'p' + 'S-Emphasis':'em', + 'S-Citation':'cite', + 'S-Strong_20_Emphasis':'strong', + 'S-Variable':'var', + 'S-Definition':'dfn', + 'S-Teletype':'tt', + 'P-Heading_20_1':'h1', + 'P-Heading_20_2':'h2', + 'P-Heading_20_3':'h3', + 'P-Heading_20_4':'h4', + 'P-Heading_20_5':'h5', + 'P-Heading_20_6':'h6', + # 'P-Caption':'caption', + 'P-Addressee':'address', + # 'P-List_20_Heading':'dt', + # 'P-List_20_Contents':'dd', + 'P-Preformatted_20_Text':'pre', + # 'P-Table_20_Heading':'th', + # 'P-Table_20_Contents':'td', + # 'P-Text_20_body':'p' } # ----------------------------------------------------------------------------- @@ -1123,8 +1123,8 @@ dl.notes dd:last-of-type { page-break-after: avoid } # Short prefixes for class selectors _familyshort = {'drawing-page':'DP', 'paragraph':'P', 'presentation':'PR', 'text':'S', 'section':'D', - 'table':'T', 'table-cell':'TD', 'table-column':'TC', - 'table-row':'TR', 'graphic':'G'} + 'table':'T', 'table-cell':'TD', 'table-column':'TC', + 'table-row':'TR', 'graphic':'G'} def s_style_style(self, tag, attrs): ''' Collect the formatting for the style. diff --git a/src/odf/opendocument.py b/src/odf/opendocument.py index 383d7bf95b..9a6d268a06 100644 --- a/src/odf/opendocument.py +++ b/src/odf/opendocument.py @@ -72,22 +72,22 @@ assert sys.version_info >= (2, 2) # s=content() s.addElement(s) won't eat up too much processor time. odmimetypes = { - 'application/vnd.oasis.opendocument.text': '.odt', - 'application/vnd.oasis.opendocument.text-template': '.ott', - 'application/vnd.oasis.opendocument.graphics': '.odg', - 'application/vnd.oasis.opendocument.graphics-template': '.otg', - 'application/vnd.oasis.opendocument.presentation': '.odp', - 'application/vnd.oasis.opendocument.presentation-template': '.otp', - 'application/vnd.oasis.opendocument.spreadsheet': '.ods', - 'application/vnd.oasis.opendocument.spreadsheet-template': '.ots', - 'application/vnd.oasis.opendocument.chart': '.odc', - 'application/vnd.oasis.opendocument.chart-template': '.otc', - 'application/vnd.oasis.opendocument.image': '.odi', - 'application/vnd.oasis.opendocument.image-template': '.oti', - 'application/vnd.oasis.opendocument.formula': '.odf', - 'application/vnd.oasis.opendocument.formula-template': '.otf', - 'application/vnd.oasis.opendocument.text-master': '.odm', - 'application/vnd.oasis.opendocument.text-web': '.oth', + 'application/vnd.oasis.opendocument.text': '.odt', + 'application/vnd.oasis.opendocument.text-template': '.ott', + 'application/vnd.oasis.opendocument.graphics': '.odg', + 'application/vnd.oasis.opendocument.graphics-template': '.otg', + 'application/vnd.oasis.opendocument.presentation': '.odp', + 'application/vnd.oasis.opendocument.presentation-template': '.otp', + 'application/vnd.oasis.opendocument.spreadsheet': '.ods', + 'application/vnd.oasis.opendocument.spreadsheet-template': '.ots', + 'application/vnd.oasis.opendocument.chart': '.odc', + 'application/vnd.oasis.opendocument.chart-template': '.otc', + 'application/vnd.oasis.opendocument.image': '.odi', + 'application/vnd.oasis.opendocument.image-template': '.oti', + 'application/vnd.oasis.opendocument.formula': '.odf', + 'application/vnd.oasis.opendocument.formula-template': '.otf', + 'application/vnd.oasis.opendocument.text-master': '.odm', + 'application/vnd.oasis.opendocument.text-web': '.oth', }