code indentation (extra-edit)

This commit is contained in:
un-pogaz 2025-01-24 11:14:21 +01:00
parent 8032201318
commit 0b23eaf328
27 changed files with 486 additions and 489 deletions

View File

@ -40,18 +40,17 @@ class AdvancedUserRecipe1294946868(BasicNewsRecipe):
] ]
remove_tags_before = dict(name='ul', attrs={'class': ['servicios-sub']}) remove_tags_before = dict(name='ul', attrs={'class': ['servicios-sub']})
remove_tags_after = dict( remove_tags_after = dict(name='div', attrs={'class': ['related-news', 'col']})
name='div', attrs={'class': ['related-news', 'col']})
remove_tags = [ 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 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 = ''' extra_css = '''
p{text-align: justify; font-size: 100%} p{text-align: justify; font-size: 100%}
body{ text-align: left; font-size:100% } body{ text-align: left; font-size:100% }
h3{font-family: sans-serif; font-size:150%; font-weight:bold; text-align: justify; } h3{font-family: sans-serif; font-size:150%; font-weight:bold; text-align: justify; }
''' '''
preprocess_regexps = [(re.compile( preprocess_regexps = [(re.compile(
r'<a href="http://estaticos.*?[0-999]px;" target="_blank">', re.DOTALL), lambda m: '')] r'<a href="http://estaticos.*?[0-999]px;" target="_blank">', re.DOTALL), lambda m: '')]

View File

@ -9,8 +9,7 @@ from calibre.web.feeds.recipes import BasicNewsRecipe
def classes(classes): def classes(classes):
q = frozenset(classes.split(' ')) q = frozenset(classes.split(' '))
return dict(attrs={ return dict(attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)})
'class': lambda x: x and frozenset(x.split()).intersection(q)})
class Minutes(BasicNewsRecipe): class Minutes(BasicNewsRecipe):

View File

@ -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/%E9%AB%94%E8%82%B2'),
('娛樂','https://www.am730.com.hk/news/%E5%A8%9B%E6%A8%82'), ('娛樂','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') ('旅遊.飲食','https://www.am730.com.hk/news/%E6%97%85%E9%81%8A.%E9%A3%B2%E9%A3%9F')
] # articles =[] ] # articles =[]
SectionsArticles=[] SectionsArticles=[]
for (title, url) in Sections: for (title, url) in Sections:
if self.debug: if self.debug:

View File

@ -199,8 +199,7 @@ def download(dest_dir, manifest_version=17, manifest_type='release', manifest_pa
pkgs = Packages(manifest, crt_variant, arch) pkgs = Packages(manifest, crt_variant, arch)
os.makedirs(dest_dir, exist_ok=True) os.makedirs(dest_dir, exist_ok=True)
total = sum(x.size for x in pkgs.files_to_download) total = sum(x.size for x in pkgs.files_to_download)
print('Downloading', int(total/(1024*1024)), 'MB in', len(pkgs.files_to_download), print('Downloading', int(total/(1024*1024)), 'MB in', len(pkgs.files_to_download), 'files...')
'files...')
with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor: with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor:
for _ in executor.map(partial(download_item, dest_dir), pkgs.files_to_download): for _ in executor.map(partial(download_item, dest_dir), pkgs.files_to_download):
pass pass

View File

@ -101,11 +101,11 @@ class MIBUK(USBMS):
class JETBOOK_MINI(USBMS): class JETBOOK_MINI(USBMS):
''' '''
['0x4b8', ['0x4b8',
'0x507', '0x507',
'0x100', '0x100',
'ECTACO', 'ECTACO',
'ECTACO ATA/ATAPI Bridge (Bulk-Only)', 'ECTACO ATA/ATAPI Bridge (Bulk-Only)',
'Rev.0.20'] 'Rev.0.20']
''' '''
FORMATS = ['fb2', 'txt'] FORMATS = ['fb2', 'txt']
@ -126,12 +126,12 @@ class JETBOOK_MINI(USBMS):
class JETBOOK_COLOR(USBMS): class JETBOOK_COLOR(USBMS):
''' '''
set([('0x951', set(['0x951',
'0x160b', '0x160b',
'0x0', '0x0',
'Freescale', 'Freescale',
'Mass Storage Device', 'Mass Storage Device',
'0802270905553')]) '0802270905553'])
''' '''
FORMATS = ['epub', 'mobi', 'prc', 'fb2', 'rtf', 'txt', 'pdf', 'djvu'] FORMATS = ['epub', 'mobi', 'prc', 'fb2', 'rtf', 'txt', 'pdf', 'djvu']

View File

@ -291,7 +291,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
'', '',
_('Use fixed network port') + ':::<p>' + _('Use fixed network port') + ':::<p>' +
_('If checked, use the port number in the "Port" box, otherwise ' _('If checked, use the port number in the "Port" box, otherwise '
'the driver will pick a random port') + '</p>', 'the driver will pick a random port') + '</p>',
_('Port number: ') + ':::<p>' + _('Port number: ') + ':::<p>' +
_('Enter the port number the driver is to use if the "fixed port" box is checked') + '</p>', _('Enter the port number the driver is to use if the "fixed port" box is checked') + '</p>',
_('Print extra debug information') + ':::<p>' + _('Print extra debug information') + ':::<p>' +
@ -300,52 +300,52 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
_('Comma separated list of metadata fields ' _('Comma separated list of metadata fields '
'to turn into collections on the device.') + ':::<p>' + 'to turn into collections on the device.') + ':::<p>' +
_('Possibilities include: series, tags, authors, etc' + _('Possibilities include: series, tags, authors, etc' +
'. Three special collections are available: %(abt)s:%(abtv)s, ' '. Three special collections are available: %(abt)s:%(abtv)s, '
'%(aba)s:%(abav)s, and %(abs)s:%(absv)s. Add ' '%(aba)s:%(abav)s, and %(abs)s:%(absv)s. Add '
'these values to the list to enable them. The collections will be ' 'these values to the list to enable them. The collections will be '
'given the name provided after the ":" character.')%dict( 'given the name provided after the ":" character.')%dict(
abt='abt', abtv=ALL_BY_TITLE, aba='aba', abav=ALL_BY_AUTHOR, abt='abt', abtv=ALL_BY_TITLE, aba='aba', abav=ALL_BY_AUTHOR,
abs='abs', absv=ALL_BY_SOMETHING), abs='abs', absv=ALL_BY_SOMETHING),
'', '',
_('Enable the no-activity timeout') + ':::<p>' + _('Enable the no-activity timeout') + ':::<p>' +
_('If this box is checked, calibre will automatically disconnect if ' _('If this box is checked, calibre will automatically disconnect if '
'a connected device does nothing for %d minutes. Unchecking this ' 'a connected device does nothing for %d minutes. Unchecking this '
' box disables this timeout, so calibre will never automatically ' ' box disables this timeout, so calibre will never automatically '
'disconnect.')%(DISCONNECT_AFTER_N_SECONDS/60,) + '</p>', 'disconnect.')%(DISCONNECT_AFTER_N_SECONDS/60,) + '</p>',
_('Use this IP address') + ':::<p>' + _('Use this IP address') + ':::<p>' +
_('Use this option if you want to force the driver to listen on a ' _('Use this option if you want to force the driver to listen on a '
'particular IP address. The driver will listen only on the ' 'particular IP address. The driver will listen only on the '
'entered address, and this address will be the one advertised ' 'entered address, and this address will be the one advertised '
'over mDNS (BonJour).') + '</p>', 'over mDNS (BonJour).') + '</p>',
_('Replace books with same calibre ID') + ':::<p>' + _('Replace books with same calibre ID') + ':::<p>' +
_('Use this option to overwrite a book on the device if that book ' _('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 ' '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 ' 'book will not change even if the save template produces a '
'different result. Using this option in most cases prevents ' 'different result. Using this option in most cases prevents '
'having multiple copies of a book on the device.') + '</p>', 'having multiple copies of a book on the device.') + '</p>',
_('Cover thumbnail compression quality') + ':::<p>' + _('Cover thumbnail compression quality') + ':::<p>' +
_('Use this option to control the size and quality of the cover ' _('Use this option to control the size and quality of the cover '
'file sent to the device. It must be between 50 and 99. ' '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 number the higher quality the cover, but also '
'the larger the file. For example, changing this from 70 to 90 ' 'the larger the file. For example, changing this from 70 to 90 '
'results in a much better cover that is approximately 2.5 ' 'results in a much better cover that is approximately 2.5 '
'times as big. To see the changes you must force calibre ' 'times as big. To see the changes you must force calibre '
'to resend metadata to the device, either by changing ' 'to resend metadata to the device, either by changing '
'the metadata for the book (updating the last modification ' 'the metadata for the book (updating the last modification '
'time) or resending the book itself.') + '</p>', 'time) or resending the book itself.') + '</p>',
_('Use metadata cache') + ':::<p>' + _('Use metadata cache') + ':::<p>' +
_('Setting this option allows calibre to keep a copy of metadata ' _('Setting this option allows calibre to keep a copy of metadata '
'on the device, speeding up device connections. Unsetting this ' 'on the device, speeding up device connections. Unsetting this '
'option disables keeping the copy, forcing the device to send ' 'option disables keeping the copy, forcing the device to send '
'metadata to calibre on every connect. Unset this option if ' 'metadata to calibre on every connect. Unset this option if '
'you think that the cache might not be operating correctly.') + '</p>', 'you think that the cache might not be operating correctly.') + '</p>',
'', '',
_('Additional file extensions to send to the device') + ':::<p>' + _('Additional file extensions to send to the device') + ':::<p>' +
_('This is a comma-separated list of format file extensions you want ' _('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 ' 'to be able to send to the device. For example, you might have '
'audio books in your library with the extension "m4b" that you ' 'audio books in your library with the extension "m4b" that you '
'want to listen to on your device. Don\'t worry about the "extra ' 'want to listen to on your device. Don\'t worry about the "extra '
'enabled extensions" warning.'), 'enabled extensions" warning.'),
_('Ignore device free space') + ':::<p>' + _('Ignore device free space') + ':::<p>' +
_("Check this box to ignore the amount of free space reported by your " _("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 " "devices. This might be needed if you store books on an SD card and "

View File

@ -15,31 +15,31 @@ from calibre.ptempfile import TemporaryDirectory
from polyglot.builtins import as_bytes from polyglot.builtins import as_bytes
block_level_tags = ( block_level_tags = (
'address', 'address',
'body', 'body',
'blockquote', 'blockquote',
'center', 'center',
'dir', 'dir',
'div', 'div',
'dl', 'dl',
'fieldset', 'fieldset',
'form', 'form',
'h1', 'h1',
'h2', 'h2',
'h3', 'h3',
'h4', 'h4',
'h5', 'h5',
'h6', 'h6',
'hr', 'hr',
'isindex', 'isindex',
'menu', 'menu',
'noframes', 'noframes',
'noscript', 'noscript',
'ol', 'ol',
'p', 'p',
'pre', 'pre',
'table', 'table',
'ul', 'ul',
) )

View File

@ -4,97 +4,97 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
import re import re
NAME_MAP = { NAME_MAP = {
'aliceblue': '#F0F8FF', 'aliceblue': '#F0F8FF',
'antiquewhite': '#FAEBD7', 'antiquewhite': '#FAEBD7',
'aqua': '#00FFFF', 'aqua': '#00FFFF',
'aquamarine': '#7FFFD4', 'aquamarine': '#7FFFD4',
'azure': '#F0FFFF', 'azure': '#F0FFFF',
'beige': '#F5F5DC', 'beige': '#F5F5DC',
'bisque': '#FFE4C4', 'bisque': '#FFE4C4',
'black': '#000000', 'black': '#000000',
'blanchedalmond': '#FFEBCD', 'blanchedalmond': '#FFEBCD',
'blue': '#0000FF', 'blue': '#0000FF',
'brown': '#A52A2A', 'brown': '#A52A2A',
'burlywood': '#DEB887', 'burlywood': '#DEB887',
'cadetblue': '#5F9EA0', 'cadetblue': '#5F9EA0',
'chartreuse': '#7FFF00', 'chartreuse': '#7FFF00',
'chocolate': '#D2691E', 'chocolate': '#D2691E',
'coral': '#FF7F50', 'coral': '#FF7F50',
'crimson': '#DC143C', 'crimson': '#DC143C',
'cyan': '#00FFFF', 'cyan': '#00FFFF',
'darkblue': '#00008B', 'darkblue': '#00008B',
'darkgoldenrod': '#B8860B', 'darkgoldenrod': '#B8860B',
'darkgreen': '#006400', 'darkgreen': '#006400',
'darkkhaki': '#BDB76B', 'darkkhaki': '#BDB76B',
'darkmagenta': '#8B008B', 'darkmagenta': '#8B008B',
'darkolivegreen': '#556B2F', 'darkolivegreen': '#556B2F',
'darkorange': '#FF8C00', 'darkorange': '#FF8C00',
'darkorchid': '#9932CC', 'darkorchid': '#9932CC',
'darkred': '#8B0000', 'darkred': '#8B0000',
'darksalmon': '#E9967A', 'darksalmon': '#E9967A',
'darkslateblue': '#483D8B', 'darkslateblue': '#483D8B',
'darkslategrey': '#2F4F4F', 'darkslategrey': '#2F4F4F',
'darkviolet': '#9400D3', 'darkviolet': '#9400D3',
'deeppink': '#FF1493', 'deeppink': '#FF1493',
'dodgerblue': '#1E90FF', 'dodgerblue': '#1E90FF',
'firebrick': '#B22222', 'firebrick': '#B22222',
'floralwhite': '#FFFAF0', 'floralwhite': '#FFFAF0',
'forestgreen': '#228B22', 'forestgreen': '#228B22',
'fuchsia': '#FF00FF', 'fuchsia': '#FF00FF',
'gainsboro': '#DCDCDC', 'gainsboro': '#DCDCDC',
'ghostwhite': '#F8F8FF', 'ghostwhite': '#F8F8FF',
'gold': '#FFD700', 'gold': '#FFD700',
'goldenrod': '#DAA520', 'goldenrod': '#DAA520',
'indianred ': '#CD5C5C', 'indianred ': '#CD5C5C',
'indigo ': '#4B0082', 'indigo ': '#4B0082',
'khaki': '#F0E68C', 'khaki': '#F0E68C',
'lavenderblush': '#FFF0F5', 'lavenderblush': '#FFF0F5',
'lawngreen': '#7CFC00', 'lawngreen': '#7CFC00',
'lightblue': '#ADD8E6', 'lightblue': '#ADD8E6',
'lightcoral': '#F08080', 'lightcoral': '#F08080',
'lightgoldenrodyellow': '#FAFAD2', 'lightgoldenrodyellow': '#FAFAD2',
'lightgray': '#D3D3D3', 'lightgray': '#D3D3D3',
'lightgrey': '#D3D3D3', 'lightgrey': '#D3D3D3',
'lightskyblue': '#87CEFA', 'lightskyblue': '#87CEFA',
'lightslategrey': '#778899', 'lightslategrey': '#778899',
'lightsteelblue': '#B0C4DE', 'lightsteelblue': '#B0C4DE',
'lime': '#87CEFA', 'lime': '#87CEFA',
'linen': '#FAF0E6', 'linen': '#FAF0E6',
'magenta': '#FF00FF', 'magenta': '#FF00FF',
'maroon': '#800000', 'maroon': '#800000',
'mediumaquamarine': '#66CDAA', 'mediumaquamarine': '#66CDAA',
'mediumblue': '#0000CD', 'mediumblue': '#0000CD',
'mediumorchid': '#BA55D3', 'mediumorchid': '#BA55D3',
'mediumpurple': '#9370D8', 'mediumpurple': '#9370D8',
'mediumseagreen': '#3CB371', 'mediumseagreen': '#3CB371',
'mediumslateblue': '#7B68EE', 'mediumslateblue': '#7B68EE',
'midnightblue': '#191970', 'midnightblue': '#191970',
'moccasin': '#FFE4B5', 'moccasin': '#FFE4B5',
'navajowhite': '#FFDEAD', 'navajowhite': '#FFDEAD',
'navy': '#000080', 'navy': '#000080',
'oldlace': '#FDF5E6', 'oldlace': '#FDF5E6',
'olive': '#808000', 'olive': '#808000',
'orange': '#FFA500', 'orange': '#FFA500',
'orangered': '#FF4500', 'orangered': '#FF4500',
'orchid': '#DA70D6', 'orchid': '#DA70D6',
'paleturquoise': '#AFEEEE', 'paleturquoise': '#AFEEEE',
'papayawhip': '#FFEFD5', 'papayawhip': '#FFEFD5',
'peachpuff': '#FFDAB9', 'peachpuff': '#FFDAB9',
'powderblue': '#B0E0E6', 'powderblue': '#B0E0E6',
'rosybrown': '#BC8F8F', 'rosybrown': '#BC8F8F',
'royalblue': '#4169E1', 'royalblue': '#4169E1',
'saddlebrown': '#8B4513', 'saddlebrown': '#8B4513',
'sandybrown': '#8B4513', 'sandybrown': '#8B4513',
'seashell': '#FFF5EE', 'seashell': '#FFF5EE',
'sienna': '#A0522D', 'sienna': '#A0522D',
'silver': '#C0C0C0', 'silver': '#C0C0C0',
'skyblue': '#87CEEB', 'skyblue': '#87CEEB',
'slategrey': '#708090', 'slategrey': '#708090',
'snow': '#FFFAFA', 'snow': '#FFFAFA',
'springgreen': '#00FF7F', 'springgreen': '#00FF7F',
'violet': '#EE82EE', 'violet': '#EE82EE',
'yellowgreen': '#9ACD32' 'yellowgreen': '#9ACD32'
} }
hex_pat = re.compile(r'#(\d{2})(\d{2})(\d{2})') hex_pat = re.compile(r'#(\d{2})(\d{2})(\d{2})')
rgb_pat = re.compile(r'rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)', re.IGNORECASE) rgb_pat = re.compile(r'rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)', re.IGNORECASE)

View File

@ -196,28 +196,28 @@ class HTMLConverter:
object.__setattr__(self, attr, val) object.__setattr__(self, attr, val)
CSS = { CSS = {
'h1' : {'font-size' : 'xx-large', 'font-weight':'bold', 'text-indent':'0pt'}, 'h1' : {'font-size' : 'xx-large', 'font-weight':'bold', 'text-indent':'0pt'},
'h2' : {'font-size' : 'x-large', 'font-weight':'bold', 'text-indent':'0pt'}, 'h2' : {'font-size' : 'x-large', 'font-weight':'bold', 'text-indent':'0pt'},
'h3' : {'font-size' : 'large', 'font-weight':'bold', 'text-indent':'0pt'}, 'h3' : {'font-size' : 'large', 'font-weight':'bold', 'text-indent':'0pt'},
'h4' : {'font-size' : 'large', 'text-indent':'0pt'}, 'h4' : {'font-size' : 'large', 'text-indent':'0pt'},
'h5' : {'font-weight' : 'bold', 'text-indent':'0pt'}, 'h5' : {'font-weight' : 'bold', 'text-indent':'0pt'},
'b' : {'font-weight' : 'bold'}, 'b' : {'font-weight' : 'bold'},
'strong' : {'font-weight' : 'bold'}, 'strong' : {'font-weight' : 'bold'},
'i' : {'font-style' : 'italic'}, 'i' : {'font-style' : 'italic'},
'cite' : {'font-style' : 'italic'}, 'cite' : {'font-style' : 'italic'},
'em' : {'font-style' : 'italic'}, 'em' : {'font-style' : 'italic'},
'small' : {'font-size' : 'small'}, 'small' : {'font-size' : 'small'},
'pre' : {'font-family' : 'monospace', 'white-space': 'pre'}, 'pre' : {'font-family' : 'monospace', 'white-space': 'pre'},
'code' : {'font-family' : 'monospace'}, 'code' : {'font-family' : 'monospace'},
'tt' : {'font-family' : 'monospace'}, 'tt' : {'font-family' : 'monospace'},
'center' : {'text-align' : 'center'}, 'center' : {'text-align' : 'center'},
'th' : {'font-size' : 'large', 'font-weight':'bold'}, 'th' : {'font-size' : 'large', 'font-weight':'bold'},
'big' : {'font-size' : 'large', 'font-weight':'bold'}, 'big' : {'font-size' : 'large', 'font-weight':'bold'},
'.libprs500_dropcaps' : {'font-size': 'xx-large'}, '.libprs500_dropcaps' : {'font-size': 'xx-large'},
'u' : {'text-decoration': 'underline'}, 'u' : {'text-decoration': 'underline'},
'sup' : {'vertical-align': 'super', 'font-size': '60%'}, 'sup' : {'vertical-align': 'super', 'font-size': '60%'},
'sub' : {'vertical-align': 'sub', 'font-size': '60%'}, 'sub' : {'vertical-align': 'sub', 'font-size': '60%'},
} }
def __init__(self, book, fonts, options, logger, paths): def __init__(self, book, fonts, options, logger, paths):
''' '''

View File

@ -80,15 +80,15 @@ class LrsParser:
def text_tag_to_element(self, tag): def text_tag_to_element(self, tag):
map = { map = {
'span' : Span, 'span' : Span,
'italic' : Italic, 'italic' : Italic,
'bold' : Bold, 'bold' : Bold,
'empline' : EmpLine, 'empline' : EmpLine,
'sup' : Sup, 'sup' : Sup,
'sub' : Sub, 'sub' : Sub,
'cr' : CR, 'cr' : CR,
'drawchar': DropCaps, 'drawchar': DropCaps,
} }
if tag.name == 'charbutton': if tag.name == 'charbutton':
return CharButton(self.parsed_objects[tag.get('refobj')], None) return CharButton(self.parsed_objects[tag.get('refobj')], None)
if tag.name == 'plot': if tag.name == 'plot':

View File

@ -1344,7 +1344,7 @@ class Amazon(Source):
terms = [] terms = []
q = {'search-alias': 'aps', q = {'search-alias': 'aps',
'unfiltered': '1', 'unfiltered': '1',
} }
if domain == 'com': if domain == 'com':
q['sort'] = 'relevanceexprank' q['sort'] = 'relevanceexprank'

View File

@ -58,8 +58,8 @@ def stretch_as_number(val):
pass pass
try: try:
return ('ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', return ('ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed',
'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'normal', 'semi-expanded', 'expanded', 'extra-expanded',
'ultra-expanded').index(val) 'ultra-expanded').index(val)
except Exception: except Exception:
return 4 # normal return 4 # normal

View File

@ -90,50 +90,50 @@ def collect_properties(container):
guide_epubtype_map = { guide_epubtype_map = {
'acknowledgements' : 'acknowledgments', 'acknowledgements' : 'acknowledgments',
'other.afterword' : 'afterword', 'other.afterword' : 'afterword',
'other.appendix' : 'appendix', 'other.appendix' : 'appendix',
'other.backmatter' : 'backmatter', 'other.backmatter' : 'backmatter',
'bibliography' : 'bibliography', 'bibliography' : 'bibliography',
'text' : 'bodymatter', 'text' : 'bodymatter',
'other.chapter' : 'chapter', 'other.chapter' : 'chapter',
'colophon' : 'colophon', 'colophon' : 'colophon',
'other.conclusion' : 'conclusion', 'other.conclusion' : 'conclusion',
'other.contributors' : 'contributors', 'other.contributors' : 'contributors',
'copyright-page' : 'copyright-page', 'copyright-page' : 'copyright-page',
'cover' : 'cover', 'cover' : 'cover',
'dedication' : 'dedication', 'dedication' : 'dedication',
'other.division' : 'division', 'other.division' : 'division',
'epigraph' : 'epigraph', 'epigraph' : 'epigraph',
'other.epilogue' : 'epilogue', 'other.epilogue' : 'epilogue',
'other.errata' : 'errata', 'other.errata' : 'errata',
'other.footnotes' : 'footnotes', 'other.footnotes' : 'footnotes',
'foreword' : 'foreword', 'foreword' : 'foreword',
'other.frontmatter' : 'frontmatter', 'other.frontmatter' : 'frontmatter',
'glossary' : 'glossary', 'glossary' : 'glossary',
'other.halftitlepage': 'halftitlepage', 'other.halftitlepage': 'halftitlepage',
'other.imprint' : 'imprint', 'other.imprint' : 'imprint',
'other.imprimatur' : 'imprimatur', 'other.imprimatur' : 'imprimatur',
'index' : 'index', 'index' : 'index',
'other.introduction' : 'introduction', 'other.introduction' : 'introduction',
'other.landmarks' : 'landmarks', 'other.landmarks' : 'landmarks',
'other.loa' : 'loa', 'other.loa' : 'loa',
'loi' : 'loi', 'loi' : 'loi',
'lot' : 'lot', 'lot' : 'lot',
'other.lov' : 'lov', 'other.lov' : 'lov',
'notes' : '', 'notes' : '',
'other.notice' : 'notice', 'other.notice' : 'notice',
'other.other-credits': 'other-credits', 'other.other-credits': 'other-credits',
'other.part' : 'part', 'other.part' : 'part',
'other.preamble' : 'preamble', 'other.preamble' : 'preamble',
'preface' : 'preface', 'preface' : 'preface',
'other.prologue' : 'prologue', 'other.prologue' : 'prologue',
'other.rearnotes' : 'rearnotes', 'other.rearnotes' : 'rearnotes',
'other.subchapter' : 'subchapter', 'other.subchapter' : 'subchapter',
'title-page' : 'titlepage', 'title-page' : 'titlepage',
'toc' : 'toc', 'toc' : 'toc',
'other.volume' : 'volume', 'other.volume' : 'volume',
'other.warning' : 'warning' 'other.warning' : 'warning'
} }

View File

@ -1721,76 +1721,76 @@ CODEPOINTS = {
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
], ],
'x1d4':[ 'x1d4':[
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e', 'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e',
'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u', 'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u',
'v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K', 'v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K',
'L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a', 'L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a',
'b','c','d','e','f','g','','i','j','k','l','m','n','o','p','q', 'b','c','d','e','f','g','','i','j','k','l','m','n','o','p','q',
'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G', 'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G',
'H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W', 'H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W',
'X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m', 'X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m',
'n','o','p','q','r','s','t','u','v','w','x','y','z','A','','C', 'n','o','p','q','r','s','t','u','v','w','x','y','z','A','','C',
'D','','','G','','','J','K','','','N','O','P','Q','','S', 'D','','','G','','','J','K','','','N','O','P','Q','','S',
'T','U','V','W','X','Y','Z','a','b','c','d','','f','','h','i', 'T','U','V','W','X','Y','Z','a','b','c','d','','f','','h','i',
'j','k','l','m','n','','p','q','r','s','t','u','v','w','x','y', 'j','k','l','m','n','','p','q','r','s','t','u','v','w','x','y',
'z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', 'z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e', 'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e',
'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v' 'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v'
], ],
'x1d5':[ 'x1d5':[
'w','x','y','z','A','B','','D','E','F','G','','','J','K', 'w','x','y','z','A','B','','D','E','F','G','','','J','K',
'L','M','N','O','P','Q','','S','T','U','V','W','X','Y','','a', 'L','M','N','O','P','Q','','S','T','U','V','W','X','Y','','a',
'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q', 'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
'r','s','t','u','v','w','x','y','z','A','B','','D','E','F','G', 'r','s','t','u','v','w','x','y','z','A','B','','D','E','F','G',
'','I','J','K','L','M','','O','','','','S','T','U','V','W', '','I','J','K','L','M','','O','','','','S','T','U','V','W',
'X','Y','','a','b','c','d','e','f','g','h','i','j','k','l','m', 'X','Y','','a','b','c','d','e','f','g','h','i','j','k','l','m',
'n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C', 'n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C',
'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S', 'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S',
'T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i', 'T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i',
'j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y', 'j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y',
'z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', 'z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e', 'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e',
'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u', 'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u',
'v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K', 'v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K',
'L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a', 'L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a',
'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r' 'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r'
], ],
'x1d6':[ 'x1d6':[
's','t','u','v','w','x','y','z','A','B','C','D','E','F','G', 's','t','u','v','w','x','y','z','A','B','C','D','E','F','G',
'H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W', 'H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W',
'X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m', 'X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m',
'n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C', 'n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C',
'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S', 'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S',
'T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i', 'T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i',
'j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y', 'j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y',
'z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', 'z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e', 'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e',
'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u', 'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u',
'v','w','x','y','z','i','j','','','Alpha','Beta','Gamma','Delta','Epsilon','Zeta','Eta', 'v','w','x','y','z','i','j','','','Alpha','Beta','Gamma','Delta','Epsilon','Zeta','Eta',
'Theta','Iota','Kappa','Lamda','Mu','Nu','Xi','Omicron','Pi','Rho','Theta','Sigma','Tau','Upsilon','Phi','Chi', 'Theta','Iota','Kappa','Lamda','Mu','Nu','Xi','Omicron','Pi','Rho','Theta','Sigma','Tau','Upsilon','Phi','Chi',
'Psi','Omega','nabla','alpha','beta','gamma','delta','epsilon','zeta','eta','theta','iota','kappa','lamda','mu','nu', 'Psi','Omega','nabla','alpha','beta','gamma','delta','epsilon','zeta','eta','theta','iota','kappa','lamda','mu','nu',
'xi','omicron','pi','rho','sigma','sigma','tai','upsilon','phi','chi','psi','omega','','','','', 'xi','omicron','pi','rho','sigma','sigma','tai','upsilon','phi','chi','psi','omega','','','','',
'','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','','' '','','','','','','','','','','','','','','','',''
], ],
'x1d7':[ 'x1d7':[
'','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','0', '','','','','','','','','','','','','','','','0',
'1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6', '1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6',
'7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2', '7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2',
'3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9' '3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9'
] ]
} }

View File

@ -1392,13 +1392,13 @@ class OnDeviceSearch(SearchQueryParser): # {{{
all_locs = set(self.USABLE_LOCATIONS) - {'all', 'tags', 'search'} all_locs = set(self.USABLE_LOCATIONS) - {'all', 'tags', 'search'}
locations = all_locs if location == 'all' else [location] locations = all_locs if location == 'all' else [location]
q = { q = {
'title' : lambda x : getattr(x, 'title').lower(), 'title' : lambda x : getattr(x, 'title').lower(),
'author': lambda x: ' & '.join(getattr(x, 'authors')).lower(), 'author': lambda x: ' & '.join(getattr(x, 'authors')).lower(),
'collections':lambda x: ','.join(getattr(x, 'device_collections')).lower(), 'collections':lambda x: ','.join(getattr(x, 'device_collections')).lower(),
'format':lambda x: os.path.splitext(x.path)[1].lower(), 'format':lambda x: os.path.splitext(x.path)[1].lower(),
'inlibrary':lambda x : getattr(x, 'in_library'), 'inlibrary':lambda x : getattr(x, 'in_library'),
'tags':lambda x : getattr(x, 'tags', []) 'tags':lambda x : getattr(x, 'tags', [])
} }
for x in ('author', 'format'): for x in ('author', 'format'):
q[x+'s'] = q[x] q[x+'s'] = q[x]
upf = prefs['use_primary_find_in_search'] upf = prefs['use_primary_find_in_search']

View File

@ -348,11 +348,11 @@ class CreateCustomColumn(QDialog):
h.addWidget(ud) h.addWidget(ud)
self.is_names = ins = QCheckBox(_('Contains names'), self) self.is_names = ins = QCheckBox(_('Contains names'), self)
ins.setToolTip('<p>' + _('Check this box if this column contains names, ' ins.setToolTip('<p>' + _('Check this box if this column contains names, '
'like the authors column. If checked, the item separator will be an ampersand ' '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 ' '(&) instead of a comma (,), sorting will be done using a computed value '
'that respects the author sort tweaks (for example converting "Firstname ' 'that respects the author sort tweaks (for example converting "Firstname '
'Lastname" into "Lastname, Firstname"), and item order will be ' 'Lastname" into "Lastname, Firstname"), and item order will be '
'preserved.')+'</p>') 'preserved.')+'</p>')
h.addWidget(ins) h.addWidget(ins)
add_row(_('&Column type:'), h) add_row(_('&Column type:'), h)
@ -513,13 +513,13 @@ class CreateCustomColumn(QDialog):
l = QHBoxLayout() l = QHBoxLayout()
self.store_template_value_in_opf = cmc = QCheckBox(_("Store this column's value in an OPF")) self.store_template_value_in_opf = cmc = QCheckBox(_("Store this column's value in an OPF"))
cmc.setToolTip('<p>' + _('If you check this box then the result of ' cmc.setToolTip('<p>' + _('If you check this box then the result of '
"evaluating this column's template will be stored in the backup OPF " "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, ' '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 ' 'assuming the format has an OPF. One reason to uncheck this box is '
'that the column contains large images.') + '</p>' + '<p>' + 'that the column contains large images.') + '</p>' + '<p>' +
_('Note that some background functions require data for a column to ' _('Note that some background functions require data for a column to '
'be in the OPF, for example book jackets. If you uncheck this box ' 'be in the OPF, for example book jackets. If you uncheck this box '
'and some function stops working then check the box.') + '</p>') 'and some function stops working then check the box.') + '</p>')
l.addWidget(cmc) l.addWidget(cmc)
l.addStretch() l.addStretch()
add_row(None, l) add_row(None, l)

View File

@ -251,13 +251,13 @@ class SearchFilter(SearchQueryParser):
all_locs = set(self.USABLE_LOCATIONS) - {'all'} all_locs = set(self.USABLE_LOCATIONS) - {'all'}
locations = all_locs if location == 'all' else [location] locations = all_locs if location == 'all' else [location]
q = { q = {
'affiliate': lambda x: x.affiliate, 'affiliate': lambda x: x.affiliate,
'description': lambda x: x.description.lower(), 'description': lambda x: x.description.lower(),
'drm': lambda x: not x.drm_free_only, 'drm': lambda x: not x.drm_free_only,
'enabled': lambda x: not is_disabled(x), 'enabled': lambda x: not is_disabled(x),
'format': lambda x: ','.join(x.formats).lower(), 'format': lambda x: ','.join(x.formats).lower(),
'headquarters': lambda x: x.headquarters.lower(), 'headquarters': lambda x: x.headquarters.lower(),
'name': lambda x : x.name.lower(), 'name': lambda x : x.name.lower(),
} }
q['formats'] = q['format'] q['formats'] = q['format']
upf = prefs['use_primary_find_in_search'] upf = prefs['use_primary_find_in_search']

View File

@ -397,15 +397,15 @@ class SearchFilter(SearchQueryParser):
all_locs = set(self.USABLE_LOCATIONS) - {'all'} all_locs = set(self.USABLE_LOCATIONS) - {'all'}
locations = all_locs if location == 'all' else [location] locations = all_locs if location == 'all' else [location]
q = { q = {
'affiliate': attrgetter('affiliate'), 'affiliate': attrgetter('affiliate'),
'author': lambda x: x.author.lower(), 'author': lambda x: x.author.lower(),
'cover': attrgetter('cover_url'), 'cover': attrgetter('cover_url'),
'drm': attrgetter('drm'), 'drm': attrgetter('drm'),
'download': attrgetter('downloads'), 'download': attrgetter('downloads'),
'format': attrgetter('formats'), 'format': attrgetter('formats'),
'price': lambda x: comparable_price(x.price), 'price': lambda x: comparable_price(x.price),
'store': lambda x: x.store_name.lower(), 'store': lambda x: x.store_name.lower(),
'title': lambda x: x.title.lower(), 'title': lambda x: x.title.lower(),
} }
for x in ('author', 'download', 'format'): for x in ('author', 'download', 'format'):
q[x+'s'] = q[x] q[x+'s'] = q[x]

View File

@ -152,9 +152,9 @@ class SearchFilter(SearchQueryParser):
all_locs = set(self.USABLE_LOCATIONS) - {'all'} all_locs = set(self.USABLE_LOCATIONS) - {'all'}
locations = all_locs if location == 'all' else [location] locations = all_locs if location == 'all' else [location]
q = { q = {
'author': lambda x: x.author.lower(), 'author': lambda x: x.author.lower(),
'format': attrgetter('formats'), 'format': attrgetter('formats'),
'title': lambda x: x.title.lower(), 'title': lambda x: x.title.lower(),
} }
for x in ('author', 'format'): for x in ('author', 'format'):
q[x+'s'] = q[x] q[x+'s'] = q[x]

View File

@ -628,7 +628,7 @@ class CustomColumns:
def clean_custom(self): def clean_custom(self):
st = ('DELETE FROM {table} WHERE (SELECT COUNT(id) FROM {lt} WHERE' st = ('DELETE FROM {table} WHERE (SELECT COUNT(id) FROM {lt} WHERE'
' {lt}.value={table}.id) < 1;') ' {lt}.value={table}.id) < 1;')
statements = [] statements = []
for data in self.custom_column_num_map.values(): for data in self.custom_column_num_map.values():
if data['normalized']: if data['normalized']:

View File

@ -440,10 +440,10 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
lines.extend([custom_map[x] for x in custom_cols]) lines.extend([custom_map[x] for x in custom_cols])
self.FIELD_MAP = {'id':0, 'title':1, 'authors':2, 'timestamp':3, self.FIELD_MAP = {'id':0, 'title':1, 'authors':2, 'timestamp':3,
'size':4, 'rating':5, 'tags':6, 'comments':7, 'series':8, 'size':4, 'rating':5, 'tags':6, 'comments':7, 'series':8,
'publisher':9, 'series_index':10, 'sort':11, 'author_sort':12, 'publisher':9, 'series_index':10, 'sort':11, 'author_sort':12,
'formats':13, 'path':14, 'pubdate':15, 'uuid':16, 'cover':17, 'formats':13, 'path':14, 'pubdate':15, 'uuid':16, 'cover':17,
'au_map':18, 'last_modified':19, 'identifiers':20, 'languages':21} 'au_map':18, 'last_modified':19, 'identifiers':20, 'languages':21}
for k,v in iteritems(self.FIELD_MAP): for k,v in iteritems(self.FIELD_MAP):
self.field_metadata.set_field_record_index(k, v, prefer_custom=False) self.field_metadata.set_field_record_index(k, v, prefer_custom=False)

View File

@ -22,22 +22,22 @@ from polyglot.builtins import iteritems
entry_points = { entry_points = {
'console_scripts': [ 'console_scripts': [
'ebook-device = calibre.devices.cli:main', 'ebook-device = calibre.devices.cli:main',
'ebook-meta = calibre.ebooks.metadata.cli:main', 'ebook-meta = calibre.ebooks.metadata.cli:main',
'ebook-convert = calibre.ebooks.conversion.cli:main', 'ebook-convert = calibre.ebooks.conversion.cli:main',
'ebook-polish = calibre.ebooks.oeb.polish.main:main', 'ebook-polish = calibre.ebooks.oeb.polish.main:main',
'markdown-calibre = markdown.__main__:run', 'markdown-calibre = markdown.__main__:run',
'web2disk = calibre.web.fetch.simple:main', 'web2disk = calibre.web.fetch.simple:main',
'calibre-server = calibre.srv.standalone:main', 'calibre-server = calibre.srv.standalone:main',
'lrf2lrs = calibre.ebooks.lrf.lrfparser:main', 'lrf2lrs = calibre.ebooks.lrf.lrfparser:main',
'lrs2lrf = calibre.ebooks.lrf.lrs.convert_from:main', 'lrs2lrf = calibre.ebooks.lrf.lrs.convert_from:main',
'calibre-debug = calibre.debug:main', 'calibre-debug = calibre.debug:main',
'calibredb = calibre.db.cli.main:main', 'calibredb = calibre.db.cli.main:main',
'calibre-parallel = calibre.utils.ipc.worker:main', 'calibre-parallel = calibre.utils.ipc.worker:main',
'calibre-customize = calibre.customize.ui:main', 'calibre-customize = calibre.customize.ui:main',
'calibre-complete = calibre.utils.complete:main', 'calibre-complete = calibre.utils.complete:main',
'fetch-ebook-metadata = calibre.ebooks.metadata.sources.cli:main', 'fetch-ebook-metadata = calibre.ebooks.metadata.sources.cli:main',
'calibre-smtp = calibre.utils.smtp:main', 'calibre-smtp = calibre.utils.smtp:main',
], ],
'gui_scripts' : [ 'gui_scripts' : [
__appname__+' = calibre.gui_launch:calibre', __appname__+' = calibre.gui_launch:calibre',

View File

@ -300,28 +300,28 @@ class Tester(SearchQueryParser):
} }
tests = { tests = {
'Dysfunction' : {348}, 'Dysfunction' : {348},
'title:Dysfunction' : {348}, 'title:Dysfunction' : {348},
'Title:Dysfunction' : {348}, 'Title:Dysfunction' : {348},
'title:Dysfunction OR author:Laurie': {348, 444}, '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)': {33, 258, 354, 305, 242, 51, 55, 56, 154},
'(tag:txt OR tag:pdf) and author:Tolstoy': {55, 56}, '(tag:txt OR tag:pdf) and author:Tolstoy': {55, 56},
'Tolstoy txt': {55, 56}, 'Tolstoy txt': {55, 56},
'Hamilton Amsterdam' : set(), 'Hamilton Amsterdam' : set(),
'Beär' : {91}, 'Beär' : {91},
'dysfunc or tolstoy': {348, 55, 56}, 'dysfunc or tolstoy': {348, 55, 56},
'tag:txt AND NOT tolstoy': {33, 258, 354, 305, 242, 154}, 'tag:txt AND NOT tolstoy': {33, 258, 354, 305, 242, 154},
'not tag:lrf' : {305}, 'not tag:lrf' : {305},
'london:thames': {13}, 'london:thames': {13},
'publisher:london:thames': {13}, 'publisher:london:thames': {13},
'"(1977)"': {13}, '"(1977)"': {13},
'jack weatherford orc': {30}, 'jack weatherford orc': {30},
'S\\"calzi': {343}, 'S\\"calzi': {343},
'author:S\\"calzi': {343}, 'author:S\\"calzi': {343},
'"S\\"calzi"': {343}, '"S\\"calzi"': {343},
'M\\\\cMurtry': {427}, 'M\\\\cMurtry': {427},
'author:Tolstoy (tag:txt OR tag:pdf)': {55, 56}, 'author:Tolstoy (tag:txt OR tag:pdf)': {55, 56},
} }
fields = {'title':0, 'author':1, 'publisher':2, 'tag':3} fields = {'title':0, 'author':1, 'publisher':2, 'tag':3}
_universal_set = set(texts.keys()) _universal_set = set(texts.keys())

View File

@ -63,45 +63,45 @@ XSDNS = 'http://www.w3.org/2001/XMLSchema'
XSINS = 'http://www.w3.org/2001/XMLSchema-instance' XSINS = 'http://www.w3.org/2001/XMLSchema-instance'
nsdict = { nsdict = {
ANIMNS: 'anim', ANIMNS: 'anim',
CHARTNS: 'chart', CHARTNS: 'chart',
CHARTOOONS: 'chartooo', CHARTOOONS: 'chartooo',
CONFIGNS: 'config', CONFIGNS: 'config',
CSS3TNS: 'css3t', CSS3TNS: 'css3t',
DBNS: 'db', DBNS: 'db',
DCNS: 'dc', DCNS: 'dc',
DOMNS: 'dom', DOMNS: 'dom',
DR3DNS: 'dr3d', DR3DNS: 'dr3d',
DRAWNS: 'draw', DRAWNS: 'draw',
FIELDNS: 'field', FIELDNS: 'field',
FONS: 'fo', FONS: 'fo',
FORMNS: 'form', FORMNS: 'form',
FORMXNS: 'formx', FORMXNS: 'formx',
GRDDLNS: 'grddl', GRDDLNS: 'grddl',
KOFFICENS: 'koffice', KOFFICENS: 'koffice',
MANIFESTNS: 'manifest', MANIFESTNS: 'manifest',
MATHNS: 'math', MATHNS: 'math',
METANS: 'meta', METANS: 'meta',
NUMBERNS: 'number', NUMBERNS: 'number',
OFFICENS: 'office', OFFICENS: 'office',
OFNS: 'of', OFNS: 'of',
OOONS: 'ooo', OOONS: 'ooo',
OOOWNS: 'ooow', OOOWNS: 'ooow',
OOOCNS: 'oooc', OOOCNS: 'oooc',
PRESENTATIONNS: 'presentation', PRESENTATIONNS: 'presentation',
RDFANS: 'rdfa', RDFANS: 'rdfa',
RPTNS: 'rpt', RPTNS: 'rpt',
SCRIPTNS: 'script', SCRIPTNS: 'script',
SMILNS: 'smil', SMILNS: 'smil',
STYLENS: 'style', STYLENS: 'style',
SVGNS: 'svg', SVGNS: 'svg',
TABLENS: 'table', TABLENS: 'table',
TABLEOOONS: 'tableooo', TABLEOOONS: 'tableooo',
TEXTNS: 'text', TEXTNS: 'text',
XFORMSNS: 'xforms', XFORMSNS: 'xforms',
XLINKNS: 'xlink', XLINKNS: 'xlink',
XHTMLNS: 'xhtml', XHTMLNS: 'xhtml',
XMLNS: 'xml', XMLNS: 'xml',
XSDNS: 'xsd', XSDNS: 'xsd',
XSINS: 'xsi', XSINS: 'xsi',
} }

View File

@ -161,12 +161,12 @@ class ODF2MoinMoin:
# Tags # Tags
self.elements = { self.elements = {
'draw:page': self.textToString, 'draw:page': self.textToString,
'draw:frame': self.textToString, 'draw:frame': self.textToString,
'draw:image': self.draw_image, 'draw:image': self.draw_image,
'draw:text-box': self.textToString, 'draw:text-box': self.textToString,
'text:a': self.text_a, 'text:a': self.text_a,
'text:note': self.text_note, 'text:note': self.text_note,
} }
for tag in IGNORED_TAGS: for tag in IGNORED_TAGS:
self.elements[tag] = self.do_nothing self.elements[tag] = self.do_nothing

View File

@ -347,26 +347,26 @@ class TagStack:
special_styles = { special_styles = {
'S-Emphasis':'em', 'S-Emphasis':'em',
'S-Citation':'cite', 'S-Citation':'cite',
'S-Strong_20_Emphasis':'strong', 'S-Strong_20_Emphasis':'strong',
'S-Variable':'var', 'S-Variable':'var',
'S-Definition':'dfn', 'S-Definition':'dfn',
'S-Teletype':'tt', 'S-Teletype':'tt',
'P-Heading_20_1':'h1', 'P-Heading_20_1':'h1',
'P-Heading_20_2':'h2', 'P-Heading_20_2':'h2',
'P-Heading_20_3':'h3', 'P-Heading_20_3':'h3',
'P-Heading_20_4':'h4', 'P-Heading_20_4':'h4',
'P-Heading_20_5':'h5', 'P-Heading_20_5':'h5',
'P-Heading_20_6':'h6', 'P-Heading_20_6':'h6',
# 'P-Caption':'caption', # 'P-Caption':'caption',
'P-Addressee':'address', 'P-Addressee':'address',
# 'P-List_20_Heading':'dt', # 'P-List_20_Heading':'dt',
# 'P-List_20_Contents':'dd', # 'P-List_20_Contents':'dd',
'P-Preformatted_20_Text':'pre', 'P-Preformatted_20_Text':'pre',
# 'P-Table_20_Heading':'th', # 'P-Table_20_Heading':'th',
# 'P-Table_20_Contents':'td', # 'P-Table_20_Contents':'td',
# 'P-Text_20_body':'p' # 'P-Text_20_body':'p'
} }
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -1123,8 +1123,8 @@ dl.notes dd:last-of-type { page-break-after: avoid }
# Short prefixes for class selectors # Short prefixes for class selectors
_familyshort = {'drawing-page':'DP', 'paragraph':'P', 'presentation':'PR', _familyshort = {'drawing-page':'DP', 'paragraph':'P', 'presentation':'PR',
'text':'S', 'section':'D', 'text':'S', 'section':'D',
'table':'T', 'table-cell':'TD', 'table-column':'TC', 'table':'T', 'table-cell':'TD', 'table-column':'TC',
'table-row':'TR', 'graphic':'G'} 'table-row':'TR', 'graphic':'G'}
def s_style_style(self, tag, attrs): def s_style_style(self, tag, attrs):
''' Collect the formatting for the style. ''' Collect the formatting for the style.

View File

@ -72,22 +72,22 @@ assert sys.version_info >= (2, 2)
# s=content() s.addElement(s) won't eat up too much processor time. # s=content() s.addElement(s) won't eat up too much processor time.
odmimetypes = { odmimetypes = {
'application/vnd.oasis.opendocument.text': '.odt', 'application/vnd.oasis.opendocument.text': '.odt',
'application/vnd.oasis.opendocument.text-template': '.ott', 'application/vnd.oasis.opendocument.text-template': '.ott',
'application/vnd.oasis.opendocument.graphics': '.odg', 'application/vnd.oasis.opendocument.graphics': '.odg',
'application/vnd.oasis.opendocument.graphics-template': '.otg', 'application/vnd.oasis.opendocument.graphics-template': '.otg',
'application/vnd.oasis.opendocument.presentation': '.odp', 'application/vnd.oasis.opendocument.presentation': '.odp',
'application/vnd.oasis.opendocument.presentation-template': '.otp', 'application/vnd.oasis.opendocument.presentation-template': '.otp',
'application/vnd.oasis.opendocument.spreadsheet': '.ods', 'application/vnd.oasis.opendocument.spreadsheet': '.ods',
'application/vnd.oasis.opendocument.spreadsheet-template': '.ots', 'application/vnd.oasis.opendocument.spreadsheet-template': '.ots',
'application/vnd.oasis.opendocument.chart': '.odc', 'application/vnd.oasis.opendocument.chart': '.odc',
'application/vnd.oasis.opendocument.chart-template': '.otc', 'application/vnd.oasis.opendocument.chart-template': '.otc',
'application/vnd.oasis.opendocument.image': '.odi', 'application/vnd.oasis.opendocument.image': '.odi',
'application/vnd.oasis.opendocument.image-template': '.oti', 'application/vnd.oasis.opendocument.image-template': '.oti',
'application/vnd.oasis.opendocument.formula': '.odf', 'application/vnd.oasis.opendocument.formula': '.odf',
'application/vnd.oasis.opendocument.formula-template': '.otf', 'application/vnd.oasis.opendocument.formula-template': '.otf',
'application/vnd.oasis.opendocument.text-master': '.odm', 'application/vnd.oasis.opendocument.text-master': '.odm',
'application/vnd.oasis.opendocument.text-web': '.oth', 'application/vnd.oasis.opendocument.text-web': '.oth',
} }