From 14e3d81b492c28e670570069b449af4ac6762abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20D=C5=82ugosz?= Date: Sat, 27 Oct 2018 22:27:44 +0200 Subject: [PATCH 0001/2613] remove broken recipes --- recipes/icons/nowa_fantastyka.png | Bin 1539 -> 0 bytes recipes/nowa_fantastyka.recipe | 87 ------------------------------ 2 files changed, 87 deletions(-) delete mode 100644 recipes/icons/nowa_fantastyka.png delete mode 100644 recipes/nowa_fantastyka.recipe diff --git a/recipes/icons/nowa_fantastyka.png b/recipes/icons/nowa_fantastyka.png deleted file mode 100644 index 66170e33981f6b7a42a8d77334a58fbc91b79f29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1539 zcmV+e2K@PnP) z2Tv1W0EhAadv~;)KtZ9RsG!JpfLa&Ez2YM75ocU+FC1}?;3jTy#Jz$>#DRNMt0Ib^ zB8q}2Ra$1Dw6*QEclT=a_k4wij2Iu#u}N>*8N=}fTgiGfh8eM_M{mO$YP6z>H`0k5uFDb``KCyiA`t| z9uX7qJThIC=(|DHn;arp?7Tfj7>06 z3o=oGB6+o(0|)s^47@5lIrMPM?5=OSAmL;}@vv0o5oML~v^rl^5=oa@n0uPH z)NZ!*u+HSL4Aba9Wi&s4HJ+;Hu*FLbu0I@Do`XJoyPe1X>mzYQuc+X~BNYf}%c zcXO|4oiaPU>KMphBZR>T5?CcBA+zhs>rKI|6$77mVJP0*|)>o zxG!oN;~&M!InpHQt=^HHpIdG|YV;~w+HOvQX7EW@IYKatq)X=|!PHiIE?(rX@E`cm z*oIg-z9d?Y(0^?q8Z>x{eH{XmiGvqcp`H_&JrihufD9GEqr`x?jQ zU7M~Zm36Y!}1 zlX~NtA;?-D^-h)FONup4WK-BOq?0E?o{%DZ^vD&rNT;y}w{Z#ob$8E{H1uNKC2L>i z8cSFwg2)aG0&o{LMo6;Xa1_!SF+w~c2g412A>GfS`s_KU+2O`2uC+j2+sJgRMUJb7 zaKd#>Y%KK`8$ydx6yqP}C^v(p7)Lr2D?%|1!E`RIMIi~rPlPgJGJ4Qju7>yX{Hh4x zFM0Zy^@cviM?!bjpKYTUACwsQQnAi6Q>hl~$s46do&m~L%7^SO_CBkXSb2s#%35uC zZCQ?7v<8QVc#pP70)t=#;ul1wZg)wa(o*C$8mB&BpXmG2`=foMKFH8Sj@8#05*@@N zk2}JpM5Tq1nt^6TT>!NkGRpFDQ?deIS6m)>_RP7wtj%|>-=p{iA^IeW)Y(mHdQ*RTa+Bg>HE&=KfmS5=4mFg8Rn5BRrC{M z*f>cqXEd+uR5-)u(Y?8u&_XTA+Bc99??(IgVZgfVfE`5jG~ zJmI00*zDECl{uA7Ln5PfQE9dPE5=j~uJ}<>q@P!i^E5{{j3hOko;&+}(5vuEVQffU zt7WY^lTzjuIi}x{KjrhrrX3^Kg>M!fJN=yz4F)yr64*^TC$*8J-&4&Bb28nAj&!{1 zk=ra@pby0bVuF`e^>+~NH2;f_{Bq*Ot;`{0;^>x(qxJL+Y+nwn`NLX_G?k-xpv1VKCjgo>7@ABq( poKi+A;q}`$MV0K(S?t!`e*owV-hEoNvW)-$002ovPDHLkV1gS|>fQhV diff --git a/recipes/nowa_fantastyka.recipe b/recipes/nowa_fantastyka.recipe deleted file mode 100644 index 28c5408890..0000000000 --- a/recipes/nowa_fantastyka.recipe +++ /dev/null @@ -1,87 +0,0 @@ -# -*- coding: utf-8 -*- -from calibre.web.feeds.news import BasicNewsRecipe -import re - - -class Nowa_Fantastyka(BasicNewsRecipe): - title = u'Nowa Fantastyka' - oldest_article = 7 - __author__ = 'fenuks' - __modified_by__ = 'zaslav' - language = 'pl' - encoding = 'latin2' - description = u'Strona dla miłośników fantastyki' - category = 'fantasy' - masthead_url = 'http://farm5.static.flickr.com/4133/4956658792_7ba7fbf562.jpg' - # extra_css='.tytul {font-size: 20px;}' #not working - max_articles_per_feed = 100 - INDEX = 'http://www.fantastyka.pl/' - no_stylesheets = True - needs_subscription = 'optional' - remove_tags_before = dict(attrs={'class': 'naglowek2'}) - remove_tags_after = dict(name='form', attrs={'name': 'form1'}) - remove_tags = [dict(attrs={'class': ['avatar2', 'belka-margin', 'naglowek2']}), dict(name='span', attrs={'class': 'alert-oceny'}), dict(name='img', attrs={'src': ['obrazki/sledz1.png', 'obrazki/print.gif', 'obrazki/mlnf.gif']}), dict(name='b', text='Dodaj komentarz'), dict(name='a', attrs={'href': 'http://www.fantastyka.pl/10,1727.html'}), dict(name='form')] # noqa - preprocess_regexps = [ - (re.compile(r'\'), lambda match: ''), - (re.compile(r'\'), lambda match: ''), - (re.compile(r'\'), lambda match: '')] - - def find_articles(self, url): - articles = [] - soup = self.index_to_soup(url) - tag = soup.find(attrs={'class': 'belka1-tlo-m'}) - art = tag.findAll(name='a', attrs={'class': 'a-box'}) - for i in art: - title = i.string - url = self.INDEX + i['href'] - # date=soup.find(id='footer').ul.li.string[41:-1] - articles.append({'title': title, - 'url': url, - 'date': '', - 'description': '' - }) - return articles - - def parse_index(self): - feeds = [] - feeds.append((u"Opowiadania", self.find_articles( - 'http://www.fantastyka.pl/3.html'))) - feeds.append((u"Publicystyka", self.find_articles( - 'http://www.fantastyka.pl/6.html'))) - feeds.append((u"Hype Park", self.find_articles( - 'http://www.fantastyka.pl/9.html'))) - - return feeds - - def get_cover_url(self): - soup = self.index_to_soup('http://www.e-kiosk.pl/nowa_fantastyka') - self.cover_url = 'http://www.e-kiosk.pl' + \ - soup.find(name='a', attrs={'class': 'img'})['href'] - return getattr(self, 'cover_url', self.cover_url) - - def get_browser(self): - br = BasicNewsRecipe.get_browser(self) - if self.username is not None and self.password is not None: - br.open('http://www.fantastyka.pl/') - br.select_form(nr=0) - br['login'] = self.username - br['pass'] = self.password - br.submit() - return br - - def preprocess_html(self, soup): - for item in soup.findAll(style=True): - del item['style'] - for item in soup.findAll(font=True): - del item['font'] - for item in soup.findAll(align=True): - del item['align'] - for item in soup.findAll(name='tr'): - item.name = 'div' - title = soup.find(attrs={'class': 'tytul'}) - if title: - title['style'] = 'font-size: 20px; font-weight: bold;' - for a in soup('a'): - if a.has_key('href') and 'http://' not in a['href'] and 'https://' not in a['href']: # noqa - a['href'] = self.INDEX + a['href'] - return soup From b559a9bebd5d1c11528866ee7832ce2f17bd61dd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 28 Oct 2018 11:15:18 +0530 Subject: [PATCH 0002/2613] http -> https --- manual/news.rst | 2 +- src/calibre/ebooks/metadata/cli.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manual/news.rst b/manual/news.rst index ece0c70c91..f09f1af413 100644 --- a/manual/news.rst +++ b/manual/news.rst @@ -269,7 +269,7 @@ of articles that appear in *todays* paper. While more complex than simply using days paper. ``parse_index`` makes heavy use of `BeautifulSoup `_ to parse the daily paper webpage. You can also use other, more modern parsers if you -dislike BeatifulSoup. calibre comes with `lxml `_ and +dislike BeatifulSoup. calibre comes with `lxml `_ and `html5lib `_, which are the recommended parsers. To use them, replace the call to ``index_to_soup()`` with the following:: diff --git a/src/calibre/ebooks/metadata/cli.py b/src/calibre/ebooks/metadata/cli.py index 6d4367b61f..b3ab36901c 100644 --- a/src/calibre/ebooks/metadata/cli.py +++ b/src/calibre/ebooks/metadata/cli.py @@ -65,7 +65,7 @@ def config(): help=_('Set the ISBN of the book.')) c.add_opt('identifiers', ['--identifier'], action='append', help=_('Set the identifiers for the book, can be specified multiple times.' - ' For example: --identifier uri:http://acme.com --identifier isbn:12345' + ' For example: --identifier uri:https://acme.com --identifier isbn:12345' ' To remove an identifier, specify no value, --identifier isbn:' ' Note that for EPUB files, an identifier marked as the package identifier cannot be removed.')) c.add_opt('tags', ['--tags'], From 08347f685dbb13a2d0ce53178ea32d1b261ea381 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 28 Oct 2018 19:18:02 +1100 Subject: [PATCH 0003/2613] Add comments to metadata plugboard This allows modification of comments to add info not displayed on the device as part of the comments/description/synopsis or whatever on the device. It was discussed in https://www.mobileread.com/forums/showthread.php?t=291138. I have been running this since before then with no issues for Kobo devices and save-to-disk. It includes a warning prompt as mangled comments could cause a problem. But, mangled any field could as well. --- src/calibre/gui2/preferences/plugboard.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/preferences/plugboard.py b/src/calibre/gui2/preferences/plugboard.py index a6beb4106d..fa0df3d9c1 100644 --- a/src/calibre/gui2/preferences/plugboard.py +++ b/src/calibre/gui2/preferences/plugboard.py @@ -97,7 +97,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.dest_fields = ['', 'authors', 'author_sort', 'language', 'publisher', - 'tags', 'title', 'title_sort'] + 'tags', 'title', 'title_sort', 'comments'] self.source_widgets = [] self.dest_widgets = [] @@ -299,6 +299,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): def ok_clicked(self): pb = [] + comments_in_dests = False for i in range(0, len(self.source_widgets)): s = unicode(self.source_widgets[i].text()) if s: @@ -312,6 +313,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): '
'+str(err), show=True) return pb.append((s, self.dest_fields[d])) + comments_in_dests = comments_in_dests or self.dest_fields[d] == 'comments' else: error_dialog(self, _('Invalid destination'), '

'+_('The destination field cannot be blank'), @@ -325,6 +327,14 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): if len(fpb) == 0: del self.current_plugboards[self.current_format] else: + if comments_in_dests and not question_dialog(self.gui, _('Plugboard modifies Comments'), + _('The plugboard modifies the comments columns. ' + 'If the comments are set to invalid HTML, it could cause problems on the device. ' + 'Do you wish to save the plugboard?' + ), + skip_dialog_name='plugboard_comments_in_dests' + ): + return if self.current_format not in self.current_plugboards: self.current_plugboards[self.current_format] = {} fpb = self.current_plugboards[self.current_format] From 59f7a1ef06c7ba9aa399a7474de10f782fb0f70e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 28 Oct 2018 16:55:24 +0530 Subject: [PATCH 0004/2613] E-book viewer: Add a keyboard shortcut (Ctrl+M) for toggling between paged and flow mode --- src/calibre/gui2/viewer/main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/viewer/main.py b/src/calibre/gui2/viewer/main.py index 2550395556..2bdf3630b0 100644 --- a/src/calibre/gui2/viewer/main.py +++ b/src/calibre/gui2/viewer/main.py @@ -11,7 +11,7 @@ from functools import partial from threading import Thread from PyQt5.Qt import ( - QAction, QApplication, QByteArray, QIcon, QInputDialog, QMimeData, QModelIndex, + QAction, QApplication, QByteArray, QIcon, QInputDialog, QMimeData, QModelIndex, QKeySequence, QObject, QPropertyAnimation, QSize, Qt, QTime, QTimer, pyqtSignal ) @@ -279,6 +279,7 @@ class EbookViewer(MainWindow): plugin.customize_ui(self) self.view.document.settings_changed.connect(self.settings_changed) + self.action_toggle_paged_mode.setShortcut(QKeySequence('Ctrl+M')) self.restore_state() self.settings_changed() self.action_toggle_paged_mode.toggled[bool].connect(self.toggle_paged_mode) @@ -308,9 +309,9 @@ class EbookViewer(MainWindow): def toggle_paged_mode(self, checked, at_start=False): in_paged_mode = not self.action_toggle_paged_mode.isChecked() self.view.document.in_paged_mode = in_paged_mode - self.action_toggle_paged_mode.setToolTip(self.FLOW_MODE_TT if - self.action_toggle_paged_mode.isChecked() else - self.PAGED_MODE_TT) + self.action_toggle_paged_mode.setToolTip(( + self.FLOW_MODE_TT if self.action_toggle_paged_mode.isChecked() else self.PAGED_MODE_TT) + + ' [%s]' % self.action_toggle_paged_mode.shortcut().toString(QKeySequence.NativeText)) if at_start: return self.reload() From 05c029333fd44effcd78363f1b5b972e8189625c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 29 Oct 2018 05:29:51 +0530 Subject: [PATCH 0005/2613] Content server: Fix --url-prefix feature not working with book conversion --- src/pyj/book_list/convert_book.pyj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyj/book_list/convert_book.pyj b/src/pyj/book_list/convert_book.pyj index eb768a3ca7..66360a3e6e 100644 --- a/src/pyj/book_list/convert_book.pyj +++ b/src/pyj/book_list/convert_book.pyj @@ -183,7 +183,7 @@ def start_conversion(): 'book_id': conversion_data.book_id, } query = url_books_query() - ajax_send(f'/conversion/start/{conversion_data.book_id}', data, on_conversion_started, query=query) + ajax_send(f'conversion/start/{conversion_data.book_id}', data, on_conversion_started, query=query) current_state = 'converting' apply_state_to_markup() From 0626088861e77b2ac966c2b716a61a62ff8f766a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 29 Oct 2018 10:15:44 +0530 Subject: [PATCH 0006/2613] Update Washington Post --- recipes/wash_post.recipe | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/recipes/wash_post.recipe b/recipes/wash_post.recipe index b65d0f5e38..c89342c001 100644 --- a/recipes/wash_post.recipe +++ b/recipes/wash_post.recipe @@ -7,6 +7,12 @@ www.washingtonpost.com from calibre.web.feeds.news import BasicNewsRecipe +def classes(classes): + q = frozenset(classes.split(' ')) + return dict(attrs={ + 'class': lambda x: x and frozenset(x.split()).intersection(q)}) + + class TheWashingtonPost(BasicNewsRecipe): title = 'The Washington Post' __author__ = 'Darko Miletic' @@ -17,7 +23,6 @@ class TheWashingtonPost(BasicNewsRecipe): max_articles_per_feed = 200 no_stylesheets = True encoding = 'utf8' - delay = 1 use_embedded_content = False language = 'en' remove_empty_feeds = True @@ -26,6 +31,10 @@ class TheWashingtonPost(BasicNewsRecipe): keep_only_tags = [ dict(itemprop=['headline', 'articleBody']), ] + remove_tags = [ + dict(name=['meta', 'link']), + classes('inline-video'), + ] feeds = [ (u'World', u'http://feeds.washingtonpost.com/rss/world'), @@ -40,3 +49,8 @@ class TheWashingtonPost(BasicNewsRecipe): (u'Sports', u'http://feeds.washingtonpost.com/rss/sports'), (u'Redskins', u'http://feeds.washingtonpost.com/rss/sports/redskins'), ] + + def preprocess_html(self, soup, *a): + for img in soup.findAll('img', attrs={'data-low-res-src': True}): + img['src'] = img['data-low-res-src'] + return soup From 87ca3b84847e5bd1f2418d61fc7fe4cd41fd95eb Mon Sep 17 00:00:00 2001 From: David Date: Mon, 29 Oct 2018 22:18:16 +1100 Subject: [PATCH 0007/2613] Use metadata source and identifier rules to generate identifiers Extend identifier from URL parsing to use metadata source plugins and the identifier rules. Each plugin needs to override the id_from_url method. --- src/calibre/ebooks/metadata/sources/base.py | 10 +++++ src/calibre/gui2/metadata/basic_widgets.py | 48 +++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/src/calibre/ebooks/metadata/sources/base.py b/src/calibre/ebooks/metadata/sources/base.py index 43413e89cd..f3ef0a7bc7 100644 --- a/src/calibre/ebooks/metadata/sources/base.py +++ b/src/calibre/ebooks/metadata/sources/base.py @@ -495,6 +495,16 @@ class Source(Plugin): that could result in a generic cover image or a not found error. ''' return None + + def id_from_url(self, url): + ''' + Parse a URL and return a tuple of the form: + (identifier_type, identifier_value). + If the URL does not match the pattern for the metadata source, + return None. + ''' + return None + def identify_results_keygen(self, title=None, authors=None, identifiers={}): diff --git a/src/calibre/gui2/metadata/basic_widgets.py b/src/calibre/gui2/metadata/basic_widgets.py index 2076e4d65e..79a996eb21 100644 --- a/src/calibre/gui2/metadata/basic_widgets.py +++ b/src/calibre/gui2/metadata/basic_widgets.py @@ -1625,6 +1625,9 @@ class IdentifiersEdit(QLineEdit, ToMetadataMixin): self.setStyleSheet(INDICATOR_SHEET % col) def paste_identifier(self): + identifier_found = self.parse_clipboard_for_identifier() + if identifier_found: + return try: prefix = gprefs['paste_isbn_prefixes'][0] except IndexError: @@ -1656,6 +1659,51 @@ class IdentifiersEdit(QLineEdit, ToMetadataMixin): vals['isbn'] = text self.current_val = vals + if not text: + return + + def parse_clipboard_for_identifier(self): + from calibre.ebooks.metadata.sources.prefs import msprefs + from calibre.utils.formatter import EvalFormatter + text = unicode(QApplication.clipboard().text()).strip() + if not text: + return False + + rules = msprefs['id_link_rules'] + if rules: + formatter = EvalFormatter() + vals = {'id' : '(?P[^/]+)'} + for key in rules.keys(): + rule = rules[key] + for name, template in rule: + try: + url_pattern = formatter.safe_format(template, vals, '', vals) + new_id = re.compile(url_pattern) + new_id = new_id.search(text).group('new_id') + if new_id: + vals = self.current_val + vals[key] = new_id + self.current_val = vals + return True + except Exception: + import traceback + traceback.format_exc() + continue + + from calibre.customize.ui import all_metadata_plugins + + for plugin in all_metadata_plugins(): + try: + identifier = plugin.id_from_url(text) + if identifier: + vals = self.current_val + vals[identifier[0]] = identifier[1] + self.current_val = vals + return True + except Exception: + pass + + return False # }}} From 8d704765173e7484bb2c6384b192709db6eb8f98 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 30 Oct 2018 09:33:21 +0530 Subject: [PATCH 0008/2613] Fix an error when converting invalid html with empty tags to text --- src/calibre/utils/html2text.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/utils/html2text.py b/src/calibre/utils/html2text.py index d81b1854a5..49a7a9559d 100644 --- a/src/calibre/utils/html2text.py +++ b/src/calibre/utils/html2text.py @@ -50,6 +50,7 @@ def name2cp(k): return int(k[2:-1]) # not in latin-1 return ord(codecs.latin_1_decode(k)[0]) + unifiable = {'rsquo':"'", 'lsquo':"'", 'rdquo':'"', 'ldquo':'"', 'copy':'(C)', 'mdash':'--', 'nbsp':' ', 'rarr':'->', 'larr':'<-', 'middot':'*', 'ndash':'-', 'oelig':'oe', 'aelig':'ae', @@ -96,6 +97,7 @@ def replaceEntities(s): else: return entityref(s) + r_unescape = re.compile(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));") @@ -150,7 +152,7 @@ def optwrap(text): def hn(tag): - if tag[0] == 'h' and len(tag) == 2: + if tag and tag[0] == 'h' and len(tag) == 2: try: n = int(tag[1]) if n in range(1, 10): @@ -364,7 +366,7 @@ class _html2text(sgmllib.SGMLParser): if not self.quiet: if puredata and not self.pre: - data = re.sub('\s+', ' ', data) + data = re.sub(r'\s+', ' ', data) if data and data[0] == ' ': self.space = 1 data = data[1:] @@ -435,6 +437,7 @@ def html2text_file(html, out=wrapwrite, baseurl=''): def html2text(html, baseurl=''): return optwrap(html2text_file(html, None, baseurl)) + if __name__ == "__main__": baseurl = '' if sys.argv[1:]: @@ -461,4 +464,3 @@ if __name__ == "__main__": else: data = sys.stdin.read().decode('utf8') wrapwrite(html2text(data, baseurl)) - From bd109dd497f3877a40a3103cf5b3282c42434d43 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 1 Nov 2018 15:09:05 +0530 Subject: [PATCH 0009/2613] Handle changed markup on NYT today's paper page --- recipes/nytimes_sub.recipe | 49 +++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index 88de536bdb..7501a1c134 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -148,18 +148,31 @@ class NewYorkTimes(BasicNewsRecipe): return soup def parse_todays_sections(self, container): - for h2 in container.findAll('h2', **classes('headline')): - title = self.tag_to_string(h2) - a = h2.find('a', href=True) + for li in container.findAll('li'): + desc = '' + h2 = li.find('h2') + if h2 is None: + a = li.find('a', href=True) + title = self.tag_to_string(a) + else: + title = self.tag_to_string(h2) + a = h2.find('a', href=True) + if a is None: + a = h2.findParent('a', href=True) + div = a.find('div', recursive=False) + if div is not None: + desc = self.tag_to_string(div) + if a is None: + continue url = a['href'] if '?' in url: url = url.split('?')[0] - p = h2.findParent(**classes('story-body')) - desc = '' - if p is not None: - s = p.find(**classes('summary')) - if s is not None: - desc = self.tag_to_string(s) + if url.startswith('/'): + url = 'https://www.nytimes.com' + url + if not desc: + p = li.find('p') + if p is not None: + desc = self.tag_to_string(p) date = '' d = date_from_url(url) if d is not None: @@ -171,19 +184,17 @@ class NewYorkTimes(BasicNewsRecipe): def parse_todays_page(self): soup = self.read_nyt_metadata() - section = soup.find(id=lambda x: x and x.startswith('collection-todays-new-york-times')) + section = soup.find(id='collection-todays-new-york-times').find('div', recursive=False) feeds = [] - for i, h1 in enumerate(section.findAll('h1')): + for i, section in enumerate(section.findAll('section')): + h2 = section.find('h2') + section_title = self.tag_to_string(h2) + self.log('\nFound section:', section_title) if i == 0: - continue - section_title = self.tag_to_string(h1) - self.log('Found section:', section_title) - if i == 1: - container = h1.parent - articles = list(self.parse_todays_sections(container)) - articles += list(self.parse_todays_sections(container.findNextSibling('div'))) + for div in section.findAll('div', recursive=False): + articles = list(self.parse_todays_sections(div.find('ol'))) else: - articles = list(self.parse_todays_sections(h1.findNextSibling('ol'))) + articles = list(self.parse_todays_sections(section.find('ol'))) if articles: feeds.append((section_title, articles)) return feeds From 7cec7f612bff5520b10205d80274fb3da628449c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 1 Nov 2018 15:11:24 +0530 Subject: [PATCH 0010/2613] ... --- recipes/nytimes_sub.recipe | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index 7501a1c134..2c0ae1c066 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -191,8 +191,9 @@ class NewYorkTimes(BasicNewsRecipe): section_title = self.tag_to_string(h2) self.log('\nFound section:', section_title) if i == 0: + articles = [] for div in section.findAll('div', recursive=False): - articles = list(self.parse_todays_sections(div.find('ol'))) + articles += list(self.parse_todays_sections(div.find('ol'))) else: articles = list(self.parse_todays_sections(section.find('ol'))) if articles: From c88614c526f9a2b99cc140614beffb8524dc5223 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 1 Nov 2018 21:48:19 +0530 Subject: [PATCH 0011/2613] Magyar Idok by pofa --- recipes/magyar_idok.recipe | 17 +++++++++++++++++ recipes/magyar_nemzet.recipe | 25 ------------------------- 2 files changed, 17 insertions(+), 25 deletions(-) create mode 100644 recipes/magyar_idok.recipe delete mode 100644 recipes/magyar_nemzet.recipe diff --git a/recipes/magyar_idok.recipe b/recipes/magyar_idok.recipe new file mode 100644 index 0000000000..eac013f4b1 --- /dev/null +++ b/recipes/magyar_idok.recipe @@ -0,0 +1,17 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +from __future__ import unicode_literals, division, absolute_import, print_function +from calibre.web.feeds.news import AutomaticNewsRecipe + + +class BasicUserRecipe1530967423(AutomaticNewsRecipe): + title = 'Magyar Id\u0151k' + language = 'hu' + __author__ = 'pofa' + oldest_article = 1 + max_articles_per_feed = 100 + auto_cleanup = True + + feeds = [ + ('Magyar Id\u0151k', 'https://magyaridok.hu/feed/'), + ] diff --git a/recipes/magyar_nemzet.recipe b/recipes/magyar_nemzet.recipe deleted file mode 100644 index 57d9ae6cff..0000000000 --- a/recipes/magyar_nemzet.recipe +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python2 -# vim:fileencoding=utf-8 -from __future__ import unicode_literals, division, absolute_import, print_function -from calibre.web.feeds.news import AutomaticNewsRecipe - - -class BasicUserRecipe1458590017(AutomaticNewsRecipe): - title = 'Magyar Nemzet' - __author__ = 'pofa' - language = 'hu' - oldest_article = 1 - max_articles_per_feed = 50 - auto_cleanup = True - - feeds = [ - ('Kiemelt', 'http://mno.hu/rss/kiemelt'), - ('Belföld', 'http://mno.hu/rss/belfold'), - ('Külföld', 'http://mno.hu/rss/kulfold'), - ('Vélemény', 'http://mno.hu/rss/velemeny'), - ('Kultúrgrund', 'http://mno.hu/rss/grund'), - ('Gazdaság', 'http://mno.hu/rss/gazdasag'), - ('Sport', 'http://mno.hu/rss/sport'), - ('Tudomány \xe9s technika', 'http://mno.hu/rss/tudomany'), - ('Életmód', 'http://mno.hu/rss/eletmod'), - ] From cc73789554d5e3986306556e62f2a608e78d6f31 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 4 Nov 2018 10:49:42 +0530 Subject: [PATCH 0012/2613] Fix random order of font family config choices in editor preview panel preferences --- src/calibre/gui2/tweak_book/preferences.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/preferences.py b/src/calibre/gui2/tweak_book/preferences.py index 508aefac5f..ea66fe41ec 100644 --- a/src/calibre/gui2/tweak_book/preferences.py +++ b/src/calibre/gui2/tweak_book/preferences.py @@ -348,7 +348,8 @@ class PreviewSettings(BasicSettings): w.setCurrentFont(QFont(val)) families = {'serif':_('Serif text'), 'sans':_('Sans-serif text'), 'mono':_('Monospaced text')} - for fam, text in families.iteritems(): + for fam in sorted(families): + text = families[fam] w = QFontComboBox(self) self('preview_%s_family' % fam, widget=w, getter=family_getter, setter=family_setter) l.addRow(_('Font family for &%s:') % text, w) From 3897ade17938b3efb965b675d4cf40e4a5775cb8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 4 Nov 2018 11:40:42 +0530 Subject: [PATCH 0013/2613] Workaround for broken ssl certificate served by kath.net --- recipes/kath_net.recipe | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes/kath_net.recipe b/recipes/kath_net.recipe index f1c501e449..fc4887c9c5 100644 --- a/recipes/kath_net.recipe +++ b/recipes/kath_net.recipe @@ -11,9 +11,13 @@ class AdvancedUserRecipe1295262156(BasicNewsRecipe): no_stylesheets = True encoding = 'iso-8859-1' - feeds = [(u'kath.net', u'http://www.kath.net/2005/xml/index.xml')] + feeds = [(u'kath.net', u'https://www.kath.net/2005/xml/index.xml')] def print_version(self, url): return url + "/print/yes" + def get_browser(self, *a, **kwargs): + kwargs['verify_ssl_certificates'] = False + return BasicNewsRecipe.get_browser(self, *a, **kwargs) + extra_css = 'td.textb {font-size: medium;}' From 661c47501aa8365e0726e8bbdef076c8a7350a8a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 5 Nov 2018 08:36:32 +0530 Subject: [PATCH 0014/2613] Allow nyt todays paper download to work even when page errors out --- recipes/nytimes_sub.recipe | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index 2c0ae1c066..270e715ec1 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -140,7 +140,20 @@ class NewYorkTimes(BasicNewsRecipe): def read_nyt_metadata(self): INDEX = 'https://www.nytimes.com/section/todayspaper' # INDEX = 'file:///t/raw.html' - soup = self.index_to_soup(INDEX) + try: + soup = self.index_to_soup(INDEX) + except Exception as err: + if getattr(err, 'code', None) == 404: + try: + soup = self.index_to_soup(strftime('https://www.nytimes.com/issue/todayspaper/%Y/%m/%d/todays-new-york-times')) + except Exception as err: + if getattr(err, 'code', None) == 404: + dt = datetime.datetime.today() - datetime.timedelta(days=1) + soup = self.index_to_soup(dt.strftime('https://www.nytimes.com/issue/todayspaper/%Y/%m/%d/todays-new-york-times')) + else: + raise + else: + raise pdate = soup.find('meta', attrs={'name':'pdate', 'content': True})['content'] date = strptime(pdate, '%Y%m%d', assume_utc=False, as_utc=False) self.cover_url = 'https://static01.nyt.com/images/{}/nytfrontpage/scan.jpg'.format(date.strftime('%Y/%m/%d')) From 6ce808c4994ce3e981a3d3023b7c8f626b03c320 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 5 Nov 2018 12:43:20 +0530 Subject: [PATCH 0015/2613] Allow saving index html easily --- src/calibre/web/feeds/news.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index d131524114..3277d957e0 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -657,7 +657,7 @@ class BasicNewsRecipe(Recipe): return frozenset() return frozenset([(parts.netloc, (parts.path or '').rstrip('/'))]) - def index_to_soup(self, url_or_raw, raw=False, as_tree=False): + def index_to_soup(self, url_or_raw, raw=False, as_tree=False, save_raw=None): ''' Convenience method that takes an URL to the index page and returns a `BeautifulSoup `_ @@ -692,6 +692,9 @@ class BasicNewsRecipe(Recipe): else: _raw = xml_to_unicode(_raw, strip_encoding_pats=True, resolve_entities=True)[0] _raw = clean_xml_chars(_raw) + if save_raw: + with lopen(save_raw, 'wb') as f: + f.write(_raw.encode('utf-8')) if as_tree: from html5_parser import parse return parse(_raw) From e2a08070790c2280cf1bfc90fcef713c9070937c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 5 Nov 2018 12:48:02 +0530 Subject: [PATCH 0016/2613] Use JSON rather than HTML data from the NYT today's paper page as it is more complete --- recipes/nytimes.recipe | 114 ++++++++++++++++++++++++------------- recipes/nytimes_sub.recipe | 111 +++++++++++++++++++----------------- 2 files changed, 134 insertions(+), 91 deletions(-) diff --git a/recipes/nytimes.recipe b/recipes/nytimes.recipe index 94359ce9a5..7a22234c32 100644 --- a/recipes/nytimes.recipe +++ b/recipes/nytimes.recipe @@ -6,6 +6,8 @@ from __future__ import absolute_import, division, print_function, unicode_litera import datetime import re +import json +from pprint import pprint # noqa from calibre import strftime from calibre.utils.date import strptime @@ -137,55 +139,85 @@ class NewYorkTimes(BasicNewsRecipe): soup.find('body').contents.insert(0, h1) return soup - def read_nyt_metadata(self): + def read_todays_paper(self): INDEX = 'https://www.nytimes.com/section/todayspaper' # INDEX = 'file:///t/raw.html' - soup = self.index_to_soup(INDEX) + try: + soup = self.index_to_soup(INDEX) + except Exception as err: + if getattr(err, 'code', None) == 404: + try: + soup = self.index_to_soup(strftime('https://www.nytimes.com/issue/todayspaper/%Y/%m/%d/todays-new-york-times')) + except Exception as err: + if getattr(err, 'code', None) == 404: + dt = datetime.datetime.today() - datetime.timedelta(days=1) + soup = self.index_to_soup(dt.strftime('https://www.nytimes.com/issue/todayspaper/%Y/%m/%d/todays-new-york-times')) + else: + raise + else: + raise + return soup + + def read_nyt_metadata(self): + soup = self.read_todays_paper() pdate = soup.find('meta', attrs={'name':'pdate', 'content': True})['content'] date = strptime(pdate, '%Y%m%d', assume_utc=False, as_utc=False) self.cover_url = 'https://static01.nyt.com/images/{}/nytfrontpage/scan.jpg'.format(date.strftime('%Y/%m/%d')) self.timefmt = strftime(' [%d %b, %Y]', date) return soup - def parse_todays_sections(self, container): - for h2 in container.findAll('h2', **classes('headline')): - title = self.tag_to_string(h2) - a = h2.find('a', href=True) - url = a['href'] - if '?' in url: - url = url.split('?')[0] - p = h2.findParent(**classes('story-body')) - desc = '' - if p is not None: - s = p.find(**classes('summary')) - if s is not None: - desc = self.tag_to_string(s) - date = '' - d = date_from_url(url) - if d is not None: - date = format_date(d) - - self.log('\t', title + date, ': ', url) - self.log('\t\t', desc) - yield {'title': title, 'url': url, 'description': desc, 'date': date} - def parse_todays_page(self): soup = self.read_nyt_metadata() - section = soup.find(id=lambda x: x and x.startswith('collection-todays-new-york-times')) + script = soup.findAll('script', text=lambda x: x and 'window.__preloadedData' in x)[0] + script = type(u'')(script) + data = json.loads(script[script.find('{'):].strip().rstrip(';'))['initialState'] + containers, sections = [], {} + article_map = {} + pat = re.compile(r'groupings.(\d+).containers.(\d+).relations.(\d+)') + for key in data: + if 'Article' in key: + adata = data[key] + if adata.get('__typename') == 'Article': + url = adata.get('url') + summary = adata.get('summary') + headline = adata.get('headline') + if url and headline: + title = data[headline['id']]['default'] + article_map[adata['id']] = { + 'title': title, 'url': url, 'description': summary or ''} + elif 'Legacy' in key: + sdata = data[key] + tname = sdata.get('__typename') + if tname == 'LegacyCollectionContainer': + containers.append(sdata['label'] or sdata['name']) + elif tname == 'LegacyCollectionRelation': + m = pat.search(key) + grouping, container, relation = map(int, m.groups()) + asset = sdata['asset'] + if asset['typename'] == 'Article' and grouping == 0: + if container not in sections: + sections[container] = [] + sections[container].append(asset['id'].split(':', 1)[1]) + feeds = [] - for i, h1 in enumerate(section.findAll('h1')): - if i == 0: - continue - section_title = self.tag_to_string(h1) - self.log('Found section:', section_title) - if i == 1: - container = h1.parent - articles = list(self.parse_todays_sections(container)) - articles += list(self.parse_todays_sections(container.findNextSibling('div'))) - else: - articles = list(self.parse_todays_sections(h1.findNextSibling('ol'))) - if articles: - feeds.append((section_title, articles)) + for i, section_title in enumerate(containers): + if i in sections: + articles = sections[i] + if articles: + self.log('\n' + section_title) + feeds.append((section_title, [])) + for artid in articles: + if artid in article_map: + art = article_map[artid] + feeds[-1][1].append(art) + self.log('\t' + art['title']) + + def skey(x): + name = x[0].strip() + if name == 'The Front Page': + return 0, '' + return 1, name.lower() + feeds.sort(key=skey) return feeds def parse_highlights(self, container): @@ -267,8 +299,10 @@ class NewYorkTimes(BasicNewsRecipe): return self.get_browser() def open_novisit(self, *args, **kwargs): - from calibre import browser - br = browser() + from calibre import browser, random_user_agent + if not hasattr(self, 'rua_stored'): + self.rua_stored = random_user_agent(allow_ie=False) + br = browser(user_agent=self.rua_stored) response = br.open_novisit(*args, **kwargs) # headers = response.info() # if headers.get('X-PageType') == 'vi-story': diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index 270e715ec1..a624577b7f 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -6,6 +6,8 @@ from __future__ import absolute_import, division, print_function, unicode_litera import datetime import re +import json +from pprint import pprint # noqa from calibre import strftime from calibre.utils.date import strptime @@ -137,7 +139,7 @@ class NewYorkTimes(BasicNewsRecipe): soup.find('body').contents.insert(0, h1) return soup - def read_nyt_metadata(self): + def read_todays_paper(self): INDEX = 'https://www.nytimes.com/section/todayspaper' # INDEX = 'file:///t/raw.html' try: @@ -154,63 +156,68 @@ class NewYorkTimes(BasicNewsRecipe): raise else: raise + return soup + + def read_nyt_metadata(self): + soup = self.read_todays_paper() pdate = soup.find('meta', attrs={'name':'pdate', 'content': True})['content'] date = strptime(pdate, '%Y%m%d', assume_utc=False, as_utc=False) self.cover_url = 'https://static01.nyt.com/images/{}/nytfrontpage/scan.jpg'.format(date.strftime('%Y/%m/%d')) self.timefmt = strftime(' [%d %b, %Y]', date) return soup - def parse_todays_sections(self, container): - for li in container.findAll('li'): - desc = '' - h2 = li.find('h2') - if h2 is None: - a = li.find('a', href=True) - title = self.tag_to_string(a) - else: - title = self.tag_to_string(h2) - a = h2.find('a', href=True) - if a is None: - a = h2.findParent('a', href=True) - div = a.find('div', recursive=False) - if div is not None: - desc = self.tag_to_string(div) - if a is None: - continue - url = a['href'] - if '?' in url: - url = url.split('?')[0] - if url.startswith('/'): - url = 'https://www.nytimes.com' + url - if not desc: - p = li.find('p') - if p is not None: - desc = self.tag_to_string(p) - date = '' - d = date_from_url(url) - if d is not None: - date = format_date(d) - - self.log('\t', title + date, ': ', url) - self.log('\t\t', desc) - yield {'title': title, 'url': url, 'description': desc, 'date': date} - def parse_todays_page(self): soup = self.read_nyt_metadata() - section = soup.find(id='collection-todays-new-york-times').find('div', recursive=False) + script = soup.findAll('script', text=lambda x: x and 'window.__preloadedData' in x)[0] + script = type(u'')(script) + data = json.loads(script[script.find('{'):].strip().rstrip(';'))['initialState'] + containers, sections = [], {} + article_map = {} + pat = re.compile(r'groupings.(\d+).containers.(\d+).relations.(\d+)') + for key in data: + if 'Article' in key: + adata = data[key] + if adata.get('__typename') == 'Article': + url = adata.get('url') + summary = adata.get('summary') + headline = adata.get('headline') + if url and headline: + title = data[headline['id']]['default'] + article_map[adata['id']] = { + 'title': title, 'url': url, 'description': summary or ''} + elif 'Legacy' in key: + sdata = data[key] + tname = sdata.get('__typename') + if tname == 'LegacyCollectionContainer': + containers.append(sdata['label'] or sdata['name']) + elif tname == 'LegacyCollectionRelation': + m = pat.search(key) + grouping, container, relation = map(int, m.groups()) + asset = sdata['asset'] + if asset['typename'] == 'Article' and grouping == 0: + if container not in sections: + sections[container] = [] + sections[container].append(asset['id'].split(':', 1)[1]) + feeds = [] - for i, section in enumerate(section.findAll('section')): - h2 = section.find('h2') - section_title = self.tag_to_string(h2) - self.log('\nFound section:', section_title) - if i == 0: - articles = [] - for div in section.findAll('div', recursive=False): - articles += list(self.parse_todays_sections(div.find('ol'))) - else: - articles = list(self.parse_todays_sections(section.find('ol'))) - if articles: - feeds.append((section_title, articles)) + for i, section_title in enumerate(containers): + if i in sections: + articles = sections[i] + if articles: + self.log('\n' + section_title) + feeds.append((section_title, [])) + for artid in articles: + if artid in article_map: + art = article_map[artid] + feeds[-1][1].append(art) + self.log('\t' + art['title']) + + def skey(x): + name = x[0].strip() + if name == 'The Front Page': + return 0, '' + return 1, name.lower() + feeds.sort(key=skey) return feeds def parse_highlights(self, container): @@ -292,8 +299,10 @@ class NewYorkTimes(BasicNewsRecipe): return self.get_browser() def open_novisit(self, *args, **kwargs): - from calibre import browser - br = browser() + from calibre import browser, random_user_agent + if not hasattr(self, 'rua_stored'): + self.rua_stored = random_user_agent(allow_ie=False) + br = browser(user_agent=self.rua_stored) response = br.open_novisit(*args, **kwargs) # headers = response.info() # if headers.get('X-PageType') == 'vi-story': From 91f30f51aa9b9e8ba8113259d6b79b1d15dd220b Mon Sep 17 00:00:00 2001 From: PJ Paul Date: Mon, 5 Nov 2018 13:48:40 +0300 Subject: [PATCH 0017/2613] Recipe for Arts and Letters Daily A recipe to pull the contents of the facing page of Arts and Letters Daily https://www.aldaily.com/ --- recipes/ald.recipe | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 recipes/ald.recipe diff --git a/recipes/ald.recipe b/recipes/ald.recipe new file mode 100644 index 0000000000..802f1d1c42 --- /dev/null +++ b/recipes/ald.recipe @@ -0,0 +1,37 @@ +#!/usr/bin/env python2 +from __future__ import unicode_literals, division, absolute_import, print_function +__license__ = 'GPL v3' +__copyright__ = '2018, PJ Paul ' + +''' +Recipe for Arts and Letters Daily website https://www.aldaily.com/ +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class ALD(BasicNewsRecipe): + title = 'Arts and Letters Daily' + oldest_article = 7 + max_articles_per_feed = 100 + auto_cleanup = True + recursions = 0 + ignore_duplicate_articles = {'url'} + index = 'https://www.aldaily.com/alt/' + cover_url = 'https://www.aldaily.com/static/images/header.gif' + + __author__ = 'https://github.com/pjpaulpj' + language = 'en' + encoding = 'utf-8' + + ## Define parser for the page + def parse_index(self): + articles = [] + feeds = [] + soup = self.index_to_soup(self.index) + for x in soup.findAll('p'): + if x.find('a'): + title = self.tag_to_string(x) + url = x.find('a')['href'] + articles.append({'title':title, 'url':url, 'description': '', 'date':''}) + feeds.append(('Articles', articles)) + return feeds From 58a51c94efd13b80458071319575d16d772dd6fc Mon Sep 17 00:00:00 2001 From: PJ Paul Date: Mon, 5 Nov 2018 17:29:20 +0300 Subject: [PATCH 0018/2613] Updated Arts and Letters Daily Made following changes: 1. Articles older than oldest articles parameter are ignored. 2. Articles are now grouped as per their section headers. --- recipes/ald.recipe | 56 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/recipes/ald.recipe b/recipes/ald.recipe index c78c78d81a..f11d47e9f9 100644 --- a/recipes/ald.recipe +++ b/recipes/ald.recipe @@ -1,14 +1,17 @@ #!/usr/bin/env python2 from __future__ import unicode_literals, division, absolute_import, print_function __license__ = 'GPL v3' -__copyright__ = '2018, PJ Paul ' +__copyright__ = '2018, PJ Paul' ''' -Recipe for Arts and Letters Daily website https://www.aldaily.com/ +Recipe for Arts and Letters Daily website ''' from calibre.web.feeds.news import BasicNewsRecipe - +from datetime import date as dt +from datetime import timedelta +from datetime import datetime +from itertools import compress class ALD(BasicNewsRecipe): title = 'Arts and Letters Daily' @@ -19,19 +22,50 @@ class ALD(BasicNewsRecipe): ignore_duplicate_articles = {'url'} index = 'https://www.aldaily.com/alt/' cover_url = 'https://www.aldaily.com/static/images/header.gif' - __author__ = 'https://github.com/pjpaulpj' language = 'en' encoding = 'utf-8' + ## Define parser for the page def parse_index(self): - articles = [] + articles_note = [] + new_books = [] + essays = [] feeds = [] soup = self.index_to_soup(self.index) - for x in soup.findAll('p'): - if x.find('a'): - title = self.tag_to_string(x) - url = x.find('a')['href'] - articles.append({'title':title, 'url':url, 'description': '', 'date':''}) - feeds.append(('Articles', articles)) + delta = timedelta(days = self.oldest_article) + now = dt.today() + oldest_date = now - delta + + # Extract a list of dates from the page. + # Subset this out to the list of target dates for extraction. + date_list = [] + for div in soup.findAll('div', attrs = {'id': "dayheader"}): + date_list.append(self.tag_to_string(div)) + date_list_clean = [re.sub(r'[^\w]', ' ', date) for date in date_list] + date_list_bool = [datetime.strptime(date, '%b %d %Y').date() >= oldest_date for date in date_list_clean] + compress_date = list(compress(date_list, date_list_bool)) + + # Process each paragraph one by one. + # Stop when the text of the previous div is not in the target date list. + for div in soup.findAll('div', attrs = {'class': "mobile-front"}): + for p in div.findAll('p'): + if self.tag_to_string(p.findPreviousSibling('div')) in compress_date: + if p.find('a'): + title =self.tag_to_string(p) + link = p.find('a')['href'] + if self.tag_to_string(p.findPreviousSibling('h3')) == "Articles of Note": + articles_note.append({'title':title, 'url':link, 'description': '', 'date':''}) + elif self.tag_to_string(p.findPreviousSibling('h3')) == "New Books": + new_books.append({'title':title, 'url':link, 'description': '', 'date':''}) + else: + essays.append({'title':title, 'url':link, 'description': '', 'date':''}) + else: + break + feeds.append(('Articles of Note', articles_note)) + feeds.append(('New Books', new_books)) + feeds.append(('Essays and Opinions', essays)) return feeds + + + From b8fec63df67361cfda91c5e0d86d1ab44a20b209 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 5 Nov 2018 21:07:21 +0530 Subject: [PATCH 0019/2613] fix typo --- src/calibre/db/write.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/db/write.py b/src/calibre/db/write.py index ffd8f9633a..3c7e09e24f 100644 --- a/src/calibre/db/write.py +++ b/src/calibre/db/write.py @@ -59,7 +59,7 @@ def multiple_text(sep, ui_sep, x): if not x: return () if isinstance(x, bytes): - x = x.decode(preferred_encoding, 'replce') + x = x.decode(preferred_encoding, 'replace') if isinstance(x, unicode): x = x.split(sep) else: From 76924d014605ff8ce307301ad0ec7f06cdb47198 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 6 Nov 2018 11:53:27 +0530 Subject: [PATCH 0020/2613] Update Business Standard --- recipes/business_standard.recipe | 44 ++++++++++++++++---------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/recipes/business_standard.recipe b/recipes/business_standard.recipe index 37b060d71d..868ce20750 100644 --- a/recipes/business_standard.recipe +++ b/recipes/business_standard.recipe @@ -7,6 +7,12 @@ www.business-standard.com 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)}) + + class BusinessStandard(BasicNewsRecipe): title = 'Business Standard' __author__ = 'Darko Miletic' @@ -15,36 +21,30 @@ class BusinessStandard(BasicNewsRecipe): max_articles_per_feed = 100 no_stylesheets = True use_embedded_content = False - auto_cleanup = False - encoding = 'cp1252' + encoding = 'utf-8' publisher = 'Business Standard Limited' category = 'news, business, money, india, world' language = 'en_IN' - masthead_url = 'http://feeds.business-standard.com/images/logo_08.jpg' conversion_options = { 'comments': description, 'tags': category, 'language': language, 'publisher': publisher, 'linearize_tables': True } - remove_tags = [ - dict(name=['object', 'link', 'script', 'iframe', 'base', 'meta']), dict( - attrs={'class': 'rightDiv2'}), dict(name='table', attrs={'width': '450px'}) + remove_attributes = ['width', 'height', 'style'] + keep_only_tags = [ + classes('headline alternativeHeadline full-img story-content pubDate'), + ] + remove_tags = [ + classes('also-read-panel') ] - remove_attributes = ['width', 'height'] feeds = [ - - (u'News Now', u'http://feeds.business-standard.com/rss/online.xml'), - (u'Banking & finance', u'http://feeds.business-standard.com/rss/3_0.xml'), - (u'Companies & Industry', u'http://feeds.business-standard.com/rss/2_0.xml'), - (u'Economy & Policy', u'http://feeds.business-standard.com/rss/4_0.xml'), - (u'Tech World', u'http://feeds.business-standard.com/rss/8_0.xml'), - (u'Life & Leisure', u'http://feeds.business-standard.com/rss/6_0.xml'), - (u'Markets & Investing', u'http://feeds.business-standard.com/rss/1_0.xml'), - (u'Management & Mktg', u'http://feeds.business-standard.com/rss/7_0.xml'), - (u'Opinion', u'http://feeds.business-standard.com/rss/5_0.xml') + (u'News Now', u'http://feeds.business-standard.com/rss/online.xml'), + (u'Banking & finance', u'http://feeds.business-standard.com/rss/3_0.xml'), + (u'Companies & Industry', u'http://feeds.business-standard.com/rss/2_0.xml'), + (u'Economy & Policy', u'http://feeds.business-standard.com/rss/4_0.xml'), + (u'Tech World', u'http://feeds.business-standard.com/rss/8_0.xml'), + (u'Life & Leisure', u'http://feeds.business-standard.com/rss/6_0.xml'), + (u'Markets & Investing', u'http://feeds.business-standard.com/rss/1_0.xml'), + (u'Management & Mktg', u'http://feeds.business-standard.com/rss/7_0.xml'), + (u'Opinion', u'http://feeds.business-standard.com/rss/5_0.xml') ] - - def print_version(self, url): - l, s, tp = url.rpartition('/') - t, k, autono = l.rpartition('/') - return 'http://www.business-standard.com/india/printpage.php?autono=' + autono + '&tp=' + tp From a616a092b2b1e6a1a627f845e339cf0e5c96e798 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 7 Nov 2018 20:49:20 +0530 Subject: [PATCH 0021/2613] Kindle driver: Add support for new 2018 Kindle Paperwhite Fixes #1802088 [Kindle Paperwhite 2018 is not detected (new kindle)](https://bugs.launchpad.net/calibre/+bug/1802088) --- src/calibre/devices/kindle/driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/devices/kindle/driver.py b/src/calibre/devices/kindle/driver.py index 98e1d53790..6358c96a09 100644 --- a/src/calibre/devices/kindle/driver.py +++ b/src/calibre/devices/kindle/driver.py @@ -328,7 +328,7 @@ class KINDLE2(KINDLE): # (for X-Ray & End Actions), azw3f & azw3r files, but all of them are in # the .sdr sidecar folder - PRODUCT_ID = [0x0002, 0x0004] + PRODUCT_ID = [0x0002, 0x0004, 0x0324] BCD = [0x0100, 0x0310, 0x401] # SUPPORTS_SUB_DIRS = False # Apparently the Paperwhite doesn't like files placed in subdirectories # SUPPORTS_SUB_DIRS_FOR_SCAN = True From dc636725fa26b08501807fbfb23a81f9ac197f93 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 8 Nov 2018 09:52:30 +0530 Subject: [PATCH 0022/2613] EPUB Input: Handle invalid EPUB files that have their NCX documents in the spine. Fixes #1796497 [AttributeError: 'NoneType' object has no attribute 'get'](https://bugs.launchpad.net/calibre/+bug/1796497) --- src/calibre/ebooks/oeb/reader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/reader.py b/src/calibre/ebooks/oeb/reader.py index 736e110bb8..844f0c33d3 100644 --- a/src/calibre/ebooks/oeb/reader.py +++ b/src/calibre/ebooks/oeb/reader.py @@ -337,7 +337,7 @@ class OEBReader(object): self.logger.warn(u'Spine item %r not found' % idref) continue item = manifest.ids[idref] - if item.media_type.lower() in OEB_DOCS and hasattr(item.data, 'xpath'): + if item.media_type.lower() in OEB_DOCS and hasattr(item.data, 'xpath') and not getattr(item.data, 'tag', '').endswith('}ncx'): spine.add(item, elem.get('linear')) else: if hasattr(item.data, 'tag') and item.data.tag and item.data.tag.endswith('}html'): From 79a0a7ab583f0fd2b972269afac1fc6a37ae5fe7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 8 Nov 2018 10:02:30 +0530 Subject: [PATCH 0023/2613] pep8 --- src/calibre/ebooks/metadata/sources/base.py | 3 +-- src/calibre/gui2/metadata/basic_widgets.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/metadata/sources/base.py b/src/calibre/ebooks/metadata/sources/base.py index f3ef0a7bc7..0513209277 100644 --- a/src/calibre/ebooks/metadata/sources/base.py +++ b/src/calibre/ebooks/metadata/sources/base.py @@ -495,7 +495,7 @@ class Source(Plugin): that could result in a generic cover image or a not found error. ''' return None - + def id_from_url(self, url): ''' Parse a URL and return a tuple of the form: @@ -505,7 +505,6 @@ class Source(Plugin): ''' return None - def identify_results_keygen(self, title=None, authors=None, identifiers={}): ''' diff --git a/src/calibre/gui2/metadata/basic_widgets.py b/src/calibre/gui2/metadata/basic_widgets.py index 79a996eb21..0cb8ccdae4 100644 --- a/src/calibre/gui2/metadata/basic_widgets.py +++ b/src/calibre/gui2/metadata/basic_widgets.py @@ -1668,7 +1668,7 @@ class IdentifiersEdit(QLineEdit, ToMetadataMixin): text = unicode(QApplication.clipboard().text()).strip() if not text: return False - + rules = msprefs['id_link_rules'] if rules: formatter = EvalFormatter() From c19cbe3d4a10bd0bac88349bca1915be71acd45b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 8 Nov 2018 10:07:03 +0530 Subject: [PATCH 0024/2613] version 3.34.0 --- Changelog.yaml | 32 ++++++++++++++++++++++++++++++++ src/calibre/constants.py | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Changelog.yaml b/Changelog.yaml index 1fadcd3933..c6e8a32bb1 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -20,6 +20,38 @@ # new recipes: # - title: +- version: 3.34.0 + date: 2018-11-08 + + new features: + - title: "Support for the new Kindle Paperwhite 2018" + tickets: [1802088] + + - title: "Metadata plugboards: Allow defining plugboards that modify comments metadata as well" + + - title: "E-book viewer: Add a keyboard shortcut (Ctrl+M) for toggling between paged and flow mode" + + bug fixes: + - title: "EPUB Input: Handle invalid EPUB files that have their NCX documents in the spine." + tickets: [1796497] + + - title: "EPUB3 Input: Handle EPUB 3 files that incorrectly use EPUB 2 markup to identify cover images." + + - title: "Content server: Fix --url-prefix feature not working with book conversion" + + improved recipes: + - Business Standard + - Washington Post + - General Knowledge Today + - How To Geek + + new recipes: + - title: Arts and Letters Daily + author: pjpaulpj + + - title: Magyar Idok + author: pofa + - version: 3.33.1 date: 2018-10-19 diff --git a/src/calibre/constants.py b/src/calibre/constants.py index dd156b8cbe..0a8d01af6d 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -6,7 +6,7 @@ from polyglot.builtins import map import sys, locale, codecs, os, importlib, collections __appname__ = u'calibre' -numeric_version = (3, 33, 1) +numeric_version = (3, 34, 0) __version__ = u'.'.join(map(unicode, numeric_version)) __author__ = u"Kovid Goyal " From 22eb77f5184f986f3a7c9bc14acbfcdfe23707e2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 8 Nov 2018 15:52:49 +0530 Subject: [PATCH 0025/2613] Fix incorrect assignment of articles to sections in NYT recipe --- recipes/nytimes.recipe | 20 +++++++++++++------- recipes/nytimes_sub.recipe | 20 +++++++++++++------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/recipes/nytimes.recipe b/recipes/nytimes.recipe index 7a22234c32..32bf4e983c 100644 --- a/recipes/nytimes.recipe +++ b/recipes/nytimes.recipe @@ -171,8 +171,9 @@ class NewYorkTimes(BasicNewsRecipe): script = soup.findAll('script', text=lambda x: x and 'window.__preloadedData' in x)[0] script = type(u'')(script) data = json.loads(script[script.find('{'):].strip().rstrip(';'))['initialState'] - containers, sections = [], {} + containers, sections = {}, {} article_map = {} + gc_pat = re.compile(r'groupings.(\d+).containers.(\d+)') pat = re.compile(r'groupings.(\d+).containers.(\d+).relations.(\d+)') for key in data: if 'Article' in key: @@ -189,7 +190,8 @@ class NewYorkTimes(BasicNewsRecipe): sdata = data[key] tname = sdata.get('__typename') if tname == 'LegacyCollectionContainer': - containers.append(sdata['label'] or sdata['name']) + m = gc_pat.search(key) + containers[int(m.group(2))] = sdata['label'] or sdata['name'] elif tname == 'LegacyCollectionRelation': m = pat.search(key) grouping, container, relation = map(int, m.groups()) @@ -200,17 +202,16 @@ class NewYorkTimes(BasicNewsRecipe): sections[container].append(asset['id'].split(':', 1)[1]) feeds = [] - for i, section_title in enumerate(containers): - if i in sections: - articles = sections[i] + for container_num in sorted(containers): + section_title = containers[container_num] + if container_num in sections: + articles = sections[container_num] if articles: - self.log('\n' + section_title) feeds.append((section_title, [])) for artid in articles: if artid in article_map: art = article_map[artid] feeds[-1][1].append(art) - self.log('\t' + art['title']) def skey(x): name = x[0].strip() @@ -218,6 +219,11 @@ class NewYorkTimes(BasicNewsRecipe): return 0, '' return 1, name.lower() feeds.sort(key=skey) + for section, articles in feeds: + self.log('\n' + section) + for article in articles: + self.log(article['title'] + ' - ' + article['url']) + # raise SystemExit(1) return feeds def parse_highlights(self, container): diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index a624577b7f..7399a96415 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -171,8 +171,9 @@ class NewYorkTimes(BasicNewsRecipe): script = soup.findAll('script', text=lambda x: x and 'window.__preloadedData' in x)[0] script = type(u'')(script) data = json.loads(script[script.find('{'):].strip().rstrip(';'))['initialState'] - containers, sections = [], {} + containers, sections = {}, {} article_map = {} + gc_pat = re.compile(r'groupings.(\d+).containers.(\d+)') pat = re.compile(r'groupings.(\d+).containers.(\d+).relations.(\d+)') for key in data: if 'Article' in key: @@ -189,7 +190,8 @@ class NewYorkTimes(BasicNewsRecipe): sdata = data[key] tname = sdata.get('__typename') if tname == 'LegacyCollectionContainer': - containers.append(sdata['label'] or sdata['name']) + m = gc_pat.search(key) + containers[int(m.group(2))] = sdata['label'] or sdata['name'] elif tname == 'LegacyCollectionRelation': m = pat.search(key) grouping, container, relation = map(int, m.groups()) @@ -200,17 +202,16 @@ class NewYorkTimes(BasicNewsRecipe): sections[container].append(asset['id'].split(':', 1)[1]) feeds = [] - for i, section_title in enumerate(containers): - if i in sections: - articles = sections[i] + for container_num in sorted(containers): + section_title = containers[container_num] + if container_num in sections: + articles = sections[container_num] if articles: - self.log('\n' + section_title) feeds.append((section_title, [])) for artid in articles: if artid in article_map: art = article_map[artid] feeds[-1][1].append(art) - self.log('\t' + art['title']) def skey(x): name = x[0].strip() @@ -218,6 +219,11 @@ class NewYorkTimes(BasicNewsRecipe): return 0, '' return 1, name.lower() feeds.sort(key=skey) + for section, articles in feeds: + self.log('\n' + section) + for article in articles: + self.log(article['title'] + ' - ' + article['url']) + # raise SystemExit(1) return feeds def parse_highlights(self, container): From b09766f26c1bcfbb60de9276b83b84c753d7fc97 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 9 Nov 2018 09:34:23 +0530 Subject: [PATCH 0026/2613] ... --- manual/news.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual/news.rst b/manual/news.rst index f09f1af413..1ea813f20a 100644 --- a/manual/news.rst +++ b/manual/news.rst @@ -269,7 +269,7 @@ of articles that appear in *todays* paper. While more complex than simply using days paper. ``parse_index`` makes heavy use of `BeautifulSoup `_ to parse the daily paper webpage. You can also use other, more modern parsers if you -dislike BeatifulSoup. calibre comes with `lxml `_ and +dislike BeautifulSoup. calibre comes with `lxml `_ and `html5lib `_, which are the recommended parsers. To use them, replace the call to ``index_to_soup()`` with the following:: From a42a49adf6bce1ff4f957b88ba69fb1efb0fcadf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 10 Nov 2018 11:03:12 +0530 Subject: [PATCH 0027/2613] Mandidner by pofa --- recipes/mandidner.recipe | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 recipes/mandidner.recipe diff --git a/recipes/mandidner.recipe b/recipes/mandidner.recipe new file mode 100644 index 0000000000..fae84ca525 --- /dev/null +++ b/recipes/mandidner.recipe @@ -0,0 +1,15 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +from __future__ import unicode_literals, division, absolute_import, print_function +from calibre.web.feeds.news import AutomaticNewsRecipe + + +class BasicUserRecipe1541708734(AutomaticNewsRecipe): + title = 'Mandídner' + oldest_article = 1 + max_articles_per_feed = 100 + auto_cleanup = True + + feeds = [ + ('Mandídner', 'http://mandiner.hu/rss/'), + ] From 4a5d4e4e3429978a59615fafa5b0fa3041c9b483 Mon Sep 17 00:00:00 2001 From: Lionel PLAIS Date: Sat, 10 Nov 2018 22:15:54 +0100 Subject: [PATCH 0028/2613] Le Peuple Breton recipe Recipe for the French newspaper Le Peuple Breton. --- recipes/le_peuple_breton.recipe | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 recipes/le_peuple_breton.recipe diff --git a/recipes/le_peuple_breton.recipe b/recipes/le_peuple_breton.recipe new file mode 100644 index 0000000000..38937b644d --- /dev/null +++ b/recipes/le_peuple_breton.recipe @@ -0,0 +1,42 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +from __future__ import unicode_literals, division, absolute_import, print_function +from calibre.web.feeds.news import BasicNewsRecipe + +class LePeupleBreton(BasicNewsRecipe): + title = 'Le Peuple Breton' + __author__ = 'Lionel Plais ' + description = u'Aujourd\'hui, tre libre c\'est tre inform' + oldest_article = 90 + language = 'fr' + cover_img_url = 'http://lepeuplebreton.bzh/wp-content/uploads/2017/11/le-peuple-breton-logo.jpg' + masthead_url = cover_img_url + remove_javascript = True + no_stylesheets = True + + keep_only_tags = [ + dict(name='article'), + ] + + remove_tags = [ + dict(name='div', attrs={'class': ['share-post', 'juiz_sps_links', 'counters_both', 'juiz_sps_displayed_bottom']}), + ] + + feeds = [ + (u' la Une', u'http://lepeuplebreton.bzh/category/a-la-une/feed/'), + (u'Bretagne', u'http://lepeuplebreton.bzh/category/themes/bretagne/feed/'), + (u'France', u'http://lepeuplebreton.bzh/category/lieu/france/feed/'), + (u'International', u'http://lepeuplebreton.bzh/category/lieu/international-fr/feed/'), + (u'Point de vue', u'http://lepeuplebreton.bzh/category/themes/point-de-vue/feed/'), + (u'conomie', u'https://lepeuplebreton.bzh/category/themes/economie/feed/'), + (u'cologie', u'http://lepeuplebreton.bzh/category/themes/ecologie/feed/'), + (u'Sant', u'http://lepeuplebreton.bzh/category/themes/sante/feed/'), + (u'Culture & Sport', u'http://lepeuplebreton.bzh/category/themes/culture/feed/'), + ] + + def preprocess_html(self, soup): + for alink in soup.findAll('a'): + if alink.string is not None: + tstr = alink.string + alink.replaceWith(tstr) + return soup \ No newline at end of file From bab04cf920d43cc3365a2e11e7373d18fab856be Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 12 Nov 2018 09:09:34 +0530 Subject: [PATCH 0029/2613] Forgot to remove leading slash in one other place --- src/pyj/book_list/convert_book.pyj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyj/book_list/convert_book.pyj b/src/pyj/book_list/convert_book.pyj index 66360a3e6e..fb77bbd212 100644 --- a/src/pyj/book_list/convert_book.pyj +++ b/src/pyj/book_list/convert_book.pyj @@ -129,7 +129,7 @@ def check_for_conversion_status(abort_job): if abort_job: query.abort_job = '1' data = {} - ajax_send(f'/conversion/status/{conversion_data.job_id}', data, on_conversion_status, query=query) + ajax_send(f'conversion/status/{conversion_data.job_id}', data, on_conversion_status, query=query) def on_conversion_started(end_type, xhr, ev): From 9f24576ab3048638b69cb50d9dff58f9a27b7cb4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 13 Nov 2018 09:29:21 +0530 Subject: [PATCH 0030/2613] Update Mother Jones --- recipes/motherjones.recipe | 117 ++++--------------------------------- 1 file changed, 11 insertions(+), 106 deletions(-) diff --git a/recipes/motherjones.recipe b/recipes/motherjones.recipe index a1976099ac..c066b2c724 100644 --- a/recipes/motherjones.recipe +++ b/recipes/motherjones.recipe @@ -1,111 +1,16 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +from __future__ import unicode_literals, division, absolute_import, print_function from calibre.web.feeds.news import BasicNewsRecipe -from calibre.ebooks.BeautifulSoup import Tag -from calibre.ptempfile import PersistentTemporaryFile -class MotherJonesRecipe(BasicNewsRecipe): - __license__ = 'GPL v3' - __author__ = 'kwetal' +class AdvancedUserRecipe1541791799(BasicNewsRecipe): + title = 'Mother Jones' language = 'en' - version = 1 - - title = u'Mother Jones' - publisher = u'Mother Jones' - category = u'News, Investigative journalism' - description = u'Independent investigative, political, and social justice reporting. Takes no prisoners, cleaves to no dogma, and tells it like it is.' - + __author__ = 'Daniel Bonnery' oldest_article = 14 - max_articles_per_feed = 100 - use_embedded_content = False - - remove_empty_feeds = True - no_stylesheets = True - remove_javascript = True - simultaneous_downloads = 3 - - keep_only_tags = [] - keep_only_tags.append(dict(name='h1')) - keep_only_tags.append(dict(name='div', attrs={'class': 'dek'})) - keep_only_tags.append(dict(name='p', attrs={'class': 'submitted'})) - keep_only_tags.append(dict(name='div', attrs={'class': 'print-content'})) - # keep_only_tags.append(dict(name = '', attrs = {'': ''})) - - remove_tags = [] - remove_tags.append(dict(name='base')) - # remove_tags.append(dict(name = '', attrs = {'': ''})) - - remove_attributes = ['style'] - - # feeds from http://motherjones.com/about/rss - feeds = [] - feeds.append( - (u'Latest News', u'http://feeds.feedburner.com/motherjones/main?format=xml')) - feeds.append((u'Politics & Current Affairs', - u'http://motherjones.com/rss/sections/Politics/feed&format=xml')) - feeds.append((u'Environment & Health', - u'http://motherjones.com/rss/sections/Environment/feed')) - feeds.append( - (u'Media & Culture', u'http://motherjones.com/rss/sections/Media/feed')) - feeds.append( - (u'Blog: Kevin Drum', u'http://motherjones.com/rss/blogs/Kevin+Drum/feed')) - feeds.append( - (u'Blog: MoJo Blog', u'http://motherjones.com/rss/blogs/mojo/feed')) - feeds.append( - (u'Blog: Blue Marble', u'http://motherjones.com/rss/blogs/Blue+Marble/feed')) - feeds.append( - (u'Blog: The Riff', u'http://motherjones.com/rss/blogs/Riff/feed')) - - extra_css = ''' - body{font-family:verdana,arial,helvetica,geneva,sans-serif;} - img {float: left; margin-right: 0.5em;} - div.dek {font-style: italic;} - p.submitted {font-size: x-small; color: #696969;} - div.mj_support {font-size: x-small; color: #0666666; border: 1px solid black; padding: 0.5em} - a, a[href] {text-decoration: none; color: blue;} - ''' - - conversion_options = {'comments': description, 'tags': category, 'language': 'en', - 'publisher': publisher} - - temp_files = [] - articles_are_obfuscated = True - - def get_obfuscated_article(self, url): - ''' - The print version is sort of hard to get. I think they look at the referer header, and if - it is not right they serve the original. This method works around that. - ''' - br = self.get_browser() - br.open(url) - - response = br.follow_link(url_regex=r'/print/[0-9]+', nr=0) - html = response.read() - - self.temp_files.append(PersistentTemporaryFile('_motherjones.html')) - self.temp_files[-1].write(html) - self.temp_files[-1].close() - - return self.temp_files[-1].name - - def get_article_url(self, article): - ''' - Some of the feeds are served by feedburner (grr). Then the workaround to get their - print version doesn't work anymore. This method provides a workaround. - ''' - if hasattr(article, 'feedburner_origlink'): - return article.feedburner_origlink - else: - return article.link - - def preprocess_html(self, soup): - for img in soup.findAll('img', attrs={'src': True}): - if not img['src'].startswith('http://'): - img['src'] = 'http://motherjones.com' + img['src'] - - div = Tag(soup, 'div', [('class', 'mj_support')]) - div.append('''Your tax-deductible gifts help keep Mother Jones independent and uncompromised. - To make a contribution, visit MotherJones.com or call 877-GIV-MOJO. - ''') - soup.body.append(div) - - return soup + max_articles_per_feed = 200 + auto_cleanup = True + feeds = [ + ('Mother Jones', 'http://feeds.feedburner.com/motherjones/feed'), + ] From 5a7275b976b8cc0bd952de1a09771f78e8258134 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 13 Nov 2018 09:54:00 +0530 Subject: [PATCH 0031/2613] Update Associated Press --- recipes/ap.recipe | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/recipes/ap.recipe b/recipes/ap.recipe index 0d290bccd4..6d395af474 100644 --- a/recipes/ap.recipe +++ b/recipes/ap.recipe @@ -7,6 +7,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera import json from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import Tag def classes(classes): @@ -28,11 +29,11 @@ class AssociatedPress(BasicNewsRecipe): ignore_duplicate_articles = {'title', 'url'} remove_empty_feeds = False keep_only_tags = [ - classes('topTitle articleImage articleBody'), + classes('CardHeadline LeadFeature Article'), ] remove_tags = [ classes('ad-placeholder modalImageButton modalVideoButton'), - dict(name='button'), + dict(name=['button', 'svg']), ] def parse_index(self): @@ -71,3 +72,11 @@ class AssociatedPress(BasicNewsRecipe): articles.append({'title': title, 'url': url}) self.log('') return articles + + def preprocess_html(self, soup, *a): + for meta in soup.findAll('meta', attrs=dict(name="twitter:image:alt")): + for div in soup.findAll(**classes('LeadFeature')): + img = Tag(soup, 'img') + img['src'] = meta['content'] + div.insert(0, img) + return soup From 82246b62eae2f0567986945919f285df0e5b1e34 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 13 Nov 2018 10:14:42 +0530 Subject: [PATCH 0032/2613] Update Yahoo News --- recipes/yahoo_news.recipe | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/recipes/yahoo_news.recipe b/recipes/yahoo_news.recipe index aef8d658e9..ff5b21ad21 100644 --- a/recipes/yahoo_news.recipe +++ b/recipes/yahoo_news.recipe @@ -1,5 +1,11 @@ from calibre.web.feeds.news import BasicNewsRecipe -import re + + +def classes(classes): + q = frozenset(classes.split(' ')) + return dict( + attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)} + ) class YahooNews(BasicNewsRecipe): @@ -20,13 +26,15 @@ class YahooNews(BasicNewsRecipe): (u'Science', u'http://rss.news.yahoo.com/rss/science') ] - keep_only_tags = [dict(name='div', attrs={'id': 'yn-story'})] + keep_only_tags = [ + dict(name='h1'), + dict(attrs={'itemprop': 'articleBody'}) + ] - remove_tags = [dict(name='div', attrs={'class': ['hd', 'ft', 'yn-share-social']}), - dict(name='div', attrs={'id': ['yn-story-minor-media']})] - - preprocess_regexps = [ - (re.compile(r'Play Video', re.DOTALL), lambda match: '')] + remove_tags = [ + classes('canvas-yahoovideo canvas-sharebuttons'), + dict(name='button'), + ] extra_css = ''' h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;} From 265b2a506b8ea08866e11490e3e5e12e3b996ccc Mon Sep 17 00:00:00 2001 From: David Date: Wed, 14 Nov 2018 23:14:18 +1100 Subject: [PATCH 0033/2613] Update metadata in Kobo database Added options to decide to update metadata, for the Subtitle and whether to update purchased books. The update will use a metadata plugboard if there is one. --- src/calibre/devices/kobo/books.py | 46 ++- src/calibre/devices/kobo/driver.py | 347 +++++++++++++++---- src/calibre/devices/kobo/kobotouch_config.py | 154 +++++++- 3 files changed, 461 insertions(+), 86 deletions(-) diff --git a/src/calibre/devices/kobo/books.py b/src/calibre/devices/kobo/books.py index 234e1de10d..2b6e6f6052 100644 --- a/src/calibre/devices/kobo/books.py +++ b/src/calibre/devices/kobo/books.py @@ -8,6 +8,7 @@ from calibre.constants import preferred_encoding, DEBUG from calibre import isbytestring, force_unicode from calibre.utils.icu import sort_key +from calibre.ebooks.metadata.book.base import Metadata from calibre.devices.usbms.books import Book as Book_ from calibre.devices.usbms.books import CollectionsBookList from calibre.utils.config_base import prefs @@ -20,12 +21,15 @@ class Book(Book_): def __init__(self, prefix, lpath, title=None, authors=None, mime=None, date=None, ContentType=None, thumbnail_name=None, size=None, other=None): from calibre.utils.date import parse_date -# debug_print('Book::__init__ - title=', title) +# debug_print('Book::__init__ - title=', title) show_debug = title is not None and title.lower().find("xxxxx") >= 0 + if other is not None: + other.title = title + other.published_date = date if show_debug: debug_print("Book::__init__ - title=", title, 'authors=', authors) debug_print("Book::__init__ - other=", other) - Book_.__init__(self, prefix, lpath, size, other) + super(Book, self).__init__(prefix, lpath, size, other) if title is not None and len(title) > 0: self.title = title @@ -58,12 +62,14 @@ class Book(Book_): except: self.datetime = time.gmtime() + self.kobo_metadata = Metadata(title, self.authors) self.contentID = None self.current_shelves = [] self.kobo_collections = [] - self.kobo_series = None - self.kobo_series_number = None self.can_put_on_shelves = True + self.kobo_series = None + self.kobo_series_number = None # Kobo stores the series number as string. And it can have a leading "#". + self.kobo_subtitle = None if thumbnail_name is not None: self.thumbnail = ImageWrapper(thumbnail_name) @@ -72,6 +78,38 @@ class Book(Book_): debug_print("Book::__init__ end - self=", self) debug_print("Book::__init__ end - title=", title, 'authors=', authors) + @property + def is_sideloaded(self): + # If we don't have a content Id, we don't know what type it is. + return self.contentID and self.contentID.startswith("file") + + @property + def is_purchased_kepub(self): + return self.contentID and not self.contentID.startswith("file") + + def __unicode__(self): + ''' + A string representation of this object, suitable for printing to + console + ''' + ans = [u"Kobo metadata:"] + + def fmt(x, y): + ans.append(u'%-20s: %s'%(unicode(x), unicode(y))) + + if self.contentID: + fmt('Content ID', self.contentID) + if self.kobo_series: + fmt('Kobo Series', self.kobo_series + ' #%s'%self.kobo_series_number) + if self.kobo_subtitle: + fmt('Subtitle', self.kobo_subtitle) + if self.mime: + fmt('MimeType', self.mime) + + ans = u'\n'.join(ans) + u"\n" + self.kobo_metadata.__unicode__() + + return super(Book,self).__unicode__() + u"\n" + ans + class ImageWrapper(object): diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 361a8d1245..97be54617b 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -17,9 +17,14 @@ Extended to support Touch firmware 2.0.0 and later and newer devices by David Fo import os, time, shutil, re from contextlib import closing +from datetime import datetime +from calibre import strftime +from calibre.utils.date import parse_date from calibre.devices.usbms.books import BookList from calibre.devices.usbms.books import CollectionsBookList from calibre.devices.kobo.books import KTCollectionsBookList +from calibre.ebooks.metadata import authors_to_string +from calibre.ebooks.metadata.book.base import Metadata from calibre.devices.kobo.books import Book from calibre.devices.kobo.books import ImageWrapper from calibre.devices.mime import mime_type_ext @@ -73,7 +78,7 @@ class KOBO(USBMS): gui_name = 'Kobo Reader' description = _('Communicate with the Kobo Reader') author = 'Timothy Legge and David Forrester' - version = (2, 3, 3) + version = (2, 4, 0) dbversion = 0 fwversion = (0,0,0) @@ -164,23 +169,30 @@ class KOBO(USBMS): def device_database_path(self): return self.normalize_path(self._main_prefix + '.kobo/KoboReader.sqlite') - def device_database_connection(self): + def device_database_connection(self, use_row_factory=False): import apsw db_connection = apsw.Connection(self.device_database_path()) + if use_row_factory: + db_connection.setrowtrace(self.row_factory) + return db_connection + def row_factory(self, cursor, row): + return {k[0]: row[i] for i, k in enumerate(cursor.getdescription())} + def get_database_version(self, connection): cursor = connection.cursor() cursor.execute('SELECT version FROM dbversion') try: result = cursor.next() - dbversion = result[0] + dbversion = result['version'] except StopIteration: dbversion = 0 return dbversion + def get_firmware_version(self): # Determine the firmware version try: @@ -306,7 +318,7 @@ class KOBO(USBMS): else: debug_print(" Strange: The file: ", prefix, lpath, " does mot exist!") title = "FILE MISSING: " + title - book = Book(prefix, lpath, title, authors, mime, date, ContentType, ImageID, size=1048576) + book = Book(prefix, lpath, title, authors, mime, date, ContentType, ImageID, size=1048576) except: debug_print("prefix: ", prefix, "lpath: ", lpath, "title: ", title, "authors: ", authors, @@ -323,7 +335,7 @@ class KOBO(USBMS): traceback.print_exc() return changed - with closing(self.device_database_connection()) as connection: + with closing(self.device_database_connection(use_row_factory=True)) as connection: self.dbversion = self.get_database_version(connection) debug_print("Database Version: ", self.dbversion) @@ -370,20 +382,23 @@ class KOBO(USBMS): cursor.execute(query) changed = False - for i, row in enumerate(cursor): + for row in cursor: # self.report_progress((i+1) / float(numrows), _('Getting list of books on device...')) - if not hasattr(row[3], 'startswith') or row[3].startswith("file:///usr/local/Kobo/help/"): + if not hasattr(row['ContentID'], 'startswith') or row['ContentID'].startswith("file:///usr/local/Kobo/help/"): # These are internal to the Kobo device and do not exist continue - path = self.path_from_contentid(row[3], row[5], row[4], oncard) + path = self.path_from_contentid(row['ContentID'], row['ContentType'], row['MimeType'], oncard) mime = mime_type_ext(path_to_ext(path)) if path.find('kepub') == -1 else 'application/epub+zip' # debug_print("mime:", mime) - - if oncard != 'carda' and oncard != 'cardb' and not row[3].startswith("file:///mnt/sd/"): - changed = update_booklist(self._main_prefix, path, row[0], row[1], mime, row[2], row[5], row[6], row[7], row[4], row[8], row[9], row[10]) - # print "shortbook: " + path - elif oncard == 'carda' and row[3].startswith("file:///mnt/sd/"): - changed = update_booklist(self._card_a_prefix, path, row[0], row[1], mime, row[2], row[5], row[6], row[7], row[4], row[8], row[9], row[10]) + if oncard != 'carda' and oncard != 'cardb' and not row['ContentID'].startswith("file:///mnt/sd/"): + prefix = self._main_prefix + elif oncard == 'carda' and row['ContentID'].startswith("file:///mnt/sd/"): + prefix = self._card_a_prefix + changed = update_booklist(self._main_prefix, path, + row['Title'], row['Attribution'], mime, row['DateCreated'], row['ContentType'], + row['ImageId'], row['ReadStatus'], row['MimeType'], row['___ExpirationStatus'], + row['FavouritesIndex'], row['Accessibility'] + ) if changed: need_sync = True @@ -722,7 +737,7 @@ class KOBO(USBMS): @classmethod def book_from_path(cls, prefix, lpath, title, authors, mime, date, ContentType, ImageID): - # debug_print("KOBO:book_from_path - title=%s"%title) +# debug_print("KOBO:book_from_path - title=%s"%title) from calibre.ebooks.metadata import MetaInformation if cls.read_metadata or cls.MUST_READ_METADATA: @@ -769,21 +784,28 @@ class KOBO(USBMS): cursor.close() def set_readstatus(self, connection, ContentID, ReadStatus): + debug_print("Kobo::set_readstatus - ContentID=%s, ReadStatus=%d" % (ContentID, ReadStatus)) cursor = connection.cursor() t = (ContentID,) cursor.execute('select DateLastRead, ReadStatus from Content where BookID is Null and ContentID = ?', t) try: result = cursor.next() - datelastread = result[0] if result[0] is not None else '1970-01-01T00:00:00' - current_ReadStatus = result[1] + datelastread = result['DateLastRead'] + current_ReadStatus = result['ReadStatus'] except StopIteration: - datelastread = '1970-01-01T00:00:00' + datelastread = None current_ReadStatus = 0 if not ReadStatus == current_ReadStatus: + if ReadStatus == 0: + datelastread = None + else: + datelastread = 'CURRENT_TIMESTAMP' if datelastread is None else datelastread + t = (ReadStatus, datelastread, ContentID,) try: + debug_print("Kobo::set_readstatus - Making change - ContentID=%s, ReadStatus=%d, DateLastRead=%s" % (ContentID, ReadStatus, datelastread)) cursor.execute('update content set ReadStatus=?,FirstTimeReading=\'false\',DateLastRead=? where BookID is Null and ContentID = ?', t) except: debug_print(' Database Exception: Unable to update ReadStatus') @@ -854,7 +876,7 @@ class KOBO(USBMS): collections_attributes = ['tags'] collections = booklists.get_collections(collections_attributes) -# debug_print('Kobo:update_device_database_collections - Collections:', collections) +# debug_print('Kobo:update_device_database_collections - Collections:', collections) # Create a connection to the sqlite database # Needs to be outside books collection as in the case of removing @@ -1526,7 +1548,6 @@ class KOBOTOUCH(KOBO): def books(self, oncard=None, end_session=True): debug_print("KoboTouch:books - oncard='%s'"%oncard) - from calibre.ebooks.metadata.meta import path_to_ext self.debugging_title = self.get_debugging_title() dummy_bl = self.booklist_class(None, None, None) @@ -1577,15 +1598,19 @@ class KOBOTOUCH(KOBO): for idx,b in enumerate(bl): bl_cache[b.lpath] = idx - def update_booklist(prefix, path, title, authors, mime, date, ContentID, ContentType, ImageID, readstatus, MimeType, expired, favouritesindex, - accessibility, isdownloaded, series, seriesnumber, userid, bookshelves): + def update_booklist(prefix, path, ContentID, ContentType, MimeType, ImageID, + title, authors, DateCreated, Description, Publisher, series, seriesnumber, + ISBN, Language, Subtitle, + readstatus, expired, favouritesindex, accessibility, isdownloaded, + userid, bookshelves + ): show_debug = self.is_debugging_title(title) # show_debug = authors == 'L. Frank Baum' if show_debug: debug_print("KoboTouch:update_booklist - title='%s'"%title, "ContentType=%s"%ContentType, "isdownloaded=", isdownloaded) debug_print( - " prefix=%s, mime=%s, date=%s, readstatus=%d, MimeType=%s, expired=%d, favouritesindex=%d, accessibility=%d, isdownloaded=%s"% - (prefix, mime, date, readstatus, MimeType, expired, favouritesindex, accessibility, isdownloaded,)) + " prefix=%s, DateCreated=%s, readstatus=%d, MimeType=%s, expired=%d, favouritesindex=%d, accessibility=%d, isdownloaded=%s"% + (prefix, DateCreated, readstatus, MimeType, expired, favouritesindex, accessibility, isdownloaded,)) changed = False try: lpath = path.partition(self.normalize_path(prefix))[2] @@ -1658,6 +1683,23 @@ class KOBOTOUCH(KOBO): path = self.normalize_path(path) # print "Normalized FileName: " + path + # Collect the Kobo metadata + kobo_metadata = Metadata(title, [a.strip() for a in authors.split("&")]) + kobo_metadata.series = series + kobo_metadata.series_index = seriesnumber + kobo_metadata.comments = Description + kobo_metadata.publisher = Publisher + kobo_metadata.language = Language + kobo_metadata.isbn = ISBN + if DateCreated is not None: + try: + kobo_metadata.pubdate = parse_date(DateCreated, assume_utc=True) + except: + try: + kobo_metadata.pubdate = datetime.strptime(DateCreated, "%Y-%m-%dT%H:%M:%S.%fZ") + except: + debug_print("KoboTouch:update_booklist - Cannot convert date - DateCreated='%s'"%DateCreated) + idx = bl_cache.get(lpath, None) if idx is not None: # and not (accessibility == 1 and isdownloaded == 'false'): if show_debug: @@ -1690,9 +1732,12 @@ class KOBOTOUCH(KOBO): if show_debug: debug_print("KoboTouch:update_booklist - ContentID='%s'"%ContentID) bl[idx].contentID = ContentID + bl[idx].kobo_metadata = kobo_metadata bl[idx].kobo_series = series bl[idx].kobo_series_number = seriesnumber + bl[idx].kobo_subtitle = Subtitle bl[idx].can_put_on_shelves = allow_shelves + bl[idx].mime = MimeType if lpath in playlist_map: bl[idx].device_collections = playlist_map.get(lpath,[]) @@ -1710,19 +1755,19 @@ class KOBOTOUCH(KOBO): debug_print('KoboTouch:update_booklist - idx is none') try: if os.path.exists(self.normalize_path(os.path.join(prefix, lpath))): - book = self.book_from_path(prefix, lpath, title, authors, mime, date, ContentType, ImageID) + book = self.book_from_path(prefix, lpath, title, authors, MimeType, DateCreated, ContentType, ImageID) else: if isdownloaded == 'true': # A recommendation or preview is OK to not have a file debug_print(" Strange: The file: ", prefix, lpath, " does not exist!") title = "FILE MISSING: " + title - book = self.book_class(prefix, lpath, title, authors, mime, date, ContentType, ImageID, size=0) + book = self.book_class(prefix, lpath, title, authors, MimeType, DateCreated, ContentType, ImageID, size=0) if show_debug: debug_print('KoboTouch:update_booklist - book file does not exist. ContentID="%s"'%ContentID) except Exception as e: debug_print("KoboTouch:update_booklist - exception creating book: '%s'"%str(e)) debug_print(" prefix: ", prefix, "lpath: ", lpath, "title: ", title, "authors: ", authors, - "mime: ", mime, "date: ", date, "ContentType: ", ContentType, "ImageID: ", ImageID) + "MimeType: ", MimeType, "DateCreated: ", DateCreated, "ContentType: ", ContentType, "ImageID: ", ImageID) raise if show_debug: @@ -1740,8 +1785,10 @@ class KOBOTOUCH(KOBO): book.current_shelves = bookshelves book.kobo_collections = kobo_collections book.contentID = ContentID + book.kobo_metadata = kobo_metadata book.kobo_series = series book.kobo_series_number = seriesnumber + book.kobo_subtitle = Subtitle book.can_put_on_shelves = allow_shelves # debug_print('KoboTouch:update_booklist - title=', title, 'book.device_collections', book.device_collections) @@ -1770,7 +1817,7 @@ class KOBOTOUCH(KOBO): values = (ContentID, ) cursor.execute(query, values) for i, row in enumerate(cursor): - bookshelves.append(row[0]) + bookshelves.append(row['ShelfName']) cursor.close() # debug_print("KoboTouch:get_bookshelvesforbook - count bookshelves=" + unicode(count_bookshelves)) @@ -1778,30 +1825,28 @@ class KOBOTOUCH(KOBO): self.debug_index = 0 - with closing(self.device_database_connection()) as connection: + with closing(self.device_database_connection(use_row_factory=True)) as connection: debug_print("KoboTouch:books - reading device database") self.dbversion = self.get_database_version(connection) debug_print("Database Version: ", self.dbversion) - cursor = connection.cursor() - self.bookshelvelist = self.get_bookshelflist(connection) debug_print("KoboTouch:books - shelf list:", self.bookshelvelist) - columns = 'Title, Attribution, DateCreated, ContentID, MimeType, ContentType, ImageID, ReadStatus' + columns = 'Title, Attribution, DateCreated, ContentID, MimeType, ContentType, ImageId, ReadStatus, Description, Publisher, Language ' if self.dbversion >= 16: columns += ', ___ExpirationStatus, FavouritesIndex, Accessibility' else: columns += ', -1 as ___ExpirationStatus, -1 as FavouritesIndex, -1 as Accessibility' if self.dbversion >= 33: - columns += ', IsDownloaded' + columns += ', IsDownloaded, ISBN' else: - columns += ', "1" as IsDownloaded' + columns += ', "1" as IsDownloaded, null AS ISBN' if self.supports_series(): - columns += ", Series, SeriesNumber, ___UserID, ExternalId" + columns += ", Series, SeriesNumber, ___UserID, ExternalId, Subtitle" else: - columns += ', null as Series, null as SeriesNumber, ___UserID, null as ExternalId' + columns += ', null as Series, null as SeriesNumber, ___UserID, null as ExternalId, null as Subtitle' where_clause = '' if self.supports_kobo_archive() or self.supports_overdrive(): @@ -1855,6 +1900,8 @@ class KOBOTOUCH(KOBO): query = 'SELECT ' + columns + ' FROM content ' + where_clause + card_condition debug_print("KoboTouch:books - query=", query) + + cursor = connection.cursor() try: cursor.execute(query) except Exception as e: @@ -1862,38 +1909,43 @@ class KOBOTOUCH(KOBO): if not (any_in(err, '___ExpirationStatus', 'FavouritesIndex', 'Accessibility', 'IsDownloaded', 'Series', 'ExternalId')): raise query= ('SELECT Title, Attribution, DateCreated, ContentID, MimeType, ContentType, ' - 'ImageID, ReadStatus, -1 AS ___ExpirationStatus, "-1" AS ' - 'FavouritesIndex, -1 AS Accessibility, 1 AS IsDownloaded, NULL AS Series, NULL AS SeriesNumber ' + 'ImageId, ReadStatus, -1 AS ___ExpirationStatus, "-1" AS FavouritesIndex, ' + 'null AS ISBN, Language ' + '-1 AS Accessibility, 1 AS IsDownloaded, NULL AS Series, NULL AS SeriesNumber, null as Subtitle ' 'FROM content ' 'WHERE BookID IS NULL' ) cursor.execute(query) changed = False - for i, row in enumerate(cursor): - # self.report_progress((i+1) / float(numrows), _('Getting list of books on device...')) - show_debug = self.is_debugging_title(row[0]) + i = 0 + for row in cursor: + i += 1 +# self.report_progress((i) / float(books_on_device), _('Getting list of books on device...')) + show_debug = self.is_debugging_title(row['Title']) if show_debug: debug_print("KoboTouch:books - looping on database - row=%d" % i) - debug_print("KoboTouch:books - title='%s'"%row[0], "authors=", row[1]) + debug_print("KoboTouch:books - title='%s'"%row['Title'], "authors=", row['Attribution']) debug_print("KoboTouch:books - row=", row) - if not hasattr(row[3], 'startswith') or row[3].lower().startswith( - "file:///usr/local/kobo/help/") or row[3].lower().startswith("/usr/local/kobo/help/"): + if not hasattr(row['ContentID'], 'startswith') or row['ContentID'].lower().startswith( + "file:///usr/local/kobo/help/") or row['ContentID'].lower().startswith("/usr/local/kobo/help/"): # These are internal to the Kobo device and do not exist continue - externalId = None if row[15] and len(row[15]) == 0 else row[15] - path = self.path_from_contentid(row[3], row[5], row[4], oncard, externalId) - mime = mime_type_ext(path_to_ext(path)) if path.find('kepub') == -1 else 'application/x-kobo-epub+zip' - # debug_print("mime:", mime) + externalId = None if row['ExternalId'] and len(row['ExternalId']) == 0 else row['ExternalId'] + path = self.path_from_contentid(row['ContentID'], row['ContentType'], row['MimeType'], oncard, externalId) if show_debug: - debug_print("KoboTouch:books - path='%s'"%path, " ContentID='%s'"%row[3], " externalId=%s" % externalId) + debug_print("KoboTouch:books - path='%s'"%path, " ContentID='%s'"%row['ContentID'], " externalId=%s" % externalId) - bookshelves = get_bookshelvesforbook(connection, row[3]) + bookshelves = get_bookshelvesforbook(connection, row['ContentID']) prefix = self._card_a_prefix if oncard == 'carda' else self._main_prefix - changed = update_booklist(prefix, path, row[0], row[1], mime, row[2], row[3], row[5], - row[6], row[7], row[4], row[8], int(row[9]), row[10], row[11], - row[12], row[13], row[14], bookshelves) + changed = update_booklist(prefix, path, row['ContentID'], row['ContentType'], row['MimeType'], row['ImageId'], + row['Title'], row['Attribution'], row['DateCreated'], row['Description'], row['Publisher'], + row['Series'], row['SeriesNumber'], row['ISBN'], row['Language'], row['Subtitle'], + row['ReadStatus'], row['___ExpirationStatus'], + int(row['FavouritesIndex']), row['Accessibility'], row['IsDownloaded'], + row['___UserID'], bookshelves + ) if changed: need_sync = True @@ -2281,6 +2333,10 @@ class KOBOTOUCH(KOBO): ContentType = 901 return ContentType + def set_plugboards(self, plugboards, pb_func): + self.plugboards = plugboards + self.plugboard_func = pb_func + def update_device_database_collections(self, booklists, collections_attributes, oncard): debug_print("KoboTouch:update_device_database_collections - oncard='%s'"%oncard) if self.modify_database_check("update_device_database_collections") is False: @@ -2312,8 +2368,10 @@ class KOBOTOUCH(KOBO): create_collections = self.create_collections delete_empty_collections = self.delete_empty_collections - update_series_details = self.update_series_details - debugging_title = self.get_debugging_title() + update_series_details = self.update_series_details + update_core_metadata = self.update_core_metadata + update_purchased_kepubs = self.update_purchased_kepubs + debugging_title = self.get_debugging_title() debug_print("KoboTouch:update_device_database_collections - set_debugging_title to '%s'" % debugging_title) booklists.set_debugging_title(debugging_title) booklists.set_device_managed_collections(self.ignore_collections_names) @@ -2328,7 +2386,7 @@ class KOBOTOUCH(KOBO): # the last book from the collection the list of books is empty # and the removal of the last book would not occur - with closing(self.device_database_connection()) as connection: + with closing(self.device_database_connection(use_row_factory=True)) as connection: if self.manage_collections: if collections: @@ -2422,19 +2480,28 @@ class KOBOTOUCH(KOBO): self.reset_favouritesindex(connection, oncard) # Set the series info and cleanup the bookshelves only if the firmware supports them and the user has set the options. - if (self.supports_bookshelves and self.manage_collections or self.supports_series()) and (bookshelf_attribute or update_series_details): + if (self.supports_bookshelves and self.manage_collections or self.supports_series()) and (bookshelf_attribute or update_series_details or update_core_metadata): debug_print("KoboTouch:update_device_database_collections - managing bookshelves and series.") - self.series_set = 0 - books_in_library = 0 + self.series_set = 0 + self.core_metadata_set = 0 + books_in_library = 0 for book in booklists: - if book.application_id is not None: +# debug_print("KoboTouch:update_device_database_collections - book.title=%s, book.contentID=%s" % (book.title, book.contentID)) + if book.application_id is not None and book.contentID is not None: books_in_library += 1 show_debug = self.is_debugging_title(book.title) if show_debug: debug_print("KoboTouch:update_device_database_collections - book.title=%s" % book.title) - if update_series_details: - self.set_series(connection, book) + debug_print("KoboTouch:update_device_database_collections - contentId=%s, update_core_metadata=%s, update_purchased_kepubs=%s, book.is_sideloaded=%s" % (book.contentID, update_core_metadata, update_purchased_kepubs, book.is_sideloaded)) + if update_core_metadata and (update_purchased_kepubs or book.is_sideloaded): + if show_debug: + debug_print("KoboTouch:update_device_database_collections - calling set_core_metadata") + self.set_core_metadata(connection, book) + elif update_series_details: + if show_debug: + debug_print("KoboTouch:update_device_database_collections - calling set_core_metadata - series only") + self.set_core_metadata(connection, book, series_only=True) if self.manage_collections and bookshelf_attribute: if show_debug: debug_print("KoboTouch:update_device_database_collections - about to remove a book from shelves book.title=%s" % book.title) @@ -2444,6 +2511,7 @@ class KOBOTOUCH(KOBO): debug_print("KoboTouch:update_device_database_collections - about to clear empty bookshelves") self.delete_empty_bookshelves(connection) debug_print("KoboTouch:update_device_database_collections - Number of series set=%d Number of books=%d" % (self.series_set, books_in_library)) + debug_print("KoboTouch:update_device_database_collections - Number of core metadata set=%d Number of books=%d" % (self.core_metadata_set, books_in_library)) self.dump_bookshelves(connection) @@ -2752,8 +2820,8 @@ class KOBOTOUCH(KOBO): cursor = connection.cursor() cursor.execute(query) # count_bookshelves = 0 - for i, row in enumerate(cursor): - bookshelves.append(row[0]) + for row in cursor: + bookshelves.append(row['Name']) # count_bookshelves = i + 1 cursor.close() @@ -2790,7 +2858,7 @@ class KOBOTOUCH(KOBO): if show_debug: debug_print(' Did not find a record - adding') cursor.execute(addquery, add_values) - elif result[0] == 'true': + elif result['_IsDeleted'] == 'true': if show_debug: debug_print(' Found a record - updating - result=', result) cursor.execute(updatequery, update_values) @@ -2839,8 +2907,8 @@ class KOBOTOUCH(KOBO): if show_debug: debug_print(' Did not find a record - adding shelf "%s"' % bookshelf_name) cursor.execute(addquery, add_values) - elif result[2] == 'true': - debug_print('KoboTouch:check_for_bookshelf - Shelf "%s" is deleted - undeleting. result[2]="%s"' % (bookshelf_name, unicode(result[2]))) + elif result['_IsDeleted'] == 'true': + debug_print("KoboTouch:check_for_bookshelf - Shelf '%s' is deleted - undeleting. result['_IsDeleted']='%s'" % (bookshelf_name, unicode(result['_IsDeleted']))) cursor.execute(updatequery, test_values) cursor.close() @@ -2879,6 +2947,7 @@ class KOBOTOUCH(KOBO): debug_print("KoboTouch:remove_from_bookshelf - end") + # No longer used, but keep for a little bit. def set_series(self, connection, book): show_debug = self.is_debugging_title(book.title) if show_debug: @@ -2921,6 +2990,125 @@ class KOBOTOUCH(KOBO): if show_debug: debug_print("KoboTouch:set_series - end") + def set_core_metadata(self, connection, book, series_only=False): +# debug_print('KoboTouch:set_core_metadata book="%s"' % book.title) + show_debug = self.is_debugging_title(book.title) + if show_debug: + debug_print('KoboTouch:set_core_metadata book="%s", series_only="%s"' % (book, series_only)) + + plugboard = None + if self.plugboard_func and not series_only: + if book.contentID.endswith('.kepub.epub') or os.path.splitext(book.contentID)[1] == "": + extension = 'kepub' + else: + extension = os.path.splitext(book.contentID)[1][1:] + plugboard = self.plugboard_func(self.__class__.__name__, extension, self.plugboards) + + # If the book is a kepub, and there is no kepub plugboard, use the epub plugboard if it exists. + if not plugboard and extension == 'kepub': + plugboard = self.plugboard_func(self.__class__.__name__, 'epub', self.plugboards) + + if plugboard is not None: + newmi = book.deepcopy_metadata() + newmi.template_to_attribute(book, plugboard) + else: + newmi = book + + update_query = 'UPDATE content SET ' + update_values = [] + set_clause = '' + changes_found = False + kobo_metadata = book.kobo_metadata + + series_changed = not (newmi.series == kobo_metadata.series) + series_number_changed = False + if kobo_metadata.series_index: + try: + kobo_series_number = float(book.kobo_series_number) + except: + kobo_series_number = None + series_number_changed = not (kobo_series_number == newmi.series_index) + + if series_changed or series_number_changed: + if newmi.series: + new_series = newmi.series + new_series_number = "%g" % newmi.series_index + else: + new_series = None + new_series_number = None + + update_values.append(new_series) + set_clause += ', Series = ? ' + update_values.append(new_series_number) + set_clause += ', SeriesNumber = ? ' + + if not series_only: + if not (newmi.title == kobo_metadata.title): + update_values.append(newmi.title) + set_clause += ', Title = ? ' + + if not (authors_to_string(newmi.authors) == authors_to_string(kobo_metadata.authors)): + update_values.append(authors_to_string(newmi.authors)) + set_clause += ', Attribution = ? ' + + if not (newmi.publisher == kobo_metadata.publisher): + update_values.append(newmi.publisher) + set_clause += ', Publisher = ? ' + + if not (newmi.pubdate == kobo_metadata.pubdate): + pubdate_string = strftime(self.TIMESTAMP_STRING, newmi.pubdate) if newmi.pubdate else None + update_values.append(pubdate_string) + set_clause += ', DateCreated = ? ' + + if not (newmi.comments == kobo_metadata.comments): + update_values.append(newmi.comments) + set_clause += ', Description = ? ' + + if not (newmi.isbn == kobo_metadata.isbn): + update_values.append(newmi.isbn) + set_clause += ', ISBN = ? ' + + if not (newmi.language == kobo_metadata.language): + update_values.append(newmi.language) + set_clause += ', Language = ? ' + + if self.update_subtitle: + if self.subtitle_template is None or self.subtitle_template == '': + new_subtitle = None + else: + pb = [(self.subtitle_template, 'subtitle')] + book.template_to_attribute(book, pb) + new_subtitle = book.subtitle + if (new_subtitle and (book.kobo_subtitle is None or not book.subtitle == book.kobo_subtitle)) or \ + (new_subtitle is None and book.kobo_subtitle is not None): + update_values.append(new_subtitle) + set_clause += ', Subtitle = ? ' + + if len(set_clause) > 0: + update_query += set_clause[1:] + changes_found = True + if show_debug: + debug_print('KoboTouch:set_core_metadata set_clause="%s"' % set_clause) + debug_print('KoboTouch:set_core_metadata update_values="%s"' % update_values) + if changes_found: + update_query += 'WHERE ContentID = ? AND BookID IS NULL' + update_values.append(book.contentID) + cursor = connection.cursor() + try: + if show_debug: + debug_print('KoboTouch:set_core_metadata - about to set - parameters:', update_values) + debug_print('KoboTouch:set_core_metadata - about to set - update_query:', update_query) + cursor.execute(update_query, update_values) + self.core_metadata_set += 1 + except: + debug_print(' Database Exception: Unable to set the core metadata') + raise + finally: + cursor.close() + + if show_debug: + debug_print("KoboTouch:set_core_metadata - end") + @classmethod def config_widget(cls): # TODO: Cleanup the following @@ -2975,7 +3163,11 @@ class KOBOTOUCH(KOBO): c.add_opt('show_recommendations', default=False) c.add_opt('update_series', default=True) + c.add_opt('update_core_metadata', default=False) + c.add_opt('update_purchased_kepubs', default=False) c.add_opt('update_device_metadata', default=True) + c.add_opt('update_subtitle', default=False) + c.add_opt('subtitle_template', default=None) c.add_opt('modify_css', default=False) c.add_opt('override_kobo_replace_existing', default=True) # Overriding the replace behaviour is how the driver has always worked. @@ -3166,6 +3358,27 @@ class KOBOTOUCH(KOBO): def update_series_details(self): return self.update_device_metadata and self.get_pref('update_series') and self.supports_series() + @property + def update_subtitle(self): + # Subtitle was added to the database at the same time as the series support. + return self.update_device_metadata and self.supports_series() and self.subtitle_template is not None + + @property + def subtitle_template(self): + subtitle_template = self.get_pref('subtitle_template') + if subtitle_template is not None: + subtitle_template = subtitle_template.strip() + subtitle_template = subtitle_template.strip() if subtitle_template is not None else None + return subtitle_template + + @property + def update_core_metadata(self): + return self.update_device_metadata and self.get_pref('update_core_metadata') + + @property + def update_purchased_kepubs(self): + return self.update_device_metadata and self.get_pref('update_purchased_kepubs') + @classmethod def get_debugging_title(cls): debugging_title = cls.get_pref('debugging_title') diff --git a/src/calibre/devices/kobo/kobotouch_config.py b/src/calibre/devices/kobo/kobotouch_config.py index 329907377b..8329f169cf 100644 --- a/src/calibre/devices/kobo/kobotouch_config.py +++ b/src/calibre/devices/kobo/kobotouch_config.py @@ -9,11 +9,13 @@ __docformat__ = 'restructuredtext en' import textwrap -from PyQt5.Qt import (QLabel, QGridLayout, QLineEdit, QVBoxLayout, - QDialog, QDialogButtonBox, QCheckBox) +from PyQt5.Qt import (QWidget, QLabel, QGridLayout, QLineEdit, QVBoxLayout, + QDialog, QDialogButtonBox, QCheckBox, QPushButton) from calibre.gui2.device_drivers.tabbed_device_config import TabbedDeviceConfig, DeviceConfigTab, DeviceOptionsGroupBox from calibre.devices.usbms.driver import debug_print +from calibre.gui2 import error_dialog +from calibre.gui2.dialogs.template_dialog import TemplateDialog def wrap_msg(msg): @@ -63,12 +65,9 @@ class KOBOTOUCHConfig(TabbedDeviceConfig): return self._device() def validate(self): - if hasattr(self, 'formats'): - if not self.formats.validate(): - return False - if not self.template.validate(): - return False - return True + validated = super(KOBOTOUCHConfig, self).validate() + validated &= self.tab2.validate() + return validated @property def book_uploads_options(self): @@ -113,6 +112,11 @@ class KOBOTOUCHConfig(TabbedDeviceConfig): p['show_archived_books'] = self.show_archived_books p['update_series'] = self.update_series + p['update_core_metadata'] = self.update_core_metadata + p['update_purchased_kepubs'] = self.update_purchased_kepubs + p['subtitle_template'] = self.subtitle_template + p['update_subtitle'] = self.update_subtitle + p['modify_css'] = self.modify_css p['override_kobo_replace_existing'] = self.override_kobo_replace_existing @@ -142,6 +146,8 @@ class Tab1Config(DeviceConfigTab): # {{{ self.book_uploads_options = BookUploadsGroupBox(self, device) self.l.addWidget(self.book_uploads_options) self.addDeviceWidget(self.book_uploads_options) + + self.l.addStretch() # }}} @@ -164,6 +170,12 @@ class Tab2Config(DeviceConfigTab): # {{{ self.advanced_options = AdvancedGroupBox(self, device) self.l.addWidget(self.advanced_options) self.addDeviceWidget(self.advanced_options) + + self.l.addStretch() + + def validate(self): + return self.metadata_options.validate() + # }}} @@ -199,7 +211,6 @@ class BookUploadsGroupBox(DeviceOptionsGroupBox): self.options_layout.addWidget(self.modify_css_checkbox, 0, 0, 1, 2) self.options_layout.addWidget(self.override_kobo_replace_existing_checkbox, 1, 0, 1, 2) - self.options_layout.setRowStretch(2, 1) @property def modify_css(self): @@ -255,7 +266,6 @@ class CollectionsGroupBox(DeviceOptionsGroupBox): self.options_layout.addWidget(self.delete_empty_collections_checkbox, 3, 0, 1, 2) self.options_layout.addWidget(self.ignore_collections_names_label, 4, 0, 1, 1) self.options_layout.addWidget(self.ignore_collections_names_edit, 4, 1, 1, 1) - self.options_layout.setRowStretch(4, 1) @property def manage_collections(self): @@ -306,7 +316,6 @@ class CoversGroupBox(DeviceOptionsGroupBox): self.options_layout.addWidget(self.keep_cover_aspect_checkbox, 0, 0, 1, 1) self.options_layout.addWidget(self.upload_grayscale_checkbox, 1, 0, 1, 1) - self.options_layout.setRowStretch(2, 1) @property def upload_covers(self): @@ -357,7 +366,6 @@ class DeviceListGroupBox(DeviceOptionsGroupBox): self.options_layout.addWidget(self.show_recommendations_checkbox, 0, 0, 1, 1) self.options_layout.addWidget(self.show_archived_books_checkbox, 1, 0, 1, 1) self.options_layout.addWidget(self.show_previews_checkbox, 2, 0, 1, 1) - self.options_layout.setRowStretch(3, 1) @property def show_recommendations(self): @@ -411,7 +419,6 @@ class AdvancedGroupBox(DeviceOptionsGroupBox): self.options_layout.addWidget(self.support_newer_firmware_checkbox, 0, 0, 1, 2) self.options_layout.addWidget(self.debugging_title_label, 1, 0, 1, 1) self.options_layout.addWidget(self.debugging_title_edit, 1, 1, 1, 1) - self.options_layout.setRowStretch(2, 2) @property def support_newer_firmware(self): @@ -445,17 +452,134 @@ class MetadataGroupBox(DeviceOptionsGroupBox): 'Enable if you wish to set series information.'), device.get_pref('update_series') ) - self.options_layout.addWidget(self.update_series_checkbox, 0, 0, 1, 1) - self.options_layout.setRowStretch(1, 1) + self.update_core_metadata_checkbox = create_checkbox( + _("Update metadata on Book Details pages"), + _('This will update the metadata in the device database when the device is connected. ' + 'The metadata updated is displayed on the device in the library and the book details page. ' + 'This is the Title, Authors, Comments/Synopsis, Series name and number, Publisher and Published Date, ISBN and Language. ' + 'If a metadata plugboard exists for the device and book format, this will be used to set the metadata.' + ), + device.get_pref('update_core_metadata') + ) + + self.update_purchased_kepubs_checkbox = create_checkbox( + _("Update purchased books"), + _('Update books purchased from Kobo and downloaded to the device.' + ), + device.get_pref('update_purchased_kepubs') + ) + self.update_subtitle_checkbox = create_checkbox( + _("Subtitle"), + _('Update the subtitle on the device using a template.'), + device.get_pref('update_subtitle') + ) + self.subtitle_template_edit = TemplateConfig( + device.get_pref('subtitle_template'), + tooltip=_("Enter a template to use to set the subtitle. " + "If the template is empty, the subtitle will be cleared." + ) + ) + + self.options_layout.addWidget(self.update_series_checkbox, 0, 0, 1, 2) + self.options_layout.addWidget(self.update_core_metadata_checkbox, 1, 0, 1, 2) + self.options_layout.addWidget(self.update_subtitle_checkbox, 2, 0, 1, 1) + self.options_layout.addWidget(self.subtitle_template_edit, 2, 1, 1, 1) + self.options_layout.addWidget(self.update_purchased_kepubs_checkbox, 3, 0, 1, 2) + + self.update_core_metadata_checkbox.clicked.connect(self.update_core_metadata_checkbox_clicked) + self.update_subtitle_checkbox.clicked.connect(self.update_subtitle_checkbox_clicked) + self.update_core_metadata_checkbox_clicked(device.get_pref('update_core_metadata')) + self.update_subtitle_checkbox_clicked(device.get_pref('update_subtitle')) + + def update_core_metadata_checkbox_clicked(self, checked): + self.update_series_checkbox.setEnabled(not checked) + self.subtitle_template_edit.setEnabled(checked) + self.update_subtitle_checkbox.setEnabled(checked) + self.update_subtitle_checkbox_clicked(self.update_subtitle) + self.update_purchased_kepubs_checkbox.setEnabled(checked) + + def update_subtitle_checkbox_clicked(self, checked): + self.subtitle_template_edit.setEnabled(checked and self.update_core_metadata) + + def edit_template(self): + t = TemplateDialog(self, self.template) + t.setWindowTitle(_('Edit template')) + if t.exec_(): + self.t.setText(t.rule[1]) + + def validate(self): + if self.update_subtitle and not self.subtitle_template_edit.validate(): + return False + return True @property def update_series(self): return self.update_series_checkbox.isChecked() + @property + def update_core_metadata(self): + return self.update_core_metadata_checkbox.isChecked() + + @property + def update_purchased_kepubs(self): + return self.update_purchased_kepubs_checkbox.isChecked() + @property def update_device_metadata(self): return self.isChecked() + @property + def subtitle_template(self): + return self.subtitle_template_edit.template + + @property + def update_subtitle(self): + return self.update_subtitle_checkbox.isChecked() + +class TemplateConfig(QWidget): # {{{ + + def __init__(self, val, tooltip=None): + QWidget.__init__(self) + self.t = t = QLineEdit(self) + t.setText(val or '') + t.setCursorPosition(0) + self.setMinimumWidth(300) + self.l = l = QGridLayout(self) + self.setLayout(l) + l.addWidget(t, 1, 0, 1, 1) + b = self.b = QPushButton(_('&Template editor')) + l.addWidget(b, 1, 1, 1, 1) + b.clicked.connect(self.edit_template) + self.setToolTip(tooltip) + + @property + def template(self): + return unicode(self.t.text()).strip() + + @template.setter + def template(self, template): + self.t.setText(template) + + def edit_template(self): + t = TemplateDialog(self, self.template) + t.setWindowTitle(_('Edit template')) + if t.exec_(): + self.t.setText(t.rule[1]) + + def validate(self): + from calibre.utils.formatter import validation_formatter + + tmpl = self.template + try: + validation_formatter.validate(tmpl) + return True + except Exception as err: + error_dialog(self, _('Invalid template'), + '

'+_('The template "%s" is invalid:')%tmpl + \ + '
'+unicode(err), show=True) + + return False +# }}} if __name__ == '__main__': from calibre.gui2 import Application From c055ec3a159012979bdf05877fa74b837c7481e1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 16 Nov 2018 08:33:26 +0530 Subject: [PATCH 0034/2613] Windows: Fix restarting calibre with system tray icon enabled causing duplicate defunct icons in the tray. Fixes #1803034 [Windows 7 - Icon duplicated in notification area](https://bugs.launchpad.net/calibre/+bug/1803034) --- src/calibre/gui2/ui.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 0d58a3ce84..dd43eef419 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -916,6 +916,9 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ pass self.restart_after_quit = restart self.debug_on_restart = debug_on_restart + if self.system_tray_icon is not None and self.restart_after_quit: + # Needed on windows to prevent multiple systray icons + self.system_tray_icon.setVisible(False) QApplication.instance().quit() def donate(self, *args): From c2895cfbc04b9b860395d7ddb1f2ffebe2532202 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 16 Nov 2018 08:46:32 +0530 Subject: [PATCH 0035/2613] Use lopen() in the container class --- src/calibre/ebooks/oeb/polish/container.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/calibre/ebooks/oeb/polish/container.py b/src/calibre/ebooks/oeb/polish/container.py index c9e4ae8f29..5eb728eaa7 100644 --- a/src/calibre/ebooks/oeb/polish/container.py +++ b/src/calibre/ebooks/oeb/polish/container.py @@ -564,7 +564,7 @@ class Container(ContainerBase): # {{{ return set() def parse(self, path, mime): - with open(path, 'rb') as src: + with lopen(path, 'rb') as src: data = src.read() if mime in OEB_DOCS: data = self.parse_xhtml(data, self.relpath(path)) @@ -944,7 +944,7 @@ class Container(ContainerBase): # {{{ base = os.path.dirname(path) if not os.path.exists(base): os.makedirs(base) - open(path, 'wb').close() + lopen(path, 'wb').close() return item def format_opf(self): @@ -999,7 +999,7 @@ class Container(ContainerBase): # {{{ if self.cloned and nlinks_file(dest) > 1: # Decouple this file from its links os.unlink(dest) - with open(dest, 'wb') as f: + with lopen(dest, 'wb') as f: f.write(data) def filesize(self, name): @@ -1040,7 +1040,7 @@ class Container(ContainerBase): # {{{ this will commit the file if it is dirtied and remove it from the parse cache. You must finish with this file before accessing the parsed version of it again, or bad things will happen. ''' - return open(self.get_file_path_for_processing(name, mode not in {'r', 'rb'}), mode) + return lopen(self.get_file_path_for_processing(name, mode not in {'r', 'rb'}), mode) def commit(self, outpath=None, keep_parsed=False): ''' @@ -1058,7 +1058,7 @@ class Container(ContainerBase): # {{{ mismatches = [] for name, path in self.name_path_map.iteritems(): opath = other.name_path_map[name] - with open(path, 'rb') as f1, open(opath, 'rb') as f2: + with lopen(path, 'rb') as f1, lopen(opath, 'rb') as f2: if f1.read() != f2.read(): mismatches.append('The file %s is not the same'%name) return '\n'.join(mismatches) @@ -1131,7 +1131,7 @@ class EpubContainer(Container): if fname is not None: shutil.copy(os.path.join(dirpath, fname), os.path.join(base, fname)) else: - with open(self.pathtoepub, 'rb') as stream: + with lopen(self.pathtoepub, 'rb') as stream: try: zf = ZipFile(stream) zf.extractall(tdir) @@ -1348,12 +1348,12 @@ class EpubContainer(Container): if err.errno != errno.EEXIST: raise for fname in filenames: - with open(os.path.join(dirpath, fname), 'rb') as src, open(os.path.join(base, fname), 'wb') as dest: + with lopen(os.path.join(dirpath, fname), 'rb') as src, lopen(os.path.join(base, fname), 'wb') as dest: shutil.copyfileobj(src, dest) else: from calibre.ebooks.tweak import zip_rebuilder - with open(join(self.root, 'mimetype'), 'wb') as f: + with lopen(join(self.root, 'mimetype'), 'wb') as f: f.write(guess_type('a.epub')) zip_rebuilder(self.root, outpath) for name, data in restore_fonts.iteritems(): @@ -1439,7 +1439,7 @@ class AZW3Container(Container): tdir = PersistentTemporaryDirectory('_azw3_container') tdir = os.path.abspath(os.path.realpath(tdir)) self.root = tdir - with open(pathtoazw3, 'rb') as stream: + with lopen(pathtoazw3, 'rb') as stream: raw = stream.read(3) if raw == b'TPZ': raise InvalidMobi(_('This is not a MOBI file. It is a Topaz file.')) From 10266356398170a84fb639690eade9cfd557eeae Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 16 Nov 2018 09:40:02 +0530 Subject: [PATCH 0036/2613] Metadata download: Add an option (in Preferences->Metadata download) to keep multiple results from individual metadata sources, useful if yu prefer to pick the best result by hand and use only one or two metadata sources. Fixes #1802293 [download metadata only keeps one book per source](https://bugs.launchpad.net/calibre/+bug/1802293) --- .../ebooks/metadata/sources/identify.py | 4 +- src/calibre/ebooks/metadata/sources/prefs.py | 1 + .../gui2/preferences/metadata_sources.py | 1 + .../gui2/preferences/metadata_sources.ui | 118 ++++++++++-------- 4 files changed, 68 insertions(+), 56 deletions(-) diff --git a/src/calibre/ebooks/metadata/sources/identify.py b/src/calibre/ebooks/metadata/sources/identify.py index 82c1ac31b6..2861f8435a 100644 --- a/src/calibre/ebooks/metadata/sources/identify.py +++ b/src/calibre/ebooks/metadata/sources/identify.py @@ -165,7 +165,7 @@ class ISBNMerge(object): # Pick only the most relevant result from each source seen = set() for result in results: - if result.identify_plugin not in seen: + if msprefs['keep_dups'] or result.identify_plugin not in seen: seen.add(result.identify_plugin) self.results.append(result) result.average_source_relevance = \ @@ -184,7 +184,7 @@ class ISBNMerge(object): groups = {} for result in self.results: title = lower(result.title if result.title else '') - key = (title, tuple([lower(x) for x in result.authors])) + key = (title, tuple(lower(x) for x in result.authors)) if key not in groups: groups[key] = [] groups[key].append(result) diff --git a/src/calibre/ebooks/metadata/sources/prefs.py b/src/calibre/ebooks/metadata/sources/prefs.py index 7a995f37dc..235f1fff00 100644 --- a/src/calibre/ebooks/metadata/sources/prefs.py +++ b/src/calibre/ebooks/metadata/sources/prefs.py @@ -22,6 +22,7 @@ msprefs.defaults['append_comments'] = False msprefs.defaults['tag_map_rules'] = [] msprefs.defaults['author_map_rules'] = [] msprefs.defaults['id_link_rules'] = {} +msprefs.defaults['keep_dups'] = False # Google covers are often poor quality (scans/errors) but they have high # resolution, so they trump covers from better sources. So make sure they diff --git a/src/calibre/gui2/preferences/metadata_sources.py b/src/calibre/gui2/preferences/metadata_sources.py index 8c4665494a..a9ea411bcd 100644 --- a/src/calibre/gui2/preferences/metadata_sources.py +++ b/src/calibre/gui2/preferences/metadata_sources.py @@ -306,6 +306,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): r('fewer_tags', msprefs) r('find_first_edition_date', msprefs) self.opt_find_first_edition_date.setVisible(False) + r('keep_dups', msprefs) r('append_comments', msprefs) self.configure_plugin_button.clicked.connect(self.configure_plugin) diff --git a/src/calibre/gui2/preferences/metadata_sources.ui b/src/calibre/gui2/preferences/metadata_sources.ui index 13df32f40e..a269bae2bd 100644 --- a/src/calibre/gui2/preferences/metadata_sources.ui +++ b/src/calibre/gui2/preferences/metadata_sources.ui @@ -147,7 +147,7 @@ 0 0 373 - 341 + 333 @@ -164,14 +164,61 @@ - + + + + Max. &number of tags to download: + + + opt_max_tags + + + + + + + Max. &time to wait after first match is found: + + + opt_wait_after_first_identify_result + + + + + + + + + + secs + + + + + + + Max. time to wait after first &cover is found: + + + opt_wait_after_first_cover_result + + + + + + + secs + + + + Swap &author names from FN LN to LN, FN - + <p>When downloading comments, append the downloaded comments to any existing comment, instead of overwriting them. @@ -184,14 +231,24 @@ - + Use &published date of "first edition" (from worldcat.org) - + + + + <p>Normally, the metadata download system will keep only a single result per metadata source. This option will cause it to keep all results returned from every metadata source. useful if you only use one or two sources and want to select individual results from them by hand. Note that result with identical title/author/identifiers are still merged. + + + Keep more than one entry per source + + + + <p>Different metadata sources have different sets of tags for the same book. If this option is checked, then calibre will use the smaller tag sets. These tend to be more like genres, while the larger tag sets tend to describe the books content. @@ -205,67 +262,20 @@ - + Create &rules to filter/transform tags - + Create rules to &transform author names - - - - - - - Max. &number of tags to download: - - - opt_max_tags - - - - - - - Max. &time to wait after first match is found: - - - opt_wait_after_first_identify_result - - - - - - - secs - - - - - - - Max. time to wait after first &cover is found: - - - opt_wait_after_first_cover_result - - - - - - - secs - - - From 97f9373a999fe9baf9d48da3e88bc7afa41ca7a5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 16 Nov 2018 12:24:41 +0530 Subject: [PATCH 0037/2613] Economist: handle printedition page redirecting to previous issue instead of current one --- recipes/economist.recipe | 6 ++++++ recipes/economist_free.recipe | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/recipes/economist.recipe b/recipes/economist.recipe index 57718ce413..0d347f5fcf 100644 --- a/recipes/economist.recipe +++ b/recipes/economist.recipe @@ -167,6 +167,12 @@ class Economist(BasicNewsRecipe): # with open('/t/raw.html', 'wb') as f: # f.write(raw) soup = self.index_to_soup(raw) + nav = soup.find(attrs={'class':'navigation__wrapper'}) + if nav is not None: + a = nav.find('a', href=lambda x: x and '/printedition/' in x) + if a is not None: + self.log('Following nav link to current edition', a['href']) + soup = self.index_to_soup(process_url(a['href'])) ans = self.economist_parse_index(soup) if not ans: raise NoArticles( diff --git a/recipes/economist_free.recipe b/recipes/economist_free.recipe index 57718ce413..0d347f5fcf 100644 --- a/recipes/economist_free.recipe +++ b/recipes/economist_free.recipe @@ -167,6 +167,12 @@ class Economist(BasicNewsRecipe): # with open('/t/raw.html', 'wb') as f: # f.write(raw) soup = self.index_to_soup(raw) + nav = soup.find(attrs={'class':'navigation__wrapper'}) + if nav is not None: + a = nav.find('a', href=lambda x: x and '/printedition/' in x) + if a is not None: + self.log('Following nav link to current edition', a['href']) + soup = self.index_to_soup(process_url(a['href'])) ans = self.economist_parse_index(soup) if not ans: raise NoArticles( From 37c15fd9110a94012703b84bb881d5a667e536a0 Mon Sep 17 00:00:00 2001 From: Becky Date: Fri, 16 Nov 2018 11:54:37 +0100 Subject: [PATCH 0038/2613] A capital letter in hint. --- src/calibre/gui2/preferences/metadata_sources.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/preferences/metadata_sources.ui b/src/calibre/gui2/preferences/metadata_sources.ui index a269bae2bd..5165482c2a 100644 --- a/src/calibre/gui2/preferences/metadata_sources.ui +++ b/src/calibre/gui2/preferences/metadata_sources.ui @@ -241,7 +241,7 @@ - <p>Normally, the metadata download system will keep only a single result per metadata source. This option will cause it to keep all results returned from every metadata source. useful if you only use one or two sources and want to select individual results from them by hand. Note that result with identical title/author/identifiers are still merged. + <p>Normally, the metadata download system will keep only a single result per metadata source. This option will cause it to keep all results returned from every metadata source. Useful if you only use one or two sources and want to select individual results from them by hand. Note that result with identical title/author/identifiers are still merged. Keep more than one entry per source From 795d7f54fff0ebf807e660a1da237525f022a312 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 19 Nov 2018 09:58:04 +0530 Subject: [PATCH 0039/2613] Update Telepolis --- recipes/telepolis.recipe | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/recipes/telepolis.recipe b/recipes/telepolis.recipe index bb3635db7d..e521c1f9f0 100644 --- a/recipes/telepolis.recipe +++ b/recipes/telepolis.recipe @@ -7,10 +7,12 @@ from calibre.web.feeds.news import BasicNewsRecipe class Telepolis(BasicNewsRecipe): title = 'Telepolis' __author__ = 'Lutz Epperlein' - oldest_article = 7 - max_articles_per_feed = 100 + oldest_article = 10 + max_articles_per_feed = 200 auto_cleanup = False language = 'de' + scale_news_images = (758, 1024) + scale_news_images_to_device = True feeds = [ ('Telepolis', 'https://www.heise.de/tp/news-atom.xml'), @@ -19,4 +21,4 @@ class Telepolis(BasicNewsRecipe): remove_tags = [dict(name='p', attrs={'class':'printversion__back-to-article printversion--hide'})] def get_article_url(self, article): - return article.link + "?view=print" + return article.link + "&view=print" From d8dc88449834210a7107735818069bbd797eb750 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 19 Nov 2018 19:42:40 +0530 Subject: [PATCH 0040/2613] Edit book: Fix suggestions in completion popup not being sorted. Fixes #1803985 [[enhancement] editor, make auto fill a href more "natural" order](https://bugs.launchpad.net/calibre/+bug/1803985) --- src/calibre/gui2/tweak_book/completion/basic.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/completion/basic.py b/src/calibre/gui2/tweak_book/completion/basic.py index 56ead0af4c..145813fd8b 100644 --- a/src/calibre/gui2/tweak_book/completion/basic.py +++ b/src/calibre/gui2/tweak_book/completion/basic.py @@ -20,6 +20,7 @@ from calibre.gui2.tweak_book import current_container, editors from calibre.gui2.tweak_book.completion.utils import control, data, DataError from calibre.utils.ipc import eintr_retry_call from calibre.utils.matcher import Matcher +from calibre.utils.icu import numeric_sort_key Request = namedtuple('Request', 'id type data query') @@ -123,6 +124,7 @@ def complete_anchor(name, data_conn): if isinstance(data, tuple) and len(data) > 1 and isinstance(data[1], dict): return frozenset(data[1]), data[1], {} + _current_matcher = (None, None, None) @@ -133,7 +135,7 @@ def handle_control_request(request, data_conn): items, descriptions, matcher_kwargs = ans fingerprint = hash(items) if fingerprint != _current_matcher[0] or matcher_kwargs != _current_matcher[1]: - _current_matcher = (fingerprint, matcher_kwargs, Matcher(items, **matcher_kwargs)) + _current_matcher = (fingerprint, matcher_kwargs, Matcher(sorted(items, key=numeric_sort_key), **matcher_kwargs)) if request.query: items = _current_matcher[-1](request.query, limit=50) else: @@ -177,6 +179,8 @@ class HandleDataRequest(QObject): return self.result, self.tb finally: del self.result, self.tb + + handle_data_request = HandleDataRequest() control_funcs = {name:func for name, func in globals().iteritems() if getattr(func, 'function_type', None) == 'control'} From 53447245c4af1cd1818d084dfb16b07e0dd7ac7e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 19 Nov 2018 19:48:15 +0530 Subject: [PATCH 0041/2613] Move sorting into individual handlers for popup completion requests --- src/calibre/gui2/tweak_book/completion/basic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/tweak_book/completion/basic.py b/src/calibre/gui2/tweak_book/completion/basic.py index 145813fd8b..d8a0329160 100644 --- a/src/calibre/gui2/tweak_book/completion/basic.py +++ b/src/calibre/gui2/tweak_book/completion/basic.py @@ -93,7 +93,7 @@ def complete_names(names_data, data_conn): quote = (lambda x:x) if base.lower().endswith('.css') else prepare_string_for_xml names = names_cache.get(names_type, names_cache[None]) nmap = {name:name_to_href(name, root, base, quote) for name in names} - items = frozenset(nmap.itervalues()) + items = tuple(sorted(frozenset(nmap.itervalues()), key=numeric_sort_key)) d = names_cache['descriptions'].get descriptions = {href:d(name) for name, href in nmap.iteritems()} return items, descriptions, {} @@ -122,7 +122,7 @@ def complete_anchor(name, data_conn): file_cache[name] = data data = file_cache[name] if isinstance(data, tuple) and len(data) > 1 and isinstance(data[1], dict): - return frozenset(data[1]), data[1], {} + return tuple(sorted(frozenset(data[1]), key=numeric_sort_key)), data[1], {} _current_matcher = (None, None, None) @@ -135,7 +135,7 @@ def handle_control_request(request, data_conn): items, descriptions, matcher_kwargs = ans fingerprint = hash(items) if fingerprint != _current_matcher[0] or matcher_kwargs != _current_matcher[1]: - _current_matcher = (fingerprint, matcher_kwargs, Matcher(sorted(items, key=numeric_sort_key), **matcher_kwargs)) + _current_matcher = (fingerprint, matcher_kwargs, Matcher(items, **matcher_kwargs)) if request.query: items = _current_matcher[-1](request.query, limit=50) else: From 01c47148e91788c1af3e7258f35abe9fa24271a3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 20 Nov 2018 09:17:46 +0530 Subject: [PATCH 0042/2613] ... --- src/calibre/gui2/complete2.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/complete2.py b/src/calibre/gui2/complete2.py index 594758043e..18d5a79883 100644 --- a/src/calibre/gui2/complete2.py +++ b/src/calibre/gui2/complete2.py @@ -353,9 +353,12 @@ class LineEdit(QLineEdit, LineEditECM): def event(self, ev): # See https://bugreports.qt.io/browse/QTBUG-46911 - if ev.type() == ev.ShortcutOverride and ( - ev.key() in (Qt.Key_Left, Qt.Key_Right) and (ev.modifiers() & ~Qt.KeypadModifier) == Qt.ControlModifier): - ev.accept() + try: + if ev.type() == ev.ShortcutOverride and ( + ev.key() in (Qt.Key_Left, Qt.Key_Right) and (ev.modifiers() & ~Qt.KeypadModifier) == Qt.ControlModifier): + ev.accept() + except AttributeError: + pass return QLineEdit.event(self, ev) def complete(self, show_all=False, select_first=True): From 2a26bb7be466b3cded8e5009ef7ca04293561587 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 21 Nov 2018 20:02:07 +0530 Subject: [PATCH 0043/2613] ... --- src/calibre/utils/fonts/sfnt/subset.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/calibre/utils/fonts/sfnt/subset.py b/src/calibre/utils/fonts/sfnt/subset.py index 5f0e570a3c..69f0e7af0e 100644 --- a/src/calibre/utils/fonts/sfnt/subset.py +++ b/src/calibre/utils/fonts/sfnt/subset.py @@ -199,7 +199,7 @@ def option_parser(): parser.add_option('-c', '--codes', default=False, action='store_true', help='If specified, the list of characters is interpreted as ' 'numeric unicode codes instead of characters. So to specify the ' - 'characters a,b you would use 97,98') + 'characters a,b you would use 97,98 or U+0061,U+0062') parser.prog = 'subset-font' return parser @@ -281,6 +281,7 @@ def main(args): f.write(sf) prints('Subset font written to:', off) + if __name__ == '__main__': try: import init_calibre @@ -370,5 +371,3 @@ def all(): # }}} - - From fb380aaaff39d6f61cac5985a4fb8960f14171c5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 22 Nov 2018 10:43:53 +0530 Subject: [PATCH 0044/2613] Update Newsweek --- recipes/newsweek.recipe | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/recipes/newsweek.recipe b/recipes/newsweek.recipe index d8a0c8a189..44935102f1 100644 --- a/recipes/newsweek.recipe +++ b/recipes/newsweek.recipe @@ -1,7 +1,7 @@ from calibre.web.feeds.news import BasicNewsRecipe from collections import defaultdict -BASE = 'http://www.newsweek.com' +BASE = 'https://www.newsweek.com' def href_to_url(a, add_piano=False): @@ -23,15 +23,18 @@ class Newsweek(BasicNewsRecipe): no_stylesheets = True requires_version = (1, 40, 0) - keep_only_tags = class_sels( - 'article-header', 'article-body', 'header-image') + keep_only_tags = [ + dict(id='block-nw-magazine-article-header'), + class_sels('article-header', 'article-body') + ] remove_tags = [ - dict(name='meta'), + dict(name=['aside', 'meta', 'source']), class_sels( 'block-openadstream', 'block-ibtmedia-social', 'issue-next', 'most-popular', 'ibt-media-stories', 'user-btn-group', 'trial-link', 'trc_related_container', 'block-ibtmedia-top-stories', 'videocontent', 'newsletter-signup', + 'in-text-slideshows', 'content-correction', 'article-navigation' ), dict(id=['taboola-below-main-column', 'piano-root', 'block-nw-magazine-magazine-more-from-issue']), @@ -46,7 +49,7 @@ class Newsweek(BasicNewsRecipe): a = li.xpath('descendant::a[@href]')[0] url = href_to_url(a, add_piano=True) self.timefmt = self.tag_to_string(a) - img = li.xpath('descendant::a[@href]/img[@src]')[0] + img = li.xpath('descendant::a[@href]//img[@src]')[0] self.cover_url = img.get('src') root = self.index_to_soup(url, as_tree=True) features = [] From 1d15835d0701dc85c638879e4d4ec802d96eba25 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 25 Nov 2018 17:47:37 +0530 Subject: [PATCH 0045/2613] Rubikon.de by schuster --- recipes/rubikon_de.recipe | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 recipes/rubikon_de.recipe diff --git a/recipes/rubikon_de.recipe b/recipes/rubikon_de.recipe new file mode 100644 index 0000000000..279d932aed --- /dev/null +++ b/recipes/rubikon_de.recipe @@ -0,0 +1,32 @@ +from __future__ import unicode_literals, division, absolute_import, print_function +from calibre.web.feeds.news import BasicNewsRecipe + + +class AdvancedUserRecipe1543143461(BasicNewsRecipe): + title = 'Rubikon.de' + description = 'Nachrichten anders/neutral beleuchtet' + __author__ = 'schuster' + __license__ = 'GPL v3' + version = 1 + oldest_article = 7 + max_articles_per_feed = 100 + auto_cleanup = True + no_stylesheets = True + use_embedded_content = False + language = 'de' + remove_javascript = True + timefmt = ' [%d.%m.%Y]' + masthead_url = 'https://www.rubikon.news/assets/logo-dd0fcd373a0c872bb432f7596d9e700155c5d7fa07ec99a3777d44621e8c61fe.svg' + + remove_tags = [ + dict(id=['download-pdf']), + dict(id=['read-article']), + dict(name='div', attrs={ + 'id': ['print_options', 'print_head']}), + dict(name='div', attrs={'class': ['article-meta']}), + dict(name='div', attrs={'class': ['article-end']}), + dict(name='span', attrs={'class': ['lens']})] + + feeds = [ + ('Alle Artikel', 'https://www.rubikon.news/artikel.atom'), + ] From 82ab74d5a7b93ec2dfeb0202818809749a0b7be0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 27 Nov 2018 21:00:01 +0530 Subject: [PATCH 0046/2613] Update Wall Street Journal for print edition page changes --- recipes/wsj.recipe | 268 ++++++++++++++++------------------------ recipes/wsj_free.recipe | 239 ++++++++++++++++++----------------- 2 files changed, 232 insertions(+), 275 deletions(-) diff --git a/recipes/wsj.recipe b/recipes/wsj.recipe index 2b3110b059..1d6f9ec645 100644 --- a/recipes/wsj.recipe +++ b/recipes/wsj.recipe @@ -2,33 +2,18 @@ # vim:fileencoding=utf-8 # License: GPLv3 Copyright: 2016, Kovid Goyal -from __future__ import (unicode_literals, division, absolute_import, - print_function) +from __future__ import absolute_import, division, print_function, unicode_literals + import json -from mechanize import Request from urllib import quote -import html5lib -from lxml import html +from mechanize import Request +from calibre import random_user_agent from calibre.web.feeds.news import BasicNewsRecipe +from css_selectors import Select - -def CSSSelect(expr): - expr = { - 'div.whatsNews-simple': '''descendant-or-self::div[@class and contains(concat(' ', normalize-space(@class), ' '), ' whatsNews-simple ')]''', - 'a.mjLinkItem[href]': '''descendant-or-self::a[@class and contains(concat(' ', normalize-space(@class), ' '), ' mjLinkItem ') and (@href)]''', - '.meta_sectionName': '''descendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), ' meta_sectionName ')]''', - 'p': 'descendant-or-self::p', - 'div.whatsNews-simple.whatsNews-itp': '''descendant-or-self::div[@class and contains(concat(' ', normalize-space(@class), ' '), ' whatsNews-simple ') and (@class and contains(concat(' ', normalize-space(@class), ' '), ' whatsNews-itp '))]''', # noqa - 'a[href]': 'descendant-or-self::a[@href]', - 'span.date-date': "descendant-or-self::span[@class and contains(concat(' ', normalize-space(@class), ' '), ' date-date ')]", - 'div.itpSectionHeaderPdf a[href]': "descendant-or-self::div[@class and contains(concat(' ', normalize-space(@class), ' '), ' itpSectionHeaderPdf ')]/descendant-or-self::*/a[@href]", # noqa - 'div.itpHeader ul.tab a[href]': "descendant-or-self::div[@class and contains(concat(' ', normalize-space(@class), ' '), ' itpHeader ')]/descendant-or-self::*/ul[@class and contains(concat(' ', normalize-space(@class), ' '), ' tab ')]/descendant-or-self::*/a[@href]", # noqa - - }[expr] - from lxml.etree import XPath - return XPath(expr) +needs_subscription = True def classes(classes): @@ -37,9 +22,6 @@ def classes(classes): 'class': lambda x: x and frozenset(x.split()).intersection(q)}) -USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0' - - class WSJ(BasicNewsRecipe): title = 'The Wall Street Journal' @@ -54,8 +36,8 @@ class WSJ(BasicNewsRecipe): no_stylesheets = True ignore_duplicate_articles = {'url'} remove_attributes = ['style', 'data-scrim'] - needs_subscription = True - WSJ_ITP = 'http://online.wsj.com/itp/today' + needs_subscription = needs_subscription + WSJ_ITP = 'https://online.wsj.com/itp/today' keep_only_tags = [ dict(classes('wsj-article-headline-wrap article_header')), @@ -77,13 +59,6 @@ class WSJ(BasicNewsRecipe): dict(name='meta link'.split()), ] - def preprocess_raw_html(self, raw_html, url): - root = html5lib.parse(raw_html, treebuilder='lxml', - namespaceHTMLElements=False) - raw_html = html.tostring(root) - # open('/t/art.html', 'w').write(raw_html) - return raw_html - def preprocess_soup(self, soup): # Slideshow and expandable images need to be processed here to # set the src attribute correctly @@ -106,86 +81,89 @@ class WSJ(BasicNewsRecipe): return image['src'] self.log("\nCover unavailable") - def get_browser(self): - # To understand the signin logic read signin.js from - # https://id.wsj.com/access/pages/wsj/us/signin.html - # This is the same login servie as used by Barrons - br = BasicNewsRecipe.get_browser(self, user_agent=USER_AGENT) - # self.wsj_itp_page = open('/t/raw.html').read() - # return br - url = 'https://id.wsj.com/access/pages/wsj/us/signin.html?mg=com-wsj&mg=id-wsj' - # br.set_debug_http(True) - br.open(url).read() - rurl = 'https://id.wsj.com/auth/submitlogin.json' - rq = Request(rurl, headers={ - 'Accept': 'application/json, text/javascript, */*; q=0.01', - 'Accept-Language': 'en-US,en;q=0.8', - 'Content-Type': 'application/json', - 'Referer': url, - 'X-HTTP-Method-Override': 'POST', - 'X-Requested-With': 'XMLHttpRequest', - }, data=json.dumps({ - 'username': self.username, - 'password': self.password, - 'realm': 'default', - 'savelogin': 'true', - 'template': 'default', - 'url': quote(self.WSJ_ITP), - })) - r = br.open(rq) - if r.code != 200: - raise ValueError('Failed to login, check username and password') - data = json.loads(r.read()) - # print(data) - if data.get('result') != 'success': - raise ValueError( - 'Failed to login (XHR failed), check username and password') - br.set_cookie('m', data['username'], '.wsj.com') - try: - r = br.open(data['url']) - except Exception: - self.log.error('Failed to open login url: {}'.format(data['url'])) - raise - self.wsj_itp_page = raw = r.read() - if b'>Sign Out<' not in raw: - raise ValueError( - 'Failed to login (auth URL failed), check username and password') - # open('/t/raw.html', 'w').write(raw) - return br + # login {{{ + if needs_subscription: + def get_browser(self, *a, **kw): + # To understand the signin logic read signin.js from + # https://id.wsj.com/access/pages/wsj/us/signin.html + # This is the same login servie as used by Barrons + kw['user_agent'] = random_user_agent(allow_ie=False) + br = BasicNewsRecipe.get_browser(self, *a, **kw) + # self.wsj_itp_page = open('/t/raw.html').read() + # return br + url = 'https://id.wsj.com/access/pages/wsj/us/signin.html?mg=com-wsj&mg=id-wsj' + # br.set_debug_http(True) + br.open(url).read() + rurl = 'https://id.wsj.com/auth/submitlogin.json' + rq = Request(rurl, headers={ + 'Accept': 'application/json, text/javascript, */*; q=0.01', + 'Accept-Language': 'en-US,en;q=0.8', + 'Content-Type': 'application/json', + 'Referer': url, + 'X-HTTP-Method-Override': 'POST', + 'X-Requested-With': 'XMLHttpRequest', + }, data=json.dumps({ + 'username': self.username, + 'password': self.password, + 'realm': 'default', + 'savelogin': 'true', + 'template': 'default', + 'url': quote(self.WSJ_ITP), + })) + r = br.open(rq) + if r.code != 200: + raise ValueError('Failed to login, check username and password') + data = json.loads(r.read()) + # print(data) + if data.get('result') != 'success': + raise ValueError( + 'Failed to login (XHR failed), check username and password') + br.set_cookie('m', data['username'], '.wsj.com') + try: + r = br.open(data['url']) + except Exception: + self.log.error('Failed to open login url: {}'.format(data['url'])) + raise + self.wsj_itp_page = raw = r.read() + if b'>Sign Out<' not in raw: + raise ValueError( + 'Failed to login (auth URL failed), check username and password') + # open('/t/raw.html', 'w').write(raw) + return br + else: + def get_browser(self, *a, **kw): + kw['user_agent'] = random_user_agent(allow_ie=False) + br = BasicNewsRecipe.get_browser(self, *a, **kw) + self.wsj_itp_page = br.open(self.WSJ_ITP).read() + return br + # }}} def abs_wsj_url(self, href): if not href.startswith('http'): - href = 'http://online.wsj.com' + href + href = 'https://www.wsj.com' + href return href def wsj_find_articles(self, url, ahed=False): root = self.index_to_soup(url, as_tree=True) - - for x in CSSSelect('div.whatsNews-simple')(root): - x.getparent().remove(x) - + CSSSelect = Select(root) articles = [] - - for container in root.xpath('//li[contains(@class, "mjItemMain")]'): - meta = container.xpath('descendant::span[@class="meta_sectionName"]') - if not meta: - continue - meta = meta[0] - a = meta.xpath('ancestor::a')[0] - meta.getparent().remove(meta) + for container in CSSSelect('.style__grid_3gzjbqouVfPMK84Adb3MFE .article'): + meta = next(CSSSelect('.type', container)) + parent = meta.getparent() meta = self.tag_to_string(meta) + title = next(CSSSelect('.title', parent)) + a = next(CSSSelect('a', title)) title = self.tag_to_string(a) if meta: title += ' [%s]' % meta url = self.abs_wsj_url(a.get('href')) desc = '' - if container: - for p in container.xpath('descendant::p'): - q = self.tag_to_string(p) - if 'Subscriber Content' in q: - continue - desc += q - break + for p in CSSSelect('p.description', container): + q = self.tag_to_string(p) + if 'Subscriber Content' in q: + continue + desc += q + break articles.append({'title': title, 'url': url, 'description': desc, 'date': ''}) @@ -193,56 +171,36 @@ class WSJ(BasicNewsRecipe): self.log('\tFound article:', title) self.log('\t\t', desc) - if ahed: - for h2 in root.xpath('//li[@class="ahed_listitem"]/h2'): - a = h2.xpath('descendant::a')[0] - title = self.tag_to_string(a) - url = self.abs_wsj_url(a.get('href')) - desc = '' - p = h2.xpath('following-sibling::p') - if p: - desc = self.tag_to_string(p[0]) - articles.append({'title': title, 'url': url, - 'description': desc, 'date': ''}) - self.log('Found article:', title) - self.log('\t\t', desc) - return articles - def wsj_find_wn_articles(self, url): - root = self.index_to_soup(url, as_tree=True) + def wsj_find_wn_articles(self, feeds, root, CSSSelect): articles = [] + for a in CSSSelect('.style__strap_2m6gCW_c_6WZKkU--eRUWv'): + if 'WHAT\'S NEWS' in self.tag_to_string(a).upper(): + whats_news = a.getparent() + break + else: + self.log.error('Failed to find Whats News section') + return + for li in CSSSelect('li', whats_news): + a = next(CSSSelect('a', li)) + if '/articles/' not in a.get('href', ''): + continue + title = self.tag_to_string(a).strip() + url = self.abs_wsj_url(a.get('href')) + desc = self.tag_to_string(li) + articles.append({'title': title, 'url': url, + 'description': desc, 'date': ''}) - whats_news = CSSSelect('div.whatsNews-simple.whatsNews-itp')(root) - if whats_news: - for a in CSSSelect('a[href]')(whats_news[-1]): - if '/articles/' not in a.get('href', ''): - continue - container = a.xpath('ancestor::p') - for meta in CSSSelect('.meta_sectionName')(a): - meta.getparent().remove(meta) - title = self.tag_to_string(a).strip() - url = self.abs_wsj_url(a.get('href')) - desc = '' - if container: - desc = self.tag_to_string(container[0]) - - articles.append({'title': title, 'url': url, - 'description': desc, 'date': ''}) - - self.log('\tFound WN article:', title) - self.log('\t\t', desc) + self.log('\tFound WN article:', title) + self.log('\t\t', desc) return articles def wsj_add_feed(self, feeds, title, url): self.log('Found section:', title, '[' + url + ']') try: - if url.endswith('whatsnews'): - articles = self.wsj_find_wn_articles(url) - else: - articles = self.wsj_find_articles( - url, ahed=title == 'Front Section') + articles = self.wsj_find_articles(url) except Exception: self.log.exception('Failed to parse section:', title) articles = [] @@ -252,30 +210,22 @@ class WSJ(BasicNewsRecipe): def parse_index(self): # return self.test_wsj_index() root = self.index_to_soup(self.wsj_itp_page, as_tree=True) - for span in CSSSelect('span.date-date')(root): - if span.text and span.text.strip(): - self.timefmt = ' [%s]' % span.text.strip() + CSSSelect = Select(root) + for inp in CSSSelect('.DayPickerInput > input'): + if inp.get('placeholder'): + self.timefmt = inp.get('placeholder') break - for a in CSSSelect('div.itpSectionHeaderPdf a[href]')(root): - self.cover_url = a.get('href') - break feeds = [] - for a in CSSSelect('div.itpHeader ul.tab a[href]')(root): - if '/itp/' not in a.get('href', ''): + for a in CSSSelect('.WSJTheme__nav-container_sPVwT3FiPlWjFGtr5KH3d .WSJTheme__section-link_XGDsdx5qPlnC8BZPxQ63R'): + frontpage = a.get('href').endswith('frontpage') + title = self.tag_to_string(a).capitalize().strip().replace('U.s.', 'U.S.') + if not title: continue - pageone = a.get('href').endswith('pageone') - if pageone: - title = 'Front Section' - url = self.abs_wsj_url(a.get('href')) - self.wsj_add_feed(feeds, title, url) - title = "What's News" - url = url.replace('pageone', 'whatsnews') - self.wsj_add_feed(feeds, title, url) - else: - title = self.tag_to_string(a) - url = self.abs_wsj_url(a.get('href')) - self.wsj_add_feed(feeds, title, url) + url = self.abs_wsj_url(a.get('href')) + self.wsj_add_feed(feeds, title, url) + if frontpage: + self.wsj_find_wn_articles(feeds, root, CSSSelect) return feeds def test_wsj_index(self): diff --git a/recipes/wsj_free.recipe b/recipes/wsj_free.recipe index 0c4429c3c6..1fb0223cc9 100644 --- a/recipes/wsj_free.recipe +++ b/recipes/wsj_free.recipe @@ -2,30 +2,18 @@ # vim:fileencoding=utf-8 # License: GPLv3 Copyright: 2016, Kovid Goyal -from __future__ import (unicode_literals, division, absolute_import, - print_function) +from __future__ import absolute_import, division, print_function, unicode_literals -import html5lib -from lxml import html +import json +from urllib import quote +from mechanize import Request + +from calibre import random_user_agent from calibre.web.feeds.news import BasicNewsRecipe +from css_selectors import Select - -def CSSSelect(expr): - expr = { - 'div.whatsNews-simple': '''descendant-or-self::div[@class and contains(concat(' ', normalize-space(@class), ' '), ' whatsNews-simple ')]''', - 'a.mjLinkItem[href]': '''descendant-or-self::a[@class and contains(concat(' ', normalize-space(@class), ' '), ' mjLinkItem ') and (@href)]''', - '.meta_sectionName': '''descendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), ' meta_sectionName ')]''', - 'p': 'descendant-or-self::p', - 'div.whatsNews-simple.whatsNews-itp': '''descendant-or-self::div[@class and contains(concat(' ', normalize-space(@class), ' '), ' whatsNews-simple ') and (@class and contains(concat(' ', normalize-space(@class), ' '), ' whatsNews-itp '))]''', # noqa - 'a[href]': 'descendant-or-self::a[@href]', - 'span.date-date': "descendant-or-self::span[@class and contains(concat(' ', normalize-space(@class), ' '), ' date-date ')]", - 'div.itpSectionHeaderPdf a[href]': "descendant-or-self::div[@class and contains(concat(' ', normalize-space(@class), ' '), ' itpSectionHeaderPdf ')]/descendant-or-self::*/a[@href]", # noqa - 'div.itpHeader ul.tab a[href]': "descendant-or-self::div[@class and contains(concat(' ', normalize-space(@class), ' '), ' itpHeader ')]/descendant-or-self::*/ul[@class and contains(concat(' ', normalize-space(@class), ' '), ' tab ')]/descendant-or-self::*/a[@href]", # noqa - - }[expr] - from lxml.etree import XPath - return XPath(expr) +needs_subscription = False def classes(classes): @@ -34,12 +22,9 @@ def classes(classes): 'class': lambda x: x and frozenset(x.split()).intersection(q)}) -USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0' - - class WSJ(BasicNewsRecipe): - title = 'The Wall Street Journal (free)' + title = 'The Wall Street Journal' __author__ = 'Kovid Goyal' description = 'News and current affairs' language = 'en' @@ -51,7 +36,8 @@ class WSJ(BasicNewsRecipe): no_stylesheets = True ignore_duplicate_articles = {'url'} remove_attributes = ['style', 'data-scrim'] - WSJ_ITP = 'http://online.wsj.com/itp/today' + needs_subscription = needs_subscription + WSJ_ITP = 'https://online.wsj.com/itp/today' keep_only_tags = [ dict(classes('wsj-article-headline-wrap article_header')), @@ -63,6 +49,9 @@ class WSJ(BasicNewsRecipe): ] remove_tags = [ + dict(id='right-rail'), + dict(id='narrator-nav'), + dict(name='div', id='ad_and_popular'), classes('strap-container right-rail comments-count-container insetButton insettipBox author-info' ' media-object-video article_tools nc-exp-artmeta category type-InsetArticlesRelatedByType media-object-rich-text'), dict(name='span', attrs={ @@ -70,13 +59,6 @@ class WSJ(BasicNewsRecipe): dict(name='meta link'.split()), ] - def preprocess_raw_html(self, raw_html, url): - root = html5lib.parse(raw_html, treebuilder='lxml', - namespaceHTMLElements=False) - raw_html = html.tostring(root) - # open('/t/art.html', 'w').write(raw_html) - return raw_html - def preprocess_soup(self, soup): # Slideshow and expandable images need to be processed here to # set the src attribute correctly @@ -91,44 +73,97 @@ class WSJ(BasicNewsRecipe): self.log.debug('Found %d dynamic images in:' % found) return soup - def get_browser(self): - br = BasicNewsRecipe.get_browser(self, user_agent=USER_AGENT) - self.wsj_itp_page = br.open(self.WSJ_ITP).read() - return br + def get_cover_url(self): + index = 'http://en.kiosko.net/us/np/wsj.html' + soup = self.index_to_soup(index) + for image in soup.findAll('img', src=True): + if image['src'].endswith('750.jpg'): + return image['src'] + self.log("\nCover unavailable") + + # login {{{ + if needs_subscription: + def get_browser(self, *a, **kw): + # To understand the signin logic read signin.js from + # https://id.wsj.com/access/pages/wsj/us/signin.html + # This is the same login servie as used by Barrons + kw['user_agent'] = random_user_agent(allow_ie=False) + br = BasicNewsRecipe.get_browser(self, *a, **kw) + # self.wsj_itp_page = open('/t/raw.html').read() + # return br + url = 'https://id.wsj.com/access/pages/wsj/us/signin.html?mg=com-wsj&mg=id-wsj' + # br.set_debug_http(True) + br.open(url).read() + rurl = 'https://id.wsj.com/auth/submitlogin.json' + rq = Request(rurl, headers={ + 'Accept': 'application/json, text/javascript, */*; q=0.01', + 'Accept-Language': 'en-US,en;q=0.8', + 'Content-Type': 'application/json', + 'Referer': url, + 'X-HTTP-Method-Override': 'POST', + 'X-Requested-With': 'XMLHttpRequest', + }, data=json.dumps({ + 'username': self.username, + 'password': self.password, + 'realm': 'default', + 'savelogin': 'true', + 'template': 'default', + 'url': quote(self.WSJ_ITP), + })) + r = br.open(rq) + if r.code != 200: + raise ValueError('Failed to login, check username and password') + data = json.loads(r.read()) + # print(data) + if data.get('result') != 'success': + raise ValueError( + 'Failed to login (XHR failed), check username and password') + br.set_cookie('m', data['username'], '.wsj.com') + try: + r = br.open(data['url']) + except Exception: + self.log.error('Failed to open login url: {}'.format(data['url'])) + raise + self.wsj_itp_page = raw = r.read() + if b'>Sign Out<' not in raw: + raise ValueError( + 'Failed to login (auth URL failed), check username and password') + # open('/t/raw.html', 'w').write(raw) + return br + else: + def get_browser(self, *a, **kw): + kw['user_agent'] = random_user_agent(allow_ie=False) + br = BasicNewsRecipe.get_browser(self, *a, **kw) + self.wsj_itp_page = br.open(self.WSJ_ITP).read() + return br + # }}} def abs_wsj_url(self, href): if not href.startswith('http'): - href = 'http://online.wsj.com' + href + href = 'https://www.wsj.com' + href return href def wsj_find_articles(self, url, ahed=False): root = self.index_to_soup(url, as_tree=True) - - for x in CSSSelect('div.whatsNews-simple')(root): - x.getparent().remove(x) - + CSSSelect = Select(root) articles = [] - - for container in root.xpath('//li[contains(@class, "mjItemMain")]'): - meta = container.xpath('descendant::span[@class="meta_sectionName"]') - if not meta: - continue - meta = meta[0] - a = meta.xpath('ancestor::a')[0] - meta.getparent().remove(meta) + for container in CSSSelect('.style__grid_3gzjbqouVfPMK84Adb3MFE .article'): + meta = next(CSSSelect('.type', container)) + parent = meta.getparent() meta = self.tag_to_string(meta) + title = next(CSSSelect('.title', parent)) + a = next(CSSSelect('a', title)) title = self.tag_to_string(a) if meta: title += ' [%s]' % meta url = self.abs_wsj_url(a.get('href')) desc = '' - if container: - for p in container.xpath('descendant::p'): - q = self.tag_to_string(p) - if 'Subscriber Content' in q: - continue - desc += q - break + for p in CSSSelect('p.description', container): + q = self.tag_to_string(p) + if 'Subscriber Content' in q: + continue + desc += q + break articles.append({'title': title, 'url': url, 'description': desc, 'date': ''}) @@ -136,56 +171,36 @@ class WSJ(BasicNewsRecipe): self.log('\tFound article:', title) self.log('\t\t', desc) - if ahed: - for h2 in root.xpath('//li[@class="ahed_listitem"]/h2'): - a = h2.xpath('descendant::a')[0] - title = self.tag_to_string(a) - url = self.abs_wsj_url(a.get('href')) - desc = '' - p = h2.xpath('following-sibling::p') - if p: - desc = self.tag_to_string(p[0]) - articles.append({'title': title, 'url': url, - 'description': desc, 'date': ''}) - self.log('Found article:', title) - self.log('\t\t', desc) - return articles - def wsj_find_wn_articles(self, url): - root = self.index_to_soup(url, as_tree=True) + def wsj_find_wn_articles(self, feeds, root, CSSSelect): articles = [] + for a in CSSSelect('.style__strap_2m6gCW_c_6WZKkU--eRUWv'): + if 'WHAT\'S NEWS' in self.tag_to_string(a).upper(): + whats_news = a.getparent() + break + else: + self.log.error('Failed to find Whats News section') + return + for li in CSSSelect('li', whats_news): + a = next(CSSSelect('a', li)) + if '/articles/' not in a.get('href', ''): + continue + title = self.tag_to_string(a).strip() + url = self.abs_wsj_url(a.get('href')) + desc = self.tag_to_string(li) + articles.append({'title': title, 'url': url, + 'description': desc, 'date': ''}) - whats_news = CSSSelect('div.whatsNews-simple.whatsNews-itp')(root) - if whats_news: - for a in CSSSelect('a[href]')(whats_news[-1]): - if '/articles/' not in a.get('href', ''): - continue - container = a.xpath('ancestor::p') - for meta in CSSSelect('.meta_sectionName')(a): - meta.getparent().remove(meta) - title = self.tag_to_string(a).strip() - url = self.abs_wsj_url(a.get('href')) - desc = '' - if container: - desc = self.tag_to_string(container[0]) - - articles.append({'title': title, 'url': url, - 'description': desc, 'date': ''}) - - self.log('\tFound WN article:', title) - self.log('\t\t', desc) + self.log('\tFound WN article:', title) + self.log('\t\t', desc) return articles def wsj_add_feed(self, feeds, title, url): self.log('Found section:', title, '[' + url + ']') try: - if url.endswith('whatsnews'): - articles = self.wsj_find_wn_articles(url) - else: - articles = self.wsj_find_articles( - url, ahed=title == 'Front Section') + articles = self.wsj_find_articles(url) except Exception: self.log.exception('Failed to parse section:', title) articles = [] @@ -195,30 +210,22 @@ class WSJ(BasicNewsRecipe): def parse_index(self): # return self.test_wsj_index() root = self.index_to_soup(self.wsj_itp_page, as_tree=True) - for span in CSSSelect('span.date-date')(root): - if span.text and span.text.strip(): - self.timefmt = ' [%s]' % span.text.strip() + CSSSelect = Select(root) + for inp in CSSSelect('.DayPickerInput > input'): + if inp.get('placeholder'): + self.timefmt = inp.get('placeholder') break - for a in CSSSelect('div.itpSectionHeaderPdf a[href]')(root): - self.cover_url = a.get('href') - break feeds = [] - for a in CSSSelect('div.itpHeader ul.tab a[href]')(root): - if '/itp/' not in a.get('href', ''): + for a in CSSSelect('.WSJTheme__nav-container_sPVwT3FiPlWjFGtr5KH3d .WSJTheme__section-link_XGDsdx5qPlnC8BZPxQ63R'): + frontpage = a.get('href').endswith('frontpage') + title = self.tag_to_string(a).capitalize().strip().replace('U.s.', 'U.S.') + if not title: continue - pageone = a.get('href').endswith('pageone') - if pageone: - title = 'Front Section' - url = self.abs_wsj_url(a.get('href')) - self.wsj_add_feed(feeds, title, url) - title = "What's News" - url = url.replace('pageone', 'whatsnews') - self.wsj_add_feed(feeds, title, url) - else: - title = self.tag_to_string(a) - url = self.abs_wsj_url(a.get('href')) - self.wsj_add_feed(feeds, title, url) + url = self.abs_wsj_url(a.get('href')) + self.wsj_add_feed(feeds, title, url) + if frontpage: + self.wsj_find_wn_articles(feeds, root, CSSSelect) return feeds def test_wsj_index(self): From ccc4a1706002dad28df6fdf3ff260514b40eeb29 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 28 Nov 2018 20:13:54 +0530 Subject: [PATCH 0047/2613] Fix missing headlines on some wsj articles --- recipes/wsj.recipe | 8 ++------ recipes/wsj_free.recipe | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/recipes/wsj.recipe b/recipes/wsj.recipe index 1d6f9ec645..2958a8f9a7 100644 --- a/recipes/wsj.recipe +++ b/recipes/wsj.recipe @@ -40,7 +40,7 @@ class WSJ(BasicNewsRecipe): WSJ_ITP = 'https://online.wsj.com/itp/today' keep_only_tags = [ - dict(classes('wsj-article-headline-wrap article_header')), + dict(classes('wsj-article-headline-wrap article_header bigTop__hed bigTop__dek bigTop__captioncredit')), dict(name='span', itemprop='author', rel='author'), dict(name='article', id='article-contents articleBody'.split()), dict(name='div', id='article_story_body ncTitleArea snipper-ad-login'.split()), @@ -232,10 +232,6 @@ class WSJ(BasicNewsRecipe): return [ ('Testing', [ {'title': 'Article One', - 'url': 'http://online.wsj.com/articles/the-end-of-the-impulse-shopper-1416872108'}, # noqa - {'title': 'Article Two', - 'url': 'http://online.wsj.com/articles/ferguson-police-officer-not-charged-in-black-teens-shooting-1416882438'}, # noqa - {'title': 'Article Three', - 'url': 'http://online.wsj.com/article/SB10634695869867284248804580297251334393676.html'}, # noqa + 'url': 'https://www.wsj.com/articles/gms-plan-to-drop-chevy-cruze-hits-ohio-town-hard-1543314600'}, # noqa ]), ] diff --git a/recipes/wsj_free.recipe b/recipes/wsj_free.recipe index 1fb0223cc9..56a0c65707 100644 --- a/recipes/wsj_free.recipe +++ b/recipes/wsj_free.recipe @@ -40,7 +40,7 @@ class WSJ(BasicNewsRecipe): WSJ_ITP = 'https://online.wsj.com/itp/today' keep_only_tags = [ - dict(classes('wsj-article-headline-wrap article_header')), + dict(classes('wsj-article-headline-wrap article_header bigTop__hed bigTop__dek bigTop__captioncredit')), dict(name='span', itemprop='author', rel='author'), dict(name='article', id='article-contents articleBody'.split()), dict(name='div', id='article_story_body ncTitleArea snipper-ad-login'.split()), @@ -232,10 +232,6 @@ class WSJ(BasicNewsRecipe): return [ ('Testing', [ {'title': 'Article One', - 'url': 'http://online.wsj.com/articles/the-end-of-the-impulse-shopper-1416872108'}, # noqa - {'title': 'Article Two', - 'url': 'http://online.wsj.com/articles/ferguson-police-officer-not-charged-in-black-teens-shooting-1416882438'}, # noqa - {'title': 'Article Three', - 'url': 'http://online.wsj.com/article/SB10634695869867284248804580297251334393676.html'}, # noqa + 'url': 'https://www.wsj.com/articles/gms-plan-to-drop-chevy-cruze-hits-ohio-town-hard-1543314600'}, # noqa ]), ] From 4a5dcef8050f27f740037540127268e9835f2972 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 28 Nov 2018 20:17:38 +0530 Subject: [PATCH 0048/2613] Add a retry for WSJ articles --- recipes/wsj.recipe | 3 +++ recipes/wsj_free.recipe | 3 +++ 2 files changed, 6 insertions(+) diff --git a/recipes/wsj.recipe b/recipes/wsj.recipe index 2958a8f9a7..13ec7e607c 100644 --- a/recipes/wsj.recipe +++ b/recipes/wsj.recipe @@ -201,6 +201,9 @@ class WSJ(BasicNewsRecipe): self.log('Found section:', title, '[' + url + ']') try: articles = self.wsj_find_articles(url) + if not articles: + # retry once, sometimes these pages come up empty + articles = self.wsj_find_articles(url) except Exception: self.log.exception('Failed to parse section:', title) articles = [] diff --git a/recipes/wsj_free.recipe b/recipes/wsj_free.recipe index 56a0c65707..d521ebd7a7 100644 --- a/recipes/wsj_free.recipe +++ b/recipes/wsj_free.recipe @@ -201,6 +201,9 @@ class WSJ(BasicNewsRecipe): self.log('Found section:', title, '[' + url + ']') try: articles = self.wsj_find_articles(url) + if not articles: + # retry once, sometimes these pages come up empty + articles = self.wsj_find_articles(url) except Exception: self.log.exception('Failed to parse section:', title) articles = [] From 5c8f4a10a15a11017e1f17124b80b4cfb63bfcb0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 1 Dec 2018 13:27:10 +0530 Subject: [PATCH 0049/2613] E-book viewer: Fix a regression that broke viewing of HTMLZ files Fixes #1691976 [ebook-viewer cannot open htmlz-files](https://bugs.launchpad.net/calibre/+bug/1691976) --- src/calibre/ebooks/oeb/iterator/book.py | 36 ++++++++++++++----------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/calibre/ebooks/oeb/iterator/book.py b/src/calibre/ebooks/oeb/iterator/book.py index 19de65b6f4..e9729dfe8c 100644 --- a/src/calibre/ebooks/oeb/iterator/book.py +++ b/src/calibre/ebooks/oeb/iterator/book.py @@ -152,25 +152,29 @@ class EbookIterator(BookmarksMixin): self.language = None if self.mi.languages: self.language = self.mi.languages[0].lower() - ordered = [i for i in self.opf.spine if i.is_linear] + \ - [i for i in self.opf.spine if not i.is_linear] + self.spine = [] Spiny = partial(SpineItem, read_anchor_map=read_anchor_map, read_links=read_links, run_char_count=run_char_count, from_epub=self.book_format == 'EPUB') - is_comic = input_fmt.lower() in {'cbc', 'cbz', 'cbr', 'cb7'} - for i in ordered: - spath = i.path - mt = None - if i.idref is not None: - mt = self.opf.manifest.type_for_id(i.idref) - if mt is None: - mt = guess_type(spath)[0] - try: - self.spine.append(Spiny(spath, mime_type=mt)) - if is_comic: - self.spine[-1].is_single_page = True - except: - self.log.warn('Missing spine item:', repr(spath)) + if input_fmt.lower() == 'htmlz': + self.spine.append(Spiny(os.path.join(os.path.dirname(self.pathtoopf), 'index.html'), mime_type='text/html')) + else: + ordered = [i for i in self.opf.spine if i.is_linear] + \ + [i for i in self.opf.spine if not i.is_linear] + is_comic = input_fmt.lower() in {'cbc', 'cbz', 'cbr', 'cb7'} + for i in ordered: + spath = i.path + mt = None + if i.idref is not None: + mt = self.opf.manifest.type_for_id(i.idref) + if mt is None: + mt = guess_type(spath)[0] + try: + self.spine.append(Spiny(spath, mime_type=mt)) + if is_comic: + self.spine[-1].is_single_page = True + except: + self.log.warn('Missing spine item:', repr(spath)) cover = self.opf.cover if cover and self.ebook_ext in {'lit', 'mobi', 'prc', 'opf', 'fb2', From d3441244812217b68a82dcde83d2d669068bab5c Mon Sep 17 00:00:00 2001 From: David Date: Sat, 1 Dec 2018 22:43:30 +1100 Subject: [PATCH 0050/2613] Fix error when no author on Kobo device And I meant to bump the driver version before. --- src/calibre/devices/kobo/driver.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 97be54617b..00637470fa 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -78,7 +78,7 @@ class KOBO(USBMS): gui_name = 'Kobo Reader' description = _('Communicate with the Kobo Reader') author = 'Timothy Legge and David Forrester' - version = (2, 4, 0) + version = (2, 5, 0) dbversion = 0 fwversion = (0,0,0) @@ -1684,7 +1684,8 @@ class KOBOTOUCH(KOBO): # print "Normalized FileName: " + path # Collect the Kobo metadata - kobo_metadata = Metadata(title, [a.strip() for a in authors.split("&")]) + authors_list = [a.strip() for a in authors.split("&")] if authors is not None else [_('Unknown')] + kobo_metadata = Metadata(title, authors_list) kobo_metadata.series = series kobo_metadata.series_index = seriesnumber kobo_metadata.comments = Description From 507901b0e95365f06002ebfa1c6e481af644da16 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 2 Dec 2018 12:22:09 +0530 Subject: [PATCH 0051/2613] Remove non-working recipe --- recipes/sportsillustrated_columnists.recipe | 65 --------------------- 1 file changed, 65 deletions(-) delete mode 100644 recipes/sportsillustrated_columnists.recipe diff --git a/recipes/sportsillustrated_columnists.recipe b/recipes/sportsillustrated_columnists.recipe deleted file mode 100644 index 2e85173664..0000000000 --- a/recipes/sportsillustrated_columnists.recipe +++ /dev/null @@ -1,65 +0,0 @@ -from calibre.web.feeds.recipes import BasicNewsRecipe -from calibre.ebooks.BeautifulSoup import BeautifulSoup -from urllib import quote - - -class SportsIllustratedColumnistsRecipe(BasicNewsRecipe): - title = u'Sports Illustrated Columnists' - __author__ = u'kwetal' - __license__ = u'GPL v3' - language = 'en' - version = 2 - - oldest_article = 7 - max_articles_per_feed = 100 - no_stylesheets = True - remove_javascript = True - - feeds = [] - # RSS sources found at http://sportsillustrated.cnn.com/services/rss/ - feeds.append((u'Jon Heyman', u'http://rss.cnn.com/rss/si_jon_heyman.rss')) - feeds.append( - (u'Austin Murphy', u'http://rss.cnn.com/rss/si_austin_murphy.rss')) - feeds.append( - (u'Lars Anderson', u'http://rss.cnn.com/rss/si_lars_anderson.rss')) - feeds.append( - (u'Melissa Segura', u'http://rss.cnn.com/rss/si_melissa_segura.rss')) - feeds.append((u'Peter King', u'http://rss.cnn.com/rss/si_peter_king.rss')) - feeds.append( - (u'Scott Wraight', u'http://rss.cnn.com/rss/si_scott_wraight.rss')) - - def print_version(self, url): - # This is the url and the parameters that work to get the print - # version. - printUrl = 'http://si.printthis.clickability.com/pt/printThis?clickMap=printThis' - printUrl += '&fb=Y&partnerID=2356&url=' + quote(url) - - return printUrl - - # However the original javascript also uses the following parameters, but they can be left out: - # title : can be some random string - # random : some random number, but I think the number of digits is important - # expire : no idea what value to use - # All this comes from the Javascript function that redirects to the - # print version. It's called PT() and is defined in the file 48.js - - def preprocess_html(self, soup): - temp = soup.find('div', attrs={'class': 'cnnstoryheadline'}) - if temp: - # It's an article, make a valid content container - homeMadeSoup = BeautifulSoup( - '') - body = homeMadeSoup.find('body') - - headline = temp.find('h1') - if headline: - body.append(headline) - - for td in soup.findAll('td', attrs={'class': 'cnnstorycontentarea'}): - for p in td.findAll('p'): - body.append(p) - - return homeMadeSoup - else: - # It's a TOC, just return the whole lot - return soup From 22d5e11cac2b7d029fb1cd83e9d328f5a8b7b3d0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 2 Dec 2018 12:58:14 +0530 Subject: [PATCH 0052/2613] Sports Illustrated by Kovid Goyal --- recipes/sports_illustrated.recipe | 57 +++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 recipes/sports_illustrated.recipe diff --git a/recipes/sports_illustrated.recipe b/recipes/sports_illustrated.recipe new file mode 100644 index 0000000000..859f0842ca --- /dev/null +++ b/recipes/sports_illustrated.recipe @@ -0,0 +1,57 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +# License: GPLv3 Copyright: 2018, Kovid Goyal + +from __future__ import absolute_import, division, print_function, unicode_literals + +from calibre.web.feeds.news import BasicNewsRecipe + + +def classes(classes): + q = frozenset(classes.split(' ')) + return dict(attrs={ + 'class': lambda x: x and frozenset(x.split()).intersection(q)}) + + +class SI(BasicNewsRecipe): + title = 'Sports Illustrated' + __author__ = 'Kovid Goyal' + language = 'en' + encoding = 'utf-8' + ignore_duplicate_articles = {'title', 'url'} + no_stylesheets = True + compress_news_images = True + compress_news_images_auto_size = 5 + remove_attributes = ['style'] + + keep_only_tags = [ + classes('headline article-content'), + ] + remove_tags = [ + classes('media-video OUTBRAIN'), + dict(name='meta'), + ] + + def preprocess_html(self, soup, *a): + for tag in soup.findAll(attrs={'data-src': True}): + tag.name = 'img' + del tag.contents[:] + tag['src'] = tag['data-src'] + print(tag) + return soup + + feeds = [ + ('Top stories', 'https://www.si.com/rss/si_topstories.rss'), + ('NFL', 'https://www.si.com/rss/si_nfl.rss'), + ('College Football', 'https://www.si.com/rss/si_ncaaf.rss'), + ('MLB', 'https://www.si.com/rss/si_mlb.rss'), + ('NBA', 'https://www.si.com/rss/si_nba.rss'), + ('College basketball', 'https://www.si.com/rss/si_ncaab.rss'), + ('NHL', 'https://www.si.com/rss/si_hockey.rss'), + ('Soccer', 'https://www.si.com/rss/si_soccer.rss'), + ('Tennis', 'https://www.si.com/rss/si_tennis.rss'), + ('Fantasy', 'https://www.si.com/rss/si_fantasy.rss'), + ('MMA', 'https://www.si.com/rss/si_mma.rss'), + ('Swim Daily', 'https://www.si.com/rss/si_swim_daily.rss'), + ('Writers', 'https://www.si.com/rss/si_writers.rss'), + ] From c327410f69bb2cc6180e058a3dd15a227cb9af45 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 2 Dec 2018 13:00:50 +0530 Subject: [PATCH 0053/2613] ... --- recipes/sports_illustrated.recipe | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/sports_illustrated.recipe b/recipes/sports_illustrated.recipe index 859f0842ca..869fab7f20 100644 --- a/recipes/sports_illustrated.recipe +++ b/recipes/sports_illustrated.recipe @@ -37,7 +37,6 @@ class SI(BasicNewsRecipe): tag.name = 'img' del tag.contents[:] tag['src'] = tag['data-src'] - print(tag) return soup feeds = [ From ff059b30667f8ec7c39c3030e00999678277c37b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 2 Dec 2018 13:38:30 +0530 Subject: [PATCH 0054/2613] Edit book: Insert hyperlink: Allow specifying a template to control the markup that is inserted for the hyperlink. Fixes #1804250 [[enhancement] editor, insert hyperlink add option](https://bugs.launchpad.net/calibre/+bug/1804250) --- src/calibre/gui2/tweak_book/boss.py | 2 +- .../gui2/tweak_book/editor/smarts/html.py | 13 +++++++------ src/calibre/gui2/tweak_book/editor/text.py | 4 ++-- src/calibre/gui2/tweak_book/editor/widget.py | 4 ++-- src/calibre/gui2/tweak_book/widgets.py | 18 ++++++++++++++++++ 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index 24e9305027..0dcb09d8b9 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -898,7 +898,7 @@ class Boss(QObject): self.commit_all_editors_to_container() d = InsertLink(current_container(), edname, initial_text=ed.get_smart_selection(), parent=self.gui) if d.exec_() == d.Accepted: - ed.insert_hyperlink(d.href, d.text) + ed.insert_hyperlink(d.href, d.text, template=d.template) elif action[0] == 'insert_tag': d = InsertTag(parent=self.gui) if d.exec_() == d.Accepted: diff --git a/src/calibre/gui2/tweak_book/editor/smarts/html.py b/src/calibre/gui2/tweak_book/editor/smarts/html.py index 854774587a..1f32354002 100644 --- a/src/calibre/gui2/tweak_book/editor/smarts/html.py +++ b/src/calibre/gui2/tweak_book/editor/smarts/html.py @@ -26,6 +26,7 @@ from calibre.utils.icu import utf16_length get_offset = itemgetter(0) PARAGRAPH_SEPARATOR = '\u2029' +DEFAULT_LINK_TEMPLATE = '_TEXT_' class Tag(object): @@ -407,18 +408,18 @@ class Smarts(NullSmarts): editor.setTextCursor(cursor) return editor.selected_text_from_cursor(cursor) - def insert_hyperlink(self, editor, target, text): + def insert_hyperlink(self, editor, target, text, template=None): + template = template or DEFAULT_LINK_TEMPLATE + template = template.replace('_TARGET_', prepare_string_for_xml(target, True)) + offset = template.find('_TEXT_') editor.highlighter.join() c = editor.textCursor() if c.hasSelection(): c.insertText('') # delete any existing selected text ensure_not_within_tag_definition(c) - c.insertText('' % prepare_string_for_xml(target, True)) - p = c.position() - c.insertText('') + p = c.position() + offset + c.insertText(template.replace('_TEXT_', text or '')) c.setPosition(p) # ensure cursor is positioned inside the newly created tag - if text: - c.insertText(text) editor.setTextCursor(c) def insert_tag(self, editor, name): diff --git a/src/calibre/gui2/tweak_book/editor/text.py b/src/calibre/gui2/tweak_book/editor/text.py index 084dbbbb49..e4b6deb9bd 100644 --- a/src/calibre/gui2/tweak_book/editor/text.py +++ b/src/calibre/gui2/tweak_book/editor/text.py @@ -869,9 +869,9 @@ version="1.1" width="100%%" height="100%%" viewBox="0 0 {w} {h}" preserveAspectR c.setPosition(left + len(text), c.KeepAnchor) self.setTextCursor(c) - def insert_hyperlink(self, target, text): + def insert_hyperlink(self, target, text, template=None): if hasattr(self.smarts, 'insert_hyperlink'): - self.smarts.insert_hyperlink(self, target, text) + self.smarts.insert_hyperlink(self, target, text, template=template) def insert_tag(self, tag): if hasattr(self.smarts, 'insert_tag'): diff --git a/src/calibre/gui2/tweak_book/editor/widget.py b/src/calibre/gui2/tweak_book/editor/widget.py index 3db90cebbb..4f5827b632 100644 --- a/src/calibre/gui2/tweak_book/editor/widget.py +++ b/src/calibre/gui2/tweak_book/editor/widget.py @@ -234,8 +234,8 @@ class Editor(QMainWindow): def insert_image(self, href, fullpage=False, preserve_aspect_ratio=False, width=-1, height=-1): self.editor.insert_image(href, fullpage=fullpage, preserve_aspect_ratio=preserve_aspect_ratio, width=width, height=height) - def insert_hyperlink(self, href, text): - self.editor.insert_hyperlink(href, text) + def insert_hyperlink(self, href, text, template=None): + self.editor.insert_hyperlink(href, text, template=template) def _build_insert_tag_button_menu(self): m = self.insert_tag_menu diff --git a/src/calibre/gui2/tweak_book/widgets.py b/src/calibre/gui2/tweak_book/widgets.py index bfc7c11bec..e81f70c394 100644 --- a/src/calibre/gui2/tweak_book/widgets.py +++ b/src/calibre/gui2/tweak_book/widgets.py @@ -671,8 +671,22 @@ class InsertLink(Dialog): t.setText(self.initial_text or '') t.setPlaceholderText(_('The (optional) text for the link')) + self.template_edit = t = QLineEdit(self) + tl.addRow(_('Tem&plate:'), t) + from calibre.gui2.tweak_book.editor.smarts.html import DEFAULT_LINK_TEMPLATE + t.setText(tprefs.get('insert-hyperlink-template', None) or DEFAULT_LINK_TEMPLATE) + l.addWidget(self.bb) + def accept(self): + from calibre.gui2.tweak_book.editor.smarts.html import DEFAULT_LINK_TEMPLATE + t = self.template + if t: + if t == DEFAULT_LINK_TEMPLATE: + t = None + tprefs.set('insert-hyperlink-template', self.template) + return Dialog.accept(self) + def selected_file_changed(self, *args): rows = list(self.file_names.selectionModel().selectedRows()) if not rows: @@ -722,6 +736,10 @@ class InsertLink(Dialog): def text(self): return unicode(self.text_edit.text()).strip() + @property + def template(self): + return self.template_edit.text().strip() or None + @classmethod def test(cls): import sys From 988a383714d584ad034d022ba93e9411e8f73bae Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 2 Dec 2018 13:44:44 +0530 Subject: [PATCH 0055/2613] ... --- src/calibre/gui2/tweak_book/widgets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tweak_book/widgets.py b/src/calibre/gui2/tweak_book/widgets.py index e81f70c394..eab1c9091c 100644 --- a/src/calibre/gui2/tweak_book/widgets.py +++ b/src/calibre/gui2/tweak_book/widgets.py @@ -25,7 +25,7 @@ from calibre.ebooks.oeb.polish.utils import lead_text, guess_type from calibre.gui2 import error_dialog, choose_files, choose_save_file, info_dialog, choose_images from calibre.gui2.tweak_book import tprefs, current_container from calibre.gui2.widgets2 import Dialog as BaseDialog -from calibre.utils.icu import primary_sort_key, sort_key, primary_contains +from calibre.utils.icu import primary_sort_key, sort_key, primary_contains, numeric_sort_key from calibre.utils.matcher import get_char, Matcher from calibre.gui2.complete2 import EditWithComplete @@ -706,7 +706,7 @@ class InsertLink(Dialog): continue text = lead_text(item, num_words=4) ac.append((text, frag)) - ac.sort(key=lambda text_frag: primary_sort_key(text_frag[0])) + ac.sort(key=lambda text_frag: numeric_sort_key(text_frag[0])) self.anchor_names.model().set_names(self.anchor_cache[name]) self.update_target() From 184bd089c10636923ccf2e5f53e8429d24b81d99 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 4 Dec 2018 17:43:32 +0530 Subject: [PATCH 0056/2613] ... --- src/calibre/gui2/viewer/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/viewer/config.py b/src/calibre/gui2/viewer/config.py index 1cb8c33385..bd015c18c6 100644 --- a/src/calibre/gui2/viewer/config.py +++ b/src/calibre/gui2/viewer/config.py @@ -264,7 +264,7 @@ class ConfigDialog(QDialog, Ui_Dialog): l.addRow(_('&Language:'), self.le) self.url = u = QLineEdit(self) u.setMinimumWidth(350) - u.setPlaceholderText(_('For example: %s') % 'http://dictionary.com/{word}') + u.setPlaceholderText(_('For example: %s') % 'https://dictionary.com/{word}') l.addRow(_('&URL:'), u) self.bb = bb = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel) l.addRow(bb) From 65eafd1f7ced5e356ef1d280816973b1e030f4b5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 5 Dec 2018 09:43:03 +0530 Subject: [PATCH 0057/2613] Update Wired Magazine --- recipes/wired.recipe | 56 ++++---------------------------------------- 1 file changed, 5 insertions(+), 51 deletions(-) diff --git a/recipes/wired.recipe b/recipes/wired.recipe index 687592b229..c4b884ce1a 100644 --- a/recipes/wired.recipe +++ b/recipes/wired.recipe @@ -5,8 +5,6 @@ www.wired.com ''' from calibre.web.feeds.news import BasicNewsRecipe -from datetime import date -import urllib2 def classes(classes): @@ -33,7 +31,6 @@ class WiredDailyNews(BasicNewsRecipe): language = 'en' ignore_duplicate_articles = {'url'} remove_empty_feeds = True - publication_type = 'newsportal' extra_css = """ .entry-header{ text-transform: uppercase; @@ -51,27 +48,9 @@ class WiredDailyNews(BasicNewsRecipe): keep_only_tags = [ dict(name='main', attrs={'class': lambda x: x and 'article-main-component__content' in x}), ] - remove_attributes = ['srcset'] - handle_gzip = True - - def get_magazine_year_month(self, seperator): - monthurl = str('{:02d}'.format(date.today().month)) - yearurl = str(date.today().year - 1992) - return yearurl + seperator + monthurl - - def get_date_url(self): - ''' - get month and year, add year modifier, append to wired magazine url, - :return: url - ''' - baseurl = 'https://www.wired.com/tag/magazine-' - magazine_year_month = self.get_magazine_year_month('.') - # monthurl = str('{:02d}'.format(date.today().month)) - # yearurl = str(date.today().year - 1992) - dateurl = baseurl + magazine_year_month + '/page/' - return dateurl def parse_wired_index_page(self, currenturl, seen): + self.log('Parsing index page', currenturl) soup = self.index_to_soup(currenturl) baseurl = 'https://www.wired.com' for a in soup.find("ul", {"class" : 'archive-list-component__items'}).findAll('a', href=True): @@ -87,39 +66,14 @@ class WiredDailyNews(BasicNewsRecipe): 'title': title, 'date': date, 'url': baseurl+url, - 'description': '' } def parse_index(self): - ''' - get the current month's url, index first page to soup, - find number of pages, just keep adding to page num until - soup is not none instead of scraping page for :return: - ''' - baseurl = self.get_date_url() + baseurl = 'https://www.wired.com/magazine/page/{}/' pagenum = 1 articles = [] seen = set() - morepages = True - while morepages: - try: - urllib2.urlopen(baseurl + str(pagenum)) - currenturl = baseurl + str(pagenum) - res=self.parse_wired_index_page(currenturl, seen) - articles.extend(res) - if len(list(res))==0: - morepages = False - pagenum += 1 - except urllib2.HTTPError: - morepages = False + for pagenum in range(1, 4): + articles.extend(self.parse_wired_index_page(baseurl.format(pagenum), seen)) - magazine_year_month = self.get_magazine_year_month('.') - return [('Magazine-' + magazine_year_month, articles)] - - def get_cover_url(self): - ''' - get the most recent magazine cover - :return: url - ''' - soup = self.index_to_soup('https://www.wired.com/category/magazine/') - return soup.find(id='mag-card').find('img').get('src') + return [('Magazine Articles', articles)] From d00558765d567215755d2e5136b895d3f17569ee Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 5 Dec 2018 10:02:39 +0530 Subject: [PATCH 0058/2613] Handle change to newsweek index page --- recipes/newsweek.recipe | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/newsweek.recipe b/recipes/newsweek.recipe index 44935102f1..09c3955b24 100644 --- a/recipes/newsweek.recipe +++ b/recipes/newsweek.recipe @@ -75,7 +75,10 @@ class Newsweek(BasicNewsRecipe): sections = defaultdict(list) for block in ('magazine-magazine-issue-story-list', 'editors-pick'): div = root.xpath( - '//div[@id="block-nw-{}"]'.format(block))[0] + '//div[@id="block-nw-{}"]'.format(block)) + if not div: + continue + div = div[0] for a in div.xpath(href_xpath): title = self.tag_to_string(a) article = a.xpath('ancestor::article')[0] From 320487b8df399204d825244ed5aefe0211a13dfa Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 6 Dec 2018 10:49:32 +0530 Subject: [PATCH 0059/2613] Macrobusinness by 2018robert --- recipes/macrobusiness.recipe | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 recipes/macrobusiness.recipe diff --git a/recipes/macrobusiness.recipe b/recipes/macrobusiness.recipe new file mode 100644 index 0000000000..c848d7261d --- /dev/null +++ b/recipes/macrobusiness.recipe @@ -0,0 +1,28 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +from __future__ import unicode_literals, division, absolute_import, print_function +from calibre.web.feeds.news import BasicNewsRecipe + + +class AdvancedUserRecipe(BasicNewsRecipe): + title = 'Macrobusiness' + language = 'en_AU' + __author__ = '2018robert' + oldest_article = 1 + max_articles_per_feed = 100 + auto_cleanup = True + needs_subscription = 'optional' + + feeds = [ + ('Macrobusiness', 'https://www.macrobusiness.com.au/feed'), + ] + + def get_browser(self): + br = BasicNewsRecipe.get_browser(self) + if self.username is not None and self.password is not None: + br.open('https://www.macrobusiness.com.au/my-account/') + br.select_form(class_=lambda x: 'login' in x) + br['username'] = self.username + br['password'] = self.password + br.submit() + return br From 34746bbd9436739951dbd2b65af1c79339f23c21 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 7 Dec 2018 08:28:03 +0530 Subject: [PATCH 0060/2613] Fix #1807266 [create_from_xpath IOError: [Errno 5] Input/output error](https://bugs.launchpad.net/calibre/+bug/1807266) --- src/calibre/gui2/toc/main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/calibre/gui2/toc/main.py b/src/calibre/gui2/toc/main.py index 81f6e7dd49..fd986c8137 100644 --- a/src/calibre/gui2/toc/main.py +++ b/src/calibre/gui2/toc/main.py @@ -934,7 +934,6 @@ class TOCView(QWidget): # {{{ def create_from_xpath(self, xpaths, remove_duplicates=True): toc = from_xpaths(self.ebook, xpaths) - print(1111111, remove_duplicates) if len(toc) == 0: return error_dialog(self, _('No items found'), _('No items were found that could be added to the Table of Contents.'), show=True) From 238c3e915848d82744eeb035df1ee313e0acfde6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 7 Dec 2018 10:26:49 +0530 Subject: [PATCH 0061/2613] version 3.35.0 --- Changelog.yaml | 44 ++++++++++++++++++++++++++++++++++++++++ src/calibre/constants.py | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/Changelog.yaml b/Changelog.yaml index c6e8a32bb1..1ffb69de01 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -20,6 +20,50 @@ # new recipes: # - title: +- version: 3.35.0 + date: 2018-12-07 + + new features: + - title: "Edit book: Insert hyperlink: Allow specifying a template to control the markup that is inserted for the hyperlink." + tickets: [1804250] + + - title: "Metadata download: Add an option (in Preferences->Metadata download) to keep multiple results from individual metadata sources, useful if you prefer to pick the best result by hand and use only one or two metadata sources." + tickets: [1802293] + + - title: "Kobo driver: Add an option to directly update metadata in the Kobo device database, instead of waiting for the Kobo to update the database after disconnecting. (Preferences->Plugins->Customize the Kobo device plugin)" + + bug fixes: + - title: "E-book viewer: Fix a regression that broke viewing of HTMLZ files" + tickets: [1691976] + + - title: "Edit book: Fix suggestions in completion popup not being sorted." + tickets: [1803985] + + - title: "Windows: Fix restarting calibre with system tray icon enabled causing duplicate defunct icons in the tray." + tickets: [1803034] + + improved recipes: + - Wired Magazine + - Wall Street Journal + - Telepolis + - Yahoo News + - Associated Press + - Mother Jones + + new recipes: + - title: Macrobusinness + author: 2018robert + + - title: Sports Illustrated + author: Kovid Goyal + + - title: Le Peuple Breton + author: Lionel Plais + + - title: Mandidner + author: pofa + + - version: 3.34.0 date: 2018-11-08 diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 0a8d01af6d..482e92c62a 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -6,7 +6,7 @@ from polyglot.builtins import map import sys, locale, codecs, os, importlib, collections __appname__ = u'calibre' -numeric_version = (3, 34, 0) +numeric_version = (3, 35, 0) __version__ = u'.'.join(map(unicode, numeric_version)) __author__ = u"Kovid Goyal " From 526835e5559676800c62efda4d80c0b8ceb7322f Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Sun, 25 Nov 2018 19:17:39 -0500 Subject: [PATCH 0062/2613] Add cmake build directory to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 50f324a49b..6122bbe6d7 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,4 @@ recipes/debug /.metadata/ .idea /*env*/ +cmake-build-* From cf576342e15db24acc3b8c174d2ec6139cee7989 Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Tue, 27 Nov 2018 00:29:40 -0500 Subject: [PATCH 0063/2613] Build tokenizer on py3 - The actual unicode manipulation wasn't converted to the new 3.3+ style, since it would lead to lots of ifdefs and become quite ugly. This can be done when py2 support is dropped. The drawbacks will be temporary slower code (there will be extra copying required). --- src/tinycss/tokenizer.c | 174 +++++++++++++++++++++++----------------- 1 file changed, 102 insertions(+), 72 deletions(-) diff --git a/src/tinycss/tokenizer.c b/src/tinycss/tokenizer.c index 98e7f0d6ec..d06e4a1200 100644 --- a/src/tinycss/tokenizer.c +++ b/src/tinycss/tokenizer.c @@ -34,7 +34,7 @@ tokenizer_Token_dealloc(tokenizer_Token* self) Py_XDECREF(self->unit); self->unit = NULL; Py_XDECREF(self->line); self->line = NULL; Py_XDECREF(self->column); self->column = NULL; - self->ob_type->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } @@ -46,7 +46,8 @@ tokenizer_Token_new(PyTypeObject *type, PyObject *args, PyObject *kwds) if (self == NULL) return PyErr_NoMemory(); if (!PyArg_ParseTuple(args, "OOOOOO", &(self->type), &(self->_as_css), &(self->value), &(self->unit), &(self->line), &(self->column))) { - self->ob_type->tp_free((PyObject*)self); return NULL; + Py_TYPE(self)->tp_free((PyObject *) self); + return NULL; } Py_INCREF(self->type); Py_INCREF(self->_as_css); Py_INCREF(self->value); Py_INCREF(self->unit); Py_INCREF(self->line); Py_INCREF(self->column); self->is_container = Py_False; Py_INCREF(self->is_container); @@ -54,16 +55,25 @@ tokenizer_Token_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return (PyObject *)self; } +#if PY_MAJOR_VERSION >= 3 +#define PyObject_Unicode_Compat(arg) PyObject_Str(arg) +#else +#define PyObject_Unicode_Compat(arg) PyObject_Unicode(arg) +#endif + static PyObject * tokenizer_Token_repr(tokenizer_Token *self) { PyObject *type = NULL, *line = NULL, *column = NULL, *value = NULL, *ans = NULL, *unit = NULL; if (!self->type || !self->line || !self->column || !self->value) return PyBytes_FromString(""); - type = PyObject_Unicode(self->type); line = PyObject_Unicode(self->line); column = PyObject_Unicode(self->column); value = PyObject_Unicode(self->value); + type = PyObject_Unicode_Compat(self->type); + line = PyObject_Unicode_Compat(self->line); + column = PyObject_Unicode_Compat(self->column); + value = PyObject_Unicode_Compat(self->value); if (type && line && column && value) { if (self->unit != NULL && PyObject_IsTrue(self->unit)) { - unit = PyObject_Unicode(self->unit); - if (unit != NULL) + unit = PyObject_Unicode_Compat(self->unit); + if (unit != NULL) ans = PyUnicode_FromFormat("", type, line, column, value, unit); else PyErr_NoMemory(); @@ -103,45 +113,44 @@ static PyMethodDef tokenizer_Token_methods[] = { }; static PyTypeObject tokenizer_TokenType = { // {{{ - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "tokenizer.Token", /*tp_name*/ - sizeof(tokenizer_Token), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)tokenizer_Token_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - (reprfunc)tokenizer_Token_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - "Token", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - tokenizer_Token_methods, /* tp_methods */ - tokenizer_Token_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - tokenizer_Token_new, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "tokenizer.Token", + /* tp_basicsize */ sizeof(tokenizer_Token), + /* tp_itemsize */ 0, + /* tp_dealloc */ (destructor) tokenizer_Token_dealloc, + /* tp_print */ 0, + /* tp_getattr */ 0, + /* tp_setattr */ 0, + /* tp_compare */ 0, + /* tp_repr */ (reprfunc) tokenizer_Token_repr, + /* tp_as_number */ 0, + /* tp_as_sequence */ 0, + /* tp_as_mapping */ 0, + /* tp_hash */ 0, + /* tp_call */ 0, + /* tp_str */ 0, + /* tp_getattro */ 0, + /* tp_setattro */ 0, + /* tp_as_buffer */ 0, + /* tp_flags */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + /* tp_doc */ "Token", + /* tp_traverse */ 0, + /* tp_clear */ 0, + /* tp_richcompare */ 0, + /* tp_weaklistoffset */ 0, + /* tp_iter */ 0, + /* tp_iternext */ 0, + /* tp_methods */ tokenizer_Token_methods, + /* tp_members */ tokenizer_Token_members, + /* tp_getset */ 0, + /* tp_base */ 0, + /* tp_dict */ 0, + /* tp_descr_get */ 0, + /* tp_descr_set */ 0, + /* tp_dictoffset */ 0, + /* tp_init */ 0, + /* tp_alloc */ 0, + /* tp_new */ tokenizer_Token_new, }; // }}} // }}} @@ -170,7 +179,7 @@ tokenize_init(PyObject *self, PyObject *args) { Py_INCREF(COMPILED_TOKEN_REGEXPS); Py_INCREF(UNICODE_UNESCAPE); Py_INCREF(NEWLINE_UNESCAPE); Py_INCREF(SIMPLE_UNESCAPE); Py_INCREF(FIND_NEWLINES); Py_INCREF(TOKEN_DISPATCH); Py_INCREF(COLON); Py_INCREF(SCOLON); Py_INCREF(LPAR); Py_INCREF(RPAR); Py_INCREF(LBRACE); Py_INCREF(RBRACE); Py_INCREF(LBOX); Py_INCREF(RBOX); Py_INCREF(DELIM_TOK); Py_INCREF(INTEGER); Py_INCREF(STRING_TOK); -#define SETCONST(x) x = PyInt_AsSsize_t(PyDict_GetItemString(cti, #x)) +#define SETCONST(x) x = PyLong_AsSsize_t(PyDict_GetItemString(cti, #x)) SETCONST(BAD_COMMENT); SETCONST(BAD_STRING); SETCONST(PERCENTAGE); SETCONST(DIMENSION); SETCONST(ATKEYWORD); SETCONST(FUNCTION); SETCONST(COMMENT); SETCONST(NUMBER); SETCONST(STRING); SETCONST(IDENT); SETCONST(HASH); SETCONST(URI); Py_RETURN_NONE; @@ -178,9 +187,6 @@ tokenize_init(PyObject *self, PyObject *args) { static int contains_char(PyObject *haystack, Py_UNICODE c) { -#if PY_VERSION_HEX >= 0x03030000 -#error Not implemented for python >= 3.3 -#endif Py_ssize_t i = 0; Py_UNICODE *data = PyUnicode_AS_UNICODE(haystack); for (i = 0; i < PyUnicode_GET_SIZE(haystack); i++) { @@ -190,35 +196,38 @@ contains_char(PyObject *haystack, Py_UNICODE c) { } static PyObject *unicode_to_number(PyObject *src) { -#if PY_VERSION_HEX >= 0x03030000 -#error Not implemented for python >= 3.3 -#endif PyObject *raw = NULL, *ans = NULL; raw = PyUnicode_AsASCIIString(src); if (raw == NULL) { return NULL; } if (contains_char(src, '.')) { +#if PY_MAJOR_VERSION >= 3 + ans = PyFloat_FromString(raw); +#else ans = PyFloat_FromString(raw, NULL); +#endif } else { +#if PY_MAJOR_VERSION >= 3 + ans = PyLong_FromUnicodeObject(raw, 10); +#else ans = PyInt_FromString(PyString_AS_STRING(raw), NULL, 10); +#endif } Py_DECREF(raw); return ans; } + +// TODO Convert this to use the 3.3+ unicode API +// doing so while preserving py2 compat would lead to a giant mess of #ifs, so +// it's better to do it when calibre is all migrated to py3 static void lowercase(PyObject *x) { -#if PY_VERSION_HEX >= 0x03030000 -#error Not implemented for python >= 3.3 -#endif Py_ssize_t i = 0; Py_UNICODE *data = PyUnicode_AS_UNICODE(x); for (i = 0; i < PyUnicode_GET_SIZE(x); i++) data[i] = Py_UNICODE_TOLOWER(data[i]); } -static PyObject* clone_unicode(Py_UNICODE *x, Py_ssize_t sz) { -#if PY_VERSION_HEX >= 0x03030000 -#error Not implemented for python >= 3.3 -#endif +static PyObject *clone_unicode(Py_UNICODE *x, Py_ssize_t sz) { PyObject *ans = PyUnicode_FromUnicode(NULL, sz); if (ans == NULL) return PyErr_NoMemory(); memcpy(PyUnicode_AS_UNICODE(ans), x, sz * sizeof(Py_UNICODE)); @@ -227,9 +236,6 @@ static PyObject* clone_unicode(Py_UNICODE *x, Py_ssize_t sz) { static PyObject* tokenize_flat(PyObject *self, PyObject *args) { -#if PY_VERSION_HEX >= 0x03030000 -#error Not implemented for python >= 3.3 -#endif Py_UNICODE *css_source = NULL, c = 0, codepoint = 0; PyObject *ic = NULL, *token = NULL, *tokens = NULL, *type_name = NULL, *css_value = NULL, *value = NULL, *unit = NULL, *tries = NULL, *match = NULL, *match_func = NULL, *py_source = NULL, *item = NULL, *newlines = NULL; int ignore_comments = 0; @@ -272,7 +278,7 @@ tokenize_flat(PyObject *self, PyObject *args) { if (match != Py_None) { css_value = PyObject_CallMethod(match, "group", NULL); if (css_value == NULL) { goto error; } - type_ = PyInt_AsSsize_t(PyTuple_GET_ITEM(item, 0)); + type_ = PyLong_AsSsize_t(PyTuple_GET_ITEM(item, 0)); type_name = PyTuple_GET_ITEM(item, 1); Py_INCREF(type_name); break; @@ -415,17 +421,41 @@ static PyMethodDef tokenizer_methods[] = { {NULL, NULL, 0, NULL} }; +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +static struct PyModuleDef tokenizer_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "tokenizer", + /* m_doc */ "Implementation of tokenizer in C for speed.", + /* m_size */ -1, + /* m_methods */ tokenizer_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; -CALIBRE_MODINIT_FUNC -inittokenizer(void) { - PyObject *m; +CALIBRE_MODINIT_FUNC PyInit_tokenizer(void) { if (PyType_Ready(&tokenizer_TokenType) < 0) - return; + INITERROR; - m = Py_InitModule3("tokenizer", tokenizer_methods, - "Implementation of tokenizer in C for speed." - ); - if (m == NULL) return; + PyObject *mod = PyModule_Create(&tokenizer_module); +#else +#define INITERROR return +CALIBRE_MODINIT_FUNC inittokenizer(void) { + if (PyType_Ready(&tokenizer_TokenType) < 0) + INITERROR; + + PyObject *mod = Py_InitModule3("tokenizer", tokenizer_methods, + "Implementation of tokenizer in C for speed."); +#endif + + if (mod == NULL) INITERROR; Py_INCREF(&tokenizer_TokenType); - PyModule_AddObject(m, "Token", (PyObject *)&tokenizer_TokenType); -} + PyModule_AddObject(mod, "Token", (PyObject *) &tokenizer_TokenType); + + +#if PY_MAJOR_VERSION >= 3 + return mod; +#endif +} \ No newline at end of file From 5f420d7047749bf0c676864cb4f4fdfc636994c5 Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Sat, 8 Dec 2018 16:58:44 -0500 Subject: [PATCH 0064/2613] Fix number->size conversion --- src/calibre/gui2/tweak_book/editor/syntax/html.c | 16 ++++++++++++++-- src/tinycss/tokenizer.c | 11 ++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/tweak_book/editor/syntax/html.c b/src/calibre/gui2/tweak_book/editor/syntax/html.c index 319ca79ff2..bf45d92bde 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/html.c +++ b/src/calibre/gui2/tweak_book/editor/syntax/html.c @@ -386,6 +386,18 @@ html_init(PyObject *self, PyObject *args) { Py_RETURN_NONE; } +static inline long number_to_long(PyObject *number) { +#if PY_VERSION_HEX >= 0x03030000 + return PyLong_AsLong(number); +#else + if(PyInt_Check(number)) { + return PyInt_AS_LONG(number); + } else { + return PyLong_AsLong(number); + } +#endif +} + static PyObject* html_check_spelling(PyObject *self, PyObject *args) { PyObject *ans = NULL, *temp = NULL, *items = NULL, *text = NULL, *fmt = NULL, *locale = NULL, *sfmt = NULL, *_store_locale = NULL, *t = NULL, *utmp = NULL; @@ -410,9 +422,9 @@ html_check_spelling(PyObject *self, PyObject *args) { for (i = 0, j = 0; i < PyList_GET_SIZE(items); i++) { temp = PyList_GET_ITEM(items, i); - start = PyLong_AsLong(PyTuple_GET_ITEM(temp, 0)); + start = number_to_long(PyTuple_GET_ITEM(temp, 0)); if(start == -1 && PyErr_Occurred() != NULL) goto error; - length = PyLong_AsLong(PyTuple_GET_ITEM(temp, 1)); + length = number_to_long(PyTuple_GET_ITEM(temp, 1)); if(length == -1 && PyErr_Occurred() != NULL) goto error; temp = NULL; diff --git a/src/tinycss/tokenizer.c b/src/tinycss/tokenizer.c index d06e4a1200..ddb5201519 100644 --- a/src/tinycss/tokenizer.c +++ b/src/tinycss/tokenizer.c @@ -179,7 +179,9 @@ tokenize_init(PyObject *self, PyObject *args) { Py_INCREF(COMPILED_TOKEN_REGEXPS); Py_INCREF(UNICODE_UNESCAPE); Py_INCREF(NEWLINE_UNESCAPE); Py_INCREF(SIMPLE_UNESCAPE); Py_INCREF(FIND_NEWLINES); Py_INCREF(TOKEN_DISPATCH); Py_INCREF(COLON); Py_INCREF(SCOLON); Py_INCREF(LPAR); Py_INCREF(RPAR); Py_INCREF(LBRACE); Py_INCREF(RBRACE); Py_INCREF(LBOX); Py_INCREF(RBOX); Py_INCREF(DELIM_TOK); Py_INCREF(INTEGER); Py_INCREF(STRING_TOK); -#define SETCONST(x) x = PyLong_AsSsize_t(PyDict_GetItemString(cti, #x)) +#define SETCONST(x) do { (x) = PyNumber_AsSsize_t(PyDict_GetItemString(cti, #x), PyExc_OverflowError); \ + if((x) == -1 && PyErr_Occurred() != NULL) { return NULL; } \ + } while(0) SETCONST(BAD_COMMENT); SETCONST(BAD_STRING); SETCONST(PERCENTAGE); SETCONST(DIMENSION); SETCONST(ATKEYWORD); SETCONST(FUNCTION); SETCONST(COMMENT); SETCONST(NUMBER); SETCONST(STRING); SETCONST(IDENT); SETCONST(HASH); SETCONST(URI); Py_RETURN_NONE; @@ -278,7 +280,8 @@ tokenize_flat(PyObject *self, PyObject *args) { if (match != Py_None) { css_value = PyObject_CallMethod(match, "group", NULL); if (css_value == NULL) { goto error; } - type_ = PyLong_AsSsize_t(PyTuple_GET_ITEM(item, 0)); + type_ = PyNumber_AsSsize_t(PyTuple_GET_ITEM(item, 0), PyExc_OverflowError); + if(type_ == -1 && PyErr_Occurred() != NULL) { goto error; } type_name = PyTuple_GET_ITEM(item, 1); Py_INCREF(type_name); break; @@ -392,7 +395,9 @@ tokenize_flat(PyObject *self, PyObject *args) { line += PyList_Size(newlines); item = PyObject_CallMethod(PyList_GET_ITEM(newlines, PyList_Size(newlines) - 1), "end", NULL); if (item == NULL) { Py_DECREF(newlines); newlines = NULL; goto error; } - column = length - PyInt_AsSsize_t(item) + 1; + column = PyNumber_AsSsize_t(item, PyExc_OverflowError); + if(column == -1 && PyErr_Occurred()) { Py_DECREF(newlines); newlines = NULL; goto error; } + column = length - column + 1; Py_DECREF(item); item = NULL; } else column += length; Py_DECREF(newlines); newlines = NULL; From dca2d1a51cbcc223a0c8dd82d4b9e975f40e0abd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 10 Dec 2018 08:36:28 +0530 Subject: [PATCH 0065/2613] String changes --- setup/translations.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup/translations.py b/setup/translations.py index 9cce93c98f..fa3507b699 100644 --- a/setup/translations.py +++ b/setup/translations.py @@ -727,9 +727,9 @@ class ISO639(Command): # {{{ if not os.path.exists(base): os.makedirs(base) if not self.newer(dest, [src, __file__]): - self.info('Pickled code is up to date') + self.info('Packed code is up to date') return - self.info('Pickling ISO-639 codes to', dest) + self.info('Packing ISO-639 codes to', dest) from lxml import etree root = etree.fromstring(open(src, 'rb').read()) by_2 = {} @@ -792,9 +792,9 @@ class ISO3166(ISO639): # {{{ if not os.path.exists(base): os.makedirs(base) if not self.newer(dest, [src, __file__]): - self.info('Pickled code is up to date') + self.info('Packed code is up to date') return - self.info('Pickling ISO-3166 codes to', dest) + self.info('Packing ISO-3166 codes to', dest) from lxml import etree root = etree.fromstring(open(src, 'rb').read()) codes = set() From a04da5322fc7ec29b82decbf0736259b8bd39469 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 10 Dec 2018 11:29:57 +0530 Subject: [PATCH 0066/2613] Change recipe title and add language/author metadata --- Changelog.yaml | 2 +- recipes/mandidner.recipe | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Changelog.yaml b/Changelog.yaml index 1ffb69de01..53b51c4a50 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -60,7 +60,7 @@ - title: Le Peuple Breton author: Lionel Plais - - title: Mandidner + - title: Mandiner author: pofa diff --git a/recipes/mandidner.recipe b/recipes/mandidner.recipe index fae84ca525..43673f8eb7 100644 --- a/recipes/mandidner.recipe +++ b/recipes/mandidner.recipe @@ -5,11 +5,13 @@ from calibre.web.feeds.news import AutomaticNewsRecipe class BasicUserRecipe1541708734(AutomaticNewsRecipe): - title = 'Mandídner' + title = 'Mandiner' + language = 'hu' + __author__ = 'pofa' oldest_article = 1 max_articles_per_feed = 100 - auto_cleanup = True + auto_cleanup = True - feeds = [ - ('Mandídner', 'http://mandiner.hu/rss/'), + feeds = [ + ('Mandiner', 'http://mandiner.hu/rss/'), ] From 7463d23777d584a099b3f32d6cb489cca93066c3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 10 Dec 2018 11:52:05 +0530 Subject: [PATCH 0067/2613] ... --- src/tinycss/tokenizer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tinycss/tokenizer.c b/src/tinycss/tokenizer.c index 66beac3602..5df9447a1b 100644 --- a/src/tinycss/tokenizer.c +++ b/src/tinycss/tokenizer.c @@ -197,7 +197,8 @@ tokenize_init(PyObject *self, PyObject *args) { #define PyUnicode_GET_LENGTH PyUnicode_GET_SIZE #define ITER_CODE_PTS(unicode_object) { \ Py_UNICODE *_data = PyUnicode_AS_UNICODE(unicode_object); \ - for (Py_ssize_t iteridx = 0; iteridx < PyUnicode_GET_LENGTH(unicode_object); iteridx++) { \ + Py_ssize_t iteridx; \ + for (iteridx = 0; iteridx < PyUnicode_GET_LENGTH(unicode_object); iteridx++) { \ Py_UNICODE ch = _data[iteridx]; #endif From 5186718fdd33a192057e08fb6dbabbc0420e823c Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Sat, 8 Dec 2018 18:05:47 -0500 Subject: [PATCH 0068/2613] Update patiencediff to py3 --- .../gui2/tweak_book/diff/_patiencediff_c.c | 134 ++++++++++-------- 1 file changed, 76 insertions(+), 58 deletions(-) diff --git a/src/calibre/gui2/tweak_book/diff/_patiencediff_c.c b/src/calibre/gui2/tweak_book/diff/_patiencediff_c.c index 0554acb6ec..bba529fa94 100644 --- a/src/calibre/gui2/tweak_book/diff/_patiencediff_c.c +++ b/src/calibre/gui2/tweak_book/diff/_patiencediff_c.c @@ -151,7 +151,7 @@ static inline int compare_lines(struct line *a, struct line *b) { return ((a->hash != b->hash) - || PyObject_Compare(a->data, b->data)); + || PyObject_RichCompareBool(a->data, b->data, Py_NE)); } @@ -804,7 +804,7 @@ PatienceSequenceMatcher_dealloc(PatienceSequenceMatcher* self) free(self->hashtable.table); delete_lines(self->b, self->bsize); delete_lines(self->a, self->asize); - self->ob_type->tp_free((PyObject *)self); + Py_TYPE(self)->tp_free((PyObject *)self); } @@ -1209,73 +1209,91 @@ static char PatienceSequenceMatcher_doc[] = static PyTypeObject PatienceSequenceMatcherType = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "PatienceSequenceMatcher", /* tp_name */ - sizeof(PatienceSequenceMatcher), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)PatienceSequenceMatcher_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags*/ - PatienceSequenceMatcher_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - PatienceSequenceMatcher_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PatienceSequenceMatcher_new, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "PatienceSequenceMatcher", + /* tp_basicsize */ sizeof(PatienceSequenceMatcher), + /* tp_itemsize */ 0, + /* tp_dealloc */ (destructor)PatienceSequenceMatcher_dealloc, + /* tp_print */ 0, + /* tp_getattr */ 0, + /* tp_setattr */ 0, + /* tp_compare */ 0, + /* tp_repr */ 0, + /* tp_as_number */ 0, + /* tp_as_sequence */ 0, + /* tp_as_mapping */ 0, + /* tp_hash */ 0, + /* tp_call */ 0, + /* tp_str */ 0, + /* tp_getattro */ 0, + /* tp_setattro */ 0, + /* tp_as_buffer */ 0, + /* tp_flags */ Py_TPFLAGS_DEFAULT, + /* tp_doc */ PatienceSequenceMatcher_doc, + /* tp_traverse */ 0, + /* tp_clear */ 0, + /* tp_richcompare */ 0, + /* tp_weaklistoffset */ 0, + /* tp_iter */ 0, + /* tp_iternext */ 0, + /* tp_methods */ PatienceSequenceMatcher_methods, + /* tp_members */ 0, + /* tp_getset */ 0, + /* tp_base */ 0, + /* tp_dict */ 0, + /* tp_descr_get */ 0, + /* tp_descr_set */ 0, + /* tp_dictoffset */ 0, + /* tp_init */ 0, + /* tp_alloc */ 0, + /* tp_new */ PatienceSequenceMatcher_new, }; - -static PyMethodDef cpatiencediff_methods[] = { +static PyMethodDef _patiencediff_c_methods[] = { {"unique_lcs_c", py_unique_lcs, METH_VARARGS}, {"recurse_matches_c", py_recurse_matches, METH_VARARGS}, - {NULL, NULL} + {NULL, NULL, 0, NULL} }; +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +static struct PyModuleDef _patiencediff_c_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "_patiencediff_c", + /* m_doc */ "C implementation of PatienceSequenceMatcher.", + /* m_size */ -1, + /* m_methods */ _patiencediff_c_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; -CALIBRE_MODINIT_FUNC -init_patiencediff_c(void) -{ - PyObject* m; - +CALIBRE_MODINIT_FUNC PyInit__patiencediff_c(void) { if (PyType_Ready(&PatienceSequenceMatcherType) < 0) - return; + INITERROR; - m = Py_InitModule3("_patiencediff_c", cpatiencediff_methods, - "C implementation of PatienceSequenceMatcher"); - if (m == NULL) - return; + PyObject *mod = PyModule_Create(&_patiencediff_c_module); +#else +#define INITERROR return +CALIBRE_MODINIT_FUNC init_patiencediff_c(void) { + if (PyType_Ready(&PatienceSequenceMatcherType) < 0) + INITERROR; + + PyObject *mod = Py_InitModule3("_patiencediff_c", _patiencediff_c_methods, + "C implementation of PatienceSequenceMatcher"); +#endif + + if (mod == NULL) INITERROR; Py_INCREF(&PatienceSequenceMatcherType); - PyModule_AddObject(m, "PatienceSequenceMatcher_c", + PyModule_AddObject(mod, "PatienceSequenceMatcher_c", (PyObject *)&PatienceSequenceMatcherType); + + +#if PY_MAJOR_VERSION >= 3 + return mod; +#endif } - -/* vim: sw=4 et - */ +/* vim: sw=4 et */ \ No newline at end of file From 58909f4c740bd8cd73e48f0f0871955070279528 Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Sun, 9 Dec 2018 17:19:48 -0500 Subject: [PATCH 0069/2613] Build ICU in py3 --- src/calibre/utils/icu.c | 268 ++++++++++++++------------ src/calibre/utils/icu_calibre_utils.h | 4 +- 2 files changed, 149 insertions(+), 123 deletions(-) diff --git a/src/calibre/utils/icu.c b/src/calibre/utils/icu.c index 81141a6e18..d6d9919ece 100644 --- a/src/calibre/utils/icu.c +++ b/src/calibre/utils/icu.c @@ -37,7 +37,7 @@ icu_Collator_dealloc(icu_Collator* self) if (self->collator != NULL) ucol_close(self->collator); if (self->contractions != NULL) uset_close(self->contractions); self->collator = NULL; - self->ob_type->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } static PyObject * @@ -92,11 +92,15 @@ icu_Collator_get_strength(icu_Collator *self, void *closure) { static int icu_Collator_set_strength(icu_Collator *self, PyObject *val, void *closure) { - if (!PyInt_Check(val)) { + if ( +#if PY_MAJOR_VERSION < 3 + !PyInt_Check(val) && +#endif + !PyLong_Check(val)) { PyErr_SetString(PyExc_TypeError, "Strength must be an integer."); return -1; } - ucol_setStrength(self->collator, (int)PyInt_AS_LONG(val)); + ucol_setStrength(self->collator, (int)PyLong_AsLong(val)); return 0; } // }}} @@ -191,9 +195,6 @@ end: // Collator.find {{{ static PyObject * icu_Collator_find(icu_Collator *self, PyObject *args) { -#if PY_VERSION_HEX >= 0x03030000 -#error Not implemented for python >= 3.3 -#endif PyObject *a_ = NULL, *b_ = NULL; UChar *a = NULL, *b = NULL; int32_t asz = 0, bsz = 0, pos = -1, length = -1; @@ -454,45 +455,44 @@ static PyGetSetDef icu_Collator_getsetters[] = { }; static PyTypeObject icu_CollatorType = { // {{{ - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "icu.Collator", /*tp_name*/ - sizeof(icu_Collator), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)icu_Collator_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - "Collator", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - icu_Collator_methods, /* tp_methods */ - 0, /* tp_members */ - icu_Collator_getsetters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - icu_Collator_new, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "icu.Collator", + /* tp_basicsize */ sizeof(icu_Collator), + /* tp_itemsize */ 0, + /* tp_dealloc */ (destructor)icu_Collator_dealloc, + /* tp_print */ 0, + /* tp_getattr */ 0, + /* tp_setattr */ 0, + /* tp_compare */ 0, + /* tp_repr */ 0, + /* tp_as_number */ 0, + /* tp_as_sequence */ 0, + /* tp_as_mapping */ 0, + /* tp_hash */ 0, + /* tp_call */ 0, + /* tp_str */ 0, + /* tp_getattro */ 0, + /* tp_setattro */ 0, + /* tp_as_buffer */ 0, + /* tp_flags */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, + /* tp_doc */ "Collator", + /* tp_traverse */ 0, + /* tp_clear */ 0, + /* tp_richcompare */ 0, + /* tp_weaklistoffset */ 0, + /* tp_iter */ 0, + /* tp_iternext */ 0, + /* tp_methods */ icu_Collator_methods, + /* tp_members */ 0, + /* tp_getset */ icu_Collator_getsetters, + /* tp_base */ 0, + /* tp_dict */ 0, + /* tp_descr_get */ 0, + /* tp_descr_set */ 0, + /* tp_dictoffset */ 0, + /* tp_init */ 0, + /* tp_alloc */ 0, + /* tp_new */ icu_Collator_new, }; // }}} // }} @@ -542,7 +542,7 @@ icu_BreakIterator_dealloc(icu_BreakIterator* self) if (self->break_iterator != NULL) ubrk_close(self->break_iterator); if (self->text != NULL) free(self->text); self->break_iterator = NULL; self->text = NULL; - self->ob_type->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } @@ -595,9 +595,6 @@ icu_BreakIterator_set_text(icu_BreakIterator *self, PyObject *input) { // BreakIterator.index {{{ static PyObject * icu_BreakIterator_index(icu_BreakIterator *self, PyObject *token) { -#if PY_VERSION_HEX >= 0x03030000 -#error Not implemented for python >= 3.3 -#endif UChar *buf = NULL, *needle = NULL; int32_t word_start = 0, p = 0, sz = 0, ans = -1, leading_hyphen = 0, trailing_hyphen = 0; @@ -655,9 +652,6 @@ end: // BreakIterator.split2 {{{ static PyObject * icu_BreakIterator_split2(icu_BreakIterator *self, PyObject *args) { -#if PY_VERSION_HEX >= 0x03030000 -#error Not implemented for python >= 3.3 -#endif int32_t word_start = 0, p = 0, sz = 0, last_pos = 0, last_sz = 0; int is_hyphen_sep = 0, leading_hyphen = 0, trailing_hyphen = 0; @@ -695,7 +689,7 @@ icu_BreakIterator_split2(icu_BreakIterator *self, PyObject *args) { if (is_hyphen_sep && PyList_GET_SIZE(ans) > 0) { sz = last_sz + sz + trailing_hyphen; last_sz = sz; - t = PyInt_FromLong((long)sz); + t = PyLong_FromLong((long)sz); if (t == NULL) { Py_DECREF(ans); ans = NULL; break; } temp = PyList_GET_ITEM(ans, PyList_GET_SIZE(ans) - 1); Py_DECREF(PyTuple_GET_ITEM(temp, 1)); @@ -737,45 +731,44 @@ static PyMethodDef icu_BreakIterator_methods[] = { static PyTypeObject icu_BreakIteratorType = { // {{{ - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "icu.BreakIterator", /*tp_name*/ - sizeof(icu_BreakIterator), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)icu_BreakIterator_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - "Break Iterator", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - icu_BreakIterator_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - icu_BreakIterator_new, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "icu.BreakIterator", + /* tp_basicsize */ sizeof(icu_BreakIterator), + /* tp_itemsize */ 0, + /* tp_dealloc */ (destructor)icu_BreakIterator_dealloc, + /* tp_print */ 0, + /* tp_getattr */ 0, + /* tp_setattr */ 0, + /* tp_compare */ 0, + /* tp_repr */ 0, + /* tp_as_number */ 0, + /* tp_as_sequence */ 0, + /* tp_as_mapping */ 0, + /* tp_hash */ 0, + /* tp_call */ 0, + /* tp_str */ 0, + /* tp_getattro */ 0, + /* tp_setattro */ 0, + /* tp_as_buffer */ 0, + /* tp_flags */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, + /* tp_doc */ "Break Iterator", + /* tp_traverse */ 0, + /* tp_clear */ 0, + /* tp_richcompare */ 0, + /* tp_weaklistoffset */ 0, + /* tp_iter */ 0, + /* tp_iternext */ 0, + /* tp_methods */ icu_BreakIterator_methods, + /* tp_members */ 0, + /* tp_getset */ 0, + /* tp_base */ 0, + /* tp_dict */ 0, + /* tp_descr_get */ 0, + /* tp_descr_set */ 0, + /* tp_dictoffset */ 0, + /* tp_init */ 0, + /* tp_alloc */ 0, + /* tp_new */ icu_BreakIterator_new, }; // }}} // }}} @@ -856,11 +849,13 @@ end: // set_default_encoding {{{ static PyObject * icu_set_default_encoding(PyObject *self, PyObject *args) { +#if PY_MAJOR_VERSION < 3 char *encoding; if (!PyArg_ParseTuple(args, "s:setdefaultencoding", &encoding)) return NULL; if (PyUnicode_SetDefaultEncoding(encoding)) return NULL; +#endif Py_INCREF(Py_None); return Py_None; @@ -989,7 +984,7 @@ icu_ord_string(PyObject *self, PyObject *input) { ans = PyTuple_New(sz); if (ans == NULL) goto end; for (i = 0; i < sz; i++) { - temp = PyInt_FromLong((long)input_buf[i]); + temp = PyLong_FromLong((long)input_buf[i]); if (temp == NULL) { Py_DECREF(ans); ans = NULL; PyErr_NoMemory(); goto end; } PyTuple_SET_ITEM(ans, i, temp); } @@ -1115,18 +1110,15 @@ icu_string_length(PyObject *self, PyObject *src) { // utf16_length {{{ static PyObject * icu_utf16_length(PyObject *self, PyObject *src) { -#if PY_VERSION_HEX >= 0x03030000 -#error Not implemented for python >= 3.3 -#endif - - int32_t sz = 0; + Py_ssize_t sz = 0; +#if PY_VERSION_HEX < 0x03030000 #ifdef Py_UNICODE_WIDE int32_t i = 0, t = 0; Py_UNICODE *data = NULL; #endif if (!PyUnicode_Check(src)) { PyErr_SetString(PyExc_TypeError, "Must be a unicode object"); return NULL; } - sz = (int32_t)PyUnicode_GET_SIZE(src); + sz = PyUnicode_GET_SIZE(src); #ifdef Py_UNICODE_WIDE data = PyUnicode_AS_UNICODE(src); for (i = 0; i < sz; i++) { @@ -1134,7 +1126,25 @@ icu_utf16_length(PyObject *self, PyObject *src) { } sz = t; #endif - return Py_BuildValue("l", (long)sz); +#else + Py_ssize_t unit_length, i; + Py_UCS4 *data = NULL; + + if(PyUnicode_READY(src) != 0) { return NULL; } + + unit_length = sz = PyUnicode_GET_LENGTH(src); + // UCS8 or UCS16? length==utf16 length already. UCS32? count big code points. + if(PyUnicode_KIND(src) == PyUnicode_4BYTE_KIND) { + data = PyUnicode_4BYTE_DATA(src); + for(i = 0; i < unit_length; i++) { + if(data[i] > 0xffff) { + sz++; + } + } + } +#endif + + return Py_BuildValue("n", sz); } // }}} // Module initialization {{{ @@ -1148,7 +1158,7 @@ static PyMethodDef icu_methods[] = { }, {"set_default_encoding", icu_set_default_encoding, METH_VARARGS, - "set_default_encoding(encoding) -> Set the default encoding for the python unicode implementation." + "set_default_encoding(encoding) -> Set the default encoding for the python unicode implementation. In Py3, this operation is a no-op" }, {"set_filesystem_encoding", icu_set_filesystem_encoding, METH_VARARGS, @@ -1198,25 +1208,36 @@ static PyMethodDef icu_methods[] = { {NULL} /* Sentinel */ }; -#define ADDUCONST(x) PyModule_AddIntConstant(m, #x, x) +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&icu_module) +static struct PyModuleDef icu_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "icu", + /* m_doc */ "Wrapper for the ICU internationalization library", + /* m_size */ -1, + /* m_methods */ icu_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; + +CALIBRE_MODINIT_FUNC PyInit_icu(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("icu", icu_methods, "Wrapper for the ICU internationalization library") +CALIBRE_MODINIT_FUNC initicu(void) { +#endif -CALIBRE_MODINIT_FUNC -initicu(void) -{ - PyObject* m; UVersionInfo ver, uver; UErrorCode status = U_ZERO_ERROR; char version[U_MAX_VERSION_STRING_LENGTH+1] = {0}, uversion[U_MAX_VERSION_STRING_LENGTH+5] = {0}; - if (sizeof(Py_UNICODE) != 2 && sizeof(Py_UNICODE) != 4) { - PyErr_SetString(PyExc_RuntimeError, "This module only works on python versions <= 3.2"); - return; - } - u_init(&status); if (U_FAILURE(status)) { PyErr_SetString(PyExc_RuntimeError, u_errorName(status)); - return; + INITERROR; } u_getVersion(ver); u_versionToString(ver, version); @@ -1224,21 +1245,23 @@ initicu(void) u_versionToString(uver, uversion); if (PyType_Ready(&icu_CollatorType) < 0) - return; + INITERROR; if (PyType_Ready(&icu_BreakIteratorType) < 0) - return; + INITERROR; - m = Py_InitModule3("icu", icu_methods, - "Wrapper for the ICU internationalization library"); + PyObject *mod = INITMODULE; + + if (mod == NULL) INITERROR; Py_INCREF(&icu_CollatorType); Py_INCREF(&icu_BreakIteratorType); - PyModule_AddObject(m, "Collator", (PyObject *)&icu_CollatorType); - PyModule_AddObject(m, "BreakIterator", (PyObject *)&icu_BreakIteratorType); + PyModule_AddObject(mod, "Collator", (PyObject *)&icu_CollatorType); + PyModule_AddObject(mod, "BreakIterator", (PyObject *)&icu_BreakIteratorType); // uint8_t must be the same size as char - PyModule_AddIntConstant(m, "ok", (U_SUCCESS(status) && sizeof(uint8_t) == sizeof(char)) ? 1 : 0); - PyModule_AddStringConstant(m, "icu_version", version); - PyModule_AddStringConstant(m, "unicode_version", uversion); + PyModule_AddIntConstant(mod, "ok", (U_SUCCESS(status) && sizeof(uint8_t) == sizeof(char)) ? 1 : 0); + PyModule_AddStringConstant(mod, "icu_version", version); + PyModule_AddStringConstant(mod, "unicode_version", uversion); +#define ADDUCONST(x) PyModule_AddIntConstant(mod, #x, x) ADDUCONST(USET_SPAN_NOT_CONTAINED); ADDUCONST(USET_SPAN_CONTAINED); ADDUCONST(USET_SPAN_SIMPLE); @@ -1270,5 +1293,8 @@ initicu(void) ADDUCONST(UBRK_LINE); ADDUCONST(UBRK_SENTENCE); +#if PY_MAJOR_VERSION >= 3 + return mod; +#endif } // }}} diff --git a/src/calibre/utils/icu_calibre_utils.h b/src/calibre/utils/icu_calibre_utils.h index 8783e7fd9f..270c914c7c 100644 --- a/src/calibre/utils/icu_calibre_utils.h +++ b/src/calibre/utils/icu_calibre_utils.h @@ -198,14 +198,14 @@ static UChar32* python_to_icu32(PyObject *obj, int32_t *osz) { if (!PyUnicode_CheckExact(obj)) { PyErr_SetString(PyExc_TypeError, "Not a unicode string"); - goto end; + return NULL; } if(PyUnicode_READY(obj) == -1) { return NULL; } sz = PyUnicode_GET_LENGTH(obj); ans = (UChar32*) malloc((sz+1) * sizeof(UChar32)); - if (ans == NULL) { PyErr_NoMemory(); goto end; } + if (ans == NULL) { PyErr_NoMemory(); return NULL; } int kind; if ((kind = PyUnicode_KIND(obj)) == PyUnicode_4BYTE_KIND) { memcpy(ans, PyUnicode_4BYTE_DATA(obj), sz * 4); From 78efc02b0103e16710f9a0e597088e8d294eff38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rogelio=20Dom=C3=ADnguez=20Hern=C3=A1ndez?= Date: Mon, 10 Dec 2018 16:14:10 -0600 Subject: [PATCH 0070/2613] Update "Al Jazeera in English" "Al Jazeera in English" is broken currently, it only retrieves titles but no content. So I updated the recipe so content is preserved. --- recipes/al_jazeera.recipe | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/recipes/al_jazeera.recipe b/recipes/al_jazeera.recipe index a04a215d10..a3fd45b7b1 100644 --- a/recipes/al_jazeera.recipe +++ b/recipes/al_jazeera.recipe @@ -25,20 +25,16 @@ class AlJazeera(BasicNewsRecipe): use_embedded_content = False extra_css = """ body{font-family: Arial,sans-serif} - #ctl00_cphBody_dvSummary{font-weight: bold} - #dvArticleDate{font-size: small; color: #999999} """ conversion_options = { 'comment': description, 'tags': category, 'publisher': publisher, 'language': language } keep_only_tags = [ - dict(id='main-story'), + dict(id='article-page'), ] remove_tags = [ - has_cls('MoreOnTheStory'), has_cls( - 'ArticleBottomToolbar'), dict(smtitle="ShowMore"), dict(name=['object', 'link', 'table', 'meta', 'base', 'iframe', 'embed']), ] @@ -48,21 +44,13 @@ class AlJazeera(BasicNewsRecipe): def get_article_url(self, article): artlurl = article.get('link', None) - return artlurl.replace('http://english.aljazeera.net//', 'http://english.aljazeera.net/') + return artlurl def preprocess_html(self, soup): for item in soup.findAll(style=True): del item['style'] for item in soup.findAll(face=True): del item['face'] - td = soup.find('td', attrs={'class': 'DetailedSummary'}) - if td: - td.name = 'div' - spn = soup.find('span', attrs={'id': 'DetailedTitle'}) - if spn: - spn.name = 'h1' - for itm in soup.findAll('span', attrs={'id': ['dvArticleDate', 'ctl00_cphBody_lblDate']}): - itm.name = 'div' for alink in soup.findAll('a'): if alink.string is not None: tstr = alink.string From b9eeeaace3e1855174a516bb3226deadcabd179c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 11 Dec 2018 18:25:08 +0530 Subject: [PATCH 0071/2613] WSJ changed its todays paper markup again Fixes #1807945 [Wall Street Journal fetch does not work](https://bugs.launchpad.net/calibre/+bug/1807945) --- recipes/wsj.recipe | 13 ++++--------- recipes/wsj_free.recipe | 13 ++++--------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/recipes/wsj.recipe b/recipes/wsj.recipe index 13ec7e607c..8cf03260b7 100644 --- a/recipes/wsj.recipe +++ b/recipes/wsj.recipe @@ -147,18 +147,13 @@ class WSJ(BasicNewsRecipe): root = self.index_to_soup(url, as_tree=True) CSSSelect = Select(root) articles = [] - for container in CSSSelect('.style__grid_3gzjbqouVfPMK84Adb3MFE .article'): - meta = next(CSSSelect('.type', container)) - parent = meta.getparent() - meta = self.tag_to_string(meta) - title = next(CSSSelect('.title', parent)) - a = next(CSSSelect('a', title)) + for container in root.xpath('descendant::div[contains(@class, "WSJTheme__list-item_")]'): + heading = next(CSSSelect('h2, h3', container)) + a = next(CSSSelect('a', heading)) title = self.tag_to_string(a) - if meta: - title += ' [%s]' % meta url = self.abs_wsj_url(a.get('href')) desc = '' - for p in CSSSelect('p.description', container): + for p in container.xpath('descendant::p[contains(@class, "WSJTheme__description_")]'): q = self.tag_to_string(p) if 'Subscriber Content' in q: continue diff --git a/recipes/wsj_free.recipe b/recipes/wsj_free.recipe index d521ebd7a7..831c483c41 100644 --- a/recipes/wsj_free.recipe +++ b/recipes/wsj_free.recipe @@ -147,18 +147,13 @@ class WSJ(BasicNewsRecipe): root = self.index_to_soup(url, as_tree=True) CSSSelect = Select(root) articles = [] - for container in CSSSelect('.style__grid_3gzjbqouVfPMK84Adb3MFE .article'): - meta = next(CSSSelect('.type', container)) - parent = meta.getparent() - meta = self.tag_to_string(meta) - title = next(CSSSelect('.title', parent)) - a = next(CSSSelect('a', title)) + for container in root.xpath('descendant::div[contains(@class, "WSJTheme__list-item_")]'): + heading = next(CSSSelect('h2, h3', container)) + a = next(CSSSelect('a', heading)) title = self.tag_to_string(a) - if meta: - title += ' [%s]' % meta url = self.abs_wsj_url(a.get('href')) desc = '' - for p in CSSSelect('p.description', container): + for p in container.xpath('descendant::p[contains(@class, "WSJTheme__description_")]'): q = self.tag_to_string(p) if 'Subscriber Content' in q: continue From d97dea713add58aa0d40887a293e8905ae5feec7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 11 Dec 2018 18:47:28 +0530 Subject: [PATCH 0072/2613] Disable logins on espn since it has moved to a JS based login system that I cannot be bothered reversing --- recipes/espn.recipe | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/espn.recipe b/recipes/espn.recipe index 0ee53369ed..8c4ce332fa 100644 --- a/recipes/espn.recipe +++ b/recipes/espn.recipe @@ -76,7 +76,9 @@ class ESPN(BasicNewsRecipe): def get_browser(self): br = BasicNewsRecipe.get_browser(self) - if self.username and self.password: + if False and self.username and self.password: + # ESPN has changed to a JS based login system, cant be bothered + # revering it br.set_handle_refresh(False) url = ('https://r.espn.go.com/members/v3_1/login') raw = br.open(url).read() From 4a025a3063fbb0f8181bc6051054a74c36310ba3 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 13 Dec 2018 22:39:08 +1100 Subject: [PATCH 0073/2613] Fix #1807914: Title showing as "Unknown" in device list for Kobo devices Fix for https://bugs.launchpad.net/calibre/+bug/1807914 With the last set of changes, if the metadata management was not set to automatic, books sent to the device would have the title showing as "Unknown" in the device list. Also bumping supported firmware version to 4.12.12111 which has just been released. --- src/calibre/devices/kobo/driver.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 6ca3d44e7b..908f98104e 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -76,13 +76,13 @@ class KOBO(USBMS): name = 'Kobo Reader Device Interface' gui_name = 'Kobo Reader' - description = _('Communicate with the Kobo Reader') + description = _('Communicate with the original Kobo Reader and the Kobo WiFi.') author = 'Timothy Legge and David Forrester' - version = (2, 5, 0) + version = (2, 5, 1) dbversion = 0 fwversion = (0,0,0) - supported_dbversion = 147 + supported_dbversion = 149 has_kepubs = False supported_platforms = ['windows', 'osx', 'linux'] @@ -309,7 +309,7 @@ class KOBO(USBMS): bl[idx].device_collections = playlist_map.get(lpath,[]) else: if ContentType == '6' and MimeType == 'Shortcover': - book = Book(prefix, lpath, title, authors, mime, date, ContentType, ImageID, size=1048576) + book = self.book_class(prefix, lpath, title, authors, mime, date, ContentType, ImageID, size=1048576) else: try: if os.path.exists(self.normalize_path(os.path.join(prefix, lpath))): @@ -317,7 +317,7 @@ class KOBO(USBMS): else: debug_print(" Strange: The file: ", prefix, lpath, " does mot exist!") title = "FILE MISSING: " + title - book = Book(prefix, lpath, title, authors, mime, date, ContentType, ImageID, size=1048576) + book = self.book_class(prefix, lpath, title, authors, mime, date, ContentType, ImageID, size=1048576) except: debug_print("prefix: ", prefix, "lpath: ", lpath, "title: ", title, "authors: ", authors, @@ -568,10 +568,12 @@ class KOBO(USBMS): self.report_progress(1.0, _('Removing books from device metadata listing...')) def add_books_to_metadata(self, locations, metadata, booklists): + debug_print("KoboTouch::add_books_to_metadata - start. metadata=%s" % metadata[0]) metadata = iter(metadata) for i, location in enumerate(locations): self.report_progress((i+1) / float(len(locations)), _('Adding books to device metadata listing...')) info = metadata.next() + debug_print("KoboTouch::add_books_to_metadata - info=%s" % info) blist = 2 if location[1] == 'cardb' else 1 if location[1] == 'carda' else 0 # Extract the correct prefix from the pathname. To do this correctly, @@ -598,7 +600,7 @@ class KOBO(USBMS): if lpath.startswith('/') or lpath.startswith('\\'): lpath = lpath[1:] # print "path: " + lpath - book = self.book_class(prefix, lpath, other=info) + book = self.book_class(prefix, lpath, info.title, other=info) if book.size is None or book.size == 0: book.size = os.stat(self.normalize_path(path)).st_size b = booklists[blist].add_book(book, replace_metadata=True) @@ -1340,11 +1342,11 @@ class KOBOTOUCH(KOBO): name = 'KoboTouch' gui_name = 'Kobo Touch/Glo/Mini/Aura HD/Aura H2O/Glo HD/Touch 2' author = 'David Forrester' - description = _('Communicate with the Kobo Touch, Glo, Mini, Aura HD, Aura H2O, Glo HD, Touch 2, Aura ONE and Aura Edition 2 ereaders.' + description = _('Communicate with the Kobo Touch, Glo, Mini, Aura HD, Aura H2O, Glo HD, Touch 2, Aura ONE, Aura Edition 2, Aura H2O Edition 2, Clara HD and Forma ereaders.' ' Based on the existing Kobo driver by %s.') % KOBO.author # icon = I('devices/kobotouch.jpg') - supported_dbversion = 147 + supported_dbversion = 149 min_supported_dbversion = 53 min_dbversion_series = 65 min_dbversion_externalid = 65 @@ -1356,7 +1358,7 @@ class KOBOTOUCH(KOBO): # Starting with firmware version 3.19.x, the last number appears to be is a # build number. A number will be recorded here but it can be safely ignored # when testing the firmware version. - max_supported_fwversion = (4, 11, 11879) + max_supported_fwversion = (4, 12, 12111) # The following document firwmare versions where new function or devices were added. # Not all are used, but this feels a good place to record it. min_fwversion_shelves = (2, 0, 0) @@ -2426,7 +2428,7 @@ class KOBOTOUCH(KOBO): category_added = False if book.contentID is None: - debug_print(' Do not know ContentID - Title="%s"'%book.title) + debug_print(' Do not know ContentID - Title="%s, Authors=%s"'%(book.title, book.author)) extension = os.path.splitext(book.path)[1] ContentType = self.get_content_type_from_extension(extension) if extension != '' else self.get_content_type_from_path(book.path) book.contentID = self.contentid_from_path(book.path, ContentType) From f18fdce33bd68d0772229d19cb08a7785002e549 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Dec 2018 18:12:54 +0530 Subject: [PATCH 0074/2613] PDF Output: Do not fail if one of th efonts from the source document has no name metadata --- src/calibre/ebooks/pdf/render/fonts.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/pdf/render/fonts.py b/src/calibre/ebooks/pdf/render/fonts.py index c5011a8822..48b48fe919 100644 --- a/src/calibre/ebooks/pdf/render/fonts.py +++ b/src/calibre/ebooks/pdf/render/fonts.py @@ -181,8 +181,12 @@ class Font(object): self.metrics.sfnt(self.font_stream) def write_to_unicode(self, objects): - cmap = CMap(self.metrics.postscript_name, self.metrics.glyph_map, - compress=self.compress) + try: + name = self.metrics.postscript_name + except KeyError: + from calibre.utils.short_uuid import uuid4 + name = uuid4() + cmap = CMap(name, self.metrics.glyph_map, compress=self.compress) self.font_dict['ToUnicode'] = objects.add(cmap) def write_widths(self, objects): From de93a5d53b3a212130e522cfae62662395c231bc Mon Sep 17 00:00:00 2001 From: David Date: Thu, 13 Dec 2018 23:51:01 +1100 Subject: [PATCH 0075/2613] Change release note for KoboTouch driver in 3.35. --- Changelog.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.yaml b/Changelog.yaml index 1ffb69de01..bd579381aa 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -30,7 +30,7 @@ - title: "Metadata download: Add an option (in Preferences->Metadata download) to keep multiple results from individual metadata sources, useful if you prefer to pick the best result by hand and use only one or two metadata sources." tickets: [1802293] - - title: "Kobo driver: Add an option to directly update metadata in the Kobo device database, instead of waiting for the Kobo to update the database after disconnecting. (Preferences->Plugins->Customize the Kobo device plugin)" + - title: "KoboTouch driver: Extend the metadata updated in the Kobo device database to all metadata displayed on the device. The update is only done for books already on the device. Needs to be enabled via Preferences->Plugins->Customize the KoboTouch device plugin." bug fixes: - title: "E-book viewer: Fix a regression that broke viewing of HTMLZ files" From f6ef5f3cf7da33e8322c925367af4f754e9c9a9f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Dec 2018 18:48:23 +0530 Subject: [PATCH 0076/2613] Fix crash when compressing mathjax on CI servers --- setup/mathjax.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/mathjax.py b/setup/mathjax.py index 23f28dcbd2..04997d8aab 100644 --- a/setup/mathjax.py +++ b/setup/mathjax.py @@ -71,7 +71,7 @@ class MathJax(Command): zf.comment = self.h.hexdigest() t.seek(0) with open(self.j(self.RESOURCES, 'content-server', 'mathjax.zip.xz'), 'wb') as f: - compress(t, f, level=1 if is_ci else 9) + compress(t, f, level=4 if is_ci else 9) with open(self.j(self.RESOURCES, 'content-server', 'mathjax.version'), 'wb') as f: f.write(zf.comment) finally: From bf60631ce05d021afb09c47dabb557733100a56e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 17 Dec 2018 15:38:14 +0530 Subject: [PATCH 0077/2613] Avoid the need to use a patched version of MathJax See https://github.com/mathjax/MathJax/pull/1453 --- setup/mathjax.py | 5 +++-- src/pyj/read_book/mathjax.pyj | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/setup/mathjax.py b/setup/mathjax.py index 04997d8aab..72d7b53dff 100644 --- a/setup/mathjax.py +++ b/setup/mathjax.py @@ -21,7 +21,8 @@ from setup import Command, download_securely class MathJax(Command): description = 'Create the MathJax bundle' - MATH_JAX_URL = 'https://github.com/kovidgoyal/MathJax/archive/master.zip' + MATH_JAX_VERSION = '2.7.5' + MATH_JAX_URL = 'https://github.com/mathjax/MathJax/archive/%s.zip' % MATH_JAX_VERSION FONT_FAMILY = 'TeX' def add_options(self, parser): @@ -33,7 +34,7 @@ class MathJax(Command): raw = download_securely(url) with ZipFile(BytesIO(raw)) as zf: zf.extractall(tdir) - return os.path.join(tdir, 'MathJax-master') + return os.path.join(tdir, 'MathJax-' + self.MATH_JAX_VERSION) def add_file(self, zf, path, name): with open(path, 'rb') as f: diff --git a/src/pyj/read_book/mathjax.pyj b/src/pyj/read_book/mathjax.pyj index 9923e4d3f6..33fcd79626 100644 --- a/src/pyj/read_book/mathjax.pyj +++ b/src/pyj/read_book/mathjax.pyj @@ -13,6 +13,18 @@ def get_url(mathjax_files, name): return ans def monkeypatch(mathjax_files): + StyleString = window.MathJax.Ajax.StyleString.bind(window.MathJax.Ajax) + + def style_string(styles): + # replace the URLs in the generated stylesheet + return StyleString(styles).replace(/url\('?(.*?)'?\)/g, def (match, url): + if not url.endsWith('.woff'): + return match + url = get_url(mathjax_files, url) + ans = f"url('{url}')" + return ans + ) + orig = window.MathJax.Ajax.fileURL.bind(window.MathJax.Ajax) def file_url(file): ans = orig(file) @@ -28,6 +40,7 @@ def monkeypatch(mathjax_files): print('WARNING: Failed to resolve MathJax file:', name) return ans window.MathJax.Ajax.fileURL = file_url + window.MathJax.Ajax.StyleString = style_string window.MathJax.Ajax.fileRev = def(file): return '' From 3fb2563d089c3380fabcc8c7563fa5fa9bbf00b5 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 17 Dec 2018 10:30:49 -0500 Subject: [PATCH 0078/2613] tokenizer: fix compile errors in merge of python3 port --- src/tinycss/tokenizer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tinycss/tokenizer.c b/src/tinycss/tokenizer.c index 5df9447a1b..be6e614ceb 100644 --- a/src/tinycss/tokenizer.c +++ b/src/tinycss/tokenizer.c @@ -192,7 +192,7 @@ tokenize_init(PyObject *self, PyObject *args) { int _kind = PyUnicode_KIND(unicode_object); \ void *_data = PyUnicode_DATA(unicode_object); \ for (Py_ssize_t iteridx = 0; iteridx < PyUnicode_GET_LENGTH(unicode_object); iteridx++) { \ - Py_UCS4 ch = PyUnicode_READ(kind, data, i); + Py_UCS4 ch = PyUnicode_READ(_kind, _data, iteridx); #else #define PyUnicode_GET_LENGTH PyUnicode_GET_SIZE #define ITER_CODE_PTS(unicode_object) { \ @@ -260,7 +260,7 @@ clone_unicode(const PyObject* src, Py_ssize_t start_offset, Py_ssize_t end_offse data = PyUnicode_4BYTE_DATA(src) + start_offset; break; } - return PyUnicode_FromKindAndData(kind, data, PyUnicode_GET_LENGTH(src) - start_offset - end_offset) + return PyUnicode_FromKindAndData(kind, data, PyUnicode_GET_LENGTH(src) - start_offset - end_offset); #else return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(src) + start_offset, PyUnicode_GET_LENGTH(src) - start_offset - end_offset); #endif @@ -308,7 +308,7 @@ tokenize_flat(PyObject *self, PyObject *args) { while (pos < source_len) { #if PY_VERSION_HEX >= 0x03030000 - c = PyUnicode_READ(css_kind, css_data, pos); + c = PyUnicode_READ(css_kind, css_source, pos); #else c = css_source[pos]; #endif From 3cfbf1c7206ea65ec370d1651191ee723907581a Mon Sep 17 00:00:00 2001 From: keatsandyeats Date: Tue, 18 Dec 2018 20:11:59 -0500 Subject: [PATCH 0079/2613] Improve formatting for an infobox when editing keyboard shortcuts in viewer The box appears when the user has edited a shortcut and clicks 'OK' before the shortcut is actually created. --- src/calibre/gui2/viewer/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/viewer/config.py b/src/calibre/gui2/viewer/config.py index bd015c18c6..78fe6aceae 100644 --- a/src/calibre/gui2/viewer/config.py +++ b/src/calibre/gui2/viewer/config.py @@ -397,8 +397,8 @@ class ConfigDialog(QDialog, Ui_Dialog): if self.shortcut_config.is_editing: from calibre.gui2 import info_dialog info_dialog(self, _('Still editing'), - _('You are in the middle of editing a keyboard shortcut' - ' first complete that, by clicking outside the ' + _('You are in the middle of editing a keyboard shortcut.' + ' First complete that by clicking outside the' ' shortcut editing box.'), show=True) return self.save_options(config()) From 5961223f773ac994baaf46824df4c826fb08af4a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 20 Dec 2018 21:03:51 +0530 Subject: [PATCH 0080/2613] Add a link to the moving calibre data instructions tothe welcome wizard. Fixes #1809203 [[Enhancement] - New installs](https://bugs.launchpad.net/calibre/+bug/1809203) --- src/calibre/gui2/wizard/__init__.py | 5 ++ src/calibre/gui2/wizard/library.ui | 74 ++++++++++++++++++----------- 2 files changed, 50 insertions(+), 29 deletions(-) diff --git a/src/calibre/gui2/wizard/__init__.py b/src/calibre/gui2/wizard/__init__.py index 6b854bbda2..0fb0d7efb4 100644 --- a/src/calibre/gui2/wizard/__init__.py +++ b/src/calibre/gui2/wizard/__init__.py @@ -652,6 +652,11 @@ class LibraryPage(QWizardPage, LibraryUI): self.init_languages() self.language.currentIndexChanged[int].connect(self.change_language) self.location.textChanged.connect(self.location_text_changed) + self.move_lib_label.setText(_( + 'If you are moving calibre from an old computer to a new one,' + ' please read the instructions.').format( + localize_user_manual_link( + 'https://manual.calibre-ebook.com/faq.html#how-do-i-move-my-calibre-data-from-one-computer-to-another'))) def location_text_changed(self, newtext): self.completeChanged.emit() diff --git a/src/calibre/gui2/wizard/library.ui b/src/calibre/gui2/wizard/library.ui index a3e337868f..9b8129791f 100644 --- a/src/calibre/gui2/wizard/library.ui +++ b/src/calibre/gui2/wizard/library.ui @@ -14,7 +14,7 @@ WizardPage - Welcome to calibre + Welcome &to calibre The one stop solution to all your e-book needs. @@ -30,25 +30,18 @@ - - - - - - - <p>Choose a location for your books. When you add books to calibre, they will be copied here. Use an <b>empty folder</b> for a new calibre library: + + + + Qt::Vertical - - true + + + 20 + 40 + - - - - - - true - - + @@ -67,18 +60,12 @@ - - - - Qt::Vertical + + + + true - - - 20 - 40 - - - + @@ -93,6 +80,35 @@ + + + + + + + <p>Choose a location for your books. When you add books to calibre, they will be copied here. Use an <b>empty folder</b> for a new calibre library: + + + true + + + + + + + + + + Qt::RichText + + + true + + + true + + + From 99d967e4f6b41bd15df8e521b0e0f45701dff9ac Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 21 Dec 2018 08:29:34 +0530 Subject: [PATCH 0081/2613] version 3.36.0 --- Changelog.yaml | 21 +++++++++++++++++++++ src/calibre/constants.py | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Changelog.yaml b/Changelog.yaml index 3fb690d094..2283b2fa8d 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -20,6 +20,27 @@ # new recipes: # - title: +- version: 3.36.0 + date: 2018-12-21 + + new features: + - title: "Happy Holidays to everyone!" + + - title: "Kobo driver: Add supported for newly released firmware update" + + bug fixes: + - title: "Kobo driver: Fix a regression in the last release that caused book title +to appear as unknown if metadata management was set to manual in calibre." + tickets: [1807914] + + - title: "PDF Output: Do not fail if one of th efonts from the source document has no name metadata" + + improved recipes: + - Wall Street Journal + - ESPN + - Al Jazeera (English) + + - version: 3.35.0 date: 2018-12-07 diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 482e92c62a..dcce22f556 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -6,7 +6,7 @@ from polyglot.builtins import map import sys, locale, codecs, os, importlib, collections __appname__ = u'calibre' -numeric_version = (3, 35, 0) +numeric_version = (3, 36, 0) __version__ = u'.'.join(map(unicode, numeric_version)) __author__ = u"Kovid Goyal " From d8d08a449f86021c7ab1ef3193545f6a56506aff Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 21 Dec 2018 08:36:01 +0530 Subject: [PATCH 0082/2613] ... --- Changelog.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.yaml b/Changelog.yaml index 2283b2fa8d..d303bfe2c5 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -33,7 +33,7 @@ to appear as unknown if metadata management was set to manual in calibre." tickets: [1807914] - - title: "PDF Output: Do not fail if one of th efonts from the source document has no name metadata" + - title: "PDF Output: Do not fail if one of the fonts from the source document has no name metadata" improved recipes: - Wall Street Journal From 5b3b05a94304054327c0e8a2e6eb575df4b42392 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 24 Dec 2018 10:32:11 +0530 Subject: [PATCH 0083/2613] macOS: PDF Output: Fix bold fonts not working on Mojave. Fixes #1799750 [ebook-convert does not display bold font when converting from html to pdf on OSX Mojave](https://bugs.launchpad.net/calibre/+bug/1799750) --- src/calibre/headless/coretext_fontdatabase.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/headless/coretext_fontdatabase.mm b/src/calibre/headless/coretext_fontdatabase.mm index a79a362307..d59d547887 100644 --- a/src/calibre/headless/coretext_fontdatabase.mm +++ b/src/calibre/headless/coretext_fontdatabase.mm @@ -240,9 +240,9 @@ static void getFontDescription(CTFontDescriptorRef font, FontDescription *fd) if (styles) { if (CFNumberRef weightValue = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontWeightTrait)) { - float normalizedWeight; - if (CFNumberGetValue(weightValue, kCFNumberFloatType, &normalizedWeight)) - fd->weight = QCoreTextFontEngine::qtWeightFromCFWeight(normalizedWeight); + double normalizedWeight; + if (CFNumberGetValue(weightValue, kCFNumberFloat64Type, &normalizedWeight)) + fd->weight = QCoreTextFontEngine::qtWeightFromCFWeight(float(normalizedWeight)); } if (CFNumberRef italic = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontSlantTrait)) { double d; From d10d7371cec23c4f7f157d31a3712e045e34fc3d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 24 Dec 2018 11:05:51 +0530 Subject: [PATCH 0084/2613] Use modernized names for cocoa fonts Old names have been deprecated --- src/calibre/headless/coretext_fontdatabase.mm | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/calibre/headless/coretext_fontdatabase.mm b/src/calibre/headless/coretext_fontdatabase.mm index d59d547887..50fb04c365 100644 --- a/src/calibre/headless/coretext_fontdatabase.mm +++ b/src/calibre/headless/coretext_fontdatabase.mm @@ -716,71 +716,71 @@ static CTFontUIFontType fontTypeFromTheme(QPlatformTheme::Font f) { switch (f) { case QPlatformTheme::SystemFont: - return kCTFontSystemFontType; + return kCTFontUIFontSystem; case QPlatformTheme::MenuFont: case QPlatformTheme::MenuBarFont: case QPlatformTheme::MenuItemFont: - return kCTFontMenuItemFontType; + return kCTFontUIFontMenuItem; case QPlatformTheme::MessageBoxFont: - return kCTFontEmphasizedSystemFontType; + return kCTFontUIFontEmphasizedSystem; case QPlatformTheme::LabelFont: - return kCTFontSystemFontType; + return kCTFontUIFontSystem; case QPlatformTheme::TipLabelFont: return kCTFontToolTipFontType; case QPlatformTheme::StatusBarFont: - return kCTFontSystemFontType; + return kCTFontUIFontSystem; case QPlatformTheme::TitleBarFont: - return kCTFontWindowTitleFontType; + return kCTFontUIFontWindowTitle; case QPlatformTheme::MdiSubWindowTitleFont: case QPlatformTheme::DockWidgetTitleFont: - return kCTFontSystemFontType; + return kCTFontUIFontSystem; case QPlatformTheme::PushButtonFont: - return kCTFontPushButtonFontType; + return kCTFontUIFontPushButton; case QPlatformTheme::CheckBoxFont: case QPlatformTheme::RadioButtonFont: - return kCTFontSystemFontType; + return kCTFontUIFontSystem; case QPlatformTheme::ToolButtonFont: - return kCTFontSmallToolbarFontType; + return kCTFontUIFontSmallToolbar; case QPlatformTheme::ItemViewFont: - return kCTFontSystemFontType; + return kCTFontUIFontSystem; case QPlatformTheme::ListViewFont: - return kCTFontViewsFontType; + return kCTFontUIFontViews; case QPlatformTheme::HeaderViewFont: - return kCTFontSmallSystemFontType; + return kCTFontUIFontSmallSystem; case QPlatformTheme::ListBoxFont: - return kCTFontViewsFontType; + return kCTFontUIFontViews; case QPlatformTheme::ComboMenuItemFont: - return kCTFontSystemFontType; + return kCTFontUIFontSystem; case QPlatformTheme::ComboLineEditFont: - return kCTFontViewsFontType; + return kCTFontUIFontViews; case QPlatformTheme::SmallFont: - return kCTFontSmallSystemFontType; + return kCTFontUIFontSmallSystem; case QPlatformTheme::MiniFont: - return kCTFontMiniSystemFontType; + return kCTFontUIFontMiniSystem; case QPlatformTheme::FixedFont: - return kCTFontUserFixedPitchFontType; + return kCTFontUIFontUserFixedPitch; default: - return kCTFontSystemFontType; + return kCTFontUIFontSystem; } } @@ -858,7 +858,7 @@ QFont *QCoreTextFontDatabase::themeFont(QPlatformTheme::Font f) const QFont QCoreTextFontDatabase::defaultFont() const { if (defaultFontName.isEmpty()) { - QCFType font = CTFontCreateUIFontForLanguage(kCTFontSystemFontType, 12.0, NULL); + QCFType font = CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, 12.0, NULL); defaultFontName = (QString) QCFString(CTFontCopyFullName(font)); } From 0afaf3a80092b2cf7b953280603653941abdabcf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 24 Dec 2018 14:00:41 +0530 Subject: [PATCH 0085/2613] Windows: When registering calibre programs as possible handlers for various file types, dont se the AllowSilentDefaultTakeOver registry key See https://www.mobileread.com/forums/showthread.php?t=313668 --- src/calibre/utils/winreg/default_programs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/utils/winreg/default_programs.py b/src/calibre/utils/winreg/default_programs.py index 50441fd3ee..8d92f721f4 100644 --- a/src/calibre/utils/winreg/default_programs.py +++ b/src/calibre/utils/winreg/default_programs.py @@ -85,7 +85,10 @@ def create_prog_id(ext, prog_id, ext_map, exe): key.set('PerceivedType', 'Document') key.set(sub_key='DefaultIcon', value=exe+',0') key.set_default_value(r'shell\open\command', '"%s" "%%1"' % exe) - key.set('AllowSilentDefaultTakeOver') + # contrary to the msdn docs, this key prevents calibre programs + # from appearing in the initial open with list, see + # https://www.mobileread.com/forums/showthread.php?t=313668 + # key.set('AllowSilentDefaultTakeOver') with Key(r'Software\Classes\.%s\OpenWithProgIDs' % ext) as key: key.set(prog_id) From fdcd6d746ca5732f783023c82a6e18841ee57c40 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 24 Dec 2018 22:53:14 +0530 Subject: [PATCH 0086/2613] macOS: Fix for random srashes when using the edit book tool on Mojave. Fixes #1805521 [e-book edit (3.34.0) repeatedly crashes when editing an epub file](https://bugs.launchpad.net/calibre/+bug/1805521) --- src/calibre/gui2/tweak_book/editor/syntax/html.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/calibre/gui2/tweak_book/editor/syntax/html.py b/src/calibre/gui2/tweak_book/editor/syntax/html.py index e0296dd5e3..96ce24940e 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/html.py +++ b/src/calibre/gui2/tweak_book/editor/syntax/html.py @@ -73,6 +73,7 @@ if _speedup is not None: def spell_property(sfmt, locale): s = QTextCharFormat(sfmt) s.setProperty(SPELL_LOCALE_PROPERTY, locale) + s.mem = locale # ensure locale is not garbage collected return s _speedup.init(spell_property, dictionaries.recognized, split_into_words_and_positions) del spell_property From e20566c7fc8ef770c33b8d7d7b0177af5d08a084 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 17 Dec 2018 12:38:20 -0500 Subject: [PATCH 0087/2613] Port lzx plugin to build on python2/python3 --- src/calibre/utils/lzx/compressor.c | 103 ++++++++++++++--------------- src/calibre/utils/lzx/lzxmodule.c | 63 ++++++++++++------ 2 files changed, 92 insertions(+), 74 deletions(-) diff --git a/src/calibre/utils/lzx/compressor.c b/src/calibre/utils/lzx/compressor.c index 1c496a5c27..b63ee3ee95 100644 --- a/src/calibre/utils/lzx/compressor.c +++ b/src/calibre/utils/lzx/compressor.c @@ -67,7 +67,7 @@ static void Compressor_dealloc(Compressor *self) { Compressor_clear(self); - + if (self->stream) { lzxc_finish(self->stream, NULL); self->stream = NULL; @@ -81,7 +81,7 @@ Compressor_dealloc(Compressor *self) self->output.data = NULL; } - self->ob_type->tp_free((PyObject *)self); + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject * @@ -99,17 +99,17 @@ Compressor_new(PyTypeObject *type, PyObject *args, PyObject *kwds) self->wbits = 0; self->blocksize = 0; self->flushing = 0; - + BUFFER_INIT(self->residue); BUFFER_INIT(self->input); BUFFER_INIT(self->output); } - + return (PyObject *)self; } static int -get_bytes(void *context, int nbytes, void *buf) +get_bytes(void *context, int nbytes, void *buf) { Compressor *self = (Compressor *)context; unsigned char *data = (unsigned char *)buf; @@ -130,7 +130,7 @@ get_bytes(void *context, int nbytes, void *buf) nbytes -= resrem; } } - + if (inrem == 0) { return resrem; } else if (nbytes > inrem) { @@ -143,7 +143,7 @@ get_bytes(void *context, int nbytes, void *buf) } static int -at_eof(void *context) +at_eof(void *context) { Compressor *self = (Compressor *)context; return (self->flushing && (COMPRESSOR_REMAINING(self) == 0)); @@ -190,10 +190,10 @@ Compressor_init(Compressor *self, PyObject *args, PyObject *kwds) int retval = 0; self->reset = 1; - + if (!PyArg_ParseTupleAndKeywords( args, kwds, "I|b", kwlist, &wbits, &self->reset)) { - return -1; + return -1; } /* TODO: check window size. */ @@ -216,7 +216,7 @@ Compressor_init(Compressor *self, PyObject *args, PyObject *kwds) PyErr_SetString(LZXError, "Failed to create compression stream"); return -1; } - + return 0; } @@ -234,12 +234,12 @@ Compressor_compress__( PyObject *cdata = NULL; PyObject *rtable = NULL; PyObject *result = NULL; - + self->flushing = flush; input->data = data; input->size = inlen; input->offset = 0; - + outlen = inlen; remainder = outlen % blocksize; if (remainder != 0) { @@ -288,7 +288,7 @@ Compressor_compress__( self->rtable = rtable; return NULL; } - cdata = PyString_FromStringAndSize(output->data, output->offset); + cdata = PyBytes_FromStringAndSize(output->data, output->offset); if (cdata == NULL) { Py_DECREF(rtable); return NULL; @@ -333,43 +333,42 @@ static PyMethodDef Compressor_methods[] = { }; PyTypeObject CompressorType = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "lzx.Compressor", /*tp_name*/ - sizeof(Compressor), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)Compressor_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Compressor objects", /* tp_doc */ - (traverseproc)Compressor_traverse, /* tp_traverse */ - (inquiry)Compressor_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - Compressor_methods, /* tp_methods */ - Compressor_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Compressor_init, /* tp_init */ - 0, /* tp_alloc */ - Compressor_new, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "lzx.Compressor", + /* tp_basicsize */ sizeof(Compressor), + /* tp_itemsize */ 0, + /* tp_dealloc */ (destructor)Compressor_dealloc, + /* tp_print */ 0, + /* tp_getattr */ 0, + /* tp_setattr */ 0, + /* tp_compare */ 0, + /* tp_repr */ 0, + /* tp_as_number */ 0, + /* tp_as_sequence */ 0, + /* tp_as_mapping */ 0, + /* tp_hash */ 0, + /* tp_call */ 0, + /* tp_str */ 0, + /* tp_getattro */ 0, + /* tp_setattro */ 0, + /* tp_as_buffer */ 0, + /* tp_flags */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + /* tp_doc */ "Compressor objects", + /* tp_traverse */ (traverseproc)Compressor_traverse, + /* tp_clear */ (inquiry)Compressor_clear, + /* tp_richcompare */ 0, + /* tp_weaklistoffset */ 0, + /* tp_iter */ 0, + /* tp_iternext */ 0, + /* tp_methods */ Compressor_methods, + /* tp_members */ Compressor_members, + /* tp_getset */ 0, + /* tp_base */ 0, + /* tp_dict */ 0, + /* tp_descr_get */ 0, + /* tp_descr_set */ 0, + /* tp_dictoffset */ 0, + /* tp_init */ (initproc)Compressor_init, + /* tp_alloc */ 0, + /* tp_new */ Compressor_new, }; diff --git a/src/calibre/utils/lzx/lzxmodule.c b/src/calibre/utils/lzx/lzxmodule.c index 410ade709d..6c9a4f15d8 100644 --- a/src/calibre/utils/lzx/lzxmodule.c +++ b/src/calibre/utils/lzx/lzxmodule.c @@ -11,7 +11,7 @@ #include -static char lzx_doc[] = +static char lzx_doc[] = "Provide basic LZX compression and decompression using the code from\n" "liblzxcomp and libmspack respectively."; @@ -68,13 +68,13 @@ glue_read(struct mspack_file *file, void *buffer, int bytes) mem = (memory_file *)file; if (mem->magic != 0xB5) return -1; - + remaining = mem->total_bytes - mem->current_bytes; if (!remaining) return 0; if (bytes > remaining) bytes = remaining; memcpy(buffer, (unsigned char *)mem->buffer + mem->current_bytes, bytes); mem->current_bytes += bytes; - + return bytes; } @@ -86,7 +86,7 @@ glue_write(struct mspack_file *file, void *buffer, int bytes) mem = (memory_file *)file; if (mem->magic != 0xB5) return -1; - + remaining = mem->total_bytes - mem->current_bytes; if (bytes > remaining) { PyErr_SetString(LZXError, @@ -99,7 +99,7 @@ glue_write(struct mspack_file *file, void *buffer, int bytes) } struct mspack_system lzxglue_system = { - glue_open, + glue_open, glue_close, glue_read, /* Read */ glue_write, /* Write */ @@ -125,7 +125,7 @@ init(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "i", &window)) { return NULL; } - + LZXwindow = window; lzx_stream = NULL; @@ -143,7 +143,7 @@ reset(PyObject *self, PyObject *args) Py_RETURN_NONE; } -//int LZXdecompress(unsigned char *inbuf, unsigned char *outbuf, +//int LZXdecompress(unsigned char *inbuf, unsigned char *outbuf, // unsigned int inlen, unsigned int outlen) static PyObject * decompress(PyObject *self, PyObject *args) @@ -161,12 +161,12 @@ decompress(PyObject *self, PyObject *args) return NULL; } - retval = PyString_FromStringAndSize(NULL, outlen); + retval = PyBytes_FromStringAndSize(NULL, outlen); if (retval == NULL) { return NULL; } - outbuf = (unsigned char *)PyString_AS_STRING(retval); - + outbuf = (unsigned char *)PyBytes_AS_STRING(retval); + source.magic = 0xB5; source.buffer = inbuf; source.current_bytes = 0; @@ -176,9 +176,9 @@ decompress(PyObject *self, PyObject *args) dest.buffer = outbuf; dest.current_bytes = 0; dest.total_bytes = outlen; - + lzx_stream = lzxd_init(&lzxglue_system, (struct mspack_file *)&source, - (struct mspack_file *)&dest, LZXwindow, + (struct mspack_file *)&dest, LZXwindow, 0x7fff /* Never reset, I do it */, 4096, outlen); err = -1; if (lzx_stream) err = lzxd_decompress(lzx_stream, outlen); @@ -191,7 +191,7 @@ decompress(PyObject *self, PyObject *args) retval = NULL; PyErr_SetString(LZXError, "LZX decompression failed"); } - + return retval; } @@ -202,20 +202,37 @@ static PyMethodDef lzx_methods[] = { { NULL } }; -CALIBRE_MODINIT_FUNC -initlzx(void) -{ - PyObject *m; +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&lzx_module) +static struct PyModuleDef lzx_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "lzx", + /* m_doc */ lzx_doc, + /* m_size */ -1, + /* m_methods */ lzx_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; + +CALIBRE_MODINIT_FUNC PyInit_lzx(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("lzx", lzx_methods, lzx_doc); +CALIBRE_MODINIT_FUNC initlzx(void) { +#endif if (PyType_Ready(&CompressorType) < 0) { - return; + INITERROR; } - m = Py_InitModule3("lzx", lzx_methods, lzx_doc); + PyObject *m = INITMODULE; if (m == NULL) { - return; + INITERROR; } - + LZXError = PyErr_NewException("lzx.LZXError", NULL, NULL); Py_INCREF(LZXError); PyModule_AddObject(m, "LZXError", LZXError); @@ -223,5 +240,7 @@ initlzx(void) Py_INCREF(&CompressorType); PyModule_AddObject(m, "Compressor", (PyObject *)&CompressorType); - return; +#if PY_MAJOR_VERSION >= 3 + return m; +#endif } From 8179235f2d968e14b892a6938cfd2a6746c9cb64 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 26 Dec 2018 13:33:52 +0530 Subject: [PATCH 0088/2613] Conversion: When converting with font size rescaling disabled, convert font size names to rem unit rather than pt units. Fixes #1809671 [AZW3 conversion generates font-sizes in points](https://bugs.launchpad.net/calibre/+bug/1809671) These give better results with kindle previewer when converting to AZW3 and are more re-scaleable in general. --- src/calibre/ebooks/oeb/stylizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/stylizer.py b/src/calibre/ebooks/oeb/stylizer.py index b034124c8e..706a38240c 100644 --- a/src/calibre/ebooks/oeb/stylizer.py +++ b/src/calibre/ebooks/oeb/stylizer.py @@ -336,7 +336,7 @@ class Stylizer(object): if size == 'smallest': size = 'xx-small' if size in FONT_SIZE_NAMES: - style['font-size'] = "%dpt" % self.profile.fnames[size] + style['font-size'] = "%.1frem" % (self.profile.fnames[size] / float(self.profile.fbase)) if '-epub-writing-mode' in style: for x in ('-webkit-writing-mode', 'writing-mode'): style[x] = style.get(x, style['-epub-writing-mode']) From 23f0256db763e9a495252db56f99a6f652e754e2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 27 Dec 2018 09:51:03 +0530 Subject: [PATCH 0089/2613] pep8 --- src/calibre/utils/chm/__init__.py | 1 - src/calibre/utils/chm/chm.py | 38 +++++++++++++++---------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/calibre/utils/chm/__init__.py b/src/calibre/utils/chm/__init__.py index 854fa4908c..93a4a345ed 100644 --- a/src/calibre/utils/chm/__init__.py +++ b/src/calibre/utils/chm/__init__.py @@ -26,4 +26,3 @@ __all__ = ["chm", "chmlib", "_chmlib", "extra"] __version__ = "0.8.4" __revision__ = "$Id: __init__.py,v 1.8 2006/06/18 10:50:43 rubensr Exp $" - diff --git a/src/calibre/utils/chm/chm.py b/src/calibre/utils/chm/chm.py index a7fa8dc8fc..0bc5f19115 100644 --- a/src/calibre/utils/chm/chm.py +++ b/src/calibre/utils/chm/chm.py @@ -210,11 +210,11 @@ class CHMFile: such as the index file name and the topics file. It returns 1 on success, and 0 if it fails. ''' - if (self.filename is not None): + if self.filename is not None: self.CloseCHM() self.file = chmlib.chm_open(archiveName) - if (self.file is None): + if self.file is None: return 0 self.filename = archiveName @@ -227,7 +227,7 @@ class CHMFile: This function will close the CHM file, if it is open. All variables are also reset. ''' - if (self.filename is not None): + if self.filename is not None: chmlib.chm_close(self.file) self.file = None self.filename = '' @@ -265,32 +265,32 @@ class CHMFile: while (index < size): cursor = buff[index] + (buff[index+1] * 256) - if (cursor == 0): + if cursor == 0: index += 2 cursor = buff[index] + (buff[index+1] * 256) index += 2 self.topics = '/' + text[index:index+cursor-1] - elif (cursor == 1): + elif cursor == 1: index += 2 cursor = buff[index] + (buff[index+1] * 256) index += 2 self.index = '/' + text[index:index+cursor-1] - elif (cursor == 2): + elif cursor == 2: index += 2 cursor = buff[index] + (buff[index+1] * 256) index += 2 self.home = '/' + text[index:index+cursor-1] - elif (cursor == 3): + elif cursor == 3: index += 2 cursor = buff[index] + (buff[index+1] * 256) index += 2 self.title = text[index:index+cursor-1] - elif (cursor == 4): + elif cursor == 4: index += 2 cursor = buff[index] + (buff[index+1] * 256) index += 2 self.lcid = buff[index] + (buff[index+1] * 256) - elif (cursor == 6): + elif cursor == 6: index += 2 cursor = buff[index] + (buff[index+1] * 256) index += 2 @@ -300,13 +300,13 @@ class CHMFile: tmp2 = '/' + tmp + '.hhk' res1, ui1 = chmlib.chm_resolve_object(self.file, tmp1) res2, ui2 = chmlib.chm_resolve_object(self.file, tmp2) - if (not self.topics) and \ - (res1 == chmlib.CHM_RESOLVE_SUCCESS): + if not self.topics and \ + res1 == chmlib.CHM_RESOLVE_SUCCESS: self.topics = '/' + tmp + '.hhc' - if (not self.index) and \ - (res2 == chmlib.CHM_RESOLVE_SUCCESS): + if not self.index and \ + res2 == chmlib.CHM_RESOLVE_SUCCESS: self.index = '/' + tmp + '.hhk' - elif (cursor == 16): + elif cursor == 16: index += 2 cursor = buff[index] + (buff[index+1] * 256) index += 2 @@ -329,7 +329,7 @@ class CHMFile: This auxiliary function reads and returns the topics tree file contents for the CHM archive. ''' - if (self.topics is None): + if self.topics is None: return None if self.topics: @@ -338,7 +338,7 @@ class CHMFile: return None size, text = chmlib.chm_retrieve_object(self.file, ui, 0, ui.length) - if (size == 0): + if size == 0: sys.stderr.write('GetTopicsTree: file size = 0\n') return None return text @@ -406,7 +406,7 @@ class CHMFile: item being a dictionary containing the results.''' if text and text != '' and self.file: return extra.search(self.file, text, wholewords, - titleonly) + titleonly) else: return None @@ -453,8 +453,8 @@ class CHMFile: '''Internal method. Reads a double word (4 bytes) from a buffer. ''' - result = buff[idx] + (buff[idx+1]<<8) + (buff[idx+2]<<16) + \ - (buff[idx+3]<<24) + result = buff[idx] + (buff[idx+1] << 8) + (buff[idx+2] << 16) + \ + (buff[idx+3] << 24) if result == 0xFFFFFFFF: result = 0 From 07f81ed878296a204ea64c763177beb8989bafdf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 27 Dec 2018 09:56:01 +0530 Subject: [PATCH 0090/2613] Mark some string types as binary explicitly --- src/calibre/utils/chm/chm.py | 53 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/src/calibre/utils/chm/chm.py b/src/calibre/utils/chm/chm.py index 0bc5f19115..60ad23db5a 100644 --- a/src/calibre/utils/chm/chm.py +++ b/src/calibre/utils/chm/chm.py @@ -26,7 +26,6 @@ ''' import array -import string import sys import codecs @@ -249,7 +248,7 @@ class CHMFile: self.searchable = False self.lcid = None - result, ui = chmlib.chm_resolve_object(self.file, '/#SYSTEM') + result, ui = chmlib.chm_resolve_object(self.file, b'/#SYSTEM') if (result != chmlib.CHM_RESOLVE_SUCCESS): sys.stderr.write('GetArchiveInfo: #SYSTEM does not exist\n') return 0 @@ -269,17 +268,17 @@ class CHMFile: index += 2 cursor = buff[index] + (buff[index+1] * 256) index += 2 - self.topics = '/' + text[index:index+cursor-1] + self.topics = b'/' + text[index:index+cursor-1] elif cursor == 1: index += 2 cursor = buff[index] + (buff[index+1] * 256) index += 2 - self.index = '/' + text[index:index+cursor-1] + self.index = b'/' + text[index:index+cursor-1] elif cursor == 2: index += 2 cursor = buff[index] + (buff[index+1] * 256) index += 2 - self.home = '/' + text[index:index+cursor-1] + self.home = b'/' + text[index:index+cursor-1] elif cursor == 3: index += 2 cursor = buff[index] + (buff[index+1] * 256) @@ -296,16 +295,16 @@ class CHMFile: index += 2 tmp = text[index:index+cursor-1] if not self.topics: - tmp1 = '/' + tmp + '.hhc' - tmp2 = '/' + tmp + '.hhk' + tmp1 = b'/' + tmp + b'.hhc' + tmp2 = b'/' + tmp + b'.hhk' res1, ui1 = chmlib.chm_resolve_object(self.file, tmp1) res2, ui2 = chmlib.chm_resolve_object(self.file, tmp2) if not self.topics and \ res1 == chmlib.CHM_RESOLVE_SUCCESS: - self.topics = '/' + tmp + '.hhc' + self.topics = b'/' + tmp + b'.hhc' if not self.index and \ res2 == chmlib.CHM_RESOLVE_SUCCESS: - self.index = '/' + tmp + '.hhk' + self.index = b'/' + tmp + b'.hhk' elif cursor == 16: index += 2 cursor = buff[index] + (buff[index+1] * 256) @@ -421,7 +420,7 @@ class CHMFile: found, or if it is not possible to find the encoding, None is returned.''' if self.encoding: - vals = string.split(self.encoding, ',') + vals = self.encoding.split(b',') if len(vals) > 2: try: return charset_table[int(vals[2])] @@ -465,7 +464,7 @@ class CHMFile: '''Internal method. Retrieves a string from the #STRINGS buffer. ''' - next = string.find(text, '\x00', idx) + next = text.find(b'\x00', idx) chunk = text[idx:next] return chunk @@ -474,12 +473,12 @@ class CHMFile: Checks the #WINDOWS file to see if it has any info that was not found in #SYSTEM (topics, index or default page. ''' - result, ui = chmlib.chm_resolve_object(self.file, '/#WINDOWS') - if (result != chmlib.CHM_RESOLVE_SUCCESS): + result, ui = chmlib.chm_resolve_object(self.file, b'/#WINDOWS') + if result != chmlib.CHM_RESOLVE_SUCCESS: return -1 size, text = chmlib.chm_retrieve_object(self.file, ui, 0, 8) - if (size < 8): + if size < 8: return -2 buff = array.array('B', text) @@ -490,7 +489,7 @@ class CHMFile: return -3 size, text = chmlib.chm_retrieve_object(self.file, ui, 8, entry_size) - if (size < entry_size): + if size < entry_size: return -4 buff = array.array('B', text) @@ -498,25 +497,25 @@ class CHMFile: idx_index = self.GetDWORD(buff, 0x64) dft_index = self.GetDWORD(buff, 0x68) - result, ui = chmlib.chm_resolve_object(self.file, '/#STRINGS') - if (result != chmlib.CHM_RESOLVE_SUCCESS): + result, ui = chmlib.chm_resolve_object(self.file, b'/#STRINGS') + if result != chmlib.CHM_RESOLVE_SUCCESS: return -5 size, text = chmlib.chm_retrieve_object(self.file, ui, 0, ui.length) - if (size == 0): + if size == 0: return -6 - if (not self.topics): + if not self.topics: self.topics = self.GetString(text, toc_index) - if not self.topics.startswith("/"): - self.topics = "/" + self.topics + if not self.topics.startswith(b"/"): + self.topics = "b/" + self.topics - if (not self.index): + if not self.index: self.index = self.GetString(text, idx_index) - if not self.index.startswith("/"): - self.index = "/" + self.index + if not self.index.startswith(b"/"): + self.index = b"/" + self.index - if (dft_index != 0): + if dft_index != 0: self.home = self.GetString(text, dft_index) - if not self.home.startswith("/"): - self.home = "/" + self.home + if not self.home.startswith(b"/"): + self.home = b"/" + self.home From e47a2d888b53d977a485fd0a80b3d0ce4e93e82b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 27 Dec 2018 14:44:43 +0530 Subject: [PATCH 0091/2613] Update the SWIG bindings for chmlib Also get rid of the xhm_extra module since we dont care about searching CHM files and get_lcid can be implemented in pure python. --- setup/extensions.json | 9 - src/calibre/constants.py | 1 - src/calibre/ebooks/chm/reader.py | 14 +- src/calibre/utils/chm/chm.py | 45 +- src/calibre/utils/chm/chmlib.py | 120 - src/calibre/utils/chm/extra.c | 754 ---- src/calibre/utils/chm/swig_chm.c | 6507 ++++++++++++++++++++++++++---- 7 files changed, 5683 insertions(+), 1767 deletions(-) delete mode 100644 src/calibre/utils/chm/chmlib.py delete mode 100644 src/calibre/utils/chm/extra.c diff --git a/setup/extensions.json b/setup/extensions.json index 6e22528dd8..5f69cc405e 100644 --- a/setup/extensions.json +++ b/setup/extensions.json @@ -86,15 +86,6 @@ "lib_dirs": "!chmlib_lib_dirs", "defines": "SWIG_COBJECT_TYPES" }, - { - "name": "chm_extra", - "sources": "calibre/utils/chm/extra.c", - "libraries": "chm", - "windows_libraries": "ChmLib", - "inc_dirs": "!chmlib_inc_dirs", - "lib_dirs": "!chmlib_lib_dirs", - "defines": "__PYTHON__" - }, { "name": "lzx", "sources": "calibre/utils/lzx/lzxmodule.c calibre/utils/lzx/compressor.c calibre/utils/lzx/lzxd.c calibre/utils/lzx/lzc.c calibre/utils/lzx/lzxc.c", diff --git a/src/calibre/constants.py b/src/calibre/constants.py index dcce22f556..77c6214492 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -165,7 +165,6 @@ class Plugins(collections.Mapping): 'cPalmdoc', 'progress_indicator', 'chmlib', - 'chm_extra', 'icu', 'speedup', 'unicode_names', diff --git a/src/calibre/ebooks/chm/reader.py b/src/calibre/ebooks/chm/reader.py index a53519fc41..5a82c3544d 100644 --- a/src/calibre/ebooks/chm/reader.py +++ b/src/calibre/ebooks/chm/reader.py @@ -10,15 +10,17 @@ from calibre import guess_type as guess_mimetype from calibre.ebooks.BeautifulSoup import BeautifulSoup, NavigableString from calibre.constants import iswindows, filesystem_encoding from calibre.utils.chm.chm import CHMFile -from calibre.utils.chm.chmlib import ( - CHM_RESOLVE_SUCCESS, CHM_ENUMERATE_NORMAL, - chm_enumerate, -) +from calibre.constants import plugins from calibre.ebooks.metadata.toc import TOC from calibre.ebooks.chardet import xml_to_unicode +chmlib, chmlib_err = plugins['chmlib'] +if chmlib_err: + raise RuntimeError('Failed to load chmlib: ' + chmlib_err) + + def match_string(s1, s2_already_lowered): if s1 is not None and s2_already_lowered is not None: if s1.lower()==s2_already_lowered: @@ -94,7 +96,7 @@ class CHMReader(CHMFile): if path[0] != '/': path = '/' + path res, ui = self.ResolveObject(path) - if res != CHM_RESOLVE_SUCCESS: + if res != chmlib.CHM_RESOLVE_SUCCESS: raise CHMError("Unable to locate '%s' within CHM file '%s'"%(path, self.filename)) size, data = self.RetrieveObject(ui) if size == 0: @@ -276,7 +278,7 @@ class CHMReader(CHMFile): if ui.path[-1] != '/': # and make paths relative paths.append(ui.path.lstrip('/')) - chm_enumerate(self.file, CHM_ENUMERATE_NORMAL, get_paths, None) + chmlib.chm_enumerate(self.file, chmlib.CHM_ENUMERATE_NORMAL, get_paths, None) self._contents = paths return self._contents diff --git a/src/calibre/utils/chm/chm.py b/src/calibre/utils/chm/chm.py index 60ad23db5a..6c36d54ef7 100644 --- a/src/calibre/utils/chm/chm.py +++ b/src/calibre/utils/chm/chm.py @@ -26,15 +26,15 @@ ''' import array -import sys import codecs +import struct +import sys -import calibre.utils.chm.chmlib as chmlib from calibre.constants import plugins -extra, extra_err = plugins['chm_extra'] -if extra_err: - raise RuntimeError('Failed to load chm.extra: '+extra_err) +chmlib, chmlib_err = plugins['chmlib'] +if chmlib_err: + raise RuntimeError('Failed to load chmlib: ' + chmlib_err) charset_table = { 0 : 'iso8859_1', # ANSI_CHARSET @@ -188,6 +188,19 @@ locale_table = { } +def get_lcid(chm_file_obj): + for lang, offset in ( + (b"/$FIftiMain", 0x7E), + (b"$WWKeywordLinks/BTree", 0x34), + (b"$WWAssociativeLinks/BTree", 0x34), + ): + result, ui = chmlib.chm_resolve_object(chm_file_obj, lang) + if result == chmlib.CHM_RESOLVE_SUCCESS: + size, text = chmlib.chm_retrieve_object(chm_file_obj, ui, offset, 4) + if size == 4: + return struct.unpack("I", text)[0] + + class CHMFile: "A class to manage access to CHM files." filename = "" @@ -242,9 +255,6 @@ class CHMFile: obtain the index, home page, topics, encoding and title. It is called from LoadCHM. ''' - - # extra.is_searchable crashed... - # self.searchable = extra.is_searchable (self.file) self.searchable = False self.lcid = None @@ -319,7 +329,9 @@ class CHMFile: self.GetWindowsInfo() if not self.lcid: - self.lcid = extra.get_lcid(self.file) + lcid = get_lcid(self.file) + if lcid is not None: + self.lcid = lcid return 1 @@ -394,21 +406,6 @@ class CHMFile: else: return (0, '') - def Search(self, text, wholewords=0, titleonly=0): - '''Performs full-text search on the archive. - The first parameter is the word to look for, the second - indicates if the search should be for whole words only, and - the third parameter indicates if the search should be - restricted to page titles. - This method will return a tuple, the first item - indicating if the search results were partial, and the second - item being a dictionary containing the results.''' - if text and text != '' and self.file: - return extra.search(self.file, text, wholewords, - titleonly) - else: - return None - def IsSearchable(self): '''Indicates if the full-text search is available for this archive - this flag is updated when GetArchiveInfo is called''' diff --git a/src/calibre/utils/chm/chmlib.py b/src/calibre/utils/chm/chmlib.py deleted file mode 100644 index bfa59c8c7d..0000000000 --- a/src/calibre/utils/chm/chmlib.py +++ /dev/null @@ -1,120 +0,0 @@ -# This file was created automatically by SWIG. -# Don't modify this file, modify the SWIG interface instead. -# This file is compatible with both classic and new-style classes. - -from calibre.constants import plugins - -_chmlib, chmlib_err = plugins['chmlib'] - -if chmlib_err: - raise RuntimeError('Failed to load chmlib: '+chmlib_err) - - -def _swig_setattr(self,class_type,name,value): - if (name == "this"): - if isinstance(value, class_type): - self.__dict__[name] = value.this - if hasattr(value,"thisown"): - self.__dict__["thisown"] = value.thisown - del value.thisown - return - method = class_type.__swig_setmethods__.get(name,None) - if method: - return method(self,value) - self.__dict__[name] = value - - -def _swig_getattr(self,class_type,name): - method = class_type.__swig_getmethods__.get(name,None) - if method: - return method(self) - raise AttributeError(name) - -import types -try: - _object = types.ObjectType - _newclass = 1 -except AttributeError: - class _object : - pass - _newclass = 0 - - -CHM_UNCOMPRESSED = _chmlib.CHM_UNCOMPRESSED -CHM_COMPRESSED = _chmlib.CHM_COMPRESSED -CHM_MAX_PATHLEN = _chmlib.CHM_MAX_PATHLEN - - -class chmUnitInfo(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, chmUnitInfo, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, chmUnitInfo, name) - __swig_setmethods__["start"] = _chmlib.chmUnitInfo_start_set - __swig_getmethods__["start"] = _chmlib.chmUnitInfo_start_get - if _newclass: - start = property(_chmlib.chmUnitInfo_start_get,_chmlib.chmUnitInfo_start_set) - __swig_setmethods__["length"] = _chmlib.chmUnitInfo_length_set - __swig_getmethods__["length"] = _chmlib.chmUnitInfo_length_get - if _newclass: - length = property(_chmlib.chmUnitInfo_length_get,_chmlib.chmUnitInfo_length_set) - __swig_setmethods__["space"] = _chmlib.chmUnitInfo_space_set - __swig_getmethods__["space"] = _chmlib.chmUnitInfo_space_get - if _newclass: - space = property(_chmlib.chmUnitInfo_space_get,_chmlib.chmUnitInfo_space_set) - __swig_setmethods__["path"] = _chmlib.chmUnitInfo_path_set - __swig_getmethods__["path"] = _chmlib.chmUnitInfo_path_get - if _newclass: - path = property(_chmlib.chmUnitInfo_path_get,_chmlib.chmUnitInfo_path_set) - - def __init__(self,*args): - _swig_setattr(self, chmUnitInfo, 'this', apply(_chmlib.new_chmUnitInfo,args)) - _swig_setattr(self, chmUnitInfo, 'thisown', 1) - - def __del__(self, destroy=_chmlib.delete_chmUnitInfo): - try: - if self.thisown: - destroy(self) - except: - pass - - def __repr__(self): - return "" % (self.this,) - - -class chmUnitInfoPtr(chmUnitInfo): - - def __init__(self,this): - _swig_setattr(self, chmUnitInfo, 'this', this) - if not hasattr(self,"thisown"): - _swig_setattr(self, chmUnitInfo, 'thisown', 0) - _swig_setattr(self, chmUnitInfo,self.__class__,chmUnitInfo) -_chmlib.chmUnitInfo_swigregister(chmUnitInfoPtr) - -chm_open = _chmlib.chm_open - -chm_close = _chmlib.chm_close - -CHM_PARAM_MAX_BLOCKS_CACHED = _chmlib.CHM_PARAM_MAX_BLOCKS_CACHED -chm_set_param = _chmlib.chm_set_param - -CHM_RESOLVE_SUCCESS = _chmlib.CHM_RESOLVE_SUCCESS -CHM_RESOLVE_FAILURE = _chmlib.CHM_RESOLVE_FAILURE -chm_resolve_object = _chmlib.chm_resolve_object - -chm_retrieve_object = _chmlib.chm_retrieve_object - -CHM_ENUMERATE_NORMAL = _chmlib.CHM_ENUMERATE_NORMAL -CHM_ENUMERATE_META = _chmlib.CHM_ENUMERATE_META -CHM_ENUMERATE_SPECIAL = _chmlib.CHM_ENUMERATE_SPECIAL -CHM_ENUMERATE_FILES = _chmlib.CHM_ENUMERATE_FILES -CHM_ENUMERATE_DIRS = _chmlib.CHM_ENUMERATE_DIRS -CHM_ENUMERATE_ALL = _chmlib.CHM_ENUMERATE_ALL -CHM_ENUMERATOR_FAILURE = _chmlib.CHM_ENUMERATOR_FAILURE -CHM_ENUMERATOR_CONTINUE = _chmlib.CHM_ENUMERATOR_CONTINUE -CHM_ENUMERATOR_SUCCESS = _chmlib.CHM_ENUMERATOR_SUCCESS -chm_enumerate = _chmlib.chm_enumerate - -chm_enumerate_dir = _chmlib.chm_enumerate_dir - - diff --git a/src/calibre/utils/chm/extra.c b/src/calibre/utils/chm/extra.c deleted file mode 100644 index ec884fa2f0..0000000000 --- a/src/calibre/utils/chm/extra.c +++ /dev/null @@ -1,754 +0,0 @@ -/* - * extra.c - full-text search support for pychm - * - * Copyright (C) 2004 Rubens Ramos - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Author: Rubens Ramos - * - * Heavily based on work done by: - * Pabs - chmdeco - * Razvan Cojocaru - xCHM - * - */ - -#include "chm_lib.h" -#ifdef __PYTHON__ -#include "Python.h" -#else -#include -#define PyObject void -#endif - -#include - -#ifdef _MSC_VER -#include -#define strcasecmp stricmp -#define strncasecmp strnicmp -#else -#include -#include -#endif - -#if defined( _MSC_VER ) && !defined( __cplusplus ) -# define inline __inline -#endif - -#if defined(_WIN32) || defined(__WIN32__) -# if defined(_MSC_VER) -# if defined(STATIC_LINKED) -# define MODEXPORT(a) a -# define MODIMPORT(a) extern a -# else -# define MODEXPORT(a) __declspec(dllexport) a -# define MODIMPORT(a) extern a -# endif -# else -# if defined(__BORLANDC__) -# define MODEXPORT(a) a _export -# define MODIMPORT(a) a _export -# else -# define MODEXPORT(a) a -# define MODIMPORT(a) a -# endif -# endif -#else -# define MODEXPORT(a) a -# define MODIMPORT(a) a -#endif - -#define false 0 -#define true 1 - -#define FTS_HEADER_LEN 0x32 -#define TOPICS_ENTRY_LEN 16 -#define COMMON_BUF_LEN 1025 - -#define FREE(x) free (x); x = NULL - -inline uint16_t -get_uint16 (uint8_t* b) { - return b[0] | - b[1]<<8; -} - -inline uint32_t -get_uint32 (uint8_t* b) { - return b[0] | - b[1]<<8 | - b[2]<<16 | - b[3]<<24; -} - -inline uint64_t -get_uint64 (uint8_t* b) { - return b[0] | - b[1]<<8 | - b[2]<<16 | - b[3]<<24 | - (uint64_t) b[4]<<32 | - (uint64_t) b[5]<<40 | - (uint64_t) b[6]<<48 | - (uint64_t) b[7]<<56; -} - -inline uint64_t -be_encint (unsigned char *buffer, size_t *length) -{ - uint64_t result = 0; - int shift=0; - *length = 0; - - do { - result |= ((*buffer) & 0x7f) << shift; - shift += 7; - *length = *length + 1; - - } while (*(buffer++) & 0x80); - - return result; -} - -/* - Finds the first unset bit in memory. Returns the number of set bits found. - Returns -1 if the buffer runs out before we find an unset bit. -*/ -inline int -ffus (unsigned char* byte, int* bit, size_t *length) { - int bits = 0; - *length = 0; - - while(*byte & (1 << *bit)){ - if(*bit) - --(*bit); - else { - ++byte; - ++(*length); - *bit = 7; - } - ++bits; - } - - if(*bit) - --(*bit); - else { - ++(*length); - *bit = 7; - } - - return bits; -} - - -static inline uint64_t -sr_int(unsigned char* byte, int* bit, - unsigned char s, unsigned char r, size_t *length) -{ - uint64_t ret; - unsigned char mask; - int n, n_bits, num_bits, base, count; - size_t fflen; - - *length = 0; - - if(!bit || *bit > 7 || s != 2) - return ~(uint64_t)0; - ret = 0; - - count = ffus(byte, bit, &fflen); - *length += fflen; - byte += *length; - - n_bits = n = r + (count ? count-1 : 0) ; - - while (n > 0) { - num_bits = n > *bit ? *bit : n-1; - base = n > *bit ? 0 : *bit - (n-1); - - switch (num_bits){ - case 0: - mask = 1; - break; - case 1: - mask = 3; - break; - case 2: - mask = 7; - break; - case 3: - mask = 0xf; - break; - case 4: - mask = 0x1f; - break; - case 5: - mask = 0x3f; - break; - case 6: - mask = 0x7f; - break; - case 7: - mask = 0xff; - break; - default: - mask = 0xff; - break; - } - - mask <<= base; - ret = (ret << (num_bits+1)) | - (uint64_t)((*byte & mask) >> base); - - if( n > *bit ){ - ++byte; - ++(*length); - n -= *bit+1; - *bit = 7; - } else { - *bit -= n; - n = 0; - } - } - - if(count) - ret |= (uint64_t)1 << n_bits; - - return ret; -} - - -static inline uint32_t -get_leaf_node_offset(struct chmFile *chmfile, - const char *text, - uint32_t initial_offset, - uint32_t buff_size, - uint16_t tree_depth, - struct chmUnitInfo *ui) -{ - unsigned char word_len; - unsigned char pos; - uint16_t free_space; - char *wrd_buf; - char *word = NULL; - uint32_t test_offset = 0; - uint32_t i = sizeof(uint16_t); - unsigned char *buffer = (unsigned char *)malloc (buff_size); - - if (NULL == buffer) - return 0; - - while (--tree_depth) { - if (initial_offset == test_offset) { - FREE(buffer); - return 0; - } - - test_offset = initial_offset; - if (chm_retrieve_object (chmfile, ui, buffer, - initial_offset, buff_size) == 0) { - FREE(buffer); - return 0; - } - - free_space = get_uint16 (buffer); - - while (i < buff_size - free_space) { - - word_len = *(buffer + i); - pos = *(buffer + i + 1); - - wrd_buf = (char*)malloc (word_len); - memcpy (wrd_buf, buffer + i + 2, word_len - 1); - wrd_buf[word_len - 1] = 0; - - if (pos == 0) { - FREE (word); - word = (char *) strdup (wrd_buf); - } else { - word = (char*)realloc (word, word_len + pos + 1); - strcpy (word + pos, wrd_buf); - } - - FREE(wrd_buf); - - if (strcasecmp (text, word) <= 0) { - initial_offset = get_uint32 (buffer + i + word_len + 1); - break; - } - - i += word_len + sizeof (unsigned char) + sizeof(uint32_t) + - sizeof(uint16_t); - } - } - - if(initial_offset == test_offset) - initial_offset = 0; - - FREE(word); - FREE(buffer); - - return initial_offset; -} - -static inline int -pychm_process_wlc (struct chmFile *chmfile, - uint64_t wlc_count, uint64_t wlc_size, - uint32_t wlc_offset, unsigned char ds, - unsigned char dr, unsigned char cs, - unsigned char cr, unsigned char ls, - unsigned char lr, struct chmUnitInfo *uimain, - struct chmUnitInfo* uitbl, - struct chmUnitInfo *uistrings, - struct chmUnitInfo* topics, - struct chmUnitInfo *urlstr, - PyObject *dict) -{ - uint32_t stroff, urloff; - uint64_t i, j, count; - size_t length; - int wlc_bit = 7; - size_t off = 0; - uint64_t index = 0; - unsigned char entry[TOPICS_ENTRY_LEN]; - unsigned char combuf[COMMON_BUF_LEN]; - unsigned char *buffer = (unsigned char *)malloc (wlc_size); - char *url = NULL; - char *topic = NULL; - - if (chm_retrieve_object(chmfile, uimain, buffer, - wlc_offset, wlc_size) == 0) { - FREE(buffer); - return false; - } - - for (i = 0; i < wlc_count; ++i) { - - if(wlc_bit != 7) { - ++off; - wlc_bit = 7; - } - - index += sr_int(buffer + off, &wlc_bit, ds, dr, &length); - off += length; - - if(chm_retrieve_object(chmfile, topics, entry, - index * 16, TOPICS_ENTRY_LEN) == 0) { - FREE(topic); - FREE(url); - FREE(buffer); - return false; - } - - combuf[COMMON_BUF_LEN - 1] = 0; - stroff = get_uint32 (entry + 4); - - FREE (topic); - if (chm_retrieve_object (chmfile, uistrings, combuf, - stroff, COMMON_BUF_LEN - 1) == 0) { - topic = strdup ("Untitled in index"); - - } else { - combuf[COMMON_BUF_LEN - 1] = 0; - - topic = strdup ((char*)combuf); - } - - urloff = get_uint32 (entry + 8); - - if(chm_retrieve_object (chmfile, uitbl, combuf, - urloff, 12) == 0) { - FREE(buffer); - return false; - } - - urloff = get_uint32 (combuf + 8); - - if (chm_retrieve_object (chmfile, urlstr, combuf, - urloff + 8, COMMON_BUF_LEN - 1) == 0) { - FREE(topic); - FREE(url); - FREE(buffer); - return false; - } - - combuf[COMMON_BUF_LEN - 1] = 0; - - FREE (url); - url = strdup ((char*)combuf); - - if (url && topic) { -#ifdef __PYTHON__ - PyDict_SetItemString (dict, topic, - PyString_FromString (url)); -#else - printf ("%s ==> %s\n", url, topic); -#endif - } - - count = sr_int (buffer + off, &wlc_bit, cs, cr, &length); - off += length; - - for (j = 0; j < count; ++j) { - sr_int (buffer + off, &wlc_bit, ls, lr, &length); - off += length; - } - } - - FREE(topic); - FREE(url); - FREE(buffer); - - return true; -} - -int -chm_search (struct chmFile *chmfile, - const char *text, int whole_words, - int titles_only, PyObject *dict) -{ - unsigned char header[FTS_HEADER_LEN]; - unsigned char doc_index_s; - unsigned char doc_index_r; - unsigned char code_count_s; - unsigned char code_count_r; - unsigned char loc_codes_s; - unsigned char loc_codes_r; - unsigned char word_len, pos; - unsigned char *buffer; - char *word = NULL; - uint32_t node_offset; - uint32_t node_len; - uint16_t tree_depth; - uint32_t i; - uint16_t free_space; - uint64_t wlc_count, wlc_size; - uint32_t wlc_offset; - char *wrd_buf; - unsigned char title; - size_t encsz; - struct chmUnitInfo ui, uitopics, uiurltbl, uistrings, uiurlstr; - int partial = false; - - if (NULL == text) - return -1; - - if (chm_resolve_object (chmfile, "/$FIftiMain", &ui) != - CHM_RESOLVE_SUCCESS || - chm_resolve_object (chmfile, "/#TOPICS", &uitopics) != - CHM_RESOLVE_SUCCESS || - chm_resolve_object (chmfile, "/#STRINGS", &uistrings) != - CHM_RESOLVE_SUCCESS || - chm_resolve_object (chmfile, "/#URLTBL", &uiurltbl) != - CHM_RESOLVE_SUCCESS || - chm_resolve_object (chmfile, "/#URLSTR", &uiurlstr) != - CHM_RESOLVE_SUCCESS) - return false; - - if(chm_retrieve_object(chmfile, &ui, header, 0, FTS_HEADER_LEN) == 0) - return false; - - doc_index_s = header[0x1E]; - doc_index_r = header[0x1F]; - code_count_s = header[0x20]; - code_count_r = header[0x21]; - loc_codes_s = header[0x22]; - loc_codes_r = header[0x23]; - - if(doc_index_s != 2 || code_count_s != 2 || loc_codes_s != 2) { - return false; - } - - node_offset = get_uint32 (header + 0x14); - node_len = get_uint32 (header + 0x2e); - tree_depth = get_uint16 (header + 0x18); - - i = sizeof(uint16_t); - - buffer = (unsigned char*)malloc (node_len); - - node_offset = get_leaf_node_offset (chmfile, text, node_offset, node_len, - tree_depth, &ui); - - if (!node_offset) { - FREE(buffer); - return false; - } - - do { - - if (chm_retrieve_object (chmfile, &ui, buffer, - node_offset, node_len) == 0) { - FREE(word); - FREE(buffer); - return false; - } - - free_space = get_uint16 (buffer + 6); - - i = sizeof(uint32_t) + sizeof(uint16_t) + sizeof(uint16_t); - - encsz = 0; - - while (i < node_len - free_space) { - word_len = *(buffer + i); - pos = *(buffer + i + 1); - - wrd_buf = (char*)malloc (word_len); - memcpy (wrd_buf, buffer + i + 2, word_len - 1); - wrd_buf[word_len - 1] = 0; - - if (pos == 0) { - FREE(word); - word = (char *) strdup (wrd_buf); - } else { - word = (char*)realloc (word, word_len + pos + 1); - strcpy (word + pos, wrd_buf); - } - - FREE(wrd_buf); - - i += 2 + word_len; - title = *(buffer + i - 1); - - wlc_count = be_encint (buffer + i, &encsz); - i += encsz; - - wlc_offset = get_uint32 (buffer + i); - - i += sizeof(uint32_t) + sizeof(uint16_t); - wlc_size = be_encint (buffer + i, &encsz); - i += encsz; - - node_offset = get_uint32 (buffer); - - if (!title && titles_only) - continue; - - if (whole_words && !strcasecmp(text, word)) { - partial = pychm_process_wlc (chmfile, wlc_count, wlc_size, - wlc_offset, doc_index_s, - doc_index_r,code_count_s, - code_count_r, loc_codes_s, - loc_codes_r, &ui, &uiurltbl, - &uistrings, &uitopics, - &uiurlstr, dict); - FREE(word); - FREE(buffer); - return partial; - } - - if (!whole_words) { - if (!strncasecmp (word, text, strlen(text))) { - partial = true; - pychm_process_wlc (chmfile, wlc_count, wlc_size, - wlc_offset, doc_index_s, - doc_index_r,code_count_s, - code_count_r, loc_codes_s, - loc_codes_r, &ui, &uiurltbl, - &uistrings, &uitopics, - &uiurlstr, dict); - - } else if (strncasecmp (text, word, strlen(text)) < -1) - break; - } - - } - } while (!whole_words && - !strncmp (word, text, strlen(text)) && - node_offset); - - FREE(word); - FREE(buffer); - - return partial; -} - -typedef struct { - const char *file; - int offset; -} Langrec; - -Langrec lang_files[] = { - {"/$FIftiMain", 0x7E}, - {"$WWKeywordLinks/BTree", 0x34}, - {"$WWAssociativeLinks/BTree", 0x34} -}; - -#define LANG_FILES_SIZE (sizeof(lang_files)/sizeof(Langrec)) - -int -chm_get_lcid (struct chmFile *chmfile) { - struct chmUnitInfo ui; - uint32_t lang; - int i; - - for (i=0; i \n"); - printf ("> "); - if (scanf ("%d %d %s", &whole_words, &titles_only, text)) - partial = chm_search (file, - text, whole_words, titles_only, NULL); - else - break; - - printf ("Partial = %d\n", partial); - } - - chm_close (file); - return 0; - } - - return -1; - - } else { - printf ("\n%s \n", argv[0]); - return 0; - } -} - -#endif diff --git a/src/calibre/utils/chm/swig_chm.c b/src/calibre/utils/chm/swig_chm.c index ec753299b4..d7649bce43 100644 --- a/src/calibre/utils/chm/swig_chm.c +++ b/src/calibre/utils/chm/swig_chm.c @@ -1,6 +1,7 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.18 + * Version 3.0.12 + * swig -Wall -python -builtin -modern -O swig_chm.i * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -8,524 +9,3691 @@ * interface file instead. * ----------------------------------------------------------------------------- */ + +#ifndef SWIGPYTHON #define SWIGPYTHON +#endif -#include "Python.h" +#define SWIG_PYTHON_NO_BUILD_NONE +#define SWIG_PYTHON_DIRECTOR_NO_VTABLE +#define SWIGPYTHON_BUILTIN -/*********************************************************************** - * common.swg +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if defined(__GNUC__) +# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + +/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ +#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) +# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif + +/* Intel's compiler complains if a variable which was never initialised is + * cast to void, which is a common idiom which we use to indicate that we + * are aware a variable isn't used. So we just silence that warning. + * See: https://github.com/swig/swig/issues/192 for more discussion. + */ +#ifdef __INTEL_COMPILER +# pragma warning disable 592 +#endif + + +#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) +/* Use debug wrappers with the Python release dll */ +# undef _DEBUG +# include +# define _DEBUG +#else +# include +#endif + +/* ----------------------------------------------------------------------------- + * swigrun.swg * - * This file contains generic SWIG runtime support for pointer - * type checking as well as a few commonly used macros to control - * external linkage. - * - * Author : David Beazley (beazley@cs.uchicago.edu) - * - * Copyright (c) 1999-2000, The University of Chicago - * - * This file may be freely redistributed without license or fee provided - * this copyright message remains intact. - ************************************************************************/ + * This file contains generic C API SWIG runtime support for pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +/* This should only be incremented when either the layout of swig_type_info changes, + or for whatever reason, the runtime changes incompatibly */ +#define SWIG_RUNTIME_VERSION "4" + +/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ +#ifdef SWIG_TYPE_TABLE +# define SWIG_QUOTE_STRING(x) #x +# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) +# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) +#else +# define SWIG_TYPE_TABLE_NAME +#endif + +/* + You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for + creating a static or dynamic library from the SWIG runtime code. + In 99.9% of the cases, SWIG just needs to declare them as 'static'. + + But only do this if strictly necessary, ie, if you have problems + with your compiler or suchlike. +*/ + +#ifndef SWIGRUNTIME +# define SWIGRUNTIME SWIGINTERN +#endif + +#ifndef SWIGRUNTIMEINLINE +# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE +#endif + +/* Generic buffer size */ +#ifndef SWIG_BUFFER_SIZE +# define SWIG_BUFFER_SIZE 1024 +#endif + +/* Flags for pointer conversions */ +#define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 + +/* Flags for new pointer objects */ +#define SWIG_POINTER_OWN 0x1 + + +/* + Flags/methods for returning states. + + The SWIG conversion methods, as ConvertPtr, return an integer + that tells if the conversion was successful or not. And if not, + an error code can be returned (see swigerrors.swg for the codes). + + Use the following macros/flags to set or process the returning + states. + + In old versions of SWIG, code such as the following was usually written: + + if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { + // success code + } else { + //fail code + } + + Now you can be more explicit: + + int res = SWIG_ConvertPtr(obj,vptr,ty.flags); + if (SWIG_IsOK(res)) { + // success code + } else { + // fail code + } + + which is the same really, but now you can also do + + Type *ptr; + int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); + if (SWIG_IsOK(res)) { + // success code + if (SWIG_IsNewObj(res) { + ... + delete *ptr; + } else { + ... + } + } else { + // fail code + } + + I.e., now SWIG_ConvertPtr can return new objects and you can + identify the case and take care of the deallocation. Of course that + also requires SWIG_ConvertPtr to return new result values, such as + + int SWIG_ConvertPtr(obj, ptr,...) { + if () { + if () { + *ptr = ; + return SWIG_NEWOBJ; + } else { + *ptr = ; + return SWIG_OLDOBJ; + } + } else { + return SWIG_BADOBJ; + } + } + + Of course, returning the plain '0(success)/-1(fail)' still works, but you can be + more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the + SWIG errors code. + + Finally, if the SWIG_CASTRANK_MODE is enabled, the result code + allows to return the 'cast rank', for example, if you have this + + int food(double) + int fooi(int); + + and you call + + food(1) // cast rank '1' (1 -> 1.0) + fooi(1) // cast rank '0' + + just use the SWIG_AddCast()/SWIG_CheckState() +*/ + +#define SWIG_OK (0) +#define SWIG_ERROR (-1) +#define SWIG_IsOK(r) (r >= 0) +#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) + +/* The CastRankLimit says how many bits are used for the cast rank */ +#define SWIG_CASTRANKLIMIT (1 << 8) +/* The NewMask denotes the object was created (using new/malloc) */ +#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) +/* The TmpMask is for in/out typemaps that use temporal objects */ +#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) +/* Simple returning values */ +#define SWIG_BADOBJ (SWIG_ERROR) +#define SWIG_OLDOBJ (SWIG_OK) +#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) +#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) +/* Check, add and del mask methods */ +#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) +#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) +#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) +#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) +#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) +#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) + +/* Cast-Rank Mode */ +#if defined(SWIG_CASTRANK_MODE) +# ifndef SWIG_TypeRank +# define SWIG_TypeRank unsigned long +# endif +# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ +# define SWIG_MAXCASTRANK (2) +# endif +# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) +# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) +SWIGINTERNINLINE int SWIG_AddCast(int r) { + return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; +} +SWIGINTERNINLINE int SWIG_CheckState(int r) { + return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; +} +#else /* no cast-rank mode */ +# define SWIG_AddCast(r) (r) +# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) +#endif + #include -#if defined(_WIN32) || defined(__WIN32__) -# if defined(_MSC_VER) -# if defined(STATIC_LINKED) -# define SWIGEXPORT(a) a -# define SWIGIMPORT(a) extern a -# else -# define SWIGEXPORT(a) __declspec(dllexport) a -# define SWIGIMPORT(a) extern a -# endif -# else -# if defined(__BORLANDC__) -# define SWIGEXPORT(a) a _export -# define SWIGIMPORT(a) a _export -# else -# define SWIGEXPORT(a) a -# define SWIGIMPORT(a) a -# endif -# endif -#else -# define SWIGEXPORT(a) a -# define SWIGIMPORT(a) a -#endif - -#ifdef SWIG_GLOBAL -#define SWIGRUNTIME(a) SWIGEXPORT(a) -#else -#define SWIGRUNTIME(a) static a -#endif - #ifdef __cplusplus extern "C" { #endif -typedef void *(*swig_converter_func)(void *); +typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); +/* Structure to store information on one type */ typedef struct swig_type_info { - const char *name; - swig_converter_func converter; - const char *str; - void *clientdata; - swig_dycast_func dcast; - struct swig_type_info *next; - struct swig_type_info *prev; + const char *name; /* mangled name of this type */ + const char *str; /* human readable name of this type */ + swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ + struct swig_cast_info *cast; /* linked list of types that can cast into this type */ + void *clientdata; /* language specific type data */ + int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; -#ifdef SWIG_NOINCLUDE +/* Structure to store a type and conversion function used for casting */ +typedef struct swig_cast_info { + swig_type_info *type; /* pointer to type that is equivalent to this type */ + swig_converter_func converter; /* function to cast the void pointers */ + struct swig_cast_info *next; /* pointer to next cast in linked list */ + struct swig_cast_info *prev; /* pointer to the previous cast */ +} swig_cast_info; -SWIGIMPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *); -SWIGIMPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *); -SWIGIMPORT(void *) SWIG_TypeCast(swig_type_info *, void *); -SWIGIMPORT(swig_type_info *) SWIG_TypeDynamicCast(swig_type_info *, void **); -SWIGIMPORT(const char *) SWIG_TypeName(const swig_type_info *); -SWIGIMPORT(swig_type_info *) SWIG_TypeQuery(const char *); -SWIGIMPORT(void) SWIG_TypeClientData(swig_type_info *, void *); +/* Structure used to store module information + * Each module generates one structure like this, and the runtime collects + * all of these structures and stores them in a circularly linked list.*/ +typedef struct swig_module_info { + swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ + size_t size; /* Number of types in this module */ + struct swig_module_info *next; /* Pointer to next element in circularly linked list */ + swig_type_info **type_initial; /* Array of initially generated type structures */ + swig_cast_info **cast_initial; /* Array of initially generated casting structures */ + void *clientdata; /* Language specific module data */ +} swig_module_info; -#else +/* + Compare two type names skipping the space characters, therefore + "char*" == "char *" and "Class" == "Class", etc. -static swig_type_info *swig_type_list = 0; - -/* Register a type mapping with the type-checking */ -SWIGRUNTIME(swig_type_info *) -SWIG_TypeRegister(swig_type_info *ti) -{ - swig_type_info *tc, *head, *ret, *next; - /* Check to see if this type has already been registered */ - tc = swig_type_list; - while (tc) { - if (strcmp(tc->name, ti->name) == 0) { - /* Already exists in the table. Just add additional types to the list */ - if (tc->clientdata) ti->clientdata = tc->clientdata; - head = tc; - next = tc->next; - goto l1; - } - tc = tc->prev; + Return 0 when the two name types are equivalent, as in + strncmp, but skipping ' '. +*/ +SWIGRUNTIME int +SWIG_TypeNameComp(const char *f1, const char *l1, + const char *f2, const char *l2) { + for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { + while ((*f1 == ' ') && (f1 != l1)) ++f1; + while ((*f2 == ' ') && (f2 != l2)) ++f2; + if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } - head = ti; - next = 0; - - /* Place in list */ - ti->prev = swig_type_list; - swig_type_list = ti; - - /* Build linked lists */ - l1: - ret = head; - tc = ti + 1; - /* Patch up the rest of the links */ - while (tc->name) { - head->next = tc; - tc->prev = head; - head = tc; - tc++; - } - if (next) next->prev = head; /**/ - head->next = next; - return ret; + return (int)((l1 - f1) - (l2 - f2)); } -/* Check the typename */ -SWIGRUNTIME(swig_type_info *) -SWIG_TypeCheck(char *c, swig_type_info *ty) -{ - swig_type_info *s; - if (!ty) return 0; /* Void pointer */ - s = ty->next; /* First element always just a name */ - do { - if (strcmp(s->name,c) == 0) { - if (s == ty->next) return s; - /* Move s to the top of the linked list */ - s->prev->next = s->next; - if (s->next) { - s->next->prev = s->prev; - } - /* Insert s as second element in the list */ - s->next = ty->next; - if (ty->next) ty->next->prev = s; - ty->next = s; - s->prev = ty; /**/ - return s; +/* + Check type equivalence in a name list like ||... + Return 0 if equal, -1 if nb < tb, 1 if nb > tb +*/ +SWIGRUNTIME int +SWIG_TypeCmp(const char *nb, const char *tb) { + int equiv = 1; + const char* te = tb + strlen(tb); + const char* ne = nb; + while (equiv != 0 && *ne) { + for (nb = ne; *ne; ++ne) { + if (*ne == '|') break; } - s = s->next; - } while (s && (s != ty->next)); + equiv = SWIG_TypeNameComp(nb, ne, tb, te); + if (*ne) ++ne; + } + return equiv; +} + +/* + Check type equivalence in a name list like ||... + Return 0 if not equal, 1 if equal +*/ +SWIGRUNTIME int +SWIG_TypeEquiv(const char *nb, const char *tb) { + return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; +} + +/* + Check the typename +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheck(const char *c, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (strcmp(iter->type->name, c) == 0) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } return 0; } -/* Cast a pointer up an inheritance hierarchy */ -SWIGRUNTIME(void *) -SWIG_TypeCast(swig_type_info *ty, void *ptr) -{ - if ((!ty) || (!ty->converter)) return ptr; - return (*ty->converter)(ptr); +/* + Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (iter->type == from) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; } +/* + Cast a pointer up an inheritance hierarchy +*/ +SWIGRUNTIMEINLINE void * +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); +} -/* Set the clientdata field for a type */ -SWIGRUNTIME(void) +/* + Dynamic pointer casting. Down an inheritance hierarchy +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { + swig_type_info *lastty = ty; + if (!ty || !ty->dcast) return ty; + while (ty && (ty->dcast)) { + ty = (*ty->dcast)(ptr); + if (ty) lastty = ty; + } + return lastty; +} + +/* + Return the name associated with this type +*/ +SWIGRUNTIMEINLINE const char * +SWIG_TypeName(const swig_type_info *ty) { + return ty->name; +} + +/* + Return the pretty name associated with this type, + that is an unmangled type name in a form presentable to the user. +*/ +SWIGRUNTIME const char * +SWIG_TypePrettyName(const swig_type_info *type) { + /* The "str" field contains the equivalent pretty names of the + type, separated by vertical-bar characters. We choose + to print the last name, as it is often (?) the most + specific. */ + if (!type) return NULL; + if (type->str != NULL) { + const char *last_name = type->str; + const char *s; + for (s = type->str; *s; s++) + if (*s == '|') last_name = s+1; + return last_name; + } + else + return type->name; +} + +/* + Set the clientdata field for a type +*/ +SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_type_info *tc, *equiv; - if (ti->clientdata == clientdata) return; + swig_cast_info *cast = ti->cast; + /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; - equiv = ti->next; - while (equiv) { - if (!equiv->converter) { - tc = swig_type_list; - while (tc) { - if ((strcmp(tc->name, equiv->name) == 0)) - SWIG_TypeClientData(tc,clientdata); - tc = tc->prev; + + while (cast) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); } } - equiv = equiv->next; + cast = cast->next; } } -#endif - -#ifdef __cplusplus +SWIGRUNTIME void +SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { + SWIG_TypeClientData(ti, clientdata); + ti->owndata = 1; } -#endif +/* + Search for a swig_type_info structure only by mangled name + Search is a O(log #types) -/*********************************************************************** - * python.swg - * - * This file contains the runtime support for Python modules - * and includes code for managing global variables and pointer - * type checking. - * - * Author : David Beazley (beazley@cs.uchicago.edu) - ************************************************************************/ - -#include "Python.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define SWIG_PY_INT 1 -#define SWIG_PY_FLOAT 2 -#define SWIG_PY_STRING 3 -#define SWIG_PY_POINTER 4 -#define SWIG_PY_BINARY 5 - -/* Flags for pointer conversion */ - -#define SWIG_POINTER_EXCEPTION 0x1 -#define SWIG_POINTER_DISOWN 0x2 - -/* Exception handling in wrappers */ -#define SWIG_fail goto fail - -/* Constant information structure */ -typedef struct swig_const_info { - int type; - char *name; - long lvalue; - double dvalue; - void *pvalue; - swig_type_info **ptype; -} swig_const_info; - -#ifdef SWIG_NOINCLUDE - -SWIGEXPORT(PyObject *) SWIG_newvarlink(void); -SWIGEXPORT(void) SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *)); -SWIGEXPORT(int) SWIG_ConvertPtr(PyObject *, void **, swig_type_info *, int); -SWIGEXPORT(int) SWIG_ConvertPacked(PyObject *, void *, int sz, swig_type_info *, int); -SWIGEXPORT(char *) SWIG_PackData(char *c, void *, int); -SWIGEXPORT(char *) SWIG_UnpackData(char *c, void *, int); -SWIGEXPORT(PyObject *) SWIG_NewPointerObj(void *, swig_type_info *,int own); -SWIGEXPORT(PyObject *) SWIG_NewPackedObj(void *, int sz, swig_type_info *); -SWIGEXPORT(void) SWIG_InstallConstants(PyObject *d, swig_const_info constants[]); -#else - -/* ----------------------------------------------------------------------------- - * global variable support code. - * ----------------------------------------------------------------------------- */ - -typedef struct swig_globalvar { - char *name; /* Name of global variable */ - PyObject *(*get_attr)(void); /* Return the current value */ - int (*set_attr)(PyObject *); /* Set the value */ - struct swig_globalvar *next; -} swig_globalvar; - -typedef struct swig_varlinkobject { - PyObject_HEAD - swig_globalvar *vars; -} swig_varlinkobject; - -static PyObject * -swig_varlink_repr(swig_varlinkobject *v) { - v = v; - return PyString_FromString(""); -} - -static int -swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) { - swig_globalvar *var; - flags = flags; - fprintf(fp,"Global variables { "); - for (var = v->vars; var; var=var->next) { - fprintf(fp,"%s", var->name); - if (var->next) fprintf(fp,", "); - } - fprintf(fp," }\n"); + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_MangledTypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + swig_module_info *iter = start; + do { + if (iter->size) { + size_t l = 0; + size_t r = iter->size - 1; + do { + /* since l+r >= 0, we can (>> 1) instead (/ 2) */ + size_t i = (l + r) >> 1; + const char *iname = iter->types[i]->name; + if (iname) { + int compare = strcmp(name, iname); + if (compare == 0) { + return iter->types[i]; + } else if (compare < 0) { + if (i) { + r = i - 1; + } else { + break; + } + } else if (compare > 0) { + l = i + 1; + } + } else { + break; /* should never happen */ + } + } while (l <= r); + } + iter = iter->next; + } while (iter != end); return 0; } -static PyObject * -swig_varlink_getattr(swig_varlinkobject *v, char *n) { - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - return (*var->get_attr)(); - } - var = var->next; +/* + Search for a swig_type_info structure for either a mangled name or a human readable name. + It first searches the mangled names of the types, which is a O(log #types) + If a type is not found it then searches the human readable names, which is O(#types). + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + /* STEP 1: Search the name field using binary search */ + swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); + if (ret) { + return ret; + } else { + /* STEP 2: If the type hasn't been found, do a complete search + of the str field (the human readable name) */ + swig_module_info *iter = start; + do { + size_t i = 0; + for (; i < iter->size; ++i) { + if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) + return iter->types[i]; + } + iter = iter->next; + } while (iter != end); } - PyErr_SetString(PyExc_NameError,"Unknown C global variable"); - return NULL; + + /* neither found a match */ + return 0; } -static int -swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - return (*var->set_attr)(p); - } - var = var->next; - } - PyErr_SetString(PyExc_NameError,"Unknown C global variable"); - return 1; -} - -statichere PyTypeObject varlinktype = { - PyObject_HEAD_INIT(0) - 0, - (char *)"swigvarlink", /* Type name */ - sizeof(swig_varlinkobject), /* Basic size */ - 0, /* Itemsize */ - 0, /* Deallocator */ - (printfunc) swig_varlink_print, /* Print */ - (getattrfunc) swig_varlink_getattr, /* get attr */ - (setattrfunc) swig_varlink_setattr, /* Set attr */ - 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_mapping*/ - 0, /* tp_hash */ -}; - -/* Create a variable linking object for use later */ -SWIGRUNTIME(PyObject *) -SWIG_newvarlink(void) { - swig_varlinkobject *result = 0; - result = PyMem_NEW(swig_varlinkobject,1); - varlinktype.ob_type = &PyType_Type; /* Patch varlinktype into a PyType */ - result->ob_type = &varlinktype; - result->vars = 0; - result->ob_refcnt = 0; - Py_XINCREF((PyObject *) result); - return ((PyObject*) result); -} - -/* Pack binary data into a string */ -SWIGRUNTIME(char *) -SWIG_PackData(char *c, void *ptr, int sz) { - static char hex[17] = "0123456789abcdef"; - int i; - unsigned char *u = (unsigned char *) ptr; - register unsigned char uu; - for (i = 0; i < sz; i++,u++) { - uu = *u; +/* + Pack binary data into a string +*/ +SWIGRUNTIME char * +SWIG_PackData(char *c, void *ptr, size_t sz) { + static const char hex[17] = "0123456789abcdef"; + const unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } -/* Convert a pointer value */ -SWIGRUNTIME(int) -SWIG_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) { - swig_type_info *tc; - char *c; - static PyObject *SWIG_this = 0; - int newref = 0; - PyObject *pyobj = 0; +/* + Unpack binary data from a string +*/ +SWIGRUNTIME const char * +SWIG_UnpackData(const char *c, void *ptr, size_t sz) { + unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + char d = *(c++); + unsigned char uu; + if ((d >= '0') && (d <= '9')) + uu = (unsigned char)((d - '0') << 4); + else if ((d >= 'a') && (d <= 'f')) + uu = (unsigned char)((d - ('a'-10)) << 4); + else + return (char *) 0; + d = *(c++); + if ((d >= '0') && (d <= '9')) + uu |= (unsigned char)(d - '0'); + else if ((d >= 'a') && (d <= 'f')) + uu |= (unsigned char)(d - ('a'-10)); + else + return (char *) 0; + *u = uu; + } + return c; +} - if (!obj) return 0; - if (obj == Py_None) { - *ptr = 0; - return 0; - } -#ifdef SWIG_COBJECT_TYPES - if (!(PyCObject_Check(obj))) { - if (!SWIG_this) - SWIG_this = PyString_FromString("this"); - pyobj = obj; - obj = PyObject_GetAttr(obj,SWIG_this); - newref = 1; - if (!obj) goto type_error; - if (!PyCObject_Check(obj)) { - Py_DECREF(obj); - goto type_error; - } - } - *ptr = PyCObject_AsVoidPtr(obj); - c = (char *) PyCObject_GetDesc(obj); - if (newref) Py_DECREF(obj); - goto cobject; -#else - if (!(PyString_Check(obj))) { - if (!SWIG_this) - SWIG_this = PyString_FromString("this"); - pyobj = obj; - obj = PyObject_GetAttr(obj,SWIG_this); - newref = 1; - if (!obj) goto type_error; - if (!PyString_Check(obj)) { - Py_DECREF(obj); - goto type_error; - } - } - c = PyString_AsString(obj); - /* Pointer values must start with leading underscore */ +/* + Pack 'void *' into a string buffer. +*/ +SWIGRUNTIME char * +SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { + char *r = buff; + if ((2*sizeof(void *) + 2) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,&ptr,sizeof(void *)); + if (strlen(name) + 1 > (bsz - (r - buff))) return 0; + strcpy(r,name); + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { - *ptr = (void *) 0; if (strcmp(c,"NULL") == 0) { - if (newref) { Py_DECREF(obj); } + *ptr = (void *) 0; + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sizeof(void *)); +} + +SWIGRUNTIME char * +SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { + char *r = buff; + size_t lname = (name ? strlen(name) : 0); + if ((2*sz + 2 + lname) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,ptr,sz); + if (lname) { + strncpy(r,name,lname+1); + } else { + *r = 0; + } + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + memset(ptr,0,sz); + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sz); +} + +#ifdef __cplusplus +} +#endif + +/* Errors in SWIG */ +#define SWIG_UnknownError -1 +#define SWIG_IOError -2 +#define SWIG_RuntimeError -3 +#define SWIG_IndexError -4 +#define SWIG_TypeError -5 +#define SWIG_DivisionByZero -6 +#define SWIG_OverflowError -7 +#define SWIG_SyntaxError -8 +#define SWIG_ValueError -9 +#define SWIG_SystemError -10 +#define SWIG_AttributeError -11 +#define SWIG_MemoryError -12 +#define SWIG_NullReferenceError -13 + + + +/* Compatibility macros for Python 3 */ +#if PY_VERSION_HEX >= 0x03000000 + +#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) +#define PyInt_Check(x) PyLong_Check(x) +#define PyInt_AsLong(x) PyLong_AsLong(x) +#define PyInt_FromLong(x) PyLong_FromLong(x) +#define PyInt_FromSize_t(x) PyLong_FromSize_t(x) +#define PyString_Check(name) PyBytes_Check(name) +#define PyString_FromString(x) PyUnicode_FromString(x) +#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) +#define PyString_AsString(str) PyBytes_AsString(str) +#define PyString_Size(str) PyBytes_Size(str) +#define PyString_InternFromString(key) PyUnicode_InternFromString(key) +#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE +#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x) +#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x) + +#endif + +#ifndef Py_TYPE +# define Py_TYPE(op) ((op)->ob_type) +#endif + +/* SWIG APIs for compatibility of both Python 2 & 3 */ + +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_Python_str_FromFormat PyUnicode_FromFormat +#else +# define SWIG_Python_str_FromFormat PyString_FromFormat +#endif + + +/* Warning: This function will allocate a new string in Python 3, + * so please call SWIG_Python_str_DelForPy3(x) to free the space. + */ +SWIGINTERN char* +SWIG_Python_str_AsChar(PyObject *str) +{ +#if PY_VERSION_HEX >= 0x03000000 + char *cstr; + char *newstr; + Py_ssize_t len; + str = PyUnicode_AsUTF8String(str); + PyBytes_AsStringAndSize(str, &cstr, &len); + newstr = (char *) malloc(len+1); + memcpy(newstr, cstr, len+1); + Py_XDECREF(str); + return newstr; +#else + return PyString_AsString(str); +#endif +} + +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) +#else +# define SWIG_Python_str_DelForPy3(x) +#endif + + +SWIGINTERN PyObject* +SWIG_Python_str_FromChar(const char *c) +{ +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_FromString(c); +#else + return PyString_FromString(c); +#endif +} + +/* Add PyOS_snprintf for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 +# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) +# define PyOS_snprintf _snprintf +# else +# define PyOS_snprintf snprintf +# endif +#endif + +/* A crude PyString_FromFormat implementation for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 + +#ifndef SWIG_PYBUFFER_SIZE +# define SWIG_PYBUFFER_SIZE 1024 +#endif + +static PyObject * +PyString_FromFormat(const char *fmt, ...) { + va_list ap; + char buf[SWIG_PYBUFFER_SIZE * 2]; + int res; + va_start(ap, fmt); + res = vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); +} +#endif + +#ifndef PyObject_DEL +# define PyObject_DEL PyObject_Del +#endif + +/* A crude PyExc_StopIteration exception for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 +# ifndef PyExc_StopIteration +# define PyExc_StopIteration PyExc_RuntimeError +# endif +# ifndef PyObject_GenericGetAttr +# define PyObject_GenericGetAttr 0 +# endif +#endif + +/* Py_NotImplemented is defined in 2.1 and up. */ +#if PY_VERSION_HEX < 0x02010000 +# ifndef Py_NotImplemented +# define Py_NotImplemented PyExc_RuntimeError +# endif +#endif + +/* A crude PyString_AsStringAndSize implementation for old Pythons */ +#if PY_VERSION_HEX < 0x02010000 +# ifndef PyString_AsStringAndSize +# define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} +# endif +#endif + +/* PySequence_Size for old Pythons */ +#if PY_VERSION_HEX < 0x02000000 +# ifndef PySequence_Size +# define PySequence_Size PySequence_Length +# endif +#endif + +/* PyBool_FromLong for old Pythons */ +#if PY_VERSION_HEX < 0x02030000 +static +PyObject *PyBool_FromLong(long ok) +{ + PyObject *result = ok ? Py_True : Py_False; + Py_INCREF(result); + return result; +} +#endif + +/* Py_ssize_t for old Pythons */ +/* This code is as recommended by: */ +/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ +#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) +typedef int Py_ssize_t; +# define PY_SSIZE_T_MAX INT_MAX +# define PY_SSIZE_T_MIN INT_MIN +typedef inquiry lenfunc; +typedef intargfunc ssizeargfunc; +typedef intintargfunc ssizessizeargfunc; +typedef intobjargproc ssizeobjargproc; +typedef intintobjargproc ssizessizeobjargproc; +typedef getreadbufferproc readbufferproc; +typedef getwritebufferproc writebufferproc; +typedef getsegcountproc segcountproc; +typedef getcharbufferproc charbufferproc; +static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc)) +{ + long result = 0; + PyObject *i = PyNumber_Int(x); + if (i) { + result = PyInt_AsLong(i); + Py_DECREF(i); + } + return result; +} +#endif + +#if PY_VERSION_HEX < 0x02050000 +#define PyInt_FromSize_t(x) PyInt_FromLong((long)x) +#endif + +#if PY_VERSION_HEX < 0x02040000 +#define Py_VISIT(op) \ + do { \ + if (op) { \ + int vret = visit((op), arg); \ + if (vret) \ + return vret; \ + } \ + } while (0) +#endif + +#if PY_VERSION_HEX < 0x02030000 +typedef struct { + PyTypeObject type; + PyNumberMethods as_number; + PyMappingMethods as_mapping; + PySequenceMethods as_sequence; + PyBufferProcs as_buffer; + PyObject *name, *slots; +} PyHeapTypeObject; +#endif + +#if PY_VERSION_HEX < 0x02030000 +typedef destructor freefunc; +#endif + +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \ + (PY_MAJOR_VERSION > 3)) +# define SWIGPY_USE_CAPSULE +# define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif + +#if PY_VERSION_HEX < 0x03020000 +#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) +#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) +#define Py_hash_t long +#endif + +/* ----------------------------------------------------------------------------- + * error manipulation + * ----------------------------------------------------------------------------- */ + +SWIGRUNTIME PyObject* +SWIG_Python_ErrorType(int code) { + PyObject* type = 0; + switch(code) { + case SWIG_MemoryError: + type = PyExc_MemoryError; + break; + case SWIG_IOError: + type = PyExc_IOError; + break; + case SWIG_RuntimeError: + type = PyExc_RuntimeError; + break; + case SWIG_IndexError: + type = PyExc_IndexError; + break; + case SWIG_TypeError: + type = PyExc_TypeError; + break; + case SWIG_DivisionByZero: + type = PyExc_ZeroDivisionError; + break; + case SWIG_OverflowError: + type = PyExc_OverflowError; + break; + case SWIG_SyntaxError: + type = PyExc_SyntaxError; + break; + case SWIG_ValueError: + type = PyExc_ValueError; + break; + case SWIG_SystemError: + type = PyExc_SystemError; + break; + case SWIG_AttributeError: + type = PyExc_AttributeError; + break; + default: + type = PyExc_RuntimeError; + } + return type; +} + + +SWIGRUNTIME void +SWIG_Python_AddErrorMsg(const char* mesg) +{ + PyObject *type = 0; + PyObject *value = 0; + PyObject *traceback = 0; + + if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); + if (value) { + char *tmp; + PyObject *old_str = PyObject_Str(value); + PyErr_Clear(); + Py_XINCREF(type); + + PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(old_str); + Py_DECREF(value); + } else { + PyErr_SetString(PyExc_RuntimeError, mesg); + } +} + +#if defined(SWIG_PYTHON_NO_THREADS) +# if defined(SWIG_PYTHON_THREADS) +# undef SWIG_PYTHON_THREADS +# endif +#endif +#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ +# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) +# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ +# define SWIG_PYTHON_USE_GIL +# endif +# endif +# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ +# ifndef SWIG_PYTHON_INITIALIZE_THREADS +# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() +# endif +# ifdef __cplusplus /* C++ code */ + class SWIG_Python_Thread_Block { + bool status; + PyGILState_STATE state; + public: + void end() { if (status) { PyGILState_Release(state); status = false;} } + SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} + ~SWIG_Python_Thread_Block() { end(); } + }; + class SWIG_Python_Thread_Allow { + bool status; + PyThreadState *save; + public: + void end() { if (status) { PyEval_RestoreThread(save); status = false; }} + SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} + ~SWIG_Python_Thread_Allow() { end(); } + }; +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block +# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow +# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() +# else /* C code */ +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() +# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() +# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) +# endif +# else /* Old thread way, not implemented, user must provide it */ +# if !defined(SWIG_PYTHON_INITIALIZE_THREADS) +# define SWIG_PYTHON_INITIALIZE_THREADS +# endif +# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK +# endif +# if !defined(SWIG_PYTHON_THREAD_END_BLOCK) +# define SWIG_PYTHON_THREAD_END_BLOCK +# endif +# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW +# endif +# if !defined(SWIG_PYTHON_THREAD_END_ALLOW) +# define SWIG_PYTHON_THREAD_END_ALLOW +# endif +# endif +#else /* No thread support */ +# define SWIG_PYTHON_INITIALIZE_THREADS +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK +# define SWIG_PYTHON_THREAD_END_BLOCK +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW +# define SWIG_PYTHON_THREAD_END_ALLOW +#endif + +/* ----------------------------------------------------------------------------- + * Python API portion that goes into the runtime + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* ----------------------------------------------------------------------------- + * Constant declarations + * ----------------------------------------------------------------------------- */ + +/* Constant Types */ +#define SWIG_PY_POINTER 4 +#define SWIG_PY_BINARY 5 + +/* Constant information structure */ +typedef struct swig_const_info { + int type; + char *name; + long lvalue; + double dvalue; + void *pvalue; + swig_type_info **ptype; +} swig_const_info; + + +/* ----------------------------------------------------------------------------- + * Wrapper of PyInstanceMethod_New() used in Python 3 + * It is exported to the generated module, used for -fastproxy + * ----------------------------------------------------------------------------- */ +#if PY_VERSION_HEX >= 0x03000000 +SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) +{ + return PyInstanceMethod_New(func); +} +#else +SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func)) +{ + return NULL; +} +#endif + +#ifdef __cplusplus +} +#endif + + +/* ----------------------------------------------------------------------------- + * pyrun.swg + * + * This file contains the runtime support for Python modules + * and includes code for managing global variables and pointer + * type checking. + * + * ----------------------------------------------------------------------------- */ + +/* Common SWIG API */ + +/* for raw pointers */ +#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) +#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) +#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) + +#ifdef SWIGPYTHON_BUILTIN +#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) +#else +#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) +#endif + +#define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) + +#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) +#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) +#define swig_owntype int + +/* for raw packed data */ +#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) + +/* for class or struct pointers */ +#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) +#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) + +/* for C or C++ function pointers */ +#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) +#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0) + +/* for C++ member pointers, ie, member methods */ +#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) + + +/* Runtime API */ + +#define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata) +#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) +#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) + +#define SWIG_SetErrorObj SWIG_Python_SetErrorObj +#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg +#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) +#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) +#define SWIG_fail goto fail + + +/* Runtime API implementation */ + +/* Error manipulation */ + +SWIGINTERN void +SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetObject(errtype, obj); + Py_DECREF(obj); + SWIG_PYTHON_THREAD_END_BLOCK; +} + +SWIGINTERN void +SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetString(errtype, msg); + SWIG_PYTHON_THREAD_END_BLOCK; +} + +#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) + +/* Set a constant value */ + +#if defined(SWIGPYTHON_BUILTIN) + +SWIGINTERN void +SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) { + PyObject *s = PyString_InternFromString(key); + PyList_Append(seq, s); + Py_DECREF(s); +} + +SWIGINTERN void +SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { +#if PY_VERSION_HEX < 0x02030000 + PyDict_SetItemString(d, (char *)name, obj); +#else + PyDict_SetItemString(d, name, obj); +#endif + Py_DECREF(obj); + if (public_interface) + SwigPyBuiltin_AddPublicSymbol(public_interface, name); +} + +#else + +SWIGINTERN void +SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { +#if PY_VERSION_HEX < 0x02030000 + PyDict_SetItemString(d, (char *)name, obj); +#else + PyDict_SetItemString(d, name, obj); +#endif + Py_DECREF(obj); +} + +#endif + +/* Append a value to the result obj */ + +SWIGINTERN PyObject* +SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { +#if !defined(SWIG_PYTHON_OUTPUT_TUPLE) + if (!result) { + result = obj; + } else if (result == Py_None) { + Py_DECREF(result); + result = obj; + } else { + if (!PyList_Check(result)) { + PyObject *o2 = result; + result = PyList_New(1); + PyList_SetItem(result, 0, o2); + } + PyList_Append(result,obj); + Py_DECREF(obj); + } + return result; +#else + PyObject* o2; + PyObject* o3; + if (!result) { + result = obj; + } else if (result == Py_None) { + Py_DECREF(result); + result = obj; + } else { + if (!PyTuple_Check(result)) { + o2 = result; + result = PyTuple_New(1); + PyTuple_SET_ITEM(result, 0, o2); + } + o3 = PyTuple_New(1); + PyTuple_SET_ITEM(o3, 0, obj); + o2 = result; + result = PySequence_Concat(o2, o3); + Py_DECREF(o2); + Py_DECREF(o3); + } + return result; +#endif +} + +/* Unpack the argument tuple */ + +SWIGINTERN Py_ssize_t +SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) +{ + if (!args) { + if (!min && !max) { + return 1; + } else { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", + name, (min == max ? "" : "at least "), (int)min); + return 0; + } + } + if (!PyTuple_Check(args)) { + if (min <= 1 && max >= 1) { + Py_ssize_t i; + objs[0] = args; + for (i = 1; i < max; ++i) { + objs[i] = 0; + } + return 2; + } + PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); + return 0; + } else { + Py_ssize_t l = PyTuple_GET_SIZE(args); + if (l < min) { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + name, (min == max ? "" : "at least "), (int)min, (int)l); + return 0; + } else if (l > max) { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + name, (min == max ? "" : "at most "), (int)max, (int)l); return 0; } else { - if (newref) { Py_DECREF(obj); } - goto type_error; + Py_ssize_t i; + for (i = 0; i < l; ++i) { + objs[i] = PyTuple_GET_ITEM(args, i); + } + for (; l < max; ++l) { + objs[l] = 0; + } + return i + 1; } } - c++; - c = SWIG_UnpackData(c,ptr,sizeof(void *)); - if (newref) { Py_DECREF(obj); } +} + +/* A functor is a function object with one single object argument */ +#if PY_VERSION_HEX >= 0x02020000 +#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); +#else +#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); #endif -#ifdef SWIG_COBJECT_TYPES -cobject: +/* + Helper for static pointer initialization for both C and C++ code, for example + static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); +*/ +#ifdef __cplusplus +#define SWIG_STATIC_POINTER(var) var +#else +#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var #endif - if (ty) { - tc = SWIG_TypeCheck(c,ty); - if (!tc) goto type_error; - *ptr = SWIG_TypeCast(tc,(void*) *ptr); +/* ----------------------------------------------------------------------------- + * Pointer declarations + * ----------------------------------------------------------------------------- */ + +/* Flags for new pointer objects */ +#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) +#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) + +#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) + +#define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2) +#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN) + +#ifdef __cplusplus +extern "C" { +#endif + +/* How to access Py_None */ +#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# ifndef SWIG_PYTHON_NO_BUILD_NONE +# ifndef SWIG_PYTHON_BUILD_NONE +# define SWIG_PYTHON_BUILD_NONE +# endif +# endif +#endif + +#ifdef SWIG_PYTHON_BUILD_NONE +# ifdef Py_None +# undef Py_None +# define Py_None SWIG_Py_None() +# endif +SWIGRUNTIMEINLINE PyObject * +_SWIG_Py_None(void) +{ + PyObject *none = Py_BuildValue((char*)""); + Py_DECREF(none); + return none; +} +SWIGRUNTIME PyObject * +SWIG_Py_None(void) +{ + static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); + return none; +} +#endif + +/* The python void return value */ + +SWIGRUNTIMEINLINE PyObject * +SWIG_Py_Void(void) +{ + PyObject *none = Py_None; + Py_INCREF(none); + return none; +} + +/* SwigPyClientData */ + +typedef struct { + PyObject *klass; + PyObject *newraw; + PyObject *newargs; + PyObject *destroy; + int delargs; + int implicitconv; + PyTypeObject *pytype; +} SwigPyClientData; + +SWIGRUNTIMEINLINE int +SWIG_Python_CheckImplicit(swig_type_info *ty) +{ + SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; + return data ? data->implicitconv : 0; +} + +SWIGRUNTIMEINLINE PyObject * +SWIG_Python_ExceptionType(swig_type_info *desc) { + SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; + PyObject *klass = data ? data->klass : 0; + return (klass ? klass : PyExc_RuntimeError); +} + + +SWIGRUNTIME SwigPyClientData * +SwigPyClientData_New(PyObject* obj) +{ + if (!obj) { + return 0; + } else { + SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); + /* the klass element */ + data->klass = obj; + Py_INCREF(data->klass); + /* the newraw method and newargs arguments used to create a new raw instance */ + if (PyClass_Check(obj)) { + data->newraw = 0; + data->newargs = obj; + Py_INCREF(obj); + } else { +#if (PY_VERSION_HEX < 0x02020000) + data->newraw = 0; +#else + data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); +#endif + if (data->newraw) { + Py_INCREF(data->newraw); + data->newargs = PyTuple_New(1); + PyTuple_SetItem(data->newargs, 0, obj); + } else { + data->newargs = obj; + } + Py_INCREF(data->newargs); + } + /* the destroy method, aka as the C++ delete method */ + data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); + if (PyErr_Occurred()) { + PyErr_Clear(); + data->destroy = 0; + } + if (data->destroy) { + int flags; + Py_INCREF(data->destroy); + flags = PyCFunction_GET_FLAGS(data->destroy); +#ifdef METH_O + data->delargs = !(flags & (METH_O)); +#else + data->delargs = 0; +#endif + } else { + data->delargs = 0; + } + data->implicitconv = 0; + data->pytype = 0; + return data; } +} - if ((pyobj) && (flags & SWIG_POINTER_DISOWN)) { - PyObject *zero = PyInt_FromLong(0); - PyObject_SetAttrString(pyobj,(char*)"thisown",zero); - Py_DECREF(zero); +SWIGRUNTIME void +SwigPyClientData_Del(SwigPyClientData *data) { + Py_XDECREF(data->newraw); + Py_XDECREF(data->newargs); + Py_XDECREF(data->destroy); +} + +/* =============== SwigPyObject =====================*/ + +typedef struct { + PyObject_HEAD + void *ptr; + swig_type_info *ty; + int own; + PyObject *next; +#ifdef SWIGPYTHON_BUILTIN + PyObject *dict; +#endif +} SwigPyObject; + + +#ifdef SWIGPYTHON_BUILTIN + +SWIGRUNTIME PyObject * +SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) +{ + SwigPyObject *sobj = (SwigPyObject *)v; + + if (!sobj->dict) + sobj->dict = PyDict_New(); + + Py_INCREF(sobj->dict); + return sobj->dict; +} + +#endif + +SWIGRUNTIME PyObject * +SwigPyObject_long(SwigPyObject *v) +{ + return PyLong_FromVoidPtr(v->ptr); +} + +SWIGRUNTIME PyObject * +SwigPyObject_format(const char* fmt, SwigPyObject *v) +{ + PyObject *res = NULL; + PyObject *args = PyTuple_New(1); + if (args) { + if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { + PyObject *ofmt = SWIG_Python_str_FromChar(fmt); + if (ofmt) { +#if PY_VERSION_HEX >= 0x03000000 + res = PyUnicode_Format(ofmt,args); +#else + res = PyString_Format(ofmt,args); +#endif + Py_DECREF(ofmt); + } + Py_DECREF(args); + } + } + return res; +} + +SWIGRUNTIME PyObject * +SwigPyObject_oct(SwigPyObject *v) +{ + return SwigPyObject_format("%o",v); +} + +SWIGRUNTIME PyObject * +SwigPyObject_hex(SwigPyObject *v) +{ + return SwigPyObject_format("%x",v); +} + +SWIGRUNTIME PyObject * +#ifdef METH_NOARGS +SwigPyObject_repr(SwigPyObject *v) +#else +SwigPyObject_repr(SwigPyObject *v, PyObject *args) +#endif +{ + const char *name = SWIG_TypePrettyName(v->ty); + PyObject *repr = SWIG_Python_str_FromFormat("", (name ? name : "unknown"), (void *)v); + if (v->next) { +# ifdef METH_NOARGS + PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); +# else + PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); +# endif +# if PY_VERSION_HEX >= 0x03000000 + PyObject *joined = PyUnicode_Concat(repr, nrep); + Py_DecRef(repr); + Py_DecRef(nrep); + repr = joined; +# else + PyString_ConcatAndDel(&repr,nrep); +# endif + } + return repr; +} + +SWIGRUNTIME int +SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +{ + void *i = v->ptr; + void *j = w->ptr; + return (i < j) ? -1 : ((i > j) ? 1 : 0); +} + +/* Added for Python 3.x, would it also be useful for Python 2.x? */ +SWIGRUNTIME PyObject* +SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +{ + PyObject* res; + if( op != Py_EQ && op != Py_NE ) { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); + return res; +} + + +SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); + +#ifdef SWIGPYTHON_BUILTIN +static swig_type_info *SwigPyObject_stype = 0; +SWIGRUNTIME PyTypeObject* +SwigPyObject_type(void) { + SwigPyClientData *cd; + assert(SwigPyObject_stype); + cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; + assert(cd); + assert(cd->pytype); + return cd->pytype; +} +#else +SWIGRUNTIME PyTypeObject* +SwigPyObject_type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); + return type; +} +#endif + +SWIGRUNTIMEINLINE int +SwigPyObject_Check(PyObject *op) { +#ifdef SWIGPYTHON_BUILTIN + PyTypeObject *target_tp = SwigPyObject_type(); + if (PyType_IsSubtype(op->ob_type, target_tp)) + return 1; + return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0); +#else + return (Py_TYPE(op) == SwigPyObject_type()) + || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); +#endif +} + +SWIGRUNTIME PyObject * +SwigPyObject_New(void *ptr, swig_type_info *ty, int own); + +SWIGRUNTIME void +SwigPyObject_dealloc(PyObject *v) +{ + SwigPyObject *sobj = (SwigPyObject *) v; + PyObject *next = sobj->next; + if (sobj->own == SWIG_POINTER_OWN) { + swig_type_info *ty = sobj->ty; + SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; + PyObject *destroy = data ? data->destroy : 0; + if (destroy) { + /* destroy is always a VARARGS method */ + PyObject *res; + + /* PyObject_CallFunction() has the potential to silently drop + the active active exception. In cases of unnamed temporary + variable or where we just finished iterating over a generator + StopIteration will be active right now, and this needs to + remain true upon return from SwigPyObject_dealloc. So save + and restore. */ + + PyObject *val = NULL, *type = NULL, *tb = NULL; + PyErr_Fetch(&val, &type, &tb); + + if (data->delargs) { + /* we need to create a temporary object to carry the destroy operation */ + PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); + res = SWIG_Python_CallFunctor(destroy, tmp); + Py_DECREF(tmp); + } else { + PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); + PyObject *mself = PyCFunction_GET_SELF(destroy); + res = ((*meth)(mself, v)); + } + if (!res) + PyErr_WriteUnraisable(destroy); + + PyErr_Restore(val, type, tb); + + Py_XDECREF(res); + } +#if !defined(SWIG_PYTHON_SILENT_MEMLEAK) + else { + const char *name = SWIG_TypePrettyName(ty); + printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); + } +#endif + } + Py_XDECREF(next); + PyObject_DEL(v); +} + +SWIGRUNTIME PyObject* +SwigPyObject_append(PyObject* v, PyObject* next) +{ + SwigPyObject *sobj = (SwigPyObject *) v; +#ifndef METH_O + PyObject *tmp = 0; + if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; + next = tmp; +#endif + if (!SwigPyObject_Check(next)) { + PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject"); + return NULL; + } + sobj->next = next; + Py_INCREF(next); + return SWIG_Py_Void(); +} + +SWIGRUNTIME PyObject* +#ifdef METH_NOARGS +SwigPyObject_next(PyObject* v) +#else +SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + SwigPyObject *sobj = (SwigPyObject *) v; + if (sobj->next) { + Py_INCREF(sobj->next); + return sobj->next; + } else { + return SWIG_Py_Void(); + } +} + +SWIGINTERN PyObject* +#ifdef METH_NOARGS +SwigPyObject_disown(PyObject *v) +#else +SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + SwigPyObject *sobj = (SwigPyObject *)v; + sobj->own = 0; + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject* +#ifdef METH_NOARGS +SwigPyObject_acquire(PyObject *v) +#else +SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + SwigPyObject *sobj = (SwigPyObject *)v; + sobj->own = SWIG_POINTER_OWN; + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject* +SwigPyObject_own(PyObject *v, PyObject *args) +{ + PyObject *val = 0; +#if (PY_VERSION_HEX < 0x02020000) + if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) +#elif (PY_VERSION_HEX < 0x02050000) + if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) +#else + if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) +#endif + { + return NULL; + } + else + { + SwigPyObject *sobj = (SwigPyObject *)v; + PyObject *obj = PyBool_FromLong(sobj->own); + if (val) { +#ifdef METH_NOARGS + if (PyObject_IsTrue(val)) { + SwigPyObject_acquire(v); + } else { + SwigPyObject_disown(v); + } +#else + if (PyObject_IsTrue(val)) { + SwigPyObject_acquire(v,args); + } else { + SwigPyObject_disown(v,args); + } +#endif + } + return obj; + } +} + +#ifdef METH_O +static PyMethodDef +swigobject_methods[] = { + {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"}, + {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, + {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, + {0, 0, 0, 0} +}; +#else +static PyMethodDef +swigobject_methods[] = { + {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"acquires ownership of the pointer"}, + {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, + {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, + {0, 0, 0, 0} +}; +#endif + +#if PY_VERSION_HEX < 0x02020000 +SWIGINTERN PyObject * +SwigPyObject_getattr(SwigPyObject *sobj,char *name) +{ + return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); +} +#endif + +SWIGRUNTIME PyTypeObject* +SwigPyObject_TypeOnce(void) { + static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + + static PyNumberMethods SwigPyObject_as_number = { + (binaryfunc)0, /*nb_add*/ + (binaryfunc)0, /*nb_subtract*/ + (binaryfunc)0, /*nb_multiply*/ + /* nb_divide removed in Python 3 */ +#if PY_VERSION_HEX < 0x03000000 + (binaryfunc)0, /*nb_divide*/ +#endif + (binaryfunc)0, /*nb_remainder*/ + (binaryfunc)0, /*nb_divmod*/ + (ternaryfunc)0,/*nb_power*/ + (unaryfunc)0, /*nb_negative*/ + (unaryfunc)0, /*nb_positive*/ + (unaryfunc)0, /*nb_absolute*/ + (inquiry)0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ +#if PY_VERSION_HEX < 0x03000000 + 0, /*nb_coerce*/ +#endif + (unaryfunc)SwigPyObject_long, /*nb_int*/ +#if PY_VERSION_HEX < 0x03000000 + (unaryfunc)SwigPyObject_long, /*nb_long*/ +#else + 0, /*nb_reserved*/ +#endif + (unaryfunc)0, /*nb_float*/ +#if PY_VERSION_HEX < 0x03000000 + (unaryfunc)SwigPyObject_oct, /*nb_oct*/ + (unaryfunc)SwigPyObject_hex, /*nb_hex*/ +#endif +#if PY_VERSION_HEX >= 0x03050000 /* 3.5 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */ +#elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ +#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ +#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ +#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ + 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ +#endif + }; + + static PyTypeObject swigpyobject_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + (char *)"SwigPyObject", /* tp_name */ + sizeof(SwigPyObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SwigPyObject_dealloc, /* tp_dealloc */ + 0, /* tp_print */ +#if PY_VERSION_HEX < 0x02020000 + (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ +#else + (getattrfunc)0, /* tp_getattr */ +#endif + (setattrfunc)0, /* tp_setattr */ +#if PY_VERSION_HEX >= 0x03000000 + 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ +#else + (cmpfunc)SwigPyObject_compare, /* tp_compare */ +#endif + (reprfunc)SwigPyObject_repr, /* tp_repr */ + &SwigPyObject_as_number, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + swigobject_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0, /* tp_iter */ + 0, /* tp_iternext */ + swigobject_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ +#endif + }; + swigpyobject_type = tmp; + type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + swigpyobject_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&swigpyobject_type) < 0) + return NULL; +#endif + } + return &swigpyobject_type; +} + +SWIGRUNTIME PyObject * +SwigPyObject_New(void *ptr, swig_type_info *ty, int own) +{ + SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); + if (sobj) { + sobj->ptr = ptr; + sobj->ty = ty; + sobj->own = own; + sobj->next = 0; + } + return (PyObject *)sobj; +} + +/* ----------------------------------------------------------------------------- + * Implements a simple Swig Packed type, and use it instead of string + * ----------------------------------------------------------------------------- */ + +typedef struct { + PyObject_HEAD + void *pack; + swig_type_info *ty; + size_t size; +} SwigPyPacked; + +SWIGRUNTIME int +SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) +{ + char result[SWIG_BUFFER_SIZE]; + fputs("pack, v->size, 0, sizeof(result))) { + fputs("at ", fp); + fputs(result, fp); + } + fputs(v->ty->name,fp); + fputs(">", fp); + return 0; +} + +SWIGRUNTIME PyObject * +SwigPyPacked_repr(SwigPyPacked *v) +{ + char result[SWIG_BUFFER_SIZE]; + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { + return SWIG_Python_str_FromFormat("", result, v->ty->name); + } else { + return SWIG_Python_str_FromFormat("", v->ty->name); + } +} + +SWIGRUNTIME PyObject * +SwigPyPacked_str(SwigPyPacked *v) +{ + char result[SWIG_BUFFER_SIZE]; + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ + return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); + } else { + return SWIG_Python_str_FromChar(v->ty->name); + } +} + +SWIGRUNTIME int +SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) +{ + size_t i = v->size; + size_t j = w->size; + int s = (i < j) ? -1 : ((i > j) ? 1 : 0); + return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); +} + +SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); + +SWIGRUNTIME PyTypeObject* +SwigPyPacked_type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); + return type; +} + +SWIGRUNTIMEINLINE int +SwigPyPacked_Check(PyObject *op) { + return ((op)->ob_type == SwigPyPacked_TypeOnce()) + || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); +} + +SWIGRUNTIME void +SwigPyPacked_dealloc(PyObject *v) +{ + if (SwigPyPacked_Check(v)) { + SwigPyPacked *sobj = (SwigPyPacked *) v; + free(sobj->pack); + } + PyObject_DEL(v); +} + +SWIGRUNTIME PyTypeObject* +SwigPyPacked_TypeOnce(void) { + static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static PyTypeObject swigpypacked_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX>=0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + (char *)"SwigPyPacked", /* tp_name */ + sizeof(SwigPyPacked), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ + (printfunc)SwigPyPacked_print, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ +#if PY_VERSION_HEX>=0x03000000 + 0, /* tp_reserved in 3.0.1 */ +#else + (cmpfunc)SwigPyPacked_compare, /* tp_compare */ +#endif + (reprfunc)SwigPyPacked_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)SwigPyPacked_str, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + swigpacked_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ +#endif + }; + swigpypacked_type = tmp; + type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + swigpypacked_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&swigpypacked_type) < 0) + return NULL; +#endif + } + return &swigpypacked_type; +} + +SWIGRUNTIME PyObject * +SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) +{ + SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); + if (sobj) { + void *pack = malloc(size); + if (pack) { + memcpy(pack, ptr, size); + sobj->pack = pack; + sobj->ty = ty; + sobj->size = size; + } else { + PyObject_DEL((PyObject *) sobj); + sobj = 0; + } + } + return (PyObject *) sobj; +} + +SWIGRUNTIME swig_type_info * +SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) +{ + if (SwigPyPacked_Check(obj)) { + SwigPyPacked *sobj = (SwigPyPacked *)obj; + if (sobj->size != size) return 0; + memcpy(ptr, sobj->pack, size); + return sobj->ty; + } else { + return 0; + } +} + +/* ----------------------------------------------------------------------------- + * pointers/data manipulation + * ----------------------------------------------------------------------------- */ + +SWIGRUNTIMEINLINE PyObject * +_SWIG_This(void) +{ + return SWIG_Python_str_FromChar("this"); +} + +static PyObject *swig_this = NULL; + +SWIGRUNTIME PyObject * +SWIG_This(void) +{ + if (swig_this == NULL) + swig_this = _SWIG_This(); + return swig_this; +} + +/* #define SWIG_PYTHON_SLOW_GETSET_THIS */ + +/* TODO: I don't know how to implement the fast getset in Python 3 right now */ +#if PY_VERSION_HEX>=0x03000000 +#define SWIG_PYTHON_SLOW_GETSET_THIS +#endif + +SWIGRUNTIME SwigPyObject * +SWIG_Python_GetSwigThis(PyObject *pyobj) +{ + PyObject *obj; + + if (SwigPyObject_Check(pyobj)) + return (SwigPyObject *) pyobj; + +#ifdef SWIGPYTHON_BUILTIN + (void)obj; +# ifdef PyWeakref_CheckProxy + if (PyWeakref_CheckProxy(pyobj)) { + pyobj = PyWeakref_GET_OBJECT(pyobj); + if (pyobj && SwigPyObject_Check(pyobj)) + return (SwigPyObject*) pyobj; + } +# endif + return NULL; +#else + + obj = 0; + +#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) + if (PyInstance_Check(pyobj)) { + obj = _PyInstance_Lookup(pyobj, SWIG_This()); + } else { + PyObject **dictptr = _PyObject_GetDictPtr(pyobj); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; + } else { +#ifdef PyWeakref_CheckProxy + if (PyWeakref_CheckProxy(pyobj)) { + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; + } +#endif + obj = PyObject_GetAttr(pyobj,SWIG_This()); + if (obj) { + Py_DECREF(obj); + } else { + if (PyErr_Occurred()) PyErr_Clear(); + return 0; + } + } + } +#else + obj = PyObject_GetAttr(pyobj,SWIG_This()); + if (obj) { + Py_DECREF(obj); + } else { + if (PyErr_Occurred()) PyErr_Clear(); + return 0; + } +#endif + if (obj && !SwigPyObject_Check(obj)) { + /* a PyObject is called 'this', try to get the 'real this' + SwigPyObject from it */ + return SWIG_Python_GetSwigThis(obj); + } + return (SwigPyObject *)obj; +#endif +} + +/* Acquire a pointer value */ + +SWIGRUNTIME int +SWIG_Python_AcquirePtr(PyObject *obj, int own) { + if (own == SWIG_POINTER_OWN) { + SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); + if (sobj) { + int oldown = sobj->own; + sobj->own = own; + return oldown; + } } return 0; +} -type_error: - if (flags & SWIG_POINTER_EXCEPTION) { +/* Convert a pointer value */ + +SWIGRUNTIME int +SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { + int res; + SwigPyObject *sobj; + int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0; + + if (!obj) + return SWIG_ERROR; + if (obj == Py_None && !implicit_conv) { + if (ptr) + *ptr = 0; + return SWIG_OK; + } + + res = SWIG_ERROR; + + sobj = SWIG_Python_GetSwigThis(obj); + if (own) + *own = 0; + while (sobj) { + void *vptr = sobj->ptr; if (ty) { - char *temp = (char *) malloc(64+strlen(ty->name)); - sprintf(temp,"Type error. Expected %s", ty->name); - PyErr_SetString(PyExc_TypeError, temp); - free((char *) temp); + swig_type_info *to = sobj->ty; + if (to == ty) { + /* no type cast needed */ + if (ptr) *ptr = vptr; + break; + } else { + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) { + sobj = (SwigPyObject *)sobj->next; + } else { + if (ptr) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + } + break; + } + } } else { - PyErr_SetString(PyExc_TypeError,"Expected a pointer"); + if (ptr) *ptr = vptr; + break; } } - return -1; + if (sobj) { + if (own) + *own = *own | sobj->own; + if (flags & SWIG_POINTER_DISOWN) { + sobj->own = 0; + } + res = SWIG_OK; + } else { + if (implicit_conv) { + SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; + if (data && !data->implicitconv) { + PyObject *klass = data->klass; + if (klass) { + PyObject *impconv; + data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ + impconv = SWIG_Python_CallFunctor(klass, obj); + data->implicitconv = 0; + if (PyErr_Occurred()) { + PyErr_Clear(); + impconv = 0; + } + if (impconv) { + SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); + if (iobj) { + void *vptr; + res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); + if (SWIG_IsOK(res)) { + if (ptr) { + *ptr = vptr; + /* transfer the ownership to 'ptr' */ + iobj->own = 0; + res = SWIG_AddCast(res); + res = SWIG_AddNewMask(res); + } else { + res = SWIG_AddCast(res); + } + } + } + Py_DECREF(impconv); + } + } + } + } + if (!SWIG_IsOK(res) && obj == Py_None) { + if (ptr) + *ptr = 0; + if (PyErr_Occurred()) + PyErr_Clear(); + res = SWIG_OK; + } + } + return res; +} + +/* Convert a function ptr value */ + +SWIGRUNTIME int +SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { + if (!PyCFunction_Check(obj)) { + return SWIG_ConvertPtr(obj, ptr, ty, 0); + } else { + void *vptr = 0; + + /* here we get the method pointer for callbacks */ + const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); + const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; + if (desc) + desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; + if (!desc) + return SWIG_ERROR; + if (ty) { + swig_cast_info *tc = SWIG_TypeCheck(desc,ty); + if (tc) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } else { + return SWIG_ERROR; + } + } else { + *ptr = vptr; + } + return SWIG_OK; + } +} + +/* Convert a packed value value */ + +SWIGRUNTIME int +SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { + swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); + if (!to) return SWIG_ERROR; + if (ty) { + if (to != ty) { + /* check type cast? */ + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) return SWIG_ERROR; + } + } + return SWIG_OK; +} + +/* ----------------------------------------------------------------------------- + * Create a new pointer object + * ----------------------------------------------------------------------------- */ + +/* + Create a new instance object, without calling __init__, and set the + 'this' attribute. +*/ + +SWIGRUNTIME PyObject* +SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) +{ +#if (PY_VERSION_HEX >= 0x02020000) + PyObject *inst = 0; + PyObject *newraw = data->newraw; + if (newraw) { + inst = PyObject_Call(newraw, data->newargs, NULL); + if (inst) { +#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) + PyObject **dictptr = _PyObject_GetDictPtr(inst); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + PyDict_SetItem(dict, SWIG_This(), swig_this); + } + } +#else + PyObject *key = SWIG_This(); + PyObject_SetAttr(inst, key, swig_this); +#endif + } + } else { +#if PY_VERSION_HEX >= 0x03000000 + inst = ((PyTypeObject*) data->newargs)->tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); + if (inst) { + PyObject_SetAttr(inst, SWIG_This(), swig_this); + Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; + } +#else + PyObject *dict = PyDict_New(); + if (dict) { + PyDict_SetItem(dict, SWIG_This(), swig_this); + inst = PyInstance_NewRaw(data->newargs, dict); + Py_DECREF(dict); + } +#endif + } + return inst; +#else +#if (PY_VERSION_HEX >= 0x02010000) + PyObject *inst = 0; + PyObject *dict = PyDict_New(); + if (dict) { + PyDict_SetItem(dict, SWIG_This(), swig_this); + inst = PyInstance_NewRaw(data->newargs, dict); + Py_DECREF(dict); + } + return (PyObject *) inst; +#else + PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); + if (inst == NULL) { + return NULL; + } + inst->in_class = (PyClassObject *)data->newargs; + Py_INCREF(inst->in_class); + inst->in_dict = PyDict_New(); + if (inst->in_dict == NULL) { + Py_DECREF(inst); + return NULL; + } +#ifdef Py_TPFLAGS_HAVE_WEAKREFS + inst->in_weakreflist = NULL; +#endif +#ifdef Py_TPFLAGS_GC + PyObject_GC_Init(inst); +#endif + PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); + return (PyObject *) inst; +#endif +#endif +} + +SWIGRUNTIME void +SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) +{ + PyObject *dict; +#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) + PyObject **dictptr = _PyObject_GetDictPtr(inst); + if (dictptr != NULL) { + dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + } + PyDict_SetItem(dict, SWIG_This(), swig_this); + return; + } +#endif + dict = PyObject_GetAttrString(inst, (char*)"__dict__"); + PyDict_SetItem(dict, SWIG_This(), swig_this); + Py_DECREF(dict); +} + + +SWIGINTERN PyObject * +SWIG_Python_InitShadowInstance(PyObject *args) { + PyObject *obj[2]; + if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) { + return NULL; + } else { + SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); + if (sthis) { + SwigPyObject_append((PyObject*) sthis, obj[1]); + } else { + SWIG_Python_SetSwigThis(obj[0], obj[1]); + } + return SWIG_Py_Void(); + } } /* Create a new pointer object */ -SWIGRUNTIME(PyObject *) -SWIG_NewPointerObj(void *ptr, swig_type_info *type, int own) { - PyObject *robj; - if (!ptr) { - Py_INCREF(Py_None); - return Py_None; - } -#ifdef SWIG_COBJECT_TYPES - robj = PyCObject_FromVoidPtrAndDesc((void *) ptr, (char *) type->name, NULL); -#else - { - char result[1024]; - char *r = result; - *(r++) = '_'; - r = SWIG_PackData(r,&ptr,sizeof(void *)); - strcpy(r,type->name); - robj = PyString_FromString(result); - } + +SWIGRUNTIME PyObject * +SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) { + SwigPyClientData *clientdata; + PyObject * robj; + int own; + + if (!ptr) + return SWIG_Py_Void(); + + clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; + own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; + if (clientdata && clientdata->pytype) { + SwigPyObject *newobj; + if (flags & SWIG_BUILTIN_TP_INIT) { + newobj = (SwigPyObject*) self; + if (newobj->ptr) { + PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0); + while (newobj->next) + newobj = (SwigPyObject *) newobj->next; + newobj->next = next_self; + newobj = (SwigPyObject *)next_self; +#ifdef SWIGPYTHON_BUILTIN + newobj->dict = 0; #endif - if (!robj || (robj == Py_None)) return robj; - if (type->clientdata) { - PyObject *inst; - PyObject *args = Py_BuildValue((char*)"(O)", robj); - Py_DECREF(robj); - inst = PyObject_CallObject((PyObject *) type->clientdata, args); - Py_DECREF(args); - if (inst) { - if (own) { - PyObject *n = PyInt_FromLong(1); - PyObject_SetAttrString(inst,(char*)"thisown",n); - Py_DECREF(n); } - robj = inst; + } else { + newobj = PyObject_New(SwigPyObject, clientdata->pytype); +#ifdef SWIGPYTHON_BUILTIN + newobj->dict = 0; +#endif } + if (newobj) { + newobj->ptr = ptr; + newobj->ty = type; + newobj->own = own; + newobj->next = 0; + return (PyObject*) newobj; + } + return SWIG_Py_Void(); + } + + assert(!(flags & SWIG_BUILTIN_TP_INIT)); + + robj = SwigPyObject_New(ptr, type, own); + if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { + PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); + Py_DECREF(robj); + robj = inst; } return robj; } -SWIGRUNTIME(PyObject *) -SWIG_NewPackedObj(void *ptr, int sz, swig_type_info *type) { - char result[1024]; - char *r = result; - if ((2*sz + 1 + strlen(type->name)) > 1000) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,ptr,sz); - strcpy(r,type->name); - return PyString_FromString(result); +/* Create a new packed object */ + +SWIGRUNTIMEINLINE PyObject * +SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { + return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); } -/* Install Constants */ -SWIGRUNTIME(void) -SWIG_InstallConstants(PyObject *d, swig_const_info constants[]) { - int i; - PyObject *obj; - for (i = 0; constants[i].type; i++) { - switch(constants[i].type) { - case SWIG_PY_INT: - obj = PyInt_FromLong(constants[i].lvalue); - break; - case SWIG_PY_FLOAT: - obj = PyFloat_FromDouble(constants[i].dvalue); - break; - case SWIG_PY_STRING: - obj = PyString_FromString((char *) constants[i].pvalue); - break; - case SWIG_PY_POINTER: - obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); - break; - case SWIG_PY_BINARY: - obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); - break; - default: - obj = 0; - break; +/* -----------------------------------------------------------------------------* + * Get type list + * -----------------------------------------------------------------------------*/ + +#ifdef SWIG_LINK_RUNTIME +void *SWIG_ReturnGlobalTypeList(void *); +#endif + +SWIGRUNTIME swig_module_info * +SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { + static void *type_pointer = (void *)0; + /* first check if module already created */ + if (!type_pointer) { +#ifdef SWIG_LINK_RUNTIME + type_pointer = SWIG_ReturnGlobalTypeList((void *)0); +#else +# ifdef SWIGPY_USE_CAPSULE + type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); +# else + type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, + (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +# endif + if (PyErr_Occurred()) { + PyErr_Clear(); + type_pointer = (void *)0; } - if (obj) { - PyDict_SetItemString(d,constants[i].name,obj); +#endif + } + return (swig_module_info *) type_pointer; +} + +#if PY_MAJOR_VERSION < 2 +/* PyModule_AddObject function was introduced in Python 2.0. The following function + is copied out of Python/modsupport.c in python version 2.3.4 */ +SWIGINTERN int +PyModule_AddObject(PyObject *m, char *name, PyObject *o) +{ + PyObject *dict; + if (!PyModule_Check(m)) { + PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); + return SWIG_ERROR; + } + if (!o) { + PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value"); + return SWIG_ERROR; + } + + dict = PyModule_GetDict(m); + if (dict == NULL) { + /* Internal error -- modules must have a dict! */ + PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", + PyModule_GetName(m)); + return SWIG_ERROR; + } + if (PyDict_SetItemString(dict, name, o)) + return SWIG_ERROR; + Py_DECREF(o); + return SWIG_OK; +} +#endif + +SWIGRUNTIME void +#ifdef SWIGPY_USE_CAPSULE +SWIG_Python_DestroyModule(PyObject *obj) +#else +SWIG_Python_DestroyModule(void *vptr) +#endif +{ +#ifdef SWIGPY_USE_CAPSULE + swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); +#else + swig_module_info *swig_module = (swig_module_info *) vptr; +#endif + swig_type_info **types = swig_module->types; + size_t i; + for (i =0; i < swig_module->size; ++i) { + swig_type_info *ty = types[i]; + if (ty->owndata) { + SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; + if (data) SwigPyClientData_Del(data); + } + } + Py_DECREF(SWIG_This()); + swig_this = NULL; +} + +SWIGRUNTIME void +SWIG_Python_SetModule(swig_module_info *swig_module) { +#if PY_VERSION_HEX >= 0x03000000 + /* Add a dummy module object into sys.modules */ + PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); +#endif +#ifdef SWIGPY_USE_CAPSULE + PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); + if (pointer && module) { + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); + } else { + Py_XDECREF(pointer); + } +#else + PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); + if (pointer && module) { + PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); + } else { + Py_XDECREF(pointer); + } +#endif +} + +/* The python cached type query */ +SWIGRUNTIME PyObject * +SWIG_Python_TypeCache(void) { + static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); + return cache; +} + +SWIGRUNTIME swig_type_info * +SWIG_Python_TypeQuery(const char *type) +{ + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *key = SWIG_Python_str_FromChar(type); + PyObject *obj = PyDict_GetItem(cache, key); + swig_type_info *descriptor; + if (obj) { +#ifdef SWIGPY_USE_CAPSULE + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); +#else + descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif + } else { + swig_module_info *swig_module = SWIG_GetModule(0); + descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); + if (descriptor) { +#ifdef SWIGPY_USE_CAPSULE + obj = PyCapsule_New((void*) descriptor, NULL, NULL); +#else + obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif + PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } } + Py_DECREF(key); + return descriptor; } +/* + For backward compatibility only +*/ +#define SWIG_POINTER_EXCEPTION 0 +#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) +#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) + +SWIGRUNTIME int +SWIG_Python_AddErrMesg(const char* mesg, int infront) +{ + if (PyErr_Occurred()) { + PyObject *type = 0; + PyObject *value = 0; + PyObject *traceback = 0; + PyErr_Fetch(&type, &value, &traceback); + if (value) { + char *tmp; + PyObject *old_str = PyObject_Str(value); + Py_XINCREF(type); + PyErr_Clear(); + if (infront) { + PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); + } else { + PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); + } + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(old_str); + } + return 1; + } else { + return 0; + } +} + +SWIGRUNTIME int +SWIG_Python_ArgFail(int argnum) +{ + if (PyErr_Occurred()) { + /* add information about failing argument */ + char mesg[256]; + PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); + return SWIG_Python_AddErrMesg(mesg, 1); + } else { + return 0; + } +} + +SWIGRUNTIMEINLINE const char * +SwigPyObject_GetDesc(PyObject *self) +{ + SwigPyObject *v = (SwigPyObject *)self; + swig_type_info *ty = v ? v->ty : 0; + return ty ? ty->str : ""; +} + +SWIGRUNTIME void +SWIG_Python_TypeError(const char *type, PyObject *obj) +{ + if (type) { +#if defined(SWIG_COBJECT_TYPES) + if (obj && SwigPyObject_Check(obj)) { + const char *otype = (const char *) SwigPyObject_GetDesc(obj); + if (otype) { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", + type, otype); + return; + } + } else #endif + { + const char *otype = (obj ? obj->ob_type->tp_name : 0); + if (otype) { + PyObject *str = PyObject_Str(obj); + const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; + if (cstr) { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", + type, otype, cstr); + SWIG_Python_str_DelForPy3(cstr); + } else { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", + type, otype); + } + Py_XDECREF(str); + return; + } + } + PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); + } else { + PyErr_Format(PyExc_TypeError, "unexpected type is received"); + } +} + + +/* Convert a pointer value, signal an exception on a type mismatch */ +SWIGRUNTIME void * +SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { + void *result; + if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { + PyErr_Clear(); +#if SWIG_POINTER_EXCEPTION + if (flags) { + SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); + SWIG_Python_ArgFail(argnum); + } +#endif + } + return result; +} + +#ifdef SWIGPYTHON_BUILTIN +SWIGRUNTIME int +SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { + PyTypeObject *tp = obj->ob_type; + PyObject *descr; + PyObject *encoded_name; + descrsetfunc f; + int res = -1; + +# ifdef Py_USING_UNICODE + if (PyString_Check(name)) { + name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL); + if (!name) + return -1; + } else if (!PyUnicode_Check(name)) +# else + if (!PyString_Check(name)) +# endif + { + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); + return -1; + } else { + Py_INCREF(name); + } + + if (!tp->tp_dict) { + if (PyType_Ready(tp) < 0) + goto done; + } + + descr = _PyType_Lookup(tp, name); + f = NULL; + if (descr != NULL) + f = descr->ob_type->tp_descr_set; + if (!f) { + if (PyString_Check(name)) { + encoded_name = name; + Py_INCREF(name); + } else { + encoded_name = PyUnicode_AsUTF8String(name); + } + PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); + Py_DECREF(encoded_name); + } else { + res = f(descr, obj, value); + } + + done: + Py_DECREF(name); + return res; +} +#endif + + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +SWIGINTERN Py_hash_t +SwigPyObject_hash(PyObject *obj) { + SwigPyObject *sobj = (SwigPyObject *)obj; + void *ptr = sobj->ptr; + return (Py_hash_t)ptr; +} + +SWIGINTERN Py_hash_t +SWIG_PyNumber_AsPyHash(PyObject *obj) { + Py_hash_t result = -1; +#if PY_VERSION_HEX < 0x03020000 +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(obj)) + result = PyInt_AsLong(obj); + else +#endif + if (PyLong_Check(obj)) + result = PyLong_AsLong(obj); +#else + if (PyNumber_Check(obj)) + result = PyNumber_AsSsize_t(obj, NULL); +#endif + else + PyErr_Format(PyExc_TypeError, "Wrong type for hash function"); + return PyErr_Occurred() ? -1 : result; +} + +SWIGINTERN int +SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) { + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); + return -1; +} + +SWIGINTERN void +SwigPyBuiltin_BadDealloc(PyObject *obj) { + SwigPyObject *sobj = (SwigPyObject *)obj; + if (sobj->own) { + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name); + } +} + +typedef struct { + PyCFunction get; + PyCFunction set; +} SwigPyGetSet; + +SWIGINTERN PyObject * +SwigPyBuiltin_GetterClosure (PyObject *obj, void *closure) { + SwigPyGetSet *getset; + PyObject *tuple, *result; + if (!closure) + return SWIG_Py_Void(); + getset = (SwigPyGetSet *)closure; + if (!getset->get) + return SWIG_Py_Void(); + tuple = PyTuple_New(0); + assert(tuple); + result = (*getset->get)(obj, tuple); + Py_DECREF(tuple); + return result; +} + +SWIGINTERN PyObject * +SwigPyBuiltin_FunpackGetterClosure (PyObject *obj, void *closure) { + SwigPyGetSet *getset; + PyObject *result; + if (!closure) + return SWIG_Py_Void(); + getset = (SwigPyGetSet *)closure; + if (!getset->get) + return SWIG_Py_Void(); + result = (*getset->get)(obj, NULL); + return result; +} + +SWIGINTERN int +SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { + SwigPyGetSet *getset; + PyObject *tuple, *result; + if (!closure) { + PyErr_Format(PyExc_TypeError, "Missing getset closure"); + return -1; + } + getset = (SwigPyGetSet *)closure; + if (!getset->set) { + PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); + return -1; + } + tuple = PyTuple_New(1); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, val); + Py_XINCREF(val); + result = (*getset->set)(obj, tuple); + Py_DECREF(tuple); + Py_XDECREF(result); + return result ? 0 : -1; +} + +SWIGINTERN int +SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) { + SwigPyGetSet *getset; + PyObject *result; + if (!closure) { + PyErr_Format(PyExc_TypeError, "Missing getset closure"); + return -1; + } + getset = (SwigPyGetSet *)closure; + if (!getset->set) { + PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); + return -1; + } + result = (*getset->set)(obj, val); + Py_XDECREF(result); + return result ? 0 : -1; +} + +SWIGINTERN void +SwigPyStaticVar_dealloc(PyDescrObject *descr) { + _PyObject_GC_UNTRACK(descr); + Py_XDECREF(PyDescr_TYPE(descr)); + Py_XDECREF(PyDescr_NAME(descr)); + PyObject_GC_Del(descr); +} + +SWIGINTERN PyObject * +SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { +#if PY_VERSION_HEX >= 0x03000000 + + return PyUnicode_FromFormat("", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); +#else + return PyString_FromFormat("", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); +#endif +} + +SWIGINTERN int +SwigPyStaticVar_traverse(PyObject *self, visitproc visit, void *arg) { + PyDescrObject *descr; + descr = (PyDescrObject *)self; + Py_VISIT((PyObject*) PyDescr_TYPE(descr)); + return 0; +} + +SWIGINTERN PyObject * +SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNUSEDPARM(type)) { + if (descr->d_getset->get != NULL) + return descr->d_getset->get(obj, descr->d_getset->closure); +#if PY_VERSION_HEX >= 0x03000000 + PyErr_Format(PyExc_AttributeError, "attribute '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); +#else + PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); +#endif + return NULL; +} + +SWIGINTERN int +SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) { + if (descr->d_getset->set != NULL) + return descr->d_getset->set(obj, value, descr->d_getset->closure); +#if PY_VERSION_HEX >= 0x03000000 + PyErr_Format(PyExc_AttributeError, "attribute '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); +#else + PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); +#endif + return -1; +} + +SWIGINTERN int +SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) { + PyObject *attribute; + PyTypeObject *type; + descrsetfunc local_set; + + assert(PyType_Check(typeobject)); + type = (PyTypeObject *)typeobject; + attribute = _PyType_Lookup(type, name); + if (attribute != NULL) { + /* Implement descriptor functionality, if any */ + local_set = attribute->ob_type->tp_descr_set; + if (local_set != NULL) + return local_set(attribute, (PyObject *)type, value); +#if PY_VERSION_HEX >= 0x03000000 + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name); +#else + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400s'", type->tp_name, PyString_AS_STRING(name)); +#endif + } else { +#if PY_VERSION_HEX >= 0x03000000 + PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name); +#else + PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); +#endif + } + + return -1; +} + +SWIGINTERN PyTypeObject* +SwigPyStaticVar_Type(void) { + static PyTypeObject staticvar_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(&PyType_Type, 0) +#else + PyObject_HEAD_INIT(&PyType_Type) + 0, /* ob_size */ +#endif + "swig_static_var_getset_descriptor", /* tp_name */ + sizeof(PyGetSetDescrObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + (reprfunc)SwigPyStaticVar_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ + 0, /* tp_doc */ + SwigPyStaticVar_traverse, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + (descrgetfunc)SwigPyStaticVar_get, /* tp_descr_get */ + (descrsetfunc)SwigPyStaticVar_set, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ +#endif + }; + staticvar_type = tmp; + type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + staticvar_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&staticvar_type) < 0) + return NULL; +#endif + } + return &staticvar_type; +} + +SWIGINTERN PyTypeObject* +SwigPyObjectType(void) { + static char swigpyobjecttype_doc[] = "Metaclass for SWIG wrapped types"; + static PyTypeObject swigpyobjecttype_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(&PyType_Type, 0) +#else + PyObject_HEAD_INIT(&PyType_Type) + 0, /* ob_size */ +#endif + "SwigPyObjectType", /* tp_name */ + PyType_Type.tp_basicsize, /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + SwigPyObjectType_setattro, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ + swigpyobjecttype_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ +#endif + }; + swigpyobjecttype_type = tmp; + type_init = 1; + swigpyobjecttype_type.tp_base = &PyType_Type; +#if PY_VERSION_HEX < 0x02020000 + swigpyobjecttype_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&swigpyobjecttype_type) < 0) + return NULL; +#endif + } + return &swigpyobjecttype_type; +} + +SWIGINTERN PyGetSetDescrObject * +SwigPyStaticVar_new_getset(PyTypeObject *type, PyGetSetDef *getset) { + + PyGetSetDescrObject *descr; + descr = (PyGetSetDescrObject *)PyType_GenericAlloc(SwigPyStaticVar_Type(), 0); + assert(descr); + Py_XINCREF(type); + PyDescr_TYPE(descr) = type; + PyDescr_NAME(descr) = PyString_InternFromString(getset->name); + descr->d_getset = getset; + if (PyDescr_NAME(descr) == NULL) { + Py_DECREF(descr); + descr = NULL; + } + return descr; +} + +SWIGINTERN void +SwigPyBuiltin_InitBases (PyTypeObject *type, PyTypeObject **bases) { + int base_count = 0; + PyTypeObject **b; + PyObject *tuple; + int i; + + if (!bases[0]) { + bases[0] = SwigPyObject_type(); + bases[1] = NULL; + } + type->tp_base = bases[0]; + Py_INCREF((PyObject *)bases[0]); + for (b = bases; *b != NULL; ++b) + ++base_count; + tuple = PyTuple_New(base_count); + for (i = 0; i < base_count; ++i) { + PyTuple_SET_ITEM(tuple, i, (PyObject *)bases[i]); + Py_INCREF((PyObject *)bases[i]); + } + type->tp_bases = tuple; +} + +SWIGINTERN PyObject * +SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { + PyObject *result; + result = (PyObject *)SWIG_Python_GetSwigThis(self); + Py_XINCREF(result); + return result; +} + +SWIGINTERN void +SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) +{ +#if PY_VERSION_HEX >= 0x03000000 + type->ob_base.ob_base.ob_type = metatype; +#else + type->ob_type = metatype; +#endif +} + + +/* Start of callback function macros for use in PyTypeObject */ + +typedef PyObject *(*SwigPyWrapperFunction)(PyObject *, PyObject *); + +#define SWIGPY_UNARYFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_unaryfunc_closure(PyObject *a) { \ + return SwigPyBuiltin_unaryfunc_closure(wrapper, a); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_unaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) { + return wrapper(a, NULL); +} + +#define SWIGPY_DESTRUCTOR_CLOSURE(wrapper) \ +SWIGINTERN void \ +wrapper##_destructor_closure(PyObject *a) { \ + SwigPyBuiltin_destructor_closure(wrapper, #wrapper, a); \ +} +SWIGINTERN void +SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) { + SwigPyObject *sobj; + sobj = (SwigPyObject *)a; + Py_XDECREF(sobj->dict); + if (sobj->own) { + PyObject *o; + PyObject *val = 0, *type = 0, *tb = 0; + PyErr_Fetch(&val, &type, &tb); + o = wrapper(a, NULL); + if (!o) { + PyObject *deallocname = PyString_FromString(wrappername); + PyErr_WriteUnraisable(deallocname); + Py_DECREF(deallocname); + } + PyErr_Restore(val, type, tb); + Py_XDECREF(o); + } + if (PyType_IS_GC(a->ob_type)) { + PyObject_GC_Del(a); + } else { + PyObject_Del(a); + } +} + +#define SWIGPY_INQUIRY_CLOSURE(wrapper) \ +SWIGINTERN int \ +wrapper##_inquiry_closure(PyObject *a) { \ + return SwigPyBuiltin_inquiry_closure(wrapper, a); \ +} +SWIGINTERN int +SwigPyBuiltin_inquiry_closure(SwigPyWrapperFunction wrapper, PyObject *a) { + PyObject *pyresult; + int result; + pyresult = wrapper(a, NULL); + result = pyresult && PyObject_IsTrue(pyresult) ? 1 : 0; + Py_XDECREF(pyresult); + return result; +} + +#define SWIGPY_GETITERFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_getiterfunc_closure(PyObject *a) { \ + return SwigPyBuiltin_getiterfunc_closure(wrapper, a); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_getiterfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) { + return wrapper(a, NULL); +} + +#define SWIGPY_BINARYFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_binaryfunc_closure(PyObject *a, PyObject *b) { \ + return SwigPyBuiltin_binaryfunc_closure(wrapper, a, b); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_binaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b) { + PyObject *tuple, *result; + tuple = PyTuple_New(1); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, b); + Py_XINCREF(b); + result = wrapper(a, tuple); + Py_DECREF(tuple); + return result; +} + +typedef ternaryfunc ternarycallfunc; + +#define SWIGPY_TERNARYFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_ternaryfunc_closure(PyObject *a, PyObject *b, PyObject *c) { \ + return SwigPyBuiltin_ternaryfunc_closure(wrapper, a, b, c); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_ternaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b, PyObject *c) { + PyObject *tuple, *result; + tuple = PyTuple_New(2); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, b); + PyTuple_SET_ITEM(tuple, 1, c); + Py_XINCREF(b); + Py_XINCREF(c); + result = wrapper(a, tuple); + Py_DECREF(tuple); + return result; +} + +#define SWIGPY_TERNARYCALLFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_ternarycallfunc_closure(PyObject *a, PyObject *b, PyObject *c) { \ + return SwigPyBuiltin_ternarycallfunc_closure(wrapper, a, b, c); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_ternarycallfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b, PyObject *c) { + (void) c; + return wrapper(a, b); +} + +#define SWIGPY_LENFUNC_CLOSURE(wrapper) \ +SWIGINTERN Py_ssize_t \ +wrapper##_lenfunc_closure(PyObject *a) { \ + return SwigPyBuiltin_lenfunc_closure(wrapper, a); \ +} +SWIGINTERN Py_ssize_t +SwigPyBuiltin_lenfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) { + PyObject *resultobj; + Py_ssize_t result; + resultobj = wrapper(a, NULL); + result = PyNumber_AsSsize_t(resultobj, NULL); + Py_DECREF(resultobj); + return result; +} + +#define SWIGPY_SSIZESSIZEARGFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_ssizessizeargfunc_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c) { \ + return SwigPyBuiltin_ssizessizeargfunc_closure(wrapper, a, b, c); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_ssizessizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b, Py_ssize_t c) { + PyObject *tuple, *result; + tuple = PyTuple_New(2); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); + PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c)); + result = wrapper(a, tuple); + Py_DECREF(tuple); + return result; +} + +#define SWIGPY_SSIZESSIZEOBJARGPROC_CLOSURE(wrapper) \ +SWIGINTERN int \ +wrapper##_ssizessizeobjargproc_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) { \ + return SwigPyBuiltin_ssizessizeobjargproc_closure(wrapper, a, b, c, d); \ +} +SWIGINTERN int +SwigPyBuiltin_ssizessizeobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) { + PyObject *tuple, *resultobj; + int result; + tuple = PyTuple_New(d ? 3 : 2); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); + PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c)); + if (d) { + PyTuple_SET_ITEM(tuple, 2, d); + Py_INCREF(d); + } + resultobj = wrapper(a, tuple); + result = resultobj ? 0 : -1; + Py_DECREF(tuple); + Py_XDECREF(resultobj); + return result; +} + +#define SWIGPY_SSIZEARGFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_ssizeargfunc_closure(PyObject *a, Py_ssize_t b) { \ + return SwigPyBuiltin_funpack_ssizeargfunc_closure(wrapper, a, b); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_funpack_ssizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b) { + PyObject *tuple, *result; + tuple = PyTuple_New(1); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); + result = wrapper(a, tuple); + Py_DECREF(tuple); + return result; +} + +#define SWIGPY_FUNPACK_SSIZEARGFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_ssizeargfunc_closure(PyObject *a, Py_ssize_t b) { \ + return SwigPyBuiltin_ssizeargfunc_closure(wrapper, a, b); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_ssizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b) { + PyObject *arg, *result; + arg = _PyLong_FromSsize_t(b); + result = wrapper(a, arg); + Py_DECREF(arg); + return result; +} + +#define SWIGPY_SSIZEOBJARGPROC_CLOSURE(wrapper) \ +SWIGINTERN int \ +wrapper##_ssizeobjargproc_closure(PyObject *a, Py_ssize_t b, PyObject *c) { \ + return SwigPyBuiltin_ssizeobjargproc_closure(wrapper, a, b, c); \ +} +SWIGINTERN int +SwigPyBuiltin_ssizeobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b, PyObject *c) { + PyObject *tuple, *resultobj; + int result; + tuple = PyTuple_New(2); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); + PyTuple_SET_ITEM(tuple, 1, c); + Py_XINCREF(c); + resultobj = wrapper(a, tuple); + result = resultobj ? 0 : -1; + Py_XDECREF(resultobj); + Py_DECREF(tuple); + return result; +} + +#define SWIGPY_OBJOBJARGPROC_CLOSURE(wrapper) \ +SWIGINTERN int \ +wrapper##_objobjargproc_closure(PyObject *a, PyObject *b, PyObject *c) { \ + return SwigPyBuiltin_objobjargproc_closure(wrapper, a, b, c); \ +} +SWIGINTERN int +SwigPyBuiltin_objobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b, PyObject *c) { + PyObject *tuple, *resultobj; + int result; + tuple = PyTuple_New(c ? 2 : 1); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, b); + Py_XINCREF(b); + if (c) { + PyTuple_SET_ITEM(tuple, 1, c); + Py_XINCREF(c); + } + resultobj = wrapper(a, tuple); + result = resultobj ? 0 : -1; + Py_XDECREF(resultobj); + Py_DECREF(tuple); + return result; +} + +#define SWIGPY_REPRFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_reprfunc_closure(PyObject *a) { \ + return SwigPyBuiltin_reprfunc_closure(wrapper, a); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_reprfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) { + return wrapper(a, NULL); +} + +#define SWIGPY_HASHFUNC_CLOSURE(wrapper) \ +SWIGINTERN Py_hash_t \ +wrapper##_hashfunc_closure(PyObject *a) { \ + return SwigPyBuiltin_hashfunc_closure(wrapper, a); \ +} +SWIGINTERN Py_hash_t +SwigPyBuiltin_hashfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) { + PyObject *pyresult; + Py_hash_t result; + pyresult = wrapper(a, NULL); + if (!pyresult) + return -1; + result = SWIG_PyNumber_AsPyHash(pyresult); + Py_DECREF(pyresult); + return result; +} + +#define SWIGPY_ITERNEXTFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_iternextfunc_closure(PyObject *a) { \ + return SwigPyBuiltin_iternextfunc_closure(wrapper, a);\ +} +SWIGINTERN PyObject * +SwigPyBuiltin_iternextfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) { + return wrapper(a, NULL); +} + +/* End of callback function macros for use in PyTypeObject */ #ifdef __cplusplus } @@ -534,31 +3702,76 @@ SWIG_InstallConstants(PyObject *d, swig_const_info constants[]) { +#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) +#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else /* -------- TYPES TABLE (BEGIN) -------- */ -#define SWIGTYPE_p_chmUnitInfo swig_types[0] -#define SWIGTYPE_p_unsigned_char swig_types[1] -#define SWIGTYPE_p_char swig_types[2] -#define SWIGTYPE_CHM_ENUMERATOR swig_types[3] -#define SWIGTYPE_p_chmFile swig_types[4] -static swig_type_info *swig_types[6]; +#define SWIGTYPE_p_SwigPyObject swig_types[0] +#define SWIGTYPE_p_char swig_types[1] +#define SWIGTYPE_p_chmFile swig_types[2] +#define SWIGTYPE_p_chmUnitInfo swig_types[3] +#define SWIGTYPE_p_f_p_struct_chmFile_p_struct_chmUnitInfo_p_void__int swig_types[4] +#define SWIGTYPE_p_long_long swig_types[5] +#define SWIGTYPE_p_unsigned_char swig_types[6] +#define SWIGTYPE_p_unsigned_long_long swig_types[7] +static swig_type_info *swig_types[9]; +static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0}; +#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) +#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ +#if (PY_VERSION_HEX <= 0x02000000) +# if !defined(SWIG_PYTHON_CLASSIC) +# error "This python version requires swig to be run with the '-classic' option" +# endif +#endif +#if (PY_VERSION_HEX <= 0x02020000) +# error "This python version requires swig to be run with the '-nomodern' option" +#endif +#if (PY_VERSION_HEX <= 0x02020000) +# error "This python version requires swig to be run with the '-nomodernargs' option" +#endif +#ifndef METH_O +# error "This python version requires swig to be run with the '-nofastunpack' option" +#endif +#ifdef SWIG_TypeQuery +# undef SWIG_TypeQuery +#endif +#define SWIG_TypeQuery SWIG_Python_TypeQuery /*----------------------------------------------- - @(target):= chmlib.so + @(target):= _chmlib.so ------------------------------------------------*/ -#define SWIG_init initchmlib +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_init PyInit__chmlib +#else +# define SWIG_init init_chmlib + +#endif #define SWIG_name "chmlib" +#define SWIGVERSION 0x030012 +#define SWIG_VERSION SWIGVERSION + + +#define SWIG_as_voidptr(a) (void *)((const void *)(a)) +#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) + + +#include + + /* - Copyright (C) 2003 Rubens Ramos + Copyright (C) 2003 Rubens Ramos + + Based on code by: + Copyright (C) 2003 Razvan Cojocaru pychm is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -570,7 +3783,7 @@ static swig_type_info *swig_types[6]; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - $Id: swig_chm.c,v 1.1.1.1 2003/12/02 12:38:14 rubensr Exp $ + $Id: swig_chm.i,v 1.1.1.1 2003/12/02 12:38:14 rubensr Exp $ */ #include "chm_lib.h" #include @@ -628,487 +3841,2075 @@ int dummy_enumerator (struct chmFile *h, } -static PyObject* t_output_helper(PyObject* target, PyObject* o) { - PyObject* o2; - PyObject* o3; - - if (!target) { - target = o; - } else if (target == Py_None) { - Py_DECREF(Py_None); - target = o; - } else { - if (!PyTuple_Check(target)) { - o2 = target; - target = PyTuple_New(1); - PyTuple_SetItem(target, 0, o2); - } - o3 = PyTuple_New(1); - PyTuple_SetItem(o3, 0, o); - - o2 = target; - target = PySequence_Concat(o2, o3); - Py_DECREF(o2); - Py_DECREF(o3); - } - return target; +SWIGINTERNINLINE PyObject* + SWIG_From_int (int value) +{ + return PyInt_FromLong((long) value); } + +SWIGINTERN int +SWIG_AsVal_double (PyObject *obj, double *val) +{ + int res = SWIG_TypeError; + if (PyFloat_Check(obj)) { + if (val) *val = PyFloat_AsDouble(obj); + return SWIG_OK; +#if PY_VERSION_HEX < 0x03000000 + } else if (PyInt_Check(obj)) { + if (val) *val = (double) PyInt_AsLong(obj); + return SWIG_OK; +#endif + } else if (PyLong_Check(obj)) { + double v = PyLong_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + double d = PyFloat_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = d; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); + } else { + PyErr_Clear(); + } + } + } +#endif + return res; +} + + +#include + + +#include + + +SWIGINTERNINLINE int +SWIG_CanCastAsInteger(double *d, double min, double max) { + double x = *d; + if ((min <= x && x <= max)) { + double fx = floor(x); + double cx = ceil(x); + double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ + if ((errno == EDOM) || (errno == ERANGE)) { + errno = 0; + } else { + double summ, reps, diff; + if (rd < x) { + diff = x - rd; + } else if (rd > x) { + diff = rd - x; + } else { + return 1; + } + summ = rd + x; + reps = diff/summ; + if (reps < 8*DBL_EPSILON) { + *d = rd; + return 1; + } + } + } + return 0; +} + + +SWIGINTERN int +SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) +{ +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(obj)) { + long v = PyInt_AsLong(obj); + if (v >= 0) { + if (val) *val = v; + return SWIG_OK; + } else { + return SWIG_OverflowError; + } + } else +#endif + if (PyLong_Check(obj)) { + unsigned long v = PyLong_AsUnsignedLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + return SWIG_OverflowError; + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + unsigned long v = PyLong_AsUnsignedLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) { + if (val) *val = (unsigned long)(d); + return res; + } + } + } +#endif + return SWIG_TypeError; +} + + +#include +#if !defined(SWIG_NO_LLONG_MAX) +# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) +# define LLONG_MAX __LONG_LONG_MAX__ +# define LLONG_MIN (-LLONG_MAX - 1LL) +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +# endif +#endif + + +#if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE) +# define SWIG_LONG_LONG_AVAILABLE +#endif + + +#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERN int +SWIG_AsVal_unsigned_SS_long_SS_long (PyObject *obj, unsigned long long *val) +{ + int res = SWIG_TypeError; + if (PyLong_Check(obj)) { + unsigned long long v = PyLong_AsUnsignedLongLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + res = SWIG_OverflowError; + } + } else { + unsigned long v; + res = SWIG_AsVal_unsigned_SS_long (obj,&v); + if (SWIG_IsOK(res)) { + if (val) *val = v; + return res; + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + const double mant_max = 1LL << DBL_MANT_DIG; + double d; + res = SWIG_AsVal_double (obj,&d); + if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, 0, mant_max)) + return SWIG_OverflowError; + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) { + if (val) *val = (unsigned long long)(d); + return SWIG_AddCast(res); + } + res = SWIG_TypeError; + } +#endif + return res; +} +#endif + + +#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERNINLINE PyObject* +SWIG_From_unsigned_SS_long_SS_long (unsigned long long value) +{ + return (value > LONG_MAX) ? + PyLong_FromUnsignedLongLong(value) : PyInt_FromLong((long)(value)); +} +#endif + + +SWIGINTERN int +SWIG_AsVal_long (PyObject *obj, long* val) +{ +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(obj)) { + if (val) *val = PyInt_AsLong(obj); + return SWIG_OK; + } else +#endif + if (PyLong_Check(obj)) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + return SWIG_OverflowError; + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + long v = PyInt_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { + if (val) *val = (long)(d); + return res; + } + } + } +#endif + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsVal_int (PyObject * obj, int *val) +{ + long v; + int res = SWIG_AsVal_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v < INT_MIN || v > INT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = (int)(v); + } + } + return res; +} + + +SWIGINTERN swig_type_info* +SWIG_pchar_descriptor(void) +{ + static int init = 0; + static swig_type_info* info = 0; + if (!init) { + info = SWIG_TypeQuery("_p_char"); + init = 1; + } + return info; +} + + +SWIGINTERN int +SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) +{ +#if PY_VERSION_HEX>=0x03000000 +#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + if (PyBytes_Check(obj)) +#else + if (PyUnicode_Check(obj)) +#endif +#else + if (PyString_Check(obj)) +#endif + { + char *cstr; Py_ssize_t len; +#if PY_VERSION_HEX>=0x03000000 +#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + if (!alloc && cptr) { + /* We can't allow converting without allocation, since the internal + representation of string in Python 3 is UCS-2/UCS-4 but we require + a UTF-8 representation. + TODO(bhy) More detailed explanation */ + return SWIG_RuntimeError; + } + obj = PyUnicode_AsUTF8String(obj); + if(alloc) *alloc = SWIG_NEWOBJ; +#endif + PyBytes_AsStringAndSize(obj, &cstr, &len); +#else + PyString_AsStringAndSize(obj, &cstr, &len); +#endif + if (cptr) { + if (alloc) { + /* + In python the user should not be able to modify the inner + string representation. To warranty that, if you define + SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string + buffer is always returned. + + The default behavior is just to return the pointer value, + so, be careful. + */ +#if defined(SWIG_PYTHON_SAFE_CSTRINGS) + if (*alloc != SWIG_OLDOBJ) +#else + if (*alloc == SWIG_NEWOBJ) +#endif + { + *cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1)); + *alloc = SWIG_NEWOBJ; + } else { + *cptr = cstr; + *alloc = SWIG_OLDOBJ; + } + } else { +#if PY_VERSION_HEX>=0x03000000 +#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + *cptr = PyBytes_AsString(obj); +#else + assert(0); /* Should never reach here with Unicode strings in Python 3 */ +#endif +#else + *cptr = SWIG_Python_str_AsChar(obj); +#endif + } + } + if (psize) *psize = len + 1; +#if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + Py_XDECREF(obj); +#endif + return SWIG_OK; + } else { +#if defined(SWIG_PYTHON_2_UNICODE) +#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) +#error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" +#endif +#if PY_VERSION_HEX<0x03000000 + if (PyUnicode_Check(obj)) { + char *cstr; Py_ssize_t len; + if (!alloc && cptr) { + return SWIG_RuntimeError; + } + obj = PyUnicode_AsUTF8String(obj); + if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) { + if (cptr) { + if (alloc) *alloc = SWIG_NEWOBJ; + *cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1)); + } + if (psize) *psize = len + 1; + + Py_XDECREF(obj); + return SWIG_OK; + } else { + Py_XDECREF(obj); + } + } +#endif +#endif + + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + if (pchar_descriptor) { + void* vptr = 0; + if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = (char *) vptr; + if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } + } + } + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsCharArray(PyObject * obj, char *val, size_t size) +{ + char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ; + int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc); + if (SWIG_IsOK(res)) { + /* special case of single char conversion when we don't need space for NUL */ + if (size == 1 && csize == 2 && cptr && !cptr[1]) --csize; + if (csize <= size) { + if (val) { + if (csize) memcpy(val, cptr, csize*sizeof(char)); + if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char)); + } + if (alloc == SWIG_NEWOBJ) { + free((char*)cptr); + res = SWIG_DelNewMask(res); + } + return res; + } + if (alloc == SWIG_NEWOBJ) free((char*)cptr); + } + return SWIG_TypeError; +} + + +SWIGINTERNINLINE PyObject * +SWIG_FromCharPtrAndSize(const char* carray, size_t size) +{ + if (carray) { + if (size > INT_MAX) { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + return pchar_descriptor ? + SWIG_InternalNewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void(); + } else { +#if PY_VERSION_HEX >= 0x03000000 +#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + return PyBytes_FromStringAndSize(carray, (Py_ssize_t)(size)); +#else +#if PY_VERSION_HEX >= 0x03010000 + return PyUnicode_DecodeUTF8(carray, (Py_ssize_t)(size), "surrogateescape"); +#else + return PyUnicode_FromStringAndSize(carray, (Py_ssize_t)(size)); +#endif +#endif +#else + return PyString_FromStringAndSize(carray, (Py_ssize_t)(size)); +#endif + } + } else { + return SWIG_Py_Void(); + } +} + + +SWIGINTERN size_t +SWIG_strnlen(const char* s, size_t maxlen) +{ + const char *p; + for (p = s; maxlen-- && *p; p++) + ; + return p - s; +} + + + + + +#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERN int +SWIG_AsVal_long_SS_long (PyObject *obj, long long *val) +{ + int res = SWIG_TypeError; + if (PyLong_Check(obj)) { + long long v = PyLong_AsLongLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + res = SWIG_OverflowError; + } + } else { + long v; + res = SWIG_AsVal_long (obj,&v); + if (SWIG_IsOK(res)) { + if (val) *val = v; + return res; + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + const double mant_max = 1LL << DBL_MANT_DIG; + const double mant_min = -mant_max; + double d; + res = SWIG_AsVal_double (obj,&d); + if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, mant_min, mant_max)) + return SWIG_OverflowError; + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, mant_min, mant_max)) { + if (val) *val = (long long)(d); + return SWIG_AddCast(res); + } + res = SWIG_TypeError; + } +#endif + return res; +} +#endif + + +#define t_output_helper SWIG_Python_AppendOutput + + +#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERNINLINE PyObject* +SWIG_From_long_SS_long (long long value) +{ + return ((value < LONG_MIN) || (value > LONG_MAX)) ? + PyLong_FromLongLong(value) : PyInt_FromLong((long)(value)); +} +#endif + #ifdef __cplusplus extern "C" { #endif -static PyObject *_wrap_chmUnitInfo_start_set(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; - unsigned long long arg2 ; - PyObject * obj0 = 0 ; +SWIGINTERN PyObject *_wrap_chmUnitInfo_start_set(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; + LONGUINT64 arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + unsigned long long val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; - if(!PyArg_ParseTuple(args,(char *)"OK:chmUnitInfo_start_set",&obj0,&arg2)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_chmUnitInfo,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - if (arg1) (arg1)->start = arg2; - - Py_INCREF(Py_None); resultobj = Py_None; - return resultobj; - fail: - return NULL; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_chmUnitInfo, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "chmUnitInfo_start_set" "', argument " "1"" of type '" "struct chmUnitInfo *""'"); + } + arg1 = (struct chmUnitInfo *)(argp1); + ecode2 = SWIG_AsVal_unsigned_SS_long_SS_long(swig_obj[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "chmUnitInfo_start_set" "', argument " "2"" of type '" "LONGUINT64""'"); + } + arg2 = (LONGUINT64)(val2); + if (arg1) (arg1)->start = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; } -static PyObject *_wrap_chmUnitInfo_start_get(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; - LONGUINT64 result; - PyObject * obj0 = 0 ; +SWIGINTERN PyObject *_wrap_chmUnitInfo_start_get(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + LONGUINT64 result; - if(!PyArg_ParseTuple(args,(char *)"O:chmUnitInfo_start_get",&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_chmUnitInfo,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - result = (LONGUINT64) ((arg1)->start); - - resultobj = PyLong_FromUnsignedLongLong(result); - return resultobj; - fail: - return NULL; + if (!SWIG_Python_UnpackTuple(args,"chmUnitInfo_start_get",0,0,0)) SWIG_fail; + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_chmUnitInfo, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "chmUnitInfo_start_get" "', argument " "1"" of type '" "struct chmUnitInfo *""'"); + } + arg1 = (struct chmUnitInfo *)(argp1); + result = (LONGUINT64) ((arg1)->start); + resultobj = SWIG_From_unsigned_SS_long_SS_long((unsigned long long)(result)); + return resultobj; +fail: + return NULL; } -static PyObject *_wrap_chmUnitInfo_length_set(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; - unsigned long long arg2 ; - PyObject * obj0 = 0 ; +SWIGINTERN PyObject *_wrap_chmUnitInfo_length_set(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; + LONGUINT64 arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + unsigned long long val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; - if(!PyArg_ParseTuple(args,(char *)"OO:chmUnitInfo_length_set",&obj0,&arg2)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_chmUnitInfo,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - if (arg1) (arg1)->length = arg2; - - Py_INCREF(Py_None); resultobj = Py_None; - return resultobj; - fail: - return NULL; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_chmUnitInfo, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "chmUnitInfo_length_set" "', argument " "1"" of type '" "struct chmUnitInfo *""'"); + } + arg1 = (struct chmUnitInfo *)(argp1); + ecode2 = SWIG_AsVal_unsigned_SS_long_SS_long(swig_obj[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "chmUnitInfo_length_set" "', argument " "2"" of type '" "LONGUINT64""'"); + } + arg2 = (LONGUINT64)(val2); + if (arg1) (arg1)->length = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; } -static PyObject *_wrap_chmUnitInfo_length_get(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; - LONGUINT64 result; - PyObject * obj0 = 0 ; +SWIGINTERN PyObject *_wrap_chmUnitInfo_length_get(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + LONGUINT64 result; - if(!PyArg_ParseTuple(args,(char *)"O:chmUnitInfo_length_get",&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_chmUnitInfo,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - result = (LONGUINT64) ((arg1)->length); - - resultobj = PyLong_FromUnsignedLongLong(result); - return resultobj; - fail: - return NULL; + if (!SWIG_Python_UnpackTuple(args,"chmUnitInfo_length_get",0,0,0)) SWIG_fail; + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_chmUnitInfo, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "chmUnitInfo_length_get" "', argument " "1"" of type '" "struct chmUnitInfo *""'"); + } + arg1 = (struct chmUnitInfo *)(argp1); + result = (LONGUINT64) ((arg1)->length); + resultobj = SWIG_From_unsigned_SS_long_SS_long((unsigned long long)(result)); + return resultobj; +fail: + return NULL; } -static PyObject *_wrap_chmUnitInfo_space_set(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; - int arg2 ; - PyObject * obj0 = 0 ; +SWIGINTERN PyObject *_wrap_chmUnitInfo_space_set(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; - if(!PyArg_ParseTuple(args,(char *)"Oi:chmUnitInfo_space_set",&obj0,&arg2)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_chmUnitInfo,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - if (arg1) (arg1)->space = arg2; - - Py_INCREF(Py_None); resultobj = Py_None; - return resultobj; - fail: - return NULL; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_chmUnitInfo, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "chmUnitInfo_space_set" "', argument " "1"" of type '" "struct chmUnitInfo *""'"); + } + arg1 = (struct chmUnitInfo *)(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[0], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "chmUnitInfo_space_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = (int)(val2); + if (arg1) (arg1)->space = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; } -static PyObject *_wrap_chmUnitInfo_space_get(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; - int result; - PyObject * obj0 = 0 ; +SWIGINTERN PyObject *_wrap_chmUnitInfo_space_get(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; - if(!PyArg_ParseTuple(args,(char *)"O:chmUnitInfo_space_get",&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_chmUnitInfo,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - result = (int) ((arg1)->space); - - resultobj = PyInt_FromLong((long)result); - return resultobj; - fail: - return NULL; + if (!SWIG_Python_UnpackTuple(args,"chmUnitInfo_space_get",0,0,0)) SWIG_fail; + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_chmUnitInfo, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "chmUnitInfo_space_get" "', argument " "1"" of type '" "struct chmUnitInfo *""'"); + } + arg1 = (struct chmUnitInfo *)(argp1); + result = (int) ((arg1)->space); + resultobj = SWIG_From_int((int)(result)); + return resultobj; +fail: + return NULL; } -static PyObject *_wrap_chmUnitInfo_path_set(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; - char *arg2 ; - PyObject * obj0 = 0 ; +SWIGINTERN PyObject *_wrap_chmUnitInfo_path_set(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; + char *arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + char temp2[256+1] ; + int res2 ; + PyObject *swig_obj[2] ; - if(!PyArg_ParseTuple(args,(char *)"Os:chmUnitInfo_path_set",&obj0,&arg2)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_chmUnitInfo,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - { - if (arg2) strncpy(arg1->path,arg2,256+1); - else arg1->path[0] = 0; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_chmUnitInfo, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "chmUnitInfo_path_set" "', argument " "1"" of type '" "struct chmUnitInfo *""'"); + } + arg1 = (struct chmUnitInfo *)(argp1); + res2 = SWIG_AsCharArray(swig_obj[0], temp2, 256+1); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "chmUnitInfo_path_set" "', argument " "2"" of type '" "char [256+1]""'"); + } + arg2 = (char *)(temp2); + if (arg2) memcpy(arg1->path,arg2,256+1*sizeof(char)); + else memset(arg1->path,0,256+1*sizeof(char)); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_chmUnitInfo_path_get(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + char *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args,"chmUnitInfo_path_get",0,0,0)) SWIG_fail; + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_chmUnitInfo, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "chmUnitInfo_path_get" "', argument " "1"" of type '" "struct chmUnitInfo *""'"); + } + arg1 = (struct chmUnitInfo *)(argp1); + result = (char *)(char *) ((arg1)->path); + { + size_t size = SWIG_strnlen(result, 256+1); + + + + resultobj = SWIG_FromCharPtrAndSize(result, size); + } + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN int _wrap_new_chmUnitInfo(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmUnitInfo *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args,"new_chmUnitInfo",0,0,0)) SWIG_fail; + result = (struct chmUnitInfo *)calloc(1, sizeof(struct chmUnitInfo)); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_chmUnitInfo, SWIG_BUILTIN_INIT | 0 ); + return resultobj == Py_None ? -1 : 0; +fail: + return -1; +} + + +SWIGINTERN PyObject *_wrap_delete_chmUnitInfo(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if (!SWIG_Python_UnpackTuple(args,"delete_chmUnitInfo",0,0,0)) SWIG_fail; + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_chmUnitInfo, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_chmUnitInfo" "', argument " "1"" of type '" "struct chmUnitInfo *""'"); + } + arg1 = (struct chmUnitInfo *)(argp1); + free((char *) arg1); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_chmUnitInfo) /* defines _wrap_delete_chmUnitInfo_destructor_closure */ + +SWIGINTERN PyObject *_wrap_chm_open(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + PyObject *swig_obj[1] ; + struct chmFile *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "chm_open" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = (char *)(buf1); + result = (struct chmFile *)chm_open((char const *)arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_chmFile, 0 | 0 ); + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return NULL; +} + + +SWIGINTERN PyObject *_wrap_chm_close(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmFile *arg1 = (struct chmFile *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_chmFile, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "chm_close" "', argument " "1"" of type '" "struct chmFile *""'"); + } + arg1 = (struct chmFile *)(argp1); + chm_close(arg1); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_chm_set_param(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmFile *arg1 = (struct chmFile *) 0 ; + int arg2 ; + int arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + + if (!SWIG_Python_UnpackTuple(args,"chm_set_param",3,3,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_chmFile, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "chm_set_param" "', argument " "1"" of type '" "struct chmFile *""'"); + } + arg1 = (struct chmFile *)(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "chm_set_param" "', argument " "2"" of type '" "int""'"); + } + arg2 = (int)(val2); + ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "chm_set_param" "', argument " "3"" of type '" "int""'"); + } + arg3 = (int)(val3); + chm_set_param(arg1,arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_chm_resolve_object(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmFile *arg1 = (struct chmFile *) 0 ; + char *arg2 = (char *) 0 ; + struct chmUnitInfo *arg3 = (struct chmUnitInfo *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + struct chmUnitInfo *temp3 = (struct chmUnitInfo *) calloc(1, sizeof(struct chmUnitInfo)) ; + PyObject *swig_obj[2] ; + int result; + + { + arg3 = temp3; + } + if (!SWIG_Python_UnpackTuple(args,"chm_resolve_object",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_chmFile, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "chm_resolve_object" "', argument " "1"" of type '" "struct chmFile *""'"); + } + arg1 = (struct chmFile *)(argp1); + res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "chm_resolve_object" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = (char *)(buf2); + result = (int)chm_resolve_object(arg1,(char const *)arg2,arg3); + resultobj = SWIG_From_int((int)(result)); + { + PyObject *o, *o2, *o3; + o = SWIG_NewPointerObj((void *) arg3, SWIGTYPE_p_chmUnitInfo, 1); + if ((!resultobj) || (resultobj == Py_None)) { + resultobj = o; + } else { + if (!PyTuple_Check(resultobj)) { + PyObject *o2 = resultobj; + resultobj = PyTuple_New(1); + PyTuple_SetItem(resultobj,0,o2); + } + o3 = PyTuple_New(1); + PyTuple_SetItem(o3,0,o); + o2 = resultobj; + resultobj = PySequence_Concat(o2,o3); + Py_DECREF(o2); + Py_DECREF(o3); } - Py_INCREF(Py_None); resultobj = Py_None; - return resultobj; - fail: - return NULL; + } + if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); + return NULL; } -static PyObject *_wrap_chmUnitInfo_path_get(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; - char *result; - PyObject * obj0 = 0 ; +SWIGINTERN PyObject *_wrap_chm_retrieve_object(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmFile *arg1 = (struct chmFile *) 0 ; + struct chmUnitInfo *arg2 = (struct chmUnitInfo *) 0 ; + unsigned char *arg3 = (unsigned char *) 0 ; + LONGUINT64 arg4 ; + LONGINT64 arg5 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + unsigned char temp3 ; + unsigned long long val4 ; + int ecode4 = 0 ; + long long val5 ; + int ecode5 = 0 ; + PyObject *swig_obj[4] ; + LONGINT64 result; - if(!PyArg_ParseTuple(args,(char *)"O:chmUnitInfo_path_get",&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_chmUnitInfo,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - result = (char *)(char *) ((arg1)->path); + arg3 = &temp3; + if (!SWIG_Python_UnpackTuple(args,"chm_retrieve_object",4,4,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_chmFile, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "chm_retrieve_object" "', argument " "1"" of type '" "struct chmFile *""'"); + } + arg1 = (struct chmFile *)(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_chmUnitInfo, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "chm_retrieve_object" "', argument " "2"" of type '" "struct chmUnitInfo *""'"); + } + arg2 = (struct chmUnitInfo *)(argp2); + ecode4 = SWIG_AsVal_unsigned_SS_long_SS_long(swig_obj[2], &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "chm_retrieve_object" "', argument " "4"" of type '" "LONGUINT64""'"); + } + arg4 = (LONGUINT64)(val4); + ecode5 = SWIG_AsVal_long_SS_long(swig_obj[3], &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "chm_retrieve_object" "', argument " "5"" of type '" "LONGINT64""'"); + } + arg5 = (LONGINT64)(val5); + { + /* nasty hack */ - resultobj = PyString_FromString(result); - return resultobj; - fail: - return NULL; + + + arg3 = (unsigned char *) malloc(arg5); + + if (arg3 == NULL) SWIG_fail; + } + result = (LONGINT64)chm_retrieve_object(arg1,arg2,arg3,arg4,arg5); + resultobj = SWIG_From_long_SS_long((long long)(result)); + { + PyObject *o; + o = PyString_FromStringAndSize((const char*)arg3, arg5); + resultobj = t_output_helper(resultobj,o); + + + free(arg3); + + } + return resultobj; +fail: + return NULL; } -static PyObject *_wrap_new_chmUnitInfo(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmUnitInfo *result; +SWIGINTERN PyObject *_wrap_chm_enumerate(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmFile *arg1 = (struct chmFile *) 0 ; + int arg2 ; + CHM_ENUMERATOR arg3 = (CHM_ENUMERATOR) 0 ; + void *arg4 = (void *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[4] ; + int result; - if(!PyArg_ParseTuple(args,(char *)":new_chmUnitInfo")) goto fail; - result = (struct chmUnitInfo *)(struct chmUnitInfo *) calloc(1, sizeof(struct chmUnitInfo)); - - resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_chmUnitInfo, 1); - return resultobj; - fail: - return NULL; + if (!SWIG_Python_UnpackTuple(args,"chm_enumerate",4,4,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_chmFile, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "chm_enumerate" "', argument " "1"" of type '" "struct chmFile *""'"); + } + arg1 = (struct chmFile *)(argp1); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "chm_enumerate" "', argument " "2"" of type '" "int""'"); + } + arg2 = (int)(val2); + { + if (!my_set_callback(self, swig_obj[2])) goto fail; + arg3 = dummy_enumerator; + } + { + if (!(arg4 = PyCObject_FromVoidPtr(swig_obj[3], NULL))) goto fail; + } + result = (int)chm_enumerate(arg1,arg2,arg3,arg4); + resultobj = SWIG_From_int((int)(result)); + return resultobj; +fail: + return NULL; } -static PyObject *_wrap_delete_chmUnitInfo(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmUnitInfo *arg1 = (struct chmUnitInfo *) 0 ; - PyObject * obj0 = 0 ; +SWIGINTERN PyObject *_wrap_chm_enumerate_dir(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + struct chmFile *arg1 = (struct chmFile *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + CHM_ENUMERATOR arg4 = (CHM_ENUMERATOR) 0 ; + void *arg5 = (void *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[5] ; + int result; - if(!PyArg_ParseTuple(args,(char *)"O:delete_chmUnitInfo",&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_chmUnitInfo,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - free((char *) arg1); - - Py_INCREF(Py_None); resultobj = Py_None; - return resultobj; - fail: - return NULL; -} - - -static PyObject * chmUnitInfo_swigregister(PyObject *self, PyObject *args) { - PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL; - SWIG_TypeClientData(SWIGTYPE_p_chmUnitInfo, obj); - Py_INCREF(obj); - return Py_BuildValue((char *)""); -} -static PyObject *_wrap_chm_open(PyObject *self, PyObject *args) { - PyObject *resultobj; - char *arg1 ; - struct chmFile *result; - - if(!PyArg_ParseTuple(args,(char *)"s:chm_open",&arg1)) goto fail; - result = (struct chmFile *)chm_open((char const *)arg1); - - resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_chmFile, 0); - return resultobj; - fail: - return NULL; -} - - -static PyObject *_wrap_chm_close(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmFile *arg1 = (struct chmFile *) 0 ; - PyObject * obj0 = 0 ; - - if(!PyArg_ParseTuple(args,(char *)"O:chm_close",&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_chmFile,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - chm_close(arg1); - - Py_INCREF(Py_None); resultobj = Py_None; - return resultobj; - fail: - return NULL; -} - - -static PyObject *_wrap_chm_set_param(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmFile *arg1 = (struct chmFile *) 0 ; - int arg2 ; - int arg3 ; - PyObject * obj0 = 0 ; - - if(!PyArg_ParseTuple(args,(char *)"Oii:chm_set_param",&obj0,&arg2,&arg3)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_chmFile,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - chm_set_param(arg1,arg2,arg3); - - Py_INCREF(Py_None); resultobj = Py_None; - return resultobj; - fail: - return NULL; -} - - -static PyObject *_wrap_chm_resolve_object(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmFile *arg1 = (struct chmFile *) 0 ; - char *arg2 ; - struct chmUnitInfo *arg3 = (struct chmUnitInfo *) 0 ; - int result; - struct chmUnitInfo *temp3 = (struct chmUnitInfo *) calloc(1, sizeof(struct chmUnitInfo)) ; - PyObject * obj0 = 0 ; - - { - arg3 = temp3; - } - if(!PyArg_ParseTuple(args,(char *)"Os:chm_resolve_object",&obj0,&arg2)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_chmFile,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - result = (int)chm_resolve_object(arg1,(char const *)arg2,arg3); - - resultobj = PyInt_FromLong((long)result); - { - PyObject *o, *o2, *o3; - o = SWIG_NewPointerObj((void *) arg3, SWIGTYPE_p_chmUnitInfo, 1); - if ((!resultobj) || (resultobj == Py_None)) { - resultobj = o; - }else { - if (!PyTuple_Check(resultobj)) { - PyObject *o2 = resultobj; - resultobj = PyTuple_New(1); - PyTuple_SetItem(resultobj,0,o2); - } - o3 = PyTuple_New(1); - PyTuple_SetItem(o3,0,o); - o2 = resultobj; - resultobj = PySequence_Concat(o2,o3); - Py_DECREF(o2); - Py_DECREF(o3); - } - } - return resultobj; - fail: - return NULL; -} - - -static PyObject *_wrap_chm_retrieve_object(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmFile *arg1 = (struct chmFile *) 0 ; - struct chmUnitInfo *arg2 = (struct chmUnitInfo *) 0 ; - unsigned char *arg3 = (unsigned char *) 0 ; - unsigned long long arg4 ; - long long arg5 ; - LONGINT64 result; - unsigned char temp3 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - arg3 = &temp3; - if(!PyArg_ParseTuple(args,(char *)"OOKL:chm_retrieve_object",&obj0,&obj1,&arg4,&arg5)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_chmFile,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_chmUnitInfo,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - { - /* nasty hack */ - - - - arg3 = (unsigned char *) malloc(arg5); - - if (arg3 == NULL) SWIG_fail; - } - result = (LONGINT64)chm_retrieve_object(arg1,arg2,arg3,arg4,arg5); - - resultobj = PyLong_FromLongLong(result); - { - PyObject *o; - o = PyString_FromStringAndSize((const char *)arg3, arg5); - resultobj = t_output_helper(resultobj,o); - - - - free(arg3); - - } - return resultobj; - fail: - return NULL; -} - - -static PyObject *_wrap_chm_enumerate(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmFile *arg1 = (struct chmFile *) 0 ; - int arg2 ; - CHM_ENUMERATOR arg3 = (CHM_ENUMERATOR) 0 ; - void *arg4 = (void *) 0 ; - int result; - PyObject * obj0 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - - if(!PyArg_ParseTuple(args,(char *)"OiOO:chm_enumerate",&obj0,&arg2,&obj2,&obj3)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_chmFile,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - { - if (!my_set_callback(self, obj2)) goto fail; - arg3 = dummy_enumerator; - } - { - if (!(arg4 = PyCObject_FromVoidPtr(obj3, NULL))) goto fail; - } - result = (int)chm_enumerate(arg1,arg2,arg3,arg4); - - resultobj = PyInt_FromLong((long)result); - return resultobj; - fail: - return NULL; -} - - -static PyObject *_wrap_chm_enumerate_dir(PyObject *self, PyObject *args) { - PyObject *resultobj; - struct chmFile *arg1 = (struct chmFile *) 0 ; - char *arg2 ; - int arg3 ; - CHM_ENUMERATOR arg4 = (CHM_ENUMERATOR) 0 ; - void *arg5 = (void *) 0 ; - int result; - PyObject * obj0 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if(!PyArg_ParseTuple(args,(char *)"OsiOO:chm_enumerate_dir",&obj0,&arg2,&arg3,&obj3,&obj4)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_chmFile,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - { - if (!my_set_callback(self, obj3)) goto fail; - arg4 = dummy_enumerator; - } - { - if (!(arg5 = PyCObject_FromVoidPtr(obj4, NULL))) goto fail; - } - result = (int)chm_enumerate_dir(arg1,(char const *)arg2,arg3,arg4,arg5); - - resultobj = PyInt_FromLong((long)result); - return resultobj; - fail: - return NULL; + if (!SWIG_Python_UnpackTuple(args,"chm_enumerate_dir",5,5,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_chmFile, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "chm_enumerate_dir" "', argument " "1"" of type '" "struct chmFile *""'"); + } + arg1 = (struct chmFile *)(argp1); + res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "chm_enumerate_dir" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = (char *)(buf2); + ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "chm_enumerate_dir" "', argument " "3"" of type '" "int""'"); + } + arg3 = (int)(val3); + { + if (!my_set_callback(self, swig_obj[3])) goto fail; + arg4 = dummy_enumerator; + } + { + if (!(arg5 = PyCObject_FromVoidPtr(swig_obj[4], NULL))) goto fail; + } + result = (int)chm_enumerate_dir(arg1,(char const *)arg2,arg3,arg4,arg5); + resultobj = SWIG_From_int((int)(result)); + if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); + return NULL; } static PyMethodDef SwigMethods[] = { - { (char *)"chmUnitInfo_start_set", _wrap_chmUnitInfo_start_set, METH_VARARGS }, - { (char *)"chmUnitInfo_start_get", _wrap_chmUnitInfo_start_get, METH_VARARGS }, - { (char *)"chmUnitInfo_length_set", _wrap_chmUnitInfo_length_set, METH_VARARGS }, - { (char *)"chmUnitInfo_length_get", _wrap_chmUnitInfo_length_get, METH_VARARGS }, - { (char *)"chmUnitInfo_space_set", _wrap_chmUnitInfo_space_set, METH_VARARGS }, - { (char *)"chmUnitInfo_space_get", _wrap_chmUnitInfo_space_get, METH_VARARGS }, - { (char *)"chmUnitInfo_path_set", _wrap_chmUnitInfo_path_set, METH_VARARGS }, - { (char *)"chmUnitInfo_path_get", _wrap_chmUnitInfo_path_get, METH_VARARGS }, - { (char *)"new_chmUnitInfo", _wrap_new_chmUnitInfo, METH_VARARGS }, - { (char *)"delete_chmUnitInfo", _wrap_delete_chmUnitInfo, METH_VARARGS }, - { (char *)"chmUnitInfo_swigregister", chmUnitInfo_swigregister, METH_VARARGS }, - { (char *)"chm_open", _wrap_chm_open, METH_VARARGS }, - { (char *)"chm_close", _wrap_chm_close, METH_VARARGS }, - { (char *)"chm_set_param", _wrap_chm_set_param, METH_VARARGS }, - { (char *)"chm_resolve_object", _wrap_chm_resolve_object, METH_VARARGS }, - { (char *)"chm_retrieve_object", _wrap_chm_retrieve_object, METH_VARARGS }, - { (char *)"chm_enumerate", _wrap_chm_enumerate, METH_VARARGS }, - { (char *)"chm_enumerate_dir", _wrap_chm_enumerate_dir, METH_VARARGS }, - { NULL, NULL } + { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, + { (char *)"chm_open", (PyCFunction)_wrap_chm_open, METH_O, NULL}, + { (char *)"chm_close", (PyCFunction)_wrap_chm_close, METH_O, NULL}, + { (char *)"chm_set_param", _wrap_chm_set_param, METH_VARARGS, NULL}, + { (char *)"chm_resolve_object", _wrap_chm_resolve_object, METH_VARARGS, NULL}, + { (char *)"chm_retrieve_object", _wrap_chm_retrieve_object, METH_VARARGS, NULL}, + { (char *)"chm_enumerate", _wrap_chm_enumerate, METH_VARARGS, NULL}, + { (char *)"chm_enumerate_dir", _wrap_chm_enumerate_dir, METH_VARARGS, NULL}, + { NULL, NULL, 0, NULL } }; +static SwigPyGetSet chmUnitInfo___dict___getset = { SwigPyObject_get___dict__, 0 }; +static SwigPyGetSet chmUnitInfo_space_getset = { _wrap_chmUnitInfo_space_get, _wrap_chmUnitInfo_space_set }; +static SwigPyGetSet chmUnitInfo_length_getset = { _wrap_chmUnitInfo_length_get, _wrap_chmUnitInfo_length_set }; +static SwigPyGetSet chmUnitInfo_start_getset = { _wrap_chmUnitInfo_start_get, _wrap_chmUnitInfo_start_set }; +static SwigPyGetSet chmUnitInfo_path_getset = { _wrap_chmUnitInfo_path_get, _wrap_chmUnitInfo_path_set }; +SWIGINTERN PyGetSetDef SwigPyBuiltin__chmUnitInfo_getset[] = { + { (char *) "__dict__", (getter) SwigPyBuiltin_FunpackGetterClosure, (setter) 0, (char *)"chmUnitInfo.__dict__", (void *) &chmUnitInfo___dict___getset } +, + { (char *) "space", (getter) SwigPyBuiltin_FunpackGetterClosure, (setter) SwigPyBuiltin_FunpackSetterClosure, (char *)"chmUnitInfo.space", (void *) &chmUnitInfo_space_getset } +, + { (char *) "length", (getter) SwigPyBuiltin_FunpackGetterClosure, (setter) SwigPyBuiltin_FunpackSetterClosure, (char *)"chmUnitInfo.length", (void *) &chmUnitInfo_length_getset } +, + { (char *) "start", (getter) SwigPyBuiltin_FunpackGetterClosure, (setter) SwigPyBuiltin_FunpackSetterClosure, (char *)"chmUnitInfo.start", (void *) &chmUnitInfo_start_getset } +, + { (char *) "path", (getter) SwigPyBuiltin_FunpackGetterClosure, (setter) SwigPyBuiltin_FunpackSetterClosure, (char *)"chmUnitInfo.path", (void *) &chmUnitInfo_path_getset } +, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ +}; + +SWIGINTERN PyObject * +SwigPyBuiltin__chmUnitInfo_richcompare(PyObject *self, PyObject *other, int op) { + PyObject *result = NULL; + if (!result) { + if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { + result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + } else { + result = Py_NotImplemented; + Py_INCREF(result); + } + } + return result; +} + +SWIGINTERN PyMethodDef SwigPyBuiltin__chmUnitInfo_methods[] = { + { NULL, NULL, 0, NULL } /* Sentinel */ +}; + +static PyHeapTypeObject SwigPyBuiltin__chmUnitInfo_type = { + { +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + "chmlib.chmUnitInfo", /* tp_name */ + sizeof(SwigPyObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor) (destructor) _wrap_delete_chmUnitInfo_destructor_closure,/* tp_dealloc */ + (printfunc) 0, /* tp_print */ + (getattrfunc) 0, /* tp_getattr */ + (setattrfunc) 0, /* tp_setattr */ +#if PY_VERSION_HEX >= 0x03000000 + 0, /* tp_compare */ +#else + (cmpfunc) 0, /* tp_compare */ +#endif + (reprfunc) 0, /* tp_repr */ + &SwigPyBuiltin__chmUnitInfo_type.as_number, /* tp_as_number */ + &SwigPyBuiltin__chmUnitInfo_type.as_sequence, /* tp_as_sequence */ + &SwigPyBuiltin__chmUnitInfo_type.as_mapping, /* tp_as_mapping */ + (hashfunc) SwigPyObject_hash, /* tp_hash */ + (ternaryfunc) 0, /* tp_call */ + (reprfunc) 0, /* tp_str */ + (getattrofunc) 0, /* tp_getattro */ + (setattrofunc) 0, /* tp_setattro */ + &SwigPyBuiltin__chmUnitInfo_type.as_buffer, /* tp_as_buffer */ +#if PY_VERSION_HEX >= 0x03000000 + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ +#else + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_CHECKTYPES, /* tp_flags */ +#endif + "::chmUnitInfo", /* tp_doc */ + (traverseproc) 0, /* tp_traverse */ + (inquiry) 0, /* tp_clear */ + (richcmpfunc) SwigPyBuiltin__chmUnitInfo_richcompare, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc) 0, /* tp_iter */ + (iternextfunc) 0, /* tp_iternext */ + SwigPyBuiltin__chmUnitInfo_methods, /* tp_methods */ + 0, /* tp_members */ + SwigPyBuiltin__chmUnitInfo_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + (descrgetfunc) 0, /* tp_descr_get */ + (descrsetfunc) 0, /* tp_descr_set */ + (Py_ssize_t) offsetof(SwigPyObject, dict),/* tp_dictoffset */ + (initproc) _wrap_new_chmUnitInfo, /* tp_init */ + (allocfunc) 0, /* tp_alloc */ + (newfunc) 0, /* tp_new */ + (freefunc) 0, /* tp_free */ + (inquiry) 0, /* tp_is_gc */ + (PyObject *) 0, /* tp_bases */ + (PyObject *) 0, /* tp_mro */ + (PyObject *) 0, /* tp_cache */ + (PyObject *) 0, /* tp_subclasses */ + (PyObject *) 0, /* tp_weaklist */ + (destructor) 0, /* tp_del */ +#if PY_VERSION_HEX >= 0x02060000 + (int) 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + (destructor) 0, /* tp_finalize */ +#endif +#ifdef COUNT_ALLOCS + (Py_ssize_t) 0, /* tp_allocs */ + (Py_ssize_t) 0, /* tp_frees */ + (Py_ssize_t) 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0, /* tp_next */ +#endif + }, +#if PY_VERSION_HEX >= 0x03050000 + { + (unaryfunc) 0, /* am_await */ + (unaryfunc) 0, /* am_aiter */ + (unaryfunc) 0, /* am_anext */ + }, +#endif + { + (binaryfunc) 0, /* nb_add */ + (binaryfunc) 0, /* nb_subtract */ + (binaryfunc) 0, /* nb_multiply */ +#if PY_VERSION_HEX < 0x03000000 + (binaryfunc) 0, /* nb_divide */ +#endif + (binaryfunc) 0, /* nb_remainder */ + (binaryfunc) 0, /* nb_divmod */ + (ternaryfunc) 0, /* nb_power */ + (unaryfunc) 0, /* nb_negative */ + (unaryfunc) 0, /* nb_positive */ + (unaryfunc) 0, /* nb_absolute */ + (inquiry) 0, /* nb_nonzero */ + (unaryfunc) 0, /* nb_invert */ + (binaryfunc) 0, /* nb_lshift */ + (binaryfunc) 0, /* nb_rshift */ + (binaryfunc) 0, /* nb_and */ + (binaryfunc) 0, /* nb_xor */ + (binaryfunc) 0, /* nb_or */ +#if PY_VERSION_HEX < 0x03000000 + (coercion) 0, /* nb_coerce */ +#endif + (unaryfunc) 0, /* nb_int */ +#if PY_VERSION_HEX >= 0x03000000 + (void *) 0, /* nb_reserved */ +#else + (unaryfunc) 0, /* nb_long */ +#endif + (unaryfunc) 0, /* nb_float */ +#if PY_VERSION_HEX < 0x03000000 + (unaryfunc) 0, /* nb_oct */ + (unaryfunc) 0, /* nb_hex */ +#endif + (binaryfunc) 0, /* nb_inplace_add */ + (binaryfunc) 0, /* nb_inplace_subtract */ + (binaryfunc) 0, /* nb_inplace_multiply */ +#if PY_VERSION_HEX < 0x03000000 + (binaryfunc) 0, /* nb_inplace_divide */ +#endif + (binaryfunc) 0, /* nb_inplace_remainder */ + (ternaryfunc) 0, /* nb_inplace_power */ + (binaryfunc) 0, /* nb_inplace_lshift */ + (binaryfunc) 0, /* nb_inplace_rshift */ + (binaryfunc) 0, /* nb_inplace_and */ + (binaryfunc) 0, /* nb_inplace_xor */ + (binaryfunc) 0, /* nb_inplace_or */ + (binaryfunc) 0, /* nb_floor_divide */ + (binaryfunc) 0, /* nb_true_divide */ + (binaryfunc) 0, /* nb_inplace_floor_divide */ + (binaryfunc) 0, /* nb_inplace_true_divide */ +#if PY_VERSION_HEX >= 0x02050000 + (unaryfunc) 0, /* nb_index */ +#endif +#if PY_VERSION_HEX >= 0x03050000 + (binaryfunc) 0, /* nb_matrix_multiply */ + (binaryfunc) 0, /* nb_inplace_matrix_multiply */ +#endif + }, + { + (lenfunc) 0, /* mp_length */ + (binaryfunc) 0, /* mp_subscript */ + (objobjargproc) 0, /* mp_ass_subscript */ + }, + { + (lenfunc) 0, /* sq_length */ + (binaryfunc) 0, /* sq_concat */ + (ssizeargfunc) 0, /* sq_repeat */ + (ssizeargfunc) 0, /* sq_item */ +#if PY_VERSION_HEX >= 0x03000000 + (void *) 0, /* was_sq_slice */ +#else + (ssizessizeargfunc) 0, /* sq_slice */ +#endif + (ssizeobjargproc) 0, /* sq_ass_item */ +#if PY_VERSION_HEX >= 0x03000000 + (void *) 0, /* was_sq_ass_slice */ +#else + (ssizessizeobjargproc) 0, /* sq_ass_slice */ +#endif + (objobjproc) 0, /* sq_contains */ + (binaryfunc) 0, /* sq_inplace_concat */ + (ssizeargfunc) 0, /* sq_inplace_repeat */ + }, + { +#if PY_VERSION_HEX < 0x03000000 + (readbufferproc) 0, /* bf_getreadbuffer */ + (writebufferproc) 0, /* bf_getwritebuffer */ + (segcountproc) 0, /* bf_getsegcount */ + (charbufferproc) 0, /* bf_getcharbuffer */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + (getbufferproc) 0, /* bf_getbuffer */ + (releasebufferproc) 0, /* bf_releasebuffer */ +#endif + }, + (PyObject *) 0, /* ht_name */ + (PyObject *) 0, /* ht_slots */ +#if PY_VERSION_HEX >= 0x03030000 + (PyObject *) 0, /* ht_qualname */ + 0, /* ht_cached_keys */ +#endif +}; + +SWIGINTERN SwigPyClientData SwigPyBuiltin__chmUnitInfo_clientdata = {0, 0, 0, 0, 0, 0, (PyTypeObject *)&SwigPyBuiltin__chmUnitInfo_type}; + /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ -static swig_type_info _swigt__p_chmUnitInfo[] = {{"_p_chmUnitInfo", 0, "struct chmUnitInfo *", 0},{"_p_chmUnitInfo"},{0}}; -static swig_type_info _swigt__p_unsigned_char[] = {{"_p_unsigned_char", 0, "unsigned char *", 0},{"_p_unsigned_char"},{0}}; -static swig_type_info _swigt__p_char[] = {{"_p_char", 0, "char *", 0},{"_p_char"},{0}}; -static swig_type_info _swigt__CHM_ENUMERATOR[] = {{"_CHM_ENUMERATOR", 0, "CHM_ENUMERATOR", 0},{"_CHM_ENUMERATOR"},{0}}; -static swig_type_info _swigt__p_chmFile[] = {{"_p_chmFile", 0, "struct chmFile *", 0},{"_p_chmFile"},{0}}; +static swig_type_info _swigt__p_SwigPyObject = {"_p_SwigPyObject", "SwigPyObject *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_chmFile = {"_p_chmFile", "struct chmFile *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_chmUnitInfo = {"_p_chmUnitInfo", "struct chmUnitInfo *|chmUnitInfo *", 0, 0, (void*)&SwigPyBuiltin__chmUnitInfo_clientdata, 0}; +static swig_type_info _swigt__p_f_p_struct_chmFile_p_struct_chmUnitInfo_p_void__int = {"_p_f_p_struct_chmFile_p_struct_chmUnitInfo_p_void__int", "int (*)(struct chmFile *,struct chmUnitInfo *,void *)|CHM_ENUMERATOR", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_long_long = {"_p_long_long", "LONGINT64 *|long long *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "LONGUINT64 *|unsigned long long *", 0, 0, (void*)0, 0}; -static swig_type_info *swig_types_initial[] = { -_swigt__p_chmUnitInfo, -_swigt__p_unsigned_char, -_swigt__p_char, -_swigt__CHM_ENUMERATOR, -_swigt__p_chmFile, -0 +static swig_type_info *swig_type_initial[] = { + &_swigt__p_SwigPyObject, + &_swigt__p_char, + &_swigt__p_chmFile, + &_swigt__p_chmUnitInfo, + &_swigt__p_f_p_struct_chmFile_p_struct_chmUnitInfo_p_void__int, + &_swigt__p_long_long, + &_swigt__p_unsigned_char, + &_swigt__p_unsigned_long_long, +}; + +static swig_cast_info _swigc__p_SwigPyObject[] = { {&_swigt__p_SwigPyObject, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_chmFile[] = { {&_swigt__p_chmFile, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_chmUnitInfo[] = { {&_swigt__p_chmUnitInfo, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_f_p_struct_chmFile_p_struct_chmUnitInfo_p_void__int[] = { {&_swigt__p_f_p_struct_chmFile_p_struct_chmUnitInfo_p_void__int, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_unsigned_long_long[] = { {&_swigt__p_unsigned_long_long, 0, 0, 0},{0, 0, 0, 0}}; + +static swig_cast_info *swig_cast_initial[] = { + _swigc__p_SwigPyObject, + _swigc__p_char, + _swigc__p_chmFile, + _swigc__p_chmUnitInfo, + _swigc__p_f_p_struct_chmFile_p_struct_chmUnitInfo_p_void__int, + _swigc__p_long_long, + _swigc__p_unsigned_char, + _swigc__p_unsigned_long_long, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_const_info swig_const_table[] = { -{ SWIG_PY_INT, (char *)"CHM_UNCOMPRESSED", (long) (0), 0, 0, 0}, -{ SWIG_PY_INT, (char *)"CHM_COMPRESSED", (long) (1), 0, 0, 0}, -{ SWIG_PY_INT, (char *)"CHM_MAX_PATHLEN", (long) 256, 0, 0, 0}, -{ SWIG_PY_INT, (char *)"CHM_PARAM_MAX_BLOCKS_CACHED", (long) 0, 0, 0, 0}, -{ SWIG_PY_INT, (char *)"CHM_RESOLVE_SUCCESS", (long) (0), 0, 0, 0}, -{ SWIG_PY_INT, (char *)"CHM_RESOLVE_FAILURE", (long) (1), 0, 0, 0}, -{ SWIG_PY_INT, (char *)"CHM_ENUMERATE_NORMAL", (long) (1), 0, 0, 0}, -{ SWIG_PY_INT, (char *)"CHM_ENUMERATE_META", (long) (2), 0, 0, 0}, -{ SWIG_PY_INT, (char *)"CHM_ENUMERATE_SPECIAL", (long) (4), 0, 0, 0}, -{ SWIG_PY_INT, (char *)"CHM_ENUMERATE_FILES", (long) (8), 0, 0, 0}, -{ SWIG_PY_INT, (char *)"CHM_ENUMERATE_DIRS", (long) (16), 0, 0, 0}, -{ SWIG_PY_INT, (char *)"CHM_ENUMERATE_ALL", (long) (31), 0, 0, 0}, -{ SWIG_PY_INT, (char *)"CHM_ENUMERATOR_FAILURE", (long) (0), 0, 0, 0}, -{ SWIG_PY_INT, (char *)"CHM_ENUMERATOR_CONTINUE", (long) (1), 0, 0, 0}, -{ SWIG_PY_INT, (char *)"CHM_ENUMERATOR_SUCCESS", (long) (2), 0, 0, 0}, -{0}}; +{0, 0, 0, 0.0, 0, 0}}; #ifdef __cplusplus } #endif +static PyTypeObject *builtin_bases[2]; + +/* ----------------------------------------------------------------------------- + * Type initialization: + * This problem is tough by the requirement that no dynamic + * memory is used. Also, since swig_type_info structures store pointers to + * swig_cast_info structures and swig_cast_info structures store pointers back + * to swig_type_info structures, we need some lookup code at initialization. + * The idea is that swig generates all the structures that are needed. + * The runtime then collects these partially filled structures. + * The SWIG_InitializeModule function takes these initial arrays out of + * swig_module, and does all the lookup, filling in the swig_module.types + * array with the correct data and linking the correct swig_cast_info + * structures together. + * + * The generated swig_type_info structures are assigned statically to an initial + * array. We just loop through that array, and handle each type individually. + * First we lookup if this type has been already loaded, and if so, use the + * loaded structure instead of the generated one. Then we have to fill in the + * cast linked list. The cast data is initially stored in something like a + * two-dimensional array. Each row corresponds to a type (there are the same + * number of rows as there are in the swig_type_initial array). Each entry in + * a column is one of the swig_cast_info structures for that type. + * The cast_initial array is actually an array of arrays, because each row has + * a variable number of columns. So to actually build the cast linked list, + * we find the array of casts associated with the type, and loop through it + * adding the casts to the list. The one last trick we need to do is making + * sure the type pointer in the swig_cast_info struct is correct. + * + * First off, we lookup the cast->type name to see if it is already loaded. + * There are three cases to handle: + * 1) If the cast->type has already been loaded AND the type we are adding + * casting info to has not been loaded (it is in this module), THEN we + * replace the cast->type pointer with the type pointer that has already + * been loaded. + * 2) If BOTH types (the one we are adding casting info to, and the + * cast->type) are loaded, THEN the cast info has already been loaded by + * the previous module so we just ignore it. + * 3) Finally, if cast->type has not already been loaded, then we add that + * swig_cast_info to the linked list (because the cast->type) pointer will + * be correct. + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* c-mode */ +#endif +#endif + +#if 0 +#define SWIGRUNTIME_DEBUG +#endif + + +SWIGRUNTIME void +SWIG_InitializeModule(void *clientdata) { + size_t i; + swig_module_info *module_head, *iter; + int init; + + /* check to see if the circular list has been setup, if not, set it up */ + if (swig_module.next==0) { + /* Initialize the swig_module */ + swig_module.type_initial = swig_type_initial; + swig_module.cast_initial = swig_cast_initial; + swig_module.next = &swig_module; + init = 1; + } else { + init = 0; + } + + /* Try and load any already created modules */ + module_head = SWIG_GetModule(clientdata); + if (!module_head) { + /* This is the first module loaded for this interpreter */ + /* so set the swig module into the interpreter */ + SWIG_SetModule(clientdata, &swig_module); + } else { + /* the interpreter has loaded a SWIG module, but has it loaded this one? */ + iter=module_head; + do { + if (iter==&swig_module) { + /* Our module is already in the list, so there's nothing more to do. */ + return; + } + iter=iter->next; + } while (iter!= module_head); + + /* otherwise we must add our module into the list */ + swig_module.next = module_head->next; + module_head->next = &swig_module; + } + + /* When multiple interpreters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + + /* Now work on filling in swig_module.types */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: size %d\n", swig_module.size); +#endif + for (i = 0; i < swig_module.size; ++i) { + swig_type_info *type = 0; + swig_type_info *ret; + swig_cast_info *cast; + +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); +#endif + + /* if there is another module already loaded */ + if (swig_module.next != &swig_module) { + type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); + } + if (type) { + /* Overwrite clientdata field */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found type %s\n", type->name); +#endif + if (swig_module.type_initial[i]->clientdata) { + type->clientdata = swig_module.type_initial[i]->clientdata; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); +#endif + } + } else { + type = swig_module.type_initial[i]; + } + + /* Insert casting types */ + cast = swig_module.cast_initial[i]; + while (cast->type) { + /* Don't need to add information already in the list */ + ret = 0; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); +#endif + if (swig_module.next != &swig_module) { + ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); +#ifdef SWIGRUNTIME_DEBUG + if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); +#endif + } + if (ret) { + if (type == swig_module.type_initial[i]) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: skip old type %s\n", ret->name); +#endif + cast->type = ret; + ret = 0; + } else { + /* Check for casting already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); +#ifdef SWIGRUNTIME_DEBUG + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); +#endif + if (!ocast) ret = 0; + } + } + + if (!ret) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); +#endif + if (type->cast) { + type->cast->prev = cast; + cast->next = type->cast; + } + type->cast = cast; + } + cast++; + } + /* Set entry in modules->types array equal to the type */ + swig_module.types[i] = type; + } + swig_module.types[i] = 0; + +#ifdef SWIGRUNTIME_DEBUG + printf("**** SWIG_InitializeModule: Cast List ******\n"); + for (i = 0; i < swig_module.size; ++i) { + int j = 0; + swig_cast_info *cast = swig_module.cast_initial[i]; + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); + while (cast->type) { + printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); + cast++; + ++j; + } + printf("---- Total casts: %d\n",j); + } + printf("**** SWIG_InitializeModule: Cast List ******\n"); +#endif +} + +/* This function will propagate the clientdata field of type to +* any new swig_type_info structures that have been added into the list +* of equivalent types. It is like calling +* SWIG_TypeClientData(type, clientdata) a second time. +*/ +SWIGRUNTIME void +SWIG_PropagateClientData(void) { + size_t i; + swig_cast_info *equiv; + static int init_run = 0; + + if (init_run) return; + init_run = 1; + + for (i = 0; i < swig_module.size; i++) { + if (swig_module.types[i]->clientdata) { + equiv = swig_module.types[i]->cast; + while (equiv) { + if (!equiv->converter) { + if (equiv->type && !equiv->type->clientdata) + SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + } + equiv = equiv->next; + } + } + } +} + +#ifdef __cplusplus +#if 0 +{ + /* c-mode */ +#endif +} +#endif + + + +#ifdef __cplusplus +extern "C" { +#endif + + /* Python-specific SWIG API */ +#define SWIG_newvarlink() SWIG_Python_newvarlink() +#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) +#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) + + /* ----------------------------------------------------------------------------- + * global variable support code. + * ----------------------------------------------------------------------------- */ + + typedef struct swig_globalvar { + char *name; /* Name of global variable */ + PyObject *(*get_attr)(void); /* Return the current value */ + int (*set_attr)(PyObject *); /* Set the value */ + struct swig_globalvar *next; + } swig_globalvar; + + typedef struct swig_varlinkobject { + PyObject_HEAD + swig_globalvar *vars; + } swig_varlinkobject; + + SWIGINTERN PyObject * + swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_InternFromString(""); +#else + return PyString_FromString(""); +#endif + } + + SWIGINTERN PyObject * + swig_varlink_str(swig_varlinkobject *v) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *str = PyUnicode_InternFromString("("); + PyObject *tail; + PyObject *joined; + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + tail = PyUnicode_FromString(var->name); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; + if (var->next) { + tail = PyUnicode_InternFromString(", "); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; + } + } + tail = PyUnicode_InternFromString(")"); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; +#else + PyObject *str = PyString_FromString("("); + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + PyString_ConcatAndDel(&str,PyString_FromString(var->name)); + if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); + } + PyString_ConcatAndDel(&str,PyString_FromString(")")); +#endif + return str; + } + + SWIGINTERN int + swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { + char *tmp; + PyObject *str = swig_varlink_str(v); + fprintf(fp,"Swig global variables "); + fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(str); + return 0; + } + + SWIGINTERN void + swig_varlink_dealloc(swig_varlinkobject *v) { + swig_globalvar *var = v->vars; + while (var) { + swig_globalvar *n = var->next; + free(var->name); + free(var); + var = n; + } + } + + SWIGINTERN PyObject * + swig_varlink_getattr(swig_varlinkobject *v, char *n) { + PyObject *res = NULL; + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + res = (*var->get_attr)(); + break; + } + var = var->next; + } + if (res == NULL && !PyErr_Occurred()) { + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); + } + return res; + } + + SWIGINTERN int + swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { + int res = 1; + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + res = (*var->set_attr)(p); + break; + } + var = var->next; + } + if (res == 1 && !PyErr_Occurred()) { + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); + } + return res; + } + + SWIGINTERN PyTypeObject* + swig_varlink_type(void) { + static char varlink__doc__[] = "Swig var link object"; + static PyTypeObject varlink_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + (char *)"swigvarlink", /* tp_name */ + sizeof(swig_varlinkobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (printfunc) swig_varlink_print, /* tp_print */ + (getattrfunc) swig_varlink_getattr, /* tp_getattr */ + (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + 0, /* tp_compare */ + (reprfunc) swig_varlink_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + (reprfunc) swig_varlink_str, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + varlink__doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ +#endif + }; + varlink_type = tmp; + type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + varlink_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&varlink_type) < 0) + return NULL; +#endif + } + return &varlink_type; + } + + /* Create a variable linking object for use later */ + SWIGINTERN PyObject * + SWIG_Python_newvarlink(void) { + swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); + if (result) { + result->vars = 0; + } + return ((PyObject*) result); + } + + SWIGINTERN void + SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { + swig_varlinkobject *v = (swig_varlinkobject *) p; + swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); + if (gv) { + size_t size = strlen(name)+1; + gv->name = (char *)malloc(size); + if (gv->name) { + strncpy(gv->name,name,size); + gv->get_attr = get_attr; + gv->set_attr = set_attr; + gv->next = v->vars; + } + } + v->vars = gv; + } + + SWIGINTERN PyObject * + SWIG_globals(void) { + static PyObject *_SWIG_globals = 0; + if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); + return _SWIG_globals; + } + + /* ----------------------------------------------------------------------------- + * constants/methods manipulation + * ----------------------------------------------------------------------------- */ + + /* Install Constants */ + SWIGINTERN void + SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { + PyObject *obj = 0; + size_t i; + for (i = 0; constants[i].type; ++i) { + switch(constants[i].type) { + case SWIG_PY_POINTER: + obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); + break; + case SWIG_PY_BINARY: + obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); + break; + default: + obj = 0; + break; + } + if (obj) { + PyDict_SetItemString(d, constants[i].name, obj); + Py_DECREF(obj); + } + } + } + + /* -----------------------------------------------------------------------------*/ + /* Fix SwigMethods to carry the callback ptrs when needed */ + /* -----------------------------------------------------------------------------*/ + + SWIGINTERN void + SWIG_Python_FixMethods(PyMethodDef *methods, + swig_const_info *const_table, + swig_type_info **types, + swig_type_info **types_initial) { + size_t i; + for (i = 0; methods[i].ml_name; ++i) { + const char *c = methods[i].ml_doc; + if (!c) continue; + c = strstr(c, "swig_ptr: "); + if (c) { + int j; + swig_const_info *ci = 0; + const char *name = c + 10; + for (j = 0; const_table[j].type; ++j) { + if (strncmp(const_table[j].name, name, + strlen(const_table[j].name)) == 0) { + ci = &(const_table[j]); + break; + } + } + if (ci) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; + strncpy(buff, methods[i].ml_doc, ldoc); + buff += ldoc; + memcpy(buff, "swig_ptr: ", 10); + buff += 10; + SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); + methods[i].ml_doc = ndoc; + } + } + } + } + } + } + +#ifdef __cplusplus +} +#endif + +/* -----------------------------------------------------------------------------* + * Partial Init method + * -----------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" #endif -CALIBRE_MODINIT_FUNC SWIG_init(void) { - static PyObject *SWIG_globals = 0; - static int typeinit = 0; - PyObject *m, *d; - int i; - if (!SWIG_globals) SWIG_globals = SWIG_newvarlink(); - m = Py_InitModule((char *) SWIG_name, SwigMethods); - d = PyModule_GetDict(m); - if (!typeinit) { - for (i = 0; swig_types_initial[i]; i++) { - swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]); - } - typeinit = 1; - } - SWIG_InstallConstants(d,swig_const_table); +SWIGEXPORT +#if PY_VERSION_HEX >= 0x03000000 +PyObject* +#else +void +#endif +initchmlib(void) { + PyObject *m, *d, *md; +#if PY_VERSION_HEX >= 0x03000000 + static struct PyModuleDef SWIG_module = { +# if PY_VERSION_HEX >= 0x03020000 + PyModuleDef_HEAD_INIT, +# else + { + PyObject_HEAD_INIT(NULL) + NULL, /* m_init */ + 0, /* m_index */ + NULL, /* m_copy */ + }, +# endif + (char *) SWIG_name, + NULL, + -1, + SwigMethods, + NULL, + NULL, + NULL, + NULL + }; +#endif +#if defined(SWIGPYTHON_BUILTIN) + static SwigPyClientData SwigPyObject_clientdata = { + 0, 0, 0, 0, 0, 0, 0 + }; + static PyGetSetDef this_getset_def = { + (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL + }; + static SwigPyGetSet thisown_getset_closure = { + (PyCFunction) SwigPyObject_own, + (PyCFunction) SwigPyObject_own + }; + static PyGetSetDef thisown_getset_def = { + (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure + }; + PyTypeObject *builtin_pytype; + int builtin_base_count; + swig_type_info *builtin_basetype; + PyObject *tuple; + PyGetSetDescrObject *static_getset; + PyTypeObject *metatype; + PyTypeObject *swigpyobject; + SwigPyClientData *cd; + PyObject *public_interface, *public_symbol; + PyObject *this_descr; + PyObject *thisown_descr; + PyObject *self = 0; + int i; + + (void)builtin_pytype; + (void)builtin_base_count; + (void)builtin_basetype; + (void)tuple; + (void)static_getset; + (void)self; + + /* Metaclass is used to implement static member variables */ + metatype = SwigPyObjectType(); + assert(metatype); +#endif + + /* Fix SwigMethods to carry the callback ptrs when needed */ + SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); + +#if PY_VERSION_HEX >= 0x03000000 + m = PyModule_Create(&SWIG_module); +#else + m = Py_InitModule((char *) SWIG_name, SwigMethods); +#endif + + md = d = PyModule_GetDict(m); + (void)md; + + SWIG_InitializeModule(0); + +#ifdef SWIGPYTHON_BUILTIN + swigpyobject = SwigPyObject_TypeOnce(); + + SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject"); + assert(SwigPyObject_stype); + cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; + if (!cd) { + SwigPyObject_stype->clientdata = &SwigPyObject_clientdata; + SwigPyObject_clientdata.pytype = swigpyobject; + } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { + PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); +# if PY_VERSION_HEX >= 0x03000000 + return NULL; +# else + return; +# endif + } + + /* All objects have a 'this' attribute */ + this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + (void)this_descr; + + /* All objects have a 'thisown' attribute */ + thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + (void)thisown_descr; + + public_interface = PyList_New(0); + public_symbol = 0; + (void)public_symbol; + + PyDict_SetItemString(md, "__all__", public_interface); + Py_DECREF(public_interface); + for (i = 0; SwigMethods[i].ml_name != NULL; ++i) + SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name); + for (i = 0; swig_const_table[i].name != 0; ++i) + SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name); +#endif + + SWIG_InstallConstants(d,swig_const_table); + + SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "CHM_UNCOMPRESSED",SWIG_From_int((int)((0)))); + SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "CHM_COMPRESSED",SWIG_From_int((int)((1)))); + SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "CHM_MAX_PATHLEN",SWIG_From_int((int)(256))); + + /* type '::chmUnitInfo' */ + builtin_pytype = (PyTypeObject *)&SwigPyBuiltin__chmUnitInfo_type; + builtin_pytype->tp_dict = d = PyDict_New(); + SwigPyBuiltin_SetMetaType(builtin_pytype, metatype); + builtin_pytype->tp_new = PyType_GenericNew; + builtin_base_count = 0; + builtin_bases[builtin_base_count] = NULL; + SwigPyBuiltin_InitBases(builtin_pytype, builtin_bases); + PyDict_SetItemString(d, "this", this_descr); + PyDict_SetItemString(d, "thisown", thisown_descr); + if (PyType_Ready(builtin_pytype) < 0) { + PyErr_SetString(PyExc_TypeError, "Could not create type 'chmUnitInfo'."); +#if PY_VERSION_HEX >= 0x03000000 + return NULL; +#else + return; +#endif + } + Py_INCREF(builtin_pytype); + PyModule_AddObject(m, "chmUnitInfo", (PyObject *)builtin_pytype); + SwigPyBuiltin_AddPublicSymbol(public_interface, "chmUnitInfo"); + d = md; + SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "CHM_PARAM_MAX_BLOCKS_CACHED",SWIG_From_int((int)(0))); + SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "CHM_RESOLVE_SUCCESS",SWIG_From_int((int)((0)))); + SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "CHM_RESOLVE_FAILURE",SWIG_From_int((int)((1)))); + SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "CHM_ENUMERATE_NORMAL",SWIG_From_int((int)((1)))); + SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "CHM_ENUMERATE_META",SWIG_From_int((int)((2)))); + SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "CHM_ENUMERATE_SPECIAL",SWIG_From_int((int)((4)))); + SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "CHM_ENUMERATE_FILES",SWIG_From_int((int)((8)))); + SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "CHM_ENUMERATE_DIRS",SWIG_From_int((int)((16)))); + SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "CHM_ENUMERATE_ALL",SWIG_From_int((int)((31)))); + SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "CHM_ENUMERATOR_FAILURE",SWIG_From_int((int)((0)))); + SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "CHM_ENUMERATOR_CONTINUE",SWIG_From_int((int)((1)))); + SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "CHM_ENUMERATOR_SUCCESS",SWIG_From_int((int)((2)))); +#if PY_VERSION_HEX >= 0x03000000 + return m; +#else + return; +#endif } From 2fb46fb3ddb848246713798ecea7551484ab6366 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 29 Dec 2018 09:41:06 +0530 Subject: [PATCH 0092/2613] Get rid of locale storage since it does not fix the crash --- src/calibre/gui2/tweak_book/editor/syntax/html.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/editor/syntax/html.py b/src/calibre/gui2/tweak_book/editor/syntax/html.py index 96ce24940e..e0296dd5e3 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/html.py +++ b/src/calibre/gui2/tweak_book/editor/syntax/html.py @@ -73,7 +73,6 @@ if _speedup is not None: def spell_property(sfmt, locale): s = QTextCharFormat(sfmt) s.setProperty(SPELL_LOCALE_PROPERTY, locale) - s.mem = locale # ensure locale is not garbage collected return s _speedup.init(spell_property, dictionaries.recognized, split_into_words_and_positions) del spell_property From 19b02bd063e33a3809a7aa38f11b37355ea6c161 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 29 Dec 2018 13:16:42 +0530 Subject: [PATCH 0093/2613] PDF Input: Fix non-breaking spaces represented as entities in the output of pdftohtml, which breaks some search/replace expressions Also modernize the pdftohtml module to make it more likely to work under py3, since I was there already. --- src/calibre/ebooks/pdf/pdftohtml.py | 118 ++++++++++++++-------------- 1 file changed, 57 insertions(+), 61 deletions(-) diff --git a/src/calibre/ebooks/pdf/pdftohtml.py b/src/calibre/ebooks/pdf/pdftohtml.py index 1ccc4209be..44da4e8095 100644 --- a/src/calibre/ebooks/pdf/pdftohtml.py +++ b/src/calibre/ebooks/pdf/pdftohtml.py @@ -1,30 +1,43 @@ -# -*- coding: utf-8 -*- +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +# License: GPLv3 Copyright: 2008, Kovid Goyal -from __future__ import print_function -__license__ = 'GPL v3' -__copyright__ = '2008, Kovid Goyal , ' \ - '2009, John Schember ' -__docformat__ = 'restructuredtext en' +from __future__ import print_function, unicode_literals -import errno, os, sys, subprocess, shutil, re -from functools import partial +import errno +import os +import re +import shutil +import subprocess +import sys +from calibre import CurrentDir, replace_entities, prints +from calibre.constants import ( + filesystem_encoding, isbsd, islinux, isosx, ispy3, iswindows +) from calibre.ebooks import ConversionError, DRMError from calibre.ebooks.chardet import xml_to_unicode from calibre.ptempfile import PersistentTemporaryFile -from calibre.constants import (isosx, iswindows, islinux, isbsd, - filesystem_encoding) -from calibre import CurrentDir from calibre.utils.cleantext import clean_xml_chars +from calibre.utils.ipc import eintr_retry_call + PDFTOHTML = 'pdftohtml' -popen = subprocess.Popen + + +def popen(cmd, **kw): + if not ispy3: + cmd = [x.encode(filesystem_encoding) if not isinstance(x, bytes) else x for x in cmd] + if iswindows: + kw['creationflags'] = 0x08 + return subprocess.Popen(cmd, **kw) + + if isosx and hasattr(sys, 'frameworks_dir'): PDFTOHTML = os.path.join(getattr(sys, 'frameworks_dir'), PDFTOHTML) if iswindows and hasattr(sys, 'frozen'): base = sys.extensions_location if hasattr(sys, 'new_app_layout') else os.path.dirname(sys.executable) PDFTOHTML = os.path.join(base, 'pdftohtml.exe') - popen = partial(subprocess.Popen, creationflags=0x08) # CREATE_NO_WINDOW=0x08 so that no ugly console is popped up if (islinux or isbsd) and getattr(sys, 'frozen', False): PDFTOHTML = os.path.join(sys.executables_location, 'bin', 'pdftohtml') @@ -36,37 +49,29 @@ def pdftohtml(output_dir, pdf_path, no_images, as_xml=False): It will also write all extracted images to the output_dir ''' - pdfsrc = os.path.join(output_dir, u'src.pdf') - index = os.path.join(output_dir, u'index.'+('xml' if as_xml else 'html')) + pdfsrc = os.path.join(output_dir, 'src.pdf') + index = os.path.join(output_dir, 'index.'+('xml' if as_xml else 'html')) - with open(pdf_path, 'rb') as src, open(pdfsrc, 'wb') as dest: + with lopen(pdf_path, 'rb') as src, lopen(pdfsrc, 'wb') as dest: shutil.copyfileobj(src, dest) with CurrentDir(output_dir): - # This is necessary as pdftohtml doesn't always (linux) respect - # absolute paths. Also, it allows us to safely pass only bytestring - # arguments to subprocess on widows - # subprocess in python 2 cannot handle unicode arguments on windows - # that cannot be encoded with mbcs. Ensure all args are - # bytestrings. def a(x): - return os.path.basename(x).encode('ascii') + return os.path.basename(x) - exe = PDFTOHTML.encode(filesystem_encoding) if isinstance(PDFTOHTML, - unicode) else PDFTOHTML - - cmd = [exe, b'-enc', b'UTF-8', b'-noframes', b'-p', b'-nomerge', - b'-nodrm', a(pdfsrc), a(index)] + exe = PDFTOHTML + cmd = [exe, '-enc', 'UTF-8', '-noframes', '-p', '-nomerge', + '-nodrm', a(pdfsrc), a(index)] if isbsd: - cmd.remove(b'-nodrm') + cmd.remove('-nodrm') if no_images: - cmd.append(b'-i') + cmd.append('-i') if as_xml: cmd.append('-xml') - logf = PersistentTemporaryFile(u'pdftohtml_log') + logf = PersistentTemporaryFile('pdftohtml_log') try: p = popen(cmd, stderr=logf._fd, stdout=logf._fd, stdin=subprocess.PIPE) @@ -76,53 +81,44 @@ def pdftohtml(output_dir, pdf_path, no_images, as_xml=False): _('Could not find pdftohtml, check it is in your PATH')) else: raise - - while True: - try: - ret = p.wait() - break - except OSError as e: - if e.errno == errno.EINTR: - continue - else: - raise + ret = eintr_retry_call(p.wait) logf.flush() logf.close() - out = open(logf.name, 'rb').read().strip() + out = lopen(logf.name, 'rb').read().decode('utf-8', 'replace').strip() if ret != 0: - raise ConversionError(b'pdftohtml failed with return code: %d\n%s' % (ret, out)) + raise ConversionError('pdftohtml failed with return code: %d\n%s' % (ret, out)) if out: - print("pdftohtml log:") - print(out) + prints("pdftohtml log:") + prints(out) if not os.path.exists(index) or os.stat(index).st_size < 100: raise DRMError() if not as_xml: with lopen(index, 'r+b') as i: - raw = i.read() + raw = i.read().decode('utf-8') raw = flip_images(raw) raw = raw.replace('\n = 0.20 output self closing
tags, this # breaks the pdf heuristics regexps, so replace them - raw = raw.replace(b'
', b'
') - raw = re.sub(br'', '
') + raw = re.sub(r']+/?>', raw, flags=re.I): + for match in re.finditer(']+/?>', raw, flags=re.I): img = match.group() - m = re.search(br'class="(x|y|xy)flip"', img) + m = re.search(r'class="(x|y|xy)flip"', img) if m is None: continue flip = m.group(1) - src = re.search(br'src="([^"]+)"', img) + src = re.search(r'src="([^"]+)"', img) if src is None: continue img = src.group(1) if not os.path.exists(img): continue flip_image(img, flip) - raw = re.sub(br'\s*', b'', raw, flags=re.I|re.DOTALL) + raw = re.sub(r'\s*', '', raw, flags=re.I|re.DOTALL) return raw From 2e33cb5cb3bde7f9939b3036db003af54741e9fd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 29 Dec 2018 16:20:14 +0530 Subject: [PATCH 0094/2613] Saving to disk: Fix errors on Linux/macOS if the title/authors are long enough to make individual path components larger than 255 characters. Fixes #1807525 [[Enhancement] Filename length during saving on disk](https://bugs.launchpad.net/calibre/+bug/1807525) --- src/calibre/library/save_to_disk.py | 4 ++-- src/calibre/utils/filenames.py | 31 +++++++++++++++++------------ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/calibre/library/save_to_disk.py b/src/calibre/library/save_to_disk.py index d9bad8edea..f1896a6e52 100644 --- a/src/calibre/library/save_to_disk.py +++ b/src/calibre/library/save_to_disk.py @@ -12,7 +12,7 @@ from calibre.constants import DEBUG from calibre.db.errors import NoSuchFormat from calibre.utils.config import Config, StringConfig, tweaks from calibre.utils.formatter import TemplateFormatter -from calibre.utils.filenames import shorten_components_to, supports_long_names, ascii_filename +from calibre.utils.filenames import shorten_components_to, ascii_filename from calibre.constants import preferred_encoding from calibre.ebooks.metadata import fmt_sidx from calibre.ebooks.metadata import title_sort @@ -378,7 +378,7 @@ def sanitize_args(root, opts): root = os.path.abspath(root) opts.template = preprocess_template(opts.template) - length = 1000 if supports_long_names(root) else 240 + length = 240 length -= len(root) if length < 5: raise ValueError('%r is too long.'%root) diff --git a/src/calibre/utils/filenames.py b/src/calibre/utils/filenames.py index f2ab60f880..58460d52f7 100644 --- a/src/calibre/utils/filenames.py +++ b/src/calibre/utils/filenames.py @@ -11,7 +11,7 @@ from math import ceil from calibre import force_unicode, isbytestring, prints, sanitize_file_name from calibre.constants import ( - filesystem_encoding, iswindows, plugins, preferred_encoding + filesystem_encoding, iswindows, plugins, preferred_encoding, isosx ) from calibre.utils.localization import get_udc @@ -38,18 +38,6 @@ def ascii_filename(orig, substitute='_'): return sanitize_file_name(''.join(ans), substitute=substitute) -def supports_long_names(path): - t = ('a'*300)+'.txt' - try: - p = os.path.join(path, t) - open(p, 'wb').close() - os.remove(p) - except: - return False - else: - return True - - def shorten_component(s, by_what): l = len(s) if l < by_what: @@ -60,7 +48,24 @@ def shorten_component(s, by_what): return s[:l] + s[-l:] +def limit_component(x, limit=254): + # windows and macs use ytf-16 codepoints for length, linux uses arbitrary + # binary data, but we will assume utf-8 + filename_encoding_for_length = 'utf-16' if iswindows or isosx else 'utf-8' + + def encoded_length(): + q = x if isinstance(x, bytes) else x.encode(filename_encoding_for_length) + return len(q) + + while encoded_length() > limit: + delta = encoded_length() - limit + x = shorten_component(x, max(2, delta // 2)) + + return x + + def shorten_components_to(length, components, more_to_take=0, last_has_extension=True): + components = [limit_component(cx) for cx in components] filepath = os.sep.join(components) extra = len(filepath) - (length - more_to_take) if extra < 1: From f3543137eac096207aa66b31dfc6c65c9ed79fc4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 31 Dec 2018 19:12:10 +0530 Subject: [PATCH 0095/2613] ... --- src/calibre/ebooks/conversion/plumber.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py index 93cd51f58e..0bd93ad6b4 100644 --- a/src/calibre/ebooks/conversion/plumber.py +++ b/src/calibre/ebooks/conversion/plumber.py @@ -263,8 +263,8 @@ OptionRecommendation(name='level2_toc', OptionRecommendation(name='level3_toc', recommended_value=None, level=OptionRecommendation.LOW, help=_('XPath expression that specifies all tags that should be ' - 'added to the Table of Contents at level three. Each entry ' - 'is added under the previous level two entry.' + 'added to the Table of Contents at level three. Each entry ' + 'is added under the previous level two entry.' ' See the XPath Tutorial in the calibre User Manual for examples.' ) ), From 84326d407cc9601c01d287113144fed9f5ff544c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 2 Jan 2019 08:51:04 +0530 Subject: [PATCH 0096/2613] Get Books: Use an external browser for Google Books Fixes #1810205 [get books/store/google won't let me log into my google account](https://bugs.launchpad.net/calibre/+bug/1810205) --- src/calibre/gui2/store/stores/google_books_plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/store/stores/google_books_plugin.py b/src/calibre/gui2/store/stores/google_books_plugin.py index 3070ec5c47..239a0bdde1 100644 --- a/src/calibre/gui2/store/stores/google_books_plugin.py +++ b/src/calibre/gui2/store/stores/google_books_plugin.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import (unicode_literals, division, absolute_import, print_function) -store_version = 4 # Needed for dynamic plugin loading +store_version = 5 # Needed for dynamic plugin loading __license__ = 'GPL 3' __copyright__ = '2011, John Schember ' @@ -75,7 +75,7 @@ class GoogleBooksStore(BasicStoreConfig, StorePlugin): def open(self, parent=None, detail_item=None, external=False): url = 'https://books.google.com/books' - if external or self.config.get('open_external', False): + if True or external or self.config.get('open_external', False): open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url))) else: d = WebStoreDialog(self.gui, url, parent, detail_item) From dde3ae0416419bb31add1690d507adf3c04d0c98 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 2 Jan 2019 09:28:34 +0530 Subject: [PATCH 0097/2613] Edit Book: Fix style attribute on tags not being preserved. Fixes #1810193 [ebook-edit drops STYLE attribute from HTML tags](https://bugs.launchpad.net/calibre/+bug/1810193) --- src/calibre/ebooks/mobi/writer8/skeleton.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/mobi/writer8/skeleton.py b/src/calibre/ebooks/mobi/writer8/skeleton.py index d6e4246d69..064a39d522 100644 --- a/src/calibre/ebooks/mobi/writer8/skeleton.py +++ b/src/calibre/ebooks/mobi/writer8/skeleton.py @@ -59,6 +59,7 @@ def node_from_path(root, path): parent = parent[idx] return parent + mychr = chr if ispy3 else unichr @@ -227,6 +228,8 @@ class Chunker(object): attrib = {'lang':lang} if lang else {} if 'class' in root.attrib: attrib['class'] = root.attrib['class'] + if 'style' in root.attrib: + attrib['style'] = root.attrib['style'] nroot = etree.Element('html', attrib=attrib) nroot.text = root.text nroot.tail = '\n' @@ -442,5 +445,3 @@ class Chunker(object): 'tool on the orig and rebuilt directories') else: self.log('Skeleton HTML before and after is identical.') - - From f19fda0857c6b9c1bb7b70863af8da0db3710285 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 2 Jan 2019 10:41:31 +0530 Subject: [PATCH 0098/2613] Update Il Post --- recipes/icons/il_post.png | Bin 0 -> 614 bytes recipes/il_post.recipe | 107 +++++++++++++++++++++++++++++++------- 2 files changed, 88 insertions(+), 19 deletions(-) create mode 100644 recipes/icons/il_post.png diff --git a/recipes/icons/il_post.png b/recipes/icons/il_post.png new file mode 100644 index 0000000000000000000000000000000000000000..7e8dcb8ed7e912c4059fe0b7c53cfffcf991bbac GIT binary patch literal 614 zcmV-s0-61ZP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGqB>(^xB>_oNB=7(L0sBcrK~y+TW8j#7 z7#Xq6J0!gLsKL53mYdFLu0F-H;0XJ?L&yqHGyqlWtUaB2=%(M!%T8M_1ns^OweOnr zvg62l5E_7@VoQ!?9JwXG;sndwLqG)7ufO(8#^GDM3y;8+Av6G`fiB58dYg0pVX0-u z`4%1l>H)I*FF)2^a~dd%t^sI+_>yA<$M1OWxV--U>&aK2IBmU{ee~AFx1SByongh) z07O7hy|rgHK6w5A|Nnpg{(t@b=kLFNd!D`%U2+WW4HPH2Z@;we{%fGCF2DT(R0`B~ z=i@h<&FA6n0V1ddppe?CQ$Tf3zWmTweM)KN$%KP9x-ULD{QN`U?khl_plbm7FMRK{ z-#}yk{hM>+888M+H=G692DIemx1TQCE~5JZsKI0Vr7yq!09CyE@w@ZFqr79c&%FKw zd(fA-<$??4T?$8G~nM9~05KyOGc zJq~n6@1@6Kd#?hck8A$nt&iTGdi6 zSuCLhbP_ORR^NN|_{)#)fBu49{(t|o_v))p!MzJX2o1o{)LeZU7`OquuFSsv?9lTM zK(pa~g(HNMfO>#d0};@F+zSrNE Date: Wed, 2 Jan 2019 10:52:12 +0530 Subject: [PATCH 0099/2613] ... --- recipes/il_post.recipe | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/il_post.recipe b/recipes/il_post.recipe index b0e9da3507..f4d03563c5 100644 --- a/recipes/il_post.recipe +++ b/recipes/il_post.recipe @@ -22,7 +22,8 @@ sections = [ ("Politica", "https://www.ilpost.it/politica/"), ("Tecnologia", "https://www.ilpost.it/tecnologia/"), ("Internet", - "https://www.ilpost.it/internet/")("Scienza", "https://www.ilpost.it/scienza/"), + "https://www.ilpost.it/internet/"), + ("Scienza", "https://www.ilpost.it/scienza/"), ("Cultura", "https://www.ilpost.it/cultura/"), ("Economia", "https://www.ilpost.it/economia/"), ("Sport", "https://www.ilpost.it/sport/"), From 3f57acc815699204b85fdd0beac4c4d087fbcef2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 2 Jan 2019 12:41:29 +0530 Subject: [PATCH 0100/2613] pep8 --- src/calibre/ebooks/oeb/transforms/structure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/transforms/structure.py b/src/calibre/ebooks/oeb/transforms/structure.py index 192e449dd4..fab67146ee 100644 --- a/src/calibre/ebooks/oeb/transforms/structure.py +++ b/src/calibre/ebooks/oeb/transforms/structure.py @@ -137,7 +137,7 @@ class DetectStructure(object): def get_toc_parts_for_xpath(self, expr): # if an attribute is selected by the xpath expr then truncate it # from the path and instead return it as where to find the title text - title_attribute_regex = re.compile('/@([-\w]+)$') + title_attribute_regex = re.compile(r'/@([-\w]+)$') match = title_attribute_regex.search(expr) if match is not None: return expr[0:match.start()], match.group(1) From dd7d8ea3c4f47e315623d882d6b68339da959ab9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 2 Jan 2019 21:49:02 +0530 Subject: [PATCH 0101/2613] Switch from cssutils to css-parser css-parser is a new fork of the unmaintained cssutils. See https://github.com/ebook-utils/css-parser --- manual/plugin_examples/editor_demo/main.py | 5 ++-- src/calibre/customize/profiles.py | 2 +- src/calibre/devices/kobo/driver.py | 8 +++---- .../ebooks/conversion/plugins/epub_output.py | 2 +- .../ebooks/conversion/plugins/fb2_input.py | 4 ++-- .../ebooks/conversion/plugins/html_input.py | 6 ++--- src/calibre/ebooks/conversion/plumber.py | 4 ++-- src/calibre/ebooks/css_transform_rules.py | 4 ++-- src/calibre/ebooks/mobi/reader/markup.py | 24 ------------------- src/calibre/ebooks/mobi/writer8/main.py | 18 +++++++------- src/calibre/ebooks/odt/input.py | 12 ++++------ src/calibre/ebooks/oeb/base.py | 10 ++++---- src/calibre/ebooks/oeb/normalize_css.py | 9 +++---- src/calibre/ebooks/oeb/polish/cascade.py | 7 +++--- src/calibre/ebooks/oeb/polish/check/fonts.py | 2 +- src/calibre/ebooks/oeb/polish/check/main.py | 3 +-- .../ebooks/oeb/polish/check/parsing.py | 6 ++--- src/calibre/ebooks/oeb/polish/container.py | 6 ++--- src/calibre/ebooks/oeb/polish/css.py | 4 ++-- .../ebooks/oeb/polish/tests/cascade.py | 2 +- src/calibre/ebooks/oeb/polish/utils.py | 8 +++---- src/calibre/ebooks/oeb/reader.py | 4 ++-- src/calibre/ebooks/oeb/stylizer.py | 10 ++++---- .../ebooks/oeb/transforms/embed_fonts.py | 4 ++-- .../ebooks/oeb/transforms/filenames.py | 5 ++-- src/calibre/ebooks/oeb/transforms/flatcss.py | 14 +++++------ .../ebooks/oeb/transforms/page_margin.py | 2 +- .../ebooks/oeb/transforms/trimmanifest.py | 4 ++-- src/calibre/gui2/tweak_book/boss.py | 8 +++---- src/calibre/gui2/tweak_book/diff/view.py | 6 ++--- .../gui2/tweak_book/editor/smarts/html.py | 2 +- src/calibre/srv/render_book.py | 4 ++-- src/tinycss/fonts3.py | 3 ++- 33 files changed, 91 insertions(+), 121 deletions(-) diff --git a/manual/plugin_examples/editor_demo/main.py b/manual/plugin_examples/editor_demo/main.py index 85c0dcdd69..88b032a563 100644 --- a/manual/plugin_examples/editor_demo/main.py +++ b/manual/plugin_examples/editor_demo/main.py @@ -8,7 +8,7 @@ __copyright__ = '2014, Kovid Goyal ' import re from PyQt5.Qt import QAction, QInputDialog -from cssutils.css import CSSRule +from css_parser.css import CSSRule # The base class that all tools must inherit from from calibre.gui2.tweak_book.plugin import Tool @@ -17,6 +17,7 @@ from calibre import force_unicode from calibre.gui2 import error_dialog from calibre.ebooks.oeb.polish.container import OEB_DOCS, OEB_STYLES, serialize + class DemoTool(Tool): #: Set this to a unique name it will be used as a key @@ -79,7 +80,7 @@ class DemoTool(Tool): # stylesheets, "); - } else { - if(n) { - n.replaceChild(document.createTextNode(s),n.firstChild); - } else { - n = document.createElement("style"); - n.type = "text/css"; - n.id = id; - n.appendChild(document.createTextNode(s)); - document.getElementsByTagName("head")[0].appendChild(n); - } - } -} - -setStylesheet("#AMMLcloseDiv \{font-size:0.8em; padding-top:1em; color:#014\}\n#AMMLwarningBox \{position:absolute; width:100%; top:0; left:0; z-index:200; text-align:center; font-size:1em; font-weight:bold; padding:0.5em 0 0.5em 0; color:#ffc; background:#c30\}"); - -function init(){ - var msg, warnings = new Array(); - if (document.getElementById==null){ - alert("This webpage requires a recent browser such as Mozilla Firefox"); - return null; - } - if (checkForMathML && (msg = checkMathML())) warnings.push(msg); - if (warnings.length>0) displayWarnings(warnings); - if (!noMathML) initSymbols(); - return true; -} - -function checkMathML(){ - if (navigator.appName.slice(0,8)=="Netscape") - if (navigator.appVersion.slice(0,1)>="5") noMathML = null; - else noMathML = true; - else if (navigator.appName.slice(0,9)=="Microsoft") - try { - var ActiveX = new ActiveXObject("MathPlayer.Factory.1"); - noMathML = null; - } catch (e) { - noMathML = true; - } - else if (navigator.appName.slice(0,5)=="Opera") - if (navigator.appVersion.slice(0,3)>="9.5") noMathML = null; - else noMathML = true; -//noMathML = true; //uncomment to check - if (noMathML && notifyIfNoMathML) { - var msg = "To view the ASCIIMathML notation use Internet Explorer + MathPlayer or Mozilla Firefox 2.0 or later."; - if (alertIfNoMathML) - alert(msg); - else return msg; - } -} - -function hideWarning(){ - var body = document.getElementsByTagName("body")[0]; - body.removeChild(document.getElementById('AMMLwarningBox')); - body.onclick = null; -} - -function displayWarnings(warnings) { - var i, frag, nd = createElementXHTML("div"); - var body = document.getElementsByTagName("body")[0]; - body.onclick=hideWarning; - nd.id = 'AMMLwarningBox'; - for (i=0; i<", tag:"mo", output:"\u22C9", tex:"ltimes", ttype:CONST}, -{input:"><|", tag:"mo", output:"\u22CA", tex:"rtimes", ttype:CONST}, -{input:"|><|", tag:"mo", output:"\u22C8", tex:"bowtie", ttype:CONST}, -{input:"-:", tag:"mo", output:"\u00F7", tex:"div", ttype:CONST}, -{input:"divide", tag:"mo", output:"-:", tex:null, ttype:DEFINITION}, -{input:"@", tag:"mo", output:"\u2218", tex:"circ", ttype:CONST}, -{input:"o+", tag:"mo", output:"\u2295", tex:"oplus", ttype:CONST}, -{input:"ox", tag:"mo", output:"\u2297", tex:"otimes", ttype:CONST}, -{input:"o.", tag:"mo", output:"\u2299", tex:"odot", ttype:CONST}, -{input:"sum", tag:"mo", output:"\u2211", tex:null, ttype:UNDEROVER}, -{input:"prod", tag:"mo", output:"\u220F", tex:null, ttype:UNDEROVER}, -{input:"^^", tag:"mo", output:"\u2227", tex:"wedge", ttype:CONST}, -{input:"^^^", tag:"mo", output:"\u22C0", tex:"bigwedge", ttype:UNDEROVER}, -{input:"vv", tag:"mo", output:"\u2228", tex:"vee", ttype:CONST}, -{input:"vvv", tag:"mo", output:"\u22C1", tex:"bigvee", ttype:UNDEROVER}, -{input:"nn", tag:"mo", output:"\u2229", tex:"cap", ttype:CONST}, -{input:"nnn", tag:"mo", output:"\u22C2", tex:"bigcap", ttype:UNDEROVER}, -{input:"uu", tag:"mo", output:"\u222A", tex:"cup", ttype:CONST}, -{input:"uuu", tag:"mo", output:"\u22C3", tex:"bigcup", ttype:UNDEROVER}, - -//binary relation symbols -{input:"!=", tag:"mo", output:"\u2260", tex:"ne", ttype:CONST}, -{input:":=", tag:"mo", output:":=", tex:null, ttype:CONST}, -{input:"lt", tag:"mo", output:"<", tex:null, ttype:CONST}, -{input:"<=", tag:"mo", output:"\u2264", tex:"le", ttype:CONST}, -{input:"lt=", tag:"mo", output:"\u2264", tex:"leq", ttype:CONST}, -{input:"gt", tag:"mo", output:">", tex:null, ttype:CONST}, -{input:">=", tag:"mo", output:"\u2265", tex:"ge", ttype:CONST}, -{input:"gt=", tag:"mo", output:"\u2265", tex:"geq", ttype:CONST}, -{input:"-<", tag:"mo", output:"\u227A", tex:"prec", ttype:CONST}, -{input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:CONST}, -{input:">-", tag:"mo", output:"\u227B", tex:"succ", ttype:CONST}, -{input:"-<=", tag:"mo", output:"\u2AAF", tex:"preceq", ttype:CONST}, -{input:">-=", tag:"mo", output:"\u2AB0", tex:"succeq", ttype:CONST}, -{input:"in", tag:"mo", output:"\u2208", tex:null, ttype:CONST}, -{input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:CONST}, -{input:"sub", tag:"mo", output:"\u2282", tex:"subset", ttype:CONST}, -{input:"sup", tag:"mo", output:"\u2283", tex:"supset", ttype:CONST}, -{input:"sube", tag:"mo", output:"\u2286", tex:"subseteq", ttype:CONST}, -{input:"supe", tag:"mo", output:"\u2287", tex:"supseteq", ttype:CONST}, -{input:"-=", tag:"mo", output:"\u2261", tex:"equiv", ttype:CONST}, -{input:"~=", tag:"mo", output:"\u2245", tex:"cong", ttype:CONST}, -{input:"~~", tag:"mo", output:"\u2248", tex:"approx", ttype:CONST}, -{input:"prop", tag:"mo", output:"\u221D", tex:"propto", ttype:CONST}, - -//logical symbols -{input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE}, -{input:"or", tag:"mtext", output:"or", tex:null, ttype:SPACE}, -{input:"not", tag:"mo", output:"\u00AC", tex:"neg", ttype:CONST}, -{input:"=>", tag:"mo", output:"\u21D2", tex:"implies", ttype:CONST}, -{input:"if", tag:"mo", output:"if", tex:null, ttype:SPACE}, -{input:"<=>", tag:"mo", output:"\u21D4", tex:"iff", ttype:CONST}, -{input:"AA", tag:"mo", output:"\u2200", tex:"forall", ttype:CONST}, -{input:"EE", tag:"mo", output:"\u2203", tex:"exists", ttype:CONST}, -{input:"_|_", tag:"mo", output:"\u22A5", tex:"bot", ttype:CONST}, -{input:"TT", tag:"mo", output:"\u22A4", tex:"top", ttype:CONST}, -{input:"|--", tag:"mo", output:"\u22A2", tex:"vdash", ttype:CONST}, -{input:"|==", tag:"mo", output:"\u22A8", tex:"models", ttype:CONST}, - -//grouping brackets -{input:"(", tag:"mo", output:"(", tex:null, ttype:LEFTBRACKET}, -{input:")", tag:"mo", output:")", tex:null, ttype:RIGHTBRACKET}, -{input:"[", tag:"mo", output:"[", tex:null, ttype:LEFTBRACKET}, -{input:"]", tag:"mo", output:"]", tex:null, ttype:RIGHTBRACKET}, -{input:"{", tag:"mo", output:"{", tex:null, ttype:LEFTBRACKET}, -{input:"}", tag:"mo", output:"}", tex:null, ttype:RIGHTBRACKET}, -{input:"|", tag:"mo", output:"|", tex:null, ttype:LEFTRIGHT}, -//{input:"||", tag:"mo", output:"||", tex:null, ttype:LEFTRIGHT}, -{input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET}, -{input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET}, -{input:"<<", tag:"mo", output:"\u2329", tex:null, ttype:LEFTBRACKET}, -{input:">>", tag:"mo", output:"\u232A", tex:null, ttype:RIGHTBRACKET}, -{input:"{:", tag:"mo", output:"{:", tex:null, ttype:LEFTBRACKET, invisible:true}, -{input:":}", tag:"mo", output:":}", tex:null, ttype:RIGHTBRACKET, invisible:true}, - -//miscellaneous symbols -{input:"int", tag:"mo", output:"\u222B", tex:null, ttype:CONST}, -{input:"dx", tag:"mi", output:"{:d x:}", tex:null, ttype:DEFINITION}, -{input:"dy", tag:"mi", output:"{:d y:}", tex:null, ttype:DEFINITION}, -{input:"dz", tag:"mi", output:"{:d z:}", tex:null, ttype:DEFINITION}, -{input:"dt", tag:"mi", output:"{:d t:}", tex:null, ttype:DEFINITION}, -{input:"oint", tag:"mo", output:"\u222E", tex:null, ttype:CONST}, -{input:"del", tag:"mo", output:"\u2202", tex:"partial", ttype:CONST}, -{input:"grad", tag:"mo", output:"\u2207", tex:"nabla", ttype:CONST}, -{input:"+-", tag:"mo", output:"\u00B1", tex:"pm", ttype:CONST}, -{input:"O/", tag:"mo", output:"\u2205", tex:"emptyset", ttype:CONST}, -{input:"oo", tag:"mo", output:"\u221E", tex:"infty", ttype:CONST}, -{input:"aleph", tag:"mo", output:"\u2135", tex:null, ttype:CONST}, -{input:"...", tag:"mo", output:"...", tex:"ldots", ttype:CONST}, -{input:":.", tag:"mo", output:"\u2234", tex:"therefore", ttype:CONST}, -{input:"/_", tag:"mo", output:"\u2220", tex:"angle", ttype:CONST}, -{input:"/_\\", tag:"mo", output:"\u25B3", tex:"triangle", ttype:CONST}, -{input:"'", tag:"mo", output:"\u2032", tex:"prime", ttype:CONST}, -{input:"tilde", tag:"mover", output:"~", tex:null, ttype:UNARY, acc:true}, -{input:"\\ ", tag:"mo", output:"\u00A0", tex:null, ttype:CONST}, -{input:"frown", tag:"mo", output:"\u2322", tex:null, ttype:CONST}, -{input:"quad", tag:"mo", output:"\u00A0\u00A0", tex:null, ttype:CONST}, -{input:"qquad", tag:"mo", output:"\u00A0\u00A0\u00A0\u00A0", tex:null, ttype:CONST}, -{input:"cdots", tag:"mo", output:"\u22EF", tex:null, ttype:CONST}, -{input:"vdots", tag:"mo", output:"\u22EE", tex:null, ttype:CONST}, -{input:"ddots", tag:"mo", output:"\u22F1", tex:null, ttype:CONST}, -{input:"diamond", tag:"mo", output:"\u22C4", tex:null, ttype:CONST}, -{input:"square", tag:"mo", output:"\u25A1", tex:null, ttype:CONST}, -{input:"|__", tag:"mo", output:"\u230A", tex:"lfloor", ttype:CONST}, -{input:"__|", tag:"mo", output:"\u230B", tex:"rfloor", ttype:CONST}, -{input:"|~", tag:"mo", output:"\u2308", tex:"lceiling", ttype:CONST}, -{input:"~|", tag:"mo", output:"\u2309", tex:"rceiling", ttype:CONST}, -{input:"CC", tag:"mo", output:"\u2102", tex:null, ttype:CONST}, -{input:"NN", tag:"mo", output:"\u2115", tex:null, ttype:CONST}, -{input:"QQ", tag:"mo", output:"\u211A", tex:null, ttype:CONST}, -{input:"RR", tag:"mo", output:"\u211D", tex:null, ttype:CONST}, -{input:"ZZ", tag:"mo", output:"\u2124", tex:null, ttype:CONST}, -{input:"f", tag:"mi", output:"f", tex:null, ttype:UNARY, func:true}, -{input:"g", tag:"mi", output:"g", tex:null, ttype:UNARY, func:true}, - -//standard functions -{input:"lim", tag:"mo", output:"lim", tex:null, ttype:UNDEROVER}, -{input:"Lim", tag:"mo", output:"Lim", tex:null, ttype:UNDEROVER}, -{input:"sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true}, -{input:"cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true}, -{input:"tan", tag:"mo", output:"tan", tex:null, ttype:UNARY, func:true}, -{input:"sinh", tag:"mo", output:"sinh", tex:null, ttype:UNARY, func:true}, -{input:"cosh", tag:"mo", output:"cosh", tex:null, ttype:UNARY, func:true}, -{input:"tanh", tag:"mo", output:"tanh", tex:null, ttype:UNARY, func:true}, -{input:"cot", tag:"mo", output:"cot", tex:null, ttype:UNARY, func:true}, -{input:"sec", tag:"mo", output:"sec", tex:null, ttype:UNARY, func:true}, -{input:"csc", tag:"mo", output:"csc", tex:null, ttype:UNARY, func:true}, -{input:"arcsin", tag:"mo", output:"arcsin", tex:null, ttype:UNARY, func:true}, -{input:"arccos", tag:"mo", output:"arccos", tex:null, ttype:UNARY, func:true}, -{input:"arctan", tag:"mo", output:"arctan", tex:null, ttype:UNARY, func:true}, -{input:"coth", tag:"mo", output:"coth", tex:null, ttype:UNARY, func:true}, -{input:"sech", tag:"mo", output:"sech", tex:null, ttype:UNARY, func:true}, -{input:"csch", tag:"mo", output:"csch", tex:null, ttype:UNARY, func:true}, -{input:"exp", tag:"mo", output:"exp", tex:null, ttype:UNARY, func:true}, -{input:"abs", tag:"mo", output:"abs", tex:null, ttype:UNARY, rewriteleftright:["|","|"]}, -{input:"norm", tag:"mo", output:"norm", tex:null, ttype:UNARY, rewriteleftright:["\u2225","\u2225"]}, -{input:"floor", tag:"mo", output:"floor", tex:null, ttype:UNARY, rewriteleftright:["\u230A","\u230B"]}, -{input:"ceil", tag:"mo", output:"ceil", tex:null, ttype:UNARY, rewriteleftright:["\u2308","\u2309"]}, -{input:"log", tag:"mo", output:"log", tex:null, ttype:UNARY, func:true}, -{input:"ln", tag:"mo", output:"ln", tex:null, ttype:UNARY, func:true}, -{input:"det", tag:"mo", output:"det", tex:null, ttype:UNARY, func:true}, -{input:"dim", tag:"mo", output:"dim", tex:null, ttype:CONST}, -{input:"mod", tag:"mo", output:"mod", tex:null, ttype:CONST}, -{input:"gcd", tag:"mo", output:"gcd", tex:null, ttype:UNARY, func:true}, -{input:"lcm", tag:"mo", output:"lcm", tex:null, ttype:UNARY, func:true}, -{input:"lub", tag:"mo", output:"lub", tex:null, ttype:CONST}, -{input:"glb", tag:"mo", output:"glb", tex:null, ttype:CONST}, -{input:"min", tag:"mo", output:"min", tex:null, ttype:UNDEROVER}, -{input:"max", tag:"mo", output:"max", tex:null, ttype:UNDEROVER}, - -//arrows -{input:"uarr", tag:"mo", output:"\u2191", tex:"uparrow", ttype:CONST}, -{input:"darr", tag:"mo", output:"\u2193", tex:"downarrow", ttype:CONST}, -{input:"rarr", tag:"mo", output:"\u2192", tex:"rightarrow", ttype:CONST}, -{input:"->", tag:"mo", output:"\u2192", tex:"to", ttype:CONST}, -{input:">->", tag:"mo", output:"\u21A3", tex:"rightarrowtail", ttype:CONST}, -{input:"->>", tag:"mo", output:"\u21A0", tex:"twoheadrightarrow", ttype:CONST}, -{input:">->>", tag:"mo", output:"\u2916", tex:"twoheadrightarrowtail", ttype:CONST}, -{input:"|->", tag:"mo", output:"\u21A6", tex:"mapsto", ttype:CONST}, -{input:"larr", tag:"mo", output:"\u2190", tex:"leftarrow", ttype:CONST}, -{input:"harr", tag:"mo", output:"\u2194", tex:"leftrightarrow", ttype:CONST}, -{input:"rArr", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST}, -{input:"lArr", tag:"mo", output:"\u21D0", tex:"Leftarrow", ttype:CONST}, -{input:"hArr", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST}, -//commands with argument -{input:"sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:UNARY}, -{input:"root", tag:"mroot", output:"root", tex:null, ttype:BINARY}, -{input:"frac", tag:"mfrac", output:"/", tex:null, ttype:BINARY}, -{input:"/", tag:"mfrac", output:"/", tex:null, ttype:INFIX}, -{input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:BINARY}, -{input:"overset", tag:"mover", output:"stackrel", tex:null, ttype:BINARY}, -{input:"underset", tag:"munder", output:"stackrel", tex:null, ttype:BINARY}, -{input:"_", tag:"msub", output:"_", tex:null, ttype:INFIX}, -{input:"^", tag:"msup", output:"^", tex:null, ttype:INFIX}, -{input:"hat", tag:"mover", output:"\u005E", tex:null, ttype:UNARY, acc:true}, -{input:"bar", tag:"mover", output:"\u00AF", tex:"overline", ttype:UNARY, acc:true}, -{input:"vec", tag:"mover", output:"\u2192", tex:null, ttype:UNARY, acc:true}, -{input:"dot", tag:"mover", output:".", tex:null, ttype:UNARY, acc:true}, -{input:"ddot", tag:"mover", output:"..", tex:null, ttype:UNARY, acc:true}, -{input:"ul", tag:"munder", output:"\u0332", tex:"underline", ttype:UNARY, acc:true}, -{input:"ubrace", tag:"munder", output:"\u23DF", tex:"underbrace", ttype:UNARYUNDEROVER, acc:true}, -{input:"obrace", tag:"mover", output:"\u23DE", tex:"overbrace", ttype:UNARYUNDEROVER, acc:true}, -{input:"text", tag:"mtext", output:"text", tex:null, ttype:TEXT}, -{input:"mbox", tag:"mtext", output:"mbox", tex:null, ttype:TEXT}, -{input:"color", tag:"mstyle", ttype:BINARY}, -{input:"cancel", tag:"menclose", output:"cancel", tex:null, ttype:UNARY}, -AMquote, -{input:"bb", tag:"mstyle", atname:"mathvariant", atval:"bold", output:"bb", tex:null, ttype:UNARY}, -{input:"mathbf", tag:"mstyle", atname:"mathvariant", atval:"bold", output:"mathbf", tex:null, ttype:UNARY}, -{input:"sf", tag:"mstyle", atname:"mathvariant", atval:"sans-serif", output:"sf", tex:null, ttype:UNARY}, -{input:"mathsf", tag:"mstyle", atname:"mathvariant", atval:"sans-serif", output:"mathsf", tex:null, ttype:UNARY}, -{input:"bbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"bbb", tex:null, ttype:UNARY, codes:AMbbb}, -{input:"mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"mathbb", tex:null, ttype:UNARY, codes:AMbbb}, -{input:"cc", tag:"mstyle", atname:"mathvariant", atval:"script", output:"cc", tex:null, ttype:UNARY, codes:AMcal}, -{input:"mathcal", tag:"mstyle", atname:"mathvariant", atval:"script", output:"mathcal", tex:null, ttype:UNARY, codes:AMcal}, -{input:"tt", tag:"mstyle", atname:"mathvariant", atval:"monospace", output:"tt", tex:null, ttype:UNARY}, -{input:"mathtt", tag:"mstyle", atname:"mathvariant", atval:"monospace", output:"mathtt", tex:null, ttype:UNARY}, -{input:"fr", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"fr", tex:null, ttype:UNARY, codes:AMfrk}, -{input:"mathfrak", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"mathfrak", tex:null, ttype:UNARY, codes:AMfrk} -]; - -function compareNames(s1,s2) { - if (s1.input > s2.input) return 1 - else return -1; -} - -var AMnames = []; //list of input symbols - -function initSymbols() { - var texsymbols = [], i; - for (i=0; i=n where str appears or would be inserted -// assumes arr is sorted - if (n==0) { - var h,m; - n = -1; - h = arr.length; - while (n+1> 1; - if (arr[m]=str -} - -function AMgetSymbol(str) { -//return maximal initial substring of str that appears in names -//return null if there is none - var k = 0; //new pos - var j = 0; //old pos - var mk; //match pos - var st; - var tagst; - var match = ""; - var more = true; - for (var i=1; i<=str.length && more; i++) { - st = str.slice(0,i); //initial substring of length i - j = k; - k = position(AMnames, st, j); - if (k=AMnames[k]; - } - AMpreviousSymbol=AMcurrentSymbol; - if (match!=""){ - AMcurrentSymbol=AMsymbols[mk].ttype; - return AMsymbols[mk]; - } -// if str[0] is a digit or - return maxsubstring of digits.digits - AMcurrentSymbol=CONST; - k = 1; - st = str.slice(0,1); - var integ = true; - while ("0"<=st && st<="9" && k<=str.length) { - st = str.slice(k,k+1); - k++; - } - if (st == decimalsign) { - st = str.slice(k,k+1); - if ("0"<=st && st<="9") { - integ = false; - k++; - while ("0"<=st && st<="9" && k<=str.length) { - st = str.slice(k,k+1); - k++; - } - } - } - if ((integ && k>1) || k>2) { - st = str.slice(0,k-1); - tagst = "mn"; - } else { - k = 2; - st = str.slice(0,1); //take 1 character - tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi"); - } - if (st=="-" && AMpreviousSymbol==INFIX) { - AMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse - return {input:st, tag:tagst, output:st, ttype:UNARY, func:true}; - } - return {input:st, tag:tagst, output:st, ttype:CONST}; -} - -function AMremoveBrackets(node) { - var st; - if (!node.hasChildNodes()) { return; } - if (node.firstChild.hasChildNodes() && (node.nodeName=="mrow" || node.nodeName=="M:MROW")) { - st = node.firstChild.firstChild.nodeValue; - if (st=="(" || st=="[" || st=="{") node.removeChild(node.firstChild); - } - if (node.lastChild.hasChildNodes() && (node.nodeName=="mrow" || node.nodeName=="M:MROW")) { - st = node.lastChild.firstChild.nodeValue; - if (st==")" || st=="]" || st=="}") node.removeChild(node.lastChild); - } -} - -/*Parsing ASCII math expressions with the following grammar -v ::= [A-Za-z] | greek letters | numbers | other constant symbols -u ::= sqrt | text | bb | other unary symbols for font commands -b ::= frac | root | stackrel binary symbols -l ::= ( | [ | { | (: | {: left brackets -r ::= ) | ] | } | :) | :} right brackets -S ::= v | lEr | uS | bSS Simple expression -I ::= S_S | S^S | S_S^S | S Intermediate expression -E ::= IE | I/I Expression -Each terminal symbol is translated into a corresponding mathml node.*/ - -var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol; - -function AMparseSexpr(str) { //parses str and returns [node,tailstr] - var symbol, node, result, i, st,// rightvert = false, - newFrag = document.createDocumentFragment(); - str = AMremoveCharsAndBlanks(str,0); - symbol = AMgetSymbol(str); //either a token or a bracket or empty - if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) { - return [null,str]; - } - if (symbol.ttype == DEFINITION) { - str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length); - symbol = AMgetSymbol(str); - } - switch (symbol.ttype) { case UNDEROVER: - case CONST: - str = AMremoveCharsAndBlanks(str,symbol.input.length); - return [createMmlNode(symbol.tag, //its a constant - document.createTextNode(symbol.output)),str]; - case LEFTBRACKET: //read (expr+) - AMnestingDepth++; - str = AMremoveCharsAndBlanks(str,symbol.input.length); - result = AMparseExpr(str,true); - AMnestingDepth--; - if (typeof symbol.invisible == "boolean" && symbol.invisible) - node = createMmlNode("mrow",result[0]); - else { - node = createMmlNode("mo",document.createTextNode(symbol.output)); - node = createMmlNode("mrow",node); - node.appendChild(result[0]); - } - return [node,result[1]]; - case TEXT: - if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length); - if (str.charAt(0)=="{") i=str.indexOf("}"); - else if (str.charAt(0)=="(") i=str.indexOf(")"); - else if (str.charAt(0)=="[") i=str.indexOf("]"); - else if (symbol==AMquote) i=str.slice(1).indexOf("\"")+1; - else i = 0; - if (i==-1) i = str.length; - st = str.slice(1,i); - if (st.charAt(0) == " ") { - node = createMmlNode("mspace"); - node.setAttribute("width","1ex"); - newFrag.appendChild(node); - } - newFrag.appendChild( - createMmlNode(symbol.tag,document.createTextNode(st))); - if (st.charAt(st.length-1) == " ") { - node = createMmlNode("mspace"); - node.setAttribute("width","1ex"); - newFrag.appendChild(node); - } - str = AMremoveCharsAndBlanks(str,i+1); - return [createMmlNode("mrow",newFrag),str]; - case UNARYUNDEROVER: - case UNARY: - str = AMremoveCharsAndBlanks(str,symbol.input.length); - result = AMparseSexpr(str); - if (result[0]==null) return [createMmlNode(symbol.tag, - document.createTextNode(symbol.output)),str]; - if (typeof symbol.func == "boolean" && symbol.func) { // functions hack - st = str.charAt(0); - if (st=="^" || st=="_" || st=="/" || st=="|" || st=="," || - (symbol.input.length==1 && symbol.input.match(/\w/) && st!="(")) { - return [createMmlNode(symbol.tag, - document.createTextNode(symbol.output)),str]; - } else { - node = createMmlNode("mrow", - createMmlNode(symbol.tag,document.createTextNode(symbol.output))); - node.appendChild(result[0]); - return [node,result[1]]; - } - } - AMremoveBrackets(result[0]); - if (symbol.input == "sqrt") { // sqrt - return [createMmlNode(symbol.tag,result[0]),result[1]]; - } else if (typeof symbol.rewriteleftright != "undefined") { // abs, floor, ceil - node = createMmlNode("mrow", createMmlNode("mo",document.createTextNode(symbol.rewriteleftright[0]))); - node.appendChild(result[0]); - node.appendChild(createMmlNode("mo",document.createTextNode(symbol.rewriteleftright[1]))); - return [node,result[1]]; - } else if (symbol.input == "cancel") { // cancel - node = createMmlNode(symbol.tag,result[0]); - node.setAttribute("notation","updiagonalstrike"); - return [node,result[1]]; - } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent - node = createMmlNode(symbol.tag,result[0]); - node.appendChild(createMmlNode("mo",document.createTextNode(symbol.output))); - return [node,result[1]]; - } else { // font change command - if (!isIE && typeof symbol.codes != "undefined") { - for (i=0; i64 && st.charCodeAt(j)<91) - newst = newst + symbol.codes[st.charCodeAt(j)-65]; - else if (st.charCodeAt(j)>96 && st.charCodeAt(j)<123) - newst = newst + symbol.codes[st.charCodeAt(j)-71]; - else newst = newst + st.charAt(j); - if (result[0].nodeName=="mi") - result[0]=createMmlNode("mo"). - appendChild(document.createTextNode(newst)); - else result[0].replaceChild(createMmlNode("mo"). - appendChild(document.createTextNode(newst)), - result[0].childNodes[i]); - } - } - node = createMmlNode(symbol.tag,result[0]); - node.setAttribute(symbol.atname,symbol.atval); - return [node,result[1]]; - } - case BINARY: - str = AMremoveCharsAndBlanks(str,symbol.input.length); - result = AMparseSexpr(str); - if (result[0]==null) return [createMmlNode("mo", - document.createTextNode(symbol.input)),str]; - AMremoveBrackets(result[0]); - var result2 = AMparseSexpr(result[1]); - if (result2[0]==null) return [createMmlNode("mo", - document.createTextNode(symbol.input)),str]; - AMremoveBrackets(result2[0]); - if (symbol.input=="color") { - if (str.charAt(0)=="{") i=str.indexOf("}"); - else if (str.charAt(0)=="(") i=str.indexOf(")"); - else if (str.charAt(0)=="[") i=str.indexOf("]"); - st = str.slice(1,i); - node = createMmlNode(symbol.tag,result2[0]); - node.setAttribute("mathcolor",st); - return [node,result2[1]]; - } - if (symbol.input=="root" || symbol.output=="stackrel") - newFrag.appendChild(result2[0]); - newFrag.appendChild(result[0]); - if (symbol.input=="frac") newFrag.appendChild(result2[0]); - return [createMmlNode(symbol.tag,newFrag),result2[1]]; - case INFIX: - str = AMremoveCharsAndBlanks(str,symbol.input.length); - return [createMmlNode("mo",document.createTextNode(symbol.output)),str]; - case SPACE: - str = AMremoveCharsAndBlanks(str,symbol.input.length); - node = createMmlNode("mspace"); - node.setAttribute("width","1ex"); - newFrag.appendChild(node); - newFrag.appendChild( - createMmlNode(symbol.tag,document.createTextNode(symbol.output))); - node = createMmlNode("mspace"); - node.setAttribute("width","1ex"); - newFrag.appendChild(node); - return [createMmlNode("mrow",newFrag),str]; - case LEFTRIGHT: -// if (rightvert) return [null,str]; else rightvert = true; - AMnestingDepth++; - str = AMremoveCharsAndBlanks(str,symbol.input.length); - result = AMparseExpr(str,false); - AMnestingDepth--; - st = ""; - if (result[0].lastChild!=null) - st = result[0].lastChild.firstChild.nodeValue; - if (st == "|") { // its an absolute value subterm - node = createMmlNode("mo",document.createTextNode(symbol.output)); - node = createMmlNode("mrow",node); - node.appendChild(result[0]); - return [node,result[1]]; - } else { // the "|" is a \mid so use unicode 2223 (divides) for spacing - node = createMmlNode("mo",document.createTextNode("\u2223")); - node = createMmlNode("mrow",node); - return [node,str]; - } - default: -//alert("default"); - str = AMremoveCharsAndBlanks(str,symbol.input.length); - return [createMmlNode(symbol.tag, //its a constant - document.createTextNode(symbol.output)),str]; - } -} - -function AMparseIexpr(str) { - var symbol, sym1, sym2, node, result, underover; - str = AMremoveCharsAndBlanks(str,0); - sym1 = AMgetSymbol(str); - result = AMparseSexpr(str); - node = result[0]; - str = result[1]; - symbol = AMgetSymbol(str); - if (symbol.ttype == INFIX && symbol.input != "/") { - str = AMremoveCharsAndBlanks(str,symbol.input.length); -// if (symbol.input == "/") result = AMparseIexpr(str); else ... - result = AMparseSexpr(str); - if (result[0] == null) // show box in place of missing argument - result[0] = createMmlNode("mo",document.createTextNode("\u25A1")); - else AMremoveBrackets(result[0]); - str = result[1]; -// if (symbol.input == "/") AMremoveBrackets(node); - underover = (sym1.ttype == UNDEROVER || sym1.ttype == UNARYUNDEROVER); - if (symbol.input == "_") { - sym2 = AMgetSymbol(str); - if (sym2.input == "^") { - str = AMremoveCharsAndBlanks(str,sym2.input.length); - var res2 = AMparseSexpr(str); - AMremoveBrackets(res2[0]); - str = res2[1]; - node = createMmlNode((underover?"munderover":"msubsup"),node); - node.appendChild(result[0]); - node.appendChild(res2[0]); - node = createMmlNode("mrow",node); // so sum does not stretch - } else { - node = createMmlNode((underover?"munder":"msub"),node); - node.appendChild(result[0]); - } - } else if (symbol.input == "^" && underover) { - node = createMmlNode("mover",node); - node.appendChild(result[0]); - } else { - node = createMmlNode(symbol.tag,node); - node.appendChild(result[0]); - } - if (typeof sym1.func != 'undefined' && sym1.func) { - sym2 = AMgetSymbol(str); - if (sym2.ttype != INFIX && sym2.ttype != RIGHTBRACKET) { - result = AMparseIexpr(str); - node = createMmlNode("mrow",node); - node.appendChild(result[0]); - str = result[1]; - } - } - } - return [node,str]; -} - -function AMparseExpr(str,rightbracket) { - var symbol, node, result, i, - newFrag = document.createDocumentFragment(); - do { - str = AMremoveCharsAndBlanks(str,0); - result = AMparseIexpr(str); - node = result[0]; - str = result[1]; - symbol = AMgetSymbol(str); - if (symbol.ttype == INFIX && symbol.input == "/") { - str = AMremoveCharsAndBlanks(str,symbol.input.length); - result = AMparseIexpr(str); - if (result[0] == null) // show box in place of missing argument - result[0] = createMmlNode("mo",document.createTextNode("\u25A1")); - else AMremoveBrackets(result[0]); - str = result[1]; - AMremoveBrackets(node); - node = createMmlNode(symbol.tag,node); - node.appendChild(result[0]); - newFrag.appendChild(node); - symbol = AMgetSymbol(str); - } - else if (node!=undefined) newFrag.appendChild(node); - } while ((symbol.ttype != RIGHTBRACKET && - (symbol.ttype != LEFTRIGHT || rightbracket) - || AMnestingDepth == 0) && symbol!=null && symbol.output!=""); - if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) { -// if (AMnestingDepth > 0) AMnestingDepth--; - var len = newFrag.childNodes.length; - if (len>0 && newFrag.childNodes[len-1].nodeName == "mrow" - && newFrag.childNodes[len-1].lastChild - && newFrag.childNodes[len-1].lastChild.firstChild ) { //matrix - //removed to allow row vectors: //&& len>1 && - //newFrag.childNodes[len-2].nodeName == "mo" && - //newFrag.childNodes[len-2].firstChild.nodeValue == "," - var right = newFrag.childNodes[len-1].lastChild.firstChild.nodeValue; - if (right==")" || right=="]") { - var left = newFrag.childNodes[len-1].firstChild.firstChild.nodeValue; - if (left=="(" && right==")" && symbol.output != "}" || - left=="[" && right=="]") { - var pos = []; // positions of commas - var matrix = true; - var m = newFrag.childNodes.length; - for (i=0; matrix && i1) matrix = pos[i].length == pos[i-2].length; - } - matrix = matrix && (pos.length>1 || pos[0].length>0); - if (matrix) { - var row, frag, n, k, table = document.createDocumentFragment(); - for (i=0; i(-,-,...,-,-) - n = node.childNodes.length; - k = 0; - node.removeChild(node.firstChild); //remove ( - for (j=1; j2) { - newFrag.removeChild(newFrag.firstChild); //remove ) - newFrag.removeChild(newFrag.firstChild); //remove , - } - table.appendChild(createMmlNode("mtr",row)); - } - node = createMmlNode("mtable",table); - if (typeof symbol.invisible == "boolean" && symbol.invisible) node.setAttribute("columnalign","left"); - newFrag.replaceChild(node,newFrag.firstChild); - } - } - } - } - str = AMremoveCharsAndBlanks(str,symbol.input.length); - if (typeof symbol.invisible != "boolean" || !symbol.invisible) { - node = createMmlNode("mo",document.createTextNode(symbol.output)); - newFrag.appendChild(node); - } - } - return [newFrag,str]; -} - -function parseMath(str,latex) { - var frag, node; - AMnestingDepth = 0; - //some basic cleanup for dealing with stuff editors like TinyMCE adds - str = str.replace(/ /g,""); - str = str.replace(/>/g,">"); - str = str.replace(/</g,"<"); - str = str.replace(/(Sin|Cos|Tan|Arcsin|Arccos|Arctan|Sinh|Cosh|Tanh|Cot|Sec|Csc|Log|Ln|Abs)/g, function(v) { return v.toLowerCase(); }); - frag = AMparseExpr(str.replace(/^\s+/g,""),false)[0]; - node = createMmlNode("mstyle",frag); - if (mathcolor != "") node.setAttribute("mathcolor",mathcolor); - if (mathfontfamily != "") node.setAttribute("fontfamily",mathfontfamily); - if (displaystyle) node.setAttribute("displaystyle","true"); - node = createMmlNode("math",node); - if (showasciiformulaonhover) //fixed by djhsu so newline - node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko - return node; -} - -/* -function strarr2docFrag(arr, linebreaks, latex) { - var newFrag=document.createDocumentFragment(); - var expr = false; - for (var i=0; i,\\|!:;'~]|\\.(?!(?:\x20|$))|"+ambigAMtoken+englishAMtoken+simpleAMtoken; - var re = new RegExp("(^|\\s)((("+token+")\\s?)(("+token+secondenglishAMtoken+")\\s?)+)([,.?]?(?=\\s|$))","g"); - str = str.replace(re," `$2`$7"); - var arr = str.split(AMdelimiter1); - var re1 = new RegExp("(^|\\s)([b-zB-HJ-Z+*<>]|"+texcommand+ambigAMtoken+simpleAMtoken+")(\\s|\\n|$)","g"); - var re2 = new RegExp("(^|\\s)([a-z]|"+texcommand+ambigAMtoken+simpleAMtoken+")([,.])","g"); // removed |\d+ for now - for (i=0; i1 || mtch) { - if (!noMathML) { - frg = strarr2docFrag(arr,n.nodeType==8,latex); - var len = frg.childNodes.length; - n.parentNode.replaceChild(frg,n); - return len-1; - } else return 0; - } - } - } else return 0; - } else if (n.nodeName!="math") { - for (i=0; i element, not %1", - "<"+doc.firstChild.nodeName+">"]); - } - var data = {math:doc.firstChild, script:script}; - MATHML.DOMfilterHooks.Execute(data); - this.mml = this.MakeMML(data.math); - }, - - // - // Convert the MathML structure to the MathJax Element jax structure - // - MakeMML: function (node) { - var CLASS = String(node.getAttribute("class")||""); // make sure CLASS is a string - var mml, type = node.nodeName.toLowerCase().replace(/^[a-z]+:/,""); - var match = (CLASS.match(/(^| )MJX-TeXAtom-([^ ]*)/)); - if (match) { - mml = this.TeXAtom(match[2],match[2] === "OP" && !CLASS.match(/MJX-fixedlimits/)); - } else if (!(MML[type] && MML[type].isa && MML[type].isa(MML.mbase))) { - MathJax.Hub.signal.Post(["MathML Jax - unknown node type",type]); - return MML.Error(_("UnknownNodeType","Unknown node type: %1",type)); - } else { - mml = MML[type](); - } - this.AddAttributes(mml,node); this.CheckClass(mml,mml["class"]); - this.AddChildren(mml,node); - if (MATHML.config.useMathMLspacing) {mml.useMMLspacing = 0x08} - return mml; - }, - TeXAtom: function (mclass,movablelimits) { - var mml = MML.TeXAtom().With({texClass:MML.TEXCLASS[mclass]}); - if (movablelimits) {mml.movesupsub = mml.movablelimits = true} - return mml; - }, - CheckClass: function (mml,CLASS) { - CLASS = (CLASS||"").split(/ /); var NCLASS = []; - for (var i = 0, m = CLASS.length; i < m; i++) { - if (CLASS[i].substr(0,4) === "MJX-") { - if (CLASS[i] === "MJX-arrow") { - // This class was used in former versions of MathJax to attach an - // arrow to the updiagonalstrike notation. For backward - // compatibility, let's continue to accept this case. See issue 481. - if (!mml.notation.match("/"+MML.NOTATION.UPDIAGONALARROW+"/")) - mml.notation += " "+MML.NOTATION.UPDIAGONALARROW; - } else if (CLASS[i] === "MJX-variant") { - mml.variantForm = true; - // - // Variant forms come from AMSsymbols, and it sets up the - // character mappings, so load that if needed. - // - if (!MathJax.Extension["TeX/AMSsymbols"]) - {MathJax.Hub.RestartAfter(MathJax.Ajax.Require("[MathJax]/extensions/TeX/AMSsymbols.js"))} - } else if (CLASS[i].substr(0,11) !== "MJX-TeXAtom") { - mml.mathvariant = CLASS[i].substr(3); - // - // Caligraphic and oldstyle bold are set up in the boldsymbol - // extension, so load it if it isn't already loaded. - // - if (mml.mathvariant === "-tex-caligraphic-bold" || - mml.mathvariant === "-tex-oldstyle-bold") { - if (!MathJax.Extension["TeX/boldsymbol"]) - {MathJax.Hub.RestartAfter(MathJax.Ajax.Require("[MathJax]/extensions/TeX/boldsymbol.js"))} - } - } - } else {NCLASS.push(CLASS[i])} - } - if (NCLASS.length) {mml["class"] = NCLASS.join(" ")} else {delete mml["class"]} - }, - - // - // Add the attributes to the mml node - // - AddAttributes: function (mml,node) { - mml.attr = {}; mml.attrNames = []; - for (var i = 0, m = node.attributes.length; i < m; i++) { - var name = node.attributes[i].name; - if (name == "xlink:href") {name = "href"} - if (name.match(/:/)) continue; - if (name.match(/^_moz-math-((column|row)(align|line)|font-style)$/)) continue; - var value = node.attributes[i].value; - value = this.filterAttribute(name,value); - var defaults = (mml.type === "mstyle" ? MML.math.prototype.defaults : mml.defaults); - if (value != null) { - if (value.toLowerCase() === "true") {value = true} - else if (value.toLowerCase() === "false") {value = false} - if (defaults[name] != null || MML.copyAttributes[name]) - {mml[name] = value} else {mml.attr[name] = value} - mml.attrNames.push(name); - } - } - }, - filterAttribute: function (name,value) {return value}, // safe mode overrides this - - // - // Create the children for the mml node - // - AddChildren: function (mml,node) { - for (var i = 0, m = node.childNodes.length; i < m; i++) { - var child = node.childNodes[i]; - if (child.nodeName === "#comment") continue; - if (child.nodeName === "#text") { - if ((mml.isToken || mml.isChars) && !mml.mmlSelfClosing) { - var text = child.nodeValue; - if (mml.isToken) { - text = text.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); - text = this.trimSpace(text); - } - mml.Append(MML.chars(text)); - } else if (child.nodeValue.match(/\S/)) { - MATHML.Error(["UnexpectedTextNode", - "Unexpected text node: %1","'"+child.nodeValue+"'"]); - } - } else if (mml.type === "annotation-xml") { - mml.Append(MML.xml(child)); - } else { - var cmml = this.MakeMML(child); mml.Append(cmml); - if (cmml.mmlSelfClosing && cmml.data.length) - {mml.Append.apply(mml,cmml.data); cmml.data = []} - } - } - if (mml.type === "mrow" && mml.data.length >= 2) { - var first = mml.data[0], last = mml.data[mml.data.length-1]; - if (first.type === "mo" && first.Get("fence") && - last.type === "mo" && last.Get("fence")) { - if (first.data[0]) {mml.open = first.data.join("")} - if (last.data[0]) {mml.close = last.data.join("")} - } - } - }, - - // - // Clean Up the source to prepare for XML parsing - // - preProcessMath: function (math) { - if (math.match(/^<[a-z]+:/i) && !math.match(/^<[^<>]* xmlns:/)) { - math = math.replace(/^<([a-z]+)(:math)/i,'<$1$2 xmlns:$1="http://www.w3.org/1998/Math/MathML"') - } - // HTML5 removes xmlns: namespaces, so put them back for XML - var match = math.match(/^(])+)>)/i); - if (match && match[2].match(/ (?!xmlns=)[a-z]+=\"http:/i)) { - math = match[1].replace(/ (?!xmlns=)([a-z]+=(['"])http:.*?\2)/ig," xmlns:$1 $1") + - math.substr(match[0].length); - } - if (math.match(/^]* xmlns=/)) { - // append the MathML namespace - math = math.replace(/^<(math)/i,'\s*$/,"$2"); - return math.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); - }, - - // - // Remove attribute whitespace - // - trimSpace: function (string) { - return string.replace(/[\t\n\r]/g," ") // whitespace to spaces - .replace(/^ +/,"") // initial whitespace - .replace(/ +$/,"") // trailing whitespace - .replace(/ +/g," "); // internal multiple whitespace - }, - - // - // Replace a named entity by its value - // (look up from external files if necessary) - // - replaceEntity: function (match,entity) { - if (entity.match(/^(lt|amp|quot)$/)) {return match} // these mess up attribute parsing - if (MATHML.Parse.Entity[entity]) {return MATHML.Parse.Entity[entity]} - var file = entity.charAt(0).toLowerCase(); - var font = entity.match(/^[a-zA-Z](fr|scr|opf)$/); - if (font) {file = font[1]} - if (!MATHML.Parse.loaded[file]) { - MATHML.Parse.loaded[file] = true; - MathJax.Hub.RestartAfter(MathJax.Ajax.Require(MATHML.entityDir+"/"+file+".js")); - } - return match; - } - }, { - loaded: [] // the entity files that are loaded - }); - - /************************************************************************/ - - MATHML.Augment({ - sourceMenuTitle: /*_(MathMenu)*/ ["OriginalMathML","Original MathML"], - - prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run on MathML string before processing MathML - DOMfilterHooks: MathJax.Callback.Hooks(true), // hooks to run on MathML DOM before processing - postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run on internal jax format after processing MathML - - Translate: function (script) { - if (!this.ParseXML) {this.ParseXML = this.createParser()} - var mml, math, data = {script:script}; - if (script.firstChild && - script.firstChild.nodeName.toLowerCase().replace(/^[a-z]+:/,"") === "math") { - data.math = script.firstChild; - } else { - math = MathJax.HTML.getScript(script); - if (BROWSER.isMSIE) {math = math.replace(/( )+$/,"")} - data.math = math; - } - var callback = this.prefilterHooks.Execute(data); if (callback) return callback; - math = data.math; - try { - mml = MATHML.Parse(math,script).mml; - } catch(err) { - if (!err.mathmlError) {throw err} - mml = this.formatError(err,math,script); - } - data.math = MML(mml); - return this.postfilterHooks.Execute(data) || data.math; - }, - prefilterMath: function (math,script) {return math}, - prefilterMathML: function (math,script) {return math}, - formatError: function (err,math,script) { - var message = err.message.replace(/\n.*/,""); - MathJax.Hub.signal.Post(["MathML Jax - parse error",message,math,script]); - return MML.Error(message); - }, - Error: function (message) { - // - // Translate message if it is ["id","message",args] - // - if (message instanceof Array) {message = _.apply(_,message)} - throw MathJax.Hub.Insert(Error(message),{mathmlError: true}); - }, - // - // Parsers for various forms (DOMParser, Windows ActiveX object, other) - // - parseDOM: function (string) {return this.parser.parseFromString(string,"text/xml")}, - parseMS: function (string) {return (this.parser.loadXML(string) ? this.parser : null)}, - parseDIV: function (string) { - this.div.innerHTML = - "

"+string.replace(/<([a-z]+)([^>]*)\/>/g,"<$1$2>")+"
"; - var doc = this.div.firstChild; - this.div.innerHTML = ""; - return doc; - }, - parseError: function (string) {return null}, - createMSParser: function() { - var parser = null; - var xml = ["MSXML2.DOMDocument.6.0","MSXML2.DOMDocument.5.0", - "MSXML2.DOMDocument.4.0","MSXML2.DOMDocument.3.0", - "MSXML2.DOMDocument.2.0","Microsoft.XMLDOM"]; - for (var i = 0, m = xml.length; i < m && !parser; i++) { - try { - parser = new ActiveXObject(xml[i]) - } catch (err) {} - } - return parser; - }, - // - // Create the parser using a DOMParser, or other fallback method - // - createParser: function () { - if (window.DOMParser) { - this.parser = new DOMParser(); - return(this.parseDOM); - } else if (window.ActiveXObject) { - this.parser = this.createMSParser(); - if (!this.parser) { - MathJax.Localization.Try(this.parserCreationError); - return(this.parseError); - } - this.parser.async = false; - return(this.parseMS); - } - this.div = MathJax.Hub.Insert(document.createElement("div"),{ - style:{visibility:"hidden", overflow:"hidden", height:"1px", - position:"absolute", top:0} - }); - if (!document.body.firstChild) {document.body.appendChild(this.div)} - else {document.body.insertBefore(this.div,document.body.firstChild)} - return(this.parseDIV); - }, - parserCreationError: function () { - alert(_("CantCreateXMLParser", - "MathJax can't create an XML parser for MathML. Check that\n"+ - "the 'Script ActiveX controls marked safe for scripting' security\n"+ - "setting is enabled (use the Internet Options item in the Tools\n"+ - "menu, and select the Security panel, then press the Custom Level\n"+ - "button to check this).\n\n"+ - "MathML equations will not be able to be processed by MathJax.")); - }, - // - // Initialize the parser object (whichever type is used) - // - Startup: function () { - MML = MathJax.ElementJax.mml; - MML.mspace.Augment({mmlSelfClosing: true}); - MML.none.Augment({mmlSelfClosing: true}); - MML.mprescripts.Augment({mmlSelfClosing:true}); - MML.maligngroup.Augment({mmlSelfClosing:true}); - MML.malignmark.Augment({mmlSelfClosing:true}); - } - }); - - // - // Add the default pre-filter (for backward compatibility) - // - MATHML.prefilterHooks.Add(function (data) { - data.math = (typeof(data.math) === "string" ? - MATHML.prefilterMath(data.math,data.script) : - MATHML.prefilterMathML(data.math,data.script)); - }); - - MATHML.Parse.Entity = { - ApplyFunction: '\u2061', - Backslash: '\u2216', - Because: '\u2235', - Breve: '\u02D8', - Cap: '\u22D2', - CenterDot: '\u00B7', - CircleDot: '\u2299', - CircleMinus: '\u2296', - CirclePlus: '\u2295', - CircleTimes: '\u2297', - Congruent: '\u2261', - ContourIntegral: '\u222E', - Coproduct: '\u2210', - Cross: '\u2A2F', - Cup: '\u22D3', - CupCap: '\u224D', - Dagger: '\u2021', - Del: '\u2207', - Delta: '\u0394', - Diamond: '\u22C4', - DifferentialD: '\u2146', - DotEqual: '\u2250', - DoubleDot: '\u00A8', - DoubleRightTee: '\u22A8', - DoubleVerticalBar: '\u2225', - DownArrow: '\u2193', - DownLeftVector: '\u21BD', - DownRightVector: '\u21C1', - DownTee: '\u22A4', - Downarrow: '\u21D3', - Element: '\u2208', - EqualTilde: '\u2242', - Equilibrium: '\u21CC', - Exists: '\u2203', - ExponentialE: '\u2147', - FilledVerySmallSquare: '\u25AA', - ForAll: '\u2200', - Gamma: '\u0393', - Gg: '\u22D9', - GreaterEqual: '\u2265', - GreaterEqualLess: '\u22DB', - GreaterFullEqual: '\u2267', - GreaterLess: '\u2277', - GreaterSlantEqual: '\u2A7E', - GreaterTilde: '\u2273', - Hacek: '\u02C7', - Hat: '\u005E', - HumpDownHump: '\u224E', - HumpEqual: '\u224F', - Im: '\u2111', - ImaginaryI: '\u2148', - Integral: '\u222B', - Intersection: '\u22C2', - InvisibleComma: '\u2063', - InvisibleTimes: '\u2062', - Lambda: '\u039B', - Larr: '\u219E', - LeftAngleBracket: '\u27E8', - LeftArrow: '\u2190', - LeftArrowRightArrow: '\u21C6', - LeftCeiling: '\u2308', - LeftDownVector: '\u21C3', - LeftFloor: '\u230A', - LeftRightArrow: '\u2194', - LeftTee: '\u22A3', - LeftTriangle: '\u22B2', - LeftTriangleEqual: '\u22B4', - LeftUpVector: '\u21BF', - LeftVector: '\u21BC', - Leftarrow: '\u21D0', - Leftrightarrow: '\u21D4', - LessEqualGreater: '\u22DA', - LessFullEqual: '\u2266', - LessGreater: '\u2276', - LessSlantEqual: '\u2A7D', - LessTilde: '\u2272', - Ll: '\u22D8', - Lleftarrow: '\u21DA', - LongLeftArrow: '\u27F5', - LongLeftRightArrow: '\u27F7', - LongRightArrow: '\u27F6', - Longleftarrow: '\u27F8', - Longleftrightarrow: '\u27FA', - Longrightarrow: '\u27F9', - Lsh: '\u21B0', - MinusPlus: '\u2213', - NestedGreaterGreater: '\u226B', - NestedLessLess: '\u226A', - NotDoubleVerticalBar: '\u2226', - NotElement: '\u2209', - NotEqual: '\u2260', - NotExists: '\u2204', - NotGreater: '\u226F', - NotGreaterEqual: '\u2271', - NotLeftTriangle: '\u22EA', - NotLeftTriangleEqual: '\u22EC', - NotLess: '\u226E', - NotLessEqual: '\u2270', - NotPrecedes: '\u2280', - NotPrecedesSlantEqual: '\u22E0', - NotRightTriangle: '\u22EB', - NotRightTriangleEqual: '\u22ED', - NotSubsetEqual: '\u2288', - NotSucceeds: '\u2281', - NotSucceedsSlantEqual: '\u22E1', - NotSupersetEqual: '\u2289', - NotTilde: '\u2241', - NotVerticalBar: '\u2224', - Omega: '\u03A9', - OverBar: '\u203E', - OverBrace: '\u23DE', - PartialD: '\u2202', - Phi: '\u03A6', - Pi: '\u03A0', - PlusMinus: '\u00B1', - Precedes: '\u227A', - PrecedesEqual: '\u2AAF', - PrecedesSlantEqual: '\u227C', - PrecedesTilde: '\u227E', - Product: '\u220F', - Proportional: '\u221D', - Psi: '\u03A8', - Rarr: '\u21A0', - Re: '\u211C', - ReverseEquilibrium: '\u21CB', - RightAngleBracket: '\u27E9', - RightArrow: '\u2192', - RightArrowLeftArrow: '\u21C4', - RightCeiling: '\u2309', - RightDownVector: '\u21C2', - RightFloor: '\u230B', - RightTee: '\u22A2', - RightTeeArrow: '\u21A6', - RightTriangle: '\u22B3', - RightTriangleEqual: '\u22B5', - RightUpVector: '\u21BE', - RightVector: '\u21C0', - Rightarrow: '\u21D2', - Rrightarrow: '\u21DB', - Rsh: '\u21B1', - Sigma: '\u03A3', - SmallCircle: '\u2218', - Sqrt: '\u221A', - Square: '\u25A1', - SquareIntersection: '\u2293', - SquareSubset: '\u228F', - SquareSubsetEqual: '\u2291', - SquareSuperset: '\u2290', - SquareSupersetEqual: '\u2292', - SquareUnion: '\u2294', - Star: '\u22C6', - Subset: '\u22D0', - SubsetEqual: '\u2286', - Succeeds: '\u227B', - SucceedsEqual: '\u2AB0', - SucceedsSlantEqual: '\u227D', - SucceedsTilde: '\u227F', - SuchThat: '\u220B', - Sum: '\u2211', - Superset: '\u2283', - SupersetEqual: '\u2287', - Supset: '\u22D1', - Therefore: '\u2234', - Theta: '\u0398', - Tilde: '\u223C', - TildeEqual: '\u2243', - TildeFullEqual: '\u2245', - TildeTilde: '\u2248', - UnderBar: '\u005F', - UnderBrace: '\u23DF', - Union: '\u22C3', - UnionPlus: '\u228E', - UpArrow: '\u2191', - UpDownArrow: '\u2195', - UpTee: '\u22A5', - Uparrow: '\u21D1', - Updownarrow: '\u21D5', - Upsilon: '\u03A5', - Vdash: '\u22A9', - Vee: '\u22C1', - VerticalBar: '\u2223', - VerticalTilde: '\u2240', - Vvdash: '\u22AA', - Wedge: '\u22C0', - Xi: '\u039E', - acute: '\u00B4', - aleph: '\u2135', - alpha: '\u03B1', - amalg: '\u2A3F', - and: '\u2227', - ang: '\u2220', - angmsd: '\u2221', - angsph: '\u2222', - ape: '\u224A', - backprime: '\u2035', - backsim: '\u223D', - backsimeq: '\u22CD', - beta: '\u03B2', - beth: '\u2136', - between: '\u226C', - bigcirc: '\u25EF', - bigodot: '\u2A00', - bigoplus: '\u2A01', - bigotimes: '\u2A02', - bigsqcup: '\u2A06', - bigstar: '\u2605', - bigtriangledown: '\u25BD', - bigtriangleup: '\u25B3', - biguplus: '\u2A04', - blacklozenge: '\u29EB', - blacktriangle: '\u25B4', - blacktriangledown: '\u25BE', - blacktriangleleft: '\u25C2', - bowtie: '\u22C8', - boxdl: '\u2510', - boxdr: '\u250C', - boxminus: '\u229F', - boxplus: '\u229E', - boxtimes: '\u22A0', - boxul: '\u2518', - boxur: '\u2514', - bsol: '\u005C', - bull: '\u2022', - cap: '\u2229', - check: '\u2713', - chi: '\u03C7', - circ: '\u02C6', - circeq: '\u2257', - circlearrowleft: '\u21BA', - circlearrowright: '\u21BB', - circledR: '\u00AE', - circledS: '\u24C8', - circledast: '\u229B', - circledcirc: '\u229A', - circleddash: '\u229D', - clubs: '\u2663', - colon: '\u003A', - comp: '\u2201', - ctdot: '\u22EF', - cuepr: '\u22DE', - cuesc: '\u22DF', - cularr: '\u21B6', - cup: '\u222A', - curarr: '\u21B7', - curlyvee: '\u22CE', - curlywedge: '\u22CF', - dagger: '\u2020', - daleth: '\u2138', - ddarr: '\u21CA', - deg: '\u00B0', - delta: '\u03B4', - digamma: '\u03DD', - div: '\u00F7', - divideontimes: '\u22C7', - dot: '\u02D9', - doteqdot: '\u2251', - dotplus: '\u2214', - dotsquare: '\u22A1', - dtdot: '\u22F1', - ecir: '\u2256', - efDot: '\u2252', - egs: '\u2A96', - ell: '\u2113', - els: '\u2A95', - empty: '\u2205', - epsi: '\u03B5', - epsiv: '\u03F5', - erDot: '\u2253', - eta: '\u03B7', - eth: '\u00F0', - flat: '\u266D', - fork: '\u22D4', - frown: '\u2322', - gEl: '\u2A8C', - gamma: '\u03B3', - gap: '\u2A86', - gimel: '\u2137', - gnE: '\u2269', - gnap: '\u2A8A', - gne: '\u2A88', - gnsim: '\u22E7', - gt: '\u003E', - gtdot: '\u22D7', - harrw: '\u21AD', - hbar: '\u210F', - hellip: '\u2026', - hookleftarrow: '\u21A9', - hookrightarrow: '\u21AA', - imath: '\u0131', - infin: '\u221E', - intcal: '\u22BA', - iota: '\u03B9', - jmath: '\u0237', - kappa: '\u03BA', - kappav: '\u03F0', - lEg: '\u2A8B', - lambda: '\u03BB', - lap: '\u2A85', - larrlp: '\u21AB', - larrtl: '\u21A2', - lbrace: '\u007B', - lbrack: '\u005B', - le: '\u2264', - leftleftarrows: '\u21C7', - leftthreetimes: '\u22CB', - lessdot: '\u22D6', - lmoust: '\u23B0', - lnE: '\u2268', - lnap: '\u2A89', - lne: '\u2A87', - lnsim: '\u22E6', - longmapsto: '\u27FC', - looparrowright: '\u21AC', - lowast: '\u2217', - loz: '\u25CA', - lt: '\u003C', - ltimes: '\u22C9', - ltri: '\u25C3', - macr: '\u00AF', - malt: '\u2720', - mho: '\u2127', - mu: '\u03BC', - multimap: '\u22B8', - nLeftarrow: '\u21CD', - nLeftrightarrow: '\u21CE', - nRightarrow: '\u21CF', - nVDash: '\u22AF', - nVdash: '\u22AE', - natur: '\u266E', - nearr: '\u2197', - nharr: '\u21AE', - nlarr: '\u219A', - not: '\u00AC', - nrarr: '\u219B', - nu: '\u03BD', - nvDash: '\u22AD', - nvdash: '\u22AC', - nwarr: '\u2196', - omega: '\u03C9', - omicron: '\u03BF', - or: '\u2228', - osol: '\u2298', - period: '\u002E', - phi: '\u03C6', - phiv: '\u03D5', - pi: '\u03C0', - piv: '\u03D6', - prap: '\u2AB7', - precnapprox: '\u2AB9', - precneqq: '\u2AB5', - precnsim: '\u22E8', - prime: '\u2032', - psi: '\u03C8', - rarrtl: '\u21A3', - rbrace: '\u007D', - rbrack: '\u005D', - rho: '\u03C1', - rhov: '\u03F1', - rightrightarrows: '\u21C9', - rightthreetimes: '\u22CC', - ring: '\u02DA', - rmoust: '\u23B1', - rtimes: '\u22CA', - rtri: '\u25B9', - scap: '\u2AB8', - scnE: '\u2AB6', - scnap: '\u2ABA', - scnsim: '\u22E9', - sdot: '\u22C5', - searr: '\u2198', - sect: '\u00A7', - sharp: '\u266F', - sigma: '\u03C3', - sigmav: '\u03C2', - simne: '\u2246', - smile: '\u2323', - spades: '\u2660', - sub: '\u2282', - subE: '\u2AC5', - subnE: '\u2ACB', - subne: '\u228A', - supE: '\u2AC6', - supnE: '\u2ACC', - supne: '\u228B', - swarr: '\u2199', - tau: '\u03C4', - theta: '\u03B8', - thetav: '\u03D1', - tilde: '\u02DC', - times: '\u00D7', - triangle: '\u25B5', - triangleq: '\u225C', - upsi: '\u03C5', - upuparrows: '\u21C8', - veebar: '\u22BB', - vellip: '\u22EE', - weierp: '\u2118', - xi: '\u03BE', - yen: '\u00A5', - zeta: '\u03B6', - zigrarr: '\u21DD' - }; - - MATHML.loadComplete("jax.js"); - -})(MathJax.InputJax.MathML,MathJax.Hub.Browser); diff --git a/resources/viewer/mathjax/jax/input/TeX/config.js b/resources/viewer/mathjax/jax/input/TeX/config.js deleted file mode 100644 index 22c2e78149..0000000000 --- a/resources/viewer/mathjax/jax/input/TeX/config.js +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ - -/************************************************************* - * - * MathJax/jax/input/TeX/config.js - * - * Initializes the TeX InputJax (the main definition is in - * MathJax/jax/input/TeX/jax.js, which is loaded when needed). - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2009-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -MathJax.InputJax.TeX = MathJax.InputJax({ - id: "TeX", - version: "2.6.1", - directory: MathJax.InputJax.directory + "/TeX", - extensionDir: MathJax.InputJax.extensionDir + "/TeX", - - config: { - TagSide: "right", - TagIndent: "0.8em", - MultLineWidth: "85%", - - equationNumbers: { - autoNumber: "none", // "AMS" for standard AMS numbering, - // or "all" for all displayed equations - formatNumber: function (n) {return n}, - formatTag: function (n) {return '('+n+')'}, - formatID: function (n) {return 'mjx-eqn-'+String(n).replace(/[:"'<>&]/g,"")}, - formatURL: function (id) {return '#'+escape(id)}, - useLabelIds: true - } - } -}); -MathJax.InputJax.TeX.Register("math/tex"); - -MathJax.InputJax.TeX.loadComplete("config.js"); diff --git a/resources/viewer/mathjax/jax/input/TeX/jax.js b/resources/viewer/mathjax/jax/input/TeX/jax.js deleted file mode 100644 index 8463c8be36..0000000000 --- a/resources/viewer/mathjax/jax/input/TeX/jax.js +++ /dev/null @@ -1,2275 +0,0 @@ -/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ - -/************************************************************* - * - * MathJax/jax/input/TeX/jax.js - * - * Implements the TeX InputJax that reads mathematics in - * TeX and LaTeX format and converts it to the MML ElementJax - * internal format. - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2009-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function (TEX,HUB,AJAX) { - var MML, NBSP = "\u00A0"; - - var _ = function (id) { - return MathJax.Localization._.apply(MathJax.Localization, - [["TeX", id]].concat([].slice.call(arguments,1))); - }; - - var STACK = MathJax.Object.Subclass({ - Init: function (env,inner) { - this.global = {isInner: inner}; - this.data = [STACKITEM.start(this.global)]; - if (env) {this.data[0].env = env} - this.env = this.data[0].env; - }, - Push: function () { - var i, m, item, top; - for (i = 0, m = arguments.length; i < m; i++) { - item = arguments[i]; if (!item) continue; - if (item instanceof MML.mbase) {item = STACKITEM.mml(item)} - item.global = this.global; - top = (this.data.length ? this.Top().checkItem(item) : true); - if (top instanceof Array) {this.Pop(); this.Push.apply(this,top)} - else if (top instanceof STACKITEM) {this.Pop(); this.Push(top)} - else if (top) { - this.data.push(item); - if (item.env) { - for (var id in this.env) - {if (this.env.hasOwnProperty(id)) {item.env[id] = this.env[id]}} - this.env = item.env; - } else {item.env = this.env} - } - } - }, - Pop: function () { - var item = this.data.pop(); if (!item.isOpen) {delete item.env} - this.env = (this.data.length ? this.Top().env : {}); - return item; - }, - Top: function (n) { - if (n == null) {n = 1} - if (this.data.length < n) {return null} - return this.data[this.data.length-n]; - }, - Prev: function (noPop) { - var top = this.Top(); - if (noPop) {return top.data[top.data.length-1]} - else {return top.Pop()} - }, - toString: function () {return "stack[\n "+this.data.join("\n ")+"\n]"} - }); - - var STACKITEM = STACK.Item = MathJax.Object.Subclass({ - type: "base", - endError: /*_()*/ ["ExtraOpenMissingClose","Extra open brace or missing close brace"], - closeError: /*_()*/ ["ExtraCloseMissingOpen","Extra close brace or missing open brace"], - rightError: /*_()*/ ["MissingLeftExtraRight","Missing \\left or extra \\right"], - Init: function () { - if (this.isOpen) {this.env = {}} - this.data = []; - this.Push.apply(this,arguments); - }, - Push: function () {this.data.push.apply(this.data,arguments)}, - Pop: function () {return this.data.pop()}, - mmlData: function (inferred,forceRow) { - if (inferred == null) {inferred = true} - if (this.data.length === 1 && !forceRow) {return this.data[0]} - return MML.mrow.apply(MML,this.data).With((inferred ? {inferred: true}: {})); - }, - checkItem: function (item) { - if (item.type === "over" && this.isOpen) {item.num = this.mmlData(false); this.data = []} - if (item.type === "cell" && this.isOpen) { - if (item.linebreak) {return false} - TEX.Error(["Misplaced","Misplaced %1",item.name]); - } - if (item.isClose && this[item.type+"Error"]) {TEX.Error(this[item.type+"Error"])} - if (!item.isNotStack) {return true} - this.Push(item.data[0]); return false; - }, - With: function (def) { - for (var id in def) {if (def.hasOwnProperty(id)) {this[id] = def[id]}} - return this; - }, - toString: function () {return this.type+"["+this.data.join("; ")+"]"} - }); - - STACKITEM.start = STACKITEM.Subclass({ - type: "start", isOpen: true, - Init: function (global) { - this.SUPER(arguments).Init.call(this); - this.global = global; - }, - checkItem: function (item) { - if (item.type === "stop") {return STACKITEM.mml(this.mmlData())} - return this.SUPER(arguments).checkItem.call(this,item); - } - }); - - STACKITEM.stop = STACKITEM.Subclass({ - type: "stop", isClose: true - }); - - STACKITEM.open = STACKITEM.Subclass({ - type: "open", isOpen: true, - stopError: /*_()*/ ["ExtraOpenMissingClose","Extra open brace or missing close brace"], - checkItem: function (item) { - if (item.type === "close") { - var mml = this.mmlData(); - return STACKITEM.mml(MML.TeXAtom(mml)); // TeXAtom make it an ORD to prevent spacing (FIXME: should be another way) - } - return this.SUPER(arguments).checkItem.call(this,item); - } - }); - - STACKITEM.close = STACKITEM.Subclass({ - type: "close", isClose: true - }); - - STACKITEM.prime = STACKITEM.Subclass({ - type: "prime", - checkItem: function (item) { - if (this.data[0].type !== "msubsup") - {return [MML.msup(this.data[0],this.data[1]),item]} - this.data[0].SetData(this.data[0].sup,this.data[1]); - return [this.data[0],item]; - } - }); - - STACKITEM.subsup = STACKITEM.Subclass({ - type: "subsup", - stopError: /*_()*/ ["MissingScript","Missing superscript or subscript argument"], - supError: /*_()*/ ["MissingOpenForSup","Missing open brace for superscript"], - subError: /*_()*/ ["MissingOpenForSub","Missing open brace for subscript"], - checkItem: function (item) { - if (item.type === "open" || item.type === "left") {return true} - if (item.type === "mml") { - if (this.primes) { - if (this.position !== 2) {this.data[0].SetData(2,this.primes)} - else {item.data[0] = MML.mrow(this.primes.With({variantForm:true}),item.data[0])} - } - this.data[0].SetData(this.position,item.data[0]); - if (this.movesupsub != null) {this.data[0].movesupsub = this.movesupsub} - return STACKITEM.mml(this.data[0]); - } - if (this.SUPER(arguments).checkItem.call(this,item)) - {TEX.Error(this[["","subError","supError"][this.position]])} - }, - Pop: function () {} - }); - - STACKITEM.over = STACKITEM.Subclass({ - type: "over", isClose: true, name: "\\over", - checkItem: function (item,stack) { - if (item.type === "over") - {TEX.Error(["AmbiguousUseOf","Ambiguous use of %1",item.name])} - if (item.isClose) { - var mml = MML.mfrac(this.num,this.mmlData(false)); - if (this.thickness != null) {mml.linethickness = this.thickness} - if (this.open || this.close) { - mml.texWithDelims = true; - mml = TEX.fixedFence(this.open,mml,this.close); - } - return [STACKITEM.mml(mml), item]; - } - return this.SUPER(arguments).checkItem.call(this,item); - }, - toString: function () {return "over["+this.num+" / "+this.data.join("; ")+"]"} - }); - - STACKITEM.left = STACKITEM.Subclass({ - type: "left", isOpen: true, delim: '(', - stopError: /*_()*/ ["ExtraLeftMissingRight", "Extra \\left or missing \\right"], - checkItem: function (item) { - if (item.type === "right") - {return STACKITEM.mml(TEX.fenced(this.delim,this.mmlData(),item.delim))} - return this.SUPER(arguments).checkItem.call(this,item); - } - }); - - STACKITEM.right = STACKITEM.Subclass({ - type: "right", isClose: true, delim: ')' - }); - - STACKITEM.begin = STACKITEM.Subclass({ - type: "begin", isOpen: true, - checkItem: function (item) { - if (item.type === "end") { - if (item.name !== this.name) - {TEX.Error(["EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.name,item.name])} - if (!this.end) {return STACKITEM.mml(this.mmlData())} - return this.parse[this.end].call(this.parse,this,this.data); - } - if (item.type === "stop") - {TEX.Error(["EnvMissingEnd","Missing \\end{%1}",this.name])} - return this.SUPER(arguments).checkItem.call(this,item); - } - }); - - STACKITEM.end = STACKITEM.Subclass({ - type: "end", isClose: true - }); - - STACKITEM.style = STACKITEM.Subclass({ - type: "style", - checkItem: function (item) { - if (!item.isClose) {return this.SUPER(arguments).checkItem.call(this,item)} - var mml = MML.mstyle.apply(MML,this.data).With(this.styles); - return [STACKITEM.mml(mml),item]; - } - }); - - STACKITEM.position = STACKITEM.Subclass({ - type: "position", - checkItem: function (item) { - if (item.isClose) {TEX.Error(["MissingBoxFor","Missing box for %1",this.name])} - if (item.isNotStack) { - var mml = item.mmlData(); - switch (this.move) { - case 'vertical': - mml = MML.mpadded(mml).With({height: this.dh, depth: this.dd, voffset: this.dh}); - return [STACKITEM.mml(mml)]; - case 'horizontal': - return [STACKITEM.mml(this.left),item,STACKITEM.mml(this.right)]; - } - } - return this.SUPER(arguments).checkItem.call(this,item); - } - }); - - STACKITEM.array = STACKITEM.Subclass({ - type: "array", isOpen: true, arraydef: {}, - Init: function () { - this.table = []; this.row = []; this.env = {}; this.frame = []; this.hfill = []; - this.SUPER(arguments).Init.apply(this,arguments); - }, - checkItem: function (item) { - if (item.isClose && item.type !== "over") { - if (item.isEntry) {this.EndEntry(); this.clearEnv(); return false} - if (item.isCR) {this.EndEntry(); this.EndRow(); this.clearEnv(); return false} - this.EndTable(); this.clearEnv(); - var scriptlevel = this.arraydef.scriptlevel; delete this.arraydef.scriptlevel; - var mml = MML.mtable.apply(MML,this.table).With(this.arraydef); - if (this.frame.length === 4) { - mml.frame = (this.frame.dashed ? "dashed" : "solid"); - } else if (this.frame.length) { - mml.hasFrame = true; - if (this.arraydef.rowlines) {this.arraydef.rowlines = this.arraydef.rowlines.replace(/none( none)+$/,"none")} - mml = MML.menclose(mml).With({notation: this.frame.join(" "), isFrame: true}); - if ((this.arraydef.columnlines||"none") != "none" || - (this.arraydef.rowlines||"none") != "none") {mml.padding = 0} // HTML-CSS jax implements this - } - if (scriptlevel) {mml = MML.mstyle(mml).With({scriptlevel: scriptlevel})} - if (this.open || this.close) {mml = TEX.fenced(this.open,mml,this.close)} - mml = STACKITEM.mml(mml); - if (this.requireClose) { - if (item.type === 'close') {return mml} - TEX.Error(["MissingCloseBrace","Missing close brace"]); - } - return [mml,item]; - } - return this.SUPER(arguments).checkItem.call(this,item); - }, - EndEntry: function () { - var mtd = MML.mtd.apply(MML,this.data); - if (this.hfill.length) { - if (this.hfill[0] === 0) mtd.columnalign = "right"; - if (this.hfill[this.hfill.length-1] === this.data.length) - mtd.columnalign = (mtd.columnalign ? "center" : "left"); - } - this.row.push(mtd); this.data = []; this.hfill = []; - }, - EndRow: function () { - var mtr = MML.mtr; - if (this.isNumbered && this.row.length === 3) { - this.row.unshift(this.row.pop()); // move equation number to first position - mtr = MML.mlabeledtr; - } - this.table.push(mtr.apply(MML,this.row)); this.row = []; - }, - EndTable: function () { - if (this.data.length || this.row.length) {this.EndEntry(); this.EndRow()} - this.checkLines(); - }, - checkLines: function () { - if (this.arraydef.rowlines) { - var lines = this.arraydef.rowlines.split(/ /); - if (lines.length === this.table.length) { - this.frame.push("bottom"); lines.pop(); - this.arraydef.rowlines = lines.join(' '); - } else if (lines.length < this.table.length-1) { - this.arraydef.rowlines += " none"; - } - } - if (this.rowspacing) { - var rows = this.arraydef.rowspacing.split(/ /); - while (rows.length < this.table.length) {rows.push(this.rowspacing+"em")} - this.arraydef.rowspacing = rows.join(' '); - } - }, - clearEnv: function () { - for (var id in this.env) {if (this.env.hasOwnProperty(id)) {delete this.env[id]}} - } - }); - - STACKITEM.cell = STACKITEM.Subclass({ - type: "cell", isClose: true - }); - - STACKITEM.mml = STACKITEM.Subclass({ - type: "mml", isNotStack: true, - Add: function () {this.data.push.apply(this.data,arguments); return this} - }); - - STACKITEM.fn = STACKITEM.Subclass({ - type: "fn", - checkItem: function (item) { - if (this.data[0]) { - if (item.isOpen) {return true} - if (item.type !== "fn") { - if (item.type !== "mml" || !item.data[0]) {return [this.data[0],item]} - if (item.data[0].isa(MML.mspace)) {return [this.data[0],item]} - var mml = item.data[0]; if (mml.isEmbellished()) {mml = mml.CoreMO()} - if ([0,0,1,1,0,1,1,0,0,0][mml.Get("texClass")]) {return [this.data[0],item]} - } - return [this.data[0],MML.mo(MML.entity("#x2061")).With({texClass:MML.TEXCLASS.NONE}),item]; - } - return this.SUPER(arguments).checkItem.apply(this,arguments); - } - }); - - STACKITEM.not = STACKITEM.Subclass({ - type: "not", - checkItem: function (item) { - var mml, c; - if (item.type === "open" || item.type === "left") {return true} - if (item.type === "mml" && item.data[0].type.match(/^(mo|mi|mtext)$/)) { - mml = item.data[0], c = mml.data.join(""); - if (c.length === 1 && !mml.movesupsub) { - c = STACKITEM.not.remap[c.charCodeAt(0)]; - if (c) {mml.SetData(0,MML.chars(String.fromCharCode(c)))} - else {mml.Append(MML.chars("\u0338"))} - return item; - } - } - // \mathrel{\rlap{\notChar}} - mml = MML.mpadded(MML.mtext("\u29F8")).With({width:0}); - mml = MML.TeXAtom(mml).With({texClass:MML.TEXCLASS.REL}); - return [mml,item]; - } - }); - STACKITEM.not.remap = { - 0x2190:0x219A, 0x2192:0x219B, 0x2194:0x21AE, - 0x21D0:0x21CD, 0x21D2:0x21CF, 0x21D4:0x21CE, - 0x2208:0x2209, 0x220B:0x220C, 0x2223:0x2224, 0x2225:0x2226, - 0x223C:0x2241, 0x007E:0x2241, 0x2243:0x2244, 0x2245:0x2247, - 0x2248:0x2249, 0x224D:0x226D, 0x003D:0x2260, 0x2261:0x2262, - 0x003C:0x226E, 0x003E:0x226F, 0x2264:0x2270, 0x2265:0x2271, - 0x2272:0x2274, 0x2273:0x2275, 0x2276:0x2278, 0x2277:0x2279, - 0x227A:0x2280, 0x227B:0x2281, 0x2282:0x2284, 0x2283:0x2285, - 0x2286:0x2288, 0x2287:0x2289, 0x22A2:0x22AC, 0x22A8:0x22AD, - 0x22A9:0x22AE, 0x22AB:0x22AF, 0x227C:0x22E0, 0x227D:0x22E1, - 0x2291:0x22E2, 0x2292:0x22E3, 0x22B2:0x22EA, 0x22B3:0x22EB, - 0x22B4:0x22EC, 0x22B5:0x22ED, 0x2203:0x2204 - }; - - STACKITEM.dots = STACKITEM.Subclass({ - type: "dots", - checkItem: function (item) { - if (item.type === "open" || item.type === "left") {return true} - var dots = this.ldots; - if (item.type === "mml" && item.data[0].isEmbellished()) { - var tclass = item.data[0].CoreMO().Get("texClass"); - if (tclass === MML.TEXCLASS.BIN || tclass === MML.TEXCLASS.REL) {dots = this.cdots} - } - return [dots,item]; - } - }); - - - var TEXDEF = { - // - // Add new definitions without overriding user-defined ones - // - Add: function (src,dst,nouser) { - if (!dst) {dst = this} - for (var id in src) {if (src.hasOwnProperty(id)) { - if (typeof src[id] === 'object' && !(src[id] instanceof Array) && - (typeof dst[id] === 'object' || typeof dst[id] === 'function')) - {this.Add(src[id],dst[id],src[id],nouser)} - else if (!dst[id] || !dst[id].isUser || !nouser) {dst[id] = src[id]} - }} - return dst; - } - }; - var STARTUP = function () { - MML = MathJax.ElementJax.mml; - HUB.Insert(TEXDEF,{ - - // patterns for letters and numbers - letter: /[a-z]/i, - digit: /[0-9.]/, - number: /^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)*|\.[0-9]+)/, - - special: { - '\\': 'ControlSequence', - '{': 'Open', - '}': 'Close', - '~': 'Tilde', - '^': 'Superscript', - '_': 'Subscript', - ' ': 'Space', - "\t": 'Space', - "\r": 'Space', - "\n": 'Space', - "'": 'Prime', - '%': 'Comment', - '&': 'Entry', - '#': 'Hash', - '\u00A0': 'Space', - '\u2019': 'Prime' - }, - - remap: { - '-': '2212', - '*': '2217', - '`': '2018' // map ` to back quote - }, - - mathchar0mi: { - // Lower-case greek - alpha: '03B1', - beta: '03B2', - gamma: '03B3', - delta: '03B4', - epsilon: '03F5', - zeta: '03B6', - eta: '03B7', - theta: '03B8', - iota: '03B9', - kappa: '03BA', - lambda: '03BB', - mu: '03BC', - nu: '03BD', - xi: '03BE', - omicron: '03BF', // added for completeness - pi: '03C0', - rho: '03C1', - sigma: '03C3', - tau: '03C4', - upsilon: '03C5', - phi: '03D5', - chi: '03C7', - psi: '03C8', - omega: '03C9', - varepsilon: '03B5', - vartheta: '03D1', - varpi: '03D6', - varrho: '03F1', - varsigma: '03C2', - varphi: '03C6', - - // Ord symbols - S: ['00A7',{mathvariant: MML.VARIANT.NORMAL}], - aleph: ['2135',{mathvariant: MML.VARIANT.NORMAL}], - hbar: ['210F',{variantForm:true}], - imath: '0131', - jmath: '0237', - ell: '2113', - wp: ['2118',{mathvariant: MML.VARIANT.NORMAL}], - Re: ['211C',{mathvariant: MML.VARIANT.NORMAL}], - Im: ['2111',{mathvariant: MML.VARIANT.NORMAL}], - partial: ['2202',{mathvariant: MML.VARIANT.NORMAL}], - infty: ['221E',{mathvariant: MML.VARIANT.NORMAL}], - prime: ['2032',{mathvariant: MML.VARIANT.NORMAL, variantForm:true}], - emptyset: ['2205',{mathvariant: MML.VARIANT.NORMAL}], - nabla: ['2207',{mathvariant: MML.VARIANT.NORMAL}], - top: ['22A4',{mathvariant: MML.VARIANT.NORMAL}], - bot: ['22A5',{mathvariant: MML.VARIANT.NORMAL}], - angle: ['2220',{mathvariant: MML.VARIANT.NORMAL}], - triangle: ['25B3',{mathvariant: MML.VARIANT.NORMAL}], - backslash: ['2216',{mathvariant: MML.VARIANT.NORMAL, variantForm:true}], - forall: ['2200',{mathvariant: MML.VARIANT.NORMAL}], - exists: ['2203',{mathvariant: MML.VARIANT.NORMAL}], - neg: ['00AC',{mathvariant: MML.VARIANT.NORMAL}], - lnot: ['00AC',{mathvariant: MML.VARIANT.NORMAL}], - flat: ['266D',{mathvariant: MML.VARIANT.NORMAL}], - natural: ['266E',{mathvariant: MML.VARIANT.NORMAL}], - sharp: ['266F',{mathvariant: MML.VARIANT.NORMAL}], - clubsuit: ['2663',{mathvariant: MML.VARIANT.NORMAL}], - diamondsuit: ['2662',{mathvariant: MML.VARIANT.NORMAL}], - heartsuit: ['2661',{mathvariant: MML.VARIANT.NORMAL}], - spadesuit: ['2660',{mathvariant: MML.VARIANT.NORMAL}] - }, - - mathchar0mo: { - surd: '221A', - - // big ops - coprod: ['2210',{texClass: MML.TEXCLASS.OP, movesupsub:true}], - bigvee: ['22C1',{texClass: MML.TEXCLASS.OP, movesupsub:true}], - bigwedge: ['22C0',{texClass: MML.TEXCLASS.OP, movesupsub:true}], - biguplus: ['2A04',{texClass: MML.TEXCLASS.OP, movesupsub:true}], - bigcap: ['22C2',{texClass: MML.TEXCLASS.OP, movesupsub:true}], - bigcup: ['22C3',{texClass: MML.TEXCLASS.OP, movesupsub:true}], - 'int': ['222B',{texClass: MML.TEXCLASS.OP}], - intop: ['222B',{texClass: MML.TEXCLASS.OP, movesupsub:true, movablelimits:true}], - iint: ['222C',{texClass: MML.TEXCLASS.OP}], - iiint: ['222D',{texClass: MML.TEXCLASS.OP}], - prod: ['220F',{texClass: MML.TEXCLASS.OP, movesupsub:true}], - sum: ['2211',{texClass: MML.TEXCLASS.OP, movesupsub:true}], - bigotimes: ['2A02',{texClass: MML.TEXCLASS.OP, movesupsub:true}], - bigoplus: ['2A01',{texClass: MML.TEXCLASS.OP, movesupsub:true}], - bigodot: ['2A00',{texClass: MML.TEXCLASS.OP, movesupsub:true}], - oint: ['222E',{texClass: MML.TEXCLASS.OP}], - bigsqcup: ['2A06',{texClass: MML.TEXCLASS.OP, movesupsub:true}], - smallint: ['222B',{largeop:false}], - - // binary operations - triangleleft: '25C3', - triangleright: '25B9', - bigtriangleup: '25B3', - bigtriangledown: '25BD', - wedge: '2227', - land: '2227', - vee: '2228', - lor: '2228', - cap: '2229', - cup: '222A', - ddagger: '2021', - dagger: '2020', - sqcap: '2293', - sqcup: '2294', - uplus: '228E', - amalg: '2A3F', - diamond: '22C4', - bullet: '2219', - wr: '2240', - div: '00F7', - odot: ['2299',{largeop: false}], - oslash: ['2298',{largeop: false}], - otimes: ['2297',{largeop: false}], - ominus: ['2296',{largeop: false}], - oplus: ['2295',{largeop: false}], - mp: '2213', - pm: '00B1', - circ: '2218', - bigcirc: '25EF', - setminus: ['2216',{variantForm:true}], - cdot: '22C5', - ast: '2217', - times: '00D7', - star: '22C6', - - // Relations - propto: '221D', - sqsubseteq: '2291', - sqsupseteq: '2292', - parallel: '2225', - mid: '2223', - dashv: '22A3', - vdash: '22A2', - leq: '2264', - le: '2264', - geq: '2265', - ge: '2265', - lt: '003C', - gt: '003E', - succ: '227B', - prec: '227A', - approx: '2248', - succeq: '2AB0', // or '227C', - preceq: '2AAF', // or '227D', - supset: '2283', - subset: '2282', - supseteq: '2287', - subseteq: '2286', - 'in': '2208', - ni: '220B', - notin: '2209', - owns: '220B', - gg: '226B', - ll: '226A', - sim: '223C', - simeq: '2243', - perp: '22A5', - equiv: '2261', - asymp: '224D', - smile: '2323', - frown: '2322', - ne: '2260', - neq: '2260', - cong: '2245', - doteq: '2250', - bowtie: '22C8', - models: '22A8', - - notChar: '29F8', - - - // Arrows - Leftrightarrow: '21D4', - Leftarrow: '21D0', - Rightarrow: '21D2', - leftrightarrow: '2194', - leftarrow: '2190', - gets: '2190', - rightarrow: '2192', - to: '2192', - mapsto: '21A6', - leftharpoonup: '21BC', - leftharpoondown: '21BD', - rightharpoonup: '21C0', - rightharpoondown: '21C1', - nearrow: '2197', - searrow: '2198', - nwarrow: '2196', - swarrow: '2199', - rightleftharpoons: '21CC', - hookrightarrow: '21AA', - hookleftarrow: '21A9', - longleftarrow: '27F5', - Longleftarrow: '27F8', - longrightarrow: '27F6', - Longrightarrow: '27F9', - Longleftrightarrow: '27FA', - longleftrightarrow: '27F7', - longmapsto: '27FC', - - - // Misc. - ldots: '2026', - cdots: '22EF', - vdots: '22EE', - ddots: '22F1', - dotsc: '2026', // dots with commas - dotsb: '22EF', // dots with binary ops and relations - dotsm: '22EF', // dots with multiplication - dotsi: '22EF', // dots with integrals - dotso: '2026', // other dots - - ldotp: ['002E', {texClass: MML.TEXCLASS.PUNCT}], - cdotp: ['22C5', {texClass: MML.TEXCLASS.PUNCT}], - colon: ['003A', {texClass: MML.TEXCLASS.PUNCT}] - }, - - mathchar7: { - Gamma: '0393', - Delta: '0394', - Theta: '0398', - Lambda: '039B', - Xi: '039E', - Pi: '03A0', - Sigma: '03A3', - Upsilon: '03A5', - Phi: '03A6', - Psi: '03A8', - Omega: '03A9', - - '_': '005F', - '#': '0023', - '$': '0024', - '%': '0025', - '&': '0026', - And: '0026' - }, - - delimiter: { - '(': '(', - ')': ')', - '[': '[', - ']': ']', - '<': '27E8', - '>': '27E9', - '\\lt': '27E8', - '\\gt': '27E9', - '/': '/', - '|': ['|',{texClass:MML.TEXCLASS.ORD}], - '.': '', - '\\\\': '\\', - '\\lmoustache': '23B0', // non-standard - '\\rmoustache': '23B1', // non-standard - '\\lgroup': '27EE', // non-standard - '\\rgroup': '27EF', // non-standard - '\\arrowvert': '23D0', - '\\Arrowvert': '2016', - '\\bracevert': '23AA', // non-standard - '\\Vert': ['2225',{texClass:MML.TEXCLASS.ORD}], - '\\|': ['2225',{texClass:MML.TEXCLASS.ORD}], - '\\vert': ['|',{texClass:MML.TEXCLASS.ORD}], - '\\uparrow': '2191', - '\\downarrow': '2193', - '\\updownarrow': '2195', - '\\Uparrow': '21D1', - '\\Downarrow': '21D3', - '\\Updownarrow': '21D5', - '\\backslash': '\\', - '\\rangle': '27E9', - '\\langle': '27E8', - '\\rbrace': '}', - '\\lbrace': '{', - '\\}': '}', - '\\{': '{', - '\\rceil': '2309', - '\\lceil': '2308', - '\\rfloor': '230B', - '\\lfloor': '230A', - '\\lbrack': '[', - '\\rbrack': ']' - }, - - macros: { - displaystyle: ['SetStyle','D',true,0], - textstyle: ['SetStyle','T',false,0], - scriptstyle: ['SetStyle','S',false,1], - scriptscriptstyle: ['SetStyle','SS',false,2], - - rm: ['SetFont',MML.VARIANT.NORMAL], - mit: ['SetFont',MML.VARIANT.ITALIC], - oldstyle: ['SetFont',MML.VARIANT.OLDSTYLE], - cal: ['SetFont',MML.VARIANT.CALIGRAPHIC], - it: ['SetFont',"-tex-mathit"], // needs special handling - bf: ['SetFont',MML.VARIANT.BOLD], - bbFont: ['SetFont',MML.VARIANT.DOUBLESTRUCK], - scr: ['SetFont',MML.VARIANT.SCRIPT], - frak: ['SetFont',MML.VARIANT.FRAKTUR], - sf: ['SetFont',MML.VARIANT.SANSSERIF], - tt: ['SetFont',MML.VARIANT.MONOSPACE], - -// font: - - tiny: ['SetSize',0.5], - Tiny: ['SetSize',0.6], // non-standard - scriptsize: ['SetSize',0.7], - small: ['SetSize',0.85], - normalsize: ['SetSize',1.0], - large: ['SetSize',1.2], - Large: ['SetSize',1.44], - LARGE: ['SetSize',1.73], - huge: ['SetSize',2.07], - Huge: ['SetSize',2.49], - - arcsin: ['NamedFn'], - arccos: ['NamedFn'], - arctan: ['NamedFn'], - arg: ['NamedFn'], - cos: ['NamedFn'], - cosh: ['NamedFn'], - cot: ['NamedFn'], - coth: ['NamedFn'], - csc: ['NamedFn'], - deg: ['NamedFn'], - det: 'NamedOp', - dim: ['NamedFn'], - exp: ['NamedFn'], - gcd: 'NamedOp', - hom: ['NamedFn'], - inf: 'NamedOp', - ker: ['NamedFn'], - lg: ['NamedFn'], - lim: 'NamedOp', - liminf: ['NamedOp','lim inf'], - limsup: ['NamedOp','lim sup'], - ln: ['NamedFn'], - log: ['NamedFn'], - max: 'NamedOp', - min: 'NamedOp', - Pr: 'NamedOp', - sec: ['NamedFn'], - sin: ['NamedFn'], - sinh: ['NamedFn'], - sup: 'NamedOp', - tan: ['NamedFn'], - tanh: ['NamedFn'], - - limits: ['Limits',1], - nolimits: ['Limits',0], - - overline: ['UnderOver','00AF',null,1], - underline: ['UnderOver','005F'], - overbrace: ['UnderOver','23DE',1], - underbrace: ['UnderOver','23DF',1], - overparen: ['UnderOver','23DC'], - underparen: ['UnderOver','23DD'], - overrightarrow: ['UnderOver','2192'], - underrightarrow: ['UnderOver','2192'], - overleftarrow: ['UnderOver','2190'], - underleftarrow: ['UnderOver','2190'], - overleftrightarrow: ['UnderOver','2194'], - underleftrightarrow: ['UnderOver','2194'], - - overset: 'Overset', - underset: 'Underset', - stackrel: ['Macro','\\mathrel{\\mathop{#2}\\limits^{#1}}',2], - - over: 'Over', - overwithdelims: 'Over', - atop: 'Over', - atopwithdelims: 'Over', - above: 'Over', - abovewithdelims: 'Over', - brace: ['Over','{','}'], - brack: ['Over','[',']'], - choose: ['Over','(',')'], - - frac: 'Frac', - sqrt: 'Sqrt', - root: 'Root', - uproot: ['MoveRoot','upRoot'], - leftroot: ['MoveRoot','leftRoot'], - - left: 'LeftRight', - right: 'LeftRight', - middle: 'Middle', - - llap: 'Lap', - rlap: 'Lap', - raise: 'RaiseLower', - lower: 'RaiseLower', - moveleft: 'MoveLeftRight', - moveright: 'MoveLeftRight', - - ',': ['Spacer',MML.LENGTH.THINMATHSPACE], - ':': ['Spacer',MML.LENGTH.MEDIUMMATHSPACE], // for LaTeX - '>': ['Spacer',MML.LENGTH.MEDIUMMATHSPACE], - ';': ['Spacer',MML.LENGTH.THICKMATHSPACE], - '!': ['Spacer',MML.LENGTH.NEGATIVETHINMATHSPACE], - enspace: ['Spacer',".5em"], - quad: ['Spacer',"1em"], - qquad: ['Spacer',"2em"], - thinspace: ['Spacer',MML.LENGTH.THINMATHSPACE], - negthinspace: ['Spacer',MML.LENGTH.NEGATIVETHINMATHSPACE], - - hskip: 'Hskip', - hspace: 'Hskip', - kern: 'Hskip', - mskip: 'Hskip', - mspace: 'Hskip', - mkern: 'Hskip', - Rule: ['Rule'], - Space: ['Rule','blank'], - - big: ['MakeBig',MML.TEXCLASS.ORD,0.85], - Big: ['MakeBig',MML.TEXCLASS.ORD,1.15], - bigg: ['MakeBig',MML.TEXCLASS.ORD,1.45], - Bigg: ['MakeBig',MML.TEXCLASS.ORD,1.75], - bigl: ['MakeBig',MML.TEXCLASS.OPEN,0.85], - Bigl: ['MakeBig',MML.TEXCLASS.OPEN,1.15], - biggl: ['MakeBig',MML.TEXCLASS.OPEN,1.45], - Biggl: ['MakeBig',MML.TEXCLASS.OPEN,1.75], - bigr: ['MakeBig',MML.TEXCLASS.CLOSE,0.85], - Bigr: ['MakeBig',MML.TEXCLASS.CLOSE,1.15], - biggr: ['MakeBig',MML.TEXCLASS.CLOSE,1.45], - Biggr: ['MakeBig',MML.TEXCLASS.CLOSE,1.75], - bigm: ['MakeBig',MML.TEXCLASS.REL,0.85], - Bigm: ['MakeBig',MML.TEXCLASS.REL,1.15], - biggm: ['MakeBig',MML.TEXCLASS.REL,1.45], - Biggm: ['MakeBig',MML.TEXCLASS.REL,1.75], - - mathord: ['TeXAtom',MML.TEXCLASS.ORD], - mathop: ['TeXAtom',MML.TEXCLASS.OP], - mathopen: ['TeXAtom',MML.TEXCLASS.OPEN], - mathclose: ['TeXAtom',MML.TEXCLASS.CLOSE], - mathbin: ['TeXAtom',MML.TEXCLASS.BIN], - mathrel: ['TeXAtom',MML.TEXCLASS.REL], - mathpunct: ['TeXAtom',MML.TEXCLASS.PUNCT], - mathinner: ['TeXAtom',MML.TEXCLASS.INNER], - - vcenter: ['TeXAtom',MML.TEXCLASS.VCENTER], - - mathchoice: ['Extension','mathchoice'], - buildrel: 'BuildRel', - - hbox: ['HBox',0], - text: 'HBox', - mbox: ['HBox',0], - fbox: 'FBox', - - strut: 'Strut', - mathstrut: ['Macro','\\vphantom{(}'], - phantom: 'Phantom', - vphantom: ['Phantom',1,0], - hphantom: ['Phantom',0,1], - smash: 'Smash', - - acute: ['Accent', "00B4"], // or 0301 or 02CA - grave: ['Accent', "0060"], // or 0300 or 02CB - ddot: ['Accent', "00A8"], // or 0308 - tilde: ['Accent', "007E"], // or 0303 or 02DC - bar: ['Accent', "00AF"], // or 0304 or 02C9 - breve: ['Accent', "02D8"], // or 0306 - check: ['Accent', "02C7"], // or 030C - hat: ['Accent', "005E"], // or 0302 or 02C6 - vec: ['Accent', "2192"], // or 20D7 - dot: ['Accent', "02D9"], // or 0307 - widetilde: ['Accent', "007E",1], // or 0303 or 02DC - widehat: ['Accent', "005E",1], // or 0302 or 02C6 - - matrix: 'Matrix', - array: 'Matrix', - pmatrix: ['Matrix','(',')'], - cases: ['Matrix','{','',"left left",null,".1em",null,true], - eqalign: ['Matrix',null,null,"right left",MML.LENGTH.THICKMATHSPACE,".5em",'D'], - displaylines: ['Matrix',null,null,"center",null,".5em",'D'], - cr: 'Cr', - '\\': 'CrLaTeX', - newline: 'Cr', - hline: ['HLine','solid'], - hdashline: ['HLine','dashed'], -// noalign: 'HandleNoAlign', - eqalignno: ['Matrix',null,null,"right left",MML.LENGTH.THICKMATHSPACE,".5em",'D',null,"right"], - leqalignno: ['Matrix',null,null,"right left",MML.LENGTH.THICKMATHSPACE,".5em",'D',null,"left"], - hfill: 'HFill', - hfil: 'HFill', // \hfil treated as \hfill for now - hfilll: 'HFill', // \hfilll treated as \hfill for now - - // TeX substitution macros - bmod: ['Macro','\\mmlToken{mo}[lspace="thickmathspace" rspace="thickmathspace"]{mod}'], - pmod: ['Macro','\\pod{\\mmlToken{mi}{mod}\\kern 6mu #1}',1], - mod: ['Macro','\\mathchoice{\\kern18mu}{\\kern12mu}{\\kern12mu}{\\kern12mu}\\mmlToken{mi}{mod}\\,\\,#1',1], - pod: ['Macro','\\mathchoice{\\kern18mu}{\\kern8mu}{\\kern8mu}{\\kern8mu}(#1)',1], - iff: ['Macro','\\;\\Longleftrightarrow\\;'], - skew: ['Macro','{{#2{#3\\mkern#1mu}\\mkern-#1mu}{}}',3], - mathcal: ['Macro','{\\cal #1}',1], - mathscr: ['Macro','{\\scr #1}',1], - mathrm: ['Macro','{\\rm #1}',1], - mathbf: ['Macro','{\\bf #1}',1], - mathbb: ['Macro','{\\bbFont #1}',1], - Bbb: ['Macro','{\\bbFont #1}',1], - mathit: ['Macro','{\\it #1}',1], - mathfrak: ['Macro','{\\frak #1}',1], - mathsf: ['Macro','{\\sf #1}',1], - mathtt: ['Macro','{\\tt #1}',1], - textrm: ['Macro','\\mathord{\\rm\\text{#1}}',1], - textit: ['Macro','\\mathord{\\it\\text{#1}}',1], - textbf: ['Macro','\\mathord{\\bf\\text{#1}}',1], - textsf: ['Macro','\\mathord{\\sf\\text{#1}}',1], - texttt: ['Macro','\\mathord{\\tt\\text{#1}}',1], - pmb: ['Macro','\\rlap{#1}\\kern1px{#1}',1], - TeX: ['Macro','T\\kern-.14em\\lower.5ex{E}\\kern-.115em X'], - LaTeX: ['Macro','L\\kern-.325em\\raise.21em{\\scriptstyle{A}}\\kern-.17em\\TeX'], - ' ': ['Macro','\\text{ }'], - - // Specially handled - not: 'Not', - dots: 'Dots', - space: 'Tilde', - '\u00A0': 'Tilde', - - - // LaTeX - begin: 'BeginEnd', - end: 'BeginEnd', - - newcommand: ['Extension','newcommand'], - renewcommand: ['Extension','newcommand'], - newenvironment: ['Extension','newcommand'], - renewenvironment: ['Extension','newcommand'], - def: ['Extension','newcommand'], - let: ['Extension','newcommand'], - - verb: ['Extension','verb'], - - boldsymbol: ['Extension','boldsymbol'], - - tag: ['Extension','AMSmath'], - notag: ['Extension','AMSmath'], - label: ['Extension','AMSmath'], - ref: ['Extension','AMSmath'], - eqref: ['Extension','AMSmath'], - nonumber: ['Macro','\\notag'], - - // Extensions to TeX - unicode: ['Extension','unicode'], - color: 'Color', - - href: ['Extension','HTML'], - 'class': ['Extension','HTML'], - style: ['Extension','HTML'], - cssId: ['Extension','HTML'], - bbox: ['Extension','bbox'], - - mmlToken: 'MmlToken', - - require: 'Require' - - }, - - environment: { - array: ['AlignedArray'], - matrix: ['Array',null,null,null,'c'], - pmatrix: ['Array',null,'(',')','c'], - bmatrix: ['Array',null,'[',']','c'], - Bmatrix: ['Array',null,'\\{','\\}','c'], - vmatrix: ['Array',null,'\\vert','\\vert','c'], - Vmatrix: ['Array',null,'\\Vert','\\Vert','c'], - cases: ['Array',null,'\\{','.','ll',null,".2em",'T'], - - equation: [null,'Equation'], - 'equation*': [null,'Equation'], - - eqnarray: ['ExtensionEnv',null,'AMSmath'], - 'eqnarray*': ['ExtensionEnv',null,'AMSmath'], - - align: ['ExtensionEnv',null,'AMSmath'], - 'align*': ['ExtensionEnv',null,'AMSmath'], - aligned: ['ExtensionEnv',null,'AMSmath'], - multline: ['ExtensionEnv',null,'AMSmath'], - 'multline*': ['ExtensionEnv',null,'AMSmath'], - split: ['ExtensionEnv',null,'AMSmath'], - gather: ['ExtensionEnv',null,'AMSmath'], - 'gather*': ['ExtensionEnv',null,'AMSmath'], - gathered: ['ExtensionEnv',null,'AMSmath'], - alignat: ['ExtensionEnv',null,'AMSmath'], - 'alignat*': ['ExtensionEnv',null,'AMSmath'], - alignedat: ['ExtensionEnv',null,'AMSmath'] - }, - - p_height: 1.2 / .85 // cmex10 height plus depth over .85 - - }); - - // - // Add macros defined in the configuration - // - if (this.config.Macros) { - var MACROS = this.config.Macros; - for (var id in MACROS) {if (MACROS.hasOwnProperty(id)) { - if (typeof(MACROS[id]) === "string") {TEXDEF.macros[id] = ['Macro',MACROS[id]]} - else {TEXDEF.macros[id] = ["Macro"].concat(MACROS[id])} - TEXDEF.macros[id].isUser = true; - }} - } - }; - - /************************************************************************/ - /* - * The TeX Parser - */ - - var PARSE = MathJax.Object.Subclass({ - Init: function (string,env) { - this.string = string; this.i = 0; this.macroCount = 0; - var ENV; if (env) {ENV = {}; for (var id in env) {if (env.hasOwnProperty(id)) {ENV[id] = env[id]}}} - this.stack = TEX.Stack(ENV,!!env); - this.Parse(); this.Push(STACKITEM.stop()); - }, - Parse: function () { - var c, n; - while (this.i < this.string.length) { - c = this.string.charAt(this.i++); n = c.charCodeAt(0); - if (n >= 0xD800 && n < 0xDC00) {c += this.string.charAt(this.i++)} - if (TEXDEF.special[c]) {this[TEXDEF.special[c]](c)} - else if (TEXDEF.letter.test(c)) {this.Variable(c)} - else if (TEXDEF.digit.test(c)) {this.Number(c)} - else {this.Other(c)} - } - }, - Push: function () {this.stack.Push.apply(this.stack,arguments)}, - mml: function () { - if (this.stack.Top().type !== "mml") {return null} - return this.stack.Top().data[0]; - }, - mmlToken: function (token) {return token}, // used by boldsymbol extension - - /************************************************************************/ - /* - * Handle various token classes - */ - - /* - * Lookup a control-sequence and process it - */ - ControlSequence: function (c) { - var name = this.GetCS(), macro = this.csFindMacro(name); - if (macro) { - if (!(macro instanceof Array)) {macro = [macro]} - var fn = macro[0]; if (!(fn instanceof Function)) {fn = this[fn]} - fn.apply(this,[c+name].concat(macro.slice(1))); - } else if (TEXDEF.mathchar0mi[name]) {this.csMathchar0mi(name,TEXDEF.mathchar0mi[name])} - else if (TEXDEF.mathchar0mo[name]) {this.csMathchar0mo(name,TEXDEF.mathchar0mo[name])} - else if (TEXDEF.mathchar7[name]) {this.csMathchar7(name,TEXDEF.mathchar7[name])} - else if (TEXDEF.delimiter["\\"+name] != null) {this.csDelimiter(name,TEXDEF.delimiter["\\"+name])} - else {this.csUndefined(c+name)} - }, - // - // Look up a macro in the macros list - // (overridden in begingroup extension) - // - csFindMacro: function (name) {return TEXDEF.macros[name]}, - // - // Handle normal mathchar (as an mi) - // - csMathchar0mi: function (name,mchar) { - var def = {mathvariant: MML.VARIANT.ITALIC}; - if (mchar instanceof Array) {def = mchar[1]; mchar = mchar[0]} - this.Push(this.mmlToken(MML.mi(MML.entity("#x"+mchar)).With(def))); - }, - // - // Handle normal mathchar (as an mo) - // - csMathchar0mo: function (name,mchar) { - var def = {stretchy: false}; - if (mchar instanceof Array) {def = mchar[1]; def.stretchy = false; mchar = mchar[0]} - this.Push(this.mmlToken(MML.mo(MML.entity("#x"+mchar)).With(def))); - }, - // - // Handle mathchar in current family - // - csMathchar7: function (name,mchar) { - var def = {mathvariant: MML.VARIANT.NORMAL}; - if (mchar instanceof Array) {def = mchar[1]; mchar = mchar[0]} - if (this.stack.env.font) {def.mathvariant = this.stack.env.font} - this.Push(this.mmlToken(MML.mi(MML.entity("#x"+mchar)).With(def))); - }, - // - // Handle delimiter - // - csDelimiter: function (name,delim) { - var def = {}; - if (delim instanceof Array) {def = delim[1]; delim = delim[0]} - if (delim.length === 4) {delim = MML.entity('#x'+delim)} else {delim = MML.chars(delim)} - this.Push(this.mmlToken(MML.mo(delim).With({fence: false, stretchy: false}).With(def))); - }, - // - // Handle undefined control sequence - // (overridden in noUndefined extension) - // - csUndefined: function (name) { - TEX.Error(["UndefinedControlSequence","Undefined control sequence %1",name]); - }, - - /* - * Handle a variable (a single letter) - */ - Variable: function (c) { - var def = {}; if (this.stack.env.font) {def.mathvariant = this.stack.env.font} - this.Push(this.mmlToken(MML.mi(MML.chars(c)).With(def))); - }, - - /* - * Determine the extent of a number (pattern may need work) - */ - Number: function (c) { - var mml, n = this.string.slice(this.i-1).match(TEXDEF.number); - if (n) {mml = MML.mn(n[0].replace(/[{}]/g,"")); this.i += n[0].length - 1} - else {mml = MML.mo(MML.chars(c))} - if (this.stack.env.font) {mml.mathvariant = this.stack.env.font} - this.Push(this.mmlToken(mml)); - }, - - /* - * Handle { and } - */ - Open: function (c) {this.Push(STACKITEM.open())}, - Close: function (c) {this.Push(STACKITEM.close())}, - - /* - * Handle tilde and spaces - */ - Tilde: function (c) {this.Push(MML.mtext(MML.chars(NBSP)))}, - Space: function (c) {}, - - /* - * Handle ^, _, and ' - */ - Superscript: function (c) { - if (this.GetNext().match(/\d/)) // don't treat numbers as a unit - {this.string = this.string.substr(0,this.i+1)+" "+this.string.substr(this.i+1)} - var primes, base, top = this.stack.Top(); - if (top.type === "prime") {base = top.data[0]; primes = top.data[1]; this.stack.Pop()} - else {base = this.stack.Prev(); if (!base) {base = MML.mi("")}} - if (base.isEmbellishedWrapper) {base = base.data[0].data[0]} - var movesupsub = base.movesupsub, position = base.sup; - if ((base.type === "msubsup" && base.data[base.sup]) || - (base.type === "munderover" && base.data[base.over] && !base.subsupOK)) - {TEX.Error(["DoubleExponent","Double exponent: use braces to clarify"])} - if (base.type !== "msubsup") { - if (movesupsub) { - if (base.type !== "munderover" || base.data[base.over]) { - if (base.movablelimits && base.isa(MML.mi)) {base = this.mi2mo(base)} - base = MML.munderover(base,null,null).With({movesupsub:true}) - } - position = base.over; - } else { - base = MML.msubsup(base,null,null); - position = base.sup; - } - } - this.Push(STACKITEM.subsup(base).With({ - position: position, primes: primes, movesupsub: movesupsub - })); - }, - Subscript: function (c) { - if (this.GetNext().match(/\d/)) // don't treat numbers as a unit - {this.string = this.string.substr(0,this.i+1)+" "+this.string.substr(this.i+1)} - var primes, base, top = this.stack.Top(); - if (top.type === "prime") {base = top.data[0]; primes = top.data[1]; this.stack.Pop()} - else {base = this.stack.Prev(); if (!base) {base = MML.mi("")}} - if (base.isEmbellishedWrapper) {base = base.data[0].data[0]} - var movesupsub = base.movesupsub, position = base.sub; - if ((base.type === "msubsup" && base.data[base.sub]) || - (base.type === "munderover" && base.data[base.under] && !base.subsupOK)) - {TEX.Error(["DoubleSubscripts","Double subscripts: use braces to clarify"])} - if (base.type !== "msubsup") { - if (movesupsub) { - if (base.type !== "munderover" || base.data[base.under]) { - if (base.movablelimits && base.isa(MML.mi)) {base = this.mi2mo(base)} - base = MML.munderover(base,null,null).With({movesupsub:true}) - } - position = base.under; - } else { - base = MML.msubsup(base,null,null); - position = base.sub; - } - } - this.Push(STACKITEM.subsup(base).With({ - position: position, primes: primes, movesupsub: movesupsub - })); - }, - PRIME: "\u2032", SMARTQUOTE: "\u2019", - Prime: function (c) { - var base = this.stack.Prev(); if (!base) {base = MML.mi()} - if (base.type === "msubsup" && base.data[base.sup]) { - TEX.Error(["DoubleExponentPrime", - "Prime causes double exponent: use braces to clarify"]); - } - var sup = ""; this.i--; - do {sup += this.PRIME; this.i++, c = this.GetNext()} - while (c === "'" || c === this.SMARTQUOTE); - sup = ["","\u2032","\u2033","\u2034","\u2057"][sup.length] || sup; - this.Push(STACKITEM.prime(base,this.mmlToken(MML.mo(sup)))); - }, - mi2mo: function (mi) { - var mo = MML.mo(); mo.Append.apply(mo,mi.data); var id; - for (id in mo.defaults) - {if (mo.defaults.hasOwnProperty(id) && mi[id] != null) {mo[id] = mi[id]}} - for (id in MML.copyAttributes) - {if (MML.copyAttributes.hasOwnProperty(id) && mi[id] != null) {mo[id] = mi[id]}} - mo.lspace = mo.rspace = "0"; // prevent mo from having space in NativeMML - mo.useMMLspacing &= ~(mo.SPACE_ATTR.lspace | mo.SPACE_ATTR.rspace); // don't count these explicit settings - return mo; - }, - - /* - * Handle comments - */ - Comment: function (c) { - while (this.i < this.string.length && this.string.charAt(this.i) != "\n") {this.i++} - }, - - /* - * Handle hash marks outside of definitions - */ - Hash: function (c) { - TEX.Error(["CantUseHash1", - "You can't use 'macro parameter character #' in math mode"]); - }, - - /* - * Handle other characters (as elements) - */ - Other: function (c) { - var def, mo; - if (this.stack.env.font) {def = {mathvariant: this.stack.env.font}} - if (TEXDEF.remap[c]) { - c = TEXDEF.remap[c]; - if (c instanceof Array) {def = c[1]; c = c[0]} - mo = MML.mo(MML.entity('#x'+c)).With(def); - } else { - mo = MML.mo(c).With(def); - } - if (mo.autoDefault("stretchy",true)) {mo.stretchy = false} - if (mo.autoDefault("texClass",true) == "") {mo = MML.TeXAtom(mo)} - this.Push(this.mmlToken(mo)); - }, - - /************************************************************************/ - /* - * Macros - */ - - SetFont: function (name,font) {this.stack.env.font = font}, - SetStyle: function (name,texStyle,style,level) { - this.stack.env.style = texStyle; this.stack.env.level = level; - this.Push(STACKITEM.style().With({styles: {displaystyle: style, scriptlevel: level}})); - }, - SetSize: function (name,size) { - this.stack.env.size = size; - this.Push(STACKITEM.style().With({styles: {mathsize: size+"em"}})); // convert to absolute? - }, - - Color: function (name) { - var color = this.GetArgument(name); - var old = this.stack.env.color; this.stack.env.color = color; - var math = this.ParseArg(name); - if (old) {this.stack.env.color} else {delete this.stack.env.color} - this.Push(MML.mstyle(math).With({mathcolor: color})); - }, - - Spacer: function (name,space) { - this.Push(MML.mspace().With({width: space, mathsize: MML.SIZE.NORMAL, scriptlevel:0})); - }, - - LeftRight: function (name) { - this.Push(STACKITEM[name.substr(1)]().With({delim: this.GetDelimiter(name)})); - }, - - Middle: function (name) { - var delim = this.GetDelimiter(name); - if (this.stack.Top().type !== "left") - {TEX.Error(["MisplacedMiddle","%1 must be within \\left and \\right",name])} - this.Push(MML.mo(delim).With({stretchy:true})); - }, - - NamedFn: function (name,id) { - if (!id) {id = name.substr(1)}; - var mml = MML.mi(id).With({texClass: MML.TEXCLASS.OP}); - this.Push(STACKITEM.fn(this.mmlToken(mml))); - }, - NamedOp: function (name,id) { - if (!id) {id = name.substr(1)}; - id = id.replace(/ /,"\u2006"); - var mml = MML.mo(id).With({ - movablelimits: true, - movesupsub: true, - form: MML.FORM.PREFIX, - texClass: MML.TEXCLASS.OP - }); - mml.useMMLspacing &= ~mml.SPACE_ATTR.form; // don't count this explicit form setting - this.Push(this.mmlToken(mml)); - }, - Limits: function (name,limits) { - var op = this.stack.Prev("nopop"); - if (!op || (op.Get("texClass") !== MML.TEXCLASS.OP && op.movesupsub == null)) - {TEX.Error(["MisplacedLimits","%1 is allowed only on operators",name])} - var top = this.stack.Top(); - if (op.type === "munderover" && !limits) { - op = top.data[top.data.length-1] = MML.msubsup.apply(MML.subsup,op.data); - } else if (op.type === "msubsup" && limits) { - op = top.data[top.data.length-1] = MML.munderover.apply(MML.underover,op.data); - } - op.movesupsub = (limits ? true : false); - op.Core().movablelimits = false; - if (op.movablelimits) op.movablelimits = false; - }, - - Over: function (name,open,close) { - var mml = STACKITEM.over().With({name: name}); - if (open || close) { - mml.open = open; mml.close = close; - } else if (name.match(/withdelims$/)) { - mml.open = this.GetDelimiter(name); - mml.close = this.GetDelimiter(name); - } - if (name.match(/^\\above/)) {mml.thickness = this.GetDimen(name)} - else if (name.match(/^\\atop/) || open || close) {mml.thickness = 0} - this.Push(mml); - }, - - Frac: function (name) { - var num = this.ParseArg(name); - var den = this.ParseArg(name); - this.Push(MML.mfrac(num,den)); - }, - - Sqrt: function (name) { - var n = this.GetBrackets(name), arg = this.GetArgument(name); - if (arg === "\\frac") {arg += "{"+this.GetArgument(arg)+"}{"+this.GetArgument(arg)+"}"} - var mml = TEX.Parse(arg,this.stack.env).mml(); - if (!n) {mml = MML.msqrt.apply(MML,mml.array())} - else {mml = MML.mroot(mml,this.parseRoot(n))} - this.Push(mml); - }, - Root: function (name) { - var n = this.GetUpTo(name,"\\of"); - var arg = this.ParseArg(name); - this.Push(MML.mroot(arg,this.parseRoot(n))); - }, - parseRoot: function (n) { - var env = this.stack.env, inRoot = env.inRoot; env.inRoot = true; - var parser = TEX.Parse(n,env); n = parser.mml(); var global = parser.stack.global; - if (global.leftRoot || global.upRoot) { - n = MML.mpadded(n); - if (global.leftRoot) {n.width = global.leftRoot} - if (global.upRoot) {n.voffset = global.upRoot; n.height = global.upRoot} - } - env.inRoot = inRoot; - return n; - }, - MoveRoot: function (name,id) { - if (!this.stack.env.inRoot) - {TEX.Error(["MisplacedMoveRoot","%1 can appear only within a root",name])} - if (this.stack.global[id]) - {TEX.Error(["MultipleMoveRoot","Multiple use of %1",name])} - var n = this.GetArgument(name); - if (!n.match(/-?[0-9]+/)) - {TEX.Error(["IntegerArg","The argument to %1 must be an integer",name])} - n = (n/15)+"em"; - if (n.substr(0,1) !== "-") {n = "+"+n} - this.stack.global[id] = n; - }, - - Accent: function (name,accent,stretchy) { - var c = this.ParseArg(name); - var def = {accent: true}; if (this.stack.env.font) {def.mathvariant = this.stack.env.font} - var mml = this.mmlToken(MML.mo(MML.entity("#x"+accent)).With(def)); - mml.stretchy = (stretchy ? true : false); - this.Push(MML.TeXAtom(MML.munderover(c,null,mml).With({accent: true}))); - }, - - UnderOver: function (name,c,stack,noaccent) { - var pos = {o: "over", u: "under"}[name.charAt(1)]; - var base = this.ParseArg(name); - if (base.Get("movablelimits")) {base.movablelimits = false} - if (base.isa(MML.munderover) && base.isEmbellished()) { - base.Core().With({lspace:0,rspace:0}); // get spacing right for NativeMML - base = MML.mrow(MML.mo().With({rspace:0}),base); // add an empty so it's not embellished any more - } - var mml = MML.munderover(base,null,null); - mml.SetData( - mml[pos], - this.mmlToken(MML.mo(MML.entity("#x"+c)).With({stretchy:true, accent:!noaccent})) - ); - if (stack) {mml = MML.TeXAtom(mml).With({texClass:MML.TEXCLASS.OP, movesupsub:true})} - this.Push(mml.With({subsupOK:true})); - }, - - Overset: function (name) { - var top = this.ParseArg(name), base = this.ParseArg(name); - if (base.movablelimits) base.movablelimits = false; - this.Push(MML.mover(base,top)); - }, - Underset: function (name) { - var bot = this.ParseArg(name), base = this.ParseArg(name); - if (base.movablelimits) base.movablelimits = false; - this.Push(MML.munder(base,bot)); - }, - - TeXAtom: function (name,mclass) { - var def = {texClass: mclass}, mml; - if (mclass == MML.TEXCLASS.OP) { - def.movesupsub = def.movablelimits = true; - var arg = this.GetArgument(name); - var match = arg.match(/^\s*\\rm\s+([a-zA-Z0-9 ]+)$/); - if (match) { - def.mathvariant = MML.VARIANT.NORMAL; - mml = STACKITEM.fn(this.mmlToken(MML.mi(match[1]).With(def))); - } else { - mml = STACKITEM.fn(MML.TeXAtom(TEX.Parse(arg,this.stack.env).mml()).With(def)); - } - } else {mml = MML.TeXAtom(this.ParseArg(name)).With(def)} - this.Push(mml); - }, - - MmlToken: function (name) { - var type = this.GetArgument(name), - attr = this.GetBrackets(name,"").replace(/^\s+/,""), - data = this.GetArgument(name), - def = {attrNames:[]}, match; - if (!MML[type] || !MML[type].prototype.isToken) - {TEX.Error(["NotMathMLToken","%1 is not a token element",type])} - while (attr !== "") { - match = attr.match(/^([a-z]+)\s*=\s*('[^']*'|"[^"]*"|[^ ,]*)\s*,?\s*/i); - if (!match) - {TEX.Error(["InvalidMathMLAttr","Invalid MathML attribute: %1",attr])} - if (MML[type].prototype.defaults[match[1]] == null && !this.MmlTokenAllow[match[1]]) { - TEX.Error(["UnknownAttrForElement", - "%1 is not a recognized attribute for %2", - match[1],type]); - } - var value = this.MmlFilterAttribute(match[1],match[2].replace(/^(['"])(.*)\1$/,"$2")); - if (value) { - if (value.toLowerCase() === "true") {value = true} - else if (value.toLowerCase() === "false") {value = false} - def[match[1]] = value; - def.attrNames.push(match[1]); - } - attr = attr.substr(match[0].length); - } - this.Push(this.mmlToken(MML[type](data).With(def))); - }, - MmlFilterAttribute: function (name,value) {return value}, - MmlTokenAllow: { - fontfamily:1, fontsize:1, fontweight:1, fontstyle:1, - color:1, background:1, - id:1, "class":1, href:1, style:1 - }, - - Strut: function (name) { - this.Push(MML.mpadded(MML.mrow()).With({height: "8.6pt", depth: "3pt", width: 0})); - }, - - Phantom: function (name,v,h) { - var box = MML.mphantom(this.ParseArg(name)); - if (v || h) { - box = MML.mpadded(box); - if (h) {box.height = box.depth = 0} - if (v) {box.width = 0} - } - this.Push(MML.TeXAtom(box)); - }, - - Smash: function (name) { - var bt = this.trimSpaces(this.GetBrackets(name,"")); - var smash = MML.mpadded(this.ParseArg(name)); - switch (bt) { - case "b": smash.depth = 0; break; - case "t": smash.height = 0; break; - default: smash.height = smash.depth = 0; - } - this.Push(MML.TeXAtom(smash)); - }, - - Lap: function (name) { - var mml = MML.mpadded(this.ParseArg(name)).With({width: 0}); - if (name === "\\llap") {mml.lspace = "-1width"} - this.Push(MML.TeXAtom(mml)); - }, - - RaiseLower: function (name) { - var h = this.GetDimen(name); - var item = STACKITEM.position().With({name: name, move: 'vertical'}); - if (h.charAt(0) === '-') {h = h.slice(1); name = {raise: "\\lower", lower: "\\raise"}[name.substr(1)]} - if (name === "\\lower") {item.dh = '-'+h; item.dd = '+'+h} else {item.dh = '+'+h; item.dd = '-'+h} - this.Push(item); - }, - - MoveLeftRight: function (name) { - var h = this.GetDimen(name); - var nh = (h.charAt(0) === '-' ? h.slice(1) : '-'+h); - if (name === "\\moveleft") {var tmp = h; h = nh; nh = tmp} - this.Push(STACKITEM.position().With({ - name: name, move: 'horizontal', - left: MML.mspace().With({width: h, mathsize: MML.SIZE.NORMAL}), - right: MML.mspace().With({width: nh, mathsize: MML.SIZE.NORMAL}) - })); - }, - - Hskip: function (name) { - this.Push(MML.mspace().With({width: this.GetDimen(name), mathsize: MML.SIZE.NORMAL})); - }, - - Rule: function (name,style) { - var w = this.GetDimen(name), - h = this.GetDimen(name), - d = this.GetDimen(name); - var mml, def = {width:w, height:h, depth:d}; - if (style !== 'blank') { - if (parseFloat(w) && parseFloat(h)+parseFloat(d)) - {def.mathbackground = (this.stack.env.color || "black")} - mml = MML.mpadded(MML.mrow()).With(def); - } else { - mml = MML.mspace().With(def); - } - this.Push(mml); - }, - - MakeBig: function (name,mclass,size) { - size *= TEXDEF.p_height; - size = String(size).replace(/(\.\d\d\d).+/,'$1')+"em"; - var delim = this.GetDelimiter(name,true); - this.Push(MML.TeXAtom(MML.mo(delim).With({ - minsize: size, maxsize: size, - fence: true, stretchy: true, symmetric: true - })).With({texClass: mclass})); - }, - - BuildRel: function (name) { - var top = this.ParseUpTo(name,"\\over"); - var bot = this.ParseArg(name); - this.Push(MML.TeXAtom(MML.munderover(bot,null,top)).With({texClass: MML.TEXCLASS.REL})); - }, - - HBox: function (name,style) { - this.Push.apply(this,this.InternalMath(this.GetArgument(name),style)); - }, - - FBox: function (name) { - this.Push(MML.menclose.apply(MML,this.InternalMath(this.GetArgument(name))).With({notation:"box"})); - }, - - Not: function (name) { - this.Push(STACKITEM.not()); - }, - - Dots: function (name) { - this.Push(STACKITEM.dots().With({ - ldots: this.mmlToken(MML.mo(MML.entity("#x2026")).With({stretchy:false})), - cdots: this.mmlToken(MML.mo(MML.entity("#x22EF")).With({stretchy:false})) - })); - }, - - Require: function (name) { - var file = this.GetArgument(name) - .replace(/.*\//,"") // remove any leading path - .replace(/[^a-z0-9_.-]/ig,""); // remove illegal characters - this.Extension(null,file); - }, - - Extension: function (name,file,array) { - if (name && !typeof(name) === "string") {name = name.name} - file = TEX.extensionDir+"/"+file; - if (!file.match(/\.js$/)) {file += ".js"} - if (!AJAX.loaded[AJAX.fileURL(file)]) { - if (name != null) {delete TEXDEF[array || 'macros'][name.replace(/^\\/,"")]} - HUB.RestartAfter(AJAX.Require(file)); - } - }, - - Macro: function (name,macro,argcount,def) { - if (argcount) { - var args = []; - if (def != null) { - var optional = this.GetBrackets(name); - args.push(optional == null ? def : optional); - } - for (var i = args.length; i < argcount; i++) {args.push(this.GetArgument(name))} - macro = this.SubstituteArgs(args,macro); - } - this.string = this.AddArgs(macro,this.string.slice(this.i)); - this.i = 0; - if (++this.macroCount > TEX.config.MAXMACROS) { - TEX.Error(["MaxMacroSub1", - "MathJax maximum macro substitution count exceeded; " + - "is there a recursive macro call?"]); - } - }, - - Matrix: function (name,open,close,align,spacing,vspacing,style,cases,numbered) { - var c = this.GetNext(); - if (c === "") - {TEX.Error(["MissingArgFor","Missing argument for %1",name])} - if (c === "{") {this.i++} else {this.string = c+"}"+this.string.slice(this.i+1); this.i = 0} - var array = STACKITEM.array().With({ - requireClose: true, - arraydef: { - rowspacing: (vspacing||"4pt"), - columnspacing: (spacing||"1em") - } - }); - if (cases) {array.isCases = true} - if (numbered) {array.isNumbered = true; array.arraydef.side = numbered} - if (open || close) {array.open = open; array.close = close} - if (style === "D") {array.arraydef.displaystyle = true} - if (align != null) {array.arraydef.columnalign = align} - this.Push(array); - }, - - Entry: function (name) { - this.Push(STACKITEM.cell().With({isEntry: true, name: name})); - if (this.stack.Top().isCases) { - var string = this.string; - var braces = 0, i = this.i, m = string.length; - while (i < m) { - var c = string.charAt(i); - if (c === "{") {braces++; i++} - else if (c === "}") {if (braces === 0) {m = 0} else {braces--; i++}} - else if (c === "&" && braces === 0) { - TEX.Error(["ExtraAlignTab","Extra alignment tab in \\cases text"]); - } else if (c === "\\") { - if (string.substr(i).match(/^((\\cr)[^a-zA-Z]|\\\\)/)) {m = 0} else {i += 2} - } else {i++} - } - var text = string.substr(this.i,i-this.i); - if (!text.match(/^\s*\\text[^a-zA-Z]/)) { - this.Push.apply(this,this.InternalMath(text,0)); - this.i = i; - } - } - }, - - Cr: function (name) { - this.Push(STACKITEM.cell().With({isCR: true, name: name})); - }, - - CrLaTeX: function (name) { - var n; - if (this.string.charAt(this.i) === "[") { - n = this.GetBrackets(name,"").replace(/ /g,"").replace(/,/,"."); - if (n && !this.matchDimen(n)) { - TEX.Error(["BracketMustBeDimension", - "Bracket argument to %1 must be a dimension",name]); - } - } - this.Push(STACKITEM.cell().With({isCR: true, name: name, linebreak: true})); - var top = this.stack.Top(); - if (top.isa(STACKITEM.array)) { - if (n && top.arraydef.rowspacing) { - var rows = top.arraydef.rowspacing.split(/ /); - if (!top.rowspacing) {top.rowspacing = this.dimen2em(rows[0])} - while (rows.length < top.table.length) {rows.push(this.Em(top.rowspacing))} - rows[top.table.length-1] = this.Em(Math.max(0,top.rowspacing+this.dimen2em(n))); - top.arraydef.rowspacing = rows.join(' '); - } - } else { - if (n) {this.Push(MML.mspace().With({depth:n}))} - this.Push(MML.mspace().With({linebreak:MML.LINEBREAK.NEWLINE})); - } - }, - emPerInch: 7.2, - pxPerInch: 72, - matchDimen: function (dim) { - return dim.match(/^(-?(?:\.\d+|\d+(?:\.\d*)?))(px|pt|em|ex|mu|pc|in|mm|cm)$/); - }, - dimen2em: function (dim) { - var match = this.matchDimen(dim); - var m = parseFloat(match[1]||"1"), unit = match[2]; - if (unit === "em") {return m} - if (unit === "ex") {return m * .43} - if (unit === "pt") {return m / 10} // 10 pt to an em - if (unit === "pc") {return m * 1.2} // 12 pt to a pc - if (unit === "px") {return m * this.emPerInch / this.pxPerInch} - if (unit === "in") {return m * this.emPerInch} - if (unit === "cm") {return m * this.emPerInch / 2.54} // 2.54 cm to an inch - if (unit === "mm") {return m * this.emPerInch / 25.4} // 10 mm to a cm - if (unit === "mu") {return m / 18} - return 0; - }, - Em: function (m) { - if (Math.abs(m) < .0006) {return "0em"} - return m.toFixed(3).replace(/\.?0+$/,"") + "em"; - }, - - HLine: function (name,style) { - if (style == null) {style = "solid"} - var top = this.stack.Top(); - if (!top.isa(STACKITEM.array) || top.data.length) - {TEX.Error(["Misplaced","Misplaced %1",name])} - if (top.table.length == 0) { - top.frame.push("top"); - } else { - var lines = (top.arraydef.rowlines ? top.arraydef.rowlines.split(/ /) : []); - while (lines.length < top.table.length) {lines.push("none")} - lines[top.table.length-1] = style; - top.arraydef.rowlines = lines.join(' '); - } - }, - - HFill: function (name) { - var top = this.stack.Top(); - if (top.isa(STACKITEM.array)) top.hfill.push(top.data.length); - else TEX.Error(["UnsupportedHFill","Unsupported use of %1",name]); - }, - - - - /************************************************************************/ - /* - * LaTeX environments - */ - - BeginEnd: function (name) { - var env = this.GetArgument(name), isEnd = false; - if (env.match(/^\\end\\/)) {isEnd = true; env = env.substr(5)} // special \end{} for \newenvironment environments - if (env.match(/\\/i)) {TEX.Error(["InvalidEnv","Invalid environment name '%1'",env])} - var cmd = this.envFindName(env); - if (!cmd) {TEX.Error(["UnknownEnv","Unknown environment '%1'",env])} - if (!(cmd instanceof Array)) {cmd = [cmd]} - var end = (cmd[1] instanceof Array ? cmd[1][0] : cmd[1]); - var mml = STACKITEM.begin().With({name: env, end: end, parse:this}); - if (name === "\\end") { - if (!isEnd && cmd[1] instanceof Array && this[cmd[1][1]]) { - mml = this[cmd[1][1]].apply(this,[mml].concat(cmd.slice(2))); - } else { - mml = STACKITEM.end().With({name: env}); - } - } else { - if (++this.macroCount > TEX.config.MAXMACROS) { - TEX.Error(["MaxMacroSub2", - "MathJax maximum substitution count exceeded; " + - "is there a recursive latex environment?"]); - } - if (cmd[0] && this[cmd[0]]) {mml = this[cmd[0]].apply(this,[mml].concat(cmd.slice(2)))} - } - this.Push(mml); - }, - envFindName: function (name) {return TEXDEF.environment[name]}, - - Equation: function (begin,row) {return row}, - - ExtensionEnv: function (begin,file) {this.Extension(begin.name,file,"environment")}, - - Array: function (begin,open,close,align,spacing,vspacing,style,raggedHeight) { - if (!align) {align = this.GetArgument("\\begin{"+begin.name+"}")} - var lines = ("c"+align).replace(/[^clr|:]/g,'').replace(/[^|:]([|:])+/g,'$1'); - align = align.replace(/[^clr]/g,'').split('').join(' '); - align = align.replace(/l/g,'left').replace(/r/g,'right').replace(/c/g,'center'); - var array = STACKITEM.array().With({ - arraydef: { - columnalign: align, - columnspacing: (spacing||"1em"), - rowspacing: (vspacing||"4pt") - } - }); - if (lines.match(/[|:]/)) { - if (lines.charAt(0).match(/[|:]/)) {array.frame.push("left"); array.frame.dashed = lines.charAt(0) === ":"} - if (lines.charAt(lines.length-1).match(/[|:]/)) {array.frame.push("right")} - lines = lines.substr(1,lines.length-2); - array.arraydef.columnlines = - lines.split('').join(' ').replace(/[^|: ]/g,'none').replace(/\|/g,'solid').replace(/:/g,'dashed'); - } - if (open) {array.open = this.convertDelimiter(open)} - if (close) {array.close = this.convertDelimiter(close)} - if (style === "D") {array.arraydef.displaystyle = true} - else if (style) {array.arraydef.displaystyle = false} - if (style === "S") {array.arraydef.scriptlevel = 1} // FIXME: should use mstyle? - if (raggedHeight) {array.arraydef.useHeight = false} - this.Push(begin); - return array; - }, - - AlignedArray: function (begin) { - var align = this.GetBrackets("\\begin{"+begin.name+"}"); - return this.setArrayAlign(this.Array.apply(this,arguments),align); - }, - setArrayAlign: function (array,align) { - align = this.trimSpaces(align||""); - if (align === "t") {array.arraydef.align = "baseline 1"} - else if (align === "b") {array.arraydef.align = "baseline -1"} - else if (align === "c") {array.arraydef.align = "center"} - else if (align) {array.arraydef.align = align} // FIXME: should be an error? - return array; - }, - - /************************************************************************/ - /* - * String handling routines - */ - - /* - * Convert delimiter to character - */ - convertDelimiter: function (c) { - if (c) {c = TEXDEF.delimiter[c]} - if (c == null) {return null} - if (c instanceof Array) {c = c[0]} - if (c.length === 4) {c = String.fromCharCode(parseInt(c,16))} - return c; - }, - - /* - * Trim spaces from a string - */ - trimSpaces: function (text) { - if (typeof(text) != 'string') {return text} - return text.replace(/^\s+|\s+$/g,''); - }, - - /* - * Check if the next character is a space - */ - nextIsSpace: function () { - return this.string.charAt(this.i).match(/\s/); - }, - - /* - * Get the next non-space character - */ - GetNext: function () { - while (this.nextIsSpace()) {this.i++} - return this.string.charAt(this.i); - }, - - /* - * Get and return a control-sequence name - */ - GetCS: function () { - var CS = this.string.slice(this.i).match(/^([a-z]+|.) ?/i); - if (CS) {this.i += CS[1].length; return CS[1]} else {this.i++; return " "} - }, - - /* - * Get and return a TeX argument (either a single character or control sequence, - * or the contents of the next set of braces). - */ - GetArgument: function (name,noneOK) { - switch (this.GetNext()) { - case "": - if (!noneOK) {TEX.Error(["MissingArgFor","Missing argument for %1",name])} - return null; - case '}': - if (!noneOK) { - TEX.Error(["ExtraCloseMissingOpen", - "Extra close brace or missing open brace"]); - } - return null; - case '\\': - this.i++; return "\\"+this.GetCS(); - case '{': - var j = ++this.i, parens = 1; - while (this.i < this.string.length) { - switch (this.string.charAt(this.i++)) { - case '\\': this.i++; break; - case '{': parens++; break; - case '}': - if (--parens == 0) {return this.string.slice(j,this.i-1)} - break; - } - } - TEX.Error(["MissingCloseBrace","Missing close brace"]); - break; - } - return this.string.charAt(this.i++); - }, - - /* - * Get an optional LaTeX argument in brackets - */ - GetBrackets: function (name,def) { - if (this.GetNext() != '[') {return def}; - var j = ++this.i, parens = 0; - while (this.i < this.string.length) { - switch (this.string.charAt(this.i++)) { - case '{': parens++; break; - case '\\': this.i++; break; - case '}': - if (parens-- <= 0) { - TEX.Error(["ExtraCloseLooking", - "Extra close brace while looking for %1","']'"]); - } - break; - case ']': - if (parens == 0) {return this.string.slice(j,this.i-1)} - break; - } - } - TEX.Error(["MissingCloseBracket", - "Couldn't find closing ']' for argument to %1",name]); - }, - - /* - * Get the name of a delimiter (check it in the delimiter list). - */ - GetDelimiter: function (name,braceOK) { - while (this.nextIsSpace()) {this.i++} - var c = this.string.charAt(this.i); this.i++; - if (this.i <= this.string.length) { - if (c == "\\") {c += this.GetCS(name)} - else if (c === "{" && braceOK) {this.i--; c = this.GetArgument(name)} - if (TEXDEF.delimiter[c] != null) {return this.convertDelimiter(c)} - } - TEX.Error(["MissingOrUnrecognizedDelim", - "Missing or unrecognized delimiter for %1",name]); - }, - - /* - * Get a dimension (including its units). - */ - GetDimen: function (name) { - var dimen; - if (this.nextIsSpace()) {this.i++} - if (this.string.charAt(this.i) == '{') { - dimen = this.GetArgument(name); - if (dimen.match(/^\s*([-+]?([.,]\d+|\d+([.,]\d*)?))\s*(pt|em|ex|mu|px|mm|cm|in|pc)\s*$/)) - {return dimen.replace(/ /g,"").replace(/,/,".")} - } else { - dimen = this.string.slice(this.i); - var match = dimen.match(/^\s*(([-+]?([.,]\d+|\d+([.,]\d*)?))\s*(pt|em|ex|mu|px|mm|cm|in|pc)) ?/); - if (match) { - this.i += match[0].length; - return match[1].replace(/ /g,"").replace(/,/,"."); - } - } - TEX.Error(["MissingDimOrUnits", - "Missing dimension or its units for %1",name]); - }, - - /* - * Get everything up to the given control sequence (token) - */ - GetUpTo: function (name,token) { - while (this.nextIsSpace()) {this.i++} - var j = this.i, k, c, parens = 0; - while (this.i < this.string.length) { - k = this.i; c = this.string.charAt(this.i++); - switch (c) { - case '\\': c += this.GetCS(); break; - case '{': parens++; break; - case '}': - if (parens == 0) { - TEX.Error(["ExtraCloseLooking", - "Extra close brace while looking for %1",token]) - } - parens--; - break; - } - if (parens == 0 && c == token) {return this.string.slice(j,k)} - } - TEX.Error(["TokenNotFoundForCommand", - "Couldn't find %1 for %2",token,name]); - }, - - /* - * Parse various substrings - */ - ParseArg: function (name) {return TEX.Parse(this.GetArgument(name),this.stack.env).mml()}, - ParseUpTo: function (name,token) {return TEX.Parse(this.GetUpTo(name,token),this.stack.env).mml()}, - - /* - * Break up a string into text and math blocks - */ - InternalMath: function (text,level) { - var def = (this.stack.env.font ? {mathvariant: this.stack.env.font} : {}); - var mml = [], i = 0, k = 0, c, match = '', braces = 0; - if (text.match(/\\?[${}\\]|\\\(|\\(eq)?ref\s*\{/)) { - while (i < text.length) { - c = text.charAt(i++); - if (c === '$') { - if (match === '$' && braces === 0) { - mml.push(MML.TeXAtom(TEX.Parse(text.slice(k,i-1),{}).mml())); - match = ''; k = i; - } else if (match === '') { - if (k < i-1) mml.push(this.InternalText(text.slice(k,i-1),def)); - match = '$'; k = i; - } - } else if (c === '{' && match !== '') { - braces++; - } else if (c === '}') { - if (match === '}' && braces === 0) { - mml.push(MML.TeXAtom(TEX.Parse(text.slice(k,i),{}).mml().With(def))); - match = ''; k = i; - } else if (match !== '') { - if (braces) braces--; - } - } else if (c === '\\') { - if (match === '' && text.substr(i).match(/^(eq)?ref\s*\{/)) { - var len = RegExp["$&"].length; - if (k < i-1) mml.push(this.InternalText(text.slice(k,i-1),def)); - match = '}'; k = i-1; i += len; - } else { - c = text.charAt(i++); - if (c === '(' && match === '') { - if (k < i-2) mml.push(this.InternalText(text.slice(k,i-2),def)); - match = ')'; k = i; - } else if (c === ')' && match === ')' && braces === 0) { - mml.push(MML.TeXAtom(TEX.Parse(text.slice(k,i-2),{}).mml())); - match = ''; k = i; - } else if (c.match(/[${}\\]/) && match === '') { - i--; text = text.substr(0,i-1) + text.substr(i); // remove \ from \$, \{, \}, or \\ - } - } - } - } - if (match !== '') TEX.Error(["MathNotTerminated","Math not terminated in text box"]); - } - if (k < text.length) mml.push(this.InternalText(text.slice(k),def)); - if (level != null) { - mml = [MML.mstyle.apply(MML,mml).With({displaystyle:false,scriptlevel:level})]; - } else if (mml.length > 1) { - mml = [MML.mrow.apply(MML,mml)]; - } - return mml; - }, - InternalText: function (text,def) { - text = text.replace(/^\s+/,NBSP).replace(/\s+$/,NBSP); - return MML.mtext(MML.chars(text)).With(def); - }, - - /* - * Replace macro paramters with their values - */ - SubstituteArgs: function (args,string) { - var text = ''; var newstring = ''; var c; var i = 0; - while (i < string.length) { - c = string.charAt(i++); - if (c === "\\") {text += c + string.charAt(i++)} - else if (c === '#') { - c = string.charAt(i++); - if (c === '#') {text += c} else { - if (!c.match(/[1-9]/) || c > args.length) { - TEX.Error(["IllegalMacroParam", - "Illegal macro parameter reference"]); - } - newstring = this.AddArgs(this.AddArgs(newstring,text),args[c-1]); - text = ''; - } - } else {text += c} - } - return this.AddArgs(newstring,text); - }, - - /* - * Make sure that macros are followed by a space if their names - * could accidentally be continued into the following text. - */ - AddArgs: function (s1,s2) { - if (s2.match(/^[a-z]/i) && s1.match(/(^|[^\\])(\\\\)*\\[a-z]+$/i)) {s1 += ' '} - if (s1.length + s2.length > TEX.config.MAXBUFFER) { - TEX.Error(["MaxBufferSize", - "MathJax internal buffer size exceeded; is there a recursive macro call?"]); - } - return s1+s2; - } - - }); - - /************************************************************************/ - - TEX.Augment({ - Stack: STACK, Parse: PARSE, Definitions: TEXDEF, Startup: STARTUP, - - config: { - MAXMACROS: 10000, // maximum number of macro substitutions per equation - MAXBUFFER: 5*1024 // maximum size of TeX string to process - }, - - sourceMenuTitle: /*_(MathMenu)*/ ["TeXCommands","TeX Commands"], - annotationEncoding: "application/x-tex", - - prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing TeX - postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing TeX - - // - // Check if AMSmath extension must be loaded and push - // it on the extensions array, if needed - // - Config: function () { - this.SUPER(arguments).Config.apply(this,arguments); - if (this.config.equationNumbers.autoNumber !== "none") { - if (!this.config.extensions) {this.config.extensions = []} - this.config.extensions.push("AMSmath.js"); - } - }, - - // - // Convert TeX to ElementJax - // - Translate: function (script) { - var mml, isError = false, math = MathJax.HTML.getScript(script); - var display = (script.type.replace(/\n/g," ").match(/(;|\s|\n)mode\s*=\s*display(;|\s|\n|$)/) != null); - var data = {math:math, display:display, script:script}; - var callback = this.prefilterHooks.Execute(data); if (callback) return callback; - math = data.math; - try { - mml = TEX.Parse(math).mml(); - } catch(err) { - if (!err.texError) {throw err} - mml = this.formatError(err,math,display,script); - isError = true; - } - if (mml.isa(MML.mtable) && mml.displaystyle === "inherit") mml.displaystyle = display; // for tagged equations - if (mml.inferred) {mml = MML.apply(MathJax.ElementJax,mml.data)} else {mml = MML(mml)} - if (display) {mml.root.display = "block"} - if (isError) {mml.texError = true} - data.math = mml; - return this.postfilterHooks.Execute(data) || data.math; - }, - prefilterMath: function (math,displaystyle,script) { - return math; - }, - postfilterMath: function (math,displaystyle,script) { - this.combineRelations(math.root); - return math; - }, - formatError: function (err,math,display,script) { - var message = err.message.replace(/\n.*/,""); - HUB.signal.Post(["TeX Jax - parse error",message,math,display,script]); - return MML.Error(message); - }, - - // - // Produce an error and stop processing this equation - // - Error: function (message) { - // - // Translate message if it is ["id","message",args] - // - if (message instanceof Array) {message = _.apply(_,message)} - throw HUB.Insert(Error(message),{texError: true}); - }, - - // - // Add a user-defined macro to the macro list - // - Macro: function (name,def,argn) { - TEXDEF.macros[name] = ['Macro'].concat([].slice.call(arguments,1)); - TEXDEF.macros[name].isUser = true; - }, - - /* - * Create an mrow that has stretchy delimiters at either end, as needed - */ - fenced: function (open,mml,close) { - var mrow = MML.mrow().With({open:open, close:close, texClass:MML.TEXCLASS.INNER}); - mrow.Append(MML.mo(open).With({fence:true, stretchy:true, texClass:MML.TEXCLASS.OPEN})); - if (mml.type === "mrow") {mrow.Append.apply(mrow,mml.data)} else {mrow.Append(mml)} - mrow.Append(MML.mo(close).With({fence:true, stretchy:true, texClass:MML.TEXCLASS.CLOSE})); - return mrow; - }, - /* - * Create an mrow that has \mathchoice using \bigg and \big for the delimiters - */ - fixedFence: function (open,mml,close) { - var mrow = MML.mrow().With({open:open, close:close, texClass:MML.TEXCLASS.ORD}); - if (open) {mrow.Append(this.mathPalette(open,"l"))} - if (mml.type === "mrow") {mrow.Append.apply(mrow,mml.data)} else {mrow.Append(mml)} - if (close) {mrow.Append(this.mathPalette(close,"r"))} - return mrow; - }, - mathPalette: function (fence,side) { - if (fence === '{' || fence === '}') {fence = "\\"+fence} - var D = '{\\bigg'+side+' '+fence+'}', T = '{\\big'+side+' '+fence+'}'; - return TEX.Parse('\\mathchoice'+D+T+T+T,{}).mml(); - }, - - // - // Combine adjacent elements that are relations - // (since MathML treats the spacing very differently) - // - combineRelations: function (mml) { - var i, m, m1, m2; - for (i = 0, m = mml.data.length; i < m; i++) { - if (mml.data[i]) { - if (mml.isa(MML.mrow)) { - while (i+1 < m && (m1 = mml.data[i]) && (m2 = mml.data[i+1]) && - m1.isa(MML.mo) && m2.isa(MML.mo) && - m1.Get("texClass") === MML.TEXCLASS.REL && - m2.Get("texClass") === MML.TEXCLASS.REL) { - if (m1.variantForm == m2.variantForm && - m1.Get("mathvariant") == m2.Get("mathvariant") && m1.style == m2.style && - m1["class"] == m2["class"] && !m1.id && !m2.id) { - m1.Append.apply(m1,m2.data); - mml.data.splice(i+1,1); m--; - } else { - m1.rspace = m2.lspace = "0pt"; i++; - } - } - } - if (!mml.data[i].isToken) {this.combineRelations(mml.data[i])} - } - } - } - }); - - // - // Add the default filters - // - TEX.prefilterHooks.Add(function (data) { - data.math = TEX.prefilterMath(data.math,data.display,data.script); - }); - TEX.postfilterHooks.Add(function (data) { - data.math = TEX.postfilterMath(data.math,data.display,data.script); - }); - - TEX.loadComplete("jax.js"); - -})(MathJax.InputJax.TeX,MathJax.Hub,MathJax.Ajax); diff --git a/resources/viewer/mathjax/jax/output/SVG/autoload/annotation-xml.js b/resources/viewer/mathjax/jax/output/SVG/autoload/annotation-xml.js deleted file mode 100644 index 2707595cc1..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/autoload/annotation-xml.js +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ - -/************************************************************* - * - * MathJax/jax/output/SVG/autoload/annotation-xml.js - * - * Implements the SVG output for elements. - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2013-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { - var VERSION = "2.6.0"; - var MML = MathJax.ElementJax.mml, - SVG = MathJax.OutputJax.SVG; - var BBOX = SVG.BBOX; - - BBOX.FOREIGN = BBOX.Subclass({type: "foreignObject", removeable: false}); - - MML["annotation-xml"].Augment({ - toSVG: function () { - var svg = this.SVG(); this.SVGhandleSpace(svg); - var encoding = this.Get("encoding"); - for (var i = 0, m = this.data.length; i < m; i++) - {svg.Add(this.data[i].toSVG(encoding),svg.w,0)} - svg.Clean(); - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - } - }); - - MML.xml.Augment({ - toSVG: function (encoding) { - // - // Get size of xml content - // - var span = SVG.textSVG.parentNode; - SVG.mathDiv.style.width = "auto"; // Firefox returns offsetWidth = 0 without this - span.insertBefore(this.div,SVG.textSVG); - var w = this.div.offsetWidth, h = this.div.offsetHeight; - var strut = MathJax.HTML.addElement(this.div,"span",{ - style:{display:"inline-block", overflow:"hidden", height:h+"px", - width:"1px", marginRight:"-1px"} - }); - var d = this.div.offsetHeight - h; h -= d; - this.div.removeChild(strut); - span.removeChild(this.div); SVG.mathDiv.style.width = ""; - // - // Create foreignObject element for the content - // - var scale = 1000/SVG.em; - var svg = BBOX.FOREIGN({ - y:(-h)+"px", width:w+"px", height:(h+d)+"px", - transform:"scale("+scale+") matrix(1 0 0 -1 0 0)" - }); - // - // Add the children to the foreignObject - // - for (var i = 0, m = this.data.length; i < m; i++) - {svg.element.appendChild(this.data[i].cloneNode(true))} - // - // Set the scale and finish up - // - svg.w = w*scale; svg.h = h*scale; svg.d = d*scale; - svg.r = svg.w; svg.l = 0; - svg.Clean(); - this.SVGsaveData(svg); - return svg; - } - }); - - MathJax.Hub.Startup.signal.Post("SVG annotation-xml Ready"); - MathJax.Ajax.loadComplete(SVG.autoloadDir+"/annotation-xml.js"); - -}); - diff --git a/resources/viewer/mathjax/jax/output/SVG/autoload/maction.js b/resources/viewer/mathjax/jax/output/SVG/autoload/maction.js deleted file mode 100644 index a194c0e31c..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/autoload/maction.js +++ /dev/null @@ -1,201 +0,0 @@ -/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ - -/************************************************************* - * - * MathJax/jax/output/SVG/autoload/maction.js - * - * Implements the SVG output for elements. - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { - var VERSION = "2.6.0"; - var MML = MathJax.ElementJax.mml, - SVG = MathJax.OutputJax["SVG"]; - - var currentTip, hover, clear; - - // - // Add configuration for tooltips - // - var CONFIG = SVG.config.tooltip = MathJax.Hub.Insert({ - delayPost: 600, delayClear: 600, - offsetX: 10, offsetY: 5 - },SVG.config.tooltip||{}); - - - MML.maction.Augment({ - SVGtooltip: MathJax.HTML.addElement(document.body,"div",{id:"MathJax_SVG_Tooltip"}), - - toSVG: function (HW,D) { - this.SVGgetStyles(); - var svg = this.SVG(); - var selected = this.selected(); - if (selected.type == "null") {this.SVGsaveData(svg);return svg;} - svg.Add(this.SVGdataStretched(this.Get("selection")-1,HW,D)); - svg.removeable = false; - this.SVGhandleHitBox(svg); - this.SVGhandleSpace(svg); - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - }, - SVGhandleHitBox: function (svg) { - var frame = SVG.Element("rect", - {width:svg.w, height:svg.h+svg.d, y:-svg.d, fill:"none", "pointer-events":"all"}); - svg.element.insertBefore(frame,svg.element.firstChild); - var type = this.Get("actiontype"); - if (this.SVGaction[type]) - {this.SVGaction[type].call(this,svg,svg.element,this.Get("selection"))} - }, - SVGstretchH: MML.mbase.prototype.SVGstretchH, - SVGstretchV: MML.mbase.prototype.SVGstretchV, - - // - // Implementations for the various actions - // - SVGaction: { - toggle: function (svg,frame,selection) { - this.selection = selection; - SVG.Element(frame,{cursor:"pointer"}); - frame.onclick = MathJax.Callback(["SVGclick",this]); - }, - - statusline: function (svg,frame,selection) { - frame.onmouseover = MathJax.Callback(["SVGsetStatus",this]), - frame.onmouseout = MathJax.Callback(["SVGclearStatus",this]); - frame.onmouseover.autoReset = frame.onmouseout.autoReset = true; - }, - - tooltip: function(svg,frame,selection) { - frame.onmouseover = MathJax.Callback(["SVGtooltipOver",this]), - frame.onmouseout = MathJax.Callback(["SVGtooltipOut",this]); - frame.onmouseover.autoReset = frame.onmouseout.autoReset = true; - } - }, - - // - // Handle a click on the maction element - // (remove the original rendering and rerender) - // - SVGclick: function (event) { - this.selection++; - if (this.selection > this.data.length) {this.selection = 1} - var math = this; while (math.type !== "math") {math = math.inherit} - var jax = MathJax.Hub.getJaxFor(math.inputID); //, hover = !!jax.hover; - jax.Update(); - /* - * if (hover) { - * var span = document.getElementById(jax.inputID+"-Span"); - * MathJax.Extension.MathEvents.Hover.Hover(jax,span); - * } - */ - return MathJax.Extension.MathEvents.Event.False(event); - }, - - // - // Set/Clear the window status message - // - SVGsetStatus: function (event) { - // FIXME: Do something better with non-token elements - this.messageID = MathJax.Message.Set - ((this.data[1] && this.data[1].isToken) ? - this.data[1].data.join("") : this.data[1].toString()); - }, - SVGclearStatus: function (event) { - if (this.messageID) {MathJax.Message.Clear(this.messageID,0)} - delete this.messageID; - }, - - // - // Handle tooltips - // - SVGtooltipOver: function (event) { - if (!event) {event = window.event} - if (clear) {clearTimeout(clear); clear = null} - if (hover) {clearTimeout(hover)} - var x = event.pageX; var y = event.pageY; - if (x == null) { - x = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; - y = event.clientY + document.body.scrollTop + document.documentElement.scrollTop; - } - var callback = MathJax.Callback(["SVGtooltipPost",this,x+CONFIG.offsetX,y+CONFIG.offsetY]) - hover = setTimeout(callback,CONFIG.delayPost); - }, - SVGtooltipOut: function (event) { - if (hover) {clearTimeout(hover); hover = null} - if (clear) {clearTimeout(clear)} - var callback = MathJax.Callback(["SVGtooltipClear",this,80]); - clear = setTimeout(callback,CONFIG.delayClear); - }, - SVGtooltipPost: function (x,y) { - hover = null; if (clear) {clearTimeout(clear); clear = null} - - // - // Get the tip div and show it at the right location, then clear its contents - // - var tip = this.SVGtooltip; - tip.style.display = "block"; tip.style.opacity = ""; - if (this === currentTip) return; - tip.style.left = x+"px"; tip.style.top = y+"px"; - tip.innerHTML = ''; var span = MathJax.HTML.addElement(tip,"span"); - - // - // Get the sizes from the jax (FIXME: should calculate again?) - // - var math = this; while (math.type !== "math") {math = math.inherit} - var jax = MathJax.Hub.getJaxFor(math.inputID); - this.em = MML.mbase.prototype.em = jax.SVG.em; this.ex = jax.SVG.ex; - this.linebreakWidth = jax.SVG.lineWidth; this.cwidth = jax.SVG.cwidth; - - // - // Make a new math element and temporarily move the tooltip to it - // Display the math containing the tip, but check for errors - // Then put the tip back into the maction element - // - var mml = this.data[1]; - math = MML.math(mml); - try {math.toSVG(span,tip)} catch(err) { - this.SetData(1,mml); tip.style.display = "none"; - if (!err.restart) {throw err} - MathJax.Callback.After(["SVGtooltipPost",this,x,y],err.restart); - return; - } - this.SetData(1,mml); - - currentTip = this; - }, - SVGtooltipClear: function (n) { - var tip = this.SVGtooltip; - if (n <= 0) { - tip.style.display = "none"; - tip.style.opacity = ""; - clear = null; - } else { - tip.style.opacity = n/100; - clear = setTimeout(MathJax.Callback(["SVGtooltipClear",this,n-20]),50); - } - } - }); - - MathJax.Hub.Startup.signal.Post("SVG maction Ready"); - MathJax.Ajax.loadComplete(SVG.autoloadDir+"/maction.js"); - -}); - diff --git a/resources/viewer/mathjax/jax/output/SVG/autoload/menclose.js b/resources/viewer/mathjax/jax/output/SVG/autoload/menclose.js deleted file mode 100644 index e0e75b0992..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/autoload/menclose.js +++ /dev/null @@ -1,234 +0,0 @@ -/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ - -/************************************************************* - * - * MathJax/jax/output/SVG/autoload/menclose.js - * - * Implements the SVG output for elements. - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { - var VERSION = "2.6.0"; - var MML = MathJax.ElementJax.mml, - SVG = MathJax.OutputJax.SVG, - BBOX = SVG.BBOX; - - BBOX.ELLIPSE = BBOX.Subclass({ - type: "ellipse", removeable: false, - Init: function (h,d,w,t,color,def) { - if (def == null) {def = {}}; def.fill = "none"; - if (color) {def.stroke = color} - def["stroke-width"] = t.toFixed(2).replace(/\.?0+$/,""); - def.cx = Math.floor(w/2); def.cy = Math.floor((h+d)/2-d); - def.rx = Math.floor((w-t)/2); def.ry = Math.floor((h+d-t)/2); - this.SUPER(arguments).Init.call(this,def); - this.w = this.r = w; this.h = this.H = h; - this.d = this.D = d; this.l = 0; - } - }); - - BBOX.DLINE = BBOX.Subclass({ - type: "line", removeable: false, - Init: function (h,d,w,t,color,updown,def) { - if (def == null) {def = {}}; def.fill = "none"; - if (color) {def.stroke = color} - def["stroke-width"] = t.toFixed(2).replace(/\.?0+$/,""); - if (updown == "up") { - def.x1 = Math.floor(t/2); def.y1 = Math.floor(t/2-d); - def.x2 = Math.floor(w-t/2); def.y2 = Math.floor(h-t/2); - } else { - def.x1 = Math.floor(t/2); def.y1 = Math.floor(h-t/2); - def.x2 = Math.floor(w-t/2); def.y2 = Math.floor(t/2-d); - } - this.SUPER(arguments).Init.call(this,def); - this.w = this.r = w; this.h = this.H = h; - this.d = this.D = d; this.l = 0; - } - }); - - BBOX.FPOLY = BBOX.Subclass({ - type: "polygon", removeable: false, - Init: function (points,color,def) { - if (def == null) {def = {}} - if (color) {def.fill = color} - var P = [], mx = 100000000, my = mx, Mx = -mx, My = Mx; - for (var i = 0, m = points.length; i < m; i++) { - var x = points[i][0], y = points[i][1]; - if (x > Mx) {Mx = x}; if (x < mx) {mx = x} - if (y > My) {My = y}; if (y < my) {my = y} - P.push(Math.floor(x)+","+Math.floor(y)); - } - def.points = P.join(" "); - this.SUPER(arguments).Init.call(this,def); - this.w = this.r = Mx; this.h = this.H = My; - this.d = this.D = -my; this.l = -mx; - } - }); - - BBOX.PPATH = BBOX.Subclass({ - type: "path", removeable: false, - Init: function (h,d,w,p,t,color,def) { - if (def == null) {def = {}}; def.fill = "none"; - if (color) {def.stroke = color} - def["stroke-width"] = t.toFixed(2).replace(/\.?0+$/,""); - def.d = p; - this.SUPER(arguments).Init.call(this,def); - this.w = this.r = w; this.h = this.H = h+d; - this.d = this.D = this.l = 0; this.y = -d; - } - }); - - MML.menclose.Augment({ - toSVG: function (HW,DD) { - this.SVGgetStyles(); - - var svg = this.SVG(), scale = this.SVGgetScale(svg); - this.SVGhandleSpace(svg); - var base = this.SVGdataStretched(0,HW,DD); - - var values = this.getValues("notation","thickness","padding","mathcolor","color"); - if (values.color && !this.mathcolor) {values.mathcolor = values.color} - if (values.thickness == null) {values.thickness = ".075em"} - if (values.padding == null) {values.padding = ".2em"} - var mu = this.SVGgetMu(svg); - var p = SVG.length2em(values.padding,mu,1/SVG.em) * scale; // padding for enclosure - var t = SVG.length2em(values.thickness,mu,1/SVG.em); // thickness of lines - t = Math.max(1/SVG.em,t); // see issue #414 - var H = base.h+p+t, D = base.d+p+t, W = base.w+2*(p+t); - var dx = 0, w, h, i, m, borders = [false,false,false,false]; - if (!values.mathcolor) {values.mathcolor = "black"} - - // perform some reduction e.g. eliminate duplicate notations. - var nl = MathJax.Hub.SplitList(values.notation), notation = {}; - for (i = 0, m = nl.length; i < m; i++) notation[nl[i]] = true; - if (notation[MML.NOTATION.UPDIAGONALARROW]) notation[MML.NOTATION.UPDIAGONALSTRIKE] = false; - - for (var n in notation) { - if (!notation.hasOwnProperty(n) || !notation[n]) continue; - switch (n) { - case MML.NOTATION.BOX: - borders = [true,true,true,true]; - break; - - case MML.NOTATION.ROUNDEDBOX: - svg.Add(BBOX.FRAME(H,D,W,t,"solid",values.mathcolor, - {rx:Math.floor(Math.min(H+D-t,W-t)/4)})); - break; - - case MML.NOTATION.CIRCLE: - svg.Add(BBOX.ELLIPSE(H,D,W,t,values.mathcolor)); - break; - - case MML.NOTATION.ACTUARIAL: - borders[0] = true; - case MML.NOTATION.RIGHT: - borders[1] = true; - break; - - case MML.NOTATION.LEFT: - borders[3] = true; - break; - - case MML.NOTATION.TOP: - borders[0] = true; - break; - - case MML.NOTATION.BOTTOM: - borders[2] = true; - break; - - case MML.NOTATION.VERTICALSTRIKE: - svg.Add(BBOX.VLINE(H+D,t,"solid",values.mathcolor),(W-t)/2,-D); - break; - - case MML.NOTATION.HORIZONTALSTRIKE: - svg.Add(BBOX.HLINE(W,t,"solid",values.mathcolor),0,(H+D-t)/2-D); - break; - - case MML.NOTATION.UPDIAGONALSTRIKE: - svg.Add(BBOX.DLINE(H,D,W,t,values.mathcolor,"up")); - break; - - case MML.NOTATION.UPDIAGONALARROW: - var l = Math.sqrt(W*W + (H+D)*(H+D)), f = 1/l * 10/SVG.em * t/.075; - w = W * f; h = (H+D) * f; var x = .4*h; - svg.Add(BBOX.DLINE(H-.5*h,D,W-.5*w,t,values.mathcolor,"up")); - svg.Add(BBOX.FPOLY( - [[x+w,h], [x-.4*h,.4*w], [x+.3*w,.3*h], [x+.4*h,-.4*w], [x+w,h]], - values.mathcolor),W-w-x,H-h); - break; - - case MML.NOTATION.DOWNDIAGONALSTRIKE: - svg.Add(BBOX.DLINE(H,D,W,t,values.mathcolor,"down")); - break; - - case MML.NOTATION.PHASORANGLE: - borders[2] = true; W -= 2*p; p = (H+D)/2; W += p; - svg.Add(BBOX.DLINE(H,D,p,t,values.mathcolor,"up")); - break; - - case MML.NOTATION.MADRUWB: - borders[1] = borders[2] = true; - break; - - case MML.NOTATION.RADICAL: - svg.Add(BBOX.PPATH(H,D,W, - "M "+this.SVGxy(t/2,.4*(H+D)) + - " L "+this.SVGxy(p,t/2) + - " L "+this.SVGxy(2*p,H+D-t/2) + - " L "+this.SVGxy(W,H+D-t/2), - t,values.mathcolor),0,t); - dx = p; - break; - - case MML.NOTATION.LONGDIV: - svg.Add(BBOX.PPATH(H,D,W, - "M "+this.SVGxy(t/2,t/2) + - " a "+this.SVGxy(p,(H+D)/2-2*t) + " 0 0,1 " + this.SVGxy(t/2,H+D-t) + - " L "+this.SVGxy(W,H+D-t/2), - t,values.mathcolor),0,t/2); - dx = p; - break; - } - } - var sides = [["H",W,0,H-t],["V",H+D,W-t,-D],["H",W,0,-D],["V",H+D,0,-D]]; - for (i = 0; i < 4; i++) { - if (borders[i]) { - var side = sides[i]; - svg.Add(BBOX[side[0]+"LINE"](side[1],t,"solid",values.mathcolor),side[2],side[3]); - } - } - svg.Add(base,dx+p+t,0,false,true); - svg.Clean(); - this.SVGhandleSpace(svg); - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - }, - - SVGxy: function (x,y) {return Math.floor(x)+","+Math.floor(y)} - - }); - - MathJax.Hub.Startup.signal.Post("SVG menclose Ready"); - MathJax.Ajax.loadComplete(SVG.autoloadDir+"/menclose.js"); - -}); - diff --git a/resources/viewer/mathjax/jax/output/SVG/autoload/mglyph.js b/resources/viewer/mathjax/jax/output/SVG/autoload/mglyph.js deleted file mode 100644 index 0c332ca655..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/autoload/mglyph.js +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ - -/************************************************************* - * - * MathJax/jax/output/SVG/autoload/mglyph.js - * - * Implements the SVG output for elements. - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { - var VERSION = "2.6.0"; - var MML = MathJax.ElementJax.mml, - SVG = MathJax.OutputJax.SVG, - BBOX = SVG.BBOX, - LOCALE = MathJax.Localization; - - var XLINKNS = "http://www.w3.org/1999/xlink"; - - BBOX.MGLYPH = BBOX.Subclass({ - type: "image", removeable: false, - Init: function (img,w,h,align,mu,def) { - if (def == null) {def = {}} - var W = img.width*1000/SVG.em, H = img.height*1000/SVG.em; - var WW = W, HH = H, y = 0; - if (w !== "") {W = SVG.length2em(w,mu,WW); H = (WW ? W/WW * HH : 0)} - if (h !== "") {H = SVG.length2em(h,mu,HH); if (w === "") {W = (HH ? H/HH * WW : 0)}} - if (align !== "" && align.match(/\d/)) {y = SVG.length2em(align,mu); def.y = -y} - def.height = Math.floor(H); def.width = Math.floor(W); - def.transform = "translate(0,"+H+") matrix(1 0 0 -1 0 0)"; - def.preserveAspectRatio = "none"; - this.SUPER(arguments).Init.call(this,def); - this.element.setAttributeNS(XLINKNS,"href",img.src); - this.w = this.r = W; this.h = this.H = H + y; - this.d = this.D = -y; this.l = 0; - } - }); - - MML.mglyph.Augment({ - toSVG: function (variant,scale) { - this.SVGgetStyles(); var svg = this.SVG(), img, err; - this.SVGhandleSpace(svg); - var values = this.getValues("src","width","height","valign","alt"); - if (values.src === "") { - values = this.getValues("index","fontfamily"); - if (values.index) { - if (!scale) {scale = this.SVGgetScale()} - var def = {}; if (values.fontfamily) {def["font-family"] = values.fontfamily} - svg.Add(BBOX.TEXT(scale,String.fromCharCode(values.index),def)); - } - } else { - if (!this.img) {this.img = MML.mglyph.GLYPH[values.src]} - if (!this.img) { - this.img = MML.mglyph.GLYPH[values.src] = {img: new Image(), status: "pending"}; - img = this.img.img; - img.onload = MathJax.Callback(["SVGimgLoaded",this]); - img.onerror = MathJax.Callback(["SVGimgError",this]); - img.src = values.src; - MathJax.Hub.RestartAfter(img.onload); - } - if (this.img.status !== "OK") { - err = MML.Error( - LOCALE._(["MathML","BadMglyph"],"Bad mglyph: %1",values.src), - {mathsize:"75%"}); - this.Append(err); svg = err.toSVG(); this.data.pop(); - } else { - var mu = this.SVGgetMu(svg); - svg.Add(BBOX.MGLYPH(this.img.img,values.width,values.height,values.valign,mu, - {src:values.src, alt:values.alt, title:values.alt})); - } - } - svg.Clean(); - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - }, - SVGimgLoaded: function (event,status) { - if (typeof(event) === "string") {status = event} - this.img.status = (status || "OK") - }, - SVGimgError: function () {this.img.img.onload("error")} - },{ - GLYPH: {} // global list of all loaded glyphs - }); - - MathJax.Hub.Startup.signal.Post("SVG mglyph Ready"); - MathJax.Ajax.loadComplete(SVG.autoloadDir+"/mglyph.js"); - -}); - diff --git a/resources/viewer/mathjax/jax/output/SVG/autoload/mmultiscripts.js b/resources/viewer/mathjax/jax/output/SVG/autoload/mmultiscripts.js deleted file mode 100644 index 0f7c4e058c..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/autoload/mmultiscripts.js +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ - -/************************************************************* - * - * MathJax/jax/output/SVG/autoload/mmultiscripts.js - * - * Implements the SVG output for elements. - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { - var VERSION = "2.6.0"; - var MML = MathJax.ElementJax.mml, - SVG = MathJax.OutputJax.SVG; - - MML.mmultiscripts.Augment({ - toSVG: function (HW,D) { - this.SVGgetStyles(); - var svg = this.SVG(), scale = this.SVGgetScale(svg); this.SVGhandleSpace(svg); - var base = (this.data[this.base] ? this.SVGdataStretched(this.base,HW,D) : SVG.BBOX.G().Clean()); - var x_height = SVG.TeX.x_height * scale, - s = SVG.TeX.scriptspace * scale * .75; // FIXME: .75 can be removed when IC is right? - - var BOX = this.SVGgetScripts(s); - var sub = BOX[0], sup = BOX[1], presub = BOX[2], presup = BOX[3]; - - var sscale = (this.data[1]||this).SVGgetScale(); - var q = SVG.TeX.sup_drop * sscale, r = SVG.TeX.sub_drop * sscale; - var u = base.h - q, v = base.d + r, delta = 0, p; - if (base.ic) {delta = base.ic} - if (this.data[this.base] && - (this.data[this.base].type === "mi" || this.data[this.base].type === "mo")) { - if (this.data[this.base].data.join("").length === 1 && base.scale === 1 && - !base.stretched && !this.data[this.base].Get("largeop")) {u = v = 0} - } - var min = this.getValues("subscriptshift","superscriptshift"), mu = this.SVGgetMu(svg); - min.subscriptshift = (min.subscriptshift === "" ? 0 : SVG.length2em(min.subscriptshift,mu)); - min.superscriptshift = (min.superscriptshift === "" ? 0 : SVG.length2em(min.superscriptshift,mu)); - - var dx = 0; - if (presub) {dx = presub.w+delta} else if (presup) {dx = presup.w-delta} - svg.Add(base,Math.max(0,dx),0); - - if (!sup && !presup) { - v = Math.max(v,SVG.TeX.sub1*scale,min.subscriptshift); - if (sub) {v = Math.max(v,sub.h-(4/5)*x_height)} - if (presub) {v = Math.max(v,presub.h-(4/5)*x_height)} - if (sub) {svg.Add(sub,dx+base.w+s-delta,-v)} - if (presub) {svg.Add(presub,0,-v)} - } else { - if (!sub && !presub) { - var values = this.getValues("displaystyle","texprimestyle"); - p = SVG.TeX[(values.displaystyle ? "sup1" : (values.texprimestyle ? "sup3" : "sup2"))]; - u = Math.max(u,p*scale,min.superscriptshift); - if (sup) {u = Math.max(u,sup.d+(1/4)*x_height)} - if (presup) {u = Math.max(u,presup.d+(1/4)*x_height)} - if (sup) {svg.Add(sup,dx+base.w+s,u)} - if (presup) {svg.Add(presup,0,u)} - } else { - v = Math.max(v,SVG.TeX.sub2*scale); - var t = SVG.TeX.rule_thickness * scale; - var h = (sub||presub).h, d = (sup||presup).d; - if (presub) {h = Math.max(h,presub.h)} - if (presup) {d = Math.max(d,presup.d)} - if ((u - d) - (h - v) < 3*t) { - v = 3*t - u + d + h; q = (4/5)*x_height - (u - d); - if (q > 0) {u += q; v -= q} - } - u = Math.max(u,min.superscriptshift); v = Math.max(v,min.subscriptshift); - if (sup) {svg.Add(sup,dx+base.w+s,u)} - if (presup) {svg.Add(presup,dx+delta-presup.w,u)} - if (sub) {svg.Add(sub,dx+base.w+s-delta,-v)} - if (presub) {svg.Add(presub,dx-presub.w,-v)} - } - } - svg.Clean(); - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - var data = this.SVGdata; - data.dx = dx; data.s = s; data.u = u, data.v = v; data.delta = delta; - return svg; - }, - SVGgetScripts: function (s) { - var sup, sub, BOX = []; - var i = 1, m = this.data.length, W = 0; - for (var k = 0; k < 4; k += 2) { - while (i < m && (this.data[i]||{}).type !== "mprescripts") { - var box = [null,null,null,null]; - for (var j = k; j < k+2; j++) { - if (this.data[i] && this.data[i].type !== "none" && this.data[i].type !== "mprescripts") { - if (!BOX[j]) {BOX[j] = SVG.BBOX.G()} - box[j] = this.data[i].toSVG(); - } - if ((this.data[i]||{}).type !== "mprescripts") i++; - } - var isPre = (k === 2); - if (isPre) W += Math.max((box[k]||{w:0}).w,(box[k+1]||{w:0}).w); - if (box[k]) BOX[k].Add(box[k].With({x:W-(isPre?box[k].w:0)})); - if (box[k+1]) BOX[k+1].Add(box[k+1].With({x:W-(isPre?box[k+1].w:0)})); - sub = BOX[k]||{w:0}; sup = BOX[k+1]||{w:0}; - sub.w = sup.w = W = Math.max(sub.w,sup.w); - } - i++; W = 0; - } - for (j = 0; j < 4; j++) {if (BOX[j]) {BOX[j].w += s; BOX[j].Clean()}} - return BOX; - } - }); - - MathJax.Hub.Startup.signal.Post("SVG mmultiscripts Ready"); - MathJax.Ajax.loadComplete(SVG.autoloadDir+"/mmultiscripts.js"); - -}); - diff --git a/resources/viewer/mathjax/jax/output/SVG/autoload/ms.js b/resources/viewer/mathjax/jax/output/SVG/autoload/ms.js deleted file mode 100644 index 22c4c4c0ce..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/autoload/ms.js +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ - -/************************************************************* - * - * MathJax/jax/output/SVG/autoload/ms.js - * - * Implements the SVG output for elements. - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { - var VERSION = "2.6.0"; - var MML = MathJax.ElementJax.mml, - SVG = MathJax.OutputJax.SVG; - - MML.ms.Augment({ - toSVG: function () { - this.SVGgetStyles(); - var svg = this.SVG(); this.SVGhandleSpace(svg); - var values = this.getValues("lquote","rquote","mathvariant"); - if (!this.hasValue("lquote") || values.lquote === '"') values.lquote = "\u201C"; - if (!this.hasValue("rquote") || values.rquote === '"') values.rquote = "\u201D"; - if (values.lquote === "\u201C" && values.mathvariant === "monospace") values.lquote = '"'; - if (values.rquote === "\u201D" && values.mathvariant === "monospace") values.rquote = '"'; - var variant = this.SVGgetVariant(), scale = this.SVGgetScale(); - var text = values.lquote+this.data.join("")+values.rquote; // FIXME: handle mglyph? - svg.Add(this.SVGhandleVariant(variant,scale,text)); - svg.Clean(); - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - } - }); - - MathJax.Hub.Startup.signal.Post("SVG ms Ready"); - MathJax.Ajax.loadComplete(SVG.autoloadDir+"/ms.js"); - -}); - diff --git a/resources/viewer/mathjax/jax/output/SVG/autoload/mtable.js b/resources/viewer/mathjax/jax/output/SVG/autoload/mtable.js deleted file mode 100644 index ee3a18159e..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/autoload/mtable.js +++ /dev/null @@ -1,389 +0,0 @@ -/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ - -/************************************************************* - * - * MathJax/jax/output/SVG/autoload/mtable.js - * - * Implements the SVG output for elements. - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { - var VERSION = "2.6.0"; - var MML = MathJax.ElementJax.mml, - SVG = MathJax.OutputJax.SVG, - BBOX = SVG.BBOX; - - MML.mtable.Augment({ - toSVG: function (span) { - this.SVGgetStyles(); - var svg = this.SVG(), scale = this.SVGgetScale(svg); - if (this.data.length === 0) {this.SVGsaveData(svg);return svg} - var values = this.getValues("columnalign","rowalign","columnspacing","rowspacing", - "columnwidth","equalcolumns","equalrows", - "columnlines","rowlines","frame","framespacing", - "align","useHeight","width","side","minlabelspacing"); - // Handle relative width as fixed width in relation to container - if (values.width.match(/%$/)) - {svg.width = values.width = SVG.Em((SVG.cwidth/1000)*(parseFloat(values.width)/100))} - - var mu = this.SVGgetMu(svg); - var LABEL = -1; - - var H = [], D = [], W = [], A = [], C = [], i, j, J = -1, - m, M, s, row, cell, mo, HD; - var LH = SVG.FONTDATA.lineH * scale * values.useHeight, - LD = SVG.FONTDATA.lineD * scale * values.useHeight; - - // - // Create cells and measure columns and rows - // - for (i = 0, m = this.data.length; i < m; i++) { - row = this.data[i]; s = (row.type === "mlabeledtr" ? LABEL : 0); - A[i] = []; H[i] = LH; D[i] = LD; - for (j = s, M = row.data.length + s; j < M; j++) { - if (W[j] == null) { - if (j > J) {J = j} - C[j] = BBOX.G(); - W[j] = -SVG.BIGDIMEN; - } - cell = row.data[j-s]; - A[i][j] = cell.toSVG(); -// if (row.data[j-s].isMultiline) {A[i][j].style.width = "100%"} - if (cell.isEmbellished()) { - mo = cell.CoreMO(); - var min = mo.Get("minsize",true); - if (min) { - if (mo.SVGcanStretch("Vertical")) { - HD = mo.SVGdata.h + mo.SVGdata.d; - if (HD) { - min = SVG.length2em(min,mu,HD); - if (min*mo.SVGdata.h/HD > H[i]) {H[i] = min*mo.SVGdata.h/HD} - if (min*mo.SVGdata.d/HD > D[i]) {D[i] = min*mo.SVGdata.d/HD} - } - } else if (mo.SVGcanStretch("Horizontal")) { - min = SVG.length2em(min,mu,mo.SVGdata.w); - if (min > W[j]) {W[j] = min} - } - } - } - if (A[i][j].h > H[i]) {H[i] = A[i][j].h} - if (A[i][j].d > D[i]) {D[i] = A[i][j].d} - if (A[i][j].w > W[j]) {W[j] = A[i][j].w} - } - } - - // - // Determine spacing and alignment - // - var SPLIT = MathJax.Hub.SplitList; - var CSPACE = SPLIT(values.columnspacing), - RSPACE = SPLIT(values.rowspacing), - CALIGN = SPLIT(values.columnalign), - RALIGN = SPLIT(values.rowalign), - CLINES = SPLIT(values.columnlines), - RLINES = SPLIT(values.rowlines), - CWIDTH = SPLIT(values.columnwidth), - RCALIGN = []; - for (i = 0, m = CSPACE.length; i < m; i++) {CSPACE[i] = SVG.length2em(CSPACE[i],mu)} - for (i = 0, m = RSPACE.length; i < m; i++) {RSPACE[i] = SVG.length2em(RSPACE[i],mu)} - while (CSPACE.length < J) {CSPACE.push(CSPACE[CSPACE.length-1])} - while (CALIGN.length <= J) {CALIGN.push(CALIGN[CALIGN.length-1])} - while (CLINES.length < J) {CLINES.push(CLINES[CLINES.length-1])} - while (CWIDTH.length <= J) {CWIDTH.push(CWIDTH[CWIDTH.length-1])} - while (RSPACE.length < A.length) {RSPACE.push(RSPACE[RSPACE.length-1])} - while (RALIGN.length <= A.length) {RALIGN.push(RALIGN[RALIGN.length-1])} - while (RLINES.length < A.length) {RLINES.push(RLINES[RLINES.length-1])} - if (C[LABEL]) { - CALIGN[LABEL] = (values.side.substr(0,1) === "l" ? "left" : "right"); - CSPACE[LABEL] = -W[LABEL]; - } - // - // Override row data - // - for (i = 0, m = A.length; i < m; i++) { - row = this.data[i]; RCALIGN[i] = []; - if (row.rowalign) {RALIGN[i] = row.rowalign} - if (row.columnalign) { - RCALIGN[i] = SPLIT(row.columnalign); - while (RCALIGN[i].length <= J) {RCALIGN[i].push(RCALIGN[i][RCALIGN[i].length-1])} - } - } - - // - // Handle equal heights - // - if (values.equalrows) { - // FIXME: should really be based on row align (below is for baseline) - var Hm = Math.max.apply(Math,H), Dm = Math.max.apply(Math,D); - for (i = 0, m = A.length; i < m; i++) - {s = ((Hm + Dm) - (H[i] + D[i])) / 2; H[i] += s; D[i] += s} - } - - // FIXME: do background colors for entire cell (include half the intercolumn space?) - - // - // Determine array total height - // - HD = H[0] + D[A.length-1]; - for (i = 0, m = A.length-1; i < m; i++) - {HD += Math.max(0,D[i]+H[i+1]+RSPACE[i])} - // - // Determine frame and line sizes - // - var fx = 0, fy = 0, fW, fH = HD; - if (values.frame !== "none" || - (values.columnlines+values.rowlines).match(/solid|dashed/)) { - var frameSpacing = SPLIT(values.framespacing); - if (frameSpacing.length != 2) { - // invalid attribute value: use the default. - frameSpacing = SPLIT(this.defaults.framespacing); - } - fx = SVG.length2em(frameSpacing[0],mu); - fy = SVG.length2em(frameSpacing[1],mu); - fH = HD + 2*fy; // fW waits until svg.w is determined - } - // - // Compute alignment - // - var Y, fY, n = ""; - if (typeof(values.align) !== "string") {values.align = String(values.align)} - if (values.align.match(/(top|bottom|center|baseline|axis)( +(-?\d+))?/)) - {n = RegExp.$3||""; values.align = RegExp.$1} else {values.align = this.defaults.align} - if (n !== "") { - // - // Find the height of the given row - // - n = parseInt(n); - if (n < 0) {n = A.length + 1 + n} - if (n < 1) {n = 1} else if (n > A.length) {n = A.length} - Y = 0; fY = -(HD + fy) + H[0]; - for (i = 0, m = n-1; i < m; i++) { - // FIXME: Should handle values.align for final row - var dY = Math.max(0,D[i]+H[i+1]+RSPACE[i]); - Y += dY; fY += dY; - } - } else { - Y = ({ - top: -(H[0] + fy), - bottom: HD + fy - H[0], - center: HD/2 - H[0], - baseline: HD/2 - H[0], - axis: HD/2 + SVG.TeX.axis_height*scale - H[0] - })[values.align]; - fY = ({ - top: -(HD + 2*fy), - bottom: 0, - center: -(HD/2 + fy), - baseline: -(HD/2 + fy), - axis: SVG.TeX.axis_height*scale - HD/2 - fy - })[values.align]; - } - - var WW, WP = 0, Wt = 0, Wp = 0, p = 0, f = 0, P = [], F = [], Wf = 1; - // - if (values.equalcolumns && values.width !== "auto") { - // - // Handle equalcolumns for percent-width and fixed-width tables - // - - // Get total width minus column spacing - WW = SVG.length2em(values.width,mu); - for (i = 0, m = Math.min(J,CSPACE.length); i < m; i++) {WW -= CSPACE[i]} - // Determine individual column widths - WW /= J; - for (i = 0, m = Math.min(J+1,CWIDTH.length); i < m; i++) {W[i] = WW} - } else { - // - // Get column widths for fit and percentage columns - // - // Calculate the natural widths and percentage widths, - // while keeping track of the fit and percentage columns - for(i = 0, m = Math.min(J+1,CWIDTH.length); i < m; i++) { - if (CWIDTH[i] === "auto") {Wt += W[i]} - else if (CWIDTH[i] === "fit") {F[f] = i; f++; Wt += W[i]} - else if (CWIDTH[i].match(/%$/)) - {P[p] = i; p++; Wp += W[i]; WP += SVG.length2em(CWIDTH[i],mu,1)} - else {W[i] = SVG.length2em(CWIDTH[i],mu); Wt += W[i]} - } - // Get the full width (excluding inter-column spacing) - if (values.width === "auto") { - if (WP > .98) {Wf = Wp/(Wt+Wp); WW = Wt + Wp} else {WW = Wt / (1-WP)} - } else { - WW = SVG.length2em(values.width,mu); - for (i = 0, m = Math.min(J,CSPACE.length); i < m; i++) {WW -= CSPACE[i]} - } - // Determine the relative column widths - for (i = 0, m = P.length; i < m; i++) { - W[P[i]] = SVG.length2em(CWIDTH[P[i]],mu,WW*Wf); Wt += W[P[i]]; - } - // Stretch fit columns, if any, otherwise stretch (or shrink) everything - if (Math.abs(WW - Wt) > .01) { - if (f && WW > Wt) { - WW = (WW - Wt) / f; for (i = 0, m = F.length; i < m; i++) {W[F[i]] += WW} - } else {WW = WW/Wt; for (j = 0; j <= J; j++) {W[j] *= WW}} - } - // - // Handle equal columns - // - if (values.equalcolumns) { - var Wm = Math.max.apply(Math,W); - for (j = 0; j <= J; j++) {W[j] = Wm} - } - } - - // - // Lay out array columns - // - var y = Y, dy, align; s = (C[LABEL] ? LABEL : 0); - for (j = s; j <= J; j++) { - C[j].w = W[j]; - for (i = 0, m = A.length; i < m; i++) { - if (A[i][j]) { - s = (this.data[i].type === "mlabeledtr" ? LABEL : 0); - cell = this.data[i].data[j-s]; - if (cell.SVGcanStretch("Horizontal")) { - A[i][j] = cell.SVGstretchH(W[j]); - } else if (cell.SVGcanStretch("Vertical")) { - mo = cell.CoreMO(); - var symmetric = mo.symmetric; mo.symmetric = false; - A[i][j] = cell.SVGstretchV(H[i],D[i]); - mo.symmetric = symmetric; - } - align = cell.rowalign||this.data[i].rowalign||RALIGN[i]; - dy = ({top: H[i] - A[i][j].h, - bottom: A[i][j].d - D[i], - center: ((H[i]-D[i]) - (A[i][j].h-A[i][j].d))/2, - baseline: 0, axis: 0})[align] || 0; // FIXME: handle axis better? - align = (cell.columnalign||RCALIGN[i][j]||CALIGN[j]) - C[j].Align(A[i][j],align,0,y+dy); - } - if (i < A.length-1) {y -= Math.max(0,D[i]+H[i+1]+RSPACE[i])} - } - y = Y; - } - - // - // Place the columns and add column lines - // - var lw = 1.5*SVG.em; - var x = fx - lw/2; - for (j = 0; j <= J; j++) { - svg.Add(C[j],x,0); x += W[j] + CSPACE[j]; - if (CLINES[j] !== "none" && j < J && j !== LABEL) - {svg.Add(BBOX.VLINE(fH,lw,CLINES[j]),x-CSPACE[j]/2,fY)} - } - svg.w += fx; svg.d = -fY; svg.h = fH+fY; - fW = svg.w; - - // - // Add frame - // - if (values.frame !== "none") { - svg.Add(BBOX.HLINE(fW,lw,values.frame),0,fY+fH-lw); - svg.Add(BBOX.HLINE(fW,lw,values.frame),0,fY); - svg.Add(BBOX.VLINE(fH,lw,values.frame),0,fY); - svg.Add(BBOX.VLINE(fH,lw,values.frame),fW-lw,fY); - } - - // - // Add row lines - // - y = Y - lw/2; - for (i = 0, m = A.length-1; i < m; i++) { - dy = Math.max(0,D[i]+H[i+1]+RSPACE[i]); - if (RLINES[i] !== "none") - {svg.Add(BBOX.HLINE(fW,lw,RLINES[i]),0,y-D[i]-(dy-D[i]-H[i+1])/2)} - y -= dy; - } - - // - // Finish the table - // - svg.Clean(); - this.SVGhandleSpace(svg); - this.SVGhandleColor(svg); - - // - // Place the labels, if any - // - if (C[LABEL]) { - svg.tw = Math.max(svg.w,svg.r) - Math.min(0,svg.l); - var indent = this.getValues("indentalignfirst","indentshiftfirst","indentalign","indentshift"); - if (indent.indentalignfirst !== MML.INDENTALIGN.INDENTALIGN) {indent.indentalign = indent.indentalignfirst} - if (indent.indentalign === MML.INDENTALIGN.AUTO) {indent.indentalign = this.displayAlign} - if (indent.indentshiftfirst !== MML.INDENTSHIFT.INDENTSHIFT) {indent.indentshift = indent.indentshiftfirst} - if (indent.indentshift === "auto" || indent.indentshift === "") {indent.indentshift = "0"} - var shift = SVG.length2em(indent.indentshift,mu,SVG.cwidth); - var labelspace = SVG.length2em(values.minlabelspacing,mu,SVG.cwidth); - var labelW = labelspace + C[LABEL].w, labelshift = 0, tw = svg.w; - var dIndent = SVG.length2em(this.displayIndent,mu,SVG.cwidth); - s = (CALIGN[LABEL] === MML.INDENTALIGN.RIGHT ? -1 : 1); - if (indent.indentalign === MML.INDENTALIGN.CENTER) { - var dx = (SVG.cwidth-tw)/2; shift += dIndent; - if (labelW + s*labelshift > dx + s*shift) { - indent.indentalign = CALIGN[LABEL]; - shift = s*(labelW + s*labelshift); tw += labelW + Math.max(0,shift); - } - } else if (CALIGN[LABEL] === indent.indentalign) { - if (dIndent < 0) {labelshift = s*dIndent; dIndent = 0} - shift += s*dIndent; if (labelW > s*shift) shift = s*labelW; shift += labelshift; - tw += s*shift; - } else { - shift -= s*dIndent; - if (tw - s*shift + labelW > SVG.cwidth) { - shift = s*(tw + labelW - SVG.cwidth); - if (s*shift > 0) {tw = SVG.cwidth + s*shift; shift = 0} - } - } - var eqn = svg; svg = this.SVG(); - svg.hasIndent = true; - svg.w = svg.r = Math.max(tw,SVG.cwidth); - svg.Align(C[LABEL],CALIGN[LABEL],0,0,labelshift); - svg.Align(eqn,indent.indentalign,0,0,shift); - svg.tw = tw; - } - - this.SVGsaveData(svg); - return svg; - }, - SVGhandleSpace: function (svg) { - if (!this.hasFrame && !svg.width) {svg.x = svg.X = 167} - this.SUPER(arguments).SVGhandleSpace.call(this,svg); - } - }); - - MML.mtd.Augment({ - toSVG: function (HW,D) { - var svg = this.svg = this.SVG(); - if (this.data[0]) { - svg.Add(this.SVGdataStretched(0,HW,D)); - svg.Clean(); - } - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - } - }); - - MathJax.Hub.Startup.signal.Post("SVG mtable Ready"); - MathJax.Ajax.loadComplete(SVG.autoloadDir+"/mtable.js"); - -}); - diff --git a/resources/viewer/mathjax/jax/output/SVG/autoload/multiline.js b/resources/viewer/mathjax/jax/output/SVG/autoload/multiline.js deleted file mode 100644 index 6a918e5991..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/autoload/multiline.js +++ /dev/null @@ -1,718 +0,0 @@ -/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ - -/************************************************************* - * - * MathJax/jax/output/SVG/autoload/multiline.js - * - * Implements the SVG output for 's that contain line breaks. - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { - var VERSION = "2.6.0"; - var MML = MathJax.ElementJax.mml, - SVG = MathJax.OutputJax.SVG, - BBOX = SVG.BBOX; - - // - // Penalties for the various line breaks - // - var PENALTY = { - newline: 0, - nobreak: 1000000, - goodbreak: [-200], - badbreak: [+200], - auto: [0], - - toobig: 800, - nestfactor: 400, - spacefactor: -100, - spaceoffset: 2, - spacelimit: 1, // spaces larger than this get a penalty boost - fence: 500, - close: 500 - }; - - var ENDVALUES = {linebreakstyle: "after"}; - - - /**************************************************************************/ - - MML.mrow.Augment({ - // - // Handle breaking an mrow into separate lines - // - SVGmultiline: function (svg) { - - // - // Find the parent element and mark it as multiline - // - var parent = this; - while (parent.inferred || (parent.parent && parent.parent.type === "mrow" && - parent.parent.data.length === 1)) {parent = parent.parent} - var isTop = ((parent.type === "math" && parent.Get("display") === "block") || - parent.type === "mtd"); - parent.isMultiline = true; - - // - // Default values for the line-breaking parameters - // - var VALUES = this.getValues( - "linebreak","linebreakstyle","lineleading","linebreakmultchar", - "indentalign","indentshift", - "indentalignfirst","indentshiftfirst", - "indentalignlast","indentshiftlast" - ); - if (VALUES.linebreakstyle === MML.LINEBREAKSTYLE.INFIXLINEBREAKSTYLE) - {VALUES.linebreakstyle = this.Get("infixlinebreakstyle")} - VALUES.lineleading = SVG.length2em(VALUES.lineleading,1,0.5); - - // - // Start with a fresh SVG element - // and make it full width if we are breaking to a specific width - // in the top-level math element - // - svg = this.SVG(); - if (isTop && parent.type !== "mtd") { - if (SVG.linebreakWidth < SVG.BIGDIMEN) {svg.w = SVG.linebreakWidth} - else {svg.w = SVG.cwidth} - } - - var state = { - n: 0, Y: 0, - scale: this.scale || 1, - isTop: isTop, - values: {}, - VALUES: VALUES - }, - align = this.SVGgetAlign(state,{}), - shift = this.SVGgetShift(state,{},align), - start = [], - end = { - index:[], penalty:PENALTY.nobreak, - w:0, W:shift, shift:shift, scanW:shift, - nest: 0 - }, - broken = false; - - // - // Break the expression at its best line breaks - // - while (this.SVGbetterBreak(end,state) && - (end.scanW >= SVG.linebreakWidth || end.penalty === PENALTY.newline)) { - this.SVGaddLine(svg,start,end.index,state,end.values,broken); - start = end.index.slice(0); broken = true; - align = this.SVGgetAlign(state,end.values); - shift = this.SVGgetShift(state,end.values,align); - if (align === MML.INDENTALIGN.CENTER) {shift = 0} - end.W = end.shift = end.scanW = shift; end.penalty = PENALTY.nobreak; - } - state.isLast = true; - this.SVGaddLine(svg,start,[],state,ENDVALUES,broken); - - this.SVGhandleSpace(svg); - this.SVGhandleColor(svg); - svg.isMultiline = true; - - this.SVGsaveData(svg); - return svg; - } - }); - - /**************************************************************************/ - - MML.mbase.Augment({ - SVGlinebreakPenalty: PENALTY, - - /****************************************************************/ - // - // Locate the next linebreak that is better than the current one - // - SVGbetterBreak: function (info,state) { - if (this.isToken) {return false} // FIXME: handle breaking of token elements - if (this.isEmbellished()) { - info.embellished = this; - return this.CoreMO().SVGbetterBreak(info,state); - } - if (this.linebreakContainer) {return false} - // - // Get the current breakpoint position and other data - // - var index = info.index.slice(0), i = info.index.shift(), - m = this.data.length, W, w, scanW, broken = (info.index.length > 0), better = false; - if (i == null) {i = -1}; if (!broken) {i++; info.W += info.w; info.w = 0} - scanW = info.scanW = info.W; info.nest++; - // - // Look through the line for breakpoints, - // (as long as we are not too far past the breaking width) - // - while (i < m && info.scanW < 1.33*SVG.linebreakWidth) { - if (this.data[i]) { - if (this.data[i].SVGbetterBreak(info,state)) { - better = true; index = [i].concat(info.index); W = info.W; w = info.w; - if (info.penalty === PENALTY.newline) { - info.index = index; - if (info.nest) {info.nest--} - return true; - } - } - scanW = (broken ? info.scanW : this.SVGaddWidth(i,info,scanW)); - } - info.index = []; i++; broken = false; - } - if (info.nest) {info.nest--} - info.index = index; - if (better) {info.W = W} - return better; - }, - SVGaddWidth: function (i,info,scanW) { - if (this.data[i]) { - var svg = this.data[i].SVGdata; - scanW += svg.w + svg.x; if (svg.X) {scanW += svg.X} - info.W = info.scanW = scanW; info.w = 0; - } - return scanW; - }, - - /****************************************************************/ - // - // Create a new line and move the required elements into it - // Position it using proper alignment and indenting - // - SVGaddLine: function (svg,start,end,state,values,broken) { - // - // Create a box for the line, with empty BBox - // fill it with the proper elements, - // and clean up the bbox - // - var line = BBOX(); - state.first = broken; state.last = true; - this.SVGmoveLine(start,end,line,state,values); - line.Clean(); - // - // Get the alignment and shift values - // - var align = this.SVGgetAlign(state,values), - shift = this.SVGgetShift(state,values,align); - // - // Set the Y offset based on previous depth, leading, and current height - // - if (state.n > 0) { - var LHD = SVG.FONTDATA.baselineskip * state.scale; - var leading = (state.values.lineleading == null ? state.VALUES : state.values).lineleading * state.scale; - state.Y -= Math.max(LHD,state.d + line.h + leading); - } - // - // Place the new line - // - if (line.w + shift > svg.w) svg.w = line.w + shift; - svg.Align(line,align,0,state.Y,shift); - // - // Save the values needed for the future - // - state.d = line.d; state.values = values; state.n++; - }, - - /****************************************************************/ - // - // Get alignment and shift values from the given data - // - SVGgetAlign: function (state,values) { - var cur = values, prev = state.values, def = state.VALUES, align; - if (state.n === 0) {align = cur.indentalignfirst || prev.indentalignfirst || def.indentalignfirst} - else if (state.isLast) {align = prev.indentalignlast || def.indentalignlast} - else {align = prev.indentalign || def.indentalign} - if (align === MML.INDENTALIGN.INDENTALIGN) {align = prev.indentalign || def.indentalign} - if (align === MML.INDENTALIGN.AUTO) {align = (state.isTop ? this.displayAlign : MML.INDENTALIGN.LEFT)} - return align; - }, - SVGgetShift: function (state,values,align) { - var cur = values, prev = state.values, def = state.VALUES, shift; - if (state.n === 0) {shift = cur.indentshiftfirst || prev.indentshiftfirst || def.indentshiftfirst} - else if (state.isLast) {shift = prev.indentshiftlast || def.indentshiftlast} - else {shift = prev.indentshift || def.indentshift} - if (shift === MML.INDENTSHIFT.INDENTSHIFT) {shift = prev.indentshift || def.indentshift} - if (shift === "auto" || shift === "") {shift = "0"} - shift = SVG.length2em(shift,1,SVG.cwidth); - if (state.isTop && this.displayIndent !== "0") { - var indent = SVG.length2em(this.displayIndent,1,SVG.cwidth); - shift += (align === MML.INDENTALIGN.RIGHT ? -indent: indent); - } - return shift; - }, - - /****************************************************************/ - // - // Move the selected elements into the new line, - // moving whole items when possible, and parts of ones - // that are split by a line break. - // - SVGmoveLine: function (start,end,svg,state,values) { - var i = start[0], j = end[0]; - if (i == null) {i = -1}; if (j == null) {j = this.data.length-1} - if (i === j && start.length > 1) { - // - // If starting and ending in the same element move the subpiece to the new line - // - this.data[i].SVGmoveSlice(start.slice(1),end.slice(1),svg,state,values,"paddingLeft"); - } else { - // - // Otherwise, move the remainder of the initial item - // and any others up to the last one - // - var last = state.last; state.last = false; - while (i < j) { - if (this.data[i]) { - if (start.length <= 1) {this.data[i].SVGmove(svg,state,values)} - else {this.data[i].SVGmoveSlice(start.slice(1),[],svg,state,values,"paddingLeft")} - } - i++; state.first = false; start = []; - } - // - // If the last item is complete, move it, - // otherwise move the first part of it up to the split - // - state.last = last; - if (this.data[i]) { - if (end.length <= 1) {this.data[i].SVGmove(svg,state,values)} - else {this.data[i].SVGmoveSlice([],end.slice(1),svg,state,values,"paddingRight")} - } - } - }, - - /****************************************************************/ - // - // Split an element and copy the selected items into the new part - // - SVGmoveSlice: function (start,end,svg,state,values,padding) { - // - // Create a new container for the slice of the element - // Move the selected portion into the slice - // - var slice = BBOX(); - this.SVGmoveLine(start,end,slice,state,values); - slice.Clean(); - this.SVGhandleColor(slice); - svg.Add(slice,svg.w,0,true); - return slice; - }, - - /****************************************************************/ - // - // Move an element from its original position to its new location in - // a split element or the new line's position - // - SVGmove: function (line,state,values) { - // FIXME: handle linebreakstyle === "duplicate" - // FIXME: handle linebreakmultchar - if (!(state.first || state.last) || - (state.first && state.values.linebreakstyle === MML.LINEBREAKSTYLE.BEFORE) || - (state.last && values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER)) { - // - // Recreate output - // Remove padding (if first, remove at leftt, if last remove at right) - // Add to line - // - var svg = this.toSVG(this.SVGdata.HW,this.SVGdata.D); - if (state.first || state.nextIsFirst) {svg.x = 0} - if (state.last && svg.X) {svg.X = 0} - line.Add(svg,line.w,0,true); - } - if (state.first && svg && svg.w === 0) {state.nextIsFirst = true} - else {delete state.nextIsFirst} - } - }); - - /**************************************************************************/ - - MML.mfenced.Augment({ - SVGbetterBreak: function (info,state) { - // - // Get the current breakpoint position and other data - // - var index = info.index.slice(0), i = info.index.shift(), - m = this.data.length, W, w, scanW, broken = (info.index.length > 0), better = false; - if (i == null) {i = -1}; if (!broken) {i++; info.W += info.w; info.w = 0} - scanW = info.scanW = info.W; info.nest++; - // - // Create indices that include the delimiters and separators - // - if (!this.dataI) { - this.dataI = []; - if (this.data.open) {this.dataI.push("open")} - if (m) {this.dataI.push(0)} - for (var j = 1; j < m; j++) { - if (this.data["sep"+j]) {this.dataI.push("sep"+j)} - this.dataI.push(j); - } - if (this.data.close) {this.dataI.push("close")} - } - m = this.dataI.length; - // - // Look through the line for breakpoints, including the open, close, and separators - // (as long as we are not too far past the breaking width) - // - while (i < m && info.scanW < 1.33*SVG.linebreakWidth) { - var k = this.dataI[i]; - if (this.data[k]) { - if (this.data[k].SVGbetterBreak(info,state)) { - better = true; index = [i].concat(info.index); W = info.W; w = info.w; - if (info.penalty === PENALTY.newline) { - info.index = index; - if (info.nest) {info.nest--} - return true; - } - } - scanW = (broken ? info.scanW : this.SVGaddWidth(i,info,scanW)); - } - info.index = []; i++; broken = false; - } - if (info.nest) {info.nest--} - info.index = index; - if (better) {info.W = W; info.w = w} - return better; - }, - - SVGmoveLine: function (start,end,svg,state,values) { - var i = start[0], j = end[0]; - if (i == null) {i = -1}; if (j == null) {j = this.dataI.length-1} - if (i === j && start.length > 1) { - // - // If starting and ending in the same element move the subpiece to the new line - // - this.data[this.dataI[i]].SVGmoveSlice(start.slice(1),end.slice(1),svg,state,values,"paddingLeft"); - } else { - // - // Otherwise, move the remainder of the initial item - // and any others (including open and separators) up to the last one - // - var last = state.last; state.last = false; var k = this.dataI[i]; - while (i < j) { - if (this.data[k]) { - if (start.length <= 1) {this.data[k].SVGmove(svg,state,values)} - else {this.data[k].SVGmoveSlice(start.slice(1),[],svg,state,values,"paddingLeft")} - } - i++; k = this.dataI[i]; state.first = false; start = []; - } - // - // If the last item is complete, move it - // - state.last = last; - if (this.data[k]) { - if (end.length <= 1) {this.data[k].SVGmove(svg,state,values)} - else {this.data[k].SVGmoveSlice([],end.slice(1),svg,state,values,"paddingRight")} - } - } - } - - }); - - /**************************************************************************/ - - MML.msubsup.Augment({ - SVGbetterBreak: function (info,state) { - if (!this.data[this.base]) {return false} - // - // Get the current breakpoint position and other data - // - var index = info.index.slice(0), i = info.index.shift(), - W, w, scanW, broken = (info.index.length > 0), better = false; - if (!broken) {info.W += info.w; info.w = 0} - scanW = info.scanW = info.W; - // - // Record the width of the base and the super- and subscripts - // - if (i == null) {this.SVGdata.dw = this.SVGdata.w - this.data[this.base].SVGdata.w} - // - // Check if the base can be broken - // - if (this.data[this.base].SVGbetterBreak(info,state)) { - better = true; index = [this.base].concat(info.index); W = info.W; w = info.w; - if (info.penalty === PENALTY.newline) {better = broken = true} - } - // - // Add in the base if it is unbroken, and add the scripts - // - if (!broken) {this.SVGaddWidth(this.base,info,scanW)} - info.scanW += this.SVGdata.dw; info.W = info.scanW; - info.index = []; if (better) {info.W = W; info.w = w; info.index = index} - return better; - }, - - SVGmoveLine: function (start,end,svg,state,values) { - // - // Move the proper part of the base - // - if (this.data[this.base]) { - if (start.length > 1) { - this.data[this.base].SVGmoveSlice(start.slice(1),end.slice(1),svg,state,values,"paddingLeft"); - } else { - if (end.length <= 1) {this.data[this.base].SVGmove(svg,state,values)} - else {this.data[this.base].SVGmoveSlice([],end.slice(1),svg,state,values,"paddingRight")} - } - } - // - // If this is the end, check for super and subscripts, and move those - // by moving the stack that contains them, and shifting by the amount of the - // base that has been removed. Remove the empty base box from the stack. - // - if (end.length === 0) { - var sup = this.data[this.sup], sub = this.data[this.sub], w = svg.w, data; - if (sup) {data = sup.SVGdata||{}; svg.Add(sup.toSVG(),w+(data.dx||0),data.dy)} - if (sub) {data = sub.SVGdata||{}; svg.Add(sub.toSVG(),w+(data.dx||0),data.dy)} - } - } - - }); - - /**************************************************************************/ - - MML.mmultiscripts.Augment({ - SVGbetterBreak: function (info,state) { - if (!this.data[this.base]) {return false} - // - // Get the current breakpoint position and other data - // - var index = info.index.slice(0); info.index.shift(); - var W, w, scanW, broken = (info.index.length > 0), better = false; - if (!broken) {info.W += info.w; info.w = 0} - info.scanW = info.W; - // - // The width of the postscripts - // - var dw = this.SVGdata.w - this.data[this.base].SVGdata.w - this.SVGdata.dx; - // - // Add in the prescripts - // - info.scanW += this.SVGdata.dx; scanW = info.scanW; - // - // Check if the base can be broken (but don't break between prescripts and base) - // - if (this.data[this.base].SVGbetterBreak(info,state)) { - better = true; index = [this.base].concat(info.index); W = info.W; w = info.w; - if (info.penalty === PENALTY.newline) {better = broken = true} - } - // - // Add in the base if it is unbroken, and add the postscripts - // - if (!broken) {this.SVGaddWidth(this.base,info,scanW)} - info.scanW += dw; info.W = info.scanW; - info.index = []; if (better) {info.W = W; info.w = w; info.index = index} - return better; - }, - - SVGmoveLine: function (start,end,svg,state,values) { - var dx, data = this.SVGdata; - // - // If this is the start, move the prescripts, if any. - // - if (start.length < 1) { - this.scriptBox = this.SVGgetScripts(this.SVGdata.s); - var presub = this.scriptBox[2], presup = this.scriptBox[3]; dx = svg.w + data.dx; - if (presup) {svg.Add(presup,dx+data.delta-presup.w,data.u)} - if (presub) {svg.Add(presub,dx-presub.w,-data.v)} - } - // - // Move the proper part of the base - // - if (this.data[this.base]) { - if (start.length > 1) { - this.data[this.base].SVGmoveSlice(start.slice(1),end.slice(1),svg,state,values,"paddingLeft"); - } else { - if (end.length <= 1) {this.data[this.base].SVGmove(svg,state,values)} - else {this.data[this.base].SVGmoveSlice([],end.slice(1),svg,state,values,"paddingRight")} - } - } - // - // If this is the end, move the postscripts, if any. - // - if (end.length === 0) { - var sub = this.scriptBox[0], sup = this.scriptBox[1]; dx = svg.w + data.s; - if (sup) {svg.Add(sup,dx,data.u)} - if (sub) {svg.Add(sub,dx-data.delta,-data.v)} - delete this.scriptBox; - } - } - - }); - - /**************************************************************************/ - - MML.mo.Augment({ - // - // Override the method for checking line breaks to properly handle - // - SVGbetterBreak: function (info,state) { - if (info.values && info.values.last === this) {return false} - var values = this.getValues( - "linebreak","linebreakstyle","lineleading","linebreakmultchar", - "indentalign","indentshift", - "indentalignfirst","indentshiftfirst", - "indentalignlast","indentshiftlast", - "texClass", "fence" - ); - if (values.linebreakstyle === MML.LINEBREAKSTYLE.INFIXLINEBREAKSTYLE) - {values.linebreakstyle = this.Get("infixlinebreakstyle")} - // - // Adjust nesting by TeX class (helps output that does not include - // mrows for nesting, but can leave these unbalanced. - // - if (values.texClass === MML.TEXCLASS.OPEN) {info.nest++} - if (values.texClass === MML.TEXCLASS.CLOSE && info.nest) {info.nest--} - // - // Get the default penalty for this location - // - var W = info.scanW, mo = info.embellished; delete info.embellished; - if (!mo || !mo.SVGdata) {mo = this} - var svg = mo.SVGdata, w = svg.w + svg.x; - if (values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER) {W += w; w = 0} - if (W - info.shift === 0 && values.linebreak !== MML.LINEBREAK.NEWLINE) - {return false} // don't break at zero width (FIXME?) - var offset = SVG.linebreakWidth - W; - // adjust offest for explicit first-line indent and align - if (state.n === 0 && (values.indentshiftfirst !== state.VALUES.indentshiftfirst || - values.indentalignfirst !== state.VALUES.indentalignfirst)) { - var align = this.SVGgetAlign(state,values), - shift = this.SVGgetShift(state,values,align); - offset += (info.shift - shift); - } - // - var penalty = Math.floor(offset / SVG.linebreakWidth * 1000); - if (penalty < 0) {penalty = PENALTY.toobig - 3*penalty} - if (values.fence) {penalty += PENALTY.fence} - if ((values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER && - values.texClass === MML.TEXCLASS.OPEN) || - values.texClass === MML.TEXCLASS.CLOSE) {penalty += PENALTY.close} - penalty += info.nest * PENALTY.nestfactor; - // - // Get the penalty for this type of break and - // use it to modify the default penalty - // - var linebreak = PENALTY[values.linebreak||MML.LINEBREAK.AUTO]; - if (!(linebreak instanceof Array)) { - // for breaks past the width, don't modify penalty - if (offset >= 0) {penalty = linebreak * info.nest} - } else {penalty = Math.max(1,penalty + linebreak[0] * info.nest)} - // - // If the penalty is no better than the current one, return false - // Otherwise save the data for this breakpoint and return true - // - if (penalty >= info.penalty) {return false} - info.penalty = penalty; info.values = values; info.W = W; info.w = w; - values.lineleading = SVG.length2em(values.lineleading,1,state.VALUES.lineleading); - values.last = this; - return true; - } - }); - - /**************************************************************************/ - - MML.mspace.Augment({ - // - // Override the method for checking line breaks to properly handle - // - SVGbetterBreak: function (info,state) { - if (info.values && info.values.last === this) {return false} - var values = this.getValues("linebreak"); - var linebreakValue = values.linebreak; - if (!linebreakValue || this.hasDimAttr()) { - // The MathML spec says that the linebreak attribute should be ignored - // if any dimensional attribute is set. - linebreakValue = MML.LINEBREAK.AUTO; - } - // - // Get the default penalty for this location - // - var W = info.scanW, svg = this.SVGdata, w = svg.w + svg.x; - if (W - info.shift === 0) {return false} // don't break at zero width (FIXME?) - var offset = SVG.linebreakWidth - W; - // - var penalty = Math.floor(offset / SVG.linebreakWidth * 1000); - if (penalty < 0) {penalty = PENALTY.toobig - 3*penalty} - penalty += info.nest * PENALTY.nestfactor; - // - // Get the penalty for this type of break and - // use it to modify the default penalty - // - var linebreak = PENALTY[linebreakValue]; - if (linebreakValue === MML.LINEBREAK.AUTO && w >= PENALTY.spacelimit*1000 && - !this.mathbackground && !this.backrgound) - {linebreak = [(w/1000+PENALTY.spaceoffset)*PENALTY.spacefactor]} - if (!(linebreak instanceof Array)) { - // for breaks past the width, don't modify penalty - if (offset >= 0) {penalty = linebreak * info.nest} - } else {penalty = Math.max(1,penalty + linebreak[0] * info.nest)} - // - // If the penalty is no better than the current one, return false - // Otherwise save the data for this breakpoint and return true - // - if (penalty >= info.penalty) {return false} - info.penalty = penalty; info.values = values; info.W = W; info.w = w; - values.lineleading = state.VALUES.lineleading; - values.linebreakstyle = "before"; values.last = this; - return true; - } - }); - - // - // Hook into the mathchoice extension - // - MathJax.Hub.Register.StartupHook("TeX mathchoice Ready",function () { - MML.TeXmathchoice.Augment({ - SVGbetterBreak: function (info,state) { - return this.Core().SVGbetterBreak(info,state); - }, - SVGmoveLine: function (start,end,svg,state,values) { - return this.Core().SVGmoveSlice(start,end,svg,state,values); - } - }); - }); - - // - // Have maction process only the selected item - // - MML.maction.Augment({ - SVGbetterBreak: function (info,state) { - return this.Core().SVGbetterBreak(info,state); - }, - SVGmoveLine: function (start,end,svg,state,values) { - return this.Core().SVGmoveSlice(start,end,svg,state,values); - }, - }); - - // - // Have semantics only do the first element - // (FIXME: do we need to do anything special about annotation-xml?) - // - MML.semantics.Augment({ - SVGbetterBreak: function (info,state) { - return (this.data[0] ? this.data[0].SVGbetterBreak(info,state) : false); - }, - SVGmoveLine: function (start,end,svg,state,values) { - return (this.data[0] ? this.data[0].SVGmoveSlice(start,end,svg,state,values) : null); - } - }); - - /**************************************************************************/ - - MathJax.Hub.Startup.signal.Post("SVG multiline Ready"); - MathJax.Ajax.loadComplete(SVG.autoloadDir+"/multiline.js"); - -}); - diff --git a/resources/viewer/mathjax/jax/output/SVG/config.js b/resources/viewer/mathjax/jax/output/SVG/config.js deleted file mode 100644 index b5282f790d..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/config.js +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ - -/************************************************************* - * - * MathJax/jax/output/SVG/config.js - * - * Initializes the SVG OutputJax (the main definition is in - * MathJax/jax/input/SVG/jax.js, which is loaded when needed). - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -MathJax.OutputJax.SVG = MathJax.OutputJax({ - id: "SVG", - version: "2.6.1", - directory: MathJax.OutputJax.directory + "/SVG", - extensionDir: MathJax.OutputJax.extensionDir + "/SVG", - autoloadDir: MathJax.OutputJax.directory + "/SVG/autoload", - fontDir: MathJax.OutputJax.directory + "/SVG/fonts", // font name added later - - config: { - scale: 100, minScaleAdjust: 50, // global math scaling factor, and minimum adjusted scale factor - font: "TeX", // currently the only font available - blacker: 1, // stroke-width to make fonts blacker - mtextFontInherit: false, // to make be in page font rather than MathJax font - undefinedFamily: "STIXGeneral,'Arial Unicode MS',serif", // fonts to use for missing characters - - addMMLclasses: false, // keep MathML structure and use CSS classes to mark elements - useFontCache: true, // use elements to re-use font paths rather than repeat paths every time - useGlobalCache: true, // store fonts in a global for use in all equations, or one in each equation - - EqnChunk: (MathJax.Hub.Browser.isMobile ? 10: 50), - // number of equations to process before showing them - EqnChunkFactor: 1.5, // chunk size is multiplied by this after each chunk - EqnChunkDelay: 100, // milliseconds to delay between chunks (to let browser - // respond to other events) - - linebreaks: { - automatic: false, // when false, only process linebreak="newline", - // when true, insert line breaks automatically in long expressions. - - width: "container" // maximum width of a line for automatic line breaks (e.g. "30em"). - // use "container" to compute size from containing element, - // use "nn% container" for a portion of the container, - // use "nn%" for a portion of the window size - }, - - merrorStyle: { - fontSize:"90%", color:"#C00", background:"#FF8", - border: "1px solid #C00", padding:"3px" - }, - - styles: { - ".MathJax_SVG_Display": { - "text-align": "center", - margin: "1em 0em" - }, - - // - // For mtextFontInherit version of \texttt{} - // - ".MathJax_SVG .MJX-monospace": { - "font-family": "monospace" - }, - - // - // For mtextFontInherit version of \textsf{} - // - ".MathJax_SVG .MJX-sans-serif": { - "font-family": "sans-serif" - }, - - // - // For tooltips - // - "#MathJax_SVG_Tooltip": { - "background-color": "InfoBackground", color: "InfoText", - border: "1px solid black", - "box-shadow": "2px 2px 5px #AAAAAA", // Opera 10.5 - "-webkit-box-shadow": "2px 2px 5px #AAAAAA", // Safari 3 and Chrome - "-moz-box-shadow": "2px 2px 5px #AAAAAA", // Forefox 3.5 - "-khtml-box-shadow": "2px 2px 5px #AAAAAA", // Konqueror - padding: "3px 4px", - "z-index": 401 - } - } - } -}); - -if (!MathJax.Hub.config.delayJaxRegistration) {MathJax.OutputJax.SVG.Register("jax/mml")} - -MathJax.OutputJax.SVG.loadComplete("config.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Arrows.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Arrows.js deleted file mode 100644 index f8d4e0f611..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Arrows.js +++ /dev/null @@ -1,140 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/Arrows.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // LEFTWARDS ARROW - 0x2190: [437,-64,500,64,423,'292 419Q292 400 261 347T211 275H306Q319 275 338 275T364 276Q399 276 410 271T422 250T411 230T366 225H306H211Q214 222 232 197T271 136T292 82Q292 71 285 68T262 64H250H241Q221 64 216 67T205 83Q186 127 153 167T78 230Q64 238 64 250Q64 258 69 263T82 272T106 288T139 318Q162 342 177 365T198 402T209 425T223 436Q224 437 252 437H258Q292 437 292 419'], - - // RIGHTWARDS ARROW - 0x2192: [437,-64,500,58,417,'188 417Q188 437 221 437H233Q256 437 263 434T275 417Q294 373 327 333T402 270Q417 261 417 250Q417 241 410 236T382 217T341 182Q315 155 299 128T275 85T263 66Q259 64 231 64H219Q197 64 191 72T193 100Q202 124 215 147T239 185T257 210T267 223L269 225H174H116Q80 225 69 229T58 250T70 271T114 276Q121 276 140 276T174 275H269L267 277Q266 280 257 291T233 325T205 374Q188 408 188 417'], - - // LEFTWARDS ARROW WITH STROKE - 0x219A: [437,-60,1000,56,942,'942 250Q942 244 928 230H511L457 148Q440 124 420 93Q404 68 400 64T389 60Q381 60 375 66T368 81Q368 88 415 159L462 230H175L188 214Q210 188 235 145T264 85Q264 75 260 74T231 72L206 74L191 103Q169 142 164 150Q130 195 64 239Q56 244 56 250T64 261Q115 294 142 323T191 397L206 428H231Q255 428 259 426T264 414Q260 397 235 355T188 288L175 272L331 270Q488 270 491 272Q491 275 542 352T597 432Q602 437 609 437Q617 437 622 432T628 417T582 341L537 272L735 270H931Q942 257 942 250'], - - // RIGHTWARDS ARROW WITH STROKE - 0x219B: [437,-60,1000,54,942,'54 250Q54 258 66 270H277L488 272L542 350Q596 431 602 435Q604 437 609 437Q617 437 622 432T628 417T582 341L537 272L608 270H751L822 272L808 288Q786 313 761 355T733 414Q733 424 737 426T766 428H793L806 397Q829 354 864 314Q896 284 928 263Q942 257 942 250T928 237Q887 208 864 185Q829 147 806 103L793 74L766 72Q742 72 738 73T733 85Q735 102 756 137T797 198L817 225L822 230H511L457 148Q440 124 420 93Q404 68 400 64T389 60Q381 60 375 66T368 81Q368 88 415 159L462 230H264L66 232Q54 239 54 250'], - - // LEFTWARDS TWO HEADED ARROW - 0x219E: [417,-83,1000,56,944,'56 250Q103 277 142 322T199 417H221Q244 417 244 416Q244 414 237 397T208 344T158 278L151 270H276L285 277Q322 306 349 345T388 417H434Q434 413 424 392T393 338T349 279L340 270H634Q933 270 937 266L938 265Q944 259 944 250T938 235L937 234Q933 230 634 230H340L349 221Q372 196 393 163T424 108T434 83H388Q377 116 350 155T285 223L276 230H151L158 222Q186 191 207 156T236 104T244 84Q244 83 221 83H199Q181 133 142 178T56 250'], - - // RIGHTWARDS TWO HEADED ARROW - 0x21A0: [417,-83,1000,55,943,'943 250Q895 221 856 177T801 83H778Q755 83 755 84Q755 86 762 103T791 156T841 222L848 230H723L714 223Q677 194 650 155T611 83H565Q565 87 575 108T606 162T650 221L659 230H365Q66 230 62 234L61 235Q55 241 55 250T61 265L62 266Q66 270 365 270H659L650 279Q627 304 606 337T575 392T565 417H611Q622 384 649 345T714 277L723 270H848L841 278Q813 309 792 344T763 396T755 416Q755 417 778 417H801Q817 367 856 323T943 250'], - - // LEFTWARDS ARROW WITH TAIL - 0x21A2: [417,-83,1111,56,1031,'56 250Q103 277 142 322T199 417H221Q244 417 244 416Q244 414 237 397T208 344T158 278L151 270H873L882 277Q919 306 946 345T985 417H1031Q1031 413 1021 392T990 338T946 279L937 270V230L946 221Q969 196 990 163T1021 108T1031 83H985Q974 116 947 155T882 223L873 230H151L158 222Q186 191 207 156T236 104T244 84Q244 83 221 83H199Q181 133 142 178T56 250'], - - // RIGHTWARDS ARROW WITH TAIL - 0x21A3: [417,-83,1111,79,1054,'1054 250Q1006 221 967 177T912 83H889Q866 83 866 84Q866 86 873 103T902 156T952 222L959 230H237L228 223Q191 194 164 155T125 83H79Q79 87 89 108T120 162T164 221L173 230V270L164 279Q141 304 120 337T89 392T79 417H125Q136 384 163 345T228 277L237 270H959L952 278Q924 309 903 344T874 396T866 416Q866 417 889 417H912Q928 367 967 323T1054 250'], - - // LEFTWARDS ARROW WITH LOOP - 0x21AB: [576,41,1000,56,965,'56 250Q103 277 142 322T199 417H221Q244 417 244 416Q244 414 237 397T208 344T158 278L151 270H622V305Q622 356 624 388T635 460T661 521T709 559T785 575Q813 575 833 573T880 561T923 534T952 483T964 405Q964 374 959 350T942 307T918 276T884 255T847 242T804 235T760 231T713 230H662V-27Q654 -41 644 -41H642H640Q628 -41 622 -27V230H151L158 222Q186 191 207 156T236 104T244 84Q244 83 221 83H199Q181 133 142 178T56 250ZM924 403Q924 474 894 505T794 536Q758 536 734 526T696 500T675 453T665 395T662 319V270H699Q826 270 875 295T924 403'], - - // RIGHTWARDS ARROW WITH LOOP - 0x21AC: [575,41,1000,35,943,'35 405Q35 454 48 489T86 542T137 567T195 575Q229 575 251 571T301 554T345 510T370 429Q377 384 377 305V270H848L841 278Q813 309 792 344T763 396T755 416Q755 417 778 417H801Q817 367 856 323T943 250Q896 221 857 177T801 83H778Q755 83 755 84Q755 86 762 103T791 156T841 222L848 230H377V-27Q369 -41 359 -41H357Q342 -41 337 -25V230H286Q247 231 225 232T169 238T115 255T75 284T45 333T35 405ZM75 406Q75 322 123 296T300 270H337V319Q335 432 317 477T240 534Q232 535 197 535Q140 535 108 507T75 406'], - - // LEFT RIGHT WAVE ARROW - 0x21AD: [417,-83,1389,57,1331,'57 250Q159 311 200 417H246L242 407Q215 340 159 278L152 270H276L315 310Q354 349 358 351Q366 356 376 351Q378 350 455 273L530 196L606 273Q683 350 686 351Q694 354 703 351Q705 350 782 273L858 196L933 273Q1010 350 1012 351Q1022 356 1030 351Q1034 349 1073 310L1112 270H1236L1229 278Q1173 340 1146 407L1142 417H1188Q1233 306 1331 250Q1231 192 1188 83H1142L1146 93Q1173 160 1229 222L1236 230H1168Q1155 230 1139 230T1119 229Q1112 229 1108 229T1099 231T1092 233T1085 238T1078 245T1068 256T1056 269L1021 304L984 267Q948 230 910 191T867 149Q857 144 848 150Q844 151 770 227T694 304T618 228T540 150Q531 144 521 149Q517 152 479 191T404 267L367 304L332 269Q328 264 320 256T310 246T303 239T296 234T289 231T280 229T269 229Q265 229 249 229T220 230H152L159 222Q215 160 242 93L246 83H223L200 84L195 96Q152 190 57 250'], - - // LEFT RIGHT ARROW WITH STROKE - 0x21AE: [437,-60,1000,56,942,'491 272Q491 275 542 352T597 432Q602 437 609 437Q617 437 622 432T628 417T582 341L537 272L608 270H751L822 272L808 288Q786 313 761 355T733 414Q733 424 737 426T766 428H793L806 397Q829 354 864 314Q896 284 928 263Q942 257 942 250T928 237Q887 208 864 185Q829 147 806 103L793 74L766 72Q742 72 738 73T733 85Q735 102 756 137T797 198L817 225L822 230H511L457 148Q440 124 420 93Q404 68 400 64T389 60Q381 60 375 66T368 81Q368 88 415 159L462 230H175L188 214Q210 188 235 145T264 85Q264 75 260 74T231 72L206 74L191 103Q169 142 164 150Q130 195 64 239Q56 244 56 250T64 261Q115 294 142 323T191 397L206 428H231Q255 428 259 426T264 414Q260 397 235 355T188 288L175 272L331 270Q488 270 491 272'], - - // UPWARDS ARROW WITH TIP LEFTWARDS - 0x21B0: [722,0,500,56,444,'56 555Q74 567 79 570T107 592T141 625T170 667T198 722H221Q244 722 244 721Q244 718 236 699T207 647T161 587L151 576L291 575H292H293H294H296H297H298H299H300H301H302H304H305H306H307H308H309H310H311H312H314H315H316H317H318H319H320H321H322H323H324H325H327H328H329H330H331H332H333H334H335H336H337H338H339H340H341H342H343H345Q435 574 438 570L439 569L440 568Q444 564 444 287Q444 15 442 12Q436 0 424 0T406 12Q404 15 404 275V535H151L162 523Q187 495 207 462T236 410T244 389H198L193 402Q171 457 131 497T56 555'], - - // UPWARDS ARROW WITH TIP RIGHTWARDS - 0x21B1: [722,0,500,55,443,'301 722Q339 618 443 555L437 551Q431 547 422 541T401 526T377 504T352 477T327 443T306 402L301 389H255Q255 392 263 410T291 461T337 523L348 535H95V275Q95 15 93 12Q87 0 75 0T57 12Q55 15 55 287Q55 564 59 568L60 569Q64 573 76 573T208 575L348 576L338 587Q314 613 294 646T264 698T255 721Q255 722 278 722H301'], - - // ANTICLOCKWISE TOP SEMICIRCLE ARROW - 0x21B6: [461,1,1000,17,950,'361 210Q373 210 373 182V177Q373 155 370 151T348 139Q303 118 267 84T216 28T201 1Q197 -1 196 -1Q189 -1 184 8Q166 39 143 64T99 104T61 129T32 144T19 150Q17 152 17 179Q17 203 21 208Q28 210 39 206Q106 178 157 135L175 119V126Q179 130 179 155Q182 173 193 201Q228 305 312 374T510 459Q532 461 551 461H567Q678 461 784 386Q835 344 861 301Q902 245 926 173T950 32Q950 15 944 8Q930 -6 917 8Q910 12 910 43Q901 208 801 314T561 421Q453 421 359 359Q300 319 263 258T217 126L216 125Q216 124 216 123T217 122Q219 122 229 131T260 156T301 181Q314 189 336 199T361 210'], - - // CLOCKWISE TOP SEMICIRCLE ARROW - 0x21B7: [460,1,1000,46,982,'972 209Q980 209 981 204T982 179Q982 155 979 151T957 139Q915 121 878 86T815 8Q808 -1 803 -1Q801 -1 797 1Q797 6 783 28T732 84T650 139L628 150Q626 152 626 177Q626 201 630 206Q636 210 637 210Q650 210 697 181Q727 166 764 137L784 119L782 132Q767 239 689 318T499 417Q474 421 442 421Q343 421 261 369T130 219Q86 121 86 28Q86 15 79 8Q73 1 66 1T53 8Q46 15 46 30Q46 102 77 192T186 361Q274 443 386 459Q396 460 426 460Q515 460 588 431T703 361T773 271T812 187T822 132Q822 123 825 123Q936 209 972 209'], - - // ANTICLOCKWISE OPEN CIRCLE ARROW - 0x21BA: [650,83,778,56,722,'369 543T369 563T397 583Q408 583 440 579L454 577L464 581Q492 592 516 609T552 638T565 650Q604 638 607 637Q606 636 598 628T585 614T570 601T548 584T523 568L510 560L516 558Q522 555 527 553T541 546T559 536T580 523T603 506T626 485Q722 384 722 250Q722 106 622 12T387 -83Q253 -83 155 12T56 250Q56 357 110 433T235 545Q244 550 252 550Q270 550 270 531Q270 522 261 515T238 501T202 477T159 433Q95 352 95 250Q95 131 178 45T388 -42Q511 -42 596 43T682 250Q682 340 636 408T522 511Q495 526 488 526Q488 525 488 525T487 522T485 515L490 506Q505 481 516 451T531 404T535 384L532 385Q529 386 524 387T513 390L491 397L488 408Q472 483 413 542L399 543Q369 543 369 563'], - - // CLOCKWISE OPEN CIRCLE ARROW - 0x21BB: [650,83,778,56,721,'170 637L213 650Q270 597 313 581L323 577L337 579Q369 583 380 583Q408 583 408 563T380 543H378L364 542Q305 483 289 408L286 397L264 390Q259 389 254 388T245 385L242 384Q242 387 246 403T261 450T287 506L292 515Q291 519 291 521T290 524T289 526Q284 526 265 517T216 486T160 434T114 354T95 249Q95 132 178 45T388 -42Q513 -42 597 44T682 250Q682 337 638 404T532 506Q529 508 525 510T519 514T515 516T511 519T509 522T508 526T507 531Q507 550 525 550Q533 550 542 545Q569 532 596 511T653 454T702 366T721 250Q721 151 672 74T547 -43T388 -83Q254 -83 155 12T56 250Q56 385 151 485Q164 498 179 509T205 528T228 542T247 551T260 558L267 560L254 568Q215 590 170 637'], - - // UPWARDS HARPOON WITH BARB RIGHTWARDS - 0x21BE: [694,194,417,188,375,'188 258V694H208L215 682Q246 628 293 594T375 551V528Q375 505 374 505Q369 505 351 510T299 534T237 578L228 587V205Q228 -178 226 -182Q221 -194 208 -194T190 -182Q188 -178 188 258'], - - // UPWARDS HARPOON WITH BARB LEFTWARDS - 0x21BF: [694,194,417,41,228,'41 551Q76 559 123 592T201 682L208 694H228V258Q228 -178 226 -182Q221 -194 208 -194T190 -182Q188 -178 188 205V587L179 578Q151 552 117 534T65 511T42 505Q41 505 41 528V551'], - - // DOWNWARDS HARPOON WITH BARB RIGHTWARDS - 0x21C2: [694,194,417,188,375,'190 682Q195 694 208 694T226 683Q228 679 228 296V-87L237 -78Q265 -52 299 -34T351 -11T374 -5Q375 -5 375 -28V-51Q340 -60 293 -92T215 -182L208 -194H188V242Q188 678 190 682'], - - // DOWNWARDS HARPOON WITH BARB LEFTWARDS - 0x21C3: [694,194,417,41,228,'188 295V573Q188 657 189 672T200 692Q206 694 208 694Q221 694 226 683Q228 679 228 242V-194H208L201 -182Q170 -128 123 -94T41 -51V-28Q41 -5 42 -5Q47 -5 65 -10T117 -34T179 -78L188 -87V295'], - - // RIGHTWARDS ARROW OVER LEFTWARDS ARROW - 0x21C4: [667,0,1000,55,944,'943 500Q895 471 856 427T801 333H778Q755 333 755 334Q755 336 762 353T791 406T841 472L848 480H459Q70 480 67 482Q55 488 55 500T67 518Q70 520 459 520H848L841 528Q813 559 792 594T763 646T755 666Q755 667 778 667H801Q817 617 856 573T943 500ZM56 167Q102 194 141 238T198 333H221Q244 333 244 332Q221 265 161 198L151 187H539Q928 187 930 186Q944 182 944 167Q944 155 934 149Q930 147 541 147H151L160 137Q185 110 205 77T235 24T244 1Q244 0 221 0H199Q158 106 56 167'], - - // LEFTWARDS ARROW OVER RIGHTWARDS ARROW - 0x21C6: [667,0,1000,55,944,'56 500Q103 527 142 572T199 667H221Q244 667 244 666Q244 664 237 647T208 594T158 528L151 520H539Q928 520 932 518Q944 513 944 500T932 482Q928 480 539 480H151L158 472Q186 441 207 406T236 354T244 334Q244 333 221 333H199Q181 383 142 428T56 500ZM943 167Q835 101 801 0H778Q755 0 755 1T758 9T765 25T771 39Q800 94 839 137L848 147H458Q68 147 66 149Q55 154 55 167Q55 182 69 186Q71 187 460 187H848L838 198Q811 228 791 261T762 314L755 332Q755 333 778 333H801Q841 227 943 167'], - - // LEFTWARDS PAIRED ARROWS - 0x21C7: [583,83,1000,55,944,'930 437Q944 426 944 416T934 399Q930 397 540 397H150L159 387Q185 360 205 328T234 277T243 252Q243 237 217 191T159 113L150 103H540Q930 103 934 101Q944 94 944 84Q944 71 930 64L540 63H151Q180 34 203 -2T236 -61L244 -83H198Q178 -31 142 11T66 77L55 83L65 89Q157 145 197 246Q199 250 190 269Q150 359 65 411L55 417L66 423Q106 447 142 489T198 583H244Q202 488 151 437H930'], - - // UPWARDS PAIRED ARROWS - 0x21C8: [694,193,833,83,749,'83 551Q190 590 250 694Q251 689 263 671T307 621T380 567Q409 551 416 551Q422 551 447 563T511 608T577 684L582 694Q642 591 749 551V528Q749 505 748 505Q745 505 724 515T669 546T612 590L602 599V-181Q595 -193 585 -193H582H581Q568 -193 565 -183L563 -179L562 209V598L552 589Q517 556 473 531T414 506H412Q411 506 393 514T361 530T324 553T280 589L270 598V-179Q255 -192 250 -193H247Q237 -193 230 -181V599L220 590Q197 567 164 546T110 515T84 505Q83 505 83 528V551'], - - // RIGHTWARDS PAIRED ARROWS - 0x21C9: [583,83,1000,55,944,'55 416Q55 427 70 437H848Q819 466 796 502T764 561L755 583H801Q821 531 857 489T933 423L944 417L934 411Q843 355 802 254Q800 250 809 231Q849 141 934 89L944 83L933 77Q893 53 857 11T801 -83H755Q797 12 848 63H459L70 64Q55 70 55 84Q55 94 65 101Q69 103 459 103H849L840 113Q806 148 779 196T756 254Q756 255 760 264T770 286T786 315T809 351T840 387L849 397H459Q69 397 65 399Q55 406 55 416'], - - // DOWNWARDS PAIRED ARROWS - 0x21CA: [694,194,833,83,749,'230 681Q240 694 251 694Q260 693 270 680V-98L280 -89Q297 -73 314 -60T348 -38T374 -24T397 -13T412 -6H414Q428 -6 473 -32T552 -89L562 -98V291L563 680Q570 693 582 693Q593 694 602 681V-99L612 -90Q635 -68 668 -47T723 -15T748 -5Q749 -5 749 -28V-51Q642 -91 582 -194L577 -184Q551 -141 512 -108T447 -63T416 -51T385 -63T321 -108T255 -184L250 -194Q189 -89 83 -51V-28Q83 -5 84 -5Q88 -5 109 -15T164 -46T220 -90L230 -99V681'], - - // LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON - 0x21CB: [514,14,1000,55,944,'195 504L198 514H221Q244 514 244 512Q244 508 239 490T215 437T171 376L162 367H545Q928 367 932 365Q944 360 944 347T932 329Q928 327 492 327H55V347L67 354Q113 379 146 420T195 504ZM67 171Q70 173 507 173H944V153L932 146Q839 95 804 -4L801 -14H778Q755 -14 755 -12Q768 59 828 124L837 133H454Q71 133 67 135Q55 140 55 153Q55 165 67 171'], - - // RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON - 0x21CC: [514,14,1000,55,944,'755 512Q755 514 778 514H801L804 503Q805 501 812 486T824 462T839 437T862 408T892 381T932 354L944 347V327H507Q70 327 67 329Q55 335 55 347T67 365Q70 367 454 367H837L828 376Q803 403 785 437T761 489T755 512ZM55 153V173H492Q928 173 932 171Q944 166 944 153T932 135Q928 133 545 133H162L171 124Q198 95 216 61T239 8L244 -12Q244 -14 221 -14H198L195 -4Q160 95 67 146L55 153'], - - // LEFTWARDS DOUBLE ARROW WITH STROKE - 0x21CD: [535,35,1000,54,942,'397 525Q410 525 414 524T418 516Q418 506 394 467T331 381L319 367H473L624 369L657 445Q674 487 684 507T699 531T709 534Q717 534 722 528T728 516Q728 510 695 434Q689 418 683 402T672 377T668 367H928Q942 355 942 347Q942 341 928 327H791Q651 327 651 325Q649 324 620 251T586 174Q586 172 757 172H928Q942 158 942 152Q942 143 928 132H568L537 54Q510 -9 503 -22T486 -35Q479 -35 473 -29T466 -17T495 61L526 132H319L331 118Q364 81 391 37T418 -17Q418 -23 415 -24T401 -26Q398 -26 397 -26L384 -24L377 -13Q344 49 301 97T218 170T143 210T84 233T55 245Q54 253 59 256T86 267Q281 327 377 512L384 525H397ZM606 325Q606 327 439 327H275Q258 312 179 265L148 249Q228 206 262 181L275 172H544L575 247L606 325'], - - // LEFT RIGHT DOUBLE ARROW WITH STROKE - 0x21CE: [534,37,1000,32,965,'395 -24T395 -19T417 57T440 132H255L266 116Q308 64 340 -6Q342 -17 337 -21Q335 -26 320 -26T302 -19Q302 -15 294 4T265 54T217 117T145 182T49 236Q30 243 33 254Q40 261 49 263Q98 283 142 315T214 379T263 442T293 493T302 519Q305 525 320 525T337 521Q342 516 340 505Q308 435 266 383L255 370L384 367H515Q561 522 569 530Q574 534 580 534Q587 534 594 528T602 516Q602 512 580 441T557 367H651L742 370L731 383Q689 435 657 505Q655 516 660 521Q662 525 677 525T695 519Q695 515 703 496T732 446T780 383T853 317T949 263Q967 258 964 245Q959 240 949 236Q897 215 852 182T779 116T731 52T703 3T695 -19Q692 -26 677 -26T660 -21Q655 -17 657 -6Q670 21 682 42T702 77T717 99T728 114T735 122T739 126T740 130T613 132H482L460 54Q440 -9 433 -23T415 -37Q408 -37 402 -31ZM502 325Q502 327 360 327H217L195 310Q173 291 120 256L111 250Q114 248 143 229T195 190L217 172H335L453 174L502 325ZM886 250Q885 251 865 263T831 286T802 310L780 327H544L535 299Q531 283 511 223L495 174L637 172H780L802 190Q843 225 877 243L886 250'], - - // RIGHTWARDS DOUBLE ARROW WITH STROKE - 0x21CF: [534,36,1000,55,943,'346 174Q348 176 378 249T411 325Q411 327 239 327H68Q55 342 55 347Q55 354 68 367H428L459 445Q487 509 494 521T510 534Q517 534 524 527T531 516Q531 515 502 438L471 367H677L666 381Q631 421 605 463T578 516Q578 522 582 523T599 525H615L619 512Q659 437 714 383T812 309T896 272T942 254Q943 246 938 243T911 232Q718 172 619 -13L615 -24L599 -26Q578 -26 578 -17Q578 -11 587 6T617 53T666 118L677 132H373L339 54Q323 12 313 -8T298 -32T288 -35Q280 -35 275 -29T269 -17Q269 -14 298 57T328 132H68Q55 145 55 152Q55 156 56 158T62 165T68 172H206Q346 172 346 174ZM848 249Q763 297 735 318L722 327H455L422 252L391 174Q391 172 557 172H722L735 181Q773 210 819 234L848 249'], - - // LEFTWARDS TRIPLE ARROW - 0x21DA: [611,111,1000,76,945,'944 54Q942 44 929 36H372Q372 34 377 26T395 -4T422 -58Q442 -109 442 -110T408 -111H374L370 -100Q282 124 87 243L76 250L87 257Q284 377 370 600L374 611H408Q442 611 442 610Q423 550 381 480Q380 478 379 475T376 471T374 468T372 465V464H929Q942 456 944 446Q944 442 943 439T941 434T938 430T935 428T931 426T928 424H344L336 414Q277 336 200 277L191 270H560Q929 270 933 268Q944 262 944 250Q944 237 933 232Q929 230 560 230H191L200 223Q279 162 336 86L344 76H928Q929 76 931 75T934 73T938 70T941 66T943 61T944 54'], - - // RIGHTWARDS TRIPLE ARROW - 0x21DB: [611,111,1000,55,923,'56 250Q56 260 68 270H808L799 277Q720 338 663 414L655 424H363Q71 424 68 426Q55 432 55 444T68 462Q71 464 349 464H627Q627 466 622 474T604 504T577 558Q557 609 557 610T591 611H626L629 600Q717 376 912 257L923 250L912 243Q715 123 629 -100L626 -111H591Q557 -111 557 -110Q576 -50 618 20Q619 22 620 25T623 29T625 32T626 35L627 36H349Q71 36 68 38Q55 44 55 56T68 74Q71 76 363 76H655L663 86Q722 164 799 223L808 230H438L68 231Q56 236 56 250'], - - // RIGHTWARDS SQUIGGLE ARROW - 0x21DD: [417,-83,1000,56,943,'76 230Q68 230 62 237T56 250Q56 257 63 264T91 291Q102 300 108 306L159 351Q168 356 177 351L218 316L303 239L353 195Q376 214 403 239L488 316L529 351Q538 356 546 351Q548 350 594 310L638 270H848L841 278Q813 309 792 344T763 396T755 416Q755 417 778 417H801Q817 367 856 323T943 250Q895 221 856 177T801 83H778Q755 83 755 84Q755 86 762 103T791 156T841 222L848 230H737Q625 230 622 232Q620 233 599 251T558 288L537 306Q537 305 451 228T362 149Q353 146 345 149Q341 150 255 227T169 306Q167 306 129 270Q123 265 115 257T102 245T93 237T84 232T76 230'], - - // LEFTWARDS DASHED ARROW - 0x21E0: [437,-64,1334,64,1251,'292 419Q292 400 261 347T211 275H306H364Q400 275 411 271T422 250T411 230T366 225H306H211Q214 222 232 197T271 136T292 82Q292 71 285 68T262 64H250H241Q221 64 216 67T205 83Q186 127 153 167T78 230Q64 238 64 250Q64 258 69 263T82 272T106 288T139 318Q162 342 177 365T198 402T209 425T223 436Q224 437 252 437H258Q292 437 292 419ZM501 237T501 250T515 270H819Q834 262 834 250T819 230H515Q501 237 501 250ZM918 237T918 250T932 270H1236Q1251 262 1251 250T1236 230H932Q918 237 918 250'], - - // RIGHTWARDS DASHED ARROW - 0x21E2: [437,-64,1334,84,1251,'84 237T84 250T98 270H402Q417 262 417 250T402 230H98Q84 237 84 250ZM501 237T501 250T515 270H819Q834 262 834 250T819 230H515Q501 237 501 250ZM1022 417Q1022 437 1055 437H1067Q1090 437 1097 434T1109 417Q1128 373 1161 333T1236 270Q1251 261 1251 250Q1251 241 1244 236T1216 217T1175 182Q1149 155 1133 128T1109 85T1097 66Q1093 64 1065 64H1053Q1031 64 1025 72T1027 100Q1036 124 1049 147T1073 185T1091 210T1101 223L1103 225H1008H950Q914 225 903 229T892 250T903 270T948 275H1008H1103L1101 277Q1100 280 1091 291T1067 325T1039 374Q1022 408 1022 417'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/Arrows.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/BoxDrawing.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/BoxDrawing.js deleted file mode 100644 index efb11889d5..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/BoxDrawing.js +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/BoxDrawing.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x250C: [694,-306,500,55,444,'76 306Q62 306 59 319T55 386V500V596Q55 664 57 676T68 692Q71 694 250 694Q428 694 432 692Q444 685 444 674Q444 665 432 656Q428 654 261 654H95V487Q95 355 95 336T90 312Q84 306 76 306'], - - // BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2510: [694,-306,500,55,445,'424 306Q418 306 413 310T406 318L404 321V654H238Q71 654 68 656Q55 662 55 674T68 692Q71 694 250 694H379Q432 694 438 688Q443 683 443 662T444 500T444 338T438 312Q432 306 424 306'], - - // BOX DRAWINGS LIGHT UP AND RIGHT - 0x2514: [366,22,500,55,444,'55 172V287Q55 341 58 353T76 366Q88 366 95 351V18H261Q428 18 432 16Q444 9 444 -2Q444 -11 432 -20Q428 -22 250 -22H120Q67 -22 61 -16Q56 -11 56 10T55 172'], - - // BOX DRAWINGS LIGHT UP AND LEFT - 0x2518: [366,22,500,55,444,'404 351Q410 366 424 366Q437 366 440 353T444 288V172V72Q444 8 443 -4T432 -20Q428 -22 250 -22Q71 -22 68 -20Q55 -14 55 -2T68 16Q71 18 238 18H404V351'], - - // BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT - 0x2571: [694,195,889,0,860,'19 -195Q13 -195 7 -188T0 -176Q0 -169 18 -151L822 683Q835 694 840 694T852 688T860 674Q860 667 810 614T460 252Q57 -167 44 -179Q27 -195 19 -195'], - - // BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT - 0x2572: [694,195,889,0,860,'0 675Q0 681 6 687T19 694Q27 694 44 678L460 247Q759 -62 809 -115T860 -175Q860 -183 852 -189T840 -195Q835 -195 822 -184L18 649Q0 667 0 675'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/BoxDrawing.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/CombDiacritMarks.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/CombDiacritMarks.js deleted file mode 100644 index 00f9faf0c0..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/CombDiacritMarks.js +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/CombDiacritMarks.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // COMBINING CIRCUMFLEX ACCENT - 0x302: [845,-561,0,-2347,13,'-2332 561Q-2336 563 -2340 577T-2346 604L-2347 618Q-2347 625 -2340 628T-2310 635Q-2302 636 -2297 637Q-2270 641 -1712 745Q-1185 845 -1168 845Q-1166 845 -581 739L5 630Q13 630 13 618Q7 565 -1 561Q-4 561 -584 654Q-716 675 -867 699T-1092 736T-1166 748Q-1168 748 -1240 737T-1466 700T-1750 654Q-2330 561 -2332 561'], - - // COMBINING TILDE - 0x303: [899,-628,0,-2332,-3,'-1529 788Q-1616 788 -1727 772T-1936 732T-2120 685T-2258 645T-2315 628Q-2322 628 -2322 632Q-2325 637 -2329 668T-2331 704Q-2331 713 -2297 732Q-2278 739 -2091 795Q-1711 898 -1507 898Q-1440 898 -1386 895Q-1324 887 -1277 872T-1146 819Q-1047 776 -977 758T-806 739Q-719 739 -608 755T-399 795T-215 842T-77 882T-20 899Q-13 899 -13 895Q-10 890 -6 860T-4 824Q-4 818 -37 795Q-60 787 -244 732Q-523 657 -735 632Q-771 629 -841 629Q-944 629 -1013 644T-1189 708Q-1285 751 -1356 769T-1529 788'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/CombDiacritMarks.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Dingbats.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Dingbats.js deleted file mode 100644 index 3abb3557d1..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Dingbats.js +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/Dingbats.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // CHECK MARK - 0x2713: [706,34,833,84,749,'84 231Q84 244 114 264T170 285Q176 285 183 274T224 205Q267 129 268 129Q271 141 279 163T318 250T389 378T502 523T662 673Q702 706 732 706H734Q749 706 749 695Q749 682 730 666T660 607T559 505Q387 299 328 29Q324 0 295 -17T245 -34H241Q234 -34 225 -21T185 46Q166 79 154 101Q84 223 84 231'], - - // MALTESE CROSS - 0x2720: [716,22,833,48,786,'195 702T195 706T201 716H632Q638 710 638 706T636 700T621 690Q436 581 427 374V357H430Q554 357 645 421Q682 447 711 483T755 542T770 567Q775 572 786 563V131Q777 125 774 125T762 139Q709 228 642 274T482 333Q452 337 430 337H427V320Q430 279 437 247T462 170T521 82T621 4Q630 -2 633 -4T637 -7T638 -12Q638 -16 632 -22H201Q195 -16 195 -12T197 -6T212 4Q397 113 406 320V337H403Q279 337 188 273Q151 247 122 211T78 152T63 127Q58 122 48 131V563Q54 569 59 569Q62 569 71 555Q124 466 191 420T351 361Q381 357 403 357H406V374Q403 415 396 447T371 525T312 613T212 690Q199 697 197 699'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/Dingbats.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/EnclosedAlphanum.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/EnclosedAlphanum.js deleted file mode 100644 index 574464c536..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/EnclosedAlphanum.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/EnclosedAlphanum.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // CIRCLED LATIN CAPITAL LETTER S - 0x24C8: [709,175,902,8,894,'451 -175Q328 -175 226 -115T66 47T8 267Q8 303 15 342T39 431T94 531T186 622Q239 663 307 686T424 709H440Q604 709 716 622Q757 592 788 555T838 482T869 414T886 350T892 301T894 267Q894 147 835 45T674 -116T451 -175ZM854 268Q854 375 802 467T657 614T450 670Q283 670 166 552T49 267Q49 99 167 -18T453 -136Q617 -136 735 -18T854 268ZM273 378Q273 430 309 474T409 527Q411 527 417 527T428 528Q498 528 549 484L567 505Q583 528 590 528H594Q600 528 606 522V350L600 344H586Q577 344 574 344T569 347T566 357Q542 491 432 491Q389 491 365 465T340 407Q340 391 344 378T358 356T377 340T400 328T421 321T443 316T459 313Q499 305 517 300T559 279T601 238Q629 195 629 148Q629 80 583 33T471 -14Q392 -14 330 30Q312 6 293 -13Q292 -14 285 -14Q279 -14 273 -8V77V138Q273 160 275 165T286 170H294H307Q313 164 313 158Q313 108 350 67T471 26Q512 26 537 54T562 119Q562 137 558 151T544 176T527 193T504 205T483 212T459 218T441 222Q391 232 368 241T318 273Q273 316 273 378'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/EnclosedAlphanum.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/GeneralPunctuation.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/GeneralPunctuation.js deleted file mode 100644 index 2395c71884..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/GeneralPunctuation.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/GeneralPunctuation.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // REVERSED PRIME - 0x2035: [560,-43,275,12,244,'12 501Q12 527 31 542T63 558Q73 560 77 560Q114 560 128 528Q133 518 188 293T244 61Q244 56 223 50T195 43Q192 43 190 45T102 263T14 486Q12 496 12 501'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/GeneralPunctuation.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/GeometricShapes.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/GeometricShapes.js deleted file mode 100644 index a9acbc3bee..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/GeometricShapes.js +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/GeometricShapes.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // BLACK SQUARE - 0x25A0: [689,0,778,55,722,'71 0Q59 4 55 16V346L56 676Q64 686 70 689H709Q719 681 722 674V15Q719 10 709 1L390 0H71'], - - // WHITE SQUARE - 0x25A1: [689,0,778,55,722,'71 0Q59 4 55 16V346L56 676Q64 686 70 689H709Q719 681 722 674V15Q719 10 709 1L390 0H71ZM682 40V649H95V40H682'], - - // BLACK UP-POINTING TRIANGLE - 0x25B2: [575,20,722,84,637,'99 -20Q84 -11 84 0Q84 5 148 145T278 424L342 563Q347 575 360 575Q368 575 375 570Q376 569 441 430T571 148T637 0Q637 -11 622 -20H99'], - - // WHITE UP-POINTING TRIANGLE - 0x25B3: [575,20,722,84,637,'99 -20Q84 -11 84 0Q84 5 148 145T278 424L342 563Q347 575 360 575Q368 575 375 570Q376 569 441 430T571 148T637 0Q637 -11 622 -20H99ZM476 260L360 509L248 266Q137 24 135 22Q135 20 360 20Q586 20 586 21L476 260'], - - // BLACK RIGHT-POINTING TRIANGLE - 0x25B6: [540,41,778,83,694,'83 523Q83 524 85 527T92 535T103 539Q107 539 389 406T680 268Q694 260 694 249Q694 239 687 234Q685 232 395 95L107 -41H101Q90 -40 83 -26V523'], - - // BLACK DOWN-POINTING TRIANGLE - 0x25BC: [576,19,722,84,637,'84 556Q84 567 99 576H622Q637 567 637 556Q637 551 572 409T441 127T375 -14Q368 -19 360 -19H358Q349 -19 342 -7T296 92Q249 193 211 275Q84 550 84 556'], - - // WHITE DOWN-POINTING TRIANGLE - 0x25BD: [576,19,722,84,637,'84 556Q84 567 99 576H622Q637 567 637 556Q637 551 572 409T441 127T375 -14Q368 -19 360 -19H358Q349 -19 342 -7T296 92Q249 193 211 275Q84 550 84 556ZM586 534Q586 536 361 536Q135 536 135 535L358 52L361 47L473 290Q584 532 586 534'], - - // BLACK LEFT-POINTING TRIANGLE - 0x25C0: [539,41,778,83,694,'694 -26Q686 -40 676 -41H670L382 95Q92 232 90 234Q83 239 83 249Q83 262 96 267Q101 270 379 401T665 537Q671 539 674 539Q686 539 694 524V-26'], - - // LOZENGE - 0x25CA: [716,132,667,56,611,'318 709Q325 716 332 716Q340 716 344 713T474 511Q611 298 611 292Q611 285 526 152Q494 103 474 72Q347 -128 344 -130Q340 -132 333 -132T322 -130Q319 -128 257 -31T131 169T60 278Q56 285 56 292Q56 298 60 305Q73 326 194 516T318 709ZM567 290T567 291T451 475T333 658L100 293Q100 288 215 108L333 -74Q334 -74 450 108'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/GeometricShapes.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/GreekAndCoptic.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/GreekAndCoptic.js deleted file mode 100644 index f481b7d5ae..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/GreekAndCoptic.js +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/GreekAndCoptic.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // GREEK SMALL LETTER DIGAMMA - 0x3DD: [605,85,778,55,719,'477 261Q477 257 473 256T455 253T417 251T348 250H235L155 -77L146 -82Q137 -85 109 -85Q55 -85 55 -77L139 261Q224 596 226 598Q229 603 239 603Q240 603 254 603T290 603T341 604T405 605T477 605Q656 603 687 602T719 596Q719 589 692 588T513 585H319L282 427L242 272Q242 270 351 270Q388 270 410 270T444 269T460 267T469 265T477 261'], - - // GREEK KAPPA SYMBOL - 0x3F0: [434,6,667,37,734,'228 325Q170 322 156 316T127 309Q108 309 104 314Q99 319 99 322T108 341Q125 376 171 400T268 425H271Q302 425 319 396Q328 377 328 358Q328 332 324 314Q311 270 286 221Q274 194 274 192H275Q339 234 484 325T639 421Q669 434 691 434T723 425T734 406Q734 394 719 381Q715 376 644 330L575 287L566 267Q543 233 526 176Q520 160 515 143T508 115T506 105Q506 103 533 103Q585 103 607 110T641 118Q670 118 670 107Q670 100 661 85Q643 50 598 27T504 3Q465 3 450 36Q441 51 441 73Q441 84 444 96Q452 146 484 205L497 236L324 125Q143 12 135 10Q103 -6 77 -6Q61 -6 49 2T37 21Q37 36 49 46T124 96L195 141L204 156Q219 179 243 248T264 323Q264 325 228 325'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/GreekAndCoptic.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Latin1Supplement.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Latin1Supplement.js deleted file mode 100644 index 9000725242..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Latin1Supplement.js +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/Latin1Supplement.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // YEN SIGN - 0xA5: [683,0,750,11,738,'515 0Q494 3 374 3Q256 3 235 0H224V46H257Q316 47 324 58Q327 62 327 137V213H133Q121 213 113 213T97 213T86 213T78 213T73 214T70 215T69 216T68 218T67 220Q64 225 66 231T73 240Q76 242 202 242H327V273L247 407H115Q81 407 75 408T67 414Q64 419 66 425T73 434Q76 436 153 436Q228 436 228 437Q227 440 173 530T115 623Q101 637 31 637H11V683H20Q66 681 153 681Q169 681 202 681T262 682L288 683H298V637H280Q230 636 230 621Q230 619 250 584Q255 576 264 561T286 526T305 494L340 437L403 436H467L513 514Q564 596 564 605Q564 608 560 616Q550 634 517 637H508V683H516Q531 680 633 680Q722 680 731 683H738V637H723Q644 632 617 595Q614 591 568 515T521 437T597 436T676 434Q681 432 683 426T682 414T671 409T589 407H503L422 273V242H547Q673 242 676 240Q681 238 683 232T682 220Q682 219 682 218T681 217T679 216T677 215T672 214T664 213T652 213T637 213T616 213H422V139V87Q422 64 425 58T441 49Q456 46 503 46H525V0H515ZM449 406Q449 407 403 407Q358 407 358 406L370 387Q381 368 392 350L404 331Q447 404 449 406'], - - // REGISTERED SIGN - 0xAE: [709,176,947,32,915,'915 266Q915 140 852 38T689 -120T474 -175Q312 -175 188 -71T38 190Q32 220 32 266V287Q32 345 57 416T129 545Q192 624 282 666T464 709Q513 709 522 708Q599 698 665 666T776 590T853 493T900 387T915 287V266ZM875 285Q875 339 853 399T789 517T676 616T519 668Q510 669 465 669Q380 669 299 630T155 514T77 336Q72 312 72 285V266V256Q72 123 163 11Q290 -135 474 -135Q614 -135 727 -46Q875 81 875 266V285ZM276 457Q275 458 274 460T272 463T270 465T267 467T264 469T258 471T252 472T243 473T232 474T218 474H204V514H335Q477 514 499 510Q560 502 610 467T661 375Q661 362 658 350T648 327T635 308T618 292T601 280T583 269T568 262T554 256L547 253Q548 252 556 247T570 237T586 223T602 202T614 174Q616 169 626 123T638 72Q652 23 683 23Q715 23 720 68Q721 78 724 81T740 84T756 82T760 70Q760 47 747 25T715 -7Q700 -14 673 -14Q672 -14 662 -14T643 -12T619 -7T593 2T568 16T547 37T534 67Q531 80 531 97Q531 103 531 116T532 136Q532 218 472 236Q466 238 413 239H360V148L361 58Q366 47 375 44T418 40H432V0H424Q409 3 318 3T212 0H204V40H218Q242 40 253 42T268 47T276 58V457ZM376 473Q365 471 363 464T360 430V366V276H416Q421 276 434 276T453 276T469 277T486 279T501 282T517 287T529 294T542 305Q561 324 561 375Q561 424 545 444T482 472Q478 473 427 474Q415 474 403 474T384 474L376 473'], - - // LATIN SMALL LETTER ETH - 0xF0: [749,21,556,42,509,'75 566V604Q75 624 79 629T102 635Q124 635 127 629T131 588L133 550L191 588L249 628L231 635Q176 654 124 657Q116 657 106 658L95 659Q94 661 94 687T95 715Q99 717 113 717Q195 717 282 679L309 668L331 681Q351 697 391 721Q428 748 435 748Q437 749 446 749Q470 749 473 746Q478 744 478 681V621Q466 615 456 615Q435 615 424 624L422 661V699L382 675L344 648Q353 639 366 630Q480 538 504 413Q509 393 509 333V313Q509 284 507 257T495 184T466 102T413 33T329 -16Q311 -21 275 -21Q226 -21 195 -10Q150 7 110 50T53 141Q42 179 42 227Q42 332 101 403T245 474Q282 474 314 461T359 436T380 415Q386 405 389 408Q389 426 378 475Q368 505 355 529T329 567T306 590T288 603L282 606L120 501Q116 500 102 500Q84 500 75 506V566ZM388 225Q388 376 309 410Q299 416 273 419Q216 419 191 390Q174 371 168 342T162 218Q162 112 184 79Q212 39 273 39Q312 39 342 62T380 121Q388 159 388 225'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/Latin1Supplement.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/LatinExtendedA.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/LatinExtendedA.js deleted file mode 100644 index d097ce0a9f..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/LatinExtendedA.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/LatinExtendedA.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // LATIN SMALL LETTER H WITH STROKE - 0x127: [695,13,540,42,562,'182 599Q182 611 174 615T133 619Q118 619 114 621T109 630Q109 636 114 656T122 681Q125 685 202 688Q272 695 286 695Q304 695 304 684Q304 682 295 644T282 597Q282 592 360 592H399Q430 592 445 587T460 563Q460 552 451 541L442 535H266L251 468Q247 453 243 436T236 409T233 399Q233 395 244 404Q295 441 357 441Q405 441 445 417T485 333Q485 284 449 178T412 58T426 44Q447 44 466 68Q485 87 500 130L509 152H531H543Q562 152 562 144Q562 128 546 93T494 23T415 -13Q385 -13 359 3T322 44Q318 52 318 77Q318 99 352 196T386 337Q386 386 346 386Q318 386 286 370Q267 361 245 338T211 292Q207 287 193 235T162 113T138 21Q128 7 122 4Q105 -12 83 -12Q66 -12 54 -2T42 26L166 530Q166 534 161 534T129 535Q127 535 122 535T112 534Q74 534 74 562Q74 570 77 576T84 585T96 589T109 591T124 592T138 592L182 595V599'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/LatinExtendedA.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/LetterlikeSymbols.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/LetterlikeSymbols.js deleted file mode 100644 index 20fb58b5b4..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/LetterlikeSymbols.js +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/LetterlikeSymbols.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // stix-/hbar - Planck's over 2pi - 0x210F: [695,13,540,42,562,'150 475Q147 475 118 466T82 457Q73 457 64 467T54 487Q54 490 55 492Q63 506 64 506Q67 512 118 526Q162 541 169 546Q173 559 175 575Q181 596 181 604Q181 613 166 617Q164 617 153 618T135 619Q119 619 114 621T109 630Q109 636 114 656T122 681Q125 685 202 688Q272 695 286 695Q304 695 304 684Q304 682 291 628L278 577L386 612Q466 635 476 635T492 627T499 607Q499 593 489 586Q485 583 373 546L262 512Q262 511 248 455T233 397T236 397T244 404Q295 441 357 441Q405 441 445 417T485 333Q485 284 449 178T412 58T426 44Q447 44 466 68Q485 87 500 130L509 152H531H543Q562 152 562 144Q562 128 546 93T494 23T415 -13Q385 -13 359 3T322 44Q318 52 318 77Q318 99 352 196T386 337Q386 386 346 386Q318 386 286 370Q267 361 245 338T211 292Q207 287 193 235T162 113T138 21Q128 7 122 4Q105 -12 83 -12Q66 -12 54 -2T42 26Q42 45 98 257L151 475H150'], - - // INVERTED OHM SIGN - 0x2127: [685,22,722,44,675,'126 584Q119 584 110 539T97 493Q95 490 73 490Q44 490 44 501Q44 515 62 590Q75 672 82 679Q84 684 177 684Q193 684 214 684T241 685Q265 685 271 682T277 664V648Q271 572 229 434T186 231Q186 173 203 132T247 70T302 42T360 33Q391 33 419 42T474 72T517 133T533 231Q533 297 491 437T442 648Q442 675 446 679Q448 684 542 684Q635 684 637 681Q640 678 657 594T675 501Q675 490 646 490Q624 490 622 493Q620 493 609 538T593 584Q591 585 585 585T569 586T551 588H513Q514 586 518 573T538 531T582 453Q647 340 660 277Q663 259 663 232Q663 194 657 177Q652 151 629 112T560 39Q495 -5 424 -19Q403 -22 360 -22Q318 -22 297 -19Q239 -8 193 18T120 74T80 131T62 177Q56 194 56 229Q56 281 74 328T137 453Q160 491 174 518T193 555T201 575T206 588H168Q160 587 150 587T134 586T126 584'], - - // TURNED CAPITAL F - 0x2132: [695,1,556,55,497,'457 681Q471 695 477 695Q485 695 497 681V12L484 -1H68Q55 14 55 19T68 39H457V328H215L211 335Q198 346 211 359L217 368H457V681'], - - // BET SYMBOL - 0x2136: [763,21,667,-22,687,'56 706V726Q56 763 76 763Q83 763 87 759T98 741Q108 726 116 721L127 717L340 715Q547 712 564 709Q575 705 587 692Q599 680 605 663L609 650V137H676Q687 124 687 115Q687 110 678 100T622 43L558 -21H-9Q-22 -6 -22 -1T-13 14T42 72L107 137H569V339Q569 541 567 546Q558 555 554 557L545 563H329Q118 566 101 569Q90 573 78 586Q54 610 54 661Q54 670 56 706'], - - // GIMEL SYMBOL - 0x2137: [764,43,444,-22,421,'56 750Q68 764 76 764Q88 764 97 743T125 717Q131 715 240 715T358 713Q421 691 421 640Q421 608 399 588T358 566Q353 566 352 565T351 557L356 526Q356 488 379 346T402 97Q400 21 385 -12Q366 -43 351 -43Q335 -43 329 -10Q316 40 316 64Q316 67 315 67Q313 67 269 26L222 -21H-9Q-22 -7 -22 -1Q-22 4 -14 14T42 73L107 137H311V564H211H164Q115 564 93 573T60 615Q56 630 56 690V750'], - - // DALET SYMBOL - 0x2138: [764,43,667,54,640,'62 757Q69 764 75 764Q87 764 97 741Q102 731 105 728T117 721L129 715H349Q569 715 580 710Q618 701 635 670Q640 661 640 639Q640 609 622 590Q617 583 604 575T580 566H573V553Q575 547 576 531T582 469T600 353Q624 205 624 104Q624 46 617 17T591 -32Q581 -43 573 -43Q550 -43 540 44Q535 73 533 319V564H322Q117 566 100 570Q90 573 77 586Q54 609 54 663Q54 689 55 706Q55 738 56 745T62 757'], - - // TURNED SANS-SERIF CAPITAL G - 0x2141: [705,23,639,37,577,'239 665Q194 665 154 653T90 629T66 617Q59 617 53 623T46 637Q46 652 66 659Q129 695 197 701Q218 705 248 705Q293 705 335 693Q371 684 435 644Q543 562 573 417Q577 393 577 341Q577 290 573 266Q531 83 384 10Q346 -9 315 -16T234 -23H206Q202 -23 183 -23T152 -21T120 -18T88 -10T63 3T44 24L37 35V297L50 310H235Q248 297 248 290Q248 285 235 270H77V103Q77 88 77 80T77 63T78 50T80 43T82 38T85 35T89 32T95 30Q126 20 206 17Q289 17 330 30Q407 55 460 120T533 275Q538 305 538 342Q538 486 452 575T239 665'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/LetterlikeSymbols.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Main.js deleted file mode 100644 index ea80fca669..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Main.js +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'] = { - directory: 'AMS/Regular', - family: 'MathJax_AMS', - id: 'MJAMS', - Ranges: [ - [0x80,0xFF,"Latin1Supplement"], - [0x100,0x17F,"LatinExtendedA"], - [0x2B0,0x2FF,"SpacingModLetters"], - [0x300,0x36F,"CombDiacritMarks"], - [0x370,0x3FF,"GreekAndCoptic"], - [0x2000,0x206F,"GeneralPunctuation"], - [0x2100,0x214F,"LetterlikeSymbols"], - [0x2190,0x21FF,"Arrows"], - [0x2200,0x22FF,"MathOperators"], - [0x2300,0x23FF,"MiscTechnical"], - [0x2460,0x24FF,"EnclosedAlphanum"], - [0x2500,0x257F,"BoxDrawing"], - [0x25A0,0x25FF,"GeometricShapes"], - [0x2600,0x26FF,"MiscSymbols"], - [0x2700,0x27BF,"Dingbats"], - [0x2980,0x29FF,"MiscMathSymbolsB"], - [0x2A00,0x2AFF,"SuppMathOperators"], - [0xE000,0xF8FF,"PUA"] - ], - - // SPACE - 0x20: [0,0,250,0,0,''], - - // LATIN CAPITAL LETTER A - 0x41: [701,1,722,17,703,'130 -1H63Q34 -1 26 2T17 17Q17 24 22 29T35 35Q49 35 64 44T88 66Q101 93 210 383Q331 693 335 697T346 701T357 697Q358 696 493 399Q621 104 633 83Q656 35 686 35Q693 35 698 30T703 17Q703 5 693 2T643 -1H541Q388 -1 386 1Q378 6 378 16Q378 24 383 29T397 35Q412 35 434 45T456 65Q456 93 428 170L419 197H197L195 179Q184 134 184 97Q184 82 186 71T190 55T198 45T205 39T214 36L219 35Q241 31 241 17Q241 5 233 2T196 -1H130ZM493 68Q493 51 481 35H619Q604 56 515 256Q486 321 468 361L348 637Q347 637 330 592T313 543Q313 538 358 436T448 219T493 68ZM404 235Q404 239 355 355T295 488L275 430Q241 348 208 232H306Q404 232 404 235ZM155 48Q151 55 148 88V117L135 86Q118 47 117 46L110 37L135 35H159Q157 41 155 48'], - - // LATIN CAPITAL LETTER B - 0x42: [683,1,667,11,620,'11 665Q11 672 22 683H213Q407 681 431 677Q582 649 582 515Q582 488 573 468Q554 413 484 372L474 366H475Q620 317 620 178Q620 115 568 69T420 6Q393 1 207 -1H22Q11 10 11 18Q11 35 51 35Q79 37 88 39T102 52Q107 70 107 341T102 630Q97 640 88 643T51 648H46Q11 648 11 665ZM142 341Q142 129 141 88T134 37Q133 36 133 35H240L233 48L229 61V623L233 635L240 648H133L138 639Q142 621 142 341ZM284 370Q365 378 391 411T417 508Q417 551 406 581T378 624T347 643T320 648Q298 648 278 635Q267 628 266 611T264 492V370H284ZM546 515Q546 551 531 577T494 617T454 635T422 641L411 643L420 630Q439 604 445 579T452 510V504Q452 481 451 467T441 430T415 383Q420 383 439 391T483 413T527 455T546 515ZM585 185Q585 221 570 249T534 294T490 320T453 334T436 337L435 336L440 330Q445 325 452 315T467 288T479 246T484 188Q484 145 474 110T454 62T442 48Q442 47 444 47Q450 47 470 54T517 75T564 119T585 185ZM449 184Q449 316 358 332Q355 332 335 333T302 335H264V199Q266 68 270 57Q275 50 289 43Q300 37 324 37Q449 37 449 184'], - - // LATIN CAPITAL LETTER C - 0x43: [702,19,722,39,684,'684 131Q684 125 672 109T633 71T573 29T489 -5T386 -19Q330 -19 276 -3T174 46T91 134T44 261Q39 283 39 341T44 421Q66 538 143 611T341 699Q344 699 364 700T395 701Q449 698 503 677T585 655Q603 655 611 662T620 678T625 694T639 702Q650 702 657 690V481L653 474Q640 467 628 472Q624 476 618 496T595 541Q562 587 507 625T390 663H381Q337 663 299 625Q212 547 212 336Q212 249 233 179Q274 30 405 30Q533 30 641 130Q658 147 666 147Q671 147 677 143T684 131ZM250 625Q264 643 261 643Q238 635 214 620T161 579T110 510T79 414Q74 384 74 341T79 268Q89 213 113 169T164 101T217 61T260 39L277 34Q270 41 264 48Q199 111 181 254Q178 281 178 344T181 434Q200 559 250 625ZM621 565V625Q617 623 613 623Q603 619 590 619H575L588 605Q608 583 610 579L621 565'], - - // LATIN CAPITAL LETTER D - 0x44: [683,1,722,16,688,'16 666Q16 675 28 683H193Q329 683 364 682T430 672Q534 650 600 585T686 423Q688 406 688 352Q688 274 673 226Q641 130 565 72T381 1Q368 -1 195 -1H28Q16 5 16 16Q16 35 53 35Q68 36 75 37T87 42T95 52Q98 61 98 341T95 630Q91 640 83 643T53 648Q16 648 16 666ZM237 646Q237 648 184 648H128Q128 647 133 632Q136 620 136 341Q136 64 133 50L128 35H237L230 48L226 61V343Q228 620 231 633Q232 636 237 646ZM264 61Q278 40 310 35Q363 35 401 55T461 112T496 193T513 295Q515 333 515 349Q515 411 504 459Q481 598 373 641Q351 648 321 648Q304 648 292 643T277 635T264 621V61ZM461 628Q462 627 471 616T489 594T509 559T529 509T544 441T550 352Q550 165 479 75L468 59Q474 61 484 65T522 87T573 128T618 195T650 290Q654 322 654 354Q654 418 638 464T581 552Q559 576 529 595T480 621L461 628'], - - // LATIN CAPITAL LETTER E - 0x45: [683,1,667,12,640,'12 666Q12 675 24 683H582Q590 680 593 672V588Q593 514 591 502T575 490Q567 490 563 495T555 517Q552 556 517 590Q486 623 445 634T340 648H282Q266 636 264 620T260 492V370H277Q329 375 358 391T404 439Q420 480 420 506Q420 529 436 529Q445 529 451 521Q455 517 455 361Q455 333 455 298T456 253Q456 217 453 207T437 197Q420 196 420 217Q420 240 406 270Q377 328 284 335H260V201Q261 174 261 134Q262 73 264 61T278 38Q281 36 282 35H331Q400 35 449 50Q571 93 602 179Q605 203 622 203Q629 203 634 197T640 183Q638 181 624 95T604 3L600 -1H24Q12 5 12 16Q12 35 51 35Q92 38 97 52Q102 60 102 341T97 632Q91 645 51 648Q12 648 12 666ZM137 341Q137 131 136 89T130 37Q129 36 129 35H235Q233 41 231 48L226 61V623L231 635L235 648H129Q132 641 133 638T135 603T137 517T137 341ZM557 603V648H504Q504 646 515 639Q527 634 542 619L557 603ZM420 317V397L406 383Q394 370 380 363L366 355Q373 350 382 346Q400 333 409 328L420 317ZM582 61L586 88Q585 88 582 83Q557 61 526 46L511 37L542 35H577Q577 36 578 39T580 49T582 61'], - - // LATIN CAPITAL LETTER F - 0x46: [683,1,611,12,584,'584 499Q569 490 566 490Q558 490 552 497T546 515Q546 535 533 559Q526 574 506 593T469 621Q415 648 326 648Q293 648 287 647T275 641Q264 630 263 617Q262 609 260 492V370L275 372Q323 376 350 392T393 441Q409 473 409 506Q409 529 427 529Q437 529 442 519Q444 511 444 362Q444 212 442 206Q436 197 426 197Q409 197 409 217Q409 265 375 299Q346 328 280 335H260V206Q260 70 262 63Q265 46 276 41T326 35Q362 35 366 28Q377 17 366 3L360 -1H24Q12 5 12 16Q12 35 51 35Q92 38 97 52Q102 60 102 341T97 632Q91 645 51 648Q12 648 12 666Q12 675 24 683H573Q576 678 584 670V499ZM137 341Q137 131 136 89T130 37Q129 36 129 35H182Q233 35 233 39Q226 54 225 92T224 346L226 623L231 635L235 648H129Q132 641 133 638T135 603T137 517T137 341ZM549 603V648H495L506 641Q531 621 533 619L549 603ZM409 317V395L400 386Q390 376 375 366L357 355L373 346Q394 331 397 328L409 317'], - - // LATIN CAPITAL LETTER G - 0x47: [702,19,778,39,749,'737 285Q749 277 749 268Q749 260 744 255T730 250Q695 250 677 217Q666 195 666 119Q666 52 664 50Q656 36 555 3Q483 -16 415 -19Q364 -19 348 -17Q226 -3 146 70T44 261Q39 283 39 341T44 421Q66 538 143 611T341 699Q344 699 364 700T395 701Q449 698 503 677T585 655Q603 655 611 662T620 678T625 694T639 702Q650 702 657 690V481L653 474Q640 467 628 472Q624 476 618 496T595 541Q562 587 507 625T390 663H381Q337 663 299 625Q213 547 213 337Q213 75 341 23Q357 19 397 19Q440 19 462 22T492 30T513 45V119Q513 184 506 203Q491 237 435 250Q421 250 415 257Q404 267 415 281L421 285H737ZM250 43Q250 45 243 55T225 87T203 139T185 224T177 343V361Q184 533 250 625Q264 643 261 643Q238 635 214 620T161 579T110 510T79 414Q74 384 74 341T79 268Q106 117 230 52L250 43ZM621 565V625Q617 623 613 623Q603 619 590 619H575L588 605Q608 583 610 579L621 565ZM655 250H517L524 241Q548 213 548 149V114V39Q549 39 562 44T592 55T615 63L630 70V134Q632 190 634 204T648 237Q655 245 655 250'], - - // LATIN CAPITAL LETTER H - 0x48: [683,1,778,14,762,'14 666Q14 675 26 683H344L351 679Q361 665 351 655Q344 648 317 648Q287 645 282 641Q270 637 269 623T266 497V370H511V497Q511 519 510 553Q509 615 507 626T496 641H495Q489 645 459 648Q420 648 420 665Q420 672 426 679L433 683H751Q762 676 762 666Q762 648 724 648Q684 645 677 632Q675 626 675 341Q675 57 677 52Q684 38 724 35Q762 35 762 16Q762 6 751 -1H433L426 3Q420 10 420 17Q420 35 459 35Q501 38 506 52Q511 64 511 190V323H266V190Q266 60 271 52Q276 38 317 35Q342 35 351 28Q360 17 351 3L344 -1H26Q14 5 14 16Q14 35 53 35Q94 38 99 52Q104 60 104 341T99 632Q93 645 53 648Q14 648 14 666ZM233 341V553Q233 635 239 648H131Q134 641 135 638T137 603T139 517T139 341Q139 131 138 89T132 37Q131 36 131 35H239Q233 47 233 129V341ZM639 341V489Q639 548 639 576T640 620T642 639T646 648H537L542 639Q546 625 546 341Q546 130 545 88T538 37Q537 36 537 35H646Q643 41 643 42T641 55T639 84T639 140V341'], - - // LATIN CAPITAL LETTER I - 0x49: [683,1,389,20,369,'20 666Q20 676 31 683H358Q369 676 369 666Q369 648 331 648Q288 645 282 632Q278 626 278 341Q278 57 282 50Q286 42 295 40T331 35Q369 35 369 16Q369 6 358 -1H31Q20 4 20 16Q20 35 58 35Q84 37 93 39T107 50Q113 60 113 341Q113 623 107 632Q101 645 58 648Q20 648 20 666ZM249 35Q246 40 246 41T244 54T242 83T242 139V341Q242 632 244 639L249 648H140Q146 634 147 596T149 341Q149 124 148 86T140 35H249'], - - // LATIN CAPITAL LETTER J - 0x4A: [683,77,500,6,478,'79 103Q108 103 129 83T151 38Q151 9 130 -15Q116 -34 130 -37Q133 -39 157 -39Q208 -39 219 -8L226 3V305Q226 612 224 621Q220 636 211 641T166 647Q137 647 128 654Q119 665 128 679L135 683H466Q478 677 478 666Q478 647 439 647Q399 644 393 632Q388 620 388 347Q386 69 384 59Q364 -6 316 -39T184 -77H172Q102 -77 56 -48T6 30Q6 62 26 82T79 103ZM353 354Q353 556 354 596T361 645Q362 646 362 647H253Q257 639 258 628T261 547T262 312V-4L255 -17Q248 -29 250 -29Q253 -29 258 -28T277 -20T302 -5T327 22T348 65Q350 74 353 354ZM115 36Q115 47 105 57T79 67Q73 67 67 66T52 56T44 34Q44 9 62 -8Q66 -11 71 -15T81 -22T86 -24L90 -13Q100 3 102 5Q115 22 115 36'], - - // LATIN CAPITAL LETTER K - 0x4B: [683,1,778,22,768,'22 666Q22 676 33 683H351L358 679Q368 665 358 655Q351 648 324 648Q288 645 280 637Q275 631 274 605T273 477L275 343L382 446Q473 530 492 553T512 599Q512 617 502 631T475 648Q455 651 455 666Q455 677 465 680T510 683H593H720Q732 676 732 666Q732 659 727 654T713 648Q670 648 589 581Q567 562 490 489T413 415Q413 413 554 245T711 61Q737 35 751 35Q758 35 763 29T768 15Q768 6 758 -1H624Q491 -1 486 3Q480 10 480 17Q480 25 487 30T506 35Q518 36 520 38T520 48L400 195L302 310L286 297L273 283V170Q275 65 277 57Q280 41 300 38Q302 37 324 35Q349 35 358 28Q367 17 358 3L351 -1H33Q22 4 22 16Q22 35 60 35Q101 38 106 52Q111 60 111 341T106 632Q100 645 60 648Q22 648 22 666ZM240 341V553Q240 635 246 648H138Q141 641 142 638T144 603T146 517T146 341Q146 131 145 89T139 37Q138 36 138 35H246Q240 47 240 129V341ZM595 632L615 648H535L542 637Q542 636 544 625T549 610V595L562 606Q565 608 577 618T595 632ZM524 226L386 388Q386 389 378 382T358 361Q330 338 330 333Q330 332 330 332L331 330L533 90Q558 55 558 41V35H684L671 50Q667 54 524 226'], - - // LATIN CAPITAL LETTER L - 0x4C: [683,1,667,12,640,'12 666Q12 675 24 683H333L340 679Q350 665 340 655Q333 648 309 648Q287 646 279 643T266 630Q264 623 264 346Q264 68 266 57Q274 40 284 35H340Q413 37 460 55Q514 78 553 117T602 197Q605 221 622 221Q629 221 634 215T640 201Q638 194 625 105T611 12Q611 6 600 -1H24Q12 5 12 16Q12 35 51 35Q92 38 97 52Q102 60 102 341T97 632Q91 645 51 648Q12 648 12 666ZM137 341Q137 131 136 89T130 37Q129 36 129 35H237Q235 41 233 48L229 61L226 339Q226 621 229 628Q230 630 231 636T233 643V648H129Q132 641 133 638T135 603T137 517T137 341ZM580 48Q580 59 583 74T586 97Q586 98 585 97T579 92T571 86Q549 64 513 43L500 35H577L580 48'], - - // LATIN CAPITAL LETTER M - 0x4D: [683,1,944,17,926,'18 666Q18 677 27 680T73 683H146Q261 683 266 679L465 215Q469 215 566 443Q663 676 668 681Q673 683 790 683H908L915 679Q924 664 915 655Q912 648 897 648Q851 639 835 606L833 346Q833 86 835 79Q838 69 849 58T873 41Q877 40 887 38T901 35Q926 35 926 16Q926 6 915 -1H604L597 3Q588 19 597 28Q600 35 615 35Q660 42 673 68L679 79V339Q679 409 679 443T679 520T679 580T677 597Q646 521 584 375T473 117T424 3Q416 -1 410 -1T401 1Q399 3 273 301L148 599L146 343Q146 86 148 79Q152 69 163 58T186 41Q190 40 200 38T215 35Q226 35 235 28Q244 17 235 3L228 -1H28Q17 4 17 17Q17 35 39 35Q84 42 97 68L104 79V639L88 641Q72 644 53 648Q34 648 26 651T18 666ZM457 166Q451 169 449 171T435 198T404 268T344 412L244 648H157L166 637Q169 633 293 346L413 66Q424 88 435 117L457 166ZM817 646Q817 648 766 648H715V72L708 57Q701 45 697 41L695 37Q695 35 757 35H819L813 46Q802 61 800 76Q797 105 797 346L799 612L804 626Q812 638 815 641L817 646ZM124 42Q119 42 119 38Q119 35 128 35Q132 35 132 36Q125 42 124 42'], - - // LATIN CAPITAL LETTER N - 0x4E: [683,20,722,20,702,'20 664Q20 666 31 683H142Q256 683 258 681Q259 680 279 653T342 572T422 468L582 259V425Q582 451 582 490T583 541Q583 611 573 628T522 648Q500 648 493 654Q484 665 493 679L500 683H691Q702 676 702 666Q702 657 698 652Q688 648 680 648Q633 648 627 612Q624 601 624 294V-8Q616 -20 607 -20Q601 -20 596 -15Q593 -13 371 270L156 548L153 319Q153 284 153 234T152 167Q152 103 156 78T172 44T213 34Q236 34 242 28Q253 17 242 3L236 -1H36Q24 6 24 16Q24 34 56 34Q58 35 69 36T86 40T100 50T109 72Q111 83 111 345V603L96 619Q72 643 44 648Q20 648 20 664ZM413 419L240 648H120L136 628Q137 626 361 341T587 54L589 68Q589 78 589 121V192L413 419'], - - // LATIN CAPITAL LETTER O - 0x4F: [701,19,778,34,742,'131 601Q180 652 249 676T387 701Q485 701 562 661Q628 629 671 575T731 448Q742 410 742 341T731 234Q707 140 646 81Q549 -19 389 -19Q228 -19 131 81Q57 155 37 274Q34 292 34 341Q34 392 37 410Q58 528 131 601ZM568 341Q568 613 437 659Q406 664 395 665Q329 665 286 625Q232 571 213 439Q210 408 210 341Q210 275 213 245Q232 111 286 57Q309 37 342 23Q357 19 389 19Q420 19 437 23Q469 38 491 57Q568 132 568 341ZM174 341Q174 403 177 441T197 535T249 639Q246 639 224 627T193 608Q189 606 183 601T169 589T155 577Q69 488 69 344Q69 133 231 52Q244 45 246 45Q248 45 246 48Q231 69 222 85T200 141T177 239Q174 269 174 341ZM708 341Q708 415 684 475T635 563T582 610Q578 612 565 619T546 630Q533 637 531 637Q530 637 530 636V635L531 634Q562 591 577 543Q602 471 602 341V316Q602 264 599 230T580 144T531 48L530 47V46Q530 45 531 45Q533 45 547 52T583 75T622 105Q708 195 708 341'], - - // LATIN CAPITAL LETTER P - 0x50: [683,1,611,16,597,'16 666Q16 675 28 683H195Q334 683 370 682T437 672Q511 657 554 611T597 495Q597 343 404 309Q402 308 401 308Q381 303 319 303H261V181Q261 157 262 120Q262 60 267 50T304 36Q310 35 313 35Q352 35 352 17Q352 10 346 3L339 -1H28Q16 5 16 16Q16 35 53 35Q68 36 75 37T87 42T95 52Q98 61 98 341T95 630Q91 640 83 643T53 648Q16 648 16 666ZM235 35Q228 46 227 84Q226 129 226 337V621L230 635L237 648H128Q128 647 133 632Q136 620 136 341Q136 64 133 50L128 35H235ZM301 341H313Q339 341 354 344T389 362T417 410T426 498Q426 586 401 616T322 647Q301 647 293 643Q271 637 264 621Q261 617 261 479V341H301ZM429 350Q431 350 443 353T476 367T515 391T548 432T562 490Q562 550 524 592Q507 607 484 619Q481 621 448 635L433 639L439 621Q462 578 462 506Q462 448 454 413T437 366T428 350H429'], - - // LATIN CAPITAL LETTER Q - 0x51: [701,181,778,34,742,'480 -10Q480 -13 486 -24T507 -50T541 -80T588 -104T648 -114Q666 -114 688 -110T714 -106Q724 -106 728 -114T729 -130Q723 -145 663 -163T548 -181Q503 -181 463 -169T395 -139T343 -97T307 -56T284 -19L280 -3L262 1Q188 24 131 81Q57 155 37 275Q34 292 34 342T37 410Q58 528 131 601Q179 652 248 676T388 701Q485 701 562 661Q698 595 731 448Q742 410 742 341T731 235Q707 141 646 81Q616 50 575 27T493 -5L480 -10ZM568 342Q568 613 437 659L395 666Q329 666 286 626Q232 570 213 439Q210 408 210 342T213 246Q231 113 286 57Q309 37 342 23Q357 19 389 19Q420 19 437 23Q469 38 491 57Q568 134 568 342ZM174 341V354Q174 393 175 419T183 484T205 561T246 635L249 639Q246 639 224 627T193 608Q189 606 183 601T169 589T155 577Q69 491 69 344Q69 133 231 52Q247 42 247 46Q247 46 246 48Q231 69 222 85T200 141T177 239Q174 269 174 341ZM708 341Q708 410 689 467T640 556T588 606T546 630Q532 638 531 638Q530 638 531 635Q563 590 577 543Q602 472 602 341V316Q602 264 599 230T580 144T531 48Q529 44 532 45T546 52Q575 68 596 84T642 128T683 200T706 299Q708 327 708 341ZM391 -17H333Q329 -15 326 -15Q324 -15 324 -17Q324 -21 362 -68Q424 -130 506 -143Q518 -144 544 -144Q569 -144 577 -143L589 -141L575 -139Q544 -127 509 -101T453 -37L442 -19L391 -17'], - - // LATIN CAPITAL LETTER R - 0x52: [683,1,722,16,705,'17 665Q17 672 28 683H221Q415 681 439 677Q461 673 481 667T516 654T544 639T566 623T584 607T597 592T607 578T614 565T618 554L621 548Q626 530 626 497Q626 447 613 419Q578 348 473 326L455 321Q462 310 473 292T517 226T578 141T637 72T686 35Q705 30 705 16Q705 7 693 -1H510Q503 6 404 159L306 310H268V183Q270 67 271 59Q274 42 291 38Q295 37 319 35Q344 35 353 28Q362 17 353 3L346 -1H28Q16 5 16 16Q16 35 55 35Q96 38 101 52Q106 60 106 341T101 632Q95 645 55 648Q17 648 17 665ZM241 35Q238 42 237 45T235 78T233 163T233 337V621L237 635L244 648H133Q136 641 137 638T139 603T141 517T141 341Q141 131 140 89T134 37Q133 36 133 35H241ZM457 496Q457 540 449 570T425 615T400 634T377 643Q374 643 339 648Q300 648 281 635Q271 628 270 610T268 481V346H284Q327 346 375 352Q421 364 439 392T457 496ZM492 537T492 496T488 427T478 389T469 371T464 361Q464 360 465 360Q469 360 497 370Q593 400 593 495Q593 592 477 630L457 637L461 626Q474 611 488 561Q492 537 492 496ZM464 243Q411 317 410 317Q404 317 401 315Q384 315 370 312H346L526 35H619L606 50Q553 109 464 243'], - - // LATIN CAPITAL LETTER S - 0x53: [702,12,556,28,528,'54 238Q72 238 72 212Q72 174 106 121Q113 110 132 90T166 59Q221 23 264 23Q315 23 348 41Q368 50 384 79Q393 102 393 129Q393 181 356 219T221 299Q120 343 74 390T28 501Q28 561 55 610Q98 682 212 699Q214 699 231 700T261 701Q309 698 340 687T408 675Q431 678 445 690T465 702Q474 702 481 690V497L477 490Q464 481 450 490Q446 500 446 501Q446 546 386 606T260 666Q215 666 182 639T148 565Q148 528 186 496T319 428Q352 414 370 405T418 379T468 338T506 284Q528 239 528 191Q528 102 456 46T266 -10Q211 -10 176 2T110 15Q86 9 73 -1T53 -12Q44 -12 37 -1V112V182Q37 214 40 226T54 238ZM446 619Q446 648 444 648Q439 646 435 644Q425 644 415 639H404L417 624Q435 606 439 601L446 592V619ZM124 619L128 635Q126 635 108 617Q64 576 64 502Q64 489 65 479T76 449T102 414T150 376T228 335Q335 291 381 245T427 128Q427 94 419 75L415 61Q421 61 448 88Q490 127 490 190Q490 233 475 264Q456 299 430 321Q402 349 369 367T287 404T204 441Q138 481 119 526Q113 544 113 565Q113 596 124 619ZM75 43Q76 43 90 46T110 50H119L106 64L74 101Q72 101 72 72T75 43'], - - // LATIN CAPITAL LETTER T - 0x54: [683,1,667,33,635,'33 672Q36 680 44 683H624Q632 680 635 672V490L631 483Q621 479 617 479Q611 479 606 485T600 499Q600 525 584 552Q577 567 558 588T524 617Q479 642 426 646L415 648V355Q415 62 422 52Q425 42 434 40T473 35Q500 35 509 28Q518 17 509 3L502 -1H166L160 3Q149 17 160 28Q167 35 195 35Q224 37 234 39T249 52Q253 66 253 355V648L242 646Q192 642 144 617Q129 609 110 588T84 552Q69 527 69 499Q69 490 64 484T50 478Q39 478 33 490V672ZM113 639L126 648H69V597L84 612Q93 623 113 639ZM389 35Q382 46 381 86Q380 134 380 350V648H289V350Q289 199 288 131T286 53T280 35H389ZM600 597V648H542L555 639Q575 623 584 612L600 597'], - - // LATIN CAPITAL LETTER U - 0x55: [683,19,722,16,709,'16 666Q16 677 28 683H341L348 679Q359 665 348 654Q342 648 315 648Q270 644 266 632Q262 627 262 598T261 399Q261 372 261 325T260 260Q260 149 274 99T339 30Q355 25 393 25Q430 25 457 33T494 49T519 72Q562 115 575 205Q576 219 576 379Q576 538 575 550Q568 597 550 622T506 648Q498 648 493 654T487 667T499 683H697Q709 675 709 667T704 654T690 648Q653 648 633 597Q624 573 622 546T619 377Q617 193 613 174Q596 95 544 41Q477 -19 355 -19H344Q275 -16 226 5T153 57T120 110T106 154Q101 172 99 399Q99 618 95 632Q88 644 53 648Q16 648 16 666ZM228 639L233 648H128Q128 647 133 632Q135 621 135 412Q135 197 137 185Q148 115 181 79Q209 51 235 41Q242 36 258 31T277 25Q276 27 268 38T254 59T241 92T228 145Q226 161 226 399Q226 632 228 639ZM604 621Q606 626 619 648H577L586 634Q587 632 591 625T595 614L597 608L604 621'], - - // LATIN CAPITAL LETTER V - 0x56: [683,20,722,0,719,'316 683Q327 676 327 666Q327 648 302 648Q272 642 258 628Q249 621 249 608Q252 589 263 556T289 485T322 406T357 325T388 256T411 205L420 185Q423 185 473 317Q547 497 547 590Q547 621 541 632T516 648Q501 648 498 654Q488 664 498 679L504 683H607H660Q695 683 707 680T719 667Q719 660 714 654T700 648Q678 648 658 628L642 614L513 301Q484 231 449 148T397 25T380 -15Q373 -20 368 -20Q361 -20 358 -15Q354 -13 287 135T149 438T67 610Q45 648 18 648Q11 648 6 653T0 666Q0 677 9 680T59 683H164H316ZM216 614Q216 620 216 622T216 628T216 633T217 635T218 638T219 640T221 644T224 648H84L96 632Q118 592 236 330L367 43L387 88L404 132L380 185Q250 468 222 568Q216 590 216 614ZM576 645Q584 628 584 597L587 568L598 597Q609 624 618 637L624 648H600Q576 648 576 645'], - - // LATIN CAPITAL LETTER W - 0x57: [683,19,1000,5,994,'785 664Q785 670 795 683H982Q994 675 994 665Q994 650 975 648Q953 643 939 619Q931 593 823 292T710 -15Q706 -19 699 -19T688 -15Q682 -6 639 107T555 328T513 437Q513 438 500 409T462 325T413 212Q315 -14 310 -17Q308 -19 302 -19T288 -15L57 619Q45 643 24 648Q5 650 5 665Q5 677 17 683H146H200Q256 683 270 681T285 666Q285 659 280 654T268 648Q253 648 239 634Q230 630 230 619Q230 598 264 481L362 192Q363 193 428 341T493 492Q493 496 473 546T446 608Q426 648 399 648Q392 648 387 653T382 667Q382 678 393 683H679Q690 670 690 665Q690 662 685 655T673 648Q653 648 633 632L622 625V610Q626 576 657 479T719 300T751 218Q754 218 779 294Q847 492 847 581Q847 648 802 648Q796 648 791 652T785 664ZM194 623Q194 630 199 648H82L90 632Q99 616 199 332L302 50Q303 50 322 94T342 141Q342 142 305 245T231 467T194 623ZM585 620Q585 634 593 648H530Q466 648 466 645Q479 632 595 323L699 54Q701 56 718 103T735 154L702 245Q585 562 585 620ZM884 572L890 587Q896 602 903 620T915 645Q915 648 893 648H868L875 634Q883 598 883 576Q883 572 884 572'], - - // LATIN CAPITAL LETTER X - 0x58: [683,1,722,16,705,'22 666Q22 677 31 680T80 683H184H335Q346 675 346 667Q346 660 341 655Q335 648 315 648Q280 644 273 637Q273 630 300 583T356 492T386 448Q430 504 450 535T474 577T478 601Q478 620 469 634T444 648Q428 648 428 666Q428 678 436 680T488 683H559H630Q673 683 681 681T690 666Q690 648 673 648Q652 648 619 637Q571 615 517 550Q490 517 450 464T410 408Q415 399 501 273T617 106Q648 61 661 48T688 35Q705 35 705 16Q705 5 695 -1H539Q384 -1 379 3Q373 10 373 17Q373 27 380 31T408 35Q459 40 459 49Q459 59 418 129T335 259Q334 260 332 260Q328 260 273 197Q210 127 208 117Q199 104 199 82Q199 57 213 46T239 35Q247 35 252 29T257 15Q257 10 256 7T253 3T248 0L246 -1H28Q16 7 16 15T21 29T35 35Q61 35 117 88Q289 279 304 297Q307 303 255 377Q117 586 79 626Q60 648 39 648Q32 648 27 653T22 666ZM237 639V648H173Q113 647 113 646Q113 642 137 612Q186 546 302 373T453 139Q497 63 497 43Q497 39 495 35H559Q622 35 622 37Q622 38 583 94T486 233T373 399T277 552T237 639ZM553 637L566 648H504L508 637Q510 630 515 615V603L528 615Q529 616 539 625T553 637ZM170 46Q169 49 167 58T164 70V83L137 59L113 35H175Q175 38 170 46'], - - // LATIN CAPITAL LETTER Y - 0x59: [683,1,722,16,704,'16 659T16 667T28 683H295Q306 676 306 666Q306 648 284 648Q258 648 255 641Q255 634 265 615T339 479Q418 339 421 339L455 394Q489 448 523 502L557 557Q560 566 560 582Q560 637 504 648Q489 648 486 655Q475 664 486 679L493 683H693Q704 675 704 667Q704 650 684 648Q672 645 653 623Q633 604 614 576T517 426L439 301V183Q442 62 444 59Q449 35 504 35Q521 35 528 30Q538 16 528 3L521 -1H195L188 3Q178 16 188 30Q195 35 213 35Q266 35 273 59Q274 61 277 163V261L75 621Q64 638 58 643T37 648Q28 648 22 653ZM219 637V648H101Q110 634 215 446L313 270V166Q310 59 306 48L301 35H415L410 48Q404 65 404 175V290L317 443Q230 601 226 612Q219 625 219 637ZM608 630L624 648H575Q584 632 588 623L595 610L608 630'], - - // LATIN CAPITAL LETTER Z - 0x5A: [683,1,667,29,635,'39 -1Q29 9 29 12Q29 23 60 77T219 337L410 648H364Q261 648 210 628Q168 612 142 588T109 545T97 509T88 490Q85 489 80 489Q72 489 61 503L70 588Q72 607 75 628T79 662T81 675Q84 677 88 681Q90 683 341 683H592Q604 673 604 666Q604 662 412 348L221 37Q221 35 301 35Q406 35 446 48Q504 68 543 111T597 212Q602 239 617 239Q624 239 629 234T635 223Q635 215 621 113T604 8L597 1Q595 -1 317 -1H39ZM148 637L166 648H112V632Q111 629 110 622T108 612Q108 608 110 608T116 612T129 623T148 637ZM552 646Q552 648 504 648Q452 648 450 643Q448 639 266 343T77 37Q77 35 128 35H179L366 339L552 646ZM572 35Q581 89 581 97L561 77Q542 59 526 48L508 37L539 35H572'], - - // LATIN SMALL LETTER K - 0x6B: [683,1,556,17,534,'519 443Q519 426 497 426Q458 422 361 335Q328 308 315 295Q307 289 310 286T383 193T466 88Q507 35 517 35Q534 35 534 16Q534 5 524 -1H304L297 3Q288 19 297 28Q300 35 317 35Q320 36 324 36T330 37T333 39Q334 39 334 40Q334 47 304 86T244 162L215 199Q212 202 206 199Q201 195 201 137V121Q201 35 230 35Q238 35 243 29T248 15Q248 4 237 -1H28L21 3Q17 13 17 17Q17 24 22 29T35 35Q55 35 61 70Q63 78 63 341T61 612Q55 648 35 648Q27 648 22 654T17 668Q17 678 26 682Q27 683 28 683H108H147Q156 683 162 683T174 683T182 683T187 682T191 681T194 680T197 678T201 675V461L204 246L244 281Q254 291 272 307Q317 349 326 360T339 386Q340 390 340 398Q340 426 321 426Q314 426 309 431T304 445Q304 456 315 461H508Q519 448 519 443ZM166 359V648H126Q89 648 89 645Q89 644 89 644T90 643T91 640T93 634T95 626Q99 612 99 341T95 57Q94 53 93 49T91 43T90 39L89 37Q89 35 133 35Q176 35 176 37Q175 38 175 39Q175 42 170 57Q166 70 166 359ZM410 423Q412 425 407 426Q404 426 393 426Q373 426 373 423Q374 422 375 417T377 410Q377 399 379 399Q406 419 410 423ZM460 37Q460 41 368 152L281 263Q280 263 259 246L239 228Q298 157 355 79Q370 61 370 41V35H417Q460 35 460 37'] -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MathOperators.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MathOperators.js deleted file mode 100644 index 4c14b0fd24..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MathOperators.js +++ /dev/null @@ -1,359 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/MathOperators.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // COMPLEMENT - 0x2201: [846,22,500,56,444,'404 269Q412 269 418 267T428 261T435 253T441 245L444 240V172Q444 103 443 96Q440 81 431 65T403 27T344 -7T250 -21T156 -8T97 27T69 65T58 96Q56 103 56 413Q56 722 58 729Q74 822 215 845Q221 846 229 846H243Q282 846 290 845Q422 826 443 729Q444 722 444 653V586L442 583Q441 580 440 578T436 573T430 567T423 562T415 558T404 556Q377 556 367 583Q364 590 364 654V719Q363 721 360 726T355 733Q326 766 250 766H249Q235 766 219 765T174 752T137 719V107Q145 83 178 71T251 58H254Q340 58 364 107V172Q364 176 364 187T363 204Q363 269 404 269'], - - // THERE DOES NOT EXIST - 0x2204: [860,166,556,55,497,'55 676Q55 688 66 694H199L333 696L351 772Q364 827 370 843T386 860Q393 860 399 854T406 841Q406 836 391 765L375 696Q375 694 431 694H484Q491 688 497 681V12L493 5L486 1L353 -1H219L202 -79Q184 -153 180 -159Q175 -166 165 -166Q146 -166 146 -148Q146 -141 161 -76T177 -4Q177 -1 122 -1H68Q55 12 55 20T66 39H126L186 41L219 181Q226 215 234 251T246 305T251 325Q251 328 166 328H79Q68 345 68 347Q68 352 75 359L82 368H262L291 505Q298 539 306 575T319 630T324 650V654H68Q55 669 55 676ZM457 368V654H411Q366 654 366 652Q365 651 361 634T349 580T333 514Q303 373 302 372V368H457ZM457 39V328H375Q293 328 293 325Q292 322 260 183T228 41T344 39H457'], - - // EMPTY SET - 0x2205: [587,3,778,55,720,'624 470Q624 468 639 446T668 382T683 291Q683 181 612 99T437 -1Q425 -2 387 -2T337 -1Q245 18 193 70L179 81L131 39Q96 8 89 3T75 -3Q55 -3 55 17Q55 24 61 30T111 73Q154 113 151 113Q151 114 140 130T115 177T95 241Q94 253 94 291T95 341Q112 431 173 495Q265 587 385 587Q410 587 437 581Q522 571 582 513L595 501L642 541Q689 586 695 586Q696 586 697 586T699 587Q706 587 713 583T720 568Q720 560 711 551T664 510Q651 499 642 490T628 475T624 470ZM564 477Q517 522 448 539Q428 546 375 546Q290 546 229 492T144 370Q133 332 133 279Q136 228 151 195Q157 179 168 160T184 141Q186 141 375 307T564 477ZM642 290Q642 318 637 343T625 386T611 416T598 436T593 444Q590 444 402 277T213 108Q213 104 231 89T293 55T392 37Q495 37 568 111T642 290'], - - // SMALL CONTAINS AS MEMBER - 0x220D: [440,1,429,102,456,'154 -1Q122 -1 112 3T102 26Q102 63 158 63H178Q192 64 206 65T228 66T240 68Q301 85 324 146L329 157H244Q158 157 153 161Q149 162 145 169T140 183Q140 201 158 215L167 221H256L344 223L349 237Q352 262 352 287Q352 308 351 315Q341 352 315 368T256 385Q231 385 206 376T166 356T149 346Q143 346 138 364T132 388Q132 396 147 406Q198 440 252 440Q291 440 318 435Q421 404 451 301Q456 288 456 248V234Q456 151 391 86Q330 25 240 3Q212 -1 154 -1'], - - // MINUS SIGN - 0x2212: [270,-230,500,84,417,'84 237T84 250T98 270H402Q417 262 417 250T402 230H98Q84 237 84 250'], - - // DOT PLUS - 0x2214: [766,93,778,57,722,'339 717Q339 739 354 752T388 766Q410 766 424 751T439 716T424 681T390 666Q369 666 354 681T339 717ZM57 237T57 250T71 270H369V425L370 581Q380 594 389 594Q402 594 409 579V270H707Q722 262 722 250T707 230H409V-79Q401 -93 391 -93H389H387Q375 -93 369 -79V230H71Q57 237 57 250'], - - // SET MINUS - 0x2216: [430,23,778,91,685,'91 404T91 410T97 423T111 430Q117 430 395 224Q676 13 678 10Q685 3 685 -3T678 -16T664 -23Q658 -23 380 184T98 397Q91 404 91 410'], - - // PROPORTIONAL TO - 0x221D: [472,-28,778,56,722,'56 250Q56 346 122 409T276 472Q349 472 407 430T486 326L489 316Q490 317 493 326T501 345T514 367T531 393Q557 425 602 448T698 472Q722 472 722 452Q722 437 702 435T642 421T571 377Q520 323 520 250Q520 179 568 126T693 68Q722 66 722 48Q722 28 698 28Q636 28 576 67T493 174L490 184Q489 181 483 167T475 150T468 136T458 120T447 107T432 90T412 73Q350 28 277 28Q188 28 122 91T56 250ZM199 68T278 68T408 122T459 250Q459 322 414 370T308 430Q302 431 273 431Q204 431 150 380T96 250Q96 176 147 122'], - - // ANGLE - 0x2220: [694,0,722,55,666,'71 0L68 2Q65 3 63 5T58 11T55 20Q55 22 57 28Q67 43 346 361Q397 420 474 508Q595 648 616 671T647 694T661 688T666 674Q666 668 663 663Q662 662 627 622T524 503T390 350L120 41L386 40H653Q666 30 666 20Q666 8 651 0H71'], - - // MEASURED ANGLE - 0x2221: [714,20,722,55,666,'71 0L68 2Q65 3 63 5T58 11T55 20Q55 22 57 28Q64 38 348 373T638 712Q644 714 646 714Q653 714 659 709T666 694V693Q666 687 633 647Q619 631 576 580Q528 524 495 485Q336 296 329 289Q328 288 348 264T395 182T433 54L434 40H651Q666 32 666 20T651 0H436Q431 -20 416 -20Q400 -20 396 -4V0H71ZM394 40Q394 51 389 76T366 149T319 234L302 256L119 41L256 40H394'], - - // SPHERICAL ANGLE - 0x2222: [551,51,722,55,666,'666 -32Q666 -51 646 -51Q639 -51 365 85L75 228Q55 238 55 250Q55 257 59 262T68 268L72 270L611 536Q642 551 647 551T659 547T666 532Q666 521 657 515L525 449Q525 448 535 424T556 352T566 250T556 148T536 77T525 51L657 -15Q666 -21 666 -32ZM526 250Q526 297 517 342T499 409T488 431Q487 431 304 341T121 250T304 159T488 69Q526 143 526 250'], - - // DIVIDES - 0x2223: [430,23,222,91,131,'91 417Q104 430 111 430T131 417V-10Q116 -23 111 -23T91 -10V417'], - - // DOES NOT DIVIDE - 0x2224: [750,252,278,-20,296,'118 737Q131 750 138 750L151 746L158 739V579L160 421L213 470Q269 519 276 519Q284 519 290 513T296 499V498Q296 493 291 488T244 445Q225 428 213 417L158 368V-239Q143 -252 136 -252L124 -248L120 -241L118 44V328L62 279Q4 231 0 230Q-8 230 -14 236T-20 250Q-20 257 -11 265T62 332L118 384V737'], - - // PARALLEL TO - 0x2225: [431,23,389,55,331,'55 417Q69 431 76 431T95 419V-12Q84 -23 76 -23Q72 -23 69 -22T62 -16T55 -10V417ZM293 419Q300 431 310 431L324 424L331 417V-10Q316 -23 309 -23L297 -19L293 -12V419'], - - // NOT PARALLEL TO - 0x2226: [751,250,500,-20,518,'131 737Q134 739 138 743T144 748T151 750T171 737V199L327 357V737Q340 750 347 750Q351 750 353 749T360 743T367 737V397L429 457Q493 518 498 519Q506 519 512 512T518 500Q518 489 442 417L367 339V-237Q352 -250 346 -250L333 -243L327 -237V301L171 143V-237Q156 -250 151 -250T131 -237V101L69 41Q24 -3 15 -12T0 -21Q-8 -21 -14 -14T-20 -2Q-20 5 -7 19T56 81L131 159V737'], - - // THEREFORE - 0x2234: [471,82,667,24,643,'273 411Q273 437 291 454T334 471Q358 471 375 454T393 411T376 368T333 351Q307 351 290 368T273 411ZM84 38Q110 38 126 21T143 -22Q143 -46 127 -64T83 -82Q57 -82 41 -65T24 -22Q24 4 41 21T84 38ZM524 -22Q524 4 541 21T584 38Q608 38 625 21T643 -22Q643 -45 627 -63T583 -82Q557 -82 541 -65T524 -22'], - - // BECAUSE - 0x2235: [471,82,667,23,644,'23 411Q23 437 41 454T84 471Q108 471 125 454T143 411T126 368T83 351Q57 351 40 368T23 411ZM523 411Q523 437 541 454T584 471Q608 471 625 454T643 411T626 368T583 351Q557 351 540 368T523 411ZM274 -22Q274 4 291 21T334 38Q356 38 374 22T392 -22T375 -65T333 -82Q307 -82 291 -65T274 -22'], - - // TILDE OPERATOR - 0x223C: [365,-132,778,55,719,'73 132Q55 132 55 172Q55 220 79 272Q95 301 111 319Q148 353 195 363Q199 364 212 364Q262 364 294 350T408 272Q472 222 522 212Q537 208 555 208Q606 208 646 243Q671 268 680 296T691 342T702 365Q713 365 716 354T719 314Q714 236 664 179L660 176Q657 173 654 170T644 163T631 154T615 146T596 139T574 134T549 132Q510 132 465 156T386 211T307 265T223 290Q162 290 124 249T86 165Q86 155 82 144T73 132'], - - // REVERSED TILDE - 0x223D: [367,-133,778,56,722,'222 133Q147 133 102 197T56 335Q56 362 66 365Q71 369 77 364Q83 356 84 335T90 298Q102 254 137 222T223 189Q258 189 292 206T355 250T413 301T477 346T550 367Q628 367 673 309T722 171Q722 133 708 133Q703 133 699 141T694 162Q694 220 655 265T555 311Q519 311 485 293T421 248T363 196T298 152T222 133'], - - // stix-not, vert, similar - 0x2241: [467,-32,778,55,719,'220 366Q258 366 297 347T361 308T391 288Q394 288 464 370Q494 407 510 425T535 454T546 465T552 467H553Q560 467 566 461T573 448Q573 439 499 350Q424 266 424 261Q424 259 442 247T492 222T554 209Q607 209 646 243Q671 268 680 295T690 341T702 366Q719 366 719 314Q716 265 695 226Q682 199 664 179Q614 132 555 132Q517 132 477 151T412 190T383 210T347 172T278 89T233 37Q228 32 220 32Q210 32 206 38T201 48Q201 57 266 137Q272 144 275 148Q351 231 351 237Q351 239 333 251T283 276T221 289Q159 289 123 248T86 166Q86 156 82 145T73 132Q55 132 55 172Q55 220 79 272Q95 301 111 319Q161 366 220 366'], - - // MINUS TILDE - 0x2242: [463,-34,778,55,720,'55 439T55 443T56 449T62 456T68 463H706Q720 449 720 443T706 423H68Q55 439 55 443ZM56 72Q56 112 73 152T130 225T224 257Q259 257 294 240T360 199T419 149T484 107T553 90Q603 90 643 125T691 223Q693 257 704 257Q717 257 717 221Q717 147 671 91T554 34Q517 34 481 51T414 93T355 142T291 184T222 201Q172 201 131 167T84 67Q81 34 71 34Q56 37 56 72'], - - // APPROXIMATELY BUT NOT ACTUALLY EQUAL TO - 0x2246: [652,155,778,54,720,'55 417Q55 479 101 528T222 578Q259 578 294 564T393 507Q413 493 434 480T469 460T484 454L537 549Q587 639 595 647Q600 652 607 652Q615 652 621 647T628 634Q628 625 575 536Q524 446 524 443Q527 440 555 440Q603 440 644 469T691 547Q694 578 706 578T718 556Q718 555 718 551T717 545Q717 488 684 445T595 387Q582 384 558 384Q530 384 508 389L493 394L404 238L557 236H708Q720 224 720 217T706 196H379L291 43L499 41H708Q720 29 720 21T706 1H268L226 -71Q186 -143 179 -148Q173 -155 165 -155T152 -150T146 -137Q146 -133 184 -64L222 1H144L66 3L59 7Q54 14 54 20Q54 29 66 41H246L333 194Q333 196 202 196H68Q55 211 55 218T66 236H213L357 238L457 409L437 421Q432 423 393 450T307 500T222 523Q171 523 129 491T84 414Q82 383 70 383Q55 383 55 417'], - - // ALMOST EQUAL TO - 0x2248: [481,-49,778,55,719,'55 326Q55 394 101 437T226 481Q268 479 313 460T392 419T469 379T555 361Q622 361 662 401Q686 423 688 450Q693 479 702 479H705Q719 479 719 442Q719 367 670 327T554 286Q512 286 466 304T386 345T307 385T220 404Q184 404 157 394T120 374L111 363Q86 339 86 317Q86 288 71 288Q55 288 55 326ZM55 90Q55 164 105 205T226 246Q269 243 314 224T392 183T470 144T558 126Q622 126 662 166Q686 187 688 214Q693 244 704 244Q716 244 719 210Q719 165 702 132T658 82T605 58T552 50T498 58T447 77T384 110Q322 146 302 152Q263 168 220 168Q179 168 144 152Q128 147 107 125T86 81Q86 52 71 52Q55 52 55 90'], - - // ALMOST EQUAL OR EQUAL TO - 0x224A: [579,39,778,51,725,'220 523Q163 523 124 486T84 412Q81 383 69 383Q56 383 56 413Q56 441 67 470Q78 508 111 537T187 575Q203 579 219 579Q248 579 271 572Q304 565 393 508Q498 439 551 439Q620 439 662 486Q688 512 693 557Q693 565 697 572T707 579Q719 579 719 548Q719 483 673 434T550 384Q512 384 467 405T386 453T305 501T220 523ZM222 288Q164 288 124 251T84 177Q81 148 69 148Q56 148 56 178Q56 206 67 235Q78 274 111 302T187 339Q198 343 220 343Q244 343 259 341T308 322T393 272Q496 203 553 203Q612 203 651 241T691 312Q693 343 705 343Q719 343 719 313Q719 245 673 199Q626 148 552 148Q513 148 467 170T385 218T304 266T222 288ZM51 -19Q51 -6 62 -1H387Q713 -1 715 -3Q725 -10 725 -20Q725 -27 718 -34Q714 -38 672 -38T387 -39H62Q51 -25 51 -19'], - - // GEOMETRICALLY EQUIVALENT TO - 0x224E: [492,-8,778,56,723,'245 367Q251 415 288 453T392 492Q445 492 485 456T532 367H707Q722 359 722 347Q722 334 711 331T665 327H608H509Q500 332 498 336Q496 338 493 363T472 411Q443 451 389 451H387Q335 451 305 411Q290 392 287 374T282 344T268 327H72Q56 332 56 347Q56 360 70 367H245ZM56 153Q56 168 72 173H268Q277 168 279 164Q281 162 284 137T305 89Q334 49 389 49H391Q442 49 472 89Q487 108 490 126T495 156T509 173H608H666Q701 173 711 170T722 153T707 133H532Q526 81 486 45T389 8Q331 8 291 45T245 133H70Q56 140 56 153'], - - // DIFFERENCE BETWEEN - 0x224F: [492,-133,778,56,722,'245 367Q251 415 288 453T392 492Q445 492 485 456T532 367H707Q722 359 722 347Q722 334 711 331T665 327H608H509Q500 332 498 336Q496 338 493 363T472 411Q443 451 389 451H387Q335 451 305 411Q290 392 287 374T282 344T268 327H72Q56 332 56 347Q56 360 70 367H245ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153'], - - // GEOMETRICALLY EQUAL TO - 0x2251: [609,108,778,56,722,'421 474T389 474T339 493T321 541Q321 566 337 587T391 609Q456 602 456 541Q456 512 439 493ZM56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153ZM421 -108T389 -108T339 -89T321 -41Q321 -16 337 5T391 27Q456 20 456 -41Q456 -70 439 -89'], - - // APPROXIMATELY EQUAL TO OR THE IMAGE OF - 0x2252: [601,101,778,15,762,'15 541Q15 569 33 585T75 601T117 585T135 541Q135 514 118 498T75 481T32 498T15 541ZM56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153ZM642 -41Q642 -17 658 0T702 18Q726 18 744 3T762 -41Q762 -67 745 -84T702 -101Q676 -101 659 -85T642 -41'], - - // IMAGE OF OR APPROXIMATELY EQUAL TO - 0x2253: [601,102,778,14,762,'642 541Q642 569 660 585T702 601T744 585T762 541Q762 515 745 498T702 481Q676 481 659 497T642 541ZM56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153ZM14 -41Q14 -15 31 1T74 18Q101 18 118 0T135 -41Q135 -64 118 -83T75 -102Q51 -102 33 -85T14 -41'], - - // RING IN EQUAL TO - 0x2256: [367,-133,778,56,722,'56 347Q56 360 70 367H707Q722 359 722 347Q722 334 711 331T658 327H586H465L472 318Q496 288 496 250T472 182L465 173H586H663Q700 173 711 170T722 153T707 133H70Q56 140 56 153Q56 168 72 173H312L305 182Q281 212 281 250T305 318L312 327H72Q56 332 56 347ZM473 250Q473 265 472 273T460 297T428 327H349Q328 313 318 298T306 273T304 250Q304 235 305 227T317 203T349 173H428Q449 187 459 202T471 227T473 250'], - - // RING EQUAL TO - 0x2257: [721,-133,778,56,722,'279 612Q279 656 310 688T388 721Q433 721 465 689T498 612Q498 573 470 538T389 503Q336 503 308 538T279 612ZM458 614Q458 637 452 651T433 672T411 679T383 680T352 675T333 664T324 647T321 629T320 611Q320 593 321 584T332 562T359 545Q366 543 389 543H391Q406 543 414 544T435 552T452 573T458 614ZM56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153'], - - // DELTA EQUAL TO - 0x225C: [859,-133,778,56,723,'192 482H190Q187 483 185 484T181 488T177 493T175 501Q175 506 178 512Q184 523 278 687T375 853Q379 857 383 857Q385 857 387 858T390 859Q397 859 403 853Q405 851 499 687T600 512Q603 506 603 501Q603 488 587 482H192ZM548 523L389 798Q388 798 309 661T230 523T389 522T548 523ZM56 347Q56 360 70 367H708Q723 359 723 347Q723 336 709 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H709Q723 163 723 153Q723 140 708 133H70Q56 140 56 153'], - - // LESS-THAN OVER EQUAL TO - 0x2266: [753,175,778,83,694,'674 753Q682 753 688 747T694 732T687 718Q686 717 417 589L151 463L399 345Q687 209 691 204Q694 198 694 193Q694 175 676 173H670L382 309Q92 446 90 448Q83 453 83 465Q84 476 96 482Q104 486 382 617T665 751Q669 753 674 753ZM84 39Q84 49 99 59H678Q694 53 694 39Q694 26 679 19H98Q84 26 84 39ZM83 -157Q83 -153 84 -150T86 -145T89 -141T92 -139T96 -137T99 -135H678Q694 -146 694 -155Q694 -168 679 -175H98Q84 -168 83 -157'], - - // GREATER-THAN OVER EQUAL TO - 0x2267: [753,175,778,82,694,'83 733Q83 741 89 747T99 753Q107 753 253 685T543 548T687 478Q694 473 694 463T687 448Q685 446 395 309L107 173H101Q83 175 83 193Q83 194 83 196Q82 203 98 212Q117 222 248 284Q326 321 378 345L626 463L360 589Q291 622 200 665Q112 706 98 714T83 733ZM84 39Q84 49 99 59H678Q694 53 694 39Q694 26 679 19H98Q84 26 84 39ZM83 -157Q83 -153 84 -150T86 -145T89 -141T92 -139T96 -137T99 -135H678Q694 -146 694 -155Q694 -168 679 -175H98Q84 -168 83 -157'], - - // stix-less, vert, not double equals - 0x2268: [752,286,778,82,694,'86 472Q93 477 381 614T673 752Q680 752 686 746T693 732T689 721Q686 715 418 590L151 461L418 332Q684 207 689 201Q693 195 693 190Q693 183 687 177T675 170Q668 170 380 307T86 450Q82 454 82 461Q82 467 86 472ZM82 33Q82 37 83 40T89 47T95 54H473L520 105Q569 156 571 156Q573 157 578 157Q586 157 592 151T598 136Q598 130 562 92L526 56L604 54H682Q693 43 693 35Q693 31 692 28T686 21T680 14H489L342 -139L513 -142H682Q693 -148 693 -160Q693 -167 680 -182H304L258 -230Q248 -240 237 -251T221 -268T211 -278T203 -284T197 -286Q189 -286 184 -280T178 -264Q178 -257 213 -219L249 -182H171L93 -179L86 -175Q82 -170 82 -163Q82 -155 95 -142H289L360 -64L433 14H262L93 16Q82 23 82 33'], - - // stix-gt, vert, not double equals - 0x2269: [752,286,778,82,693,'89 745Q95 752 100 752Q106 752 394 615T689 472Q693 468 693 461T689 450Q684 445 396 308T100 170Q95 170 89 176T82 190Q82 195 86 201Q91 208 358 332L624 461L358 590Q90 715 86 721Q82 725 82 731Q82 739 89 745ZM82 33Q82 37 83 40T89 47T95 54H473L520 105Q569 156 571 156Q573 157 578 157Q586 157 592 151T598 136Q598 130 562 92L526 56L604 54H682Q693 43 693 35Q693 31 692 28T686 21T680 14H489L342 -139L513 -142H682Q693 -148 693 -160Q693 -167 680 -182H304L258 -230Q248 -240 237 -251T221 -268T211 -278T203 -284T197 -286Q189 -286 184 -280T178 -264Q178 -257 213 -219L249 -182H171L93 -179L86 -175Q82 -170 82 -163Q82 -155 95 -142H289L360 -64L433 14H262L93 16Q82 23 82 33'], - - // BETWEEN - 0x226C: [751,251,500,74,425,'104 730Q104 749 123 749Q130 749 138 745Q186 717 237 671L250 659L261 670Q297 703 332 726T375 750T389 744T395 730Q395 721 390 717T364 699T322 668Q290 641 283 632Q280 628 281 627T293 612Q425 454 425 250Q425 144 388 51T293 -112Q282 -125 281 -126T283 -132Q306 -162 379 -209Q395 -219 395 -230Q395 -238 389 -244T375 -250T335 -228T262 -171L250 -159L238 -170Q202 -203 167 -226T124 -250T110 -244T104 -230Q104 -219 121 -209Q199 -156 216 -132Q219 -128 218 -127T206 -112Q74 46 74 250T206 612Q217 625 218 626T216 632Q199 656 121 709Q104 719 104 730ZM249 -94Q364 61 364 250Q364 430 265 574Q253 590 249 594L242 583Q134 439 134 250Q134 114 192 -1Q212 -44 242 -83L249 -94'], - - // stix-not, vert, less-than - 0x226E: [709,209,778,82,693,'693 -14T693 -20T687 -33T675 -41Q667 -41 506 37L344 112Q342 112 262 -46Q184 -196 176 -205Q172 -209 168 -209T162 -208Q155 -208 151 -203T146 -190Q146 -178 171 -137Q193 -91 251 21L306 132L198 183Q142 208 118 220T88 238T82 249Q82 253 86 261Q92 267 278 357L464 443L529 572Q561 637 577 667T597 703T607 708Q615 708 622 702T629 688Q629 680 575 579L524 474Q524 473 545 482T598 508Q666 541 673 541T686 535T693 521Q693 512 679 504T589 459L493 414L360 150Q366 148 378 142T431 116T529 70Q686 -8 689 -10Q693 -14 693 -20ZM380 277L433 383Q432 385 292 319T151 250T237 209T324 170L380 277'], - - // stix-not, vert, greater-than - 0x226F: [708,209,778,82,693,'82 514T82 520T89 533T100 541Q106 541 271 463Q434 386 435 386L515 543Q593 699 600 706Q604 708 607 708Q615 708 622 702T629 688T549 526Q509 445 491 407T473 368Q522 343 580 317Q636 291 660 278T688 261T693 250V249Q693 241 681 234T580 184Q533 161 502 146Q317 59 315 59Q312 56 246 -74Q197 -170 186 -189T168 -209Q164 -209 162 -208Q155 -208 151 -203T146 -190Q146 -187 200 -79L253 28L218 11Q182 -6 144 -23T100 -41Q95 -41 89 -35T82 -21Q82 -12 96 -4T186 41L284 88L349 217Q377 273 395 311T413 350Q413 351 253 428Q101 498 86 510Q82 514 82 520ZM624 250Q461 330 455 330Q454 331 453 329T448 321T441 308T430 287T416 259T398 223L342 114L624 250'], - - // stix-not, vert, less-than-or-equal - 0x2270: [801,303,778,81,694,'82 -124Q82 -120 83 -117T89 -110T95 -103H220L284 50Q346 204 344 206L218 268Q153 297 123 313T87 333T82 344T86 355Q104 369 291 455Q491 552 491 553L542 673Q581 767 590 784T609 801Q616 801 622 795T629 781Q629 773 586 677Q546 581 546 577L609 606Q669 635 673 635Q680 635 686 629T693 615Q693 610 692 608T670 593T604 561L524 521L400 226L542 157Q617 123 649 107T687 85T694 72Q694 66 690 60T679 54Q664 54 526 121Q513 127 495 136T464 150T438 162T416 173T399 180T388 185L384 186Q383 186 322 41L262 -103H680Q682 -105 684 -108T688 -113T691 -118T693 -124Q693 -134 682 -141L464 -143H246L213 -219Q182 -292 178 -299Q172 -303 166 -303T153 -297T146 -283Q146 -282 174 -213T202 -143H146L93 -141Q82 -134 82 -124ZM418 370L466 495Q464 495 308 420T151 344T204 317T311 267T364 244Q364 247 418 370'], - - // stix-not, vert, greater-than-or-equal - 0x2271: [801,303,778,82,694,'97 54Q82 54 82 72Q82 79 86 84Q95 91 222 153L351 215L398 324L442 433L258 519Q95 597 87 604Q82 608 82 615T88 628T102 635Q107 635 424 484L458 468L524 630Q593 789 597 795Q601 801 609 801Q616 801 622 795T629 781L562 615L493 450L589 406Q665 371 679 362T694 344Q694 339 693 337T677 326T631 302T538 257Q504 241 465 223T406 195T386 186Q384 185 322 39L262 -103H680Q682 -105 684 -108T688 -113T691 -118T693 -124Q693 -134 682 -141L464 -143H246L213 -219Q182 -292 178 -299Q172 -303 166 -303T153 -297T146 -283Q146 -282 174 -213T202 -143H146L93 -141Q82 -134 82 -124Q82 -120 83 -117T89 -110T95 -103H220L273 26Q326 156 326 157L218 106Q109 54 97 54ZM553 379Q480 412 480 415Q479 415 460 372T423 285T406 241Q408 240 516 291T624 344L553 379'], - - // stix-less-than or (contour) similar - 0x2272: [732,228,778,56,722,'674 732Q682 732 688 726T694 711T687 697Q686 696 417 568L151 442L399 324Q687 188 691 183Q694 177 694 172Q694 154 676 152H670L382 288Q92 425 90 427Q83 432 83 444Q84 455 96 461Q104 465 382 596T665 730Q669 732 674 732ZM56 -194Q56 -107 106 -51T222 6Q260 6 296 -12T362 -56T420 -108T483 -153T554 -171Q616 -171 654 -128T694 -29Q696 6 708 6Q722 6 722 -26Q722 -102 676 -164T557 -227Q518 -227 481 -209T415 -165T358 -113T294 -69T223 -51Q163 -51 125 -93T83 -196Q81 -228 69 -228Q56 -228 56 -202V-194'], - - // stix-greater-than or (contour) similar - 0x2273: [732,228,778,56,722,'90 697Q83 704 83 712T88 726T99 732Q107 732 253 664T543 527T687 457Q694 452 694 442T687 427Q685 425 395 288L107 152H101Q83 154 83 172Q83 173 83 175Q82 182 98 191Q117 201 248 263Q326 300 378 324L626 442L360 568Q91 696 90 697ZM56 -194Q56 -107 106 -51T222 6Q260 6 296 -12T362 -56T420 -108T483 -153T554 -171Q616 -171 654 -128T694 -29Q696 6 708 6Q722 6 722 -26Q722 -102 676 -164T557 -227Q518 -227 481 -209T415 -165T358 -113T294 -69T223 -51Q163 -51 125 -93T83 -196Q81 -228 69 -228Q56 -228 56 -202V-194'], - - // LESS-THAN OR GREATER-THAN - 0x2276: [681,253,778,44,734,'734 181Q734 173 728 167T714 161Q711 161 386 280T54 404Q44 408 44 421Q44 432 52 437Q66 443 388 562T714 681Q721 681 727 675T734 661Q734 651 722 645Q711 639 462 546Q441 539 420 531L122 421L420 311L723 198Q734 192 734 181ZM44 247Q44 255 50 261T63 267Q66 267 391 148T723 24Q734 18 734 7T723 -10Q716 -14 391 -133T63 -253Q56 -253 50 -247T44 -233Q44 -223 55 -217Q67 -210 317 -118Q337 -110 357 -103L655 7L357 117L54 230Q44 236 44 247'], - - // GREATER-THAN OR LESS-THAN - 0x2277: [681,253,778,83,694,'83 661Q83 668 88 674T104 681Q111 679 396 560Q686 437 687 436Q694 431 694 421T687 406Q686 405 543 344T253 222T101 161Q83 163 83 180Q83 194 95 199Q96 199 130 213T232 257T361 311L621 421L357 532Q307 553 233 584Q121 631 102 640T83 661ZM673 267Q694 267 694 248Q694 237 687 232Q684 229 420 118L156 7L416 -103L683 -215Q694 -222 694 -233Q694 -251 676 -253Q670 -253 524 -192T235 -70T90 -8Q83 -1 83 7Q83 19 94 24Q97 25 378 144T667 266Q669 267 673 267'], - - // PRECEDES OR EQUAL TO - 0x227C: [580,153,778,83,694,'112 270Q83 270 83 290Q83 301 94 307Q98 310 118 310Q516 310 620 464Q635 486 642 510T651 548T657 571T675 580Q693 577 693 559V552Q684 472 628 410T465 314Q436 303 372 290Q373 290 388 287T425 278T465 266Q674 199 693 28L694 17Q688 5 683 3Q677 0 673 0Q656 0 653 24Q623 270 118 270H112ZM110 116Q83 116 83 136T110 156H113Q134 156 160 155T231 146T318 128T407 95T489 44T550 -30T583 -131Q583 -153 563 -153Q556 -153 553 -152T547 -145T542 -127Q531 -54 478 0Q425 53 333 83T123 116H110'], - - // SUCCEEDS OR EQUAL TO - 0x227D: [580,154,778,83,694,'668 310Q694 310 694 290Q694 285 691 279Q684 271 664 270Q550 268 464 257T301 220T179 146T124 27Q119 0 103 0T83 16Q83 21 83 31T92 68T113 121T157 177T229 231Q295 268 405 290Q404 290 389 293T352 302T312 314Q138 371 96 500Q83 541 83 562Q83 568 89 574T103 580Q115 580 120 570T126 542T138 497T173 442Q289 310 659 310H668ZM194 -131Q201 -60 241 -6T343 82T477 133T628 155Q632 155 644 155T661 156Q685 155 690 147Q694 143 694 136Q694 132 693 129T689 124T685 120T681 117L656 116Q596 114 543 106T436 79T342 35T272 -33T235 -127Q231 -154 212 -154Q203 -153 199 -147T194 -136V-131'], - - // PRECEDES OR EQUIVALENT TO - 0x227E: [732,228,778,56,722,'84 442Q84 455 91 459T117 463Q120 463 126 463T137 462Q388 466 512 526T653 705Q657 732 676 732Q685 731 689 725T694 714V708Q689 662 672 624T626 559T569 513T500 479T435 458T373 442Q379 441 404 435T440 426T477 414T533 392Q592 362 630 319T681 241T694 174Q694 153 674 153Q662 153 657 163T652 188T640 231T606 287Q500 416 137 422H114Q104 422 98 423T88 428T84 442ZM56 -194Q56 -107 106 -51T222 6Q260 6 296 -12T362 -56T420 -108T483 -153T554 -171Q616 -171 654 -128T694 -29Q696 6 708 6Q722 6 722 -26Q722 -102 676 -164T557 -227Q518 -227 481 -209T415 -165T358 -113T294 -69T223 -51Q163 -51 125 -93T83 -196Q81 -228 69 -228Q56 -228 56 -202V-194'], - - // SUCCEEDS OR EQUIVALENT TO - 0x227F: [732,228,778,56,722,'84 710Q84 732 102 732Q115 732 119 722T125 696T137 652T171 597Q277 468 640 462H661Q694 462 694 442T661 422H640Q578 421 526 417T415 403T309 376T222 333T156 268T124 179Q122 162 118 158T103 153Q100 153 98 153T95 154T93 155T90 158T85 163Q83 167 83 176Q88 222 105 260T151 325T208 371T277 405T342 426T404 442Q401 443 380 447T345 456T302 469T245 492Q125 551 92 661Q84 695 84 710ZM56 -194Q56 -107 106 -51T222 6Q260 6 296 -12T362 -56T420 -108T483 -153T554 -171Q616 -171 654 -128T694 -29Q696 6 708 6Q722 6 722 -26Q722 -102 676 -164T557 -227Q518 -227 481 -209T415 -165T358 -113T294 -69T223 -51Q163 -51 125 -93T83 -196Q81 -228 69 -228Q56 -228 56 -202V-194'], - - // DOES NOT PRECEDE - 0x2280: [705,208,778,82,693,'386 292Q388 292 439 393T543 598T598 703Q599 703 603 704T609 705Q616 705 622 699T629 685T533 494Q440 308 440 305Q451 310 462 312Q547 342 592 388T651 505Q654 525 658 532T673 539Q680 539 686 533T693 519Q693 495 678 450Q638 341 500 283Q433 259 418 259Q416 259 411 251T406 241T415 239Q482 224 544 190Q674 121 691 -10Q693 -28 691 -32Q684 -43 672 -43Q664 -43 658 -37Q656 -33 650 -6T634 47T589 109T500 168Q473 179 436 190T388 201H386L284 -1Q261 -45 232 -101T191 -181T178 -206Q176 -206 172 -207T166 -208Q160 -208 153 -202T146 -188Q146 -185 246 12Q344 206 344 210Q344 213 305 217T213 225T124 228H95Q82 241 82 248Q82 253 95 268H124Q172 268 236 273T343 283T386 292'], - - // stix-not (vert) succeeds - 0x2281: [705,208,778,82,693,'103 -43Q96 -43 89 -39T82 -26L84 -10Q105 141 275 212Q342 236 355 236Q360 236 364 245L369 256H360Q284 280 275 283Q115 351 86 490Q82 507 82 517Q82 526 88 532T103 538Q110 538 115 534Q119 531 122 517T128 486T143 444T174 397T231 351T320 310Q371 292 389 292L491 496Q595 701 598 703Q599 703 603 704T609 705Q616 705 622 699T629 685Q629 684 531 485Q431 296 431 288Q431 278 520 273T651 268H680Q693 253 693 248Q693 241 680 228H651Q591 228 491 218T386 201L284 -1Q261 -45 232 -101T191 -181T178 -206Q176 -206 172 -207T166 -208Q160 -208 153 -202T146 -188Q146 -182 302 125L335 190L324 185Q313 185 289 172Q241 153 208 128T159 78T135 31T124 -11T118 -37Q112 -43 103 -43'], - - // stix-/nsubseteq N: not (vert) subset, equals - 0x2288: [801,303,778,83,693,'146 -283Q146 -282 174 -213T202 -143H115Q102 -127 102 -123T115 -103H220L291 68L278 73Q203 101 153 157T86 288Q83 309 83 344Q83 380 86 399Q107 480 160 539Q222 601 298 621Q328 630 345 631T435 635L526 637L560 715Q587 778 593 789T609 801Q616 801 622 795T629 781Q629 780 625 771T614 742T600 706L571 637Q571 635 626 635H680Q693 620 693 613T689 601L682 597L618 595H553L449 346Q425 288 399 223T359 127T346 95H356Q365 95 381 95T417 94T463 93T515 93H682Q693 82 693 74T680 53H511Q420 55 335 55L329 57L262 -103H680Q682 -105 684 -108T688 -113T691 -118T693 -124Q693 -134 682 -141L464 -143H246L213 -219Q182 -292 178 -299Q172 -303 166 -303T153 -297T146 -283ZM509 590Q509 595 438 595Q354 595 318 586Q246 567 195 516T126 395Q123 378 123 344T126 293Q141 229 184 181T291 110L306 104L406 346L509 590'], - - // stix-/nsupseteq N: not (vert) superset, equals - 0x2289: [801,303,778,82,691,'82 606T82 613T95 635H251H348Q408 635 435 632T502 615L515 608L520 617Q520 619 558 708Q584 774 591 787T609 801Q616 801 622 795T629 781Q629 775 562 615L551 590L569 577Q646 527 678 437Q691 398 691 344T678 250Q653 182 597 132T469 64Q427 53 366 53H326L295 -25L262 -103H660Q673 -118 673 -124Q673 -129 669 -136L662 -141L453 -143H246L213 -219Q182 -292 178 -299Q172 -303 166 -303T153 -297T146 -283Q146 -282 174 -213T202 -143H95Q82 -128 82 -123T95 -103H220L251 -25L284 53H189L93 55L86 59Q82 64 82 71T95 93H302L400 333Q498 569 498 573L444 590Q431 593 260 595L93 597L86 601Q82 606 82 613ZM652 344V354Q652 451 575 521Q571 526 557 538T537 551Q534 551 533 548Q533 543 438 319L344 95L371 93H386Q487 93 557 150T649 293Q652 309 652 344'], - - // stix-subset, not equals, variant - 0x228A: [635,241,778,84,693,'693 72Q693 68 692 66T686 59T680 52H524Q398 52 367 53T309 63Q236 82 180 132T98 250Q84 288 84 343Q84 397 98 437Q126 515 193 568T346 632Q347 632 373 633T440 634T520 635H680Q693 620 693 615Q693 608 680 595H526Q364 595 353 592Q279 582 221 539T138 430Q124 392 124 343Q124 296 138 257Q163 192 221 149T353 95Q364 92 526 92H680Q693 79 693 72ZM102 -132T102 -125T115 -103H382L420 -68Q429 -60 438 -52T452 -39T463 -28T472 -20T478 -14T483 -10T487 -7T490 -6T493 -5T496 -5Q502 -5 508 -12T515 -28Q515 -34 513 -37Q512 -38 507 -42T492 -55T475 -70L440 -101L562 -103H682Q693 -114 693 -122T680 -143H395L355 -179Q289 -241 280 -241Q273 -241 267 -235T260 -221T265 -208T300 -174L335 -143H224L113 -141L106 -137Q102 -132 102 -125'], - - // stix-superset, not equals, variant - 0x228B: [635,241,778,82,691,'82 615Q82 620 95 635H251Q378 635 409 634T469 623Q540 605 596 555T678 437Q691 397 691 343T678 250Q649 172 581 119T426 55Q415 52 251 52H95Q93 55 89 59T84 65T82 72Q82 79 95 92H249Q411 92 422 95Q496 105 554 148T638 257Q651 296 651 343Q651 391 638 430Q613 495 555 538T422 592Q411 595 249 595H95Q82 608 82 615ZM82 -132T82 -125T95 -103H380L420 -57Q452 -21 460 -14T474 -6Q482 -6 488 -12T495 -25T451 -81L433 -101L549 -103H662Q673 -114 673 -122T660 -143H395L355 -190Q311 -239 309 -239Q305 -241 302 -241Q294 -241 287 -235T280 -221T324 -163L342 -143H218L93 -141L86 -137Q82 -132 82 -125'], - - // SQUARE IMAGE OF - 0x228F: [539,41,778,83,694,'83 523Q87 535 99 539H679Q694 531 694 519Q694 506 679 499H123V-1H678Q694 -7 694 -21Q694 -34 679 -41H98Q93 -38 84 -28L83 247V523'], - - // SQUARE ORIGINAL OF - 0x2290: [539,41,778,64,714,'64 506T64 519T78 539H699Q706 536 714 526V-28Q706 -38 699 -41H78Q64 -34 64 -21Q64 -6 80 -1H674V499H78Q64 506 64 519'], - - // CIRCLED RING OPERATOR - 0x229A: [583,82,778,57,721,'57 250Q57 327 87 392T166 497T270 560T382 582H394Q512 582 610 500Q721 401 721 250Q721 112 626 15T389 -82Q251 -82 154 13T57 250ZM682 129T682 250T596 457T390 543Q269 543 183 457T96 250Q96 132 180 45T389 -43Q511 -43 596 43ZM250 250Q250 316 295 352T384 388Q451 388 489 347T528 250Q528 192 487 152T389 112Q331 112 291 152T250 250ZM488 250Q488 290 460 319T389 349Q348 349 319 320T290 250Q290 208 320 180T389 151Q431 151 459 181T488 250'], - - // CIRCLED ASTERISK OPERATOR - 0x229B: [583,82,778,57,721,'57 250Q57 327 87 392T166 497T270 560T382 582H394Q512 582 610 500Q721 401 721 250Q721 112 626 15T389 -82Q251 -82 154 13T57 250ZM682 129T682 250T596 457T390 543Q269 543 183 457T96 250Q96 132 180 45T389 -43Q511 -43 596 43ZM204 339Q204 357 215 366T238 375Q247 375 283 348Q300 336 311 328L368 286Q369 286 366 323T359 398T355 437Q357 456 379 465Q380 465 384 465T391 466Q403 465 412 457T423 437Q423 436 420 398T413 323T410 286L467 328Q476 334 486 341T501 353T513 361T523 368T529 372T535 374T541 375Q554 375 564 365T575 339Q575 325 566 318T519 292Q504 285 496 281L430 250L496 219Q552 192 559 188T572 175Q575 168 575 161Q575 148 566 137T541 126H538Q530 126 499 149Q480 163 467 172L410 214Q409 214 412 177T419 102T423 63Q423 59 421 54T411 43T389 36T368 42T357 54T355 63Q355 64 358 102T365 177T368 214L311 172Q302 165 293 159T279 148T268 140T260 134T254 131T250 128T246 127T242 126T238 126Q223 126 214 135T204 161T213 183T282 219L348 250L282 281Q226 308 219 312T206 325Q204 330 204 339'], - - // CIRCLED DASH - 0x229D: [583,82,778,57,721,'57 250Q57 327 87 392T166 497T270 560T382 582H394Q512 582 610 500Q721 401 721 250Q721 112 626 15T389 -82Q251 -82 154 13T57 250ZM682 129T682 250T596 457T390 543Q269 543 183 457T96 250Q96 132 180 45T389 -43Q511 -43 596 43ZM223 250Q223 263 233 267T280 271Q289 271 325 271T389 270H490Q535 270 545 267T555 250Q555 241 549 235Q544 231 527 231T389 230Q239 230 235 232Q223 236 223 250'], - - // SQUARED PLUS - 0x229E: [689,0,778,55,722,'71 0Q59 4 55 16V346L56 676Q64 686 70 689H709Q719 681 722 674V15Q719 10 709 1L390 0H71ZM369 365V649H95V365H369ZM682 365V649H409V365H682ZM369 40V325H95V40H369ZM682 40V325H409V40H682'], - - // SQUARED MINUS - 0x229F: [689,0,778,55,722,'71 0Q59 4 55 16V346L56 676Q64 686 70 689H709Q719 681 722 674V15Q719 10 709 1L390 0H71ZM682 365V649H95V365H682ZM682 40V325H95V40H682'], - - // SQUARED TIMES - 0x22A0: [689,0,778,55,722,'71 0Q59 4 55 16V346L56 676Q64 686 70 689H707Q714 686 722 676V13Q714 3 707 0H71ZM123 649Q147 625 214 555T335 430T389 374L654 649H123ZM95 70Q99 74 229 209T360 345L95 619V70ZM682 70V619L418 346Q417 344 549 207L682 70ZM654 41L400 304L388 315L123 41L256 40H522L654 41'], - - // SQUARED DOT OPERATOR - 0x22A1: [689,0,778,55,722,'71 0Q59 4 55 16V346L56 676Q64 686 70 689H709Q719 681 722 674V15Q719 10 709 1L390 0H71ZM682 40V649H95V40H682ZM330 345Q330 371 347 388T390 405Q412 405 430 389T448 345Q448 317 430 301T389 285T348 301T330 345'], - - // TRUE - 0x22A8: [695,0,611,55,556,'55 678Q55 679 56 681T58 684T61 688T65 691T70 693T77 694Q88 692 95 679V464H540Q554 456 555 446Q555 442 554 439T552 434T549 430T546 428T542 426T539 424H95V270H539Q540 270 542 269T545 267T549 264T552 260T554 255T555 248Q554 238 540 230H95V15Q88 2 77 0Q73 0 70 1T65 3T61 6T59 9T57 13T55 16V678'], - - // FORCES - 0x22A9: [695,0,722,55,666,'55 678Q55 679 56 681T58 684T61 688T65 691T70 693T77 694Q88 692 95 679V15Q88 2 77 0Q73 0 70 1T65 3T61 6T59 9T57 13T55 16V678ZM249 678Q249 679 250 681T252 684T255 688T259 691T264 693T271 694Q282 692 289 679V367H651Q666 359 666 347Q666 334 651 327H289V15Q282 2 271 0Q267 0 264 1T259 3T255 6T253 9T251 13T249 16V678'], - - // TRIPLE VERTICAL BAR RIGHT TURNSTILE - 0x22AA: [695,0,889,55,833,'55 678Q55 679 56 681T58 684T61 688T65 691T70 693T77 694Q88 692 95 679V15Q88 2 77 0Q73 0 70 1T65 3T61 6T59 9T57 13T55 16V678ZM237 678Q237 679 238 681T240 684T243 688T247 691T252 693T259 694Q270 692 277 679V15Q270 2 259 0Q255 0 252 1T247 3T243 6T241 9T239 13T237 16V678ZM419 678Q419 679 420 681T422 684T425 688T429 691T434 693T441 694Q452 692 459 679V367H818Q833 359 833 347Q833 334 818 327H459V15Q452 2 441 0Q437 0 434 1T429 3T425 6T423 9T421 13T419 16V678'], - - // DOES NOT PROVE - 0x22AC: [696,1,611,-55,554,'56 681Q70 695 76 695T96 681V368H243L381 530Q521 692 525 692Q537 700 547 688Q554 682 554 674Q554 671 553 669T548 661T539 649T522 631T499 604T465 565T421 512Q296 373 296 368H416H476Q525 368 539 365T554 348Q554 334 543 328H261L96 141V12Q81 -1 75 -1Q65 -1 58 10L56 50V92L18 48Q7 37 -1 28T-13 14T-19 6T-23 1T-27 0T-33 -1Q-42 -1 -48 4T-55 19Q-55 24 -47 34T12 103L56 155V681ZM205 326Q205 328 152 328H96V263Q96 203 98 203Q99 203 123 231T174 290T205 326'], - - // NOT TRUE - 0x22AD: [695,1,611,-55,554,'56 681Q70 695 76 695T96 681V466H327L425 579Q522 692 527 692Q529 693 534 693Q542 693 547 688T553 674Q553 668 549 663Q549 662 538 650T504 611T463 563L381 468L461 466H543Q554 453 554 446T541 426H345L209 272L376 270H543Q554 257 554 251T541 230H174L96 141V12Q81 -1 75 -1Q65 -1 58 10L56 50V92L18 48Q7 37 -1 28T-13 14T-19 6T-23 1T-27 0T-33 -1Q-42 -1 -48 4T-55 19Q-55 24 -47 34T12 103L56 155V681ZM267 399L292 426H96V270H158L201 321Q256 382 267 399ZM118 228L119 229Q119 230 109 230H96V201L107 212Q118 227 118 228'], - - // DOES NOT FORCE - 0x22AE: [695,1,722,-55,665,'56 681Q70 695 77 695T96 683V428L98 175L252 323V681Q264 695 272 695Q278 695 292 681V526Q292 368 296 368Q298 368 447 510Q638 695 642 695H645Q651 695 658 688T665 673Q665 666 661 661Q659 660 639 641T578 582T505 512L356 370L505 368H654Q665 357 665 349Q665 343 652 328H314L303 317L292 308V12Q289 10 285 6T279 1T272 -1Q265 -1 252 12V139Q252 266 249 266L96 119V12Q80 -1 76 -1T70 0T63 6T56 12V79L29 55Q-26 -1 -35 -1Q-42 -1 -48 5T-55 19Q-55 25 -51 30T-15 66Q5 86 18 99L56 135V681'], - - // NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE - 0x22AF: [695,1,722,-55,665,'56 681Q70 695 77 695T96 683V428L98 175L252 323V681Q264 695 272 695Q278 695 292 681V466H401L503 563L621 679Q637 695 645 695Q652 695 658 688T665 673Q665 670 663 666Q663 665 651 652T611 612T561 563L458 468L556 466H654Q665 455 665 447T652 426H416L294 308L292 288V270H652Q665 255 665 250T652 230H292V12Q289 10 285 6T279 1T272 -1Q265 -1 252 12V139Q252 266 249 266L96 119V12Q80 -1 76 -1T70 0T63 6T56 12V79L29 55Q-26 -1 -35 -1Q-42 -1 -48 5T-55 19Q-55 25 -51 30T-15 66Q5 86 18 99L56 135V681ZM358 426H292V361L325 392L358 426'], - - // NORMAL SUBGROUP OF - 0x22B2: [539,41,778,83,694,'694 -26Q686 -40 676 -41H670L382 95Q92 232 90 234Q83 239 83 249Q83 262 96 267Q101 270 379 401T665 537Q671 539 674 539Q686 539 694 524V-26ZM654 11T654 249T653 487T402 369T151 249L275 190Q399 131 524 72T652 11Q654 11 654 249'], - - // CONTAINS AS NORMAL SUBGROUP - 0x22B3: [540,41,778,83,694,'83 523Q83 524 85 527T92 535T103 539Q107 539 389 406T680 268Q694 260 694 249Q694 239 687 234Q685 232 395 95L107 -41H101Q90 -40 83 -26V523ZM376 368Q323 393 254 425T155 472L125 487Q123 487 123 249T125 11Q127 12 252 71T502 190L626 249L376 368'], - - // NORMAL SUBGROUP OF OR EQUAL TO - 0x22B4: [636,138,778,83,695,'694 71Q686 58 676 56H670L382 192Q92 329 90 331Q83 336 83 346Q83 359 96 364Q101 367 379 498T665 634Q671 636 674 636Q686 636 694 621V71ZM654 108T654 346T653 584T402 466T151 346L275 287Q399 228 524 169T652 108Q654 108 654 346ZM83 -120Q83 -116 84 -113T86 -108T89 -104T92 -102T96 -100T99 -98H678Q679 -98 681 -99T684 -101T688 -104T691 -108T693 -113T694 -120Q692 -130 679 -138H98Q84 -130 83 -120'], - - // CONTAINS AS NORMAL SUBGROUP OR EQUAL TO - 0x22B5: [637,138,778,83,695,'83 620Q83 621 85 624T92 632T103 636Q107 636 389 503T680 365Q694 357 694 346Q694 336 687 331Q685 329 395 192L107 56H101Q90 58 83 71V620ZM376 465Q323 490 254 522T155 570L125 584Q123 584 123 346T125 108Q127 109 252 168T502 287L626 346L376 465ZM83 -120Q83 -116 84 -113T86 -108T89 -104T92 -102T96 -100T99 -98H678Q679 -98 681 -99T684 -101T688 -104T691 -108T693 -113T694 -120Q692 -130 679 -138H98Q84 -130 83 -120'], - - // MULTIMAP - 0x22B8: [408,-92,1111,55,1055,'1055 250Q1055 190 1012 141T896 92Q858 92 828 106T781 140T755 180T741 214L738 228V230H405Q71 230 68 232Q55 238 55 250T68 268Q71 270 405 270H738V272L740 280Q742 287 745 297T754 321T771 348T796 374T832 396T881 408H891Q969 408 1012 360T1055 250ZM896 132Q948 132 981 166T1014 250Q1014 301 985 330T920 367Q914 368 891 368Q853 368 816 338T778 250Q778 198 812 165T896 132'], - - // INTERCALATE - 0x22BA: [431,212,556,57,501,'318 -182Q302 -212 280 -212H278H275Q249 -212 239 -182L238 84V351H162L87 352Q57 362 57 391T84 429Q89 431 280 431H470L474 429Q477 427 479 426T484 423T490 417T495 410T499 402T500 391Q500 365 470 352L394 351H318V-182'], - - // XOR - 0x22BB: [716,0,611,55,555,'56 697Q56 706 62 711T75 716Q86 716 90 709Q91 708 104 680T147 592T199 483L305 261L411 483Q443 548 481 629Q512 694 518 705T535 716Q543 716 549 710T555 700Q555 693 501 577T388 340T325 210Q316 194 305 194Q292 194 285 210Q282 219 224 339T111 574T56 697ZM55 14T55 20T59 31T66 38T71 40H540Q555 32 555 20T540 0H71Q70 0 67 2T59 9'], - - // NAND - 0x22BC: [716,0,611,54,555,'55 698Q56 708 70 716H540Q554 708 555 698Q555 694 554 691T552 686T549 682T546 680T542 678T539 676H71Q70 676 68 677T65 679T61 682T58 686T56 691T55 698ZM555 18Q554 12 549 6T536 0H535Q525 0 515 17T459 132Q430 194 410 235L305 455L199 233Q176 185 147 125T105 36T90 7Q85 0 75 0Q63 0 58 11Q55 15 55 21Q58 31 170 266T285 507Q295 522 305 522T320 515Q322 513 439 268L555 24V18'], - - // DOT OPERATOR - 0x22C5: [189,0,278,55,222,'71 0Q59 4 55 16V96L56 176Q59 180 66 187L70 189H209Q219 181 222 174V15Q219 10 209 1L140 0H71'], - - // DIVISION TIMES - 0x22C7: [545,44,778,55,720,'366 543Q374 545 382 545Q405 545 419 538Q429 534 443 521T462 496Q466 478 466 467Q466 438 444 412Q422 390 388 390Q352 390 331 412Q311 434 311 467Q311 499 331 518Q345 533 366 543ZM146 472Q146 479 153 485T166 492Q171 492 187 476T279 385L386 278L495 385Q600 492 608 492Q615 492 621 486T628 472Q628 467 614 452T531 367L435 270H706Q720 256 720 250Q720 241 706 230H435L531 132Q600 63 614 48T628 27Q628 20 622 14T608 7Q600 7 495 114L386 221L279 114Q204 39 188 23T166 7Q159 7 153 13T146 27Q146 32 160 47T244 132L339 230H68Q55 243 55 250Q55 255 68 270H339L244 367Q175 436 161 451T146 472ZM466 34Q466 4 447 -20T388 -44Q353 -44 331 -22Q311 1 311 34Q311 66 331 85Q347 101 366 110Q374 112 382 112Q405 112 419 105Q429 100 443 87T462 63Q466 45 466 34'], - - // LEFT NORMAL FACTOR SEMIDIRECT PRODUCT - 0x22C9: [492,-8,778,146,628,'146 479Q159 492 166 492Q171 492 189 475T279 386L386 279L495 386Q598 492 608 492Q615 492 621 486T628 472Q628 464 522 357L415 250L522 144Q628 37 628 28Q628 21 622 15T608 8Q599 8 495 115L386 221L279 115Q204 40 188 24T166 8Q162 8 160 9T153 15T146 21V479ZM186 77L359 250L186 424V77'], - - // RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT - 0x22CA: [492,-8,778,146,628,'146 472Q146 479 152 485T166 492Q171 492 189 475T279 386L386 279L495 386Q598 492 608 492Q615 492 628 479V21Q615 8 608 8Q599 8 495 115L386 221L279 115Q204 40 188 24T166 8Q159 8 153 14T146 28Q146 37 253 144L359 250L253 357Q146 464 146 472ZM588 77V424L499 337L415 250L588 77'], - - // LEFT SEMIDIRECT PRODUCT - 0x22CB: [694,23,778,55,722,'55 674Q55 682 62 688T76 694H77Q83 694 100 677T208 561Q320 440 410 342Q462 286 541 201Q677 55 699 30T722 -2Q722 -9 716 -15T701 -22T688 -17Q687 -15 542 141T394 301L388 306L240 146Q119 15 101 -3T75 -22T61 -16T55 -2Q55 4 67 19T158 117Q190 151 209 172L361 336L209 500Q62 657 57 667Q55 671 55 674'], - - // RIGHT SEMIDIRECT PRODUCT - 0x22CC: [694,22,778,55,722,'84 -22T76 -22T62 -16T55 -2Q55 4 78 30T249 215Q321 293 367 342Q672 672 683 682Q695 694 702 694Q710 694 716 688T722 674Q722 668 710 653T619 555Q587 521 568 500L416 336L568 172Q715 15 720 5Q722 1 722 -2Q722 -9 716 -15T702 -22H700Q693 -22 671 1T537 146L389 306Q387 304 340 253T237 143T135 33L89 -17Q84 -22 76 -22'], - - // REVERSED TILDE EQUALS - 0x22CD: [464,-36,778,56,722,'56 433Q56 464 71 464Q74 464 77 461Q82 454 82 438T91 397T123 347Q166 307 222 307Q264 307 308 331T386 385T465 438T556 463Q631 463 676 408T722 283Q722 250 708 250Q704 250 699 257Q695 265 693 286T682 330Q670 350 655 367Q612 407 556 407Q514 407 470 383T393 329T314 276T222 251Q148 251 102 306T56 433ZM57 56Q57 71 73 76H706Q722 70 722 56Q722 44 707 36H71Q57 43 57 56'], - - // CURLY LOGICAL OR - 0x22CE: [578,21,760,83,676,'83 558Q83 566 89 572T104 578Q108 578 116 577T146 570T190 555T239 526T286 480Q308 453 325 420T351 358T367 304T376 265T380 251T381 253Q381 262 395 312Q428 434 492 499T642 576Q654 578 655 578Q664 578 670 572T676 558Q676 543 657 540T599 524T525 476Q406 362 400 29V8Q400 -21 380 -21Q369 -21 362 -11Q360 -7 360 12Q360 115 348 200T308 360T231 480T111 537Q83 540 83 558'], - - // CURLY LOGICAL AND - 0x22CF: [578,22,760,83,676,'104 -22Q95 -22 89 -16T83 -2Q83 11 98 16T135 23T192 46T256 103Q360 233 360 549Q360 554 360 557T361 563T362 567T364 569T367 572T371 576Q377 578 380 578Q401 578 401 547Q401 543 401 537T400 527Q409 53 648 19Q676 16 676 -2Q676 -10 670 -16T655 -22Q654 -22 642 -20Q556 -9 492 56T395 244Q381 294 381 303Q381 305 380 305T374 275T352 201T310 110T234 27T117 -20Q105 -22 104 -22'], - - // DOUBLE SUBSET - 0x22D0: [541,41,778,84,694,'84 250Q84 372 166 450T360 539Q361 539 370 539T395 539T430 540T475 540T524 540H679Q694 532 694 520Q694 511 681 501L522 500H470H441Q366 500 338 496T266 472Q244 461 224 446T179 404T139 337T124 250V245Q124 157 185 89Q244 25 328 7Q348 2 366 2T522 0H681Q694 -10 694 -20Q694 -32 679 -40H526Q510 -40 480 -40T434 -41Q350 -41 289 -25T172 45Q84 127 84 250ZM694 134Q694 123 679 114H425H384Q350 114 326 121T277 154Q238 193 238 251Q238 322 295 361Q318 378 339 382T412 387Q423 387 459 387T520 386H679Q694 377 694 366Q694 354 679 346H519Q493 346 458 346T411 347Q360 347 341 342T303 315Q278 287 278 250Q278 210 301 187T351 156Q358 154 519 154H679Q694 146 694 134'], - - // DOUBLE SUPERSET - 0x22D1: [541,40,778,83,693,'83 520Q83 532 98 540H251Q267 540 297 540T343 541Q427 541 488 525T605 455Q693 374 693 250Q693 165 650 99T545 0T415 -39Q407 -40 251 -40H98Q83 -32 83 -20Q83 -10 96 0H255H308H337Q412 0 439 4T512 28Q533 39 553 54T599 96T639 163T654 250Q654 341 592 411Q557 449 512 472Q468 491 439 495T335 500H306H255L96 501Q83 511 83 520ZM83 366Q83 376 96 386H244Q280 386 317 386T378 386L402 387Q456 387 498 348T540 250Q540 203 512 168T446 120Q427 114 353 114H99Q84 120 84 134Q84 147 98 154H258Q284 154 319 154T366 153Q416 153 436 158T474 185Q500 214 500 250Q500 290 477 313T426 344Q419 346 258 346H98Q83 354 83 366'], - - // DOUBLE INTERSECTION - 0x22D2: [598,22,667,55,611,'88 -21T75 -21T55 -7V200Q55 231 55 280Q56 414 60 428Q61 430 61 431Q77 500 152 549T332 598Q443 598 522 544T610 405Q611 399 611 194V-7Q604 -22 591 -22Q582 -22 572 -9L570 405Q563 433 556 449T529 485Q498 519 445 538T334 558Q251 558 179 518T96 401Q95 396 95 193V-7Q88 -21 75 -21ZM229 -21H227Q215 -21 209 -7V166Q209 304 209 327T215 363Q226 398 259 421T333 444Q380 444 414 416T455 347Q457 339 457 166V-7Q449 -21 439 -21H437H435Q423 -21 417 -7V164Q417 303 417 325T411 358Q387 403 333 403T255 358Q250 347 250 325T249 164V-7Q241 -21 231 -21H229'], - - // DOUBLE UNION - 0x22D3: [598,22,667,55,611,'591 598H592Q604 598 611 583V376Q611 345 611 296Q610 162 606 148Q605 146 605 145Q586 68 507 23T333 -22Q268 -22 209 -1T106 66T56 173Q55 180 55 384L56 585Q66 598 75 598Q85 598 95 585V378L96 172L98 162Q112 95 181 57T332 18Q415 18 487 58T570 175Q571 180 571 383V583Q579 598 591 598ZM437 598Q450 598 457 583V410Q457 237 455 229Q448 189 414 161T333 132Q291 132 255 157T211 230Q209 237 209 412L210 585Q220 598 229 598Q242 598 249 583V412Q249 273 249 251T255 218Q279 173 333 173T411 218Q416 229 416 251T417 412V583Q425 598 437 598'], - - // PITCHFORK - 0x22D4: [736,22,667,56,611,'76 -22Q64 -22 56 -7V176L57 360L59 370Q66 401 83 426T123 468T171 495T221 513T265 522T298 527L311 528H314V625L315 723Q325 736 334 736Q346 736 354 721V528H356L368 527Q380 526 399 523T441 515T490 498T537 472T578 433T606 379Q611 359 611 171V-7Q604 -21 591 -21T571 -7V170Q571 313 571 337T565 375Q555 408 526 432T461 467T402 482T365 487H354V-7Q347 -21 334 -21T314 -7V487H303Q251 484 207 467Q121 438 99 367L97 357L96 174V-9Q86 -22 76 -22'], - - // LESS-THAN WITH DOT - 0x22D6: [541,41,778,82,694,'86 261Q92 267 381 404T673 541Q680 541 686 535T693 521T689 510Q684 504 418 379L151 250L418 121Q686 -4 689 -10Q693 -14 693 -21T687 -34T675 -41Q668 -41 380 96T86 239Q82 244 82 250Q82 257 86 261ZM610 250Q610 224 592 198T531 172Q498 172 475 195Q453 214 453 250Q453 308 513 328Q515 330 535 330Q569 328 589 304T610 250'], - - // GREATER-THAN WITH DOT - 0x22D7: [541,41,778,82,693,'82 521Q82 529 89 535T100 541Q107 541 395 404T689 261Q693 257 693 250T689 239Q684 234 396 97T100 -41Q95 -41 89 -35T82 -21Q82 -12 96 -4Q118 9 358 121L624 250L358 379Q91 503 86 510Q82 514 82 521ZM165 250Q165 282 188 306T239 330Q262 330 275 323Q303 312 318 283Q322 272 322 250Q322 213 300 195Q277 172 246 172Q224 172 213 177Q165 200 165 250'], - - // VERY MUCH LESS-THAN - 0x22D8: [568,67,1333,56,1277,'639 -48Q639 -54 634 -60T619 -67H618Q612 -67 536 -26Q430 33 329 88Q61 235 59 239Q56 243 56 250T59 261Q62 266 336 415T615 567L619 568Q622 567 625 567Q639 562 639 548Q639 540 633 534Q632 532 374 391L117 250L374 109Q632 -32 633 -34Q639 -40 639 -48ZM958 -48Q958 -54 953 -60T938 -67H937Q931 -67 855 -26Q749 33 648 88Q380 235 378 239Q375 243 375 250T378 261Q381 266 655 415T934 567L938 568Q941 567 944 567Q958 562 958 548Q958 540 952 534Q951 532 693 391L436 250L693 109Q951 -32 952 -34Q958 -40 958 -48ZM1277 -48Q1277 -54 1272 -60T1257 -67H1256Q1250 -67 1174 -26Q1068 33 967 88Q699 235 697 239Q694 243 694 250T697 261Q700 266 974 415T1253 567L1257 568Q1260 567 1263 567Q1277 562 1277 548Q1277 540 1271 534Q1270 532 1012 391L755 250L1012 109Q1270 -32 1271 -34Q1277 -40 1277 -48'], - - // VERY MUCH GREATER-THAN - 0x22D9: [568,68,1333,55,1277,'75 -67Q65 -67 60 -61T55 -48Q55 -40 61 -34Q62 -32 329 109L595 250L329 391Q62 532 61 534Q55 540 55 548Q55 562 69 567H77Q81 567 222 493T506 342T653 264Q667 250 653 236Q649 234 504 157T220 7T77 -67H75ZM364 547Q364 563 381 567L384 568Q387 568 518 499T795 353T955 269Q967 261 967 250T955 231Q925 216 780 139T513 -3T383 -67Q373 -67 369 -60T364 -47Q364 -40 370 -34Q373 -31 639 109L904 250L639 391Q373 531 370 534Q364 540 364 547ZM674 538T674 548T681 562T693 567Q699 567 816 505Q915 453 993 412Q1050 382 1132 339Q1241 282 1259 271T1277 250Q1277 241 1263 232Q1246 221 985 84Q698 -67 692 -67Q674 -67 674 -47Q674 -38 680 -33Q683 -30 947 109L1213 250L947 391Q683 530 680 533Q674 538 674 548'], - - // stix-less, equal, slanted, greater - 0x22DA: [886,386,778,83,674,'674 445Q674 438 669 432T655 425T369 531T90 640Q83 645 83 655Q83 668 95 673Q644 886 654 886Q662 886 668 880T674 866Q674 856 663 850Q649 843 411 751L160 655L407 560Q474 534 561 501Q646 469 660 462T674 445ZM84 250Q84 260 99 270H658Q674 264 674 250Q674 238 659 230H98Q84 237 84 250ZM83 55Q83 68 94 73Q98 76 104 76Q108 75 383 -30T664 -138Q674 -144 674 -155Q674 -165 667 -170Q664 -173 385 -279T104 -386Q85 -386 83 -368Q83 -354 92 -349Q93 -349 347 -251L597 -155L346 -59Q296 -40 223 -12Q118 28 101 36T83 55'], - - // stix-greater, equal, slanted, less - 0x22DB: [886,386,778,83,674,'111 425T102 425T88 431T83 445V446Q83 455 96 461Q111 469 203 504Q287 536 350 560L597 655L346 751Q94 848 92 850Q83 856 83 866Q83 873 88 879T104 886Q109 885 386 779T667 670Q674 665 674 655T667 640Q665 638 388 532ZM84 250Q84 260 99 270H658Q674 264 674 250Q674 238 659 230H98Q84 237 84 250ZM653 76Q656 76 660 75T669 68T674 56Q674 46 665 40Q663 38 411 -59L160 -155L410 -251Q664 -349 665 -349Q674 -354 674 -368Q672 -386 654 -386Q650 -386 371 -279T90 -170Q83 -165 83 -155Q83 -144 93 -138Q645 76 653 76'], - - // EQUAL TO OR PRECEDES - 0x22DE: [734,0,778,83,694,'113 424Q83 424 83 444Q83 453 96 464H121Q181 466 234 474T341 501T435 545T505 613T542 707Q545 734 564 734Q583 731 583 714Q583 658 560 613T500 538T414 486T321 453T229 434T156 426T113 424ZM112 270Q83 270 83 290Q83 301 94 307Q98 310 118 310Q624 310 653 556Q657 580 675 580Q693 577 693 559V552Q684 472 628 410T465 314Q436 303 372 290Q373 290 388 287T425 278T465 266Q674 199 693 28L694 17L692 14Q691 11 689 8T683 3T673 0Q657 0 653 24Q623 270 118 270H112'], - - // EQUAL TO OR SUCCEEDS - 0x22DF: [734,0,778,83,694,'195 713Q195 725 201 729T214 734Q227 734 231 722T238 691T255 641T299 580Q405 474 656 464H681Q694 451 694 443Q694 424 670 424H664Q535 424 415 465T235 595Q195 657 195 713ZM668 310Q694 310 694 290Q694 285 691 279Q684 271 664 270Q550 268 464 257T301 220T179 146T124 27Q119 0 103 0T83 16Q83 21 83 31T92 68T113 121T157 177T229 231Q295 268 405 290Q404 290 389 293T352 302T312 314Q138 371 96 500Q83 541 83 562Q83 568 89 574T103 580Q115 580 120 570T126 542T138 497T173 442Q289 310 659 310H668'], - - // stix-not (vert) precedes or contour equals - 0x22E0: [801,303,778,82,693,'82 344Q82 349 95 364H124Q266 364 398 390L429 397L509 595Q519 619 536 659Q581 766 590 783T609 801Q616 801 622 795T629 781Q629 776 553 595Q533 548 516 506T489 439T480 415Q482 415 505 426T538 444Q632 498 651 601Q654 621 658 628T673 635Q680 635 686 629T693 615Q693 591 678 546Q636 433 484 375L458 364L451 348Q443 332 443 329T455 324Q480 316 503 307T560 277T619 233T664 170T691 86Q693 68 691 64Q684 53 672 53Q664 53 658 59Q657 60 650 97T617 174T538 244Q515 257 476 273T428 289Q425 289 412 256Q381 179 344 90L262 -103H680Q682 -105 684 -108T688 -113T691 -118T693 -124Q693 -134 682 -141L464 -143H246L213 -219Q182 -292 178 -299Q172 -303 166 -303T153 -297T146 -283Q146 -282 174 -213T202 -143H95Q82 -128 82 -123T95 -103H220L302 97Q384 288 384 299Q384 302 341 308T235 319T124 324H95Q82 337 82 344ZM399 338Q403 338 406 346L409 353L375 344Q375 343 384 341T399 338'], - - // stix-not (vert) succeeds or contour equals - 0x22E1: [801,303,778,82,694,'146 -283Q146 -282 174 -213T202 -143H95Q82 -127 82 -123T95 -103H220L300 93Q343 196 374 270Q385 294 386 299L373 295Q331 287 289 268Q241 249 208 224T159 174T135 127T124 85T118 59Q112 53 103 53Q91 53 84 64Q82 68 84 86Q96 185 174 248T375 337L400 344Q399 344 381 348T351 355T316 364T276 379T235 398T193 424T155 456T122 497T98 546Q82 587 82 615Q82 622 88 628T102 635Q112 635 116 628T124 601Q128 579 134 562T159 515T207 463T290 418T415 384L422 381L506 586Q571 744 584 772T609 801Q616 801 622 795T629 781T544 577Q525 529 504 478T473 402T462 375Q480 373 500 373Q579 364 651 364H680Q682 361 686 357T691 351T693 344Q693 337 680 324H651Q553 324 451 310L433 308L349 104L262 -101L473 -103H682Q694 -115 694 -123Q694 -133 682 -141L464 -143H246L213 -219Q182 -292 178 -299Q172 -303 166 -303T153 -297T146 -283'], - - // LESS-THAN BUT NOT EQUIVALENT TO - 0x22E6: [730,359,778,55,719,'86 450Q93 455 380 592T673 730Q680 730 686 724T693 710Q693 702 688 699Q686 693 417 568L151 439L417 310Q685 185 688 179Q693 176 693 168Q693 161 687 155T675 148Q668 148 380 285T86 428Q74 438 86 450ZM55 -205Q55 -175 64 -142T92 -76T145 -22T222 -1Q288 -1 362 -66Q369 -72 372 -75T378 -79T382 -81T384 -79Q389 -74 439 21Q483 100 490 111T504 122Q510 122 518 118T526 103Q526 101 510 69T467 -12T419 -99L413 -112L433 -128Q498 -180 553 -180Q605 -180 646 -139Q672 -112 681 -77T693 -21T706 -1Q719 -1 719 -33Q719 -39 717 -57Q708 -141 655 -190Q625 -224 586 -232Q568 -237 551 -237Q487 -237 413 -172L391 -155Q391 -157 335 -255Q297 -325 286 -342T268 -359Q260 -359 254 -353T248 -339T304 -230L359 -126Q359 -124 337 -107T302 -81Q262 -57 221 -57Q170 -57 130 -93T84 -201Q82 -236 70 -236Q55 -236 55 -205'], - - // GREATER-THAN BUT NOT EQUIVALENT TO - 0x22E7: [730,359,778,55,719,'88 723Q95 730 99 730Q106 730 394 593T688 450Q693 447 693 439T688 428Q683 423 395 286T99 148Q94 148 88 155T82 168Q82 175 86 179Q89 184 357 310L624 439L357 568Q88 694 86 699Q81 703 81 711T88 723ZM55 -205Q55 -175 64 -142T92 -76T145 -22T222 -1Q288 -1 362 -66Q369 -72 372 -75T378 -79T382 -81T384 -79Q389 -74 439 21Q483 100 490 111T504 122Q510 122 518 118T526 103Q526 101 510 69T467 -12T419 -99L413 -112L433 -128Q498 -180 553 -180Q605 -180 646 -139Q672 -112 681 -77T693 -21T706 -1Q719 -1 719 -33Q719 -39 717 -57Q708 -141 655 -190Q625 -224 586 -232Q568 -237 551 -237Q487 -237 413 -172L391 -155Q391 -157 335 -255Q297 -325 286 -342T268 -359Q260 -359 254 -353T248 -339T304 -230L359 -126Q359 -124 337 -107T302 -81Q262 -57 221 -57Q170 -57 130 -93T84 -201Q82 -236 70 -236Q55 -236 55 -205'], - - // PRECEDES BUT NOT EQUIVALENT TO - 0x22E8: [730,359,778,55,719,'95 419Q81 433 81 439T95 459H124Q318 459 455 501Q515 521 556 550T615 607T641 659T652 702T659 725Q667 730 673 730Q680 730 686 724T693 710Q693 682 677 641Q668 616 654 594T622 554T586 522T545 497T504 477T464 462T428 452T397 444T375 439Q379 437 410 430T476 411T551 379T625 321T677 237Q693 196 693 168Q693 161 687 155T673 148Q662 148 658 154T651 181Q638 253 591 300T455 377Q318 419 124 419H95ZM55 -205Q55 -175 64 -142T92 -76T145 -22T222 -1Q288 -1 362 -66Q369 -72 372 -75T378 -79T382 -81T384 -79Q389 -74 439 21Q483 100 490 111T504 122Q510 122 518 118T526 103Q526 101 510 69T467 -12T419 -99L413 -112L433 -128Q498 -180 553 -180Q605 -180 646 -139Q672 -112 681 -77T693 -21T706 -1Q719 -1 719 -33Q719 -39 717 -57Q708 -141 655 -190Q625 -224 586 -232Q568 -237 551 -237Q487 -237 413 -172L391 -155Q391 -157 335 -255Q297 -325 286 -342T268 -359Q260 -359 254 -353T248 -339T304 -230L359 -126Q359 -124 337 -107T302 -81Q262 -57 221 -57Q170 -57 130 -93T84 -201Q82 -236 70 -236Q55 -236 55 -205'], - - // SUCCEEDS BUT NOT EQUIVALENT TO - 0x22E9: [730,359,778,55,719,'679 459Q693 445 693 439Q693 430 679 419H651Q455 419 319 377Q231 347 184 300T124 181Q120 161 116 155T102 148Q95 148 89 154T82 168Q82 192 97 237Q111 275 137 306T188 355T249 391T307 414T361 429T399 439Q397 440 364 447T298 467T224 499T149 557T97 641Q82 686 82 710Q82 717 88 723T102 730L115 725Q118 722 124 697Q137 625 184 578T319 501Q456 459 651 459H679ZM55 -205Q55 -175 64 -142T92 -76T145 -22T222 -1Q288 -1 362 -66Q369 -72 372 -75T378 -79T382 -81T384 -79Q389 -74 439 21Q483 100 490 111T504 122Q510 122 518 118T526 103Q526 101 510 69T467 -12T419 -99L413 -112L433 -128Q498 -180 553 -180Q605 -180 646 -139Q672 -112 681 -77T693 -21T706 -1Q719 -1 719 -33Q719 -39 717 -57Q708 -141 655 -190Q625 -224 586 -232Q568 -237 551 -237Q487 -237 413 -172L391 -155Q391 -157 335 -255Q297 -325 286 -342T268 -359Q260 -359 254 -353T248 -339T304 -230L359 -126Q359 -124 337 -107T302 -81Q262 -57 221 -57Q170 -57 130 -93T84 -201Q82 -236 70 -236Q55 -236 55 -205'], - - // NOT NORMAL SUBGROUP OF - 0x22EA: [707,208,778,82,693,'693 -30Q686 -41 673 -41Q661 -41 506 34L346 110L280 -44Q228 -162 216 -185T193 -208Q177 -208 173 -192Q173 -186 242 -30T311 128Q271 145 184 186T86 236Q82 240 82 246Q82 251 86 259Q96 267 271 350L449 434L506 565Q537 635 551 664T571 700T582 706Q587 706 593 701T600 690Q600 679 553 572Q504 463 504 461L586 501Q672 539 673 539Q679 539 693 525V-30ZM653 10V488L566 445L480 405L422 276Q415 260 405 236T388 199T376 171T368 151T366 145Q368 143 510 77T653 10ZM422 374Q422 376 420 376T285 313T151 248Q315 168 326 163Q415 356 422 374'], - - // DOES NOT CONTAIN AS NORMAL SUBGROUP - 0x22EB: [706,208,778,82,693,'82 525Q96 539 102 539Q103 539 122 530T186 501T266 463L426 388Q428 388 495 541Q564 694 569 699Q573 706 581 706Q587 706 593 702T600 691Q600 676 533 528Q515 486 506 465T485 418T470 381T466 370Q466 369 575 316Q676 269 689 259Q693 253 693 248Q693 242 689 236Q688 235 506 145Q328 63 324 59Q324 50 266 -70Q224 -169 214 -188T193 -208Q177 -208 173 -192Q173 -183 222 -77Q244 -29 257 2T269 34L186 -6Q108 -43 99 -43Q93 -43 82 -30V525ZM271 416Q129 485 126 485H125Q122 485 122 250Q122 10 124 10L211 50L295 92L411 350Q411 351 271 416ZM624 248L449 332L440 319Q434 297 393 214Q353 121 353 119Q355 119 489 182T624 248'], - - // stix-not, vert, left triangle, equals - 0x22EC: [802,303,778,82,693,'82 -123Q82 -114 93 -103H166L238 -101L293 50Q349 200 349 204L220 266Q166 291 140 304T100 325T84 336T82 344Q82 353 94 360Q112 372 282 453L473 541L482 568Q487 578 529 693Q559 785 569 795Q573 802 581 802Q587 802 593 797T599 786Q599 775 564 675L526 570Q526 568 561 584T633 617T673 635Q679 635 693 621V66Q686 54 679 54Q665 54 526 119Q491 137 458 153T405 177T386 184Q385 182 334 42T282 -101T482 -103H680Q682 -105 684 -108T688 -113T691 -118T693 -124Q693 -134 682 -141L473 -143H266L238 -219Q217 -278 210 -290T193 -303Q178 -303 173 -287Q173 -279 198 -214L222 -145Q222 -143 158 -143L93 -141L86 -136Q82 -131 82 -123ZM653 106V584L506 513L453 370Q442 339 428 300T407 243T400 224Q403 222 527 164T653 106ZM453 486Q453 488 451 488T300 417T151 344L224 308Q247 298 285 279T331 257L364 241L453 486'], - - // stix-not, vert, right triangle, equals - 0x22ED: [801,303,778,82,693,'82 621Q96 635 102 635T249 568L420 486L449 473L469 533Q563 789 569 797Q573 801 581 801Q598 801 600 786Q602 781 544 617L484 455Q531 435 584 408Q677 364 689 355Q693 351 693 344Q693 339 692 337T676 325T631 302T538 257Q504 241 465 223T406 195T386 186Q384 184 333 44T282 -101Q282 -103 482 -103H680Q682 -105 684 -108T688 -113T691 -118T693 -124Q693 -134 682 -141L473 -143H266L238 -219Q217 -278 210 -290T193 -303Q178 -303 173 -287Q173 -279 198 -214L222 -145Q222 -143 158 -143L93 -141L86 -136Q82 -131 82 -123Q82 -114 93 -103H166L238 -101L333 159Q326 159 220 106Q110 54 97 54Q89 54 82 66V621ZM298 501Q155 567 142 575L122 584V344Q122 106 124 106Q125 106 180 132T291 185T351 213Q355 217 393 326L433 435Q433 436 298 501ZM549 381Q472 417 471 417L406 241Q408 240 516 291T624 344L549 381'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/MathOperators.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MiscMathSymbolsB.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MiscMathSymbolsB.js deleted file mode 100644 index 85e0ea9160..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MiscMathSymbolsB.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/MiscMathSymbolsB.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // BLACK LOZENGE - 0x29EB: [716,132,667,56,611,'318 709Q325 716 332 716Q340 716 344 713T474 511Q611 298 611 292Q611 285 526 152Q494 103 474 72Q347 -128 344 -130Q340 -132 333 -132T322 -130Q319 -128 257 -31T131 169T60 278Q56 285 56 292Q56 298 60 305Q73 326 194 516T318 709'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/MiscMathSymbolsB.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MiscSymbols.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MiscSymbols.js deleted file mode 100644 index 697d946c6b..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MiscSymbols.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/MiscSymbols.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // BLACK STAR - 0x2605: [694,111,944,49,895,'367 395Q374 416 398 492T442 627T463 688Q463 692 467 692Q471 694 472 694Q478 694 484 680T523 562Q553 469 576 400L577 395H731H819Q872 395 883 394T895 384Q895 380 891 376T832 333Q794 305 767 285Q643 195 643 194L690 47Q737 -96 737 -103Q737 -111 727 -111Q721 -111 594 -18L472 71L350 -18Q223 -111 217 -111Q207 -111 207 -103Q207 -96 254 47L301 194Q301 195 241 239T118 328T51 378Q49 382 49 384Q49 392 58 393T110 395H213H367'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/MiscSymbols.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MiscTechnical.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MiscTechnical.js deleted file mode 100644 index d52172dcef..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MiscTechnical.js +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/MiscTechnical.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // stix-small down curve - 0x2322: [378,-122,778,55,722,'77 122Q68 122 63 126T57 135T55 142Q55 151 68 176T111 235T177 302T271 356T388 378Q451 378 508 355T602 300T668 233T709 174T722 142Q722 124 704 122Q692 122 685 134T658 179T606 243Q511 338 390 338Q354 338 320 329Q251 312 193 263T97 141Q87 123 77 122'], - - // stix-small up curve - 0x2323: [378,-142,778,54,722,'389 143Q324 143 266 164T171 215T107 277T67 330T55 358T60 371T77 378Q85 377 92 367T116 331T158 280Q256 182 389 182Q475 182 552 227T675 351Q688 378 704 378Q722 376 722 358Q722 352 710 330T670 276T605 215T511 164T389 143'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/MiscTechnical.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/PUA.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/PUA.js deleted file mode 100644 index 021ce53ecf..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/PUA.js +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/PUA.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // ?? - 0xE006: [430,23,222,-20,240,'91 417Q104 430 111 430T131 417V301L171 341Q201 373 207 378T220 384Q227 384 233 377T240 366Q240 357 187 299L131 244V-10Q116 -23 111 -23T91 -10V201L49 157Q20 127 14 121T0 115Q-8 115 -14 121T-20 132Q-20 139 17 178Q29 191 36 199L91 257V417'], - - // ?? - 0xE007: [431,24,389,-20,407,'56 417Q68 431 76 431L89 426L96 419V317L98 215L193 273L291 330V375L293 419Q301 431 311 431Q331 431 331 388L333 355L356 370Q381 384 388 384Q394 384 400 377T407 363Q407 354 367 328L331 308V-10Q316 -23 310 -23Q300 -23 293 -12L291 135V284L98 168L96 77V-12Q84 -24 76 -24L62 -19L58 -12L56 66V144L31 128Q5 114 -2 114Q-8 114 -14 121T-20 136Q-20 142 -14 147T20 170L56 190V417'], - - // ?? - 0xE008: [605,85,778,55,719,'477 261Q477 257 473 256T455 253T417 251T348 250H235L155 -77L146 -82Q137 -85 109 -85Q55 -85 55 -77L139 261Q224 596 226 598Q229 603 239 603Q240 603 254 603T290 603T341 604T405 605T477 605Q656 603 687 602T719 596Q719 589 692 588T513 585H319L282 427L242 272Q242 270 351 270Q388 270 410 270T444 269T460 267T469 265T477 261'], - - // ?? - 0xE009: [434,6,667,37,734,'228 325Q170 322 156 316T127 309Q108 309 104 314Q99 319 99 322T108 341Q125 376 171 400T268 425H271Q302 425 319 396Q328 377 328 358Q328 332 324 314Q311 270 286 221Q274 194 274 192H275Q339 234 484 325T639 421Q669 434 691 434T723 425T734 406Q734 394 719 381Q715 376 644 330L575 287L566 267Q543 233 526 176Q520 160 515 143T508 115T506 105Q506 103 533 103Q585 103 607 110T641 118Q670 118 670 107Q670 100 661 85Q643 50 598 27T504 3Q465 3 450 36Q441 51 441 73Q441 84 444 96Q452 146 484 205L497 236L324 125Q143 12 135 10Q103 -6 77 -6Q61 -6 49 2T37 21Q37 36 49 46T124 96L195 141L204 156Q219 179 243 248T264 323Q264 325 228 325'], - - // ?? - 0xE00C: [752,284,778,81,694,'86 472Q93 477 381 614T673 752Q680 752 686 746T693 732T689 721Q686 715 418 590L151 461L418 332Q684 207 689 201Q693 195 693 190Q693 183 687 177T675 170Q668 170 380 307T86 450Q82 454 82 461Q82 467 86 472ZM369 101V126Q369 156 382 156H384Q385 157 386 157Q409 157 409 115V98V54H680Q693 39 693 34T680 14H409V-142H680Q693 -155 693 -162Q693 -167 680 -182H409V-273Q396 -284 388 -284Q382 -284 369 -275V-182H95Q82 -167 82 -162Q82 -155 95 -142H369V14H95Q93 17 89 21T84 27T82 34T83 40T89 47T95 54H369V101'], - - // ?? - 0xE00D: [752,284,778,81,693,'89 745Q95 752 100 752Q106 752 394 615T689 472Q693 468 693 461T689 450Q684 445 396 308T100 170Q95 170 89 176T82 190Q82 195 86 201Q91 208 358 332L624 461L358 590Q90 715 86 721Q82 725 82 731Q82 739 89 745ZM369 101V126Q369 156 382 156H384Q385 157 386 157Q409 157 409 115V98V54H680Q693 39 693 34T680 14H409V-142H680Q693 -155 693 -162Q693 -167 680 -182H409V-273Q396 -284 388 -284Q382 -284 369 -275V-182H95Q82 -167 82 -162Q82 -155 95 -142H369V14H95Q93 17 89 21T84 27T82 34T83 40T89 47T95 54H369V101'], - - // stix-not greater, double equals - 0xE00E: [919,421,778,82,694,'97 172Q82 172 82 190Q82 197 86 201Q94 209 173 246T327 319T402 357Q405 360 434 448T462 539L278 628Q96 713 86 721Q82 725 82 732T88 745T102 752Q103 752 125 742T198 709T293 666Q342 642 385 622T453 590T478 579Q479 579 506 659T562 824T598 915Q602 919 609 919T622 913T629 901Q629 898 571 728Q546 656 531 608T518 559Q555 539 602 519Q664 488 679 479T694 461Q694 457 689 450Q680 443 616 413T494 356T435 326L389 190L342 57L513 55H682Q694 43 694 34Q694 28 689 21L682 17L506 15H329L322 -8Q320 -13 310 -41T295 -85L275 -141H680Q682 -143 684 -146T688 -151T691 -156T693 -162Q693 -172 682 -179L473 -181H262L220 -303Q192 -388 185 -404T166 -421Q160 -421 153 -415T146 -403Q146 -400 179 -302T220 -185Q220 -181 158 -181L93 -179L86 -174Q82 -169 82 -161Q82 -152 93 -141H164L233 -139L260 -63L286 15H189L93 17L86 21Q82 26 82 34Q82 44 93 55H198L300 57L342 179Q350 204 361 238T378 286T382 301L246 237Q111 172 97 172ZM624 461Q621 464 560 492Q512 518 503 518Q500 518 500 517Q499 513 488 479T465 413T453 379L624 461'], - - // stix-not greater-or-equal, slanted - 0xE00F: [801,303,778,82,694,'97 54Q82 54 82 72Q82 79 86 84Q95 91 222 153L351 215L398 324L442 433L258 519Q95 597 87 604Q82 608 82 615T88 628T102 635Q107 635 424 484L458 468L524 630Q593 789 597 795Q601 801 609 801Q616 801 622 795T629 781L562 615L493 450L589 406Q665 371 679 362T694 344Q694 339 693 337T677 326T631 302T538 257Q504 241 465 223T406 195T386 186Q383 185 344 92T306 -3L486 81Q662 168 673 168Q680 168 686 162T693 148T689 137Q688 136 482 35L280 -59L233 -176Q184 -291 178 -299Q172 -303 166 -303T153 -297T146 -283Q146 -279 185 -186T224 -90Q225 -88 223 -88Q219 -88 193 -101Q109 -143 98 -143Q82 -138 82 -122Q82 -116 85 -113T108 -98T171 -67L249 -30L289 61Q297 81 307 107T321 144T326 157L218 106Q109 54 97 54ZM553 379Q480 412 480 415Q479 415 460 372T423 285T406 241Q408 240 516 291T624 344L553 379'], - - // stix-not less-or-equal, slanted - 0xE010: [801,303,778,81,694,'102 168Q103 168 151 146T247 102T295 81Q299 85 322 144T344 206L218 268Q153 297 123 313T87 333T82 344T86 355Q104 369 291 455Q491 552 491 553L542 673Q581 767 590 784T609 801Q616 801 622 795T629 781Q629 773 586 677Q546 581 546 577L609 606Q669 635 673 635Q680 635 686 629T693 615Q693 610 692 608T670 593T604 561L524 521L400 226L542 157Q617 123 649 107T687 85T694 72Q694 66 690 60T679 54Q665 54 526 119Q394 186 386 186Q385 186 342 88L331 61L509 -23Q680 -105 688 -111Q693 -115 693 -122T688 -135T675 -141H673Q664 -141 491 -59Q320 21 316 21H315L249 -136Q183 -293 178 -299Q172 -303 166 -303T153 -297T146 -283Q146 -282 154 -261T181 -197T213 -119L280 41Q280 46 186 86Q157 101 121 119Q92 133 87 136T82 148Q82 155 88 161T102 168ZM418 370L466 495Q464 495 308 420T151 344T204 317T311 267T364 244Q364 247 418 370'], - - // stix-not less, double equals - 0xE011: [919,421,778,82,694,'82 34Q82 44 93 55H198L300 57L342 179Q351 207 362 238T378 286T384 303T238 377Q109 435 86 450Q82 454 82 460T86 472Q90 476 302 579L511 679Q512 679 553 795Q569 842 577 866T592 903T600 917T608 919Q615 919 622 912T629 901Q629 899 595 799Q589 777 581 753T569 717T564 703L618 728Q666 752 673 752T686 746T693 732Q693 723 683 717T615 683L546 650L491 488Q464 410 450 368T438 326Q493 297 562 266Q660 219 677 209T694 190Q694 183 690 177T678 171Q664 171 546 228L424 286Q422 286 382 172L342 57L513 55H682Q694 43 694 34Q694 28 689 21L682 17L506 15H329L322 -8Q320 -13 310 -41T295 -85L275 -141H680Q682 -143 684 -146T688 -151T691 -156T693 -162Q693 -172 682 -179L473 -181H262L220 -303Q192 -388 185 -404T166 -421Q160 -421 153 -415T146 -403Q146 -400 179 -302T220 -185Q220 -181 158 -181L93 -179L86 -174Q82 -169 82 -161Q82 -152 93 -141H164L233 -139L260 -63L286 15H189L93 17L86 21Q82 26 82 34ZM495 623Q495 626 493 626T321 544T151 461L398 343Q399 343 405 360T423 415T446 483Q457 513 469 551T488 606T495 623'], - - // stix-not subset, double equals - 0xE016: [828,330,778,82,694,'82 -6Q82 1 95 14H262L295 94Q331 171 331 174Q324 175 312 178T267 194T206 227T146 283T98 368Q84 406 84 461T98 554Q126 632 194 685T349 750Q360 752 480 752H591L604 783Q620 819 624 821Q631 828 640 828Q653 825 658 810Q658 808 646 781L635 754Q635 752 658 752Q680 752 686 746Q693 739 693 732Q693 728 692 726T686 719T680 712H615L506 466Q479 407 451 344T408 248T393 214Q393 210 535 210H680Q693 194 693 190T680 170H373L340 92L304 14H680Q693 1 693 -6Q693 -11 680 -26H286L253 -103L218 -179L451 -181H682Q694 -193 694 -201Q694 -212 682 -219L440 -221H200L178 -270Q160 -309 154 -319T139 -330Q122 -330 118 -312L155 -223Q155 -221 126 -221H95Q82 -206 82 -201T95 -181H175L206 -108Q237 -35 242 -30Q242 -26 169 -26H95Q82 -11 82 -6ZM571 710Q571 712 469 712Q443 712 416 712T371 711T351 710Q279 700 221 656T138 548Q124 508 124 461T138 374Q186 245 351 212L460 459Q571 709 571 710'], - - // ?? - 0xE017: [752,332,778,81,694,'82 -14T82 -7T95 15H431L529 170H435Q341 170 333 175Q149 218 98 368Q84 406 84 461Q84 515 98 555Q126 633 193 686T346 750Q347 750 373 750T440 751T520 752H680Q693 739 693 732Q693 727 680 712H526Q364 712 353 710Q268 700 207 646T126 512Q123 496 123 461T126 410Q141 350 180 304T280 232Q312 217 344 214T464 210H555L589 261Q613 301 620 311T635 321Q644 321 650 315T657 301Q657 296 651 286T630 252T604 212Q604 210 642 210H680Q693 197 693 190Q693 186 692 184T686 177T680 170H578L526 92L478 17L580 15H682Q693 4 693 -4T680 -25H451L353 -179L518 -181H682Q694 -193 694 -201Q694 -211 682 -219L504 -221H326L293 -272Q257 -332 246 -332Q238 -332 232 -326T225 -313Q225 -310 226 -308Q226 -305 251 -265T278 -223Q278 -221 186 -221H95Q93 -218 89 -214T84 -208T82 -201T95 -181H306L404 -25H249L93 -23L86 -19Q82 -14 82 -7'], - - // stix-not superset, double equals - 0xE018: [828,330,778,82,694,'82 732Q82 739 95 752H251H348Q420 752 460 744T551 708Q566 697 566 701Q618 815 624 821Q631 828 640 828Q653 825 658 810L600 677Q600 671 615 656T653 605T689 517Q692 496 692 461T689 406Q668 325 615 266Q572 221 513 196T391 170H373L340 92L304 14H680Q693 1 693 -6Q693 -11 680 -26H286L253 -103L218 -179L451 -181H682Q694 -193 694 -201Q694 -212 682 -219L440 -221H200L178 -270Q160 -309 154 -319T139 -330Q122 -330 118 -312L155 -223Q155 -221 126 -221H95Q82 -206 82 -201T95 -181H175L206 -108Q237 -35 242 -30Q242 -26 169 -26H95Q82 -11 82 -6Q82 1 95 14H262L295 92L331 170H95Q93 172 91 175T87 180T84 185T82 191Q82 199 93 210H220L349 212L549 659Q507 692 462 702T338 712H249H95Q82 727 82 732ZM652 473Q652 513 636 552T603 611T582 632Q581 632 487 422T393 210Q424 210 460 220T535 253T605 316T649 410Q652 427 652 461V473'], - - // ?? - 0xE019: [752,333,778,82,693,'82 732Q82 739 95 752H251Q415 752 426 750Q539 736 615 657Q667 599 689 517Q692 496 692 461T689 406Q668 325 615 266Q522 170 382 170H355L326 95Q319 80 311 59T298 28T293 17Q293 15 486 15H680Q693 0 693 -6T680 -25H275L213 -179L449 -181H682Q693 -192 693 -199T680 -221H198L178 -270Q153 -333 139 -333Q132 -333 126 -327T119 -314T135 -266T153 -223Q153 -221 124 -221H95Q82 -207 82 -201T95 -181H171L233 -25H162L93 -23L86 -19Q82 -14 82 -7T95 15H251L313 170H202L93 172L86 177Q82 182 82 190Q82 199 93 210H211L329 212L349 261Q366 301 372 311T386 321Q392 321 399 315T407 302Q407 295 390 254T373 210Q374 209 377 209Q412 209 444 217Q512 231 564 273T638 377Q651 414 651 461Q651 509 638 548Q613 613 555 656T422 710Q411 712 249 712H95Q82 727 82 732'], - - // ?? - 0xE01A: [634,255,778,84,694,'693 -115T693 -122T680 -144H315L269 -199Q221 -255 213 -255H212Q203 -255 197 -248T193 -231Q195 -225 229 -184L262 -144H186L113 -142L106 -137Q102 -130 102 -125Q102 -119 115 -104H298L426 52H386Q342 54 309 63Q236 79 180 129T98 249Q84 289 84 343Q84 398 98 436Q126 514 193 567T346 632Q347 632 373 632T440 633T520 634H680Q682 631 686 627T691 621T693 614T680 594H526Q364 594 353 592Q268 581 207 528T126 394Q123 378 123 343T126 292Q141 231 181 185T280 114Q329 92 415 92H462L506 147Q554 203 562 203H563Q572 203 578 196T582 178Q579 173 546 132L513 94L598 92H682Q693 81 693 73T680 52H480L349 -102L515 -104H682Q693 -115 693 -122'], - - // ?? - 0xE01B: [634,254,778,82,691,'82 610T82 614T83 620T89 627T95 634H251Q378 634 409 633T469 623Q540 604 596 554T678 436Q691 397 691 343T678 249Q653 181 597 131T469 63Q427 52 362 52H315L213 -102L438 -104H662Q673 -115 673 -123Q673 -129 660 -144H186L151 -197Q114 -250 109 -253Q106 -254 104 -254Q100 -254 98 -253Q91 -253 87 -248T82 -235Q82 -230 109 -186L138 -144H115Q82 -144 82 -125Q82 -119 95 -104H166L266 49Q266 52 182 52H95Q82 65 82 72Q82 76 83 78T89 85T95 92H295L329 143Q365 195 369 198Q372 203 380 203Q385 203 391 197T398 185Q398 184 398 184L399 182Q399 175 369 129L344 94Q344 92 376 92Q402 92 422 94Q496 104 554 147T638 256Q651 295 651 343Q651 390 638 429Q613 494 555 537T422 592Q411 594 249 594H95Q82 610 82 614'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/PUA.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/SpacingModLetters.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/SpacingModLetters.js deleted file mode 100644 index ccd6c6de30..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/SpacingModLetters.js +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/SpacingModLetters.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // MODIFIER LETTER CIRCUMFLEX ACCENT - 0x2C6: [845,-561,2333,-14,2346,'1 561Q-3 563 -6 577T-12 604L-14 618Q-14 625 -7 628T23 635Q31 636 36 637Q63 641 621 745Q1148 845 1165 845Q1167 845 1752 739L2338 630Q2346 630 2346 618Q2340 565 2332 561Q2329 561 1749 654Q1617 675 1466 699T1241 736T1167 748Q1165 748 1093 737T867 700T583 654Q3 561 1 561'], - - // SMALL TILDE - 0x2DC: [899,-628,2333,1,2330,'804 788Q717 788 606 772T397 732T213 685T75 645T18 628Q11 628 11 632Q8 637 4 668T2 704Q2 713 36 732Q55 739 242 795Q622 898 826 898Q893 898 947 895Q1009 887 1056 872T1187 819Q1286 776 1356 758T1527 739Q1614 739 1725 755T1934 795T2118 842T2256 882T2313 899Q2320 899 2320 895Q2323 890 2327 860T2329 824Q2329 818 2296 795Q2273 787 2089 732Q1810 657 1598 632Q1562 629 1492 629Q1389 629 1320 644T1144 708Q1048 751 977 769T804 788'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/SpacingModLetters.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/SuppMathOperators.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/SuppMathOperators.js deleted file mode 100644 index 8f8bfdfe5c..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/SuppMathOperators.js +++ /dev/null @@ -1,95 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/AMS/Regular/SuppMathOperators.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_AMS'], - { - // LOGICAL AND WITH DOUBLE OVERBAR - 0x2A5E: [813,97,611,54,555,'55 795Q56 806 70 813H540Q554 806 555 795Q555 791 554 788T552 783T549 779T546 777T542 775T539 773H71Q70 773 68 774T65 776T61 779T58 783T56 788T55 795ZM55 601Q56 612 70 619H540Q554 612 555 601Q555 597 554 594T552 589T549 585T546 583T542 581T539 579H71Q70 579 68 580T65 582T61 585T58 589T56 594T55 601ZM75 -97Q67 -97 61 -91T55 -81Q55 -71 169 166T285 410Q295 425 305 425Q311 425 316 422T323 414L325 410Q327 404 441 167T555 -81Q555 -85 549 -91T535 -97T520 -90Q519 -89 506 -61T463 27T411 136L305 358L199 136Q167 71 129 -10Q98 -75 92 -86T75 -97'], - - // LESS-THAN OR SLANTED EQUAL TO - 0x2A7D: [636,138,778,83,694,'674 636Q682 636 688 630T694 615T687 601Q686 600 417 472L151 346L399 228Q687 92 691 87Q694 81 694 76Q694 58 676 56H670L382 192Q92 329 90 331Q83 336 83 348Q84 359 96 365Q104 369 382 500T665 634Q669 636 674 636ZM94 170Q102 172 104 172Q110 171 254 103T535 -30T678 -98Q694 -106 694 -118Q694 -136 676 -138H670L382 -2Q92 135 90 137Q83 142 83 154Q84 164 94 170'], - - // GREATER-THAN OR SLANTED EQUAL TO - 0x2A7E: [636,138,778,82,694,'83 616Q83 624 89 630T99 636Q107 636 253 568T543 431T687 361Q694 356 694 346T687 331Q685 329 395 192L107 56H101Q83 58 83 76Q83 77 83 79Q82 86 98 95Q117 105 248 167Q326 204 378 228L626 346L360 472Q291 505 200 548Q112 589 98 597T83 616ZM674 172Q692 172 694 154Q694 142 687 137Q685 135 395 -2L107 -138H101Q83 -136 83 -118Q83 -106 96 -100Q100 -98 380 35T665 170T674 172'], - - // LESS-THAN OR APPROXIMATE - 0x2A85: [762,290,778,55,722,'667 761Q669 762 673 762Q682 762 688 756T694 741Q694 731 687 727Q684 724 420 613L156 502L416 392Q476 367 544 338T647 295T682 280Q694 274 694 262Q694 244 676 242Q670 242 524 303T235 425T90 487Q83 493 83 501Q83 514 94 519Q97 520 378 639T667 761ZM55 -23Q55 43 103 90T223 138Q265 138 316 114Q342 100 393 68L443 36Q502 0 554 0Q609 0 650 32T694 109Q694 138 708 138Q710 138 713 136T719 127T722 108Q722 37 673 -9T557 -56Q514 -56 468 -35T387 13T308 60T223 82Q167 82 127 50T83 -27Q81 -56 69 -56Q55 -56 55 -23ZM55 -257Q55 -191 103 -144T223 -96Q265 -96 316 -120Q342 -134 393 -166L443 -198Q502 -234 554 -234Q609 -234 650 -202T694 -125Q694 -96 708 -96Q710 -96 713 -98T719 -107T722 -126Q722 -197 673 -243T557 -290Q514 -290 468 -269T387 -221T308 -174T223 -152Q167 -152 127 -184T83 -261Q80 -290 69 -290Q55 -290 55 -257'], - - // GREATER-THAN OR APPROXIMATE - 0x2A86: [762,290,778,55,722,'90 727Q83 734 83 743Q83 751 89 756T104 762Q111 760 396 641Q686 518 687 517Q694 512 694 502T687 487Q686 486 543 425T253 303T101 242Q83 244 83 262Q83 274 95 280Q96 280 130 294T232 338T361 392L621 502L357 613Q93 724 90 727ZM55 -23Q55 43 103 90T223 138Q265 138 316 114Q342 100 393 68L443 36Q502 0 554 0Q609 0 650 32T694 109Q694 138 708 138Q710 138 713 136T719 127T722 108Q722 37 673 -9T557 -56Q514 -56 468 -35T387 13T308 60T223 82Q167 82 127 50T83 -27Q81 -56 69 -56Q55 -56 55 -23ZM55 -257Q55 -191 103 -144T223 -96Q265 -96 316 -120Q342 -134 393 -166L443 -198Q502 -234 554 -234Q609 -234 650 -202T694 -125Q694 -96 708 -96Q710 -96 713 -98T719 -107T722 -126Q722 -197 673 -243T557 -290Q514 -290 468 -269T387 -221T308 -174T223 -152Q167 -152 127 -184T83 -261Q80 -290 69 -290Q55 -290 55 -257'], - - // LESS-THAN AND SINGLE-LINE NOT EQUAL TO - 0x2A87: [636,241,778,82,694,'380 497Q445 528 522 564T636 618T673 635Q680 635 686 628T693 615T689 603Q686 599 418 472L151 343L418 215Q686 88 689 83Q693 79 693 72T687 59T675 52Q669 52 381 189T86 332Q82 337 82 344Q82 350 86 355Q91 359 380 497ZM82 -130T82 -124T95 -103H380L431 -54Q476 -6 486 -6Q491 -6 498 -12T505 -27Q505 -28 505 -29T504 -32Q503 -33 498 -38T485 -53T469 -70L438 -103H680Q682 -106 686 -110T691 -116T693 -123Q693 -130 680 -143H398L346 -192Q300 -241 291 -241Q271 -241 271 -221Q271 -209 306 -179L340 -143H95Q82 -130 82 -124'], - - // GREATER-THAN AND SINGLE-LINE NOT EQUAL TO - 0x2A88: [635,241,778,82,693,'82 614Q82 620 86 625T94 632T100 635Q106 635 394 498T689 355Q693 349 693 343Q693 338 689 332Q683 327 395 190T100 52Q95 52 89 58T82 72Q82 80 95 88Q114 99 358 215L624 343L358 472Q89 599 86 603Q82 607 82 614ZM82 -130T82 -124T95 -103H380L431 -54Q476 -6 486 -6Q491 -6 498 -12T505 -27Q505 -28 505 -29T504 -32Q503 -33 498 -38T485 -53T469 -70L438 -103H680Q682 -106 686 -110T691 -116T693 -123Q693 -130 680 -143H398L346 -192Q300 -241 291 -241Q271 -241 271 -221Q271 -209 306 -179L340 -143H95Q82 -130 82 -124'], - - // LESS-THAN AND NOT APPROXIMATE - 0x2A89: [761,387,778,57,718,'86 512Q93 518 381 639T673 761Q680 761 686 755T693 741Q693 733 688 730Q685 723 419 612L155 501L419 390Q685 277 688 272Q693 269 693 261Q693 254 687 248T675 241Q669 241 381 362T86 490Q74 500 86 512ZM70 -59Q57 -59 57 -24Q57 40 104 87Q116 102 146 118Q186 136 231 136Q232 136 242 135T258 133T276 128T302 118T334 101T377 74Q386 69 396 63T411 53T417 50Q435 87 453 134Q491 223 495 227Q498 230 505 230Q513 230 519 225T526 212Q526 203 491 118T453 30Q453 22 489 10T553 -3Q589 -3 622 14Q653 28 669 50T688 90T694 122T706 136Q718 136 718 114Q718 113 718 109T717 103Q717 31 668 -14T554 -60Q529 -60 499 -50T451 -32T433 -24Q431 -24 404 -90T375 -157Q375 -159 402 -178T473 -218T553 -239Q599 -239 641 -211T691 -130Q694 -99 706 -99T718 -122Q718 -123 718 -127T717 -133Q717 -204 668 -249T559 -295Q512 -295 470 -275T355 -206L322 -290Q313 -310 304 -332T289 -367T282 -382Q277 -387 270 -387Q262 -387 255 -382T248 -368Q248 -361 322 -186Q311 -177 280 -166T222 -155Q189 -155 153 -173Q122 -186 106 -208T87 -248T82 -280T71 -294Q57 -294 57 -259Q57 -195 104 -148Q122 -126 155 -113T220 -99Q245 -99 276 -109T324 -127T342 -135Q397 -2 397 1Q386 10 367 23T302 58T222 80Q175 80 132 52T84 -28Q82 -59 70 -59'], - - // GREATER-THAN AND NOT APPROXIMATE - 0x2A8A: [761,387,778,57,718,'86 730Q81 734 81 740Q81 747 88 754T99 761Q103 761 392 640T688 512Q693 509 693 501T688 490Q682 484 394 363T99 241Q94 241 88 248T82 261Q82 268 86 272Q89 277 355 390L619 501L355 612Q89 723 86 730ZM70 -59Q57 -59 57 -24Q57 40 104 87Q116 102 146 118Q186 136 231 136Q232 136 242 135T258 133T276 128T302 118T334 101T377 74Q386 69 396 63T411 53T417 50Q435 87 453 134Q491 223 495 227Q498 230 505 230Q513 230 519 225T526 212Q526 203 491 118T453 30Q453 22 489 10T553 -3Q589 -3 622 14Q653 28 669 50T688 90T694 122T706 136Q718 136 718 114Q718 113 718 109T717 103Q717 31 668 -14T554 -60Q529 -60 499 -50T451 -32T433 -24Q431 -24 404 -90T375 -157Q375 -159 402 -178T473 -218T553 -239Q599 -239 641 -211T691 -130Q694 -99 706 -99T718 -122Q718 -123 718 -127T717 -133Q717 -204 668 -249T559 -295Q512 -295 470 -275T355 -206L322 -290Q313 -310 304 -332T289 -367T282 -382Q277 -387 270 -387Q262 -387 255 -382T248 -368Q248 -361 322 -186Q311 -177 280 -166T222 -155Q189 -155 153 -173Q122 -186 106 -208T87 -248T82 -280T71 -294Q57 -294 57 -259Q57 -195 104 -148Q122 -126 155 -113T220 -99Q245 -99 276 -109T324 -127T342 -135Q397 -2 397 1Q386 10 367 23T302 58T222 80Q175 80 132 52T84 -28Q82 -59 70 -59'], - - // LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN - 0x2A8B: [1003,463,778,83,694,'674 1003Q681 1003 687 999T694 983Q694 973 683 967Q669 959 420 868L162 772L422 676Q683 579 685 577Q694 571 694 560Q694 550 687 546T673 541Q669 542 384 647T93 755Q83 760 83 772Q83 783 91 788Q98 791 383 897T674 1003ZM84 354T84 367T98 387H679Q694 379 694 367Q694 354 679 347H98Q84 354 84 367ZM84 160T84 173T98 193H679Q694 185 694 173Q694 160 679 153H98Q84 160 84 173ZM94 -3Q102 -1 104 -1Q107 -2 392 -107T684 -215Q694 -219 694 -232Q694 -241 687 -247Q686 -248 395 -357Q106 -463 101 -463Q83 -461 83 -443Q83 -431 94 -426Q97 -423 357 -328L615 -232L355 -136Q94 -39 92 -37Q83 -31 83 -21Q83 -9 94 -3'], - - // GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN - 0x2A8C: [1003,463,778,83,694,'104 541Q98 541 91 545T83 560Q83 571 92 577Q94 579 355 676L615 772L357 868Q108 959 94 967Q83 973 83 983Q83 989 87 996T104 1003Q109 1002 396 896T687 787Q694 781 694 772Q694 759 684 755Q678 752 393 647T104 541ZM84 367Q84 380 98 387H679Q694 379 694 367Q694 356 680 348L390 347H100Q84 352 84 367ZM84 173Q84 188 100 193H680Q694 183 694 173Q694 160 679 153H98Q84 160 84 173ZM674 -1Q682 -1 688 -6T694 -20Q694 -31 685 -37Q683 -39 422 -136L162 -232L420 -328Q680 -423 683 -426Q694 -431 694 -443Q694 -461 676 -463Q671 -463 382 -357Q91 -248 90 -247Q83 -242 83 -232Q83 -220 93 -215Q667 -1 674 -1'], - - // SLANTED EQUAL TO OR LESS-THAN - 0x2A95: [636,138,778,83,694,'674 636Q682 636 688 631T694 616Q694 605 687 601Q685 599 395 462L107 326H101Q83 328 83 345Q83 358 96 365Q102 367 382 500T665 634Q671 636 674 636ZM674 442Q692 442 694 424Q694 412 687 407Q686 406 417 278L151 152L399 34Q687 -102 691 -107Q694 -113 694 -118Q694 -136 676 -138H670L382 -2Q92 135 90 137Q83 142 83 154Q84 165 96 171Q104 175 382 306T665 440Q669 442 674 442'], - - // SLANTED EQUAL TO OR GREATER-THAN - 0x2A96: [636,138,778,83,694,'83 616Q83 624 89 630T99 636Q107 636 253 568T543 431T687 361Q694 354 694 346Q694 328 676 326H670L382 462Q317 493 226 535Q119 585 101 595T83 616ZM94 440Q102 442 104 442Q110 441 254 373T535 240T678 172Q679 172 680 171Q694 164 694 153T687 137Q685 135 395 -2L107 -138H101Q83 -136 83 -118Q83 -106 93 -101L128 -84Q163 -68 230 -36T361 26L626 152L360 278Q91 406 90 407Q83 412 83 424Q84 434 94 440'], - - // PRECEDES ABOVE NOT EQUAL TO - 0x2AB5: [752,286,778,82,693,'653 734Q653 738 660 745T673 752T686 745T693 723Q672 555 466 485Q390 463 378 463Q373 463 373 461Q373 458 378 458Q390 458 466 436Q562 404 620 350Q682 283 693 198Q693 183 686 176Q681 170 674 170T660 176T653 187Q653 192 652 200T646 228T631 265T602 307T555 350Q435 431 151 441H95Q82 454 82 460T95 481H151Q165 482 197 483T238 485Q427 500 528 554T649 707Q653 729 653 734ZM82 33Q82 37 83 40T89 47T95 54H473L520 105Q569 156 571 156Q573 157 578 157Q586 157 592 151T598 136Q598 130 562 92L526 56L604 54H682Q693 43 693 35Q693 31 692 28T686 21T680 14H489L342 -139L513 -142H682Q693 -148 693 -160Q693 -167 680 -182H304L258 -230Q248 -240 237 -251T221 -268T211 -278T203 -284T197 -286Q189 -286 184 -280T178 -264Q178 -257 213 -219L249 -182H171L93 -179L86 -175Q82 -170 82 -163Q82 -155 95 -142H289L360 -64L433 14H262L93 16Q82 23 82 33'], - - // SUCCEEDS ABOVE NOT EQUAL TO - 0x2AB6: [752,286,778,82,693,'693 466T693 460T680 441H624Q608 439 577 438T538 436Q349 421 248 367T126 214Q122 192 122 187Q122 183 116 177T102 170Q95 170 89 176Q82 183 82 198Q93 283 155 350Q213 404 309 436Q385 458 398 458Q402 458 402 461Q402 463 398 463Q385 463 309 485Q103 555 82 723Q82 738 89 745T102 752T115 745T122 734Q122 721 126 701T155 640T220 572Q340 490 624 481H680Q693 466 693 460ZM82 33Q82 37 83 40T89 47T95 54H473L520 105Q569 156 571 156Q573 157 578 157Q586 157 592 151T598 136Q598 130 562 92L526 56L604 54H682Q693 43 693 35Q693 31 692 28T686 21T680 14H489L342 -139L513 -142H682Q693 -148 693 -160Q693 -167 680 -182H304L258 -230Q248 -240 237 -251T221 -268T211 -278T203 -284T197 -286Q189 -286 184 -280T178 -264Q178 -257 213 -219L249 -182H171L93 -179L86 -175Q82 -170 82 -163Q82 -155 95 -142H289L360 -64L433 14H262L93 16Q82 23 82 33'], - - // PRECEDES ABOVE ALMOST EQUAL TO - 0x2AB7: [761,294,778,57,717,'82 494T82 501T95 521H171Q405 527 511 569Q630 618 651 732Q652 734 653 740T655 748T658 754T663 759T672 761L686 754Q693 747 693 734Q684 668 648 623Q627 591 573 557T442 507L417 501Q428 496 442 494Q520 478 573 444T648 378Q684 333 693 267Q693 254 686 247Q673 234 659 245Q657 247 651 269Q630 383 511 432Q406 474 171 481H95Q82 494 82 501ZM70 -59Q57 -59 57 -26Q57 30 90 73T177 132Q191 136 226 136Q228 136 239 136T253 135T267 132T287 125T311 113T346 95T391 67Q462 20 502 5Q519 1 553 1Q586 1 602 5Q641 18 664 45T691 107Q694 136 704 136Q717 136 717 115V105Q717 39 671 -9T554 -58Q518 -58 481 -43T382 14Q302 63 273 74Q255 78 222 78Q188 78 173 74Q90 46 84 -28Q82 -59 70 -59ZM71 -294Q57 -294 57 -262Q57 -205 90 -162T177 -104Q191 -99 226 -99Q266 -103 277 -106Q310 -119 391 -168Q455 -212 502 -231Q519 -235 553 -235Q586 -235 602 -231Q640 -218 661 -195T686 -151T693 -115T704 -99Q717 -99 717 -121V-131Q717 -198 671 -246T556 -294Q519 -294 482 -279T382 -222Q307 -175 273 -162Q255 -157 222 -157Q188 -157 173 -162Q133 -175 110 -201T84 -264Q82 -294 71 -294'], - - // SUCCEEDS ABOVE ALMOST EQUAL TO - 0x2AB8: [761,294,778,57,717,'693 501Q693 493 679 481H604Q369 474 264 432Q143 382 124 269Q116 246 115 245Q101 234 88 247Q82 254 82 267Q89 329 126 378Q147 410 201 444T333 494L357 501Q354 502 340 505T318 510T295 516T269 525T243 535T215 548T188 565Q142 599 126 623Q89 672 82 734Q82 761 102 761L115 756Q116 755 124 732Q143 619 264 569Q371 527 604 521H679Q693 507 693 501ZM70 -59Q57 -59 57 -26Q57 30 90 73T177 132Q191 136 226 136Q228 136 239 136T253 135T267 132T287 125T311 113T346 95T391 67Q462 20 502 5Q519 1 553 1Q586 1 602 5Q641 18 664 45T691 107Q694 136 704 136Q717 136 717 115V105Q717 39 671 -9T554 -58Q518 -58 481 -43T382 14Q302 63 273 74Q255 78 222 78Q188 78 173 74Q90 46 84 -28Q82 -59 70 -59ZM71 -294Q57 -294 57 -262Q57 -205 90 -162T177 -104Q191 -99 226 -99Q266 -103 277 -106Q310 -119 391 -168Q455 -212 502 -231Q519 -235 553 -235Q586 -235 602 -231Q640 -218 661 -195T686 -151T693 -115T704 -99Q717 -99 717 -121V-131Q717 -198 671 -246T556 -294Q519 -294 482 -279T382 -222Q307 -175 273 -162Q255 -157 222 -157Q188 -157 173 -162Q133 -175 110 -201T84 -264Q82 -294 71 -294'], - - // PRECEDES ABOVE NOT ALMOST EQUAL TO - 0x2AB9: [761,337,778,57,718,'82 494T82 501T95 521H171Q256 523 317 528T441 548T543 584T613 644T651 732Q652 734 653 740T655 748T658 754T663 759T672 761L686 754Q693 747 693 734Q686 686 664 647T615 586T548 545T482 518T417 501Q419 500 451 493T517 471T590 434T657 367T693 267Q693 241 673 241Q664 241 659 245Q656 249 650 273T635 323T593 380T511 432Q406 474 171 481H95Q82 494 82 501ZM57 -26Q57 39 101 87T219 136Q254 136 277 130Q320 114 382 72Q419 50 424 45Q426 45 459 110Q496 178 497 179Q500 180 504 180Q509 180 517 175T526 161Q526 158 495 90L462 25Q462 21 502 5Q519 1 553 1Q586 1 602 5Q641 18 664 45T691 107Q694 136 706 136T718 115Q718 114 718 111T717 105Q717 39 671 -9T554 -58L459 -33Q450 -29 444 -27T437 -26L371 -155L391 -168Q485 -235 538 -235H553Q586 -235 602 -230Q683 -204 691 -128Q694 -99 706 -99T718 -120Q718 -121 718 -124T717 -130Q717 -199 670 -246T557 -294T393 -228Q353 -205 351 -201Q348 -201 315 -266Q294 -310 285 -323T268 -337Q259 -337 254 -331T248 -317Q248 -305 282 -246L313 -181Q313 -177 273 -161Q255 -157 222 -157Q188 -157 173 -161Q134 -174 113 -198T88 -242T82 -278T71 -294Q57 -294 57 -261Q57 -204 91 -161T179 -104Q195 -99 228 -99Q274 -102 315 -124Q337 -132 337 -130L404 -1L384 12Q319 58 273 74Q255 79 222 79Q188 79 173 74Q133 61 112 37T88 -7T82 -43T70 -59Q57 -59 57 -26'], - - // SUCCEEDS ABOVE NOT ALMOST EQUAL TO - 0x2ABA: [761,337,778,57,718,'693 501Q693 493 679 481H604Q548 479 509 477T418 469T331 454T257 429T194 392T150 340T124 270Q117 247 115 245Q101 236 88 247Q82 254 82 267Q89 330 126 379Q147 411 202 444T333 494L357 501Q239 531 188 565Q142 599 126 623Q89 672 82 734Q82 761 102 761L115 756Q116 755 124 732Q133 678 166 640T241 579T349 544T470 527T604 521H679Q693 507 693 501ZM57 -26Q57 39 101 87T219 136Q254 136 277 130Q320 114 382 72Q419 50 424 45Q426 45 459 110Q496 178 497 179Q500 180 504 180Q509 180 517 175T526 161Q526 158 495 90L462 25Q462 21 502 5Q519 1 553 1Q586 1 602 5Q641 18 664 45T691 107Q694 136 706 136T718 115Q718 114 718 111T717 105Q717 39 671 -9T554 -58L459 -33Q450 -29 444 -27T437 -26L371 -155L391 -168Q485 -235 538 -235H553Q586 -235 602 -230Q683 -204 691 -128Q694 -99 706 -99T718 -120Q718 -121 718 -124T717 -130Q717 -199 670 -246T557 -294T393 -228Q353 -205 351 -201Q348 -201 315 -266Q294 -310 285 -323T268 -337Q259 -337 254 -331T248 -317Q248 -305 282 -246L313 -181Q313 -177 273 -161Q255 -157 222 -157Q188 -157 173 -161Q134 -174 113 -198T88 -242T82 -278T71 -294Q57 -294 57 -261Q57 -204 91 -161T179 -104Q195 -99 228 -99Q274 -102 315 -124Q337 -132 337 -130L404 -1L384 12Q319 58 273 74Q255 79 222 79Q188 79 173 74Q133 61 112 37T88 -7T82 -43T70 -59Q57 -59 57 -26'], - - // SUBSET OF ABOVE EQUALS SIGN - 0x2AC5: [754,215,778,84,694,'84 463Q84 585 166 663T360 752Q361 752 370 752T395 752T430 752T475 753T524 753H679Q694 746 694 733Q694 724 681 714L522 713H470H441Q366 713 338 709T266 685Q244 674 224 659T179 617T139 550T124 463V458Q124 370 185 302Q244 238 328 220Q348 215 366 215T522 213H681Q694 203 694 193Q694 180 679 173H526Q510 173 480 173T434 172Q350 172 289 188T172 258Q84 340 84 463ZM84 -14T84 -1T98 19H679Q694 11 694 -1Q694 -14 679 -21H98Q84 -14 84 -1ZM84 -208T84 -195T98 -175H679Q694 -183 694 -195Q694 -208 679 -215H98Q84 -208 84 -195'], - - // SUPERSET OF ABOVE EQUALS SIGN - 0x2AC6: [754,215,778,83,694,'83 733Q83 746 98 753H251Q267 753 297 753T343 754Q427 754 488 738T605 668Q693 587 693 463Q693 378 650 312T545 213T415 174Q407 173 251 173H98Q83 180 83 193Q83 203 96 213H255H308H337Q412 213 439 217T512 241Q533 252 553 267T599 309T639 376T654 463Q654 554 592 624Q557 662 512 685Q468 704 439 708T335 713H306H255L96 714Q83 724 83 733ZM84 -14T84 -1T98 19H679Q694 11 694 -1Q694 -14 679 -21H98Q84 -14 84 -1ZM84 -208T84 -195T98 -175H679Q694 -183 694 -195Q694 -208 679 -215H98Q84 -208 84 -195'], - - // stix-subset not double equals, variant - 0x2ACB: [783,385,778,82,694,'693 221Q693 214 680 201H524Q398 201 367 202T309 212Q236 230 180 280T98 398Q84 438 84 492T98 585Q126 663 193 716T346 781Q347 781 373 781T440 782T520 783H680Q682 780 686 776T691 770T693 763T680 743H526Q364 743 353 741Q279 730 221 687T138 578Q124 540 124 492T138 405Q163 340 221 297T353 243Q364 241 526 241H680Q682 238 686 234T691 228T693 221ZM82 -48T82 -41T95 -19H462L513 41L569 105Q574 110 582 110T596 104T602 90Q602 87 600 83Q600 77 555 30L515 -17L600 -19H682Q693 -30 693 -38T680 -59H480L415 -137L349 -213L515 -215H682Q693 -226 693 -233T680 -255H313L260 -317Q224 -360 212 -372T192 -385Q184 -385 179 -377T173 -362Q174 -361 218 -306L260 -255H178L93 -253L86 -248Q82 -243 82 -235Q82 -226 93 -215H195L295 -213L362 -137L426 -59H260L93 -57L86 -53Q82 -48 82 -41'], - - // SUPERSET OF ABOVE NOT EQUAL TO - 0x2ACC: [783,385,778,82,693,'82 759T82 763T83 769T89 776T95 783H251Q378 783 409 782T469 772Q540 753 596 703T678 585Q691 546 691 492T678 398Q649 320 581 267T426 203Q415 201 251 201H95Q82 214 82 221Q82 225 83 227T89 234T95 241H249Q411 241 422 243Q496 253 554 296T638 405Q651 444 651 492Q651 539 638 578Q613 643 555 686T422 741Q411 743 249 743H95Q82 759 82 763ZM82 -48T82 -41T95 -19H462L513 41L569 105Q574 110 582 110T596 104T602 90Q602 87 600 83Q600 77 555 30L515 -17L600 -19H682Q693 -30 693 -38T680 -59H480L415 -137L349 -213L515 -215H682Q693 -226 693 -233T680 -255H313L260 -317Q224 -360 212 -372T192 -385Q184 -385 179 -377T173 -362Q174 -361 218 -306L260 -255H178L93 -253L86 -248Q82 -243 82 -235Q82 -226 93 -215H195L295 -213L362 -137L426 -59H260L93 -57L86 -53Q82 -48 82 -41'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/SuppMathOperators.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Caligraphic/Bold/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Caligraphic/Bold/Main.js deleted file mode 100644 index b2d5a83975..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Caligraphic/Bold/Main.js +++ /dev/null @@ -1,167 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Caligraphic/Bold/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Caligraphic-bold'] = { - directory: 'Caligraphic/Bold', - family: 'MathJax_Caligraphic', - id: 'MJCALB', - weight: 'bold', - skew: { - 0x41: 0.224, - 0x42: 0.16, - 0x43: 0.16, - 0x44: 0.0958, - 0x45: 0.128, - 0x46: 0.128, - 0x47: 0.128, - 0x48: 0.128, - 0x49: 0.0319, - 0x4A: 0.192, - 0x4B: 0.0639, - 0x4C: 0.16, - 0x4D: 0.16, - 0x4E: 0.0958, - 0x4F: 0.128, - 0x50: 0.0958, - 0x51: 0.128, - 0x52: 0.0958, - 0x53: 0.16, - 0x54: 0.0319, - 0x55: 0.0958, - 0x56: 0.0319, - 0x57: 0.0958, - 0x58: 0.16, - 0x59: 0.0958, - 0x5A: 0.16 - }, - - // SPACE - 0x20: [0,0,250,0,0,''], - - // DIGIT ZERO - 0x30: [460,17,575,46,528,'259 460H279Q352 460 403 444T491 378Q528 320 528 219Q528 100 475 45Q417 -17 287 -17Q152 -17 99 44T46 219Q46 246 47 265T57 318T82 376T131 422T210 454Q234 460 259 460ZM389 229V271Q389 351 371 380T280 409Q232 409 208 385Q194 371 190 345T185 229V210Q185 108 194 83Q208 35 287 35Q317 35 336 42Q372 55 380 85T389 204V229'], - - // DIGIT ONE - 0x31: [461,0,575,80,494,'119 417Q191 417 240 428T310 450T338 461Q353 461 357 452T361 400Q361 389 361 342T360 254V62H420H456Q483 62 488 58T494 35V29Q494 13 491 7T473 0Q468 0 424 1T295 2T167 1T117 0Q114 0 111 0T107 1Q96 8 96 27V35Q96 54 102 58T140 62H170H229V213Q229 363 228 363Q220 360 196 358T150 356L130 355H93Q84 360 82 365T80 386Q80 404 81 407T95 417H119'], - - // DIGIT TWO - 0x32: [460,0,575,51,517,'214 399Q202 399 191 398T175 395T170 392L171 390Q172 389 174 386T178 379T181 369T182 355Q182 328 165 312T123 296Q99 296 82 312T64 356Q64 397 105 428T253 460Q301 460 337 456T411 441T476 403T514 338Q516 328 516 310V304Q516 257 470 227Q456 217 427 205T376 184L354 176Q350 174 325 162T277 139L254 128Q414 129 428 130H439Q450 148 453 166T460 188T486 193H493Q515 193 517 178Q517 171 502 94T484 11Q481 3 472 2T410 0H269Q65 0 62 2Q55 5 53 10T51 32Q51 54 56 58Q60 62 173 131Q296 207 318 224Q368 264 368 308Q368 342 342 363T283 392T214 399'], - - // DIGIT THREE - 0x33: [461,212,575,48,526,'80 309Q80 367 131 414T276 461Q388 461 441 417T494 313Q494 265 463 223T373 155L361 151L376 147Q436 132 480 92T525 -15T487 -127T393 -192T274 -211Q179 -211 114 -167T48 -53Q48 -18 69 5T128 29Q168 29 188 5T208 -50Q208 -59 207 -67T203 -81T197 -92T190 -101T183 -109T177 -114T170 -118L167 -121Q160 -125 164 -127Q167 -129 176 -133Q215 -152 268 -152H273Q337 -152 356 -92Q364 -69 364 -14Q364 45 352 74T303 120Q287 125 240 125H230Q201 125 196 127T191 146V152Q192 170 196 173T233 178Q234 178 241 178T252 179T262 181T274 183T285 188T297 195T308 205T319 218T328 235T337 257Q345 280 345 320V330Q345 345 343 355T335 379T312 399T270 407Q226 407 177 377Q226 356 226 310Q226 270 204 253T153 235Q123 235 102 253T80 309'], - - // DIGIT FOUR - 0x34: [469,194,575,32,542,'180 0Q155 0 124 0T84 -1Q48 -1 40 3T32 27V37Q32 59 34 63T204 265T377 465Q380 468 383 468H387Q391 468 398 468T411 469Q432 469 438 468T449 459Q451 455 451 258V62H489H498Q531 62 536 58T542 31Q542 9 537 5T504 0H489H451V-132H489H498Q530 -132 536 -136T542 -163Q542 -181 538 -187T522 -194Q518 -194 483 -193T378 -192Q281 -192 256 -193L217 -194Q203 -189 203 -169V-163V-158Q203 -140 209 -136T246 -132H265H314V0H180ZM325 62V320L105 63L215 62H325'], - - // DIGIT FIVE - 0x35: [461,211,575,57,517,'131 29Q159 26 175 12T194 -13T197 -35V-41Q197 -58 195 -66Q191 -76 185 -84T173 -97T161 -105T152 -109L148 -110Q148 -112 158 -121T195 -141T252 -152Q274 -152 280 -151Q335 -137 349 -104T363 9Q363 85 356 114T322 157Q305 166 286 166Q251 166 223 154T182 131T162 109Q154 98 150 96T130 93Q107 93 102 104Q100 107 100 279V371V424Q100 461 110 461Q114 461 123 458T149 450T183 441Q234 429 286 429Q313 429 340 432T387 440T422 449T447 457T458 461Q472 461 472 435Q472 420 470 418Q464 405 438 379T352 325T226 297Q189 297 171 301H168V182Q169 182 174 185T190 194T213 205T248 213T292 217Q391 217 454 159T517 5Q517 -92 444 -151T255 -211Q167 -211 112 -160T57 -44Q57 -12 76 8T131 29'], - - // DIGIT SIX - 0x36: [660,17,575,48,526,'48 316Q48 398 70 462T124 562T198 621T274 652T339 660Q377 660 384 659Q497 632 497 532Q497 507 482 487T431 466Q397 466 381 486T365 530Q365 569 405 593Q382 603 381 603Q361 607 350 607Q316 607 279 589T221 533Q199 489 196 385L195 370Q196 371 203 379T217 395T237 410T263 424Q283 431 313 431Q409 431 468 368Q526 310 526 208Q526 131 492 81T405 5Q359 -17 289 -17Q256 -17 227 -11T163 17T105 73T65 170T48 316ZM293 380Q244 380 220 331T196 212Q196 104 216 80Q240 41 292 41Q295 41 301 41T309 42Q338 46 355 62Q372 81 375 108T379 230Q378 314 372 333Q358 375 299 380H293'], - - // DIGIT SEVEN - 0x37: [476,211,575,64,558,'95 210H88Q66 210 64 225Q64 229 82 345T102 465Q106 476 125 476H131Q162 476 162 458Q162 451 213 448Q221 448 238 447T260 446Q261 446 410 444Q436 444 468 444T509 445Q544 445 551 440T558 413V404Q558 395 547 380T478 301L392 202Q354 150 339 81T321 -104V-132Q321 -187 286 -203Q273 -211 255 -211Q236 -211 217 -199T190 -160Q189 -153 189 -130Q194 17 282 156Q309 200 370 270Q404 307 400 307H293Q151 306 146 303Q140 300 132 259T120 215Q115 210 95 210'], - - // DIGIT EIGHT - 0x38: [661,17,575,48,526,'48 164Q48 199 59 228T92 277T128 307T163 329Q159 332 155 336Q135 346 110 382Q80 427 80 477Q80 564 147 620Q202 660 264 660Q266 660 275 660T290 661Q384 661 439 619T494 506Q494 486 489 468T477 437T459 413T440 395T421 380T406 370L410 368Q414 365 421 361T437 351T456 335T476 316T495 291T511 262T522 228T526 189Q526 93 460 38T282 -17Q242 -17 205 -9T130 19T71 75T48 164ZM406 506Q406 545 379 576T283 607Q218 606 193 585T168 536Q168 522 172 513T195 490T224 471T275 443L346 403Q406 446 406 506ZM291 42Q365 42 395 70T425 134V141Q425 170 401 190T319 242Q308 248 302 251Q286 260 266 271T235 288L225 294Q222 292 217 289T198 274T175 249T157 212T148 163Q148 116 179 79T291 42'], - - // DIGIT NINE - 0x39: [461,210,575,48,526,'175 -140Q198 -152 236 -152Q294 -152 332 -116Q356 -91 366 -54T379 62V78L376 74Q372 70 366 64T352 50T333 35T308 23Q289 17 262 17Q168 17 108 77T48 235Q48 273 59 317Q81 381 141 421T276 461Q279 461 285 461T295 460Q326 460 354 454T415 426T471 371T510 277T526 136Q526 42 501 -28T432 -136T341 -192T240 -210Q199 -210 169 -201T121 -178T94 -146T80 -112T77 -82Q77 -51 95 -33T143 -15Q170 -15 189 -33T209 -81Q209 -116 175 -140ZM377 244V274Q377 300 376 316T368 352T348 384T312 405Q307 406 283 406Q257 406 238 396T213 376T205 361Q196 341 196 259V233V181Q196 122 211 96T278 69H298Q330 82 345 104Q367 134 376 190Q377 200 377 244'], - - // LATIN CAPITAL LETTER A - 0x41: [751,49,921,39,989,'761 751Q784 751 784 728V711Q784 570 795 417T820 191Q844 76 865 76Q868 76 902 93T962 112H973Q989 104 989 94Q989 92 987 86Q978 47 846 -11Q812 -25 779 -26Q722 -26 708 9Q688 47 669 161H524L379 162L359 136Q286 43 234 -3T142 -49T71 -19T39 55Q39 92 60 131T103 174Q113 174 117 167T124 149T136 128T166 110Q183 105 190 105Q230 105 341 246Q401 322 453 397T531 514T582 601T611 651H640V663Q640 692 676 718T745 750Q747 750 752 750T761 751ZM658 266Q653 312 649 377T644 489T641 541V556L557 415Q500 325 448 253Q467 261 524 261H568H658V266'], - - // LATIN CAPITAL LETTER B - 0x42: [706,17,748,40,739,'441 83Q571 83 571 195Q571 246 538 279T466 322T386 333Q378 333 357 330T329 327Q307 327 307 345Q307 354 313 365T347 396T419 430Q546 472 581 498Q594 508 594 535Q594 574 567 589T508 604Q469 604 442 583Q390 546 342 457T265 256Q237 148 186 60Q167 29 144 13Q105 -15 68 -17H65Q40 -17 40 1Q40 7 53 29T87 100T124 210Q162 373 190 575Q188 575 174 567T138 550T98 542Q75 542 75 560Q75 588 123 618Q135 625 203 659T281 696Q299 703 316 703Q339 703 339 685Q339 656 328 583L333 588Q338 592 346 599T367 615T394 634T428 654T467 674T511 690T559 701T611 705Q651 704 681 689Q739 659 739 598Q739 507 595 427L584 421Q585 420 595 416T610 410T626 402T644 392T660 380T677 365T691 347T703 325T710 299T715 268Q717 193 665 130Q622 73 531 28T348 -17Q275 -17 225 10Q206 19 200 24T193 36Q193 57 231 86T311 119H322Q386 83 441 83'], - - // LATIN CAPITAL LETTER C - 0x43: [704,20,613,20,599,'243 -20Q135 -20 78 48T20 218Q20 280 39 344T98 470T193 580T324 661T488 702H490Q491 702 493 702T498 703T507 703T518 702H526Q599 702 599 631Q599 597 577 550T541 486Q523 463 490 447T431 430Q423 430 419 433Q409 437 409 450Q410 456 432 499T454 567Q454 586 446 594T415 603Q316 603 254 532Q216 487 190 421T164 284Q164 228 181 186T226 122T282 90T340 80Q377 80 405 96T449 131T492 167T553 187H555Q580 187 580 168Q580 153 551 123T476 60T367 4T243 -20'], - - // LATIN CAPITAL LETTER D - 0x44: [686,0,892,20,885,'107 0Q92 5 92 18Q92 33 113 53T160 86Q170 91 182 94T197 100L206 120Q248 226 273 337T304 501T309 585Q278 585 234 577T179 557Q172 550 166 532T156 509Q140 484 105 466T44 447Q20 447 20 465Q20 482 34 510T76 565Q122 608 173 632Q281 686 447 686H480H517Q692 686 784 631Q885 571 885 450Q885 339 805 239T586 75T286 1Q276 0 187 0H107ZM741 391Q741 424 731 452T694 510T613 558T481 584Q476 584 468 584T457 585L449 586V579Q441 501 425 424T391 292T357 193T330 125T319 100H324Q511 100 628 175Q688 215 714 275T741 391'], - - // LATIN CAPITAL LETTER E - 0x45: [703,16,607,37,627,'495 516Q485 516 478 520T470 532Q470 537 476 550T482 570Q482 589 465 596T401 603Q344 603 319 582Q295 558 295 519Q295 493 312 474T355 445T407 432T455 427Q477 427 477 409Q477 395 453 371T389 333Q380 330 345 327T279 312T223 272Q181 223 181 176Q181 131 225 107T324 83Q366 83 395 98T448 136T487 167Q517 185 547 187H551Q574 187 574 170Q574 151 535 113T421 36T271 -15Q260 -16 226 -16Q181 -16 152 -9Q104 4 71 33T37 111Q37 140 50 176T106 263T216 356Q215 357 207 362T190 374T172 392T156 419T150 456Q150 521 208 580T341 670T474 702Q475 703 499 703Q528 703 547 701T586 693T615 673T627 637Q627 584 581 550T495 516'], - - // LATIN CAPITAL LETTER F - 0x46: [686,30,814,17,930,'812 567Q804 567 795 570T786 579Q786 586 647 586H559L558 582Q558 575 539 510T506 407L498 384H775Q788 378 790 368Q790 328 746 298T665 268Q646 268 642 284H457L447 261Q396 150 360 94Q329 46 270 8T149 -30Q123 -30 100 -24T63 -10T37 9T22 26T17 36Q17 59 56 88T135 119Q145 119 149 117T165 104Q187 78 227 72Q232 72 234 76Q245 93 273 145T350 323T424 570L428 586H276Q265 575 239 563T190 551Q180 551 174 556T167 569Q167 580 179 597T213 634T278 668T371 685Q374 686 624 686Q863 685 888 682Q917 678 927 663Q930 658 930 650Q930 624 888 596T812 567'], - - // LATIN CAPITAL LETTER G - 0x47: [703,114,682,50,671,'50 279Q50 361 88 438T190 570T335 661T503 702H514Q524 703 532 703Q671 703 671 626Q671 580 614 514T495 447Q472 447 472 465Q472 477 499 511T527 562Q527 582 507 592T433 602Q351 602 302 569Q252 535 223 469T194 344Q194 266 237 217T352 168Q401 168 442 205T505 316Q515 345 551 368T622 393H625Q649 393 649 376Q649 371 635 318T612 237Q580 129 540 62T442 -49Q353 -114 264 -114Q259 -114 252 -114L246 -113Q190 -113 142 -107T81 -96Q71 -90 71 -81Q71 -57 110 -30T187 2Q196 2 236 -4T338 -14Q371 -14 377 -9Q410 24 446 113L451 127Q353 68 253 68Q157 68 104 129T50 279'], - - // LATIN CAPITAL LETTER H - 0x48: [686,48,987,20,946,'42 447Q20 447 20 465Q20 481 47 515T119 589T239 657T392 686Q443 686 463 664T484 616Q484 570 473 506T452 401L441 360Q441 359 550 359H660L663 370Q684 435 716 522T758 624Q771 646 806 666T870 686Q894 686 894 668Q894 667 867 597T804 416T752 218Q737 135 737 93Q737 77 746 65T778 53Q799 53 803 54T814 63Q831 86 864 103T924 120Q946 120 946 100Q945 85 931 63T888 16T806 -27T684 -48H681Q625 -48 603 -10Q593 4 593 29Q593 71 603 131T624 230L634 269Q632 269 624 266Q610 261 600 261T507 259H411L399 222Q344 62 322 21Q301 -7 268 -24T209 -41H207Q187 -41 185 -25Q185 -17 192 2T220 71T261 184Q284 256 284 258Q284 259 227 259H170Q169 259 166 261T162 264T158 266T156 271T155 277Q155 296 184 320T250 356Q259 358 286 359Q312 359 312 360Q314 372 318 385Q332 450 339 526Q339 530 339 535T340 543Q340 586 296 586Q255 586 227 576T188 553T165 523T146 497Q127 476 97 462T42 447'], - - // LATIN CAPITAL LETTER I - 0x49: [687,0,642,-27,746,'56 499Q32 499 32 516Q32 540 64 580T165 649Q241 682 365 685Q366 685 376 685T405 685T445 686T496 686T553 686H732Q746 677 746 668Q746 646 711 620T642 587L572 586H503Q479 546 458 479T424 352T383 224T318 111L309 101L412 100H514L523 109Q567 150 618 153Q644 153 644 135Q644 132 642 124Q629 86 581 52T476 6Q454 2 433 2T216 0Q-11 0 -15 2Q-27 6 -27 18Q-27 37 2 61T59 93Q77 100 142 100H198Q255 177 299 369Q337 513 382 574L391 586H348Q261 586 176 576Q163 543 124 521T56 499'], - - // LATIN CAPITAL LETTER J - 0x4A: [687,114,779,53,937,'286 390Q263 390 263 407Q263 432 293 481T367 566Q511 687 724 687Q738 687 761 687T793 686H923Q937 677 937 668Q937 648 905 623T842 589Q829 587 817 586T802 585T795 583T788 578Q709 506 632 189Q622 153 615 134T588 81T537 17Q482 -39 404 -76T247 -114Q192 -114 158 -100Q53 -61 53 32Q53 59 58 73T79 102Q126 147 177 147Q200 147 200 128Q200 123 198 112T196 96Q196 47 238 17T345 -13Q362 -13 377 -9T404 0T426 16T444 34T459 55T470 76T478 97T483 116T488 132L490 141Q511 222 520 257T554 364T608 486T675 576L685 586H634H612Q532 586 484 564Q453 549 436 526T409 478T395 447Q378 424 345 407T286 390'], - - // LATIN CAPITAL LETTER K - 0x4B: [703,17,871,40,834,'98 542Q75 542 75 560Q75 588 123 618Q132 624 199 657T275 694Q291 703 315 703Q327 703 332 699T338 690T339 670Q339 596 323 505T283 337T237 194T198 90L181 53Q170 31 136 8T68 -17H65Q40 -17 40 0L76 92Q112 185 150 322T194 564V578L168 565Q125 542 98 542ZM834 142Q834 125 819 100T774 48T692 3T576 -16H560Q540 -16 508 6Q469 33 422 108T342 267T309 398Q309 411 310 417T320 442T347 482Q401 542 517 615T710 702Q712 702 721 702T735 703Q772 703 791 690Q819 674 819 646T792 597T733 574H722Q704 584 704 599Q706 607 700 610T672 617L660 613Q609 595 524 538T423 450V440Q423 376 488 247T604 83Q621 70 640 70Q677 70 701 82Q713 87 718 101T737 132T783 160Q792 163 807 163Q834 163 834 142'], - - // LATIN CAPITAL LETTER L - 0x4C: [703,17,788,41,751,'63 -17Q41 -17 41 0Q41 22 85 54Q101 68 113 92T133 141T154 219T182 315Q230 462 306 553Q345 599 391 632T478 678T543 697T582 703Q584 703 589 703T598 702Q643 702 666 676T689 613Q689 588 683 575Q674 551 632 524T552 496Q530 496 530 512Q530 517 531 525T533 538Q533 559 522 577T480 596H476Q462 596 451 588T415 544Q350 447 310 281Q284 181 261 136L255 124H285Q342 123 441 107T583 90L596 89Q603 116 647 144T729 173Q751 173 751 157Q751 118 685 60T523 -15Q514 -16 479 -16Q421 -16 320 0T171 18H155L142 10Q98 -17 63 -17'], - - // LATIN CAPITAL LETTER M - 0x4D: [703,49,1378,38,1353,'38 20Q38 59 60 99T104 139Q106 139 126 125T176 106H181Q200 106 221 139T286 281Q322 370 342 451T368 581T376 634Q384 657 420 680T487 703Q502 703 507 696T522 649Q538 589 554 537Q579 453 609 372T660 248T686 202Q687 201 739 244T830 322L1166 642Q1225 700 1230 701Q1230 701 1237 703Q1258 703 1258 667L1253 637Q1248 607 1241 558T1227 451T1214 326T1209 202Q1209 77 1232 77Q1237 77 1269 94T1326 112H1329Q1353 112 1353 94Q1353 81 1334 60Q1311 37 1248 7T1150 -24H1141H1135Q1085 -24 1074 26Q1064 75 1064 134Q1064 239 1086 426Q1087 430 1087 434L1061 410Q871 227 783 149L694 76Q653 44 647 40T631 34Q620 34 616 37T594 63Q546 125 514 198Q467 307 423 449L418 466L412 444Q376 310 306 153Q278 88 251 45T201 -18T163 -43T131 -49Q102 -48 70 -31T38 20'], - - // LATIN CAPITAL LETTER N - 0x4E: [840,49,937,-24,1105,'47 139Q81 105 122 105Q137 105 147 117Q159 134 182 199T234 381T274 610Q275 634 284 647Q297 666 327 684T389 703Q403 703 408 695T428 645Q480 490 567 298Q628 163 673 103Q674 102 674 102T675 106Q732 331 803 551Q842 674 875 725Q908 775 966 807T1081 840H1084Q1105 840 1105 803Q1105 768 1088 733T1051 689Q1045 686 1032 686Q986 683 948 663T901 624Q881 579 837 430T760 154L726 28Q725 28 725 28T723 25Q716 0 682 -24T611 -48Q600 -48 595 -45T576 -23Q522 44 480 124Q417 243 332 463L328 473L325 457Q291 293 227 124Q159 -49 72 -49Q38 -49 5 -28Q-24 -8 -24 21Q-24 58 -3 98T41 139H47'], - - // LATIN CAPITAL LETTER O - 0x4F: [704,17,906,63,882,'433 703Q456 703 456 685Q456 672 441 655T407 627Q402 623 378 611T328 579T276 524Q207 434 207 324Q207 222 270 153T441 84Q566 84 651 177T737 400V405Q737 496 693 549T576 603Q542 603 510 560Q490 537 472 502T442 454Q397 412 346 409Q320 409 320 427Q320 430 322 436Q331 465 360 507T433 594T542 671T677 703Q776 703 829 636T882 468Q882 369 831 277T702 122T528 21T343 -17Q214 -17 139 61T63 257Q63 336 94 409T173 534T272 625T367 684T432 703H433'], - - // LATIN CAPITAL LETTER P - 0x50: [686,67,810,20,846,'170 -67Q147 -67 147 -49Q147 -42 162 -8T204 99T253 254Q274 332 288 415T305 542L308 585Q277 585 234 577T179 557Q172 550 166 532T156 509Q140 484 105 466T44 447Q20 447 20 465Q20 482 34 510T76 565Q122 608 173 632Q279 686 448 686H495H537Q622 686 678 677T784 637Q846 598 846 533Q846 452 776 375T597 252T378 206H366L358 181Q341 130 316 68T282 -7Q262 -33 230 -50T170 -67ZM701 468Q701 512 661 540T570 577T461 586H448V582Q446 576 443 545T428 447T395 301L389 280Q390 280 398 284T419 295T441 303Q443 304 484 306T572 321T651 359Q701 402 701 468'], - - // LATIN CAPITAL LETTER Q - 0x51: [703,146,939,120,905,'874 453Q874 372 836 298T750 177T638 89T543 33T486 8L483 7Q485 5 523 -7T622 -32T726 -46Q741 -46 746 -45T755 -41T762 -27Q770 -1 806 23T878 50H890Q905 42 905 33Q905 -8 838 -68T670 -145Q662 -146 628 -146Q538 -146 389 -100T164 -50Q132 -50 132 -32T162 11T227 47Q231 48 286 51T394 62T518 100T641 180Q730 271 730 387Q730 478 673 540T520 602Q410 602 337 525T264 355Q264 284 310 244T420 203Q476 203 568 222Q594 222 594 204Q594 184 565 161T508 128Q433 103 316 103Q227 103 174 157T120 290Q120 382 182 471T343 620T548 697Q578 703 601 703Q604 703 611 703T623 702Q663 702 687 696Q760 679 817 618T874 453'], - - // LATIN CAPITAL LETTER R - 0x52: [686,17,990,20,981,'159 0Q159 5 172 34T205 114T245 229T284 386T309 575V585H304Q303 585 295 585T282 584Q233 579 207 570T175 553T165 531T156 509Q140 484 105 466T44 447Q20 447 20 465Q20 482 34 510T76 565Q122 608 173 632Q279 686 448 686H505H582Q683 686 745 672T834 611Q842 594 842 565Q842 523 824 484T780 419T722 370T669 336T632 318L619 312L626 302Q640 279 667 227T696 172Q717 133 735 112T762 88T784 84Q824 84 872 118T957 153Q981 153 981 136Q981 114 937 78T820 13T684 -17Q646 -17 616 8T569 66T526 151T477 234Q461 256 446 265Q437 272 421 274Q400 274 400 291Q400 311 430 336T495 371Q496 371 543 374T627 392T681 436Q699 467 699 503Q699 550 644 568T471 586H449V582Q449 581 447 559T438 499T422 413T393 298T348 165Q313 73 296 45Q282 24 249 4T185 -17Q159 -17 159 0'], - - // LATIN CAPITAL LETTER S - 0x53: [703,16,696,25,722,'204 476Q204 525 248 577T372 666T539 703T674 683T721 612Q721 588 714 569Q704 547 669 524T601 499Q573 499 573 516Q573 521 575 527T577 543Q577 563 568 574T548 588L539 590Q490 603 444 603Q418 603 394 597T364 583Q348 567 348 533Q348 493 382 466T459 425T555 387T633 330Q662 292 662 249Q662 153 544 69T257 -16Q218 -16 208 -15Q118 1 64 46Q25 76 25 126Q25 185 82 235T203 290H207Q229 290 231 274Q231 243 180 213Q173 209 172 206T170 189T171 170T183 150T216 121Q273 83 356 83Q412 83 459 100Q493 111 507 141Q518 165 518 185Q518 208 506 228T478 262T437 288T398 306T360 320Q316 335 285 352T239 384T215 416T205 443T204 467V476'], - - // LATIN CAPITAL LETTER T - 0x54: [720,69,644,38,947,'61 462H59Q38 462 38 479Q38 528 109 594T289 683L304 685L837 687L846 693Q889 720 923 720Q947 720 947 702Q945 671 892 631T776 583Q774 583 772 583T769 582T766 582L764 581H758Q753 581 744 581T722 580T693 580T662 580H563L514 385Q507 355 493 299T475 225T460 172T443 119T426 76T402 24Q386 -11 355 -33T304 -61T266 -69Q242 -69 242 -50Q243 -45 253 -25T278 32T307 115L364 340Q405 511 413 538T436 580H207Q202 572 200 568T197 561T195 552T190 537Q176 511 135 487T61 462'], - - // LATIN CAPITAL LETTER U - 0x55: [686,24,715,-10,771,'124 586Q107 586 74 569T15 552H13Q-10 552 -10 570Q-10 605 70 645T222 686Q283 686 283 631Q283 590 246 504T172 326T135 181Q135 130 157 107T205 83Q221 83 259 106Q347 165 453 301T604 548Q607 557 612 569T619 587T624 600T628 612T632 621T637 628T641 634T647 640T654 645T662 652Q706 686 748 686Q771 686 771 669Q771 656 754 614T700 467T630 229Q615 168 610 105Q610 88 617 78L641 90Q681 111 706 112Q733 112 733 95Q733 82 714 60Q694 40 633 10Q567 -23 532 -24Q507 -24 495 -17Q466 -4 466 32Q466 96 500 225Q277 -17 102 -17Q56 -17 23 17T-10 118Q-10 164 13 234T64 363T115 481T139 567Q139 586 124 586'], - - // LATIN CAPITAL LETTER V - 0x56: [686,77,737,25,774,'25 608Q25 628 60 657T148 686Q184 683 213 671T273 625T327 538T363 394T380 184L381 134L399 148Q503 226 574 302T667 415T689 467Q688 474 684 482T672 502T645 521T600 532Q576 532 576 567Q576 604 597 644T641 685H649Q701 685 737 648T774 545Q774 457 703 333T461 66Q397 13 332 -32T255 -77Q237 -77 237 -30V-23Q241 20 241 109Q241 483 115 569Q91 586 50 589Q25 589 25 608'], - - // LATIN CAPITAL LETTER W - 0x57: [686,77,1169,25,1206,'25 607Q25 629 62 657T142 686Q205 686 248 647T312 541T339 411T347 275Q347 249 345 203V189Q375 219 449 316T587 516Q629 584 629 587Q629 589 626 597T622 607Q622 629 658 656T732 686H744Q755 680 757 678Q757 677 769 649T799 577T835 475T874 339T904 183Q908 157 910 151L925 169Q997 252 1059 343T1121 474Q1120 498 1103 513T1059 532Q1036 532 1036 568Q1036 600 1053 636T1090 683L1097 686H1109Q1147 684 1176 652T1206 551Q1206 460 1131 320T897 7Q859 -33 840 -52T816 -74T804 -77Q788 -77 784 -32Q783 -28 783 -26Q774 108 744 239T691 436T665 501Q664 501 649 475T602 400T528 289T420 146T280 -15Q243 -56 231 -66T210 -77Q191 -77 191 -40Q191 -38 195 -4T204 91T209 217Q209 290 202 351T177 469T126 557T45 589Q25 589 25 607'], - - // LATIN CAPITAL LETTER X - 0x58: [687,-1,817,56,906,'762 562Q762 579 737 584T711 604Q711 630 753 658T834 686Q864 686 885 669T906 627Q906 580 834 522T614 379L584 362V357Q585 354 589 315T597 233T603 183Q610 132 627 116T671 100Q678 100 704 113T754 126T778 107Q776 79 733 45T626 2Q615 1 578 1Q542 1 535 3Q521 7 510 15T491 31T477 54T467 78T460 108T456 137T452 170T449 201Q447 220 445 240T442 270L441 281Q435 281 357 233Q240 165 206 135Q200 128 200 124Q200 113 208 108T226 101T244 96T252 82Q252 61 214 31T129 1H120Q97 1 77 16T56 60Q56 105 133 168T414 345Q428 352 431 354T433 359Q422 493 414 522Q407 551 395 566T373 583T350 586H341L332 580Q290 560 265 560Q243 560 243 577Q243 585 248 596T269 624T306 653T365 676T447 686H456Q472 686 484 683T514 671T543 637T562 576Q565 557 570 501L577 437Q577 436 613 457T694 506T756 551Q762 558 762 562'], - - // LATIN CAPITAL LETTER Y - 0x59: [686,164,759,36,797,'73 555Q49 555 49 573Q49 602 110 644T239 686Q319 686 376 624Q416 584 444 511T483 361T499 240T503 173Q503 165 504 165Q506 165 524 184T556 218Q631 297 674 377T718 485Q718 505 699 526Q673 552 628 552Q619 552 613 562T607 590Q607 617 621 645T658 685Q661 686 671 686Q718 686 757 652T797 545Q797 476 749 369T602 146Q500 29 371 -67T176 -164Q112 -164 74 -120T36 -29Q36 5 55 36T95 67Q104 67 108 59T115 39T128 12T154 -12Q183 -30 216 -30Q239 -30 305 7L361 44L367 49V54Q367 95 364 143T351 273T312 429T243 546Q206 581 156 588L146 581Q108 555 73 555'], - - // LATIN CAPITAL LETTER Z - 0x5A: [686,0,818,46,853,'622 574Q522 579 420 579H396Q373 579 364 574T351 550Q339 516 297 490T218 462Q195 462 195 479Q195 487 197 492Q218 565 313 625T509 685Q564 685 650 683T755 680Q787 680 807 683T831 686Q853 686 853 669Q853 657 826 626Q742 532 641 437L619 415L622 414Q626 414 631 414T642 414Q697 411 697 388Q697 367 670 345T607 323Q605 323 592 325T546 329H522L490 302Q457 274 400 226T289 136L260 113L318 112Q345 111 452 109T587 106H627Q650 143 656 170Q666 197 710 225T788 253Q811 253 811 237Q811 211 781 160T710 77Q619 0 515 0Q507 0 497 0T484 1Q434 1 319 3T177 6Q123 6 95 2Q83 2 71 0H68Q46 0 46 17Q46 28 58 44Q68 56 100 80T210 165T383 307L408 329H361L314 330Q297 338 297 350Q297 368 320 388T368 413Q375 415 441 415H506L647 555L664 574H622'] -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Caligraphic/Bold/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Caligraphic/Regular/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Caligraphic/Regular/Main.js deleted file mode 100644 index 12148542da..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Caligraphic/Regular/Main.js +++ /dev/null @@ -1,166 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Caligraphic/Regular/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Caligraphic'] = { - directory: 'Caligraphic/Regular', - family: 'MathJax_Caligraphic', - id: 'MJCAL', - skew: { - 0x41: 0.194, - 0x42: 0.139, - 0x43: 0.139, - 0x44: 0.0833, - 0x45: 0.111, - 0x46: 0.111, - 0x47: 0.111, - 0x48: 0.111, - 0x49: 0.0278, - 0x4A: 0.167, - 0x4B: 0.0556, - 0x4C: 0.139, - 0x4D: 0.139, - 0x4E: 0.0833, - 0x4F: 0.111, - 0x50: 0.0833, - 0x51: 0.111, - 0x52: 0.0833, - 0x53: 0.139, - 0x54: 0.0278, - 0x55: 0.0833, - 0x56: 0.0278, - 0x57: 0.0833, - 0x58: 0.139, - 0x59: 0.0833, - 0x5A: 0.139 - }, - - // SPACE - 0x20: [0,0,250,0,0,''], - - // DIGIT ZERO - 0x30: [452,22,500,39,460,'39 213Q39 274 53 319T89 389T139 429T192 448T242 452Q347 452 400 400Q460 335 460 213Q460 -22 250 -22Q39 -22 39 213ZM364 242Q364 279 363 301T355 348T338 385T306 406T254 415Q250 415 245 415T238 416Q217 416 190 404T150 368Q136 339 136 221Q136 114 146 78T200 23Q219 16 250 16Q280 16 299 23Q341 41 352 77T364 221V242'], - - // DIGIT ONE - 0x31: [453,0,500,86,426,'116 410Q176 412 215 423T269 443T288 453H291Q293 453 301 447V254Q301 62 303 60Q307 52 322 49T394 46Q418 46 422 43T426 23Q426 8 424 4T411 0Q407 0 369 1T258 2T148 1T106 0Q96 0 94 4T91 23Q91 40 95 43T123 46Q180 46 195 49T215 61Q216 63 216 220V376Q192 367 119 364H93L86 371V403L92 410H116'], - - // DIGIT TWO - 0x32: [453,0,500,44,449,'55 334Q55 386 105 419T236 453Q333 453 390 413T448 307Q448 278 437 256T406 218T365 193T318 172T277 151L248 134Q219 118 191 102T163 84T267 83L382 85H391Q399 99 406 126Q410 143 413 145T429 148Q440 148 442 147T449 139Q449 137 435 73T420 7Q420 6 414 0H233Q94 0 71 0T46 5Q46 5 46 6Q44 8 44 24Q44 39 46 41Q47 44 98 78T212 155T294 212Q347 257 347 304Q347 354 306 380T203 407Q150 407 120 377Q118 375 123 373Q146 362 146 332Q146 315 133 302T101 288Q85 288 70 298T55 334'], - - // DIGIT THREE - 0x33: [452,216,500,42,457,'69 312Q69 377 122 414T233 452Q333 452 381 409T430 313Q430 268 402 223T311 149L301 144Q307 143 317 140T355 123T402 92T439 44T456 -25Q456 -101 396 -158T241 -216Q154 -216 98 -173T42 -68Q42 -58 44 -50T50 -35T57 -25T66 -17T75 -13T82 -10L87 -8Q92 -7 102 -7Q132 -7 147 -25T162 -66Q162 -112 118 -125L113 -126Q113 -129 127 -140T173 -162T239 -173Q268 -173 292 -158Q345 -124 345 -24Q345 33 329 67Q298 125 229 125H210H172Q166 131 166 142Q166 159 172 161Q178 161 208 164T244 169Q251 169 263 176T291 199T316 245T327 314Q327 413 238 413Q182 413 130 369Q177 350 181 312Q181 289 166 273T125 257Q102 257 86 272T69 312'], - - // DIGIT FOUR - 0x34: [464,194,500,28,471,'163 0Q139 0 109 0T71 -1Q43 -1 36 2T28 15V27V46L190 270Q325 457 330 462Q333 464 352 464H371L377 458V46H464L471 40V6L464 0H377V-65V-108Q377 -131 379 -137T391 -144Q409 -148 446 -148H464Q468 -151 471 -155V-187L464 -194H453Q395 -192 325 -192Q222 -192 210 -194H199L193 -188V-154L199 -148H228Q241 -148 250 -148T265 -146T275 -145T281 -143T284 -141T286 -138T289 -134V0H163ZM295 46V350L75 46H295'], - - // DIGIT FIVE - 0x35: [453,216,500,50,448,'159 -44Q159 -66 145 -80T109 -96H102L107 -105Q148 -173 228 -173Q255 -173 280 -162Q351 -128 351 -6V8Q351 67 344 98T316 151Q288 176 255 176Q175 176 136 109Q129 100 114 100Q97 100 95 106Q93 110 93 277V403Q93 451 98 451Q100 452 103 452Q105 452 124 445T177 431T251 423Q294 423 328 430T380 445T401 453Q410 453 410 435V422Q332 331 203 331Q152 331 140 339Q139 339 139 254V168Q194 214 256 214Q332 214 390 154T448 0Q448 -95 381 -155T229 -216Q153 -216 104 -166T50 -49Q50 -15 66 -1T105 13Q128 13 143 -3T159 -44'], - - // DIGIT SIX - 0x36: [665,22,500,41,456,'42 313Q42 401 68 472T133 583T215 644T296 665H304Q317 665 329 664T360 657T393 640T418 608T432 557Q432 533 422 519T401 502T380 498Q358 498 343 512T328 550Q328 591 367 601L372 602Q372 604 365 609T341 620T307 626Q260 626 226 600T174 537Q147 483 143 376V356Q192 434 266 434Q317 434 357 409Q406 375 435 317Q456 268 456 210V192Q456 169 451 149Q440 90 387 34T253 -22Q225 -22 199 -14T143 16T92 75T56 172T42 313ZM251 396Q211 396 178 354T145 217Q145 159 152 122T166 73T187 47Q216 21 252 21Q294 21 321 47Q342 68 349 99T356 203V232Q356 264 354 285T345 331T322 373T280 395Q274 396 251 396'], - - // DIGIT SEVEN - 0x37: [463,216,500,55,485,'75 246Q64 246 62 247T55 255Q55 259 72 357T90 458L94 462H99Q104 463 109 463H121Q128 460 128 452Q128 445 134 441T165 435T233 432T356 431H478L485 425V392L414 298Q408 290 385 260T358 223T337 191T317 154T302 116T289 68T282 14T275 -55T274 -137Q274 -173 272 -177Q262 -216 223 -216Q170 -216 170 -157V-148Q172 -78 189 -12T237 109T288 196T338 266Q345 275 348 279Q395 340 395 342Q396 343 376 343T274 343Q122 342 117 339T103 294T90 248Q88 246 75 246'], - - // DIGIT EIGHT - 0x38: [666,22,500,43,456,'69 496Q69 570 124 618T247 666Q321 666 375 624T429 515Q429 468 405 433T320 361L346 344Q385 320 403 301T439 250Q456 212 456 181V172V160Q456 141 449 119T426 71T386 26T326 -8T246 -21Q160 -21 102 30T43 155Q43 265 167 332L176 337L161 347Q105 384 87 423Q69 458 69 496ZM371 513Q371 567 334 596T249 626Q198 626 163 598T127 532Q127 521 129 511T138 492T150 476T167 460T185 447T207 433T228 420L284 384L294 391Q346 424 363 469Q371 486 371 513ZM190 21T250 21T351 56T393 140Q393 180 362 213Q354 221 317 246T246 292L212 313Q210 313 200 307T173 287T142 256T117 212T106 157Q106 100 148 61'], - - // DIGIT NINE - 0x39: [453,216,500,42,457,'171 -101Q171 -118 163 -130T146 -146T134 -151Q132 -151 132 -152Q132 -154 140 -159T167 -168T206 -173Q274 -173 317 -108Q356 -50 356 79V86L350 77Q308 9 231 9Q150 9 92 81Q42 141 42 228Q42 289 64 333Q93 390 142 421T235 452Q237 452 244 452T255 453Q289 453 321 439T386 391T437 290T457 128Q457 -29 381 -122T206 -216Q148 -216 108 -187T67 -104Q67 -75 84 -62T119 -49Q141 -49 156 -63T171 -101ZM242 46Q293 46 324 94T355 223Q355 323 337 356Q316 401 275 410Q267 412 248 412Q206 412 179 386Q155 360 149 328T143 224Q143 120 163 88Q192 46 242 46'], - - // LATIN CAPITAL LETTER A - 0x41: [728,51,798,30,819,'576 668Q576 688 606 708T660 728Q676 728 675 712V571Q675 409 688 252Q696 122 720 57Q722 53 723 50T728 46T732 43T737 41T743 39L754 45Q788 61 803 61Q819 61 819 47Q818 43 814 35Q799 15 755 -7T675 -30Q659 -30 648 -25T630 -8T621 11T614 34Q603 77 599 106T594 146T591 160V163H460L329 164L316 145Q241 35 196 -7T119 -50T59 -24T30 43Q30 75 46 100T74 125Q81 125 83 120T88 104T96 84Q118 57 151 57Q189 57 277 182Q432 400 542 625L559 659H567Q574 659 575 660T576 668ZM584 249Q579 333 577 386T575 473T574 520V581L563 560Q497 426 412 290L372 228L370 224H371L383 228L393 232H586L584 249'], - - // LATIN CAPITAL LETTER B - 0x42: [705,23,657,32,664,'304 342Q292 342 292 353Q292 372 323 391Q331 396 417 428T533 487Q563 512 563 555V562Q563 575 557 589T530 618T475 636Q429 636 396 613T330 539Q263 446 210 238Q196 183 173 120Q135 31 121 16Q108 1 85 -10T47 -22T32 -10Q32 -5 44 18T77 93T112 206Q135 296 154 395T182 550T191 615Q191 616 190 616Q188 616 179 611T157 601T131 594Q113 594 113 605Q113 623 144 644Q154 650 205 676T267 703Q277 705 279 705Q295 705 295 693Q295 686 288 635T278 575Q278 572 287 582Q336 635 402 669T540 704Q603 704 633 673T664 599Q664 559 638 523T580 462Q553 440 504 413L491 407L504 402Q566 381 596 338T627 244Q627 172 575 110T444 13T284 -22Q208 -22 158 28Q144 42 146 50Q150 67 178 85T230 103Q236 103 246 95T267 75T302 56T357 47Q436 47 486 93Q526 136 526 198V210Q526 228 518 249T491 292T436 330T350 345Q335 345 321 344T304 342'], - - // LATIN CAPITAL LETTER C - 0x43: [705,25,527,12,533,'201 -25Q167 -25 136 -14T75 23T29 94T12 202Q12 290 50 394T161 574Q227 642 303 673T433 704Q435 705 457 705Q533 701 533 640Q533 606 507 548T464 474Q431 444 396 444Q381 444 381 453Q381 459 388 473T407 513T428 563Q433 580 433 594Q433 636 381 636Q314 636 260 594T175 489T128 363T112 247Q112 157 153 101T273 44Q347 44 398 121Q413 144 437 157T481 171Q496 171 496 160Q496 150 476 123Q426 56 350 16T201 -25'], - - // LATIN CAPITAL LETTER D - 0x44: [683,1,771,19,766,'37 475Q19 475 19 487Q19 536 103 604T327 682H356Q386 683 408 683H419Q475 683 506 681T582 668T667 633Q766 571 766 450Q766 365 723 287T611 152T455 57T279 6Q248 1 160 0Q148 0 131 0T108 -1Q72 -1 72 11Q72 24 90 40T133 64L144 68L152 88Q247 328 272 587Q275 613 272 613Q272 613 269 613Q225 610 195 602T149 579T129 556T119 532Q118 530 116 525T113 518Q102 502 80 490T37 475ZM665 407Q665 596 412 613Q403 614 383 614Q370 614 370 612Q370 598 363 542T323 357T242 103L228 69H265Q391 73 481 119Q536 148 575 188T633 268T658 338T665 392V407'], - - // LATIN CAPITAL LETTER E - 0x45: [705,22,528,30,564,'144 470Q144 556 240 630T451 705Q564 705 564 637Q564 611 540 573Q529 559 505 547T464 534Q448 534 448 545Q448 552 455 562Q463 577 463 591Q463 600 462 604T456 616T436 627T400 635Q396 635 390 635T380 636Q291 636 258 568Q245 544 245 516Q245 463 290 438T391 410Q415 410 415 398Q415 392 407 380T376 356T326 341Q288 340 260 327Q218 311 187 276T143 208T130 151Q130 113 156 88T211 55T268 47Q349 47 403 125Q415 144 439 157T483 171Q499 171 499 160Q499 148 475 120T413 59T315 3T197 -22Q124 -22 77 14T30 105Q30 126 39 154T66 216T122 288T209 354L223 362Q144 400 144 470'], - - // LATIN CAPITAL LETTER F - 0x46: [684,32,719,18,829,'199 579Q181 579 181 590Q181 598 188 611T212 639T260 666T335 682Q336 682 349 682T383 682T431 682T493 683T561 683Q776 682 784 681Q826 673 829 647Q829 620 797 600T744 580Q728 580 728 595Q729 607 713 610Q698 613 598 614H500L499 610Q499 598 467 486T428 367Q428 365 551 365H674Q683 360 684 355Q687 346 677 329Q666 312 642 299T598 285Q586 285 582 296H402L394 277Q386 258 373 229T346 167T315 102T286 51Q265 22 225 -5T133 -32Q108 -32 87 -25T54 -7T33 15T21 35T18 47Q18 60 44 80T98 103Q108 103 111 101T119 88Q130 66 150 54T179 39T195 37Q199 37 203 43Q217 67 245 125T318 300T391 532Q393 543 398 564T406 598T409 613T339 614H269Q229 579 199 579'], - - // LATIN CAPITAL LETTER G - 0x47: [704,119,595,43,599,'216 68Q155 68 115 100T59 177T44 273Q44 299 50 333T73 421T133 533T239 632Q346 704 466 704Q508 704 515 703Q555 696 577 681T599 635Q599 605 570 560T523 496Q490 466 455 466Q440 466 440 475T469 526T499 589Q499 605 489 617Q460 636 403 636Q343 636 295 611T220 548T174 464T150 382T144 318Q144 241 180 189T287 137Q325 137 359 160Q428 205 466 322Q472 342 501 359T551 376Q557 376 560 373T564 368L565 365Q560 341 551 302T512 173T451 31Q359 -119 204 -119Q163 -118 127 -109T74 -91T53 -77Q52 -75 52 -71Q52 -54 79 -35T132 -14H140L151 -19Q210 -49 281 -49H289Q312 -49 329 -31Q351 -7 372 36T405 109T416 142L408 136Q401 131 392 125T369 111T338 96T303 82T261 72T216 68'], - - // LATIN CAPITAL LETTER H - 0x48: [683,48,845,18,803,'18 487Q18 496 29 517T67 566T127 621T216 665T330 683Q359 683 376 669T397 643T400 622Q400 584 382 488T348 343Q348 342 467 342H587L594 366Q615 440 648 534T690 641Q701 656 723 669T764 683Q783 683 783 672L750 578Q716 485 677 346T625 101Q624 92 623 82T622 65T621 56Q621 20 658 20Q666 20 701 25Q709 52 736 69T785 87Q803 87 803 75T791 44T754 3T685 -33T588 -48Q568 -48 562 -46Q522 -31 522 13V23Q531 129 562 250L569 281L565 280Q561 278 556 277T549 274L438 273H328L321 249Q307 202 275 107T232 0Q219 -16 196 -28T155 -41Q149 -41 145 -39T140 -34T139 -29Q139 -24 148 -3T181 86T233 247Q240 270 240 272Q240 273 194 273H169Q139 273 139 285Q139 295 153 308T187 332Q206 341 236 342L260 343L264 359Q278 414 289 482T300 578Q300 613 260 613H254Q198 613 169 592Q148 578 127 544T104 508Q72 478 37 475Q18 475 18 487'], - - // LATIN CAPITAL LETTER I - 0x49: [683,0,545,-30,642,'174 0H31Q-13 0 -21 2T-30 12Q-30 23 -17 36Q9 60 42 68L155 70Q187 102 214 179T257 333T302 491T366 610L369 614H305Q221 611 188 607T145 596T128 569Q119 543 94 529T47 512Q28 512 28 524Q28 527 32 539Q56 614 159 654Q218 678 312 682Q314 682 339 682T404 682T481 683H632Q642 678 642 671Q642 657 621 641T577 617Q570 615 507 614H444Q427 592 406 542Q382 478 355 366T310 209Q280 123 238 78L230 69H330Q442 70 442 74Q443 74 443 77T447 87T460 105Q490 134 527 137Q545 137 545 125Q545 120 542 112Q531 78 491 49T399 7Q379 2 360 2T174 0'], - - // LATIN CAPITAL LETTER J - 0x4A: [683,119,678,47,839,'148 78Q148 16 189 -17T286 -50Q319 -50 348 -33T396 10T426 59T444 101L471 204Q498 306 521 372Q575 532 649 605L659 614H591Q517 613 494 607Q433 591 400 550T360 477Q353 454 325 437T275 419Q256 419 260 435Q280 523 376 597T583 681Q603 683 713 683H830Q839 674 839 671Q839 654 810 634T754 614Q735 614 721 601Q688 571 654 495T600 351T561 209T541 132Q507 29 412 -45T213 -119Q141 -119 94 -77T47 33Q47 55 50 69T58 90T71 103Q105 131 135 131Q152 131 152 120Q152 119 151 114T149 99T148 78'], - - // LATIN CAPITAL LETTER K - 0x4B: [705,22,762,32,732,'194 618Q193 618 182 613T156 601T131 594Q113 594 113 605Q113 623 144 644Q154 650 205 676T267 703Q277 705 279 705Q295 705 295 691Q295 569 250 397Q225 306 197 217T151 81T128 25Q120 8 94 -7T47 -22Q32 -22 32 -10L64 76Q95 163 133 295T185 530Q198 611 194 618ZM331 429Q331 383 364 290T449 117T542 36Q574 36 607 51T652 103Q660 124 677 133T709 143Q727 143 727 128Q727 119 723 111Q704 56 639 17T497 -22H493Q463 -22 425 16Q401 40 382 71Q335 138 296 243T256 399Q256 434 288 473Q342 540 471 622T670 705Q691 704 703 696Q732 678 732 644Q732 613 714 600T677 586Q671 586 667 587T660 592T657 604V619Q657 647 629 647Q623 647 620 646Q576 635 495 583T365 482Q331 448 331 429'], - - // LATIN CAPITAL LETTER L - 0x4C: [705,22,690,32,656,'62 -22T47 -22T32 -11Q32 -1 56 24T83 55Q113 96 138 172T180 320T234 473T323 609Q364 649 419 677T531 705Q559 705 578 696T604 671T615 645T618 623V611Q618 582 615 571T598 548Q581 531 558 520T518 509Q503 509 503 520Q503 523 505 536T507 560Q507 590 494 610T452 630Q423 630 410 617Q367 578 333 492T271 301T233 170Q211 123 204 112L198 103L224 102Q281 102 369 79T509 52H523Q535 64 544 87T579 128Q616 152 641 152Q656 152 656 142Q656 101 588 40T433 -22Q381 -22 289 1T156 28L141 29L131 20Q111 0 87 -11'], - - // LATIN CAPITAL LETTER M - 0x4D: [705,50,1201,28,1137,'28 9Q28 37 43 63T73 90Q77 90 83 84T103 70T141 57H146Q162 57 178 79T222 167Q266 279 295 371T334 513T349 598T358 651T371 677Q397 705 432 705Q442 705 445 699T452 666Q453 661 453 659Q475 538 509 405T568 207L574 192Q581 178 587 164T594 150Q596 150 635 189T693 248Q765 324 863 438T1024 626T1089 701Q1093 705 1100 705Q1111 705 1111 682Q1111 675 1108 660T1099 611T1086 540Q1041 277 1041 144Q1041 98 1044 75T1050 48T1059 42Q1064 41 1075 46Q1102 61 1121 61Q1137 61 1137 50Q1137 28 1087 0T1000 -29Q983 -29 972 -23T955 -9T945 16T942 45T941 83V96Q941 158 952 256T974 422L985 489Q984 489 939 436T821 300T698 164Q665 128 620 85T568 37Q564 34 558 34Q550 34 546 37T535 54Q512 91 496 127T450 259T389 498L384 518Q349 367 294 223T198 15Q155 -50 117 -50Q87 -50 61 -35T30 -6Q28 2 28 9'], - - // LATIN CAPITAL LETTER N - 0x4E: [789,51,820,-27,979,'343 705Q358 705 358 698Q360 696 370 658T411 524T484 319Q536 174 590 82L595 73L615 152Q646 274 683 407Q729 571 752 637T799 727Q852 780 937 788Q939 788 947 788T958 789H962Q979 789 979 765Q979 722 951 692Q942 683 924 683Q888 681 859 672T818 654T803 639Q784 608 708 322T631 15Q631 14 630 15Q630 17 629 15Q628 14 628 12Q621 -4 601 -17T560 -31Q550 -31 546 -28T530 -7Q484 67 458 123T398 272Q352 392 314 514L306 535V534Q306 533 296 488T272 379T234 239T185 100T127 -7T61 -50Q34 -50 4 -34T-27 8Q-27 33 -12 61T18 90Q21 90 36 77T87 57H92Q109 57 123 78T162 173Q206 299 232 417T265 599T276 667Q284 681 304 693T343 705'], - - // LATIN CAPITAL LETTER O - 0x4F: [705,22,796,58,777,'308 428Q289 428 289 438Q289 457 318 508T378 593Q417 638 475 671T599 705Q688 705 732 643T777 483Q777 380 733 285T620 123T464 18T293 -22Q188 -22 123 51T58 245Q58 327 87 403T159 533T249 626T333 685T388 705Q404 705 404 693Q404 674 363 649Q333 632 304 606T239 537T181 429T158 290Q158 179 214 114T364 48Q489 48 583 165T677 438Q677 473 670 505T648 568T601 617T528 636Q518 636 513 635Q486 629 460 600T419 544T392 490Q383 470 372 459Q341 430 308 428'], - - // LATIN CAPITAL LETTER P - 0x50: [683,57,696,19,733,'37 475Q19 475 19 487Q19 536 103 604T327 682Q329 682 344 682T380 682T421 683H463Q625 683 695 615Q718 591 726 564Q733 547 733 525Q733 412 607 312T321 205H312Q293 205 293 217Q293 224 302 236T333 260T385 274Q558 287 614 407Q633 445 633 477Q633 515 612 543T556 585T481 607T399 614H370L368 603Q352 463 312 312T242 82T202 -13Q190 -33 164 -45T121 -57Q108 -57 108 -45Q108 -40 120 -10T151 73T192 190T233 349T266 539Q267 546 269 565T272 598T274 613H270Q209 613 163 588Q131 572 113 518Q102 502 80 490T37 475'], - - // LATIN CAPITAL LETTER Q - 0x51: [705,131,817,114,787,'114 286Q114 358 151 433T249 569T392 667T558 705Q653 705 713 641T774 460Q774 389 750 322T687 206T600 114T504 46T412 4L399 -2Q542 -62 636 -62Q660 -62 670 -54T686 -27T700 0Q734 34 770 34Q787 34 787 23Q787 -18 720 -74T563 -131Q485 -131 350 -83T145 -34Q127 -34 127 -22Q127 -12 144 5T190 31L200 34L237 35Q386 38 467 79Q550 120 612 210T675 416Q675 510 625 573T484 636Q410 636 346 587T248 469T214 333Q214 306 221 281T243 229T288 188T360 172Q403 172 441 188T490 205Q510 205 510 192Q505 162 432 132T287 102Q206 102 160 155T114 286'], - - // LATIN CAPITAL LETTER R - 0x52: [683,22,848,19,837,'37 475Q19 475 19 487Q19 503 35 530T83 589T180 647T327 682H374Q387 682 417 682T464 683Q519 683 559 679T642 663T708 625T731 557Q731 481 668 411T504 300Q506 296 512 286T528 257T553 202Q594 105 611 82Q635 47 665 47Q708 47 742 93Q758 113 786 128Q804 136 819 137Q837 137 837 125Q837 115 818 92T767 43T687 -2T589 -22Q549 -22 517 22T467 120T422 221T362 273Q346 273 346 287Q348 301 373 320T436 342Q437 342 446 343T462 345T481 348T504 353T527 362T553 375T577 393Q598 412 614 443T630 511Q630 545 613 566T541 600T393 614Q370 614 370 613L366 584Q349 446 311 307T243 96L213 25Q205 8 179 -7T132 -22Q125 -22 120 -18T117 -8Q117 -5 130 26T163 113T205 239T246 408T274 606V614Q273 614 259 613T231 609T198 602T163 588Q131 572 113 518Q102 502 80 490T37 475'], - - // LATIN CAPITAL LETTER S - 0x53: [705,22,606,18,642,'554 512Q536 512 536 522Q536 525 539 539T542 564Q542 588 528 604Q515 616 482 625T410 635Q374 635 349 624T312 594T295 561T290 532Q290 505 303 482T342 442T378 419T409 404Q435 391 451 383T494 357T535 323T562 282T574 231Q574 133 464 56T220 -22Q138 -22 78 21T18 123Q18 184 61 227T156 274Q178 274 178 263Q178 260 177 258Q172 247 164 239T151 227T136 218L127 213L124 202Q118 186 118 163Q120 124 165 86T292 48Q374 48 423 86T473 186V193Q473 267 347 327Q268 364 239 389Q191 431 191 486Q191 547 242 600T356 679T470 705Q472 705 478 705T489 704Q551 704 596 682T642 610Q642 566 621 545Q592 516 554 512'], - - // LATIN CAPITAL LETTER T - 0x54: [717,68,545,34,833,'49 475Q34 475 34 490Q34 552 106 611T261 681Q272 683 507 683H742Q790 717 816 717Q833 717 833 708Q833 682 795 653T714 615Q691 610 588 609Q490 609 490 607L483 580Q476 554 462 496T435 392Q410 289 395 231T363 116T335 34T309 -15T279 -47T242 -64Q231 -68 218 -68Q203 -68 203 -57Q203 -52 211 -38Q224 -7 234 20T251 66T268 123T283 179T304 261T328 360Q342 415 360 488Q380 567 384 582T397 605Q400 607 401 609H302H244Q200 609 188 607T167 596Q145 572 145 541Q145 520 109 498T49 475'], - - // LATIN CAPITAL LETTER U - 0x55: [683,28,626,-17,687,'8 592Q8 616 70 649T193 683Q246 683 246 631Q246 587 205 492T124 297T83 143Q83 101 100 75T154 48Q202 48 287 135T450 342T560 553Q589 635 593 640Q603 656 626 668T669 683H670Q687 683 687 672T670 616T617 463T547 220Q525 137 521 68Q521 54 522 50T533 42L543 47Q573 61 588 61Q604 61 604 47Q599 16 506 -22Q486 -28 468 -28T436 -18T421 18Q421 92 468 258Q468 259 467 257T459 248Q426 206 391 167T303 81T194 6T83 -22Q66 -22 58 -20Q25 -11 4 19T-17 99Q-17 146 8 220T64 358T120 488T146 586Q146 604 141 608T123 613H120Q99 613 72 597T25 580Q8 580 8 592'], - - // LATIN CAPITAL LETTER V - 0x56: [683,52,613,25,658,'25 633Q25 647 47 665T100 683Q291 683 291 306Q291 264 288 213T282 132L279 102Q281 102 308 126T378 191T464 279T545 381T596 479Q600 490 600 502Q600 527 581 550T523 577Q505 577 505 601Q505 622 516 647T542 681Q546 683 558 683Q605 679 631 645T658 559Q658 423 487 215Q409 126 308 37T190 -52Q177 -52 177 -28Q177 -26 183 15T196 127T203 270Q203 356 192 421T165 523T126 583T83 613T41 620Q25 620 25 633'], - - // LATIN CAPITAL LETTER W - 0x57: [683,54,988,25,1035,'25 633Q25 647 46 665T103 683Q168 683 207 632Q228 608 243 568Q269 485 269 374Q269 324 265 271T256 184L251 150L252 152Q254 153 257 157T264 167T274 180T286 197Q359 293 424 398T519 558T549 616Q549 618 547 624T545 638Q550 654 572 668T615 683Q626 683 632 672T657 595Q726 370 741 128L742 110Q752 122 767 142T823 217T894 321T950 424T976 511Q976 544 958 560T918 577Q906 577 906 602Q906 629 918 651T942 681Q948 683 954 683Q983 683 1008 658T1034 569T999 421T915 257T813 109T724 -3T681 -49Q666 -59 660 -45Q659 -41 657 35T639 233T591 477Q573 551 570 551Q569 551 554 523T507 439T433 315T323 155T182 -25Q160 -52 151 -53Q137 -53 137 -30Q137 -29 148 25T170 168T181 338Q181 424 168 483T131 571T87 609T40 620Q25 620 25 633'], - - // LATIN CAPITAL LETTER X - 0x58: [683,0,713,52,807,'324 614Q291 576 250 573Q231 573 231 584Q231 589 232 592Q235 601 244 614T271 643T324 671T400 683H403Q462 683 481 610Q485 594 490 545T498 454L501 413Q504 413 551 442T648 509T705 561Q707 565 707 578Q707 610 682 614Q667 614 667 626Q667 641 695 662T755 683Q765 683 775 680T796 662T807 623Q807 596 792 572T713 499T530 376L505 361V356Q508 346 511 278T524 148T557 75Q569 69 580 69Q585 69 593 77Q624 108 660 110Q667 110 670 110T676 106T678 94Q668 59 624 30T510 0Q487 0 471 9T445 32T430 71T422 117T417 173Q416 183 416 188Q413 214 411 244T407 286T405 299Q403 299 344 263T223 182T154 122Q152 118 152 105Q152 69 180 69Q183 69 187 66T191 60L192 58V56Q192 41 163 21T105 0Q94 0 84 3T63 21T52 60Q52 77 56 90T85 131T155 191Q197 223 259 263T362 327T402 352L391 489Q391 492 390 505T387 526T384 547T379 568T372 586T361 602T348 611Q346 612 341 613T333 614H324'], - - // LATIN CAPITAL LETTER Y - 0x59: [683,143,668,31,714,'65 599Q65 618 107 650T204 683Q267 683 312 643T380 533T414 385T424 217Q424 186 423 160T422 123Q426 123 468 170T567 304T650 469Q661 503 661 519Q661 546 639 570Q615 591 583 591Q569 591 569 616Q569 640 582 661T613 683Q624 683 638 679T671 664T702 625T714 558Q714 472 639 329T426 45Q361 -21 282 -82T154 -143Q97 -143 64 -104T31 -20Q31 4 44 25T70 46Q78 46 81 39T87 16T97 -9Q127 -51 182 -51Q184 -51 187 -50H190Q233 -41 314 25Q330 36 330 40Q336 79 336 178Q336 508 223 594Q199 614 158 619L148 620L139 611Q111 586 83 586Q65 586 65 599'], - - // LATIN CAPITAL LETTER Z - 0x5A: [683,0,725,37,767,'694 220Q708 220 708 210Q708 195 695 167T658 105T593 42T502 3Q492 1 458 1Q400 1 293 11T150 22Q116 22 92 11T51 0Q37 0 37 10Q37 21 63 44T179 146T367 319L391 343H343L296 344Q285 350 285 358Q285 365 289 372T300 383T313 392T324 398L329 400H450L561 518Q597 558 607 571L621 587H596Q553 589 484 599T383 609Q342 609 326 596T301 555Q294 533 263 514T208 492Q189 492 189 503Q189 510 197 528T215 559Q249 607 318 645T466 683Q504 683 573 673T669 662L690 661Q734 682 748 683Q767 683 767 673Q767 666 746 640Q655 531 555 428L529 400Q529 399 543 399Q604 397 604 366Q604 350 587 337T551 322Q541 322 539 323Q529 328 529 334Q529 339 487 342L470 343L446 320Q272 153 200 96L235 95Q297 95 392 86T533 74H554Q586 116 597 159Q604 179 635 199T694 220'] -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Caligraphic/Regular/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/BasicLatin.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/BasicLatin.js deleted file mode 100644 index 2c81d38547..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/BasicLatin.js +++ /dev/null @@ -1,272 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Fraktur/Bold/BasicLatin.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Fraktur-bold'], - { - // SPACE - 0x20: [0,0,250,0,0,''], - - // EXCLAMATION MARK - 0x21: [689,12,349,107,241,'121 621Q121 657 132 673T177 689Q223 689 223 644V635Q223 604 222 595Q221 590 210 490T187 292T175 190V186L166 185L156 184Q156 185 139 393T121 621ZM107 47Q107 70 127 87T174 104Q201 104 221 89T241 48Q241 24 222 6T174 -12Q147 -12 127 6T107 47'], - - // QUOTATION MARK - 0x22: [695,-432,254,10,231,'53 695Q74 695 90 679V622L65 433L52 432H39L27 516Q10 626 10 655Q10 680 26 688Q33 693 39 693Q49 695 53 695ZM151 668Q151 691 191 691Q217 691 224 685T231 661V652Q230 634 219 531L207 433L195 432Q183 432 183 433L168 541Q151 664 151 668'], - - // AMPERSAND - 0x26: [696,17,871,44,839,'290 -14Q186 -14 115 41T44 185Q44 222 54 249T88 300T131 336T189 371Q216 387 216 388Q185 459 185 510Q185 563 206 601T263 659T334 687T405 696Q476 696 503 668T531 603Q531 565 513 536T450 476Q423 459 370 432L334 413L354 384Q474 212 560 139L563 137Q611 185 611 250Q611 295 577 329Q549 356 496 357Q439 357 433 354Q432 354 432 379V403L437 402Q443 402 479 401T557 400Q653 400 735 403T831 407H836Q833 352 833 351L821 352Q809 352 792 352T756 352T720 353T696 354Q680 354 680 353L681 346Q682 339 683 327T685 306Q685 283 681 260T669 218T653 182T635 152T619 129T606 114L602 109Q604 107 618 99T659 81T707 71Q742 71 767 99T804 155L815 183Q815 184 821 183T833 180T839 177Q837 169 834 156T816 110T782 52T727 5T648 -16Q569 -16 499 35H498Q496 35 466 23T387 -1T290 -14ZM418 592Q418 617 398 639T352 661T302 642T278 574Q278 545 288 514T306 465T319 444Q342 456 353 463T382 488T409 529T418 584V592ZM159 239Q159 158 222 98T364 38Q386 38 447 57L469 63L434 98Q349 185 286 275Q258 316 238 345Q233 353 232 353Q159 316 159 239'], - - // APOSTROPHE - 0x27: [695,-436,250,80,158,'80 645T80 662T93 687T123 695Q158 695 158 659Q158 649 157 643L123 437Q123 436 114 436H104Q104 442 92 538Q80 645 80 662'], - - // LEFT PARENTHESIS - 0x28: [737,186,459,134,347,'347 719Q325 708 311 698T272 656T233 580T207 455T195 267Q195 30 247 -79Q261 -110 291 -136Q320 -163 347 -172V-179Q347 -186 344 -186Q338 -186 328 -184T287 -165T230 -123Q134 -25 134 271Q134 417 158 514T226 662T335 734L346 737Q347 737 347 728V719'], - - // RIGHT PARENTHESIS - 0x29: [735,187,459,105,326,'264 262Q264 366 253 446T226 572T186 649T145 692T105 714V725Q105 735 107 735Q108 734 121 731T154 719T196 692T242 641T284 560T314 437T326 268Q326 112 299 7Q279 -78 239 -124T116 -185L105 -187V-179L106 -171L109 -169Q130 -161 138 -158T165 -146T190 -127T210 -101T229 -64T243 -12T255 58T261 148T264 262'], - - // ASTERISK - 0x2A: [692,-449,328,40,277,'40 516L62 529Q85 542 110 556T140 574L126 582Q112 591 104 595T80 607T40 629Q53 642 57 645L65 652L78 642Q106 620 132 603L152 589V595Q152 630 149 681V692H179V689Q178 681 174 638T171 593Q173 593 240 639L258 652Q260 652 267 643L276 633L260 625Q190 587 175 576Q173 575 180 570Q183 569 186 567Q213 549 256 527L277 515L256 495Q246 501 228 515T194 539T170 554V543Q170 486 178 449H148V456Q152 492 152 550L151 562Q150 562 102 528L53 495Q40 514 40 516'], - - // PLUS SIGN - 0x2B: [598,82,893,56,837,'422 584L471 598Q472 598 472 440V282H837Q833 273 829 263L821 244L647 243H472V-63L448 -73L423 -82Q422 -82 422 81V243H239Q56 243 56 244Q60 253 65 263L73 282H422V584'], - - // COMMA - 0x2C: [107,191,328,118,253,'118 61Q118 80 135 93T169 107Q190 107 221 65T253 -23Q253 -39 251 -49T237 -80T198 -133Q148 -191 144 -191Q142 -191 137 -182T132 -172Q143 -161 160 -131T183 -83Q185 -77 185 -62Q185 -54 184 -48T182 -38T177 -28T171 -19T162 -8T150 6Q130 28 124 38T118 61'], - - // HYPHEN-MINUS - 0x2D: [275,-236,893,54,833,'54 236L73 275H453Q833 275 833 274Q830 265 825 255L818 236H54'], - - // FULL STOP - 0x2E: [102,15,328,103,237,'103 23T103 44T120 83T170 102Q200 102 218 84T237 44Q237 20 216 3T168 -15Q138 -15 121 4'], - - // SOLIDUS - 0x2F: [721,182,593,41,550,'272 270Q503 721 506 721L509 720Q512 720 518 719T529 717L550 713L91 -181L66 -182Q41 -182 41 -181L272 270'], - - // DIGIT ZERO - 0x30: [501,12,593,42,533,'238 -12Q162 -12 102 42T42 185Q42 303 130 393Q163 425 208 452T284 490L313 501Q323 499 339 495T395 472T464 426Q533 357 533 273Q533 201 483 133T364 27T238 -12ZM428 208Q428 255 402 297T342 365T280 404T241 419Q214 419 178 374T142 259Q142 206 168 164T225 99Q259 74 310 74Q326 74 337 75T366 82T396 103T417 141Q428 171 428 208'], - - // DIGIT ONE - 0x31: [489,0,593,54,548,'95 481Q102 481 217 485T383 489Q384 489 384 485Q367 397 367 165Q367 58 369 54Q374 46 380 44T410 42H466H546V40Q547 38 547 19L548 0H54V23Q54 29 54 34T54 44L55 47Q79 47 134 46T202 45Q226 45 234 52Q240 57 241 64T245 105Q254 236 254 320V347Q254 369 252 382T240 409T211 431L97 450L96 465Q95 480 95 481'], - - // DIGIT TWO - 0x32: [491,-2,593,44,563,'307 335Q307 374 283 397T224 421Q187 421 112 387Q105 384 100 382T95 381Q90 387 86 394L77 407L86 413Q219 491 298 491Q370 491 399 460T428 388Q428 373 424 358T409 326T391 297T363 264T335 235T301 202T269 171L199 104Q194 99 205 97Q209 96 214 96Q527 105 544 105Q553 107 563 102Q563 100 557 79T545 34T537 2H377Q338 2 247 2T130 4H44V26L104 77Q185 145 212 172T267 235Q307 291 307 335'], - - // DIGIT THREE - 0x33: [487,193,593,31,523,'102 402L108 408Q115 413 122 418T141 431T165 447T194 461T227 474T263 483T302 487H307Q413 487 452 420Q465 400 465 371Q465 334 445 303T396 253T347 225T317 213Q314 213 314 211Q316 209 316 205Q317 201 320 201Q337 201 359 198T411 184T465 156T506 109T523 39Q523 -62 436 -127T229 -193Q179 -193 130 -178T56 -150T31 -133Q31 -132 41 -122L52 -112L63 -117Q128 -148 201 -148Q282 -148 331 -104T381 20Q381 71 363 100T304 145Q243 166 149 166H137V204H146Q179 204 211 210T275 229T326 268T346 329Q346 372 314 401Q292 423 245 423Q188 423 125 383L102 402'], - - // DIGIT FOUR - 0x34: [495,196,593,13,565,'346 -196Q344 -196 335 -187L336 -148Q337 -127 337 -55V0H13V29L187 253Q362 477 362 479L368 480Q375 481 387 483T411 487T434 491T452 494L459 495Q460 495 470 482V453Q470 389 466 230T461 62Q461 61 513 61T565 60L555 29L546 -1H461V-15Q461 -48 463 -100T465 -154L457 -157Q449 -160 434 -165T405 -175Q347 -196 346 -196ZM339 265V341Q339 362 335 362Q327 362 219 217T110 65V61H337V117Q338 133 338 187T339 265'], - - // DIGIT FIVE - 0x35: [481,190,593,18,519,'232 192Q176 192 122 152L95 162V481H306Q516 481 516 479Q514 477 501 433L486 389L319 388H152V386V382Q152 379 152 374T151 365Q147 329 146 260V218H149Q211 242 284 242Q353 242 402 224T474 176T508 117T518 55Q518 -62 432 -126T220 -190Q184 -190 151 -185T96 -172T57 -157T31 -145T20 -139T19 -138Q19 -136 27 -125L35 -112L51 -120Q114 -152 174 -152Q257 -152 314 -100T371 46Q371 107 340 149T232 192'], - - // DIGIT SIX - 0x36: [704,12,593,48,547,'48 251Q48 330 76 403T150 529T253 623T370 683T485 704Q494 704 520 701T547 695Q547 692 542 659T536 625Q531 624 524 624L512 623L502 628Q489 635 468 640Q452 645 423 645Q403 645 379 640T320 617T255 568T201 481T171 348Q170 341 170 330V325L183 333Q275 385 357 385H361Q464 385 514 312Q546 267 546 217Q546 127 457 58T262 -12Q225 -12 189 3T120 49T68 132T48 251ZM448 165Q448 228 406 274T289 320Q264 320 236 312T190 295T173 284Q173 266 176 241T189 178T214 112T259 61T326 39Q372 39 410 75T448 165'], - - // DIGIT SEVEN - 0x37: [479,197,593,54,591,'57 376L87 479H591V455L584 446Q544 399 491 328T349 117T185 -169L171 -196H159Q152 -197 102 -197Q58 -197 58 -196T56 -185L54 -175L299 158L443 359Q446 367 444 370H254L71 365L57 376'], - - // DIGIT EIGHT - 0x38: [714,5,593,45,542,'88 533Q88 573 120 610T194 668T268 701T307 714Q324 714 352 711T422 695T486 659Q518 625 518 585Q518 536 479 489T384 406L371 398L385 390Q387 389 400 382T420 370T442 356T466 339T489 319T510 295T526 269T538 238T542 204Q542 125 463 60T256 -5Q145 -5 92 52Q45 97 45 165Q45 204 64 237T109 290T163 324T209 345T228 353L214 364Q199 375 179 392T138 431T103 480T88 533ZM405 557Q405 568 402 581T387 612T350 644T286 663Q283 663 280 663T274 664H272Q256 664 228 636T199 572Q199 547 238 507Q268 475 320 437L334 427Q345 433 358 443T388 483T405 549V557ZM304 42Q366 42 398 76T431 155Q431 178 420 200T396 238T359 270T321 296T283 318L263 328Q262 328 230 312Q190 290 175 266T160 198Q160 132 202 87T304 42'], - - // DIGIT NINE - 0x39: [487,195,593,29,549,'549 220Q549 23 429 -82T105 -195H84V-189Q84 -179 85 -174V-164H93Q184 -156 238 -132T334 -56Q361 -23 376 16T394 78L397 100L363 88Q329 75 291 61T244 45Q237 44 218 44Q154 44 94 97Q29 152 29 240Q29 350 108 404Q145 429 257 480Q270 487 279 487Q403 487 470 421Q549 347 549 220ZM408 217Q408 276 390 320T346 385T297 415T259 424Q218 424 185 393T151 286Q151 216 213 154Q252 115 321 115Q368 115 388 134T408 217'], - - // COLON - 0x3A: [457,12,255,57,197,'57 398Q57 419 72 438T117 457Q154 457 174 439T194 398Q194 379 176 361T119 343Q85 343 71 362T57 398ZM62 19T62 43T77 85T115 104Q153 104 175 86T197 42Q197 14 171 1T119 -12Q96 -12 79 3'], - - // SEMICOLON - 0x3B: [458,190,255,56,211,'56 399Q56 424 73 440T104 456Q114 458 120 458Q149 458 170 440T192 399Q192 380 174 362T120 344Q85 344 71 362T56 399ZM78 53Q78 67 84 76T90 86Q90 88 98 92T116 98Q117 98 121 98T128 99Q152 97 181 58T211 -24Q211 -77 128 -165Q124 -170 121 -173T116 -178T113 -181T110 -185T106 -190L97 -184L88 -177L95 -168Q143 -104 143 -65Q143 -51 137 -40T113 -7T81 35Q78 41 78 53'], - - // EQUALS SIGN - 0x3D: [343,-168,582,22,559,'559 342L549 304H22L27 319Q29 328 30 333T33 343H296Q559 343 559 342ZM559 206L549 168H22L27 183Q29 192 30 197T33 207H296Q559 207 559 206'], - - // QUESTION MARK - 0x3F: [697,14,428,40,422,'121 590Q121 575 128 562T144 542T152 533T115 512L78 491Q55 499 47 516Q40 530 40 553Q40 601 77 632Q155 697 257 697H268Q316 697 355 679Q422 646 422 576Q422 518 388 476Q383 468 376 461T358 444T340 428T316 410T290 390L230 344Q180 307 180 275Q180 261 187 248T202 227L209 219Q209 215 176 193L142 170Q114 177 100 194T84 226V239Q84 259 93 276T113 302T150 331T192 362Q203 370 219 382T247 403T267 422Q312 471 312 546Q312 593 282 623T207 653Q170 653 146 636T121 590ZM95 23T95 49T117 94T173 113Q204 113 223 96T242 54Q242 27 221 7T167 -14Q136 -14 116 4'], - - // LATIN CAPITAL LETTER A - 0x41: [686,31,847,29,827,'821 97Q822 97 824 88T827 77L793 53Q676 -25 670 -28Q669 -29 656 -27L583 123Q583 124 467 46L352 -31L341 -20Q305 18 264 47T192 77Q161 77 60 32L49 40Q37 47 38 49Q39 49 93 83T212 160T297 219Q411 312 411 452Q411 519 360 571T233 624Q180 624 157 601T133 548Q133 524 160 496T214 441T241 393Q241 356 199 321T100 256L86 249L77 256Q68 263 67 263L84 274Q101 286 118 304T135 339T109 384T56 446T29 504Q29 566 118 624Q207 686 309 686Q349 686 360 685Q405 678 439 661T491 625T520 583T534 543T537 511Q537 436 491 344L478 318L455 299Q420 272 308 179L284 160L294 158Q348 154 426 89L437 79Q513 110 579 153V175Q579 183 579 227T580 330T581 446T582 542L583 582L664 630Q681 640 703 653T734 673L744 679Q750 678 756 676L767 674L716 623V585Q716 568 712 463T708 289V250Q708 237 709 218T710 195L711 180L739 130Q768 79 771 79Q775 79 796 88T821 97'], - - // LATIN CAPITAL LETTER B - 0x42: [684,31,1044,56,965,'160 345Q160 357 144 376T109 413T73 458T57 509Q57 544 95 584Q142 631 205 657T331 684Q382 684 427 658T500 585L505 577L521 588Q537 599 562 614T616 646T679 673T738 684Q790 684 807 666T840 587Q850 552 863 532T888 508Q894 505 906 505Q917 505 930 507T953 512T963 514L964 504Q965 495 965 494T914 467T808 413T745 384H751Q782 380 802 377T854 362T904 334T937 287T951 217Q951 178 937 143T908 91Q903 86 820 34L734 -21L718 -24Q679 -31 639 -31Q561 -31 451 4T271 40Q190 40 119 -2L99 -13L91 1L84 15L86 16Q88 18 132 42T233 100T315 152Q377 199 386 233Q388 240 393 297T399 363Q399 487 353 551Q337 573 306 597T238 622Q201 622 179 602T157 557T214 476T272 396Q272 371 229 334T143 272T96 246Q95 246 85 252T74 259T95 273T138 306T160 345ZM529 443Q529 409 528 385T526 353L525 346Q526 346 649 390T773 435Q749 451 742 464T727 518Q727 519 725 532T721 548T717 562T712 577T706 589T698 601T688 608T675 614T658 616Q626 616 576 582T525 528Q525 527 526 518T528 489T529 443ZM772 57Q774 57 778 58T792 64T808 77T821 103T827 144Q827 222 784 266T660 322Q652 323 611 323H596Q577 323 535 316L523 314Q520 291 505 255L500 241L356 138L366 137Q443 131 518 110T650 72T748 54Q763 54 772 57'], - - // LATIN CAPITAL LETTER C - 0x43: [676,32,723,71,726,'460 -32Q373 -32 305 -11T193 45T122 124T83 214T72 303Q72 395 114 476L119 486L313 592L338 568L359 580Q418 615 479 638T568 668T606 675Q607 675 608 676H610Q612 676 615 661T630 621T660 578Q673 568 694 568Q717 568 721 570H726Q724 565 722 559L717 549L706 545Q608 513 583 513Q568 517 559 522T533 546T493 603L490 609Q452 599 452 558Q452 537 469 481T486 393Q486 353 474 331T422 285T296 231L272 223L262 230L253 237Q279 246 314 274T351 338Q351 376 334 442T316 532Q316 546 319 552Q319 554 316 554Q304 554 288 547T250 523T214 466T199 371Q199 218 299 133T541 47Q571 47 585 51T652 81L712 108Q716 104 716 81L706 74Q695 68 673 54T633 29L550 -22L540 -24Q492 -32 460 -32'], - - // LATIN CAPITAL LETTER D - 0x44: [683,29,982,31,896,'380 596Q307 596 250 582T158 546T100 493T67 433T56 373V361Q55 361 43 366L31 372V384Q31 455 69 523T173 627Q213 650 284 666T444 683H452Q629 683 735 629Q896 548 896 369Q896 263 839 163Q835 155 818 140Q746 82 662 27T563 -29Q525 -29 386 16T183 62Q147 62 127 52T63 1L48 -14L40 -4L31 5Q83 73 172 149L186 161H199Q291 161 329 181Q357 199 357 231Q357 258 301 316T245 396Q245 423 282 458T349 512T403 543L413 548L425 545L438 541Q373 491 373 462Q373 446 399 415T453 349T480 288Q480 251 433 212Q394 180 348 156L334 148L353 145Q408 134 513 105T654 76Q711 76 745 132T780 277Q780 434 676 517Q637 549 562 572T380 596'], - - // LATIN CAPITAL LETTER E - 0x45: [686,29,783,74,728,'527 55Q574 55 619 69T691 97L717 111V85L562 -18Q520 -29 443 -29Q379 -29 325 -15T235 21T180 61T146 98Q74 186 74 307Q74 395 109 472Q113 482 123 489T190 533Q251 568 295 591L308 598L350 580L361 586Q403 612 464 636T564 673T609 686Q610 686 610 685Q612 683 616 670T627 636T646 601Q666 572 686 572H692Q713 572 726 576H728L725 565L723 554L692 544Q660 535 629 526T595 516Q585 514 574 519Q563 527 543 552T507 597T490 617Q467 604 456 579V564Q456 535 473 471T492 393L494 381L613 460L622 446Q630 433 650 411T696 371L703 365L614 312H596L580 322Q568 329 553 340T528 355T510 360Q496 358 491 354T484 345T471 326T435 297Q408 278 370 261T307 235T277 227Q273 227 266 234L256 240L267 245Q280 251 294 258T330 288T353 336Q353 373 335 444T316 530V537Q316 549 322 567Q270 554 233 499T196 370Q196 253 287 157Q392 55 527 55'], - - // LATIN CAPITAL LETTER F - 0x46: [684,146,722,17,727,'424 522Q265 596 208 596Q193 596 180 593T150 579T116 542T89 474Q86 465 86 463L59 481L63 494Q87 578 137 627Q191 684 285 684Q334 684 406 658T538 607T621 581Q644 581 706 629L721 640Q722 640 725 630L727 620Q701 592 654 548T582 486L569 487Q533 490 485 504L468 508Q449 503 429 495T387 466T365 422Q365 373 439 299L453 310Q473 325 528 370L588 418Q614 398 642 368T668 331Q667 331 628 296L590 262L582 274Q557 311 526 311Q511 311 487 297T462 278Q462 277 492 244T551 166T581 88Q581 54 570 25T536 -27T505 -56T478 -76Q376 -146 274 -146H270Q199 -146 162 -118T124 -15Q124 12 128 30T132 96V107Q132 144 117 157Q102 169 85 169Q74 169 59 165T32 156T20 151Q20 152 19 158T17 167Q17 168 17 168T17 169T19 170T22 172T27 175T35 179Q131 230 195 230Q231 230 259 202Q270 190 270 171Q269 150 253 87T236 -16Q236 -67 261 -87T322 -107Q380 -107 428 -68Q467 -35 467 30Q467 60 447 91T383 171T316 251Q290 286 278 308T263 339T261 359Q261 384 284 418Q322 469 424 522'], - - // LATIN CAPITAL LETTER G - 0x47: [687,29,927,74,844,'742 611Q784 611 812 631V611Q807 607 783 591T718 544T629 476L606 458Q608 458 628 457T667 453T713 443T762 423T804 388T836 335Q844 313 844 289Q844 231 814 182T746 103Q720 82 655 48T546 -18L520 -21Q456 -29 432 -29Q313 -29 223 33Q204 45 183 65T135 119T91 207T74 320Q74 428 109 480Q116 491 127 497T215 546L308 595L343 583L355 591Q387 613 433 636T488 660H489L491 659Q493 658 495 657T500 655L509 650L500 645Q479 635 460 612T441 552Q441 535 447 498T459 433T466 405L625 513L643 526Q620 530 585 546T535 586Q535 587 532 592T527 602T525 610Q525 613 577 649L630 687Q632 687 638 675T653 649T686 623T742 611ZM349 313Q349 328 327 413T305 510V516Q305 531 308 542T314 559T317 566T315 567Q297 567 270 548Q233 524 212 490T191 392Q191 337 206 288T244 207T284 156T316 128Q410 51 535 51Q632 51 675 102T718 217Q718 269 690 314T599 375Q574 381 535 381Q501 381 477 377L466 376Q469 364 469 349Q469 314 457 295T408 258Q366 236 308 219L288 213L279 220L270 227Q284 232 294 236T309 243T320 252T326 260T331 270T336 281Q349 310 349 313'], - - // LATIN CAPITAL LETTER H - 0x48: [683,126,851,6,752,'288 139Q288 172 255 224T189 335T156 442Q156 495 242 579Q289 625 361 668Q364 671 368 673T376 678T380 681L384 683L392 676Q401 670 414 661T443 642T477 626T509 619Q543 619 618 668Q625 672 628 674T631 675Q632 673 633 663T633 651L564 595Q556 589 545 580T528 566T516 556T505 548T497 543T488 539T481 537T472 535T463 534T451 534H442Q385 534 304 581L291 589Q290 588 285 583T277 575T269 566T262 555T257 543T255 529V522Q255 507 260 487T276 446T293 409T311 376L321 359Q321 358 322 358T324 359T327 361T333 366Q386 409 481 460L503 472L543 471Q586 471 599 470Q692 459 714 430Q725 416 738 360T752 245Q752 184 742 127T725 51T703 -8Q700 -13 619 -64T518 -123Q508 -126 493 -126Q438 -126 398 -86L427 -52Q456 -17 457 -17Q460 -17 465 -16H473Q474 -21 481 -32T504 -56T539 -69Q572 -69 599 -34Q625 4 625 158Q625 264 609 311T532 378Q508 386 484 386Q455 386 419 372T360 345T337 330L346 313Q375 263 386 227Q389 215 389 202Q389 192 388 184T384 168T376 152T365 138T350 121T331 103T307 81T278 54L194 -24Q130 30 99 30Q85 30 64 20T31 1T16 -10Q15 -11 13 -7Q12 -6 11 -3Q8 4 6 8L32 35Q88 88 117 107T169 126Q177 126 182 125Q218 118 252 84L263 73Q288 113 288 139'], - - // LATIN CAPITAL LETTER I - 0x49: [681,25,655,32,623,'500 615Q523 615 550 628T595 655T614 668L623 654L607 642Q512 569 440 534L427 527L413 529Q384 535 340 547T265 565T209 572Q173 572 145 556T101 522T60 465Q58 460 54 460T41 468L32 477L37 487Q96 599 139 640Q187 681 247 681Q275 681 283 680Q313 674 398 645T500 615ZM418 170Q418 186 410 260T401 382Q403 418 403 424L405 433L415 444Q482 515 571 571L582 578Q591 573 607 568L597 560Q522 504 522 450Q522 427 533 357T545 241V228Q545 190 536 159T508 106T478 73T446 48Q343 -25 238 -25Q179 -25 118 15L107 22L79 5Q51 -12 51 -12L38 2L55 18Q106 67 175 122L192 136Q202 130 206 123Q223 91 252 61Q263 50 266 48T278 39T297 32T320 30Q357 30 389 68Q415 102 418 170'], - - // LATIN CAPITAL LETTER J - 0x4A: [681,141,652,-8,616,'65 510Q68 517 74 528T101 569T144 620T202 661T274 680Q308 680 389 628T503 576Q530 576 596 600Q615 607 616 607Q616 602 615 596V585Q605 581 576 568T531 548T485 531T418 509L400 503L358 522Q347 527 327 537T299 550T277 560T257 568T239 573T220 577T201 578H196Q181 578 169 575T135 554T88 502L83 496Q82 496 74 502T65 510ZM424 4Q424 50 395 151T365 313V320Q365 352 369 361T405 403Q431 432 465 462T521 508T547 525L549 524Q551 524 554 523T560 521L571 517L552 498Q515 461 499 430Q485 399 485 366Q485 326 512 231T539 84Q539 -14 460 -77T273 -141Q248 -141 234 -140T198 -131T160 -106T134 -59Q128 -40 124 -16T117 22T108 49T91 69T59 75T15 65L1 59Q-8 76 -7 77Q4 85 22 97T88 129T170 149Q218 149 234 125Q242 112 242 43V21Q242 -17 248 -41T274 -85T322 -105H325H330Q363 -105 396 -75Q424 -47 424 4'], - - // LATIN CAPITAL LETTER K - 0x4B: [681,27,789,20,806,'234 109Q234 144 194 245T153 404Q153 445 180 490Q232 572 325 626T517 681H524Q612 681 661 658Q683 647 699 632T717 604Q717 600 708 545L699 490L690 489Q681 488 679 488Q675 488 669 504T640 546T577 592Q520 620 446 620Q415 620 386 614T327 594T280 553T262 487Q262 468 265 447T271 413T279 384T285 362L295 371Q320 396 352 421T439 474T538 502Q577 502 596 484T627 428Q642 386 651 373T677 360H682Q698 360 727 369L724 357Q724 354 724 351T722 346V344Q559 289 539 283Q582 272 589 271L615 265L637 189Q662 109 663 108Q668 97 682 84Q698 68 722 68H730H738Q762 68 799 91L803 80L806 70Q795 59 770 40T703 -3T631 -26Q598 -26 578 -8Q548 24 536 92Q524 154 509 183T477 218T428 224Q409 224 385 220T346 212L331 207Q330 205 330 201T331 189T332 178Q332 158 325 116L305 96Q269 60 240 38Q171 -21 123 -21Q72 -21 33 18L20 32L62 74Q96 107 102 112T116 118Q120 118 122 113T131 95T150 69Q171 48 190 48Q198 48 206 51T224 69T234 109ZM519 367Q497 432 450 432Q379 432 313 333L300 314L304 299Q306 294 309 280T315 260L321 235L542 313Q530 325 519 367'], - - // LATIN CAPITAL LETTER L - 0x4C: [683,28,786,30,764,'277 226Q277 248 253 286T203 369T178 449Q178 490 212 533T284 607Q380 683 532 683Q610 683 639 660T668 583Q668 568 666 546T663 509Q663 478 683 460Q691 452 719 452L738 450Q732 437 729 437Q728 437 652 416T573 394Q554 394 541 409T527 444Q527 449 532 487T538 542Q536 584 501 606T418 628Q389 628 364 620T317 587T295 523Q295 478 333 401T372 276Q372 269 371 267Q371 264 318 206L264 149Q284 141 317 130T433 101T577 82Q619 82 652 95T701 127T728 164T742 196L744 209Q744 210 749 208T759 203T764 199T760 185T751 154T744 129Q714 42 680 13Q628 -28 566 -28Q490 -28 403 -5T249 42T153 66T106 53T70 15T47 -16Q46 -17 30 -5L39 13Q85 100 138 148L147 156L161 157Q218 165 246 179T277 226'], - - // LATIN CAPITAL LETTER M - 0x4D: [683,32,1239,27,1232,'134 338Q134 357 81 417T27 504Q27 516 34 530Q55 568 110 615Q190 683 305 683H314Q445 683 495 580L501 569L512 577Q608 646 681 646Q759 646 801 585L808 576L816 583Q860 619 921 650T1041 682Q1063 682 1077 675T1096 660T1112 631T1132 596Q1160 555 1188 555Q1204 555 1228 564Q1230 565 1231 562Q1231 560 1232 554V547L1215 538Q1179 521 1114 475Q1112 474 1106 470T1099 464T1093 459T1088 452T1085 441T1082 425T1081 404T1079 376T1079 339Q1079 282 1084 236T1098 160T1117 112T1138 85T1159 77Q1166 77 1180 81T1207 90L1219 94Q1220 94 1221 86T1222 76L1045 -32Q1044 -32 1004 15L964 64V167Q965 334 970 372V378L994 402Q1032 440 1057 460Q1061 463 1066 467Q1070 469 1070 470T1068 471T1060 474T1050 481Q1040 488 1021 531T996 583Q979 609 947 609Q922 609 887 592T820 537L821 524Q825 484 825 448Q825 268 768 155L759 137L589 -28L579 -20Q533 17 507 17Q475 17 449 -7L436 -18L424 2L441 20Q446 25 456 36T471 52T484 65T497 79T509 90T522 99T534 106T548 112T561 115T576 117Q602 117 639 86Q648 81 648 81Q650 82 657 94T668 112Q711 202 711 373Q711 484 677 533T600 583Q592 583 583 581T569 577T554 568T542 560T528 549T516 539L519 523Q527 485 527 461Q527 444 522 407Q506 266 447 150L437 130L217 -25L208 -15Q165 28 126 28Q89 28 62 1Q47 -14 43 -14Q42 -14 36 -8L28 0L44 17Q96 73 120 92T166 117Q182 123 204 123Q239 123 284 78L295 67Q307 72 337 102Q400 178 400 346Q400 508 325 571Q270 618 208 618Q180 618 168 614T140 594Q124 578 124 564Q124 540 182 480T240 396Q240 359 197 321Q154 285 94 252L80 245L76 248L67 257L61 262L71 268Q82 275 94 284T120 309T134 338'], - - // LATIN CAPITAL LETTER N - 0x4E: [679,30,983,25,973,'522 492Q521 492 517 502T512 513Q542 444 542 333Q542 226 503 137L498 125L396 53Q308 -8 292 -17T260 -27Q226 -27 191 -9T136 29L145 39Q162 56 192 89L230 129L235 128H241Q276 57 332 57Q358 57 391 80Q403 89 409 100T422 143T428 227Q428 329 406 408T347 530T272 594T196 615Q152 615 135 596T118 558Q118 535 146 502T203 438T232 385Q232 357 195 322T122 265T83 243Q82 242 72 249T61 258L66 262Q72 265 82 273T103 292Q125 314 125 333Q125 351 101 376T51 432T26 492Q26 549 108 614T290 679Q326 679 335 678Q353 675 370 670T400 658T425 642T445 625T463 606T477 588T487 571T495 556T500 543L504 535L523 553Q553 581 569 595T619 632T686 667T757 678Q778 678 793 675T819 664T833 651T844 633T852 617Q884 548 910 548H916Q938 548 962 556L967 542Q967 540 947 531Q909 509 883 492T847 467T838 458Q825 419 825 328Q825 234 833 191T858 121Q875 94 892 77Q898 71 907 71Q912 71 928 76T957 87T971 91L972 88Q972 84 972 81L973 73L957 63Q891 21 806 -23L794 -30L783 -14Q766 13 728 60L713 79V372L724 384Q743 406 765 427T800 460L813 471Q809 472 806 472Q783 479 766 503T741 551T715 594T672 614Q644 614 622 595Q597 576 572 550T534 508L522 492'], - - // LATIN CAPITAL LETTER O - 0x4F: [726,30,976,12,881,'254 595Q269 583 269 581L262 577Q256 573 247 566T228 549T212 527T205 502Q205 480 266 386T328 277Q328 234 239 150L221 134L231 133Q264 131 376 99T516 62Q567 50 604 50Q614 50 626 52Q643 57 662 71T703 115T739 198T753 323Q753 454 692 517Q652 555 584 565T382 577Q365 577 357 577H308L300 591L292 606Q292 608 342 665L392 724L403 725Q406 725 411 726H416L417 725L412 715Q408 705 408 698Q408 684 423 679Q431 677 516 672T663 655Q757 634 806 593T873 463Q881 421 881 380Q881 340 874 306Q859 223 809 147Q801 134 789 124Q595 -30 456 -30Q395 -30 289 3T147 36Q134 36 121 33T98 26T76 15T59 4T44 -8T32 -17L22 -7L12 4L56 59L100 114L116 118Q217 142 217 199Q217 230 185 276T120 365T87 430Q87 435 109 464T172 534T254 595'], - - // LATIN CAPITAL LETTER P - 0x50: [688,223,977,33,943,'247 398Q247 372 206 334T126 272T83 247Q82 247 72 253T61 261Q60 261 61 262T66 265Q127 306 127 343Q127 364 63 430Q42 451 38 458T33 480V490V497Q33 526 63 567Q112 632 170 660T282 688Q341 688 384 667Q454 633 482 566Q483 565 484 566T496 574Q562 623 630 653Q699 681 751 681Q778 681 797 673Q818 662 830 609Q835 580 843 564Q863 524 895 524H901Q917 524 932 528Q936 522 938 518T942 513T942 511Q873 480 836 454Q789 423 789 395Q789 362 834 298T880 200Q880 170 867 145T820 81Q733 -20 647 -20Q581 -20 499 21V9Q499 -16 502 -53T509 -116L512 -141L370 -223L357 -216Q344 -209 344 -208L348 -196Q370 -113 370 33V52L355 58Q307 76 284 76Q258 76 228 60T183 29T141 -11Q137 -7 133 -2L126 7L134 18Q181 89 210 121T278 170Q304 179 328 179Q336 179 358 177L370 175Q368 268 367 359Q367 416 363 434Q362 438 362 441Q348 527 302 574T203 621Q169 621 148 599T127 557Q127 535 187 476T247 398ZM673 315Q673 357 786 442Q786 443 776 444T750 449T727 462Q719 471 716 484V496Q715 507 715 515Q715 571 698 588Q680 611 643 611Q592 611 547 571Q534 558 511 522L499 505V139L543 123Q702 64 744 64Q770 64 781 79T793 112Q793 143 733 217T673 315'], - - // LATIN CAPITAL LETTER Q - 0x51: [726,83,976,12,918,'254 595Q269 583 269 581L262 577Q256 573 247 566T228 549T212 527T205 502Q205 480 266 386T328 277Q328 234 239 150L221 134L231 133Q264 131 376 99T516 62Q567 50 604 50Q614 50 626 52Q643 57 662 71T703 115T739 198T753 323Q753 454 692 517Q652 555 584 565T382 577Q365 577 357 577H308L300 591L292 606Q292 608 342 665L392 724L403 725Q406 725 411 726H416L417 725L412 715Q408 705 408 698Q408 684 423 679Q431 677 516 672T663 655Q757 634 806 593T873 463Q881 421 881 380Q881 340 874 306Q864 250 838 196T791 126Q748 93 733 82L715 69Q714 68 723 60T748 40T774 23Q806 2 832 2Q849 2 870 6T904 14L917 17Q917 12 918 6V-3L882 -22Q806 -60 778 -73L755 -83Q640 -36 596 -7L586 0L576 -4Q513 -30 457 -30Q394 -30 289 2T149 35Q119 35 93 22T52 -4T36 -17T24 -7T12 4L56 59L100 114L116 118Q217 142 217 199Q217 230 185 276T120 365T87 430Q87 435 109 464T172 534T254 595'], - - // LATIN CAPITAL LETTER R - 0x52: [688,28,978,31,978,'31 498Q34 541 76 586T176 659T279 688H290Q377 688 429 653T506 569L511 558L526 572Q620 663 707 682Q722 685 737 685Q781 685 804 665T830 619T838 565T854 525Q866 511 897 511Q917 511 925 513L937 515Q938 515 941 509T944 501T925 493T870 470T803 438Q735 406 735 401Q735 400 741 399T767 390T814 374L828 367L829 307Q829 233 833 202T852 144Q873 109 896 90Q906 82 928 82T976 95V92Q976 88 978 72L807 -28Q768 39 733 87L718 108V149Q718 230 714 257T693 298Q654 333 580 333Q524 333 520 329Q520 300 489 224T443 133Q441 131 333 53T223 -27Q221 -26 204 -11T169 16T136 28Q110 28 66 -8L56 -16Q52 -13 40 -1L48 7Q165 124 211 124Q232 124 287 77L298 67Q309 73 337 97Q397 150 397 347Q397 419 379 474T330 560T269 604T207 619Q177 619 152 601T126 563Q126 540 185 479T244 387Q240 336 160 289Q144 278 98 255L80 246L62 261L79 272Q96 283 113 301T130 337Q130 353 115 373T81 410T47 451T31 498ZM524 358Q537 358 657 405T777 457Q777 459 768 459Q749 462 738 474T723 499T714 539Q706 585 697 599Q681 618 657 618Q632 618 597 595T532 515L525 502L524 441Q524 375 523 369Q523 358 524 358'], - - // LATIN CAPITAL LETTER S - 0x53: [685,31,978,82,905,'457 -31Q356 -31 272 6T135 120T82 304Q82 372 106 430T170 527T241 588T305 626Q341 643 386 657T460 678T495 685T554 660T674 609T778 584Q800 584 818 591T848 610T866 633T878 651T883 659L893 649L901 639Q879 574 803 532T666 490Q661 490 657 490T650 491T641 492T633 495T622 500T610 505T595 513T577 522T554 533T527 547Q436 594 415 602Q393 608 374 608Q303 608 253 545T202 386Q202 229 307 135T568 41Q674 41 748 85T822 198Q822 244 779 283T639 322Q595 322 499 303T383 283Q358 283 335 290T291 318T270 374Q270 418 313 460T424 510H431L435 505L440 500Q425 496 403 475T380 427Q380 382 431 373Q437 372 475 372Q543 372 626 388T742 404Q831 404 868 362T905 260Q905 182 831 108Q692 -31 457 -31'], - - // LATIN CAPITAL LETTER T - 0x54: [686,30,790,30,802,'666 641Q737 641 794 686L802 662Q790 648 734 596L677 541L664 538Q630 528 583 528Q540 528 482 537L461 541Q402 512 402 456Q402 427 439 387T512 311T549 253Q549 220 455 139L440 126Q541 75 586 75Q600 75 619 80T654 94T685 110T709 124T719 130Q722 125 725 119L730 108Q700 72 568 -18Q551 -30 542 -30Q495 -30 404 6T270 42H263Q213 42 142 -11L131 -19L129 -8Q126 1 126 4Q218 84 301 126L316 134H406L413 142Q436 165 436 189Q436 202 421 221T364 281Q336 307 318 328T296 356T283 381L290 394Q338 478 410 540Q419 549 417 549Q415 550 369 558T268 575T195 584Q153 584 127 567T100 523Q100 499 116 479T151 447T170 433Q170 429 171 428Q171 427 131 394T88 359Q82 363 73 370T47 403T31 457Q31 513 79 565T197 648T332 679Q369 679 490 660T666 641'], - - // LATIN CAPITAL LETTER U - 0x55: [688,39,851,18,871,'273 244Q273 281 244 331T186 428T155 502Q155 524 165 536Q239 634 333 688Q338 684 345 680L356 672L344 664Q310 642 295 624T280 582Q280 550 303 505T348 407T371 300Q371 270 362 248L247 123L358 92Q452 64 484 64Q507 64 523 72Q553 87 573 109Q583 121 586 146T593 283Q594 303 594 344Q594 401 591 461T584 558L581 595Q598 600 623 611T672 634T719 659T754 678L768 686Q770 686 784 673L782 670Q781 668 777 664T768 655Q747 635 738 616T721 535T714 359Q714 205 723 176Q727 164 744 133T771 89Q780 75 804 75Q814 75 853 87L867 92L871 73L671 -39L654 -10Q636 20 619 50T600 83Q600 84 589 75T539 34Q478 -16 475 -19Q469 -22 449 -28T414 -34Q410 -34 394 -32Q356 -28 282 -2L237 15Q169 38 126 38Q106 38 85 27T51 4T37 -8T27 -1T18 8Q18 10 70 63T124 116Q154 123 176 131T223 154T260 191T273 244'], - - // LATIN CAPITAL LETTER V - 0x56: [685,29,982,25,966,'133 343Q133 360 79 416T25 496Q25 523 58 563T118 624Q197 685 293 685Q331 685 339 684Q453 665 489 558L493 546Q521 570 553 596T640 653T725 684Q753 684 783 672T844 641T889 618Q895 616 912 616Q924 616 936 617T956 620T965 622T966 612V604L952 595Q924 576 895 549Q864 517 856 496T847 448V434Q847 395 848 388L859 323Q874 241 874 212Q874 142 830 96Q796 62 724 14Q661 -29 603 -29Q555 -29 421 28T242 86Q182 86 110 31Q105 28 102 26T99 25Q88 36 88 42Q95 54 222 142Q252 163 262 165Q319 183 344 218Q378 266 378 377Q378 444 362 494T319 571T266 610T212 623Q181 623 156 603T131 562Q131 539 154 512T206 458T243 416Q246 409 246 399Q246 387 242 377T225 351T178 311T94 259L79 251Q72 256 68 261T62 268L61 270L70 277Q131 318 133 343ZM822 526Q778 531 719 564T628 597Q611 597 579 574Q543 543 513 506L505 495L506 473Q506 469 506 461T507 449Q507 348 467 271L462 261L404 218L348 174Q349 173 356 173Q384 169 450 144L546 105Q665 56 708 56Q737 56 746 72T756 118Q756 129 755 135L741 219Q725 314 725 334V344Q725 416 736 431Q748 450 815 510L832 526H822'], - - // LATIN CAPITAL LETTER W - 0x57: [683,30,1235,26,1240,'133 317T133 338T80 413T26 496Q26 532 83 591Q100 608 111 616T151 644T219 672T304 682Q381 682 434 646T506 564L510 557Q513 557 534 573L677 665L707 683L790 561L803 572Q933 682 1001 682Q1037 682 1098 650T1193 616Q1208 616 1222 619L1235 622Q1239 622 1239 616Q1239 611 1240 609Q1240 608 1206 577T1138 503T1104 430Q1104 409 1123 330T1142 208Q1142 183 1136 147Q1127 118 1117 106Q1114 103 1031 48T935 -14Q930 -18 908 -22T862 -27Q826 -27 759 -6T647 26Q597 38 578 38Q573 38 561 33T533 20T505 4T480 -10L469 -16L452 -26L439 -28Q423 -30 411 -30Q358 -30 279 7T169 45Q125 45 58 -5L47 -14L41 -4L35 8Q35 11 56 29T113 75T181 125L200 139H217Q279 143 320 180T377 270T394 393Q394 453 378 498T334 568T277 605T213 617Q177 617 155 607Q140 600 130 587T119 560Q119 545 137 522T177 479T217 434T236 393Q236 324 98 251L89 246L76 253L63 261Q91 275 112 296ZM1088 526Q1066 526 1004 556T909 586Q863 586 816 539L802 526L804 514Q814 461 814 411Q814 319 781 238Q772 214 760 198T730 165T702 136L715 133Q759 122 848 90T973 57Q1003 57 1017 80Q1022 93 1022 116Q1022 152 1003 241T983 377V391Q983 405 985 409T1002 429Q1019 450 1045 475T1090 514L1107 528Q1104 527 1102 527T1096 527T1088 526ZM699 358Q699 391 696 419T688 467T675 503T660 530T642 550T626 563T608 574T593 582Q581 575 559 554T524 512Q523 510 523 477Q523 315 444 218L435 207L368 169Q301 132 301 131Q307 128 315 125L377 99Q476 57 515 57Q534 57 608 94L627 102L636 111Q699 187 699 358'], - - // LATIN CAPITAL LETTER X - 0x58: [681,35,849,32,835,'273 679Q354 674 408 633T477 525L484 533Q496 548 524 574T571 615Q594 633 625 649T675 673T699 681Q724 632 747 607Q754 601 756 599T765 594T777 591T794 590Q818 590 834 594V585L835 577L704 513L693 518Q657 534 631 560T597 599Q596 601 581 584Q495 490 489 379V366H562L681 369Q682 369 679 366T668 355T651 341L620 314H485V295Q490 190 543 125T686 60Q720 60 789 88L801 93V89Q798 83 798 66Q781 59 685 -10L665 -25L634 -30Q596 -35 594 -35Q570 -35 536 -23T477 19Q461 37 445 67T418 118L409 138Q401 131 388 120T340 79T273 28T206 -12T151 -31Q129 -31 90 -12T32 22L113 101Q114 101 120 96T136 84T160 69T189 56T221 51Q256 51 305 90Q376 149 376 301V315H293Q276 315 251 315T210 314T190 313L168 312Q168 313 200 340L231 368L238 367Q275 367 311 366H378V387Q376 470 355 512T291 572Q274 579 252 579Q223 579 197 568T156 544T131 519T117 508Q112 512 108 518L99 527L117 545Q177 604 255 665L273 679'], - - // LATIN CAPITAL LETTER Y - 0x59: [688,214,984,34,878,'34 496Q34 518 53 549T107 610T195 661T310 682Q357 682 398 663T460 611Q467 600 475 583T489 554T495 542Q495 544 531 570T617 629T700 676L724 688Q742 670 756 657T784 635T806 621T830 606T856 592Q878 416 878 340Q878 154 805 -3L798 -20L779 -40Q706 -113 613 -163T421 -214Q359 -214 317 -196T256 -160L306 -63L313 -64L320 -66L326 -79Q337 -104 349 -120T392 -151T470 -166Q576 -166 644 -101Q750 7 750 292Q750 426 721 495T617 565H611Q563 565 513 509L506 501L508 493Q508 490 509 475T510 445Q510 319 458 236L451 225L436 216Q406 198 365 169T318 134L332 127Q336 126 397 103T489 80H493Q527 80 593 129L604 137L607 127Q610 119 610 116Q610 114 592 95T543 46T484 -4Q450 -27 446 -27Q441 -27 402 -18Q365 -9 290 20T188 50Q135 50 64 -7L52 -17L43 -7L34 2L51 19Q118 87 177 132L192 143H215Q259 145 289 155T335 184T355 214T366 245Q382 306 382 388Q382 426 381 436Q368 520 318 570T214 621Q184 621 165 608T142 583T137 562Q137 541 163 508L201 469Q245 425 251 408Q253 403 253 398Q253 383 240 366T212 335T161 295Q128 271 99 253L89 247L77 256L65 266L76 273Q125 301 134 329Q136 334 136 342Q136 357 124 372T88 410T49 455Q34 479 34 496'], - - // LATIN CAPITAL LETTER Z - 0x5A: [677,148,711,-5,624,'278 601Q242 601 212 591T167 570T121 533Q114 528 111 525L93 550Q223 661 244 667Q299 677 356 677Q415 677 456 666T515 634T541 596T549 555Q549 513 529 478T480 421T424 388T377 372Q365 370 365 367Q365 365 389 365T450 358T523 337T588 282T623 183Q624 177 624 161Q624 20 524 -60Q415 -148 285 -148Q242 -148 213 -139Q181 -131 159 -109Q136 -87 127 -56T114 6T104 49Q94 69 57 69Q38 69 13 58L1 53Q1 55 0 59T-3 68T-4 76Q78 130 138 142Q150 144 162 144Q213 144 227 120T242 31Q242 -30 263 -66T345 -102Q397 -102 444 -52T491 107Q491 172 471 211T428 265Q392 288 306 288Q269 288 233 284L218 282Q208 289 208 291L229 324L251 359Q250 360 248 360Q239 360 248 371L256 381H273Q344 385 378 409T413 495Q413 537 384 569T278 601'], - - // LEFT SQUARE BRACKET - 0x5B: [740,130,257,36,226,'226 711T225 711T86 699V-93H89Q94 -93 157 -96T223 -100H226V-119H223Q134 -119 42 -130H36V740H42Q61 738 156 736H226V723Q226 711 225 711'], - - // RIGHT SQUARE BRACKET - 0x5D: [738,132,257,14,208,'69 732Q116 733 146 734T184 736T197 737T206 738H208V-132Q190 -129 160 -127T99 -125T66 -124H14V-103H19Q20 -103 84 -98T152 -92H158V699H151Q148 700 85 703T18 708H14V732H69'], - - // CIRCUMFLEX ACCENT - 0x5E: [734,-452,590,1,584,'1 463T1 464T148 599T296 734Q584 486 584 485L561 472Q538 459 537 461Q296 672 293 672L161 563Q133 539 97 509T44 466L28 452Q27 452 14 457'], - - // LATIN SMALL LETTER A - 0x61: [472,32,603,80,586,'80 129V151Q80 241 99 363Q99 367 111 372T172 401T285 465L297 472Q340 455 405 443L423 440L455 453Q486 467 489 467L497 461L494 451Q480 390 480 292V283Q480 207 483 155L484 143L535 80L558 90L582 99Q586 95 586 83Q586 81 513 25L443 -29Q410 16 386 40L371 55V61Q371 63 371 67T370 74V80L278 25Q186 -29 184 -31Q182 -32 160 -12T112 35T80 75V129ZM359 366Q334 366 300 371T243 382L221 388Q218 388 212 375T200 323T194 228Q194 191 197 152L198 139L217 120Q245 92 269 74L279 66L304 78Q338 95 349 100L369 110V152Q368 164 368 210T367 275Q367 358 366 361V366H359'], - - // LATIN SMALL LETTER B - 0x62: [690,32,590,86,504,'99 398Q99 610 86 662Q86 665 95 669T106 674L108 669Q109 664 112 654T119 635Q122 626 125 616T130 601L131 596Q214 649 273 678Q295 690 298 690Q299 690 304 688T313 682L317 679Q275 653 240 612Q210 569 210 469V459Q210 450 210 432T211 406L212 378L285 425Q301 435 321 447T350 466L360 472Q360 473 361 473T368 471T401 456T465 429L501 414V408Q504 386 504 309Q504 255 500 203T491 125T485 97Q485 95 445 74T343 23T237 -24L214 -32Q197 -22 165 3T109 49T87 73Q99 169 99 398ZM386 251Q386 320 380 347V350L305 374L282 382L214 348L213 274Q213 184 214 165V131L230 119Q288 76 349 54Q386 137 386 251'], - - // LATIN SMALL LETTER C - 0x63: [473,26,464,87,424,'227 393Q215 393 210 351T205 269Q205 161 213 153Q220 145 244 125T290 88L312 72L365 92Q414 113 418 113V93L365 60Q255 -9 221 -26L211 -18Q158 21 91 88L90 107Q87 167 87 225Q87 267 90 302T96 351T100 366L295 473L311 470Q340 464 368 454T410 437T424 429L347 334L342 333H337L325 342Q299 363 271 378T228 393H227'], - - // LATIN SMALL LETTER D - 0x64: [632,28,589,-1,511,'88 117Q88 177 91 231T97 310T102 341Q102 343 118 357T168 397T239 447L257 459L268 454L278 449Q242 416 238 412L219 394Q219 391 216 378T211 349T206 307T203 249Q203 211 206 166L208 148Q224 132 261 108T333 70Q341 66 342 67T350 79Q393 157 393 302Q393 368 388 406V411L371 424Q199 558 101 558Q69 558 28 545L18 542L8 549L-1 557L24 569Q61 587 147 621L177 632Q179 631 194 627T216 621T240 613T269 602T302 589T340 571T382 549T431 522T484 488Q504 475 504 472Q511 449 511 365Q511 248 474 129L468 108L451 96Q427 77 347 28T254 -28Q235 -20 174 21T89 86L88 117'], - - // LATIN SMALL LETTER E - 0x65: [471,27,472,81,428,'309 69Q391 98 416 108Q418 106 422 100T425 92Q419 86 326 30T229 -27Q228 -27 207 -13T154 27T97 76L85 87L84 106Q81 152 81 194Q81 295 93 359L95 369L286 471L313 449Q376 397 414 372L428 362Q428 360 375 318L188 181V170Q188 156 189 153V148L203 138Q228 119 266 94T309 69ZM209 389Q208 388 204 366T194 307T187 244Q187 225 188 225T201 233L245 261Q283 284 291 291Q324 313 324 316L296 334Q280 343 259 357T224 380L210 390Q209 390 209 389'], - - // LATIN SMALL LETTER F - 0x66: [687,222,388,35,372,'128 400Q127 401 121 422T108 478T99 540V555L111 569Q135 597 165 626T214 671T235 687L249 678Q263 668 282 659T315 650Q335 650 362 666L372 654L286 569H271Q205 576 173 586V583Q173 558 208 492T252 401Q253 399 310 399T367 398L332 355H254V311Q251 160 235 16Q230 -28 226 -36Q225 -38 221 -45Q171 -140 121 -211L113 -222H104Q94 -222 94 -220Q94 -215 105 -187L121 -145Q139 -80 139 35V93Q139 222 135 314L134 354Q134 355 84 355H35L84 399H106Q128 399 128 400'], - - // LATIN SMALL LETTER G - 0x67: [472,208,595,17,541,'92 71Q92 74 91 88T88 128T86 183Q86 230 91 275T102 342T109 366Q115 372 207 422T305 472Q407 426 431 426Q435 426 476 445L519 465L525 463L532 461Q497 392 497 268Q496 255 496 233Q496 179 516 92T539 -10L541 -22L526 -38Q441 -126 355 -194L339 -206L327 -207Q324 -207 319 -207T310 -208Q242 -208 171 -179T73 -131L56 -141Q40 -150 38 -150Q17 -140 17 -137Q17 -136 18 -136T98 -79L176 -23Q174 -21 134 24T92 71ZM226 393Q224 393 221 372T214 312T210 235Q210 182 214 144L215 132L230 118Q281 70 301 66Q304 66 331 80T373 105L384 112L383 165Q383 224 387 309Q387 314 387 319T387 329T388 336T388 341V343Q388 344 381 344T339 354T249 384Q246 385 243 386T236 389T231 391T228 392L226 393ZM414 -80Q414 -64 411 -43T403 -1T394 37T386 66T382 79Q381 79 286 15T189 -52Q312 -125 365 -125Q397 -125 405 -115T414 -80'], - - // LATIN SMALL LETTER H - 0x68: [687,207,615,89,507,'95 661Q95 662 103 667T113 672L126 634L137 596L147 602Q235 656 275 677L292 687L303 680Q305 679 307 677T312 674L313 672L310 670Q307 669 301 667T289 660T274 649T259 634Q250 622 244 611T233 585T226 560T222 528T221 497T220 456T219 413V377L232 384Q244 391 271 409T339 455L362 471L383 461Q425 440 491 415L504 410V406Q507 399 507 269Q507 76 486 -21Q485 -30 483 -33T461 -57Q382 -139 299 -207L281 -197L263 -186L266 -185Q268 -184 280 -177T312 -155Q344 -130 353 -116Q394 -59 394 117Q394 162 391 216T386 301T382 335Q382 338 365 346T323 364T281 376L250 362Q220 347 219 347Q213 336 213 232Q213 177 217 144L218 128L224 119Q244 92 263 71L272 60Q206 21 157 -24Q156 -24 151 -16T132 11T98 52L89 62L91 103Q104 289 104 436Q104 471 103 506T101 568T99 616T96 649L95 661'], - - // LATIN SMALL LETTER I - 0x69: [686,25,331,3,327,'73 613L164 686L184 666Q200 650 214 637T235 620T242 614T203 577T162 540Q158 540 122 570T73 613ZM92 58Q92 63 94 83T98 142T101 234Q101 318 97 358V366L59 387L40 379L21 371Q20 371 12 376T3 382L38 406Q78 431 125 466L138 477Q149 468 186 444L219 422V389Q215 324 215 247Q215 136 222 123Q226 113 238 98T258 83Q263 83 292 94L322 104Q322 103 324 97T327 89Q327 88 317 82T272 52T190 -7Q166 -25 164 -25L112 35Q92 55 92 58'], - - // LATIN SMALL LETTER J - 0x6A: [682,203,332,-19,238,'74 611L155 682Q172 666 186 655T208 636L235 614Q227 606 191 574L154 540L135 556Q101 582 84 601L74 611ZM10 377L144 477Q145 476 184 453T229 428L233 425V416Q238 346 238 252Q238 93 215 -16L213 -30L185 -57Q29 -203 19 -203Q17 -203 -19 -189L-9 -183Q52 -146 78 -116T114 -37Q120 31 120 192V237Q120 327 113 351T72 380L53 372Q34 362 32 364L10 377'], - - // LATIN SMALL LETTER K - 0x6B: [682,25,464,34,432,'106 72Q110 105 111 193T114 294V308H74L34 309L83 346H115V430Q114 591 106 652Q105 662 107 665T114 668T123 672Q125 672 139 635L152 597L154 598Q156 600 160 602T167 607Q193 625 226 644T279 672T302 682L312 676L321 670L312 665Q281 649 263 626T241 587T233 547Q232 541 231 530T230 510T230 501Q231 501 265 522T334 564T369 583L380 570Q428 509 428 481Q428 475 427 470T423 459T416 448T404 434T389 418T369 397T344 371L321 347L365 346H409L372 308H227V294Q227 272 230 208T234 138Q234 136 256 119T302 84L324 68L372 88Q421 108 422 108T432 90L421 83Q373 53 270 -5L234 -25L204 -1Q172 25 124 60L106 72ZM336 434Q336 452 327 472T308 503T297 514Q296 514 290 510T275 499T264 490Q230 458 230 358V346H247Q268 346 276 350T302 372Q328 398 335 423Q335 424 335 428T336 434'], - - // LATIN SMALL LETTER L - 0x6C: [681,24,337,100,312,'111 275Q111 406 108 518T104 650V657Q105 657 109 660T117 665T122 666L133 629L144 594L161 606Q218 642 272 670L294 681Q295 681 300 677T306 672L302 669Q298 666 292 662T278 651T263 637T251 621Q232 587 227 530T222 343Q222 226 230 125L231 112L244 98L258 83Q271 87 285 92L312 102V84Q297 72 231 24T163 -23L100 55Q110 141 111 275'], - - // LATIN SMALL LETTER M - 0x6D: [476,31,921,16,900,'115 203Q115 257 114 291T112 338T111 355Q111 357 93 370L75 384L54 375Q32 366 31 365Q27 365 16 378Q25 383 89 430L152 476Q175 453 228 420Q229 420 229 418T229 410T227 394L225 369Q279 400 315 425T363 461T376 471Q480 424 514 416V412Q514 411 514 404T513 392L511 376L520 382Q529 387 548 399T584 422Q599 432 618 444T648 463L657 469H658Q661 469 681 461T735 440T796 420Q803 418 803 416Q801 414 798 390T791 325T788 247Q788 220 790 172T794 123Q799 115 814 97T835 78H838Q841 78 867 89L895 101Q896 101 896 100T897 92T900 78L873 62Q810 23 761 -12L736 -30Q735 -30 729 -22T707 7T671 48L661 59Q674 93 674 207V219Q674 341 670 344Q655 353 591 372L576 376L544 364Q511 351 510 351Q507 349 507 224V132L535 95Q541 87 548 78T560 63L563 58Q563 57 504 15T444 -28L385 53L387 67Q396 114 396 206Q396 289 393 334Q393 346 390 348Q369 358 306 373Q301 373 265 361L228 349V335Q227 322 227 284Q227 206 231 157Q231 151 231 144T232 133V129Q232 125 259 90Q286 56 286 53Q287 53 284 51T273 43T258 31L173 -31L166 -20Q160 -11 145 7T119 38T108 59Q108 62 110 81T113 133T115 203'], - - // LATIN SMALL LETTER N - 0x6E: [473,28,654,5,608,'608 88Q572 65 535 37T477 -8T455 -25Q432 7 389 53L375 68L378 82Q386 160 386 195V221Q386 284 385 307L384 344Q352 359 306 373L286 379L213 353V273Q214 229 214 161V129L275 62L163 -28L150 -14Q136 0 121 16T91 44Q86 48 86 50Q95 83 96 148Q96 224 89 340L88 366L79 374Q69 384 67 385L64 388L55 383Q52 382 44 378T33 373L21 367L13 374Q5 379 5 381Q5 384 69 428L133 473Q135 473 147 464T179 443T215 424L214 400V376Q271 404 342 457L363 472Q363 473 364 473Q366 473 375 469T418 449T502 414L512 411V407Q502 330 502 217V197V132L523 109Q527 104 533 97T543 87T547 83L550 80L578 92Q603 103 604 103Q606 103 608 88'], - - // LATIN SMALL LETTER O - 0x6F: [482,35,609,107,515,'107 102Q107 178 112 242T123 334T129 362Q129 363 140 368T199 400T315 469L336 482L346 476Q409 439 498 414L514 410L515 389Q515 208 502 141Q494 101 491 94Q490 89 478 81Q430 51 375 23T288 -20T254 -34Q250 -34 200 -1T119 56L108 65L107 76V102ZM389 355Q367 358 346 363T309 372T282 381T264 388L257 390H256Q254 390 249 381T238 348T227 293Q226 280 226 237Q226 183 231 146L232 131L244 122Q285 91 323 74T374 57H377L380 68Q405 154 405 267Q405 315 401 349V354L389 355'], - - // LATIN SMALL LETTER P - 0x70: [557,207,604,-1,519,'66 435Q66 445 117 501T173 557Q174 557 183 555T193 551Q174 526 174 509Q174 496 190 472T233 428V386L377 482L399 471Q450 445 509 425Q519 421 519 420L518 419Q518 418 518 416T517 410Q517 405 518 381T519 335Q519 222 501 137Q492 84 489 84L473 75Q457 66 423 44T354 -6L338 -19L329 -13Q320 -8 313 -4T297 4T284 10T270 14T258 17T245 20T233 22V12L241 -161L214 -172Q187 -184 160 -195T131 -207Q127 -207 112 -202L113 -188Q113 -182 115 -77T118 31Q118 32 109 32Q63 27 23 0L10 -9Q5 -4 -1 8Q1 13 52 57T114 101H115L117 123Q117 141 117 230V359L110 367Q85 394 71 421Q66 433 66 435ZM384 83Q386 83 389 110T396 180T400 254Q400 294 395 339L394 349L379 355Q308 383 294 383Q290 383 263 372L234 360L233 245V130Q270 125 305 113T361 92T384 83'], - - // LATIN SMALL LETTER Q - 0x71: [485,211,596,87,515,'362 -196Q375 -92 375 47V78L282 24Q189 -29 188 -30Q187 -30 139 21T90 75Q87 84 87 158Q88 206 94 259T107 342L113 372L308 478L322 473Q374 452 421 444L433 442L503 485Q515 479 515 477Q485 378 485 56Q485 -100 494 -164V-171L381 -211L371 -207L362 -202V-196ZM280 72Q301 77 323 86T358 101T372 110Q372 268 377 346L378 358H374Q368 360 358 360T323 365T257 380L234 386Q231 386 229 379Q215 353 211 310T207 180Q207 152 208 150Q210 142 235 114T280 72'], - - // LATIN SMALL LETTER R - 0x72: [472,26,460,13,453,'23 367Q21 370 18 374T14 380L13 382L151 472L236 411L238 381L290 426Q298 432 307 439T322 452T333 461T342 467L344 469Q382 410 404 399Q410 397 416 397Q423 397 432 399T446 403L451 405Q453 405 453 399V393Q430 374 404 356T364 328T350 318L349 317Q321 320 276 356Q257 371 256 371Q253 374 249 366T242 351Q232 321 232 236Q232 214 232 205T232 182T233 162T235 148T238 137T242 129T249 120T257 114T268 105T281 95Q313 70 314 70L358 85Q377 92 389 96T402 100V90L403 80L229 -26L221 -18Q195 6 166 29T121 63T105 76T106 82T110 97T114 121T117 158T119 208Q119 269 114 329L113 341L103 350Q90 362 67 380L45 374L23 367'], - - // LATIN SMALL LETTER S - 0x73: [479,34,523,-24,481,'189 331Q190 304 196 282T207 252T214 244Q239 244 348 292L371 302L382 297Q398 290 415 279T433 265Q442 238 442 166Q442 103 423 45Q416 42 380 29T310 3T244 -26L227 -34Q139 40 73 40Q61 40 48 37T24 30T6 22T-8 14L-13 11Q-14 11 -18 18T-23 26T38 75T102 125Q107 128 146 131H153Q192 131 296 56Q318 40 318 43Q323 48 323 114Q323 157 321 177L319 194Q308 208 291 216T261 225Q239 225 160 185L123 167Q85 205 79 227Q78 230 78 304V377L171 428Q264 479 265 478Q268 478 287 465T334 440T384 427Q423 427 475 463L478 453Q481 446 481 442Q481 439 410 391L339 342H331Q309 345 277 361T222 391T198 406T195 399T191 372T189 331'], - - // LATIN SMALL LETTER T - 0x74: [648,27,393,43,406,'328 69Q401 102 403 102Q404 102 405 94T406 84Q406 83 318 28L230 -27Q223 -21 206 -5T171 25T132 54L124 60V71Q129 154 129 297V359H43L44 363Q44 365 44 367L45 369L48 372Q51 374 57 378T68 387L90 405H129V553L285 648Q304 641 306 640L260 598V592Q259 589 255 505T249 413V405H353V402Q353 399 328 379L303 360H245V319Q245 150 253 125Q257 115 276 101T311 78T328 69'], - - // LATIN SMALL LETTER U - 0x75: [472,32,589,9,603,'444 -31Q444 -29 384 66Q382 66 364 58T309 30T231 -17Q214 -29 212 -29L197 -20Q172 -4 140 11T88 34L68 42Q68 43 73 49T85 67T100 98T113 149T118 221Q118 272 105 332L100 356L58 383L23 365L9 379L76 425Q141 472 144 472Q144 471 183 443L221 414V404Q224 365 224 275V253Q224 159 196 113Q191 104 193 104Q203 104 285 72L308 62L374 89L375 106Q375 266 373 340Q373 364 371 396V424L430 445L491 467Q493 467 499 463T505 457Q505 456 503 442Q488 335 488 187V158L529 81L534 80Q541 80 568 90L598 101Q605 94 602 87L524 27Q445 -32 444 -31'], - - // LATIN SMALL LETTER V - 0x76: [546,27,604,56,507,'95 67Q104 80 104 193Q104 261 100 321L98 355L91 363Q56 402 56 421Q56 441 82 472T132 524T159 546Q174 542 175 542Q159 520 159 501Q159 481 205 432L221 415L220 401Q219 394 219 387L288 429Q309 441 325 451T347 465T358 472T365 476L504 415V409Q504 408 505 374T507 318Q507 155 474 91L469 80L343 26Q314 14 281 0T232 -20L216 -27L202 -15Q192 -5 152 28Q141 35 126 45T103 60T95 67ZM386 349Q302 389 287 389Q271 383 253 375L220 361V136Q226 120 256 100T312 68T342 56Q355 56 360 68Q389 134 389 258Q389 310 386 341V349'], - - // LATIN SMALL LETTER W - 0x77: [549,32,918,55,815,'90 58T90 59T92 64T97 78T102 105T107 150T109 218Q109 290 103 350V356L83 377Q55 407 55 425Q55 445 138 528Q158 549 162 549L164 548Q165 548 167 548T170 547L175 546L172 540Q168 533 165 523T161 502Q161 479 216 430L229 419V382Q232 382 366 471Q407 445 500 408L511 404V387L512 370L595 420Q678 469 679 469L693 462Q756 431 795 417L815 409L814 380Q812 187 782 96Q774 71 766 62T744 48T684 25T577 -23L557 -32L546 -26Q536 -19 519 -10T481 10T436 31T393 47Q384 50 380 50Q380 52 381 58T384 77T387 104Q391 174 391 256V292L390 333L377 340Q350 357 304 373L294 376L227 355V348Q224 322 224 243Q228 117 232 112L235 108Q238 103 245 95T257 80L281 50Q281 49 227 10T172 -29L159 -13Q133 19 116 36T94 56ZM652 64Q658 64 667 84T685 162T697 303V336L686 341Q653 356 619 367L591 376Q590 376 553 361T514 344T512 324T510 275T508 221Q508 167 510 152T521 126Q537 112 590 88T652 64'], - - // LATIN SMALL LETTER X - 0x78: [471,188,459,8,441,'8 -90Q8 -68 13 -63Q13 -56 53 -8T120 63L128 71L129 85Q133 120 134 182Q134 308 131 331T106 365Q100 367 97 369L75 381L35 365L20 377Q20 378 47 397T110 440T161 471L253 413V396Q253 378 254 378L309 422Q364 466 365 466Q365 467 366 466T370 461T376 454Q403 419 426 396L441 380L438 377Q438 376 433 372T420 359T404 344L372 314Q351 320 338 327T310 344T277 364Q261 364 252 316Q251 306 251 235Q251 136 255 129Q257 127 258 124T268 113T298 92Q334 68 335 68Q340 70 349 73T377 84T408 95T421 99Q422 99 422 90L423 82L334 26Q246 -28 243 -28L200 8Q156 43 148 43Q144 43 130 36T99 9T83 -36Q83 -67 121 -89T198 -118L237 -124V-129L238 -133L193 -160Q183 -166 171 -173T152 -184L146 -188Q140 -187 131 -185T98 -173T56 -154T23 -127T8 -90'], - - // LATIN SMALL LETTER Y - 0x79: [557,221,589,60,512,'280 53Q272 47 246 27T199 -10T176 -27L167 -18Q137 17 107 44L90 60L93 71Q108 130 109 290V331Q109 339 109 344T108 353T107 359T105 364T102 369T97 374T91 381Q60 412 60 432Q60 448 86 479T138 534L164 557Q168 553 180 553Q163 532 163 511Q165 491 186 468Q206 443 231 423V404L232 385L371 477L389 468Q439 441 498 418L512 412V386Q512 360 507 190T500 14Q488 -26 445 -67Q401 -111 355 -148T282 -203T249 -221Q247 -220 230 -210T213 -199T229 -191T269 -172T306 -151Q361 -120 379 14Q391 92 391 182Q391 218 386 305Q384 339 380 341Q363 353 330 366T288 379Q282 379 258 368L230 356V181V141Q230 127 232 120T236 108T251 89T275 59L280 53'], - - // LATIN SMALL LETTER Z - 0x7A: [471,214,461,-7,378,'153 371Q141 371 126 365T100 354T78 340L65 331L57 338L50 346L62 356Q133 419 222 471Q274 453 306 422T338 366Q338 356 329 346T283 301L243 264L262 257Q298 246 361 214Q378 154 378 73Q378 33 371 -9T356 -74T345 -104Q340 -106 267 -160L191 -214H177Q60 -214 13 -150Q-7 -122 -7 -115Q-7 -112 19 -77T106 25T241 149Q241 152 227 158T181 173T109 185V190L108 194L158 229Q212 267 223 278T234 306Q234 329 208 350T153 371ZM258 1Q258 42 257 68T254 105T252 118Q235 105 210 85T144 22T102 -45Q102 -79 146 -106T234 -133H238Q248 -128 254 -80Q258 -58 258 1'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Fraktur/Bold/BasicLatin.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/Main.js deleted file mode 100644 index 7cf5fdaaf4..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/Main.js +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Fraktur/Bold/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Fraktur-bold'] = { - directory: 'Fraktur/Bold', - family: 'MathJax_Fraktur', - id: 'MJFRAKB', - weight: 'bold', - Ranges: [ - [0x0,0x7F,"BasicLatin"], - [0x80,0xDFFF,"Other"], - [0xE300,0xE310,"PUA"] - ] - - -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Fraktur/Bold/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/Other.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/Other.js deleted file mode 100644 index 71b794acc2..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/Other.js +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Fraktur/Bold/Other.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Fraktur-bold'], - { - // LEFT SINGLE QUOTATION MARK - 0x2018: [708,-411,254,53,187,'187 456Q187 437 169 424T138 411Q114 411 84 454T53 538Q53 565 75 597Q109 648 155 697L166 708L181 694L173 681Q124 610 124 577Q124 549 155 511T187 456'], - - // RIGHT SINGLE QUOTATION MARK - 0x2019: [692,-394,254,58,193,'125 524Q125 545 92 588T58 651Q58 661 61 667Q65 674 80 683T107 692Q131 692 162 645T193 564Q193 540 176 509T144 460T87 394L78 400L68 406L79 421Q125 489 125 524'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Fraktur/Bold/Other.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/PUA.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/PUA.js deleted file mode 100644 index c83ff79146..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/PUA.js +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Fraktur/Bold/PUA.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Fraktur-bold'], - { - // stix-MATHEMATICAL BOLD CAPITAL GAMMA SLASHED - 0xE301: [630,27,587,64,512,'388 427Q320 485 242 524T128 563H116Q95 563 87 561L77 559Q72 563 69 566T65 570T65 572L75 576Q106 592 154 611T212 630Q230 630 262 622T358 581T492 498L508 486Q512 463 512 396Q512 246 469 112L465 102Q453 94 341 25Q252 -27 247 -27Q243 -27 174 24T97 84Q90 100 90 214Q90 285 98 345Q100 360 102 363T118 377Q175 422 262 465Q264 463 270 460L277 456Q277 455 267 447T244 428T228 414Q206 382 206 269Q206 187 214 164T259 110Q286 89 342 58Q391 131 391 313Q391 355 388 412V427'], - - // stix-capital Delta, Greek slashed - 0xE302: [693,212,394,37,408,'39 362L37 366L38 368L82 405H133V474Q135 563 143 589T198 658Q210 669 224 676T247 687L255 690H253Q241 690 253 692Q254 692 256 692T260 693Q263 693 262 691L261 690Q300 690 361 662L373 656L388 666Q404 675 405 675L406 674Q406 672 406 670T406 664L408 655L301 555Q300 555 287 564T254 584T221 597Q190 597 176 583T161 550Q161 525 184 495T232 440T261 405H387V399Q377 389 364 379L340 359H258V315Q258 52 228 -18L172 -120L121 -211H109Q102 -212 96 -212L109 -174Q131 -108 135 -80T139 53V76V157V362H39'], - - // stix-MATHEMATICAL BOLD CAPITAL DELTA SLASHED - 0xE303: [681,219,387,36,384,'41 352Q40 354 39 355T37 358L36 360H37Q48 370 61 380L84 400H108Q131 400 131 402Q121 424 104 501L100 519Q109 560 134 602T196 664Q230 681 271 681Q291 681 316 669T358 644L373 631Q373 630 304 553Q299 548 294 547Q292 547 290 546H287Q286 546 274 562T243 593T205 609Q180 609 165 596T150 562Q150 526 191 488L217 462Q248 431 253 405V400H381L384 394L349 352H251V332Q249 271 231 17L227 -37L120 -217L109 -218Q103 -219 97 -219Q97 -218 101 -206T110 -177T118 -151Q126 -129 128 -120T136 -46T141 127Q141 250 136 340V352H41'], - - // stix-capital Epsilon, Greek slashed - 0xE304: [474,212,593,67,531,'107 370Q127 384 172 409T255 454T294 473L306 468Q356 446 425 431L435 429L524 468Q528 465 531 461Q499 395 499 271V263Q499 146 509 71T519 -8Q519 -28 512 -45Q510 -50 435 -123T355 -197Q296 -212 257 -212Q209 -212 164 -196T98 -167T67 -143L133 -44H144Q167 -88 216 -111T320 -134Q371 -134 390 -118T410 -69Q410 -52 404 -12T392 60T385 92L193 -29L158 5Q124 39 110 51L96 63V71Q94 79 94 121Q94 130 94 148T93 174Q93 230 96 275T103 344T107 370ZM221 397Q200 334 200 254Q200 170 210 140Q216 126 234 109T268 81L283 71L383 119V127Q384 132 384 241L385 347L368 349Q325 357 290 369T240 389T221 397'], - - // stix-MATHEMATICAL BOLD CAPITAL EPSILON SLASHED - 0xE305: [684,27,393,33,387,'103 453Q103 631 95 661Q95 663 102 667T110 672L114 664Q117 655 123 641T131 621L140 597L154 606Q208 641 275 673L297 684Q300 683 302 682T307 679T310 678L314 676Q283 658 256 625Q238 601 231 579T223 515L224 512L282 548Q339 583 341 583T365 548T386 509Q326 443 318 443L316 446Q314 448 311 452T304 460T294 470T283 480T272 488T260 494T248 497Q231 497 223 474Q220 468 218 440T215 407V401H345L309 360H218V314Q218 181 221 139V129L253 108Q306 73 310 73Q315 73 343 83L373 92L374 87Q375 82 375 79T375 74T360 65T308 36T229 -13L208 -27L192 -13Q149 24 90 61Q89 61 89 62L90 68Q91 73 93 87T97 125T100 191T103 291V360H33V366L34 371L85 405H94L103 404V453'], - - // stix-capital Eta, Greek slashed - 0xE308: [679,220,981,31,875,'602 575Q505 508 505 489Q505 488 505 482T506 463T507 432Q507 314 456 237L449 226L434 216Q420 208 325 143L316 137Q453 82 488 82Q527 82 585 127L596 136Q597 136 599 126L602 115Q578 85 511 27T428 -31Q400 -31 308 10T170 51Q143 51 123 43T92 24T54 -15L34 6L41 14Q65 41 170 129L188 144L204 145Q254 147 293 164T350 208Q378 249 378 344Q378 422 362 478T320 563T268 605T213 618Q177 618 156 600T134 561Q134 539 162 508T217 446T245 394Q245 368 213 337T85 250L62 262Q73 269 86 279T116 308T133 338T108 378T57 439T32 499Q32 556 117 617T291 679Q350 679 393 658Q415 647 433 631T462 600T480 572T490 550T494 541T499 544T516 556T547 578T603 613T689 662L720 679L730 670Q742 659 756 649T785 629T810 615T836 601T855 590Q855 587 860 536T870 419T875 312Q875 114 800 -25Q794 -35 781 -47Q584 -220 398 -220Q322 -220 278 -190Q253 -173 239 -155L244 -150Q248 -145 255 -138T271 -120T290 -100T310 -80T328 -63T341 -51T349 -46Q350 -46 351 -46T354 -47Q357 -47 357 -52Q359 -68 364 -83T383 -118T424 -151T491 -166Q559 -166 613 -129Q629 -118 641 -108T674 -68T710 1T735 107T746 260Q746 433 727 507Q727 512 685 535T615 570L602 575'], - - // stix-MATHEMATICAL BOLD CAPITAL ETA SLASHED - 0xE309: [717,137,727,17,633,'351 571Q317 571 247 563T171 555Q153 555 133 563T107 584Q94 605 98 609Q101 615 138 658T190 717H207Q204 710 204 699Q204 673 231 666Q235 665 264 665Q296 665 345 667T426 669Q474 669 501 660T545 626Q553 612 553 594Q553 531 498 474T379 384Q371 379 371 378Q371 376 390 376H411H434Q520 376 602 318Q621 303 627 288T633 234Q633 59 540 -34Q465 -109 348 -130Q308 -137 235 -137Q159 -136 143 -129Q132 -125 132 -118V-53Q118 -24 90 -24Q69 -24 37 -39L27 -44L25 -42Q23 -39 21 -35T17 -30Q17 -28 40 -14T103 19T177 44Q183 45 205 45Q219 45 227 44T245 37T259 20T264 -12Q264 -33 262 -48T259 -80Q259 -93 260 -95Q271 -110 305 -110Q343 -110 383 -86T443 -33Q491 34 491 154Q491 223 467 249Q428 288 334 288H322Q288 288 237 276L222 273L206 286L262 367Q279 369 303 377T358 403T410 452T431 524Q431 531 431 533T427 545T416 558T392 566T351 571'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Fraktur/Bold/PUA.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/BasicLatin.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/BasicLatin.js deleted file mode 100644 index 101498add6..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/BasicLatin.js +++ /dev/null @@ -1,272 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Fraktur/Regular/BasicLatin.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Fraktur'], - { - // SPACE - 0x20: [0,0,250,0,0,''], - - // EXCLAMATION MARK - 0x21: [689,12,296,91,204,'102 582T102 620T112 673T152 689Q190 689 190 638Q190 605 167 373L148 187L133 184Q102 582 102 620ZM91 24T91 48T107 88T148 104Q171 104 187 87T204 48Q204 22 188 5T149 -12Q124 -12 108 6'], - - // QUOTATION MARK - 0x22: [695,-432,215,8,196,'33 436Q8 603 8 648Q8 663 9 671T19 687T43 695Q63 695 74 681Q76 678 76 650V623L66 532Q57 443 55 436V432H33V436ZM128 666Q128 691 162 691T196 668Q196 634 186 531Q176 441 176 432H166Q155 432 155 434L142 545Q135 603 130 647Q128 664 128 666'], - - // AMPERSAND - 0x26: [698,11,738,49,733,'181 520Q181 604 231 650T328 697L330 698Q333 698 335 698Q336 698 340 698T346 697Q390 697 418 670T446 604Q446 554 414 511Q384 467 300 417L283 406Q281 405 296 374T347 286T425 182Q466 135 469 135Q470 135 473 140T480 152T486 165Q509 210 509 263Q509 282 507 292Q498 317 488 332T465 352T443 359T418 361Q388 361 357 358L346 356L347 374Q347 394 348 396V399H355Q366 396 535 396Q663 396 689 398L703 399Q703 398 702 375T700 351L688 353Q655 356 601 357Q553 357 553 355Q562 332 562 294Q562 280 561 267T555 241T548 218T539 195T529 175T518 156T508 141T497 126L489 115L496 107Q549 54 596 54Q623 54 644 67T677 101T697 140T708 174L710 187Q710 188 710 188L711 190Q714 190 723 187T733 183Q733 179 732 172T726 145T714 107T694 66T665 27T623 0T569 -11Q500 -11 443 41L434 49L425 42Q348 -9 275 -9Q251 -9 233 -6Q187 -1 152 18T98 60T67 111T52 159T49 195Q49 231 60 261T96 315T141 354T197 390L208 397Q181 459 181 520ZM374 577Q374 607 356 629T311 651Q289 651 271 636Q242 614 242 559Q242 533 249 502T262 453T270 435T279 440T298 453T314 464Q374 503 374 577ZM127 217Q127 145 173 89T291 32Q318 32 347 42T393 63T409 75Q384 100 325 184T227 351Q223 366 220 366Q215 366 178 338Q127 298 127 217'], - - // APOSTROPHE - 0x27: [695,-436,212,69,134,'69 666Q69 680 79 687T104 695Q112 695 117 694T128 684T134 659L104 438Q104 436 96 436T88 438Q88 447 79 540T69 655V666'], - - // LEFT PARENTHESIS - 0x28: [737,186,389,114,293,'293 737V719Q291 718 285 714T276 708T268 702T258 695T250 686T241 674Q164 570 164 282Q164 -37 230 -119Q273 -171 292 -171Q293 -171 293 -179V-186H289Q270 -180 259 -175Q175 -132 145 -23T114 275Q114 491 157 598T293 737'], - - // RIGHT PARENTHESIS - 0x29: [735,187,389,89,276,'223 259Q223 386 212 474T178 609T136 677T89 714V735Q121 726 139 713Q276 622 276 273Q276 98 246 -23Q225 -106 189 -139T89 -187V-170L101 -165Q148 -146 172 -110T210 13T223 259'], - - // ASTERISK - 0x2A: [692,-449,278,34,234,'118 573Q118 575 76 602L34 629L50 647L55 652L66 642Q76 633 91 620T117 598L128 590Q128 663 125 687V692H151V689V687Q151 685 151 683T150 678T150 672Q145 628 144 605V592L219 652L232 634Q232 632 220 624Q195 610 155 582L146 575L158 567Q178 552 197 540T225 523T233 516Q233 515 226 506T217 495L152 549L143 555V530Q144 509 145 492T148 466T149 454Q149 449 142 449H125V462Q128 522 128 549V562L115 552Q88 531 59 506L45 495Q44 495 39 505T34 516L118 573'], - - // PLUS SIGN - 0x2B: [598,82,756,47,709,'357 584L399 598V282H709L702 263L696 243H399V-64L379 -73L358 -82Q357 -82 357 81V243H47L51 253Q52 256 54 263T58 272L62 282H357V584'], - - // COMMA - 0x2C: [107,191,278,99,213,'99 62Q99 82 114 94T144 107Q159 107 178 77T205 26Q213 5 213 -23Q213 -49 207 -65T181 -113Q128 -189 122 -191Q121 -191 116 -184T111 -174Q111 -173 122 -155T145 -111T156 -62Q156 -44 152 -34T127 4L104 37Q99 49 99 62'], - - // HYPHEN-MINUS - 0x2D: [275,-236,756,46,706,'46 236L62 274Q62 275 384 275H706L699 255L693 236H46'], - - // FULL STOP - 0x2E: [102,15,278,87,200,'87 43Q87 69 104 85T142 102Q164 102 182 86T200 44Q200 20 183 3T141 -15Q118 -15 103 2T87 43'], - - // SOLIDUS - 0x2F: [721,182,502,34,466,'230 270Q426 721 428 721Q437 719 447 717L466 713L448 672Q78 -180 77 -181Q77 -182 55 -182L34 -181L230 270'], - - // DIGIT ZERO - 0x30: [492,13,502,42,456,'212 -13Q184 -13 156 -2T101 32T59 97T42 195Q42 311 132 396Q170 433 211 462T262 492Q272 492 301 477T366 434T429 360T456 258Q456 161 378 74T212 -13ZM381 209Q381 257 365 295T328 355T282 390T243 408T223 413Q220 413 204 403T167 376T137 341Q119 305 119 250Q119 168 159 114T263 59Q308 59 344 93T381 209'], - - // DIGIT ONE - 0x31: [468,2,502,47,460,'123 459Q145 459 170 460T217 462T256 464T284 466L295 467Q296 467 296 467T297 468Q299 468 302 466T307 462L309 459Q307 454 304 424T299 341T297 235Q297 139 298 101T302 55T313 44Q316 43 367 43L460 46Q460 35 459 22V-1H450Q402 2 281 6Q222 6 171 4T91 1T56 -1L47 -2V43H121H170Q195 43 201 45T209 56Q212 69 212 214Q212 333 209 365T194 409Q183 417 161 423T121 430L104 432Q103 432 103 446V459H123'], - - // DIGIT TWO - 0x32: [474,-1,502,60,484,'104 384Q115 394 133 409T199 449T281 474Q321 474 351 447T385 378Q385 328 333 255T228 127T176 72Q176 67 183 65Q184 65 203 65T260 67T331 69L475 73L484 67Q484 64 472 33L460 1H60V17L107 61Q210 159 249 208Q309 283 309 331Q309 363 285 389T228 415Q212 415 184 403T134 379L114 367L104 384'], - - // DIGIT THREE - 0x33: [473,182,502,39,429,'305 328Q305 372 279 396T214 421H211Q172 421 128 384L107 398L116 405Q151 437 191 455T251 473H260Q314 473 341 455T382 394Q384 386 384 367T382 338Q362 263 271 217L256 210L257 206L259 202Q260 202 272 201T296 198T324 192T355 179T384 157T410 123T427 75Q429 64 429 41Q429 -59 353 -120T183 -182L88 -164Q81 -162 69 -157T48 -147T39 -141Q39 -139 46 -127L53 -114L69 -122Q129 -149 171 -149Q218 -149 253 -131T305 -83T330 -26T338 29Q338 41 336 55T328 89T308 127T273 153Q228 171 162 171Q158 171 152 171T142 170H127V204H134Q232 214 275 257Q305 292 305 328'], - - // DIGIT FOUR - 0x34: [476,191,502,10,481,'299 -179Q306 -156 306 -48V0H11V7Q10 10 10 18Q10 23 154 236L298 449Q298 450 339 463L379 476Q385 473 384 470V466Q384 463 384 457T384 444T383 427T383 408Q381 328 381 248Q381 46 384 40H387Q422 40 460 44Q465 44 470 44T478 44L481 45Q481 43 478 24T473 1Q473 -1 464 -1Q462 -1 451 -1T430 0H387V-76L389 -156V-161L311 -191Q299 -181 299 -179ZM299 364H287L277 352Q234 297 186 224T112 104T79 43Q79 42 192 42H306V115Q306 300 299 359V364'], - - // DIGIT FIVE - 0x35: [458,185,502,47,441,'334 25Q334 99 296 134T207 169Q154 169 107 123L98 114L89 120L80 125V458H420Q420 456 409 418L397 379Q397 378 264 378H131Q130 377 128 376T125 374T124 371T122 368T122 363T121 356T121 345V279V190L130 186L140 190Q196 214 260 214Q311 214 348 197T404 153T431 99T440 42T433 -16T406 -76T356 -130T276 -169T163 -184H156Q110 -184 57 -163L47 -159L53 -147L58 -134Q61 -134 74 -139T110 -148T156 -153Q206 -153 243 -135T299 -87T326 -30T334 25'], - - // DIGIT SIX - 0x36: [700,13,502,45,471,'45 240Q45 328 73 406T143 536T235 626T327 681T399 699Q400 699 404 699T411 700Q424 700 441 696T459 689Q459 671 451 637Q451 633 447 632L444 629L434 633Q413 640 384 640H377Q299 640 222 565Q182 531 156 463T129 315V306H136L149 315Q229 376 316 376H318Q393 376 432 326T471 213Q471 129 402 58T237 -13T93 59T45 240ZM391 172Q391 231 354 272T258 314Q230 314 200 302T154 279T133 262L134 249Q154 32 266 32Q315 32 353 64T391 172'], - - // DIGIT SEVEN - 0x37: [468,181,502,37,498,'395 377L391 382H225Q59 382 59 383L74 423Q89 464 89 465Q90 468 94 468Q146 460 350 458H498V442L473 406Q241 75 125 -156L113 -181H40L37 -168L57 -140Q115 -58 199 70T339 287T395 377'], - - // DIGIT EIGHT - 0x38: [705,10,502,40,461,'220 -10Q168 -10 131 6T75 50T48 103T40 157Q40 223 77 266Q103 295 156 328T225 375Q247 393 247 394L206 361Q205 361 193 368T164 391T131 426T102 474T90 531Q90 580 114 615Q146 660 238 698L254 705L262 704Q288 704 332 693T402 656Q434 620 434 568Q434 518 401 475T321 402L305 391L336 368Q339 366 353 356T372 343T389 330T406 316T420 301T434 283T445 265T454 244T458 222T461 195Q461 106 389 48T220 -10ZM350 545Q350 578 337 601T304 634T266 649T234 653L224 654L204 639Q196 634 191 629T182 621T176 614T173 609T170 603T168 597Q165 585 165 567Q165 497 261 424L273 415Q350 467 350 545ZM261 405L263 407Q262 407 261 405ZM258 403Q257 403 255 401L254 399L256 400Q258 402 258 403ZM252 398Q251 398 249 396L248 394L250 395Q252 397 252 398ZM245 36Q276 36 300 45T338 69T360 102T371 136T374 168Q374 211 341 255Q324 275 305 289T235 332Q231 330 215 321T193 307T173 292T153 271T138 247T127 216T123 177Q123 146 132 117T170 62T245 36'], - - // DIGIT NINE - 0x39: [469,182,502,28,466,'353 93T352 93T320 79T251 49T201 34Q127 37 87 79Q28 138 28 234Q28 273 37 304T60 355T101 396T152 429T218 462L234 469H243Q348 461 395 417Q466 348 466 201Q466 72 397 -29T211 -163Q155 -179 91 -182H72V-154H80Q144 -154 202 -131T297 -60Q318 -31 333 7T352 68L357 92Q353 93 352 93ZM369 208Q369 240 362 272T339 339T290 394T214 415Q171 415 144 372T116 266Q116 193 154 144T238 95H249Q369 95 369 208'], - - // COLON - 0x3A: [457,12,216,50,168,'50 377T50 400T64 440T99 457Q128 457 146 440T165 399Q165 375 146 359T102 342T64 359ZM53 19T53 43T66 86T103 105Q129 105 148 87T168 41Q168 17 147 3T102 -12Q80 -12 67 3'], - - // SEMICOLON - 0x3B: [458,189,216,47,179,'47 399Q47 424 62 441T101 458T143 442T162 400T144 359T101 343Q78 343 63 360T47 399ZM76 86Q76 88 80 91T91 96T106 99Q119 99 131 86Q179 35 179 -25Q179 -64 146 -115T89 -189Q86 -187 83 -185T79 -182T76 -180T75 -177T77 -173T80 -168Q121 -108 121 -64Q121 -44 94 -5T66 52Q66 66 71 75T76 86'], - - // EQUALS SIGN - 0x3D: [368,-132,756,54,725,'725 366Q724 365 721 349T716 331V329H385Q54 329 54 331Q55 332 59 349T63 368H394Q725 368 725 366ZM725 169Q724 168 721 152T716 134V132H385Q54 132 54 134Q55 135 59 152T63 171H394Q725 171 725 169'], - - // QUESTION MARK - 0x3F: [693,11,362,46,357,'46 557Q46 613 103 653T227 693Q287 693 322 659T357 564Q357 517 326 469T259 390T191 326T160 272Q160 240 187 221Q193 217 193 216Q182 209 170 200L147 184Q127 192 113 209T98 250Q98 290 193 376Q287 454 287 542Q287 581 262 616T188 652Q143 652 126 631T108 588Q108 559 140 527L79 490Q46 515 46 557ZM108 47Q108 68 123 85T160 103Q179 103 198 90T217 46Q215 24 201 7T164 -11Q142 -11 125 6T108 47'], - - // LATIN CAPITAL LETTER A - 0x41: [696,26,718,22,707,'22 505Q22 563 94 624T271 685H280Q416 685 443 560Q447 535 447 504Q444 414 405 330L399 319L229 155Q233 154 241 153T253 150T265 145T281 135T301 119T328 93L357 64L402 92Q438 116 473 137L500 154V339Q500 528 495 593V601L559 649Q621 696 624 696L638 686L629 677Q599 650 593 638Q582 614 581 504Q580 490 580 443Q580 314 584 238Q584 235 584 224T584 210T585 199T586 187T588 176T591 164T595 152T601 137T609 121Q630 77 640 77Q661 77 703 101Q704 95 706 90L707 86V84L636 29Q618 15 601 2T574 -19T564 -25L500 121Q499 121 399 48L299 -26Q298 -26 291 -15T272 11T245 42T209 69T165 80Q120 80 58 43L48 37L40 42L32 48L122 117Q196 173 241 211Q319 280 343 327T368 447Q368 535 317 582Q264 633 199 633Q155 633 122 605T86 542Q86 518 133 467T181 387Q181 348 140 309Q113 281 73 260L64 255L50 265L59 273Q112 307 112 345Q112 363 90 387T45 441T22 505'], - - // LATIN CAPITAL LETTER B - 0x42: [691,27,884,48,820,'48 506Q48 568 120 629T268 691Q362 691 425 594L431 585L441 594Q478 628 528 657T629 686Q665 686 687 670Q703 658 718 584T753 506Q756 505 763 505Q778 505 804 512L815 516L820 496Q820 494 808 490T774 476T732 454Q720 445 708 437L675 415L640 394L625 383Q626 382 635 382Q652 382 670 379T712 364T754 336T784 289T797 220Q797 172 776 122Q769 106 766 102T745 84Q654 11 619 -8T538 -27Q483 -27 387 10T249 47Q218 47 186 34T133 8T112 -5T104 7T97 21L196 82Q259 120 284 140Q333 181 351 214Q368 251 368 353Q368 588 228 620Q222 621 205 621Q160 621 139 596Q117 569 117 548Q117 526 162 470T208 387Q208 352 179 320T104 264Q88 256 86 256Q83 256 70 266L82 274Q134 309 134 343Q134 352 130 359Q118 377 100 401T72 439T56 470T48 506ZM453 528Q457 496 457 419L458 357L488 367Q554 390 622 425Q673 449 673 453L671 454Q669 456 665 460T657 473T648 498T639 541Q629 597 616 613Q599 633 567 633Q534 633 493 599Q471 577 457 540L453 528ZM713 176Q713 252 661 295T528 339Q512 339 494 336T466 330T455 325Q454 325 452 311T444 270T425 217L420 207L304 118L319 116Q381 111 475 74T602 37Q655 37 684 79T713 176'], - - // LATIN CAPITAL LETTER C - 0x43: [685,24,613,59,607,'299 585Q333 609 384 634T470 672L505 685Q506 685 513 662T531 613T548 580Q553 576 563 576Q575 576 605 585Q607 585 607 575V564Q537 532 496 527Q475 542 456 567T427 610T415 627Q410 627 398 618T382 603Q373 588 373 558T386 475T400 399Q400 337 366 303Q343 281 309 266T254 247T226 242L214 257Q214 258 223 260T251 272T287 299Q304 316 304 360Q304 396 289 451T274 532Q274 553 277 561V564H269Q205 558 172 501T139 358Q139 207 226 127T443 46Q448 46 457 46T470 47L485 48L601 106Q602 106 602 93V80Q551 48 517 25T474 -4T460 -13T443 -19Q409 -24 367 -24Q360 -24 351 -24T335 -23T326 -22Q190 -2 125 87T59 319V328Q62 412 96 487L101 500L118 512Q189 563 245 591L266 601L299 585'], - - // LATIN CAPITAL LETTER D - 0x44: [685,27,832,27,745,'346 611Q300 611 261 604T194 584T144 555T107 519T82 481T65 443T55 410T50 383T48 367L37 372L27 378V393Q33 524 115 603Q160 648 230 666T365 685Q423 685 434 684Q745 653 745 405Q745 281 694 151L687 133L657 103Q524 -27 470 -27Q456 -27 331 18T157 64Q122 64 84 28Q67 9 57 -6L50 -16L43 -8L35 0Q35 3 46 22T83 74T141 133H154Q208 136 253 161T299 230Q299 259 277 290T232 348T209 392Q209 434 254 479T358 556L368 561L382 550Q382 549 381 548T377 545T371 541Q353 527 326 496T298 444Q298 430 343 365T389 277Q389 240 353 202T267 136L252 127Q304 118 400 83T513 47Q548 47 582 79T635 145Q671 208 671 323Q671 390 651 441T599 524T523 576T436 603T346 611'], - - // LATIN CAPITAL LETTER E - 0x45: [685,24,663,86,634,'301 564Q240 564 203 507T165 361Q165 280 190 218T260 119T358 64T474 46Q491 46 499 47L511 48L628 106V80L499 -5Q498 -6 497 -7T494 -10T490 -12T485 -15T478 -17T468 -19T456 -21T439 -22T418 -23T392 -24Q252 -20 169 67T86 315Q86 409 124 491Q128 500 139 508Q211 560 272 591L293 601L325 585L338 594Q374 617 422 639T502 674L532 685Q533 685 540 663T557 614T574 581Q580 575 591 575Q600 575 616 580T634 585V564L623 559Q572 535 532 529L522 527Q491 547 442 627Q442 628 440 627T435 624T428 620Q410 610 405 597T399 559V553Q399 534 409 487Q419 431 427 369L476 400Q526 431 526 432Q531 426 537 420Q565 382 602 359Q611 353 610 352Q609 351 575 332T537 312Q536 312 505 335T463 358Q451 358 439 352T425 337Q394 243 263 223L251 221L243 229L235 236L245 239Q274 247 303 266Q320 277 325 290T330 336Q330 394 315 451T300 531Q300 549 303 561Q303 564 301 564'], - - // LATIN CAPITAL LETTER F - 0x46: [686,153,611,11,612,'198 617Q177 617 159 609T128 587T106 557T91 524T82 494T76 472L75 463Q74 463 67 468T59 474Q59 488 63 510T80 564T114 622T170 667T253 686Q272 686 295 680Q330 672 384 645T468 598Q498 580 524 580Q549 580 595 626L612 643V616L599 599Q522 500 482 500Q466 500 435 514L420 521Q388 516 349 486T309 415Q309 396 323 366T352 315T367 294Q367 293 375 301T398 322T429 352L490 410Q537 355 542 332Q542 330 531 315T510 286L499 273Q479 313 449 313Q437 313 419 303T390 282L378 271L394 250Q444 183 470 129Q484 96 484 71Q484 -19 402 -86T223 -153H220Q175 -153 137 -120Q103 -89 103 -8Q103 12 106 40T109 96Q109 132 103 146T72 161Q46 161 16 143L14 154L11 165Q88 219 143 219Q163 219 177 197T192 127Q192 102 186 65T179 4Q179 -60 210 -88T272 -117Q319 -117 362 -75T405 33Q405 72 363 139T278 271T235 368Q235 385 243 404T264 439T292 472T324 500T353 522T374 538L382 543Q382 544 351 562T274 598T198 617'], - - // LATIN CAPITAL LETTER G - 0x47: [690,26,785,66,710,'373 560Q373 543 378 509T388 448T394 421Q396 421 416 433T474 474T548 537L538 543Q481 570 452 628L487 659Q521 690 522 690L526 684Q529 677 535 667T551 646T575 625T607 608Q617 606 621 606Q644 606 660 622L664 600L497 455Q495 453 527 453H546Q628 453 665 407L666 406Q710 357 710 297Q710 196 631 109L621 98L577 69Q471 -7 452 -15Q413 -26 370 -26Q239 -26 155 59Q66 148 66 319Q66 442 113 505L191 552Q269 600 270 600H271Q273 600 280 596T293 589T299 586Q300 586 357 623Q413 659 415 659L426 649Q373 604 373 560ZM219 228Q305 262 305 329V343Q305 384 294 434T282 519Q282 562 287 567Q287 569 286 569Q222 556 191 520Q144 464 144 362Q144 213 228 128T420 42Q514 42 568 103T622 255V260Q622 320 578 357Q526 400 453 400Q434 400 410 396L399 394L400 378V372Q400 330 388 301T348 254T305 232T252 217Q245 215 242 214L234 213L226 220L219 228'], - - // LATIN CAPITAL LETTER H - 0x48: [666,133,720,1,644,'11 -16L1 0Q7 6 25 27T57 62T91 88T128 101Q159 99 195 66L203 59L211 67Q239 95 239 133Q239 158 210 213T152 330T123 430Q123 477 173 536T269 630T320 666Q376 610 440 606H443Q457 606 466 611T519 647L542 664Q543 664 543 654V643L522 622Q434 537 403 537Q388 537 366 543T329 555T293 570T270 580L261 585L253 574Q206 517 206 475Q206 452 218 416T242 356L255 331Q256 331 270 345T324 391T421 459L437 468H453Q545 463 608 421L618 415L623 392Q644 307 644 233Q644 97 612 9Q604 -10 601 -15T581 -35Q505 -104 467 -124Q446 -133 431 -133Q414 -132 399 -126T376 -115T368 -107Q368 -106 392 -75L415 -43Q432 -67 444 -73T472 -79H474Q479 -79 484 -78T501 -69T521 -50T538 -13T551 46Q558 97 558 180Q558 232 557 245Q553 277 547 300T528 349T488 389T424 404Q344 404 276 295Q272 288 273 285Q300 216 300 168Q300 161 300 156T298 145T297 137T293 129T289 123T283 116T277 107Q212 23 178 -13L166 -26L149 -9Q108 32 81 32Q63 32 21 -7L11 -16'], - - // LATIN CAPITAL LETTER I - 0x49: [686,26,554,30,532,'190 601Q161 601 137 587T97 553T71 512T55 477T48 463Q44 465 39 468L30 473L35 488Q73 594 106 636T199 685Q200 686 211 686Q250 686 326 652T417 617Q435 617 455 626T497 652T522 670Q532 660 532 654Q469 591 390 550L378 543L343 556Q223 601 190 601ZM378 208Q378 249 369 318T360 424Q360 430 360 439T361 451L362 462Q416 526 482 571L495 580L503 577L511 575L499 562Q442 502 442 465Q442 436 452 368T462 246Q462 169 442 128T385 56Q292 -26 195 -26Q150 -26 104 14L96 21L43 -16Q43 -15 43 -14T41 -10T38 0L48 13Q76 50 123 97L150 125Q154 131 159 131Q166 131 171 116T182 81T193 53Q199 43 216 33T261 22Q307 22 344 68Q378 113 378 208'], - - // LATIN CAPITAL LETTER J - 0x4A: [686,139,552,-10,522,'194 601Q175 601 155 590T121 564T95 533T76 506L69 495Q55 503 55 507Q55 509 60 521Q87 586 132 636T222 686Q251 686 289 660T363 607T422 580Q442 580 466 588T506 604L522 612V591L487 574Q371 517 359 517H357Q332 522 280 561T194 601ZM383 39Q383 96 356 203T329 361Q329 364 329 370T330 378L331 388L339 399Q362 429 394 462T446 513T469 531Q470 531 477 527T484 521L474 509Q411 434 411 379Q411 341 434 223T458 82Q458 1 390 -69T239 -139Q191 -139 162 -123T123 -83T108 -30T101 23T88 64T52 80Q27 80 -4 64L-10 80Q-5 85 13 98T63 128T118 144Q149 144 163 129T179 93T182 38T187 -19Q199 -96 278 -96Q294 -96 309 -91T343 -73T372 -31T383 39'], - - // LATIN CAPITAL LETTER K - 0x4B: [680,27,668,17,682,'154 37Q219 41 219 142Q219 203 190 302T160 434Q160 445 172 472T209 534T269 602T354 657T460 680H472Q576 680 618 617V599Q618 578 615 555T608 517T602 501Q596 495 587 495Q586 495 586 499Q586 500 586 505T585 513Q567 628 415 628Q384 628 356 621T302 596T260 546T244 466Q244 416 258 377L261 367L276 382Q294 401 317 422T386 471T468 500Q500 500 518 477T544 422T554 386Q555 382 560 376T576 364T601 357Q612 357 623 361Q623 360 621 351T617 340L541 305L465 272Q469 271 476 270T488 266T502 260L512 255L519 242Q533 211 546 157T564 93Q584 53 617 53Q649 53 682 74V54L675 46Q646 17 612 -5T554 -27Q546 -27 538 -23T517 -9T494 28T478 91Q465 172 448 200T378 228Q337 228 289 207L288 196Q288 160 284 138Q283 125 262 98Q185 1 112 -24L102 -27L91 -25Q47 -13 17 31Q17 33 49 69L80 106Q111 37 154 37ZM421 434Q411 436 405 436Q370 436 336 407T275 337L267 325L271 313Q288 257 288 234Q289 234 395 276T502 319Q501 320 499 323T493 330T485 345T475 371Q473 378 468 388T449 416T421 434'], - - // LATIN CAPITAL LETTER L - 0x4C: [686,26,666,33,644,'251 231Q251 254 206 341T160 468Q160 529 238 605Q313 677 425 685L432 686Q440 686 445 686Q520 686 545 657T571 576Q571 548 568 517T564 480Q564 466 572 460T608 452H623V431L619 430Q618 430 611 428T591 423T566 417L516 404Q497 415 491 419T480 433T475 461Q475 470 477 498T480 546Q480 561 480 569T474 592T459 615T429 631T379 638Q322 638 283 606T239 526Q237 480 280 394Q319 310 320 268V250Q308 235 244 169L203 128H210Q215 128 256 112T357 80T466 64Q526 64 564 88T625 186L629 196Q643 187 644 186Q618 70 604 41Q577 -15 513 -24Q496 -26 476 -26Q418 -26 344 -3T211 45T133 69Q115 69 97 50T65 7T49 -20L45 -16Q41 -11 37 -6T33 0Q33 8 66 69T111 134Q251 156 251 231'], - - // LATIN CAPITAL LETTER M - 0x4D: [692,27,1050,27,1048,'687 578Q690 586 719 612T794 665T877 692Q909 692 926 670T953 614T973 570Q983 561 1000 560Q1023 560 1048 569V553L1034 546Q1003 528 972 504T933 466Q905 403 905 264Q905 205 909 172T920 126T940 91Q951 74 959 74T997 87L1027 100V79L956 27Q940 15 922 2T894 -19L885 -26Q883 -26 854 27L825 80V192Q826 314 830 341Q831 345 833 356Q840 398 844 404Q871 444 920 489L917 491Q914 493 911 495T903 501T898 508Q893 516 877 562T852 616Q840 628 818 628Q751 628 702 541L697 532L700 515Q708 467 708 419Q706 348 690 276T662 169T643 126L634 116Q626 105 611 87T581 51L522 -22L514 -15Q470 21 452 21Q431 21 394 -16L384 5L386 9L426 60Q449 87 460 95T486 104Q487 104 491 104T497 103Q514 99 541 81L559 69Q595 96 606 169T618 350Q618 486 598 543T517 601Q484 601 458 570T432 523Q432 516 434 492T436 443Q436 250 369 133L363 122L280 50Q207 -16 192 -27L182 -18Q136 26 106 26Q83 26 62 9T37 -16L27 0L33 10Q41 22 54 39T94 81T143 106Q178 106 225 62L235 53Q283 82 307 117Q352 190 352 359Q352 408 345 451T320 534T267 597T183 621Q159 621 147 617T120 598Q97 574 96 556Q96 528 143 469T191 377T161 311T102 262T70 245Q69 245 59 252T49 260L56 264Q63 268 73 275T94 291T111 312T118 338Q118 355 95 384T50 446T27 506Q31 567 101 626T255 686Q297 686 330 671T382 632T409 595T421 572V571L430 580Q454 610 496 634T588 659H590Q655 659 683 585L687 578'], - - // LATIN CAPITAL LETTER N - 0x4E: [686,25,832,27,825,'112 334Q112 356 70 410T27 497Q27 553 94 619T229 685Q230 685 236 685T246 686Q303 686 349 654Q373 636 392 607T419 558L426 538L454 576Q474 604 486 618T520 651T569 678T633 686Q668 684 687 673T713 651T730 609Q730 608 732 600T736 588T741 578T747 568T754 561T765 555T779 553Q789 553 817 562Q819 557 819 555V547L790 526Q743 492 730 479T712 447Q697 369 697 281Q697 166 726 108Q741 76 755 68Q759 66 767 66Q789 66 825 93V82Q825 71 822 70Q821 69 763 27T701 -18L692 -25L668 15Q662 25 650 45T635 70L627 85V107Q627 122 626 162T624 285Q624 381 632 398Q638 409 651 425T675 454T696 477T707 489H696Q683 490 679 492T669 507T653 551Q642 588 627 608T584 628Q572 628 560 625T538 616T519 602T502 586T486 568T473 549T463 532T454 517T448 504L445 497Q437 480 437 474Q437 472 439 461T444 421T446 348Q446 205 405 124Q396 105 392 100T368 78Q312 32 278 9T235 -18T214 -22Q191 -22 170 -10T139 12T129 25T160 66T192 105Q193 102 194 98T200 83T213 64T233 49T261 42Q303 42 339 90Q373 134 373 268Q373 397 339 493T235 618Q215 628 191 628Q155 628 126 604T97 548Q97 524 120 493T168 431T192 381Q192 346 164 318T86 260L70 250L54 266L63 272Q112 300 112 334'], - - // LATIN CAPITAL LETTER O - 0x4F: [729,27,827,12,744,'428 596Q412 596 386 595T350 593Q289 593 270 625Q267 632 267 640Q267 656 280 672T312 705T336 729H343Q351 729 351 728Q342 710 342 703Q342 683 382 676T493 662T604 643Q648 627 677 599T720 535T739 466T744 392Q744 317 732 260T696 166T659 116T621 83Q617 80 615 78Q485 -27 377 -27Q320 -25 272 -9T187 21T122 36H116Q65 36 29 -13L27 -15L12 0Q12 1 32 26T76 78T109 109Q145 123 166 150T187 207Q187 244 134 318T80 412Q80 454 112 498T176 566T213 590Q216 590 224 585L234 580L225 573Q216 566 207 557T188 536T172 511T165 484Q165 448 213 368T261 259Q261 241 252 219T228 179T200 146T176 122L167 112Q170 111 174 111Q188 110 233 91T339 55T453 37Q508 37 556 68T626 152Q655 219 655 328Q655 543 532 582Q484 596 428 596'], - - // LATIN CAPITAL LETTER P - 0x50: [692,218,828,28,804,'112 339Q112 354 91 380T49 438T28 497Q28 565 95 628T242 692Q261 692 277 689T307 682T331 670T351 655T367 637T379 619T388 600T395 582T401 565T405 550Q409 554 422 570T453 603T500 641Q573 692 637 692Q656 692 670 686T692 672T705 647T713 618T718 584Q720 568 721 562T728 546T742 534T768 530Q776 531 782 532T791 535T796 536Q799 536 804 521Q801 519 789 513T764 499T738 480Q697 447 680 414Q677 407 677 396Q677 370 713 312T750 210Q750 125 686 57T560 -11Q540 -11 475 13L410 37V31Q410 -9 412 -50T417 -118T420 -150Q419 -150 373 -184T326 -218L305 -208Q305 -207 307 -196T314 -165T322 -116T328 -46T331 43V63L318 66Q270 80 250 80Q233 80 213 70Q183 57 138 -3L128 -16L118 5L125 20Q193 154 282 154Q309 154 331 146V287Q331 444 327 469Q321 522 301 560Q284 590 251 611T184 633Q146 633 119 607T92 550Q92 539 94 534Q100 516 143 460T186 386Q186 366 170 336T119 281Q102 264 70 250L49 260L56 266Q64 271 72 278T90 296T106 317T112 339ZM602 345Q602 357 608 371T622 397T642 421T661 441T678 456L686 462Q663 473 652 486T639 512T634 553Q631 594 624 608T593 631Q587 632 567 632Q539 632 497 600T416 497L410 484V122L467 103Q481 99 502 92T533 82T557 75T578 69T594 66T610 64Q647 64 672 87T697 144Q697 180 650 250T602 345'], - - // LATIN CAPITAL LETTER Q - 0x51: [729,69,827,11,782,'428 596Q412 596 386 595T350 593Q313 593 291 605T268 638Q268 644 269 648T274 658T284 669T301 689T326 718L336 729H343Q351 729 351 728Q342 710 342 703Q342 683 382 676T493 662T604 643Q744 592 744 398Q744 299 708 213T646 104L603 68L614 55Q670 -5 710 -5Q726 -5 744 1T772 14L781 20Q782 20 782 7V-6L771 -13Q673 -69 665 -69L647 -63Q552 -30 514 8H512Q509 8 500 3T471 -9T428 -23Q405 -27 377 -27Q305 -24 228 6T124 36Q69 36 27 -16Q23 -13 19 -8L11 0L27 20Q93 102 109 109Q145 123 166 150T187 207Q187 244 134 318T80 412Q80 454 112 498T176 566T213 590Q216 590 224 585L234 580L225 573Q216 566 207 557T188 536T172 511T165 484Q165 448 213 368T261 259Q261 241 252 219T228 179T200 146T176 122L167 112Q170 111 174 111Q188 110 233 91T339 55T453 37Q508 37 556 68T626 152Q655 219 655 328Q655 543 532 582Q484 596 428 596'], - - // LATIN CAPITAL LETTER R - 0x52: [686,26,828,27,824,'27 496Q31 569 102 627T234 685Q236 685 241 685T251 686Q287 686 318 672T367 638T399 598T418 564L423 550Q424 554 434 567T463 601T505 639T561 671T626 685Q672 685 688 659T710 572Q713 533 721 523T766 513Q781 513 787 514T794 516Q796 512 798 509T801 504T802 501T787 493Q702 461 624 401L607 389Q655 383 688 358L697 352V342Q699 330 699 297Q704 209 710 173T734 103Q751 69 765 69Q769 69 806 83L824 90V74Q823 73 759 24T693 -26Q692 -26 660 32L628 90L629 111Q631 159 631 177Q631 278 614 300Q584 340 523 340Q500 340 467 333T431 325Q429 325 429 322Q428 321 426 308T420 275T410 230T392 178T366 125L358 112L342 99Q306 70 269 38T213 -10T193 -26Q192 -26 163 0T116 26Q82 26 50 -8L42 -16L35 -8L27 0L35 10Q43 21 58 38T104 80T158 106Q179 106 218 65L235 48Q238 48 255 60T295 99T329 158Q352 231 352 359Q352 555 242 614Q210 628 187 628Q140 628 116 600T91 548Q91 522 138 464T185 382V376Q185 345 158 313T103 263L76 246Q74 244 64 253L54 260L65 267Q91 285 100 302Q111 318 111 337Q111 355 69 410T27 496ZM562 628Q504 628 443 507L435 491L436 479Q437 471 437 446Q437 396 432 351L529 389L602 426Q673 462 673 463H672Q644 470 637 483T622 553Q608 628 562 628'], - - // LATIN CAPITAL LETTER S - 0x53: [692,27,829,66,756,'750 276Q750 141 645 57T378 -27Q224 -27 146 67Q66 163 66 307Q66 361 80 412T127 515T217 609T356 676L388 684L420 692L442 681Q545 625 586 608T654 591Q688 591 710 609T737 646L742 665Q742 665 756 654L752 642Q736 594 706 566T621 515L607 510Q580 513 528 542T421 599T335 627Q272 627 214 569Q139 500 139 373Q139 308 159 247T217 136T316 56T455 26Q520 26 566 43T634 90T666 148T676 207Q676 264 649 297T580 338Q574 339 552 339Q516 339 442 325T327 310H324Q303 310 290 312T259 328T232 369Q230 375 230 390Q230 426 259 461Q286 488 338 507Q351 498 351 495L346 492Q342 490 339 488T330 482T320 473T312 462T305 447T303 428Q303 368 366 368Q393 368 487 388T613 409Q656 409 696 385T748 306Q750 294 750 276'], - - // LATIN CAPITAL LETTER T - 0x54: [701,27,669,34,676,'289 686Q338 686 439 668T565 649Q606 649 641 672Q656 683 664 690T674 700L675 701Q676 698 676 692V681L641 636Q608 591 602 588Q577 575 528 575Q490 575 438 583L426 585L416 578Q335 520 335 465Q335 437 393 366T452 259Q452 226 406 171Q387 146 351 115L341 106L358 97Q438 58 475 58Q525 58 598 124L608 133Q617 119 617 118Q617 114 606 103Q513 0 448 -27L438 -25Q401 -19 337 14T234 48Q186 48 122 -3L112 -11L106 -3L101 5L110 15Q160 63 209 105L224 117H310Q384 163 384 210Q384 238 329 303T263 398Q262 400 262 404Q262 427 290 476T368 580Q383 596 381 596Q315 622 228 622Q159 622 118 593T76 516Q76 482 96 461T139 431L107 399L75 367Q34 403 34 472Q34 525 64 572T148 652Q207 686 289 686'], - - // LATIN CAPITAL LETTER U - 0x55: [697,27,646,-25,665,'160 247Q160 291 110 382T59 505Q59 542 106 597T207 690L218 697L229 682Q229 680 216 669T187 644T158 604T144 552Q144 526 165 482T207 387T228 291Q228 277 228 267T224 247T219 232T210 217T199 202T184 184T166 163L118 107Q124 105 132 105T160 98T220 77Q298 47 317 47Q354 47 409 105Q444 142 451 161T458 244V277Q458 339 455 457T447 596L575 686L591 676L583 668Q550 632 541 587T532 449V372V298Q532 198 550 147Q572 79 605 79Q617 79 631 84T656 95L665 100V79L595 27Q578 15 560 2T532 -19L523 -26Q522 -26 490 42L458 111L397 50Q389 42 374 27T355 8T340 -5T325 -16T311 -22T294 -26T274 -27Q232 -25 152 6T35 37Q28 36 19 30T4 18T-8 4T-16 -5Q-25 10 -25 11T-20 18Q-5 34 15 57L54 101Q70 103 86 116Q94 121 113 140T137 166Q160 201 160 247'], - - // LATIN CAPITAL LETTER V - 0x56: [687,26,831,26,825,'54 266Q118 307 118 339Q118 360 74 413T27 493Q26 530 59 578T133 651Q187 686 256 686Q299 686 332 673T382 640T409 600T424 567T429 553Q431 553 463 586T542 653T624 686Q663 686 715 652T798 617Q812 617 825 622V606L815 599Q785 576 762 546Q724 495 724 432Q724 397 737 317T750 217Q750 148 711 96Q697 75 639 34T578 -10Q563 -21 555 -23T522 -26Q458 -26 363 29Q253 89 211 89Q192 89 173 83T139 67T114 49T96 34L90 27L80 43L95 59Q121 87 148 110T191 143T213 154Q261 154 300 195Q328 222 340 267T352 406Q352 562 255 611Q222 627 187 627H182Q143 627 115 598Q96 579 96 559Q96 528 144 470T192 381Q192 348 156 314T80 256L70 250L54 266ZM727 548Q701 550 650 583T567 617Q560 617 554 615Q532 610 501 580T445 501L437 485V465Q432 326 378 223L294 150Q321 143 421 87T560 31Q608 31 634 64Q660 102 660 198Q660 226 655 292T650 387Q650 418 658 452L660 462L735 548H727ZM264 150Q265 151 263 151H261Q261 150 264 150ZM280 150H276V149Q280 149 280 150'], - - // LATIN CAPITAL LETTER W - 0x57: [686,27,1046,32,1054,'32 501Q35 564 103 625T264 686Q326 686 365 652Q402 618 420 564L441 585Q486 630 539 670L559 686L572 672Q637 606 665 559L682 576Q787 686 845 686Q877 686 929 656T992 623Q999 621 1016 621Q1041 621 1054 628L1051 617L1047 606Q1042 602 1037 597Q983 557 969 522T954 434Q954 394 961 336T968 221Q968 201 966 184T963 155T956 131T948 113T936 96T923 82T906 66T887 50L816 -2Q815 -3 810 -6T801 -11T791 -16T777 -20T759 -23T735 -25Q691 -25 619 4T505 37H496L463 21Q420 0 389 -20L378 -27H362Q316 -27 275 -9T202 28T150 46H146Q114 46 59 -5L48 -16L41 -6Q40 -4 38 -2T34 2L33 4Q33 8 77 54Q111 87 142 112L154 122H166Q239 127 288 182Q346 244 346 406Q346 489 326 537T259 610Q227 628 195 628Q155 628 128 606T101 549Q101 517 146 465T192 382Q192 348 156 310T85 254L75 250L64 258L55 266Q56 267 74 276T105 301T118 339Q118 362 75 413T32 501ZM952 547Q927 555 877 586T796 617Q744 617 682 525L676 516L677 498Q678 486 678 425Q678 301 652 206Q649 195 613 151T577 102Q577 100 582 100Q618 100 720 51Q761 32 790 32H794Q843 32 869 83Q884 110 884 189Q884 233 879 294T873 400Q874 433 879 451T889 478T915 507T952 547ZM241 105Q249 98 263 88T317 60T393 42Q478 42 547 109Q607 171 607 358Q607 371 607 380T604 417T595 467T577 517T546 566T500 601L479 580Q449 550 433 526L426 516V503Q426 311 357 200L352 191L296 149Q241 107 241 105'], - - // LATIN CAPITAL LETTER X - 0x58: [688,27,719,28,709,'96 511L78 527L149 603Q207 666 227 686L237 685Q278 680 306 667T351 631T376 588T395 533L400 516L406 527Q439 600 523 653Q538 664 587 688Q589 688 596 672T613 635T629 606Q643 588 665 588Q677 588 693 596L709 603V585L607 526Q583 536 554 564T512 614Q461 571 435 507T405 381V367H581L563 347Q561 344 558 341T553 335T549 330T546 326L545 325H541Q537 325 488 329T411 334H405V325Q405 198 454 123Q497 54 568 54Q594 54 619 64T660 84L676 95V74L565 -16L553 -20Q528 -27 512 -27Q492 -27 475 -21T444 -5T418 19T398 47T382 77T371 105T363 128T358 145L357 151Q354 151 339 136T294 91T232 37Q152 -22 113 -22Q90 -22 69 -9T38 17T28 32Q28 33 58 68L86 101Q94 81 115 64T165 47Q206 47 249 84Q302 128 325 222Q334 263 336 312V334H312Q198 334 163 324H161Q162 326 182 348L198 367H336V398Q333 508 308 550Q295 570 274 585T227 601Q204 601 181 589T145 565T115 533T96 511'], - - // LATIN CAPITAL LETTER Y - 0x59: [686,218,833,27,740,'123 345Q123 358 75 415T27 496Q27 533 63 578T121 639Q181 685 256 685Q305 685 332 676T384 635Q419 588 425 542Q468 585 526 628T618 686Q632 667 658 645T704 609T724 594Q740 512 740 385V375V361Q740 128 682 -3Q656 -64 554 -141T361 -218Q319 -218 287 -203T243 -173T230 -150Q230 -148 267 -109L304 -69Q311 -115 341 -142T411 -170Q474 -170 534 -119T624 11Q660 111 660 312Q660 447 633 528L612 549Q578 583 552 596L543 601L528 592Q501 574 483 558Q454 528 436 494L431 484V473Q431 330 376 230Q366 213 359 206T306 159L250 112Q278 105 327 82T399 58Q421 58 440 69T471 92T484 104H485L493 90L480 73Q453 39 429 13Q393 -22 372 -22Q342 -22 260 15T153 53Q97 53 48 -16L38 5Q46 22 74 54T128 108L143 122H155Q226 127 275 168Q352 236 352 399Q352 501 309 564T197 628Q156 628 129 607T102 553Q102 517 147 463T192 383Q192 323 75 250L59 266Q123 314 123 345'], - - // LATIN CAPITAL LETTER Z - 0x5A: [729,139,602,11,532,'148 590Q95 592 91 627V633L160 729H176Q169 713 169 705Q169 670 244 670Q269 670 305 672T357 675Q405 675 432 661T468 609Q469 605 469 596Q469 572 460 540Q433 463 301 372Q325 378 359 378Q431 378 472 350T519 297Q532 249 532 198Q532 115 500 40T442 -57Q335 -139 202 -139Q165 -139 125 -131L112 -129V-100Q112 -49 106 -33T75 -17Q55 -17 31 -35L22 -42L11 -26L22 -18Q94 36 151 36H160Q171 36 178 33T188 27T194 13T196 -5T197 -32Q198 -79 206 -90Q217 -107 251 -107Q336 -107 389 -33T442 155Q442 240 407 274Q362 319 285 319Q236 319 192 298Q188 298 181 309L224 372Q227 373 234 374T246 376T257 379T271 384T285 391T302 402T321 417Q384 471 384 540Q384 562 366 581T306 600Q292 600 233 595T148 590'], - - // LEFT SQUARE BRACKET - 0x5B: [740,130,278,117,278,'262 -119Q224 -120 191 -123T141 -128T118 -130Q117 -130 117 305V740H122Q141 737 219 736H278V723Q278 711 277 711L159 699V-93H162Q167 -93 220 -96T276 -100Q278 -100 278 -109V-119H262'], - - // RIGHT SQUARE BRACKET - 0x5D: [739,131,278,-4,160,'64 733Q89 733 110 734T143 737T158 738H160V-131H154Q101 -125 40 -124H-4V-103H1Q3 -102 57 -98T113 -92H118V700L64 703Q7 707 3 708H-4V732H21Q34 733 64 733'], - - // CIRCUMFLEX ACCENT - 0x5E: [734,-452,500,0,495,'0 464L250 734L262 722Q274 712 384 598L495 486Q483 478 467 467L456 459L248 672L154 580L23 452Q17 454 10 458T0 464'], - - // LATIN SMALL LETTER A - 0x61: [470,35,500,66,497,'86 363Q86 365 128 391T212 444L255 470Q256 470 263 465T283 453T308 442Q338 431 346 431Q350 431 358 436L414 465L421 459L418 434Q404 339 404 262Q404 147 408 119L425 97Q443 74 444 74L467 86L491 97Q492 97 497 83L436 28Q377 -26 374 -26L331 46L329 91L155 -35Q152 -35 114 10T68 65L67 86Q66 100 66 156Q66 177 66 198T68 236T71 268T74 296T77 320T80 338T83 351T86 360V363ZM314 365Q285 367 255 374T206 386L187 392Q181 392 172 376T154 311T145 197Q145 124 151 118Q156 110 187 78L208 56H214Q221 57 253 76L308 109L329 123V136Q328 143 328 257V365H314'], - - // LATIN SMALL LETTER B - 0x62: [685,31,513,87,442,'177 427Q177 364 181 364Q184 364 192 370T223 395T271 433Q317 469 323 469Q325 469 338 462T377 440T432 413L440 409L441 396Q441 394 441 372T442 334Q442 203 425 108L423 97L400 83Q347 49 296 21T222 -19T196 -31Q192 -29 149 12T87 71L89 89Q100 155 100 319Q100 500 94 627Q94 632 94 638T94 648T94 656T93 662V664Q93 668 97 669T106 670H110Q114 653 118 633L127 596Q127 595 132 597Q136 599 195 642L255 685L272 673Q269 670 256 659T233 637T211 609T190 565T179 508Q177 494 177 427ZM295 377L274 385Q273 385 264 381T242 370T223 361Q213 355 188 340L178 333V123L198 103Q259 42 285 42Q299 42 314 55T339 85Q363 132 363 232Q363 310 358 343V349L345 355Q330 363 295 377'], - - // LATIN SMALL LETTER C - 0x63: [466,29,389,72,358,'72 208Q72 323 84 361Q84 363 167 414Q248 466 250 466Q255 465 260 465Q283 460 307 450T344 430L357 422L306 343L301 342L296 340Q267 362 247 372T216 384T177 390Q154 349 154 238Q154 220 156 158V145L168 132Q179 121 208 93T244 59Q245 58 246 58Q255 58 302 83T350 108L352 104Q355 100 356 96L358 92Q358 91 274 32T187 -29L177 -20Q160 -6 120 36T77 84Q77 87 75 118T72 208'], - - // LATIN SMALL LETTER D - 0x64: [609,33,499,13,428,'13 542Q13 544 77 576T147 609Q154 609 185 598T283 551T414 464L427 454V440Q427 436 427 412T428 372Q428 315 426 270T418 197T409 152T400 121T394 103L304 35Q285 21 261 2T225 -25L214 -33Q149 7 97 59L76 80L75 91V171Q75 221 76 254T79 299T80 313Q80 315 78 321Q78 323 78 326L77 330Q79 336 132 384T211 447L219 445Q221 445 224 444L228 443Q229 443 228 441T221 432T206 415L191 395Q175 378 162 339Q152 306 152 250Q152 217 159 140V134L171 121Q194 99 235 74T284 48Q296 48 310 75T337 156T349 267Q349 346 336 400L315 420Q246 489 176 525Q127 545 94 545H73L27 527L13 542'], - - // LATIN SMALL LETTER E - 0x65: [467,30,401,70,364,'353 103Q353 97 358 87L337 71Q293 38 247 6Q191 -30 189 -30Q188 -30 173 -16T130 26T76 85L74 99Q70 139 70 190Q70 228 73 271T79 338T84 365L94 372Q105 378 126 392T166 417L246 467Q283 417 349 369L364 358L355 349Q249 249 169 180L151 166L152 152V139L165 126Q186 105 215 84T260 62Q267 62 309 82L353 103ZM267 323Q246 337 230 350T204 371T189 385T179 394T174 397Q149 381 149 219V211Q151 211 171 223T220 258T268 299L282 313L267 323'], - - // LATIN SMALL LETTER F - 0x66: [681,221,326,30,323,'128 387Q128 391 112 456T92 546V555L101 568Q133 617 183 670L193 681L204 673Q238 648 262 648Q276 648 292 656L302 661L308 653Q308 652 278 618L249 585H234Q194 587 159 595Q158 595 156 596H153L150 597Q151 593 152 581T154 564T157 547T164 524T176 494Q199 436 203 400V392H207L323 386Q323 384 309 368L296 351H203V176Q201 -9 198 -32Q194 -61 166 -114Q158 -129 153 -138Q114 -214 110 -221Q105 -221 98 -220L87 -219V-216Q88 -215 106 -150T124 -82Q128 -73 129 155V351H30L64 386H96Q128 386 128 387'], - - // LATIN SMALL LETTER G - 0x67: [470,209,504,17,455,'27 -144L17 -131L82 -75L146 -20L126 6Q99 37 92 48L78 65L77 79Q75 103 75 158Q75 217 78 268T86 343T91 368Q92 370 109 382T157 413T222 452Q240 465 249 469L251 470Q296 443 350 428L365 424L437 465L442 459Q442 456 441 453T437 444T432 424T427 385T423 317T421 215V133L423 119Q423 111 455 -17Q455 -21 380 -108T290 -201Q290 -202 284 -204T269 -207T252 -209Q172 -209 75 -135L62 -126Q60 -126 44 -135L27 -144ZM349 351Q267 359 178 389Q177 387 173 376T166 358T161 337T157 303T155 259Q155 195 159 135L160 124L170 112Q180 101 204 77T230 53Q231 53 286 88L340 123V141Q340 235 348 329Q348 334 348 339T348 348L349 351ZM364 -59Q364 -37 358 -1T347 64T341 93Q336 93 252 28T149 -57Q226 -134 293 -134Q325 -134 344 -118T364 -69V-59'], - - // LATIN SMALL LETTER H - 0x68: [688,205,521,77,434,'88 427Q88 486 87 545T84 634T81 667Q81 673 82 673T89 676H94L117 600L200 661Q208 667 218 674T233 684L238 688L254 678Q222 646 216 637Q164 572 164 483V442V371Q187 390 244 431T312 478Q344 446 411 423L428 417L429 396Q434 297 434 218Q430 8 406 -34Q346 -111 262 -195L251 -205L249 -203Q248 -203 244 -199T236 -193Q226 -183 227 -182Q228 -182 244 -169T278 -140T301 -121Q330 -89 340 -22Q355 60 355 171Q355 200 353 244T348 321T344 354Q333 363 307 376T260 390Q241 390 179 350L164 341V121Q180 96 201 66L213 50Q210 46 172 11T131 -24Q130 -24 123 -11T102 25T77 65V78Q80 104 84 227T88 427'], - - // LATIN SMALL LETTER I - 0x69: [673,20,279,14,267,'72 617Q72 618 102 645T133 673H134Q134 668 175 627L187 615L130 555L116 568Q72 615 72 617ZM27 369Q21 376 14 382L26 392Q83 440 119 474Q158 435 169 427L179 420L176 395Q166 302 166 227Q166 171 174 139Q178 119 186 103T202 81L208 75Q255 100 261 100Q262 100 264 92T267 83Q267 80 208 30T145 -20Q143 -20 118 17L91 55Q98 117 98 193Q98 339 88 369Q71 390 68 390Q63 390 39 376L27 369'], - - // LATIN SMALL LETTER J - 0x6A: [672,208,281,-9,196,'101 644L132 672L145 657Q155 642 169 628L182 614L169 600Q148 579 140 570L125 555L112 568Q109 570 91 592T72 615Q72 617 101 644ZM19 -208Q-9 -185 -9 -183Q57 -134 80 -106Q103 -81 110 -19T118 179Q118 294 113 329T86 383Q78 389 76 389Q73 389 57 379L39 367Q26 380 26 381L33 387Q40 393 53 405T79 428L130 474Q147 457 186 428L195 422L196 376Q196 130 192 58T174 -35Q172 -39 104 -114T19 -208'], - - // LATIN SMALL LETTER K - 0x6B: [689,25,389,24,362,'93 348Q93 379 90 503T87 658V670Q87 671 94 671L100 672L112 636Q124 603 124 600L144 616Q196 659 234 682L246 689Q252 686 256 685T268 680L254 667Q225 641 211 626T184 579T168 505V497L178 504Q203 523 237 544L300 584L310 573Q359 522 359 481Q359 476 359 472T358 464T355 456T351 448T346 440T340 433T332 424T323 414T312 402T299 389L255 343L300 342H346L320 309H177V128L193 113Q214 92 244 68L254 60L303 84Q351 108 352 108L362 96Q355 85 277 30T194 -25L170 -4Q146 18 120 41T89 68Q94 85 94 168Q94 184 94 218T93 268V309H58L24 310L51 342H93V348ZM172 342Q217 342 252 374T287 445Q287 472 255 504Q242 517 241 517Q202 498 187 468T168 365V342H172'], - - // LATIN SMALL LETTER L - 0x6C: [685,20,280,98,277,'221 76L267 99Q268 98 269 96T271 88T270 82L262 76Q255 69 241 57T214 34L148 -20L98 56L99 89Q107 247 107 373Q107 494 101 621Q101 653 99 659V665L106 668L113 672L118 655Q122 642 131 617L138 597Q140 597 157 611L240 670L264 685Q265 685 270 680T276 674T269 667T247 647T219 617Q197 587 186 551T173 493T171 438Q171 376 175 282T179 147V117Q184 109 201 93T221 76'], - - // LATIN SMALL LETTER M - 0x6D: [475,26,767,8,753,'20 367L8 379Q9 380 63 425T118 471Q130 460 143 446L168 421V398L169 376L295 475Q362 433 415 418V399Q415 380 416 380T437 394T484 428T529 462L544 474L556 467Q590 449 614 438T646 424L653 421L665 417L664 412Q664 411 664 407T664 397T663 384Q660 342 660 335Q658 303 658 245Q658 186 660 152L661 126L669 115Q680 96 697 79L707 83Q716 87 723 90T735 96T741 100T746 102L747 103V102L750 95Q753 88 753 87L631 -18Q630 -17 622 -3T589 43L576 60L579 72Q592 146 592 218Q592 265 584 321Q581 345 578 350T560 363Q535 376 496 386L481 390Q475 387 425 358L415 351V238V157Q415 142 415 135T417 120T421 110T430 98T441 81L465 47Q462 44 458 41T443 28T420 8L380 -26L333 47L336 62Q339 77 342 109T345 184Q345 223 341 285T333 348Q322 364 258 382L240 388L169 347L168 240Q168 118 171 110L174 106Q178 101 183 93T195 78L217 48Q217 47 196 30T154 -5T133 -21L130 -16Q127 -10 122 0T111 19Q89 56 89 60Q95 76 95 153Q95 239 88 337V365L62 391L20 367'], - - // LATIN SMALL LETTER N - 0x6E: [475,22,527,20,514,'31 368Q20 379 20 380T72 427L121 470L129 463Q137 455 155 441T176 425V367L320 475L329 469Q351 454 385 437T434 417L432 402Q429 362 429 231V128L439 111Q442 107 445 102T449 95T453 90T456 86T459 84T463 82T467 82Q468 82 489 93T511 105T514 95V88L395 -18L340 65L341 77Q347 111 348 178Q348 343 343 353V358L332 363Q298 377 264 382Q260 382 254 382L249 383Q247 383 211 362L176 341V229V147Q176 134 176 127T177 115T179 106T183 99T189 91T197 81Q201 76 206 69T214 57L217 53Q217 52 175 15T132 -22Q132 -20 114 5T88 41Q84 45 84 50Q94 116 94 203Q94 227 93 263T92 324L90 364L67 388L50 378Q32 368 31 368'], - - // LATIN SMALL LETTER O - 0x6F: [480,28,489,67,412,'67 121Q70 265 84 359V364L97 371Q137 394 177 421T238 464T260 480L278 468Q295 457 327 442T394 418L406 414Q412 388 412 300Q412 263 410 228T405 170T399 130T393 103T391 92L381 86Q274 19 165 -28L161 -24Q157 -21 151 -15T136 -2T118 14T101 30T86 46T74 60L67 68V121ZM335 278Q335 286 335 303T334 335L333 349V356H326Q288 360 208 388L183 397Q178 393 172 383T154 333T142 239Q142 192 151 134Q152 124 155 120T175 99Q197 77 219 64T251 47T267 44T281 52T302 80T320 124Q335 182 335 278'], - - // LATIN SMALL LETTER P - 0x70: [541,212,500,12,430,'23 25Q15 33 12 38L35 59Q82 102 87 105V351L68 378Q42 414 42 422Q42 437 67 472T114 530L125 541Q126 541 132 537T138 532Q121 507 121 488Q121 453 160 413L167 405L166 390L165 372Q169 372 233 421T305 478Q307 479 315 472Q395 421 423 415Q424 415 424 415T425 414L426 410Q426 407 426 401T426 388Q430 335 430 272Q430 139 408 80Q407 78 340 22L273 -33Q200 23 165 23Q164 23 164 -32Q165 -89 168 -155V-170L93 -212L78 -203Q85 -48 87 16V47H79Q53 44 23 25ZM319 41Q346 94 349 212Q349 278 343 343V351L330 357Q318 363 270 381L255 387L245 383Q212 370 178 345L166 336V287Q165 260 165 166V94H175Q219 90 299 51L319 41ZM132 57L129 60Q130 58 132 57ZM158 29Q159 29 155 34T145 45T138 50Q155 29 158 29'], - - // LATIN SMALL LETTER Q - 0x71: [479,219,489,60,419,'399 19Q399 -123 407 -174V-179L332 -219L322 -210L312 -202L314 -185Q320 -83 323 54V95L311 85Q255 40 162 -19Q146 -29 145 -27Q140 -22 103 20L63 65V73Q61 83 61 115Q61 122 61 135T60 154Q60 263 79 353L83 368L94 375Q123 391 147 405T186 429T212 446T229 458T238 466T243 470T247 471L260 464Q274 457 295 448T330 434L341 432L410 479L412 478Q414 476 416 475T419 473L417 461Q399 358 399 19ZM316 367Q287 370 252 377T196 391L176 397H175Q173 397 166 382T149 314T139 187V158Q139 138 141 132T155 114Q158 111 160 109Q210 58 211 58L218 62Q226 67 240 75T266 91L319 124V196Q319 334 325 361V367H316'], - - // LATIN SMALL LETTER R - 0x72: [474,21,389,17,387,'357 398Q364 398 375 403L386 408Q386 404 387 400V393L369 377Q361 370 350 360T336 347T327 340T316 336T303 335Q270 335 234 371L224 379Q220 375 214 370T198 355L182 340V243Q182 164 183 152T189 129Q195 117 211 100T239 72T254 60T298 81Q342 101 343 101Q344 100 345 92T346 82L200 -21Q174 -5 117 55L97 75L99 92Q106 147 106 196Q106 216 104 282T97 355Q95 359 95 361Q95 364 77 378L65 387L48 380Q30 372 29 372Q28 371 23 375T17 380Q17 384 50 415T107 467L115 474L128 461Q171 421 182 414V382L235 425Q247 435 261 446T283 462L290 468L295 460Q335 398 357 398'], - - // LATIN SMALL LETTER S - 0x73: [478,29,443,-18,406,'272 33Q284 33 290 70T296 138Q296 181 290 198T262 230Q257 232 246 232Q231 232 218 227T156 194L108 167L101 176Q90 192 75 219L69 230V284Q69 346 70 357V377L146 427Q181 450 202 464T223 477L225 476Q227 475 229 474Q231 472 242 466T270 450T296 431Q309 418 326 418Q342 418 361 429T392 450T403 459Q406 445 406 442Q406 440 384 421T338 382L316 363Q315 362 310 362Q292 362 251 371T173 396Q156 403 155 403Q143 386 143 342Q143 305 150 278T168 244Q171 242 181 242L190 243L315 300Q330 295 357 274Q358 273 362 270T366 266T369 261T372 253T373 239T374 217T374 185Q374 157 372 133T368 98T363 71T358 50L336 40Q288 20 255 2T211 -22T198 -29L190 -22Q181 -14 168 -3T138 19T104 38T70 46Q50 46 32 37T3 20T-9 11L-18 23L-1 41Q46 89 62 99T112 110Q141 110 157 103T225 62Q268 33 272 33'], - - // LATIN SMALL LETTER T - 0x74: [640,20,333,27,348,'228 640L242 627L227 613Q213 599 211 593T203 553Q197 500 196 435V389H301L272 353H195V274Q195 178 196 159L197 123Q249 71 273 68H280L312 83Q344 99 345 99Q348 99 348 78Q348 76 314 52T246 4L212 -20Q211 -20 164 19T112 62Q112 122 113 196Q113 228 113 262T114 318T114 341V353H27L62 389H116L117 431V558L228 640'], - - // LATIN SMALL LETTER U - 0x75: [474,23,517,9,513,'171 315Q171 252 165 199T153 124L147 103Q147 102 196 80L244 57L335 107V116Q339 161 339 268Q339 315 338 351T337 412V424L420 468Q424 465 427 461L424 435Q412 331 412 226Q412 170 415 145T434 96Q442 84 452 83Q461 83 492 96L506 102Q507 102 510 96T513 88L493 71Q445 32 401 -9Q392 -18 388 -17L384 -16Q358 39 355 44Q336 77 333 77Q261 45 203 -9Q186 -23 181 -23Q177 -23 162 -11T121 18T69 44L57 48L61 54Q65 60 71 73T82 102Q100 156 100 262Q100 305 93 335T80 373T62 396L23 376Q18 377 9 386L119 474Q149 437 171 421V339V315'], - - // LATIN SMALL LETTER V - 0x76: [530,28,512,55,434,'55 418Q55 443 100 503Q121 530 123 530Q125 528 127 528T131 528T134 528T135 524T131 516Q123 499 123 486Q123 457 159 416L169 405L170 388L171 372Q171 371 244 424L317 477L334 466Q394 428 432 416L433 402Q433 400 433 377T434 336V305Q434 195 420 131Q413 94 406 87Q403 84 298 29L192 -28L172 -8Q139 25 106 52L92 64V70Q95 97 95 198Q95 293 94 318L92 355L84 367Q55 406 55 418ZM174 306Q174 297 173 255T171 184Q171 153 175 136T198 100Q207 94 224 80T255 57T282 49Q304 49 328 80Q359 129 359 243Q359 284 352 345Q351 358 348 360Q333 373 304 384T265 396L251 390Q215 372 186 351L175 344V337Q175 319 174 306'], - - // LATIN SMALL LETTER W - 0x77: [532,28,774,45,688,'45 425Q45 439 82 485T126 532Q127 532 128 532T131 531T137 529L132 519Q121 499 121 483Q121 473 131 454T156 419L167 408L169 376L185 388Q237 425 291 473L301 466Q337 443 394 416L419 405L418 387V369Q419 369 487 418T560 471L581 459Q597 450 621 437T664 415T684 406Q688 406 688 323Q688 254 679 193T662 103T648 71Q647 70 554 20L464 -28L443 -15Q416 1 386 17T343 40T331 49Q331 52 333 73T337 133T339 216Q339 309 334 339Q333 341 316 353T277 377T246 389Q235 389 201 369T166 346Q166 345 164 247Q164 232 164 210T163 179Q163 139 170 116T205 57L212 48L136 -27Q115 16 87 44L78 53L80 67Q88 124 88 211Q88 282 87 315T83 356T74 371Q45 410 45 425ZM591 352Q580 359 565 365T540 374T517 381T504 385L418 342L417 318V220Q417 212 417 194T417 170T418 152T420 134T424 120T431 106T440 95T454 83Q508 44 544 44Q566 44 583 77Q603 120 605 235Q605 289 600 322Q598 343 597 345T591 352'], - - // LATIN SMALL LETTER X - 0x78: [472,188,389,10,363,'14 377Q63 428 117 472Q130 462 144 449L193 408V392V376L247 420Q300 464 301 464L310 451Q331 417 363 390L333 365Q303 340 301 340Q293 343 277 364T250 386Q241 386 215 361L195 341Q194 333 193 327T191 318T190 304T188 269Q188 220 192 148Q193 122 195 118T210 101Q255 60 271 60Q276 60 278 61L318 82Q327 86 336 91T351 98L356 101Q359 82 356 79Q354 77 283 27T210 -24L192 -7Q160 23 137 40L126 49L116 40Q66 -13 66 -54Q66 -117 167 -140L179 -142V-147L180 -152L123 -188L112 -185Q58 -170 31 -145Q10 -122 10 -96Q10 -80 22 -53Q44 -10 95 49Q97 51 100 54T104 59T107 64T109 71T111 81T112 97T113 119T114 149T114 188Q114 284 108 347V354L96 365Q76 385 67 385Q62 385 45 377L27 368L14 377'], - - // LATIN SMALL LETTER Y - 0x79: [528,218,499,45,431,'74 58Q89 124 89 241Q89 265 89 278T89 305T88 324T87 336T84 346T81 352T77 359T71 368Q57 388 52 398L45 409Q62 454 98 507L113 528Q128 528 128 524Q128 523 125 518T120 503T117 483V471Q123 456 130 445Q135 438 140 432T148 422T153 415T157 409T160 405T162 402T163 399T163 395V384V365Q165 365 237 419L311 473Q383 430 420 416Q426 414 426 411V404Q426 398 426 388T427 367Q431 233 431 201Q431 -3 391 -52Q387 -58 305 -138T221 -218L218 -217Q216 -216 211 -214T202 -210L184 -202L199 -194Q259 -162 288 -127T334 -19T350 184Q350 257 342 328L340 356Q282 390 262 390Q248 390 178 346L163 336V111L216 45L131 -26L124 -15Q114 3 85 44L74 58'], - - // LATIN SMALL LETTER Z - 0x7A: [471,214,391,-7,314,'47 335L36 347L52 362Q112 421 167 461L181 471L192 465Q236 444 260 417T284 369Q284 355 276 343T233 291Q195 246 195 245T205 242T241 228T300 198L302 187Q314 138 314 74Q314 -24 291 -95Q290 -100 222 -157L154 -214H145Q102 -214 53 -189T-7 -117Q41 -21 183 122L207 147Q205 149 186 157T140 172T100 180H97V192L140 231Q192 280 199 293Q205 303 205 315Q205 339 185 363T137 388Q119 388 63 347L47 335ZM179 -153Q212 -153 226 -113T240 14Q240 67 233 98T223 132T211 143L222 130Q216 125 206 116T170 82T124 33T88 -20T72 -70Q72 -99 105 -126T179 -153'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Fraktur/Regular/BasicLatin.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/Main.js deleted file mode 100644 index 620cc788e7..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/Main.js +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Fraktur/Regular/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Fraktur'] = { - directory: 'Fraktur/Regular', - family: 'MathJax_Fraktur', - id: 'MJFRAK', - Ranges: [ - [0x0,0x7F,"BasicLatin"], - [0x80,0xDFFF,"Other"], - [0xE300,0xE310,"PUA"] - ] - - -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Fraktur/Regular/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/Other.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/Other.js deleted file mode 100644 index 1c4820bdda..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/Other.js +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Fraktur/Regular/Other.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Fraktur'], - { - // LEFT SINGLE QUOTATION MARK - 0x2018: [708,-410,215,45,158,'117 410Q97 410 71 455T45 539Q45 588 129 694L140 708Q142 708 153 694L147 682Q106 609 106 582V577V571Q106 548 132 511T158 455Q158 434 143 422T117 410'], - - // RIGHT SINGLE QUOTATION MARK - 0x2019: [692,-395,215,49,163,'105 529Q105 546 77 588T49 651Q49 658 51 666Q53 672 67 682T92 692Q111 692 137 644T163 563Q163 534 143 497T99 428T74 395Q72 395 65 400T58 407Q105 476 105 523V529'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Fraktur/Regular/Other.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/PUA.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/PUA.js deleted file mode 100644 index e8da68217e..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/PUA.js +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Fraktur/Regular/PUA.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Fraktur'], - { - // stix-capital Gamma, Greek slashed - 0xE300: [683,32,497,75,431,'427 436Q427 434 427 425T429 398T430 362Q430 222 396 109L393 99L305 33Q218 -32 216 -32Q208 -29 142 22L91 68L78 81L77 94Q75 130 75 173Q75 245 87 347L135 385Q178 418 184 424L177 428Q174 429 170 431Q116 454 96 473T75 534Q79 608 154 683Q164 677 164 673Q164 670 157 662T144 637T137 598Q137 552 182 518T280 470T380 447T427 436ZM342 371L275 394L208 417Q203 417 192 399T168 334T156 229Q153 187 153 157Q153 141 156 135Q158 125 208 88T280 51Q306 51 326 120T346 297Q346 339 344 354T342 371'], - - // stix-MATHEMATICAL BOLD CAPITAL GAMMA SLASHED - 0xE301: [616,30,498,35,432,'39 551L35 569L52 577Q72 586 98 595T140 610T158 616Q174 612 200 604T293 560T412 477Q414 475 417 472Q428 462 430 450T432 376Q432 223 401 124Q395 106 393 103T382 92Q351 68 281 20T206 -29Q201 -31 137 26L100 60L78 83L77 112Q76 132 76 170Q76 259 86 342L88 360L101 371Q116 386 163 422T215 459Q216 459 224 455T233 450L229 446Q225 442 218 434T203 419Q179 394 175 389T168 372Q156 334 156 262Q156 167 164 137Q168 125 196 102T252 62L278 45Q279 45 285 52T302 78T322 126T339 205T346 316Q346 367 344 389L343 406L326 423Q228 520 113 559L100 564L70 557L39 551'], - - // stix-capital Delta, Greek slashed - 0xE302: [680,215,333,29,339,'123 386L120 431Q116 476 116 511V520Q116 593 174 649Q207 680 236 680Q258 680 284 664T312 648Q318 648 327 656Q328 657 330 659Q337 664 337 661Q337 660 338 657Q338 652 339 648L268 566L260 574Q234 600 206 600Q182 600 164 585T145 541Q145 492 211 386L267 385H324L299 354H214V312Q214 86 193 -58L192 -69L116 -215H108Q92 -215 92 -212Q93 -211 100 -189T116 -135T128 -80Q134 -41 134 22Q134 54 130 185T125 349V354H29L59 385H91Q123 385 123 386'], - - // stix-MATHEMATICAL BOLD CAPITAL DELTA SLASHED - 0xE303: [679,224,329,28,318,'91 530Q91 564 116 600T164 656T194 678Q195 678 200 678T209 679Q268 679 316 639L293 593Q267 547 263 546H262Q260 546 256 553Q222 613 180 613Q160 613 146 599T132 564T170 474T210 388H318L296 356H206V322Q204 284 204 255Q202 221 202 161V99Q202 28 194 -22T160 -124Q148 -146 116 -199L101 -224L91 -220Q85 -218 84 -217T83 -215L101 -161Q116 -114 119 -73T122 108Q119 334 117 352V356H72L28 357L66 388H92Q118 388 118 389L109 433Q91 514 91 530'], - - // stix-capital Epsilon, Greek slashed - 0xE304: [471,214,503,52,449,'254 -150Q293 -150 328 -126T363 -54Q363 -38 352 29T339 98L250 34Q160 -30 159 -30L77 64V71Q74 95 74 174Q74 212 75 243T79 294T83 328T87 352T90 366L117 384Q206 446 238 464L250 471Q277 455 306 443T350 427L365 423Q367 423 405 443T443 465L449 455Q431 414 426 362T418 201Q418 135 420 121Q438 -4 438 -19Q438 -26 438 -31T434 -42T429 -51T420 -63T408 -77T391 -95T370 -119T346 -147T325 -170T309 -187T291 -200T274 -207T252 -213T225 -214Q175 -214 132 -196T70 -160L52 -143Q52 -138 90 -48Q90 -47 95 -47H101Q108 -81 146 -115T254 -150ZM341 136Q341 157 344 242T347 348V355L334 356Q299 359 262 367T203 383T179 391Q177 391 173 377T163 323T158 227Q158 164 161 128V121L174 106Q203 75 223 59L341 127V136'], - - // stix-MATHEMATICAL BOLD CAPITAL EPSILON SLASHED - 0xE305: [686,20,333,26,315,'92 446Q92 603 82 664Q94 670 95 670L96 666Q98 661 101 651T108 633Q121 598 121 597L141 612Q247 686 250 686Q251 686 266 679Q261 674 243 659T213 632T190 597T173 546Q172 541 171 530T170 511T170 502Q171 502 222 542L273 582Q308 522 315 504L279 449L269 462Q231 506 215 506Q202 506 190 490Q164 458 164 395V390H279L266 373L254 355H167V306Q169 252 169 217Q170 195 170 147V117L200 92Q234 64 237 64Q243 64 277 81L311 99V75Q310 75 242 27L174 -20L156 -3Q88 60 81 60L79 62Q80 60 82 62Q87 67 87 290V355H57L26 356L73 390H92V446'], - - // stix-capital Zeta, Greek slashed - 0xE306: [577,21,334,29,347,'117 531Q117 533 137 544T178 566L198 577Q200 577 204 575T208 572V570Q208 568 208 566T207 560Q197 496 197 397V392H321L295 353H199V260Q199 157 200 145V122L269 68Q271 67 274 67Q282 67 310 83T342 100Q343 100 345 92T346 83L211 -21L172 12Q117 59 117 63Q117 65 117 87T119 150T120 238V353H75L29 354L65 391H118V460Q117 498 117 531'], - - // stix-MATHEMATICAL BOLD CAPITAL ZETA SLASHED - 0xE307: [475,22,501,10,514,'337 91V78L324 71Q288 53 256 29T206 -8T180 -22Q174 -22 158 -9Q82 46 60 46H59L63 51Q67 56 73 68T85 96Q101 158 101 254Q101 300 95 330T83 370T66 394L53 388Q48 385 41 382T24 374Q22 376 20 378T16 381T13 383T10 385V386L119 475Q150 439 160 430L171 422V409Q173 377 173 300Q173 228 166 183T152 122T145 102Q207 81 242 58L337 104V111Q340 146 340 227Q340 320 339 351T338 408V423L422 469Q425 465 429 462L426 438Q413 354 413 251Q413 152 423 119Q426 110 435 96T452 82Q454 82 509 103Q514 98 514 89Q514 87 507 81T472 51T409 -7L395 -20Q393 -18 390 -17Q386 -14 382 -6Q380 -2 379 1Q369 24 361 40T348 62T341 73T338 84L337 91'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Fraktur/Regular/PUA.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/Arrows.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/Arrows.js deleted file mode 100644 index 14628b53c9..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/Arrows.js +++ /dev/null @@ -1,98 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/Arrows.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // LEFTWARDS ARROW - 0x2190: [518,17,1150,64,1084,'1063 281Q1084 268 1084 251Q1084 231 1063 221L649 220H235Q340 133 364 17Q368 1 368 -2Q368 -16 343 -17Q340 -17 338 -17H332Q317 -17 314 -14T305 6Q298 34 285 62T247 126T179 189T78 233Q64 237 64 251Q64 261 74 265T108 277T154 297Q212 328 251 379T305 495Q309 511 313 514T333 518H338Q363 517 367 510Q368 507 368 503Q368 500 364 484Q345 401 287 331Q254 295 235 282L649 281H1063'], - - // UPWARDS ARROW - 0x2191: [694,193,575,14,561,'33 396Q14 396 14 423Q14 445 18 449T41 459Q72 466 99 478T147 505T185 537T215 571T238 604T254 635T264 661T270 678L272 685Q276 694 288 694Q298 692 300 689T307 672Q331 592 392 535T535 459Q553 454 557 450T561 423Q561 396 542 396Q531 396 501 405T418 443T329 517L319 529L318 179V-171Q307 -193 288 -193Q265 -193 258 -171L257 179V529L247 517Q209 473 158 444T76 405T33 396'], - - // RIGHTWARDS ARROW - 0x2192: [518,17,1150,65,1085,'65 251Q65 270 87 281H500L914 282Q881 304 842 357T785 482Q781 500 781 501Q781 512 792 517Q794 518 812 518H817Q832 518 835 515T844 495Q864 412 923 351T1065 270Q1085 263 1085 251Q1085 240 1077 236T1044 225T995 204Q937 173 898 122T844 6Q840 -10 836 -13T816 -17H811Q786 -16 782 -9Q781 -6 781 -2Q781 1 785 17Q813 138 914 220H500L87 221Q65 228 65 251'], - - // DOWNWARDS ARROW - 0x2193: [694,194,575,14,561,'14 77Q14 104 33 104Q44 104 74 96T156 57T247 -17L257 -29V321Q257 669 259 675Q268 694 289 694Q295 693 300 691T307 686T313 679T318 672V321L319 -29L329 -17Q366 26 417 55T499 94T542 104Q561 104 561 77Q561 56 557 51T535 41Q481 28 438 0T370 -58T330 -119T308 -167T302 -187Q297 -194 288 -194Q278 -194 273 -186T265 -165T251 -127T220 -77Q151 15 41 41Q22 46 18 50T14 77'], - - // LEFT RIGHT ARROW - 0x2194: [518,17,1150,64,1085,'305 495Q309 511 313 514T333 518H338Q363 517 367 510Q368 507 368 503Q368 500 364 484Q345 401 287 331Q254 295 235 282L404 281H744L914 282Q880 305 839 362T785 484Q781 500 781 503Q781 517 806 518Q809 518 811 518H817Q832 518 835 515T844 495Q864 412 923 351T1065 270Q1085 263 1085 251Q1085 240 1077 236T1044 225T995 204Q937 173 898 122T844 6Q840 -10 836 -13T816 -17H811Q786 -16 782 -9Q781 -6 781 -2Q781 1 785 17Q813 138 914 220H235Q340 133 364 17Q368 1 368 -2Q368 -16 343 -17Q340 -17 338 -17H332Q317 -17 314 -14T305 6Q298 34 285 62T247 126T179 189T78 233Q64 237 64 251Q64 261 74 265T108 277T154 297Q212 328 251 379T305 495'], - - // UP DOWN ARROW - 0x2195: [767,267,575,14,561,'33 469Q14 469 14 496Q14 518 18 522T41 532Q121 551 182 608T268 745Q275 767 288 767Q299 767 303 755T320 713T355 650Q424 558 535 532Q553 527 557 523T561 496Q561 469 542 469Q531 469 501 478T418 516T329 590L319 602L318 426V74L319 -102L329 -90Q366 -47 417 -18T499 21T542 31Q561 31 561 4Q561 -17 557 -22T535 -32Q454 -51 393 -108T307 -245Q300 -267 288 -267Q279 -267 274 -259T266 -238T250 -200T220 -150Q151 -58 41 -32Q22 -27 18 -23T14 4Q14 31 33 31Q44 31 74 23T156 -16T247 -90L257 -102V602L247 590Q209 546 158 517T76 478T33 469'], - - // NORTH WEST ARROW - 0x2196: [724,194,1150,63,1084,'429 724Q438 724 452 711T466 690Q466 681 452 671Q361 602 242 599H218L756 135Q832 69 913 -1T1036 -108L1077 -143Q1084 -151 1084 -163Q1084 -180 1074 -187T1054 -194H1052Q1043 -194 939 -105Q866 -42 812 5Q180 549 178 549V546Q179 542 179 539Q183 520 183 483Q183 435 172 390T149 323T130 296Q121 292 115 295Q85 312 85 328Q85 331 95 350T115 406T125 486Q125 540 110 583T79 648T64 675Q64 681 68 687T81 693Q87 693 94 690Q162 657 232 657Q296 657 349 681T420 722Q422 724 429 724'], - - // NORTH EAST ARROW - 0x2197: [724,193,1150,64,1085,'1069 693Q1076 693 1080 687T1085 675Q1085 671 1076 656T1055 621T1034 565T1024 486Q1024 442 1034 406T1054 351T1064 328Q1064 321 1057 313T1042 300L1034 295Q1030 293 1027 293Q1023 293 1020 295T1014 301T1009 308T1005 316T1001 324Q980 368 971 419Q966 442 966 484V492Q966 528 972 553Q971 553 757 368T328 -3T107 -191Q103 -193 94 -193Q78 -193 71 -184T64 -164Q64 -153 72 -143Q79 -136 382 124L934 599H909Q837 599 760 634T683 690Q683 697 696 710T722 724Q726 724 742 714T779 691T838 668T920 657Q959 657 991 666T1043 684T1069 693'], - - // SOUTH EAST ARROW - 0x2198: [694,224,1150,65,1085,'65 663Q65 680 74 687T93 694H96Q104 694 118 683T204 610Q280 545 338 495Q969 -49 971 -49L970 -46Q970 -42 970 -39Q966 -20 966 18Q966 65 977 110T1001 177T1019 204Q1028 208 1034 205Q1064 188 1064 172Q1064 169 1054 150T1034 94T1024 14Q1024 -28 1033 -64T1054 -120T1075 -155T1085 -175Q1085 -181 1081 -187T1068 -193Q1062 -193 1055 -190Q987 -157 919 -157Q817 -157 739 -215Q727 -224 720 -224Q712 -224 697 -210Q683 -199 683 -190T697 -171Q788 -102 907 -99H931L393 365Q317 431 236 501T114 608L72 643Q65 651 65 663'], - - // SOUTH WEST ARROW - 0x2199: [694,224,1150,64,1085,'80 -193Q73 -193 69 -187T64 -175Q64 -172 79 -150T109 -84T125 14Q125 58 115 94T95 149T85 172Q85 179 92 187T108 200L115 205Q119 207 122 207Q126 207 129 205T135 199T140 192T144 184T148 176Q169 132 178 81Q183 58 183 17Q183 -7 182 -24T178 -48L177 -53Q178 -53 389 129T816 498T1043 692Q1049 694 1054 694Q1070 694 1077 684T1085 664Q1085 653 1077 643Q1070 636 767 376L215 -98L240 -99Q312 -99 389 -134T466 -190Q466 -197 452 -210T429 -224Q422 -224 411 -215Q330 -157 229 -157Q190 -157 158 -166T106 -184T80 -193'], - - // RIGHTWARDS ARROW FROM BAR - 0x21A6: [518,17,1150,65,1085,'65 426Q74 448 95 448Q112 448 125 426V281H500L914 282Q881 304 842 357T785 482Q781 500 781 501Q781 512 792 517Q794 518 812 518H817Q832 518 835 515T844 495Q864 412 923 351T1065 270Q1085 263 1085 251Q1085 240 1077 236T1044 225T995 204Q937 173 898 122T844 6Q840 -10 836 -13T816 -17H811Q786 -16 782 -9Q781 -6 781 -2Q781 1 785 17Q813 138 914 220H500L135 221Q134 221 133 221T130 220H125V76Q115 54 95 54Q73 54 65 76V426'], - - // LEFTWARDS ARROW WITH HOOK - 0x21A9: [518,17,1282,64,1218,'1029 475Q1029 505 1068 505Q1129 501 1173 463T1218 363Q1218 296 1170 259T1066 221H1063L649 220H235Q340 133 364 17Q368 1 368 -2Q368 -16 343 -17Q340 -17 338 -17H332Q317 -17 314 -14T305 6Q298 34 285 62T247 126T179 189T78 233Q64 237 64 251Q64 261 74 265T108 277T154 297Q212 328 251 379T305 495Q309 511 313 514T333 518H338Q363 517 367 510Q368 507 368 503Q368 500 364 484Q345 401 287 331Q254 295 235 282L649 281H1063Q1105 284 1131 305T1158 361Q1158 385 1146 401Q1122 441 1063 444Q1029 446 1029 475'], - - // RIGHTWARDS ARROW WITH HOOK - 0x21AA: [518,17,1282,65,1217,'225 221H218Q159 221 112 260T65 363Q65 431 116 468T221 505Q254 503 254 474Q254 456 245 450T216 443T188 438Q152 427 137 401Q125 385 125 362Q125 334 147 310Q171 288 221 281H632L1046 282Q1013 304 974 357T917 482Q913 500 913 501Q913 512 924 517Q926 518 944 518H949Q964 518 967 515T976 495Q996 412 1055 351T1197 270Q1217 263 1217 251Q1217 240 1209 236T1176 225T1127 204Q1069 173 1030 122T976 6Q972 -10 968 -13T948 -17H943Q918 -16 914 -9Q913 -6 913 -2Q913 1 917 17Q945 138 1046 220H632L225 221'], - - // LEFTWARDS HARPOON WITH BARB UPWARDS - 0x21BC: [518,-220,1150,64,1084,'1063 281Q1084 268 1084 251Q1084 231 1063 221L572 220Q79 220 77 221Q64 225 64 244Q64 250 64 254T67 261T71 265T78 268T85 272Q142 302 189 345T258 421T296 484T315 516Q319 518 337 518Q358 518 363 512Q370 504 367 496Q360 469 319 404T219 290L209 282L636 281H1063'], - - // LEFTWARDS HARPOON WITH BARB DOWNWARDS - 0x21BD: [281,17,1150,64,1084,'1063 281Q1084 268 1084 251Q1084 231 1063 221L636 220H209L219 212Q278 162 319 97T367 5Q370 -3 363 -11Q358 -17 337 -17H332Q318 -17 314 -14T302 7Q278 55 246 95T185 160T130 202T88 228L70 237Q64 243 64 257Q64 274 75 279Q78 281 571 281H1063'], - - // RIGHTWARDS HARPOON WITH BARB UPWARDS - 0x21C0: [518,-220,1150,65,1085,'65 251Q65 270 87 281H513L940 282L930 290Q871 338 830 403T782 496Q779 510 791 517Q794 518 812 518H817Q831 518 835 515T847 494Q871 445 903 404T966 338T1022 298T1064 272T1083 259Q1085 255 1085 245Q1085 225 1072 221Q1070 220 578 220L87 221Q65 228 65 251'], - - // RIGHTWARDS HARPOON WITH BARB DOWNWARDS - 0x21C1: [281,17,1150,64,1085,'84 279Q89 281 580 281Q1070 281 1074 279Q1085 275 1085 256Q1085 245 1083 241T1066 230Q919 153 847 7Q839 -11 835 -14T817 -17H812Q791 -17 786 -11Q779 -3 782 5Q789 31 830 96T930 212L940 220H513L87 221Q64 229 64 250Q64 272 84 279'], - - // RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON - 0x21CC: [718,17,1150,64,1085,'65 451Q65 470 87 481H513L940 482L930 490Q871 538 830 603T782 696Q779 710 791 717Q794 718 812 718H817Q831 718 835 715T847 694Q871 645 903 604T966 538T1022 498T1064 472T1083 459Q1085 455 1085 445Q1085 425 1072 421Q1070 420 578 420L87 421Q65 428 65 451ZM1063 281Q1084 268 1084 251Q1084 231 1063 221L636 220H209L219 212Q278 162 319 97T367 5Q370 -3 363 -11Q358 -17 337 -17H332Q318 -17 314 -14T302 7Q278 55 246 95T185 160T130 202T88 228L70 237Q64 243 64 257Q64 274 75 279Q78 281 571 281H1063'], - - // LEFTWARDS DOUBLE ARROW - 0x21D0: [547,46,1150,64,1086,'1063 169L1068 166Q1072 163 1074 162T1079 157T1083 149T1085 139Q1085 118 1063 109L733 108H404L412 99Q455 50 488 -10Q498 -27 493 -37Q487 -46 465 -46H460Q446 -46 439 -39T426 -18T399 25T344 89Q239 194 99 229Q96 230 92 231T85 232T79 234T73 235T69 237T66 240T65 244T64 250Q64 267 90 271Q197 295 286 361T430 525Q439 542 442 544T460 547H465Q487 547 492 539Q496 531 496 530Q496 521 471 482T414 405L404 394L733 393H1063Q1064 392 1069 389T1076 384T1082 375T1085 362Q1085 344 1063 333L700 332H338L324 321Q283 290 230 264L205 250Q266 224 323 180L338 170L700 169H1063'], - - // UPWARDS DOUBLE ARROW - 0x21D1: [694,193,703,30,672,'672 343Q672 326 670 320T657 313Q644 313 602 335Q577 349 557 361T527 381T509 395T499 403T495 406T494 118Q494 -166 492 -174Q484 -193 465 -193H463Q456 -193 453 -192T444 -186T433 -170V465L423 477Q407 495 394 514T367 554T351 579Q349 576 339 560T313 520T279 477L269 465V-22V-102Q269 -132 269 -145T268 -169T266 -180T260 -185T253 -191Q248 -193 239 -193H237Q218 -193 210 -174Q208 -166 208 118Q208 406 207 406L199 399Q191 392 165 374T100 335Q58 313 45 313Q35 313 33 319T30 343V349Q30 359 30 362T35 369T45 374T66 383T100 401Q267 499 333 680Q339 694 351 694Q361 694 365 687T380 652T407 597Q442 536 489 489T573 420T638 383T670 365Q672 361 672 343'], - - // RIGHTWARDS DOUBLE ARROW - 0x21D2: [547,46,1150,64,1084,'64 362Q64 380 87 393H416L745 394L735 405Q708 436 681 477T654 531Q654 547 679 547H684H689Q703 547 710 540T723 519T750 475T806 411Q914 303 1059 271Q1060 271 1063 270T1068 269T1072 268T1076 266T1079 264T1082 260T1083 256T1084 250Q1084 242 1080 238T1063 231T1035 225T992 211T934 185Q797 112 719 -24Q710 -40 706 -43T689 -46H684Q653 -46 653 -31Q653 -24 661 -10Q694 50 737 99L745 108H416L87 109Q64 117 64 139Q64 156 87 169H449L812 170L826 180Q842 193 860 204T892 223T918 237T937 246L944 250L919 264Q866 290 825 321L811 332H449L87 333Q64 343 64 362'], - - // DOWNWARDS DOUBLE ARROW - 0x21D3: [694,194,703,30,672,'30 157Q30 174 32 180T46 187Q59 187 104 163Q154 136 198 101L207 94Q208 94 208 382Q208 666 210 674Q219 694 241 694Q254 692 262 683Q266 679 267 674Q269 658 269 522V35L279 23Q295 5 308 -14T335 -54T351 -79Q353 -76 363 -60T389 -20T423 23L433 35V671Q439 682 444 686T452 692T463 693H465Q484 693 492 674Q494 666 494 382Q494 94 495 94L504 101Q547 135 593 160T652 187Q665 191 671 177Q672 175 672 157Q672 137 669 134T636 116Q606 101 578 83T528 47T486 9T452 -30T424 -68T403 -103T387 -134T377 -159T370 -176L367 -184Q360 -194 351 -194Q345 -194 342 -192T334 -182T327 -166T315 -137T295 -97Q260 -36 213 11T129 80T63 117T32 136Q30 139 30 157'], - - // LEFT RIGHT DOUBLE ARROW - 0x21D4: [547,46,1150,47,1102,'336 497Q358 541 363 544Q367 547 379 547H384Q401 547 405 545Q418 538 414 525T389 474T346 408L335 393H814L803 408Q781 436 760 474T735 525T744 545Q748 547 765 547Q771 547 774 547T780 546T786 544T790 541T794 535T799 527T805 514T813 497Q841 446 877 406T950 340T1014 301T1068 276L1096 265Q1102 259 1102 251Q1102 240 1085 232Q981 195 902 121Q835 56 798 -25Q791 -40 787 -43T765 -46T744 -44Q735 -40 735 -30Q735 -15 760 28T806 98L814 108H335L343 98Q361 75 378 46T404 -1T414 -24Q418 -37 405 -44Q401 -46 384 -46T363 -43T351 -25Q314 56 247 121Q216 150 182 173T125 206T79 226T53 237Q47 243 47 251Q47 254 47 256T49 261T52 264T57 267T61 268T66 270T71 272Q246 335 336 497ZM985 251Q932 280 882 323L871 332H278Q264 321 253 311T237 297T214 282T164 251L176 244Q221 218 278 169H871Q928 218 973 244L985 251'], - - // UP DOWN DOUBLE ARROW - 0x21D5: [767,267,703,30,672,'49 441Q30 441 30 464V471V480Q30 498 44 502Q237 573 331 750Q337 767 351 767Q360 767 368 753T400 702T460 629Q504 584 552 554T632 511T666 497Q672 493 672 471Q672 454 670 449Q664 441 653 441Q639 443 591 465T508 513L495 522L494 386V114L495 -22L508 -13Q543 12 591 34T653 59Q672 59 672 36V29V20Q672 2 658 -2Q465 -71 367 -257Q360 -267 351 -267Q343 -267 336 -257T320 -231T292 -187T242 -129Q198 -84 150 -54T70 -11T36 3Q30 7 30 29Q30 46 32 51Q38 59 49 59Q63 57 111 35T194 -13L208 -22V522L194 513Q159 488 111 466T49 441ZM422 584Q411 594 400 606T383 626T366 648T351 667Q349 665 339 652T314 620T280 584L269 573V-73L280 -84Q305 -108 351 -166Q353 -164 363 -151T389 -119T422 -84L433 -73V573L422 584'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/Arrows.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/BasicLatin.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/BasicLatin.js deleted file mode 100644 index 7115a559dc..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/BasicLatin.js +++ /dev/null @@ -1,149 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/BasicLatin.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // SPACE - 0x20: [0,0,250,0,0,''], - - // EXCLAMATION MARK - 0x21: [705,-1,350,89,260,'89 629Q89 663 116 684T171 705Q215 705 237 681T260 634Q260 619 233 434T204 244Q201 237 175 237Q150 237 146 244Q144 248 117 433T89 629ZM90 86Q90 125 116 148T177 171Q211 169 235 146T259 86Q259 48 235 25T175 1Q138 1 114 24T90 86'], - - // QUOTATION MARK - 0x22: [694,-328,603,38,492,'38 572T38 608T61 669T121 694Q167 694 196 657T225 559Q225 520 214 482T186 418T151 370T119 339T99 329T82 340T70 360Q70 365 74 369T92 385T122 414Q142 441 154 471T170 518L172 535L166 532Q160 530 148 527T122 523Q85 523 62 547ZM305 572T305 608T328 669T388 694Q434 694 463 657T492 559Q492 520 481 482T453 418T418 370T386 339T366 329T349 340T337 360Q337 365 341 369T359 385T389 414Q409 441 421 471T436 518L439 535L433 532Q427 530 415 527T389 523Q352 523 329 547'], - - // NUMBER SIGN - 0x23: [694,193,958,64,893,'64 362Q64 380 87 393H363L366 404Q379 443 390 480T409 542T424 590T435 628T443 655T451 674T458 686T467 692T478 694Q490 694 499 686T509 662Q505 643 427 395Q427 393 523 393H620L623 404Q630 426 652 498T691 624T711 681Q718 694 735 694Q748 694 757 685T766 662Q762 643 684 395Q684 393 777 393H871Q872 392 875 390T881 386T887 381T891 374T893 363Q893 345 871 333L767 332H664L660 319Q660 318 638 245T614 171Q614 169 742 169H871L877 165Q883 161 885 159T890 151T893 138Q893 120 871 109L732 108H594L590 95Q587 84 546 -46Q508 -175 505 -178Q498 -193 478 -193Q462 -193 455 -183T448 -164Q448 -156 530 106Q530 108 434 108H337L333 95Q330 84 289 -46Q251 -175 248 -178Q240 -193 222 -193Q206 -193 199 -183T191 -164Q191 -154 273 106Q273 108 180 108L87 109Q64 117 64 139Q64 156 87 169H293L321 262Q326 277 331 294T340 321L343 330Q343 332 215 332L87 333Q64 343 64 362ZM600 330Q600 332 504 332H407L403 319Q403 318 381 245T357 171Q357 169 453 169H550L578 262Q583 277 588 294T597 321L600 330'], - - // DOLLAR SIGN - 0x24: [750,56,575,64,510,'64 494Q64 541 80 579T120 638T171 674T219 693T253 698H256V750H318V699H323Q355 694 380 686T433 663T480 620T506 556Q510 539 510 520Q510 480 488 463T440 445L422 447Q407 451 398 459Q370 478 370 515Q370 542 384 559T412 580L427 584Q424 589 418 596T386 617T324 636H318V434Q411 419 460 355T510 217Q510 196 507 175T492 122T461 67T404 23T318 -4V-56H256V-5H254Q252 -3 240 -3Q194 4 160 23T108 64T80 112T67 156T64 190Q64 218 81 240T134 262Q171 262 187 240T204 193T190 150T153 125Q146 125 144 123Q142 123 149 113T174 89T218 66Q247 58 255 58Q256 58 256 173V287L239 291Q160 308 112 365T64 494ZM255 636Q246 635 236 632T206 620T173 591T160 543Q160 472 256 448V542Q256 636 255 636ZM320 59Q324 59 333 61T356 70T384 89T406 120T415 167Q415 200 395 225T356 260T318 274V59H320'], - - // PERCENT SIGN - 0x25: [751,56,958,65,893,'65 549Q65 609 84 652T132 714T187 742T236 750Q265 750 296 734T355 697T431 661T541 644Q662 644 736 730Q751 749 767 749T790 739T797 719Q797 710 768 672T504 329Q212 -47 211 -48Q203 -55 191 -55Q161 -55 161 -25Q161 -17 163 -12L642 609Q608 595 542 595Q515 595 488 599T441 608T405 619T381 628L373 632Q373 630 375 619T380 589T383 548Q383 455 343 401T235 347Q217 347 198 351T154 368T110 403T78 462T65 549ZM320 549Q320 633 295 665T235 698H234Q214 698 196 674Q182 650 182 549Q182 509 183 486T190 441T207 409T238 399Q269 399 294 431T320 549ZM745 -56Q727 -56 708 -52T664 -35T620 0T588 59T575 146T588 232T620 291T663 325T708 343T747 347Q810 347 851 294T893 146Q893 89 879 48T841 -15T794 -46T745 -56ZM830 146Q830 230 805 262T745 295H744Q724 295 706 271Q692 247 692 146Q692 106 693 83T700 38T717 6T748 -4Q779 -4 804 28T830 146'], - - // AMPERSAND - 0x26: [705,11,894,48,836,'255 -11Q209 -11 164 4T84 56T48 146Q48 159 50 171Q57 197 72 218T99 249T152 292Q204 333 204 334L194 356Q185 379 176 421T166 511Q166 538 168 551Q182 613 226 654T332 704Q334 704 343 704T358 705Q412 702 444 661T476 565V559Q476 489 334 371L330 368L335 357Q382 272 485 165L496 154L506 163Q543 200 597 273L671 382H601V444H610L732 441Q821 441 830 444H836V382H741L709 335Q702 324 687 302T665 270T646 244T625 216T605 191T581 162T553 132L537 116Q544 109 557 98T605 69T673 51Q711 51 739 70T767 115V118H829V114Q829 70 786 30T668 -11Q570 -11 474 37L451 49L441 43Q352 -11 255 -11ZM415 564Q415 596 400 625T356 654Q329 654 310 634T285 588Q283 580 283 554Q283 475 309 417L325 431Q415 512 415 564ZM192 182Q192 126 213 89T279 51Q348 51 400 83L389 91Q362 112 338 137T295 186T264 229T240 265T227 286Q226 285 222 280T217 272T211 263T205 251T200 238T196 222T193 204T192 182'], - - // APOSTROPHE - 0x27: [694,-329,319,74,261,'74 572T74 608T97 669T157 694Q203 694 232 657T261 559Q261 520 250 482T222 418T187 370T155 339T135 329Q128 329 117 340T106 359Q106 365 117 375T144 399T176 440T203 505Q204 511 205 518T208 530V535L202 532Q196 530 184 527T158 523Q121 523 98 547'], - - // ASTERISK - 0x2A: [750,-306,575,72,502,'235 706Q235 724 251 737T287 750Q306 750 322 738T339 706Q339 685 318 580V579Q429 663 436 666Q441 668 449 668Q471 668 486 650T501 612Q501 582 478 572Q476 570 414 549L354 528L414 507Q420 505 430 502T445 497T458 492T470 488T479 483T487 478T493 471T497 463T500 454T501 443Q501 423 486 406T449 388H446Q435 388 370 437Q339 461 318 477V476Q339 371 339 350Q339 332 323 319T287 306T251 319T235 350Q235 371 256 476V477Q145 393 138 390Q133 388 125 388Q103 388 88 406T73 444Q73 474 96 484Q98 486 160 507L220 528L160 549Q154 551 144 554T129 559T116 564T104 568T95 573T87 578T81 585T77 593T74 602T73 613Q73 633 88 650T125 668H128Q139 668 204 619Q235 595 256 579V580Q235 685 235 706'], - - // HYPHEN-MINUS - 0x2D: [278,-166,383,13,318,'13 166V278H318V166H13'], - - // QUESTION MARK - 0x3F: [700,-1,543,65,478,'65 570Q65 628 119 664T259 700Q326 700 372 688T440 654T469 613T478 569Q478 505 412 465Q287 391 287 294V283Q287 250 284 244T263 237H256H249Q232 237 229 242T225 272V287Q227 364 253 418Q274 463 311 504Q335 530 335 575Q335 622 323 635T259 648Q231 648 209 644T179 636T170 630L172 628Q174 627 177 625T183 620T190 611T197 601T202 587T204 570Q204 539 185 519T134 499Q105 499 85 517T65 570ZM171 86Q171 125 197 148T258 171Q292 169 316 146T340 86Q340 48 316 25T256 1Q218 1 195 24T171 86'], - - // COMMERCIAL AT - 0x40: [699,6,894,64,829,'64 347Q64 511 171 605T434 699Q487 699 500 698Q624 684 703 621T811 464Q828 414 828 344Q828 232 788 179T691 125Q673 125 657 127T628 132T606 140T588 148T576 156T568 162L566 164Q565 164 549 154T504 135T444 125Q349 125 284 183T218 347Q218 455 284 512T448 569Q554 569 610 479H638Q670 479 674 471Q676 468 676 340V258Q676 213 679 199T694 178Q701 174 713 177Q767 187 767 340Q767 489 678 569T446 649Q299 649 213 566T126 346Q126 307 134 269T166 189T225 116T320 65T455 45H463Q606 51 721 91L746 99H782H801Q829 99 829 85Q829 78 825 75T804 65Q800 63 797 62Q625 -6 451 -6Q271 -6 168 91T64 347ZM547 468Q526 493 504 505T444 517T377 476T346 347Q346 306 354 271T386 206T448 177Q505 177 547 226V468'], - - // LATIN CAPITAL LETTER A - 0x41: [698,0,869,40,828,'296 0Q278 3 164 3Q58 3 49 0H40V62H92Q144 62 144 64Q388 682 397 689Q403 698 434 698Q463 698 471 689Q475 686 538 530T663 218L724 64Q724 62 776 62H828V0H817Q796 3 658 3Q509 3 485 0H472V62H517Q561 62 561 63L517 175H262L240 120Q218 65 217 64Q217 62 261 62H306V0H296ZM390 237L492 238L440 365Q390 491 388 491Q287 239 287 237H390'], - - // LATIN CAPITAL LETTER B - 0x42: [686,0,818,39,752,'720 510Q720 476 704 448T665 404T619 377T580 362L564 359L583 356Q602 353 632 342T690 312Q712 292 725 276Q752 235 752 189V183Q752 160 741 125Q698 18 547 2Q543 1 288 0H39V62H147V624H39V686H264H409Q502 686 542 681T624 655Q720 607 720 510ZM563 513Q563 553 548 578T518 611T486 622Q479 624 385 624H293V382H375Q458 383 467 385Q563 405 563 513ZM590 192Q590 307 505 329Q504 330 503 330L398 331H293V62H391H400H444Q496 62 528 75T580 131Q590 155 590 192'], - - // LATIN CAPITAL LETTER C - 0x43: [697,11,831,64,766,'64 343Q64 502 174 599T468 697Q502 697 533 691T586 674T623 655T647 639T657 632L694 663Q703 670 711 677T723 687T730 692T735 695T740 696T746 697Q759 697 762 692T766 668V627V489V449Q766 428 762 424T742 419H732H720Q699 419 697 436Q690 498 657 545Q611 618 532 632Q522 634 496 634Q356 634 286 553Q232 488 232 343T286 133Q355 52 497 52Q597 52 650 112T704 237Q704 248 709 251T729 254H735Q750 254 755 253T763 248T766 234Q766 136 680 63T469 -11Q285 -11 175 86T64 343'], - - // LATIN CAPITAL LETTER D - 0x44: [686,0,882,39,817,'39 624V686H270H310H408Q500 686 545 680T638 649Q768 584 805 438Q817 388 817 338Q817 171 702 75Q628 17 515 2Q504 1 270 0H39V62H147V624H39ZM655 337Q655 370 655 390T650 442T639 494T616 540T580 580T526 607T451 623Q443 624 368 624H298V62H377H387H407Q445 62 472 65T540 83T606 129Q629 156 640 195T653 262T655 337'], - - // LATIN CAPITAL LETTER E - 0x45: [680,0,756,39,723,'723 286Q721 284 700 145T677 3V0H39V62H147V618H39V680H660V676Q662 670 675 552T691 428V424H629V428Q629 429 627 448T618 494T601 541Q574 593 527 605T382 618H374H304V384H336Q338 384 347 384T361 384T376 386T392 390T407 397T421 407T432 423Q442 444 443 482V501H505V205H443V224Q442 258 435 278T411 307T380 318T336 322H304V62H375H394Q429 62 449 62T497 66T541 76T577 95T609 126T632 170T651 232Q661 287 661 289H723V286'], - - // LATIN CAPITAL LETTER F - 0x46: [680,0,724,39,675,'425 0L228 3Q63 3 51 0H39V62H147V618H39V680H644V676Q647 670 659 552T675 428V424H613Q613 433 605 477Q599 511 589 535T562 574T530 599T488 612T441 617T387 618H368H304V371H333Q389 373 411 390T437 468V488H499V192H437V212Q436 244 430 263T408 292T378 305T333 309H304V62H439V0H425'], - - // LATIN CAPITAL LETTER G - 0x47: [697,10,904,64,845,'465 -10Q281 -10 173 88T64 343Q64 413 85 471T143 568T217 631T298 670Q371 697 449 697Q452 697 459 697T470 696Q502 696 531 690T582 675T618 658T644 641T656 632L732 695Q734 697 745 697Q758 697 761 692T765 668V627V489V449Q765 428 761 424T741 419H731H724Q705 419 702 422T695 444Q683 520 631 577T495 635Q364 635 295 563Q261 528 247 477T232 343Q232 296 236 260T256 185T296 120T366 76T472 52Q481 51 498 51Q544 51 573 67T607 108Q608 111 608 164V214H464V276H479Q506 273 680 273Q816 273 834 276H845V214H765V113V51Q765 16 763 8T750 0Q742 2 709 16T658 40L648 46Q592 -10 465 -10'], - - // LATIN CAPITAL LETTER H - 0x48: [686,0,900,39,860,'400 0Q376 3 226 3Q75 3 51 0H39V62H147V624H39V686H51Q75 683 226 683Q376 683 400 686H412V624H304V388H595V624H487V686H499Q523 683 673 683Q824 683 848 686H860V624H752V62H860V0H848Q824 3 674 3Q523 3 499 0H487V62H595V326H304V62H412V0H400'], - - // LATIN CAPITAL LETTER I - 0x49: [686,0,436,25,410,'397 0Q370 3 218 3Q65 3 38 0H25V62H139V624H25V686H38Q65 683 218 683Q370 683 397 686H410V624H296V62H410V0H397'], - - // LATIN CAPITAL LETTER J - 0x4A: [686,11,594,8,527,'174 114Q174 96 169 82T159 63T144 47L155 45Q183 40 203 40Q271 40 290 104Q294 118 294 150T295 380V624H154V686H169Q196 683 365 683Q499 683 517 686H527V624H446V379Q446 183 446 153T441 108Q413 32 315 2Q266 -11 208 -11Q160 -11 118 -2T42 37T8 114V122Q8 150 30 174T91 198T152 174T174 122V114'], - - // LATIN CAPITAL LETTER K - 0x4B: [686,0,901,39,852,'400 0Q376 3 226 3Q75 3 51 0H39V62H147V624H39V686H51Q75 683 226 683Q376 683 400 686H412V624H304V338L472 483L634 624H565V686H576Q597 683 728 683Q814 683 829 686H836V624H730L614 524Q507 432 497 422Q496 422 498 418T514 395T553 342T627 241L759 63L805 62H852V0H842Q830 3 701 3Q550 3 526 0H513V62H549Q584 62 584 63Q583 65 486 196T388 328L304 256V62H412V0H400'], - - // LATIN CAPITAL LETTER L - 0x4C: [686,0,692,39,643,'643 285Q641 280 629 148T612 4V0H39V62H147V624H39V686H51Q75 683 228 683Q415 685 425 686H439V624H304V62H352H378Q492 62 539 138Q551 156 558 178T569 214T576 255T581 289H643V285'], - - // LATIN CAPITAL LETTER M - 0x4D: [686,0,1092,39,1052,'314 0Q296 3 181 3T48 0H39V62H147V624H39V686H305Q316 679 323 667Q330 653 434 414L546 157L658 414Q766 662 773 674Q778 681 788 686H1052V624H944V62H1052V0H1040Q1016 3 874 3T708 0H696V62H804V341L803 618L786 580Q770 543 735 462T671 315Q540 13 536 9Q528 1 507 1Q485 1 477 9Q472 14 408 162T281 457T217 603Q215 603 215 334V62H323V0H314'], - - // LATIN CAPITAL LETTER N - 0x4E: [686,0,900,39,860,'314 0Q296 3 181 3T48 0H39V62H147V624H39V686H171H265Q288 686 297 686T309 684T315 679Q317 676 500 455T684 233V624H576V686H585Q603 683 718 683T851 686H860V624H752V319Q752 15 750 11Q747 4 742 2T718 0H712Q708 0 706 0T700 0T696 1T693 2T690 4T687 7T684 11T679 16T674 23Q671 27 437 311L215 579V62H323V0H314'], - - // LATIN CAPITAL LETTER O - 0x4F: [696,10,864,64,798,'64 339Q64 431 96 502T182 614T295 675T420 696Q469 696 481 695Q620 680 709 589T798 339Q798 173 697 82T432 -10Q262 -10 163 85T64 339ZM625 454Q618 502 600 538T562 593T515 624T469 639T431 642Q331 642 276 563Q232 493 232 353Q232 315 234 285T244 216T267 148T308 94T372 56Q405 46 432 46Q517 46 567 106T627 267Q631 299 631 353Q631 418 625 454'], - - // LATIN CAPITAL LETTER P - 0x50: [686,0,786,39,722,'400 0Q376 3 226 3Q75 3 51 0H39V62H147V624H39V686H253Q435 686 470 685T536 678Q585 668 621 648T675 605T705 557T718 514T721 483T718 451T704 409T673 362T616 322T530 293Q500 288 399 287H304V62H412V0H400ZM553 475Q553 554 537 582T459 622Q451 623 373 624H298V343H372Q457 344 480 350Q527 362 540 390T553 475'], - - // LATIN CAPITAL LETTER Q - 0x51: [696,193,864,64,805,'64 339Q64 431 96 502T182 614T295 675T420 696Q469 696 481 695Q620 680 709 589T798 339Q798 255 768 184Q720 77 611 26L600 21Q635 -26 682 -26H696Q769 -26 769 0Q769 7 774 12T787 18Q805 18 805 -7V-13Q803 -64 785 -106T737 -171Q720 -183 697 -191Q687 -193 668 -193Q636 -193 613 -182T575 -144T552 -94T532 -27Q531 -23 530 -16T528 -6T526 -3L512 -5Q499 -7 477 -8T431 -10Q393 -10 382 -9Q238 8 151 97T64 339ZM326 80Q326 113 356 138T430 163Q492 163 542 100L553 86Q554 85 561 91T578 108Q637 179 637 330Q637 430 619 498T548 604Q500 641 425 641Q408 641 390 637T347 623T299 590T259 535Q226 469 226 338Q226 244 246 180T318 79L325 74Q326 74 326 80ZM506 58Q480 112 433 112Q412 112 395 104T378 77Q378 44 431 44Q480 44 506 58'], - - // LATIN CAPITAL LETTER R - 0x52: [687,11,862,39,858,'394 0Q370 3 222 3Q75 3 51 0H39V62H147V624H39V686H234Q256 686 299 686T362 687Q479 687 554 669T681 593Q716 550 716 497Q716 390 568 338Q569 337 572 336T577 332Q605 317 623 300T650 258T662 218T668 172Q678 98 689 76Q707 40 748 40Q770 40 780 54T795 88T801 111Q805 117 827 117H831Q846 117 852 113T858 92Q857 78 852 63T834 30T797 1T739 -11Q630 -11 580 12T511 87Q506 104 506 168Q506 170 506 178T507 194Q507 289 438 313Q424 318 356 318H298V62H406V0H394ZM366 369Q459 370 490 381Q548 402 548 476V498V517Q548 578 513 600Q479 624 392 624H358H298V369H366'], - - // LATIN CAPITAL LETTER S - 0x53: [698,12,639,63,574,'64 493Q64 582 120 636T264 696H272Q280 697 285 697Q380 697 454 645L480 669Q484 672 488 676T495 683T500 688T504 691T508 693T511 695T514 696T517 697T522 697Q536 697 539 691T542 652V577Q542 557 542 532T543 500Q543 472 540 465T524 458H511H505Q489 458 485 461T479 478Q472 529 449 564T393 614T336 634T287 639Q228 639 203 610T177 544Q177 517 195 493T247 457Q253 454 343 436T475 391Q574 326 574 207V200Q574 163 559 120Q517 12 389 -9Q380 -10 346 -10Q308 -10 275 -5T221 7T184 22T160 35T151 40L126 17Q122 14 118 10T111 3T106 -2T102 -5T98 -7T95 -9T92 -10T89 -11T84 -11Q70 -11 67 -4T64 35V108Q64 128 64 153T63 185Q63 203 63 211T69 223T77 227T94 228H100Q118 228 122 225T126 205Q130 125 193 88T345 51Q408 51 434 82T460 157Q460 196 439 221T388 257Q384 259 305 276T221 295Q155 313 110 366T64 493'], - - // LATIN CAPITAL LETTER T - 0x54: [675,0,800,41,758,'41 425Q41 426 51 545T62 669V675H737V669Q738 665 748 546T758 425V419H696V425Q687 517 669 555T595 607Q578 612 522 613H478V62H631V0H615Q585 3 399 3Q214 3 184 0H168V62H321V613H277H263Q164 613 134 561Q113 527 103 425V419H41V425'], - - // LATIN CAPITAL LETTER U - 0x55: [686,11,885,39,845,'570 686Q588 683 703 683T836 686H845V624H737V420Q737 390 737 345T738 284Q738 205 729 164T689 83Q614 -11 465 -11Q321 -11 240 51T148 207Q147 214 147 421V624H39V686H51Q75 683 226 683Q376 683 400 686H412V624H304V405V370V268Q304 181 311 146T346 87Q387 52 466 52Q642 52 667 195Q668 204 669 415V624H561V686H570'], - - // LATIN CAPITAL LETTER V - 0x56: [686,7,869,25,843,'592 686H604Q615 685 631 685T666 684T700 684T724 683Q829 683 835 686H843V624H744L611 315Q584 254 546 165Q492 40 482 19T461 -6L460 -7H409Q398 -4 391 9Q385 20 257 315L124 624H25V686H36Q57 683 190 683Q340 683 364 686H377V624H289L384 403L480 185L492 212Q504 240 529 298T575 405L670 624H582V686H592'], - - // LATIN CAPITAL LETTER W - 0x57: [686,7,1189,24,1164,'915 686L1052 683Q1142 683 1157 686H1164V624H1073L957 320Q930 249 900 170T855 52T839 10Q834 0 826 -5Q821 -7 799 -7H792Q777 -7 772 -5T759 10Q759 11 748 39T716 122T676 228L594 442L512 228Q486 159 455 78Q433 19 428 9T416 -5Q411 -7 389 -7H379Q356 -7 349 10Q349 12 334 51T288 170T231 320L116 624H24V686H35Q44 683 183 683Q331 683 355 686H368V624H323Q278 624 278 623L437 207L499 369L561 531L526 624H434V686H445Q454 683 593 683Q741 683 765 686H778V624H733Q688 624 688 623L847 207Q848 207 927 415T1006 624H905V686H915'], - - // LATIN CAPITAL LETTER X - 0x58: [686,0,869,33,835,'327 0Q306 3 174 3Q52 3 43 0H33V62H98L162 63L360 333L157 624H48V686H59Q80 683 217 683Q368 683 395 686H408V624H335L393 540L452 458L573 623Q573 624 528 624H483V686H494Q515 683 646 683Q769 683 778 686H787V624H658L575 511Q493 398 493 397L508 376Q522 356 553 312T611 229L727 62H835V0H824Q803 3 667 3Q516 3 489 0H476V62H513L549 63L401 274L247 63Q247 62 292 62H338V0H327'], - - // LATIN CAPITAL LETTER Y - 0x59: [686,0,869,19,849,'605 0Q581 3 434 3Q286 3 262 0H250V62H358V275L126 624H19V686H30Q54 683 189 683Q361 685 370 686H383V624H308L319 608Q330 591 353 556T396 491L484 359L660 623Q660 624 623 624H585V686H595Q613 683 728 683Q832 683 841 686H849V624H742L509 274V62H618V0H605'], - - // LATIN CAPITAL LETTER Z - 0x5A: [686,0,703,64,645,'80 430L92 686H358Q624 686 628 684Q638 679 638 656Q638 640 637 639Q637 638 445 353Q401 288 351 214T277 103L253 67L256 66Q258 66 265 66T279 66T298 66H343Q380 66 406 68T464 81T518 110T557 164T579 250Q583 278 583 298Q583 299 614 299H645V291Q643 281 636 150T627 8V0H353Q79 0 75 2Q64 7 64 31Q64 48 66 52L259 340L451 623Q451 624 384 624Q294 623 259 612Q155 581 143 446Q142 440 142 432V430H80'], - - // LOW LINE - 0x5F: [-10,61,575,0,574,'0 -61V-10H574V-61H0'], - - // GRAVE ACCENT - 0x60: [706,-503,575,113,338,'114 634Q114 663 136 684T183 706Q191 706 196 705T208 700T219 693T232 681T245 666T262 645T282 620Q332 558 337 553Q338 552 318 527L299 503L223 543Q215 547 202 553T183 563T167 571T153 580T141 587T131 595T124 603T118 612T115 622T114 634'], - - // TILDE - 0x7E: [344,-202,575,96,478,'343 202Q320 202 278 225T215 249Q181 249 146 214L134 202L115 219Q111 222 106 226T98 234L96 236Q158 306 165 313Q199 344 230 344Q239 344 244 343Q262 339 300 318T359 297Q393 297 428 332L440 344L459 327Q463 324 468 320T476 312L478 310Q416 240 409 233Q375 202 343 202'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/BasicLatin.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/CombDiacritMarks.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/CombDiacritMarks.js deleted file mode 100644 index c5f96789f5..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/CombDiacritMarks.js +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/CombDiacritMarks.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // COMBINING GRAVE ACCENT - 0x300: [706,-503,0,-462,-237,'-461 634Q-461 663 -439 684T-392 706Q-384 706 -379 705T-367 700T-356 693T-343 681T-330 666T-313 645T-293 620Q-243 558 -238 553Q-237 552 -257 527L-276 503L-352 543Q-360 547 -373 553T-392 563T-408 571T-422 580T-434 587T-444 595T-451 603T-457 612T-460 622T-461 634'], - - // COMBINING ACUTE ACCENT - 0x301: [706,-503,0,-339,-115,'-184 706Q-156 706 -136 683T-115 634Q-115 608 -134 593T-209 550Q-219 545 -224 543L-300 503L-319 527Q-339 552 -338 553Q-333 558 -283 620Q-276 629 -266 641T-251 659T-239 673T-229 685T-221 693T-212 699T-204 703T-195 705T-184 706'], - - // COMBINING CIRCUMFLEX ACCENT - 0x302: [694,-520,0,-449,-126,'-368 632L-288 694Q-286 693 -207 632T-127 570T-144 545T-162 520Q-165 520 -225 559L-288 597L-351 559Q-411 520 -414 520Q-415 520 -432 544T-449 570T-368 632'], - - // COMBINING TILDE - 0x303: [694,-552,0,-479,-97,'-232 552Q-255 552 -297 575T-360 599Q-394 599 -429 564L-441 552L-460 569Q-464 572 -469 576T-476 584L-479 586Q-417 656 -410 663Q-376 694 -345 694Q-336 694 -331 693Q-313 689 -275 668T-216 647Q-182 647 -147 682L-135 694L-116 677Q-112 674 -107 670T-100 662L-97 660Q-159 590 -166 583Q-200 552 -232 552'], - - // COMBINING MACRON - 0x304: [607,-540,0,-495,-81,'-495 540V607H-81V540H-495'], - - // COMBINING BREVE - 0x306: [694,-500,0,-473,-103,'-288 500Q-367 500 -420 558T-473 689V694H-422V685Q-422 681 -421 674T-411 648T-389 615T-349 590T-288 578Q-228 578 -193 611T-154 685V694H-103V689Q-103 623 -153 562T-288 500'], - - // COMBINING DOT ABOVE - 0x307: [695,-525,0,-373,-203,'-373 610Q-373 647 -348 671T-292 695Q-251 695 -227 669T-203 610T-225 551T-288 525Q-327 525 -350 551T-373 610'], - - // COMBINING DIAERESIS - 0x308: [695,-535,0,-479,-97,'-479 615Q-479 650 -456 672T-397 695Q-361 693 -341 669T-320 615Q-320 583 -343 559T-399 535Q-428 535 -453 556T-479 615ZM-256 615Q-256 651 -232 673T-176 695Q-149 695 -123 675T-97 615Q-97 578 -121 557T-180 535Q-211 537 -233 559T-256 615'], - - // COMBINING RING ABOVE - 0x30A: [702,-535,0,-415,-161,'-415 618Q-415 653 -382 677T-296 702H-291Q-194 702 -168 647Q-161 634 -161 618Q-161 607 -165 596T-180 570T-220 546T-288 536T-355 545T-394 568T-410 594T-415 618ZM-223 618Q-223 645 -234 652T-274 659H-283Q-289 659 -297 659T-307 660Q-328 660 -339 653T-351 638T-353 619Q-353 591 -341 585T-288 578Q-260 578 -249 580T-230 590T-223 618'], - - // COMBINING DOUBLE ACUTE ACCENT - 0x30B: [714,-511,0,-442,-82,'-389 511L-442 543Q-442 544 -424 606T-404 674Q-390 705 -361 713Q-360 713 -356 713T-349 714Q-340 714 -330 712Q-273 690 -273 644Q-273 621 -290 604L-342 554L-389 511ZM-198 511L-251 543Q-251 544 -233 606T-213 674Q-199 705 -170 713Q-169 713 -165 713T-158 714Q-127 714 -105 693T-82 647Q-82 638 -84 631T-89 618T-99 604T-112 590T-130 574T-151 554L-198 511'], - - // COMBINING CARON - 0x30C: [660,-515,0,-445,-132,'-444 603Q-445 604 -439 618T-425 646T-417 659L-352 635L-288 611L-224 635L-159 659Q-158 660 -151 647T-138 619T-132 603Q-135 601 -211 558T-288 515T-365 558T-444 603'], - - // COMBINING LONG SOLIDUS OVERLAY - 0x338: [711,210,0,-734,-161,'-705 -210Q-715 -210 -724 -203T-734 -179Q-734 -171 -732 -166Q-730 -163 -474 266T-215 698Q-208 711 -190 711Q-180 711 -171 704T-161 681Q-161 672 -164 667Q-171 654 -425 228T-683 -201Q-692 -210 -705 -210'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/CombDiacritMarks.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/CombDiactForSymbols.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/CombDiactForSymbols.js deleted file mode 100644 index 93c35b0e5a..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/CombDiactForSymbols.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/CombDiactForSymbols.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // COMBINING RIGHT ARROW ABOVE - 0x20D7: [723,-513,0,-542,-33,'-169 694Q-169 707 -160 715T-142 723Q-127 723 -119 716T-107 698T-90 673T-53 648Q-33 637 -33 619Q-33 602 -45 595T-87 573T-144 532Q-165 513 -176 513Q-189 513 -197 522T-206 543Q-206 556 -188 574L-175 588H-347L-519 589Q-542 597 -542 618Q-542 623 -541 627T-537 635T-532 640T-527 644T-522 648L-519 649H-149Q-169 676 -169 694'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/CombDiactForSymbols.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/GeneralPunctuation.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/GeneralPunctuation.js deleted file mode 100644 index b3709c9843..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/GeneralPunctuation.js +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/GeneralPunctuation.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // EN DASH - 0x2013: [300,-249,575,0,574,'0 249V300H574V249H0'], - - // EM DASH - 0x2014: [300,-249,1150,0,1149,'0 249V300H1149V249H0'], - - // LEFT SINGLE QUOTATION MARK - 0x2018: [695,-329,319,58,246,'58 461Q58 503 70 542T99 607T134 654T165 684T184 694T201 683T213 664Q213 658 202 648T175 624T143 583T116 518Q115 512 114 505T112 493L111 488Q132 500 161 500Q198 500 221 475T245 414T222 354T161 329Q112 329 85 369T58 461'], - - // RIGHT SINGLE QUOTATION MARK - 0x2019: [694,-329,319,74,261,'74 572T74 608T97 669T157 694Q203 694 232 657T261 559Q261 520 250 482T222 418T187 370T155 339T135 329Q128 329 117 340T106 359Q106 365 117 375T144 399T176 440T203 505Q204 511 205 518T208 530V535L202 532Q196 530 184 527T158 523Q121 523 98 547'], - - // LEFT DOUBLE QUOTATION MARK - 0x201C: [694,-329,603,110,564,'110 461Q110 502 121 541T150 606T185 653T217 684T235 694Q242 694 254 682T266 664Q266 659 254 648T226 623T193 578T167 511Q164 500 164 494T164 487Q188 500 212 500Q251 500 274 475T297 414Q297 378 274 354T212 329Q167 329 139 367T110 461ZM377 461Q377 502 388 541T417 606T452 653T484 684T502 694Q509 694 521 682T533 664Q533 659 521 648T493 623T460 578T434 511Q431 500 431 494T431 487Q455 500 479 500Q518 500 541 475T564 414Q564 378 541 354T479 329Q434 329 406 367T377 461'], - - // RIGHT DOUBLE QUOTATION MARK - 0x201D: [694,-328,603,38,492,'38 572T38 608T61 669T121 694Q167 694 196 657T225 559Q225 520 214 482T186 418T151 370T119 339T99 329T82 340T70 360Q70 365 74 369T92 385T122 414Q142 441 154 471T170 518L172 535L166 532Q160 530 148 527T122 523Q85 523 62 547ZM305 572T305 608T328 669T388 694Q434 694 463 657T492 559Q492 520 481 482T453 418T418 370T386 339T366 329T349 340T337 360Q337 365 341 369T359 385T389 414Q409 441 421 471T436 518L439 535L433 532Q427 530 415 527T389 523Q352 523 329 547'], - - // DAGGER - 0x2020: [702,211,511,64,446,'231 470Q232 471 232 473Q232 477 213 540T193 636Q192 642 192 651T204 677T239 700Q249 702 255 702Q300 702 315 660Q317 653 317 636Q317 603 298 539T279 472V470Q280 470 318 488T383 506Q408 506 423 493T442 467T446 444T443 421T424 396T383 382Q355 382 318 400T279 418Q278 416 285 392T303 334T316 284Q318 268 318 234Q318 149 311 45T296 -127T284 -203Q279 -211 255 -211Q237 -211 233 -210T226 -203Q222 -195 214 -129T199 41T192 234V245Q192 286 212 349Q233 413 231 418Q229 418 192 400T128 382Q102 382 86 396T67 421T64 444T67 466T86 492T128 506Q155 506 192 488T231 470'], - - // DOUBLE DAGGER - 0x2021: [703,202,511,64,446,'193 637Q193 663 206 679T231 698T255 702T279 699T304 679T317 637Q317 605 299 557T280 504Q280 503 281 503T320 521T382 539Q410 539 428 521T446 476Q446 454 432 434T383 414H377Q358 414 320 431T281 449L280 448Q280 444 298 396T317 316Q318 310 318 301T306 275T271 252Q261 250 255 250Q210 250 195 292Q193 299 193 316Q193 347 211 395T230 448Q230 449 229 449Q227 449 196 434Q151 414 133 414H127Q102 414 87 427T68 452T64 477Q64 503 81 521T127 539Q143 539 164 532T204 515T226 504Q230 502 230 504Q230 508 212 556T193 637ZM193 184Q193 210 206 226T231 245T255 249T279 246T304 226T317 184Q317 153 299 106T280 53Q280 51 282 51T322 68T383 86Q411 86 428 69T445 24T428 -21T382 -39Q358 -39 322 -22T282 -4Q280 -3 280 -3T280 -6Q281 -13 299 -59T317 -136Q318 -142 318 -151T306 -177T271 -200Q261 -202 255 -202Q210 -202 195 -160Q193 -153 193 -136Q193 -106 211 -60T230 -6Q230 -4 228 -4T188 -21T128 -39Q100 -39 83 -22T65 24Q65 53 82 69T127 86Q150 86 187 69T228 51Q230 50 230 50T230 53Q229 58 211 105T193 184'], - - // HORIZONTAL ELLIPSIS - 0x2026: [171,-1,1295,74,1221,'74 85Q74 121 99 146T156 171Q200 171 222 143T245 85Q245 56 224 29T160 1Q118 1 96 27T74 85ZM562 85Q562 121 587 146T644 171Q688 171 710 143T733 85Q733 56 712 29T648 1Q606 1 584 27T562 85ZM1050 85Q1050 121 1075 146T1132 171Q1176 171 1198 143T1221 85Q1221 56 1200 29T1136 1Q1094 1 1072 27T1050 85'], - - // PRIME - 0x2032: [563,-33,344,35,331,'240 563Q278 563 304 539T331 480V473Q331 462 316 431T217 236Q199 200 174 151T136 78T123 50Q113 33 105 33Q101 33 72 45T38 60Q35 63 35 65Q35 77 101 293T171 517Q182 542 202 552T240 563'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/GeneralPunctuation.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/GeometricShapes.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/GeometricShapes.js deleted file mode 100644 index 6ca970045f..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/GeometricShapes.js +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/GeometricShapes.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // WHITE UP-POINTING TRIANGLE - 0x25B3: [711,-1,1022,69,953,'91 1Q69 10 69 31Q69 39 81 59T168 197Q327 447 485 697Q493 711 510 711Q523 711 532 702Q536 697 743 371T951 41Q953 35 953 31Q953 12 931 1H91ZM690 340Q651 401 604 476T534 586L512 621Q511 622 507 616Q498 604 332 342L154 62L333 61H689L867 62L690 340'], - - // WHITE RIGHT-POINTING SMALL TRIANGLE - 0x25B9: [540,39,575,33,542,'33 518Q45 540 63 540H65Q72 540 174 481Q247 439 302 407Q529 276 533 272Q542 263 542 250Q542 238 533 229Q528 224 304 95T71 -38Q69 -39 63 -39Q42 -39 33 -16V518ZM449 251L94 456Q93 456 93 251Q93 45 94 45L106 52Q119 59 139 71T186 98T242 131T301 165T357 197T404 225T437 244L449 251'], - - // WHITE DOWN-POINTING TRIANGLE - 0x25BD: [500,210,1022,68,953,'68 470Q68 481 75 489T91 499H93Q296 500 512 500H931Q932 499 937 496T945 490T950 482T953 469Q953 465 951 459Q950 455 743 129T532 -202Q524 -210 511 -210Q497 -210 489 -202Q486 -199 281 124T71 456Q68 462 68 470ZM154 439Q155 437 332 158T510 -122Q510 -123 533 -87T600 18T688 157Q866 437 866 438Q867 439 805 439T511 439H154'], - - // WHITE LEFT-POINTING SMALL TRIANGLE - 0x25C3: [539,38,575,33,542,'542 -14Q533 -38 514 -38H512Q503 -38 498 -35Q494 -34 270 95T42 229Q33 238 33 251Q33 259 35 264Q36 265 38 268T42 272Q48 278 271 407T504 539H508Q533 539 542 515V-14ZM481 251Q481 456 480 456Q125 252 124 251Q124 250 301 148T480 45T481 251'], - - // LARGE CIRCLE - 0x25EF: [711,212,1150,65,1084,'65 42T65 250T204 584T574 711Q795 711 935 594Q955 577 974 555T1022 490T1067 385T1084 250Q1084 42 945 -84T574 -211T204 -85ZM1024 250Q1024 431 903 540T578 650Q482 650 404 627T274 565T189 474T140 366T125 250Q125 123 186 31T347 -106T573 -150Q772 -150 898 -45T1024 250'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/GeometricShapes.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/GreekAndCoptic.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/GreekAndCoptic.js deleted file mode 100644 index bd5a975f34..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/GreekAndCoptic.js +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/GreekAndCoptic.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // GREEK CAPITAL LETTER GAMMA - 0x393: [680,0,692,39,643,'425 0L228 3Q63 3 51 0H39V62H147V618H39V680H612V676Q614 670 627 552T643 428V424H581V428Q580 430 576 461T562 524T532 576Q512 596 481 605T426 616T357 618H304V62H439V0H425'], - - // GREEK CAPITAL LETTER DELTA - 0x394: [698,0,958,56,901,'901 12Q901 7 892 0H479Q65 0 62 2Q56 6 56 11Q56 14 242 347T433 685Q438 694 450 696Q454 698 480 698H506L523 687Q526 683 711 354T899 17Q901 13 901 12ZM653 137L427 538L202 137L315 136H540L653 137'], - - // GREEK CAPITAL LETTER THETA - 0x398: [696,10,894,64,830,'629 -10T446 -10T164 89T64 340Q64 380 71 420T102 510T163 596T266 662T418 696H438Q488 696 499 695Q582 686 644 655T741 584T796 495T823 409T829 338Q829 188 729 89ZM439 645Q416 645 390 638T333 615T275 564T236 480Q221 423 221 341Q221 272 230 228Q247 144 301 94T447 43T592 93T663 228Q672 272 672 341Q672 645 439 645ZM286 242V446H348V412H545V446H607V242H545V276H348V242H286'], - - // GREEK CAPITAL LETTER LAMDA - 0x39B: [698,0,806,40,765,'285 0Q267 3 154 3Q56 3 47 0H40V62H131Q131 63 167 160T244 369T321 578T359 678Q366 698 393 698H404H413Q437 698 446 678Q448 672 560 369T674 62H765V0H754Q733 3 604 3Q453 3 429 0H416V62H461L507 63L355 470Q353 468 279 265L203 63L249 62H294V0H285'], - - // GREEK CAPITAL LETTER XI - 0x39E: [675,0,767,48,718,'54 465L63 674Q63 675 383 675T703 674L712 465Q712 464 681 464H650V467Q650 490 646 516T632 545Q612 550 383 550H283Q169 550 149 548T124 531Q123 530 123 529Q116 506 116 467V464H85Q54 464 54 465ZM160 256V447H222V414H544V447H606V256H544V289H222V256H160ZM57 0L48 222H110V219Q110 147 125 133Q127 130 130 129T160 127T235 126T383 126Q482 126 530 126T604 127T635 129T641 133Q656 146 656 219V222H718L709 0H57'], - - // GREEK CAPITAL LETTER PI - 0x3A0: [680,0,900,39,860,'400 0Q376 3 226 3Q75 3 51 0H39V62H147V618H39V680H860V618H752V62H860V0H848Q824 3 674 3Q523 3 499 0H487V62H595V618H304V62H412V0H400'], - - // GREEK CAPITAL LETTER SIGMA - 0x3A3: [686,0,831,64,766,'766 271Q764 266 750 137T735 4V0H407Q74 0 71 4L70 5Q64 9 64 18Q64 24 82 41T213 158L359 288Q360 288 320 336T214 460Q67 633 66 635Q64 638 64 655Q64 679 75 684Q78 686 407 686H735V682Q738 676 751 558T766 434V430H735Q704 430 704 431Q704 434 703 444T696 477T681 520T654 563T613 598Q578 615 527 619T371 624H281L396 489Q506 358 513 351Q517 342 512 334Q503 325 371 208Q338 179 303 147T249 99L231 83L243 81Q258 81 364 81Q382 81 418 81T470 82T513 83T554 88T587 96T619 109T645 129Q689 173 702 260L704 274Q704 275 735 275H766V271'], - - // GREEK CAPITAL LETTER UPSILON - 0x3A5: [698,0,894,64,829,'64 556Q69 619 114 658T224 697Q271 697 310 677T375 622T417 554T444 484L447 477V479Q456 516 473 551T516 620T582 676T670 697Q735 697 780 656T829 556Q829 539 818 532H772Q761 539 761 548Q761 571 681 571Q664 571 653 570T623 562T587 537T555 490Q536 448 531 410T525 300V210V62H660V0H646L447 3Q257 1 247 0H233V62H368V210V301Q368 373 363 410T338 490Q324 518 307 536T270 561T240 569T212 571Q132 571 132 548Q132 539 121 532H75Q64 538 64 556'], - - // GREEK CAPITAL LETTER PHI - 0x3A6: [686,0,831,64,766,'609 0Q582 3 415 3T221 0H207V62H342V168L328 169Q193 180 117 241Q64 286 64 343T117 445Q193 506 328 517L342 518V624H207V686H221Q248 683 415 683T609 686H623V624H488V518L502 517Q637 506 713 445Q766 400 766 343T713 241Q637 180 502 169L488 168V62H623V0H609ZM342 219T342 343T340 467Q328 467 304 459Q277 451 261 439T237 409T228 378T226 343Q226 314 229 296T250 259T301 228Q331 219 341 219Q342 219 342 343ZM604 343Q604 365 602 379T591 413T560 446T503 464L489 467Q488 467 488 343T489 219Q499 219 529 228Q554 236 570 248T593 277T602 308T604 343'], - - // GREEK CAPITAL LETTER PSI - 0x3A8: [686,0,894,64,829,'64 515Q64 532 71 536T104 540H139Q200 540 207 538Q225 533 236 521T253 489T260 454T264 414Q264 340 287 296T347 237Q369 226 373 226Q374 226 374 425V624H239V686H253Q280 683 447 683T641 686H655V624H520V226L522 227Q525 228 531 229T552 240T580 261T606 298T624 354Q627 368 628 394T631 440T637 482T654 518T686 538Q693 540 754 540H794Q817 540 823 536T829 515Q829 500 824 495T811 489T796 483T782 461T775 408Q767 212 568 175Q526 168 521 168Q520 168 520 115V62H655V0H641Q614 3 447 3T253 0H239V62H374V168L364 169Q290 178 243 203Q126 261 118 409Q117 443 111 461T98 484T83 489T70 495T64 515'], - - // GREEK CAPITAL LETTER OMEGA - 0x3A9: [696,1,831,51,779,'598 645T415 645T232 458Q232 385 275 239T318 26Q318 8 311 4T272 -1Q265 -1 240 -1T196 0H88V3Q86 5 70 108Q52 211 51 212V215H113V212Q123 149 132 133Q136 124 149 122T202 118Q241 118 241 119Q241 132 132 277Q64 378 64 457Q64 564 158 630T403 696Q487 696 543 685T661 638Q722 599 744 549T766 458Q766 434 761 410T749 368T729 327T709 293T684 258T663 229Q632 187 614 160T592 126L589 119Q589 118 628 118Q667 119 680 121T698 133Q702 140 706 160T714 196L717 212V215H779V212Q778 211 760 108Q744 5 742 3V0H634H562Q528 0 520 4T512 26Q512 92 555 238T598 458Q598 645 415 645'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/GreekAndCoptic.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/Latin1Supplement.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/Latin1Supplement.js deleted file mode 100644 index fe0e89ff21..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/Latin1Supplement.js +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/Latin1Supplement.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // DIAERESIS - 0xA8: [695,-535,575,96,478,'96 615Q96 650 120 672T178 695Q214 693 234 669T255 615Q255 583 232 559T176 535Q147 535 122 556T96 615ZM319 615Q319 651 343 673T399 695Q426 695 452 675T478 615Q478 578 454 557T395 535Q364 537 342 559T319 615'], - - // NOT SIGN - 0xAC: [371,-61,767,64,703,'680 371Q683 369 688 366T695 361T698 356T701 346T701 332T702 308V216Q702 196 702 168T703 130Q703 90 697 76T671 61Q650 61 643 81Q641 86 641 198V310H364L87 311Q64 319 64 341Q64 362 84 369Q89 371 385 371H680'], - - // MACRON - 0xAF: [607,-540,575,80,494,'80 540V607H494V540H80'], - - // DEGREE SIGN - 0xB0: [702,-535,575,160,414,'160 618Q160 653 193 677T279 702H284Q381 702 407 647Q414 634 414 618Q414 607 410 596T395 570T355 546T287 536T220 545T181 568T165 594T160 618ZM352 618Q352 645 341 652T301 659H292Q286 659 278 659T268 660Q247 660 236 653T224 638T222 619Q222 591 234 585T287 578Q315 578 326 580T345 590T352 618'], - - // PLUS-MINUS SIGN - 0xB1: [728,35,894,64,829,'64 328T64 346T87 377H416V542L417 707Q431 728 443 728Q467 728 475 709Q477 704 477 540V377H807Q808 376 811 374T817 370T823 365T827 358T829 347Q829 326 807 317L642 316H477V25H807Q808 24 811 22T817 18T823 13T827 6T829 -5Q829 -26 807 -35H87Q64 -24 64 -6T87 25H416V316H251L87 317Q64 328 64 346'], - - // ACUTE ACCENT - 0xB4: [706,-503,575,236,460,'391 706Q419 706 439 683T460 634Q460 608 441 593T366 550Q356 545 351 543L275 503L256 527Q236 552 237 553Q242 558 292 620Q299 629 309 641T324 659T336 673T346 685T354 693T363 699T371 703T380 705T391 706'], - - // MULTIPLICATION SIGN - 0xD7: [530,28,894,168,726,'168 500Q168 515 178 522T195 530H198Q207 530 218 521T282 458Q312 428 331 409L447 294L563 409Q674 520 682 525Q687 529 695 529Q711 529 718 520T726 499V498Q726 489 720 481T666 427Q631 392 606 367L490 251L606 135Q717 23 721 17T726 2Q726 -9 719 -18T695 -28H692Q685 -28 674 -18T608 47Q581 74 563 92L447 207L331 91Q217 -22 208 -27Q206 -28 203 -28H197Q168 -28 168 2Q168 13 178 24T288 135L404 250L288 366Q177 479 173 485T168 500'], - - // DIVISION SIGN - 0xF7: [597,96,894,64,828,'344 495Q344 535 372 566T447 597Q490 597 519 566T548 495Q548 452 518 423T446 393Q404 393 374 423T344 495ZM87 221Q64 230 64 251T84 279Q89 281 448 281H806Q807 280 810 278T816 274T822 269T826 262T828 251Q828 230 806 221H87ZM344 -36T344 6T373 78T446 108Q487 108 517 79T548 6Q548 -35 519 -65T446 -96Q406 -96 375 -66'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/Latin1Supplement.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/LatinExtendedA.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/LatinExtendedA.js deleted file mode 100644 index deeac27e82..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/LatinExtendedA.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/LatinExtendedA.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // LATIN SMALL LETTER DOTLESS I - 0x131: [452,8,394,24,367,'24 296Q24 305 34 328T63 380T115 430T187 452Q205 452 223 448T262 435T295 406T308 360Q308 345 287 290T240 170T207 87Q202 67 202 57Q202 42 215 42Q235 42 257 64Q288 92 302 140Q307 156 310 159T330 162H336H347Q367 162 367 148Q367 140 357 117T329 65T276 14T201 -8Q158 -8 121 15T83 84Q83 104 133 229T184 358Q189 376 189 388Q189 402 177 402Q156 402 134 380Q103 352 89 304Q84 288 81 285T61 282H55H44Q24 282 24 296'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/LatinExtendedA.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/LatinExtendedB.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/LatinExtendedB.js deleted file mode 100644 index 0e0c8d39da..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/LatinExtendedB.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/LatinExtendedB.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // LATIN SMALL LETTER DOTLESS J - 0x237: [451,201,439,-12,420,'297 360T297 373T294 392T288 400T278 401H276Q237 398 200 363Q181 343 170 325T156 299T149 287T129 282H123H116Q102 282 97 284T92 298Q93 303 98 315T118 349T151 390T201 427T267 451H279Q357 451 388 422T420 354V339L370 138Q321 -60 317 -69Q287 -157 163 -194Q133 -201 99 -201Q39 -201 14 -178T-12 -125Q-12 -94 11 -69T68 -43Q93 -43 108 -57T123 -95Q123 -121 100 -151H104Q131 -151 155 -125T193 -60Q195 -54 244 141T294 345Q297 360 297 373'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/LatinExtendedB.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/LetterlikeSymbols.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/LetterlikeSymbols.js deleted file mode 100644 index c3a5eefd44..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/LetterlikeSymbols.js +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/LetterlikeSymbols.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // stix-/hbar - Planck's over 2pi - 0x210F: [694,8,668,45,642,'477 56Q477 48 479 46T490 43Q522 45 544 75T577 140Q582 156 585 159T605 162H611H622Q642 162 642 148Q642 138 632 114T602 62T550 13T478 -8Q429 -8 394 17T358 83Q358 95 395 199T433 350Q433 400 394 400H388H383Q335 400 291 363Q256 332 236 298Q233 293 202 170T169 40Q160 18 141 5T99 -8Q70 -8 58 9T45 39Q45 51 116 336L167 540H80V607H184L188 622H184Q183 622 179 622T169 623T157 624T146 624T136 624T131 625Q119 628 119 642Q119 647 123 661T129 679Q133 684 142 685T220 690Q293 694 307 694Q324 694 328 679Q328 673 311 607H494V540H294Q286 507 278 473T264 420L260 403Q260 400 269 408Q327 451 393 451H401H410Q425 451 439 450T476 442T515 424T544 391T556 337Q556 286 517 179T477 56'], - - // BLACK-LETTER CAPITAL I - 0x2111: [702,8,831,64,798,'65 502Q65 564 99 611T174 680T250 701Q251 701 257 701T269 702Q319 702 374 680T466 633T542 578T592 542L602 538L621 537Q669 537 695 542T725 550T730 560Q732 570 736 572T756 575H764H777Q798 575 798 559Q798 535 780 519Q762 500 727 493T622 486Q532 486 483 504T386 572Q382 576 371 588T355 603T341 616T327 628T313 637T298 645T282 649T264 651Q215 651 174 609T132 501Q132 434 184 393T312 347Q327 346 330 343T333 322T330 301T312 296Q276 296 236 307T157 341T91 406T65 502ZM406 314Q406 351 427 378T480 418T541 437T598 443Q645 443 655 442Q722 435 760 407T798 338Q798 326 794 324T772 321H764Q739 321 734 325T729 341T717 365Q690 392 618 392H611Q586 392 572 366Q561 345 561 315Q561 291 577 275Q595 260 643 241T706 211Q747 186 747 140Q747 78 696 39Q667 15 617 1Q578 -8 480 -8H439Q379 -8 345 5T228 74Q182 105 152 119T86 137Q71 138 68 142T64 164Q64 175 64 177T68 184T78 188T99 188H151L226 187L238 185Q275 176 305 158T376 106T443 54Q478 31 489 31H490Q494 32 500 34T524 43T554 62T579 92T593 135Q593 162 575 179T533 204T479 225T432 255Q406 278 406 314'], - - // SCRIPT SMALL L - 0x2113: [702,19,474,-1,446,'245 -19Q228 -19 212 -16T184 -6T162 9T143 27T129 46T118 66T111 84T106 99T102 111L101 116L69 89L36 62Q31 60 24 62Q-1 88 -1 98Q-1 101 1 105Q1 106 73 170L95 189V197Q95 242 112 317T159 476T241 624T353 701Q357 702 367 702Q428 702 444 641Q446 630 446 606Q446 454 241 246L215 220L212 203Q203 150 203 114Q203 113 203 106T204 95T205 82T209 67T214 54T223 43T236 35T253 32Q277 32 305 44T352 70T389 98T407 112Q409 113 412 113Q420 113 432 95Q445 77 443 70Q440 64 416 44T342 3T245 -19ZM387 615Q387 651 366 651Q342 651 321 604T276 470L241 331Q246 331 280 373T350 486T387 615'], - - // SCRIPT CAPITAL P - 0x2118: [461,210,740,72,726,'399 159Q410 159 421 151T433 126Q433 104 410 85Q408 84 410 78Q411 72 414 66T428 51T455 43Q483 43 506 55T543 83T568 125T584 166T594 206Q595 211 596 214Q610 273 610 301Q610 365 542 365H538Q483 365 429 344T337 292T269 229T225 175T210 150L255 99Q261 92 274 78T292 58T305 41T316 22T321 3T324 -23Q324 -87 283 -148T174 -210H171Q161 -210 152 -209T128 -201T101 -180T81 -141T72 -78Q72 -72 72 -60T73 -45Q79 4 102 65L108 81Q84 117 84 167Q84 273 140 367T269 461Q285 461 285 447Q285 440 282 431Q278 418 276 415T264 410Q228 404 201 336T174 219Q174 218 176 202L184 214Q252 303 348 360T549 417Q614 417 658 391T719 317Q726 292 726 260Q726 148 646 70T451 -8Q407 -8 377 17T346 92Q346 159 396 159H399ZM178 -160Q200 -160 216 -132T232 -75Q232 -63 228 -56T203 -26Q196 -18 192 -14Q185 -5 176 5T161 20T156 27L153 28Q151 28 146 8T137 -42T132 -89Q132 -160 178 -160'], - - // BLACK-LETTER CAPITAL R - 0x211C: [711,16,831,42,824,'133 87Q166 34 218 34Q232 34 238 47T247 99Q248 105 248 127Q248 135 248 144T247 169T245 239T243 382Q242 534 241 565T234 612Q219 651 190 651Q168 651 151 630T134 580Q134 565 148 548T178 516T209 468T223 394Q218 243 131 243Q102 243 84 266T64 319Q64 334 69 337T95 340Q117 340 121 337T126 317Q127 294 133 294Q140 294 146 318Q150 339 150 382L151 413Q141 437 103 485T64 572Q64 623 100 662T197 702Q235 702 273 684T339 634Q407 702 610 710Q615 710 630 710T651 711Q673 711 677 709Q682 706 753 578T824 444Q824 437 817 432Q799 420 758 399T686 361T654 344T657 289T665 177T670 115Q676 78 708 46L735 69Q762 93 769 93L807 73Q812 68 812 62Q812 57 805 51T759 18L710 -16H680H669Q617 -16 573 17Q527 52 515 114Q514 118 508 218T501 326V330H397V281Q397 197 384 135T327 28Q281 -16 223 -16H220Q180 -16 151 -7T107 18T86 46T78 68L74 67Q64 67 53 78T42 97Q42 106 51 109T60 114V119Q60 120 60 122L59 124Q59 129 64 135T78 149T91 160Q102 163 109 155Q115 133 119 133Q124 133 137 123T150 102Q150 98 146 94Q144 90 133 87ZM664 419L540 644H535Q517 644 487 637Q396 621 371 582L376 571Q396 512 397 435V392H494Q598 393 610 396Q611 397 615 398Q626 401 645 409T664 419'], - - // ALEF SYMBOL - 0x2135: [694,0,703,64,638,'590 427Q581 427 579 433T575 450T568 470V468L532 288L541 281Q620 220 634 165L637 154V124Q637 74 628 46Q623 32 612 16T592 0Q580 0 578 19T569 69T538 121Q532 126 385 240T236 355Q234 355 231 338T225 291T222 237Q222 222 223 213T225 201T228 195T231 190Q238 179 261 160T300 119T316 73Q316 41 291 23T231 1Q226 0 149 0H98Q73 0 69 3T64 24Q64 43 67 47T85 51H89Q119 51 134 55T152 64T154 76Q154 95 125 141T96 220Q96 243 104 270T123 319T145 360T164 391T172 404T150 421T102 468T68 529L65 541V570Q65 620 74 648Q79 664 91 679T111 694Q122 694 123 675T132 625T164 573Q168 569 319 452T471 335Q471 337 486 409T502 488Q502 489 491 493T467 511T448 546V573Q448 602 452 624T462 659T474 680T486 691T493 694Q499 694 502 691T507 682T513 673Q517 667 534 651T557 630Q558 629 590 616T631 587Q638 577 638 543Q637 489 622 458T590 427'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/LetterlikeSymbols.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/Main.js deleted file mode 100644 index ce456e7461..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/Main.js +++ /dev/null @@ -1,217 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'] = { - directory: 'Main/Bold', - family: 'MathJax_Main', - id: 'MJMAINB', - weight: 'bold', - skew: { - 0x131: 0.0319, - 0x237: 0.0958, - 0x210F: -0.0319, - 0x2113: 0.128, - 0x2202: 0.0958 - }, - Ranges: [ - [0x20,0x7F,"BasicLatin"], - [0xA0,0xFF,"Latin1Supplement"], - [0x100,0x17F,"LatinExtendedA"], - [0x180,0x24F,"LatinExtendedB"], - [0x2B0,0x2FF,"SpacingModLetters"], - [0x300,0x36F,"CombDiacritMarks"], - [0x370,0x3FF,"GreekAndCoptic"], - [0x2000,0x206F,"GeneralPunctuation"], - [0x20D0,0x20FF,"CombDiactForSymbols"], - [0x2100,0x214F,"LetterlikeSymbols"], - [0x2190,0x21FF,"Arrows"], - [0x2200,0x22FF,"MathOperators"], - [0x2300,0x23FF,"MiscTechnical"], - [0x25A0,0x25FF,"GeometricShapes"], - [0x2600,0x26FF,"MiscSymbols"], - [0x27C0,0x27EF,"MiscMathSymbolsA"], - [0x27F0,0x27FF,"SupplementalArrowsA"], - [0x2A00,0x2AFF,"SuppMathOperators"] - ], - - // LEFT PARENTHESIS - 0x28: [750,249,447,103,382,'103 166T103 251T121 412T165 541T225 639T287 708T341 750H356H361Q382 750 382 736Q382 732 365 714T323 661T274 576T232 439T214 250Q214 -62 381 -229Q382 -231 382 -234Q382 -249 360 -249H356H341Q314 -231 287 -207T226 -138T165 -41T121 89'], - - // RIGHT PARENTHESIS - 0x29: [751,249,447,64,344,'231 251Q231 354 214 439T173 575T123 661T81 714T64 735Q64 744 73 749H75Q77 749 79 749T84 750T90 750H105Q132 732 159 708T220 639T281 542T325 413T343 251T325 89T281 -40T221 -138T159 -207T105 -249H90Q80 -249 76 -249T68 -245T64 -234Q64 -230 81 -212T123 -160T172 -75T214 61T231 251'], - - // PLUS SIGN - 0x2B: [633,131,894,64,829,'64 232T64 250T87 281H416V444Q416 608 418 612Q426 633 446 633T475 613Q477 608 477 444V281H807Q808 280 811 278T817 274T823 269T827 262T829 251Q829 230 807 221L642 220H477V57Q477 -107 475 -112Q468 -131 446 -131Q425 -131 418 -112Q416 -107 416 57V220H251L87 221Q64 232 64 250'], - - // COMMA - 0x2C: [171,194,319,74,258,'74 85Q74 120 97 145T159 171Q200 171 226 138Q258 101 258 37Q258 -5 246 -44T218 -109T183 -155T152 -184T135 -194Q129 -194 118 -183T106 -164Q106 -157 115 -149Q121 -145 130 -137T161 -100T195 -35Q197 -28 200 -17T204 3T205 11T199 9T183 3T159 0Q120 0 97 26T74 85'], - - // FULL STOP - 0x2E: [171,-1,319,74,245,'74 85Q74 121 99 146T156 171Q200 171 222 143T245 85Q245 56 224 29T160 1Q118 1 96 27T74 85'], - - // SOLIDUS - 0x2F: [750,250,575,64,510,'451 730Q460 750 479 750Q492 750 501 740T510 718Q508 708 318 244L122 -232Q112 -250 95 -250Q82 -250 73 -241T64 -218Q66 -205 258 261T451 730'], - - // DIGIT ZERO - 0x30: [654,10,575,45,529,'266 654H280H282Q500 654 524 418Q529 370 529 320Q529 125 456 52Q397 -10 287 -10Q110 -10 63 154Q45 212 45 316Q45 504 113 585Q140 618 185 636T266 654ZM374 548Q347 604 286 604Q247 604 218 575Q197 552 193 511T188 311Q188 159 196 116Q202 87 225 64T287 41Q339 41 367 87Q379 107 382 152T386 329Q386 518 374 548'], - - // DIGIT ONE - 0x31: [655,0,575,80,494,'481 0L294 3Q136 3 109 0H96V62H227V304Q227 546 225 546Q169 529 97 529H80V591H97Q231 591 308 647L319 655H333Q355 655 359 644Q361 640 361 351V62H494V0H481'], - - // DIGIT TWO - 0x32: [654,0,575,57,517,'175 580Q175 578 185 572T205 551T215 510Q215 467 191 449T137 430Q107 430 83 448T58 511Q58 558 91 592T168 640T259 654Q328 654 383 637Q451 610 484 563T517 459Q517 401 482 360T368 262Q340 243 265 184L210 140H274Q416 140 429 145Q439 148 447 186T455 237H517V233Q516 230 501 119Q489 9 486 4V0H57V25Q57 51 58 54Q60 57 109 106T215 214T288 291Q364 377 364 458Q364 515 328 553T231 592Q214 592 201 589T181 584T175 580'], - - // DIGIT THREE - 0x33: [655,11,575,47,526,'80 503Q80 565 133 610T274 655Q366 655 421 623T491 538Q493 528 493 510Q493 446 453 407T361 348L376 344Q452 324 489 281T526 184Q526 152 514 121T474 58T392 8T265 -11Q175 -11 111 34T48 152Q50 187 72 209T132 232Q171 232 193 208T216 147Q216 136 214 126T207 108T197 94T187 84T178 77T170 72L168 71Q168 70 179 65T215 54T266 48H270Q331 48 350 105Q358 128 358 185Q358 239 348 268T309 313Q292 321 242 322Q205 322 198 324T191 341V348Q191 366 196 369T232 375Q239 375 247 376T260 377T268 378Q284 383 297 393T326 436T341 517Q341 536 339 547T331 573T308 593T266 600Q248 600 241 599Q214 593 183 576Q234 556 234 503Q234 462 210 444T157 426Q126 426 103 446T80 503'], - - // DIGIT FOUR - 0x34: [656,0,575,32,542,'531 0Q510 3 381 3Q238 3 214 0H201V62H313V155H32V217L205 434Q342 606 362 630T387 655L391 656Q395 656 401 656T414 656H427Q447 656 451 645Q453 641 453 429V217H542V155H453V62H542V0H531ZM324 217V494L103 218L213 217H324'], - - // DIGIT FIVE - 0x35: [655,11,575,57,517,'100 565V605Q100 637 102 646T113 655Q116 655 139 647T202 631T286 623Q332 623 372 631T434 647T459 655Q466 655 469 651T472 643T472 629Q472 613 463 601Q370 487 219 487Q195 487 183 488T169 490T168 433V376Q169 376 174 379T188 387T211 397T244 405T288 409Q390 409 453 352T517 201Q517 106 445 48T253 -11Q169 -11 113 37T57 154Q57 187 79 208T131 229T183 209T206 154Q206 99 155 83Q152 82 157 78Q196 47 253 47Q347 47 358 135Q358 137 358 138Q360 158 360 209Q360 277 355 301T337 338Q315 358 282 358Q202 358 160 303Q153 294 149 292T130 290Q107 290 102 301Q100 304 100 474V565'], - - // DIGIT SIX - 0x36: [655,11,575,48,526,'48 318Q48 395 68 456T120 553T193 613T273 646T350 655Q425 655 461 616T497 524Q497 485 475 468T428 451Q399 451 378 470T357 521Q357 565 403 588Q375 601 351 601Q313 601 282 584Q242 565 222 526Q199 473 199 367Q201 369 210 380T227 396T246 410T275 422T312 426Q438 426 494 332Q526 285 526 208V199Q526 112 465 53Q428 17 388 3T285 -11Q236 -11 195 7T135 43T104 80Q48 165 48 318ZM375 231V244V268Q375 295 373 310T364 342T341 366T299 374H297Q231 374 208 287Q200 257 200 196Q201 120 209 100Q231 47 288 47Q351 47 368 90Q375 112 375 231'], - - // DIGIT SEVEN - 0x37: [676,11,575,64,558,'256 -11Q231 -11 208 5T185 65Q185 105 193 146T212 220T241 289T275 349T312 402T346 445T377 479T397 502L400 504H301Q156 503 150 497Q142 491 134 456T126 407H64V411Q65 414 82 544T99 675T130 676H161V673Q161 669 162 666T167 661T173 657T181 654T190 652T200 651T210 650T220 649T229 648Q237 648 254 647T276 646Q277 646 426 644H558V620V607Q558 596 551 586T509 537Q489 515 476 500Q390 401 384 393Q349 339 337 259T324 113T322 38Q307 -11 256 -11'], - - // DIGIT EIGHT - 0x38: [654,11,575,48,526,'80 474Q80 561 139 607T278 654Q357 654 411 632Q490 593 494 509Q494 424 416 376L407 371L418 364Q432 356 447 345T481 312T513 260T526 192Q526 100 461 45T285 -11Q184 -11 116 32T48 164Q48 181 50 196T58 225T69 249T84 270T100 286T117 300T134 311T149 321T162 329L152 336Q120 360 100 397T80 474ZM347 404Q404 446 404 503Q404 579 317 599Q309 600 276 600Q178 600 170 538Q170 532 171 527T173 518T178 509T184 501T194 492T205 484T219 476T235 467T254 456T275 445L347 404ZM289 47Q323 47 351 54T402 82T425 137Q425 147 421 161Q411 183 391 197T303 249Q224 293 223 293Q220 291 215 288T197 273T175 248T157 213T149 167Q149 109 188 78T289 47'], - - // DIGIT NINE - 0x39: [654,11,575,48,526,'178 59Q206 48 238 48Q311 48 345 102Q370 138 375 259V278Q374 278 369 271T350 252T322 232Q297 220 258 220Q172 220 110 275T48 438V446Q54 561 146 618Q199 654 278 654Q321 654 329 653Q526 621 526 330Q526 252 507 190T457 92T388 31T312 -2T240 -11Q165 -11 121 25T77 120Q77 159 99 176T147 193T194 177T217 122Q217 113 216 106T211 92T205 82T198 73T191 67T184 62T178 59ZM374 446V465Q374 523 364 552T315 598Q309 600 293 601Q227 601 210 562Q199 539 199 433Q199 343 204 319T235 279Q250 272 274 271H282Q293 271 303 274T327 288T353 323T371 385Q374 403 374 446'], - - // COLON - 0x3A: [444,-1,319,74,245,'74 359Q74 394 98 419T158 444Q200 444 222 417T245 358Q245 329 224 302T160 274Q116 274 95 301T74 359ZM74 85Q74 121 99 146T156 171Q200 171 222 143T245 85Q245 56 224 29T160 1Q118 1 96 27T74 85'], - - // SEMICOLON - 0x3B: [444,194,319,74,248,'74 359Q74 394 98 419T158 444Q200 444 222 417T245 358Q245 329 224 302T160 274Q116 274 95 301T74 359ZM74 50T74 86T97 146T158 171Q204 171 226 132T248 38Q248 -23 223 -80T171 -165T135 -194Q129 -194 118 -183T106 -164Q106 -163 106 -160L107 -158Q108 -155 121 -142T150 -107T177 -58Q189 -32 194 3Q195 6 193 6Q172 0 158 0Q121 0 98 25'], - - // LESS-THAN SIGN - 0x3C: [587,85,894,96,797,'797 -56Q797 -68 790 -76T767 -85H759L434 70Q108 226 105 229Q96 238 96 250Q96 263 105 272Q109 276 271 354T595 508T757 585Q763 587 766 587Q780 587 788 578T797 556Q797 544 788 535Q784 531 490 391L197 251Q213 242 359 173T644 37T788 -34Q797 -43 797 -56'], - - // EQUALS SIGN - 0x3D: [393,-109,894,64,829,'87 333Q64 343 64 362Q64 383 84 391Q89 393 448 393H807Q808 392 811 390T817 386T823 381T827 374T829 363Q829 345 807 333H87ZM87 109Q64 118 64 139Q64 159 86 168Q89 169 448 169H807L812 166Q816 163 818 162T823 157T827 149T829 139Q829 118 807 109H87'], - - // GREATER-THAN SIGN - 0x3E: [587,85,894,96,797,'127 -85Q110 -85 103 -75T96 -55Q96 -41 106 -34Q119 -24 308 65Q361 90 411 114L696 250L427 379Q106 533 103 537Q96 545 96 557Q96 568 104 577T128 587Q137 586 460 431T788 272Q797 263 797 250Q797 238 788 229Q785 226 459 70L135 -85H127'], - - // LEFT SQUARE BRACKET - 0x5B: [750,250,319,128,293,'128 -250V750H293V689H189V-189H293V-250H128'], - - // REVERSE SOLIDUS - 0x5C: [750,250,575,63,511,'64 718Q63 731 72 740T94 750Q106 750 113 743Q118 741 122 732L318 256Q508 -208 510 -218Q511 -231 502 -240T480 -250Q460 -250 451 -230Q451 -229 259 238T64 718'], - - // RIGHT SQUARE BRACKET - 0x5D: [750,250,319,25,190,'25 689V750H190V-250H25V-189H129V689H25'], - - // CIRCUMFLEX ACCENT - 0x5E: [694,-520,575,126,449,'207 632L287 694Q289 693 368 632T448 570T431 545T413 520Q410 520 350 559L287 597L224 559Q164 520 161 520Q160 520 143 544T126 570T207 632'], - - // LATIN SMALL LETTER A - 0x61: [453,6,559,32,558,'64 349Q64 399 107 426T255 453Q346 453 402 423T473 341Q478 327 478 310T479 196V77Q493 63 529 62Q549 62 553 57T558 31Q558 9 552 5T514 0H497H481Q375 0 367 56L356 46Q300 -6 210 -6Q130 -6 81 30T32 121Q32 188 111 226T332 272H350V292Q350 313 348 327T337 361T306 391T248 402T194 399H189Q204 376 204 354Q204 327 187 306T134 284Q97 284 81 305T64 349ZM164 121Q164 89 186 67T238 45Q274 45 307 63T346 108L350 117V226H347Q248 218 206 189T164 121'], - - // LATIN SMALL LETTER B - 0x62: [694,6,639,29,600,'32 686L123 690Q214 694 215 694H221V409Q289 450 378 450Q479 450 539 387T600 221Q600 122 535 58T358 -6H355Q272 -6 203 53L160 1L129 0H98V301Q98 362 98 435T99 525Q99 591 97 604T83 620Q69 624 42 624H29V686H32ZM227 105L232 99Q237 93 242 87T258 73T280 59T306 49T339 45Q380 45 411 66T451 131Q457 160 457 230Q457 264 456 284T448 329T430 367T396 389T343 398Q282 398 235 355L227 348V105'], - - // LATIN SMALL LETTER C - 0x63: [453,6,511,39,478,'447 131H458Q478 131 478 117Q478 112 471 95T439 51T377 9Q330 -6 286 -6Q196 -6 135 35Q39 96 39 222Q39 324 101 384Q169 453 286 453Q359 453 411 431T464 353Q464 319 445 302T395 284Q360 284 343 305T325 353Q325 380 338 396H333Q317 398 295 398H292Q280 398 271 397T245 390T218 373T197 338T183 283Q182 275 182 231Q182 199 184 180T193 132T220 85T270 57Q289 50 317 50H326Q385 50 414 115Q419 127 423 129T447 131'], - - // LATIN SMALL LETTER D - 0x64: [694,6,639,38,609,'351 686L442 690Q533 694 534 694H540V389Q540 327 540 253T539 163Q539 97 541 83T555 66Q569 62 596 62H609V31Q609 0 608 0Q588 0 510 -3T412 -6Q411 -6 411 16V38L401 31Q337 -6 265 -6Q159 -6 99 58T38 224Q38 265 51 303T92 375T165 429T272 449Q359 449 417 412V507V555Q417 597 415 607T402 620Q388 624 361 624H348V686H351ZM411 350Q362 399 291 399Q278 399 256 392T218 371Q195 351 189 320T182 238V221Q182 179 183 159T191 115T212 74Q241 46 288 46Q358 46 404 100L411 109V350'], - - // LATIN SMALL LETTER E - 0x65: [452,6,527,32,494,'32 225Q32 332 102 392T272 452H283Q382 452 436 401Q494 343 494 243Q494 226 486 222T440 217Q431 217 394 217T327 218H175V209Q175 177 179 154T196 107T236 69T306 50Q312 49 323 49Q376 49 410 85Q421 99 427 111T434 127T442 133T463 135H468Q494 135 494 117Q494 110 489 97T468 66T431 32T373 5T292 -6Q181 -6 107 55T32 225ZM383 276Q377 346 348 374T280 402Q253 402 230 390T195 357Q179 331 176 279V266H383V276'], - - // LATIN SMALL LETTER F - 0x66: [700,0,351,40,453,'308 0Q290 3 172 3Q58 3 49 0H40V62H109V382H42V444H109V503L110 562L112 572Q127 625 178 658T316 699Q318 699 330 699T348 700Q381 698 404 687T436 658T449 629T452 606Q452 576 432 557T383 537Q355 537 335 555T314 605Q314 635 328 649H325Q311 649 293 644T253 618T227 560Q226 555 226 498V444H340V382H232V62H318V0H308'], - - // LATIN SMALL LETTER G - 0x67: [455,201,575,30,559,'50 300Q50 368 105 409T255 450Q328 450 376 426L388 420Q435 455 489 455Q517 455 533 441T554 414T558 389Q558 367 544 353T508 339Q484 339 471 354T458 387Q458 397 462 400Q464 401 461 400Q459 400 454 399Q429 392 427 390Q454 353 459 328Q461 315 461 300Q461 240 419 202Q364 149 248 149Q185 149 136 172Q129 158 129 148Q129 105 170 93Q176 91 263 91Q273 91 298 91T334 91T366 89T400 85T432 77T466 64Q544 22 544 -69Q544 -114 506 -145Q438 -201 287 -201Q149 -201 90 -161T30 -70Q30 -58 33 -47T42 -27T54 -13T69 -1T82 6T94 12T101 15Q66 57 66 106Q66 151 90 187L97 197L89 204Q50 243 50 300ZM485 403H492Q491 404 488 404L485 403V403ZM255 200Q279 200 295 206T319 219T331 242T335 268T336 300Q336 337 333 352T317 380Q298 399 255 399Q228 399 211 392T187 371T178 345T176 312V300V289Q176 235 194 219Q215 200 255 200ZM287 -150Q357 -150 400 -128T443 -71Q443 -65 442 -61T436 -50T420 -37T389 -27T339 -21L308 -20Q276 -20 253 -20Q190 -20 180 -20T156 -26Q130 -38 130 -69Q130 -105 173 -127T287 -150'], - - // LATIN SMALL LETTER H - 0x68: [694,0,639,37,623,'40 686L131 690Q222 694 223 694H229V533L230 372L238 381Q248 394 264 407T317 435T398 450Q428 450 448 447T491 434T529 402T551 346Q553 335 554 198V62H623V0H614Q596 3 489 3Q374 3 365 0H356V62H425V194V275Q425 348 416 373T371 399Q326 399 288 370T238 290Q236 281 235 171V62H304V0H295Q277 3 171 3Q64 3 46 0H37V62H106V332Q106 387 106 453T107 534Q107 593 105 605T91 620Q77 624 50 624H37V686H40'], - - // LATIN SMALL LETTER I - 0x69: [695,0,319,40,294,'72 610Q72 649 98 672T159 695Q193 693 217 670T241 610Q241 572 217 549T157 525Q120 525 96 548T72 610ZM46 442L136 446L226 450H232V62H294V0H286Q271 3 171 3Q67 3 49 0H40V62H109V209Q109 358 108 362Q103 380 55 380H43V442H46'], - - // LATIN SMALL LETTER J - 0x6A: [695,200,351,-71,274,'104 610Q104 649 130 672T191 695Q225 693 249 670T273 610Q273 572 249 549T189 525Q152 525 128 548T104 610ZM78 442L173 446L268 450H274V196Q274 -5 274 -37T269 -83Q256 -132 201 -166T71 -200Q10 -200 -30 -173T-71 -102Q-71 -70 -51 -51T-1 -31Q27 -31 48 -49T69 -100Q69 -121 53 -147H56Q66 -149 77 -149H80Q90 -149 100 -146T127 -125T149 -73Q151 -55 151 149V362Q150 364 148 366T145 370T142 373T138 375T133 377T124 378T113 379T97 380H75V442H78'], - - // LATIN SMALL LETTER K - 0x6B: [694,0,607,29,587,'32 686L123 690Q214 694 215 694H221V255L377 382H346V444H355Q370 441 476 441Q544 441 556 444H562V382H476L347 277L515 62H587V0H579Q564 3 476 3Q370 3 352 0H343V62H358L373 63L260 206L237 189L216 172V62H285V0H277Q259 3 157 3Q46 3 37 0H29V62H98V332Q98 387 98 453T99 534Q99 593 97 605T83 620Q69 624 42 624H29V686H32'], - - // LATIN SMALL LETTER L - 0x6C: [694,0,319,40,301,'43 686L134 690Q225 694 226 694H232V62H301V0H292Q274 3 170 3Q67 3 49 0H40V62H109V332Q109 387 109 453T110 534Q110 593 108 605T94 620Q80 624 53 624H40V686H43'], - - // LATIN SMALL LETTER M - 0x6D: [450,0,958,37,942,'40 442Q217 450 218 450H224V365Q226 367 235 378T254 397T278 416T314 435T362 448Q376 450 400 450H406Q503 450 534 393Q545 376 545 370Q545 368 555 379Q611 450 716 450Q774 450 809 434Q850 414 861 379T873 276V213V198V62H942V0H933Q915 3 809 3Q702 3 684 0H675V62H744V194V275Q744 348 735 373T690 399Q645 399 607 370T557 290Q555 281 554 171V62H623V0H614Q596 3 489 3Q374 3 365 0H356V62H425V194V275Q425 348 416 373T371 399Q326 399 288 370T238 290Q236 281 235 171V62H304V0H295Q277 3 171 3Q64 3 46 0H37V62H106V210V303Q106 353 104 363T91 376Q77 380 50 380H37V442H40'], - - // LATIN SMALL LETTER N - 0x6E: [450,0,639,37,623,'40 442Q217 450 218 450H224V407L225 365Q233 378 245 391T289 422T362 448Q374 450 398 450Q428 450 448 447T491 434T529 402T551 346Q553 335 554 198V62H623V0H614Q596 3 489 3Q374 3 365 0H356V62H425V194V275Q425 348 416 373T371 399Q326 399 288 370T238 290Q236 281 235 171V62H304V0H295Q277 3 171 3Q64 3 46 0H37V62H106V210V303Q106 353 104 363T91 376Q77 380 50 380H37V442H40'], - - // LATIN SMALL LETTER O - 0x6F: [453,5,575,32,542,'287 -5Q228 -5 182 10T109 48T63 102T39 161T32 219Q32 272 50 314T94 382T154 423T214 446T265 452H279Q319 452 326 451Q428 439 485 376T542 221Q542 156 514 108T442 33Q384 -5 287 -5ZM399 230V250Q399 280 398 298T391 338T372 372T338 392T282 401Q241 401 212 380Q190 363 183 334T175 230Q175 202 175 189T177 153T183 118T195 91T215 68T245 56T287 50Q348 50 374 84Q388 101 393 132T399 230'], - - // LATIN SMALL LETTER P - 0x70: [450,194,639,29,600,'32 442L123 446Q214 450 215 450H221V409Q222 409 229 413T251 423T284 436T328 446T382 450Q480 450 540 388T600 223Q600 128 539 61T361 -6H354Q292 -6 236 28L227 34V-132H296V-194H287Q269 -191 163 -191Q56 -191 38 -194H29V-132H98V113V284Q98 330 97 348T93 370T83 376Q69 380 42 380H29V442H32ZM457 224Q457 303 427 349T350 395Q282 395 235 352L227 345V104L233 97Q274 45 337 45Q383 45 420 86T457 224'], - - // LATIN SMALL LETTER Q - 0x71: [450,194,607,38,609,'38 220Q38 273 54 314T95 380T152 421T211 443T264 449Q368 449 429 386L438 377L484 450H540V-132H609V-194H600Q582 -191 475 -191Q360 -191 351 -194H342V-132H411V42Q409 41 399 34T383 25T367 16T347 7T324 1T296 -4T264 -6Q162 -6 100 56T38 220ZM287 46Q368 46 417 127V301L412 312Q398 347 369 371T302 395Q282 395 263 388T225 362T194 308T182 221Q182 126 214 86T287 46'], - - // LATIN SMALL LETTER R - 0x72: [450,0,474,29,442,'405 293T374 293T324 312T305 361Q305 378 312 394Q315 397 315 399Q305 399 294 394T266 375T238 329T222 249Q221 241 221 149V62H308V0H298Q280 3 161 3Q47 3 38 0H29V62H98V210V303Q98 353 96 363T83 376Q69 380 42 380H29V442H32L118 446Q204 450 205 450H210V414L211 378Q247 449 315 449H321Q384 449 413 422T442 360Q442 332 424 313'], - - // LATIN SMALL LETTER S - 0x73: [453,6,454,37,414,'38 315Q38 339 45 360T70 404T127 440T223 453Q273 453 320 436L338 445L357 453H366Q380 453 383 447T386 403V387V355Q386 331 383 326T365 321H355H349Q333 321 329 324T324 341Q317 406 224 406H216Q123 406 123 353Q123 334 143 321T188 304T244 294T285 286Q305 281 325 273T373 237T412 172Q414 162 414 142Q414 -6 230 -6Q154 -6 117 22L68 -6H58Q44 -6 41 0T38 42V73Q38 85 38 101T37 122Q37 144 42 148T68 153H75Q87 153 91 151T97 147T103 132Q131 46 220 46H230Q257 46 265 47Q330 58 330 108Q330 127 316 142Q300 156 284 162Q271 168 212 178T122 202Q38 243 38 315'], - - // LATIN SMALL LETTER T - 0x74: [635,5,447,21,382,'272 49Q320 49 320 136V145V177H382V143Q382 106 380 99Q374 62 349 36T285 -2L272 -5H247Q173 -5 134 27Q109 46 102 74T94 160Q94 171 94 199T95 245V382H21V433H25Q58 433 90 456Q121 479 140 523T162 621V635H224V444H363V382H224V239V207V149Q224 98 228 81T249 55Q261 49 272 49'], - - // LATIN SMALL LETTER U - 0x75: [450,6,639,37,623,'40 442L134 446Q228 450 229 450H235V273V165Q235 90 238 74T254 52Q268 46 304 46H319Q352 46 380 67T419 121L420 123Q424 135 425 199Q425 201 425 207Q425 233 425 249V316Q425 354 423 363T410 376Q396 380 369 380H356V442L554 450V267Q554 84 556 79Q561 62 610 62H623V31Q623 0 622 0Q603 0 527 -3T432 -6Q431 -6 431 25V56L420 45Q373 6 332 -1Q313 -6 281 -6Q208 -6 165 14T109 87L107 98L106 230Q106 358 104 366Q96 380 50 380H37V442H40'], - - // LATIN SMALL LETTER V - 0x76: [444,4,607,26,580,'401 444Q413 441 495 441Q568 441 574 444H580V382H510L409 156Q348 18 339 6Q331 -4 320 -4Q318 -4 313 -4T303 -3H288Q273 -3 264 12T221 102Q206 135 197 156L96 382H26V444H34Q49 441 145 441Q252 441 270 444H279V382H231L284 264Q335 149 338 149Q338 150 389 264T442 381Q442 382 418 382H394V444H401'], - - // LATIN SMALL LETTER W - 0x77: [444,4,831,25,805,'624 444Q636 441 722 441Q797 441 800 444H805V382H741L593 11Q592 10 590 8T586 4T584 2T581 0T579 -2T575 -3T571 -3T567 -4T561 -4T553 -4H542Q525 -4 518 6T490 70Q474 110 463 137L415 257L367 137Q357 111 341 72Q320 17 313 7T289 -4H277Q259 -4 253 -2T238 11L90 382H25V444H32Q47 441 140 441Q243 441 261 444H270V382H222L310 164L382 342L366 382H303V444H310Q322 441 407 441Q508 441 523 444H531V382H506Q481 382 481 380Q482 376 529 259T577 142L674 382H617V444H624'], - - // LATIN SMALL LETTER X - 0x78: [444,0,607,21,586,'227 0Q212 3 121 3Q40 3 28 0H21V62H117L245 213L109 382H26V444H34Q49 441 143 441Q247 441 265 444H274V382H246L281 339Q315 297 316 297Q320 297 354 341L389 382H352V444H360Q375 441 466 441Q547 441 559 444H566V382H471L355 246L504 63L545 62H586V0H578Q563 3 469 3Q365 3 347 0H338V62H366Q366 63 326 112T285 163L198 63L217 62H235V0H227'], - - // LATIN SMALL LETTER Y - 0x79: [444,200,607,23,580,'84 -102Q84 -110 87 -119T102 -138T133 -149Q148 -148 162 -143T186 -131T206 -114T222 -95T234 -76T243 -59T249 -45T252 -37L269 0L96 382H26V444H34Q49 441 146 441Q252 441 270 444H279V382H255Q232 382 232 380L337 151L442 382H394V444H401Q413 441 495 441Q568 441 574 444H580V382H510L406 152Q298 -84 297 -87Q269 -139 225 -169T131 -200Q85 -200 54 -172T23 -100Q23 -64 44 -50T87 -35Q111 -35 130 -50T152 -92V-100H84V-102'], - - // LATIN SMALL LETTER Z - 0x7A: [445,0,511,32,462,'48 262Q48 264 54 349T60 436V444H252Q289 444 336 444T394 445Q441 445 450 441T459 418Q459 406 458 404Q456 399 327 229T194 55H237Q260 56 268 56T297 58T325 65T348 77T370 98T384 128T395 170Q400 197 400 216Q400 217 431 217H462V211Q461 208 453 108T444 6V0H245Q46 0 43 2Q32 7 32 28V33Q32 41 40 52T84 112Q129 170 164 217L298 393H256Q189 392 165 380Q124 360 115 303Q110 280 110 256Q110 254 79 254H48V262'], - - // LEFT CURLY BRACKET - 0x7B: [750,250,575,69,505,'504 -207T504 -225T500 -246T476 -250H469Q257 -250 227 -145L225 -135L224 0Q224 15 224 30T224 59T224 84T224 106T223 122T223 133V137Q222 138 221 144T213 162T195 185Q171 206 141 215Q123 222 107 223T84 225T74 229T70 250T73 270T83 276T106 276T141 285Q171 294 195 315Q201 321 206 328T214 341T219 352T222 360L223 363V367Q223 371 223 378T223 394T224 415T224 441T224 470T224 501L225 636Q249 739 426 749Q428 749 443 749T466 750H473Q495 750 499 747T504 725T501 704T480 699Q381 693 357 645Q352 634 351 617T350 497V412Q350 350 338 329Q325 303 298 284T251 258T227 251Q226 251 226 250L227 249Q231 248 238 246T265 236T299 217T329 184T349 137Q350 131 350 3T352 -130Q358 -160 392 -178T480 -199Q497 -200 500 -203'], - - // VERTICAL LINE - 0x7C: [750,249,319,129,190,'160 -249Q138 -249 129 -225V250Q129 725 131 729Q139 750 159 750T190 725V-225Q181 -249 160 -249'], - - // RIGHT CURLY BRACKET - 0x7D: [750,250,575,70,505,'70 726Q71 744 74 747T99 750H106Q323 750 349 636L350 501Q350 486 350 470T350 441T350 416T350 394T351 378T351 367V363Q352 362 353 356T361 338T379 315Q403 294 433 285Q451 278 467 277T490 275T500 271T504 250T501 230T491 224T468 224T433 215Q403 206 379 185Q373 179 368 172T360 159T355 148T352 140L351 137V133Q351 129 351 122T351 106T350 85T350 59T350 31T350 0L349 -135L347 -145Q317 -250 106 -250H99Q79 -250 75 -247T70 -226Q70 -208 73 -204T95 -199Q193 -193 217 -145Q222 -134 223 -117T224 3Q224 20 224 48T223 86Q223 145 237 175T301 232Q335 249 347 249Q348 249 348 250L347 251Q343 252 336 254T309 264T275 284T245 316T225 363Q224 369 224 497T222 631Q216 660 182 678T95 699Q77 700 74 704T70 726'] -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MathOperators.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MathOperators.js deleted file mode 100644 index ed69c3d229..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MathOperators.js +++ /dev/null @@ -1,230 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/MathOperators.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // FOR ALL - 0x2200: [694,16,639,0,640,'1 664Q-2 685 23 693H27Q46 693 54 680T102 578L148 475H492L533 570Q541 586 548 603T560 630T569 650T576 667T582 678T588 686T594 691T600 693T609 694Q622 694 631 684T639 662Q637 653 492 325T341 -8Q333 -16 320 -16Q306 -16 298 -8Q294 -4 147 326L1 656V664ZM464 414H319Q175 414 175 413L319 88L464 414'], - - // PARTIAL DIFFERENTIAL - 0x2202: [710,17,628,60,657,'230 475Q202 475 189 492T175 526T186 570T221 631T288 687T389 710Q430 710 438 709Q495 701 537 679T601 629T637 568T653 509T657 459Q657 409 640 341Q617 248 581 180T507 75T424 16T348 -11T282 -17Q171 -17 113 37Q60 88 60 159Q60 192 71 231Q96 336 184 402Q264 462 366 462Q407 462 439 448T497 389L502 380Q503 381 508 403T519 463T525 531Q523 580 499 610T447 648T387 657Q324 657 283 616Q271 604 276 604Q279 604 286 600T302 583T311 555Q311 523 287 499T230 475ZM196 110Q196 41 287 41Q351 41 398 88Q422 111 437 151Q473 243 473 298Q473 386 409 409Q408 409 383 411Q316 411 278 373Q265 360 259 351T241 311T217 226Q196 143 196 110'], - - // THERE EXISTS - 0x2203: [694,-1,639,64,574,'81 347Q81 359 84 363T104 378H513V633H300L87 634Q64 642 64 664Q64 685 84 692Q89 694 321 694H552Q571 681 574 669V25Q567 7 552 1H87Q64 12 64 30T87 61H513V317H308Q103 317 99 319Q81 328 81 347'], - - // EMPTY SET - 0x2205: [767,73,575,46,528,'285 711Q307 711 326 708T357 701T370 698Q371 698 375 710T383 735T389 750Q395 767 415 767Q431 767 438 757T446 738T436 701T426 670Q426 668 433 664Q468 633 489 588Q511 542 519 488T528 344Q528 286 524 243T508 150T466 63T394 6Q345 -17 287 -17Q265 -17 246 -14T216 -7T203 -4Q191 -47 183 -60T159 -73Q146 -73 137 -63T128 -44Q128 -38 138 -7L148 24L141 30Q134 35 120 49Q94 77 78 113T56 194T48 268T46 344Q46 388 47 416T56 494T78 577T122 644T194 694Q239 711 285 711ZM351 639Q350 639 346 642T337 648T325 654T306 658T283 660Q254 660 221 638T181 567Q171 513 171 375Q171 164 182 129L351 639ZM402 356Q402 516 395 555Q395 557 395 559T394 563T394 566L393 568L223 57Q252 34 286 34H288Q318 34 346 53T387 109Q402 152 402 329V356'], - - // INCREMENT - 0x2206: [698,0,958,56,901,''], - - // NABLA - 0x2207: [686,24,958,56,901,'56 673Q56 679 65 686H892Q901 679 901 673Q901 668 714 331T521 -15Q518 -18 506 -24H452Q440 -19 436 -15Q431 -8 337 162T150 501L57 669Q57 670 56 672V673ZM528 136L758 553H297Q298 551 414 341L528 136'], - - // ELEMENT OF - 0x2208: [587,86,767,97,671,'97 251Q97 393 194 484T417 586Q418 586 436 586T482 586T538 587H648Q649 586 652 584T658 580T664 575T668 568T670 557Q670 536 648 527L534 526Q515 526 491 526T457 526T435 526T417 525T404 523T390 521T374 517Q298 498 243 447T167 324Q159 295 159 283Q159 281 403 281H648Q649 280 652 278T658 274T664 269T668 262T670 251Q670 230 648 221L403 220Q159 220 159 218Q159 206 166 182T190 122T247 50T341 -6Q380 -20 405 -22T534 -25H648Q649 -26 654 -29T661 -34T667 -43T670 -56Q670 -74 648 -85L541 -86Q419 -86 396 -82Q276 -65 187 24T97 251'], - - // stix-negated (vert) set membership, variant - 0x2209: [711,210,767,97,671,'126 -210Q116 -210 107 -203T97 -179Q97 -171 99 -166Q99 -165 111 -145T150 -80T203 8Q97 104 97 251Q97 393 194 484T417 586Q418 586 436 586T482 586T538 587H549Q565 614 582 643T608 685L616 698Q623 711 641 711Q651 711 660 704T670 681Q670 672 667 667Q666 666 661 657T644 627T620 587H648Q649 586 652 584T658 580T664 575T668 568T670 557Q670 536 648 527L584 526L437 281H648Q649 280 652 278T658 274T664 269T668 262T670 251Q670 230 648 221L403 220H401L283 23Q311 5 341 -6Q380 -20 405 -22T534 -25H648Q649 -26 654 -29T661 -34T667 -43T670 -56Q670 -74 648 -85L541 -86Q419 -86 396 -82Q320 -71 252 -29Q152 -197 148 -201Q139 -210 126 -210ZM235 62L330 220Q159 219 159 218Q159 196 176 150T235 62ZM366 281L513 526Q503 526 487 526T465 526T448 525T433 525T422 525T412 524T403 523T394 521T385 519T374 517Q298 498 243 447T167 324Q159 295 159 283Q159 281 366 281'], - - // CONTAINS AS MEMBER - 0x220B: [588,86,767,96,670,'96 251Q96 268 119 281H363Q607 281 607 283Q607 295 600 319T576 379T519 451T425 507Q386 521 361 523T233 526L119 527Q96 535 96 557Q96 578 116 585Q121 587 229 587Q238 587 257 587T288 588Q366 588 435 568T568 488Q670 388 670 251Q670 155 621 78T499 -39T345 -85Q336 -86 225 -86L119 -85Q96 -77 96 -55Q96 -38 119 -25H233Q356 -24 371 -21Q373 -21 393 -16Q468 3 523 55T599 177Q607 206 607 218Q607 220 363 220L119 221Q96 229 96 251'], - - // MINUS SIGN - 0x2212: [281,-221,894,96,797,'119 221Q96 230 96 251T116 279Q121 281 448 281H775Q776 280 779 278T785 274T791 269T795 262T797 251Q797 230 775 221H119'], - - // MINUS-OR-PLUS SIGN - 0x2213: [537,227,894,64,829,'64 155Q64 172 87 185H416V476H251L87 477Q64 485 64 507Q64 528 84 535Q89 537 448 537H807Q808 536 811 534T817 530T823 525T827 518T829 507Q829 486 807 477L642 476H477V185H807Q808 184 811 182T817 178T823 173T827 166T829 155Q829 134 807 125L642 124H477V-39Q477 -203 475 -208Q466 -227 446 -227Q427 -227 417 -205L416 -41V124H251L87 125Q64 133 64 155'], - - // DIVISION SLASH - 0x2215: [750,250,575,64,510,'451 730Q460 750 479 750Q492 750 501 740T510 718Q508 708 318 244L122 -232Q112 -250 95 -250Q82 -250 73 -241T64 -218Q66 -205 258 261T451 730'], - - // SET MINUS - 0x2216: [750,250,575,63,511,'64 718Q63 731 72 740T94 750Q106 750 113 743Q118 741 122 732L318 256Q508 -208 510 -218Q511 -231 502 -240T480 -250Q460 -250 451 -230Q451 -229 259 238T64 718'], - - // ASTERISK OPERATOR - 0x2217: [473,-28,575,72,502,'236 431Q237 447 251 459T287 472T323 459T338 431Q338 423 328 363L317 300Q318 300 340 317T392 356T435 387Q442 390 450 390Q470 390 485 374T501 335Q501 326 500 320T494 309T486 300T473 293T458 287T438 280T414 272L353 250L414 228Q422 225 436 221T457 214T472 208T485 201T493 192T499 181T501 166Q501 141 484 126T450 111Q447 111 445 111T441 111T437 112T433 114T428 117T422 121T414 127T404 135T391 145T374 158L317 200L328 137Q338 77 338 69Q336 52 321 40T287 28T253 40T236 69Q236 77 246 137L257 200Q256 200 234 183T182 144T139 113Q132 110 124 110Q104 110 89 126T73 165Q73 174 74 180T80 191T88 200T101 207T116 213T136 220T160 228L221 250L160 272Q152 275 138 279T117 286T102 292T89 299T81 308T75 319T73 334Q73 359 90 374T124 389Q127 389 129 389T133 389T137 388T141 386T146 383T152 379T160 373T170 365T183 355T200 342L257 300L246 363Q236 423 236 431'], - - // RING OPERATOR - 0x2218: [475,-27,575,64,510,'64 251Q64 303 80 344T121 409T175 448T230 469T275 474Q277 474 283 474T292 473Q385 473 447 415T510 251Q510 149 449 89T287 28T126 88T64 251ZM448 251Q448 325 405 369T286 413Q215 413 171 371T126 251Q126 177 168 133T287 89Q361 89 404 132T448 251'], - - // BULLET OPERATOR - 0x2219: [475,-27,575,64,510,'64 251Q64 303 80 344T121 409T175 448T230 469T275 474Q277 474 283 474T292 473Q385 473 447 415T510 251Q510 149 449 89T287 28T126 88T64 251'], - - // SQUARE ROOT - 0x221A: [820,180,958,78,988,'107 178Q100 178 89 188T78 207Q78 216 84 220Q85 221 124 248T207 304T260 338Q269 340 275 335Q276 334 370 156L463 -20L698 393Q928 800 935 811Q944 820 954 820Q972 820 980 811T988 789Q988 781 858 553Q776 409 718 306Q452 -166 447 -171Q439 -179 422 -180Q405 -180 400 -175Q399 -174 346 -73T241 128T187 229L151 205Q111 178 107 178'], - - // PROPORTIONAL TO - 0x221D: [451,8,894,65,830,'65 222Q65 282 88 329T144 401T208 438T261 451H273Q312 451 320 450Q456 431 526 330L537 316Q638 451 778 451Q813 451 830 445V388Q821 391 799 391Q758 391 721 377T660 342T618 301T592 266L584 251Q648 152 697 114Q748 74 804 74H806Q823 74 829 77Q830 77 830 38V-1L820 -3Q801 -7 786 -7H771Q699 -7 632 25T527 114L516 128Q414 -8 276 -8Q192 -8 129 56T65 222ZM256 53Q296 53 332 67T392 102T434 143T461 178L469 193Q405 292 356 330Q308 369 251 369H243Q196 369 156 328T116 221Q116 191 124 161T158 99T225 55Q234 53 256 53'], - - // INFINITY - 0x221E: [452,8,1150,65,1084,'65 219Q65 318 132 385T302 452Q473 452 573 331L589 312L596 320Q710 452 857 452Q948 452 1016 386T1084 225Q1084 125 1017 59T848 -8Q679 -8 576 113L560 132L553 124Q439 -8 292 -8Q200 -8 133 58T65 219ZM1033 224Q1033 291 987 340T875 389Q748 389 648 261Q641 253 642 251Q717 163 748 137Q813 81 880 81Q941 81 987 120T1033 224ZM275 56Q315 56 353 70T418 104T466 144T497 178L507 192Q507 193 474 230T441 269Q355 362 267 362Q210 362 163 324T116 221Q116 150 162 103T275 56'], - - // ANGLE - 0x2220: [714,0,722,55,676,'71 0L68 2Q65 3 63 5T58 11T55 20Q55 21 56 23V25Q55 27 55 30Q55 31 56 33V35Q55 37 55 40Q55 42 57 48Q67 63 346 381Q421 467 518 578Q607 680 623 697T647 714Q656 714 661 708T666 694V692Q676 687 676 674Q676 668 673 663Q672 662 637 622T534 503T400 350L147 61L386 60H653Q666 50 666 40V38Q676 31 676 20Q676 8 661 0H71'], - - // DIVIDES - 0x2223: [750,249,319,129,190,'160 -249Q138 -249 129 -225V250Q129 725 131 729Q139 750 159 750T190 725V-225Q181 -249 160 -249'], - - // PARALLEL TO - 0x2225: [751,248,575,145,430,'205 -225Q201 -234 199 -237T191 -244T175 -248T161 -246Q151 -240 146 -229Q145 -224 145 251Q145 725 146 730Q156 750 176 750Q193 748 205 727V-225ZM369 727L372 732Q375 737 377 740T385 747T398 750Q406 750 413 747Q423 740 428 730Q430 720 430 251Q430 -219 428 -229Q423 -240 413 -246Q408 -248 400 -248Q393 -248 388 -247T379 -242T375 -236T371 -230L369 -225V727'], - - // LOGICAL AND - 0x2227: [604,17,767,64,702,'95 -16Q78 -16 71 -6T64 14Q64 20 65 22L212 308Q359 593 361 595Q370 604 385 604Q398 602 405 595Q407 593 554 308L701 22Q702 20 702 15Q702 1 693 -8T671 -17Q661 -17 651 -9Q647 -5 515 251L383 506L251 251Q119 -5 116 -8Q108 -16 95 -16'], - - // LOGICAL OR - 0x2228: [605,16,767,64,702,'64 572Q64 585 72 594T94 604T116 595Q119 592 251 336L383 81L515 336Q647 592 651 596Q661 604 671 604Q684 604 693 595T702 572Q702 567 701 565L554 279Q407 -6 405 -8Q404 -9 401 -11T397 -14Q392 -16 383 -16H380Q369 -16 361 -8Q359 -6 212 279L65 565Q65 566 65 568T64 572'], - - // stix-intersection, serifs - 0x2229: [603,16,767,64,702,'94 -16Q73 -16 64 8V209Q64 239 64 287Q65 418 69 432Q70 434 70 435Q84 487 125 523T216 575T299 597T354 603H372Q444 603 501 590T591 558T648 515T681 471T696 435Q696 434 697 432Q701 417 702 309Q702 303 702 287Q702 239 702 209V8Q693 -16 672 -16Q650 -16 643 3Q641 8 641 201Q641 397 640 403Q631 472 558 507T383 542Q339 542 298 535T219 511T156 468T126 403Q125 397 125 201Q125 8 123 3Q116 -16 94 -16'], - - // stix-union, serifs - 0x222A: [604,16,767,64,702,'672 603Q693 603 702 579V378Q702 348 702 300Q701 169 697 155Q696 153 696 152Q676 78 593 31T383 -16Q265 -16 179 28T70 152Q70 153 69 155Q65 170 64 278Q64 285 64 300Q64 348 64 378Q64 579 65 583Q74 604 94 604T123 584Q125 579 125 386Q125 190 126 184Q135 115 210 80T383 44Q426 44 467 51T546 75T609 119T640 184Q641 190 641 386Q641 579 643 584Q650 603 672 603'], - - // INTEGRAL - 0x222B: [711,211,569,64,632,'204 -71Q204 -108 181 -124T137 -141Q132 -141 132 -142Q142 -161 154 -161Q164 -161 186 -152Q200 -145 210 -135T228 -107T241 -77T249 -38T254 -2T258 38T262 74Q282 265 334 489Q334 490 337 503T341 523T347 544T355 569T365 594T379 620T397 643T420 666T447 685T481 700Q511 711 539 711T587 696T616 656T628 612T632 573Q632 536 610 519T562 501Q534 501 513 519T492 571Q492 608 515 624T559 641Q564 641 564 642Q554 661 542 661Q532 661 510 652Q496 645 486 635T468 607T455 577T447 538T442 502T438 462T434 426Q414 235 362 11Q352 -35 347 -54T328 -101T291 -152Q235 -208 162 -211Q147 -211 136 -208T109 -196T83 -165T67 -108Q64 -94 64 -73Q64 -37 86 -19T134 -1Q162 -1 183 -19T204 -71'], - - // TILDE OPERATOR - 0x223C: [392,-109,894,64,828,'64 155Q64 210 84 262T150 353T257 391Q300 391 341 371T417 321T484 264T557 215T637 194Q702 194 745 244T788 367Q796 391 808 391Q815 391 821 381T828 353V342Q828 252 776 181T637 109Q594 109 552 129T476 179T409 236T336 285T256 306Q193 306 149 258T105 132Q98 109 86 109Q76 109 70 122T64 155'], - - // WREATH PRODUCT - 0x2240: [583,82,319,64,254,'64 561Q64 570 76 576T108 583Q174 583 214 535T254 407Q254 368 238 324T202 248T166 173T149 92Q149 43 169 2T217 -39Q231 -40 242 -46T254 -60Q254 -69 241 -75T210 -82Q145 -82 105 -34T64 93Q64 133 80 177T116 253T152 328T169 408Q169 461 148 500T105 540Q92 540 78 545T64 561'], - - // ASYMPTOTICALLY EQUAL TO - 0x2243: [502,3,894,64,829,'64 295Q64 378 117 440T257 502Q298 502 339 485T416 443T486 394T560 352T637 335Q693 335 740 373T788 478Q796 502 808 502Q815 502 821 492T828 465V455Q828 365 771 308T640 250Q603 250 562 265T501 294T439 336L370 382Q308 417 256 417Q205 417 164 388T110 317Q110 316 109 304T107 286T103 270T97 255T86 250Q76 250 70 263T64 295ZM64 6T64 27T87 56H93Q99 56 110 56T137 56T173 56T217 56T267 57T323 57T383 57T448 57H807Q808 56 811 54T815 52T819 49T823 45T826 40T828 34T829 27Q829 7 807 -3H87Q64 6 64 27'], - - // APPROXIMATELY EQUAL TO - 0x2245: [639,27,1000,64,829,'64 402Q64 457 84 509T150 600T257 638Q300 638 341 618T417 569T484 511T557 462T637 441Q702 441 745 491T788 614Q796 638 808 638Q815 638 821 628T828 600V589Q828 499 776 428T637 356Q594 356 552 376T476 425T409 483T336 532T256 553Q193 553 149 505T105 379Q98 356 86 356Q76 356 70 369T64 402ZM87 197Q64 207 64 226Q64 247 84 255Q89 257 448 257H807Q808 256 811 254T817 250T823 245T827 238T829 227Q829 209 807 197H87ZM87 -27Q64 -18 64 3Q64 23 86 32Q89 33 448 33H807L812 30Q816 27 818 26T823 21T827 13T829 3Q829 -18 807 -27H87'], - - // ALMOST EQUAL TO - 0x2248: [524,-31,894,64,829,'64 345Q64 423 119 473T250 524Q301 524 356 503T451 455T542 407T636 385Q700 385 743 417T786 481Q786 493 791 508T807 524Q817 524 823 512T829 479Q829 404 776 352T638 300Q590 300 537 321T443 369T352 417T256 439Q207 439 166 417T110 359Q109 357 107 341T100 312T85 300Q77 300 71 313T64 345ZM64 77Q64 155 119 205T250 256Q302 256 357 235T451 187T541 139T636 117Q699 117 742 148T786 213Q786 231 792 243T808 256T823 242T829 208Q829 134 776 83T640 32Q591 32 537 53T443 101T352 149T256 171Q206 171 165 148T110 91Q109 89 107 73T100 44T85 32Q77 32 71 45T64 77'], - - // EQUIVALENT TO - 0x224D: [533,32,894,64,830,'798 533Q812 533 820 524T829 502T819 480T769 440Q655 355 537 330Q492 322 447 322Q401 322 356 330Q289 344 219 381T118 443T73 481Q64 490 64 503Q64 517 72 525T94 533Q99 533 102 532Q107 531 138 507T209 456T314 405T446 382Q604 382 765 515Q788 533 798 533ZM95 -32Q81 -32 73 -23T64 -1Q64 10 74 21T124 61Q213 127 293 153T421 179L422 180Q424 180 426 180T432 180T441 180T452 179Q612 179 769 61Q811 29 820 19T829 -1Q829 -14 821 -23T798 -32Q788 -32 765 -14Q608 118 446 118Q287 118 128 -14Q105 -32 95 -32'], - - // APPROACHES THE LIMIT - 0x2250: [721,-109,894,64,829,'87 333Q64 343 64 362Q64 383 84 391Q89 393 448 393H807Q808 392 811 390T817 386T823 381T827 374T829 363Q829 345 807 333H87ZM87 109Q64 118 64 139Q64 159 86 168Q89 169 448 169H807L812 166Q816 163 818 162T823 157T827 149T829 139Q829 118 807 109H87ZM362 635Q362 671 387 696T444 721Q488 721 510 693T533 635Q533 606 512 579T448 551Q406 551 384 577T362 635'], - - // stix-not (vert) equals - 0x2260: [711,210,894,64,829,'189 -210Q179 -210 170 -203T160 -179Q160 -171 162 -166Q165 -163 327 109H87Q64 118 64 139Q64 159 86 168Q89 169 363 169L461 333H87Q64 343 64 362Q64 383 84 391Q89 393 448 393H496Q533 455 583 539T656 660T679 698Q686 711 704 711Q714 711 723 704T733 681Q733 672 730 667Q729 664 709 631T645 523T567 393H807Q808 392 811 390T817 386T823 381T827 374T829 363Q829 345 807 333H532L433 169H807L812 166Q816 163 818 162T823 157T827 149T829 139Q829 118 807 109H398Q217 -195 211 -201Q202 -210 189 -210'], - - // IDENTICAL TO - 0x2261: [505,3,894,64,829,'87 445Q64 454 64 475Q64 497 84 503Q89 505 448 505H807Q808 504 812 502T818 497T823 492T827 484T829 474Q829 456 807 445H87ZM87 221Q64 230 64 251T84 279Q89 281 448 281H807Q808 280 811 278T817 274T823 269T827 262T829 251Q829 230 807 221H87ZM64 6T64 27T87 56H93Q99 56 110 56T137 56T173 56T217 56T267 57T323 57T383 57T448 57H807Q808 56 811 54T815 52T819 49T823 45T826 40T828 34T829 27Q829 7 807 -3H87Q64 6 64 27'], - - // LESS-THAN OR EQUAL TO - 0x2264: [697,199,894,96,797,'797 55Q797 45 790 35T767 25H759L434 180Q108 336 105 339Q96 348 96 360Q96 378 114 388Q126 394 439 544T757 695Q763 697 766 697Q780 697 788 688T797 666Q797 654 788 645Q784 641 507 509T197 361L466 232Q785 80 790 74Q797 66 797 55ZM119 -199Q96 -191 96 -169Q96 -160 102 -152T119 -140H124Q130 -140 140 -140T164 -140T197 -140T237 -140T283 -139T334 -139T389 -139T448 -139H775Q797 -153 797 -169Q797 -187 775 -199H119'], - - // GREATER-THAN OR EQUAL TO - 0x2265: [697,199,894,96,797,'127 25Q110 25 103 34T96 54Q96 66 105 75Q109 80 439 238L696 361Q113 637 105 645Q96 654 96 667Q96 679 104 688T128 697Q137 696 460 541T788 382Q797 373 797 360Q797 348 788 339Q785 336 459 180L135 25H127ZM119 -199Q96 -191 96 -169Q96 -160 102 -152T119 -140H124Q130 -140 140 -140T164 -140T197 -140T237 -140T283 -139T334 -139T389 -139T448 -139H775Q797 -153 797 -169Q797 -187 775 -199H119'], - - // MUCH LESS-THAN - 0x226A: [617,116,1150,64,1085,'734 -74T734 -86T727 -107T704 -116H702Q694 -116 584 -55Q473 7 380 58Q87 219 73 229Q64 238 64 250Q64 263 73 272Q87 282 380 443Q695 616 699 617H700Q718 617 726 607T734 588Q734 568 717 560Q705 554 435 404L157 250L439 94Q721 -61 726 -66Q734 -74 734 -86ZM1085 -74T1085 -86T1078 -107T1055 -116H1053Q1045 -116 935 -55Q824 7 731 58Q438 219 424 229Q415 238 415 250Q415 263 424 272Q438 282 731 443Q1046 616 1050 617H1051Q1069 617 1077 607T1085 588Q1085 568 1068 560Q1056 554 786 404L508 250L790 94Q1072 -61 1077 -66Q1085 -74 1085 -86'], - - // MUCH GREATER-THAN - 0x226B: [618,116,1150,64,1085,'64 588Q64 600 72 609T94 618H95Q103 618 209 559Q322 496 419 443Q712 282 725 272Q734 263 734 250Q734 238 725 229Q714 220 415 55T110 -113Q103 -116 95 -116Q78 -116 71 -106T64 -86Q64 -74 72 -66Q77 -61 359 94L641 250L363 404Q277 452 173 509Q95 552 82 560T66 576V577Q64 585 64 588ZM415 588Q415 600 423 609T445 618H446Q454 618 560 559Q673 496 770 443Q1063 282 1076 272Q1085 263 1085 250Q1085 238 1076 229Q1065 220 766 55T461 -113Q454 -116 446 -116Q429 -116 422 -106T415 -86Q415 -74 423 -66Q428 -61 710 94L992 250L714 404Q628 452 524 509Q446 552 433 560T417 576V577Q415 585 415 588'], - - // PRECEDES - 0x227A: [585,86,894,96,797,'797 -57Q797 -65 790 -75T766 -86Q748 -86 741 -74T733 -43T719 8T681 72Q647 112 588 141T475 185T343 207T230 216T136 219Q96 219 96 250Q96 280 132 280H136Q193 281 239 283T347 292T457 310T556 342T643 391T703 460T735 553Q741 585 763 585Q781 585 789 575T797 556Q797 540 792 513T758 434T682 345Q605 285 481 254L462 249Q483 246 526 233T633 185T733 104Q767 63 782 15T797 -57'], - - // SUCCEEDS - 0x227B: [586,86,894,96,797,'96 556Q96 568 104 577T126 586Q152 586 158 553Q164 503 188 462T247 394T331 345T429 313T539 294T649 284T758 280H760Q797 280 797 250Q797 219 760 219H758Q627 217 529 204T347 160T216 77T158 -54Q152 -86 126 -86Q110 -86 103 -76T96 -57Q96 -41 101 -14T135 65T211 154Q288 214 412 245L431 250Q410 252 367 265T259 314T160 395Q127 435 112 483T96 556'], - - // SUBSET OF - 0x2282: [588,85,894,96,798,'96 251Q96 389 191 482T417 586Q418 586 428 586T456 586T496 586T546 587T601 587H775Q776 586 779 584T785 580T791 575T795 568T797 557Q797 536 775 527L597 526Q411 525 395 522Q390 521 370 516Q285 494 222 424T158 251Q158 131 246 53Q313 -9 408 -23Q417 -24 597 -25H775Q776 -26 781 -29T788 -34T794 -43T797 -56Q797 -74 775 -85H493Q407 -85 376 -79Q257 -55 177 35T96 251'], - - // SUPERSET OF - 0x2283: [587,86,894,96,796,'96 -55Q96 -38 119 -25H296Q482 -24 498 -21Q503 -20 523 -15Q609 7 672 77T735 251T665 431T485 524Q476 525 296 526L119 527Q96 535 96 557Q96 578 116 585Q121 587 300 587Q451 586 476 585T522 579Q632 556 714 468T796 251Q796 112 695 13Q612 -65 497 -82Q473 -86 289 -86L119 -85Q96 -77 96 -55'], - - // SUBSET OF OR EQUAL TO - 0x2286: [698,199,894,96,798,'96 361Q96 499 191 592T417 696Q418 696 428 696T456 696T496 696T546 697T601 697H775Q776 696 779 694T785 690T791 685T795 678T797 667Q797 646 775 637L597 636Q411 635 395 632Q390 631 370 626Q285 604 222 534T158 361Q158 241 246 163Q313 101 408 87Q417 86 597 85H775Q776 84 781 81T788 76T794 67T797 54Q797 36 775 25H493Q407 25 376 31Q257 55 177 145T96 361ZM149 -199Q127 -191 127 -169T149 -140H154Q160 -140 169 -140T192 -140T224 -140T262 -140T306 -139T354 -139T407 -139T463 -139H775Q776 -140 779 -142T785 -146T791 -151T795 -158T797 -169Q797 -190 775 -199H149'], - - // SUPERSET OF OR EQUAL TO - 0x2287: [697,199,894,96,796,'96 55Q96 72 119 85H296Q482 86 498 89Q503 90 523 95Q609 117 672 187T735 361T665 541T485 634Q476 635 296 636L119 637Q96 645 96 667Q96 688 116 695Q121 697 300 697Q451 696 476 695T522 689Q632 666 714 578T796 361Q796 222 695 123Q612 45 497 28Q473 24 289 24L119 25Q96 33 96 55ZM119 -199Q96 -190 96 -169T116 -141Q121 -139 433 -139H745Q766 -152 766 -170Q766 -190 745 -199H119'], - - // MULTISET UNION - 0x228E: [604,16,767,64,702,'672 603Q693 603 702 579V378Q702 348 702 300Q701 169 697 155Q696 153 696 152Q676 78 593 31T383 -16Q265 -16 179 28T70 152Q70 153 69 155Q65 170 64 278Q64 285 64 300Q64 348 64 378Q64 579 65 583Q74 604 94 604T123 584Q125 579 125 386Q125 190 126 184Q135 115 210 80T383 44Q426 44 467 51T546 75T609 119T640 184Q641 190 641 386Q641 579 643 584Q650 603 672 603ZM353 412Q353 420 353 435T352 456Q352 483 358 495T385 507Q403 506 409 494T415 457Q415 451 415 436T414 411V341H558Q579 329 579 311Q579 289 558 281L486 280H414V136Q400 114 384 114Q363 114 354 136L353 208V280H281L209 281Q187 289 187 310Q187 328 209 341H353V412'], - - // SQUARE IMAGE OF OR EQUAL TO - 0x2291: [698,199,894,96,828,'127 25Q111 29 104 49V362L105 675Q114 693 127 696H132Q138 696 149 696T174 696T208 696T249 696T297 697T350 697T407 697T468 697H806Q828 683 828 666Q828 646 806 637L485 636H165V85H805Q806 84 809 82T813 80T817 77T821 73T824 68T826 62T827 55Q827 34 806 25H127ZM96 -190T96 -169T119 -140H125Q131 -140 141 -140T167 -140T201 -140T242 -140T290 -139T344 -139T402 -139T463 -139H805Q806 -140 809 -142T813 -144T817 -147T821 -151T824 -156T826 -162T827 -169Q827 -190 806 -199H119Q96 -190 96 -169'], - - // SQUARE ORIGINAL OF OR EQUAL TO - 0x2292: [698,199,894,66,797,'66 55Q66 74 89 85H728V636H408L88 637Q66 645 66 667T88 696H94Q99 696 110 696T135 696T169 696T210 696T258 697T311 697T368 697T429 697H767Q786 684 789 672V49Q782 31 767 25H88Q66 32 66 55ZM88 -199Q66 -191 66 -169Q66 -148 87 -140Q91 -139 433 -139H775Q776 -140 779 -142T783 -144T787 -147T791 -151T794 -156T796 -162T797 -169Q797 -189 775 -199H88'], - - // stix-square intersection, serifs - 0x2293: [604,-1,767,70,696,'131 25Q121 1 100 1Q81 1 71 23L70 301Q70 579 72 583Q77 598 90 602Q95 604 385 604H674Q693 591 696 579V25Q686 1 665 1Q646 1 636 23L635 283V543H131V25'], - - // stix-square union, serifs - 0x2294: [604,-1,767,70,696,'696 25Q689 7 674 1H93Q77 7 71 23L70 301Q70 579 72 583Q80 604 100 604T131 579V61H635V579Q644 603 666 603Q687 603 696 579V25'], - - // stix-circled plus (with rim) - 0x2295: [632,132,894,64,828,'64 250Q64 350 98 426T189 546T307 610T434 632Q485 632 496 631Q572 621 635 592Q669 575 699 550T760 484T809 384T828 250Q828 77 725 -27T446 -132Q272 -132 168 -27T64 250ZM416 282V570H414Q341 564 285 535T202 475T156 397T134 332T128 287Q127 283 127 282H416ZM765 288Q760 344 743 389T700 462T647 512T589 543T538 560T499 568L483 570H478V282H766L765 288ZM416 -69V220H127Q130 195 131 189T138 155T150 115T168 76T196 35T234 0T286 -35Q337 -61 410 -69H416ZM483 -69Q554 -60 607 -33T687 21T733 93T756 156T764 209Q766 217 766 220H478V-69H483'], - - // CIRCLED MINUS - 0x2296: [632,132,894,64,828,'64 250Q64 350 98 426T189 546T307 610T434 632Q485 632 496 631Q572 621 635 592Q669 575 699 550T760 484T809 384T828 250Q828 77 725 -27T446 -132Q272 -132 168 -27T64 250ZM765 288Q753 424 666 497T446 571T227 498T128 288L127 282H766L765 288ZM446 -70Q578 -70 666 4T765 213L766 220H127Q130 195 131 189T138 155T150 115T168 76T196 35T234 0T286 -35Q353 -70 446 -70'], - - // stix-circled times (with rim) - 0x2297: [632,132,894,64,828,'64 250Q64 350 98 426T189 546T307 610T434 632Q485 632 496 631Q572 621 635 592Q669 575 699 550T760 484T809 384T828 250Q828 77 725 -27T446 -132Q272 -132 168 -27T64 250ZM647 512Q567 571 447 571Q340 571 262 523Q237 507 237 505L342 399L447 295L657 505L647 512ZM298 356L192 461Q180 445 161 411Q126 341 126 251Q126 128 192 40L403 250L298 356ZM701 41Q704 41 719 63T750 138T767 250Q767 310 750 362T719 437T701 460L491 250L701 41ZM238 -5Q238 -8 261 -22T336 -53T447 -70Q567 -70 647 -11L657 -4L447 206L342 101Q238 -1 238 -5'], - - // CIRCLED DIVISION SLASH - 0x2298: [632,132,894,64,828,'64 250Q64 350 98 426T189 546T307 610T434 632Q485 632 496 631Q572 621 635 592Q669 575 699 550T760 484T809 384T828 250Q828 77 725 -27T446 -132Q272 -132 168 -27T64 250ZM657 505Q656 506 650 510T638 518T623 527T604 537T581 547T553 556T522 563T486 569T446 571Q305 571 216 487T126 251Q126 128 192 40L657 505ZM447 -70Q591 -70 679 16T767 250Q767 308 751 360T719 436T701 460L469 228Q238 -1 238 -5Q238 -8 261 -22T336 -53T447 -70'], - - // CIRCLED DOT OPERATOR - 0x2299: [632,132,894,64,828,'64 250Q64 350 98 426T189 546T307 610T434 632Q485 632 496 631Q572 621 635 592Q669 575 699 550T760 484T809 384T828 250Q828 77 725 -27T446 -132Q272 -132 168 -27T64 250ZM767 252Q767 395 681 483T446 571Q303 571 215 486T126 249Q126 107 212 19T446 -70Q596 -70 681 18T767 252ZM335 251Q335 297 368 329T441 361Q498 361 527 327T557 250Q557 202 525 171T446 140Q397 140 366 173T335 251'], - - // RIGHT TACK - 0x22A2: [693,-1,703,65,637,'65 672Q76 693 91 693Q115 693 123 674Q125 669 125 523V378H615Q618 376 622 373T628 369T632 366T635 362T636 356T637 347Q637 328 619 319Q615 317 370 317H125V171Q125 25 123 20Q114 1 94 1Q73 1 65 23V672'], - - // LEFT TACK - 0x22A3: [693,-1,703,64,638,'64 327T64 347T89 378H577V525L578 672Q592 693 604 693Q629 693 638 669V25Q628 1 607 1Q588 1 578 23L577 170V317H88Q64 327 64 347'], - - // DOWN TACK - 0x22A4: [695,-1,894,64,829,'64 664Q64 675 71 683T87 693H93Q99 693 110 693T137 693T173 693T217 694T267 694T323 694T383 694T448 694H807Q808 693 811 691T817 687T823 682T827 675T829 664Q829 643 807 634L642 633H477V25Q467 1 446 1Q427 1 417 23L416 328V633H251L87 634Q64 643 64 664'], - - // UP TACK - 0x22A5: [693,-1,894,65,829,'65 31Q65 38 66 41T71 50T87 61H416V366L417 672Q431 693 443 693Q468 693 477 669V61H807Q808 60 811 58T817 54T823 49T827 42T829 31Q829 10 807 1H87Q65 10 65 31'], - - // TRUE - 0x22A8: [750,249,974,129,918,'160 -249Q138 -249 129 -225V250Q129 725 131 729Q139 750 159 750T190 725V392Q219 393 537 393H896Q897 392 900 390T906 386T912 381T916 374T918 363Q918 345 896 333H190V169H896L900 166Q905 163 907 162T912 157T916 149T918 139Q918 118 896 109H190V-225Q181 -249 160 -249'], - - // DIAMOND OPERATOR - 0x22C4: [523,21,575,15,560,'280 522Q281 523 285 523H289Q301 523 366 457Q404 420 431 393Q533 291 546 277T560 250Q560 239 548 226T431 108Q313 -10 304 -16Q297 -21 287 -21Q278 -21 275 -19Q270 -17 146 107T18 238Q15 242 15 251Q15 258 18 263Q20 268 145 392T274 519L280 522ZM388 350L288 449L188 350L89 250L288 52L487 250L388 350'], - - // DOT OPERATOR - 0x22C5: [336,-165,319,74,245,'74 251Q74 286 99 311T156 336Q200 336 222 308T245 250Q245 221 224 194T160 166T96 193T74 251'], - - // STAR OPERATOR - 0x22C6: [502,0,575,24,550,'270 491Q274 502 287 502Q298 502 304 491Q304 486 323 396T342 303L438 314Q520 324 534 324Q540 324 545 320T550 307Q550 298 539 290T456 243Q377 198 377 197L416 111Q456 26 456 22Q457 21 457 18Q457 11 451 6T438 0H437Q432 0 415 16Q387 42 358 68L287 133L216 68Q193 47 167 23Q142 0 136 0Q129 0 123 5T117 18Q117 21 118 22Q118 26 158 111L197 197Q197 198 156 221T72 269T26 298Q24 304 24 307Q24 315 29 319T40 324Q53 324 136 314L232 303Q232 306 251 396T270 491'], - - // BOWTIE - 0x22C8: [540,39,1000,33,967,'906 251Q906 456 905 456Q550 252 549 251Q549 250 726 148T905 45T906 251ZM967 -14Q958 -38 939 -38H937Q928 -38 923 -35Q919 -34 748 64T500 209L71 -38Q69 -39 63 -39Q42 -39 33 -16V518Q45 540 63 540H65Q72 540 174 481Q247 439 302 407L500 292Q578 339 750 438T929 539H933Q958 539 967 515V-14ZM449 251L94 456Q93 456 93 251Q93 45 94 45L106 52Q119 59 139 71T186 98T242 131T301 165T357 197T404 225T437 244L449 251'], - - // VERTICAL ELLIPSIS - 0x22EE: [951,29,319,74,245,'74 55Q74 91 99 116T156 141Q200 141 222 113T245 55Q245 26 224 -1T160 -29Q118 -29 96 -3T74 55ZM74 465Q74 501 99 526T156 551Q200 551 222 523T245 465Q245 436 224 409T160 381Q118 381 96 407T74 465ZM74 865Q74 901 99 926T156 951Q200 951 222 923T245 865Q245 836 224 809T160 781Q118 781 96 807T74 865'], - - // MIDLINE HORIZONTAL ELLIPSIS - 0x22EF: [336,-165,1295,74,1221,'74 251Q74 286 99 311T156 336Q200 336 222 308T245 250Q245 221 224 194T160 166T96 193T74 251ZM562 251Q562 286 587 311T644 336Q688 336 710 308T733 250Q733 221 712 194T648 166T584 193T562 251ZM1050 251Q1050 286 1075 311T1132 336Q1176 336 1198 308T1221 250Q1221 221 1200 194T1136 166T1072 193T1050 251'], - - // DOWN RIGHT DIAGONAL ELLIPSIS - 0x22F1: [871,-101,1323,129,1194,'129 785Q129 821 154 846T211 871Q255 871 277 843T300 785Q300 756 279 729T215 701Q173 701 151 727T129 785ZM576 485Q576 521 601 546T658 571Q702 571 724 543T747 485Q747 456 726 429T662 401Q620 401 598 427T576 485ZM1023 185Q1023 221 1048 246T1105 271Q1149 271 1171 243T1194 185Q1194 156 1173 129T1109 101Q1067 101 1045 127T1023 185'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/MathOperators.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MiscMathSymbolsA.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MiscMathSymbolsA.js deleted file mode 100644 index 1333b2890e..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MiscMathSymbolsA.js +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/MiscMathSymbolsA.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // MATHEMATICAL LEFT ANGLE BRACKET - 0x27E8: [750,249,447,127,382,'127 243V259L223 491Q251 557 286 642Q318 719 324 732T340 748H341Q347 750 351 750Q365 750 373 740T382 723Q382 713 286 482L190 251Q190 249 286 20T382 -219Q382 -232 373 -240T352 -249Q332 -249 323 -229Q320 -220 223 10L127 243'], - - // MATHEMATICAL RIGHT ANGLE BRACKET - 0x27E9: [750,249,447,64,319,'64 720Q64 732 72 741T94 750Q106 750 113 743Q118 741 122 732L319 259V243L122 -231Q112 -249 95 -249Q83 -249 74 -240T64 -218Q64 -210 160 20L256 251L160 482Q64 715 64 720'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/MiscMathSymbolsA.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MiscSymbols.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MiscSymbols.js deleted file mode 100644 index 303934e6b1..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MiscSymbols.js +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/MiscSymbols.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // BLACK SPADE SUIT - 0x2660: [719,130,894,64,829,'675 -18Q536 -18 527 62V70H477V55Q479 14 487 -21T502 -75T509 -101Q509 -120 491 -127Q487 -129 447 -129Q446 -129 439 -129T427 -130Q384 -130 384 -101Q384 -95 391 -76T406 -21T416 55V70H366Q364 52 360 40T342 14T300 -8T230 -17H218Q110 -17 75 117Q64 163 64 209Q64 290 116 357T261 495Q363 574 414 690Q425 719 445 719Q467 719 478 693Q507 627 547 578T623 503T702 438T777 357Q829 285 829 202V197Q826 128 808 81T762 15T714 -11T675 -18'], - - // WHITE HEART SUIT - 0x2661: [711,24,894,65,828,'65 491Q65 602 121 656T246 710Q375 710 440 624L447 615Q519 711 638 711Q723 711 775 652T828 491Q828 390 770 313T581 129Q539 95 514 63T483 14T469 -13T446 -24Q434 -24 427 -17T416 0T400 32T371 74Q352 97 310 131T229 199T151 276T89 374T65 491ZM249 649Q188 649 157 603T125 489Q125 409 181 338T352 176Q408 131 437 87L446 73L456 87Q479 121 507 147T579 207T659 278Q768 387 768 489Q768 506 766 524T756 566T731 611T687 642Q668 649 638 649Q609 649 593 644Q547 633 516 604T478 534Q473 505 447 505H445Q420 505 416 534Q407 577 372 608T285 648Q277 649 249 649'], - - // WHITE DIAMOND SUIT - 0x2662: [719,154,894,64,828,'409 686Q410 688 412 691T415 696T418 701T421 706T424 709T427 713T431 715T435 717T440 718T446 719Q455 719 460 717T472 704T488 679T516 633T563 567Q624 485 687 422T787 330T826 296T828 282Q828 270 825 265T801 245Q696 161 612 59T477 -133Q465 -154 447 -154Q439 -154 434 -152T425 -146T414 -130T399 -104T372 -62T330 -3Q270 78 207 142T107 234T70 265Q64 274 64 282Q64 296 90 317Q284 472 409 686ZM749 282Q745 286 721 307T681 343T635 388T581 446T525 516T465 601Q462 606 457 613T450 624L447 627V628Q446 628 436 611T402 561T348 489T266 396T155 292L145 282Q147 280 185 245T257 177T343 79T442 -57Q446 -64 447 -64V-63Q450 -59 475 -22T530 56T619 160T749 282'], - - // BLACK CLUB SUIT - 0x2663: [719,130,894,32,861,'240 527Q240 611 301 665T446 719T590 665T652 527Q652 431 571 373Q578 363 584 352T593 335T597 329L604 335Q611 341 617 345T637 356T667 366Q672 366 680 367T694 368Q767 368 814 310T861 177Q861 109 819 57T713 -12Q690 -17 656 -17Q535 -13 527 62V70H477V55Q479 14 487 -21T502 -75T509 -101Q509 -120 491 -127Q487 -129 447 -129Q446 -129 439 -129T427 -130Q384 -130 384 -101Q384 -95 391 -76T406 -21T416 55V70H366V62Q356 -12 237 -17Q130 -17 71 60Q32 111 32 178Q32 251 78 309T198 368Q217 368 233 364T260 354T279 343T291 333T296 329L300 336Q304 343 310 354T322 373Q240 432 240 527'], - - // MUSIC FLAT SIGN - 0x266D: [750,17,447,64,381,'230 480Q293 480 337 440T381 330V322Q381 240 323 161Q258 71 123 -11L114 -16L97 -17Q70 -17 66 -7Q64 -3 64 366V641Q64 717 65 731T75 748Q78 750 95 750Q117 750 122 742T127 694Q127 685 127 653T126 595V454Q183 480 230 480ZM242 333Q242 405 212 405H207Q147 405 130 370L127 364L126 219Q126 77 128 77Q133 82 140 90T167 127T202 183T229 253T242 333'], - - // MUSIC NATURAL SIGN - 0x266E: [741,223,447,57,389,'345 -223Q333 -223 330 -214T327 -178V-116Q327 -23 326 -23L203 -82Q90 -134 77 -140Q65 -142 59 -130Q57 -126 57 295V595Q57 643 57 667T58 704T60 719T63 724Q93 741 101 741Q113 741 116 732T119 680V597Q119 467 120 467Q121 468 180 495T301 552T369 584Q381 586 387 574Q389 570 389 187V-88Q389 -132 389 -154T388 -188T386 -202T383 -206Q353 -223 345 -223ZM327 271Q327 421 326 421L120 323L119 173V23Q120 23 223 72L327 121V271'], - - // MUSIC SHARP SIGN - 0x266F: [724,224,447,64,382,'140 628Q151 628 154 620T158 591V549V484L166 488Q175 492 192 500T223 516L288 548V622V674Q288 681 288 685T289 693T289 699T291 703T295 707T298 709T304 712T311 716Q326 724 332 724Q343 724 346 715T350 685V644V579Q358 583 364 583Q376 583 380 574Q382 570 382 514V481Q382 459 380 454T363 441L350 435V135Q358 139 364 139Q376 139 380 130Q382 126 382 70V37Q382 15 380 10T363 -3L350 -9V-76Q350 -102 348 -106T328 -119Q312 -128 306 -128Q288 -128 288 -99V-77V-40L280 -44Q271 -48 254 -56T223 -72L158 -104V-150V-180Q158 -198 155 -202T135 -216Q119 -224 114 -224Q96 -224 96 -192V-172V-135Q86 -140 81 -140Q70 -140 66 -129Q64 -126 64 -70V-54Q64 -18 66 -12T83 3L96 9V309Q86 304 81 304Q70 304 66 315Q64 318 64 374V407Q64 429 66 434T83 447L96 453V602Q99 609 100 610T118 619Q134 628 140 628ZM288 254Q288 404 287 404L158 340V40L166 44Q175 48 192 56T223 72L288 104V254'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/MiscSymbols.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MiscTechnical.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MiscTechnical.js deleted file mode 100644 index 0e19d84bec..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MiscTechnical.js +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/MiscTechnical.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // LEFT CEILING - 0x2308: [751,248,511,194,494,'194 728Q199 743 216 749H220Q223 749 229 749T245 749T265 750T289 750T316 750T345 750H471Q472 749 477 746T484 741T490 732T493 719Q493 701 471 690L362 689H254V-224Q244 -248 223 -248T194 -226V728'], - - // RIGHT CEILING - 0x2309: [750,248,511,17,317,'317 -224Q307 -248 286 -248Q267 -248 257 -226L256 231V689H148L40 690Q17 698 17 720Q17 741 37 748Q42 750 169 750H295Q314 737 317 725V-224'], - - // LEFT FLOOR - 0x230A: [749,248,511,194,494,'194 728Q204 749 220 749Q245 749 254 725V-188H471Q472 -189 477 -192T484 -197T490 -206T493 -219Q493 -237 471 -248H216Q200 -242 194 -226V728'], - - // RIGHT FLOOR - 0x230B: [749,248,511,17,317,'17 -219Q17 -201 40 -188H256V270L257 728Q271 749 283 749Q308 749 317 725V-224Q310 -242 295 -248H40L38 -247Q35 -246 34 -245T30 -243T25 -239T21 -234T18 -227T17 -219'], - - // stix-small down curve - 0x2322: [405,-107,1150,65,1084,'95 108Q85 108 75 114T65 139Q65 159 129 227Q316 405 573 405Q654 405 729 387T854 344T950 286T1015 232T1053 191Q1078 160 1083 152Q1084 148 1084 139Q1084 121 1074 115T1054 108Q1040 108 1029 122T990 167T922 223Q819 291 680 309Q641 315 575 315Q508 315 469 309Q303 288 197 201Q168 179 148 155T118 119T95 108'], - - // stix-small up curve - 0x2323: [393,-126,1150,64,1085,'1054 392Q1067 392 1076 384T1085 362Q1085 351 1079 342T1050 310Q983 243 901 200Q753 126 575 126Q494 126 420 141T298 176T205 225T140 272T100 310Q64 346 64 362Q64 370 67 374Q75 393 93 393Q107 393 124 375Q272 214 575 214Q877 214 1025 375Q1039 392 1054 392'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/MiscTechnical.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/SpacingModLetters.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/SpacingModLetters.js deleted file mode 100644 index 53a16f216f..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/SpacingModLetters.js +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/SpacingModLetters.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // MODIFIER LETTER CIRCUMFLEX ACCENT - 0x2C6: [694,-520,575,126,449,'207 632L287 694Q289 693 368 632T448 570T431 545T413 520Q410 520 350 559L287 597L224 559Q164 520 161 520Q160 520 143 544T126 570T207 632'], - - // CARON - 0x2C7: [660,-515,575,130,443,'131 603Q130 604 136 618T150 646T158 659L223 635L287 611L351 635L416 659Q417 660 424 647T437 619T443 603Q440 601 364 558T287 515T210 558T131 603'], - - // MODIFIER LETTER MACRON - 0x2C9: [607,-540,575,80,494,'80 540V607H494V540H80'], - - // MODIFIER LETTER ACUTE ACCENT - 0x2CA: [706,-503,575,236,460,'391 706Q419 706 439 683T460 634Q460 608 441 593T366 550Q356 545 351 543L275 503L256 527Q236 552 237 553Q242 558 292 620Q299 629 309 641T324 659T336 673T346 685T354 693T363 699T371 703T380 705T391 706'], - - // MODIFIER LETTER GRAVE ACCENT - 0x2CB: [706,-503,575,113,338,'114 634Q114 663 136 684T183 706Q191 706 196 705T208 700T219 693T232 681T245 666T262 645T282 620Q332 558 337 553Q338 552 318 527L299 503L223 543Q215 547 202 553T183 563T167 571T153 580T141 587T131 595T124 603T118 612T115 622T114 634'], - - // BREVE - 0x2D8: [694,-500,575,102,472,'287 500Q208 500 155 558T102 689V694H153V685Q153 681 154 674T164 648T186 615T226 590T287 578Q347 578 382 611T421 685V694H472V689Q472 623 422 562T287 500'], - - // DOT ABOVE - 0x2D9: [695,-525,575,202,372,'202 610Q202 647 227 671T283 695Q324 695 348 669T372 610T350 551T287 525Q248 525 225 551T202 610'], - - // RING ABOVE - 0x2DA: [702,-535,575,160,414,'160 618Q160 653 193 677T279 702H284Q381 702 407 647Q414 634 414 618Q414 607 410 596T395 570T355 546T287 536T220 545T181 568T165 594T160 618ZM352 618Q352 645 341 652T301 659H292Q286 659 278 659T268 660Q247 660 236 653T224 638T222 619Q222 591 234 585T287 578Q315 578 326 580T345 590T352 618'], - - // SMALL TILDE - 0x2DC: [694,-552,575,96,478,'343 552Q320 552 278 575T215 599Q181 599 146 564L134 552L115 569Q111 572 106 576T98 584L96 586Q158 656 165 663Q199 694 230 694Q239 694 244 693Q262 689 300 668T359 647Q393 647 428 682L440 694L459 677Q463 674 468 670T476 662L478 660Q416 590 409 583Q375 552 343 552'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/SpacingModLetters.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/SuppMathOperators.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/SuppMathOperators.js deleted file mode 100644 index 494b71a946..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/SuppMathOperators.js +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/SuppMathOperators.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // AMALGAMATION OR COPRODUCT - 0x2A3F: [686,0,900,39,860,'39 655Q39 675 43 680T69 686Q110 684 225 684Q267 684 303 684T360 685T385 686Q401 686 405 680T409 651Q409 632 403 628T367 624H348H301V62H598V624H551H532Q502 624 496 628T490 651Q490 673 494 679T514 686Q518 686 558 685T675 684T792 685T836 686Q852 686 856 680T860 651Q860 632 854 628T818 624H799H752V62H799H809Q846 62 853 59T860 36V31V21Q860 6 850 2Q846 0 450 0H156Q75 0 60 1T40 11V18Q39 26 39 31Q39 54 44 58T82 63Q84 63 90 63T100 62H147V624H100H90Q53 624 46 627T39 650V655'], - - // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN - 0x2AAF: [696,199,894,96,797,'796 54Q796 40 788 32T767 24Q741 24 735 57Q729 107 705 148T646 216T563 264T465 297T356 316T245 326T136 330H134Q96 330 96 360Q96 391 134 391H136Q193 392 239 394T347 403T457 421T556 453T643 502T703 571T735 664Q741 696 763 696Q781 696 789 686T797 667Q797 651 792 624T758 545T682 456Q605 396 481 365L462 360Q483 357 526 344T633 296T733 215Q767 173 781 128T796 54ZM119 -199Q96 -190 96 -169T116 -141Q121 -139 448 -139H775Q776 -140 779 -142T785 -146T791 -151T795 -158T797 -169Q797 -190 775 -199H119'], - - // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN - 0x2AB0: [697,199,894,96,797,'127 24Q115 24 106 32T97 55Q97 95 124 156T211 265Q288 325 412 356L431 361Q410 363 367 376T259 425T160 506Q127 546 112 594T96 667Q96 679 104 688T126 697Q152 697 158 664Q164 614 188 573T247 505T331 456T429 424T539 405T649 395T758 391Q797 391 797 360Q797 330 761 330H758Q701 329 655 327T547 318T437 300T337 268T251 219T190 150T158 57Q151 24 127 24ZM119 -199Q96 -190 96 -169T116 -141Q121 -139 448 -139H775Q776 -140 779 -142T785 -146T791 -151T795 -158T797 -169Q797 -190 775 -199H119'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/SuppMathOperators.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/SupplementalArrowsA.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/SupplementalArrowsA.js deleted file mode 100644 index 225db4921f..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Bold/SupplementalArrowsA.js +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Bold/SupplementalArrowsA.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-bold'], - { - // LONG LEFTWARDS ARROW - 0x27F5: [518,17,1805,64,1741,'1063 221L649 220H235Q340 133 364 17Q368 1 368 -2Q368 -16 343 -17Q340 -17 338 -17H332Q317 -17 314 -14T305 6Q298 34 285 62T247 126T179 189T78 233Q64 237 64 251Q64 261 74 265T108 277T154 297Q212 328 251 379T305 495Q309 511 313 514T333 518H338Q363 517 367 510Q368 507 368 503Q368 500 364 484Q345 401 287 331Q254 295 235 282L649 281H1063L1065 280Q1079 281 1392 281H1719Q1720 280 1723 278T1729 274T1735 269T1739 262T1741 251Q1741 230 1719 221H1063'], - - // LONG RIGHTWARDS ARROW - 0x27F6: [518,17,1833,96,1773,'119 221Q96 230 96 251T116 279Q121 281 448 281H1188L1602 282Q1569 304 1530 357T1473 482Q1469 500 1469 501Q1469 512 1480 517Q1482 518 1500 518H1505Q1520 518 1523 515T1532 495Q1552 412 1611 351T1753 270Q1773 263 1773 251Q1773 240 1765 236T1732 225T1683 204Q1625 173 1586 122T1532 6Q1528 -10 1524 -13T1504 -17H1499Q1474 -16 1470 -9Q1469 -6 1469 -2Q1469 1 1473 17Q1501 138 1602 220H1188L775 221H119'], - - // LONG LEFT RIGHT ARROW - 0x27F7: [518,17,2126,64,2061,'1063 221L649 220H235Q340 133 364 17Q368 1 368 -2Q368 -16 343 -17Q340 -17 338 -17H332Q317 -17 314 -14T305 6Q298 34 285 62T247 126T179 189T78 233Q64 237 64 251Q64 261 74 265T108 277T154 297Q212 328 251 379T305 495Q309 511 313 514T333 518H338Q363 517 367 510Q368 507 368 503Q368 500 364 484Q345 401 287 331Q254 295 235 282L649 281H1476L1890 282Q1857 304 1818 357T1761 482Q1757 500 1757 501Q1757 512 1768 517Q1770 518 1788 518H1793Q1808 518 1811 515T1820 495Q1840 412 1899 351T2041 270Q2061 263 2061 251Q2061 240 2053 236T2020 225T1971 204Q1913 173 1874 122T1820 6Q1816 -10 1812 -13T1792 -17H1787Q1762 -16 1758 -9Q1757 -6 1757 -2Q1757 1 1761 17Q1789 138 1890 220H1476L1063 221'], - - // LONG LEFTWARDS DOUBLE ARROW - 0x27F8: [547,46,1868,64,1804,'1063 333L700 332H338L324 321Q283 290 230 264L205 250Q266 224 323 180L338 170L700 169H1063L1064 168Q1080 169 1423 169H1782L1786 166Q1791 163 1793 162T1798 157T1802 149T1804 139Q1804 118 1782 109H1063L733 108H404L412 99Q455 50 488 -10Q498 -27 493 -37Q487 -46 465 -46H460Q446 -46 439 -39T426 -18T399 25T344 89Q239 194 99 229Q96 230 92 231T85 232T79 234T73 235T69 237T66 240T65 244T64 250Q64 267 90 271Q197 295 286 361T430 525Q439 542 442 544T460 547H465Q487 547 492 539Q496 531 496 530Q496 521 471 482T414 405L404 394L733 393H1063Q1064 392 1065 392Q1081 393 1423 393H1782Q1783 392 1786 390T1792 386T1798 381T1802 374T1804 363Q1804 345 1782 333H1063'], - - // LONG RIGHTWARDS DOUBLE ARROW - 0x27F9: [547,46,1870,64,1804,'87 109Q64 118 64 139Q64 159 86 168Q89 169 448 169H1169L1532 170L1546 180Q1562 193 1580 204T1612 223T1638 237T1657 246L1664 250L1639 264Q1586 290 1545 321L1531 332H1169L807 333H87Q64 343 64 362Q64 383 84 391Q89 393 448 393H1136L1465 394L1455 405Q1428 436 1401 477T1374 531Q1374 547 1399 547H1404H1409Q1423 547 1430 540T1443 519T1470 475T1526 411Q1634 303 1779 271Q1780 271 1783 270T1788 269T1792 268T1796 266T1799 264T1802 260T1803 256T1804 250Q1804 242 1800 238T1783 231T1755 225T1712 211T1654 185Q1517 112 1439 -24Q1430 -40 1426 -43T1409 -46H1404Q1373 -46 1373 -31Q1373 -24 1381 -10Q1414 50 1457 99L1465 108H1136L807 109H87'], - - // LONG LEFT RIGHT DOUBLE ARROW - 0x27FA: [547,46,2126,64,2060,'1063 333L700 332H338L324 321Q283 290 230 264L205 250Q266 224 323 180L338 170L700 169H1425L1788 170L1802 180Q1818 193 1836 204T1868 223T1894 237T1913 246L1920 250L1895 264Q1842 290 1801 321L1787 332H1425L1063 333ZM733 393H1392L1721 394L1711 405Q1684 436 1657 477T1630 531Q1630 547 1655 547H1660H1665Q1679 547 1686 540T1699 519T1726 475T1782 411Q1890 303 2035 271Q2036 271 2039 270T2044 269T2048 268T2052 266T2055 264T2058 260T2059 256T2060 250Q2060 242 2056 238T2039 231T2011 225T1968 211T1910 185Q1773 112 1695 -24Q1686 -40 1682 -43T1665 -46H1660Q1629 -46 1629 -31Q1629 -24 1637 -10Q1670 50 1713 99L1721 108H1392L1063 109L733 108H404L412 99Q455 50 488 -10Q498 -27 493 -37Q487 -46 465 -46H460Q446 -46 439 -39T426 -18T399 25T344 89Q239 194 99 229Q96 230 92 231T85 232T79 234T73 235T69 237T66 240T65 244T64 250Q64 267 90 271Q197 295 286 361T430 525Q439 542 442 544T460 547H465Q487 547 492 539Q496 531 496 530Q496 521 471 482T414 405L404 394L733 393'], - - // LONG RIGHTWARDS ARROW FROM BAR - 0x27FC: [518,17,1833,65,1773,'65 426Q74 448 95 448Q112 448 125 426V281H130L132 280H134Q162 281 448 281H1188L1602 282Q1569 304 1530 357T1473 482Q1469 500 1469 501Q1469 512 1480 517Q1482 518 1500 518H1505Q1520 518 1523 515T1532 495Q1552 412 1611 351T1753 270Q1773 263 1773 251Q1773 240 1765 236T1732 225T1683 204Q1625 173 1586 122T1532 6Q1528 -10 1524 -13T1504 -17H1499Q1474 -16 1470 -9Q1469 -6 1469 -2Q1469 1 1473 17Q1501 138 1602 220H1188L775 221H135Q133 220 130 220H125V76Q115 54 95 54Q73 54 65 76V426'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Bold/SupplementalArrowsA.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/BasicLatin.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/BasicLatin.js deleted file mode 100644 index ab4546307c..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/BasicLatin.js +++ /dev/null @@ -1,287 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Italic/BasicLatin.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-italic'], - { - // SPACE - 0x20: [0,0,250,0,0,''], - - // EXCLAMATION MARK - 0x21: [716,0,307,107,380,'330 716Q351 716 365 703T380 670V659L304 433Q230 207 227 204Q225 198 205 198Q184 198 184 207T220 439T260 669Q270 694 297 708Q300 709 304 710T311 713T316 714Q324 716 330 716ZM107 51Q110 83 133 102T179 121Q207 121 219 105T231 72Q231 45 209 23T156 0Q138 0 123 11T107 51'], - - // QUOTATION MARK - 0x22: [694,-379,514,176,538,'214 620Q214 647 236 670T289 694Q312 694 326 677T341 633V624Q341 588 327 550T294 482T253 428T216 392T196 379Q191 379 184 388T176 401Q176 404 195 421T243 472T287 547Q299 576 299 582L295 580Q291 578 282 576T264 573Q241 573 228 585T214 620ZM411 620Q411 647 433 670T486 694Q509 694 523 677T538 633V624Q538 588 524 550T491 482T450 428T413 392T393 379Q388 379 381 388T373 401Q373 404 392 421T440 472T484 547Q496 576 496 582L492 580Q488 578 479 576T461 573Q438 573 425 585T411 620'], - - // NUMBER SIGN - 0x23: [694,194,818,115,828,'281 327H228Q186 327 175 330T164 347Q164 359 176 365Q179 367 292 367H404L563 688Q569 694 578 694T593 686T597 670Q597 667 531 535L448 367H614L773 688Q779 694 787 694Q796 694 802 688T808 674V672L807 670Q807 667 732 517L658 368L736 367H814Q828 357 828 347Q828 336 812 327H637L599 250Q561 174 561 173H662H724Q760 173 769 170T779 153T770 136T729 132Q721 132 696 132T651 133H540L380 -188Q374 -194 366 -194Q357 -194 351 -188T345 -174L346 -172V-170Q346 -167 412 -35L495 133H330L170 -188Q164 -194 156 -194Q147 -194 141 -188T135 -174L136 -172V-170Q136 -167 211 -17L285 133H207L130 134Q115 140 115 153Q115 164 131 173H306L344 250Q382 326 382 327H281ZM592 327H427L389 250Q351 174 351 173H516L554 250Q592 326 592 327'], - - // PERCENT SIGN - 0x25: [750,56,818,145,847,'301 348Q257 348 231 383T205 480Q205 553 244 629T346 736Q370 750 394 750Q416 750 429 742T458 714Q512 644 606 644Q722 644 802 732Q817 750 827 750Q835 750 841 744T847 730Q847 725 827 700T689 540Q586 421 512 335Q180 -50 176 -52Q172 -56 165 -56Q157 -56 151 -50T145 -35Q145 -29 162 -9T330 186Q392 258 430 302Q711 627 711 628L701 624Q652 607 604 607Q551 607 494 634L479 642V624Q479 544 439 467Q414 416 377 382T301 348ZM270 443Q270 385 303 385H306H308Q326 385 348 407Q384 441 409 504T434 627Q434 713 390 713Q358 713 328 663Q307 631 289 556T270 451V443ZM608 -56Q573 -56 543 -23T513 76Q513 129 536 190T604 296L627 318Q670 347 704 347Q747 347 767 310T788 222Q788 126 732 35T608 -56ZM742 222Q742 310 699 310Q677 310 655 285T620 227Q608 197 593 138T578 42V36Q578 -18 613 -18Q657 -18 699 64T742 222'], - - // AMPERSAND - 0x26: [716,23,767,127,802,'209 444Q209 546 278 631T424 716Q473 716 501 683T530 601Q530 554 511 535T467 515Q446 515 437 527T427 553Q427 578 446 594T481 610H483V617Q480 641 464 660T419 679Q367 679 328 603Q316 578 305 538T288 470L282 443L295 449Q308 455 330 462T371 469Q397 469 413 450T430 404Q430 363 400 329T331 295Q291 295 256 322Q255 322 246 293T227 223T217 158Q217 117 232 88T273 43T327 22T387 15Q457 15 512 37T599 93T652 169T680 248T688 317T678 380T659 423T647 437Q643 435 637 431T613 416T581 392T554 364T538 332Q540 310 541 310Q554 335 587 335Q601 335 613 327T626 300Q626 290 622 279T603 255T563 242Q532 245 512 263T491 320Q494 351 511 377T547 418T600 456T652 494Q676 512 697 539T728 582T738 601Q738 602 736 602Q732 602 726 604T714 616T707 638Q707 661 724 677T764 694Q799 694 802 660Q802 625 767 562T688 467L694 458Q700 449 702 444T711 428T720 408T727 385T733 358T735 327Q735 281 724 235T685 141T617 59T515 1T375 -22Q270 -22 199 34T127 181Q127 216 147 270T207 374L216 386Q209 421 209 444ZM386 412Q386 432 366 432Q345 432 325 418T294 390T284 375Q284 371 289 362T306 343T335 332Q355 332 367 350T383 384T386 412'], - - // APOSTROPHE - 0x27: [694,-378,307,212,377,'250 620Q250 647 272 670T325 694Q348 694 362 677T377 633V624Q377 566 343 506T275 412T231 379Q226 379 220 388T213 401T232 421T279 472T323 547Q335 573 335 582L331 580Q327 578 318 576T300 573Q277 573 264 585T250 620'], - - // LEFT PARENTHESIS - 0x28: [750,250,409,144,517,'241 -250Q203 -212 174 -140T144 39Q144 158 180 288T296 544T481 746L487 750H499Q517 750 517 740Q517 736 495 716Q399 630 331 491T236 228T208 3Q208 -73 224 -130T255 -214T271 -244Q271 -250 252 -250H241'], - - // RIGHT PARENTHESIS - 0x29: [750,250,409,17,390,'326 497Q326 546 320 588T304 655T285 699T269 728T262 740Q262 746 267 749L272 750Q276 750 281 750H293Q331 712 360 640T390 461Q390 332 339 171T188 -116Q161 -150 121 -188T47 -250H35Q17 -250 17 -240Q17 -236 39 -216Q135 -130 203 9T298 272T326 497'], - - // ASTERISK - 0x2A: [750,-320,511,195,584,'560 658Q569 658 576 649T584 631Q584 625 583 620T577 611T569 603T556 595T540 587T519 578T494 566L428 536Q427 535 433 531T479 502Q525 475 532 469T539 450Q538 435 525 424T497 412Q489 412 482 418T442 456Q400 497 400 494L387 420Q376 353 373 343T352 323Q345 320 336 320H331Q322 320 316 327T309 343Q309 347 334 420L359 496Q358 496 297 456T234 414Q228 411 221 411Q212 411 204 417T195 439Q198 458 209 465T283 502L353 534L300 566Q255 593 247 599T239 616Q239 631 252 644T282 658Q290 658 295 654T335 615L378 573L391 647Q393 657 395 671T398 691T400 706T404 720T408 730T414 739T423 744T434 749Q435 749 439 749T445 750Q467 748 469 728Q469 723 457 685T432 610L420 573L481 613Q548 658 560 658'], - - // PLUS SIGN - 0x2B: [557,57,767,139,753,'139 237T139 250T151 266T198 270H293H431L465 407Q469 424 476 452Q494 528 500 542T519 557Q526 557 532 552T538 538Q538 536 507 409T472 272Q472 270 604 270Q737 270 741 268Q753 261 753 250Q753 237 742 233T696 229Q687 229 655 229T599 230H462L461 226Q461 224 427 91T392 -47Q387 -57 374 -57Q367 -57 361 -51T355 -37Q355 -31 388 99L421 230H288Q267 230 238 230T199 229Q163 229 151 233'], - - // COMMA - 0x2C: [121,194,307,69,232,'106 46Q106 68 121 90T167 120Q168 120 173 120T180 121Q232 121 232 59V54Q232 18 219 -20T186 -88T145 -143T109 -181T88 -194Q84 -194 77 -185T69 -171Q69 -168 70 -166T76 -161T85 -154T101 -139T124 -114Q146 -88 162 -58T183 -12T188 7Q187 7 183 5T172 2T156 0Q129 0 118 14T106 46'], - - // HYPHEN-MINUS - 0x2D: [251,-180,358,84,341,'205 180H131Q102 180 93 181T84 190Q90 238 103 251H334Q341 244 341 241Q341 236 336 214T327 186Q325 181 312 181T205 180'], - - // FULL STOP - 0x2E: [121,0,307,107,231,'107 50Q107 76 129 98T181 121Q203 121 217 108T231 72Q231 47 210 24T156 0Q135 0 121 13T107 50'], - - // SOLIDUS - 0x2F: [750,250,511,19,617,'596 750Q604 750 610 744T617 730L616 728Q616 727 616 726Q615 723 337 244T55 -242Q49 -250 40 -250Q30 -250 25 -243Q18 -238 20 -226Q21 -223 299 256T581 742Q589 750 596 750'], - - // DIGIT ZERO - 0x30: [665,21,511,110,562,'414 665Q562 665 562 490Q562 426 534 318Q451 -21 251 -21Q222 -21 202 -15Q155 2 134 40T110 144Q110 201 127 286T187 470T287 614Q348 665 414 665ZM187 98Q187 59 208 37T260 15Q320 15 365 83Q394 128 440 312T487 547Q487 580 471 600T433 627Q428 628 408 628Q381 628 353 609T311 569Q279 526 239 364T190 143Q187 120 187 98'], - - // DIGIT ONE - 0x31: [666,0,511,110,468,'248 491Q228 491 228 502Q228 516 236 532Q237 536 246 537T275 541T314 552Q350 567 382 595T430 644L446 664Q450 666 454 666Q468 666 468 658Q468 647 395 359Q321 63 321 59Q321 52 334 50T388 46H422Q428 37 428 35Q428 19 421 5Q416 0 405 0Q400 0 361 1T263 2Q215 2 185 2T142 1T127 0Q110 0 110 11Q110 13 113 25T118 40Q120 46 146 46Q196 46 212 49T235 61Q238 66 295 295L353 526L340 519Q328 512 302 503T248 491'], - - // DIGIT TWO - 0x32: [666,22,511,76,551,'159 404Q159 433 176 476T222 562T297 635T395 666Q466 666 508 617T551 497Q551 473 545 446Q534 388 482 333Q441 292 355 240T264 184Q216 151 179 101L171 91Q171 90 177 90Q206 90 269 77T366 64Q385 64 390 65Q418 73 441 98T475 156Q479 168 481 170T495 173H518Q524 167 524 166T521 152Q502 86 459 32T353 -22Q315 -22 259 15T172 53Q156 53 143 36T126 1L121 -16Q119 -22 98 -22H82Q76 -16 76 -13T80 5T98 50T132 111T189 178T274 242Q327 273 364 305T420 370T447 427T460 483Q466 514 466 538Q466 586 443 607T389 629Q338 629 293 584T226 487T204 399Q204 390 204 386T209 378T222 373Q258 376 282 422T307 493Q307 506 302 517T297 531Q297 537 308 546T327 551Q329 550 333 543T340 523T344 497Q344 450 306 393T216 336Q186 336 173 355T159 396V404'], - - // DIGIT THREE - 0x33: [666,22,511,96,562,'296 531Q296 536 307 544T322 553Q330 553 338 534T346 501Q346 468 319 440T258 412Q232 412 216 430T200 478Q200 552 281 618Q345 666 416 666Q489 666 525 625T562 530Q562 473 525 419T430 335L416 329Q479 288 479 206Q479 142 440 89T344 7T229 -22Q173 -22 135 12T96 106Q96 192 157 192Q192 192 197 157Q197 134 184 117T142 96Q153 47 180 29Q201 15 232 15Q249 15 275 22Q307 34 331 57Q363 90 379 153T396 246Q396 261 393 272T384 290T371 301T355 308T341 311T326 312H316H307Q287 312 282 313T276 320Q276 323 279 337T283 352Q284 356 290 357T325 358Q364 359 368 360Q386 365 400 372T433 397T464 448T485 527Q487 535 487 556Q487 629 414 629Q350 629 298 580T245 476Q245 450 263 450H264Q280 450 294 463T308 496Q308 508 302 518T296 531'], - - // DIGIT FOUR - 0x34: [666,195,511,46,478,'448 34Q453 34 463 22T473 5Q473 -2 457 -7Q417 -22 383 -23H366L350 -91Q348 -98 345 -111T340 -130T335 -146T330 -161T325 -172T318 -182T310 -188T299 -193T286 -194Q256 -194 253 -165Q253 -159 271 -83T292 -5Q231 29 169 29Q114 29 91 14Q72 -2 65 1Q46 20 46 28Q46 35 55 43T77 60T96 74Q306 257 396 623Q410 666 444 666Q459 666 468 657T478 634Q478 627 470 595T440 504T387 381T303 239T187 99L164 75H178Q217 75 260 59L304 43Q304 48 325 127Q342 195 346 207T358 228Q372 242 391 242Q403 242 413 235T423 214Q423 205 402 116T378 25Q378 23 387 23Q405 23 418 25T439 31T448 34'], - - // DIGIT FIVE - 0x35: [667,22,511,106,567,'196 304Q189 309 189 314Q189 317 231 487T275 660Q278 666 283 666Q287 666 302 658T346 643T413 635Q447 635 481 642T537 658T559 666Q561 666 564 663T567 658Q565 637 557 629Q528 600 474 573T359 545Q342 545 327 546T304 550T294 552L291 540Q288 529 283 507T273 465L251 379Q307 420 364 420Q415 420 456 382T497 261Q497 165 429 82T262 -20Q256 -20 247 -21T233 -22Q176 -22 141 15T106 112Q106 208 173 208Q192 208 203 197T214 169Q214 143 195 125T156 107H153V100Q155 73 174 47T239 21Q245 21 259 23Q355 46 392 200Q393 205 394 207Q412 276 412 312Q412 352 396 367T358 383Q288 383 233 314Q226 306 224 305T209 304H196'], - - // DIGIT SIX - 0x36: [665,22,511,120,565,'377 434Q425 434 457 404T499 341T509 278Q509 243 496 194T456 105T383 27Q322 -22 256 -22Q142 -22 122 114Q120 130 120 159Q120 221 135 292T195 452T310 599Q390 665 465 665Q565 665 565 583V574Q565 543 546 524Q528 506 504 506Q491 506 478 514T465 543Q465 585 515 602Q505 626 466 626Q419 626 372 587Q334 557 305 503T266 409L255 370Q287 410 339 429Q361 434 377 434ZM424 333Q424 359 411 378T365 397Q318 397 282 356T230 257T205 157T197 94Q197 67 211 45T260 22Q313 22 341 57T386 151Q424 283 424 333'], - - // DIGIT SEVEN - 0x37: [666,22,511,136,634,'466 519Q448 519 435 528T416 550T400 571T376 581Q324 581 271 540T186 437Q185 435 183 432T181 428T179 426T177 424T174 423T171 422T165 422H159Q141 422 141 423Q136 423 136 431Q136 433 190 548T247 665Q249 666 266 666H282Q288 660 288 657Q288 655 284 646T276 628L273 620Q337 666 390 666Q413 666 425 652T438 620T444 584T457 559Q460 557 470 557Q497 557 524 582T571 635T594 665Q595 666 612 666H628Q634 660 634 657Q634 653 618 629T572 556T510 441T437 269T367 43Q356 -22 304 -22Q291 -22 278 -14T263 14Q263 36 281 95T354 269T486 507Q497 524 495 524Q482 519 466 519'], - - // DIGIT EIGHT - 0x38: [666,21,511,99,553,'209 449Q209 545 278 605T416 666Q482 666 517 631T553 546Q553 513 539 482T504 430T463 394T426 370L410 360L430 343Q471 309 483 278T495 211Q495 141 441 75Q363 -21 253 -21Q182 -21 141 18T99 117Q99 161 119 201T170 268T222 308T259 331L272 338L259 349Q212 389 209 449ZM492 542Q492 586 469 605T415 625Q360 625 320 587T279 505Q279 495 281 487T286 474T295 460T306 449T321 436T337 422Q379 386 380 386Q389 386 420 412T472 471Q492 513 492 542ZM163 118Q163 76 189 49T258 21Q316 21 368 64T420 170Q420 193 412 208T395 233T350 271L302 312Q298 312 284 303T249 276T209 235T177 181T163 118'], - - // DIGIT NINE - 0x39: [666,22,511,107,554,'297 211Q258 211 230 228T189 273T169 323T163 367Q163 411 183 472T254 585Q327 656 401 665Q403 665 412 665T427 666Q458 664 481 652T518 622T539 580T550 535T553 491Q553 448 544 395T515 277T454 148T358 37Q282 -22 213 -22Q166 -22 137 -1T107 55V64Q107 88 114 104T134 127T154 136T169 138Q185 138 196 128T207 101Q207 82 196 68T172 48L161 43Q161 40 167 36T187 26T219 21Q286 21 344 99Q364 126 382 169T408 241T417 275L412 269Q406 263 395 253T370 234T337 218T297 211ZM476 552Q476 626 417 626Q368 626 330 584Q312 563 300 533T270 433Q248 341 248 312Q248 286 262 267T310 248Q353 248 387 287T440 380T467 480T476 552'], - - // COLON - 0x3A: [431,0,307,107,308,'184 358Q184 385 206 408T258 431Q279 431 293 418T308 383Q308 354 284 332T233 310Q212 310 198 324T184 358ZM107 50Q107 76 129 98T181 121Q203 121 217 108T231 72Q231 47 210 24T156 0Q135 0 121 13T107 50'], - - // SEMICOLON - 0x3B: [431,195,307,70,308,'184 358Q184 385 206 408T258 431Q279 431 293 418T308 383Q308 354 284 332T233 310Q212 310 198 324T184 358ZM107 47Q107 77 130 99T180 121Q226 121 226 61Q226 25 214 -14T182 -84T144 -140T109 -180T88 -194T77 -185T70 -172Q70 -169 84 -155T121 -112T161 -48Q180 -10 180 3Q180 4 174 2Q172 2 166 1T156 0Q135 0 121 13T107 47'], - - // EQUALS SIGN - 0x3D: [367,-133,767,116,776,'776 357T776 347T761 327H470Q180 327 176 329Q164 334 164 347Q164 359 176 365Q179 367 470 367H761Q776 357 776 347ZM116 143T116 153T131 173H422Q713 173 717 171Q728 166 728 153T717 135Q713 133 422 133H131Q116 143 116 153'], - - // QUESTION MARK - 0x3F: [716,0,511,195,551,'235 431Q217 431 206 442T195 468Q195 490 215 537T280 638T380 707Q403 716 423 716Q425 716 429 716T436 715Q485 715 518 681T551 590Q551 543 530 503T482 439Q471 428 400 375T318 310Q300 287 300 259Q300 236 315 236Q333 236 352 251T384 300Q386 306 407 306H423Q429 300 429 297Q429 272 393 235T308 198Q287 198 269 215T251 270Q251 330 293 374L374 436Q377 438 401 456T432 480T457 503T481 531T494 561T501 598Q501 614 499 626Q482 678 430 678H426Q392 678 362 660T311 615T280 571T264 540L259 528Q259 527 266 526T283 516T294 492Q294 466 276 449T235 431ZM209 51Q212 83 235 102T281 121Q309 121 321 105T333 72Q333 45 311 23T258 0Q240 0 225 11T209 51'], - - // COMMERCIAL AT - 0x40: [705,12,767,152,789,'198 250Q198 155 248 91T394 26Q514 26 640 80L650 84H675H683Q709 84 709 76Q709 73 708 71Q706 64 660 45T534 8T383 -11T260 24T181 115Q152 168 152 248Q152 410 268 552Q303 590 324 608Q439 705 551 705Q611 705 658 683T733 623T775 543T789 454Q789 380 766 304T720 192Q677 125 617 125Q591 125 573 137T548 160T541 176Q541 178 540 178L534 173Q527 168 515 160T488 144T454 131T417 125Q361 125 320 166T279 284Q279 393 356 481T523 569Q570 569 603 537Q623 515 632 490L637 480L657 479Q684 479 684 470Q684 465 650 333L617 199V185Q616 162 628 162Q677 162 712 278Q743 381 743 442Q743 555 687 611T553 668Q467 668 385 608T250 450T198 250ZM598 445Q598 453 594 470T569 510T518 532Q463 532 410 448T356 271Q356 220 374 191T423 162Q482 162 552 255L575 348Q598 440 598 445'], - - // LATIN CAPITAL LETTER A - 0x41: [716,0,743,58,696,'85 46Q112 48 132 56T161 73T176 92T185 104Q185 106 353 407T524 709Q527 716 551 716Q568 716 572 712Q573 711 574 710Q576 708 594 384Q613 54 617 52H618Q626 46 672 46H689Q696 41 696 36Q696 13 683 0H670Q639 2 557 2Q526 2 500 2T459 2T441 1Q425 1 425 10Q425 12 427 24Q428 27 429 31T430 36T432 40T434 43T437 45T443 46T450 46Q514 46 514 69Q514 74 511 136L506 209H292L260 152Q222 84 222 74Q222 48 264 46Q280 46 280 35Q280 33 278 21Q275 7 272 4T259 0Q256 0 232 1T159 2Q135 2 109 1T78 0Q58 0 58 10Q58 14 61 26T66 40Q68 46 85 46ZM504 260Q503 263 496 407T486 553L466 520Q446 486 402 406L318 256Q318 255 411 255H504V260'], - - // LATIN CAPITAL LETTER B - 0x42: [683,0,704,57,732,'57 11Q57 38 69 45L74 46Q78 46 85 46T99 46Q134 47 145 50T162 62Q164 66 233 344T303 626Q303 627 302 629V631Q296 637 241 637H223Q217 642 217 645T219 664Q223 677 229 683H411L593 682L605 680Q616 678 628 675T660 662T694 639T720 601T732 547Q732 519 726 503Q710 452 662 414T556 360L545 357L556 355Q604 346 641 312T678 221Q678 155 622 92T482 8Q459 2 439 2T256 0H154H105Q74 0 66 2T57 11ZM629 549Q628 550 629 557T627 576T619 600T601 622T570 636Q564 637 490 637Q472 637 454 637T424 636T411 636Q399 635 395 622T364 500Q333 377 332 376Q332 374 408 374L485 375L495 377Q547 390 588 437T629 549ZM504 336Q500 337 410 337Q323 337 322 336Q322 334 305 263T270 122T252 51Q252 47 337 46Q346 46 361 46T384 45Q425 45 455 55T515 95Q574 156 574 235Q574 276 555 304T504 336'], - - // LATIN CAPITAL LETTER C - 0x43: [705,21,716,150,812,'395 -21Q279 -21 215 56T150 244Q150 402 265 543Q339 630 421 667T562 704Q596 704 604 703Q627 698 647 689T679 669T699 649T711 633T716 627L753 665Q790 704 792 704Q793 705 798 705Q812 705 812 698Q812 694 780 561Q744 422 744 421Q742 416 739 415T721 413H705Q699 419 699 426Q701 432 701 444Q705 464 705 493Q705 524 700 551T681 604T643 644T583 659Q480 659 387 570Q321 502 287 397T252 213Q252 123 297 74Q347 24 421 24Q500 24 564 89T653 240Q656 253 659 255T677 257Q700 257 700 248Q700 242 694 222Q681 183 656 143T593 65T504 3T395 -21'], - - // LATIN CAPITAL LETTER D - 0x44: [683,0,755,56,775,'56 11Q56 38 68 45L72 46Q77 46 84 46T98 46Q133 47 144 50T161 62Q163 66 232 344T302 626Q302 627 302 629L301 631Q295 637 240 637H222Q216 642 216 645T218 664Q222 677 228 683H403Q582 683 589 682Q672 674 723 608T775 440Q775 312 709 209T562 54Q502 14 432 2Q423 1 243 0H148H102Q72 0 64 2T56 11ZM254 51Q254 46 348 46Q395 46 422 50T484 71Q585 121 633 255Q679 396 679 477Q679 522 665 554T629 603T587 626T548 636Q547 636 536 636T510 636T480 637Q420 637 411 636T398 627Q396 623 325 339T254 51'], - - // LATIN CAPITAL LETTER E - 0x45: [680,0,678,54,743,'248 634Q216 634 214 638Q213 641 213 646Q213 674 224 678Q226 680 481 680H736Q743 676 743 669Q743 665 729 557T713 447Q711 440 690 440H675Q667 445 667 454Q667 455 671 481T675 536Q675 583 658 604T592 632Q574 634 475 634Q439 634 424 633T405 631T399 625Q397 622 367 501T336 377Q336 376 367 376H388Q451 376 477 389Q493 399 503 419T520 462T528 489Q531 493 549 493Q557 493 561 492T566 491T569 488T572 483L539 351Q507 221 503 216Q503 216 500 213H484Q468 213 465 216Q461 219 461 225Q461 228 466 250T472 290Q472 317 452 323T368 330H324Q323 326 289 191T255 51T331 46H360Q413 46 444 49T511 67T570 113Q589 137 608 175T638 242T652 272Q656 274 670 274Q693 274 693 262L648 148Q590 4 588 2Q585 0 323 0H61Q54 4 54 11Q54 27 61 41Q65 46 95 46Q131 47 142 50T159 62L194 200Q229 337 264 477T299 623Q299 630 292 631T248 634'], - - // LATIN CAPITAL LETTER F - 0x46: [680,-1,653,54,731,'299 623Q299 630 292 631T247 634H219Q213 640 213 642T215 661Q218 673 225 680H724Q731 676 731 669Q731 665 717 557T701 447Q699 440 678 440H663Q656 444 656 452Q656 457 659 485T663 538Q663 586 644 607T566 633Q564 633 535 633T486 634H458Q404 634 399 625Q396 620 364 492L332 363H380Q446 365 464 373Q496 389 514 458Q518 477 523 479Q527 480 541 480H556Q563 475 563 470Q563 467 532 339T498 207Q496 200 475 200H460Q453 207 453 212Q454 213 456 225T461 254T464 278Q464 304 445 310T369 317H321L289 190Q257 66 257 59Q257 54 261 52T283 48T337 46Q348 46 352 46T360 45T366 42T368 37Q368 32 365 23Q360 4 355 2Q352 1 342 1Q336 1 297 1T199 2Q138 2 106 2T71 1H68Q54 1 54 11Q54 38 66 45L70 46Q75 46 82 46T96 46Q131 47 142 50T159 62L194 200Q229 337 264 477T299 623'], - - // LATIN CAPITAL LETTER G - 0x47: [705,22,774,150,812,'632 -1Q629 -1 622 5T604 25T583 53Q508 -22 394 -22Q287 -22 219 52T150 244Q150 402 265 543Q339 630 421 667T562 704Q596 704 604 703Q627 698 647 689T679 669T699 649T711 633T716 627L753 665Q790 704 792 704Q793 705 798 705Q812 705 812 698Q812 694 780 561Q744 422 744 421Q742 416 739 415T721 413H705Q699 419 699 426Q701 432 701 444Q705 464 705 493Q705 524 700 551T681 604T643 644T583 659Q480 659 387 570Q319 501 286 394T252 208Q252 156 269 118T314 61T369 33T425 24Q470 24 509 46T566 104Q571 116 583 162T595 214Q595 222 583 223Q561 227 517 227H495Q488 230 488 238Q488 254 495 268Q500 273 511 273Q515 273 532 273T581 272T649 271Q731 271 752 273H761Q767 267 767 264T765 246Q761 233 755 227H742Q698 227 693 213L639 4Q636 -1 632 -1'], - - // LATIN CAPITAL LETTER H - 0x48: [683,0,743,54,860,'61 0Q54 7 54 11Q54 27 61 41Q65 46 95 46Q131 47 142 50T159 62Q161 66 230 344T300 626Q300 627 300 629L299 631Q293 637 238 637H220Q214 642 214 645T216 664Q220 677 226 683H239Q307 681 372 681Q480 681 486 683H496Q502 677 502 674T500 656Q496 643 490 637H472Q418 637 406 630Q400 627 396 612T367 500Q360 474 352 442T340 395L336 380Q336 378 466 378H596Q657 622 657 626Q657 627 656 629V631Q650 637 595 637H577Q571 642 571 645T573 664Q577 677 583 683H596Q664 681 729 681Q837 681 843 683H853Q860 676 860 672Q858 647 848 637H819Q783 636 772 634T756 623Q753 618 684 340T614 57Q614 50 621 49T666 46Q697 46 699 40Q701 37 698 21Q693 3 689 1Q686 0 677 0Q673 0 657 0T611 1T546 2Q453 2 428 0H418Q411 7 411 11Q411 27 418 41Q422 46 452 46Q488 47 499 50T516 62Q517 64 550 196T584 331Q584 332 454 332H324L291 197Q257 64 257 56Q257 50 265 49T309 46Q340 46 342 40Q344 37 341 21Q336 3 332 1Q329 0 320 0Q316 0 300 0T254 1T189 2Q96 2 71 0H61'], - - // LATIN CAPITAL LETTER I - 0x49: [683,0,386,49,508,'235 637Q217 637 213 638T209 649Q209 673 220 682Q222 683 237 683Q278 681 369 681Q404 681 441 682T483 683Q499 683 503 681T508 672Q508 670 505 658T500 643Q498 637 464 637Q425 635 415 633T398 621Q396 618 327 340T257 58T260 52T278 48T322 46Q349 46 349 36Q349 31 346 22Q342 4 337 1Q336 1 334 1T329 0Q325 0 307 0T258 1T190 2Q95 2 67 0H56Q49 7 49 11Q51 38 62 46H91Q129 47 141 50T159 62Q161 66 230 344T300 625Q300 637 235 637'], - - // LATIN CAPITAL LETTER J - 0x4A: [683,22,525,78,622,'361 637Q333 637 331 641Q330 644 330 649Q330 673 341 682Q343 683 360 683Q405 681 500 681Q551 681 577 681T607 682Q622 682 622 673Q622 665 616 647Q614 640 610 639T587 637Q547 636 541 624Q538 618 477 374T413 124Q391 64 333 22T207 -21T109 12T78 86Q78 130 101 150T149 170Q193 170 196 129Q196 100 178 80T137 58L132 57Q134 52 138 46T160 28T205 16Q242 16 273 48T319 122Q322 129 383 371T444 627Q444 637 361 637'], - - // LATIN CAPITAL LETTER K - 0x4B: [683,0,769,54,859,'668 621Q668 635 645 637Q629 637 629 648Q629 650 632 662T637 677Q640 682 653 682Q657 682 688 681T764 680Q786 680 810 681T839 682Q859 682 859 672Q859 655 852 643Q849 637 839 637Q804 637 768 621T717 595T697 578Q696 578 600 497L505 417L508 408Q543 311 574 227T618 106T632 69Q645 47 688 46H707Q713 38 713 37T710 19Q706 6 700 0H688Q659 2 587 2Q557 2 532 2T492 2T474 1Q458 1 458 10Q458 13 460 23Q464 39 466 42T480 46Q526 46 526 72Q526 75 476 213L427 350Q426 350 396 325T334 272T302 242Q302 241 299 230T290 194T279 150Q257 61 257 55Q257 50 265 49T309 46H337Q343 40 343 38T341 19Q337 6 331 0H316Q280 2 190 2Q158 2 131 2T89 2T70 1Q54 1 54 11Q54 38 66 45L70 46Q75 46 82 46T96 46Q131 47 142 50T159 62Q161 66 230 344T300 626Q300 627 300 629L299 631Q293 637 238 637H220Q214 642 214 645T216 664Q220 677 226 683H239Q307 681 372 681Q386 681 414 681T464 682L487 683H496Q502 677 502 674T500 656Q495 641 491 637H462Q426 636 415 634T399 623Q396 618 358 467L320 314Q321 314 484 452Q510 474 552 509Q625 570 646 590T668 621'], - - // LATIN CAPITAL LETTER L - 0x4C: [683,0,627,54,628,'61 0Q54 4 54 11Q54 27 61 41Q65 46 95 46Q131 47 142 50T159 62Q161 66 230 344T300 626Q300 627 300 629L299 631Q293 637 238 637H220Q214 642 214 645T216 664Q220 677 226 683H240Q275 681 371 681Q407 681 438 681T487 682T509 682Q527 682 527 674Q527 670 524 659Q523 657 523 654T522 649T520 645T519 642T517 640T515 639T512 638T507 637T502 637T494 637H478Q433 636 417 633T396 617Q395 614 325 334T255 51Q255 47 319 47Q387 47 410 52Q459 65 494 98T543 163T570 229T589 273H622Q628 264 628 262Q628 259 584 133T539 5Q537 1 511 1Q482 0 296 0H61'], - - // LATIN CAPITAL LETTER M - 0x4D: [683,0,897,58,1010,'72 1Q58 1 58 11Q58 33 66 41Q68 46 87 46Q150 50 168 84Q172 91 238 356T304 626Q304 627 304 629L303 631Q297 637 242 637H224Q218 642 218 645T220 664Q224 677 230 683H326H394Q417 683 422 682T429 676L480 127L502 163Q523 199 560 262T642 400Q801 668 805 676L817 683H1003Q1010 678 1010 672Q1010 650 997 637H979Q915 637 906 623Q903 618 834 340T764 57Q764 50 771 49T817 46H845Q851 38 851 37T848 19Q845 7 838 0H824Q789 2 701 2Q670 2 644 2T603 2T584 1Q569 1 569 11Q569 13 571 25Q576 42 581 45L586 46Q590 46 597 46T611 46Q646 47 657 50T674 62L813 616L634 313Q453 7 452 7Q446 0 428 0Q409 0 407 6Q405 10 379 304T351 604L285 348Q220 83 220 82Q220 65 233 57T279 46H295Q301 38 301 37T298 19Q295 7 288 0H275Q244 2 171 2Q145 2 123 2T88 2T72 1'], - - // LATIN CAPITAL LETTER N - 0x4E: [683,1,743,54,860,'633 637Q624 637 621 639T617 650Q617 670 630 683H641Q682 680 736 680Q836 680 845 683H853Q860 676 860 672Q858 647 848 637H832Q764 633 750 598Q746 590 673 300Q656 230 638 156T610 44L600 7Q598 0 576 0H559Q553 6 448 297L342 588Q341 588 279 336T216 81Q216 49 274 46Q293 46 295 40Q297 37 294 21Q293 19 292 16T291 11T290 7T289 4T287 2T284 1T280 1T275 0T263 0T229 1T167 2Q91 2 70 0H61Q54 7 54 11T57 27Q61 41 64 43T83 46Q146 50 164 84Q167 90 235 362L303 634Q300 635 253 637H220Q214 643 214 645T216 664Q220 677 226 683H314Q386 683 397 683T410 677Q412 675 501 428L591 179Q591 178 592 180T595 189T600 209T610 246T624 303T645 385Q698 595 698 606Q698 618 683 627T633 637'], - - // LATIN CAPITAL LETTER O - 0x4F: [704,22,767,149,788,'149 237Q149 326 186 413T282 563T412 665T552 704Q619 704 667 678T741 611T777 528T788 444Q788 328 728 219T572 44T377 -22Q275 -22 212 50T149 237ZM688 487Q688 570 650 617T548 665Q467 665 398 592T291 413T253 203Q253 119 290 70T387 20Q440 20 489 52T573 135T635 249T675 373T688 487'], - - // LATIN CAPITAL LETTER P - 0x50: [683,0,678,55,729,'62 0Q55 7 55 11Q55 27 62 41Q66 46 96 46Q132 47 143 50T160 62Q162 66 231 344T301 626Q301 627 300 629V631Q294 637 239 637H221Q215 642 215 645T217 664Q221 677 227 683H404H431H502Q578 683 615 675T684 636Q729 595 729 531Q729 462 671 396T524 308Q499 302 404 301H318L288 182Q258 63 258 55T310 46Q341 46 343 40Q345 37 342 21Q337 3 333 1Q330 0 321 0Q317 0 301 0T255 1T190 2Q97 2 72 0H62ZM626 555V562Q626 620 552 635Q546 636 481 637Q466 637 450 637T423 636T412 636Q401 635 398 627Q396 622 361 484Q353 452 344 416T330 362L325 344Q325 342 390 342H427Q523 342 567 386Q596 415 611 473T626 555'], - - // LATIN CAPITAL LETTER Q - 0x51: [704,195,767,149,788,'460 -107Q460 -72 464 -42T468 -7L457 -10Q446 -14 424 -18T379 -22Q276 -22 213 50T149 237Q149 326 186 413T282 563T412 665T552 704Q664 704 726 631T788 442Q788 305 703 180Q627 64 517 13L506 8Q506 7 508 -12T513 -38T522 -59T538 -79T565 -85Q604 -85 634 -59T672 0Q676 11 684 11Q693 11 695 2Q695 -1 690 -20T673 -69T644 -126T599 -174T538 -194Q464 -194 460 -110Q460 -108 460 -107ZM689 481Q689 578 646 621T551 665Q468 665 391 586Q321 512 285 399T249 202Q249 106 295 58Q310 41 314 41Q315 41 315 46Q315 83 344 118T420 154Q450 154 473 135Q493 114 500 69L502 58L512 65Q571 110 613 192T672 348T689 481ZM472 49Q472 118 415 118Q393 118 373 98T353 51Q353 18 386 18H387Q424 18 472 40V49'], - - // LATIN CAPITAL LETTER R - 0x52: [683,22,729,55,723,'62 0Q55 7 55 11Q55 27 62 41Q66 46 96 46Q132 47 143 50T160 62Q162 66 231 344T301 626Q301 627 300 629V631Q294 637 239 637H221Q215 642 215 645T217 664Q221 677 227 683H386Q554 682 569 679Q571 678 580 676Q643 662 680 623T717 533Q717 473 667 420T528 337L538 330Q563 314 578 286T594 228Q594 212 588 147T581 65Q581 36 589 26T616 16H618Q637 16 652 37Q668 57 677 94Q679 105 701 105T723 95Q723 89 717 72T698 33T662 -5T610 -22Q555 -22 513 3T471 88Q471 107 486 168T502 244Q502 303 452 320Q445 322 382 323H320L288 192Q255 63 255 55T307 46Q338 46 340 40Q342 37 339 21Q335 3 330 1Q326 0 320 0Q317 0 306 0T265 1T190 2Q99 2 73 0H62ZM612 558Q612 566 612 568T610 581T603 597T590 611T567 625T532 635Q526 636 470 637Q458 637 445 637T422 636T412 636Q402 635 397 627L390 598Q383 570 373 532T354 455T337 389T330 361Q356 360 384 360H415Q483 360 527 382Q557 399 574 424T604 498Q612 533 612 558'], - - // LATIN CAPITAL LETTER S - 0x53: [706,22,562,74,633,'198 460Q198 551 269 628T432 705Q516 705 557 644L583 673Q589 679 593 684T600 693T605 698T609 702T611 704T614 705T618 705H620Q633 705 633 698T605 577T573 459L570 456H554Q546 456 543 456T536 457T532 460T531 466Q531 469 533 489T536 532Q536 573 525 600T496 640T462 657T427 662Q369 662 325 612T281 503Q281 475 290 458T318 430T356 415T407 401T463 383Q506 360 522 323T538 258V244Q538 141 465 60T300 -22Q198 -22 152 41L143 31Q137 25 126 12T106 -10T95 -21L92 -22Q88 -22 86 -22Q81 -22 78 -20T74 -16V-14Q74 -11 132 221Q134 227 155 227H171Q177 221 177 215Q177 212 175 205T171 182T169 147Q171 99 195 70T246 33T306 25Q358 25 400 70T453 169Q455 180 455 203V210Q455 263 414 285Q409 288 347 305Q271 328 254 339Q239 350 224 371Q198 409 198 460'], - - // LATIN CAPITAL LETTER T - 0x54: [677,0,716,171,806,'178 437Q173 442 171 446Q171 451 238 654Q243 670 250 677H681H762Q792 677 799 676T806 667Q806 661 788 553T768 444Q768 437 746 437Q727 437 723 445Q723 450 729 492T736 562Q736 589 728 602T693 624Q675 630 622 630H595Q575 630 571 629T564 623Q562 621 492 342T422 59Q422 48 502 46H542Q548 38 548 37T545 19Q541 6 535 0H517Q475 2 357 2Q315 2 279 2T223 2T198 1Q179 1 179 9Q179 14 182 24Q187 42 190 44Q194 46 206 46H232Q289 47 301 49T326 65L395 344Q465 619 465 626Q465 629 462 629Q456 631 411 631Q364 631 336 625T288 597T255 549T224 467Q215 442 210 437H178'], - - // LATIN CAPITAL LETTER U - 0x55: [683,22,743,194,860,'636 637Q627 637 624 639T620 650Q620 670 633 683H644Q702 681 753 681Q760 681 772 681T796 681T820 682T838 683H845H853Q860 676 860 672Q858 647 848 637H832Q764 633 750 598Q745 588 698 400T648 204Q627 140 584 86Q484 -22 378 -22Q300 -22 247 31T194 167Q194 176 194 182T196 198T200 218T207 248T217 288T231 346T250 422Q300 618 300 626Q300 627 300 629L299 631Q293 637 238 637H220Q214 642 214 645T216 664Q220 677 226 683H239Q307 681 372 681Q480 681 486 683H496Q502 677 502 674T500 656Q496 643 490 637H472Q418 637 406 630Q400 627 394 603T344 410Q299 232 292 198T284 135Q284 102 294 78T322 44T355 29T387 24Q455 24 515 74T604 211Q605 215 653 404T701 607Q701 618 686 627T636 637'], - - // LATIN CAPITAL LETTER V - 0x56: [683,22,743,205,868,'667 637Q657 637 654 639T650 650Q650 670 663 683H675Q704 681 772 681Q793 681 818 682T847 683Q868 683 868 672Q868 670 865 658T860 643Q857 637 848 637Q785 637 749 587L394 -15Q387 -22 366 -22Q346 -22 342 -16Q341 -13 313 303Q285 622 285 623Q283 631 273 634T229 637Q205 637 205 648Q205 654 208 666T217 682Q219 683 230 683Q276 680 329 680Q444 680 456 683H466Q472 677 472 674T470 656Q466 643 460 637H448Q384 637 384 615Q385 612 406 371T427 126Q427 125 495 240T632 473T704 596Q707 604 707 609Q707 633 667 637'], - - // LATIN CAPITAL LETTER W - 0x57: [683,22,999,205,1124,'234 637H226Q205 637 205 648Q205 673 216 682Q218 683 231 683Q265 681 340 681Q371 681 404 682T443 683Q458 683 462 681T467 672Q467 670 464 658T459 643Q457 637 434 637Q407 636 394 632T378 623T376 613Q376 589 385 377T394 149L511 361Q542 419 596 519L613 551L612 585Q610 621 610 624Q608 637 559 637H555Q537 637 537 647Q537 654 540 664Q544 677 550 683H561Q600 680 656 680Q771 680 783 683H792Q798 677 798 675T796 658Q792 643 790 640T778 637H774Q721 637 708 620L717 385Q726 150 727 149Q727 148 752 193T812 303T882 433T942 546T969 596Q970 600 970 606Q970 610 969 613T966 620T961 625T955 628T949 631T941 633T934 634T927 636T920 637Q903 637 903 648Q903 650 905 664Q909 677 915 683H928Q960 681 1031 681Q1050 681 1073 681T1101 682Q1124 682 1124 672Q1124 655 1117 643Q1114 637 1104 637Q1085 637 1069 632T1043 618T1026 603T1014 588L1009 580L687 -16Q681 -22 660 -22Q643 -22 637 -16Q635 -14 627 223Q617 441 617 464L602 441Q578 397 487 228Q456 171 423 110T372 17T355 -15Q348 -22 328 -22Q312 -22 308 -20T303 -9Q303 -5 291 310T277 627Q273 636 234 637'], - - // LATIN CAPITAL LETTER X - 0x58: [683,0,743,50,825,'684 0Q670 0 634 1T569 2Q512 2 482 2T449 1Q433 1 433 10Q433 11 435 25Q437 34 438 37T442 43T448 45T459 46T476 49Q506 58 506 64Q506 65 467 179T426 295L382 244Q339 194 295 142T249 86Q245 79 245 72Q245 48 279 46Q293 46 293 32Q293 13 280 0H268Q206 2 151 2Q70 2 64 0Q50 0 50 11Q50 15 53 27Q57 41 60 43T78 46Q154 49 205 100Q207 103 312 225L411 341L407 353Q404 360 381 428T336 560T310 627Q301 636 255 637H229Q223 643 223 645T225 664Q229 677 235 683H246Q288 680 346 680Q462 680 477 683H487Q493 677 493 674T491 656Q488 644 485 641T471 637Q461 635 454 635Q419 626 421 619Q421 617 453 524T486 430T554 509T624 593Q631 604 631 611Q631 622 621 629T598 637Q583 637 583 648Q583 650 585 660Q589 676 591 679T602 683Q606 683 637 682T715 680Q742 680 771 681T804 682Q825 682 825 672Q825 650 817 642Q814 637 797 637Q739 634 700 608Q684 597 659 569T505 389L501 384L557 222Q612 61 616 57Q625 47 671 46Q691 46 697 45T704 36Q704 35 702 23Q701 19 700 14T699 7T696 3T692 1T684 0'], - - // LATIN CAPITAL LETTER Y - 0x59: [683,0,743,198,875,'232 637Q198 637 198 647Q198 651 201 664T210 682Q212 683 223 683Q269 680 325 680Q443 680 455 683H465Q472 676 472 672Q472 656 465 642Q460 637 441 637Q395 634 395 623Q395 621 438 478T482 334T583 460T688 591Q688 593 694 601T700 617Q700 637 668 637H666Q655 637 655 648Q655 654 658 664Q660 672 660 673T663 678T668 682T677 683Q680 683 704 682T776 680Q801 680 828 681T858 682Q875 682 875 673Q875 669 872 657T867 643Q865 637 848 637Q788 634 749 597Q733 581 608 424L487 273L461 170Q454 145 448 118T438 76T434 60Q434 54 436 52T452 48T496 46H514Q520 41 520 38T518 19Q514 6 508 0H495Q427 2 364 2Q350 2 323 2T272 0H250H241Q234 7 234 11Q234 27 241 41Q245 46 275 46Q312 47 323 50T340 64Q340 65 344 79T355 120T368 171L393 274L341 448Q288 622 286 626Q278 636 232 637'], - - // LATIN CAPITAL LETTER Z - 0x5A: [683,1,613,80,704,'203 452Q203 455 236 565T270 677Q270 681 274 681Q276 683 488 683H699Q704 678 704 675Q704 663 697 649Q697 647 449 348L201 50L266 49H301Q442 49 495 116Q525 155 556 251Q563 274 565 278T579 282H585Q609 285 609 271Q609 270 570 142T528 8T518 1T466 0H303Q253 0 197 0T131 -1Q112 -1 102 -1T87 1T81 3T80 8Q80 30 89 39Q90 41 204 178T446 470T575 626L584 637H512H504H475Q446 637 426 635T378 624T330 597T289 546T254 467Q247 446 243 444Q239 442 226 442Q203 442 203 452'], - - // LEFT SQUARE BRACKET - 0x5B: [750,250,307,73,446,'205 -221Q205 -239 194 -250H137H106Q73 -250 73 -242Q73 -232 194 255T321 747L324 750H381H417Q435 750 440 748T446 739Q446 730 443 723T437 712L434 710H350L349 706Q349 704 235 249T120 -208Q120 -210 159 -210Q166 -210 175 -210T187 -209Q205 -209 205 -221'], - - // RIGHT SQUARE BRACKET - 0x5D: [750,250,307,-14,359,'227 721Q227 739 238 750H295H326Q359 750 359 742Q359 732 238 245T111 -247L108 -250H51H15Q-3 -250 -8 -248T-14 -239Q-14 -230 -11 -223T-5 -212L-2 -210H82L83 -206Q83 -204 197 251T312 708Q312 710 273 710Q266 710 257 710T245 709Q227 709 227 721'], - - // CIRCUMFLEX ACCENT - 0x5E: [694,-527,511,260,528,'528 555Q528 549 514 538T496 527Q491 527 470 554Q458 569 449 580L414 625L353 578Q339 567 323 555T298 536L290 529Q286 527 285 527Q279 527 273 533T264 546L260 553Q260 559 263 562Q265 564 342 628T421 693T425 694Q430 694 433 691Q528 563 528 555'], - - // LOW LINE - 0x5F: [-25,62,511,91,554,'98 -62Q91 -58 91 -51Q91 -31 100 -26Q102 -25 324 -25H442H500Q536 -25 545 -27T554 -36Q554 -50 548 -56Q546 -60 538 -61Q520 -62 319 -62H98'], - - // LATIN SMALL LETTER A - 0x61: [442,11,511,101,543,'418 53Q418 26 438 26Q466 26 494 131Q500 151 504 152Q507 153 516 153H521Q531 153 534 153T540 150T543 144Q543 141 540 126T529 88T509 43T477 5T434 -11Q404 -11 383 3T354 30T347 48H346Q345 47 342 45T337 40Q282 -11 228 -11Q172 -11 137 34T101 146Q101 260 177 351T333 442Q343 442 352 441T369 437T382 431T393 425T402 417T409 410T414 402T419 396Q423 406 436 414T461 422Q475 422 484 413T494 395Q494 384 459 244T420 88Q418 80 418 58V53ZM397 323Q397 344 382 374T333 405Q302 405 271 372Q249 349 235 316T203 215Q184 135 184 108V100V94Q184 54 207 35Q218 26 235 26Q279 26 330 91Q343 109 346 118T372 217Q397 317 397 323'], - - // LATIN SMALL LETTER B - 0x62: [694,11,460,108,467,'158 683Q163 683 223 688T300 694Q312 694 312 685T279 544Q243 405 243 403L256 412Q268 422 292 432T338 442Q395 442 431 398T467 284Q467 175 393 82T229 -11Q175 -11 142 32T108 142Q108 176 115 207T166 412Q177 458 190 510T209 588T216 616Q216 629 209 632T170 637H149Q143 643 143 645T145 664Q150 683 158 683ZM178 109Q178 27 234 27Q247 27 254 29Q295 44 323 94Q343 129 363 208T384 332Q384 354 382 361Q369 405 332 405Q282 405 228 326L222 317L205 250Q178 142 178 109'], - - // LATIN SMALL LETTER C - 0x63: [441,10,460,103,469,'257 -10Q183 -10 143 37T103 155Q103 257 173 341T337 440Q341 441 348 441H358Q421 441 445 415T469 356Q469 320 450 305T410 289Q392 289 381 299T370 325Q370 362 404 378L414 383Q392 402 365 405Q322 405 285 375T227 294Q217 271 202 213T187 119Q187 27 263 27Q299 27 330 40Q361 51 386 71T424 106T440 121Q444 121 455 110T466 96Q466 92 458 81T432 54T390 24T331 0T257 -10'], - - // LATIN SMALL LETTER D - 0x64: [694,11,511,101,567,'418 54Q418 26 438 26Q466 26 494 131Q500 151 504 152Q507 153 516 153H521H526Q543 153 543 144Q543 143 541 129Q531 91 521 65T487 14T434 -11T383 3T354 30T347 48H346Q345 47 342 45T337 40Q282 -11 228 -11Q172 -11 137 34T101 146Q101 255 174 348T337 441Q354 441 368 437T390 427T404 414T413 404T417 400L471 616Q471 629 464 632T425 637H404Q398 643 398 645T400 664Q405 683 413 683Q418 683 478 688T555 694Q567 694 567 686Q567 676 495 389L419 86Q418 80 418 61V54ZM397 323Q397 329 394 340T385 367T365 394T333 405Q302 405 271 372Q249 349 235 316T203 215Q184 135 184 108V100Q184 71 191 56Q204 26 235 26Q267 26 300 57T344 112Q347 117 372 217T397 323'], - - // LATIN SMALL LETTER E - 0x65: [442,10,460,107,470,'107 166Q107 230 131 283T193 369T270 420T345 441Q346 441 352 441T361 442H364Q409 442 439 418T470 355Q470 270 366 239Q308 223 218 223H205Q189 164 189 125Q189 83 206 55T261 27Q309 27 353 50T426 109Q436 121 440 121T453 111T466 97Q469 92 455 77Q424 41 372 16T258 -10Q184 -10 146 41T107 166ZM416 333T416 354T401 390T360 405Q322 405 292 384T246 336T223 288T215 261Q215 260 240 260Q262 261 276 262T314 266T353 275T384 291T408 317'], - - // LATIN SMALL LETTER F - 0x66: [705,204,307,-23,450,'351 608Q351 642 389 661Q368 668 365 668Q358 668 352 664Q349 663 347 661T342 654T337 647T333 637T330 627T327 614T324 601T321 587T318 571L291 432Q291 431 343 431H394Q400 426 400 423T398 404Q394 390 389 386L335 385H282L255 246Q212 20 189 -51Q136 -199 58 -204Q22 -204 0 -185T-23 -134Q-23 -100 -3 -85T37 -69Q54 -69 65 -80T76 -108Q76 -115 75 -119Q70 -134 61 -144T46 -158L39 -161Q39 -162 42 -163T50 -166T61 -168Q77 -168 91 -145Q98 -128 105 -95L125 -1Q145 90 146 98Q149 109 163 180T189 317T202 384T158 385H114Q108 390 108 393T110 412Q113 424 120 431H165Q211 431 211 433Q213 435 219 473T237 561T266 639Q282 667 310 686T367 705Q402 705 426 686T450 635Q450 600 430 585T390 569Q373 569 362 580T351 608'], - - // LATIN SMALL LETTER G - 0x67: [442,205,460,46,494,'103 163Q106 263 173 347T320 441Q322 441 329 441T341 442Q387 439 419 398Q420 399 420 400Q421 402 425 406T440 416T464 422Q476 421 485 413T494 396Q494 386 465 268T407 38T377 -77Q365 -123 310 -164T179 -205Q46 -205 46 -139Q46 -114 64 -97T106 -79Q127 -79 136 -91T146 -115Q146 -127 141 -138T130 -155T124 -162T125 -163Q133 -166 170 -168Q200 -168 217 -162Q242 -153 264 -130T297 -78Q298 -74 305 -46T320 10T327 38Q326 38 317 31T291 15T256 2Q249 1 231 1Q182 1 143 38T103 163ZM398 324Q398 330 395 346T375 383T332 405Q330 405 326 405T320 404Q291 396 263 365Q230 324 208 239T185 115Q185 38 238 38Q258 38 279 50T312 77T336 106L348 122Q349 125 373 223T398 324'], - - // LATIN SMALL LETTER H - 0x68: [694,11,511,69,545,'398 44Q398 26 414 26Q431 26 451 43Q477 71 496 136Q499 148 501 150T515 153H521Q531 153 534 153T541 150T544 143Q544 133 534 105T496 41T432 -8Q424 -10 408 -10Q370 -10 348 12T326 72Q326 93 342 135Q397 288 397 349Q397 367 396 372Q386 405 357 405Q283 405 228 310Q217 290 212 274T180 152Q153 42 148 26T135 3Q121 -11 102 -11Q89 -11 80 -3T69 19L216 616Q216 629 209 632T170 637H149Q143 643 143 645T145 664Q150 683 158 683Q163 683 223 688T300 694Q312 694 312 685Q312 674 277 539Q241 395 241 393Q242 394 249 399T259 407T271 415T285 424T300 431T318 437T338 440T362 442Q423 442 449 410T475 338Q475 290 437 178T398 44'], - - // LATIN SMALL LETTER I - 0x69: [656,10,307,75,341,'234 599Q234 620 251 638T292 656Q306 656 319 647T332 617Q332 594 313 577T273 560Q260 560 247 569T234 599ZM75 287Q75 292 82 313T103 362T142 413T196 441H214Q248 441 270 419T293 357Q292 338 289 330T245 208Q193 72 193 46Q193 26 209 26Q228 26 247 43Q273 71 292 136Q295 148 297 150T311 153H317Q327 153 330 153T337 150T340 143Q340 133 330 105T292 41T228 -8Q220 -10 204 -10Q160 -10 141 15T122 71Q122 98 171 227T221 384Q221 396 218 400T203 405Q175 403 156 374T128 312T116 279Q115 278 97 278H81Q75 284 75 287'], - - // LATIN SMALL LETTER J - 0x6A: [656,204,307,-32,364,'266 600Q266 622 283 639T322 656Q340 656 352 645T364 616Q364 596 347 578T305 560Q291 560 279 569T266 600ZM75 287Q75 293 86 316T117 369T168 420T236 442Q282 442 304 415T327 358V332L278 134Q269 98 260 60T246 3T236 -36T227 -66T220 -85T213 -101T204 -114Q181 -150 139 -177T46 -204Q8 -204 -12 -186T-32 -140Q-32 -112 -14 -96T27 -79Q48 -79 57 -91T67 -114Q67 -146 38 -166Q42 -168 49 -168Q75 -168 98 -147T130 -108T146 -71Q150 -59 199 138T250 346Q253 359 253 373Q253 405 230 405Q206 405 184 386T149 345T126 301L117 280Q115 278 98 278H81Q75 284 75 287'], - - // LATIN SMALL LETTER K - 0x6B: [694,11,460,69,498,'158 683Q163 683 223 688T300 694Q312 694 312 686Q312 679 262 478L211 273Q212 272 219 276T248 299T296 349Q317 371 328 382T360 410T399 434T439 442Q462 442 480 427T498 373Q498 329 479 313T437 296Q420 296 409 305T398 331Q398 357 413 372T445 391Q454 392 448 399Q445 405 431 405Q408 405 377 385Q351 368 314 327T250 261Q243 257 243 254Q249 254 279 243T328 220Q366 192 366 146Q366 131 361 109T355 62V54Q355 26 376 26Q379 26 387 28Q420 36 443 130Q449 151 454 152Q457 153 465 153H470Q484 153 488 152T492 144Q492 141 489 126T476 88T454 42T420 5T372 -11Q331 -11 306 17T280 88Q280 100 283 119T287 146Q287 172 265 190T221 215T198 220Q197 220 173 121Q152 37 148 24T135 3Q121 -11 102 -11Q89 -11 80 -3T69 19L216 616Q216 629 209 632T170 637H149Q143 643 143 645T145 664Q150 683 158 683'], - - // LATIN SMALL LETTER L - 0x6C: [694,11,256,87,312,'162 61Q162 26 183 26Q211 26 239 131Q245 151 249 152Q252 153 261 153H266H271Q288 153 288 144Q288 143 286 129Q276 91 266 65T232 14T179 -11Q144 -11 116 12T87 81Q87 96 88 102L216 616Q216 629 209 632T170 637H149Q143 643 143 645T145 664Q150 683 158 683Q163 683 223 688T300 694Q312 694 312 686Q312 676 240 389L164 86Q162 74 162 61'], - - // LATIN SMALL LETTER M - 0x6D: [442,11,818,75,852,'81 278Q75 284 75 289Q77 299 89 338Q101 373 114 396T142 428T166 439T186 442H189Q225 440 251 417Q266 401 271 384L275 374L286 386Q342 442 414 442Q428 442 440 440T461 435T479 427T493 418T503 407T511 397T516 387T520 378T523 370L524 366Q546 395 583 418T667 442Q729 442 755 411T782 338Q782 290 743 178T704 45Q704 26 720 26Q773 26 802 136Q805 148 807 150T822 153H828Q838 153 841 153T848 150T851 143Q851 137 843 115T821 63T778 12T715 -10Q671 -10 652 16T632 71Q632 88 668 191T704 349Q704 367 703 372Q693 405 664 405Q637 405 613 393T571 360T547 329T534 309Q523 290 518 274T487 151Q455 24 452 16Q438 -11 408 -11T376 18Q376 26 411 167T447 314Q449 325 449 346Q449 372 444 384Q431 405 408 405Q334 405 276 305Q266 289 262 273T231 151Q199 24 196 16Q182 -11 152 -11T120 18Q120 26 159 182T200 347Q202 361 202 372Q202 405 181 405Q168 405 159 391Q145 374 132 328T117 280T98 278H81'], - - // LATIN SMALL LETTER N - 0x6E: [443,11,562,75,596,'449 44Q449 26 465 26Q482 26 502 43Q528 71 547 136Q550 148 552 150T566 153H572Q582 153 585 153T592 150T595 143Q595 133 585 105T547 41T483 -8Q475 -10 459 -10Q421 -10 399 12T377 72Q377 93 393 135Q448 288 448 349Q448 367 447 372Q437 405 408 405Q381 405 357 393T315 360T291 329T278 309Q267 290 262 274T231 151Q199 24 196 16Q182 -11 152 -11T120 18Q120 23 159 181Q199 343 199 346Q202 360 202 372Q202 406 183 406Q163 406 148 374Q142 360 135 338T124 299T117 280T98 278H81Q75 284 75 287Q76 293 78 303T90 341T110 388T141 425T184 442Q195 442 204 441T221 436T235 429T247 421T256 412T262 403T267 394T271 387T273 381L274 378V374L287 387Q342 442 414 442Q474 442 500 410T526 338Q526 290 488 178T449 44'], - - // LATIN SMALL LETTER O - 0x6F: [442,11,511,103,517,'103 155Q103 266 185 354T366 442Q435 442 476 394T517 275Q517 169 436 79T255 -11Q194 -11 149 32T103 155ZM187 119Q187 67 209 47T260 26Q290 26 321 47Q354 68 380 113T426 260Q432 291 432 315Q432 361 408 385Q388 405 358 405Q319 405 283 374T227 294Q217 271 202 213T187 119'], - - // LATIN SMALL LETTER P - 0x70: [442,194,511,6,518,'81 278Q75 284 75 287Q93 379 131 417Q154 442 189 442Q222 440 243 423T272 382L280 390Q335 442 389 442Q446 442 482 398T518 284Q518 212 480 137T375 19Q321 -10 291 -10H282H278Q237 -10 204 28L202 32L181 -51Q160 -135 160 -139Q160 -147 205 -148H230Q236 -155 236 -157T233 -175Q230 -187 227 -190T214 -194Q211 -194 202 -194T169 -193T108 -192Q40 -192 21 -194H13Q6 -187 6 -183T9 -167Q13 -153 16 -151T39 -148Q73 -147 78 -136Q82 -128 139 104Q199 337 199 347Q202 362 202 372Q202 406 182 406Q169 406 159 391Q145 374 132 328T117 280T98 278H81ZM221 111Q234 26 286 26Q307 26 336 47T385 116Q398 147 416 217T435 332Q435 354 433 361Q420 405 383 405Q333 405 279 326L273 317L221 111'], - - // LATIN SMALL LETTER Q - 0x71: [442,194,460,101,504,'228 -11Q172 -11 137 33T101 147Q101 205 125 266T201 377T318 441Q322 442 333 442Q388 442 420 394L429 403Q439 413 455 423T481 437T494 442Q498 442 501 439T504 434Q504 425 435 149Q364 -135 364 -139Q364 -147 409 -148H434Q440 -155 440 -157T437 -175Q433 -191 429 -193Q425 -194 418 -194Q416 -194 406 -194T372 -193T309 -192Q259 -192 233 -192T204 -193Q190 -193 190 -184Q190 -181 192 -169Q196 -153 199 -151T219 -148Q266 -148 277 -141Q283 -137 305 -51L325 29L316 22Q270 -11 228 -11ZM397 323Q397 329 394 340T385 367T365 394T333 405Q302 405 271 372Q249 349 235 316T203 215Q184 135 184 108V100Q184 71 191 56Q204 26 235 26Q267 26 300 57T344 112Q347 117 372 217T397 323'], - - // LATIN SMALL LETTER R - 0x72: [442,11,422,75,484,'81 278Q75 284 75 289Q77 301 89 339Q122 442 183 442Q219 442 241 425T271 384L283 396Q327 442 384 442Q424 442 454 421T484 362Q484 327 464 312T424 296Q407 296 396 305T385 331Q385 352 394 365T414 384T424 390Q409 405 378 405Q322 405 276 315L268 300L234 161Q200 25 196 16Q182 -11 152 -11T120 18Q120 23 159 181Q199 343 199 346Q202 360 202 372Q202 405 182 405Q164 405 150 377T128 316T117 280Q115 278 98 278H81'], - - // LATIN SMALL LETTER S - 0x73: [442,11,409,76,418,'153 285Q153 349 197 395T311 442Q355 442 386 420T418 356Q418 321 401 308T365 294Q336 294 331 326Q331 336 334 345T343 359T353 368T362 374L366 376Q365 379 362 383T344 396T308 404Q265 404 246 377T226 325T244 289T287 275T339 258T383 212Q395 188 395 163Q395 132 379 95T333 32Q279 -11 207 -11Q154 -11 115 13T76 86Q76 108 83 123T102 145T121 153T135 156Q154 156 164 145T175 117Q175 82 142 66L132 62Q131 62 131 61Q131 57 139 49T166 34T210 26Q250 26 277 44T312 83T321 123Q321 153 301 166T248 185T204 198Q176 211 162 241Q153 258 153 285'], - - // LATIN SMALL LETTER T - 0x74: [626,11,332,87,373,'94 385Q87 392 87 395Q87 399 90 411T95 425Q97 430 103 430T149 431H196L215 511Q218 521 222 539T228 565T234 585T242 603T251 615T264 623T281 626Q311 626 315 597Q315 591 296 513T275 433Q275 431 320 431H366Q373 424 373 420Q373 398 360 385H263L189 86Q188 80 188 61V54Q188 29 201 27Q213 23 229 30Q253 37 276 66T316 138Q321 149 324 151T342 153H347Q364 153 364 146T360 130Q331 63 290 26T202 -11Q158 -11 135 18T111 81Q111 93 129 168T166 314L184 383Q184 385 139 385H94'], - - // LATIN SMALL LETTER U - 0x75: [441,11,537,75,570,'75 287Q75 299 89 333T135 404T205 441Q246 441 269 420T293 357Q292 338 259 245T225 95Q225 26 274 26Q301 26 324 43T358 77T369 99Q369 102 406 249T446 404Q460 431 490 431T522 402Q522 394 485 245T446 89Q443 74 443 56Q443 28 461 26Q487 26 507 86Q524 130 524 146Q524 147 530 153H547Q570 153 570 144Q570 138 561 109T544 62Q530 29 512 12Q492 -11 454 -11Q429 -9 410 2T385 23T376 41L363 28Q350 16 325 3T269 -10Q204 -10 176 25T148 108Q148 161 184 262T221 383Q221 405 206 405Q178 405 158 375T128 313T116 279Q115 278 97 278H81Q75 284 75 287'], - - // LATIN SMALL LETTER V - 0x76: [443,10,460,75,492,'387 386Q387 407 406 425T445 443Q466 443 479 423T492 371Q492 330 473 253Q411 18 307 -8Q298 -10 279 -10Q208 -10 179 26T149 114Q149 162 185 261T221 384Q221 405 206 405Q177 405 157 375T128 313T116 279Q115 278 97 278H81Q75 284 75 287T79 304T93 342T119 388T158 425T210 441H218Q243 441 268 421T293 357Q292 337 259 245T226 102Q226 26 285 26Q328 26 360 72T422 237Q429 265 429 290Q428 324 408 349T387 386'], - - // LATIN SMALL LETTER W - 0x77: [443,11,664,75,696,'591 386Q591 407 610 425T649 443Q670 443 683 423T696 371Q696 327 672 232T621 85Q575 -11 493 -11Q469 -11 449 -6T418 8T398 24T386 38L382 43Q347 -10 293 -10H286Q221 -10 186 21T150 115Q150 164 185 262T221 384Q221 405 206 405Q177 405 157 375T128 313T116 279Q115 278 97 278H81Q75 284 75 287T79 304T93 342T119 388T158 425T210 441H218Q243 441 268 421T293 357Q292 336 260 246T227 108Q227 26 292 26H295Q332 26 361 93L366 103V119Q366 122 367 133T369 150Q372 167 401 282T433 404Q446 431 477 431Q507 431 509 402Q509 396 500 358T474 254T446 140Q444 126 444 104V92Q444 66 459 46T502 26H505Q527 28 545 43T577 88T602 149T623 226Q633 265 633 290Q632 324 612 349T591 386'], - - // LATIN SMALL LETTER X - 0x78: [442,11,464,58,513,'275 356Q275 383 262 394T233 405Q196 405 166 371T121 289Q119 280 116 279T98 278H81Q77 282 76 283T75 288T78 300Q88 332 109 363T153 411Q195 442 235 442Q306 442 333 386Q373 442 427 442Q461 442 487 421T513 364T494 312T453 296Q436 296 425 305T414 331Q414 352 424 366T446 386L456 390Q448 404 421 404H418Q382 404 358 341Q355 332 328 227T298 105Q295 90 295 75Q295 26 339 26Q365 26 388 43T424 82T444 123T451 146L457 153H474Q490 153 493 152T496 144Q496 133 486 110T456 58T404 10T333 -11Q276 -11 237 45Q197 -11 146 -11Q108 -11 83 10T58 67Q58 99 76 117T119 135Q136 135 147 124T158 96Q158 89 157 85Q149 57 125 45L115 41Q125 26 151 26Q171 26 187 45T214 93Q217 102 244 210T273 330Q275 339 275 356'], - - // LATIN SMALL LETTER Y - 0x79: [441,205,486,75,522,'75 287Q75 299 89 333T135 404T205 441Q246 441 269 420T293 357Q292 338 259 245T225 95Q225 26 274 26Q325 26 367 93L405 245Q442 393 446 404Q460 431 490 431T522 402Q522 400 416 -24Q389 -102 327 -153T196 -205Q152 -205 122 -181T91 -119Q91 -84 110 -67T152 -49Q170 -49 180 -60T191 -87Q191 -108 174 -128Q167 -134 157 -138T146 -144Q155 -153 159 -156T173 -163T199 -167Q229 -167 255 -149T297 -105T325 -52T342 -6T347 15Q315 -10 269 -10Q204 -10 176 25T148 108Q148 161 184 262T221 383Q221 405 206 405Q178 405 158 375T128 313T116 279Q115 278 97 278H81Q75 284 75 287'], - - // LATIN SMALL LETTER Z - 0x7A: [442,11,409,54,466,'160 317Q158 317 155 317Q136 317 136 324Q136 351 171 396T260 442Q292 442 321 410T365 375H369Q384 375 404 408L425 441Q427 442 444 442H460Q466 436 466 434Q466 419 426 367Q387 314 294 222T178 105L170 95L181 94Q198 93 236 81T295 68Q328 68 356 89T395 141Q398 150 401 151T419 153Q441 153 441 144Q441 110 394 50T282 -11Q251 -11 221 23T171 57Q157 57 143 47T121 26T104 3T95 -10Q93 -11 76 -11H60Q54 -5 54 -2Q54 3 61 14Q103 88 233 215Q349 329 349 338L302 351Q269 362 247 362Q227 362 212 356T192 342T183 327T178 320Q175 317 160 317'], - - // TILDE - 0x7E: [318,-208,511,247,571,'266 208Q262 208 255 215T247 228Q247 233 250 236T274 259Q335 318 369 318Q394 318 420 292T464 265Q485 265 516 291T550 318Q554 318 562 311T571 297Q570 293 551 273T502 231T451 209H447Q421 209 396 235T355 261Q334 261 301 235T266 208'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Italic/BasicLatin.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/CombDiacritMarks.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/CombDiacritMarks.js deleted file mode 100644 index 0222ffcdce..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/CombDiacritMarks.js +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Italic/CombDiacritMarks.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-italic'], - { - // COMBINING GRAVE ACCENT - 0x300: [697,-500,0,-222,-74,'-222 651Q-222 668 -206 682T-174 697Q-155 697 -145 680Q-140 671 -107 599T-74 526Q-74 522 -88 511T-107 500Q-109 500 -113 502T-167 568T-219 637Q-222 643 -222 651'], - - // COMBINING ACUTE ACCENT - 0x301: [697,-500,0,-173,39,'-148 500Q-154 500 -163 511T-173 528Q-173 529 -172 530V532Q-170 534 -97 610T-21 688Q-8 697 4 697Q19 697 29 688T39 663T30 638Q26 631 -50 573L-135 507Q-144 500 -148 500'], - - // COMBINING CIRCUMFLEX ACCENT - 0x302: [694,-527,0,-251,17,'17 555Q17 549 3 538T-15 527Q-20 527 -41 554Q-53 569 -62 580L-97 625L-158 578Q-172 567 -188 555T-212 536L-221 529Q-225 527 -226 527Q-232 527 -238 533T-248 546L-251 553Q-251 559 -248 562Q-246 564 -169 628T-90 693T-86 694Q-81 694 -78 691Q17 563 17 555'], - - // COMBINING TILDE - 0x303: [668,-558,0,-264,60,'-245 558Q-249 558 -256 565T-264 578Q-264 583 -261 586T-237 609Q-176 668 -142 668Q-117 668 -91 642T-47 615Q-26 615 5 641T39 668Q43 668 51 661T60 647Q59 643 40 623T-9 581T-60 559H-64Q-90 559 -115 585T-156 611Q-177 611 -210 585T-245 558'], - - // COMBINING MACRON - 0x304: [589,-544,0,-282,54,'-275 544Q-282 548 -282 554Q-282 561 -279 573T-271 588Q-269 589 -111 589H-27H12Q38 589 46 587T54 578Q54 574 51 563T47 550Q45 546 32 545Q15 544 -118 544H-275'], - - // COMBINING BREVE - 0x306: [694,-515,0,-237,62,'-237 641Q-237 694 -218 694H-213Q-195 694 -195 684Q-195 683 -195 679T-197 667T-198 650Q-198 611 -176 589T-117 566Q-74 566 -34 597T23 678Q27 689 30 691T43 694Q62 694 62 684Q62 671 49 645T14 589T-46 537T-123 515Q-175 515 -206 550T-237 641'], - - // COMBINING DOT ABOVE - 0x307: [669,-548,0,-165,-41,'-165 599Q-162 631 -139 650T-93 669Q-65 669 -53 653T-41 620Q-41 593 -63 571T-116 548Q-134 548 -149 559T-165 599'], - - // COMBINING DIAERESIS - 0x308: [669,-554,0,-251,45,'-251 601Q-251 626 -230 647T-180 669Q-139 669 -133 625Q-133 595 -155 575T-203 554Q-223 554 -237 567T-251 601ZM-72 599Q-72 632 -48 650T-2 669Q18 669 31 657T45 623Q45 592 22 573T-25 554Q-68 554 -72 599'], - - // COMBINING RING ABOVE - 0x30A: [716,-542,0,-199,3,'-199 610Q-199 654 -161 685T-79 716Q-39 716 -16 693Q3 674 3 647Q3 607 -34 575T-118 542Q-199 542 -199 610ZM-41 631T-41 655T-83 679H-89Q-129 679 -142 656Q-146 650 -151 632T-156 604Q-156 578 -113 578H-108Q-94 578 -86 579T-69 586T-52 605Q-41 631 -41 655'], - - // COMBINING DOUBLE ACUTE ACCENT - 0x30B: [697,-503,0,-248,65,'-217 503Q-221 503 -234 510T-248 523Q-248 528 -205 602Q-200 610 -192 623T-180 644T-170 661T-159 676T-151 686T-142 694T-134 696Q-132 697 -121 697Q-88 694 -88 664Q-88 652 -97 640T-152 574Q-214 504 -217 503ZM-64 503Q-68 503 -81 510T-95 523Q-95 528 -52 602Q-47 610 -39 623T-27 644T-17 661T-6 676T2 686T11 694T19 696Q21 697 32 697Q65 694 65 664Q65 652 56 640T1 574Q-61 504 -64 503'], - - // COMBINING CARON - 0x30C: [638,-502,0,-236,29,'11 637Q16 637 22 624T29 607Q29 606 27 602Q26 600 -47 552T-125 502H-127Q-133 502 -184 553Q-236 602 -236 608Q-236 612 -224 625T-206 638L-202 637L-196 632Q-190 628 -179 620T-158 603L-116 570Q-109 572 -52 604T11 637'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Italic/CombDiacritMarks.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/GeneralPunctuation.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/GeneralPunctuation.js deleted file mode 100644 index d2abad0380..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/GeneralPunctuation.js +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Italic/GeneralPunctuation.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-italic'], - { - // EN DASH - 0x2013: [285,-248,511,91,554,'98 248Q91 252 91 259Q91 279 100 284Q102 285 324 285H442H500Q536 285 545 283T554 274Q554 260 548 254Q546 250 538 249Q520 248 319 248H98'], - - // EM DASH - 0x2014: [285,-248,1022,117,1038,'124 248Q117 252 117 259Q117 279 126 284Q128 285 579 285T1033 284Q1037 280 1037 278Q1038 276 1038 274Q1038 253 1029 250Q1026 248 575 248H124'], - - // LEFT SINGLE QUOTATION MARK - 0x2018: [694,-379,307,197,362,'249 379Q228 379 213 396T197 448Q197 533 271 627L278 635Q286 643 295 652T314 671T332 687T344 694Q349 694 355 685T362 671Q362 668 345 654T301 608T256 537Q238 493 240 491Q241 491 245 493T258 498T275 500Q296 500 311 488T326 454Q326 426 304 403T249 379'], - - // RIGHT SINGLE QUOTATION MARK - 0x2019: [694,-378,307,212,377,'250 620Q250 647 272 670T325 694Q348 694 362 677T377 633V624Q377 566 343 506T275 412T231 379Q226 379 220 388T213 401T232 421T279 472T323 547Q335 573 335 582L331 580Q327 578 318 576T300 573Q277 573 264 585T250 620'], - - // LEFT DOUBLE QUOTATION MARK - 0x201C: [694,-379,514,243,606,'295 379Q274 379 259 396T243 448Q243 533 317 627Q326 638 354 666T391 694Q395 694 402 686T409 673Q409 668 392 654T348 608T302 537Q284 493 286 491Q287 491 291 493T304 498T321 500Q342 500 357 488T372 454Q372 426 350 403T295 379ZM492 379Q471 379 456 396T440 448Q440 533 514 627Q523 638 551 666T588 694Q592 694 599 685T606 672T589 654T544 608T499 537Q481 493 483 491Q484 491 488 493T501 498T518 500Q539 500 554 488T569 454Q569 426 547 403T492 379'], - - // RIGHT DOUBLE QUOTATION MARK - 0x201D: [694,-379,514,176,538,'214 620Q214 647 236 670T289 694Q312 694 326 677T341 633V624Q341 588 327 550T294 482T253 428T216 392T196 379Q191 379 184 388T176 401Q176 404 195 421T243 472T287 547Q299 576 299 582L295 580Q291 578 282 576T264 573Q241 573 228 585T214 620ZM411 620Q411 647 433 670T486 694Q509 694 523 677T538 633V624Q538 588 524 550T491 482T450 428T413 392T393 379Q388 379 381 388T373 401Q373 404 392 421T440 472T484 547Q496 576 496 582L492 580Q488 578 479 576T461 573Q438 573 425 585T411 620'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Italic/GeneralPunctuation.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/GreekAndCoptic.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/GreekAndCoptic.js deleted file mode 100644 index de370446fd..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/GreekAndCoptic.js +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Italic/GreekAndCoptic.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-italic'], - { - // GREEK CAPITAL LETTER GAMMA - 0x393: [680,0,627,54,705,'337 46Q339 46 342 46Q360 46 363 45T367 34Q367 13 359 5Q356 0 343 0Q339 0 320 0T268 1T196 2Q98 2 72 0H61Q54 7 54 11Q54 27 61 41Q65 46 95 46Q131 47 142 50T159 62L194 200Q229 337 264 477T299 623Q299 630 292 631T248 634Q216 634 214 638Q213 641 213 646Q213 674 224 678Q226 680 462 680H698Q705 676 705 669Q705 665 691 557T675 447Q673 440 652 440H637Q630 445 630 451Q630 452 632 467T636 504T638 543Q638 569 632 586T615 613T586 627T549 633T500 634Q491 634 487 634Q426 634 414 633T399 625Q397 621 327 342T257 59Q257 54 261 52T283 48T337 46'], - - // GREEK CAPITAL LETTER DELTA - 0x394: [716,0,818,70,751,'409 0H145Q117 0 103 0T81 1T72 3T70 6Q70 9 310 354T557 707Q559 711 565 713Q570 716 587 716Q608 716 613 710Q616 704 683 358Q752 9 750 6Q750 2 747 2Q745 0 409 0ZM581 342L531 597Q530 597 352 342T174 85T403 84T632 86Q632 87 581 342'], - - // GREEK CAPITAL LETTER THETA - 0x398: [704,22,767,149,788,'149 237Q149 326 186 413T282 563T412 665T552 704Q619 704 667 678T741 611T777 528T788 444Q788 328 728 219T572 44T377 -22Q275 -22 212 50T149 237ZM691 480Q691 569 652 618T551 668Q458 668 367 562Q307 485 277 382T246 202Q246 147 260 108T298 51T343 24T387 16Q408 16 433 22T494 51T562 109T626 211T677 363Q691 423 691 480ZM302 275Q302 281 317 346T338 415L341 418H356Q380 418 380 408Q380 405 378 398T375 385Q375 384 480 384H585L588 398Q592 412 598 418H613Q636 418 636 409Q636 406 621 340Q617 326 612 306Q603 272 598 267L597 266H582Q558 266 558 276Q558 279 560 286T563 299Q563 300 458 300H353L350 286Q346 272 340 266H325Q302 266 302 275'], - - // GREEK CAPITAL LETTER LAMDA - 0x39B: [716,0,692,58,646,'71 0Q58 0 58 11Q58 33 68 43Q71 46 77 46Q106 46 128 59T156 79T173 104Q174 106 255 256T416 556T497 707Q502 716 519 716H525Q543 716 547 711Q550 707 561 398T572 65Q573 57 574 54T587 49T623 46Q646 46 646 36Q646 35 643 23Q642 21 641 17T640 12T639 8T638 5T636 3T633 1T629 1T624 0Q622 0 612 0T578 1T514 2Q466 2 434 2T398 1Q381 1 381 11Q381 13 383 23Q387 40 390 43T406 46Q460 46 472 63L464 298Q457 533 455 536V537Q452 537 335 317T214 90Q211 80 211 75Q211 53 244 47Q246 47 251 47T258 46Q270 46 270 34Q270 33 268 19Q264 6 258 0H247Q185 2 143 2Q77 2 71 0'], - - // GREEK CAPITAL LETTER XI - 0x39E: [678,0,664,74,755,'243 668Q243 670 250 677H640Q661 677 687 677T719 678Q741 678 747 676T754 667T740 595T726 522Q725 521 724 520T723 517T720 516T714 515T704 514Q690 514 685 515T680 525Q680 531 683 543Q690 578 690 590V597H686Q670 600 468 600Q282 599 275 596Q267 591 251 539Q246 521 243 518T228 514H224Q200 511 200 525Q200 526 220 594T243 668ZM535 277Q535 282 538 296T543 312Q543 314 411 314H278L277 310Q277 309 272 291T266 272Q264 267 245 267Q237 267 233 268T228 269T225 272T222 277L241 354Q245 368 250 389Q261 432 266 437L267 438H299Q306 431 306 428Q306 426 306 424T304 417T302 409L297 391H430L562 392L567 412Q572 431 579 438H611Q615 434 616 432L618 430Q618 423 599 352Q581 275 577 270Q574 267 568 267H558Q535 267 535 277ZM81 0Q74 4 74 11Q74 14 89 89T106 168Q112 174 127 174Q138 174 142 174T148 171T151 164Q151 163 147 143Q140 101 139 92Q139 81 140 81Q143 78 265 78H349H484Q518 78 532 78T555 80T566 83T570 91Q575 103 589 145Q595 166 598 170T611 174H617H622Q641 174 641 163Q641 162 619 86T595 7Q593 2 584 1T530 0H334H81'], - - // GREEK CAPITAL LETTER PI - 0x3A0: [680,0,743,54,859,'248 634Q216 634 214 638Q213 641 213 646Q213 674 224 678Q226 680 539 680H852Q859 676 859 669Q859 653 852 639Q848 634 818 634Q782 633 771 630T754 618L719 480Q684 343 649 203T614 57Q614 50 621 49T666 46Q697 46 699 40Q701 37 698 21Q693 3 689 1Q686 0 677 0Q673 0 657 0T611 1T546 2Q453 2 428 0H418Q411 7 411 11Q411 27 418 41Q422 46 452 46Q488 47 499 50T516 62Q518 67 553 209T624 491T660 632Q660 634 530 634H400L399 630Q399 629 390 593T363 484T328 344Q257 60 257 57Q257 50 264 49T309 46Q340 46 342 40Q344 37 341 21Q336 3 332 1Q329 0 320 0Q316 0 300 0T254 1T189 2Q96 2 71 0H61Q54 7 54 11Q54 27 61 41Q65 46 95 46Q131 47 142 50T159 62L194 200Q229 337 264 477T299 623Q299 630 292 631T248 634'], - - // GREEK CAPITAL LETTER SIGMA - 0x3A3: [683,1,716,80,782,'87 0Q80 7 80 11Q80 14 81 15Q81 16 231 161Q381 304 381 305L310 475Q239 646 239 648T242 662T247 677Q247 681 251 681Q253 683 514 683H775Q780 678 782 674Q782 668 767 559T751 448Q747 443 729 443Q715 443 711 444T707 453Q707 454 710 479T713 529Q713 555 709 573T691 604T663 622T619 632T564 636T492 637H457Q356 637 356 635Q358 634 417 489T478 343Q478 340 474 335T436 297T330 196L185 57L294 56H339Q450 56 499 65T581 109Q603 131 620 164T646 221T657 248Q660 250 675 250Q699 253 699 239L681 188Q663 138 643 81T617 9Q614 2 605 1T552 -1Q541 -1 475 -1T348 0H87'], - - // GREEK CAPITAL LETTER UPSILON - 0x3A5: [706,0,767,213,832,'213 543Q213 576 262 640T379 705Q507 705 507 531Q507 514 505 492L504 482L514 505Q524 528 543 561T587 626T653 682T738 705Q783 705 807 675T832 594Q832 535 808 535H802Q780 535 780 542Q780 543 781 550T783 563Q783 589 765 606T716 623Q588 623 521 354Q521 353 485 208T448 59Q448 46 529 46Q559 46 559 36Q559 31 556 22Q552 4 547 1Q546 1 544 1T538 0Q534 0 514 0T458 1T380 2Q271 2 241 0H228Q222 6 222 9T224 27Q228 40 234 46H257Q322 46 336 52Q346 54 349 62Q351 64 372 145T416 324T445 461Q446 471 446 506Q446 528 445 541T436 577T410 610T361 622Q319 622 295 600T261 552Q257 539 249 536Q245 535 233 535T218 536L214 540V541Q213 542 213 543'], - - // GREEK CAPITAL LETTER PHI - 0x3A6: [683,0,716,159,729,'467 624Q467 631 454 633T400 637Q361 637 359 643Q358 644 358 649Q358 673 369 682Q371 683 387 683Q430 681 532 681Q569 681 600 681T650 682T672 683Q689 683 689 672Q689 670 686 658T681 643Q679 637 640 637Q595 636 579 633T558 617Q556 613 547 575T538 533Q538 532 541 532Q555 532 582 524T643 500T703 450T728 374Q728 311 673 256Q621 203 550 177T445 151Q443 151 441 149Q440 146 430 104T419 59Q419 46 500 46Q530 46 530 36Q530 31 527 22Q523 4 518 1Q517 1 515 1T510 0Q505 0 486 0T431 1T355 2Q248 2 218 0H205Q199 6 199 9T201 27Q205 40 211 46H234Q300 46 313 52Q323 54 326 62Q328 64 334 86T344 129L349 150Q349 151 346 151Q333 151 307 158T245 182T185 231T159 309V314Q159 325 162 338T174 374T207 421T264 468Q334 518 435 531L446 533L457 577Q467 620 467 624ZM436 494Q429 494 417 492T373 477T319 442Q288 408 274 362T260 284Q260 257 269 239T298 210T328 196T359 188L436 494ZM626 398Q626 438 605 460T539 493L528 495Q527 495 489 342T451 188Q455 188 462 189T490 197T528 212T566 241T598 285Q626 341 626 398'], - - // GREEK CAPITAL LETTER PSI - 0x3A8: [683,0,767,207,824,'494 626Q493 627 493 628T491 629T489 631T484 632T477 634T465 635T449 636T426 637Q387 637 385 643Q384 644 384 649Q384 673 395 682Q397 683 413 683Q456 681 558 681Q595 681 626 681T676 682T698 683Q715 683 715 672Q715 670 712 658T707 643Q705 637 666 637Q621 636 605 633T584 617L478 193Q486 195 498 199T542 229T597 291Q626 335 646 415Q669 500 694 523T759 546H777H801Q824 546 824 536Q822 509 809 509Q762 509 735 406Q707 300 642 234T481 153L467 151L456 106Q445 62 445 59Q445 46 526 46Q556 46 556 36Q556 31 553 22Q549 4 544 1Q543 1 541 1T536 0Q531 0 512 0T457 1T381 2Q274 2 244 0H231Q225 6 225 9T227 27Q231 40 237 46H260Q326 46 339 52Q349 54 352 62Q354 64 365 106T376 151Q374 152 371 152Q360 153 347 156T310 172T270 201T239 250T225 323Q225 359 235 405T245 470T239 498T226 507T213 510T207 520Q207 528 209 534T215 544L218 546H257Q305 546 314 540Q338 530 338 485Q338 455 326 402T313 312Q313 218 379 193Q386 192 387 192Q387 196 441 408Q494 621 494 626'], - - // GREEK CAPITAL LETTER OMEGA - 0x3A9: [705,0,716,100,759,'183 393Q183 451 206 502T267 590T348 652T435 691T510 704Q513 705 525 705Q631 705 695 650T759 505Q759 454 732 397T672 299T593 203T527 117Q503 81 503 76Q503 75 521 75Q576 75 588 77Q589 77 592 78T595 79T598 80T602 82T605 86T609 92T614 101T620 112T627 127T636 147Q646 169 649 170Q651 172 667 172H682Q689 167 689 162Q689 158 654 81T617 2Q614 0 530 0H447Q441 5 441 9T444 28Q461 85 498 158T569 285T628 408T654 534Q654 592 621 630T527 668Q488 668 448 649T371 593T310 487T286 330Q286 302 290 247T294 137Q294 34 280 6Q278 1 268 1T190 0H107Q100 5 100 12Q100 24 103 94T108 165Q110 172 131 172H146Q150 169 153 165L152 141V116Q152 84 153 82Q156 75 217 75H252V84Q252 126 218 231T183 393'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Italic/GreekAndCoptic.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/LatinExtendedA.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/LatinExtendedA.js deleted file mode 100644 index 870cbd6a52..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/LatinExtendedA.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Italic/LatinExtendedA.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-italic'], - { - // LATIN SMALL LETTER DOTLESS I - 0x131: [441,10,307,75,341,'75 287Q75 292 82 313T103 362T142 413T196 441H214Q248 441 270 419T293 357Q292 338 289 330T245 208Q193 72 193 46Q193 26 209 26Q228 26 247 43Q273 71 292 136Q295 148 297 150T311 153H317Q327 153 330 153T337 150T340 143Q340 133 330 105T292 41T228 -8Q220 -10 204 -10Q160 -10 141 15T122 71Q122 98 171 227T221 384Q221 396 218 400T203 405Q175 403 156 374T128 312T116 279Q115 278 97 278H81Q75 284 75 287'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Italic/LatinExtendedA.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/LatinExtendedB.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/LatinExtendedB.js deleted file mode 100644 index 992b68f4ff..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/LatinExtendedB.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Italic/LatinExtendedB.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-italic'], - { - // LATIN SMALL LETTER DOTLESS J - 0x237: [442,204,332,-32,327,'75 284T75 287T81 305T101 343T133 389T180 426T240 442Q273 440 300 420T327 350V332L278 134Q267 92 253 37T233 -45T225 -73Q208 -123 162 -163T54 -204Q8 -204 -15 -181Q-32 -164 -32 -140Q-32 -112 -14 -96T27 -79Q48 -79 57 -91T67 -114Q67 -146 39 -166L44 -167H59H60Q112 -167 145 -74Q148 -65 198 134T251 347Q252 353 252 370Q252 382 251 388T245 399T230 405Q204 405 175 378Q157 360 145 337T126 298T117 280T98 278H81Q75 284 75 287'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Italic/LatinExtendedB.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/LetterlikeSymbols.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/LetterlikeSymbols.js deleted file mode 100644 index 7518bc8e8f..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/LetterlikeSymbols.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Italic/LetterlikeSymbols.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-italic'], - { - // stix-/hbar - Planck's over 2pi - 0x210F: [695,13,540,42,562,'150 475Q147 475 118 466T82 457Q73 457 64 467T54 487Q54 490 55 492Q63 506 64 506Q67 512 118 526Q162 541 169 546Q173 559 175 575Q181 596 181 604Q181 613 166 617Q164 617 153 618T135 619Q119 619 114 621T109 630Q109 636 114 656T122 681Q125 685 202 688Q272 695 286 695Q304 695 304 684Q304 682 291 628L278 577L386 612Q466 635 476 635T492 627T499 607Q499 593 489 586Q485 583 373 546L262 512Q262 511 248 455T233 397T236 397T244 404Q295 441 357 441Q405 441 445 417T485 333Q485 284 449 178T412 58T426 44Q447 44 466 68Q485 87 500 130L509 152H531H543Q562 152 562 144Q562 128 546 93T494 23T415 -13Q385 -13 359 3T322 44Q318 52 318 77Q318 99 352 196T386 337Q386 386 346 386Q318 386 286 370Q267 361 245 338T211 292Q207 287 193 235T162 113T138 21Q128 7 122 4Q105 -12 83 -12Q66 -12 54 -2T42 26Q42 45 98 257L151 475H150'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Italic/LetterlikeSymbols.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/Main.js deleted file mode 100644 index a2f380f347..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/Main.js +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Italic/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-italic'] = { - directory: 'Main/Italic', - family: 'MathJax_Main', - id: 'MJMAINI', - style: 'italic', - Ranges: [ - [0x20,0x7F,"BasicLatin"], - [0x100,0x17F,"LatinExtendedA"], - [0x180,0x24F,"LatinExtendedB"], - [0x300,0x36F,"CombDiacritMarks"], - [0x370,0x3FF,"GreekAndCoptic"], - [0x2000,0x206F,"GeneralPunctuation"], - [0x2100,0x214F,"LetterlikeSymbols"], - [0x2200,0x22FF,"MathOperators"] - ], - - // POUND SIGN - 0xA3: [714,11,769,88,699,'699 578Q699 473 635 473Q597 473 595 508Q595 559 654 569V576Q654 619 637 648T581 677Q545 677 513 647T463 561Q460 554 437 464T414 371Q414 370 458 370H502Q508 364 508 362Q505 334 495 324H402L382 241Q377 224 373 206T366 180T361 163T358 151T354 142T350 133T344 120Q340 112 338 107T336 101L354 90Q398 63 422 54T476 44Q515 44 539 73T574 133Q578 144 580 146T598 148Q622 148 622 139Q622 138 620 130Q602 74 555 32T447 -11Q395 -11 317 38L294 51Q271 28 233 9T155 -10Q117 -10 103 5T88 39Q88 73 126 106T224 139Q236 139 247 138T266 134L273 132Q275 132 302 239L323 324H259Q253 330 253 332Q253 350 265 370H300L334 371L355 453Q356 457 360 477T366 501T372 522T379 545T387 565T397 587T409 606T425 627Q453 664 497 689T583 714Q640 714 669 676T699 578ZM245 76Q211 85 195 85Q173 85 158 71T142 42Q142 26 160 26H163Q211 30 245 76'] -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Italic/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/MathOperators.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/MathOperators.js deleted file mode 100644 index aef973c556..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Italic/MathOperators.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Italic/MathOperators.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main-italic'], - { - // INCREMENT - 0x2206: [716,0,818,70,751,''] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Italic/MathOperators.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/BasicLatin.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/BasicLatin.js deleted file mode 100644 index 7c85edc26a..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/BasicLatin.js +++ /dev/null @@ -1,146 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Regular/BasicLatin.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main'], - { - // EXCLAMATION MARK - 0x21: [716,-1,278,78,199,'78 661Q78 682 96 699T138 716T180 700T199 661Q199 654 179 432T158 206Q156 198 139 198Q121 198 119 206Q118 209 98 431T78 661ZM79 61Q79 89 97 105T141 121Q164 119 181 104T198 61Q198 31 181 16T139 1Q114 1 97 16T79 61'], - - // QUOTATION MARK - 0x22: [694,-379,500,34,372,'34 634Q34 659 50 676T93 694Q121 694 144 668T168 579Q168 525 146 476T101 403T73 379Q69 379 60 388T50 401Q50 404 62 417T88 448T116 500T131 572Q131 584 130 584T125 581T112 576T94 573Q69 573 52 590T34 634ZM238 634Q238 659 254 676T297 694Q325 694 348 668T372 579Q372 525 350 476T305 403T277 379Q273 379 264 388T254 401Q254 404 266 417T292 448T320 500T335 572Q335 584 334 584T329 581T316 576T298 573Q273 573 256 590T238 634'], - - // NUMBER SIGN - 0x23: [694,194,833,56,778,'56 347Q56 360 70 367H313L355 524Q394 676 401 686Q406 694 416 694Q434 694 436 676Q436 672 396 522Q355 374 355 369L354 367H543L585 524Q626 679 630 685Q636 694 646 694Q653 694 659 689T665 678Q665 668 626 522Q585 374 585 369L584 367H762Q777 359 777 347Q777 334 767 331T722 327H667H572L552 251L531 174Q531 173 647 173H720Q756 173 766 170T777 153T762 133H519L477 -24Q436 -179 432 -185Q426 -194 416 -194Q409 -194 403 -189T397 -177Q397 -167 436 -21Q477 125 477 131L478 133H289L247 -24Q206 -179 202 -185Q196 -194 186 -194Q179 -194 173 -189T167 -177Q167 -167 206 -21Q247 125 247 131L248 133H70Q56 140 56 153Q56 168 72 173H260L280 249L301 326Q301 327 186 327H72Q56 332 56 347ZM531 326Q531 327 437 327H342L322 251L301 174Q301 173 395 173H490L510 249L531 326'], - - // DOLLAR SIGN - 0x24: [750,56,500,55,444,'162 187Q162 164 146 149T109 133H103V130Q108 115 115 105Q122 92 131 82T150 64T170 52T190 44T206 40T220 37L227 36V313Q190 320 162 335Q116 358 86 404T55 508Q55 567 85 614T165 685Q186 696 225 704H227V750H273V704L286 703Q369 690 413 631Q441 588 444 531Q444 514 443 509Q439 490 425 479T391 468Q368 468 353 483T337 522Q337 546 353 560T390 575L394 576V578Q386 599 372 614T342 637T314 649T288 656L273 658V408L288 405Q329 394 355 376Q396 348 420 300T444 199Q444 130 408 76T313 1Q286 -9 276 -9H273V-56H227V-10H221Q202 -6 193 -4T155 11T108 41T74 94T55 176V182Q55 227 95 238Q103 240 108 240Q129 240 145 226T162 187ZM225 657Q219 657 204 651T169 632T135 594T121 538Q121 512 131 491T156 457T187 435T213 423T227 420V539Q227 657 225 657ZM378 169Q378 230 339 265T274 301Q273 301 273 169V37Q324 50 351 87T378 169'], - - // PERCENT SIGN - 0x25: [750,56,833,56,777,'465 605Q428 605 394 614T340 632T319 641Q332 608 332 548Q332 458 293 403T202 347Q145 347 101 402T56 548Q56 637 101 693T202 750Q241 750 272 719Q359 642 464 642Q580 642 650 732Q662 748 668 749Q670 750 673 750Q682 750 688 743T693 726Q178 -47 170 -52Q166 -56 160 -56Q147 -56 142 -45Q137 -36 142 -27Q143 -24 363 304Q469 462 525 546T581 630Q528 605 465 605ZM207 385Q235 385 263 427T292 548Q292 617 267 664T200 712Q193 712 186 709T167 698T147 668T134 615Q132 595 132 548V527Q132 436 165 403Q183 385 203 385H207ZM500 146Q500 234 544 290T647 347Q699 347 737 292T776 146T737 0T646 -56Q590 -56 545 0T500 146ZM651 -18Q679 -18 707 24T736 146Q736 215 711 262T644 309Q637 309 630 306T611 295T591 265T578 212Q577 200 577 146V124Q577 -18 647 -18H651'], - - // AMPERSAND - 0x26: [716,22,778,42,727,'156 540Q156 620 201 668T302 716Q354 716 377 671T401 578Q401 505 287 386L274 373Q309 285 416 148L429 132L437 142Q474 191 543 309L562 341V349Q562 368 541 376T498 385H493V431H502L626 428Q709 428 721 431H727V385H712Q688 384 669 379T639 369T618 354T603 337T591 316T578 295Q537 223 506 176T464 117T454 104Q454 102 471 85T497 62Q543 24 585 24Q618 24 648 48T682 113V121H722V112Q721 94 714 75T692 32T646 -7T574 -22Q491 -19 414 42L402 51L391 42Q312 -22 224 -22Q144 -22 93 25T42 135Q42 153 46 169T55 197T74 225T96 249T125 278T156 308L195 347L190 360Q185 372 182 382T174 411T165 448T159 491T156 540ZM361 576Q361 613 348 646T305 679Q272 679 252 649T232 572Q232 497 255 426L259 411L267 420Q361 519 361 576ZM140 164Q140 103 167 64T240 24Q271 24 304 36T356 61T374 77Q295 156 235 262L220 292L210 310L193 293Q177 277 169 268T151 229T140 164'], - - // APOSTROPHE - 0x27: [694,-379,278,78,212,'78 634Q78 659 95 676T138 694Q166 694 189 668T212 579Q212 525 190 476T146 403T118 379Q114 379 105 388T95 401Q95 404 107 417T133 448T161 500T176 572Q176 584 175 584T170 581T157 576T139 573Q114 573 96 590T78 634'], - - // ASTERISK - 0x2A: [750,-320,500,64,436,'215 721Q216 732 225 741T248 750Q263 750 273 742T284 721L270 571L327 613Q383 654 388 657T399 660Q412 660 423 650T435 624T424 600T376 575Q363 569 355 566L289 534L355 504L424 470Q435 462 435 447Q435 431 424 420T399 409Q393 409 388 412T327 456L270 498L277 423L284 348Q280 320 250 320T215 348L229 498L172 456Q116 415 111 412T100 409Q87 409 76 420T64 447Q64 461 75 470L144 504L210 534L144 566Q136 570 122 576Q83 593 74 600T64 624Q64 639 75 649T100 660Q106 660 111 657T172 613L229 571Q229 578 222 643T215 721'], - - // HYPHEN-MINUS - 0x2D: [252,-179,333,11,277,'11 179V252H277V179H11'], - - // QUESTION MARK - 0x3F: [705,-1,472,55,417,'226 668Q190 668 162 656T124 632L114 621Q116 621 119 620T130 616T145 607T157 591T162 567Q162 544 147 529T109 514T71 528T55 566Q55 625 100 661T199 704Q201 704 210 704T224 705H228Q281 705 320 692T378 656T407 612T416 567Q416 503 361 462Q267 395 247 303Q242 279 242 241V224Q242 205 239 202T222 198T205 201T202 218V249Q204 320 220 371T255 445T292 491T315 537Q317 546 317 574V587Q317 604 315 615T304 640T277 661T226 668ZM162 61Q162 89 180 105T224 121Q247 119 264 104T281 61Q281 31 264 16T222 1Q197 1 180 16T162 61'], - - // COMMERCIAL AT - 0x40: [705,11,778,56,722,'56 347Q56 429 86 498T164 612T270 680T386 705Q522 705 622 603T722 349Q722 126 608 126Q541 126 513 176Q512 177 512 179T510 182L509 183Q508 183 503 177T487 163T464 146T429 132T385 126Q311 126 251 186T190 347Q190 448 251 508T385 568Q426 568 460 548T509 511T531 479H555Q580 479 582 478Q586 477 587 468Q588 454 588 338V260Q588 200 593 182T619 163Q641 163 655 178T674 223T680 273T682 325V330Q682 426 647 500Q611 569 544 618T388 668Q271 668 184 577T96 347Q96 216 180 121T396 26Q421 26 446 28T493 34T535 43T573 52T605 63T629 72T647 80T657 84H716Q722 78 722 74Q722 65 675 45T547 7T392 -11Q255 -11 156 90T56 347ZM274 347Q274 266 308 214T390 162Q420 162 449 182T498 235L504 245V449L498 459Q453 532 387 532Q347 532 311 483T274 347'], - - // LATIN CAPITAL LETTER A - 0x41: [716,0,750,32,717,'255 0Q240 3 140 3Q48 3 39 0H32V46H47Q119 49 139 88Q140 91 192 245T295 553T348 708Q351 716 366 716H376Q396 715 400 709Q402 707 508 390L617 67Q624 54 636 51T687 46H717V0H708Q699 3 581 3Q458 3 437 0H427V46H440Q510 46 510 64Q510 66 486 138L462 209H229L209 150Q189 91 189 85Q189 72 209 59T259 46H264V0H255ZM447 255L345 557L244 256Q244 255 345 255H447'], - - // LATIN CAPITAL LETTER B - 0x42: [683,0,708,28,651,'131 622Q124 629 120 631T104 634T61 637H28V683H229H267H346Q423 683 459 678T531 651Q574 627 599 590T624 512Q624 461 583 419T476 360L466 357Q539 348 595 302T651 187Q651 119 600 67T469 3Q456 1 242 0H28V46H61Q103 47 112 49T131 61V622ZM511 513Q511 560 485 594T416 636Q415 636 403 636T371 636T333 637Q266 637 251 636T232 628Q229 624 229 499V374H312L396 375L406 377Q410 378 417 380T442 393T474 417T499 456T511 513ZM537 188Q537 239 509 282T430 336L329 337H229V200V116Q229 57 234 52Q240 47 334 47H383Q425 47 443 53Q486 67 511 104T537 188'], - - // LATIN CAPITAL LETTER C - 0x43: [705,21,722,56,666,'56 342Q56 428 89 500T174 615T283 681T391 705Q394 705 400 705T408 704Q499 704 569 636L582 624L612 663Q639 700 643 704Q644 704 647 704T653 705H657Q660 705 666 699V419L660 413H626Q620 419 619 430Q610 512 571 572T476 651Q457 658 426 658Q322 658 252 588Q173 509 173 342Q173 221 211 151Q232 111 263 84T328 45T384 29T428 24Q517 24 571 93T626 244Q626 251 632 257H660L666 251V236Q661 133 590 56T403 -21Q262 -21 159 83T56 342'], - - // LATIN CAPITAL LETTER D - 0x44: [683,0,764,27,708,'130 622Q123 629 119 631T103 634T60 637H27V683H228Q399 682 419 682T461 676Q504 667 546 641T626 573T685 470T708 336Q708 210 634 116T442 3Q429 1 228 0H27V46H60Q102 47 111 49T130 61V622ZM593 338Q593 439 571 501T493 602Q439 637 355 637H322H294Q238 637 234 628Q231 624 231 344Q231 62 232 59Q233 49 248 48T339 46H350Q456 46 515 95Q561 133 577 191T593 338'], - - // LATIN CAPITAL LETTER E - 0x45: [680,0,681,25,652,'128 619Q121 626 117 628T101 631T58 634H25V680H597V676Q599 670 611 560T625 444V440H585V444Q584 447 582 465Q578 500 570 526T553 571T528 601T498 619T457 629T411 633T353 634Q266 634 251 633T233 622Q233 622 233 621Q232 619 232 497V376H286Q359 378 377 385Q413 401 416 469Q416 471 416 473V493H456V213H416V233Q415 268 408 288T383 317T349 328T297 330Q290 330 286 330H232V196V114Q232 57 237 52Q243 47 289 47H340H391Q428 47 452 50T505 62T552 92T584 146Q594 172 599 200T607 247T612 270V273H652V270Q651 267 632 137T610 3V0H25V46H58Q100 47 109 49T128 61V619'], - - // LATIN CAPITAL LETTER F - 0x46: [680,0,653,25,610,'128 619Q121 626 117 628T101 631T58 634H25V680H582V676Q584 670 596 560T610 444V440H570V444Q563 493 561 501Q555 538 543 563T516 601T477 622T431 631T374 633H334H286Q252 633 244 631T233 621Q232 619 232 490V363H284Q287 363 303 363T327 364T349 367T372 373T389 385Q407 403 410 459V480H450V200H410V221Q407 276 389 296Q381 303 371 307T348 313T327 316T303 317T284 317H232V189L233 61Q240 54 245 52T270 48T333 46H360V0H348Q324 3 182 3Q51 3 36 0H25V46H58Q100 47 109 49T128 61V619'], - - // LATIN CAPITAL LETTER G - 0x47: [705,22,785,56,735,'56 342Q56 428 89 500T174 615T283 681T391 705Q394 705 400 705T408 704Q499 704 569 636L582 624L612 663Q639 700 643 704Q644 704 647 704T653 705H657Q660 705 666 699V419L660 413H626Q620 419 619 430Q610 512 571 572T476 651Q457 658 426 658Q401 658 376 654T316 633T254 592T205 519T177 411Q173 369 173 335Q173 259 192 201T238 111T302 58T370 31T431 24Q478 24 513 45T559 100Q562 110 562 160V212Q561 213 557 216T551 220T542 223T526 225T502 226T463 227H437V273H449L609 270Q715 270 727 273H735V227H721Q674 227 668 215Q666 211 666 108V6Q660 0 657 0Q653 0 639 10Q617 25 600 42L587 54Q571 27 524 3T406 -22Q317 -22 238 22T108 151T56 342'], - - // LATIN CAPITAL LETTER H - 0x48: [683,0,750,25,724,'128 622Q121 629 117 631T101 634T58 637H25V683H36Q57 680 180 680Q315 680 324 683H335V637H302Q262 636 251 634T233 622L232 500V378H517V622Q510 629 506 631T490 634T447 637H414V683H425Q446 680 569 680Q704 680 713 683H724V637H691Q651 636 640 634T622 622V61Q628 51 639 49T691 46H724V0H713Q692 3 569 3Q434 3 425 0H414V46H447Q489 47 498 49T517 61V332H232V197L233 61Q239 51 250 49T302 46H335V0H324Q303 3 180 3Q45 3 36 0H25V46H58Q100 47 109 49T128 61V622'], - - // LATIN CAPITAL LETTER I - 0x49: [683,0,361,21,339,'328 0Q307 3 180 3T32 0H21V46H43Q92 46 106 49T126 60Q128 63 128 342Q128 620 126 623Q122 628 118 630T96 635T43 637H21V683H32Q53 680 180 680T328 683H339V637H317Q268 637 254 634T234 623Q232 620 232 342Q232 63 234 60Q238 55 242 53T264 48T317 46H339V0H328'], - - // LATIN CAPITAL LETTER J - 0x4A: [683,22,514,25,465,'89 177Q115 177 133 160T152 112Q152 88 137 72T102 52Q99 51 101 49Q106 43 129 29Q159 15 190 15Q232 15 256 48T286 126Q286 127 286 142T286 183T286 238T287 306T287 378Q287 403 287 429T287 479T287 524T286 563T286 593T286 614V621Q281 630 263 633T182 637H154V683H166Q187 680 332 680Q439 680 457 683H465V637H449Q422 637 401 634Q393 631 389 623Q388 621 388 376T387 123Q377 61 322 20T194 -22Q188 -22 177 -21T160 -20Q96 -9 61 29T25 110Q25 144 44 160T89 177'], - - // LATIN CAPITAL LETTER K - 0x4B: [683,0,778,25,736,'128 622Q121 629 117 631T101 634T58 637H25V683H36Q57 680 180 680Q315 680 324 683H335V637H313Q235 637 233 620Q232 618 232 462L233 307L379 449Q425 494 479 546Q518 584 524 591T531 607V608Q531 630 503 636Q501 636 498 636T493 637H489V683H499Q517 680 630 680Q704 680 716 683H722V637H708Q633 633 589 597Q584 592 495 506T406 419T515 254T631 80Q644 60 662 54T715 46H736V0H728Q719 3 615 3Q493 3 472 0H461V46H469Q515 46 515 72Q515 78 512 84L336 351Q332 348 278 296L232 251V156Q232 62 235 58Q243 47 302 46H335V0H324Q303 3 180 3Q45 3 36 0H25V46H58Q100 47 109 49T128 61V622'], - - // LATIN CAPITAL LETTER L - 0x4C: [683,0,625,25,582,'128 622Q121 629 117 631T101 634T58 637H25V683H36Q48 680 182 680Q324 680 348 683H360V637H333Q273 637 258 635T233 622L232 342V129Q232 57 237 52Q243 47 313 47Q384 47 410 53Q470 70 498 110T536 221Q536 226 537 238T540 261T542 272T562 273H582V268Q580 265 568 137T554 5V0H25V46H58Q100 47 109 49T128 61V622'], - - // LATIN CAPITAL LETTER M - 0x4D: [683,0,917,29,887,'132 622Q125 629 121 631T105 634T62 637H29V683H135Q221 683 232 682T249 675Q250 674 354 398L458 124L562 398Q666 674 668 675Q671 681 683 682T781 683H887V637H854Q814 636 803 634T785 622V61Q791 51 802 49T854 46H887V0H876Q855 3 736 3Q605 3 596 0H585V46H618Q660 47 669 49T688 61V347Q688 424 688 461T688 546T688 613L687 632Q454 14 450 7Q446 1 430 1T410 7Q409 9 292 316L176 624V606Q175 588 175 543T175 463T175 356L176 86Q187 50 261 46H278V0H269Q254 3 154 3Q52 3 37 0H29V46H46Q78 48 98 56T122 69T132 86V622'], - - // LATIN CAPITAL LETTER N - 0x4E: [683,0,750,25,724,'42 46Q74 48 94 56T118 69T128 86V634H124Q114 637 52 637H25V683H232L235 680Q237 679 322 554T493 303L578 178V598Q572 608 568 613T544 627T492 637H475V683H483Q498 680 600 680Q706 680 715 683H724V637H707Q634 633 622 598L621 302V6L614 0H600Q585 0 582 3T481 150T282 443T171 605V345L172 86Q183 50 257 46H274V0H265Q250 3 150 3Q48 3 33 0H25V46H42'], - - // LATIN CAPITAL LETTER O - 0x4F: [705,23,778,56,722,'56 340Q56 423 86 494T164 610T270 680T388 705Q521 705 621 601T722 341Q722 260 693 191T617 75T510 4T388 -22T267 3T160 74T85 189T56 340ZM467 647Q426 665 388 665Q360 665 331 654T269 620T213 549T179 439Q174 411 174 354Q174 144 277 61Q327 20 385 20H389H391Q474 20 537 99Q603 188 603 354Q603 411 598 439Q577 592 467 647'], - - // LATIN CAPITAL LETTER P - 0x50: [684,0,681,27,624,'130 622Q123 629 119 631T103 634T60 637H27V683H214Q237 683 276 683T331 684Q419 684 471 671T567 616Q624 563 624 489Q624 421 573 372T451 307Q429 302 328 301H234V181Q234 62 237 58Q245 47 304 46H337V0H326Q305 3 182 3Q47 3 38 0H27V46H60Q102 47 111 49T130 61V622ZM507 488Q507 514 506 528T500 564T483 597T450 620T397 635Q385 637 307 637H286Q237 637 234 628Q231 624 231 483V342H302H339Q390 342 423 349T481 382Q507 411 507 488'], - - // LATIN CAPITAL LETTER Q - 0x51: [705,193,778,56,728,'56 341Q56 499 157 602T388 705Q521 705 621 601T722 341Q722 275 703 218T660 127T603 63T555 25T525 9Q524 8 524 8H523Q524 5 526 -1T537 -21T555 -47T581 -67T615 -76Q653 -76 678 -56T706 -3Q707 10 716 10Q721 10 728 5L727 -13Q727 -88 697 -140T606 -193Q563 -193 538 -166T498 -83Q483 -23 483 -8L471 -11Q459 -14 435 -18T388 -22Q254 -22 155 81T56 341ZM607 339Q607 429 586 496T531 598T461 649T390 665T318 649T248 598T192 496T170 339Q170 143 277 57Q301 39 305 39L304 42Q304 44 304 46Q301 53 301 68Q301 101 325 128T391 155Q454 155 495 70L501 58Q549 91 578 164Q607 234 607 339ZM385 18Q404 18 425 23T459 33T472 40Q471 47 468 57T449 88T412 115Q398 117 386 117Q367 117 353 102T338 67Q338 48 351 33T385 18'], - - // LATIN CAPITAL LETTER R - 0x52: [683,22,736,27,732,'130 622Q123 629 119 631T103 634T60 637H27V683H202H236H300Q376 683 417 677T500 648Q595 600 609 517Q610 512 610 501Q610 468 594 439T556 392T511 361T472 343L456 338Q459 335 467 332Q497 316 516 298T545 254T559 211T568 155T578 94Q588 46 602 31T640 16H645Q660 16 674 32T692 87Q692 98 696 101T712 105T728 103T732 90Q732 59 716 27T672 -16Q656 -22 630 -22Q481 -16 458 90Q456 101 456 163T449 246Q430 304 373 320L363 322L297 323H231V192L232 61Q238 51 249 49T301 46H334V0H323Q302 3 181 3Q59 3 38 0H27V46H60Q102 47 111 49T130 61V622ZM491 499V509Q491 527 490 539T481 570T462 601T424 623T362 636Q360 636 340 636T304 637H283Q238 637 234 628Q231 624 231 492V360H289Q390 360 434 378T489 456Q491 467 491 499'], - - // LATIN CAPITAL LETTER S - 0x53: [705,22,556,55,500,'55 507Q55 590 112 647T243 704H257Q342 704 405 641L426 672Q431 679 436 687T446 700L449 704Q450 704 453 704T459 705H463Q466 705 472 699V462L466 456H448Q437 456 435 459T430 479Q413 605 329 646Q292 662 254 662Q201 662 168 626T135 542Q135 508 152 480T200 435Q210 431 286 412T370 389Q427 367 463 314T500 191Q500 110 448 45T301 -21Q245 -21 201 -4T140 27L122 41Q118 36 107 21T87 -7T78 -21Q76 -22 68 -22H64Q61 -22 55 -16V101Q55 220 56 222Q58 227 76 227H89Q95 221 95 214Q95 182 105 151T139 90T205 42T305 24Q352 24 386 62T420 155Q420 198 398 233T340 281Q284 295 266 300Q261 301 239 306T206 314T174 325T141 343T112 367T85 402Q55 451 55 507'], - - // LATIN CAPITAL LETTER T - 0x54: [677,0,722,36,685,'36 443Q37 448 46 558T55 671V677H666V671Q667 666 676 556T685 443V437H645V443Q645 445 642 478T631 544T610 593Q593 614 555 625Q534 630 478 630H451H443Q417 630 414 618Q413 616 413 339V63Q420 53 439 50T528 46H558V0H545L361 3Q186 1 177 0H164V46H194Q264 46 283 49T309 63V339V550Q309 620 304 625T271 630H244H224Q154 630 119 601Q101 585 93 554T81 486T76 443V437H36V443'], - - // LATIN CAPITAL LETTER U - 0x55: [683,22,750,25,724,'128 622Q121 629 117 631T101 634T58 637H25V683H36Q57 680 180 680Q315 680 324 683H335V637H302Q262 636 251 634T233 622L232 418V291Q232 189 240 145T280 67Q325 24 389 24Q454 24 506 64T571 183Q575 206 575 410V598Q569 608 565 613T541 627T489 637H472V683H481Q496 680 598 680T715 683H724V637H707Q634 633 622 598L621 399Q620 194 617 180Q617 179 615 171Q595 83 531 31T389 -22Q304 -22 226 33T130 192Q129 201 128 412V622'], - - // LATIN CAPITAL LETTER V - 0x56: [683,22,750,19,730,'114 620Q113 621 110 624T107 627T103 630T98 632T91 634T80 635T67 636T48 637H19V683H28Q46 680 152 680Q273 680 294 683H305V637H284Q223 634 223 620Q223 618 313 372T404 126L490 358Q575 588 575 597Q575 616 554 626T508 637H503V683H512Q527 680 627 680Q718 680 724 683H730V637H723Q648 637 627 596Q627 595 515 291T401 -14Q396 -22 382 -22H374H367Q353 -22 348 -14Q346 -12 231 303Q114 617 114 620'], - - // LATIN CAPITAL LETTER W - 0x57: [683,22,1028,18,1009,'792 683Q810 680 914 680Q991 680 1003 683H1009V637H996Q931 633 915 598Q912 591 863 438T766 135T716 -17Q711 -22 694 -22Q676 -22 673 -15Q671 -13 593 231L514 477L435 234Q416 174 391 92T358 -6T341 -22H331Q314 -21 310 -15Q309 -14 208 302T104 622Q98 632 87 633Q73 637 35 637H18V683H27Q69 681 154 681Q164 681 181 681T216 681T249 682T276 683H287H298V637H285Q213 637 213 620Q213 616 289 381L364 144L427 339Q490 535 492 546Q487 560 482 578T475 602T468 618T461 628T449 633T433 636T408 637H380V683H388Q397 680 508 680Q629 680 650 683H660V637H647Q576 637 576 619L727 146Q869 580 869 600Q869 605 863 612T839 627T794 637H783V683H792'], - - // LATIN CAPITAL LETTER X - 0x58: [683,0,750,23,726,'270 0Q252 3 141 3Q46 3 31 0H23V46H40Q129 50 161 88Q165 94 244 216T324 339Q324 341 235 480T143 622Q133 631 119 634T57 637H37V683H46Q64 680 172 680Q297 680 318 683H329V637H324Q307 637 286 632T263 621Q263 618 322 525T384 431Q385 431 437 511T489 593Q490 595 490 599Q490 611 477 622T436 637H428V683H437Q455 680 566 680Q661 680 676 683H684V637H667Q585 634 551 599Q548 596 478 491Q412 388 412 387Q412 385 514 225T620 62Q628 53 642 50T695 46H726V0H717Q699 3 591 3Q466 3 445 0H434V46H440Q454 46 476 51T499 64Q499 67 463 124T390 238L353 295L350 292Q348 290 343 283T331 265T312 236T286 195Q219 88 218 84Q218 70 234 59T272 46H280V0H270'], - - // LATIN CAPITAL LETTER Y - 0x59: [683,0,750,11,738,'518 0Q497 3 374 3Q253 3 232 0H221V46H254Q313 47 321 58Q324 62 324 167V273L221 446Q117 620 114 623Q106 631 91 634T31 637H11V683H20Q29 680 148 680Q273 680 294 683H305V637H287Q239 636 236 621Q236 619 321 475L407 332L483 460Q502 492 527 534Q563 594 563 604Q563 632 517 637H508V683H517H525Q533 683 545 683T571 682T600 681T626 681Q695 681 731 683H738V637H723Q640 633 613 588Q612 587 517 427L425 273V169V95Q425 66 428 59T444 49Q459 46 506 46H528V0H518'], - - // LATIN CAPITAL LETTER Z - 0x5A: [683,0,611,55,560,'69 443Q69 452 74 554T80 683H549Q555 677 555 664Q555 649 554 648Q552 645 366 348T179 50T192 49T263 49H275H302Q333 49 353 50T401 59T447 78T482 115T507 173Q513 200 520 273V282H560V274Q560 272 552 143T543 8V0H302L61 1L58 3Q55 8 55 21V35Q59 43 153 193T340 489T432 637H343Q259 637 214 625T141 573Q109 523 109 445Q109 443 89 443H69'], - - // LOW LINE - 0x5F: [-25,62,500,0,499,'0 -62V-25H499V-62H0'], - - // GRAVE ACCENT - 0x60: [699,-505,500,106,296,'106 655Q106 671 119 685T150 699Q166 699 177 688Q190 671 222 629T275 561T295 533T282 519L267 505L196 563Q119 626 113 634Q106 643 106 655'], - - // TILDE - 0x7E: [318,-215,500,83,416,'179 251Q164 251 151 245T131 234T111 215L97 227L83 238Q83 239 95 253T121 283T142 304Q165 318 187 318T253 300T320 282Q335 282 348 288T368 299T388 318L402 306L416 295Q375 236 344 222Q330 215 313 215Q292 215 248 233T179 251'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Regular/BasicLatin.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/CombDiacritMarks.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/CombDiacritMarks.js deleted file mode 100644 index ac31369f4b..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/CombDiacritMarks.js +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Regular/CombDiacritMarks.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main'], - { - // COMBINING GRAVE ACCENT - 0x300: [699,-505,0,-394,-204,'-394 655Q-394 671 -381 685T-350 699Q-334 699 -323 688Q-310 671 -278 629T-225 561T-205 533T-218 519L-233 505L-304 563Q-381 626 -387 634Q-394 643 -394 655'], - - // COMBINING ACUTE ACCENT - 0x301: [699,-505,0,-297,-107,'-151 699Q-133 699 -120 686T-107 656Q-107 651 -108 647T-113 637T-120 627T-133 616T-149 602T-170 585T-197 563L-268 505L-283 519Q-297 533 -296 533Q-296 534 -271 567T-218 636T-187 678L-184 681Q-182 684 -179 686T-172 692T-163 697T-151 699'], - - // COMBINING CIRCUMFLEX ACCENT - 0x302: [694,-531,0,-388,-113,'-388 560L-251 694L-243 686Q-113 562 -113 560L-139 531Q-141 532 -197 581L-250 627L-305 580Q-318 569 -331 557T-352 538L-360 532Q-362 530 -375 546L-388 560'], - - // COMBINING TILDE - 0x303: [668,-565,0,-417,-84,'-321 601Q-336 601 -349 595T-369 584T-389 565L-403 577L-417 588Q-417 589 -405 603T-379 633T-358 654Q-335 668 -313 668T-247 650T-180 632Q-165 632 -152 638T-132 649T-112 668L-98 656L-84 645Q-125 586 -156 572Q-170 565 -187 565Q-208 565 -252 583T-321 601'], - - // COMBINING MACRON - 0x304: [590,-544,0,-431,-70,'-431 544V590H-70V544H-431'], - - // COMBINING BREVE - 0x306: [694,-515,0,-408,-93,'-250 515Q-321 515 -362 565T-408 683V694H-371V689Q-371 688 -371 683T-370 675Q-363 631 -331 599T-252 567Q-196 567 -163 608T-130 689V694H-93V683Q-97 617 -139 566T-250 515'], - - // COMBINING DOT ABOVE - 0x307: [669,-549,0,-310,-191,'-310 609Q-310 637 -292 653T-248 669Q-225 667 -208 652T-191 609Q-191 579 -208 564T-250 549Q-275 549 -292 564T-310 609'], - - // COMBINING DIAERESIS - 0x308: [669,-554,0,-405,-95,'-405 612Q-405 633 -388 651T-347 669T-307 652T-290 612Q-290 588 -306 571T-348 554L-373 560Q-405 577 -405 612ZM-211 611Q-211 634 -196 649T-165 668Q-164 668 -160 668T-154 669Q-131 669 -114 652T-96 612T-113 572T-154 554Q-177 554 -194 570T-211 611'], - - // COMBINING RING ABOVE - 0x30A: [715,-542,0,-353,-148,'-353 628Q-353 669 -321 692T-256 715Q-202 715 -175 689T-148 629Q-148 592 -177 567T-251 542Q-298 542 -325 567T-353 628ZM-187 628Q-187 660 -200 669T-241 678H-247Q-252 678 -258 678T-266 679Q-283 679 -293 674T-308 659T-312 644T-313 629Q-313 600 -302 590Q-290 579 -250 579H-235Q-221 579 -212 581T-195 595T-187 628'], - - // COMBINING DOUBLE ACUTE ACCENT - 0x30B: [701,-510,0,-378,-80,'-292 701Q-278 701 -262 690T-246 658Q-246 649 -250 641Q-252 637 -297 574T-344 510L-378 528Q-378 530 -355 598T-327 676Q-316 701 -292 701ZM-126 701Q-112 701 -96 690T-80 658Q-80 649 -84 641Q-86 637 -131 574T-178 510L-212 528Q-212 530 -189 598T-161 676Q-150 701 -126 701'], - - // COMBINING CARON - 0x30C: [644,-513,0,-386,-115,'-386 611L-373 630L-364 644Q-362 644 -307 612Q-252 581 -250 581L-194 612Q-139 644 -137 644L-115 611L-182 562L-251 513L-386 611'], - - // COMBINING LONG SOLIDUS OVERLAY - 0x338: [716,215,0,-639,-140,'-612 -215T-619 -215T-631 -212T-637 -204T-639 -197Q-639 -190 -634 -183Q-621 -157 -400 274T-176 707Q-173 716 -160 716Q-153 716 -148 712T-142 703T-140 696Q-140 691 -372 241T-608 -212Q-612 -215 -619 -215'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Regular/CombDiacritMarks.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/GeometricShapes.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/GeometricShapes.js deleted file mode 100644 index e218c11c09..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/GeometricShapes.js +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Regular/GeometricShapes.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main'], - { - // WHITE UP-POINTING TRIANGLE - 0x25B3: [716,0,889,59,828,'75 0L72 2Q69 3 67 5T62 11T59 20Q59 24 62 30Q65 37 245 370T428 707Q428 708 430 710T436 714T444 716Q451 716 455 712Q459 710 644 368L828 27V20Q828 7 814 0H75ZM610 347L444 653Q443 653 278 347T113 40H775Q775 42 610 347'], - - // WHITE RIGHT-POINTING SMALL TRIANGLE - 0x25B9: [505,5,500,26,473,'26 489Q33 505 43 505Q51 505 260 385Q464 266 471 259Q473 257 473 250Q473 242 469 239Q459 231 260 115Q51 -5 43 -5Q39 -5 35 -1T28 7L26 11V489ZM412 250L67 450Q66 450 66 250T67 50Q69 51 240 150T412 250'], - - // WHITE DOWN-POINTING TRIANGLE - 0x25BD: [500,215,889,59,828,'59 480Q59 485 61 489T66 495T72 498L75 500H814Q828 493 828 480V474L644 132Q458 -210 455 -212Q451 -215 444 -215T433 -212Q429 -210 342 -49T164 282T64 466Q59 478 59 480ZM775 460H113Q113 459 278 153T444 -153T610 153T775 460'], - - // WHITE LEFT-POINTING SMALL TRIANGLE - 0x25C3: [505,5,500,26,473,'473 10Q466 -5 454 -5Q451 -5 445 -3Q444 -3 343 56T140 173T35 234Q26 239 26 250T35 266Q40 269 240 384T445 503Q451 505 453 505Q466 505 473 490V10ZM433 50T433 250T432 450T259 351T87 250T258 150T432 50Q433 50 433 250'], - - // LARGE CIRCLE - 0x25EF: [715,215,1000,56,944,'56 250Q56 353 95 442T196 589T335 681T491 715Q573 715 635 693Q694 673 747 635T846 543T917 412T944 250Q944 58 815 -78T500 -215Q457 -215 429 -210Q274 -183 165 -56T56 250ZM500 -176Q664 -176 784 -54T904 250Q904 418 799 536T543 674Q534 675 493 675Q425 675 357 647T229 567T133 432T96 250Q96 160 129 80T217 -56T346 -144T500 -176'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Regular/GeometricShapes.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/GreekAndCoptic.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/GreekAndCoptic.js deleted file mode 100644 index 52e4d33d4a..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/GreekAndCoptic.js +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Regular/GreekAndCoptic.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main'], - { - // GREEK CAPITAL LETTER GAMMA - 0x393: [680,0,625,25,582,'128 619Q121 626 117 628T101 631T58 634H25V680H554V676Q556 670 568 560T582 444V440H542V444Q542 445 538 478T523 545T492 598Q454 634 349 634H334Q264 634 249 633T233 621Q232 618 232 339L233 61Q240 54 245 52T270 48T333 46H360V0H348Q324 3 182 3Q51 3 36 0H25V46H58Q100 47 109 49T128 61V619'], - - // GREEK CAPITAL LETTER DELTA - 0x394: [716,0,833,46,786,'51 0Q46 4 46 7Q46 9 215 357T388 709Q391 716 416 716Q439 716 444 709Q447 705 616 357T786 7Q786 4 781 0H51ZM507 344L384 596L137 92L383 91H630Q630 93 507 344'], - - // GREEK CAPITAL LETTER THETA - 0x398: [705,23,778,56,722,'56 340Q56 423 86 494T164 610T270 680T388 705Q521 705 621 601T722 341Q722 260 693 191T617 75T510 4T388 -22T267 3T160 74T85 189T56 340ZM610 339Q610 428 590 495T535 598T463 651T384 668Q332 668 289 638T221 566Q168 485 168 339Q168 274 176 235Q189 158 228 105T324 28Q356 16 388 16Q415 16 442 24T501 54T555 111T594 205T610 339ZM223 263V422H263V388H514V422H554V263H514V297H263V263H223'], - - // GREEK CAPITAL LETTER LAMDA - 0x39B: [716,0,694,32,661,'320 708Q326 716 340 716H348H355Q367 716 372 708Q374 706 423 547T523 226T575 62Q581 52 591 50T634 46H661V0H653Q644 3 532 3Q411 3 390 0H379V46H392Q464 46 464 65Q463 70 390 305T316 539L246 316Q177 95 177 84Q177 72 198 59T248 46H253V0H245Q230 3 130 3Q47 3 38 0H32V46H45Q112 51 127 91Q128 92 224 399T320 708'], - - // GREEK CAPITAL LETTER XI - 0x39E: [677,0,667,42,624,'47 509L55 676Q55 677 333 677T611 676L619 509Q619 508 599 508T579 510Q579 529 575 557T564 589Q550 594 333 594T102 589Q95 586 91 558T87 510Q87 508 67 508T47 509ZM139 260V445H179V394H487V445H527V260H487V311H179V260H139ZM50 0L42 180H62Q82 180 82 178Q82 133 89 105Q92 93 95 90T108 86Q137 83 333 83Q530 83 558 86Q568 87 571 90T577 105Q584 133 584 178Q584 180 604 180H624L616 0H50'], - - // GREEK CAPITAL LETTER PI - 0x3A0: [680,0,750,25,724,'128 619Q121 626 117 628T101 631T58 634H25V680H724V634H691Q651 633 640 631T622 619V61Q628 51 639 49T691 46H724V0H713Q692 3 569 3Q434 3 425 0H414V46H447Q489 47 498 49T517 61V634H232V348L233 61Q239 51 250 49T302 46H335V0H324Q303 3 180 3Q45 3 36 0H25V46H58Q100 47 109 49T128 61V619'], - - // GREEK CAPITAL LETTER SIGMA - 0x3A3: [683,0,722,55,666,'666 247Q664 244 652 126T638 4V0H351Q131 0 95 0T57 5V6Q54 12 57 17L73 36Q89 54 121 90T182 159L305 299L56 644L55 658Q55 677 60 681Q63 683 351 683H638V679Q640 674 652 564T666 447V443H626V447Q618 505 604 543T559 605Q529 626 478 631T333 637H294H189L293 494Q314 465 345 422Q400 346 400 340Q400 338 399 337L154 57Q407 57 428 58Q476 60 508 68T551 83T575 103Q595 125 608 162T624 225L626 251H666V247'], - - // GREEK CAPITAL LETTER UPSILON - 0x3A5: [705,0,778,55,722,'55 551Q55 604 91 654T194 705Q240 705 277 681T334 624T367 556T385 498L389 474L392 488Q394 501 400 521T414 566T438 615T473 659T521 692T584 705Q620 705 648 689T691 647T714 597T722 551Q722 540 719 538T699 536Q680 536 677 541Q677 542 677 544T676 548Q676 576 650 596T588 616H582Q538 616 505 582Q466 543 454 477T441 318Q441 301 441 269T442 222V61Q448 55 452 53T478 48T542 46H569V0H557Q533 3 389 3T221 0H209V46H236Q256 46 270 46T295 47T311 48T322 51T328 54T332 57T337 61V209Q337 383 333 415Q313 616 189 616Q154 616 128 597T101 548Q101 540 97 538T78 536Q63 536 59 538T55 551'], - - // GREEK CAPITAL LETTER PHI - 0x3A6: [683,0,722,55,665,'312 622Q310 623 307 625T303 629T297 631T286 634T270 635T246 636T211 637H184V683H196Q220 680 361 680T526 683H538V637H511Q468 637 447 635T422 631T411 622V533L425 531Q525 519 595 466T665 342Q665 301 642 267T583 209T506 172T425 152L411 150V61Q417 55 421 53T447 48T511 46H538V0H526Q502 3 361 3T196 0H184V46H211Q231 46 245 46T270 47T286 48T297 51T303 54T307 57T312 61V150H310Q309 151 289 153T232 166T160 195Q149 201 136 210T103 238T69 284T56 342Q56 414 128 467T294 530Q309 532 310 533H312V622ZM170 342Q170 207 307 188H312V495H309Q301 495 282 491T231 469T186 423Q170 389 170 342ZM415 188Q487 199 519 236T551 342Q551 384 539 414T507 459T470 481T434 491T415 495H410V188H415'], - - // GREEK CAPITAL LETTER PSI - 0x3A8: [683,0,778,55,722,'340 622Q338 623 335 625T331 629T325 631T314 634T298 635T274 636T239 637H212V683H224Q248 680 389 680T554 683H566V637H539Q479 637 464 635T439 622L438 407Q438 192 439 192Q443 193 449 195T474 207T507 232T536 276T557 344Q560 365 562 417T573 493Q587 536 620 544Q627 546 671 546H715L722 540V515Q714 509 708 509Q680 505 671 476T658 392T644 307Q599 177 451 153L438 151V106L439 61Q446 54 451 52T476 48T539 46H566V0H554Q530 3 389 3T224 0H212V46H239Q259 46 273 46T298 47T314 48T325 51T331 54T335 57T340 61V151Q126 178 117 406Q115 503 69 509Q55 509 55 526Q55 541 59 543T86 546H107H120Q150 546 161 543T184 528Q198 514 204 493Q212 472 213 420T226 316T272 230Q287 216 303 207T330 194L339 192Q340 192 340 407V622'], - - // GREEK CAPITAL LETTER OMEGA - 0x3A9: [705,0,722,44,677,'55 454Q55 503 75 546T127 617T197 665T272 695T337 704H352Q396 704 404 703Q527 687 596 615T666 454Q666 392 635 330T559 200T499 83V80H543Q589 81 600 83T617 93Q622 102 629 135T636 172L637 177H677V175L660 89Q645 3 644 2V0H552H488Q461 0 456 3T451 20Q451 89 499 235T548 455Q548 512 530 555T483 622T424 656T361 668Q332 668 303 658T243 626T193 560T174 456Q174 380 222 233T270 20Q270 7 263 0H77V2Q76 3 61 89L44 175V177H84L85 172Q85 171 88 155T96 119T104 93Q109 86 120 84T178 80H222V83Q206 132 162 199T87 329T55 454'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Regular/GreekAndCoptic.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/LatinExtendedA.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/LatinExtendedA.js deleted file mode 100644 index 71cd2635ca..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/LatinExtendedA.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Regular/LatinExtendedA.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main'], - { - // LATIN SMALL LETTER DOTLESS I - 0x131: [443,0,278,26,255,'247 0Q232 3 143 3Q132 3 106 3T56 1L34 0H26V46H42Q70 46 91 49Q100 53 102 60T104 102V205V293Q104 345 102 359T88 378Q74 385 41 385H30V408Q30 431 32 431L42 432Q52 433 70 434T106 436Q123 437 142 438T171 441T182 442H185V62Q190 52 197 50T232 46H255V0H247'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Regular/LatinExtendedA.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/LatinExtendedB.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/LatinExtendedB.js deleted file mode 100644 index 6810e45812..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/LatinExtendedB.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Regular/LatinExtendedB.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main'], - { - // LATIN SMALL LETTER DOTLESS J - 0x237: [443,205,306,-55,218,'28 -163Q58 -168 64 -168Q124 -168 135 -77Q137 -65 137 141T136 353Q132 371 120 377T72 385H52V408Q52 431 54 431L58 432Q62 432 70 432T87 433T108 434T133 436Q151 437 171 438T202 441T214 442H218V184Q217 -36 217 -59T211 -98Q195 -145 153 -175T58 -205Q9 -205 -23 -179T-55 -117Q-55 -94 -40 -79T-2 -64T36 -79T52 -118Q52 -143 28 -163'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Regular/LatinExtendedB.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/LetterlikeSymbols.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/LetterlikeSymbols.js deleted file mode 100644 index a05cda4269..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/LetterlikeSymbols.js +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Regular/LetterlikeSymbols.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main'], - { - // stix-/hbar - Planck's over 2pi - 0x210F: [695,13,540,42,562,'182 599Q182 611 174 615T133 619Q118 619 114 621T109 630Q109 636 114 656T122 681Q125 685 202 688Q272 695 286 695Q304 695 304 684Q304 682 295 644T282 597Q282 592 360 592H399Q430 592 445 587T460 563Q460 552 451 541L442 535H266L251 468Q247 453 243 436T236 409T233 399Q233 395 244 404Q295 441 357 441Q405 441 445 417T485 333Q485 284 449 178T412 58T426 44Q447 44 466 68Q485 87 500 130L509 152H531H543Q562 152 562 144Q562 128 546 93T494 23T415 -13Q385 -13 359 3T322 44Q318 52 318 77Q318 99 352 196T386 337Q386 386 346 386Q318 386 286 370Q267 361 245 338T211 292Q207 287 193 235T162 113T138 21Q128 7 122 4Q105 -12 83 -12Q66 -12 54 -2T42 26L166 530Q166 534 161 534T129 535Q127 535 122 535T112 534Q74 534 74 562Q74 570 77 576T84 585T96 589T109 591T124 592T138 592L182 595V599'], - - // BLACK-LETTER CAPITAL I - 0x2111: [705,10,722,55,693,'55 507Q55 589 116 647T260 705Q395 705 526 541Q542 522 549 517T567 512Q595 512 621 521T647 550Q647 553 647 555T650 558T653 560T657 561T661 561T665 561T670 561Q681 561 685 561T691 558T693 548Q693 515 657 495T565 475Q518 475 481 495T418 543T371 599T320 647T259 667Q194 667 148 622T102 508Q102 468 119 436T164 385T220 357T273 347Q282 347 284 344T287 329Q287 317 285 314T272 310Q193 310 124 364T55 507ZM420 312Q420 367 464 399T564 431Q613 431 651 406T693 336Q693 325 689 323T667 320Q654 320 651 322T647 335Q645 360 622 376T566 393H563Q557 393 551 391T537 381T523 356T517 312Q517 287 535 265T574 229T613 190T631 132Q628 74 586 37T487 -9Q478 -10 417 -10H387Q344 -10 310 4T215 69Q130 142 71 146Q59 146 57 149T55 163Q55 177 58 180T75 183H108Q177 183 207 170T306 93Q346 56 368 40T420 13Q474 25 503 60T533 136Q533 160 516 182T477 219T438 257T420 304V312'], - - // SCRIPT SMALL L - 0x2113: [706,20,417,7,397,'345 104T349 104T361 95T369 80T352 59Q268 -20 206 -20Q170 -20 146 3T113 53T99 104L94 129Q94 130 79 116T48 86T28 70Q22 70 15 79T7 94Q7 98 12 103T58 147L91 179V185Q91 186 91 191T92 200Q92 282 128 400T223 612T336 705Q397 705 397 636V627Q397 453 194 233Q185 223 180 218T174 211T171 208T165 201L163 186Q159 142 159 123Q159 17 208 17Q228 17 253 30T293 56T335 94Q345 104 349 104ZM360 634Q360 655 354 661T336 668Q328 668 322 666T302 645T272 592Q252 547 229 467T192 330L179 273Q179 272 186 280T204 300T221 322Q327 453 355 590Q360 612 360 634'], - - // SCRIPT CAPITAL P - 0x2118: [453,216,636,67,625,'300 74Q300 133 338 133Q350 133 356 126T363 109Q363 88 340 76Q340 71 342 62T358 39T393 26Q435 26 474 67T532 182T551 290Q551 325 535 349T484 373Q430 373 378 348T291 289T228 218T187 157T174 130Q254 30 265 10Q276 -15 276 -41Q276 -101 235 -158T142 -216Q112 -216 90 -195T67 -118Q67 -40 104 64L110 81Q81 118 81 174Q81 268 134 360T247 453Q252 453 255 451T258 447L259 445Q259 432 253 420Q251 416 242 416Q209 411 176 341T142 203Q142 193 143 184T146 170T149 165L158 180Q215 280 303 345T485 410Q548 410 586 368T625 255Q625 157 553 74T389 -10H383Q349 -10 325 14Q302 37 300 74ZM105 -123Q105 -134 106 -141T110 -158T122 -173T145 -178Q155 -178 160 -176Q184 -163 199 -132T214 -73Q214 -69 214 -66T213 -59T212 -53T209 -47T205 -41T199 -33T193 -25T184 -14T174 -1L165 10Q156 22 148 32L139 43Q138 43 130 15T113 -54T105 -123'], - - // BLACK-LETTER CAPITAL R - 0x211C: [716,22,722,40,715,'300 614L306 620Q311 626 316 631T332 646T356 663T386 679T425 695T473 707T531 715Q534 715 543 715T557 716Q570 716 572 714Q574 713 644 580T715 444Q715 441 713 439Q712 438 677 419T602 379T549 354L550 348Q550 337 555 238T561 128Q561 122 560 115T559 101Q559 63 591 25L599 18L631 51Q665 85 671 85Q674 85 687 78T702 68Q704 63 702 59Q702 58 659 20T613 -21Q612 -22 598 -22Q556 -22 526 -8T484 27T466 66T461 101Q461 110 462 116T463 129Q463 135 458 232T452 331V338H343V280Q342 195 333 157Q316 64 267 12Q233 -22 193 -22Q155 -22 122 2T72 74Q72 76 70 76T67 74T60 74T48 82Q40 91 40 95Q40 100 42 102T57 109V113Q57 118 66 127T81 137Q88 137 93 123Q105 127 108 126Q111 124 118 117T127 107Q127 101 123 98T113 93T107 90Q107 86 115 71T143 37T189 15H192Q230 15 239 96Q244 135 244 334Q244 510 242 542Q236 584 233 596Q223 630 205 649T166 668Q136 668 118 642T100 584Q100 567 110 554T137 522T166 486Q194 446 194 401V389Q189 243 114 243Q91 243 77 260T59 294T55 322Q55 331 59 333T75 336T91 334T95 322Q95 280 113 280Q134 280 140 305T147 375V391Q147 417 139 435T101 487Q56 540 56 572V580Q56 630 86 667T169 704Q214 704 247 676T300 614ZM324 562Q326 555 330 539T336 515T340 484T343 427V384H424L505 385Q537 396 584 422L609 435Q610 435 594 465T550 550Q536 575 520 605T496 650L488 664L476 662Q348 633 324 562'], - - // ALEF SYMBOL - 0x2135: [694,0,611,55,555,'55 613Q55 643 61 663T74 688T85 694Q94 694 94 681Q98 632 134 588L412 285Q416 311 430 397T447 509V519L438 526Q407 554 398 571T388 617T394 664T407 688T418 694Q425 694 427 684Q429 675 454 635T488 586Q490 584 496 579T513 563T537 540Q555 516 555 487Q555 460 549 441T537 416T528 409Q519 409 517 415T513 435T503 463Q492 481 490 481Q454 264 454 246Q454 237 479 212T529 152T555 79Q555 32 538 9Q531 1 524 1Q516 1 516 13Q512 62 476 106Q468 115 337 258T195 412L193 406Q191 401 189 394T183 377T176 352T171 322T167 284T165 240Q165 224 166 220Q171 199 211 152T252 70Q252 45 235 29T203 8T175 1Q170 0 115 0H79Q60 0 58 3T55 20Q55 31 58 34Q60 37 76 37Q112 39 126 46T140 70Q140 96 112 148T83 236Q83 281 102 334T140 419T159 452Q55 556 55 613'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Regular/LetterlikeSymbols.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/Main.js deleted file mode 100644 index f6a493cf7a..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/Main.js +++ /dev/null @@ -1,629 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Regular/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main'] = { - directory: 'Main/Regular', - family: 'MathJax_Main', - id: 'MJMAIN', - skew: { - 0x131: 0.0278, - 0x237: 0.0833, - 0x2113: 0.111, - 0x2118: 0.111, - 0x2202: 0.0833 - }, - Ranges: [ - [0x20,0x7F,"BasicLatin"], - [0x100,0x17F,"LatinExtendedA"], - [0x180,0x24F,"LatinExtendedB"], - [0x2B0,0x2FF,"SpacingModLetters"], - [0x300,0x36F,"CombDiacritMarks"], - [0x370,0x3FF,"GreekAndCoptic"], - [0x2100,0x214F,"LetterlikeSymbols"], - [0x2200,0x22FF,"MathOperators"], - [0x25A0,0x25FF,"GeometricShapes"], - [0x2600,0x26FF,"MiscSymbols"], - [0x2A00,0x2AFF,"SuppMathOperators"] - ], - - // SPACE - 0x20: [0,0,250,0,0,''], - - // LEFT PARENTHESIS - 0x28: [750,250,389,94,333,'94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250'], - - // RIGHT PARENTHESIS - 0x29: [750,250,389,55,294,'60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749'], - - // PLUS SIGN - 0x2B: [583,82,778,56,722,'56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250'], - - // COMMA - 0x2C: [121,195,278,78,210,'78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17'], - - // FULL STOP - 0x2E: [120,0,278,78,199,'78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60'], - - // SOLIDUS - 0x2F: [750,250,500,56,444,'423 750Q432 750 438 744T444 730Q444 725 271 248T92 -240Q85 -250 75 -250Q68 -250 62 -245T56 -231Q56 -221 230 257T407 740Q411 750 423 750'], - - // DIGIT ZERO - 0x30: [666,22,500,39,460,'96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597'], - - // DIGIT ONE - 0x31: [666,0,500,83,427,'213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578'], - - // DIGIT TWO - 0x32: [666,0,500,50,449,'109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429'], - - // DIGIT THREE - 0x33: [665,22,500,42,457,'127 463Q100 463 85 480T69 524Q69 579 117 622T233 665Q268 665 277 664Q351 652 390 611T430 522Q430 470 396 421T302 350L299 348Q299 347 308 345T337 336T375 315Q457 262 457 175Q457 96 395 37T238 -22Q158 -22 100 21T42 130Q42 158 60 175T105 193Q133 193 151 175T169 130Q169 119 166 110T159 94T148 82T136 74T126 70T118 67L114 66Q165 21 238 21Q293 21 321 74Q338 107 338 175V195Q338 290 274 322Q259 328 213 329L171 330L168 332Q166 335 166 348Q166 366 174 366Q202 366 232 371Q266 376 294 413T322 525V533Q322 590 287 612Q265 626 240 626Q208 626 181 615T143 592T132 580H135Q138 579 143 578T153 573T165 566T175 555T183 540T186 520Q186 498 172 481T127 463'], - - // DIGIT FOUR - 0x34: [677,0,500,28,471,'462 0Q444 3 333 3Q217 3 199 0H190V46H221Q241 46 248 46T265 48T279 53T286 61Q287 63 287 115V165H28V211L179 442Q332 674 334 675Q336 677 355 677H373L379 671V211H471V165H379V114Q379 73 379 66T385 54Q393 47 442 46H471V0H462ZM293 211V545L74 212L183 211H293'], - - // DIGIT FIVE - 0x35: [666,22,500,50,449,'164 157Q164 133 148 117T109 101H102Q148 22 224 22Q294 22 326 82Q345 115 345 210Q345 313 318 349Q292 382 260 382H254Q176 382 136 314Q132 307 129 306T114 304Q97 304 95 310Q93 314 93 485V614Q93 664 98 664Q100 666 102 666Q103 666 123 658T178 642T253 634Q324 634 389 662Q397 666 402 666Q410 666 410 648V635Q328 538 205 538Q174 538 149 544L139 546V374Q158 388 169 396T205 412T256 420Q337 420 393 355T449 201Q449 109 385 44T229 -22Q148 -22 99 32T50 154Q50 178 61 192T84 210T107 214Q132 214 148 197T164 157'], - - // DIGIT SIX - 0x36: [666,22,500,41,456,'42 313Q42 476 123 571T303 666Q372 666 402 630T432 550Q432 525 418 510T379 495Q356 495 341 509T326 548Q326 592 373 601Q351 623 311 626Q240 626 194 566Q147 500 147 364L148 360Q153 366 156 373Q197 433 263 433H267Q313 433 348 414Q372 400 396 374T435 317Q456 268 456 210V192Q456 169 451 149Q440 90 387 34T253 -22Q225 -22 199 -14T143 16T92 75T56 172T42 313ZM257 397Q227 397 205 380T171 335T154 278T148 216Q148 133 160 97T198 39Q222 21 251 21Q302 21 329 59Q342 77 347 104T352 209Q352 289 347 316T329 361Q302 397 257 397'], - - // DIGIT SEVEN - 0x37: [676,22,500,55,485,'55 458Q56 460 72 567L88 674Q88 676 108 676H128V672Q128 662 143 655T195 646T364 644H485V605L417 512Q408 500 387 472T360 435T339 403T319 367T305 330T292 284T284 230T278 162T275 80Q275 66 275 52T274 28V19Q270 2 255 -10T221 -22Q210 -22 200 -19T179 0T168 40Q168 198 265 368Q285 400 349 489L395 552H302Q128 552 119 546Q113 543 108 522T98 479L95 458V455H55V458'], - - // DIGIT EIGHT - 0x38: [666,22,500,43,457,'70 417T70 494T124 618T248 666Q319 666 374 624T429 515Q429 485 418 459T392 417T361 389T335 371T324 363L338 354Q352 344 366 334T382 323Q457 264 457 174Q457 95 399 37T249 -22Q159 -22 101 29T43 155Q43 263 172 335L154 348Q133 361 127 368Q70 417 70 494ZM286 386L292 390Q298 394 301 396T311 403T323 413T334 425T345 438T355 454T364 471T369 491T371 513Q371 556 342 586T275 624Q268 625 242 625Q201 625 165 599T128 534Q128 511 141 492T167 463T217 431Q224 426 228 424L286 386ZM250 21Q308 21 350 55T392 137Q392 154 387 169T375 194T353 216T330 234T301 253T274 270Q260 279 244 289T218 306L210 311Q204 311 181 294T133 239T107 157Q107 98 150 60T250 21'], - - // DIGIT NINE - 0x39: [666,22,500,42,456,'352 287Q304 211 232 211Q154 211 104 270T44 396Q42 412 42 436V444Q42 537 111 606Q171 666 243 666Q245 666 249 666T257 665H261Q273 665 286 663T323 651T370 619T413 560Q456 472 456 334Q456 194 396 97Q361 41 312 10T208 -22Q147 -22 108 7T68 93T121 149Q143 149 158 135T173 96Q173 78 164 65T148 49T135 44L131 43Q131 41 138 37T164 27T206 22H212Q272 22 313 86Q352 142 352 280V287ZM244 248Q292 248 321 297T351 430Q351 508 343 542Q341 552 337 562T323 588T293 615T246 625Q208 625 181 598Q160 576 154 546T147 441Q147 358 152 329T172 282Q197 248 244 248'], - - // COLON - 0x3A: [430,0,278,78,199,'78 370Q78 394 95 412T138 430Q162 430 180 414T199 371Q199 346 182 328T139 310T96 327T78 370ZM78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60'], - - // SEMICOLON - 0x3B: [430,194,278,78,202,'78 370Q78 394 95 412T138 430Q162 430 180 414T199 371Q199 346 182 328T139 310T96 327T78 370ZM78 60Q78 85 94 103T137 121Q202 121 202 8Q202 -44 183 -94T144 -169T118 -194Q115 -194 106 -186T95 -174Q94 -171 107 -155T137 -107T160 -38Q161 -32 162 -22T165 -4T165 4Q165 5 161 4T142 0Q110 0 94 18T78 60'], - - // LESS-THAN SIGN - 0x3C: [540,40,778,83,695,'694 -11T694 -19T688 -33T678 -40Q671 -40 524 29T234 166L90 235Q83 240 83 250Q83 261 91 266Q664 540 678 540Q681 540 687 534T694 519T687 505Q686 504 417 376L151 250L417 124Q686 -4 687 -5Q694 -11 694 -19'], - - // EQUALS SIGN - 0x3D: [367,-133,778,56,722,'56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153'], - - // GREATER-THAN SIGN - 0x3E: [540,40,778,82,694,'84 520Q84 528 88 533T96 539L99 540Q106 540 253 471T544 334L687 265Q694 260 694 250T687 235Q685 233 395 96L107 -40H101Q83 -38 83 -20Q83 -19 83 -17Q82 -10 98 -1Q117 9 248 71Q326 108 378 132L626 250L378 368Q90 504 86 509Q84 513 84 520'], - - // LEFT SQUARE BRACKET - 0x5B: [750,250,278,118,255,'118 -250V750H255V710H158V-210H255V-250H118'], - - // REVERSE SOLIDUS - 0x5C: [750,250,500,56,444,'56 731Q56 740 62 745T75 750Q85 750 92 740Q96 733 270 255T444 -231Q444 -239 438 -244T424 -250Q414 -250 407 -240Q404 -236 230 242T56 731'], - - // RIGHT SQUARE BRACKET - 0x5D: [750,250,278,22,159,'22 710V750H159V-250H22V-210H119V710H22'], - - // CIRCUMFLEX ACCENT - 0x5E: [694,-531,500,112,387,'112 560L249 694L257 686Q387 562 387 560L361 531Q359 532 303 581L250 627L195 580Q182 569 169 557T148 538L140 532Q138 530 125 546L112 560'], - - // LATIN SMALL LETTER A - 0x61: [448,11,500,34,493,'137 305T115 305T78 320T63 359Q63 394 97 421T218 448Q291 448 336 416T396 340Q401 326 401 309T402 194V124Q402 76 407 58T428 40Q443 40 448 56T453 109V145H493V106Q492 66 490 59Q481 29 455 12T400 -6T353 12T329 54V58L327 55Q325 52 322 49T314 40T302 29T287 17T269 6T247 -2T221 -8T190 -11Q130 -11 82 20T34 107Q34 128 41 147T68 188T116 225T194 253T304 268H318V290Q318 324 312 340Q290 411 215 411Q197 411 181 410T156 406T148 403Q170 388 170 359Q170 334 154 320ZM126 106Q126 75 150 51T209 26Q247 26 276 49T315 109Q317 116 318 175Q318 233 317 233Q309 233 296 232T251 223T193 203T147 166T126 106'], - - // LATIN SMALL LETTER B - 0x62: [695,11,556,20,522,'307 -11Q234 -11 168 55L158 37Q156 34 153 28T147 17T143 10L138 1L118 0H98V298Q98 599 97 603Q94 622 83 628T38 637H20V660Q20 683 22 683L32 684Q42 685 61 686T98 688Q115 689 135 690T165 693T176 694H179V543Q179 391 180 391L183 394Q186 397 192 401T207 411T228 421T254 431T286 439T323 442Q401 442 461 379T522 216Q522 115 458 52T307 -11ZM182 98Q182 97 187 90T196 79T206 67T218 55T233 44T250 35T271 29T295 26Q330 26 363 46T412 113Q424 148 424 212Q424 287 412 323Q385 405 300 405Q270 405 239 390T188 347L182 339V98'], - - // LATIN SMALL LETTER C - 0x63: [448,12,444,34,415,'370 305T349 305T313 320T297 358Q297 381 312 396Q317 401 317 402T307 404Q281 408 258 408Q209 408 178 376Q131 329 131 219Q131 137 162 90Q203 29 272 29Q313 29 338 55T374 117Q376 125 379 127T395 129H409Q415 123 415 120Q415 116 411 104T395 71T366 33T318 2T249 -11Q163 -11 99 53T34 214Q34 318 99 383T250 448T370 421T404 357Q404 334 387 320'], - - // LATIN SMALL LETTER D - 0x64: [695,11,556,34,535,'376 495Q376 511 376 535T377 568Q377 613 367 624T316 637H298V660Q298 683 300 683L310 684Q320 685 339 686T376 688Q393 689 413 690T443 693T454 694H457V390Q457 84 458 81Q461 61 472 55T517 46H535V0Q533 0 459 -5T380 -11H373V44L365 37Q307 -11 235 -11Q158 -11 96 50T34 215Q34 315 97 378T244 442Q319 442 376 393V495ZM373 342Q328 405 260 405Q211 405 173 369Q146 341 139 305T131 211Q131 155 138 120T173 59Q203 26 251 26Q322 26 373 103V342'], - - // LATIN SMALL LETTER E - 0x65: [448,11,444,28,415,'28 218Q28 273 48 318T98 391T163 433T229 448Q282 448 320 430T378 380T406 316T415 245Q415 238 408 231H126V216Q126 68 226 36Q246 30 270 30Q312 30 342 62Q359 79 369 104L379 128Q382 131 395 131H398Q415 131 415 121Q415 117 412 108Q393 53 349 21T250 -11Q155 -11 92 58T28 218ZM333 275Q322 403 238 411H236Q228 411 220 410T195 402T166 381T143 340T127 274V267H333V275'], - - // LATIN SMALL LETTER F - 0x66: [705,0,306,26,372,'273 0Q255 3 146 3Q43 3 34 0H26V46H42Q70 46 91 49Q99 52 103 60Q104 62 104 224V385H33V431H104V497L105 564L107 574Q126 639 171 668T266 704Q267 704 275 704T289 705Q330 702 351 679T372 627Q372 604 358 590T321 576T284 590T270 627Q270 647 288 667H284Q280 668 273 668Q245 668 223 647T189 592Q183 572 182 497V431H293V385H185V225Q185 63 186 61T189 57T194 54T199 51T206 49T213 48T222 47T231 47T241 46T251 46H282V0H273'], - - // LATIN SMALL LETTER G - 0x67: [453,206,500,29,485,'329 409Q373 453 429 453Q459 453 472 434T485 396Q485 382 476 371T449 360Q416 360 412 390Q410 404 415 411Q415 412 416 414V415Q388 412 363 393Q355 388 355 386Q355 385 359 381T368 369T379 351T388 325T392 292Q392 230 343 187T222 143Q172 143 123 171Q112 153 112 133Q112 98 138 81Q147 75 155 75T227 73Q311 72 335 67Q396 58 431 26Q470 -13 470 -72Q470 -139 392 -175Q332 -206 250 -206Q167 -206 107 -175Q29 -140 29 -75Q29 -39 50 -15T92 18L103 24Q67 55 67 108Q67 155 96 193Q52 237 52 292Q52 355 102 398T223 442Q274 442 318 416L329 409ZM299 343Q294 371 273 387T221 404Q192 404 171 388T145 343Q142 326 142 292Q142 248 149 227T179 192Q196 182 222 182Q244 182 260 189T283 207T294 227T299 242Q302 258 302 292T299 343ZM403 -75Q403 -50 389 -34T348 -11T299 -2T245 0H218Q151 0 138 -6Q118 -15 107 -34T95 -74Q95 -84 101 -97T122 -127T170 -155T250 -167Q319 -167 361 -139T403 -75'], - - // LATIN SMALL LETTER H - 0x68: [695,0,556,25,542,'41 46H55Q94 46 102 60V68Q102 77 102 91T102 124T102 167T103 217T103 272T103 329Q103 366 103 407T103 482T102 542T102 586T102 603Q99 622 88 628T43 637H25V660Q25 683 27 683L37 684Q47 685 66 686T103 688Q120 689 140 690T170 693T181 694H184V367Q244 442 328 442Q451 442 463 329Q464 322 464 190V104Q464 66 466 59T477 49Q498 46 526 46H542V0H534L510 1Q487 2 460 2T422 3Q319 3 310 0H302V46H318Q379 46 379 62Q380 64 380 200Q379 335 378 343Q372 371 358 385T334 402T308 404Q263 404 229 370Q202 343 195 315T187 232V168V108Q187 78 188 68T191 55T200 49Q221 46 249 46H265V0H257L234 1Q210 2 183 2T145 3Q42 3 33 0H25V46H41'], - - // LATIN SMALL LETTER I - 0x69: [669,0,278,26,255,'69 609Q69 637 87 653T131 669Q154 667 171 652T188 609Q188 579 171 564T129 549Q104 549 87 564T69 609ZM247 0Q232 3 143 3Q132 3 106 3T56 1L34 0H26V46H42Q70 46 91 49Q100 53 102 60T104 102V205V293Q104 345 102 359T88 378Q74 385 41 385H30V408Q30 431 32 431L42 432Q52 433 70 434T106 436Q123 437 142 438T171 441T182 442H185V62Q190 52 197 50T232 46H255V0H247'], - - // LATIN SMALL LETTER J - 0x6A: [669,205,306,-55,218,'98 609Q98 637 116 653T160 669Q183 667 200 652T217 609Q217 579 200 564T158 549Q133 549 116 564T98 609ZM28 -163Q58 -168 64 -168Q124 -168 135 -77Q137 -65 137 141T136 353Q132 371 120 377T72 385H52V408Q52 431 54 431L58 432Q62 432 70 432T87 433T108 434T133 436Q151 437 171 438T202 441T214 442H218V184Q217 -36 217 -59T211 -98Q195 -145 153 -175T58 -205Q9 -205 -23 -179T-55 -117Q-55 -94 -40 -79T-2 -64T36 -79T52 -118Q52 -143 28 -163'], - - // LATIN SMALL LETTER K - 0x6B: [695,0,528,20,511,'36 46H50Q89 46 97 60V68Q97 77 97 91T97 124T98 167T98 217T98 272T98 329Q98 366 98 407T98 482T98 542T97 586T97 603Q94 622 83 628T38 637H20V660Q20 683 22 683L32 684Q42 685 61 686T98 688Q115 689 135 690T165 693T176 694H179V463L180 233L240 287Q300 341 304 347Q310 356 310 364Q310 383 289 385H284V431H293Q308 428 412 428Q475 428 484 431H489V385H476Q407 380 360 341Q286 278 286 274Q286 273 349 181T420 79Q434 60 451 53T500 46H511V0H505Q496 3 418 3Q322 3 307 0H299V46H306Q330 48 330 65Q330 72 326 79Q323 84 276 153T228 222L176 176V120V84Q176 65 178 59T189 49Q210 46 238 46H254V0H246Q231 3 137 3T28 0H20V46H36'], - - // LATIN SMALL LETTER L - 0x6C: [695,0,278,26,263,'42 46H56Q95 46 103 60V68Q103 77 103 91T103 124T104 167T104 217T104 272T104 329Q104 366 104 407T104 482T104 542T103 586T103 603Q100 622 89 628T44 637H26V660Q26 683 28 683L38 684Q48 685 67 686T104 688Q121 689 141 690T171 693T182 694H185V379Q185 62 186 60Q190 52 198 49Q219 46 247 46H263V0H255L232 1Q209 2 183 2T145 3T107 3T57 1L34 0H26V46H42'], - - // LATIN SMALL LETTER M - 0x6D: [443,0,833,25,819,'41 46H55Q94 46 102 60V68Q102 77 102 91T102 122T103 161T103 203Q103 234 103 269T102 328V351Q99 370 88 376T43 385H25V408Q25 431 27 431L37 432Q47 433 65 434T102 436Q119 437 138 438T167 441T178 442H181V402Q181 364 182 364T187 369T199 384T218 402T247 421T285 437Q305 442 336 442Q351 442 364 440T387 434T406 426T421 417T432 406T441 395T448 384T452 374T455 366L457 361L460 365Q463 369 466 373T475 384T488 397T503 410T523 422T546 432T572 439T603 442Q729 442 740 329Q741 322 741 190V104Q741 66 743 59T754 49Q775 46 803 46H819V0H811L788 1Q764 2 737 2T699 3Q596 3 587 0H579V46H595Q656 46 656 62Q657 64 657 200Q656 335 655 343Q649 371 635 385T611 402T585 404Q540 404 506 370Q479 343 472 315T464 232V168V108Q464 78 465 68T468 55T477 49Q498 46 526 46H542V0H534L510 1Q487 2 460 2T422 3Q319 3 310 0H302V46H318Q379 46 379 62Q380 64 380 200Q379 335 378 343Q372 371 358 385T334 402T308 404Q263 404 229 370Q202 343 195 315T187 232V168V108Q187 78 188 68T191 55T200 49Q221 46 249 46H265V0H257L234 1Q210 2 183 2T145 3Q42 3 33 0H25V46H41'], - - // LATIN SMALL LETTER N - 0x6E: [443,0,556,25,542,'41 46H55Q94 46 102 60V68Q102 77 102 91T102 122T103 161T103 203Q103 234 103 269T102 328V351Q99 370 88 376T43 385H25V408Q25 431 27 431L37 432Q47 433 65 434T102 436Q119 437 138 438T167 441T178 442H181V402Q181 364 182 364T187 369T199 384T218 402T247 421T285 437Q305 442 336 442Q450 438 463 329Q464 322 464 190V104Q464 66 466 59T477 49Q498 46 526 46H542V0H534L510 1Q487 2 460 2T422 3Q319 3 310 0H302V46H318Q379 46 379 62Q380 64 380 200Q379 335 378 343Q372 371 358 385T334 402T308 404Q263 404 229 370Q202 343 195 315T187 232V168V108Q187 78 188 68T191 55T200 49Q221 46 249 46H265V0H257L234 1Q210 2 183 2T145 3Q42 3 33 0H25V46H41'], - - // LATIN SMALL LETTER O - 0x6F: [448,10,500,28,471,'28 214Q28 309 93 378T250 448Q340 448 405 380T471 215Q471 120 407 55T250 -10Q153 -10 91 57T28 214ZM250 30Q372 30 372 193V225V250Q372 272 371 288T364 326T348 362T317 390T268 410Q263 411 252 411Q222 411 195 399Q152 377 139 338T126 246V226Q126 130 145 91Q177 30 250 30'], - - // LATIN SMALL LETTER P - 0x70: [443,194,556,20,522,'36 -148H50Q89 -148 97 -134V-126Q97 -119 97 -107T97 -77T98 -38T98 6T98 55T98 106Q98 140 98 177T98 243T98 296T97 335T97 351Q94 370 83 376T38 385H20V408Q20 431 22 431L32 432Q42 433 61 434T98 436Q115 437 135 438T165 441T176 442H179V416L180 390L188 397Q247 441 326 441Q407 441 464 377T522 216Q522 115 457 52T310 -11Q242 -11 190 33L182 40V-45V-101Q182 -128 184 -134T195 -145Q216 -148 244 -148H260V-194H252L228 -193Q205 -192 178 -192T140 -191Q37 -191 28 -194H20V-148H36ZM424 218Q424 292 390 347T305 402Q234 402 182 337V98Q222 26 294 26Q345 26 384 80T424 218'], - - // LATIN SMALL LETTER Q - 0x71: [442,194,528,33,535,'33 218Q33 308 95 374T236 441H246Q330 441 381 372L387 364Q388 364 404 403L420 442H457V156Q457 -132 458 -134Q462 -142 470 -145Q491 -148 519 -148H535V-194H527L504 -193Q480 -192 453 -192T415 -191Q312 -191 303 -194H295V-148H311Q339 -148 360 -145Q369 -141 371 -135T373 -106V-41V49Q313 -11 236 -11Q154 -11 94 53T33 218ZM376 300Q346 389 278 401Q275 401 269 401T261 402Q211 400 171 350T131 214Q131 137 165 82T253 27Q296 27 328 54T376 118V300'], - - // LATIN SMALL LETTER R - 0x72: [443,0,392,20,364,'36 46H50Q89 46 97 60V68Q97 77 97 91T98 122T98 161T98 203Q98 234 98 269T98 328L97 351Q94 370 83 376T38 385H20V408Q20 431 22 431L32 432Q42 433 60 434T96 436Q112 437 131 438T160 441T171 442H174V373Q213 441 271 441H277Q322 441 343 419T364 373Q364 352 351 337T313 322Q288 322 276 338T263 372Q263 381 265 388T270 400T273 405Q271 407 250 401Q234 393 226 386Q179 341 179 207V154Q179 141 179 127T179 101T180 81T180 66V61Q181 59 183 57T188 54T193 51T200 49T207 48T216 47T225 47T235 46T245 46H276V0H267Q249 3 140 3Q37 3 28 0H20V46H36'], - - // LATIN SMALL LETTER S - 0x73: [448,11,394,33,359,'295 316Q295 356 268 385T190 414Q154 414 128 401Q98 382 98 349Q97 344 98 336T114 312T157 287Q175 282 201 278T245 269T277 256Q294 248 310 236T342 195T359 133Q359 71 321 31T198 -10H190Q138 -10 94 26L86 19L77 10Q71 4 65 -1L54 -11H46H42Q39 -11 33 -5V74V132Q33 153 35 157T45 162H54Q66 162 70 158T75 146T82 119T101 77Q136 26 198 26Q295 26 295 104Q295 133 277 151Q257 175 194 187T111 210Q75 227 54 256T33 318Q33 357 50 384T93 424T143 442T187 447H198Q238 447 268 432L283 424L292 431Q302 440 314 448H322H326Q329 448 335 442V310L329 304H301Q295 310 295 316'], - - // LATIN SMALL LETTER T - 0x74: [615,10,389,18,333,'27 422Q80 426 109 478T141 600V615H181V431H316V385H181V241Q182 116 182 100T189 68Q203 29 238 29Q282 29 292 100Q293 108 293 146V181H333V146V134Q333 57 291 17Q264 -10 221 -10Q187 -10 162 2T124 33T105 68T98 100Q97 107 97 248V385H18V422H27'], - - // LATIN SMALL LETTER U - 0x75: [443,11,556,25,542,'383 58Q327 -10 256 -10H249Q124 -10 105 89Q104 96 103 226Q102 335 102 348T96 369Q86 385 36 385H25V408Q25 431 27 431L38 432Q48 433 67 434T105 436Q122 437 142 438T172 441T184 442H187V261Q188 77 190 64Q193 49 204 40Q224 26 264 26Q290 26 311 35T343 58T363 90T375 120T379 144Q379 145 379 161T380 201T380 248V315Q380 361 370 372T320 385H302V431Q304 431 378 436T457 442H464V264Q464 84 465 81Q468 61 479 55T524 46H542V0Q540 0 467 -5T390 -11H383V58'], - - // LATIN SMALL LETTER V - 0x76: [431,11,528,19,508,'338 431Q344 429 422 429Q479 429 503 431H508V385H497Q439 381 423 345Q421 341 356 172T288 -2Q283 -11 263 -11Q244 -11 239 -2Q99 359 98 364Q93 378 82 381T43 385H19V431H25L33 430Q41 430 53 430T79 430T104 429T122 428Q217 428 232 431H240V385H226Q187 384 184 370Q184 366 235 234L286 102L377 341V349Q377 363 367 372T349 383T335 385H331V431H338'], - - // LATIN SMALL LETTER W - 0x77: [431,11,722,18,703,'90 368Q84 378 76 380T40 385H18V431H24L43 430Q62 430 84 429T116 428Q206 428 221 431H229V385H215Q177 383 177 368Q177 367 221 239L265 113L339 328L333 345Q323 374 316 379Q308 384 278 385H258V431H264Q270 428 348 428Q439 428 454 431H461V385H452Q404 385 404 369Q404 366 418 324T449 234T481 143L496 100L537 219Q579 341 579 347Q579 363 564 373T530 385H522V431H529Q541 428 624 428Q692 428 698 431H703V385H697Q696 385 691 385T682 384Q635 377 619 334L559 161Q546 124 528 71Q508 12 503 1T487 -11H479Q460 -11 456 -4Q455 -3 407 133L361 267Q359 263 266 -4Q261 -11 243 -11H238Q225 -11 220 -3L90 368'], - - // LATIN SMALL LETTER X - 0x78: [431,0,528,11,516,'201 0Q189 3 102 3Q26 3 17 0H11V46H25Q48 47 67 52T96 61T121 78T139 96T160 122T180 150L226 210L168 288Q159 301 149 315T133 336T122 351T113 363T107 370T100 376T94 379T88 381T80 383Q74 383 44 385H16V431H23Q59 429 126 429Q219 429 229 431H237V385Q201 381 201 369Q201 367 211 353T239 315T268 274L272 270L297 304Q329 345 329 358Q329 364 327 369T322 376T317 380T310 384L307 385H302V431H309Q324 428 408 428Q487 428 493 431H499V385H492Q443 385 411 368Q394 360 377 341T312 257L296 236L358 151Q424 61 429 57T446 50Q464 46 499 46H516V0H510H502Q494 1 482 1T457 2T432 2T414 3Q403 3 377 3T327 1L304 0H295V46H298Q309 46 320 51T331 63Q331 65 291 120L250 175Q249 174 219 133T185 88Q181 83 181 74Q181 63 188 55T206 46Q208 46 208 23V0H201'], - - // LATIN SMALL LETTER Y - 0x79: [431,204,528,19,508,'69 -66Q91 -66 104 -80T118 -116Q118 -134 109 -145T91 -160Q84 -163 97 -166Q104 -168 111 -168Q131 -168 148 -159T175 -138T197 -106T213 -75T225 -43L242 0L170 183Q150 233 125 297Q101 358 96 368T80 381Q79 382 78 382Q66 385 34 385H19V431H26L46 430Q65 430 88 429T122 428Q129 428 142 428T171 429T200 430T224 430L233 431H241V385H232Q183 385 185 366L286 112Q286 113 332 227L376 341V350Q376 365 366 373T348 383T334 385H331V431H337H344Q351 431 361 431T382 430T405 429T422 429Q477 429 503 431H508V385H497Q441 380 422 345Q420 343 378 235T289 9T227 -131Q180 -204 113 -204Q69 -204 44 -177T19 -116Q19 -89 35 -78T69 -66'], - - // LATIN SMALL LETTER Z - 0x7A: [431,0,444,28,401,'42 263Q44 270 48 345T53 423V431H393Q399 425 399 415Q399 403 398 402L381 378Q364 355 331 309T265 220L134 41L182 40H206Q254 40 283 46T331 77Q352 105 359 185L361 201Q361 202 381 202H401V196Q401 195 393 103T384 6V0H209L34 1L31 3Q28 8 28 17Q28 30 29 31T160 210T294 394H236Q169 393 152 388Q127 382 113 367Q89 344 82 264V255H42V263'], - - // LEFT CURLY BRACKET - 0x7B: [750,250,500,65,434,'434 -231Q434 -244 428 -250H410Q281 -250 230 -184Q225 -177 222 -172T217 -161T213 -148T211 -133T210 -111T209 -84T209 -47T209 0Q209 21 209 53Q208 142 204 153Q203 154 203 155Q189 191 153 211T82 231Q71 231 68 234T65 250T68 266T82 269Q116 269 152 289T203 345Q208 356 208 377T209 529V579Q209 634 215 656T244 698Q270 724 324 740Q361 748 377 749Q379 749 390 749T408 750H428Q434 744 434 732Q434 719 431 716Q429 713 415 713Q362 710 332 689T296 647Q291 634 291 499V417Q291 370 288 353T271 314Q240 271 184 255L170 250L184 245Q202 239 220 230T262 196T290 137Q291 131 291 1Q291 -134 296 -147Q306 -174 339 -192T415 -213Q429 -213 431 -216Q434 -219 434 -231'], - - // VERTICAL LINE - 0x7C: [750,249,278,119,159,'139 -249H137Q125 -249 119 -235V251L120 737Q130 750 139 750Q152 750 159 735V-235Q151 -249 141 -249H139'], - - // RIGHT CURLY BRACKET - 0x7D: [750,250,500,65,434,'65 731Q65 745 68 747T88 750Q171 750 216 725T279 670Q288 649 289 635T291 501Q292 362 293 357Q306 312 345 291T417 269Q428 269 431 266T434 250T431 234T417 231Q380 231 345 210T298 157Q293 143 292 121T291 -28V-79Q291 -134 285 -156T256 -198Q202 -250 89 -250Q71 -250 68 -247T65 -230Q65 -224 65 -223T66 -218T69 -214T77 -213Q91 -213 108 -210T146 -200T183 -177T207 -139Q208 -134 209 3L210 139Q223 196 280 230Q315 247 330 250Q305 257 280 270Q225 304 212 352L210 362L209 498Q208 635 207 640Q195 680 154 696T77 713Q68 713 67 716T65 731'], - - // DIAERESIS - 0xA8: [669,-554,500,95,405,'95 612Q95 633 112 651T153 669T193 652T210 612Q210 588 194 571T152 554L127 560Q95 577 95 612ZM289 611Q289 634 304 649T335 668Q336 668 340 668T346 669Q369 669 386 652T404 612T387 572T346 554Q323 554 306 570T289 611'], - - // NOT SIGN - 0xAC: [356,-89,667,56,611,'56 323T56 336T70 356H596Q603 353 611 343V102Q598 89 591 89Q587 89 584 90T579 94T575 98T572 102L571 209V316H70Q56 323 56 336'], - - // MACRON - 0xAF: [590,-544,500,69,430,'69 544V590H430V544H69'], - - // DEGREE SIGN - 0xB0: [715,-542,500,147,352,'147 628Q147 669 179 692T244 715Q298 715 325 689T352 629Q352 592 323 567T249 542Q202 542 175 567T147 628ZM313 628Q313 660 300 669T259 678H253Q248 678 242 678T234 679Q217 679 207 674T192 659T188 644T187 629Q187 600 198 590Q210 579 250 579H265Q279 579 288 581T305 595T313 628'], - - // PLUS-MINUS SIGN - 0xB1: [666,0,778,56,722,'56 320T56 333T70 353H369V502Q369 651 371 655Q376 666 388 666Q402 666 405 654T409 596V500V353H707Q722 345 722 333Q722 320 707 313H409V40H707Q722 32 722 20T707 0H70Q56 7 56 20T70 40H369V313H70Q56 320 56 333'], - - // ACUTE ACCENT - 0xB4: [699,-505,500,203,393,'349 699Q367 699 380 686T393 656Q393 651 392 647T387 637T380 627T367 616T351 602T330 585T303 563L232 505L217 519Q203 533 204 533Q204 534 229 567T282 636T313 678L316 681Q318 684 321 686T328 692T337 697T349 699'], - - // MULTIPLICATION SIGN - 0xD7: [491,-9,778,147,630,'630 29Q630 9 609 9Q604 9 587 25T493 118L389 222L284 117Q178 13 175 11Q171 9 168 9Q160 9 154 15T147 29Q147 36 161 51T255 146L359 250L255 354Q174 435 161 449T147 471Q147 480 153 485T168 490Q173 490 175 489Q178 487 284 383L389 278L493 382Q570 459 587 475T609 491Q630 491 630 471Q630 464 620 453T522 355L418 250L522 145Q606 61 618 48T630 29'], - - // DIVISION SIGN - 0xF7: [537,36,778,56,721,'318 466Q318 500 339 518T386 537Q418 537 438 517T458 466Q458 438 440 417T388 396Q355 396 337 417T318 466ZM56 237T56 250T70 270H706Q721 262 721 250T706 230H70Q56 237 56 250ZM318 34Q318 68 339 86T386 105Q418 105 438 85T458 34Q458 6 440 -15T388 -36Q355 -36 337 -15T318 34'], - - // MODIFIER LETTER CIRCUMFLEX ACCENT - 0x2C6: [694,-531,500,112,387,'112 560L249 694L257 686Q387 562 387 560L361 531Q359 532 303 581L250 627L195 580Q182 569 169 557T148 538L140 532Q138 530 125 546L112 560'], - - // CARON - 0x2C7: [644,-513,500,114,385,'114 611L127 630L136 644Q138 644 193 612Q248 581 250 581L306 612Q361 644 363 644L385 611L318 562L249 513L114 611'], - - // MODIFIER LETTER MACRON - 0x2C9: [590,-544,500,69,430,'69 544V590H430V544H69'], - - // MODIFIER LETTER ACUTE ACCENT - 0x2CA: [699,-505,500,203,393,'349 699Q367 699 380 686T393 656Q393 651 392 647T387 637T380 627T367 616T351 602T330 585T303 563L232 505L217 519Q203 533 204 533Q204 534 229 567T282 636T313 678L316 681Q318 684 321 686T328 692T337 697T349 699'], - - // MODIFIER LETTER GRAVE ACCENT - 0x2CB: [699,-505,500,106,296,'106 655Q106 671 119 685T150 699Q166 699 177 688Q190 671 222 629T275 561T295 533T282 519L267 505L196 563Q119 626 113 634Q106 643 106 655'], - - // BREVE - 0x2D8: [694,-515,500,92,407,'250 515Q179 515 138 565T92 683V694H129V689Q129 688 129 683T130 675Q137 631 169 599T248 567Q304 567 337 608T370 689V694H407V683Q403 617 361 566T250 515'], - - // DOT ABOVE - 0x2D9: [669,-549,500,190,309,'190 609Q190 637 208 653T252 669Q275 667 292 652T309 609Q309 579 292 564T250 549Q225 549 208 564T190 609'], - - // SMALL TILDE - 0x2DC: [668,-565,500,83,416,'179 601Q164 601 151 595T131 584T111 565L97 577L83 588Q83 589 95 603T121 633T142 654Q165 668 187 668T253 650T320 632Q335 632 348 638T368 649T388 668L402 656L416 645Q375 586 344 572Q330 565 313 565Q292 565 248 583T179 601'], - - // EN DASH - 0x2013: [285,-248,500,0,499,'0 248V285H499V248H0'], - - // EM DASH - 0x2014: [285,-248,1000,0,999,'0 248V285H999V248H0'], - - // LEFT SINGLE QUOTATION MARK - 0x2018: [694,-379,278,64,199,'64 494Q64 548 86 597T131 670T160 694Q163 694 172 685T182 672Q182 669 170 656T144 625T116 573T101 501Q101 489 102 489T107 491T120 497T138 500Q163 500 180 483T198 440T181 397T139 379Q110 379 87 405T64 494'], - - // RIGHT SINGLE QUOTATION MARK - 0x2019: [694,-379,278,78,212,'78 634Q78 659 95 676T138 694Q166 694 189 668T212 579Q212 525 190 476T146 403T118 379Q114 379 105 388T95 401Q95 404 107 417T133 448T161 500T176 572Q176 584 175 584T170 581T157 576T139 573Q114 573 96 590T78 634'], - - // LEFT DOUBLE QUOTATION MARK - 0x201C: [694,-379,500,128,466,'128 494Q128 528 137 560T158 616T185 658T209 685T223 694T236 685T245 670Q244 668 231 654T204 622T178 571T164 501Q164 489 165 489T170 491T183 497T201 500Q226 500 244 483T262 440T245 397T202 379Q173 379 151 405T128 494ZM332 494Q332 528 341 560T362 616T389 658T413 685T427 694T439 685T449 672Q449 669 437 656T411 625T383 573T368 501Q368 489 369 489T374 491T387 497T405 500Q430 500 448 483T466 440T449 397T406 379Q377 379 355 405T332 494'], - - // RIGHT DOUBLE QUOTATION MARK - 0x201D: [694,-379,500,34,372,'34 634Q34 659 50 676T93 694Q121 694 144 668T168 579Q168 525 146 476T101 403T73 379Q69 379 60 388T50 401Q50 404 62 417T88 448T116 500T131 572Q131 584 130 584T125 581T112 576T94 573Q69 573 52 590T34 634ZM238 634Q238 659 254 676T297 694Q325 694 348 668T372 579Q372 525 350 476T305 403T277 379Q273 379 264 388T254 401Q254 404 266 417T292 448T320 500T335 572Q335 584 334 584T329 581T316 576T298 573Q273 573 256 590T238 634'], - - // DAGGER - 0x2020: [705,216,444,54,389,'182 675Q195 705 222 705Q234 705 243 700T253 691T263 675L262 655Q262 620 252 549T240 454V449Q250 451 288 461T346 472T377 461T389 431Q389 417 379 404T346 390Q327 390 288 401T243 412H240V405Q245 367 250 339T258 301T261 274T263 225Q263 124 255 -41T239 -213Q236 -216 222 -216H217Q206 -216 204 -212T200 -186Q199 -175 199 -168Q181 38 181 225Q181 265 182 280T191 327T204 405V412H201Q196 412 157 401T98 390Q76 390 66 403T55 431T65 458T98 472Q116 472 155 462T205 449Q204 452 204 460T201 490T193 547Q182 619 182 655V675'], - - // DOUBLE DAGGER - 0x2021: [705,205,444,54,389,'181 658Q181 705 222 705T263 658Q263 633 252 572T240 497Q240 496 241 496Q243 496 285 507T345 519Q365 519 376 508T388 478Q388 466 384 458T375 447T361 438H344Q318 438 282 448T241 459Q240 458 240 456Q240 449 251 384T263 297Q263 278 255 267T238 253T222 250T206 252T190 266T181 297Q181 323 192 383T204 458Q204 459 203 459Q198 459 162 449T101 438H84Q74 443 70 446T61 457T56 478Q56 497 67 508T99 519Q117 519 159 508T203 496Q204 496 204 499Q204 507 193 572T181 658ZM181 202Q181 249 222 249T263 202Q263 185 259 161T249 103T240 48V41H243Q248 41 287 52T346 63T377 52T389 22Q389 8 379 -5T346 -19Q327 -19 288 -8T243 3H240V-4Q243 -24 249 -58T259 -117T263 -158Q263 -177 255 -188T238 -202T222 -205T206 -203T190 -189T181 -158Q181 -141 185 -117T195 -59T204 -4V3H201Q196 3 157 -8T98 -19Q76 -19 66 -6T55 22T65 49T98 63Q117 63 156 52T201 41H204V48Q201 68 195 102T185 161T181 202'], - - // HORIZONTAL ELLIPSIS - 0x2026: [120,0,1172,78,1093,'78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60ZM525 60Q525 84 542 102T585 120Q609 120 627 104T646 61Q646 36 629 18T586 0T543 17T525 60ZM972 60Q972 84 989 102T1032 120Q1056 120 1074 104T1093 61Q1093 36 1076 18T1033 0T990 17T972 60'], - - // PRIME - 0x2032: [560,-43,275,30,262,'79 43Q73 43 52 49T30 61Q30 68 85 293T146 528Q161 560 198 560Q218 560 240 545T262 501Q262 496 260 486Q259 479 173 263T84 45T79 43'], - - // COMBINING RIGHT ARROW ABOVE - 0x20D7: [714,-516,0,-471,-29,'-123 694Q-123 702 -118 708T-103 714Q-93 714 -88 706T-80 687T-67 660T-40 633Q-29 626 -29 615Q-29 606 -36 600T-53 590T-83 571T-121 531Q-135 516 -143 516T-157 522T-163 536T-152 559T-129 584T-116 595H-287L-458 596Q-459 597 -461 599T-466 602T-469 607T-471 615Q-471 622 -458 635H-99Q-123 673 -123 694'], - - // LEFTWARDS ARROW - 0x2190: [511,11,1000,55,944,'944 261T944 250T929 230H165Q167 228 182 216T211 189T244 152T277 96T303 25Q308 7 308 0Q308 -11 288 -11Q281 -11 278 -11T272 -7T267 2T263 21Q245 94 195 151T73 236Q58 242 55 247Q55 254 59 257T73 264Q121 283 158 314T215 375T247 434T264 480L267 497Q269 503 270 505T275 509T288 511Q308 511 308 500Q308 493 303 475Q293 438 278 406T246 352T215 315T185 287T165 270H929Q944 261 944 250'], - - // UPWARDS ARROW - 0x2191: [694,193,500,17,483,'27 414Q17 414 17 433Q17 437 17 439T17 444T19 447T20 450T22 452T26 453T30 454T36 456Q80 467 120 494T180 549Q227 607 238 678Q240 694 251 694Q259 694 261 684Q261 677 265 659T284 608T320 549Q340 525 363 507T405 479T440 463T467 455T479 451Q483 447 483 433Q483 413 472 413Q467 413 458 416Q342 448 277 545L270 555V-179Q262 -193 252 -193H250H248Q236 -193 230 -179V555L223 545Q192 499 146 467T70 424T27 414'], - - // RIGHTWARDS ARROW - 0x2192: [511,11,1000,56,944,'56 237T56 250T70 270H835Q719 357 692 493Q692 494 692 496T691 499Q691 511 708 511H711Q720 511 723 510T729 506T732 497T735 481T743 456Q765 389 816 336T935 261Q944 258 944 250Q944 244 939 241T915 231T877 212Q836 186 806 152T761 85T740 35T732 4Q730 -6 727 -8T711 -11Q691 -11 691 0Q691 7 696 25Q728 151 835 230H70Q56 237 56 250'], - - // DOWNWARDS ARROW - 0x2193: [694,194,500,17,483,'473 86Q483 86 483 67Q483 63 483 61T483 56T481 53T480 50T478 48T474 47T470 46T464 44Q428 35 391 14T316 -55T264 -168Q264 -170 263 -173T262 -180T261 -184Q259 -194 251 -194Q242 -194 238 -176T221 -121T180 -49Q169 -34 155 -21T125 2T95 20T67 33T44 42T27 47L21 49Q17 53 17 67Q17 87 28 87Q33 87 42 84Q158 52 223 -45L230 -55V312Q230 391 230 482T229 591Q229 662 231 676T243 693Q244 694 251 694Q264 692 270 679V-55L277 -45Q307 1 353 33T430 76T473 86'], - - // LEFT RIGHT ARROW - 0x2194: [511,11,1000,55,944,'263 479Q267 501 271 506T288 511Q308 511 308 500Q308 493 303 475Q293 438 278 406T246 352T215 315T185 287T165 270H835Q729 349 696 475Q691 493 691 500Q691 511 711 511Q720 511 723 510T729 506T732 497T735 481T743 456Q765 389 816 336T935 261Q944 258 944 250Q944 244 939 241T915 231T877 212Q836 186 806 152T761 85T740 35T732 4Q730 -6 727 -8T711 -11Q691 -11 691 0Q691 7 696 25Q728 151 835 230H165Q167 228 182 216T211 189T244 152T277 96T303 25Q308 7 308 0Q308 -11 288 -11Q281 -11 278 -11T272 -7T267 2T263 21Q245 94 195 151T73 236Q58 242 55 247Q55 254 59 257T73 264Q144 292 194 349T263 479'], - - // UP DOWN ARROW - 0x2195: [772,272,500,17,483,'27 492Q17 492 17 511Q17 515 17 517T17 522T19 525T20 528T22 530T26 531T30 532T36 534Q80 545 120 572T180 627Q210 664 223 701T238 755T250 772T261 762Q261 757 264 741T282 691T319 628Q352 589 390 566T454 536L479 529Q483 525 483 511Q483 491 472 491Q467 491 458 494Q342 526 277 623L270 633V-133L277 -123Q307 -77 353 -45T430 -2T473 8Q483 8 483 -11Q483 -15 483 -17T483 -22T481 -25T480 -28T478 -30T474 -31T470 -32T464 -34Q407 -49 364 -84T300 -157T270 -223T261 -262Q259 -272 250 -272Q242 -272 239 -255T223 -201T180 -127Q169 -112 155 -99T125 -76T95 -58T67 -45T44 -36T27 -31L21 -29Q17 -25 17 -11Q17 9 28 9Q33 9 42 6Q158 -26 223 -123L230 -133V633L223 623Q192 577 146 545T70 502T27 492'], - - // NORTH WEST ARROW - 0x2196: [720,195,1000,29,944,'204 662Q257 662 301 676T369 705T394 720Q398 720 407 711T417 697Q417 688 389 671T310 639T212 623Q176 623 153 628Q151 628 221 557T546 232Q942 -164 943 -168Q944 -170 944 -174Q944 -182 938 -188T924 -195Q922 -195 916 -193Q912 -191 517 204Q440 281 326 394T166 553L121 598Q126 589 126 541Q126 438 70 349Q59 332 52 332Q48 332 39 341T29 355Q29 358 38 372T57 407T77 464T86 545Q86 583 78 614T63 663T55 683Q55 693 65 693Q73 693 82 688Q136 662 204 662'], - - // NORTH EAST ARROW - 0x2197: [720,195,1000,55,971,'582 697Q582 701 591 710T605 720Q607 720 630 706T697 677T795 662Q830 662 863 670T914 686T934 694Q942 694 944 685Q944 680 936 663T921 615T913 545Q913 490 927 446T956 379T970 355Q970 351 961 342T947 332Q940 332 929 349Q874 436 874 541Q874 590 878 598L832 553Q787 508 673 395T482 204Q87 -191 83 -193Q77 -195 75 -195Q67 -195 61 -189T55 -174Q55 -170 56 -168Q58 -164 453 232Q707 487 777 557T847 628Q824 623 787 623Q689 623 599 679Q582 690 582 697'], - - // SOUTH EAST ARROW - 0x2198: [695,220,1000,55,970,'55 675Q55 683 60 689T75 695Q77 695 83 693Q87 691 482 296Q532 246 605 174T717 62T799 -20T859 -80T878 -97Q874 -93 874 -41Q874 64 929 151Q940 168 947 168Q951 168 960 159T970 145Q970 143 956 121T928 54T913 -45Q913 -83 920 -114T936 -163T944 -185Q942 -194 934 -194Q932 -194 914 -186T864 -170T795 -162Q743 -162 698 -176T630 -205T605 -220Q601 -220 592 -211T582 -197Q582 -187 611 -170T691 -138T787 -123Q824 -123 847 -128Q848 -128 778 -57T453 268Q58 664 56 668Q55 670 55 675'], - - // SOUTH WEST ARROW - 0x2199: [695,220,1000,29,944,'126 -41Q126 -92 121 -97Q121 -98 139 -80T200 -20T281 61T394 173T517 296Q909 690 916 693Q922 695 924 695Q932 695 938 689T944 674Q944 670 943 668Q942 664 546 268Q292 13 222 -57T153 -128Q176 -123 212 -123Q310 -123 400 -179Q417 -190 417 -197Q417 -201 408 -210T394 -220Q392 -220 369 -206T302 -177T204 -162Q131 -162 67 -194Q63 -195 59 -192T55 -183Q55 -180 62 -163T78 -115T86 -45Q86 10 72 54T44 120T29 145Q29 149 38 158T52 168Q59 168 70 151Q126 62 126 -41'], - - // RIGHTWARDS ARROW FROM BAR - 0x21A6: [511,11,1000,54,944,'95 155V109Q95 83 92 73T75 63Q61 63 58 74T54 130Q54 140 54 180T55 250Q55 421 57 425Q61 437 75 437Q88 437 91 428T95 393V345V270H835Q719 357 692 493Q692 494 692 496T691 499Q691 511 708 511H711Q720 511 723 510T729 506T732 497T735 481T743 456Q765 389 816 336T935 261Q944 258 944 250Q944 244 939 241T915 231T877 212Q836 186 806 152T761 85T740 35T732 4Q730 -6 727 -8T711 -11Q691 -11 691 0Q691 7 696 25Q728 151 835 230H95V155'], - - // LEFTWARDS ARROW WITH HOOK - 0x21A9: [511,11,1126,55,1070,'903 424T903 444T929 464Q976 464 1023 434T1070 347Q1070 316 1055 292T1016 256T971 237T929 230H165Q167 228 182 216T211 189T244 152T277 96T303 25Q308 7 308 0Q308 -11 288 -11Q281 -11 278 -11T272 -7T267 2T263 21Q245 94 195 151T73 236Q58 242 55 247Q55 254 59 257T73 264Q121 283 158 314T215 375T247 434T264 480L267 497Q269 503 270 505T275 509T288 511Q308 511 308 500Q308 493 303 475Q293 438 278 406T246 352T215 315T185 287T165 270H926Q929 270 941 271T960 275T978 280T998 290T1015 307Q1030 325 1030 347Q1030 355 1027 364T1014 387T983 411T929 424H928Q903 424 903 444'], - - // RIGHTWARDS ARROW WITH HOOK - 0x21AA: [511,11,1126,55,1070,'55 347Q55 380 72 404T113 441T159 458T197 464Q222 464 222 444Q222 429 204 426T157 417T110 387Q95 369 95 347Q95 339 98 330T111 307T142 283T196 270H961Q845 357 818 493Q818 494 818 496T817 499Q817 511 834 511H837Q846 511 849 510T855 506T858 497T861 481T869 456Q891 389 942 336T1061 261Q1070 258 1070 250Q1070 244 1065 241T1041 231T1003 212Q962 186 932 152T887 85T866 35T858 4Q856 -6 853 -8T837 -11Q817 -11 817 0Q817 7 822 25Q854 151 961 230H196Q149 230 102 260T55 347'], - - // LEFTWARDS HARPOON WITH BARB UPWARDS - 0x21BC: [511,-230,1000,55,944,'62 230Q56 236 55 244Q55 252 57 255T69 265Q114 292 151 326T208 391T243 448T265 491T273 509Q276 511 288 511Q304 511 306 505Q309 501 303 484Q293 456 279 430T251 383T223 344T196 313T173 291T156 276L148 270H929Q944 261 944 250T929 230H62'], - - // LEFTWARDS HARPOON WITH BARB DOWNWARDS - 0x21BD: [270,11,1000,55,944,'55 256Q56 264 62 270H929Q944 261 944 250T929 230H148Q149 229 165 215T196 185T231 145T270 87T303 16Q309 -1 306 -5Q304 -11 288 -11Q279 -11 276 -10T269 -4T264 10T253 36T231 75Q172 173 69 235Q59 242 57 245T55 256'], - - // RIGHTWARDS HARPOON WITH BARB UPWARDS - 0x21C0: [511,-230,1000,56,945,'691 500Q691 511 711 511Q720 511 723 510T730 504T735 490T746 464T768 425Q796 378 835 339T897 285T933 263Q941 258 942 256T944 245T937 230H70Q56 237 56 250T70 270H852Q802 308 762 364T707 455T691 500'], - - // RIGHTWARDS HARPOON WITH BARB DOWNWARDS - 0x21C1: [270,11,1000,56,944,'56 237T56 250T70 270H937Q944 263 944 256Q944 251 944 250T943 246T940 242T933 238Q794 153 734 7Q729 -7 726 -9T711 -11Q695 -11 693 -5Q690 -1 696 16Q721 84 763 139T852 230H70Q56 237 56 250'], - - // RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON - 0x21CC: [671,11,1000,55,945,'691 660Q691 671 711 671Q720 671 723 670T730 664T735 650T746 624T768 585Q797 538 836 499T897 445T933 423Q941 418 942 416T944 405T937 390H70Q56 397 56 410T70 430H852Q802 468 762 524T707 615T691 660ZM55 256Q56 264 62 270H929Q944 261 944 250T929 230H148Q149 229 165 215T196 185T231 145T270 87T303 16Q309 -1 306 -5Q304 -11 288 -11Q279 -11 276 -10T269 -4T264 10T253 36T231 75Q172 173 69 235Q59 242 57 245T55 256'], - - // LEFTWARDS DOUBLE ARROW - 0x21D0: [525,24,1000,56,945,'944 153Q944 140 929 133H318L328 123Q379 69 414 0Q419 -13 419 -17Q419 -24 399 -24Q388 -24 385 -23T377 -12Q332 77 253 144T72 237Q62 240 59 242T56 250T59 257T70 262T89 268T119 278T160 296Q303 366 377 512Q382 522 385 523T401 525Q419 524 419 515Q419 510 414 500Q379 431 328 377L318 367H929Q944 359 944 347Q944 336 930 328L602 327H274L264 319Q225 289 147 250Q148 249 165 241T210 217T264 181L274 173H930Q931 172 933 171T936 169T938 167T941 164T942 162T943 158T944 153'], - - // UPWARDS DOUBLE ARROW - 0x21D1: [694,194,611,31,579,'228 -179Q227 -180 226 -182T223 -186T221 -189T218 -192T214 -193T208 -194Q196 -194 189 -181L188 125V430L176 419Q122 369 59 338Q46 330 40 330Q38 330 31 337V350Q31 362 33 365T46 374Q60 381 77 390T128 426T190 484T247 567T292 677Q295 688 298 692Q302 694 305 694Q313 694 318 677Q334 619 363 568T420 485T481 427T532 391T564 374Q575 368 577 365T579 350V337Q572 330 570 330Q564 330 551 338Q487 370 435 419L423 430L422 125V-181Q409 -194 401 -194Q397 -194 394 -193T388 -189T385 -184T382 -180V-177V475L373 487Q331 541 305 602Q304 601 300 591T290 571T278 548T260 519T238 488L229 476L228 148V-179'], - - // RIGHTWARDS DOUBLE ARROW - 0x21D2: [525,24,1000,56,944,'580 514Q580 525 596 525Q601 525 604 525T609 525T613 524T615 523T617 520T619 517T622 512Q659 438 720 381T831 300T927 263Q944 258 944 250T935 239T898 228T840 204Q696 134 622 -12Q618 -21 615 -22T600 -24Q580 -24 580 -17Q580 -13 585 0Q620 69 671 123L681 133H70Q56 140 56 153Q56 168 72 173H725L735 181Q774 211 852 250Q851 251 834 259T789 283T735 319L725 327H72Q56 332 56 347Q56 360 70 367H681L671 377Q638 412 609 458T580 514'], - - // DOWNWARDS DOUBLE ARROW - 0x21D3: [694,194,611,31,579,'401 694Q412 694 422 681V375L423 70L435 81Q487 130 551 162Q564 170 570 170Q572 170 579 163V150Q579 138 577 135T564 126Q541 114 518 99T453 48T374 -46T318 -177Q313 -194 305 -194T293 -178T272 -119T225 -31Q158 70 46 126Q35 132 33 135T31 150V163Q38 170 40 170Q46 170 59 162Q122 131 176 81L188 70V375L189 681Q199 694 208 694Q219 694 228 680V352L229 25L238 12Q279 -42 305 -102Q344 -23 373 13L382 25V678Q387 692 401 694'], - - // LEFT RIGHT DOUBLE ARROW - 0x21D4: [526,25,1000,33,966,'308 524Q318 526 323 526Q340 526 340 514Q340 507 336 499Q326 476 314 454T292 417T274 391T260 374L255 368Q255 367 500 367Q744 367 744 368L739 374Q734 379 726 390T707 416T685 453T663 499Q658 511 658 515Q658 525 680 525Q687 524 690 523T695 519T701 507Q766 359 902 287Q921 276 939 269T961 259T966 250Q966 246 965 244T960 240T949 236T930 228T902 213Q763 137 701 -7Q697 -16 695 -19T690 -23T680 -25Q658 -25 658 -15Q658 -11 663 1Q673 24 685 46T707 83T725 109T739 126L744 132Q744 133 500 133Q255 133 255 132L260 126Q265 121 273 110T292 84T314 47T336 1Q341 -11 341 -15Q341 -25 319 -25Q312 -24 309 -23T304 -19T298 -7Q233 141 97 213Q83 221 70 227T51 235T41 239T35 243T34 250T35 256T40 261T51 265T70 273T97 287Q235 363 299 509Q305 522 308 524ZM792 319L783 327H216Q183 294 120 256L110 250L120 244Q173 212 207 181L216 173H783L792 181Q826 212 879 244L889 250L879 256Q826 288 792 319'], - - // UP DOWN DOUBLE ARROW - 0x21D5: [772,272,611,31,579,'290 755Q298 772 305 772T318 757T343 706T393 633Q431 588 473 558T545 515T579 497V484Q579 464 570 464Q564 464 550 470Q485 497 423 550L422 400V100L423 -50Q485 3 550 30Q565 36 570 36Q579 36 579 16V3Q575 -1 549 -12T480 -53T393 -132Q361 -172 342 -208T318 -258T305 -272T293 -258T268 -208T217 -132Q170 -80 128 -51T61 -12T31 3V16Q31 36 40 36Q46 36 61 30Q86 19 109 6T146 -18T173 -38T188 -50V550Q186 549 173 539T147 519T110 495T61 470Q46 464 40 464Q31 464 31 484V497Q34 500 63 513T135 557T217 633Q267 692 290 755ZM374 598Q363 610 351 625T332 651T316 676T305 695L294 676Q282 657 267 636T236 598L228 589V-89L236 -98Q247 -110 259 -125T278 -151T294 -176T305 -195L316 -176Q328 -157 343 -136T374 -98L382 -89V589L374 598'], - - // FOR ALL - 0x2200: [694,22,556,0,556,'0 673Q0 684 7 689T20 694Q32 694 38 680T82 567L126 451H430L473 566Q483 593 494 622T512 668T519 685Q524 694 538 694Q556 692 556 674Q556 670 426 329T293 -15Q288 -22 278 -22T263 -15Q260 -11 131 328T0 673ZM414 410Q414 411 278 411T142 410L278 55L414 410'], - - // PARTIAL DIFFERENTIAL - 0x2202: [715,22,531,42,567,'202 508Q179 508 169 520T158 547Q158 557 164 577T185 624T230 675T301 710L333 715H345Q378 715 384 714Q447 703 489 661T549 568T566 457Q566 362 519 240T402 53Q321 -22 223 -22Q123 -22 73 56Q42 102 42 148V159Q42 276 129 370T322 465Q383 465 414 434T455 367L458 378Q478 461 478 515Q478 603 437 639T344 676Q266 676 223 612Q264 606 264 572Q264 547 246 528T202 508ZM430 306Q430 372 401 400T333 428Q270 428 222 382Q197 354 183 323T150 221Q132 149 132 116Q132 21 232 21Q244 21 250 22Q327 35 374 112Q389 137 409 196T430 306'], - - // THERE EXISTS - 0x2203: [694,0,556,56,500,'56 661T56 674T70 694H487Q497 686 500 679V15Q497 10 487 1L279 0H70Q56 7 56 20T70 40H460V327H84Q70 334 70 347T84 367H460V654H70Q56 661 56 674'], - - // EMPTY SET - 0x2205: [772,78,500,39,460,'331 696Q335 708 339 722T345 744T350 759T357 769T367 772Q374 772 381 767T388 754Q388 746 377 712L366 673L378 661Q460 575 460 344Q460 281 456 234T432 126T373 27Q319 -22 250 -22Q214 -22 180 -7Q168 -3 168 -4L159 -33Q148 -71 142 -75Q138 -78 132 -78Q124 -78 118 -72T111 -60Q111 -52 122 -18L133 21L125 29Q39 111 39 344Q39 596 137 675Q187 716 251 716Q265 716 278 714T296 710T315 703T331 696ZM276 676Q264 679 246 679Q196 679 159 631Q134 597 128 536T121 356Q121 234 127 174T151 80L234 366Q253 430 275 506T308 618L318 654Q318 656 294 669L276 676ZM181 42Q207 16 250 16Q291 16 324 47Q354 78 366 136T378 356Q378 470 372 528T349 616L348 613Q348 611 264 326L181 42'], - - // NABLA - 0x2207: [683,33,833,46,786,'46 676Q46 679 51 683H781Q786 679 786 676Q786 674 617 326T444 -26Q439 -33 416 -33T388 -26Q385 -22 216 326T46 676ZM697 596Q697 597 445 597T193 596Q195 591 319 336T445 80L697 596'], - - // ELEMENT OF - 0x2208: [541,41,667,84,583,'84 250Q84 372 166 450T360 539Q361 539 377 539T419 540T469 540H568Q583 532 583 520Q583 511 570 501L466 500Q355 499 329 494Q280 482 242 458T183 409T147 354T129 306T124 272V270H568Q583 262 583 250T568 230H124V228Q124 207 134 177T167 112T231 48T328 7Q355 1 466 0H570Q583 -10 583 -20Q583 -32 568 -40H471Q464 -40 446 -40T417 -41Q262 -41 172 45Q84 127 84 250'], - - // stix-negated (vert) set membership, variant - 0x2209: [716,215,667,84,584,'196 25Q84 109 84 250Q84 372 166 450T360 539Q361 539 375 539T413 540T460 540L547 707Q550 716 563 716Q570 716 575 712T581 703T583 696T505 540H568Q583 532 583 520Q583 511 570 501L484 500L366 270H568Q583 262 583 250T568 230H346L247 38Q284 16 328 7Q355 1 466 0H570Q583 -10 583 -20Q583 -32 568 -40H471Q464 -40 447 -40T419 -41Q304 -41 228 3Q117 -211 115 -212Q111 -215 104 -215T92 -212T86 -204T84 -197Q84 -190 89 -183L196 25ZM214 61L301 230H124V228Q124 196 147 147T214 61ZM321 270L440 500Q353 499 329 494Q280 482 242 458T183 409T147 354T129 306T124 272V270H321'], - - // CONTAINS AS MEMBER - 0x220B: [541,40,667,83,582,'83 520Q83 532 98 540H195Q202 540 220 540T249 541Q404 541 494 455Q582 374 582 250Q582 165 539 99T434 0T304 -39Q297 -40 195 -40H98Q83 -32 83 -20Q83 -10 96 0H200Q311 1 337 6Q369 14 401 28Q422 39 445 55Q484 85 508 127T537 191T542 228V230H98Q84 237 84 250T98 270H542V272Q542 280 539 295T527 336T497 391T445 445Q422 461 401 472Q386 479 374 483T347 491T325 495T298 498T273 499T239 500T200 500L96 501Q83 511 83 520'], - - // MINUS SIGN - 0x2212: [270,-230,778,84,694,'84 237T84 250T98 270H679Q694 262 694 250T679 230H98Q84 237 84 250'], - - // MINUS-OR-PLUS SIGN - 0x2213: [500,166,778,56,722,'56 467T56 480T70 500H707Q722 492 722 480T707 460H409V187H707Q722 179 722 167Q722 154 707 147H409V0V-93Q409 -144 406 -155T389 -166Q376 -166 372 -155T368 -105Q368 -96 368 -62T369 -2V147H70Q56 154 56 167T70 187H369V460H70Q56 467 56 480'], - - // DIVISION SLASH - 0x2215: [750,250,500,56,444,'423 750Q432 750 438 744T444 730Q444 725 271 248T92 -240Q85 -250 75 -250Q68 -250 62 -245T56 -231Q56 -221 230 257T407 740Q411 750 423 750'], - - // SET MINUS - 0x2216: [750,250,500,56,444,'56 731Q56 740 62 745T75 750Q85 750 92 740Q96 733 270 255T444 -231Q444 -239 438 -244T424 -250Q414 -250 407 -240Q404 -236 230 242T56 731'], - - // ASTERISK OPERATOR - 0x2217: [465,-35,500,64,435,'229 286Q216 420 216 436Q216 454 240 464Q241 464 245 464T251 465Q263 464 273 456T283 436Q283 419 277 356T270 286L328 328Q384 369 389 372T399 375Q412 375 423 365T435 338Q435 325 425 315Q420 312 357 282T289 250L355 219L425 184Q434 175 434 161Q434 146 425 136T401 125Q393 125 383 131T328 171L270 213Q283 79 283 63Q283 53 276 44T250 35Q231 35 224 44T216 63Q216 80 222 143T229 213L171 171Q115 130 110 127Q106 124 100 124Q87 124 76 134T64 161Q64 166 64 169T67 175T72 181T81 188T94 195T113 204T138 215T170 230T210 250L74 315Q65 324 65 338Q65 353 74 363T98 374Q106 374 116 368T171 328L229 286'], - - // RING OPERATOR - 0x2218: [444,-55,500,55,444,'55 251Q55 328 112 386T249 444T386 388T444 249Q444 171 388 113T250 55Q170 55 113 112T55 251ZM245 403Q188 403 142 361T96 250Q96 183 141 140T250 96Q284 96 313 109T354 135T375 160Q403 197 403 250Q403 313 360 358T245 403'], - - // BULLET OPERATOR - 0x2219: [444,-55,500,55,444,'55 251Q55 328 112 386T249 444T386 388T444 249Q444 171 388 113T250 55Q170 55 113 112T55 251'], - - // SQUARE ROOT - 0x221A: [800,200,833,71,853,'95 178Q89 178 81 186T72 200T103 230T169 280T207 309Q209 311 212 311H213Q219 311 227 294T281 177Q300 134 312 108L397 -77Q398 -77 501 136T707 565T814 786Q820 800 834 800Q841 800 846 794T853 782V776L620 293L385 -193Q381 -200 366 -200Q357 -200 354 -197Q352 -195 256 15L160 225L144 214Q129 202 113 190T95 178'], - - // PROPORTIONAL TO - 0x221D: [442,11,778,56,722,'56 124T56 216T107 375T238 442Q260 442 280 438T319 425T352 407T382 385T406 361T427 336T442 315T455 297T462 285L469 297Q555 442 679 442Q687 442 722 437V398H718Q710 400 694 400Q657 400 623 383T567 343T527 294T503 253T495 235Q495 231 520 192T554 143Q625 44 696 44Q717 44 719 46H722V-5Q695 -11 678 -11Q552 -11 457 141Q455 145 454 146L447 134Q362 -11 235 -11Q157 -11 107 56ZM93 213Q93 143 126 87T220 31Q258 31 292 48T349 88T389 137T413 178T421 196Q421 200 396 239T362 288Q322 345 288 366T213 387Q163 387 128 337T93 213'], - - // INFINITY - 0x221E: [442,11,1000,55,944,'55 217Q55 305 111 373T254 442Q342 442 419 381Q457 350 493 303L507 284L514 294Q618 442 747 442Q833 442 888 374T944 214Q944 128 889 59T743 -11Q657 -11 580 50Q542 81 506 128L492 147L485 137Q381 -11 252 -11Q166 -11 111 57T55 217ZM907 217Q907 285 869 341T761 397Q740 397 720 392T682 378T648 359T619 335T594 310T574 285T559 263T548 246L543 238L574 198Q605 158 622 138T664 94T714 61T765 51Q827 51 867 100T907 217ZM92 214Q92 145 131 89T239 33Q357 33 456 193L425 233Q364 312 334 337Q285 380 233 380Q171 380 132 331T92 214'], - - // ANGLE - 0x2220: [694,0,722,55,666,'71 0L68 2Q65 3 63 5T58 11T55 20Q55 22 57 28Q67 43 346 361Q397 420 474 508Q595 648 616 671T647 694T661 688T666 674Q666 668 663 663Q662 662 627 622T524 503T390 350L120 41L386 40H653Q666 30 666 20Q666 8 651 0H71'], - - // DIVIDES - 0x2223: [750,249,278,119,159,'139 -249H137Q125 -249 119 -235V251L120 737Q130 750 139 750Q152 750 159 735V-235Q151 -249 141 -249H139'], - - // PARALLEL TO - 0x2225: [750,250,500,132,368,'133 736Q138 750 153 750Q164 750 170 739Q172 735 172 250T170 -239Q164 -250 152 -250Q144 -250 138 -244L137 -243Q133 -241 133 -179T132 250Q132 731 133 736ZM329 739Q334 750 346 750Q353 750 361 744L362 743Q366 741 366 679T367 250T367 -178T362 -243L361 -244Q355 -250 347 -250Q335 -250 329 -239Q327 -235 327 250T329 739'], - - // LOGICAL AND - 0x2227: [598,22,667,55,611,'318 591Q325 598 333 598Q344 598 348 591Q349 590 414 445T545 151T611 -4Q609 -22 591 -22Q588 -22 586 -21T581 -20T577 -17T575 -13T572 -9T570 -4L333 528L96 -4Q87 -20 80 -21Q78 -22 75 -22Q57 -22 55 -4Q55 2 120 150T251 444T318 591'], - - // LOGICAL OR - 0x2228: [598,22,667,55,611,'55 580Q56 587 61 592T75 598Q86 598 96 580L333 48L570 580Q579 596 586 597Q588 598 591 598Q609 598 611 580Q611 574 546 426T415 132T348 -15Q343 -22 333 -22T318 -15Q317 -14 252 131T121 425T55 580'], - - // stix-intersection, serifs - 0x2229: [598,22,667,55,611,'88 -21T75 -21T55 -7V200Q55 231 55 280Q56 414 60 428Q61 430 61 431Q77 500 152 549T332 598Q443 598 522 544T610 405Q611 399 611 194V-7Q604 -22 591 -22Q582 -22 572 -9L570 405Q563 433 556 449T529 485Q498 519 445 538T334 558Q251 558 179 518T96 401Q95 396 95 193V-7Q88 -21 75 -21'], - - // stix-union, serifs - 0x222A: [598,22,667,55,611,'591 598H592Q604 598 611 583V376Q611 345 611 296Q610 162 606 148Q605 146 605 145Q586 68 507 23T333 -22Q268 -22 209 -1T106 66T56 173Q55 180 55 384L56 585Q66 598 75 598Q85 598 95 585V378L96 172L98 162Q112 95 181 57T332 18Q415 18 487 58T570 175Q571 180 571 383V583Q579 598 591 598'], - - // INTEGRAL - 0x222B: [716,216,417,55,472,'151 -112Q151 -150 106 -161Q106 -165 114 -172T134 -179Q155 -179 170 -146Q181 -120 188 -64T206 101T232 310Q256 472 277 567Q308 716 392 716Q434 716 453 681T472 613Q472 590 458 577T424 564Q404 564 390 578T376 612Q376 650 421 661Q421 663 418 667T407 675T393 679Q387 679 380 675Q360 665 350 619T326 438Q302 190 253 -57Q235 -147 201 -186Q174 -213 138 -216Q93 -216 74 -181T55 -113Q55 -91 69 -78T103 -64Q123 -64 137 -78T151 -112'], - - // TILDE OPERATOR - 0x223C: [367,-133,778,55,722,'55 166Q55 241 101 304T222 367Q260 367 296 349T362 304T421 252T484 208T554 189Q616 189 655 236T694 338Q694 350 698 358T708 367Q722 367 722 334Q722 260 677 197T562 134H554Q517 134 481 152T414 196T355 248T292 293T223 311Q179 311 145 286Q109 257 96 218T80 156T69 133Q55 133 55 166'], - - // WREATH PRODUCT - 0x2240: [583,83,278,55,222,'55 569Q55 583 83 583Q122 583 151 565T194 519T215 464T222 411Q222 360 194 304T139 193T111 89Q111 38 134 -7T195 -55Q222 -57 222 -69Q222 -83 189 -83Q130 -83 93 -33T55 90Q55 130 72 174T110 252T148 328T166 411Q166 462 144 507T83 555Q55 556 55 569'], - - // ASYMPTOTICALLY EQUAL TO - 0x2243: [464,-36,778,55,722,'55 283Q55 356 103 409T217 463Q262 463 297 447T395 382Q431 355 446 344T493 320T554 307H558Q613 307 652 344T694 433Q694 464 708 464T722 432Q722 356 673 304T564 251H554Q510 251 465 275T387 329T310 382T223 407H219Q164 407 122 367Q91 333 85 295T76 253T69 250Q55 250 55 283ZM56 56Q56 71 72 76H706Q722 70 722 56Q722 44 707 36H70Q56 43 56 56'], - - // APPROXIMATELY EQUAL TO - 0x2245: [589,-22,1000,55,722,'55 388Q55 463 101 526T222 589Q260 589 296 571T362 526T421 474T484 430T554 411Q616 411 655 458T694 560Q694 572 698 580T708 589Q722 589 722 556Q722 482 677 419T562 356H554Q517 356 481 374T414 418T355 471T292 515T223 533Q179 533 145 508Q109 479 96 440T80 378T69 355Q55 355 55 388ZM56 236Q56 249 70 256H707Q722 248 722 236Q722 225 708 217L390 216H72Q56 221 56 236ZM56 42Q56 57 72 62H708Q722 52 722 42Q722 30 707 22H70Q56 29 56 42'], - - // ALMOST EQUAL TO - 0x2248: [483,-55,778,55,722,'55 319Q55 360 72 393T114 444T163 472T205 482Q207 482 213 482T223 483Q262 483 296 468T393 413L443 381Q502 346 553 346Q609 346 649 375T694 454Q694 465 698 474T708 483Q722 483 722 452Q722 386 675 338T555 289Q514 289 468 310T388 357T308 404T224 426Q164 426 125 393T83 318Q81 289 69 289Q55 289 55 319ZM55 85Q55 126 72 159T114 210T163 238T205 248Q207 248 213 248T223 249Q262 249 296 234T393 179L443 147Q502 112 553 112Q609 112 649 141T694 220Q694 249 708 249T722 217Q722 153 675 104T555 55Q514 55 468 76T388 123T308 170T224 192Q164 192 125 159T83 84Q80 55 69 55Q55 55 55 85'], - - // EQUIVALENT TO - 0x224D: [484,-16,778,55,722,'55 464Q55 471 60 477T74 484Q80 484 108 464T172 420T268 376T389 356Q436 356 483 368T566 399T630 436T675 467T695 482Q701 484 703 484Q711 484 716 478T722 464Q722 454 707 442Q550 316 389 316Q338 316 286 329T195 362T124 402T76 437T57 456Q55 462 55 464ZM57 45Q66 58 109 88T230 151T381 183Q438 183 494 168T587 135T658 94T703 61T720 45Q722 39 722 36Q722 28 717 22T703 16Q697 16 669 36T606 80T510 124T389 144Q341 144 294 132T211 101T147 64T102 33T82 18Q76 16 74 16Q66 16 61 22T55 36Q55 39 57 45'], - - // APPROACHES THE LIMIT - 0x2250: [670,-133,778,56,722,'56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153ZM329 610Q329 634 346 652T389 670Q413 670 431 654T450 611Q450 586 433 568T390 550T347 567T329 610'], - - // stix-not (vert) equals - 0x2260: [716,215,778,56,722,'166 -215T159 -215T147 -212T141 -204T139 -197Q139 -190 144 -183L306 133H70Q56 140 56 153Q56 168 72 173H327L406 327H72Q56 332 56 347Q56 360 70 367H426Q597 702 602 707Q605 716 618 716Q625 716 630 712T636 703T638 696Q638 692 471 367H707Q722 359 722 347Q722 336 708 328L451 327L371 173H708Q722 163 722 153Q722 140 707 133H351Q175 -210 170 -212Q166 -215 159 -215'], - - // IDENTICAL TO - 0x2261: [464,-36,778,56,722,'56 444Q56 457 70 464H707Q722 456 722 444Q722 430 706 424H72Q56 429 56 444ZM56 237T56 250T70 270H707Q722 262 722 250T707 230H70Q56 237 56 250ZM56 56Q56 71 72 76H706Q722 70 722 56Q722 44 707 36H70Q56 43 56 56'], - - // LESS-THAN OR EQUAL TO - 0x2264: [636,138,778,83,694,'674 636Q682 636 688 630T694 615T687 601Q686 600 417 472L151 346L399 228Q687 92 691 87Q694 81 694 76Q694 58 676 56H670L382 192Q92 329 90 331Q83 336 83 348Q84 359 96 365Q104 369 382 500T665 634Q669 636 674 636ZM84 -118Q84 -108 99 -98H678Q694 -104 694 -118Q694 -130 679 -138H98Q84 -131 84 -118'], - - // GREATER-THAN OR EQUAL TO - 0x2265: [636,138,778,82,694,'83 616Q83 624 89 630T99 636Q107 636 253 568T543 431T687 361Q694 356 694 346T687 331Q685 329 395 192L107 56H101Q83 58 83 76Q83 77 83 79Q82 86 98 95Q117 105 248 167Q326 204 378 228L626 346L360 472Q291 505 200 548Q112 589 98 597T83 616ZM84 -118Q84 -108 99 -98H678Q694 -104 694 -118Q694 -130 679 -138H98Q84 -131 84 -118'], - - // MUCH LESS-THAN - 0x226A: [568,67,1000,56,944,'639 -48Q639 -54 634 -60T619 -67H618Q612 -67 536 -26Q430 33 329 88Q61 235 59 239Q56 243 56 250T59 261Q62 266 336 415T615 567L619 568Q622 567 625 567Q639 562 639 548Q639 540 633 534Q632 532 374 391L117 250L374 109Q632 -32 633 -34Q639 -40 639 -48ZM944 -48Q944 -54 939 -60T924 -67H923Q917 -67 841 -26Q735 33 634 88Q366 235 364 239Q361 243 361 250T364 261Q367 266 641 415T920 567L924 568Q927 567 930 567Q944 562 944 548Q944 540 938 534Q937 532 679 391L422 250L679 109Q937 -32 938 -34Q944 -40 944 -48'], - - // MUCH GREATER-THAN - 0x226B: [567,67,1000,55,944,'55 539T55 547T60 561T74 567Q81 567 207 498Q297 449 365 412Q633 265 636 261Q639 255 639 250Q639 241 626 232Q614 224 365 88Q83 -65 79 -66Q76 -67 73 -67Q65 -67 60 -61T55 -47Q55 -39 61 -33Q62 -33 95 -15T193 39T320 109L321 110H322L323 111H324L325 112L326 113H327L329 114H330L331 115H332L333 116L334 117H335L336 118H337L338 119H339L340 120L341 121H342L343 122H344L345 123H346L347 124L348 125H349L351 126H352L353 127H354L355 128L356 129H357L358 130H359L360 131H361L362 132L363 133H364L365 134H366L367 135H368L369 136H370L371 137L372 138H373L374 139H375L376 140L378 141L576 251Q63 530 62 533Q55 539 55 547ZM360 539T360 547T365 561T379 567Q386 567 512 498Q602 449 670 412Q938 265 941 261Q944 255 944 250Q944 241 931 232Q919 224 670 88Q388 -65 384 -66Q381 -67 378 -67Q370 -67 365 -61T360 -47Q360 -39 366 -33Q367 -33 400 -15T498 39T625 109L626 110H627L628 111H629L630 112L631 113H632L634 114H635L636 115H637L638 116L639 117H640L641 118H642L643 119H644L645 120L646 121H647L648 122H649L650 123H651L652 124L653 125H654L656 126H657L658 127H659L660 128L661 129H662L663 130H664L665 131H666L667 132L668 133H669L670 134H671L672 135H673L674 136H675L676 137L677 138H678L679 139H680L681 140L683 141L881 251Q368 530 367 533Q360 539 360 547'], - - // PRECEDES - 0x227A: [539,41,778,84,694,'84 249Q84 262 91 266T117 270Q120 270 126 270T137 269Q388 273 512 333T653 512Q657 539 676 539Q685 538 689 532T694 520V515Q689 469 672 431T626 366T569 320T500 286T435 265T373 249Q379 248 404 242T440 233T477 221T533 199Q681 124 694 -17Q694 -41 674 -41Q658 -41 653 -17Q646 41 613 84T533 154T418 197T284 220T137 229H114Q104 229 98 230T88 235T84 249'], - - // SUCCEEDS - 0x227B: [539,41,778,83,694,'84 517Q84 539 102 539Q115 539 119 529T125 503T137 459T171 404Q277 275 640 269H661Q694 269 694 249T661 229H640Q526 227 439 214T283 173T173 98T124 -17Q118 -41 103 -41Q83 -41 83 -17Q88 29 105 67T151 132T208 178T277 212T342 233T404 249Q401 250 380 254T345 263T302 276T245 299Q125 358 92 468Q84 502 84 517'], - - // SUBSET OF - 0x2282: [541,41,778,84,694,'84 250Q84 372 166 450T360 539Q361 539 370 539T395 539T430 540T475 540T524 540H679Q694 532 694 520Q694 511 681 501L522 500H470H441Q366 500 338 496T266 472Q244 461 224 446T179 404T139 337T124 250V245Q124 157 185 89Q244 25 328 7Q348 2 366 2T522 0H681Q694 -10 694 -20Q694 -32 679 -40H526Q510 -40 480 -40T434 -41Q350 -41 289 -25T172 45Q84 127 84 250'], - - // SUPERSET OF - 0x2283: [541,40,778,83,693,'83 520Q83 532 98 540H251Q267 540 297 540T343 541Q427 541 488 525T605 455Q693 374 693 250Q693 165 650 99T545 0T415 -39Q407 -40 251 -40H98Q83 -32 83 -20Q83 -10 96 0H255H308H337Q412 0 439 4T512 28Q533 39 553 54T599 96T639 163T654 250Q654 341 592 411Q557 449 512 472Q468 491 439 495T335 500H306H255L96 501Q83 511 83 520'], - - // SUBSET OF OR EQUAL TO - 0x2286: [637,138,778,84,694,'84 346Q84 468 166 546T360 635Q361 635 370 635T395 635T430 636T475 636T524 636H679Q694 628 694 616Q694 607 681 597L522 596H470H441Q366 596 338 592T266 568Q244 557 224 542T179 500T139 433T124 346V341Q124 253 185 185Q244 121 328 103Q348 98 366 98T522 96H681Q694 86 694 76Q694 64 679 56H526Q510 56 480 56T434 55Q350 55 289 71T172 141Q84 223 84 346ZM104 -131T104 -118T118 -98H679Q694 -106 694 -118T679 -138H118Q104 -131 104 -118'], - - // SUPERSET OF OR EQUAL TO - 0x2287: [637,138,778,83,693,'83 616Q83 628 98 636H251Q267 636 297 636T343 637Q427 637 488 621T605 551Q693 470 693 346Q693 261 650 195T545 96T415 57Q407 56 251 56H98Q83 64 83 76Q83 86 96 96H255H308H337Q412 96 439 100T512 124Q533 135 553 150T599 192T639 259T654 346Q654 437 592 507Q557 545 512 568Q468 587 439 591T335 596H306H255L96 597Q83 607 83 616ZM84 -131T84 -118T98 -98H659Q674 -106 674 -118T659 -138H98Q84 -131 84 -118'], - - // MULTISET UNION - 0x228E: [598,22,667,55,611,'591 598H592Q604 598 611 583V376Q611 345 611 296Q610 162 606 148Q605 146 605 145Q586 68 507 23T333 -22Q268 -22 209 -1T106 66T56 173Q55 180 55 384L56 585Q66 598 75 598Q85 598 95 585V378L96 172L98 162Q112 95 181 57T332 18Q415 18 487 58T570 175Q571 180 571 383V583Q579 598 591 598ZM313 406Q313 417 313 435T312 459Q312 483 316 493T333 503T349 494T353 461V406V325H515Q516 325 519 323T527 316T531 305T527 294T520 287T515 285H353V204V152Q353 127 350 117T333 107T316 117T312 152Q312 158 312 175T313 204V285H151Q150 285 147 287T139 294T135 305T139 316T146 323T151 325H313V406'], - - // SQUARE IMAGE OF OR EQUAL TO - 0x2291: [636,138,778,84,714,'94 620Q98 632 110 636H699Q714 628 714 616T699 596H134V96H698Q714 90 714 76Q714 64 699 56H109Q104 59 95 69L94 344V620ZM84 -118Q84 -103 100 -98H698Q714 -104 714 -118Q714 -130 699 -138H98Q84 -131 84 -118'], - - // SQUARE ORIGINAL OF OR EQUAL TO - 0x2292: [636,138,778,64,694,'64 603T64 616T78 636H668Q675 633 683 623V69Q675 59 668 56H78Q64 63 64 76Q64 91 80 96H643V596H78Q64 603 64 616ZM64 -118Q64 -108 79 -98H678Q694 -104 694 -118Q694 -130 679 -138H78Q64 -131 64 -118'], - - // stix-square intersection, serifs - 0x2293: [598,0,667,61,605,'83 0Q79 0 76 1T71 3T67 6T65 9T63 13T61 16V301L62 585Q70 595 76 598H592Q602 590 605 583V15Q598 2 587 0Q583 0 580 1T575 3T571 6T569 9T567 13T565 16V558H101V15Q94 2 83 0'], - - // stix-square union, serifs - 0x2294: [598,0,667,61,605,'77 0Q65 4 61 16V301L62 585Q72 598 81 598Q94 598 101 583V40H565V583Q573 598 585 598Q598 598 605 583V15Q602 10 592 1L335 0H77'], - - // stix-circled plus (with rim) - 0x2295: [583,83,778,56,722,'56 250Q56 394 156 488T384 583Q530 583 626 485T722 250Q722 110 625 14T390 -83Q249 -83 153 14T56 250ZM364 542Q308 539 251 509T148 418T96 278V270H369V542H364ZM681 278Q675 338 650 386T592 462T522 509T458 535T412 542H409V270H681V278ZM96 222Q104 150 139 95T219 12T302 -29T366 -42H369V230H96V222ZM681 222V230H409V-42H412Q429 -42 456 -36T521 -10T590 37T649 113T681 222'], - - // CIRCLED MINUS - 0x2296: [583,83,778,56,722,'56 250Q56 394 156 488T384 583Q530 583 626 485T722 250Q722 110 625 14T390 -83Q249 -83 153 14T56 250ZM681 278Q669 385 591 463T381 542Q283 542 196 471T96 278V270H681V278ZM275 -42T388 -42T585 32T681 222V230H96V222Q108 107 191 33'], - - // stix-circled times (with rim) - 0x2297: [583,83,778,56,722,'56 250Q56 394 156 488T384 583Q530 583 626 485T722 250Q722 110 625 14T390 -83Q249 -83 153 14T56 250ZM582 471Q531 510 496 523Q446 542 381 542Q324 542 272 519T196 471L389 278L485 375L582 471ZM167 442Q95 362 95 250Q95 137 167 58L359 250L167 442ZM610 58Q682 138 682 250Q682 363 610 442L418 250L610 58ZM196 29Q209 16 230 2T295 -27T388 -42Q409 -42 429 -40T465 -33T496 -23T522 -11T544 1T561 13T574 22T582 29L388 222L196 29'], - - // CIRCLED DIVISION SLASH - 0x2298: [583,83,778,56,722,'56 250Q56 394 156 488T384 583Q530 583 626 485T722 250Q722 110 625 14T390 -83Q249 -83 153 14T56 250ZM582 471Q581 472 571 480T556 491T539 502T517 514T491 525T460 534T424 539T381 542Q272 542 184 460T95 251Q95 198 113 150T149 80L167 58L582 471ZM388 -42Q513 -42 597 44T682 250Q682 363 610 442L196 29Q209 16 229 2T295 -27T388 -42'], - - // CIRCLED DOT OPERATOR - 0x2299: [583,83,778,56,722,'56 250Q56 394 156 488T384 583Q530 583 626 485T722 250Q722 110 625 14T390 -83Q249 -83 153 14T56 250ZM682 250Q682 322 649 387T546 497T381 542Q272 542 184 459T95 250Q95 132 178 45T389 -42Q515 -42 598 45T682 250ZM311 250Q311 285 332 304T375 328Q376 328 382 328T392 329Q424 326 445 305T466 250Q466 217 445 195T389 172Q354 172 333 195T311 250'], - - // RIGHT TACK - 0x22A2: [695,0,611,55,555,'55 678Q55 679 56 681T58 684T61 688T65 691T70 693T77 694Q88 692 95 679V367H540Q555 359 555 347Q555 334 540 327H95V15Q88 2 77 0Q73 0 70 1T65 3T61 6T59 9T57 13T55 16V678'], - - // LEFT TACK - 0x22A3: [695,0,611,54,555,'515 678Q515 679 516 681T518 684T521 688T525 691T530 693T537 694Q548 692 555 679V15Q548 2 537 0Q533 0 530 1T525 3T521 6T519 9T517 13T515 16V327H71Q70 327 67 329T59 336T55 347T59 358T66 365T71 367H515V678'], - - // DOWN TACK - 0x22A4: [668,0,778,55,723,'55 642T55 648T59 659T66 666T71 668H708Q723 660 723 648T708 628H409V15Q402 2 391 0Q387 0 384 1T379 3T375 6T373 9T371 13T369 16V628H71Q70 628 67 630T59 637'], - - // UP TACK - 0x22A5: [669,0,778,54,723,'369 652Q369 653 370 655T372 658T375 662T379 665T384 667T391 668Q402 666 409 653V40H708Q723 32 723 20T708 0H71Q70 0 67 2T59 9T55 20T59 31T66 38T71 40H369V652'], - - // TRUE - 0x22A8: [750,249,867,119,812,'139 -249H137Q125 -249 119 -235V251L120 737Q130 750 139 750Q152 750 159 735V367H796Q811 359 811 347Q811 336 797 328L479 327H161L159 328V172L161 173H797Q798 172 800 171T803 169T805 167T808 164T809 162T810 158T811 153Q811 140 796 133H159V-235Q151 -249 141 -249H139'], - - // DIAMOND OPERATOR - 0x22C4: [488,-12,500,12,488,'242 486Q245 488 250 488Q256 488 258 486Q262 484 373 373T486 258T488 250T486 242T373 127T258 14Q256 12 250 12Q245 12 242 14Q237 16 127 126T14 242Q12 245 12 250T14 258Q16 263 126 373T242 486ZM439 250L250 439L61 250L250 61L439 250'], - - // DOT OPERATOR - 0x22C5: [310,-190,278,78,199,'78 250Q78 274 95 292T138 310Q162 310 180 294T199 251Q199 226 182 208T139 190T96 207T78 250'], - - // STAR OPERATOR - 0x22C6: [486,-16,500,3,497,'210 282Q210 284 225 381T241 480Q241 484 245 484Q249 486 251 486Q258 486 260 477T272 406Q275 390 276 380Q290 286 290 282L388 299Q484 314 487 314H488Q497 314 497 302Q497 297 434 266Q416 257 404 251L315 206L361 118Q372 98 383 75T401 40L407 28Q407 16 395 16Q394 16 392 16L390 17L250 159L110 17L108 16Q106 16 105 16Q93 16 93 28L99 40Q105 52 116 75T139 118L185 206L96 251Q6 296 4 300Q3 301 3 302Q3 314 12 314H13Q16 314 112 299L210 282'], - - // BOWTIE - 0x22C8: [505,5,900,26,873,'833 50T833 250T832 450T659 351T487 250T658 150T832 50Q833 50 833 250ZM873 10Q866 -5 854 -5Q851 -5 845 -3L449 226L260 115Q51 -5 43 -5Q39 -5 35 -1T28 7L26 11V489Q33 505 43 505Q51 505 260 385L449 274L845 503Q851 505 853 505Q866 505 873 490V10ZM412 250L67 450Q66 450 66 250T67 50Q69 51 240 150T412 250'], - - // VERTICAL ELLIPSIS - 0x22EE: [900,30,278,78,199,'78 30Q78 54 95 72T138 90Q162 90 180 74T199 31Q199 6 182 -12T139 -30T96 -13T78 30ZM78 440Q78 464 95 482T138 500Q162 500 180 484T199 441Q199 416 182 398T139 380T96 397T78 440ZM78 840Q78 864 95 882T138 900Q162 900 180 884T199 841Q199 816 182 798T139 780T96 797T78 840'], - - // MIDLINE HORIZONTAL ELLIPSIS - 0x22EF: [310,-190,1172,78,1093,'78 250Q78 274 95 292T138 310Q162 310 180 294T199 251Q199 226 182 208T139 190T96 207T78 250ZM525 250Q525 274 542 292T585 310Q609 310 627 294T646 251Q646 226 629 208T586 190T543 207T525 250ZM972 250Q972 274 989 292T1032 310Q1056 310 1074 294T1093 251Q1093 226 1076 208T1033 190T990 207T972 250'], - - // DOWN RIGHT DIAGONAL ELLIPSIS - 0x22F1: [820,-100,1282,133,1148,'133 760Q133 784 150 802T193 820Q217 820 235 804T254 761Q254 736 237 718T194 700T151 717T133 760ZM580 460Q580 484 597 502T640 520Q664 520 682 504T701 461Q701 436 684 418T641 400T598 417T580 460ZM1027 160Q1027 184 1044 202T1087 220Q1111 220 1129 204T1148 161Q1148 136 1131 118T1088 100T1045 117T1027 160'], - - // LEFT CEILING - 0x2308: [750,250,444,174,422,'174 734Q178 746 190 750H298H369Q400 750 411 747T422 730T411 713T372 709Q365 709 345 709T310 710H214V-235Q206 -248 196 -250Q192 -250 189 -249T184 -247T180 -244T178 -241T176 -237T174 -234V734'], - - // RIGHT CEILING - 0x2309: [750,250,444,21,269,'21 717T21 730T32 746T75 750H147H256Q266 742 269 735V-235Q262 -248 251 -250Q247 -250 244 -249T239 -247T235 -244T233 -241T231 -237T229 -234V710H133Q119 710 99 710T71 709Q43 709 32 713'], - - // LEFT FLOOR - 0x230A: [751,251,444,174,423,'174 734Q174 735 175 737T177 740T180 744T184 747T189 749T196 750Q206 748 214 735V-210H310H373Q401 -210 411 -213T422 -230T411 -247T369 -251Q362 -251 338 -251T298 -250H190Q178 -246 174 -234V734'], - - // RIGHT FLOOR - 0x230B: [751,250,444,21,269,'229 734Q229 735 230 737T232 740T235 744T239 747T244 749T251 750Q262 748 269 735V-235Q266 -240 256 -249L147 -250H77Q43 -250 32 -247T21 -230T32 -213T72 -209Q79 -209 99 -209T133 -210H229V734'], - - // stix-small down curve - 0x2322: [388,-122,1000,55,944,'55 141Q55 149 72 174T125 234T209 303T329 360T478 388H526Q649 383 765 319Q814 291 858 250T923 179T944 141Q944 133 938 128T924 122Q914 124 912 125T902 139Q766 328 500 328Q415 328 342 308T225 258T150 199T102 148T84 124Q81 122 75 122Q55 127 55 141'], - - // stix-small up curve - 0x2323: [378,-134,1000,55,944,'923 378Q944 378 944 358Q944 345 912 311T859 259Q710 134 500 134Q288 134 140 259Q55 336 55 358Q55 366 61 372T75 378Q78 378 84 376Q86 376 101 356T147 310T221 257T339 212T500 193Q628 193 734 236Q841 282 903 363Q914 378 923 378'], - - // UPPER LEFT OR LOWER RIGHT CURLY BRACKET SECTION - 0x23B0: [744,244,412,56,357,'357 741V726Q357 720 349 715Q261 655 242 539Q240 526 240 454T239 315T239 247Q240 235 240 124V40Q240 -17 233 -53T201 -130Q155 -206 78 -244H69H64Q58 -244 57 -243T56 -234Q56 -232 56 -231V-225Q56 -218 63 -215Q153 -153 170 -39Q172 -25 173 119V219Q173 245 174 249Q173 258 173 376V460Q173 515 178 545T201 611Q244 695 327 741L334 744H354L357 741'], - - // UPPER RIGHT OR LOWER LEFT CURLY BRACKET SECTION - 0x23B1: [744,244,412,55,357,'78 744Q153 706 196 640T239 492V376Q239 341 239 314T238 271T238 253Q239 251 239 223V119V49Q239 -39 254 -85Q263 -111 275 -134T301 -172T326 -197T346 -213T356 -221T357 -232V-241L354 -244H334Q264 -209 222 -146T174 -12Q173 -6 173 95Q173 134 173 191T174 250Q173 258 173 382V451Q173 542 159 585Q145 626 120 658T75 706T56 723V731Q56 741 57 742T66 744H78'], - - // MATHEMATICAL LEFT ANGLE BRACKET - 0x27E8: [750,250,389,109,333,'333 -232Q332 -239 327 -244T313 -250Q303 -250 296 -240Q293 -233 202 6T110 250T201 494T296 740Q299 745 306 749L309 750Q312 750 313 750Q331 750 333 732Q333 727 243 489Q152 252 152 250T243 11Q333 -227 333 -232'], - - // MATHEMATICAL RIGHT ANGLE BRACKET - 0x27E9: [750,250,389,55,279,'55 732Q56 739 61 744T75 750Q85 750 92 740Q95 733 186 494T278 250T187 6T92 -240Q85 -250 75 -250Q67 -250 62 -245T55 -232Q55 -227 145 11Q236 248 236 250T145 489Q55 727 55 732'], - - // MATHEMATICAL LEFT FLATTENED PARENTHESIS - 0x27EE: [744,244,412,173,357,'357 741V726Q357 720 349 715Q261 655 242 539Q240 526 240 394V331Q240 259 239 250Q240 242 240 119V49Q240 -42 254 -85Q263 -111 275 -134T301 -172T326 -197T346 -213T356 -221T357 -232V-241L354 -244H334Q264 -209 222 -146T174 -12Q173 -6 173 95Q173 134 173 191T174 250Q173 260 173 376V460Q173 515 178 545T201 611Q244 695 327 741L334 744H354L357 741'], - - // MATHEMATICAL RIGHT FLATTENED PARENTHESIS - 0x27EF: [744,244,412,55,240,'78 744Q153 706 196 640T239 492V376Q239 339 239 311T238 269T238 252Q240 236 240 124V40Q240 -18 233 -53T202 -130Q156 -206 79 -244H70H65Q58 -244 57 -242T56 -231T57 -220T64 -215Q153 -154 170 -39Q173 -18 174 119V247Q173 249 173 382V451Q173 542 159 585Q145 626 120 658T75 706T56 723V731Q56 741 57 742T66 744H78'], - - // LONG LEFTWARDS ARROW - 0x27F5: [511,11,1609,55,1525,'165 270H1510Q1525 262 1525 250T1510 230H165Q167 228 182 216T211 189T244 152T277 96T303 25Q308 7 308 0Q308 -11 288 -11Q281 -11 278 -11T272 -7T267 2T263 21Q245 94 195 151T73 236Q58 242 55 247Q55 254 59 257T73 264Q121 283 158 314T215 375T247 434T264 480L267 497Q269 503 270 505T275 509T288 511Q308 511 308 500Q308 493 303 475Q293 438 278 406T246 352T215 315T185 287T165 270'], - - // LONG RIGHTWARDS ARROW - 0x27F6: [511,11,1638,84,1553,'84 237T84 250T98 270H1444Q1328 357 1301 493Q1301 494 1301 496T1300 499Q1300 511 1317 511H1320Q1329 511 1332 510T1338 506T1341 497T1344 481T1352 456Q1374 389 1425 336T1544 261Q1553 258 1553 250Q1553 244 1548 241T1524 231T1486 212Q1445 186 1415 152T1370 85T1349 35T1341 4Q1339 -6 1336 -8T1320 -11Q1300 -11 1300 0Q1300 7 1305 25Q1337 151 1444 230H98Q84 237 84 250'], - - // LONG LEFT RIGHT ARROW - 0x27F7: [511,11,1859,55,1803,'165 270H1694Q1578 357 1551 493Q1551 494 1551 496T1550 499Q1550 511 1567 511H1570Q1579 511 1582 510T1588 506T1591 497T1594 481T1602 456Q1624 389 1675 336T1794 261Q1803 258 1803 250Q1803 244 1798 241T1774 231T1736 212Q1695 186 1665 152T1620 85T1599 35T1591 4Q1589 -6 1586 -8T1570 -11Q1550 -11 1550 0Q1550 7 1555 25Q1587 151 1694 230H165Q167 228 182 216T211 189T244 152T277 96T303 25Q308 7 308 0Q308 -11 288 -11Q281 -11 278 -11T272 -7T267 2T263 21Q245 94 195 151T73 236Q58 242 55 247Q55 254 59 257T73 264Q121 283 158 314T215 375T247 434T264 480L267 497Q269 503 270 505T275 509T288 511Q308 511 308 500Q308 493 303 475Q293 438 278 406T246 352T215 315T185 287T165 270'], - - // LONG LEFTWARDS DOUBLE ARROW - 0x27F8: [525,24,1609,56,1554,'274 173H1539Q1540 172 1542 171T1545 169T1547 167T1550 164T1551 162T1552 158T1553 153Q1553 140 1538 133H318L328 123Q379 69 414 0Q419 -13 419 -17Q419 -24 399 -24Q388 -24 385 -23T377 -12Q332 77 253 144T72 237Q62 240 59 242T56 250T59 257T70 262T89 268T119 278T160 296Q303 366 377 512Q382 522 385 523T401 525Q419 524 419 515Q419 510 414 500Q379 431 328 377L318 367H1538Q1553 359 1553 347Q1553 336 1539 328L1221 327H903L900 328L602 327H274L264 319Q225 289 147 250Q148 249 165 241T210 217T264 181L274 173'], - - // LONG RIGHTWARDS DOUBLE ARROW - 0x27F9: [525,24,1638,56,1582,'1218 514Q1218 525 1234 525Q1239 525 1242 525T1247 525T1251 524T1253 523T1255 520T1257 517T1260 512Q1297 438 1358 381T1469 300T1565 263Q1582 258 1582 250T1573 239T1536 228T1478 204Q1334 134 1260 -12Q1256 -21 1253 -22T1238 -24Q1218 -24 1218 -17Q1218 -13 1223 0Q1258 69 1309 123L1319 133H70Q56 140 56 153Q56 168 72 173H1363L1373 181Q1412 211 1490 250Q1489 251 1472 259T1427 283T1373 319L1363 327H710L707 328L390 327H72Q56 332 56 347Q56 360 70 367H1319L1309 377Q1276 412 1247 458T1218 514'], - - // LONG LEFT RIGHT DOUBLE ARROW - 0x27FA: [525,24,1858,56,1802,'1438 514Q1438 525 1454 525Q1459 525 1462 525T1467 525T1471 524T1473 523T1475 520T1477 517T1480 512Q1517 438 1578 381T1689 300T1785 263Q1802 258 1802 250T1793 239T1756 228T1698 204Q1554 134 1480 -12Q1476 -21 1473 -22T1458 -24Q1438 -24 1438 -17Q1438 -13 1443 0Q1478 69 1529 123L1539 133H318L328 123Q379 69 414 0Q419 -13 419 -17Q419 -24 399 -24Q388 -24 385 -23T377 -12Q332 77 253 144T72 237Q62 240 59 242T56 250T59 257T70 262T89 268T119 278T160 296Q303 366 377 512Q382 522 385 523T401 525Q419 524 419 515Q419 510 414 500Q379 431 328 377L318 367H1539L1529 377Q1496 412 1467 458T1438 514ZM274 173H1583L1593 181Q1632 211 1710 250Q1709 251 1692 259T1647 283T1593 319L1583 327H930L927 328L602 327H274L264 319Q225 289 147 250Q148 249 165 241T210 217T264 181L274 173'], - - // LONG RIGHTWARDS ARROW FROM BAR - 0x27FC: [511,11,1638,54,1553,'95 155V109Q95 83 92 73T75 63Q61 63 58 74T54 130Q54 140 54 180T55 250Q55 421 57 425Q61 437 75 437Q88 437 91 428T95 393V345V270H1444Q1328 357 1301 493Q1301 494 1301 496T1300 499Q1300 511 1317 511H1320Q1329 511 1332 510T1338 506T1341 497T1344 481T1352 456Q1374 389 1425 336T1544 261Q1553 258 1553 250Q1553 244 1548 241T1524 231T1486 212Q1445 186 1415 152T1370 85T1349 35T1341 4Q1339 -6 1336 -8T1320 -11Q1300 -11 1300 0Q1300 7 1305 25Q1337 151 1444 230H95V155'], - - // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN - 0x2AAF: [636,138,778,84,694,'84 346Q84 359 91 363T117 367Q120 367 126 367T137 366Q388 370 512 430T653 609Q657 636 676 636Q685 635 689 629T694 618V612Q689 566 672 528T626 463T569 417T500 383T435 362T373 346Q379 345 404 339T440 330T477 318T533 296Q592 266 630 223T681 145T694 78Q694 57 674 57Q662 57 657 67T652 92T640 135T606 191Q500 320 137 326H114Q104 326 98 327T88 332T84 346ZM84 -131T84 -118T98 -98H679Q694 -106 694 -118T679 -138H98Q84 -131 84 -118'], - - // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN - 0x2AB0: [636,138,778,83,694,'84 614Q84 636 102 636Q115 636 119 626T125 600T137 556T171 501Q277 372 640 366H661Q694 366 694 346T661 326H640Q578 325 526 321T415 307T309 280T222 237T156 172T124 83Q122 66 118 62T103 57Q100 57 98 57T95 58T93 59T90 62T85 67Q83 71 83 80Q88 126 105 164T151 229T208 275T277 309T342 330T404 346Q401 347 380 351T345 360T302 373T245 396Q125 455 92 565Q84 599 84 614ZM84 -131T84 -118T98 -98H679Q694 -106 694 -118T679 -138H98Q84 -131 84 -118'] -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Regular/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/MathOperators.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/MathOperators.js deleted file mode 100644 index 2a76ab16ae..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/MathOperators.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Regular/MathOperators.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main'], - { - // INCREMENT - 0x2206: [716,0,833,46,786,''] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Regular/MathOperators.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/MiscSymbols.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/MiscSymbols.js deleted file mode 100644 index cc984e1b9d..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/MiscSymbols.js +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Regular/MiscSymbols.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main'], - { - // BLACK SPADE SUIT - 0x2660: [727,131,778,55,723,'181 -21Q134 -21 96 27T55 193Q55 224 58 247T82 317T143 410Q172 443 234 498Q282 543 314 598T360 687T380 725Q386 727 389 727Q395 727 398 725T406 716T413 702T423 677T439 641Q481 556 544 498Q633 420 678 353T723 204Q723 142 711 94T669 12T590 -21Q520 -21 490 8T459 66V70H409V62Q409 22 416 -17T430 -82T437 -112Q437 -131 407 -131Q403 -131 397 -131T389 -130T382 -130T372 -131Q341 -131 341 -111Q341 -107 348 -82T362 -18T369 62V70H319V66Q319 57 314 44T297 16T257 -10T191 -21H181'], - - // WHITE HEART SUIT - 0x2661: [716,33,778,55,723,'55 490Q55 557 71 604T114 674T167 706T222 716Q279 716 322 684T389 605Q391 610 395 617T414 643T447 677T494 704T555 716Q642 716 682 652T723 490Q723 455 718 426T684 342T602 227Q573 196 537 161T485 110T449 63T412 -8Q408 -22 404 -27T389 -33Q382 -33 379 -31T372 -23T366 -8T355 18T335 54Q319 81 298 104T239 163T176 227Q102 310 79 371T55 490ZM198 674Q143 664 119 613T95 491Q95 415 137 346Q174 282 265 194T384 48L389 39Q391 42 397 54T406 71T415 86T427 104T442 122T464 146T491 172Q571 249 613 303Q683 396 683 487Q683 581 649 631Q613 676 556 676Q495 676 457 634T410 538Q407 514 390 514Q386 514 380 517Q372 520 369 536T355 581T319 635Q277 675 223 675H217H208L204 674Q200 674 198 674'], - - // WHITE DIAMOND SUIT - 0x2662: [727,162,778,55,723,'370 714Q370 717 375 722T388 727Q398 727 403 721T417 697Q420 692 421 689Q536 465 709 304Q723 291 723 282T709 260Q529 93 406 -153Q402 -162 390 -162H389Q379 -162 376 -158T357 -125Q247 89 89 241L64 265Q55 272 55 282Q55 287 57 290T64 300T77 312T98 331T127 361Q197 435 258 523T344 663L370 714ZM655 299Q568 384 508 470T389 662L376 638Q362 613 341 577T289 497T215 399T123 299L105 282L123 265Q210 180 270 94T389 -98L402 -74Q416 -49 437 -13T489 67T563 165T655 265L673 282L655 299'], - - // BLACK CLUB SUIT - 0x2663: [726,131,778,28,750,'213 532Q213 615 265 670T389 726Q461 726 513 671T565 532Q565 511 562 492T553 458T541 432T526 409T512 393T498 379L490 371L511 326Q512 326 516 330T528 341T546 353T572 363T606 368Q664 368 707 315T750 174Q750 87 699 33T579 -22Q567 -22 553 -20T517 -10T479 16T459 63V70H409V62Q409 22 416 -17T430 -82T437 -112Q437 -131 407 -131Q403 -131 397 -131T389 -130T382 -130T372 -131Q341 -131 341 -111Q341 -107 348 -82T362 -18T369 62V70H319V63Q315 25 281 2T197 -22Q132 -22 80 32T28 174Q28 255 69 311T175 368Q192 368 207 364T232 353T250 341T262 331T267 326L288 371L280 378Q272 385 267 391T253 407T238 430T226 457T217 492T213 532'], - - // MUSIC FLAT SIGN - 0x266D: [750,22,389,55,332,'200 467Q254 467 293 428T332 321Q332 147 104 -11L88 -22H75Q62 -22 56 -16L55 362V647Q55 743 60 748Q63 750 76 750H83Q87 750 95 744V434L104 440Q144 467 200 467ZM237 322Q237 360 225 388T183 417Q158 417 134 407T101 378Q96 370 96 349T95 197V34Q152 91 194 167T237 322'], - - // MUSIC NATURAL SIGN - 0x266E: [734,223,389,65,324,'65 721Q78 734 94 734Q100 734 104 727V444L116 449Q129 454 157 465T208 486Q313 527 314 527Q318 527 324 521V-210Q306 -223 294 -223Q289 -223 284 -216V-13L270 -18Q257 -24 231 -34T180 -54Q77 -96 74 -96T65 -90V721ZM104 13Q282 84 283 85Q284 85 284 252Q284 418 283 418L230 396L140 360L104 346V13'], - - // MUSIC SHARP SIGN - 0x266F: [723,223,389,55,333,'101 -223Q94 -223 93 -217T91 -188V-151Q91 -88 90 -88Q87 -88 80 -92T68 -96Q62 -96 56 -90L55 -50V-22Q55 -8 58 -4T78 5L91 10V177Q91 343 90 343Q87 343 80 339T68 335Q62 335 56 341L55 381V409Q55 423 58 427T78 436L91 441V543V616Q91 643 93 648T106 656Q119 662 126 659Q130 657 130 645T131 554V456L257 503V607L258 710L260 712Q261 715 272 719T286 723Q293 723 295 715T297 671V617Q297 519 298 519Q301 519 307 522T319 526Q327 526 333 521V437L330 435Q328 432 312 427L297 421V254Q297 88 298 88Q301 88 307 91T319 95Q327 95 333 90V6L330 4Q328 1 312 -4L297 -10V-78V-122Q297 -145 295 -149T282 -156Q274 -160 268 -160Q257 -160 257 -130V-89V-25L131 -72V-210Q123 -215 116 -218T104 -222L101 -223ZM257 72V406L131 359V25L257 72'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Regular/MiscSymbols.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/SpacingModLetters.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/SpacingModLetters.js deleted file mode 100644 index 1a362a550d..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/SpacingModLetters.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Regular/SpacingModLetters.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main'], - { - // RING ABOVE - 0x2DA: [715,-542,500,147,352,'147 628Q147 669 179 692T244 715Q298 715 325 689T352 629Q352 592 323 567T249 542Q202 542 175 567T147 628ZM313 628Q313 660 300 669T259 678H253Q248 678 242 678T234 679Q217 679 207 674T192 659T188 644T187 629Q187 600 198 590Q210 579 250 579H265Q279 579 288 581T305 595T313 628'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Regular/SpacingModLetters.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/SuppMathOperators.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/SuppMathOperators.js deleted file mode 100644 index d5d272c9fd..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Main/Regular/SuppMathOperators.js +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Main/Regular/SuppMathOperators.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Main'], - { - // AMALGAMATION OR COPRODUCT - 0x2A3F: [683,0,750,28,721,'28 660Q28 676 31 679T46 683H50Q87 681 182 681Q217 681 247 681T294 682T315 682Q321 682 323 682T328 679T331 673T332 660Q332 643 328 640T304 637Q239 637 231 626Q229 620 229 334V46H520V334Q520 620 518 626Q510 637 445 637Q426 637 422 640T417 660Q417 675 420 678T432 682H435Q437 682 467 682T569 681T671 681T703 682Q714 682 717 679T721 660Q721 643 717 640T693 637Q628 637 620 626Q619 623 619 342Q619 60 620 57Q628 46 693 46Q714 46 717 43T721 23Q721 5 715 1Q713 0 374 0Q36 0 34 1Q28 5 28 23Q28 40 31 43T56 46Q121 46 129 57Q131 63 131 342Q131 620 129 626Q121 637 56 637Q35 637 32 640T28 660'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Main/Regular/SuppMathOperators.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Math/BoldItalic/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Math/BoldItalic/Main.js deleted file mode 100644 index 361fc1c7bb..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Math/BoldItalic/Main.js +++ /dev/null @@ -1,395 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Math/BoldItalic/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Math-bold-italic'] = { - directory: 'Math/BoldItalic', - family: 'MathJax_Math', - id: 'MJMATHBI', - weight: 'bold', - style: 'italic', - skew: { - 0x41: 0.16, - 0x42: 0.0958, - 0x43: 0.0958, - 0x44: 0.0639, - 0x45: 0.0958, - 0x46: 0.0958, - 0x47: 0.0958, - 0x48: 0.0639, - 0x49: 0.128, - 0x4A: 0.192, - 0x4B: 0.0639, - 0x4C: 0.0319, - 0x4D: 0.0958, - 0x4E: 0.0958, - 0x4F: 0.0958, - 0x50: 0.0958, - 0x51: 0.0958, - 0x52: 0.0958, - 0x53: 0.0958, - 0x54: 0.0958, - 0x55: 0.0319, - 0x58: 0.0958, - 0x5A: 0.0958, - 0x63: 0.0639, - 0x64: 0.192, - 0x65: 0.0639, - 0x66: 0.192, - 0x67: 0.0319, - 0x68: -0.0319, - 0x6C: 0.0958, - 0x6F: 0.0639, - 0x70: 0.0958, - 0x71: 0.0958, - 0x72: 0.0639, - 0x73: 0.0639, - 0x74: 0.0958, - 0x75: 0.0319, - 0x76: 0.0319, - 0x77: 0.0958, - 0x78: 0.0319, - 0x79: 0.0639, - 0x7A: 0.0639, - 0x393: 0.0958, - 0x394: 0.192, - 0x398: 0.0958, - 0x39B: 0.192, - 0x39E: 0.0958, - 0x3A0: 0.0639, - 0x3A3: 0.0958, - 0x3A5: 0.0639, - 0x3A6: 0.0958, - 0x3A8: 0.0639, - 0x3A9: 0.0958, - 0x3B1: 0.0319, - 0x3B2: 0.0958, - 0x3B4: 0.0639, - 0x3B5: 0.0958, - 0x3B6: 0.0958, - 0x3B7: 0.0639, - 0x3B8: 0.0958, - 0x3B9: 0.0639, - 0x3BC: 0.0319, - 0x3BD: 0.0319, - 0x3BE: 0.128, - 0x3BF: 0.0639, - 0x3C1: 0.0958, - 0x3C2: 0.0958, - 0x3C4: 0.0319, - 0x3C5: 0.0319, - 0x3C6: 0.0958, - 0x3C7: 0.0639, - 0x3C8: 0.128, - 0x3D1: 0.0958, - 0x3D5: 0.0958, - 0x3F1: 0.0958, - 0x3F5: 0.0639 - }, - - // SPACE - 0x20: [0,0,250,0,0,''], - - // SOLIDUS - 0x2F: [711,210,894,160,733,'189 -210Q179 -210 170 -203T160 -179Q160 -171 162 -166Q164 -163 420 266T679 698Q686 711 704 711Q714 711 723 704T733 681Q733 672 730 667Q723 654 469 228T211 -201Q202 -210 189 -210'], - - // LATIN CAPITAL LETTER A - 0x41: [711,0,869,45,839,'65 0Q45 0 45 18Q48 52 61 60Q65 62 81 62Q155 62 165 74Q166 74 265 228T465 539T569 699Q576 707 583 709T611 711T637 710T649 700Q650 697 695 380L741 63L784 62H827Q839 50 839 45L835 29Q831 9 827 5T806 0Q803 0 790 0T743 1T657 2Q585 2 547 1T504 0Q481 0 481 17Q484 54 497 60Q501 62 541 62Q580 62 580 63Q580 68 573 121T564 179V181H308L271 124Q236 69 236 67T283 62H287Q316 62 316 46Q316 26 307 8Q302 3 295 0L262 1Q242 2 168 2Q119 2 93 1T65 0ZM537 372Q533 402 528 435T521 486T518 504V505Q517 505 433 375L348 244L451 243Q555 243 555 244L537 372'], - - // LATIN CAPITAL LETTER B - 0x42: [686,0,866,43,853,'258 624H235Q214 624 209 626T199 639Q203 678 216 684Q220 686 449 686H477H586Q684 686 733 677T817 634Q853 598 853 547Q853 499 826 460T761 401T695 371T654 360H653L662 358Q670 357 683 354T712 344T744 327T774 303T795 269T804 224Q804 148 732 79T533 1Q524 0 288 0H58Q47 5 43 15Q47 54 60 60Q64 62 113 62H162L302 623Q302 624 258 624ZM703 550Q703 571 695 586T675 609T656 619T643 623L545 624H447L417 504Q386 384 386 383T470 382Q554 383 565 385Q632 397 667 447T703 550ZM651 240Q651 265 645 282T626 309T608 322T592 329Q587 330 479 331H373L340 198Q307 65 306 64Q306 62 406 62L507 63L519 65Q565 76 596 107T639 171T651 240'], - - // LATIN CAPITAL LETTER C - 0x43: [704,17,817,55,855,'380 -17Q335 -17 293 -10T207 16T130 65T76 144T55 256Q55 306 70 361T122 476T211 582T345 663T525 702H545Q673 702 731 634L777 668Q783 672 789 677T800 685T808 691T814 695T818 698T822 700T825 702T828 703T830 703T833 703Q855 703 855 690Q855 686 823 558T789 426Q786 421 782 420T756 419Q734 420 729 421T724 432Q724 434 725 447T726 472Q726 552 678 604Q640 640 586 640H574Q533 640 494 632T409 604T324 541T260 437Q243 397 227 333T210 219Q210 152 237 117Q255 90 299 68T420 46H429Q506 46 580 100T678 234Q683 249 687 251T712 254H723Q743 254 743 240Q743 232 736 213T710 162T663 100T586 40T477 -5Q433 -17 380 -17'], - - // LATIN CAPITAL LETTER D - 0x44: [686,0,938,43,914,'258 624H235Q214 624 209 626T199 639Q203 678 216 684Q220 686 437 686Q659 686 668 685Q727 680 772 662T842 621T883 568T905 517T913 475Q914 466 914 434Q914 373 892 307T828 179T712 69T548 7Q517 2 494 2T279 0H58Q47 5 43 15Q47 54 60 60Q64 62 113 62H162L302 623Q302 624 258 624ZM768 475Q768 515 753 544T718 588T666 611T613 622T563 624H538H532H452L382 344Q311 64 311 63T363 62H405Q490 62 545 76T656 142Q696 185 724 265T760 399T768 475'], - - // LATIN CAPITAL LETTER E - 0x45: [680,0,810,43,825,'257 618H231Q198 618 198 636Q202 672 214 678L219 680H811Q817 677 820 673T824 666L825 664Q825 659 814 549T799 433Q793 424 771 424Q752 424 746 427T740 441Q740 445 742 466T744 505Q744 561 722 585T646 616Q639 617 545 618H456Q456 617 427 502T398 385Q398 384 435 384Q461 385 471 385T499 391T526 405T545 433T562 478Q566 494 571 497T595 501H604Q622 501 626 486Q626 482 593 349T557 213Q552 205 530 205Q499 205 499 219Q499 222 503 242T508 281Q508 308 491 314T429 322Q425 322 423 322H382L317 64Q317 62 390 62Q460 62 493 64T569 80T640 124Q665 149 686 187T719 253T733 283Q739 289 760 289Q791 289 791 274Q791 267 763 201T706 71L678 8Q676 4 667 0H58Q47 5 43 15Q47 54 60 60Q64 62 113 62H162L163 66Q163 67 231 341T301 616Q301 618 257 618'], - - // LATIN CAPITAL LETTER F - 0x46: [680,0,689,43,809,'257 618H231Q198 618 198 636Q202 672 214 678L219 680H795Q801 677 804 673T808 666L809 664Q809 659 798 549T783 433Q777 424 755 424Q736 424 730 427T724 444Q724 448 725 468T727 507V524Q727 541 724 554T713 577T698 594T676 605T653 612T625 616T597 617T566 618T538 618H456L455 614Q455 611 424 491L394 371H429Q454 372 463 372T491 378T517 392T536 419T552 464Q556 481 561 484T586 488Q603 488 607 486Q616 482 616 473Q616 467 584 337T549 201Q542 192 521 192Q503 192 497 195T490 209Q490 212 492 224Q499 251 499 269Q499 288 489 296T465 306T417 308L379 309L348 188Q341 161 334 129T322 80L318 65L317 62H375H409Q430 62 438 59T447 45Q444 8 431 2L426 0L377 1Q347 2 231 2Q152 2 111 1T65 0Q48 0 43 15Q47 54 60 60Q64 62 113 62H162L163 66Q163 67 231 341T301 616Q301 618 257 618'], - - // LATIN CAPITAL LETTER G - 0x47: [704,16,887,56,854,'379 -16Q233 -16 145 52T56 255Q56 310 73 368T127 483T216 586T347 663T518 702H540Q562 702 582 700T616 696T644 689T667 681T686 670T702 659T717 647T731 635L776 668Q782 672 788 677T799 685T807 691T813 695T817 698T821 700T824 702T827 703T829 703T832 703Q854 703 854 690Q854 686 822 558T788 426Q785 421 781 420T755 419Q734 420 729 422T723 432Q723 434 724 446T725 469Q725 531 702 571T642 628Q616 640 575 640Q468 640 390 593T272 464Q247 415 229 340T210 214Q210 166 228 132T277 79T343 54T419 46Q445 46 465 50T500 59T526 76T544 96T557 123T566 150T574 182T581 214H519Q511 214 498 214T479 213Q443 213 443 230Q443 250 452 268Q457 273 464 276L514 275Q546 274 657 274Q735 274 768 275T803 276Q826 276 826 258Q823 224 810 216Q806 214 771 214H736Q736 211 710 109T683 5Q678 0 671 0Q666 0 637 14T597 36Q593 38 590 40T585 44T582 44T576 40Q511 -16 379 -16'], - - // LATIN CAPITAL LETTER H - 0x48: [686,0,982,43,1027,'258 624H235Q214 624 209 626T199 639Q203 678 216 684Q220 686 239 686Q290 684 403 684Q475 684 512 685T553 686Q576 686 576 668Q572 632 560 626Q555 624 506 624H457L399 389Q399 388 547 388H695L753 623Q753 624 709 624H686Q665 624 660 626T650 639Q653 678 668 684Q672 686 681 686Q685 686 726 685T847 684Q902 684 937 684T986 685T1004 686Q1027 686 1027 668Q1023 632 1011 626Q1006 624 957 624H908L839 344Q768 64 768 63T812 62H839Q871 62 871 44Q867 6 854 2L850 0L808 1Q782 2 675 2Q600 2 560 1T516 0Q499 0 494 15Q498 54 511 60Q515 62 564 62H613L614 66L679 324Q679 326 531 326H383L382 322L317 64Q317 62 361 62H388Q420 62 420 44Q416 6 403 2L399 0L357 1Q331 2 224 2Q149 2 109 1T65 0Q48 0 43 15Q47 54 60 60Q64 62 113 62H162L302 623Q302 624 258 624'], - - // LATIN CAPITAL LETTER I - 0x49: [686,0,511,30,573,'247 624Q242 624 233 624T220 623Q186 623 186 640Q186 647 190 664T202 684Q206 686 226 686Q277 684 393 684Q435 684 471 684T528 685T553 686Q573 686 573 670Q573 650 564 632Q556 624 537 624H501H449L380 344Q309 64 309 63T356 62Q361 62 370 62T384 63Q417 63 417 46Q417 26 408 8Q403 3 396 0L352 1Q325 2 216 2T82 1L45 0Q30 7 30 16Q33 51 46 60Q51 62 102 62H154L294 623Q294 624 247 624'], - - // LATIN CAPITAL LETTER J - 0x4A: [686,17,631,42,694,'205 131Q205 105 192 84T165 54L152 45Q152 44 160 42T182 37T213 35H216Q255 35 289 65Q314 90 329 129Q331 136 392 378T453 623Q453 624 393 624H332Q318 631 318 640Q318 647 322 664T334 684Q338 686 359 686Q413 684 533 684Q566 684 605 685T652 686Q677 686 685 683T694 669Q694 664 691 652Q686 631 681 628T647 624H602L542 380Q531 336 518 285T500 212T487 161T475 122T463 97T448 74T429 55Q351 -17 213 -17Q142 -17 99 7T43 70Q42 75 42 93Q42 143 73 168T139 194Q168 194 186 177T205 131'], - - // LATIN CAPITAL LETTER K - 0x4B: [686,1,971,43,1003,'536 0Q522 6 522 18Q522 35 533 57Q539 62 557 62Q595 62 601 65L472 330L365 255L342 160Q318 65 317 64Q317 62 361 62H388Q420 62 420 44Q416 6 403 2L399 0L357 1Q331 2 224 2Q149 2 109 1T65 0Q48 0 43 15Q47 54 60 60Q64 62 113 62H162L302 623Q302 624 258 624H235Q214 624 209 626T199 639Q203 678 216 684Q220 686 239 686Q290 684 403 684Q475 684 512 685T553 686Q576 686 576 668Q572 632 560 626Q555 624 506 624H457L422 481Q386 339 386 337L785 621Q779 624 749 624Q726 624 726 641Q726 645 730 659Q734 675 736 679T747 686L786 685Q812 684 888 684Q908 684 934 685T968 686Q1003 686 1003 669Q1003 646 991 629Q985 624 967 624Q918 624 888 617Q884 617 874 613L865 609Q864 608 732 515T599 420Q599 418 686 242T775 65Q784 62 829 62Q847 62 850 61T860 54Q862 52 862 43Q862 10 845 1Q844 1 842 1T836 0T797 1T694 2Q599 2 573 1L536 0'], - - // LATIN CAPITAL LETTER L - 0x4C: [686,0,756,43,711,'258 624H235Q214 624 209 626T199 639Q203 678 216 684Q220 686 239 686Q290 684 409 684Q454 684 492 684T552 685T579 686Q603 686 603 668Q599 632 587 626Q583 624 520 624H457L388 344Q317 64 317 63T353 62H390Q418 62 440 64T493 78T548 110T598 169T643 261Q651 282 655 285T680 289Q696 289 700 288T709 279Q711 274 711 269Q710 265 663 138T613 8Q611 4 602 0H58Q47 5 43 15Q47 54 60 60Q64 62 113 62H162L302 623Q302 624 258 624'], - - // LATIN CAPITAL LETTER M - 0x4D: [686,0,1142,43,1219,'258 624H231Q214 624 208 626T199 639Q203 678 216 684Q220 686 347 686H473Q474 685 478 682T484 677Q487 673 535 413L584 153L608 187Q631 221 672 281T761 410Q935 663 943 671Q949 678 962 686H1082H1166Q1201 686 1210 683T1219 668Q1215 632 1203 626Q1199 624 1149 624H1100L1031 344Q960 64 960 63T1004 62H1031Q1063 62 1063 44Q1060 7 1046 2Q1042 0 1034 0Q1030 0 990 1T875 2Q804 2 767 1T725 0H723Q707 0 703 15Q707 54 720 60Q724 62 773 62H822Q961 618 961 619L754 318Q546 15 543 12Q531 0 510 0Q500 0 495 0T484 5T477 19Q477 20 421 315L367 604L299 335Q234 72 234 68Q234 62 302 62Q334 62 334 46Q332 8 317 2Q313 0 306 0Q301 0 267 1T181 2Q125 2 96 1T63 0Q48 0 43 15Q43 19 47 35Q52 55 57 58T94 62Q147 64 164 69L233 345Q302 619 302 622Q302 624 258 624'], - - // LATIN CAPITAL LETTER N - 0x4E: [686,0,950,43,1027,'258 624H235Q214 624 209 626T199 639Q203 678 216 684Q220 686 344 686H434Q464 686 477 680Q480 677 607 454Q738 227 739 227Q742 227 789 418T836 618Q836 620 835 620L821 622Q811 622 779 624Q755 624 749 625T740 632Q737 635 737 644Q737 656 742 669T754 685Q755 685 757 685T763 686Q768 686 803 685T890 684Q925 684 951 684T990 685T1006 686Q1014 686 1016 684Q1027 679 1027 668Q1023 632 1011 626Q1007 624 978 624Q912 622 907 617Q907 616 831 314T753 8Q749 0 723 0H712Q699 0 692 7Q692 8 671 44T607 155T526 296L361 580L296 323Q234 74 234 68T302 62H307Q334 62 334 44Q330 6 317 2L313 0L280 1Q260 2 181 2Q125 2 96 1T63 0Q48 0 43 15Q43 19 47 35Q52 55 57 58T94 62Q147 64 164 69L233 345Q302 619 302 622Q302 624 258 624'], - - // LATIN CAPITAL LETTER O - 0x4F: [703,17,837,53,815,'53 245Q53 297 70 356T125 478T216 590T349 671T523 703Q656 703 735 637T815 445Q815 378 791 307Q727 104 527 17Q437 -17 344 -17Q289 -17 242 -5T150 35T79 116T53 245ZM664 489Q664 575 618 611T511 648Q463 648 416 627T334 570Q297 531 270 472T230 355T213 261T208 206Q208 177 215 151T237 98T284 56T358 40Q440 40 510 98T618 270Q664 400 664 489'], - - // LATIN CAPITAL LETTER P - 0x50: [686,0,723,43,847,'162 62L302 623Q302 624 258 624H234Q214 624 209 626T200 638Q200 677 217 684Q220 686 439 686Q667 685 684 682Q686 681 693 680Q713 677 733 671T782 649T829 602T847 528Q847 450 784 382T604 293Q571 288 469 287H373L346 176Q340 151 333 122T321 78L317 64Q317 62 361 62H387Q420 62 420 44Q417 10 404 2L399 0L357 1Q331 2 224 2Q149 2 109 1T65 0Q43 0 43 17Q43 21 47 33Q52 54 57 58T89 62H113H162ZM692 558Q692 611 617 622Q610 623 529 624H452L381 343H458H492Q604 343 641 389Q662 414 677 471T692 558'], - - // LATIN CAPITAL LETTER Q - 0x51: [703,194,869,52,815,'53 245Q53 297 70 356T125 478T216 590T349 671T523 703Q656 703 735 637T815 445Q815 410 808 370T781 277T729 178T643 87T519 14L525 4Q540 -19 553 -25T592 -32Q632 -32 654 -24T680 -7T689 10T704 18Q713 18 717 12T722 0Q722 -8 711 -36T681 -101T624 -166T541 -194Q513 -194 494 -183T465 -157T450 -118T444 -79T443 -41V-7L433 -9Q391 -17 344 -17Q301 -17 263 -10T185 15T118 62T71 138T53 245ZM666 482Q666 529 652 563T614 615T565 640T512 648Q412 648 335 573Q268 506 235 389T201 202Q201 164 210 136T230 95T259 66L262 76Q269 109 302 135T382 162Q401 162 415 159T449 140T484 92L491 78L496 82Q502 86 505 88T515 97T528 107T541 120T555 137T570 156T585 179T599 205T612 235Q629 278 647 351T666 482ZM439 56Q439 58 439 62T435 75T426 92T410 106T383 112Q353 112 332 96T311 63Q311 38 355 38H366Q391 39 415 45T439 56'], - - // LATIN CAPITAL LETTER R - 0x52: [686,17,872,43,881,'258 624H235Q214 624 209 626T199 639Q203 678 216 684Q220 686 422 686H446H525Q634 686 698 674T806 620Q843 583 843 535Q843 505 833 478T805 432T768 396T728 370T690 352T662 342L651 338L654 336Q658 334 667 327T688 310Q719 278 719 237Q719 222 710 165T701 94Q701 35 748 35Q775 35 793 57T819 101Q822 112 826 114T843 117H849Q881 117 881 99Q881 78 852 39T781 -11Q765 -17 728 -17Q537 -13 537 94Q537 110 552 169T567 243Q567 292 529 309Q517 316 508 316T441 318H375L374 314Q374 312 343 189T311 64Q311 62 355 62H382Q414 62 414 44Q410 6 397 2L393 0L351 1Q325 2 221 2Q147 2 108 1T65 0Q48 0 43 15Q47 54 60 60Q64 62 113 62H162L302 623Q302 624 258 624ZM687 555Q687 617 589 623Q581 624 513 624H451L420 498Q413 468 405 436T392 388L388 371Q388 369 458 369Q464 369 485 369T515 369T541 372T570 377T596 386T624 400Q649 417 664 457T683 522T687 555'], - - // LATIN CAPITAL LETTER S - 0x53: [703,17,693,63,714,'354 45Q429 45 467 91T506 184Q506 225 477 250Q461 262 384 279T294 300Q238 318 210 362T182 452Q182 493 202 540T257 623Q338 702 449 702Q491 702 501 701Q571 690 610 654Q614 649 617 650Q618 650 650 675T683 702Q685 703 692 703Q714 703 714 690Q714 686 687 578T658 466Q653 458 629 458Q606 458 602 463Q600 465 599 466Q599 467 599 469T598 473Q598 475 599 487T600 511Q600 584 557 614T454 645Q386 645 347 606T308 520Q308 506 311 496T323 477T338 464T360 454T384 446T413 439T441 433Q523 416 549 401Q581 384 602 352Q631 309 631 254Q631 214 615 170T567 83T478 12T347 -16Q322 -16 300 -14T261 -8T230 0T205 10T187 20T172 30L162 37L130 11Q124 7 119 3T110 -4T104 -9T100 -13T96 -15T93 -16T91 -17T88 -17H82Q76 -17 73 -16T69 -14T66 -10T63 -5L90 107Q97 133 106 170Q116 211 120 219T136 228H148Q167 228 173 227T179 218Q179 216 176 200T173 168Q173 102 227 74T354 45'], - - // LATIN CAPITAL LETTER T - 0x54: [675,0,637,22,772,'498 62Q511 58 511 43Q511 10 494 1L490 0Q487 0 482 0T424 1T271 2Q201 2 157 2T94 1T72 0H70Q46 0 46 17Q49 54 62 60L66 62H137Q208 62 209 63L218 98Q227 134 244 203T278 339L347 613H300Q262 612 246 611T198 599T146 564Q128 545 114 512T91 454T79 425Q73 419 52 419Q22 419 22 434Q22 440 41 498T80 611L100 666Q105 673 111 675H434Q758 675 762 673Q772 668 772 657Q772 655 756 549T738 434Q735 419 711 419H707Q690 419 686 421Q677 425 677 434Q676 436 678 449T683 485T686 529Q686 553 679 569T662 594T631 607T593 612T544 613H502L433 340Q418 279 400 207T374 100L365 65L364 62H498'], - - // LATIN CAPITAL LETTER U - 0x55: [686,16,800,63,877,'856 686Q877 686 877 668Q877 663 873 649T867 631Q861 624 828 624Q762 622 757 617Q757 613 705 409T651 200Q620 112 540 48T328 -16Q251 -16 196 2T113 51T75 112T63 176Q63 202 70 232T117 422Q129 469 141 520T160 598L167 623Q167 624 123 624H96Q79 624 73 626T64 639Q68 678 81 684Q85 686 104 686Q155 684 268 684Q340 684 377 685T418 686Q441 686 441 668Q437 632 425 626Q421 624 371 624H322L270 415Q224 232 217 198T209 141Q209 45 336 45Q372 45 406 52T475 77T540 128T585 211L590 229Q594 247 601 274T617 336T636 409T654 482T670 547T681 595T686 618Q686 620 685 620H683Q681 621 678 621T671 622Q660 622 630 624Q616 624 610 624T598 626T589 630T587 640Q587 647 590 659Q594 677 598 681T613 686Q618 686 653 685T740 684Q775 684 801 684T840 685T856 686'], - - // LATIN CAPITAL LETTER V - 0x56: [686,16,678,62,886,'401 686Q415 680 415 668Q415 651 404 629Q398 624 356 624Q318 624 318 623Q318 620 337 508T377 284L397 174L472 285Q548 396 623 507T699 620Q698 621 652 624Q634 624 627 627T619 641Q619 648 622 658Q627 677 631 681T650 686Q654 686 686 685T766 684Q794 684 823 684T858 685Q874 685 878 683T886 671Q886 667 882 651Q877 632 873 628T850 624Q800 624 779 617Q774 617 770 613Q767 610 560 304T350 -5Q346 -9 332 -16H306H291Q270 -16 267 -2Q267 -1 260 37T238 161T210 313L156 624H116H94Q62 624 62 642Q66 678 78 684Q82 686 99 686Q144 684 246 684Q330 684 368 685L401 686'], - - // LATIN CAPITAL LETTER W - 0x57: [686,17,1093,61,1207,'111 624Q109 624 102 624T91 623Q61 623 61 640Q61 660 70 678Q78 686 98 686Q140 684 239 684Q277 684 309 684T360 685T383 686H385Q407 686 407 668Q404 634 391 626Q387 624 348 624Q307 624 307 622Q307 618 332 409Q359 198 359 195L570 532L564 576L558 622V624H522H504Q472 624 472 641Q475 678 488 684L493 686L529 685Q551 684 645 684Q716 684 753 685T795 686Q818 686 818 669Q815 632 802 626Q798 624 759 624Q718 624 718 622Q718 615 743 410Q770 199 770 196Q770 195 806 253T903 406Q1035 618 1035 619Q1025 624 968 624Q943 624 943 641Q943 648 946 659Q950 675 952 679T963 686L998 685Q1020 684 1093 684Q1113 684 1139 685T1173 686Q1207 686 1207 669Q1207 664 1204 652Q1199 631 1194 628T1164 624Q1113 622 1101 615Q1098 612 905 305Q715 -1 709 -7Q699 -17 673 -17Q645 -17 639 -8L581 441Q581 444 442 221Q331 44 314 18T288 -14Q279 -17 263 -17H254Q229 -17 227 -5Q225 2 186 311L147 620V624H111'], - - // LATIN CAPITAL LETTER X - 0x58: [686,0,947,38,953,'931 686Q953 686 953 670Q953 650 944 632Q936 624 924 624H914Q823 624 803 611Q800 609 696 503T591 396Q591 394 667 229L743 62H787H814Q846 62 846 44Q843 7 829 2Q825 0 817 0Q813 0 775 1T664 2Q590 2 551 1T508 0H507Q484 0 484 18Q484 19 488 37Q492 56 497 58T534 62L566 63Q567 64 520 169T471 274Q469 274 369 172T268 67L315 62Q320 62 328 62L335 61Q347 58 347 44Q344 10 331 2L326 0L287 1Q263 2 177 2Q95 2 78 1L53 0Q38 6 38 17Q38 40 50 57Q56 62 78 62Q169 62 188 75Q194 77 435 324L444 334L439 347Q437 351 373 492L313 624H268H246Q220 624 212 632Q210 636 210 642Q210 655 215 669T227 684Q230 686 247 686Q295 684 398 684Q438 684 472 684T527 685T551 686Q567 686 572 671Q572 667 568 651Q563 631 558 628T523 624T492 623H488L526 540Q563 457 564 457Q564 456 574 466T604 496T645 537L724 619Q716 622 677 624H673Q645 624 645 640Q645 660 654 678Q659 683 666 686L704 685Q728 684 813 684Q847 684 873 684T913 685T931 686'], - - // LATIN CAPITAL LETTER Y - 0x59: [686,0,675,40,876,'97 624H73Q40 624 40 640Q40 660 49 678Q57 686 77 686Q122 684 228 684Q269 684 304 684T360 685T385 686Q406 686 406 668Q406 662 403 653Q398 631 393 628T361 624H353Q321 624 321 623T376 491T432 360L448 377Q465 394 493 424T553 490L673 620Q662 624 630 624Q606 624 606 640Q608 678 623 684Q627 686 634 686Q638 686 671 685T755 684Q777 684 805 685T841 686Q861 686 868 683T876 669Q876 664 873 652Q868 631 863 628T829 624Q764 622 747 611Q727 590 590 441L437 275L411 170Q385 65 384 64Q384 62 429 62H453Q473 62 478 60T487 48Q488 44 484 29Q479 6 473 3Q468 0 454 0Q450 0 436 0T386 1T294 2Q220 2 181 1T138 0Q121 0 116 15Q120 54 133 60Q137 62 187 62H236L289 275L142 624H97'], - - // LATIN CAPITAL LETTER Z - 0x5A: [686,1,773,68,805,'223 430Q192 430 192 448Q192 450 225 561T261 677Q265 683 270 684Q273 686 534 686Q796 686 797 685Q805 682 805 673Q805 668 804 661T800 648T798 641Q796 637 531 352L266 67L329 66H364Q412 66 446 70T523 96T596 157Q617 186 630 220T649 273T663 297Q667 299 684 299H688Q715 299 715 281Q715 278 673 145T628 8Q626 4 617 0H348Q289 0 221 0T139 -1Q112 -1 99 -1T78 1T69 5T68 12Q68 16 71 31T77 49L84 57Q91 65 104 79T133 110T170 151T213 196L610 624H540Q533 624 514 624T488 624T467 623T443 620T422 616T398 609T373 600Q292 560 255 449Q251 436 246 433T223 430'], - - // LATIN SMALL LETTER A - 0x61: [452,9,633,38,607,'222 -8Q140 -8 89 34T38 158Q38 191 48 227Q72 329 151 390T327 452Q361 452 385 443T421 425T433 416H434L441 421Q448 426 460 430T486 435Q509 435 523 422T538 386Q538 380 522 315T488 179T467 93Q466 87 466 72Q466 42 483 42Q505 42 521 75Q531 94 541 134Q546 155 550 158T571 162H576H587Q607 162 607 148Q606 142 604 132T590 94T566 47T528 9T474 -8Q396 -8 358 40Q295 -8 222 -8ZM404 351Q383 401 324 401Q300 401 270 385T221 330Q206 296 186 220Q166 136 166 106Q166 72 184 58T228 43Q256 43 284 57T328 84T343 103Q343 106 374 228L404 351'], - - // LATIN SMALL LETTER B - 0x62: [694,8,521,45,513,'220 -8Q142 -8 94 35T45 155V167Q45 187 52 218T104 426L153 622H149Q148 622 144 622T134 623T122 624T111 624T101 624T96 625Q84 628 84 642Q84 647 88 661T94 679Q98 684 109 685T185 690Q258 694 272 694Q289 694 293 679Q293 676 263 553L232 429L244 434Q256 440 281 446T331 452Q417 452 465 407T513 285Q513 235 494 184T439 90T346 20T220 -8ZM385 337Q385 400 318 400Q269 400 226 360Q214 349 211 341T191 268Q162 149 162 113Q162 44 226 44Q269 44 299 76T339 135T362 215Q364 222 365 226Q385 303 385 337'], - - // LATIN SMALL LETTER C - 0x63: [451,8,513,40,509,'362 325Q362 344 371 361T390 386L399 394Q390 401 355 401Q276 401 231 338Q207 301 189 230T170 122Q170 43 264 43Q392 43 457 105Q472 120 480 117Q486 114 497 102T509 83Q509 79 502 70T477 47T432 21T360 1T259 -8Q194 -8 148 9T80 54T49 109T40 167Q40 280 129 365T352 451Q390 451 396 450Q448 442 473 416T499 358T477 302T421 274H417Q393 274 378 288T362 325'], - - // LATIN SMALL LETTER D - 0x64: [694,9,610,38,612,'222 -8Q140 -8 89 34T38 158Q38 220 68 285T151 391Q230 452 329 452Q382 452 416 428L422 424Q423 424 447 523L472 622H468Q467 622 463 622T453 623T441 624T430 624T420 624T415 625Q403 628 403 642Q403 647 407 661T413 679Q417 684 428 685T504 690Q577 694 591 694Q608 694 612 679L467 91Q466 87 466 72Q466 43 483 43Q518 43 541 134Q546 155 550 158T571 162H576H587Q607 162 607 148Q606 142 604 132T590 94T566 47T528 9T474 -8Q396 -8 358 40Q295 -8 222 -8ZM404 351Q383 401 324 401Q300 401 270 385T221 330Q206 296 186 220Q166 136 166 106Q166 72 184 58T228 43Q256 43 284 57T328 84T343 103Q343 106 374 228L404 351'], - - // LATIN SMALL LETTER E - 0x65: [452,8,554,42,509,'260 -8Q196 -8 151 9T83 54T52 111T42 169Q42 188 44 210Q50 240 58 266Q127 434 335 451L338 452Q342 452 345 452Q347 452 353 452T363 451Q426 451 464 424T502 352Q502 289 442 250Q381 211 222 211H184Q184 210 181 196T175 162T171 126Q171 43 264 43Q391 43 457 105Q472 120 480 117Q486 114 497 102T509 83Q509 79 502 70T477 47T432 21T360 1T260 -8ZM237 262Q427 266 427 349Q427 368 409 384T354 401Q316 401 287 388T242 354T216 314T202 278L197 263Q197 262 237 262'], - - // LATIN SMALL LETTER F - 0x66: [701,201,568,63,624,'584 444Q597 439 597 426Q597 409 586 387Q580 382 505 382H434V380Q432 378 421 314T395 162T368 30Q324 -164 203 -199Q194 -201 175 -201Q123 -201 94 -177T64 -117T88 -58T145 -33Q169 -33 184 -47T200 -84Q200 -122 166 -150L174 -151H185Q202 -148 217 -112Q222 -94 240 9Q246 40 262 132T293 303T307 382H247H210Q190 382 182 385T173 400Q177 436 189 442Q193 444 256 444H318L319 446Q337 565 355 602Q373 640 404 664T458 694T503 701Q569 701 596 676T624 617Q624 581 599 557T544 533Q520 533 504 547T488 585Q488 596 491 606T499 624T508 637T516 646L520 650Q515 650 509 651Q459 651 459 561V554L458 518L452 484Q446 448 445 447V444H584'], - - // LATIN SMALL LETTER G - 0x67: [452,202,545,0,540,'227 0Q142 0 93 43T43 166Q43 207 58 252T104 341T188 414T310 451L313 452Q316 452 319 452Q321 452 326 452T335 451Q367 451 390 443T425 425L436 416L443 421Q450 426 462 430T488 435Q511 435 525 422T540 386Q540 378 483 151T424 -82Q401 -139 335 -170T167 -202Q72 -202 36 -183T0 -125Q0 -90 24 -67T81 -43Q103 -43 119 -56T136 -99Q133 -124 114 -149L123 -150H183Q222 -150 254 -127T299 -74Q300 -71 306 -47T318 -1T324 23Q323 23 310 18T274 6T227 0ZM407 353Q406 354 404 358T400 365T395 371T388 379T381 385T371 391T360 396T346 400T329 401Q300 401 277 389T240 355T219 317T205 280Q171 148 171 109Q171 77 190 64T235 51T296 67Q322 82 337 98L345 106L407 353'], - - // LATIN SMALL LETTER H - 0x68: [694,8,668,45,642,'477 56Q477 48 479 46T490 43Q522 45 544 75T577 140Q582 156 585 159T605 162H611H622Q642 162 642 148Q642 138 632 114T602 62T550 13T478 -8Q429 -8 394 17T358 83Q358 95 395 199T433 350Q433 400 394 400H388H383Q335 400 291 363Q256 332 236 298Q233 293 202 170T169 40Q160 18 141 5T99 -8Q70 -8 58 9T45 39Q45 51 116 336L188 622H184Q183 622 179 622T169 623T157 624T146 624T136 624T131 625Q119 628 119 642Q119 647 123 661T129 679Q133 684 144 685T220 690Q293 694 307 694Q324 694 328 679Q328 672 294 540Q286 507 278 473T264 420L260 403Q260 400 269 408Q327 451 393 451H401H410Q425 451 439 450T476 442T515 424T544 391T556 337Q556 286 517 179T477 56'], - - // LATIN SMALL LETTER I - 0x69: [694,8,405,24,367,'205 615Q205 646 229 670T283 694Q310 694 324 679T339 641Q339 610 315 586T258 562Q235 562 220 577T205 615ZM24 296Q24 305 34 328T63 380T115 430T187 452Q205 452 223 448T262 435T295 406T308 360Q308 345 287 290T240 170T207 87Q202 67 202 57Q202 42 215 42Q235 42 257 64Q288 92 302 140Q307 156 310 159T330 162H336H347Q367 162 367 148Q367 140 357 117T329 65T276 14T201 -8Q158 -8 121 15T83 84Q83 104 133 229T184 358Q189 376 189 388Q189 402 177 402Q156 402 134 380Q103 352 89 304Q84 288 81 285T61 282H55H44Q24 282 24 296'], - - // LATIN SMALL LETTER J - 0x6A: [694,202,471,-12,456,'321 616Q321 648 346 671T400 694Q425 694 440 680T456 640Q456 609 431 586T376 562Q353 562 337 577T321 616ZM297 360T297 373T294 392T288 400T278 401H276Q241 399 210 372T158 303Q151 287 148 285T129 282H123H116Q102 282 97 284T92 298Q96 331 153 391T279 451Q357 451 388 422T420 354V339L371 142Q363 111 353 71T339 13T329 -30T318 -64T308 -88T296 -109T283 -125T264 -142Q190 -202 88 -202Q44 -202 16 -181T-12 -125Q-12 -93 11 -68T68 -43Q92 -43 108 -58T124 -93Q124 -121 106 -144Q101 -150 103 -150Q120 -150 147 -128T191 -64Q194 -57 242 136T294 345Q297 360 297 373'], - - // LATIN SMALL LETTER K - 0x6B: [694,8,604,45,578,'99 -8Q71 -8 58 9T45 39Q45 51 116 336L188 622H184Q183 622 179 622T169 623T157 624T146 624T136 624T131 625Q119 628 119 642Q119 647 123 661T129 679Q133 684 144 685T220 690Q293 694 307 694Q324 694 328 679Q328 674 280 482Q231 290 231 287Q231 285 234 286Q259 302 294 334T356 390T420 433T493 452Q528 452 546 427T564 364Q564 308 538 282T480 256Q456 256 441 269T425 308Q425 339 444 359T483 384L502 389Q502 395 496 398Q493 400 483 400Q465 400 449 395T409 374T373 347T323 305T268 257Q274 256 282 256Q312 251 329 247T371 232T411 202Q431 181 431 146Q431 132 427 110T422 73Q422 44 440 44H442Q462 44 478 64T502 102T514 141Q518 157 522 159T547 162H558Q578 162 578 148Q578 118 537 56T440 -7H432Q374 -7 337 21T299 94Q299 103 301 116T304 139Q304 164 281 181T235 202L212 206H211Q176 47 160 24Q137 -8 99 -8'], - - // LATIN SMALL LETTER L - 0x6C: [694,9,348,26,296,'157 -8Q138 -8 118 -4T77 11T41 42T27 91V106L156 622H152Q151 622 147 622T137 623T125 624T114 624T104 624T99 625Q87 628 87 642Q87 647 91 661T97 679Q101 684 112 685T188 690Q261 694 275 694Q292 694 296 679L151 91Q150 85 150 71Q150 42 167 42Q186 42 205 75Q216 96 225 134Q230 155 234 158T255 162H260H271Q291 162 291 148Q290 145 289 140T283 118T271 87T254 54T229 23T197 1T157 -8'], - - // LATIN SMALL LETTER M - 0x6D: [453,8,1032,24,1006,'24 296Q25 302 27 312T41 350T65 397T104 435T159 452Q203 452 234 435Q268 419 285 384L295 392Q305 401 317 410T349 429T389 445Q411 451 446 451Q560 451 592 383Q593 380 594 379L595 375L604 384Q675 452 762 452Q893 452 916 367Q918 356 918 334Q918 285 881 183T841 66Q838 43 849 43Q876 43 901 69T940 138Q945 156 949 159T969 162H975H986Q1006 162 1006 148Q1006 138 996 115T966 63T914 13T841 -8Q794 -8 758 16T721 82Q721 96 758 199T796 351Q796 401 753 401Q702 401 662 369T599 298Q597 294 567 172T533 40Q525 22 506 7T462 -8Q435 -8 422 8T409 39Q409 48 425 114T458 248T476 320Q478 330 478 348T474 377T462 393T449 399T433 400H428Q380 400 336 363Q301 332 281 298Q278 293 247 170T214 40Q206 22 187 7T143 -8T104 7T90 39Q90 47 108 124T146 274L164 347Q166 355 166 372Q166 401 149 401Q129 401 115 379T89 306Q84 288 80 285T55 282H44Q24 282 24 296'], - - // LATIN SMALL LETTER N - 0x6E: [453,8,713,24,687,'24 296Q25 302 27 312T41 350T65 397T104 435T159 452Q203 452 234 435Q268 419 285 384L293 391Q363 452 454 452Q575 446 597 367Q599 356 599 334Q599 285 562 183T522 66Q519 43 530 43Q557 43 582 69T621 138Q626 156 630 159T650 162H656H667Q687 162 687 148Q687 138 677 115T647 63T595 13T522 -8Q475 -8 439 16T402 82Q402 96 439 199T477 351Q477 401 434 401Q421 401 409 398Q341 388 285 305L278 295L247 170Q216 46 214 40Q206 22 187 7T143 -8T104 7T90 39Q90 47 108 124T146 274L164 347Q166 355 166 372Q166 401 149 401Q129 401 115 379T89 306Q84 288 80 285T55 282H44Q24 282 24 296'], - - // LATIN SMALL LETTER O - 0x6F: [452,8,585,39,576,'254 -8Q191 -8 146 9T80 54T49 111T39 169Q39 206 53 247T96 329T176 402T292 446Q317 451 336 451L344 452Q353 452 359 452Q457 452 516 408T576 279Q576 169 488 81T254 -8ZM349 400Q321 400 287 385T231 338Q206 301 188 228T170 126Q170 99 178 83Q198 44 260 44Q367 44 409 157Q419 185 432 238T445 317Q445 336 443 348Q435 372 416 384T384 398T349 400'], - - // LATIN SMALL LETTER P - 0x70: [453,194,601,-23,594,'24 296Q25 302 27 312T41 350T65 397T103 435T157 452Q235 452 273 404Q336 452 409 452Q434 452 458 448T507 432T550 402T581 354T593 285Q593 221 564 159T480 53Q401 -8 302 -8Q290 -8 279 -7T259 -3T242 3T228 9T218 14T212 18L209 20Q208 19 190 -55T171 -131T198 -132H213Q240 -132 240 -150Q237 -187 223 -192Q219 -194 212 -194Q208 -194 176 -193T95 -192Q48 -192 24 -193T-3 -194Q-11 -194 -16 -190T-22 -182T-23 -176Q-20 -142 -7 -134Q-3 -132 20 -132H44L164 354Q165 357 165 372Q165 401 148 401Q113 401 90 310Q85 289 82 286T60 282H55H44Q24 282 24 296ZM465 339Q465 373 447 387T403 401Q375 401 347 387T303 360T288 341Q288 338 257 216L227 93Q248 43 306 43Q332 43 361 59T410 115Q425 147 445 224Q465 309 465 339'], - - // LATIN SMALL LETTER Q - 0x71: [452,194,542,38,550,'38 159Q38 209 58 260T113 355T205 425T327 452Q338 452 348 451T366 449T382 444T394 440T405 434T414 429T422 423T429 418Q440 429 481 440T533 452Q540 452 545 447T550 437Q550 432 481 152Q410 -130 410 -131T437 -132H452Q479 -132 479 -150Q476 -187 462 -192Q458 -194 451 -194Q447 -194 414 -193T330 -192Q277 -192 249 -193T217 -194Q202 -194 197 -179Q197 -175 201 -159Q206 -139 211 -136T243 -132H283L319 15L307 10Q295 4 270 -2T220 -8Q134 -8 86 37T38 159ZM402 353Q402 358 395 368T369 390T324 401Q301 401 282 394T249 369T226 338T208 297T196 258T186 218Q166 141 166 107Q166 44 229 44Q265 44 294 61T337 95Q341 100 371 222T402 353'], - - // LATIN SMALL LETTER R - 0x72: [452,8,529,24,500,'24 296Q24 298 28 313T42 352T67 398T104 436T154 452Q198 452 230 437T273 404L282 411Q334 452 393 452Q441 452 470 423T500 350Q500 301 473 279T418 256Q395 256 379 270T363 308Q363 366 424 386Q424 388 420 391T405 398T385 401Q363 401 343 390Q321 380 289 341L252 192Q214 42 212 39Q190 -8 142 -8Q117 -8 103 7T89 39Q89 52 127 202T165 369Q165 402 148 402Q139 402 128 393T110 369Q100 348 90 310Q85 289 82 286T60 282H55H44Q24 282 24 296'], - - // LATIN SMALL LETTER S - 0x73: [451,8,531,57,476,'140 290Q140 311 148 336T176 388T235 433T326 451H336Q355 451 373 449T418 439T460 412T476 363Q476 333 456 311T406 289Q384 289 371 302T357 335Q357 351 364 364T379 384L386 391Q386 392 381 394T362 398T330 400Q299 400 278 393T247 373T235 352T232 335Q232 322 242 312Q258 299 315 290T403 260Q457 224 457 167Q457 152 453 134T435 90T397 43T330 7T229 -8Q133 -8 95 22T57 91Q57 127 81 152T139 177Q161 177 177 164T194 121Q189 80 153 56Q179 43 236 43Q275 43 303 52T343 75T361 101T366 124Q366 148 338 161T272 180T232 186Q187 198 164 227T140 290'], - - // LATIN SMALL LETTER T - 0x74: [643,8,415,21,387,'82 382H55Q21 382 21 399Q21 422 33 439Q39 444 93 444H144L162 517Q163 522 167 541T174 567T181 589T192 611T206 627T226 639T253 643Q276 643 291 630T306 594Q306 586 288 514Q284 499 280 481T273 454L271 445Q271 444 317 444Q322 444 331 444T345 445Q377 445 377 428Q377 408 368 390Q360 382 341 382H306H255Q182 86 182 75Q182 43 201 43H204Q242 46 279 81Q298 101 309 119T323 145T330 157T350 162H356H363Q377 162 382 160T387 146Q385 136 372 114T337 64T275 14T192 -7Q131 -7 95 19T59 90V105L128 381Q128 382 82 382'], - - // LATIN SMALL LETTER U - 0x75: [452,9,681,24,655,'189 389Q189 397 187 399T176 401Q150 399 126 372T89 304Q84 288 81 285T61 282H55H44Q24 282 24 296Q24 307 35 331T65 383T117 431T187 452Q237 452 272 427T308 362Q308 347 273 254T238 111Q238 43 291 43Q319 43 344 58T380 86T391 103T426 247T464 396Q472 414 491 429T535 444T574 429T588 397Q588 390 570 315T534 168L516 97Q514 89 514 72Q514 42 531 42Q544 42 556 56Q574 76 589 134Q594 155 598 158T619 162H624H635Q655 162 655 148Q654 142 652 132T638 94T614 47T575 9T520 -8Q509 -8 498 -7T478 -3T461 2T446 8T434 16T424 23T416 29T410 35T406 39L405 41L397 34Q347 -7 288 -7H281Q148 -7 122 78Q116 95 116 125V136Q116 174 152 273T189 389'], - - // LATIN SMALL LETTER V - 0x76: [453,8,567,24,540,'380 367Q380 397 406 425T465 453Q493 453 516 430T540 357Q540 314 524 250T467 115T373 13Q338 -8 292 -8Q218 -8 167 23T116 129Q116 178 152 275T189 388Q189 396 187 398T176 401Q148 398 125 372T89 304Q84 288 81 285T61 282H55H44Q24 282 24 296Q24 306 34 330T64 382T116 431T189 452Q231 452 269 429T308 362Q308 346 273 255T238 114Q238 43 306 43Q336 43 363 65T407 118T437 182T456 239T462 268Q462 290 417 315Q380 335 380 367'], - - // LATIN SMALL LETTER W - 0x77: [453,8,831,24,796,'636 367Q636 400 664 426T719 453Q748 453 772 431T796 357Q796 321 782 256T727 112T633 6Q604 -8 567 -8Q466 -8 415 43Q414 42 410 38T403 31T396 25T388 18T378 11T367 5T355 0T340 -4T324 -7T306 -8Q249 -8 209 5T151 40T125 84T117 129Q117 176 153 274T190 388Q190 408 158 396Q112 376 90 306Q85 288 81 285T61 282H55H44Q24 282 24 296Q24 305 34 328T63 380T114 430T187 452Q240 452 274 427T309 362Q309 346 275 255T240 117Q240 43 317 43Q325 43 333 45T347 50T359 57T369 66T377 75T383 83T388 90L390 95Q390 99 389 110T387 129Q387 139 391 167Q393 177 419 282T448 396Q456 414 475 429T519 444Q546 444 559 428T572 397Q572 384 542 265T511 114Q511 43 579 43Q608 43 633 66T673 122T699 188T714 244L718 267Q718 291 673 315Q636 335 636 367'], - - // LATIN SMALL LETTER X - 0x78: [452,9,659,43,599,'74 282H63Q43 282 43 296Q43 298 45 307T56 332T76 365T110 401T159 433Q200 451 233 451H236Q273 451 282 450Q358 437 382 400L392 410Q434 452 483 452Q538 452 568 421T599 346Q599 303 573 280T517 256Q494 256 478 270T462 308Q462 343 488 367Q501 377 520 385Q520 386 516 389T502 396T480 400T462 398Q429 383 415 341Q354 116 354 80T405 44Q449 44 485 74T535 142Q539 156 542 159T562 162H568H579Q599 162 599 148Q599 135 586 111T550 60T485 12T397 -8Q313 -8 266 35L258 44Q215 -7 161 -7H156Q99 -7 71 25T43 95Q43 143 70 165T125 188Q148 188 164 174T180 136Q180 101 154 77Q141 67 122 59Q124 54 136 49T161 43Q183 43 200 61T226 103Q287 328 287 364T236 400Q200 400 164 377T107 302Q103 288 100 285T80 282H74'], - - // LATIN SMALL LETTER Y - 0x79: [452,202,590,24,587,'206 -150Q240 -150 268 -134T314 -95T344 -48T362 -7T367 14Q339 -7 280 -7Q230 -7 195 5T144 39T122 79T115 122Q115 175 152 274T189 388Q189 396 187 398T176 401Q148 398 125 372T89 304Q84 288 81 285T61 282H55H44Q24 282 24 296Q24 306 34 329T64 381T116 431T188 452Q239 452 273 427T308 361Q308 347 273 253T237 109Q237 43 291 43T388 98Q388 99 425 246T463 396Q471 414 490 429T534 444T573 430T587 399Q587 386 537 186T483 -25Q461 -84 410 -126T296 -188Q248 -202 204 -202Q127 -202 96 -175T64 -114Q64 -82 86 -57T144 -31Q169 -31 184 -45T199 -83Q199 -89 198 -94T196 -104T193 -113T189 -120T184 -128T179 -134T173 -141T168 -147Q189 -150 206 -150'], - - // LATIN SMALL LETTER Z - 0x7A: [452,8,555,34,539,'66 -8H60Q34 -8 34 5Q34 9 42 22T70 59T115 110Q162 156 255 229T381 332L389 339H381Q348 332 298 329T212 325T172 321Q168 318 151 318H146Q116 318 116 332Q116 334 118 342Q128 374 154 402Q205 452 265 452Q304 452 352 422T426 392Q441 392 462 421T485 451T508 452H518Q539 452 539 438Q539 431 516 401T458 334Q412 289 312 210Q229 146 191 111L183 103H195Q203 103 213 104T240 107T268 110Q301 114 337 116T391 119T428 123T455 134T469 157Q473 166 495 166Q521 166 525 161Q532 156 528 141Q510 81 456 37T337 -7Q297 -7 251 22T177 52Q154 52 134 38T100 8L88 -7Q86 -8 66 -8'], - - // GREEK CAPITAL LETTER GAMMA - 0x393: [680,0,657,43,777,'257 618H231Q198 618 198 636Q202 672 214 678L219 680H763Q769 677 772 673T776 666L777 664Q777 659 766 549T751 433Q745 424 723 424Q704 424 699 427T693 441Q693 444 695 467T697 513Q697 543 689 563T670 594T636 610T592 617T534 618H516H456L455 614Q455 613 387 339T317 64Q317 62 375 62H411Q430 62 438 59T447 44Q444 7 430 2Q426 0 416 0Q409 0 359 1T231 2Q152 2 111 1T65 0Q48 0 43 15Q47 54 60 60Q64 62 113 62H162L163 66Q163 67 231 341T301 616Q301 618 257 618'], - - // GREEK CAPITAL LETTER DELTA - 0x394: [711,0,958,59,904,'65 0Q59 6 59 9T61 16Q64 20 334 357T608 698Q616 706 629 710Q630 710 634 710T644 710T656 711Q686 711 694 703Q698 699 700 693Q706 674 805 345T904 14Q904 7 894 1L479 0H65ZM630 342L567 551L232 134L462 133H693Q693 137 630 342'], - - // GREEK CAPITAL LETTER THETA - 0x398: [702,17,867,54,844,'358 -17Q218 -17 136 49T54 243Q54 298 70 356T123 474T211 582T338 663T504 702H527Q578 702 590 701Q709 688 776 622T844 441Q844 379 825 315T765 192T668 86T532 11T358 -17ZM700 474Q700 525 685 561T642 616T587 643T528 652Q390 652 301 534Q252 472 225 373T198 210Q198 160 214 125T256 71T311 44T372 36Q484 36 571 119Q639 189 669 299T700 474ZM366 428Q366 425 364 419T362 411H466L570 412L573 422Q576 437 581 441T604 445Q620 445 623 444Q636 440 636 429Q636 423 616 340T593 253Q586 243 572 243H566Q545 243 539 249Q536 251 535 253T534 258T534 263T535 270T537 277H329L326 266Q323 251 318 247T295 243Q279 243 276 244Q263 248 263 259Q263 265 283 346Q288 366 295 394Q304 431 308 438T326 445H334H338Q366 445 366 428'], - - // GREEK CAPITAL LETTER LAMDA - 0x39B: [711,0,806,44,776,'439 0Q425 6 425 18Q425 35 436 57Q442 62 485 62Q525 62 525 64L478 483Q478 484 465 463T422 394T350 277Q222 69 222 68Q223 67 224 67Q229 64 271 62Q290 62 297 59T305 45Q305 38 302 28Q297 9 293 5T274 0Q270 0 238 1T159 2Q133 2 105 2T72 1Q56 1 52 3T44 15Q44 19 48 35Q53 55 58 58T89 62Q142 64 151 73Q154 76 345 387T538 699Q550 711 570 711H580H592Q613 711 618 695Q619 692 654 379T690 63Q690 62 726 62H746Q776 62 776 44Q773 7 759 2Q755 0 747 0Q743 0 707 1T600 2Q502 2 476 1L439 0'], - - // GREEK CAPITAL LETTER XI - 0x39E: [675,0,841,62,867,'206 466Q175 466 175 484Q175 487 201 574T230 666Q235 673 241 675H547Q853 675 857 673Q867 668 867 657Q867 655 850 569T832 478Q827 466 808 466H802H795Q773 466 771 481Q771 486 775 508T779 541V549H774Q755 552 505 552Q281 551 267 548Q262 548 255 533T242 496T233 472Q228 466 206 466ZM259 255H252Q231 255 228 270Q228 275 248 355T270 439Q277 448 288 448H298Q321 448 326 440Q331 434 326 414Q326 413 486 413H647L650 424Q654 441 658 444T678 448H683H693Q702 448 705 446T714 432L694 348Q674 267 669 261Q664 255 652 255H643Q622 255 617 261Q613 265 613 272T613 283T616 289Q616 290 456 290H295L294 285Q293 280 292 275T288 265T281 257Q278 255 259 255ZM150 131Q150 124 281 123Q346 123 390 123Q640 123 664 126Q668 127 675 127Q686 131 704 198Q708 213 713 216T733 220H738Q755 220 759 218Q768 213 768 203Q768 198 741 105T710 8Q708 4 699 0H388Q77 0 73 2Q62 7 62 18Q62 27 81 115Q99 206 102 212Q106 220 120 220H129Q140 220 145 220T155 215T160 202Q160 196 159 192Q150 145 150 131'], - - // GREEK CAPITAL LETTER PI - 0x3A0: [680,0,982,43,1026,'257 618H231Q198 618 198 636Q202 672 214 678L219 680H1011Q1022 675 1026 665Q1022 626 1009 620Q1005 618 956 618H907L906 614Q906 613 838 339T768 64Q768 62 812 62H839Q871 62 871 44Q867 6 854 2L850 0L808 1Q782 2 675 2Q600 2 560 1T516 0Q499 0 494 15Q498 54 511 60Q515 62 564 62H613L614 66Q614 67 682 341T752 616Q752 618 604 618H456L455 614Q455 613 387 339T317 64Q317 62 361 62H388Q420 62 420 44Q416 6 403 2L399 0L357 1Q331 2 224 2Q149 2 109 1T65 0Q48 0 43 15Q47 54 60 60Q64 62 113 62H162L163 66Q163 67 231 341T301 616Q301 618 257 618'], - - // GREEK CAPITAL LETTER SIGMA - 0x3A3: [686,0,885,69,902,'847 430Q828 430 823 434T817 450Q817 454 817 466T818 487Q818 526 809 551T784 591T737 613T675 622T590 624H528H430L513 487Q594 351 596 345Q596 335 590 330Q583 323 418 204L250 81L363 80Q533 80 591 89T694 142Q739 185 765 252Q772 268 776 271T799 274Q816 274 820 272Q832 266 830 254Q829 250 784 130T736 7Q732 3 725 0H405Q84 0 80 2Q69 7 69 18Q69 26 75 32Q76 32 98 48T168 100T255 164L432 293Q429 300 329 465T225 637Q223 675 245 686H888Q900 680 902 671Q902 667 890 556T876 441Q871 430 847 430'], - - // GREEK CAPITAL LETTER UPSILON - 0x3A5: [703,0,671,32,802,'32 544Q32 586 91 644T229 703Q277 703 311 683T363 628T389 560T397 491V478L404 491Q455 589 526 646T677 703Q730 703 766 671T802 584Q802 551 793 541T766 531H757L736 532L732 535L729 539V549Q731 569 715 575T658 581H650Q545 581 477 443Q453 392 443 351Q441 345 424 273T389 133T371 64Q371 62 428 62H461Q483 62 492 59T501 44Q498 10 485 2L480 0L431 1Q401 2 278 2T127 1L85 0Q71 5 71 17Q71 24 74 33Q77 46 78 49T84 57T95 61T118 62H154H216Q232 126 249 193T273 287T287 345T296 388T299 416T300 452Q294 581 198 581Q154 581 132 575T106 562T99 546T86 533Q82 531 60 531L39 532Q32 537 32 544'], - - // GREEK CAPITAL LETTER PHI - 0x3A6: [686,0,767,29,737,'323 624H293Q267 624 261 626T251 639Q255 678 268 684Q272 686 293 686Q348 684 475 684Q557 684 600 685T647 686H648Q671 686 671 668Q667 632 655 626Q650 624 588 624H525L500 520Q500 519 520 518T579 507T656 480Q737 440 737 372Q737 294 648 237Q562 180 426 169L412 168L399 118Q386 66 386 65L385 62H443H479Q498 62 506 59T515 44Q511 8 499 2L494 0L447 1Q417 2 298 2Q212 2 167 1T118 0Q100 0 95 15Q99 54 112 60Q116 62 179 62H241Q242 64 254 114T266 167Q266 168 262 168Q256 168 237 170T180 181T110 205T54 249T29 316Q29 391 112 446T327 516Q345 518 349 518Q351 518 353 518L355 519Q356 520 368 570T381 623Q381 624 323 624ZM342 466Q341 467 339 467Q320 467 283 455T225 420Q181 361 181 296Q181 273 193 257T222 233T254 222T277 219L280 220Q281 220 311 342T342 466ZM583 389Q583 409 576 423T557 444T533 456T509 463T492 467H486L455 343Q444 300 437 271T428 231T426 219Q430 219 445 222T483 232T521 250Q551 269 567 310T583 389'], - - // GREEK CAPITAL LETTER PSI - 0x3A8: [686,0,714,22,790,'205 471Q205 445 196 403T186 333Q186 303 194 281T218 248T240 233T262 224L361 623Q361 624 303 624Q296 624 284 624T266 623Q232 623 232 641Q232 648 235 657Q240 678 244 682T268 686H273Q329 684 457 684Q502 684 540 684T599 685T626 686H628Q651 686 651 668Q649 633 631 624H505L407 227Q410 228 416 229T439 239T472 259T507 294T539 345Q549 365 563 416T597 498T649 538Q657 540 717 540Q725 540 737 540T755 541Q790 541 790 524Q790 512 784 497Q780 491 767 490T742 477Q736 471 731 463T722 449T715 433T710 419T705 403T701 389Q686 340 658 302T599 240T530 201T463 179T404 169L391 168L379 116Q365 67 365 63Q365 62 422 62H455Q477 62 486 59T495 44Q492 10 479 2L474 0L427 1Q397 2 278 2T131 1L90 0Q76 5 76 17Q76 24 79 33Q82 46 83 49T89 57T100 61T123 62H159H221Q247 162 247 168H244Q241 169 239 169Q202 176 178 182T123 207T74 252Q46 291 46 351Q46 375 52 404T59 454Q59 489 40 489Q32 489 27 494T22 507Q22 535 37 538Q40 540 99 540H128Q168 540 186 528T205 471'], - - // GREEK CAPITAL LETTER OMEGA - 0x3A9: [703,0,879,93,887,'162 119Q181 115 235 115L273 116Q273 133 231 222T180 345Q173 368 173 391V406V414Q173 477 214 540Q255 600 315 635Q353 661 423 682T585 703Q656 703 711 690T799 656T851 608T879 555T886 503Q886 449 860 401Q840 359 810 322T725 230T643 146Q619 117 619 116T650 115Q707 115 722 120Q730 123 750 165T775 210Q779 212 796 212Q828 212 828 196Q828 191 807 144T764 52L743 7Q740 4 740 4T733 2T717 0T686 0H632H573Q535 0 526 3T517 17Q517 44 544 103T617 243T671 341Q729 454 729 535Q729 599 686 625T583 652Q549 652 517 645T450 616T388 561T344 470T327 340Q327 304 331 237T336 135Q336 93 330 50T313 2Q308 0 208 0H142Q107 0 100 4T93 25Q93 28 93 41T95 77T96 118L100 199Q105 208 109 210T131 212Q147 212 151 210T161 199V160Q161 131 162 125V119'], - - // GREEK SMALL LETTER ALPHA - 0x3B1: [452,8,761,39,712,'39 166Q39 213 59 261T117 353T219 424T362 452Q420 452 466 433T536 384T573 325T586 269V265Q593 272 609 308T636 381Q640 397 644 399T669 402H680Q700 402 700 388Q700 379 691 351T659 276T604 188L593 173L595 153Q600 79 612 43H618Q634 45 642 51T653 64T658 71Q661 73 684 73Q712 73 712 59Q712 39 685 16T603 -7Q588 -7 575 -5T551 2T532 12T516 24T503 37T494 49T487 60T481 69L469 61Q362 -8 251 -8Q159 -8 99 36T39 166ZM260 43Q310 43 361 63T438 101T465 124Q458 240 453 277Q435 401 354 401Q291 401 245 355Q230 337 217 313Q201 279 186 216T170 126Q170 72 208 54Q230 43 260 43'], - - // GREEK SMALL LETTER BETA - 0x3B2: [701,194,660,28,638,'59 -194H49Q31 -194 28 -182Q28 -178 107 139T192 473Q212 533 248 580T324 652T395 689T450 701H461Q514 701 551 688T605 652T630 607T637 561Q637 546 634 526T611 465T556 393Q572 382 590 347T608 262Q608 146 522 69T299 -8Q279 -8 261 -6T228 2T204 13T183 26T169 37T157 48L150 56L120 -64Q113 -90 104 -128Q93 -175 89 -184T73 -194H59ZM531 592Q531 651 463 651Q399 651 341 600T253 466Q250 458 217 327T182 185Q180 176 180 159Q180 108 212 76T301 44Q330 44 354 51T393 65T423 91T444 118T459 151T468 179T475 206Q490 264 491 296Q491 313 489 326T484 345L482 350Q481 350 477 348T464 344T444 340T413 335T372 333T334 334T301 340T274 355T265 380Q265 444 397 444Q425 444 445 441T476 436L485 433Q489 433 499 458Q509 482 520 527T531 592ZM424 390Q424 393 389 393Q383 393 374 393T362 392Q348 392 333 388Q345 384 379 384Q424 384 424 390'], - - // GREEK SMALL LETTER GAMMA - 0x3B3: [451,211,590,5,617,'5 269Q5 285 19 312T57 368T124 421T215 451H241Q274 451 303 439T353 406T389 361T416 311T432 266T442 232L444 220L446 216L450 226Q473 278 513 357T561 441Q566 444 584 444H594Q617 444 617 430Q617 426 596 389T536 273T462 110L452 84L451 70Q447 12 427 -76T388 -192Q375 -211 355 -211Q339 -211 332 -198T325 -171Q325 -114 386 64L393 84V98Q393 181 371 241Q360 280 319 303T210 327Q158 327 126 317T84 296T68 272T59 258Q55 256 36 256Q23 256 18 256T9 260T5 269'], - - // GREEK SMALL LETTER DELTA - 0x3B4: [726,8,522,39,513,'216 610Q216 640 229 664T262 700T299 719T327 725Q330 725 406 709T487 690Q513 681 513 651Q513 627 494 607T450 587Q417 587 378 631Q346 663 314 663Q286 663 272 639Q271 637 271 634Q271 609 344 536L397 484Q438 448 458 410T478 313Q478 234 443 147T338 18Q298 -8 249 -8Q214 -8 180 0T113 26T60 81T39 168Q39 200 50 237T87 316T160 391T272 442L260 465Q216 553 216 610ZM348 235Q348 274 336 313T310 372L298 392Q295 391 290 390T269 380T241 359T212 323T185 267Q157 168 157 130Q157 83 186 63T255 43Q280 43 300 67Q317 89 332 138T348 235'], - - // GREEK SMALL LETTER EPSILON - 0x3B5: [461,18,529,36,481,'224 -17Q126 -17 81 22T36 112Q36 178 84 226L93 236L88 246Q79 264 79 289Q79 341 124 388Q201 461 333 461Q402 461 455 425Q480 409 481 390Q481 365 464 350T428 334Q415 334 387 352T313 370Q141 370 141 293Q141 275 146 270Q147 270 148 270T155 272Q202 291 263 291H270Q349 291 349 244Q349 195 281 183Q274 182 239 182Q201 182 184 185T137 200Q123 188 112 168T100 129T112 98T148 81T189 75T237 74H243H251Q288 74 310 75T359 86T398 112Q405 124 417 124Q426 124 432 117T439 100Q439 88 427 70T390 32T322 -3T224 -17ZM286 238Q286 240 253 240Q245 240 234 239T216 237T209 235Q209 232 250 232Q286 232 286 238'], - - // GREEK SMALL LETTER ZETA - 0x3B6: [711,202,508,48,521,'361 711Q373 711 381 703T389 683Q389 681 388 676T383 656T376 618V612H379Q385 618 429 618Q521 618 521 572Q521 551 506 534Q483 510 415 507Q385 507 371 511T336 536L326 528Q254 472 204 381T154 209Q154 190 157 177Q159 165 162 154T170 135T182 119T195 106T212 95T229 86T249 78T269 72T290 66T311 60Q385 37 388 36Q437 14 454 -36Q456 -46 456 -64Q456 -83 455 -90Q445 -132 413 -167T333 -202Q300 -202 257 -191T206 -169Q203 -164 203 -158Q203 -148 210 -140T231 -130Q239 -130 263 -139T326 -151H329Q337 -151 342 -150T352 -143T357 -123Q356 -117 355 -113T350 -104T344 -96T335 -90T324 -85T310 -80T294 -74T275 -68T254 -62Q253 -62 231 -56T205 -48T179 -39T150 -26T125 -10T100 11T80 37T62 70T53 109T48 157Q48 281 123 396T317 586V612Q319 638 320 649T325 678T338 703T361 711ZM454 564Q445 567 424 567Q407 567 398 565T387 563Q387 558 411 558Q434 558 450 562L454 564'], - - // GREEK SMALL LETTER ETA - 0x3B7: [453,211,600,24,600,'24 296Q25 302 27 312T41 350T65 397T103 435T157 452Q202 452 233 435Q267 419 284 384L294 392Q304 401 316 410T348 429T388 445Q410 451 445 451H453Q468 451 482 450T519 443T558 425T587 391T600 337V327Q600 311 538 64Q484 -158 478 -168Q457 -211 409 -211Q386 -211 372 -197T357 -161Q357 -158 415 80Q476 330 477 348Q477 366 473 377T461 393T448 399T432 400H427Q379 400 335 363Q300 332 280 298Q277 293 246 170T213 40Q205 22 186 7T142 -8T103 7T89 39Q89 49 106 117T142 260T164 351Q166 363 166 372Q166 402 148 402Q126 402 110 369Q100 350 90 310Q85 289 82 286T60 282H55H44Q24 282 24 296'], - - // GREEK SMALL LETTER THETA - 0x3B8: [702,8,562,40,554,'213 -8Q130 -8 85 50T40 200V207Q40 303 83 428Q122 535 189 608Q279 702 381 702Q410 702 437 693T492 661T537 593T554 486Q554 428 539 362T495 230T425 111T330 25T213 -8ZM433 562Q433 600 419 625T377 651Q363 651 348 644T311 619T268 557T229 453Q225 441 217 411T208 378H401Q433 500 433 562ZM161 140Q161 43 217 43Q249 43 280 74Q310 103 332 150T378 287Q385 313 385 315Q385 316 289 316H192Q191 308 183 275T169 205T161 140'], - - // GREEK SMALL LETTER IOTA - 0x3B9: [452,8,412,38,386,'161 -8Q111 -8 75 16T38 85Q38 95 48 121T80 214T123 368L124 374Q126 381 127 386T132 399T139 414T149 428T162 440T180 448T203 452Q226 452 241 439T257 404Q257 386 230 290T171 111Q157 73 157 57Q157 43 166 43Q209 43 258 69T322 144Q326 157 330 159T348 162H355H366Q386 162 386 148Q386 143 383 132T367 100T335 61Q301 27 253 10T161 -8'], - - // GREEK SMALL LETTER KAPPA - 0x3BA: [452,8,668,45,642,'258 405Q258 394 251 364T237 308T230 281T238 284T270 306T330 349Q365 377 389 394T450 427T519 444Q545 444 559 430T574 391Q574 360 551 336T491 312Q469 312 454 326T439 364Q439 372 438 372Q433 372 395 344T320 289T283 260H285Q287 260 290 260T297 259Q495 248 495 146Q495 132 491 110T486 74Q486 43 505 43Q520 43 531 53Q559 72 578 141Q582 157 586 159T611 162H622Q642 162 642 148T627 100T578 29T504 -7H495Q435 -7 399 22T363 96Q363 111 366 122T369 142Q369 155 364 165T347 182T326 193T298 200T269 204T238 207T212 210L211 206L190 123L169 40Q161 22 142 7T98 -8T59 7T45 39Q45 48 67 139T112 317L134 404Q142 424 161 438T204 452Q226 452 242 440T258 405'], - - // GREEK SMALL LETTER LAMDA - 0x3BB: [694,13,671,40,652,'95 -13Q70 -13 55 4T40 41Q40 65 61 88Q65 92 210 207T357 322L235 602Q217 640 185 643Q182 643 178 644T173 645Q161 651 161 666Q161 677 167 684T181 692Q189 694 212 694Q335 694 358 660Q362 653 500 340T647 18Q652 10 652 6Q652 -8 622 -8H589H538L526 -5Q506 1 500 8Q494 16 444 128Q442 133 440 138L387 259L265 134Q156 20 137 4T95 -13'], - - // GREEK SMALL LETTER MU - 0x3BC: [452,211,708,34,682,'294 -8Q265 -8 244 -5T213 1T201 4Q200 4 192 -32T172 -111T155 -168Q134 -211 86 -211Q62 -211 48 -196T34 -158Q37 -144 103 123T174 404Q182 424 201 438T244 452Q271 452 284 436T298 404Q298 392 267 269T235 114Q235 43 305 43Q342 43 375 68T418 110Q420 112 455 253T492 397Q514 444 562 444Q587 444 601 429T615 397Q615 387 599 320T563 178T542 93Q540 81 540 72Q540 42 558 42Q580 42 596 75Q606 94 616 134Q621 155 624 158T646 162H651H662Q682 162 682 148Q681 142 679 132T665 94T641 47T602 9T548 -8Q523 -8 502 -3T468 11T446 27T432 40L429 46Q367 -8 294 -8'], - - // GREEK SMALL LETTER NU - 0x3BD: [452,2,577,38,608,'88 382Q70 382 65 385T59 402T64 427T78 443Q79 444 157 448T247 452Q256 452 261 448T266 440L267 437Q267 432 223 252L177 71L192 77Q293 117 371 199T480 388Q489 424 511 438T556 452Q579 452 593 438T608 402Q608 378 593 340T540 251T446 152T299 62T96 -1Q91 -2 78 -2Q38 -2 38 15Q38 22 82 198L127 379Q124 382 88 382'], - - // GREEK SMALL LETTER XI - 0x3BE: [711,201,508,23,490,'287 648Q291 671 293 680T305 700T329 711Q339 711 347 705T356 687Q356 680 351 653T345 619Q345 615 346 615Q358 618 398 618Q490 618 490 572Q490 553 476 536T434 512Q411 508 378 508H366Q332 508 306 534L298 525Q271 496 254 456T237 375Q237 336 244 336Q272 346 319 346H325Q354 346 372 344T406 331T422 300Q422 252 350 238Q332 236 303 236Q286 236 269 238T240 242T218 247T202 252L196 254Q191 254 174 237T141 191T124 139Q124 108 151 92T267 46Q285 40 295 37Q308 33 332 25T366 13T392 3T415 -8T432 -20T445 -36T451 -55T454 -80Q454 -118 427 -153T358 -199Q349 -201 327 -201Q313 -201 298 -200T271 -196T246 -191T226 -185T210 -180T200 -176L196 -174Q187 -170 187 -158T196 -138T216 -130Q217 -130 254 -140T329 -151Q349 -151 349 -135Q349 -127 340 -122T293 -104Q260 -93 238 -85Q130 -48 115 -41Q71 -19 47 15T23 88Q23 126 48 179T130 277L144 288L136 297Q99 336 99 390Q99 456 148 514T285 602V619Q285 624 286 635T287 648ZM355 563Q362 560 376 558Q424 558 423 564Q405 567 390 567Q369 567 355 563ZM279 292Q297 287 315 287Q355 287 355 293Q355 296 321 296Q316 296 308 296L301 295Q295 295 289 294L279 292'], - - // GREEK SMALL LETTER OMICRON - 0x3BF: [452,8,585,39,576,'254 -8Q191 -8 146 9T80 54T49 111T39 169Q39 206 53 247T96 329T176 402T292 446Q317 451 336 451L344 452Q353 452 359 452Q457 452 516 408T576 279Q576 169 488 81T254 -8ZM349 400Q321 400 287 385T231 338Q206 301 188 228T170 126Q170 99 178 83Q198 44 260 44Q367 44 409 157Q419 185 432 238T445 317Q445 336 443 348Q435 372 416 384T384 398T349 400'], - - // GREEK SMALL LETTER PI - 0x3C0: [444,8,682,23,674,'55 289H43Q23 289 23 303Q23 308 33 322Q116 434 199 443Q200 444 418 444Q591 444 617 444T652 439Q674 426 674 400Q674 378 661 360T625 335Q621 334 549 333H479L477 321Q476 312 476 279Q476 219 491 174T521 104T536 65Q536 38 511 15T457 -8Q403 -8 386 94Q384 110 384 139Q384 181 391 229T406 304L413 331Q413 333 365 333H316L315 329Q315 328 312 314T301 272T288 220Q274 167 258 103Q244 49 240 38T228 18Q225 16 224 14Q200 -8 172 -8Q146 -8 132 7T118 44Q118 54 121 61Q122 65 142 102T190 195T235 293Q250 329 250 333Q177 333 166 332Q115 328 88 301L77 290L55 289'], - - // GREEK SMALL LETTER RHO - 0x3C1: [451,211,612,34,603,'307 -8Q277 -8 251 0T215 14L205 20Q203 18 193 -25T171 -114T155 -168Q134 -211 87 -211Q64 -211 49 -198T34 -162Q34 -158 137 254Q153 299 179 334T232 390T277 419T311 434Q357 451 403 451Q435 451 455 449T506 435T560 400Q603 357 603 285Q603 172 520 82T307 -8ZM474 343Q474 364 458 382T409 400H406Q339 400 299 341Q281 313 264 257Q261 248 242 170T222 89Q222 84 230 74T260 54T308 43Q334 43 365 57T417 110Q437 145 456 228Q474 298 474 332V343'], - - // GREEK SMALL LETTER FINAL SIGMA - 0x3C2: [451,105,424,33,457,'33 209Q33 277 80 334T195 421T330 451H344Q410 451 439 429Q457 417 457 402Q457 386 445 375T420 363Q415 363 406 368T383 383T354 398Q347 400 330 400Q256 400 196 361T135 265V257Q135 242 147 225T174 199L358 107Q400 77 400 28T362 -63T271 -105Q254 -105 229 -99T195 -86Q188 -82 188 -71Q188 -56 197 -50T216 -44Q225 -44 237 -48T270 -53H282Q293 -44 293 -31Q293 -19 283 -10Q278 -4 200 33T115 76Q77 98 55 133T33 209'], - - // GREEK SMALL LETTER SIGMA - 0x3C3: [445,8,686,35,677,'35 151Q35 190 51 236T99 327T184 404T306 443Q307 443 316 443T342 443T378 444T425 444T476 444Q606 444 626 444T655 439Q677 426 677 400Q677 358 639 340Q625 333 563 333Q510 333 510 331Q518 319 518 272Q518 155 437 74T226 -8Q123 -8 79 41T35 151ZM396 278Q396 314 375 323T305 332Q249 332 222 310T180 243Q171 219 162 178T153 116V110Q153 43 234 43Q347 43 382 199Q383 203 383 204Q396 255 396 278'], - - // GREEK SMALL LETTER TAU - 0x3C4: [444,13,521,23,610,'55 289H43Q23 289 23 303Q23 308 33 322Q116 434 199 443Q200 444 386 444Q571 444 577 442Q588 441 599 432T610 402Q610 359 572 340Q561 335 547 334T452 333H353V331Q352 330 342 261T320 119T306 40Q300 18 281 3Q257 -13 233 -13Q210 -13 196 0T181 35Q181 44 182 48Q183 53 229 187T279 331Q279 333 228 333H209Q163 333 136 328T88 301L77 290L55 289'], - - // GREEK SMALL LETTER UPSILON - 0x3C5: [453,9,631,24,604,'189 388Q189 396 187 398T176 401Q144 399 122 369T89 304Q84 288 81 285T61 282H55H44Q24 282 24 296Q24 306 34 330T64 382T116 431T188 452Q232 452 270 430T308 361Q308 345 275 258T241 123Q241 44 336 44H344Q380 44 415 73T474 140T511 214T526 267Q526 280 513 292Q505 301 486 311T456 333T444 367Q444 400 471 426T529 453Q555 453 579 431T604 358Q604 327 592 271T557 172Q550 157 541 142T510 97T464 47T404 9T328 -8Q264 -8 219 5T154 41T125 85T117 131Q117 182 153 277T189 388'], - - // GREEK SMALL LETTER PHI - 0x3C6: [452,216,747,52,703,'238 4Q230 5 218 8T174 26T118 58T73 112T53 190Q53 219 60 246Q77 313 103 362T143 426T163 443Q165 444 186 444Q217 444 217 432Q217 425 188 392Q157 351 137 291T116 206Q116 127 263 109L276 107L288 139Q347 304 414 378T566 452Q621 449 662 412T703 286Q698 167 598 82T357 -8H332V-11Q332 -12 327 -46T317 -116T310 -157Q306 -180 286 -198T234 -216Q211 -216 197 -203T183 -168Q183 -160 184 -155Q184 -152 198 -112T225 -34T238 4ZM637 260Q637 303 607 322T541 341Q502 341 466 319T405 264Q368 218 356 159Q348 111 348 104Q348 103 361 103Q502 103 569 152T637 260'], - - // GREEK SMALL LETTER CHI - 0x3C7: [452,201,718,32,685,'58 -194Q32 -194 32 -164Q32 -153 46 -139L175 -13Q296 104 296 106Q271 232 226 308Q165 401 141 401Q128 401 117 390T100 365Q94 350 91 349T69 346H45Q35 348 35 359Q35 380 62 411T133 450Q143 452 165 452Q286 452 329 402Q347 379 366 333T394 254T404 215Q404 213 405 213Q405 212 420 227T463 268T520 324Q637 437 640 438Q647 444 661 444Q667 444 676 438T685 419Q685 405 670 389T549 271L420 145Q433 85 444 53Q466 -25 509 -88T575 -151Q590 -151 600 -140T617 -114T626 -98Q629 -96 650 -96H655Q681 -96 681 -108Q681 -114 679 -119Q670 -148 646 -169T591 -199Q581 -201 550 -201Q422 -201 381 -143Q345 -88 316 20L311 39L230 -40Q144 -126 114 -153Q85 -182 77 -188T58 -194'], - - // GREEK SMALL LETTER PSI - 0x3C8: [695,202,758,24,732,'244 141Q244 117 254 98T277 70T305 55T329 48T342 47L344 48L424 366Q501 678 505 686Q508 691 512 692T533 694T555 693T562 688T565 683Q565 678 486 362T406 45Q406 43 415 43Q467 49 514 78T590 143T636 213T653 266Q653 282 641 293T613 311T585 332T572 367Q572 397 598 425T657 453Q684 453 708 430T732 358Q732 330 723 287T706 225Q671 124 578 58T401 -8H393L370 -101Q346 -196 345 -197Q340 -202 316 -202H306Q286 -202 286 -188Q286 -187 296 -144T318 -57T331 -8Q331 -6 328 -6Q290 -6 233 11T148 62Q119 97 119 146Q119 181 154 275T190 388Q190 401 181 401Q154 401 129 375T90 306Q85 288 81 285T61 282H55H44Q24 282 24 296Q24 306 34 329T64 381T116 431T189 452Q237 452 273 428T309 362Q309 343 277 260T244 141'], - - // GREEK SMALL LETTER OMEGA - 0x3C9: [453,8,718,24,691,'532 367Q532 399 559 426T618 453Q645 453 668 430T691 357Q691 319 677 261T649 171Q640 149 626 125T586 68T521 14T438 -7Q401 -7 372 7T333 30T311 57Q246 -8 165 -8Q119 -8 82 19T30 102Q24 126 24 163V178Q24 210 37 255Q61 346 118 424Q141 451 161 451Q174 451 184 443T194 419Q194 402 179 387Q91 273 91 206Q91 159 122 138T189 117T281 145V173Q283 223 294 253Q304 276 323 289T364 303Q386 303 400 287T415 250Q415 219 385 157L378 144Q378 142 388 136T419 124T462 117Q522 117 566 165T610 255Q610 288 561 320Q532 337 532 367'], - - // GREEK THETA SYMBOL - 0x3D1: [701,8,692,24,656,'114 132Q114 153 140 253T166 372Q166 402 148 402Q126 402 110 369Q100 350 90 310Q85 289 82 286T60 282H55H44Q24 282 24 296Q25 302 27 312T41 350T65 397T104 435T158 452Q184 452 211 445T263 414T288 354V339L265 245Q237 134 237 118V107V102Q237 87 239 77T257 56T300 43Q395 43 455 254Q479 346 479 347L460 354Q294 408 294 528Q294 606 350 653T464 701Q536 701 579 659Q634 601 634 491Q634 468 630 438T623 388L620 370Q624 370 631 369T647 364T656 352Q656 347 653 335Q647 317 642 316Q640 315 637 315Q635 315 619 317Q606 319 605 316Q605 315 603 308Q587 248 550 177T457 57Q379 -8 293 -8Q192 -8 153 23T114 116V132ZM519 566Q519 600 507 625T464 651Q425 651 391 617T356 529Q356 501 370 478T404 441T443 417T477 404L491 400Q493 400 499 428T512 497T519 566'], - - // GREEK PHI SYMBOL - 0x3D5: [694,202,712,50,693,'274 -7Q232 -4 195 7T125 38T71 94T51 176V190Q51 213 60 242T95 307T156 373T255 425T393 451L397 452L427 568Q434 597 443 636Q452 677 456 685T472 694H486H495Q517 694 517 680L514 665Q510 650 503 621T489 564L460 451H469Q527 447 574 430T657 370T693 266Q693 163 599 82T350 -7H346L322 -100Q301 -190 295 -197Q291 -202 283 -202H269H258Q238 -202 238 -188Q238 -186 260 -96L283 -7H274ZM449 400Q448 400 404 225T359 47T366 45Q464 55 516 119Q542 149 558 199T575 295Q575 387 462 398L449 400ZM384 398Q384 399 381 399Q350 399 298 378T214 308Q168 236 168 149Q168 68 259 49Q282 44 294 44H295L384 398'], - - // GREEK PI SYMBOL - 0x3D6: [444,8,975,23,961,'55 289H43Q23 289 23 303Q23 308 33 322Q116 434 199 443Q200 444 562 444Q922 444 928 442Q961 434 961 400Q961 376 944 355T886 333H870Q872 322 872 295V279Q872 230 842 165T751 46T618 -8Q581 -8 554 6T513 45T494 84T484 119Q484 121 478 114Q477 113 476 111Q384 -7 268 -7H265Q251 -7 237 -4T199 11T162 54T147 132Q147 149 149 166T155 198T165 229T176 256T189 281T200 301T211 319T220 333H199Q120 333 88 301L77 290L55 289ZM639 103Q674 103 712 122T780 188T811 295Q811 318 808 330V333H289Q274 318 244 263T214 169Q214 133 236 118T288 103Q351 103 412 153T494 278Q497 290 502 292T529 295Q546 295 551 293T556 283Q556 281 553 260T550 218Q550 153 576 128T639 103'], - - // GREEK RHO SYMBOL - 0x3F1: [451,194,612,75,603,'371 -168Q357 -168 323 -171T245 -175Q143 -175 109 -150T75 -66Q75 -5 100 108T137 254Q153 299 179 334T232 390T277 419T311 434Q357 451 403 451Q435 451 455 449T506 435T560 400Q603 357 603 282Q603 213 569 148T465 38T304 -8Q273 -8 247 -2T204 14T176 31T159 46T152 53Q152 52 148 27T144 -16Q144 -36 150 -44T189 -58T293 -64Q405 -65 432 -75Q466 -88 466 -127Q466 -140 459 -172Q455 -188 451 -191T426 -194H420Q405 -194 400 -191T395 -176Q396 -170 394 -169T378 -168Q373 -168 371 -168ZM236 116Q236 77 258 60T311 43Q369 43 407 94Q429 123 451 206T474 331Q474 400 409 400H406Q339 400 299 341Q276 305 256 227T236 116'], - - // GREEK LUNATE EPSILON SYMBOL - 0x3F5: [444,7,483,44,450,'415 89Q423 89 429 74T436 46Q436 43 434 39Q432 36 420 29T380 11T322 -5Q311 -7 281 -7Q216 -7 168 10T94 54T56 110T44 167V181Q44 262 94 329Q104 343 119 357T162 391T234 425T327 443Q328 443 348 443T383 444Q434 444 442 438Q450 430 450 416Q446 392 424 383L376 382Q306 381 278 369Q230 349 208 294Q199 274 199 268Q199 267 291 267Q305 267 325 267T353 268Q383 268 394 263T406 241Q406 214 380 206Q375 205 279 205T183 203Q174 176 174 140Q174 87 208 65T292 43Q295 43 300 43T307 44Q337 49 372 69T415 89'], - - // INCREMENT - 0x2206: [711,0,958,59,904,''] -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Math/BoldItalic/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Math/Italic/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Math/Italic/Main.js deleted file mode 100644 index 61be7e1348..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Math/Italic/Main.js +++ /dev/null @@ -1,394 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Math/Italic/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Math-italic'] = { - directory: 'Math/Italic', - family: 'MathJax_Math', - id: 'MJMATHI', - style: 'italic', - skew: { - 0x41: 0.139, - 0x42: 0.0833, - 0x43: 0.0833, - 0x44: 0.0556, - 0x45: 0.0833, - 0x46: 0.0833, - 0x47: 0.0833, - 0x48: 0.0556, - 0x49: 0.111, - 0x4A: 0.167, - 0x4B: 0.0556, - 0x4C: 0.0278, - 0x4D: 0.0833, - 0x4E: 0.0833, - 0x4F: 0.0833, - 0x50: 0.0833, - 0x51: 0.0833, - 0x52: 0.0833, - 0x53: 0.0833, - 0x54: 0.0833, - 0x55: 0.0278, - 0x58: 0.0833, - 0x5A: 0.0833, - 0x63: 0.0556, - 0x64: 0.167, - 0x65: 0.0556, - 0x66: 0.167, - 0x67: 0.0278, - 0x68: -0.0278, - 0x6C: 0.0833, - 0x6F: 0.0556, - 0x70: 0.0833, - 0x71: 0.0833, - 0x72: 0.0556, - 0x73: 0.0556, - 0x74: 0.0833, - 0x75: 0.0278, - 0x76: 0.0278, - 0x77: 0.0833, - 0x78: 0.0278, - 0x79: 0.0556, - 0x7A: 0.0556, - 0x393: 0.0833, - 0x394: 0.167, - 0x398: 0.0833, - 0x39B: 0.167, - 0x39E: 0.0833, - 0x3A0: 0.0556, - 0x3A3: 0.0833, - 0x3A5: 0.0556, - 0x3A6: 0.0833, - 0x3A8: 0.0556, - 0x3A9: 0.0833, - 0x3B1: 0.0278, - 0x3B2: 0.0833, - 0x3B4: 0.0556, - 0x3B5: 0.0833, - 0x3B6: 0.0833, - 0x3B7: 0.0556, - 0x3B8: 0.0833, - 0x3B9: 0.0556, - 0x3BC: 0.0278, - 0x3BD: 0.0278, - 0x3BE: 0.111, - 0x3BF: 0.0556, - 0x3C1: 0.0833, - 0x3C2: 0.0833, - 0x3C4: 0.0278, - 0x3C5: 0.0278, - 0x3C6: 0.0833, - 0x3C7: 0.0556, - 0x3C8: 0.111, - 0x3D1: 0.0833, - 0x3D5: 0.0833, - 0x3F1: 0.0833, - 0x3F5: 0.0556 - }, - - // SPACE - 0x20: [0,0,250,0,0,''], - - // SOLIDUS - 0x2F: [716,215,778,139,638,'166 -215T159 -215T147 -212T141 -204T139 -197Q139 -190 144 -183Q157 -157 378 274T602 707Q605 716 618 716Q625 716 630 712T636 703T638 696Q638 691 406 241T170 -212Q166 -215 159 -215'], - - // LATIN CAPITAL LETTER A - 0x41: [716,0,750,35,726,'208 74Q208 50 254 46Q272 46 272 35Q272 34 270 22Q267 8 264 4T251 0Q249 0 239 0T205 1T141 2Q70 2 50 0H42Q35 7 35 11Q37 38 48 46H62Q132 49 164 96Q170 102 345 401T523 704Q530 716 547 716H555H572Q578 707 578 706L606 383Q634 60 636 57Q641 46 701 46Q726 46 726 36Q726 34 723 22Q720 7 718 4T704 0Q701 0 690 0T651 1T578 2Q484 2 455 0H443Q437 6 437 9T439 27Q443 40 445 43L449 46H469Q523 49 533 63L521 213H283L249 155Q208 86 208 74ZM516 260Q516 271 504 416T490 562L463 519Q447 492 400 412L310 260L413 259Q516 259 516 260'], - - // LATIN CAPITAL LETTER B - 0x42: [683,0,759,35,756,'231 637Q204 637 199 638T194 649Q194 676 205 682Q206 683 335 683Q594 683 608 681Q671 671 713 636T756 544Q756 480 698 429T565 360L555 357Q619 348 660 311T702 219Q702 146 630 78T453 1Q446 0 242 0Q42 0 39 2Q35 5 35 10Q35 17 37 24Q42 43 47 45Q51 46 62 46H68Q95 46 128 49Q142 52 147 61Q150 65 219 339T288 628Q288 635 231 637ZM649 544Q649 574 634 600T585 634Q578 636 493 637Q473 637 451 637T416 636H403Q388 635 384 626Q382 622 352 506Q352 503 351 500L320 374H401Q482 374 494 376Q554 386 601 434T649 544ZM595 229Q595 273 572 302T512 336Q506 337 429 337Q311 337 310 336Q310 334 293 263T258 122L240 52Q240 48 252 48T333 46Q422 46 429 47Q491 54 543 105T595 229'], - - // LATIN CAPITAL LETTER C - 0x43: [705,22,715,50,760,'50 252Q50 367 117 473T286 641T490 704Q580 704 633 653Q642 643 648 636T656 626L657 623Q660 623 684 649Q691 655 699 663T715 679T725 690L740 705H746Q760 705 760 698Q760 694 728 561Q692 422 692 421Q690 416 687 415T669 413H653Q647 419 647 422Q647 423 648 429T650 449T651 481Q651 552 619 605T510 659Q484 659 454 652T382 628T299 572T226 479Q194 422 175 346T156 222Q156 108 232 58Q280 24 350 24Q441 24 512 92T606 240Q610 253 612 255T628 257Q648 257 648 248Q648 243 647 239Q618 132 523 55T319 -22Q206 -22 128 53T50 252'], - - // LATIN CAPITAL LETTER D - 0x44: [683,0,828,33,803,'287 628Q287 635 230 637Q207 637 200 638T193 647Q193 655 197 667T204 682Q206 683 403 683Q570 682 590 682T630 676Q702 659 752 597T803 431Q803 275 696 151T444 3L430 1L236 0H125H72Q48 0 41 2T33 11Q33 13 36 25Q40 41 44 43T67 46Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628ZM703 469Q703 507 692 537T666 584T629 613T590 629T555 636Q553 636 541 636T512 636T479 637H436Q392 637 386 627Q384 623 313 339T242 52Q242 48 253 48T330 47Q335 47 349 47T373 46Q499 46 581 128Q617 164 640 212T683 339T703 469'], - - // LATIN CAPITAL LETTER E - 0x45: [680,0,738,31,764,'492 213Q472 213 472 226Q472 230 477 250T482 285Q482 316 461 323T364 330H312Q311 328 277 192T243 52Q243 48 254 48T334 46Q428 46 458 48T518 61Q567 77 599 117T670 248Q680 270 683 272Q690 274 698 274Q718 274 718 261Q613 7 608 2Q605 0 322 0H133Q31 0 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 659Q197 676 203 680H757Q764 676 764 669Q764 664 751 557T737 447Q735 440 717 440H705Q698 445 698 453L701 476Q704 500 704 528Q704 558 697 578T678 609T643 625T596 632T532 634H485Q397 633 392 631Q388 629 386 622Q385 619 355 499T324 377Q347 376 372 376H398Q464 376 489 391T534 472Q538 488 540 490T557 493Q562 493 565 493T570 492T572 491T574 487T577 483L544 351Q511 218 508 216Q505 213 492 213'], - - // LATIN CAPITAL LETTER F - 0x46: [680,0,643,31,749,'48 1Q31 1 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 659Q197 676 203 680H742Q749 676 749 669Q749 664 736 557T722 447Q720 440 702 440H690Q683 445 683 453Q683 454 686 477T689 530Q689 560 682 579T663 610T626 626T575 633T503 634H480Q398 633 393 631Q388 629 386 623Q385 622 352 492L320 363H375Q378 363 398 363T426 364T448 367T472 374T489 386Q502 398 511 419T524 457T529 475Q532 480 548 480H560Q567 475 567 470Q567 467 536 339T502 207Q500 200 482 200H470Q463 206 463 212Q463 215 468 234T473 274Q473 303 453 310T364 317H309L277 190Q245 66 245 60Q245 46 334 46H359Q365 40 365 39T363 19Q359 6 353 0H336Q295 2 185 2Q120 2 86 2T48 1'], - - // LATIN CAPITAL LETTER G - 0x47: [705,22,786,50,760,'50 252Q50 367 117 473T286 641T490 704Q580 704 633 653Q642 643 648 636T656 626L657 623Q660 623 684 649Q691 655 699 663T715 679T725 690L740 705H746Q760 705 760 698Q760 694 728 561Q692 422 692 421Q690 416 687 415T669 413H653Q647 419 647 422Q647 423 648 429T650 449T651 481Q651 552 619 605T510 659Q492 659 471 656T418 643T357 615T294 567T236 496T189 394T158 260Q156 242 156 221Q156 173 170 136T206 79T256 45T308 28T353 24Q407 24 452 47T514 106Q517 114 529 161T541 214Q541 222 528 224T468 227H431Q425 233 425 235T427 254Q431 267 437 273H454Q494 271 594 271Q634 271 659 271T695 272T707 272Q721 272 721 263Q721 261 719 249Q714 230 709 228Q706 227 694 227Q674 227 653 224Q646 221 643 215T629 164Q620 131 614 108Q589 6 586 3Q584 1 581 1Q571 1 553 21T530 52Q530 53 528 52T522 47Q448 -22 322 -22Q201 -22 126 55T50 252'], - - // LATIN CAPITAL LETTER H - 0x48: [683,0,831,31,888,'228 637Q194 637 192 641Q191 643 191 649Q191 673 202 682Q204 683 219 683Q260 681 355 681Q389 681 418 681T463 682T483 682Q499 682 499 672Q499 670 497 658Q492 641 487 638H485Q483 638 480 638T473 638T464 637T455 637Q416 636 405 634T387 623Q384 619 355 500Q348 474 340 442T328 395L324 380Q324 378 469 378H614L615 381Q615 384 646 504Q674 619 674 627T617 637Q594 637 587 639T580 648Q580 650 582 660Q586 677 588 679T604 682Q609 682 646 681T740 680Q802 680 835 681T871 682Q888 682 888 672Q888 645 876 638H874Q872 638 869 638T862 638T853 637T844 637Q805 636 794 634T776 623Q773 618 704 340T634 58Q634 51 638 51Q646 48 692 46H723Q729 38 729 37T726 19Q722 6 716 0H701Q664 2 567 2Q533 2 504 2T458 2T437 1Q420 1 420 10Q420 15 423 24Q428 43 433 45Q437 46 448 46H454Q481 46 514 49Q520 50 522 50T528 55T534 64T540 82T547 110T558 153Q565 181 569 198Q602 330 602 331T457 332H312L279 197Q245 63 245 58Q245 51 253 49T303 46H334Q340 38 340 37T337 19Q333 6 327 0H312Q275 2 178 2Q144 2 115 2T69 2T48 1Q31 1 31 10Q31 12 34 24Q39 43 44 45Q48 46 59 46H65Q92 46 125 49Q139 52 144 61Q147 65 216 339T285 628Q285 635 228 637'], - - // LATIN CAPITAL LETTER I - 0x49: [683,0,440,26,504,'43 1Q26 1 26 10Q26 12 29 24Q34 43 39 45Q42 46 54 46H60Q120 46 136 53Q137 53 138 54Q143 56 149 77T198 273Q210 318 216 344Q286 624 286 626Q284 630 284 631Q274 637 213 637H193Q184 643 189 662Q193 677 195 680T209 683H213Q285 681 359 681Q481 681 487 683H497Q504 676 504 672T501 655T494 639Q491 637 471 637Q440 637 407 634Q393 631 388 623Q381 609 337 432Q326 385 315 341Q245 65 245 59Q245 52 255 50T307 46H339Q345 38 345 37T342 19Q338 6 332 0H316Q279 2 179 2Q143 2 113 2T65 2T43 1'], - - // LATIN CAPITAL LETTER J - 0x4A: [683,22,555,57,633,'447 625Q447 637 354 637H329Q323 642 323 645T325 664Q329 677 335 683H352Q393 681 498 681Q541 681 568 681T605 682T619 682Q633 682 633 672Q633 670 630 658Q626 642 623 640T604 637Q552 637 545 623Q541 610 483 376Q420 128 419 127Q397 64 333 21T195 -22Q137 -22 97 8T57 88Q57 130 80 152T132 174Q177 174 182 130Q182 98 164 80T123 56Q115 54 115 53T122 44Q148 15 197 15Q235 15 271 47T324 130Q328 142 387 380T447 625'], - - // LATIN CAPITAL LETTER K - 0x4B: [683,0,849,31,889,'285 628Q285 635 228 637Q205 637 198 638T191 647Q191 649 193 661Q199 681 203 682Q205 683 214 683H219Q260 681 355 681Q389 681 418 681T463 682T483 682Q500 682 500 674Q500 669 497 660Q496 658 496 654T495 648T493 644T490 641T486 639T479 638T470 637T456 637Q416 636 405 634T387 623L306 305Q307 305 490 449T678 597Q692 611 692 620Q692 635 667 637Q651 637 651 648Q651 650 654 662T659 677Q662 682 676 682Q680 682 711 681T791 680Q814 680 839 681T869 682Q889 682 889 672Q889 650 881 642Q878 637 862 637Q787 632 726 586Q710 576 656 534T556 455L509 418L518 396Q527 374 546 329T581 244Q656 67 661 61Q663 59 666 57Q680 47 717 46H738Q744 38 744 37T741 19Q737 6 731 0H720Q680 3 625 3Q503 3 488 0H478Q472 6 472 9T474 27Q478 40 480 43T491 46H494Q544 46 544 71Q544 75 517 141T485 216L427 354L359 301L291 248L268 155Q245 63 245 58Q245 51 253 49T303 46H334Q340 37 340 35Q340 19 333 5Q328 0 317 0Q314 0 280 1T180 2Q118 2 85 2T49 1Q31 1 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q147 65 216 339T285 628'], - - // LATIN CAPITAL LETTER L - 0x4C: [683,2,681,32,647,'228 637Q194 637 192 641Q191 643 191 649Q191 673 202 682Q204 683 217 683Q271 680 344 680Q485 680 506 683H518Q524 677 524 674T522 656Q517 641 513 637H475Q406 636 394 628Q387 624 380 600T313 336Q297 271 279 198T252 88L243 52Q243 48 252 48T311 46H328Q360 46 379 47T428 54T478 72T522 106T564 161Q580 191 594 228T611 270Q616 273 628 273H641Q647 264 647 262T627 203T583 83T557 9Q555 4 553 3T537 0T494 -1Q483 -1 418 -1T294 0H116Q32 0 32 10Q32 17 34 24Q39 43 44 45Q48 46 59 46H65Q92 46 125 49Q139 52 144 61Q147 65 216 339T285 628Q285 635 228 637'], - - // LATIN CAPITAL LETTER M - 0x4D: [684,0,970,35,1051,'289 629Q289 635 232 637Q208 637 201 638T194 648Q194 649 196 659Q197 662 198 666T199 671T201 676T203 679T207 681T212 683T220 683T232 684Q238 684 262 684T307 683Q386 683 398 683T414 678Q415 674 451 396L487 117L510 154Q534 190 574 254T662 394Q837 673 839 675Q840 676 842 678T846 681L852 683H948Q965 683 988 683T1017 684Q1051 684 1051 673Q1051 668 1048 656T1045 643Q1041 637 1008 637Q968 636 957 634T939 623Q936 618 867 340T797 59Q797 55 798 54T805 50T822 48T855 46H886Q892 37 892 35Q892 19 885 5Q880 0 869 0Q864 0 828 1T736 2Q675 2 644 2T609 1Q592 1 592 11Q592 13 594 25Q598 41 602 43T625 46Q652 46 685 49Q699 52 704 61Q706 65 742 207T813 490T848 631L654 322Q458 10 453 5Q451 4 449 3Q444 0 433 0Q418 0 415 7Q413 11 374 317L335 624L267 354Q200 88 200 79Q206 46 272 46H282Q288 41 289 37T286 19Q282 3 278 1Q274 0 267 0Q265 0 255 0T221 1T157 2Q127 2 95 1T58 0Q43 0 39 2T35 11Q35 13 38 25T43 40Q45 46 65 46Q135 46 154 86Q158 92 223 354T289 629'], - - // LATIN CAPITAL LETTER N - 0x4E: [683,0,803,31,888,'234 637Q231 637 226 637Q201 637 196 638T191 649Q191 676 202 682Q204 683 299 683Q376 683 387 683T401 677Q612 181 616 168L670 381Q723 592 723 606Q723 633 659 637Q635 637 635 648Q635 650 637 660Q641 676 643 679T653 683Q656 683 684 682T767 680Q817 680 843 681T873 682Q888 682 888 672Q888 650 880 642Q878 637 858 637Q787 633 769 597L620 7Q618 0 599 0Q585 0 582 2Q579 5 453 305L326 604L261 344Q196 88 196 79Q201 46 268 46H278Q284 41 284 38T282 19Q278 6 272 0H259Q228 2 151 2Q123 2 100 2T63 2T46 1Q31 1 31 10Q31 14 34 26T39 40Q41 46 62 46Q130 49 150 85Q154 91 221 362L289 634Q287 635 234 637'], - - // LATIN CAPITAL LETTER O - 0x4F: [704,22,763,50,740,'740 435Q740 320 676 213T511 42T304 -22Q207 -22 138 35T51 201Q50 209 50 244Q50 346 98 438T227 601Q351 704 476 704Q514 704 524 703Q621 689 680 617T740 435ZM637 476Q637 565 591 615T476 665Q396 665 322 605Q242 542 200 428T157 216Q157 126 200 73T314 19Q404 19 485 98T608 313Q637 408 637 476'], - - // LATIN CAPITAL LETTER P - 0x50: [683,0,642,33,751,'287 628Q287 635 230 637Q206 637 199 638T192 648Q192 649 194 659Q200 679 203 681T397 683Q587 682 600 680Q664 669 707 631T751 530Q751 453 685 389Q616 321 507 303Q500 302 402 301H307L277 182Q247 66 247 59Q247 55 248 54T255 50T272 48T305 46H336Q342 37 342 35Q342 19 335 5Q330 0 319 0Q316 0 282 1T182 2Q120 2 87 2T51 1Q33 1 33 11Q33 13 36 25Q40 41 44 43T67 46Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628ZM645 554Q645 567 643 575T634 597T609 619T560 635Q553 636 480 637Q463 637 445 637T416 636T404 636Q391 635 386 627Q384 621 367 550T332 412T314 344Q314 342 395 342H407H430Q542 342 590 392Q617 419 631 471T645 554'], - - // LATIN CAPITAL LETTER Q - 0x51: [704,194,791,50,740,'399 -80Q399 -47 400 -30T402 -11V-7L387 -11Q341 -22 303 -22Q208 -22 138 35T51 201Q50 209 50 244Q50 346 98 438T227 601Q351 704 476 704Q514 704 524 703Q621 689 680 617T740 435Q740 255 592 107Q529 47 461 16L444 8V3Q444 2 449 -24T470 -66T516 -82Q551 -82 583 -60T625 -3Q631 11 638 11Q647 11 649 2Q649 -6 639 -34T611 -100T557 -165T481 -194Q399 -194 399 -87V-80ZM636 468Q636 523 621 564T580 625T530 655T477 665Q429 665 379 640Q277 591 215 464T153 216Q153 110 207 59Q231 38 236 38V46Q236 86 269 120T347 155Q372 155 390 144T417 114T429 82T435 55L448 64Q512 108 557 185T619 334T636 468ZM314 18Q362 18 404 39L403 49Q399 104 366 115Q354 117 347 117Q344 117 341 117T337 118Q317 118 296 98T274 52Q274 18 314 18'], - - // LATIN CAPITAL LETTER R - 0x52: [683,21,759,33,755,'230 637Q203 637 198 638T193 649Q193 676 204 682Q206 683 378 683Q550 682 564 680Q620 672 658 652T712 606T733 563T739 529Q739 484 710 445T643 385T576 351T538 338L545 333Q612 295 612 223Q612 212 607 162T602 80V71Q602 53 603 43T614 25T640 16Q668 16 686 38T712 85Q717 99 720 102T735 105Q755 105 755 93Q755 75 731 36Q693 -21 641 -21H632Q571 -21 531 4T487 82Q487 109 502 166T517 239Q517 290 474 313Q459 320 449 321T378 323H309L277 193Q244 61 244 59Q244 55 245 54T252 50T269 48T302 46H333Q339 38 339 37T336 19Q332 6 326 0H311Q275 2 180 2Q146 2 117 2T71 2T50 1Q33 1 33 10Q33 12 36 24Q41 43 46 45Q50 46 61 46H67Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628Q287 635 230 637ZM630 554Q630 586 609 608T523 636Q521 636 500 636T462 637H440Q393 637 386 627Q385 624 352 494T319 361Q319 360 388 360Q466 361 492 367Q556 377 592 426Q608 449 619 486T630 554'], - - // LATIN CAPITAL LETTER S - 0x53: [705,22,613,52,645,'308 24Q367 24 416 76T466 197Q466 260 414 284Q308 311 278 321T236 341Q176 383 176 462Q176 523 208 573T273 648Q302 673 343 688T407 704H418H425Q521 704 564 640Q565 640 577 653T603 682T623 704Q624 704 627 704T632 705Q645 705 645 698T617 577T585 459T569 456Q549 456 549 465Q549 471 550 475Q550 478 551 494T553 520Q553 554 544 579T526 616T501 641Q465 662 419 662Q362 662 313 616T263 510Q263 480 278 458T319 427Q323 425 389 408T456 390Q490 379 522 342T554 242Q554 216 546 186Q541 164 528 137T492 78T426 18T332 -20Q320 -22 298 -22Q199 -22 144 33L134 44L106 13Q83 -14 78 -18T65 -22Q52 -22 52 -14Q52 -11 110 221Q112 227 130 227H143Q149 221 149 216Q149 214 148 207T144 186T142 153Q144 114 160 87T203 47T255 29T308 24'], - - // LATIN CAPITAL LETTER T - 0x54: [677,0,584,21,704,'40 437Q21 437 21 445Q21 450 37 501T71 602L88 651Q93 669 101 677H569H659Q691 677 697 676T704 667Q704 661 687 553T668 444Q668 437 649 437Q640 437 637 437T631 442L629 445Q629 451 635 490T641 551Q641 586 628 604T573 629Q568 630 515 631Q469 631 457 630T439 622Q438 621 368 343T298 60Q298 48 386 46Q418 46 427 45T436 36Q436 31 433 22Q429 4 424 1L422 0Q419 0 415 0Q410 0 363 1T228 2Q99 2 64 0H49Q43 6 43 9T45 27Q49 40 55 46H83H94Q174 46 189 55Q190 56 191 56Q196 59 201 76T241 233Q258 301 269 344Q339 619 339 625Q339 630 310 630H279Q212 630 191 624Q146 614 121 583T67 467Q60 445 57 441T43 437H40'], - - // LATIN CAPITAL LETTER U - 0x55: [683,22,683,60,767,'107 637Q73 637 71 641Q70 643 70 649Q70 673 81 682Q83 683 98 683Q139 681 234 681Q268 681 297 681T342 682T362 682Q378 682 378 672Q378 670 376 658Q371 641 366 638H364Q362 638 359 638T352 638T343 637T334 637Q295 636 284 634T266 623Q265 621 238 518T184 302T154 169Q152 155 152 140Q152 86 183 55T269 24Q336 24 403 69T501 205L552 406Q599 598 599 606Q599 633 535 637Q511 637 511 648Q511 650 513 660Q517 676 519 679T529 683Q532 683 561 682T645 680Q696 680 723 681T752 682Q767 682 767 672Q767 650 759 642Q756 637 737 637Q666 633 648 597Q646 592 598 404Q557 235 548 205Q515 105 433 42T263 -22Q171 -22 116 34T60 167V183Q60 201 115 421Q164 622 164 628Q164 635 107 637'], - - // LATIN CAPITAL LETTER V - 0x56: [683,22,583,52,769,'52 648Q52 670 65 683H76Q118 680 181 680Q299 680 320 683H330Q336 677 336 674T334 656Q329 641 325 637H304Q282 635 274 635Q245 630 242 620Q242 618 271 369T301 118L374 235Q447 352 520 471T595 594Q599 601 599 609Q599 633 555 637Q537 637 537 648Q537 649 539 661Q542 675 545 679T558 683Q560 683 570 683T604 682T668 681Q737 681 755 683H762Q769 676 769 672Q769 655 760 640Q757 637 743 637Q730 636 719 635T698 630T682 623T670 615T660 608T652 599T645 592L452 282Q272 -9 266 -16Q263 -18 259 -21L241 -22H234Q216 -22 216 -15Q213 -9 177 305Q139 623 138 626Q133 637 76 637H59Q52 642 52 648'], - - // LATIN CAPITAL LETTER W - 0x57: [683,22,944,51,1048,'436 683Q450 683 486 682T553 680Q604 680 638 681T677 682Q695 682 695 674Q695 670 692 659Q687 641 683 639T661 637Q636 636 621 632T600 624T597 615Q597 603 613 377T629 138L631 141Q633 144 637 151T649 170T666 200T690 241T720 295T759 362Q863 546 877 572T892 604Q892 619 873 628T831 637Q817 637 817 647Q817 650 819 660Q823 676 825 679T839 682Q842 682 856 682T895 682T949 681Q1015 681 1034 683Q1048 683 1048 672Q1048 666 1045 655T1038 640T1028 637Q1006 637 988 631T958 617T939 600T927 584L923 578L754 282Q586 -14 585 -15Q579 -22 561 -22Q546 -22 542 -17Q539 -14 523 229T506 480L494 462Q472 425 366 239Q222 -13 220 -15T215 -19Q210 -22 197 -22Q178 -22 176 -15Q176 -12 154 304T131 622Q129 631 121 633T82 637H58Q51 644 51 648Q52 671 64 683H76Q118 680 176 680Q301 680 313 683H323Q329 677 329 674T327 656Q322 641 318 637H297Q236 634 232 620Q262 160 266 136L501 550L499 587Q496 629 489 632Q483 636 447 637Q428 637 422 639T416 648Q416 650 418 660Q419 664 420 669T421 676T424 680T428 682T436 683'], - - // LATIN CAPITAL LETTER X - 0x58: [683,0,828,26,852,'42 0H40Q26 0 26 11Q26 15 29 27Q33 41 36 43T55 46Q141 49 190 98Q200 108 306 224T411 342Q302 620 297 625Q288 636 234 637H206Q200 643 200 645T202 664Q206 677 212 683H226Q260 681 347 681Q380 681 408 681T453 682T473 682Q490 682 490 671Q490 670 488 658Q484 643 481 640T465 637Q434 634 411 620L488 426L541 485Q646 598 646 610Q646 628 622 635Q617 635 609 637Q594 637 594 648Q594 650 596 664Q600 677 606 683H618Q619 683 643 683T697 681T738 680Q828 680 837 683H845Q852 676 852 672Q850 647 840 637H824Q790 636 763 628T722 611T698 593L687 584Q687 585 592 480L505 384Q505 383 536 304T601 142T638 56Q648 47 699 46Q734 46 734 37Q734 35 732 23Q728 7 725 4T711 1Q708 1 678 1T589 2Q528 2 496 2T461 1Q444 1 444 10Q444 11 446 25Q448 35 450 39T455 44T464 46T480 47T506 54Q523 62 523 64Q522 64 476 181L429 299Q241 95 236 84Q232 76 232 72Q232 53 261 47Q262 47 267 47T273 46Q276 46 277 46T280 45T283 42T284 35Q284 26 282 19Q279 6 276 4T261 1Q258 1 243 1T201 2T142 2Q64 2 42 0'], - - // LATIN CAPITAL LETTER Y - 0x59: [683,-1,581,30,763,'66 637Q54 637 49 637T39 638T32 641T30 647T33 664T42 682Q44 683 56 683Q104 680 165 680Q288 680 306 683H316Q322 677 322 674T320 656Q316 643 310 637H298Q242 637 242 624Q242 619 292 477T343 333L346 336Q350 340 358 349T379 373T411 410T454 461Q546 568 561 587T577 618Q577 634 545 637Q528 637 528 647Q528 649 530 661Q533 676 535 679T549 683Q551 683 578 682T657 680Q684 680 713 681T746 682Q763 682 763 673Q763 669 760 657T755 643Q753 637 734 637Q662 632 617 587Q608 578 477 424L348 273L322 169Q295 62 295 57Q295 46 363 46Q379 46 384 45T390 35Q390 33 388 23Q384 6 382 4T366 1Q361 1 324 1T232 2Q170 2 138 2T102 1Q84 1 84 9Q84 14 87 24Q88 27 89 30T90 35T91 39T93 42T96 44T101 45T107 45T116 46T129 46Q168 47 180 50T198 63Q201 68 227 171L252 274L129 623Q128 624 127 625T125 627T122 629T118 631T113 633T105 634T96 635T83 636T66 637'], - - // LATIN CAPITAL LETTER Z - 0x5A: [683,0,683,58,723,'58 8Q58 23 64 35Q64 36 329 334T596 635L586 637Q575 637 512 637H500H476Q442 637 420 635T365 624T311 598T266 548T228 469Q227 466 226 463T224 458T223 453T222 450L221 448Q218 443 202 443Q185 443 182 453L214 561Q228 606 241 651Q249 679 253 681Q256 683 487 683H718Q723 678 723 675Q723 673 717 649Q189 54 188 52L185 49H274Q369 50 377 51Q452 60 500 100T579 247Q587 272 590 277T603 282H607Q628 282 628 271Q547 5 541 2Q538 0 300 0H124Q58 0 58 8'], - - // LATIN SMALL LETTER A - 0x61: [441,10,529,33,506,'33 157Q33 258 109 349T280 441Q331 441 370 392Q386 422 416 422Q429 422 439 414T449 394Q449 381 412 234T374 68Q374 43 381 35T402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487Q506 153 506 144Q506 138 501 117T481 63T449 13Q436 0 417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157ZM351 328Q351 334 346 350T323 385T277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q217 26 254 59T298 110Q300 114 325 217T351 328'], - - // LATIN SMALL LETTER B - 0x62: [694,11,429,40,422,'73 647Q73 657 77 670T89 683Q90 683 161 688T234 694Q246 694 246 685T212 542Q204 508 195 472T180 418L176 399Q176 396 182 402Q231 442 283 442Q345 442 383 396T422 280Q422 169 343 79T173 -11Q123 -11 82 27T40 150V159Q40 180 48 217T97 414Q147 611 147 623T109 637Q104 637 101 637H96Q86 637 83 637T76 640T73 647ZM336 325V331Q336 405 275 405Q258 405 240 397T207 376T181 352T163 330L157 322L136 236Q114 150 114 114Q114 66 138 42Q154 26 178 26Q211 26 245 58Q270 81 285 114T318 219Q336 291 336 325'], - - // LATIN SMALL LETTER C - 0x63: [442,12,433,34,430,'34 159Q34 268 120 355T306 442Q362 442 394 418T427 355Q427 326 408 306T360 285Q341 285 330 295T319 325T330 359T352 380T366 386H367Q367 388 361 392T340 400T306 404Q276 404 249 390Q228 381 206 359Q162 315 142 235T121 119Q121 73 147 50Q169 26 205 26H209Q321 26 394 111Q403 121 406 121Q410 121 419 112T429 98T420 83T391 55T346 25T282 0T202 -11Q127 -11 81 37T34 159'], - - // LATIN SMALL LETTER D - 0x64: [694,10,520,33,523,'366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326'], - - // LATIN SMALL LETTER E - 0x65: [443,11,466,39,430,'39 168Q39 225 58 272T107 350T174 402T244 433T307 442H310Q355 442 388 420T421 355Q421 265 310 237Q261 224 176 223Q139 223 138 221Q138 219 132 186T125 128Q125 81 146 54T209 26T302 45T394 111Q403 121 406 121Q410 121 419 112T429 98T420 82T390 55T344 24T281 -1T205 -11Q126 -11 83 42T39 168ZM373 353Q367 405 305 405Q272 405 244 391T199 357T170 316T154 280T149 261Q149 260 169 260Q282 260 327 284T373 353'], - - // LATIN SMALL LETTER F - 0x66: [705,205,490,55,550,'118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162'], - - // LATIN SMALL LETTER G - 0x67: [442,205,477,10,480,'311 43Q296 30 267 15T206 0Q143 0 105 45T66 160Q66 265 143 353T314 442Q361 442 401 394L404 398Q406 401 409 404T418 412T431 419T447 422Q461 422 470 413T480 394Q480 379 423 152T363 -80Q345 -134 286 -169T151 -205Q10 -205 10 -137Q10 -111 28 -91T74 -71Q89 -71 102 -80T116 -111Q116 -121 114 -130T107 -144T99 -154T92 -162L90 -164H91Q101 -167 151 -167Q189 -167 211 -155Q234 -144 254 -122T282 -75Q288 -56 298 -13Q311 35 311 43ZM384 328L380 339Q377 350 375 354T369 368T359 382T346 393T328 402T306 405Q262 405 221 352Q191 313 171 233T151 117Q151 38 213 38Q269 38 323 108L331 118L384 328'], - - // LATIN SMALL LETTER H - 0x68: [694,11,576,48,555,'137 683Q138 683 209 688T282 694Q294 694 294 685Q294 674 258 534Q220 386 220 383Q220 381 227 388Q288 442 357 442Q411 442 444 415T478 336Q478 285 440 178T402 50Q403 36 407 31T422 26Q450 26 474 56T513 138Q516 149 519 151T535 153Q555 153 555 145Q555 144 551 130Q535 71 500 33Q466 -10 419 -10H414Q367 -10 346 17T325 74Q325 90 361 192T398 345Q398 404 354 404H349Q266 404 205 306L198 293L164 158Q132 28 127 16Q114 -11 83 -11Q69 -11 59 -2T48 16Q48 30 121 320L195 616Q195 629 188 632T149 637H128Q122 643 122 645T124 664Q129 683 137 683'], - - // LATIN SMALL LETTER I - 0x69: [661,11,345,21,302,'184 600Q184 624 203 642T247 661Q265 661 277 649T290 619Q290 596 270 577T226 557Q211 557 198 567T184 600ZM21 287Q21 295 30 318T54 369T98 420T158 442Q197 442 223 419T250 357Q250 340 236 301T196 196T154 83Q149 61 149 51Q149 26 166 26Q175 26 185 29T208 43T235 78T260 137Q263 149 265 151T282 153Q302 153 302 143Q302 135 293 112T268 61T223 11T161 -11Q129 -11 102 10T74 74Q74 91 79 106T122 220Q160 321 166 341T173 380Q173 404 156 404H154Q124 404 99 371T61 287Q60 286 59 284T58 281T56 279T53 278T49 278T41 278H27Q21 284 21 287'], - - // LATIN SMALL LETTER J - 0x6A: [661,204,412,-12,403,'297 596Q297 627 318 644T361 661Q378 661 389 651T403 623Q403 595 384 576T340 557Q322 557 310 567T297 596ZM288 376Q288 405 262 405Q240 405 220 393T185 362T161 325T144 293L137 279Q135 278 121 278H107Q101 284 101 286T105 299Q126 348 164 391T252 441Q253 441 260 441T272 442Q296 441 316 432Q341 418 354 401T367 348V332L318 133Q267 -67 264 -75Q246 -125 194 -164T75 -204Q25 -204 7 -183T-12 -137Q-12 -110 7 -91T53 -71Q70 -71 82 -81T95 -112Q95 -148 63 -167Q69 -168 77 -168Q111 -168 139 -140T182 -74L193 -32Q204 11 219 72T251 197T278 308T289 365Q289 372 288 376'], - - // LATIN SMALL LETTER K - 0x6B: [694,11,521,48,503,'121 647Q121 657 125 670T137 683Q138 683 209 688T282 694Q294 694 294 686Q294 679 244 477Q194 279 194 272Q213 282 223 291Q247 309 292 354T362 415Q402 442 438 442Q468 442 485 423T503 369Q503 344 496 327T477 302T456 291T438 288Q418 288 406 299T394 328Q394 353 410 369T442 390L458 393Q446 405 434 405H430Q398 402 367 380T294 316T228 255Q230 254 243 252T267 246T293 238T320 224T342 206T359 180T365 147Q365 130 360 106T354 66Q354 26 381 26Q429 26 459 145Q461 153 479 153H483Q499 153 499 144Q499 139 496 130Q455 -11 378 -11Q333 -11 305 15T277 90Q277 108 280 121T283 145Q283 167 269 183T234 206T200 217T182 220H180Q168 178 159 139T145 81T136 44T129 20T122 7T111 -2Q98 -11 83 -11Q66 -11 57 -1T48 16Q48 26 85 176T158 471L195 616Q196 629 188 632T149 637H144Q134 637 131 637T124 640T121 647'], - - // LATIN SMALL LETTER L - 0x6C: [695,12,298,38,266,'117 59Q117 26 142 26Q179 26 205 131Q211 151 215 152Q217 153 225 153H229Q238 153 241 153T246 151T248 144Q247 138 245 128T234 90T214 43T183 6T137 -11Q101 -11 70 11T38 85Q38 97 39 102L104 360Q167 615 167 623Q167 626 166 628T162 632T157 634T149 635T141 636T132 637T122 637Q112 637 109 637T101 638T95 641T94 647Q94 649 96 661Q101 680 107 682T179 688Q194 689 213 690T243 693T254 694Q266 694 266 686Q266 675 193 386T118 83Q118 81 118 75T117 65V59'], - - // LATIN SMALL LETTER M - 0x6D: [443,11,878,21,857,'21 287Q22 293 24 303T36 341T56 388T88 425T132 442T175 435T205 417T221 395T229 376L231 369Q231 367 232 367L243 378Q303 442 384 442Q401 442 415 440T441 433T460 423T475 411T485 398T493 385T497 373T500 364T502 357L510 367Q573 442 659 442Q713 442 746 415T780 336Q780 285 742 178T704 50Q705 36 709 31T724 26Q752 26 776 56T815 138Q818 149 821 151T837 153Q857 153 857 145Q857 144 853 130Q845 101 831 73T785 17T716 -10Q669 -10 648 17T627 73Q627 92 663 193T700 345Q700 404 656 404H651Q565 404 506 303L499 291L466 157Q433 26 428 16Q415 -11 385 -11Q372 -11 364 -4T353 8T350 18Q350 29 384 161L420 307Q423 322 423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 181Q151 335 151 342Q154 357 154 369Q154 405 129 405Q107 405 92 377T69 316T57 280Q55 278 41 278H27Q21 284 21 287'], - - // LATIN SMALL LETTER N - 0x6E: [443,11,600,21,580,'21 287Q22 293 24 303T36 341T56 388T89 425T135 442Q171 442 195 424T225 390T231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336T465 179T427 52Q427 26 444 26Q450 26 453 27Q482 32 505 65T540 145Q542 153 560 153Q580 153 580 145Q580 144 576 130Q568 101 554 73T508 17T439 -10Q392 -10 371 17T350 73Q350 92 386 193T423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 180T152 343Q153 348 153 366Q153 405 129 405Q91 405 66 305Q60 285 60 284Q58 278 41 278H27Q21 284 21 287'], - - // LATIN SMALL LETTER O - 0x6F: [441,11,485,34,476,'201 -11Q126 -11 80 38T34 156Q34 221 64 279T146 380Q222 441 301 441Q333 441 341 440Q354 437 367 433T402 417T438 387T464 338T476 268Q476 161 390 75T201 -11ZM121 120Q121 70 147 48T206 26Q250 26 289 58T351 142Q360 163 374 216T388 308Q388 352 370 375Q346 405 306 405Q243 405 195 347Q158 303 140 230T121 120'], - - // LATIN SMALL LETTER P - 0x70: [443,194,503,-39,497,'23 287Q24 290 25 295T30 317T40 348T55 381T75 411T101 433T134 442Q209 442 230 378L240 387Q302 442 358 442Q423 442 460 395T497 281Q497 173 421 82T249 -10Q227 -10 210 -4Q199 1 187 11T168 28L161 36Q160 35 139 -51T118 -138Q118 -144 126 -145T163 -148H188Q194 -155 194 -157T191 -175Q188 -187 185 -190T172 -194Q170 -194 161 -194T127 -193T65 -192Q-5 -192 -24 -194H-32Q-39 -187 -39 -183Q-37 -156 -26 -148H-6Q28 -147 33 -136Q36 -130 94 103T155 350Q156 355 156 364Q156 405 131 405Q109 405 94 377T71 316T59 280Q57 278 43 278H29Q23 284 23 287ZM178 102Q200 26 252 26Q282 26 310 49T356 107Q374 141 392 215T411 325V331Q411 405 350 405Q339 405 328 402T306 393T286 380T269 365T254 350T243 336T235 326L232 322Q232 321 229 308T218 264T204 212Q178 106 178 102'], - - // LATIN SMALL LETTER Q - 0x71: [442,194,446,33,460,'33 157Q33 258 109 349T280 441Q340 441 372 389Q373 390 377 395T388 406T404 418Q438 442 450 442Q454 442 457 439T460 434Q460 425 391 149Q320 -135 320 -139Q320 -147 365 -148H390Q396 -156 396 -157T393 -175Q389 -188 383 -194H370Q339 -192 262 -192Q234 -192 211 -192T174 -192T157 -193Q143 -193 143 -185Q143 -182 145 -170Q149 -154 152 -151T172 -148Q220 -148 230 -141Q238 -136 258 -53T279 32Q279 33 272 29Q224 -10 172 -10Q117 -10 75 30T33 157ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326'], - - // LATIN SMALL LETTER R - 0x72: [443,11,451,21,430,'21 287Q22 290 23 295T28 317T38 348T53 381T73 411T99 433T132 442Q161 442 183 430T214 408T225 388Q227 382 228 382T236 389Q284 441 347 441H350Q398 441 422 400Q430 381 430 363Q430 333 417 315T391 292T366 288Q346 288 334 299T322 328Q322 376 378 392Q356 405 342 405Q286 405 239 331Q229 315 224 298T190 165Q156 25 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 114 189T154 366Q154 405 128 405Q107 405 92 377T68 316T57 280Q55 278 41 278H27Q21 284 21 287'], - - // LATIN SMALL LETTER S - 0x73: [443,10,469,53,419,'131 289Q131 321 147 354T203 415T300 442Q362 442 390 415T419 355Q419 323 402 308T364 292Q351 292 340 300T328 326Q328 342 337 354T354 372T367 378Q368 378 368 379Q368 382 361 388T336 399T297 405Q249 405 227 379T204 326Q204 301 223 291T278 274T330 259Q396 230 396 163Q396 135 385 107T352 51T289 7T195 -10Q118 -10 86 19T53 87Q53 126 74 143T118 160Q133 160 146 151T160 120Q160 94 142 76T111 58Q109 57 108 57T107 55Q108 52 115 47T146 34T201 27Q237 27 263 38T301 66T318 97T323 122Q323 150 302 164T254 181T195 196T148 231Q131 256 131 289'], - - // LATIN SMALL LETTER T - 0x74: [626,11,361,19,330,'26 385Q19 392 19 395Q19 399 22 411T27 425Q29 430 36 430T87 431H140L159 511Q162 522 166 540T173 566T179 586T187 603T197 615T211 624T229 626Q247 625 254 615T261 596Q261 589 252 549T232 470L222 433Q222 431 272 431H323Q330 424 330 420Q330 398 317 385H210L174 240Q135 80 135 68Q135 26 162 26Q197 26 230 60T283 144Q285 150 288 151T303 153H307Q322 153 322 145Q322 142 319 133Q314 117 301 95T267 48T216 6T155 -11Q125 -11 98 4T59 56Q57 64 57 83V101L92 241Q127 382 128 383Q128 385 77 385H26'], - - // LATIN SMALL LETTER U - 0x75: [442,11,572,21,551,'21 287Q21 295 30 318T55 370T99 420T158 442Q204 442 227 417T250 358Q250 340 216 246T182 105Q182 62 196 45T238 27T291 44T328 78L339 95Q341 99 377 247Q407 367 413 387T427 416Q444 431 463 431Q480 431 488 421T496 402L420 84Q419 79 419 68Q419 43 426 35T447 26Q469 29 482 57T512 145Q514 153 532 153Q551 153 551 144Q550 139 549 130T540 98T523 55T498 17T462 -8Q454 -10 438 -10Q372 -10 347 46Q345 45 336 36T318 21T296 6T267 -6T233 -11Q189 -11 155 7Q103 38 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287'], - - // LATIN SMALL LETTER V - 0x76: [443,11,485,21,467,'173 380Q173 405 154 405Q130 405 104 376T61 287Q60 286 59 284T58 281T56 279T53 278T49 278T41 278H27Q21 284 21 287Q21 294 29 316T53 368T97 419T160 441Q202 441 225 417T249 361Q249 344 246 335Q246 329 231 291T200 202T182 113Q182 86 187 69Q200 26 250 26Q287 26 319 60T369 139T398 222T409 277Q409 300 401 317T383 343T365 361T357 383Q357 405 376 424T417 443Q436 443 451 425T467 367Q467 340 455 284T418 159T347 40T241 -11Q177 -11 139 22Q102 54 102 117Q102 148 110 181T151 298Q173 362 173 380'], - - // LATIN SMALL LETTER W - 0x77: [443,11,716,21,690,'580 385Q580 406 599 424T641 443Q659 443 674 425T690 368Q690 339 671 253Q656 197 644 161T609 80T554 12T482 -11Q438 -11 404 5T355 48Q354 47 352 44Q311 -11 252 -11Q226 -11 202 -5T155 14T118 53T104 116Q104 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Q21 293 29 315T52 366T96 418T161 441Q204 441 227 416T250 358Q250 340 217 250T184 111Q184 65 205 46T258 26Q301 26 334 87L339 96V119Q339 122 339 128T340 136T341 143T342 152T345 165T348 182T354 206T362 238T373 281Q402 395 406 404Q419 431 449 431Q468 431 475 421T483 402Q483 389 454 274T422 142Q420 131 420 107V100Q420 85 423 71T442 42T487 26Q558 26 600 148Q609 171 620 213T632 273Q632 306 619 325T593 357T580 385'], - - // LATIN SMALL LETTER X - 0x78: [442,11,572,35,522,'52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289'], - - // LATIN SMALL LETTER Y - 0x79: [443,205,490,21,497,'21 287Q21 301 36 335T84 406T158 442Q199 442 224 419T250 355Q248 336 247 334Q247 331 231 288T198 191T182 105Q182 62 196 45T238 27Q261 27 281 38T312 61T339 94Q339 95 344 114T358 173T377 247Q415 397 419 404Q432 431 462 431Q475 431 483 424T494 412T496 403Q496 390 447 193T391 -23Q363 -106 294 -155T156 -205Q111 -205 77 -183T43 -117Q43 -95 50 -80T69 -58T89 -48T106 -45Q150 -45 150 -87Q150 -107 138 -122T115 -142T102 -147L99 -148Q101 -153 118 -160T152 -167H160Q177 -167 186 -165Q219 -156 247 -127T290 -65T313 -9T321 21L315 17Q309 13 296 6T270 -6Q250 -11 231 -11Q185 -11 150 11T104 82Q103 89 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287'], - - // LATIN SMALL LETTER Z - 0x7A: [442,11,465,35,468,'347 338Q337 338 294 349T231 360Q211 360 197 356T174 346T162 335T155 324L153 320Q150 317 138 317Q117 317 117 325Q117 330 120 339Q133 378 163 406T229 440Q241 442 246 442Q271 442 291 425T329 392T367 375Q389 375 411 408T434 441Q435 442 449 442H462Q468 436 468 434Q468 430 463 420T449 399T432 377T418 358L411 349Q368 298 275 214T160 106L148 94L163 93Q185 93 227 82T290 71Q328 71 360 90T402 140Q406 149 409 151T424 153Q443 153 443 143Q443 138 442 134Q425 72 376 31T278 -11Q252 -11 232 6T193 40T155 57Q111 57 76 -3Q70 -11 59 -11H54H41Q35 -5 35 -2Q35 13 93 84Q132 129 225 214T340 322Q352 338 347 338'], - - // GREEK CAPITAL LETTER GAMMA - 0x393: [680,-1,615,31,721,'49 1Q31 1 31 10Q31 12 34 24Q39 43 44 45Q48 46 59 46H65Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 661Q197 674 203 680H714Q721 676 721 669Q721 664 708 557T694 447Q692 440 674 440H662Q655 445 655 454Q655 455 658 480T661 534Q661 572 652 592Q638 619 603 626T501 634H471Q398 633 393 630Q389 628 386 622Q385 619 315 341T245 60Q245 46 333 46H345Q366 46 366 35Q366 33 363 21T358 6Q356 1 339 1Q334 1 292 1T187 2Q122 2 88 2T49 1'], - - // GREEK CAPITAL LETTER DELTA - 0x394: [716,0,833,48,788,'574 715L582 716Q589 716 595 716Q612 716 616 714Q621 712 621 709Q622 707 705 359T788 8Q786 5 785 3L781 0H416Q52 0 50 2T48 6Q48 9 305 358T567 711Q572 712 574 715ZM599 346L538 602L442 474Q347 345 252 217T157 87T409 86T661 88L654 120Q646 151 629 220T599 346'], - - // GREEK CAPITAL LETTER THETA - 0x398: [704,22,763,50,740,'740 435Q740 320 676 213T511 42T304 -22Q207 -22 138 35T51 201Q50 209 50 244Q50 346 98 438T227 601Q351 704 476 704Q514 704 524 703Q621 689 680 617T740 435ZM640 466Q640 523 625 565T583 628T532 658T479 668Q370 668 273 559T151 255Q150 245 150 213Q150 156 165 116T207 55T259 26T313 17Q385 17 451 63T561 184Q590 234 615 312T640 466ZM510 276Q510 278 512 288L515 298Q515 299 384 299H253L250 285Q246 271 244 268T231 265H227Q216 265 214 266T207 274Q207 278 223 345T244 416Q247 419 260 419H263Q280 419 280 408Q280 406 278 396L275 386Q275 385 406 385H537L540 399Q544 413 546 416T559 419H563Q574 419 576 418T583 410Q583 403 566 339Q549 271 544 267Q542 265 538 265H530H527Q510 265 510 276'], - - // GREEK CAPITAL LETTER LAMDA - 0x39B: [716,0,694,35,670,'135 2Q114 2 90 2T60 1Q35 1 35 11Q35 28 42 40Q45 46 55 46Q119 46 151 94Q153 97 325 402T498 709Q505 716 526 716Q543 716 549 710Q550 709 560 548T580 224T591 57Q594 52 595 52Q603 47 638 46H663Q670 39 670 35Q669 12 657 0H644Q613 2 530 2Q497 2 469 2T424 2T405 1Q388 1 388 10Q388 15 391 24Q392 27 393 32T395 38T397 41T401 44T406 45T415 46Q473 46 487 64L472 306Q468 365 465 426T459 518L457 550Q456 550 328 322T198 88Q196 80 196 77Q196 49 243 46Q261 46 261 35Q261 34 259 22Q256 7 254 4T240 0Q237 0 211 1T135 2'], - - // GREEK CAPITAL LETTER XI - 0x39E: [678,0,742,53,777,'222 668Q222 670 229 677H654Q677 677 705 677T740 678Q764 678 770 676T777 667Q777 662 764 594Q761 579 757 559T751 528L749 519Q747 512 729 512H717Q710 519 710 525Q712 532 715 559T719 591Q718 595 711 595Q682 598 486 598Q252 598 246 592Q239 587 228 552L216 517Q214 512 197 512H185Q178 517 178 522Q178 524 198 591T222 668ZM227 262Q218 262 215 262T209 266L207 270L227 356Q247 435 250 439Q253 443 260 443H267H280Q287 438 287 433Q287 430 285 420T280 402L278 393Q278 392 431 392H585L590 415Q595 436 598 439T612 443H628Q635 438 635 433Q635 431 615 351T594 268Q592 262 575 262H572Q556 262 556 272Q556 280 560 293L565 313H258L252 292Q248 271 245 267T230 262H227ZM60 0Q53 4 53 11Q53 14 68 89T84 169Q88 176 98 176H104H116Q123 169 123 163Q122 160 117 127T112 88Q112 80 243 80H351H454Q554 80 574 81T597 88V89Q603 100 610 121T622 157T630 174Q633 176 646 176H658Q665 171 665 166Q665 164 643 89T618 7Q616 2 607 1T548 0H335H60'], - - // GREEK CAPITAL LETTER PI - 0x3A0: [681,0,831,31,887,'48 1Q31 1 31 10Q31 12 34 24Q39 43 44 45Q48 46 59 46H65Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 661Q197 674 203 680H541Q621 680 709 680T812 681Q841 681 855 681T877 679T886 676T887 670Q887 663 885 656Q880 637 875 635Q871 634 860 634H854Q827 634 794 631Q780 628 775 619Q773 614 704 338T634 58Q634 51 638 51Q646 48 692 46H723Q729 38 729 37T726 19Q722 6 716 0H701Q664 2 567 2Q533 2 504 2T458 2T437 1Q420 1 420 10Q420 15 423 24Q428 43 433 45Q437 46 448 46H454Q481 46 514 49Q528 52 533 61Q536 67 572 209T642 491T678 632Q678 634 533 634H388Q387 631 316 347T245 59Q245 55 246 54T253 50T270 48T303 46H334Q340 38 340 37T337 19Q333 6 327 0H312Q275 2 178 2Q144 2 115 2T69 2T48 1'], - - // GREEK CAPITAL LETTER SIGMA - 0x3A3: [683,0,780,58,806,'65 0Q58 4 58 11Q58 16 114 67Q173 119 222 164L377 304Q378 305 340 386T261 552T218 644Q217 648 219 660Q224 678 228 681Q231 683 515 683H799Q804 678 806 674Q806 667 793 559T778 448Q774 443 759 443Q747 443 743 445T739 456Q739 458 741 477T743 516Q743 552 734 574T710 609T663 627T596 635T502 637Q480 637 469 637H339Q344 627 411 486T478 341V339Q477 337 477 336L457 318Q437 300 398 265T322 196L168 57Q167 56 188 56T258 56H359Q426 56 463 58T537 69T596 97T639 146T680 225Q686 243 689 246T702 250H705Q726 250 726 239Q726 238 683 123T639 5Q637 1 610 1Q577 0 348 0H65'], - - // GREEK CAPITAL LETTER UPSILON - 0x3A5: [706,0,583,28,700,'45 535Q34 535 31 536T28 544Q28 554 39 578T70 631T126 683T206 705Q230 705 251 698T295 671T330 612T344 514Q344 477 342 473V472Q343 472 347 480T361 509T380 547Q471 704 596 704Q615 704 625 702Q659 692 679 663T700 595Q700 565 696 552T687 537T670 535Q656 535 653 536T649 543Q649 544 649 550T650 562Q650 589 629 605T575 621Q502 621 448 547T365 361Q290 70 290 60Q290 46 379 46H404Q410 40 410 39T408 19Q404 6 398 0H381Q340 2 225 2Q184 2 149 2T94 2T69 1Q61 1 58 1T53 4T51 10Q51 11 53 23Q54 25 55 30T56 36T58 40T60 43T62 44T67 46T73 46T82 46H89Q144 46 163 49T190 62L198 93Q206 124 217 169T241 262T262 350T274 404Q281 445 281 486V494Q281 621 185 621Q147 621 116 601T74 550Q71 539 66 537T45 535'], - - // GREEK CAPITAL LETTER PHI - 0x3A6: [683,0,667,24,642,'356 624Q356 637 267 637H243Q237 642 237 645T239 664Q243 677 249 683H264Q342 681 429 681Q565 681 571 683H583Q589 677 589 674T587 656Q582 641 578 637H540Q516 637 504 637T479 633T463 630T454 623T448 613T443 597T438 576Q436 566 434 556T430 539L428 533Q442 533 472 526T543 502T613 451T642 373Q642 301 567 241T386 158L336 150Q332 150 331 146Q310 66 310 60Q310 46 399 46H424Q430 40 430 39T428 19Q424 6 418 0H401Q360 2 247 2Q207 2 173 2T119 2T95 1Q87 1 84 1T79 4T77 10Q77 11 79 23Q80 25 81 30T82 36T84 40T86 43T88 44T93 46T99 46T108 46H115Q170 46 189 49T216 62Q220 74 228 107L239 150L223 152Q139 164 82 205T24 311Q24 396 125 462Q207 517 335 533L346 578Q356 619 356 624ZM130 291Q130 203 241 188H249Q249 190 287 342L325 495H324Q313 495 291 491T229 466T168 414Q130 357 130 291ZM536 393Q536 440 507 463T418 496L341 187L351 189Q443 201 487 255Q536 314 536 393'], - - // GREEK CAPITAL LETTER PSI - 0x3A8: [683,0,612,21,692,'216 151Q48 174 48 329Q48 361 56 403T65 458Q65 482 58 494T43 507T28 510T21 520Q21 528 23 534T29 544L32 546H72H94Q110 546 119 544T139 536T154 514T159 476V465Q159 445 149 399T138 314Q142 229 197 201Q223 187 226 190L233 218Q240 246 253 300T280 407Q333 619 333 625Q333 637 244 637H220Q214 642 214 645T216 664Q220 677 226 683H241Q321 681 405 681Q543 681 549 683H560Q566 677 566 674T564 656Q559 641 555 637H517Q448 636 436 628Q429 623 423 600T373 404L320 192Q370 201 419 248Q451 281 469 317T500 400T518 457Q529 486 542 505T569 532T594 543T621 546H644H669Q692 546 692 536Q691 509 676 509Q623 509 593 399Q587 377 579 355T552 301T509 244T446 195T359 159Q324 151 314 151Q311 151 310 150T298 106T287 60Q287 46 376 46H401Q407 40 407 39T405 19Q401 6 395 0H378Q337 2 224 2Q184 2 150 2T96 2T72 1Q64 1 61 1T56 4T54 10Q54 11 56 23Q57 25 58 30T59 36T61 40T63 43T65 44T70 46T76 46T85 46H92Q147 46 166 49T193 62L204 106Q216 149 216 151'], - - // GREEK CAPITAL LETTER OMEGA - 0x3A9: [704,0,772,80,786,'125 84Q127 78 194 76H243V78Q243 122 208 215T165 350Q164 359 162 389Q162 522 272 610Q328 656 396 680T525 704Q628 704 698 661Q734 637 755 601T781 544T786 504Q786 439 747 374T635 226T537 109Q518 81 518 77Q537 76 557 76Q608 76 620 78T640 92Q646 100 656 119T673 155T683 172Q690 173 698 173Q718 173 718 162Q718 161 681 82T642 2Q639 0 550 0H461Q455 5 455 9T458 28Q472 78 510 149T584 276T648 402T677 525Q677 594 636 631T530 668Q476 668 423 641T335 568Q284 499 271 400Q270 388 270 348Q270 298 277 228T285 115Q285 82 280 49T271 6Q269 1 258 1T175 0H87Q83 3 80 7V18Q80 22 82 98Q84 156 85 163T91 172Q94 173 104 173T119 172Q124 169 124 126Q125 104 125 84'], - - // GREEK SMALL LETTER ALPHA - 0x3B1: [442,11,640,34,603,'34 156Q34 270 120 356T309 442Q379 442 421 402T478 304Q484 275 485 237V208Q534 282 560 374Q564 388 566 390T582 393Q603 393 603 385Q603 376 594 346T558 261T497 161L486 147L487 123Q489 67 495 47T514 26Q528 28 540 37T557 60Q559 67 562 68T577 70Q597 70 597 62Q597 56 591 43Q579 19 556 5T512 -10H505Q438 -10 414 62L411 69L400 61Q390 53 370 41T325 18T267 -2T203 -11Q124 -11 79 39T34 156ZM208 26Q257 26 306 47T379 90L403 112Q401 255 396 290Q382 405 304 405Q235 405 183 332Q156 292 139 224T121 120Q121 71 146 49T208 26'], - - // GREEK SMALL LETTER BETA - 0x3B2: [705,194,566,23,573,'29 -194Q23 -188 23 -186Q23 -183 102 134T186 465Q208 533 243 584T309 658Q365 705 429 705H431Q493 705 533 667T573 570Q573 465 469 396L482 383Q533 332 533 252Q533 139 448 65T257 -10Q227 -10 203 -2T165 17T143 40T131 59T126 65L62 -188Q60 -194 42 -194H29ZM353 431Q392 431 427 419L432 422Q436 426 439 429T449 439T461 453T472 471T484 495T493 524T501 560Q503 569 503 593Q503 611 502 616Q487 667 426 667Q384 667 347 643T286 582T247 514T224 455Q219 439 186 308T152 168Q151 163 151 147Q151 99 173 68Q204 26 260 26Q302 26 349 51T425 137Q441 171 449 214T457 279Q457 337 422 372Q380 358 347 358H337Q258 358 258 389Q258 396 261 403Q275 431 353 431'], - - // GREEK SMALL LETTER GAMMA - 0x3B3: [441,216,518,11,543,'31 249Q11 249 11 258Q11 275 26 304T66 365T129 418T206 441Q233 441 239 440Q287 429 318 386T371 255Q385 195 385 170Q385 166 386 166L398 193Q418 244 443 300T486 391T508 430Q510 431 524 431H537Q543 425 543 422Q543 418 522 378T463 251T391 71Q385 55 378 6T357 -100Q341 -165 330 -190T303 -216Q286 -216 286 -188Q286 -138 340 32L346 51L347 69Q348 79 348 100Q348 257 291 317Q251 355 196 355Q148 355 108 329T51 260Q49 251 47 251Q45 249 31 249'], - - // GREEK SMALL LETTER DELTA - 0x3B4: [717,10,444,36,451,'195 609Q195 656 227 686T302 717Q319 716 351 709T407 697T433 690Q451 682 451 662Q451 644 438 628T403 612Q382 612 348 641T288 671T249 657T235 628Q235 584 334 463Q401 379 401 292Q401 169 340 80T205 -10H198Q127 -10 83 36T36 153Q36 286 151 382Q191 413 252 434Q252 435 245 449T230 481T214 521T201 566T195 609ZM112 130Q112 83 136 55T204 27Q233 27 256 51T291 111T309 178T316 232Q316 267 309 298T295 344T269 400L259 396Q215 381 183 342T137 256T118 179T112 130'], - - // GREEK SMALL LETTER EPSILON - 0x3B5: [452,23,466,27,428,'190 -22Q124 -22 76 11T27 107Q27 174 97 232L107 239L99 248Q76 273 76 304Q76 364 144 408T290 452H302Q360 452 405 421Q428 405 428 392Q428 381 417 369T391 356Q382 356 371 365T338 383T283 392Q217 392 167 368T116 308Q116 289 133 272Q142 263 145 262T157 264Q188 278 238 278H243Q308 278 308 247Q308 206 223 206Q177 206 142 219L132 212Q68 169 68 112Q68 39 201 39Q253 39 286 49T328 72T345 94T362 105Q376 103 376 88Q376 79 365 62T334 26T275 -8T190 -22'], - - // GREEK SMALL LETTER ZETA - 0x3B6: [704,204,438,44,471,'296 643Q298 704 324 704Q342 704 342 687Q342 682 339 664T336 633Q336 623 337 618T338 611Q339 612 341 612Q343 614 354 616T374 618L384 619H394Q471 619 471 586Q467 548 386 546H372Q338 546 320 564L311 558Q235 506 175 398T114 190Q114 171 116 155T125 127T137 104T153 86T171 72T192 61T213 53T235 46T256 39L322 16Q389 -10 389 -80Q389 -119 364 -154T300 -202Q292 -204 274 -204Q247 -204 225 -196Q210 -192 193 -182T172 -167Q167 -159 173 -148Q180 -139 191 -139Q195 -139 221 -153T283 -168Q298 -166 310 -152T322 -117Q322 -91 302 -75T250 -51T183 -29T116 4T65 62T44 160Q44 287 121 410T293 590L302 595Q296 613 296 643'], - - // GREEK SMALL LETTER ETA - 0x3B7: [443,216,497,21,503,'21 287Q22 290 23 295T28 317T38 348T53 381T73 411T99 433T132 442Q156 442 175 435T205 417T221 395T229 376L231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336V326Q503 302 439 53Q381 -182 377 -189Q364 -216 332 -216Q319 -216 310 -208T299 -186Q299 -177 358 57L420 307Q423 322 423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 114 189T154 366Q154 405 128 405Q107 405 92 377T68 316T57 280Q55 278 41 278H27Q21 284 21 287'], - - // GREEK SMALL LETTER THETA - 0x3B8: [705,10,469,35,462,'35 200Q35 302 74 415T180 610T319 704Q320 704 327 704T339 705Q393 701 423 656Q462 596 462 495Q462 380 417 261T302 66T168 -10H161Q125 -10 99 10T60 63T41 130T35 200ZM383 566Q383 668 330 668Q294 668 260 623T204 521T170 421T157 371Q206 370 254 370L351 371Q352 372 359 404T375 484T383 566ZM113 132Q113 26 166 26Q181 26 198 36T239 74T287 161T335 307L340 324H145Q145 321 136 286T120 208T113 132'], - - // GREEK SMALL LETTER IOTA - 0x3B9: [442,10,354,48,333,'139 -10Q111 -10 92 0T64 25T52 52T48 74Q48 89 55 109T85 199T135 375L137 384Q139 394 140 397T145 409T151 422T160 431T173 439T190 442Q202 442 213 435T225 410Q225 404 214 358T181 238T137 107Q126 74 126 54Q126 43 126 39T130 31T142 27H147Q206 27 255 78Q272 98 281 114T290 138T295 149T313 153Q321 153 324 153T329 152T332 149T332 143Q332 106 276 48T145 -10H139'], - - // GREEK SMALL LETTER KAPPA - 0x3BA: [442,11,576,48,554,'83 -11Q70 -11 62 -4T51 8T49 17Q49 30 96 217T147 414Q160 442 193 442Q205 441 213 435T223 422T225 412Q225 401 208 337L192 270Q193 269 208 277T235 292Q252 304 306 349T396 412T467 431Q489 431 500 420T512 391Q512 366 494 347T449 327Q430 327 418 338T405 368Q405 370 407 380L397 375Q368 360 315 315L253 266L240 257H245Q262 257 300 251T366 230Q422 203 422 150Q422 140 417 114T411 67Q411 26 437 26Q484 26 513 137Q516 149 519 151T535 153Q554 153 554 144Q554 121 527 64T457 -7Q447 -10 431 -10Q386 -10 360 17T333 90Q333 108 336 122T339 146Q339 170 320 186T271 209T222 218T185 221H180L155 122Q129 22 126 16Q113 -11 83 -11'], - - // GREEK SMALL LETTER LAMDA - 0x3BB: [694,12,583,47,557,'166 673Q166 685 183 694H202Q292 691 316 644Q322 629 373 486T474 207T524 67Q531 47 537 34T546 15T551 6T555 2T556 -2T550 -11H482Q457 3 450 18T399 152L354 277L340 262Q327 246 293 207T236 141Q211 112 174 69Q123 9 111 -1T83 -12Q47 -12 47 20Q47 37 61 52T199 187Q229 216 266 252T321 306L338 322Q338 323 288 462T234 612Q214 657 183 657Q166 657 166 673'], - - // GREEK SMALL LETTER MU - 0x3BC: [442,216,603,23,580,'58 -216Q44 -216 34 -208T23 -186Q23 -176 96 116T173 414Q186 442 219 442Q231 441 239 435T249 423T251 413Q251 401 220 279T187 142Q185 131 185 107V99Q185 26 252 26Q261 26 270 27T287 31T302 38T315 45T327 55T338 65T348 77T356 88T365 100L372 110L408 253Q444 395 448 404Q461 431 491 431Q504 431 512 424T523 412T525 402L449 84Q448 79 448 68Q448 43 455 35T476 26Q485 27 496 35Q517 55 537 131Q543 151 547 152Q549 153 557 153H561Q580 153 580 144Q580 138 575 117T555 63T523 13Q510 0 491 -8Q483 -10 467 -10Q446 -10 429 -4T402 11T385 29T376 44T374 51L368 45Q362 39 350 30T324 12T288 -4T246 -11Q199 -11 153 12L129 -85Q108 -167 104 -180T92 -202Q76 -216 58 -216'], - - // GREEK SMALL LETTER NU - 0x3BD: [442,2,494,45,530,'74 431Q75 431 146 436T219 442Q231 442 231 434Q231 428 185 241L137 51H140L150 55Q161 59 177 67T214 86T261 119T312 165Q410 264 445 394Q458 442 496 442Q509 442 519 434T530 411Q530 390 516 352T469 262T388 162T267 70T106 5Q81 -2 71 -2Q66 -2 59 -1T51 1Q45 5 45 11Q45 13 88 188L132 364Q133 377 125 380T86 385H65Q59 391 59 393T61 412Q65 431 74 431'], - - // GREEK SMALL LETTER XI - 0x3BE: [704,205,438,21,443,'268 632Q268 704 296 704Q314 704 314 687Q314 682 311 664T308 635T309 620V616H315Q342 619 360 619Q443 619 443 586Q439 548 358 546H344Q326 546 317 549T290 566Q257 550 226 505T195 405Q195 381 201 364T211 342T218 337Q266 347 298 347Q375 347 375 314Q374 297 359 288T327 277T280 275Q234 275 208 283L195 286Q149 260 119 214T88 130Q88 116 90 108Q101 79 129 63T229 20Q238 17 243 15Q337 -21 354 -33Q383 -53 383 -94Q383 -137 351 -171T273 -205Q240 -205 202 -190T158 -167Q156 -163 156 -159Q156 -151 161 -146T176 -140Q182 -140 189 -143Q232 -168 274 -168Q286 -168 292 -165Q313 -151 313 -129Q313 -112 301 -104T232 -75Q214 -68 204 -64Q198 -62 171 -52T136 -38T107 -24T78 -8T56 12T36 37T26 66T21 103Q21 149 55 206T145 301L154 307L148 313Q141 319 136 323T124 338T111 358T103 382T99 413Q99 471 143 524T259 602L271 607Q268 618 268 632'], - - // GREEK SMALL LETTER OMICRON - 0x3BF: [441,11,485,34,476,'201 -11Q126 -11 80 38T34 156Q34 221 64 279T146 380Q222 441 301 441Q333 441 341 440Q354 437 367 433T402 417T438 387T464 338T476 268Q476 161 390 75T201 -11ZM121 120Q121 70 147 48T206 26Q250 26 289 58T351 142Q360 163 374 216T388 308Q388 352 370 375Q346 405 306 405Q243 405 195 347Q158 303 140 230T121 120'], - - // GREEK SMALL LETTER PI - 0x3C0: [431,11,570,19,573,'132 -11Q98 -11 98 22V33L111 61Q186 219 220 334L228 358H196Q158 358 142 355T103 336Q92 329 81 318T62 297T53 285Q51 284 38 284Q19 284 19 294Q19 300 38 329T93 391T164 429Q171 431 389 431Q549 431 553 430Q573 423 573 402Q573 371 541 360Q535 358 472 358H408L405 341Q393 269 393 222Q393 170 402 129T421 65T431 37Q431 20 417 5T381 -10Q370 -10 363 -7T347 17T331 77Q330 86 330 121Q330 170 339 226T357 318T367 358H269L268 354Q268 351 249 275T206 114T175 17Q164 -11 132 -11'], - - // GREEK SMALL LETTER RHO - 0x3C1: [442,216,517,23,510,'58 -216Q25 -216 23 -186Q23 -176 73 26T127 234Q143 289 182 341Q252 427 341 441Q343 441 349 441T359 442Q432 442 471 394T510 276Q510 219 486 165T425 74T345 13T266 -10H255H248Q197 -10 165 35L160 41L133 -71Q108 -168 104 -181T92 -202Q76 -216 58 -216ZM424 322Q424 359 407 382T357 405Q322 405 287 376T231 300Q217 269 193 170L176 102Q193 26 260 26Q298 26 334 62Q367 92 389 158T418 266T424 322'], - - // GREEK SMALL LETTER FINAL SIGMA - 0x3C2: [442,107,363,30,405,'31 207Q31 306 115 374T302 442Q341 442 373 430T405 400Q405 392 399 383T379 374Q373 375 348 390T296 405Q222 405 160 357T98 249Q98 232 103 218T112 195T132 175T154 159T186 141T219 122Q234 114 255 102T286 85T299 78L302 74Q306 71 308 69T315 61T322 51T328 40T332 25T334 8Q334 -31 305 -69T224 -107Q194 -107 163 -92Q156 -88 156 -80Q156 -73 162 -67T178 -61Q186 -61 190 -63Q209 -71 224 -71Q244 -71 253 -59T263 -30Q263 -25 263 -21T260 -12T255 -4T248 3T239 9T227 17T213 25T195 34T174 46Q170 48 150 58T122 74T97 90T70 112T51 137T36 169T31 207'], - - // GREEK SMALL LETTER SIGMA - 0x3C3: [431,11,571,31,572,'184 -11Q116 -11 74 34T31 147Q31 247 104 333T274 430Q275 431 414 431H552Q553 430 555 429T559 427T562 425T565 422T567 420T569 416T570 412T571 407T572 401Q572 357 507 357Q500 357 490 357T476 358H416L421 348Q439 310 439 263Q439 153 359 71T184 -11ZM361 278Q361 358 276 358Q152 358 115 184Q114 180 114 178Q106 141 106 117Q106 67 131 47T188 26Q242 26 287 73Q316 103 334 153T356 233T361 278'], - - // GREEK SMALL LETTER TAU - 0x3C4: [431,13,437,18,517,'39 284Q18 284 18 294Q18 301 45 338T99 398Q134 425 164 429Q170 431 332 431Q492 431 497 429Q517 424 517 402Q517 388 508 376T485 360Q479 358 389 358T299 356Q298 355 283 274T251 109T233 20Q228 5 215 -4T186 -13Q153 -13 153 20V30L203 192Q214 228 227 272T248 336L254 357Q254 358 208 358Q206 358 197 358T183 359Q105 359 61 295Q56 287 53 286T39 284'], - - // GREEK SMALL LETTER UPSILON - 0x3C5: [443,10,540,21,523,'413 384Q413 406 432 424T473 443Q492 443 507 425T523 367Q523 334 508 270T468 153Q424 63 373 27T282 -10H268Q220 -10 186 2T135 36T111 78T104 121Q104 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Q21 299 34 333T82 404T161 441Q200 441 225 419T250 355Q248 336 247 334Q247 331 232 291T201 199T185 118Q185 68 211 47T275 26Q317 26 355 57T416 132T452 216T465 277Q465 301 457 318T439 343T421 361T413 384'], - - // GREEK SMALL LETTER PHI - 0x3C6: [442,218,654,50,618,'92 210Q92 176 106 149T142 108T185 85T220 72L235 70L237 71L250 112Q268 170 283 211T322 299T370 375T429 423T502 442Q547 442 582 410T618 302Q618 224 575 152T457 35T299 -10Q273 -10 273 -12L266 -48Q260 -83 252 -125T241 -179Q236 -203 215 -212Q204 -218 190 -218Q159 -215 159 -185Q159 -175 214 -2L209 0Q204 2 195 5T173 14T147 28T120 46T94 71T71 103T56 142T50 190Q50 238 76 311T149 431H162Q183 431 183 423Q183 417 175 409Q134 361 114 300T92 210ZM574 278Q574 320 550 344T486 369Q437 369 394 329T323 218Q309 184 295 109L286 64Q304 62 306 62Q423 62 498 131T574 278'], - - // GREEK SMALL LETTER CHI - 0x3C7: [443,204,626,24,600,'576 -125Q576 -147 547 -175T487 -204H476Q394 -204 363 -157Q334 -114 293 26L284 59Q283 58 248 19T170 -66T92 -151T53 -191Q49 -194 43 -194Q36 -194 31 -189T25 -177T38 -154T151 -30L272 102L265 131Q189 405 135 405Q104 405 87 358Q86 351 68 351Q48 351 48 361Q48 369 56 386T89 423T148 442Q224 442 258 400Q276 375 297 320T330 222L341 180Q344 180 455 303T573 429Q579 431 582 431Q600 431 600 414Q600 407 587 392T477 270Q356 138 353 134L362 102Q392 -10 428 -89T490 -168Q504 -168 517 -156T536 -126Q539 -116 543 -115T557 -114T571 -115Q576 -118 576 -125'], - - // GREEK SMALL LETTER PSI - 0x3C8: [694,205,651,21,634,'161 441Q202 441 226 417T250 358Q250 338 218 252T187 127Q190 85 214 61Q235 43 257 37Q275 29 288 29H289L371 360Q455 691 456 692Q459 694 472 694Q492 694 492 687Q492 678 411 356Q329 28 329 27T335 26Q421 26 498 114T576 278Q576 302 568 319T550 343T532 361T524 384Q524 405 541 424T583 443Q602 443 618 425T634 366Q634 337 623 288T605 220Q573 125 492 57T329 -11H319L296 -104Q272 -198 272 -199Q270 -205 252 -205H239Q233 -199 233 -197Q233 -192 256 -102T279 -9Q272 -8 265 -8Q106 14 106 139Q106 174 139 264T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Q21 299 34 333T82 404T161 441'], - - // GREEK SMALL LETTER OMEGA - 0x3C9: [443,12,622,15,604,'495 384Q495 406 514 424T555 443Q574 443 589 425T604 364Q604 334 592 278T555 155T483 38T377 -11Q297 -11 267 66Q266 68 260 61Q201 -11 125 -11Q15 -11 15 139Q15 230 56 325T123 434Q135 441 147 436Q160 429 160 418Q160 406 140 379T94 306T62 208Q61 202 61 187Q61 124 85 100T143 76Q201 76 245 129L253 137V156Q258 297 317 297Q348 297 348 261Q348 243 338 213T318 158L308 135Q309 133 310 129T318 115T334 97T358 83T393 76Q456 76 501 148T546 274Q546 305 533 325T508 357T495 384'], - - // GREEK THETA SYMBOL - 0x3D1: [705,11,591,21,563,'537 500Q537 474 533 439T524 383L521 362Q558 355 561 351Q563 349 563 345Q563 321 552 318Q542 318 521 323L510 326Q496 261 459 187T362 51T241 -11Q100 -11 100 105Q100 139 127 242T154 366Q154 405 128 405Q107 405 92 377T68 316T57 280Q55 278 41 278H27Q21 284 21 287Q21 291 27 313T47 368T79 418Q103 442 134 442Q169 442 201 419T233 344Q232 330 206 228T180 98Q180 26 247 26Q292 26 332 90T404 260L427 349Q422 349 398 359T339 392T289 440Q265 476 265 520Q265 590 312 647T417 705Q463 705 491 670T528 592T537 500ZM464 564Q464 668 413 668Q373 668 339 622T304 522Q304 494 317 470T349 431T388 406T421 391T435 387H436L443 415Q450 443 457 485T464 564'], - - // GREEK PHI SYMBOL - 0x3D5: [694,205,596,42,579,'409 688Q413 694 421 694H429H442Q448 688 448 686Q448 679 418 563Q411 535 404 504T392 458L388 442Q388 441 397 441T429 435T477 418Q521 397 550 357T579 260T548 151T471 65T374 11T279 -10H275L251 -105Q245 -128 238 -160Q230 -192 227 -198T215 -205H209Q189 -205 189 -198Q189 -193 211 -103L234 -11Q234 -10 226 -10Q221 -10 206 -8T161 6T107 36T62 89T43 171Q43 231 76 284T157 370T254 422T342 441Q347 441 348 445L378 567Q409 686 409 688ZM122 150Q122 116 134 91T167 53T203 35T237 27H244L337 404Q333 404 326 403T297 395T255 379T211 350T170 304Q152 276 137 237Q122 191 122 150ZM500 282Q500 320 484 347T444 385T405 400T381 404H378L332 217L284 29Q284 27 285 27Q293 27 317 33T357 47Q400 66 431 100T475 170T494 234T500 282'], - - // GREEK PI SYMBOL - 0x3D6: [431,10,828,19,823,'206 -10Q158 -10 136 24T114 110Q114 233 199 349L205 358H184Q144 358 121 347Q108 340 95 330T75 312T61 295T53 285Q51 284 38 284Q19 284 19 294Q19 300 38 329T93 391T164 429Q171 431 532 431Q799 431 803 430Q823 423 823 402Q823 377 801 364Q790 358 766 358Q748 358 748 357Q748 355 749 348T752 327T754 297Q754 258 738 207T693 107T618 24T520 -10Q488 -10 466 2T432 36T416 77T411 120Q411 128 410 128T404 122Q373 71 323 31T206 -10ZM714 296Q714 316 707 358H251Q250 357 244 348T230 328T212 301T193 267T176 229T164 187T159 144Q159 62 222 62Q290 62 349 127T432 285Q433 286 434 288T435 291T437 293T440 294T444 294T452 294H466Q472 288 472 286Q472 285 464 244T456 170Q456 62 534 62Q604 62 659 139T714 296'], - - // GREEK RHO SYMBOL - 0x3F1: [442,194,517,67,510,'205 -174Q136 -174 102 -153T67 -76Q67 -25 91 85T127 234Q143 289 182 341Q252 427 341 441Q343 441 349 441T359 442Q432 442 471 394T510 276Q510 169 431 80T253 -10Q226 -10 204 -2T169 19T146 44T132 64L128 73Q128 72 124 53T116 5T112 -44Q112 -68 117 -78T150 -95T236 -102Q327 -102 356 -111T386 -154Q386 -166 384 -178Q381 -190 378 -192T361 -194H348Q342 -188 342 -179Q342 -169 315 -169Q294 -169 264 -171T205 -174ZM424 322Q424 359 407 382T357 405Q322 405 287 376T231 300Q221 276 204 217Q188 152 188 116Q188 68 210 47T259 26Q297 26 334 62Q367 92 389 158T418 266T424 322'], - - // GREEK LUNATE EPSILON SYMBOL - 0x3F5: [431,11,406,40,382,'227 -11Q149 -11 95 41T40 174Q40 262 87 322Q121 367 173 396T287 430Q289 431 329 431H367Q382 426 382 411Q382 385 341 385H325H312Q191 385 154 277L150 265H327Q340 256 340 246Q340 228 320 219H138V217Q128 187 128 143Q128 77 160 52T231 26Q258 26 284 36T326 57T343 68Q350 68 354 58T358 39Q358 36 357 35Q354 31 337 21T289 0T227 -11'], - - // INCREMENT - 0x2206: [716,0,833,48,788,''] -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Math/Italic/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/BasicLatin.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/BasicLatin.js deleted file mode 100644 index 2e7e6b5aaa..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/BasicLatin.js +++ /dev/null @@ -1,290 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/SansSerif/Bold/BasicLatin.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_SansSerif-bold'], - { - // SPACE - 0x20: [0,0,250,0,0,''], - - // EXCLAMATION MARK - 0x21: [694,0,367,110,256,'111 669Q111 680 111 682T113 689T121 693T137 694H184H249Q255 686 256 681Q244 220 239 213Q236 208 229 208T183 207T137 207T127 213T118 431T111 669ZM110 71V95Q110 137 136 144Q140 146 183 146H200Q246 146 254 121Q256 115 256 73V51Q256 9 230 2Q225 0 181 0L138 1Q121 7 113 21L111 28L110 71'], - - // QUOTATION MARK - 0x22: [694,-442,558,37,420,'38 687Q42 693 45 693Q46 694 111 694H176Q179 690 183 687V556L144 501Q139 494 134 486T126 474T120 465T114 457T110 451T106 447T102 445T98 443T94 443T89 442H73H62Q37 442 37 453Q37 458 55 501T74 546Q74 548 59 548L44 549L38 555V687ZM275 687Q279 693 282 693Q283 694 348 694H413Q416 690 420 687V556L381 501Q376 494 371 486T363 474T357 465T351 457T347 451T343 447T339 445T335 443T331 443T326 442H310H299Q274 442 274 453Q274 458 292 501T311 546Q311 548 296 548L281 549L275 555V687'], - - // NUMBER SIGN - 0x23: [694,193,917,61,855,'61 365Q61 370 62 375T65 383T69 390T74 395T80 399T85 403T90 406L94 407H344L381 536Q418 668 426 680Q431 687 445 692Q451 694 457 694Q477 694 488 682T500 651Q500 645 466 528T431 409Q431 407 504 407H577L609 521Q651 668 656 675Q669 693 691 693Q710 693 721 680T733 651Q733 645 699 528T664 409Q664 407 743 407H823L827 405Q831 403 834 402T841 397T848 389T853 379T855 365Q855 337 823 324L731 323H639L619 253Q599 181 598 180V177H823L827 175Q831 173 834 172T841 167T848 159T853 149T855 135Q855 107 823 94L698 93H573L540 -21Q498 -168 493 -175Q480 -193 458 -193Q439 -193 428 -180T416 -151Q416 -144 450 -27T485 91Q485 93 412 93H340L307 -21Q265 -168 260 -175Q247 -193 225 -193Q206 -193 195 -180T183 -151Q183 -144 217 -27T252 91Q252 93 173 93L94 94Q61 105 61 135Q61 140 62 145T65 153T69 160T74 165T80 169T85 173T90 176L94 177H185L277 178L297 248L318 320V323H206L94 324Q61 335 61 365ZM551 320V323H479Q406 323 405 322Q404 319 385 249T365 178T438 177L510 178L530 248L551 320'], - - // DOLLAR SIGN - 0x24: [750,56,550,49,488,'231 712L232 716Q232 719 232 722T234 729T239 736T246 743T256 748T271 750Q318 750 318 711V703Q393 692 451 656Q469 645 470 640Q470 635 461 587L453 537Q445 529 442 529Q438 529 424 540T384 565T330 585Q328 585 325 585T320 586L318 587V434Q322 433 333 429T350 424T365 418T382 409T399 397T419 380Q488 313 488 213Q488 24 334 -5L318 -8V-17Q318 -56 279 -56H272Q253 -56 243 -46T232 -30T231 -18V-8H224Q170 2 127 20T68 50T49 67Q49 71 58 122T68 176Q71 182 79 182Q83 182 98 169T145 138T216 110Q228 108 229 108H231V288Q167 299 114 356T61 496Q61 537 70 570T94 624T126 661T162 684T195 696T219 701L228 702H231V712ZM231 521Q231 583 230 583Q226 582 220 579T204 561T193 521Q193 491 212 472Q226 458 230 458Q231 458 231 521ZM318 112Q356 131 356 187Q356 237 318 263V112'], - - // PERCENT SIGN - 0x25: [750,57,1029,61,966,'61 549Q61 733 218 749Q220 749 228 749T241 750Q286 750 321 735T369 708T389 683Q422 634 422 548V538Q422 519 420 501T408 453T381 401T328 364T243 347Q61 347 61 549ZM292 549Q292 663 242 663Q221 663 211 648T198 615T196 566V548Q196 471 206 454Q218 434 242 434Q292 434 292 549ZM243 -55Q223 -55 212 -42T201 -13Q201 -2 207 7Q209 11 480 371T758 738Q770 750 788 750Q805 750 817 738T830 709Q830 694 820 681L544 315Q273 -43 269 -47Q258 -55 243 -55ZM606 146Q606 330 763 346Q764 346 773 346T786 347Q831 347 866 332T914 305T934 280Q966 233 966 146V135Q966 115 964 97T952 49T925 -2T872 -40T788 -56Q606 -56 606 146ZM742 146V132Q742 107 743 93T748 62T762 39T787 31Q819 31 832 79Q837 97 837 146Q837 260 787 260Q767 260 757 246T744 214T742 169V146'], - - // AMPERSAND - 0x26: [716,23,831,47,769,'757 117Q762 117 769 110V3Q759 -7 718 -14T641 -22T571 -15T518 1T477 19T453 31L437 23Q350 -19 257 -22Q158 -22 103 30T47 155Q47 188 57 216T87 263T119 292T151 313L182 333L187 336L181 349Q150 431 150 506Q150 605 211 660T347 716Q417 716 471 668T526 543Q526 517 518 495T471 432T360 343L342 330Q342 327 358 306T402 250T458 189L467 181Q518 225 556 289T607 395L620 437Q622 443 630 443Q631 443 679 430Q718 420 725 418T733 409Q733 402 722 365T670 255T573 123Q562 111 563 111Q589 94 644 94Q678 94 703 100T740 111T757 117ZM397 544Q397 573 384 601T346 629Q320 629 299 607T277 538Q277 484 295 429Q301 413 301 412Q302 409 309 415Q397 476 397 544ZM227 258Q197 228 197 177Q197 150 207 126T234 95Q242 93 251 93Q288 93 337 107L349 110L328 131Q266 196 234 248L227 258'], - - // APOSTROPHE - 0x27: [694,-442,306,80,226,'81 687Q85 693 88 693Q89 694 154 694H219Q222 690 226 687V556L187 501Q182 494 177 486T169 474T163 465T157 457T153 451T149 447T145 445T141 443T137 443T132 442H116H105Q80 442 80 453Q80 458 98 501T117 546Q117 548 102 548L87 549L81 555V687'], - - // LEFT PARENTHESIS - 0x28: [750,249,428,79,366,'79 250Q79 352 100 441T152 585T213 678T266 733L287 749Q288 750 324 750H359Q366 741 366 738Q366 734 356 721T329 682T296 623T262 531T238 407Q230 346 230 250Q230 142 244 55T278 -82T318 -165T352 -215T366 -238Q366 -242 359 -249H286L277 -242Q79 -74 79 250'], - - // RIGHT PARENTHESIS - 0x29: [750,250,428,61,348,'61 737Q61 750 85 750H106H141L150 742Q348 574 348 250T150 -242L141 -249L106 -250H87Q61 -250 61 -238Q61 -233 74 -216Q157 -113 183 51Q197 130 197 250T183 449Q174 505 158 554T126 634T95 687T71 722T61 737'], - - // ASTERISK - 0x2A: [750,-293,550,67,482,'241 579Q241 582 228 639T215 702Q215 722 233 736T271 750Q296 750 315 736T334 702V697Q334 693 328 664T314 607L308 579L352 620Q389 654 397 660T417 668Q447 668 464 647T482 602Q482 591 479 583T472 569T459 559T443 552T421 546T397 538L342 521L397 504Q405 501 420 497T442 490T458 483T472 473T479 460T482 440Q482 416 465 395T417 374Q406 375 398 381T352 422L308 463L314 435Q321 407 327 378T334 345Q336 333 327 319T296 295Q288 293 275 293Q241 293 227 311T215 345Q215 349 221 378T234 435L241 463L197 422Q160 388 152 382T132 374Q102 374 85 395T67 440Q67 451 70 459T77 473T90 483T106 490T128 496T152 504L207 521L152 538Q144 541 129 545T107 552T91 559T77 569T70 582T67 602Q67 626 84 647T132 668Q143 667 151 661T197 620L241 579'], - - // PLUS SIGN - 0x2B: [617,116,856,61,794,'61 250Q61 276 94 292H386V436V535Q386 577 388 589T401 607Q411 617 427 617Q458 617 468 587Q470 581 470 436V292H762L766 290Q770 288 773 287T780 282T787 274T792 264T794 250Q794 222 762 209L616 208H470V64Q470 -81 468 -87Q458 -116 428 -116T388 -87Q386 -81 386 64V208H240L94 209Q61 220 61 250'], - - // COMMA - 0x2C: [146,106,306,80,226,'81 139Q85 145 88 145Q89 146 154 146H219Q222 142 226 139V8L187 -47Q182 -54 177 -62T169 -74T163 -83T157 -91T153 -97T149 -101T145 -103T141 -105T137 -105T132 -106H116H105Q80 -106 80 -95Q80 -90 98 -47T117 -2Q117 0 102 0L87 1L81 7V139'], - - // HYPHEN-MINUS - 0x2D: [274,-185,367,12,306,'12 230Q12 257 26 265T80 274Q88 274 114 274T158 273T201 273T235 274Q276 274 290 266T305 230T291 194T235 185Q226 185 201 185T159 186Q143 186 119 186T85 185Q43 185 28 193T12 230'], - - // FULL STOP - 0x2E: [146,0,306,80,226,'219 146Q222 142 226 139V7L222 4L219 1L154 0Q102 0 94 0T82 6Q80 9 80 74L81 139Q85 145 88 145Q89 146 154 146H219'], - - // SOLIDUS - 0x2F: [750,249,550,61,488,'103 -249Q81 -249 71 -235T61 -207Q61 -201 62 -198Q64 -192 235 265T409 727Q418 750 445 750Q464 750 476 737T488 707Q488 701 313 234Q143 -225 137 -232Q126 -249 103 -249'], - - // DIGIT ZERO - 0x30: [715,22,550,43,507,'274 -22Q227 -22 190 -9T128 24T87 76T62 135T49 204T44 271T43 336V343V362Q43 407 45 440T56 524T86 613T141 677Q197 715 264 715Q314 715 353 702T418 669T460 616T487 555T500 483T505 413T506 343Q506 310 506 293T503 241T498 185T486 133T467 83T437 42T397 8T343 -13T274 -22ZM355 355V401Q355 448 354 476T349 537T336 587T311 617T272 629Q270 629 266 629T261 628Q219 618 207 568T194 419V355Q194 203 200 156T231 85Q250 66 275 66Q299 66 318 85Q342 109 348 156T355 355'], - - // DIGIT ONE - 0x31: [716,-1,550,76,473,'118 560H116Q107 560 100 561T85 572T76 600Q76 612 77 618T83 632T99 644Q102 645 135 646T207 660T275 700Q292 716 310 716Q353 716 360 691Q362 685 362 386V87H446Q464 76 468 69T473 44Q473 12 446 1H118Q105 7 100 13T94 25T93 44V62Q100 79 119 87H210V329Q210 571 208 571Q182 560 118 560'], - - // DIGIT TWO - 0x32: [716,0,550,46,494,'339 477Q339 505 332 531T301 579T242 601Q165 601 136 503Q133 493 130 490T121 486Q116 486 94 514Q86 523 82 528Q46 572 46 577Q46 591 77 632T147 691Q192 716 257 716Q305 716 351 700Q416 674 455 615T494 481Q494 421 463 376T356 266Q326 240 287 205T224 146T199 122H331Q359 122 392 122T431 123H445Q485 123 492 98Q494 92 494 62V47Q494 9 468 2Q463 0 272 0L83 1Q63 7 56 28L55 57V89Q59 97 215 261Q255 303 275 327T317 394T339 477'], - - // DIGIT THREE - 0x33: [716,22,550,46,503,'61 624Q62 630 83 650T153 693T262 716Q328 716 373 698T438 650T465 593T473 536Q473 438 375 376L387 371Q450 350 476 305T503 208Q503 164 492 126T456 53T380 -2T261 -22Q224 -22 189 -15T130 2T86 24T57 43T46 53Q46 56 53 99T62 145Q65 152 71 152Q76 152 90 143T123 121T175 99T248 87Q302 87 321 113T341 202Q341 264 329 292T279 329L232 331L190 332L184 338V411Q190 417 192 417Q193 418 205 419T232 421T252 424Q280 430 299 461T318 539V551Q318 599 283 609Q276 611 257 611Q225 611 199 601T159 577T136 554T120 543T102 560T76 597T62 618T61 624'], - - // DIGIT FOUR - 0x34: [695,0,550,31,518,'278 693H282Q285 693 291 693T305 694T322 694T342 694H377Q402 694 411 691T430 677Q434 670 434 646T435 456V249H461H472Q509 249 516 224Q518 219 518 194Q518 178 518 171T511 155T492 142Q488 140 461 140H435V86V53Q435 9 409 2Q405 0 366 0H351Q306 0 298 25Q296 31 296 86V140H179H123Q99 140 80 129T50 106T37 95Q31 95 31 163V208Q31 246 33 251Q251 673 262 684Q268 691 278 693ZM302 249V416L301 576Q301 536 165 276L151 250L226 249H302'], - - // DIGIT FIVE - 0x35: [694,22,550,36,494,'109 282Q87 290 83 310V666Q83 667 84 670T87 676T91 682T98 688T108 693Q112 694 269 694T431 692Q457 686 457 648V637V624Q457 588 431 581Q426 579 326 579H227V510Q227 442 229 442Q243 450 288 450Q377 450 435 399T494 222Q494 -22 241 -22Q202 -22 167 -11T109 16T69 49T45 79T37 94T69 151Q91 185 97 185Q105 185 112 170Q127 135 160 111T240 87Q266 87 284 94T311 111T325 142T331 179T332 226Q332 307 324 335T281 363Q228 363 197 306Q189 289 172 282H109'], - - // DIGIT SIX - 0x36: [716,22,550,46,503,'414 589Q410 589 389 600T334 612Q275 612 243 575Q209 538 202 433V422L209 431Q243 487 317 487Q392 487 440 442Q478 402 490 357T503 236Q503 113 454 54Q421 13 381 -4T279 -22Q263 -22 250 -21T214 -15T173 1T133 30T96 77T68 146T50 242Q46 278 46 336Q46 406 52 447Q84 698 312 715L315 716Q318 716 321 716Q323 716 328 716T337 715Q398 715 425 688V596Q419 591 414 589ZM282 87Q324 89 336 117T348 231Q348 310 343 343T324 388T277 399Q249 399 231 373T208 317T202 253Q202 201 207 168T224 117T249 93T282 87'], - - // DIGIT SEVEN - 0x37: [695,11,550,46,503,'135 38Q135 190 198 335T353 572H215Q185 572 151 572T110 571H96Q55 571 48 596Q46 602 46 633V648Q46 686 72 693Q76 695 124 695Q134 695 183 695T274 694Q472 694 477 692Q503 686 503 648V637Q503 612 502 605T491 588Q300 349 292 46V36Q292 -4 266 -9Q262 -11 214 -11H192Q160 -11 148 -3T135 38'], - - // DIGIT EIGHT - 0x38: [715,22,550,46,503,'61 518Q61 574 79 614T128 676T192 706T263 715H270Q298 715 318 714T373 701T430 671T470 612T488 517Q488 459 458 423T390 376Q388 375 393 373Q395 372 398 371Q503 330 503 204Q503 -22 275 -22Q209 -22 163 -3T92 49T57 120T46 204Q46 230 50 252T61 289T77 318T96 339T116 353T134 363T148 369T158 373T160 376Q118 389 90 424T61 518ZM344 538Q344 563 340 578T326 600T307 609T279 612Q232 612 218 594T204 518Q204 459 216 439T275 418Q328 418 338 450Q344 464 344 515V538ZM248 88T274 88T315 94T338 117T346 149T349 197Q349 269 342 290Q338 309 320 320T274 331Q246 331 229 320T207 290Q200 269 200 197Q201 163 202 149T210 118T232 94'], - - // DIGIT NINE - 0x39: [716,22,550,46,503,'347 272Q346 272 342 266T330 250T309 230T276 214T230 207Q185 207 150 223Q116 240 90 276T54 357Q46 393 46 468Q46 469 46 484T47 502T48 520T51 540T55 559T61 579T69 599T81 620T96 640T115 661Q174 716 276 716Q299 716 317 714T369 698T426 658T471 580T499 456Q503 402 503 342Q503 115 392 29Q322 -22 231 -22Q163 -22 115 7L82 31Q76 38 81 46Q116 112 127 123Q130 126 134 126T148 116T179 97T226 87Q287 87 318 132Q323 139 326 146T332 165T337 182T340 204T342 225T345 249T347 272ZM201 547T201 454T211 329T262 294Q276 294 285 296T310 312T335 355Q347 391 347 447Q347 520 340 550T317 595Q300 612 277 612Q226 612 214 580'], - - // COLON - 0x3A: [458,0,306,80,226,'226 319L219 313H87L81 319L80 384Q80 437 80 445T86 456Q89 458 154 458H219Q222 454 226 451V319ZM219 146Q222 142 226 139V7L222 4L219 1L154 0Q102 0 94 0T82 6Q80 9 80 74L81 139Q85 145 88 145Q89 146 154 146H219'], - - // SEMICOLON - 0x3B: [458,106,306,80,226,'226 319L219 313H87L81 319L80 384Q80 437 80 445T86 456Q89 458 154 458H219Q222 454 226 451V319ZM81 139Q85 145 88 145Q89 146 154 146H219Q222 142 226 139V8L187 -47Q182 -54 177 -62T169 -74T163 -83T157 -91T153 -97T149 -101T145 -103T141 -105T137 -105T132 -106H116H105Q80 -106 80 -95Q80 -90 98 -47T117 -2Q117 0 102 0L87 1L81 7V139'], - - // EQUALS SIGN - 0x3D: [407,-94,856,61,795,'94 324Q61 335 61 366Q61 396 91 405Q96 407 429 407H762Q763 406 767 404T774 400T781 395T787 387T792 378T794 365Q794 338 762 324H94ZM94 94Q61 105 61 135Q61 149 69 160T92 175Q97 177 430 177H762L766 175Q770 173 773 172T780 167T787 159T792 149T794 135Q794 107 762 94H94'], - - // QUESTION MARK - 0x3F: [706,0,519,61,457,'61 644Q61 652 87 666T157 693T244 705Q344 705 400 671T457 551Q457 516 446 490T422 451T387 421T356 391Q330 361 318 332T305 292T303 252Q303 218 300 213T290 208T244 207H220Q194 207 188 213Q187 214 186 215V255Q187 282 188 296T198 345T229 417T288 496Q306 515 306 559Q306 596 296 607T253 618Q214 618 185 607T143 583T120 558T103 547Q99 547 95 551Q93 553 77 597T61 644ZM171 71V95Q171 137 197 144Q201 146 244 146H261Q307 146 315 121Q317 115 317 73V51Q317 9 291 2Q286 0 242 0L199 1Q182 7 174 21L172 28L171 71'], - - // COMMERCIAL AT - 0x40: [704,11,733,61,671,'61 264T61 347T82 494T136 596T217 660T311 694T410 704Q460 704 471 703Q534 694 577 666Q633 623 651 552T670 370V342Q670 249 633 195Q583 116 454 116Q238 116 238 347Q238 443 276 499Q328 578 456 578Q488 578 494 577L504 575Q475 617 430 617H421Q196 617 196 347Q196 215 253 143Q310 76 427 76Q499 76 561 102L575 107H664Q671 97 671 94V89L663 81Q566 -11 422 -11Q365 -11 316 -2T219 33T137 97T82 200ZM469 490Q459 492 453 492Q429 492 405 472Q374 439 374 347Q374 233 423 210Q436 202 454 202L486 210Q536 228 536 347Q536 461 486 484Q476 490 469 490'], - - // LATIN CAPITAL LETTER A - 0x41: [694,1,733,42,690,'110 0H86Q42 0 42 27Q42 37 148 350T258 667Q269 687 291 692Q295 694 366 694H399Q432 694 448 689T474 667Q477 663 583 350T690 27Q690 0 642 0H617H592Q582 0 575 1T561 2T549 6T541 11T533 18T527 26T522 37T517 49T512 64T506 81L490 130H225Q225 128 208 79T189 27Q185 19 180 14T170 7T156 3T143 1T127 0T110 0ZM439 279Q359 524 359 547L357 555L355 543Q347 503 270 263L259 231H357Q455 231 455 232L439 279'], - - // LATIN CAPITAL LETTER B - 0x42: [694,-1,733,92,671,'119 1Q98 5 92 28V667Q98 686 118 693Q121 694 272 694H289H346Q439 694 500 681T600 625Q640 580 640 513Q640 451 601 414T504 364L518 361Q568 351 602 329T649 280T666 235T671 197Q671 172 665 147T642 91T586 37T488 5Q456 1 282 1H119ZM489 509Q489 532 479 548T450 573T421 585T394 591Q387 592 315 593H247V404H298H325Q432 404 466 444Q489 470 489 509ZM517 194Q517 235 502 261T458 299T407 313T353 317H329H322H247V101H319H357Q387 101 407 103T452 111T492 133T514 171Q516 176 517 194'], - - // LATIN CAPITAL LETTER C - 0x43: [704,11,703,61,647,'423 -11Q339 -11 275 9T171 62T106 143T71 240T61 347Q61 450 93 527Q157 664 313 694Q357 704 416 704Q479 704 517 699T608 676Q634 667 635 660Q635 653 624 592L612 528L609 524Q604 521 601 521Q595 521 583 531T555 555T505 578T428 589H424Q298 589 250 494Q224 438 224 347Q224 292 233 251T265 175T329 122T432 104Q488 104 524 115T604 158Q607 160 610 162T615 165T619 168L621 170Q625 172 630 170T637 163Q638 160 642 109T647 54Q646 49 625 37T568 11T499 -7Q463 -11 423 -11'], - - // LATIN CAPITAL LETTER D - 0x44: [695,0,794,92,732,'119 1Q98 5 92 28V667Q98 686 118 693H124Q131 693 142 693T168 694T200 694T237 694H296Q416 694 450 692T525 677Q732 617 732 342Q732 169 644 81Q593 32 528 16T372 0Q356 0 324 0T276 1H119ZM573 349Q573 387 571 413T559 473T532 527T482 567T403 591Q395 592 320 593H250V101H321Q418 102 456 114Q553 144 569 263Q573 303 573 349'], - - // LATIN CAPITAL LETTER E - 0x45: [691,0,642,92,595,'277 122Q280 122 380 123T544 125Q552 125 557 125T565 124T569 124Q595 115 595 75V62V47Q595 9 569 2Q564 0 341 0L119 1Q99 7 92 28V664Q98 683 118 690Q121 691 335 691T554 689Q580 682 580 644V632V618Q580 582 554 573Q553 573 551 573T542 572T527 572Q464 572 364 573T260 575H253V412H385H459Q524 412 536 404T549 357Q549 341 549 334T542 318T523 305Q518 303 385 303H253V122H277'], - - // LATIN CAPITAL LETTER F - 0x46: [691,0,611,92,564,'512 572Q451 572 356 573T258 575H253V400H370H431Q494 400 506 392T518 345Q518 307 507 299T437 291H370H253V161Q253 141 253 113T254 75Q254 23 245 12T195 0H170L119 1Q99 7 92 28V664Q98 683 118 690Q121 691 327 691T538 689Q564 682 564 644V632V618Q564 582 538 573Q537 573 535 573T526 572T512 572'], - - // LATIN CAPITAL LETTER G - 0x47: [705,11,733,60,659,'61 347Q61 405 70 454T105 550T171 631T276 685T426 705Q483 705 537 693T620 668T650 646Q650 645 649 637T645 612T639 578L627 514L624 510Q620 507 615 507T597 520T566 548T512 577T430 590Q223 590 223 347T431 104Q478 104 506 112Q508 112 508 164V215H471L434 216L428 222L427 268Q427 315 429 318Q432 323 444 323T544 324H652Q655 320 659 317V45L656 43Q654 39 624 27T536 2T424 -11Q366 -11 317 -2T219 33T137 97T82 200T61 347'], - - // LATIN CAPITAL LETTER H - 0x48: [694,0,794,92,702,'92 667Q101 694 143 694H172H198Q244 694 251 669Q253 663 253 539V415H540V539Q540 558 540 585T539 621Q539 673 550 683T611 694H621H646Q671 694 683 690T700 669Q702 663 702 347T700 25Q696 9 684 5T646 0H621H606Q560 0 550 11T539 76Q539 85 539 116T540 169V306H253V169Q253 147 253 116T254 75Q254 23 245 12T194 0H170L119 1Q99 7 92 28V667'], - - // LATIN CAPITAL LETTER I - 0x49: [694,0,331,85,246,'85 667Q94 694 136 694H165H191Q237 694 244 669Q246 663 246 347T244 25Q235 0 192 0H163L112 1Q92 7 85 28V667'], - - // LATIN CAPITAL LETTER J - 0x4A: [694,22,519,46,427,'236 -22Q190 -22 144 -11T72 12T46 29Q63 147 69 153Q80 164 92 146Q124 91 191 91Q222 91 242 102T267 134Q268 139 268 402Q268 663 270 669Q275 687 294 692Q298 694 347 694H367Q393 694 406 690T425 669Q427 663 427 399Q427 132 426 125Q421 87 404 58T366 15T318 -9T273 -20T236 -22'], - - // LATIN CAPITAL LETTER K - 0x4B: [694,0,764,92,701,'92 667Q101 694 139 694H163H186Q225 694 234 671Q236 663 236 529L237 392L533 682Q550 694 590 694H623H681Q695 680 695 672Q695 670 693 664Q688 657 561 533L431 405L698 33Q701 28 701 23Q701 7 683 0H626H604Q571 0 564 2T545 13Q544 14 530 33T489 90T437 162L332 307Q331 307 284 260L236 214V122V65Q236 32 231 19T210 2Q205 0 161 0L119 1Q99 7 92 28V667'], - - // LATIN CAPITAL LETTER L - 0x4C: [694,0,581,92,534,'92 667Q98 684 109 689T142 694H172H198Q244 694 251 669Q253 663 253 389V116L278 117Q410 119 490 119H495Q511 119 517 115T534 93V63V48Q534 9 508 2Q503 0 310 0L119 1Q99 7 92 28V667'], - - // LATIN CAPITAL LETTER M - 0x4D: [695,0,978,92,886,'92 667Q98 684 109 689T146 695Q152 695 167 695T192 694Q200 694 214 694T234 695Q291 695 305 664Q313 651 400 419T487 165Q487 162 488 162T489 165Q489 187 574 413T671 664Q679 680 695 688Q708 694 785 694H828Q855 694 867 689T884 669Q886 663 886 347T884 25Q876 0 832 0H817H802Q758 0 750 25Q748 31 748 293V555L746 544Q737 509 692 386T606 160T564 52Q548 22 502 22H487H472Q423 22 410 52Q407 59 367 160T283 385T231 546L230 548Q229 548 229 293Q229 31 227 25Q222 9 211 5T176 0H158L119 1Q99 7 92 28V667'], - - // LATIN CAPITAL LETTER N - 0x4E: [694,0,794,92,702,'92 667Q98 684 109 689T146 694H185Q273 694 279 692Q301 689 315 669Q322 660 419 453L554 163L562 143Q564 143 564 401Q564 663 566 669Q574 694 618 694H633H648Q692 694 700 669Q702 663 702 347T700 25Q696 10 683 5T642 0H596H551Q520 0 505 4T478 25Q471 34 374 241L239 532Q231 550 231 552L229 479Q229 440 229 293Q229 31 227 25Q222 9 211 5T176 0H158L119 1Q99 7 92 28V667'], - - // LATIN CAPITAL LETTER O - 0x4F: [716,22,794,62,731,'362 715Q364 715 376 715T394 716H400Q542 716 626 643T727 426Q731 395 731 342Q731 271 722 225Q674 -22 396 -22Q320 -22 259 -3T148 68T77 201Q62 257 62 342Q62 447 86 522T173 649Q245 707 362 715ZM568 433Q551 623 396 623Q383 623 370 622T333 612T292 591T257 550T233 485Q223 442 223 350Q223 276 232 227T267 137Q309 74 397 74Q433 74 461 85T507 113T537 156T556 205T566 260T569 310T570 357Q570 409 568 433'], - - // LATIN CAPITAL LETTER P - 0x50: [694,0,703,92,641,'641 470Q641 426 630 391T603 334T561 295T513 271T459 259T408 254T361 253H350H337H253V142Q253 125 253 100T254 67Q254 32 249 19T227 2Q222 0 170 0L119 1Q99 7 92 28V667Q98 686 118 693Q121 694 271 694Q428 693 462 688Q641 656 641 470ZM487 467Q487 495 485 510T474 546T442 578T382 592Q375 593 310 593H250V347H309H339Q364 347 380 348T418 354T451 368T474 395T486 438Q487 444 487 467'], - - // LATIN CAPITAL LETTER Q - 0x51: [716,106,794,62,732,'450 -20Q444 -20 429 -21T396 -22Q320 -22 259 -3T148 68T77 201Q62 257 62 342Q62 447 86 522T173 649Q245 707 362 715Q364 715 376 715T394 716Q732 716 732 340Q732 268 719 210T686 120T647 68T615 39T601 29T638 -22T676 -73Q679 -78 679 -83Q679 -98 661 -106H593Q526 -106 521 -104Q514 -103 507 -97T496 -84T477 -55L454 -19L450 -20ZM554 509Q516 622 391 622Q294 622 250 535Q220 475 220 345Q220 299 222 266T234 198T258 140T299 99T363 74Q378 71 393 71H395L381 92Q367 114 353 136T338 161Q336 165 336 170Q336 186 352 193L361 194Q370 194 384 194T412 194H452Q457 194 460 194T466 194T471 192T476 191T480 188T483 185T487 180T492 174T497 167T504 158L526 129Q532 127 552 175Q573 231 573 348Q573 455 554 509'], - - // LATIN CAPITAL LETTER R - 0x52: [695,0,703,92,654,'654 24Q654 9 644 5T612 0H577L521 1Q509 5 503 13Q498 20 421 160L343 304H250V168Q250 147 250 118T251 78Q251 24 242 12T192 0H168L119 1Q99 7 92 28V667Q98 686 118 693H124Q131 693 141 693T165 694T195 694T229 694T280 694T332 695Q389 695 428 691T510 675T582 637T627 569Q641 532 641 493Q641 377 537 331L497 317L493 316L571 177Q653 28 654 24ZM487 472T487 492T485 525T476 553T450 577T404 591Q398 592 322 593H250V391H321Q327 391 353 391T385 392T412 395T438 401T457 412T474 430T483 456'], - - // LATIN CAPITAL LETTER S - 0x53: [716,22,611,49,549,'61 503Q61 547 72 583T110 650T186 698T305 716Q405 716 496 671Q513 664 514 657Q514 656 513 648T509 623T503 589L491 525L488 521Q484 518 479 518H475L461 532Q430 565 395 581T305 598Q201 598 201 523Q201 480 240 462T345 431T443 394Q549 324 549 204Q549 160 538 123T502 51T427 -2T308 -22Q180 -22 69 41Q50 52 49 57Q49 58 50 66T54 91T60 125L72 189L75 193Q80 196 84 196Q87 196 104 182T145 149T212 117T304 102Q408 102 408 188Q408 215 396 234T362 263T319 278T267 290T219 302Q149 324 105 380T61 503'], - - // LATIN CAPITAL LETTER T - 0x54: [688,0,733,40,692,'67 687Q70 688 366 688Q661 688 666 686Q692 680 692 641V629V615Q692 579 666 570H660Q655 569 648 569Q645 569 624 569T581 570Q505 570 475 572H447V302Q447 31 445 25Q436 0 393 0H364L313 1Q293 7 286 28L285 300V572H257Q227 570 151 570Q130 570 109 570T84 569Q77 569 72 570H66Q48 577 44 588T40 631L41 661Q47 680 67 687'], - - // LATIN CAPITAL LETTER U - 0x55: [694,22,764,92,672,'92 667Q101 694 143 694H172H200Q242 694 251 671Q253 663 253 430Q254 189 255 185Q262 134 288 107T384 79Q498 79 516 168Q520 191 521 431Q521 663 523 671Q532 694 572 694H596H618Q639 694 648 692T665 679Q671 672 671 653Q672 632 672 555V432Q671 200 670 190Q652 79 581 29T383 -22Q137 -22 98 166Q92 195 92 303V667'], - - // LATIN CAPITAL LETTER V - 0x56: [694,-1,733,27,705,'27 667Q27 683 39 688T75 694H101Q155 694 159 692Q182 687 194 665Q202 652 283 419T374 142Q376 165 473 445Q552 664 553 666Q568 694 618 694H639H658Q681 694 693 689T705 667Q705 660 592 347Q481 32 477 28Q466 7 441 1H292Q266 7 255 28Q251 32 140 347Q27 660 27 667'], - - // LATIN CAPITAL LETTER W - 0x57: [694,0,1039,24,1014,'994 694Q1012 683 1014 668Q1014 661 977 519T896 217T845 26Q831 0 783 0H747H711Q685 0 672 5T649 26Q644 36 583 272T517 548Q516 552 516 551Q503 479 437 227Q389 37 383 26Q367 0 323 0H288H254Q207 0 193 26Q191 32 108 346T24 665Q24 685 44 693Q47 694 98 694H115Q152 694 168 668Q174 657 235 417T297 144Q297 134 300 153Q307 204 362 421T427 668Q441 694 488 694H523Q586 694 597 688Q612 683 620 661T651 549Q664 496 673 462Q744 194 750 146V140Q767 223 800 354T857 576T883 668Q897 694 938 694H958H994'], - - // LATIN CAPITAL LETTER X - 0x58: [695,0,733,37,694,'52 1Q37 11 37 23Q37 26 39 32Q39 34 158 202L275 369Q275 370 221 441T112 586T55 663Q53 669 53 672Q53 687 68 693H72Q77 693 84 693T99 694T118 694T139 694H176Q203 694 212 692T230 682Q231 681 239 669T265 634T296 591L358 504L418 591Q481 682 486 686Q491 691 499 692Q505 694 569 694H632Q650 685 650 672Q650 667 646 660Q643 654 592 582T491 440T441 369T566 201T693 29Q694 27 694 23Q694 11 677 0H607L537 1Q523 6 519 10T437 131Q422 153 411 170T390 200T375 222T365 237T359 245L357 247L348 232Q339 218 319 188T283 131Q222 37 211 22T186 1H52'], - - // LATIN CAPITAL LETTER Y - 0x59: [694,0,733,24,708,'635 694H668Q688 694 698 690T708 670Q708 664 704 658L446 278L445 152V27Q442 20 440 17T433 9T419 1L368 0H339Q316 0 305 5T288 26Q286 31 286 154V278L157 468Q135 500 101 550Q43 635 34 650T24 671Q24 686 39 693Q42 694 105 694H122H132Q163 694 180 689T214 666Q225 654 336 485Q373 425 373 420L374 418Q375 419 375 421Q378 432 418 493T496 609T536 667Q543 676 551 681T572 689T591 693T615 694T635 694'], - - // LATIN CAPITAL LETTER Z - 0x5A: [694,0,672,61,616,'411 584Q243 581 131 581Q122 581 116 581T106 582T102 582Q84 589 80 600T76 640L77 667Q83 686 103 693Q106 694 343 694Q579 694 584 692Q592 691 599 684T609 668Q610 665 610 646Q610 614 608 608Q605 603 434 361L261 116Q340 117 402 118T490 119T533 120T560 120H572Q605 120 614 95Q616 89 616 60V46Q616 9 590 2Q585 0 339 0Q92 0 87 2Q79 3 72 10T62 26Q61 29 61 49Q61 84 63 90Q65 94 152 217T325 461T411 584'], - - // LEFT SQUARE BRACKET - 0x5B: [751,251,343,79,318,'318 -206Q318 -235 305 -243T255 -251Q248 -251 229 -251T198 -250H143Q112 -250 99 -246T81 -225Q79 -219 79 250T81 725Q85 741 98 745T143 750H198Q210 750 229 750T255 751Q291 751 304 743T318 707Q318 680 301 668Q293 663 255 663H224V-163H255Q293 -163 301 -168Q318 -180 318 -206'], - - // RIGHT SQUARE BRACKET - 0x5D: [751,251,343,24,263,'24 706Q24 734 39 742T90 751Q97 751 114 751T143 750H198Q230 750 243 746T261 725Q263 719 263 250T261 -225Q257 -241 244 -245T198 -250H143Q131 -250 112 -250T86 -251Q50 -251 37 -243T24 -207Q24 -180 41 -168Q49 -163 87 -163H118V663H87H71Q24 663 24 706'], - - // CIRCUMFLEX ACCENT - 0x5E: [694,-537,550,108,441,'108 550Q108 554 135 589T190 658T219 692Q221 694 275 694Q328 694 330 693Q331 692 381 629T438 557Q441 553 441 549T434 538L399 537Q363 537 362 538Q361 538 318 575L275 611Q274 611 231 575Q188 538 187 538Q186 537 150 537L115 538Q108 545 108 550'], - - // LOW LINE - 0x5F: [-23,110,550,0,549,'0 -66Q0 -32 26 -25Q30 -23 274 -23Q469 -23 497 -23T532 -28Q549 -40 549 -67Q549 -93 532 -105Q525 -109 498 -109T275 -110Q31 -110 26 -108Q0 -101 0 -66'], - - // LATIN SMALL LETTER A - 0x61: [475,11,525,31,473,'255 394Q218 394 186 383T138 358T109 333T94 321H91Q88 321 86 322T83 325T80 331T79 339T78 349T77 362T75 377Q72 410 72 420Q72 423 72 425T73 429T74 431T77 433T80 435T85 437Q166 475 262 475Q360 475 413 440Q462 406 471 341Q472 332 472 181Q472 155 472 119T473 73Q473 20 462 10T398 0H380Q349 0 337 8T324 48V65Q298 30 257 10T172 -11Q109 -11 70 37T31 145Q31 276 307 289H321V309Q321 337 318 352T300 381T255 394ZM176 146Q176 116 190 97T231 77Q251 77 266 85Q322 110 322 185Q322 189 322 192T322 198L321 201V234L308 232Q176 220 176 146'], - - // LATIN SMALL LETTER B - 0x62: [694,10,561,54,523,'54 667Q63 694 102 694H127H151Q190 694 199 671Q201 663 201 544L202 422L211 428Q270 468 355 468Q523 468 523 231Q523 -10 321 -10Q286 -10 261 -2T204 33Q197 11 187 6T142 0H126L81 1Q61 7 54 28V667ZM372 230Q372 317 355 349T280 382Q251 382 204 356V107Q235 76 274 76Q301 76 320 84T349 105T364 139T371 180T372 230'], - - // LATIN SMALL LETTER C - 0x63: [475,12,489,37,457,'188 233Q188 199 190 177T200 131T225 95T271 83H281Q356 83 421 130Q433 138 434 139Q446 141 448 131Q449 128 453 84T457 36Q455 30 432 20T364 -1T273 -11Q37 -11 37 232Q37 456 244 474Q246 474 257 474T276 475Q349 475 400 455Q443 436 448 431L451 425Q451 419 443 377Q442 372 441 366T439 356T438 348T436 340T435 334T433 330T431 327T429 325T426 324Q420 324 406 336Q376 362 350 372T281 382Q254 382 236 373T208 352T194 317T189 278T188 233'], - - // LATIN SMALL LETTER D - 0x64: [694,11,561,37,507,'225 -11Q192 -11 164 -3T104 29T55 102T37 227Q37 321 63 376Q111 469 223 469Q292 469 349 433L359 426V546Q359 564 359 589T358 623Q358 675 369 684T433 694H451Q497 694 505 669Q507 663 507 347T505 25Q500 9 487 5T450 0H432H413Q356 0 356 36V40Q298 -11 225 -11ZM356 359Q326 382 286 382Q239 382 215 358Q189 330 189 256V229V203V195Q189 102 231 86Q251 76 274 76Q318 76 356 114V359'], - - // LATIN SMALL LETTER E - 0x65: [475,10,511,30,481,'30 231Q30 301 51 351T107 426T181 463T262 474H268Q293 474 312 472T366 459T422 427T462 363T480 260Q480 230 466 222T405 213Q395 213 364 213T311 214H173V211Q173 183 183 148T216 96Q244 76 287 76Q319 76 350 85T399 104T433 125T451 136Q463 138 465 128Q466 125 469 84T473 39Q471 29 423 13T330 -9Q321 -10 286 -10Q213 -10 161 11T81 68T42 144T30 231ZM353 292Q350 324 342 344T320 373T294 384T264 387Q191 387 175 286V282H353V292'], - - // LATIN SMALL LETTER F - 0x66: [706,0,336,29,381,'67 458H78V502V509Q78 538 79 556T90 604T117 651T169 685T253 704Q254 704 258 704T265 705T275 705T287 704Q364 704 381 687V638V607Q381 591 378 585T366 579Q362 581 351 591T323 610T282 618Q238 618 226 587Q224 581 223 519V458H253Q288 458 298 453Q315 441 315 415Q315 399 312 390T299 377T282 372T259 371H255H226V201Q226 31 224 25Q215 0 174 0H150L106 1Q86 7 79 28L78 199V371H69Q29 371 29 412Q29 425 30 431T40 447T67 458'], - - // LATIN SMALL LETTER G - 0x67: [469,206,550,17,534,'63 108Q63 142 83 176L76 184Q35 227 35 300Q35 469 243 469Q330 469 385 437L397 443Q451 469 508 469Q515 468 517 466T522 456T528 425Q534 392 534 386Q532 379 523 377Q520 377 509 381T477 390T431 398L425 399Q453 362 453 297Q453 268 445 242T417 189T351 146T242 130Q169 130 119 153Q117 141 117 136Q117 95 155 83Q161 81 252 81Q354 80 362 79Q437 71 475 48T526 -24Q532 -42 532 -65Q532 -116 489 -156T341 -204Q323 -206 274 -206H256Q39 -206 18 -84Q17 -79 17 -68Q17 15 82 42L76 53Q63 79 63 108ZM310 300Q310 359 298 377T238 396Q217 396 204 390T186 368T179 339T178 300Q178 245 189 224T244 203T299 224T310 300ZM414 -66Q414 -55 411 -47T401 -32T387 -21T368 -14T346 -10T322 -7T297 -6T271 -6T246 -6H193Q163 -6 154 -10T140 -30Q135 -45 135 -62Q135 -134 274 -134Q414 -134 414 -66'], - - // LATIN SMALL LETTER H - 0x68: [694,0,561,53,508,'53 667Q62 694 101 694H126H148Q191 694 198 669Q200 663 200 526V390Q263 469 361 469Q390 469 412 465T456 449T491 413T507 351Q508 342 508 185Q508 31 506 25Q498 0 450 0H432H413Q368 0 359 23Q357 31 357 186Q356 345 355 350Q349 369 336 376Q324 381 301 381H298Q269 381 242 362Q217 342 210 316T202 239Q202 229 202 202T203 157V82Q203 24 195 12T146 0H125L80 1Q60 7 53 28V667'], - - // LATIN SMALL LETTER I - 0x69: [695,0,256,46,208,'72 574Q55 583 51 591T46 619V636L47 670L48 673Q50 676 52 678T56 684T63 690T73 694H81Q89 694 102 694T129 695H181Q193 687 196 685T203 676T207 661T208 634Q208 603 204 593T181 574H72ZM54 431Q63 458 102 458H127H149Q192 458 199 433Q201 427 201 229T199 25Q190 0 149 0H125L81 1Q61 7 54 28V431'], - - // LATIN SMALL LETTER J - 0x6A: [695,205,286,-71,232,'70 634V648Q70 686 96 693Q100 695 151 695H176Q201 695 213 691T230 670Q232 665 232 634V620Q232 582 206 575Q202 573 151 573H126Q101 573 89 577T72 598Q70 603 70 634ZM-41 -84Q-1 -105 28 -105Q67 -105 78 -85Q83 -77 83 -48T84 180Q84 427 86 433Q93 458 136 458H158H180Q201 458 209 456T225 443Q230 436 231 418Q232 397 232 313V183V124V40Q232 -55 228 -87T203 -147Q166 -205 78 -205Q31 -205 -20 -189T-71 -159Q-71 -156 -62 -124T-52 -89Q-49 -84 -41 -84'], - - // LATIN SMALL LETTER K - 0x6B: [694,0,531,63,496,'496 23Q496 9 487 5T457 0H427H398Q367 0 354 11Q352 12 288 99L226 183L191 150V90V54Q191 30 186 18T165 2Q160 0 124 0L90 1Q70 7 63 28V667Q72 694 108 694H128H146Q183 694 192 671Q194 663 194 496L195 325L254 383Q266 394 281 409T301 429T316 441T329 450T341 455T357 458T376 458H409H436Q461 458 470 454T480 437Q480 430 477 427T445 395Q417 368 396 347L319 271Q319 270 358 217T442 103T494 32Q496 30 496 23'], - - // LATIN SMALL LETTER L - 0x6C: [694,0,256,54,201,'54 667Q63 694 102 694H127H149Q192 694 199 669Q201 663 201 347T199 25Q190 0 149 0H125L81 1Q61 7 54 28V667'], - - // LATIN SMALL LETTER M - 0x6D: [469,0,867,53,815,'197 386Q256 468 366 468Q404 468 430 461T471 438T491 413T503 385Q563 469 666 469Q731 469 769 446T814 350Q815 343 815 185Q815 31 813 25Q808 9 796 5T758 0H737L692 1Q672 7 665 28L664 186V206V290Q664 349 655 365T610 381Q581 381 560 370T529 341T515 311T510 291Q509 286 509 157V82Q509 24 501 12T452 0H431L386 1Q366 7 359 28L358 186V206V290Q358 349 349 365T304 381Q275 381 254 370T223 341T209 311T204 291Q203 286 203 157V82Q203 24 195 12T146 0H125L80 1Q60 7 53 28V437Q58 453 80 464H122H142Q167 464 178 460T195 439Q197 434 197 409V386'], - - // LATIN SMALL LETTER N - 0x6E: [468,0,561,53,508,'197 386Q264 468 350 468Q375 468 390 467T429 460T466 443T492 408T507 351Q508 342 508 185Q508 31 506 25Q498 0 450 0H432H413Q368 0 359 23Q357 31 357 186Q356 345 355 350Q349 369 336 376Q324 381 301 381H298Q269 381 242 362Q217 342 210 316T202 239Q202 229 202 202T203 157V82Q203 24 195 12T146 0H125L80 1Q60 7 53 28V437Q58 453 80 464H122H142Q167 464 178 460T195 439Q197 434 197 409V386'], - - // LATIN SMALL LETTER O - 0x6F: [474,11,550,32,518,'274 -11Q32 -11 32 225Q32 346 85 406T249 474H266H271Q302 474 325 471T385 458T451 419T498 346Q518 300 518 225Q518 -11 274 -11ZM367 233Q367 322 350 354T270 387Q240 387 222 377T195 344T184 298T182 233Q182 151 198 117T275 83H282Q318 83 339 104Q355 119 361 146T367 233'], - - // LATIN SMALL LETTER P - 0x70: [469,194,561,54,523,'125 458H139Q174 458 185 452T202 420L211 426Q245 448 288 458T354 469Q356 469 361 469T369 468Q443 468 481 412Q523 355 523 223Q523 164 509 120T473 51T423 12T371 -7T323 -11Q260 -11 204 33V-65Q204 -80 204 -102T205 -131Q205 -162 200 -175T178 -192Q173 -194 126 -194L81 -193Q61 -187 54 -166V431Q58 447 81 458H125ZM372 230Q372 376 282 376Q247 376 204 352V107L208 103Q213 99 218 95T232 87T251 79T274 76Q323 76 349 116Q372 153 372 230'], - - // LATIN SMALL LETTER Q - 0x71: [470,194,561,37,507,'226 -11Q37 -11 37 236Q37 294 51 338T86 407T135 445T186 464T233 469H235Q300 469 349 422L359 413V425Q359 452 376 464Q384 469 433 469H455Q498 469 505 444Q507 438 507 137Q507 -163 505 -169Q500 -185 487 -189T450 -194H432H413Q367 -194 358 -171Q356 -163 356 -63V40L348 33Q296 -11 231 -11H226ZM281 375Q188 375 188 228Q188 77 275 77Q322 77 359 120V328Q338 357 324 366T281 375'], - - // LATIN SMALL LETTER R - 0x72: [469,0,372,54,356,'54 437Q58 453 81 464H122H147Q186 464 194 439Q196 434 196 405V377L203 387Q245 456 324 468Q325 468 331 468T340 469Q347 469 356 462V360Q350 355 346 354T339 353T326 353T300 347Q260 337 234 311T202 252Q201 247 201 138Q201 122 201 98T202 66Q202 33 197 20T175 2Q170 0 125 0L81 1Q61 7 54 28V437'], - - // LATIN SMALL LETTER S - 0x73: [474,10,422,30,396,'37 328Q37 392 75 433T203 474Q254 474 265 473Q319 465 370 442Q378 439 380 432Q380 426 372 384Q364 336 359 333Q358 331 355 331Q348 331 337 341Q282 388 216 388H208Q190 388 180 387T161 377T151 351Q151 333 164 323T224 306L267 297Q314 285 355 246T396 144Q396 17 282 -5Q260 -10 218 -10Q170 -10 124 2T55 26T30 44Q30 48 39 99T49 153Q52 159 60 159Q66 159 70 153Q100 120 133 101T218 82Q231 82 238 83T258 87T277 101T283 126Q283 149 260 160T200 176T153 186Q109 201 73 236T37 328'], - - // LATIN SMALL LETTER T - 0x74: [589,10,404,20,373,'225 267Q225 202 226 169T232 115T244 88T265 82Q295 84 318 100T345 116Q352 116 354 110T364 77Q373 46 373 43Q373 28 312 9T190 -10Q160 -10 139 1T107 29T89 77T82 136T80 210V258V371H66H59Q39 371 27 386Q20 394 20 417Q21 432 23 437Q35 458 60 458H65H83V510L84 562Q93 589 131 589H154H174Q216 589 223 564Q225 558 225 508V458H274Q330 458 338 453Q355 441 355 415Q355 388 338 376Q330 371 274 371H225V267'], - - // LATIN SMALL LETTER U - 0x75: [459,11,561,52,508,'53 431Q62 459 100 459Q105 459 114 459T127 458H152Q192 458 201 435Q203 427 203 262Q204 86 208 77Q209 74 216 71Q227 66 258 66H264Q334 66 354 140L356 150L357 290Q357 427 359 435Q365 449 377 453T412 458H432H450Q498 458 506 433Q508 427 508 229T506 25Q498 0 451 0H434H418Q386 0 374 7T360 43V58L352 49Q298 -11 199 -11Q135 -9 101 11T56 80Q52 100 52 273L53 431'], - - // LATIN SMALL LETTER V - 0x76: [458,0,500,26,473,'26 429T26 435T32 448T44 456Q48 458 85 458H99Q145 458 161 431Q162 429 207 285L251 145L294 284Q333 410 341 430Q351 451 374 456Q379 458 420 458H430Q450 458 457 456T471 443Q473 437 473 435Q473 426 443 325T381 126L350 28Q339 7 316 2Q312 0 250 0Q187 0 183 2Q160 7 149 28L136 68Q124 109 106 166T70 283T39 385'], - - // LATIN SMALL LETTER W - 0x77: [458,0,744,24,719,'699 458Q717 447 719 432Q719 426 666 230T610 27Q602 10 588 5T548 0H512H482Q431 0 420 17T384 135Q356 241 352 298V308L351 295Q348 251 322 145T290 28Q279 0 233 0H212H191Q146 0 133 27Q130 33 77 229T24 430Q24 449 44 457Q47 458 79 458Q122 458 126 456Q154 450 163 419L233 153Q241 187 272 304T307 431Q318 458 368 458Q394 458 398 456Q421 451 430 431Q434 423 509 147L547 286Q582 416 588 429Q600 454 624 457Q632 458 647 458H663H699'], - - // LATIN SMALL LETTER X - 0x78: [460,1,500,24,475,'92 0Q87 0 77 0T62 -1Q24 -1 24 22Q24 29 33 41T106 136Q185 237 184 238Q184 239 147 284T73 376T33 427Q31 430 31 436Q31 451 45 457Q48 458 96 458H122Q152 458 163 450T208 394L247 345L282 394Q288 403 297 416T309 434T319 444T328 452T338 455T352 458T372 458H393H440Q457 449 457 435Q457 428 450 419T379 328Q308 239 308 237L389 137Q409 112 436 79Q475 31 475 23Q475 -1 436 -1Q432 -1 422 -1T407 0Q360 0 352 3Q343 6 336 16T291 83L247 151L245 148Q243 145 239 139T229 124T218 106T204 84Q167 24 160 15T141 1L92 0'], - - // LATIN SMALL LETTER Y - 0x79: [458,205,500,29,473,'454 458Q473 446 473 430Q473 426 394 184L311 -68Q291 -119 245 -162T123 -205Q51 -205 46 -190Q44 -187 40 -142T36 -92Q36 -90 36 -88L37 -87Q41 -80 46 -80Q48 -80 73 -92T126 -105Q146 -105 161 -98T185 -76T197 -53T206 -28L215 0L122 212Q29 427 29 435Q29 448 46 457Q49 458 91 458Q93 458 106 458T125 457T140 454T157 446T170 431Q183 410 224 305T266 158Q266 152 266 151Q267 151 268 163Q271 206 302 310T342 432Q354 458 398 458H418H454'], - - // LATIN SMALL LETTER Z - 0x7A: [458,0,476,31,442,'268 376Q250 376 180 375T92 374Q69 374 63 380Q46 390 46 419Q46 428 49 437Q57 451 73 457Q76 458 242 458T413 456Q420 455 427 448Q439 438 439 413Q439 392 433 385Q432 383 318 236T204 88Q235 88 306 89T395 90H399Q408 90 414 89T427 84T438 70T442 45Q442 9 416 2Q411 0 236 0H136Q73 0 62 1T41 12Q31 23 31 47Q31 68 36 77Q37 78 51 97T96 155T153 228L268 376'], - - // TILDE - 0x7E: [344,-198,550,92,457,'92 215Q92 259 122 301T204 344Q238 344 264 329T310 300T343 285Q356 285 361 295T369 322T377 344H450Q457 334 457 330Q457 281 427 240T344 198Q312 198 285 213T239 242T206 257Q188 257 182 230T172 199L137 198H120Q102 198 97 200T92 215'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/SansSerif/Bold/BasicLatin.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/CombDiacritMarks.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/CombDiacritMarks.js deleted file mode 100644 index b15323eb26..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/CombDiacritMarks.js +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/SansSerif/Bold/CombDiacritMarks.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_SansSerif-bold'], - { - // COMBINING GRAVE ACCENT - 0x300: [694,-537,0,-458,-218,'-458 682Q-458 690 -452 692T-426 694H-381H-314L-312 691Q-311 691 -305 682T-287 655T-263 622L-218 555V549Q-218 544 -224 538L-259 537Q-295 537 -296 538Q-298 539 -376 606T-456 676Q-458 680 -458 682'], - - // COMBINING ACUTE ACCENT - 0x301: [694,-537,0,-334,-93,'-290 537H-310Q-334 537 -334 549Q-334 553 -311 588T-264 656L-241 690Q-240 690 -239 691T-236 693Q-235 694 -167 694H-100Q-93 684 -93 681T-94 677Q-95 675 -173 607T-255 538Q-256 537 -290 537'], - - // COMBINING CIRCUMFLEX ACCENT - 0x302: [694,-537,0,-442,-109,'-442 550Q-442 554 -415 589T-360 658T-331 692Q-329 694 -275 694Q-222 694 -220 693Q-219 692 -169 629T-112 557Q-109 552 -109 549Q-109 545 -116 538L-151 537Q-187 537 -188 538Q-189 538 -232 575L-275 611Q-276 611 -319 575Q-362 538 -363 538Q-364 537 -400 537L-435 538Q-442 545 -442 550'], - - // COMBINING TILDE - 0x303: [694,-548,0,-458,-93,'-458 565Q-458 609 -428 651T-346 694Q-312 694 -286 679T-240 650T-207 635Q-194 635 -189 645T-181 672T-173 694H-100Q-93 684 -93 680Q-93 631 -123 590T-206 548Q-238 548 -265 563T-311 592T-344 607Q-362 607 -368 580T-378 549L-413 548H-430Q-448 548 -453 550T-458 565'], - - // COMBINING MACRON - 0x304: [660,-560,0,-474,-77,'-84 660Q-81 656 -77 653V567L-81 564L-84 561L-274 560H-383Q-469 560 -471 565L-472 566Q-474 569 -474 611L-473 653Q-469 659 -466 659Q-465 660 -274 660H-84'], - - // COMBINING BREVE - 0x306: [694,-552,0,-470,-80,'-123 694Q-80 694 -80 657Q-80 626 -99 601T-161 563Q-199 552 -275 552Q-352 552 -389 563Q-470 586 -470 655Q-470 667 -468 673Q-457 694 -435 694H-431Q-408 694 -396 685Q-387 676 -387 671Q-384 661 -275 661Q-167 661 -164 671Q-164 674 -163 677T-151 687T-123 694'], - - // COMBINING DOT ABOVE - 0x307: [695,-596,0,-356,-194,'-329 596Q-346 602 -351 611T-356 638V646Q-356 653 -356 654T-356 661T-355 668T-353 673T-351 679T-347 684T-341 689T-332 693T-274 695H-221Q-202 683 -198 676T-194 645Q-194 632 -195 625T-202 610T-221 596H-329'], - - // COMBINING DIAERESIS - 0x308: [696,-595,0,-459,-91,'-331 695Q-312 683 -308 676T-304 645Q-304 632 -304 626T-311 610T-331 596L-380 595H-408Q-448 595 -457 617Q-459 621 -459 645T-457 673Q-448 696 -409 696Q-405 696 -396 696T-380 695H-331ZM-247 644Q-247 658 -246 665T-239 680T-221 694Q-217 695 -169 695H-143Q-102 695 -93 672Q-91 664 -91 645V635Q-91 613 -106 602Q-113 597 -121 596T-171 595L-219 596Q-232 600 -238 608T-246 622T-247 644'], - - // COMBINING RING ABOVE - 0x30A: [694,-538,0,-365,-119,'-365 616Q-365 658 -331 676T-256 694Q-253 694 -247 694T-236 693Q-166 693 -139 666Q-119 644 -119 616T-139 565Q-166 538 -237 538H-242Q-365 538 -365 616ZM-181 616Q-181 641 -195 647T-242 654Q-258 654 -266 654T-284 650T-298 638T-303 616Q-303 592 -289 585T-242 577Q-209 577 -195 584T-181 616'], - - // COMBINING DOUBLE ACUTE ACCENT - 0x30B: [694,-537,0,-440,-94,'-426 686Q-424 694 -394 694H-350H-283Q-277 686 -277 682Q-277 673 -317 608T-361 538L-396 537H-420Q-432 537 -436 539T-440 548Q-440 560 -434 616Q-432 633 -430 650T-427 677L-426 686ZM-243 686Q-241 694 -211 694H-167H-100Q-94 686 -94 682Q-94 673 -134 608T-178 538L-213 537H-237Q-249 537 -253 539T-257 548Q-257 560 -251 616Q-249 633 -247 650T-244 677L-243 686'], - - // COMBINING CARON - 0x30C: [657,-500,0,-442,-109,'-442 645Q-442 657 -418 657H-398Q-393 657 -388 657T-379 657T-371 656T-365 656H-363L-319 620L-276 583Q-275 583 -232 619Q-189 656 -188 656Q-187 657 -151 657H-116Q-109 649 -109 645Q-109 642 -112 637Q-118 629 -168 566T-220 501Q-222 500 -275 500Q-329 500 -331 501Q-442 634 -442 645'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/SansSerif/Bold/CombDiacritMarks.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/Main.js deleted file mode 100644 index 4ad6887e23..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/Main.js +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/SansSerif/Bold/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_SansSerif-bold'] = { - directory: 'SansSerif/Bold', - family: 'MathJax_SansSerif', - id: 'MJSSB', - weight: 'bold', - Ranges: [ - [0x0,0x7F,"BasicLatin"], - [0x80,0xFFFF,"Other"], - [0x300,0x36F,"CombDiacritMarks"] - ] - - -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/SansSerif/Bold/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/Other.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/Other.js deleted file mode 100644 index af8b3e1d79..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/Other.js +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/SansSerif/Bold/Other.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_SansSerif-bold'], - { - // LATIN SMALL LETTER DOTLESS I - 0x131: [458,0,256,54,201,'54 431Q63 458 102 458H127H149Q192 458 199 433Q201 427 201 229T199 25Q190 0 149 0H125L81 1Q61 7 54 28V431'], - - // LATIN SMALL LETTER DOTLESS J - 0x237: [458,205,286,-71,232,'-38 -84Q-36 -84 -14 -95T33 -106H38Q70 -103 78 -86Q83 -78 83 -49T84 180Q84 427 86 433Q93 458 136 458H158H180Q201 458 209 456T225 443Q230 436 231 418Q232 397 232 313V183V124V40Q232 -55 228 -87T203 -147Q166 -205 78 -205Q31 -205 -20 -189T-71 -159Q-71 -156 -59 -123Q-50 -96 -47 -91T-38 -84'], - - // GREEK CAPITAL LETTER GAMMA - 0x393: [691,0,581,92,534,'92 664Q98 683 118 690Q121 691 312 691T508 689Q534 682 534 644V632V618Q534 582 508 573L502 572Q496 572 489 572Q486 572 463 572T416 573Q333 573 291 575H253V303Q253 31 251 25Q242 0 199 0H170L119 1Q99 7 92 28V664'], - - // GREEK CAPITAL LETTER DELTA - 0x394: [694,0,917,60,856,'381 692Q386 694 458 694Q516 694 527 693T549 687Q564 680 575 663Q576 658 715 349T856 27Q856 6 838 1H826Q815 1 795 1T747 1T686 1T616 0T539 0T458 0T378 0T300 0T230 0T169 1T122 1T90 1H78Q60 6 60 27Q62 38 201 349T341 663Q356 687 381 692ZM627 148Q626 149 581 250T492 453L447 554Q447 553 446 552Q444 546 326 278L268 148Q268 147 448 147Q627 147 627 148'], - - // GREEK CAPITAL LETTER THETA - 0x398: [716,22,856,62,793,'62 340Q62 716 425 716Q511 716 576 696T681 642T747 559T783 458T793 341Q793 264 777 203T721 89T608 7T428 -22Q62 -22 62 340ZM638 333Q638 365 637 387T632 441T621 495T600 542T567 583T518 611T451 628Q443 629 427 629Q402 629 378 624T327 608T276 571T240 511Q217 453 217 345Q217 254 231 204T279 120Q333 69 428 69Q522 69 576 120Q638 183 638 333ZM279 349V373Q279 413 305 420Q309 422 427 422H487Q550 422 563 414T576 369V349Q576 345 576 337T577 324Q577 284 550 277Q545 275 428 275H369Q306 275 293 283T279 329V349'], - - // GREEK CAPITAL LETTER LAMDA - 0x39B: [694,0,672,41,630,'106 0H83Q41 0 41 28Q41 39 133 349T229 667Q242 694 296 694H335H375Q403 694 418 689T442 667Q445 660 537 350T630 28Q630 11 619 6T584 0H555H526Q478 0 465 27Q462 32 431 136T366 372T325 555V546Q320 503 287 376T222 141T186 27Q184 22 177 15T165 6Q154 0 106 0'], - - // GREEK CAPITAL LETTER XI - 0x39E: [688,0,733,46,686,'627 553Q609 553 512 554T366 555Q316 555 220 554T105 553Q96 553 90 553T82 554T78 554Q61 560 57 571T52 605V623L53 661Q59 680 79 687Q82 688 366 688Q649 688 654 686Q680 679 680 639V621V603Q680 563 654 554Q653 554 651 554T642 554T627 553ZM149 423Q152 424 366 424Q579 424 584 422Q610 415 610 376V358V340Q610 300 584 293Q579 291 366 291H232Q162 291 150 293T129 306Q122 315 122 360L123 397Q129 416 149 423ZM108 135Q143 135 226 134T363 133Q407 133 507 134T632 135H645Q675 135 684 110Q686 104 686 68V49Q686 9 660 2Q655 0 364 0L74 1Q57 7 49 21L47 28L46 65V83Q46 126 72 133Q80 135 108 135'], - - // GREEK CAPITAL LETTER PI - 0x3A0: [691,0,794,92,702,'92 664Q98 683 118 690Q121 691 396 691T676 689Q695 684 700 666Q702 660 702 345Q702 31 700 25Q696 9 684 5T646 0H621H596Q571 0 559 4T542 25Q540 31 540 307V582H253V307Q253 31 251 25Q242 0 199 0H170L119 1Q99 7 92 28V664'], - - // GREEK CAPITAL LETTER SIGMA - 0x3A3: [694,0,794,61,732,'322 124Q326 124 457 125T672 127H689Q721 127 730 102Q732 96 732 64V48Q732 9 706 2Q701 0 394 0L89 1Q76 5 69 13T62 29V36Q62 37 62 38Q62 47 70 58T126 126Q161 167 185 196Q302 335 302 336L187 463Q74 584 68 594Q61 603 61 639L62 667Q68 686 88 693Q91 694 396 694T706 692Q732 686 732 647V635V621Q732 585 706 576Q705 576 702 576T691 576T670 575L302 578Q302 577 394 475T490 371Q498 362 498 347Q498 336 488 323T408 226L322 124'], - - // GREEK CAPITAL LETTER UPSILON - 0x3A5: [715,0,856,62,793,'62 560Q62 607 94 644T169 698T253 715Q273 715 286 713T322 704T363 677T398 625Q413 597 423 556L428 540Q429 541 436 566T454 620T494 677T561 713Q570 715 593 715Q682 715 737 668T793 560Q793 549 793 545T786 533T767 520H670Q646 532 644 551T632 579Q618 594 591 594Q539 594 524 530T509 321V216Q509 31 507 25Q498 0 455 0H426L375 1Q355 7 348 28L347 232Q346 344 346 441Q346 442 343 468T335 521T312 571T266 594Q252 594 247 593Q228 586 220 576T212 557T209 539T191 523L185 520H88Q75 527 69 534T63 545T62 560'], - - // GREEK CAPITAL LETTER PHI - 0x3A6: [694,0,794,62,732,'62 292T62 347T80 445T124 511T183 552T243 574T292 584L315 587H319V627L320 667Q329 694 370 694H397H422Q466 694 473 669Q475 663 475 625V587H478Q479 587 500 584T548 575T608 553T668 513T713 446T732 347Q732 253 674 187Q655 167 628 152T576 128T530 116T493 109L478 107H475V69V50Q475 9 449 2Q444 0 395 0L347 1Q327 7 320 28L319 67V107H315L292 110Q269 114 243 119T184 142T124 182T80 249ZM319 197T319 347T318 497Q316 497 307 494T284 485T262 471Q220 438 220 347Q220 285 239 249Q248 234 261 223T286 208T308 200L317 197Q319 197 319 347ZM572 347V357Q572 387 569 407T548 452T496 491Q495 491 494 491T487 493T475 497V197Q518 210 541 232T571 303Q572 312 572 347'], - - // GREEK CAPITAL LETTER PSI - 0x3A8: [694,0,856,61,794,'61 585Q62 594 62 597T64 606T73 616T89 626H138Q196 626 208 620Q243 602 253 546T261 431T271 309T325 219Q342 205 349 205Q350 205 350 436L351 667Q360 694 401 694H428H454Q495 694 504 671Q506 663 506 436L507 205Q542 222 561 251T586 318T593 392T595 472T602 546Q614 614 661 625Q665 626 708 626H730Q766 626 780 618T794 582Q794 548 768 540Q755 538 754 501T750 410T736 298T680 191T560 120Q550 116 512 109H506V70V50Q506 9 480 2Q475 0 426 0L378 1Q358 7 351 28L350 68V109L335 111Q298 117 267 129T214 156T175 191T146 229T127 272T115 314T109 357T106 395T105 429Q104 537 87 540Q66 548 63 565Q61 570 61 585'], - - // GREEK CAPITAL LETTER OMEGA - 0x3A9: [716,1,794,49,744,'241 122Q225 154 191 199T131 278T83 363T61 464Q61 497 68 527T94 591T145 650T228 693T349 715Q354 715 370 715T396 716Q539 716 622 668Q658 647 682 617T715 556T728 505T732 465Q732 415 711 365T663 280T602 200T552 122H632Q649 122 669 122T693 123H697Q736 123 742 98Q744 92 744 62V47Q744 9 718 2Q713 0 591 0L471 1Q454 7 446 21Q444 27 444 45Q444 96 463 154T506 257T549 360T569 469Q569 504 563 530T538 580T485 616T396 629Q313 629 268 594T223 468Q223 419 243 361T286 258T330 152T350 41Q350 14 335 7T276 -1Q267 -1 241 -1T197 0L77 1Q57 7 50 28L49 59V74Q49 114 75 121Q81 123 100 123Q104 123 124 123T161 122H241'], - - // EN DASH - 0x2013: [327,-240,550,0,549,'0 284Q0 318 26 325Q30 327 274 327Q469 327 497 327T532 322Q549 310 549 283Q549 257 532 245Q525 241 498 241T275 240Q31 240 26 242Q0 249 0 284'], - - // EM DASH - 0x2014: [327,-240,1100,0,1099,'0 284Q0 318 26 325Q30 327 549 327T1073 325Q1099 318 1099 284Q1099 249 1073 242Q1068 240 549 240Q31 240 26 242Q0 249 0 284'], - - // LEFT SINGLE QUOTATION MARK - 0x2018: [694,-443,306,81,226,'87 443L81 449V581L119 636Q125 644 131 653T141 667T148 677T154 685T158 689T163 692T167 693T173 694H190H201Q226 694 226 683Q226 678 208 635T189 590Q189 588 204 588H219Q222 584 226 581V449L219 443H87'], - - // RIGHT SINGLE QUOTATION MARK - 0x2019: [694,-442,306,80,226,'81 687Q85 693 88 693Q89 694 154 694H219Q222 690 226 687V556L187 501Q182 494 177 486T169 474T163 465T157 457T153 451T149 447T145 445T141 443T137 443T132 442H116H105Q80 442 80 453Q80 458 98 501T117 546Q117 548 102 548L87 549L81 555V687'], - - // LEFT DOUBLE QUOTATION MARK - 0x201C: [694,-443,558,138,520,'144 443L138 449V581L176 636Q182 644 188 653T198 667T205 677T211 685T215 689T220 692T224 693T230 694H247H258Q283 694 283 683Q283 678 265 635T246 590Q246 588 261 588H276Q279 584 283 581V449L276 443H144ZM381 443L375 449V581L413 636Q419 644 425 653T435 667T442 677T448 685T452 689T457 692T461 693T467 694H484H495Q520 694 520 683Q520 678 502 635T483 590Q483 588 498 588H513Q516 584 520 581V449L513 443H381'], - - // RIGHT DOUBLE QUOTATION MARK - 0x201D: [694,-442,558,37,420,'38 687Q42 693 45 693Q46 694 111 694H176Q179 690 183 687V556L144 501Q139 494 134 486T126 474T120 465T114 457T110 451T106 447T102 445T98 443T94 443T89 442H73H62Q37 442 37 453Q37 458 55 501T74 546Q74 548 59 548L44 549L38 555V687ZM275 687Q279 693 282 693Q283 694 348 694H413Q416 690 420 687V556L381 501Q376 494 371 486T363 474T357 465T351 457T347 451T343 447T339 445T335 443T331 443T326 442H310H299Q274 442 274 453Q274 458 292 501T311 546Q311 548 296 548L281 549L275 555V687'], - - // INCREMENT - 0x2206: [694,1,917,60,856,''] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/SansSerif/Bold/Other.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/BasicLatin.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/BasicLatin.js deleted file mode 100644 index 685cab02c7..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/BasicLatin.js +++ /dev/null @@ -1,290 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/SansSerif/Italic/BasicLatin.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_SansSerif-italic'], - { - // SPACE - 0x20: [0,0,250,0,0,''], - - // EXCLAMATION MARK - 0x21: [694,0,319,110,355,'160 187L257 694H306Q355 694 355 693L238 186H199Q160 186 160 187ZM110 2Q111 3 120 49T131 96Q131 98 180 98T229 96L219 50Q209 3 208 2V0H110V2'], - - // QUOTATION MARK - 0x22: [694,-471,500,133,472,'171 647L180 694H229Q278 694 278 693L276 686Q275 680 273 668T268 644L258 597L182 471H157Q133 471 133 472L189 595Q189 596 174 596H160V598Q160 601 171 647ZM365 647L374 694H423Q472 694 472 693L470 686Q469 680 467 668T462 644L452 597L376 471H351Q327 471 327 472L383 595Q383 596 368 596H354V598Q354 601 365 647'], - - // NUMBER SIGN - 0x23: [694,194,833,87,851,'793 170Q809 162 809 149Q809 145 807 141T802 135T796 132L793 130H547L472 -27Q397 -184 394 -187Q389 -194 379 -194Q367 -194 362 -183Q359 -179 359 -173Q360 -168 431 -20L503 129Q503 130 410 130H317L242 -27Q167 -184 164 -187Q159 -194 149 -194Q137 -194 132 -183Q129 -179 129 -173Q130 -168 201 -19L273 130H187L100 131Q87 141 87 150Q87 162 102 170H294L331 248Q339 265 349 286T365 318L370 328Q370 330 258 330Q145 330 142 332Q129 338 129 351Q129 362 140 368Q146 370 267 370L391 371L467 527Q542 684 544 686Q544 688 549 691T560 694H562Q565 693 567 692T571 690T575 686T578 681T579 672Q577 665 507 520T436 373L435 370H528L621 371L692 518Q767 675 769 677Q775 694 789 694Q798 694 804 688T809 672Q806 664 737 519L665 371L751 370Q835 370 841 368Q851 362 851 350Q851 337 841 334T799 330H765H741H645L606 250L568 170H793ZM600 328Q600 330 508 330H415Q412 326 338 171Q338 170 431 170H524L561 248Q569 265 579 286T595 318L600 328'], - - // DOLLAR SIGN - 0x24: [750,56,500,56,565,'228 70Q233 92 246 155T270 266T280 316Q271 318 265 320T237 333T200 360T172 403T159 468Q159 537 205 600T325 691Q352 701 360 701Q361 701 361 701T362 703T364 711T368 727L372 750H409Q445 750 445 749L436 705Q436 703 450 702T494 691T554 657L565 649Q562 642 548 604L534 568Q511 591 484 605T440 621L424 623L419 624L372 405Q399 400 424 384Q490 338 490 247V240Q490 156 430 85Q374 13 294 -5L284 -7L280 -30Q279 -35 278 -41T275 -52L274 -55Q274 -56 237 -56Q201 -56 201 -54Q202 -53 205 -34T211 -11Q211 -9 206 -9Q154 -2 115 19Q80 35 56 59L88 141L99 131Q109 121 119 113T141 99T160 89T180 82T197 77T214 73T228 70ZM303 426Q304 427 313 471T332 564T345 620L335 616Q287 596 263 549Q252 525 252 499Q252 470 267 451T298 426Q303 424 303 426ZM302 75Q305 75 315 80T340 98T367 125T390 164T399 214Q399 247 384 268T349 297Q338 247 326 186L302 75'], - - // PERCENT SIGN - 0x25: [750,56,833,165,815,'268 347Q224 347 195 386T165 488Q165 517 173 552Q191 637 246 693T349 749Q389 749 414 725T448 673T456 614Q456 506 396 427T268 347ZM372 604Q372 674 339 674Q311 674 290 633T261 549T253 482V474Q253 438 272 426Q277 424 286 424Q319 424 345 485T372 604ZM189 -56Q179 -56 173 -49T167 -37Q167 -30 347 198Q425 296 475 360Q780 745 785 747Q790 750 796 750Q814 748 814 730Q814 725 811 719L204 -49Q198 -56 189 -56ZM523 87Q523 184 583 265T713 347Q758 347 786 308T815 207Q815 110 757 28T629 -55Q576 -55 550 -12T523 87ZM729 200Q729 271 696 271Q675 271 658 247T631 189T616 125T611 76Q611 21 644 21H647Q672 21 700 77T729 200'], - - // AMPERSAND - 0x26: [716,22,758,71,747,'219 -22Q158 -22 117 13T71 111Q71 131 74 150T84 185T98 215T118 241T137 262T159 281T179 295T199 308L214 318L258 348L256 362Q254 373 254 413V435Q254 483 271 537T325 641T411 708Q427 715 441 715Q446 716 455 716Q504 716 534 681T565 590Q565 522 519 468T377 347L358 334Q359 333 363 320T374 290T387 262Q404 227 428 187T460 139Q521 183 574 251T651 362T674 409L710 398Q746 388 747 388Q747 381 720 333T635 213T517 94L510 87Q542 57 598 57Q649 57 708 72Q716 75 718 75L709 34L701 -7Q636 -22 578 -22Q531 -22 498 -8T428 34L408 25Q314 -22 219 -22ZM480 579Q480 640 436 640Q410 640 385 615T351 554Q340 513 340 457Q340 413 343 410Q343 406 360 419Q431 471 455 505T480 579ZM245 57Q279 59 311 67T359 81T375 89T358 113T318 178T281 260L274 277L245 257Q167 205 167 135Q167 110 174 93T194 69T217 60T237 57H245'], - - // APOSTROPHE - 0x27: [694,-471,278,190,335,'228 647L237 694H286Q335 694 335 693L334 686Q332 680 330 668T325 644L315 597L239 471H214Q190 471 190 472L246 595Q246 596 231 596H217V598Q217 601 228 647'], - - // LEFT PARENTHESIS - 0x28: [750,250,389,104,491,'195 37Q195 -7 200 -47T213 -113T231 -166T250 -204T268 -232T280 -250H204L194 -238Q104 -124 104 55Q104 238 181 432T405 740L417 750H454Q491 750 491 749L468 729Q446 709 411 667T337 565T262 405T208 188Q195 110 195 37'], - - // RIGHT PARENTHESIS - 0x29: [750,250,389,2,390,'300 463Q300 634 222 740L214 750H290L299 740Q300 738 309 726T323 707T337 682T353 651T367 613T379 566T387 510T390 444Q390 314 344 156T203 -125Q179 -155 145 -191Q111 -224 89 -241L78 -250H2Q4 -248 27 -227T65 -189T107 -140T155 -71T200 16T244 129T278 266Q300 372 300 463'], - - // ASTERISK - 0x2A: [750,-306,500,156,568,'193 608Q193 628 210 644T246 660Q250 660 252 660T257 658T264 654T272 648T284 638T302 623Q340 590 340 593Q341 594 345 623T354 682T360 715Q365 729 378 739T407 750Q424 750 433 740T443 720Q443 712 427 652L410 591L462 623Q505 650 514 655T534 660Q549 660 558 650T568 625Q568 617 567 611T560 599T551 590T536 580T519 571T496 561T470 548L429 528L474 500Q482 495 492 489T506 481T516 475T523 469T527 464T529 458T530 450Q530 430 514 414T479 397H475Q468 397 460 402T423 433Q414 440 404 448T388 461L383 465L365 344Q348 306 314 306Q302 306 292 313T281 338Q281 347 297 404L313 464L260 433Q201 397 195 397H189Q173 397 165 407T156 432Q156 438 157 443T161 452T166 460T175 468T185 475T198 482T212 489T230 497T250 506L295 528L250 556Q203 582 202 585Q193 591 193 608'], - - // PLUS SIGN - 0x2B: [583,83,778,108,775,'108 244T108 250T112 261T119 268T124 270H426V272Q428 274 457 419Q489 565 492 573Q497 583 508 583Q516 583 522 577T528 565Q528 553 498 417Q491 384 483 346T471 288L467 270H760Q775 262 775 250T760 230H458Q456 221 426 77T394 -71Q389 -83 375 -83Q367 -83 362 -78T356 -64Q356 -58 387 84Q394 118 401 155T413 210L417 229Q417 230 271 230H124Q123 230 120 232T112 239'], - - // COMMA - 0x2C: [98,125,278,63,209,'90 2Q91 3 100 49T111 96Q111 98 160 98T209 96L199 50Q189 3 188 2Q188 0 149 -63L112 -125H63L120 0H105Q90 0 90 2'], - - // HYPHEN-MINUS - 0x2D: [259,-186,333,51,332,'66 257V259H332V257L324 220L317 186H184Q51 186 51 187T58 220T66 257'], - - // FULL STOP - 0x2E: [98,0,278,90,209,'90 2Q91 3 100 49T111 96Q111 98 160 98T209 96L199 50Q189 3 188 2V0H90V2'], - - // SOLIDUS - 0x2F: [750,250,500,6,600,'564 744L568 747Q573 750 579 750Q588 750 594 744T599 729Q597 721 321 241T41 -243Q37 -250 27 -250Q6 -250 6 -230Q6 -228 8 -222Q9 -219 285 261T564 744'], - - // DIGIT ZERO - 0x30: [678,22,500,87,549,'245 -22Q209 -22 181 -11T135 20T107 65T92 116T88 171Q88 235 114 354T194 557Q226 606 269 635T340 671T392 678H395Q422 678 446 670T495 643T534 582T549 481Q549 430 534 350T499 213Q459 89 379 25Q315 -22 247 -22H245ZM430 582Q408 601 378 601Q313 601 269 534Q234 475 205 341Q181 232 181 174Q181 104 209 76Q231 54 260 54T318 73T368 125Q410 194 447 375Q460 445 460 487Q460 555 430 582'], - - // DIGIT ONE - 0x31: [678,0,500,88,451,'234 613Q277 613 331 628T428 678H439Q451 678 451 676Q450 671 387 373T323 74T384 73H445L430 0H259L88 1L104 73H229L332 560Q278 541 198 539Q198 540 198 541T199 546T200 554T202 564T205 576L213 612H219Q221 612 226 612T234 613'], - - // DIGIT TWO - 0x32: [678,0,500,50,551,'190 460Q189 460 181 475T164 507T155 527Q155 535 182 571Q259 678 380 678Q462 678 506 630T551 513V507Q551 418 487 349Q469 329 441 305T391 265T344 232T316 212Q158 87 158 86T188 85Q194 85 234 85T311 86Q467 86 467 85Q451 9 449 2V0H50Q54 18 58 40L67 79L133 133Q246 226 269 243Q369 318 410 373T452 492Q452 535 433 560T393 592T350 599Q311 599 279 578T231 532T203 484T190 460'], - - // DIGIT THREE - 0x33: [678,23,500,56,544,'446 542Q446 576 424 590T372 605Q330 605 288 583T216 524Q209 515 208 516Q207 517 192 549L178 580L187 589Q224 627 276 652T386 678Q456 678 500 642T544 550Q544 515 530 482T495 427T453 387T418 362L403 353L413 348Q440 335 462 313Q500 271 500 217Q500 135 423 57T236 -22T63 59L56 68L85 141Q106 112 125 98Q177 54 254 54Q315 54 355 105T396 218Q396 242 393 254Q380 301 335 313Q327 315 280 316Q233 316 233 318L249 392Q298 392 322 399Q373 408 409 453T446 542'], - - // DIGIT FOUR - 0x34: [656,0,500,62,521,'78 235L411 656H465Q519 656 519 655T475 447T430 237V235H521V233L505 160Q505 159 459 159H414L380 0H286L320 159H62L63 164Q64 169 66 179T70 198L78 235ZM342 235L421 607Q420 607 419 604Q409 535 197 267Q173 236 173 235H342'], - - // DIGIT FIVE - 0x35: [656,22,500,49,555,'330 350Q263 350 214 272H133V275Q134 276 174 467L214 655Q214 656 385 656H555V653Q555 652 554 647T550 631T546 613L539 577H284L265 486Q261 464 256 441T248 406L246 395L250 398Q255 401 264 406T286 415T315 423T350 427Q412 427 455 381T498 256Q498 150 415 64T222 -22Q186 -22 155 -12T105 12T74 41T55 65T50 77L51 79Q61 89 78 112L104 145L107 138Q110 130 114 123T125 106T142 88T165 72T196 60T236 55Q282 55 316 79T366 140T389 208T396 267Q396 310 378 330T337 350H330'], - - // DIGIT SIX - 0x36: [678,22,500,94,548,'437 605Q397 605 361 585T301 536T261 477T236 426T228 401L236 408Q244 414 260 424T296 445T345 462T402 469H404Q422 469 434 467T465 446T498 394Q515 351 515 307Q515 254 497 193T439 85Q352 -22 246 -22Q220 -22 196 -14T148 15T109 78T94 179Q94 272 123 373Q163 505 257 591T450 678Q474 678 498 674T535 664T548 656L540 621L532 586L520 590Q509 594 485 599T437 605ZM339 392Q281 392 233 334T185 163V158Q185 87 230 61Q244 54 262 54Q325 54 371 122Q395 158 407 217T419 298Q419 337 401 364T339 392'], - - // DIGIT SEVEN - 0x37: [656,11,500,143,596,'173 614L181 656H389Q596 656 596 655L595 650Q594 645 592 635T588 616L580 578L554 551Q313 307 245 4L242 -11H192Q143 -11 143 -10Q144 0 148 17T169 89T212 198T285 327T393 470Q423 504 472 550Q479 555 485 561T496 571L329 570Q163 570 163 571L164 577Q166 583 168 593T173 614'], - - // DIGIT EIGHT - 0x38: [678,22,500,77,554,'159 470Q159 547 229 612T394 678Q467 678 510 636T554 533Q554 512 549 493T535 458T515 429T492 405T467 386T443 372T423 362T409 356L404 354Q404 353 405 353Q411 353 432 341T476 295T500 218Q500 134 424 56T246 -22Q175 -22 126 22T77 143Q77 204 110 251T188 327L202 334Q216 340 229 346T243 353T235 358T214 372T189 393T168 426T159 470ZM467 527Q467 605 375 605Q317 605 281 566T244 472Q244 429 271 411T334 392Q392 392 429 430T467 527ZM405 228Q405 262 384 289T315 316Q257 316 216 266T174 144Q174 95 199 75T262 54Q329 54 367 109T405 228'], - - // DIGIT NINE - 0x39: [677,22,500,77,545,'220 594Q303 677 389 677Q545 677 545 479Q545 413 526 327Q493 175 398 77T202 -22Q124 -22 77 25L130 91L137 83Q169 54 218 54Q255 54 290 76T347 129Q364 151 380 182T403 232T411 256Q410 255 390 241T353 217T303 197T236 187Q195 187 173 209Q155 226 140 263T124 352Q124 392 135 435Q154 527 220 594ZM455 497Q455 605 383 605Q340 605 305 577T246 492Q220 411 220 360Q220 278 279 264Q280 264 287 264T299 263Q347 263 387 302Q455 375 455 497'], - - // COLON - 0x3A: [444,0,278,90,282,'174 396L184 444H233Q282 444 282 443Q277 421 272 394L262 346H213Q164 346 164 347Q169 369 174 396ZM90 2Q91 3 100 49T111 96Q111 98 160 98T209 96L199 50Q189 3 188 2V0H90V2'], - - // SEMICOLON - 0x3B: [444,125,278,63,282,'174 396L184 444H233Q282 444 282 443Q277 421 272 394L262 346H213Q164 346 164 347Q169 369 174 396ZM90 2Q91 3 100 49T111 96Q111 98 160 98T209 96L199 50Q189 3 188 2Q188 0 149 -63L112 -125H63L120 0H105Q90 0 90 2'], - - // EQUALS SIGN - 0x3D: [370,-130,778,88,796,'142 368Q145 370 463 370Q780 370 784 368Q796 364 796 350T784 332Q780 330 463 330Q145 330 142 332Q129 338 129 351Q129 362 142 368ZM88 137T88 150T102 170H738Q739 170 742 168T750 161T754 150T750 139T743 132T738 130H102Q88 137 88 150'], - - // QUESTION MARK - 0x3F: [704,0,472,173,536,'194 652Q194 654 218 666T284 691T362 704Q444 704 490 678T536 583Q536 541 516 500T459 433Q415 400 387 371T343 313T321 266T307 216L301 186H262Q223 186 223 187Q224 199 228 218T250 288T294 377Q317 413 344 440T391 481T414 499Q442 527 442 574Q442 584 441 590T433 607T409 623T362 629Q335 629 310 624T267 610T235 595T214 582T205 576L200 614Q194 651 194 652ZM173 2Q174 3 183 49T194 96Q194 98 243 98T292 96L282 50Q272 3 271 2V0H173V2'], - - // COMMERCIAL AT - 0x40: [705,10,667,120,707,'120 267Q120 377 179 478T336 642T538 705Q610 705 658 662T707 513Q707 425 681 331Q658 241 590 179T447 117Q386 117 343 163T300 288Q300 397 374 486T544 576Q575 576 608 562Q590 628 517 628Q406 628 309 522T212 278Q212 179 267 122T404 65T550 91H631Q513 -10 390 -10Q265 -10 193 70T120 267ZM600 397Q600 441 581 471T530 501Q476 501 433 436T390 298Q390 254 409 224T462 193Q512 193 556 257T600 397'], - - // LATIN CAPITAL LETTER A - 0x41: [694,0,667,28,638,'28 0L429 694H533L585 350Q596 275 610 182T632 46L638 3V0H530L528 18Q527 25 515 103T503 183H223L135 29L118 1L73 0H28ZM492 254Q492 256 473 398T454 589V610Q433 552 290 301L264 255L378 254H492'], - - // LATIN CAPITAL LETTER B - 0x42: [694,0,667,90,696,'501 363Q557 355 605 316T653 222Q653 148 586 85T403 2Q394 1 240 0Q90 0 90 1L100 46Q109 90 128 177T164 348L238 694H375Q518 693 546 688Q614 674 655 635T696 544Q696 490 648 441T516 368L501 363ZM601 530Q601 568 566 590T479 621Q472 622 394 623H320L297 513Q292 489 286 459T276 415L273 401V399H339H372Q504 399 571 466Q601 498 601 530ZM257 322Q256 320 230 197T203 73Q203 71 289 71Q379 72 387 73Q459 84 507 122T556 210Q556 255 519 283T428 320Q415 322 336 323Q257 323 257 322'], - - // LATIN CAPITAL LETTER C - 0x43: [705,10,639,124,719,'124 266Q124 372 179 473T333 639T544 705Q592 705 635 697T698 679L718 670Q719 669 701 621T681 572L676 576Q670 580 661 586T641 598T614 611T583 620Q558 625 526 625Q406 625 318 516T230 276Q230 238 236 212Q251 148 294 108T412 68Q469 68 508 80T598 123Q608 129 608 128Q606 109 603 87L598 45L573 33Q521 7 486 -1T394 -10Q358 -10 346 -8Q260 5 202 62Q124 145 124 266'], - - // LATIN CAPITAL LETTER D - 0x44: [694,0,722,88,747,'162 348L236 694H385Q535 693 543 692Q600 682 641 654T705 586T737 506T747 425Q747 296 672 187Q625 114 548 62T384 1Q376 0 262 0Q88 0 88 1L98 46Q107 90 126 177T162 348ZM622 533Q575 624 443 624Q434 624 419 624T399 623H321L263 348Q249 283 234 213T212 107L204 72Q204 71 289 71Q374 72 386 74Q501 94 573 193T646 422Q646 487 622 533'], - - // LATIN CAPITAL LETTER E - 0x45: [691,0,597,86,688,'86 2Q88 4 160 346T233 689Q233 691 461 691Q688 691 688 689Q685 686 671 611H495L320 612L319 609Q319 607 297 501L274 397H436Q597 397 597 396L596 391Q595 386 593 376T589 358L581 322L420 321Q258 321 258 320Q209 89 208 87Q208 85 390 85Q417 85 460 85T518 86L572 85Q556 8 554 2V0H86V2'], - - // LATIN CAPITAL LETTER F - 0x46: [691,0,569,86,673,'86 2Q88 4 160 346T233 689Q233 691 453 691T673 689Q670 686 656 611H488L320 612Q314 579 302 523T281 427T272 385Q272 384 419 384H567L551 308H255L223 156Q216 124 207 82T194 20L190 2Q190 0 138 0H86V2'], - - // LATIN CAPITAL LETTER G - 0x47: [705,11,667,125,730,'125 267Q125 375 182 476T337 641T544 705Q598 705 644 693T710 669T730 655L712 609L693 560L692 557L681 567Q618 626 526 626Q447 626 378 573T269 440T229 277Q229 185 276 127T406 68Q422 68 451 71T502 78T524 84L526 93Q528 102 532 119T539 153L553 222Q553 223 495 223Q436 223 436 224Q436 230 444 262L452 299H662V296Q661 290 635 166T607 40Q606 37 576 25T492 1T391 -11Q272 -11 199 66T125 267'], - - // LATIN CAPITAL LETTER H - 0x48: [694,0,708,86,768,'517 2Q518 3 551 161T585 322Q586 323 557 323T422 323H259L190 0H138Q86 0 86 1L96 46Q105 90 124 177T160 348L234 694H337V691Q336 690 306 545T275 399H602L603 403Q603 407 634 551L665 694H768V691Q768 690 695 348T621 2V0H517V2'], - - // LATIN CAPITAL LETTER I - 0x49: [694,0,278,87,338,'161 348L235 694H338V691Q338 690 265 348T191 2V0H139Q87 0 87 1L96 46Q106 90 125 177T161 348'], - - // LATIN CAPITAL LETTER J - 0x4A: [694,22,472,46,535,'377 424L435 694H535V691Q534 685 476 412T416 135Q401 74 350 26T210 -22Q165 -22 124 -11T65 9T46 21L54 41Q62 61 70 83T81 109Q82 111 85 106Q86 105 87 103Q93 94 103 84T135 64T185 53Q238 53 272 76T317 142Q317 145 325 182T348 289T377 424'], - - // LATIN CAPITAL LETTER K - 0x4B: [694,0,694,88,784,'236 223Q235 222 213 113T188 2V0H138Q88 0 88 1L98 46Q107 90 126 177T162 348L236 694H285Q335 694 335 693L330 671Q326 649 316 603T298 518Q289 477 280 433T266 366L261 343L672 694H729L784 693L465 420L651 0H596L541 1L384 350Q383 351 310 288T236 223'], - - // LATIN CAPITAL LETTER L - 0x4C: [694,0,542,87,516,'161 348L235 694H338V691Q338 690 273 385T208 79Q278 80 362 80H516Q502 11 499 2V0H293Q87 0 87 1L96 46Q106 90 125 177T161 348'], - - // LATIN CAPITAL LETTER M - 0x4D: [694,0,875,92,929,'375 691Q456 215 459 124V106Q488 177 762 641L793 694H929V691Q929 690 856 348T782 2V0H689V2Q691 4 753 304Q817 604 818 606Q819 611 817 608Q817 607 815 603Q798 559 540 117L484 22H440L397 23L393 42Q393 47 373 169T334 422T315 594V609L250 306Q186 3 185 2Q185 0 138 0Q92 0 92 1L102 46Q111 90 130 177T166 348L240 694H375V691'], - - // LATIN CAPITAL LETTER N - 0x4E: [694,0,708,88,766,'311 609Q310 608 246 306T181 2V0H134Q88 0 88 1L98 46Q107 90 126 177T162 348L236 694H382L383 691Q383 688 418 561T493 286T541 97L544 84L545 89Q545 90 553 128T578 246T610 394L674 694H766V691Q766 690 693 348T619 2V0H472L469 13Q468 17 393 293T312 605L311 609'], - - // LATIN CAPITAL LETTER O - 0x4F: [716,23,736,118,763,'118 254Q118 366 174 473T324 648T517 716Q627 716 695 638T763 435Q763 321 706 215T555 43T362 -22Q256 -22 187 56T118 254ZM380 58Q452 58 518 116T622 263T661 442Q661 496 646 535T608 594T567 622T534 634Q516 636 496 636Q400 636 313 528T225 264Q225 172 267 115T380 58'], - - // LATIN CAPITAL LETTER P - 0x50: [694,0,639,88,690,'162 348L236 694H378Q522 693 530 692Q604 680 647 635T690 524Q690 474 665 430T612 359Q550 299 465 280Q443 275 343 274H250V271Q250 269 235 201T206 68T192 2V0H140Q88 0 88 1L98 46Q107 90 126 177T162 348ZM594 513Q594 560 562 588T477 622Q470 623 394 623H321L293 487L263 349V347H342H347H375Q530 347 578 449Q594 483 594 513'], - - // LATIN CAPITAL LETTER Q - 0x51: [716,125,736,118,763,'118 254Q118 366 174 473T324 648T517 716Q627 716 695 638T763 435Q763 305 693 194T543 36Q547 29 586 -47T625 -125H504L450 -8Q406 -22 363 -22Q256 -22 187 56T118 254ZM661 437Q661 532 616 584T506 636Q428 636 361 578T257 433T220 258Q220 167 264 113T380 58Q390 58 397 58T408 59T413 60T417 61Q417 63 387 127T356 193Q356 194 409 194H462L485 150L508 105Q509 103 532 125T567 161Q661 278 661 437'], - - // LATIN CAPITAL LETTER R - 0x52: [694,0,646,88,698,'162 348L236 694H375H414H445Q507 694 538 690T606 668Q698 623 698 534V528Q698 447 608 377Q582 358 555 345T512 326L497 321L617 0H565L513 1L402 309H255L189 0H138Q88 0 88 1L98 46Q107 90 126 177T162 348ZM603 525Q603 603 499 620Q486 622 403 623H321L297 506Q292 482 285 449T274 402L271 387V385H346Q350 385 363 385T386 384Q548 384 592 479Q603 503 603 525'], - - // LATIN CAPITAL LETTER S - 0x53: [716,22,556,54,609,'161 478Q161 568 242 642T435 716Q527 716 599 673L609 667Q595 633 589 615L571 568Q570 568 564 575T546 592T518 611T475 628T417 635Q351 635 305 596T259 507Q259 465 290 444T372 411T432 396Q473 385 509 343T545 236Q545 140 464 59T270 -22Q155 -22 54 48L92 146Q93 146 101 138T124 117T161 92T216 72T288 63Q360 63 403 109T447 204Q447 220 444 233T435 256T421 273T404 285T385 295T366 301T347 306T331 310T315 314T292 321T265 331T235 346T207 367T183 395T168 431T161 478'], - - // LATIN CAPITAL LETTER T - 0x54: [688,0,681,165,790,'165 608L182 687Q182 688 486 688H790L789 685L781 645L773 609H521L457 306Q393 3 392 2Q392 0 340 0H288V2Q289 5 353 304T417 605V609L291 608H165'], - - // LATIN CAPITAL LETTER U - 0x55: [694,22,688,131,747,'340 -22Q251 -22 191 33T131 177V187Q131 192 131 195T132 205T133 215T136 231T141 253T147 285T156 328T168 384T184 457L235 694H338V691Q338 690 288 451T236 210Q234 194 234 177Q234 138 247 111T280 72T319 54T357 49Q408 49 449 74T510 128Q516 136 521 143T530 158T538 175T545 194T553 220T560 250T569 289T579 336T591 395T606 464L655 694H747V691Q651 243 645 213Q623 149 587 102Q482 -22 340 -22'], - - // LATIN CAPITAL LETTER V - 0x56: [694,0,667,161,799,'220 348L161 694H216Q270 694 270 693L283 613Q334 313 346 215Q359 102 359 96Q359 87 358 84Q388 162 684 657L706 694H753Q799 694 799 693L387 0H333Q279 0 279 1L272 45Q264 89 249 177T220 348'], - - // LATIN CAPITAL LETTER W - 0x57: [694,0,944,161,1076,'596 540Q596 562 597 585T599 609Q599 588 436 255Q402 185 362 104L310 0H213V3Q213 6 188 347T161 694H263L265 664Q290 327 293 184Q293 112 289 85Q290 85 290 87Q290 95 301 123T332 194T373 282T419 380T463 469T498 541T517 579L574 694H671V689L674 646Q678 603 682 538T691 401T699 263T703 160Q703 102 700 87Q719 154 930 576L989 694H1076Q1076 693 903 347L730 0H628V4L626 26Q624 48 622 85T616 168T609 267T603 369T598 464T596 540'], - - // LATIN CAPITAL LETTER X - 0x58: [694,0,667,14,758,'14 0Q17 3 184 184T352 367L265 529Q244 567 222 609T188 672L176 692Q176 694 236 694H297L338 612Q387 515 400 489L421 448L645 694H758L708 640Q481 393 456 368Q455 366 500 281T596 104T652 0H531L388 293L128 0H14'], - - // LATIN CAPITAL LETTER Y - 0x59: [694,0,667,151,809,'151 692Q151 694 212 694H272L418 362L696 683L705 694H758L809 693Q809 692 630 490T444 280Q442 275 413 139L383 1L333 0Q282 0 282 2Q283 3 312 141L341 278L246 484L151 692'], - - // LATIN CAPITAL LETTER Z - 0x5A: [694,0,611,55,702,'67 54Q551 615 551 617Q543 618 517 618Q510 618 463 618T376 617Q200 617 200 618T209 657L216 694H459Q702 694 702 692Q702 689 697 667L692 643L207 80H392Q493 81 577 81Q577 70 560 2V0H55V2L67 54'], - - // LEFT SQUARE BRACKET - 0x5B: [750,250,289,41,425,'148 252L253 750H339Q425 750 425 749L424 744Q423 739 421 729T417 711L409 675L367 674H325L235 252Q145 -167 145 -172Q145 -174 187 -174H229V-176Q213 -240 213 -250H127Q41 -250 41 -248Q41 -245 148 252'], - - // RIGHT SQUARE BRACKET - 0x5D: [750,250,289,-31,353,'353 749Q353 746 303 512T200 27T141 -250H-31Q-31 -240 -15 -176V-174H70L250 674H208L165 675L181 750H267Q353 750 353 749'], - - // CIRCUMFLEX ACCENT - 0x5E: [694,-527,500,190,533,'190 527L360 694H434L484 611Q533 528 533 527H457L390 632L385 639L266 527H190'], - - // LOW LINE - 0x5F: [-38,114,500,50,565,'59 -75L66 -38H316Q565 -38 565 -39T558 -75T549 -112Q549 -114 299 -114Q50 -114 50 -113L52 -108Q53 -103 55 -93T59 -75'], - - // LATIN SMALL LETTER A - 0x61: [461,10,481,61,473,'313 386Q286 386 260 381T217 369T186 355T164 342T155 337Q154 338 159 377T165 418Q251 461 320 461Q322 461 328 461T337 460Q397 460 435 424T473 329Q473 325 473 318T472 308Q432 110 407 2V0H317V2L325 38Q295 21 269 10Q215 -10 156 -10H149Q76 -10 62 69Q61 75 61 90Q61 127 73 150T116 194Q146 215 207 231T348 252H368L373 277Q378 302 378 318Q378 367 339 384Q332 386 313 386ZM150 116Q150 93 171 79T223 65Q259 65 293 85T341 135Q343 140 348 160T353 184Q353 186 342 186Q298 186 231 174T153 134Q150 127 150 116'], - - // LATIN SMALL LETTER B - 0x62: [694,11,517,75,539,'302 -11Q266 -11 235 1T190 26L176 38Q170 8 168 2V0H121Q75 0 75 1L84 46Q94 90 113 177T149 348L223 694H267Q312 694 312 693T282 551T251 407Q251 406 256 408T271 415Q347 454 430 454H438Q501 454 528 374Q539 339 539 299Q539 179 466 84T302 -11ZM443 275Q443 317 421 348T346 379Q318 379 296 369Q269 359 238 332L193 118L198 109Q220 65 269 65Q350 65 396 130T443 275'], - - // LATIN SMALL LETTER C - 0x63: [460,11,444,74,499,'75 164Q75 226 100 282T165 377T252 437T342 460H347Q447 460 499 417L483 378Q468 339 468 338Q466 338 455 347T424 366T385 378Q355 382 334 382Q262 382 215 318T168 177Q168 120 196 95T259 69H269Q345 69 420 108Q432 114 432 113T427 72L422 32L402 22Q382 12 344 2T259 -11Q214 -11 180 2T126 36T95 81T79 126T75 164'], - - // LATIN SMALL LETTER D - 0x64: [694,10,517,73,588,'73 156Q73 224 102 293T184 408T294 455Q375 455 432 413Q438 407 438 410T469 553L499 694H588V691Q588 690 515 348T441 2V0H348V2Q357 29 357 43L352 41Q332 24 288 7T196 -10H190Q178 -10 166 -7T134 8T98 46T75 113Q73 129 73 156ZM419 335Q419 339 412 348T386 368T342 379Q284 379 243 343T184 261T167 168Q167 122 191 94T263 66Q321 66 367 116L374 124L397 229Q419 333 419 335'], - - // LATIN SMALL LETTER E - 0x65: [460,11,444,71,472,'248 -11Q170 -11 121 41T71 173Q71 265 133 349T285 454Q305 460 318 460H328Q368 460 399 448Q472 414 472 309Q472 274 464 234L462 219H159Q156 198 156 185Q156 137 179 107T237 68Q246 66 268 66Q345 66 427 113V109Q426 108 422 73T417 37Q417 34 409 29Q329 -11 248 -11ZM401 299Q399 337 376 361T316 385Q291 385 266 371Q220 350 184 289H401V299'], - - // LATIN SMALL LETTER F - 0x66: [705,0,306,94,494,'381 443Q381 440 374 407T366 371H315Q263 371 263 369Q262 368 224 186Q215 145 205 97T189 25L184 2V0H94V2L99 25Q104 48 114 96T134 186Q172 368 173 369Q173 371 139 371H106V373L114 410L121 444H155L188 445L191 455L212 551Q232 612 288 658T415 705Q438 705 464 701T494 694Q478 614 477 614L467 618Q457 621 440 624T406 629H400Q333 629 306 579Q301 568 289 507L275 444H328Q381 444 381 443'], - - // LATIN SMALL LETTER G - 0x67: [455,206,500,12,568,'113 252Q113 334 177 394T311 454Q332 454 350 451T379 442T398 432T410 424L413 421Q412 423 411 424L409 426Q409 429 434 436T496 449T560 455H568V451Q568 447 567 429T566 394L565 377L553 379Q522 385 479 385Q463 385 456 384L443 383L436 392Q454 357 454 324Q454 243 390 182T249 120Q233 120 219 122T195 128T178 136T167 142L163 145Q149 131 149 105Q149 78 171 72L242 71Q246 71 269 71T303 71T336 68T372 62T403 51T432 32Q461 8 461 -40Q461 -112 383 -159T211 -206Q123 -206 68 -172T12 -86Q12 -55 31 -23T82 32Q90 38 89 39Q89 40 87 44T82 59T80 82Q80 134 126 189Q113 228 113 252ZM369 319Q369 354 350 368T304 383Q274 383 252 369T218 333T202 291T197 255Q197 221 217 206T263 191Q317 191 343 233T369 319ZM373 -59Q373 -41 362 -30T330 -13T291 -7T247 -5H216Q167 -5 158 -6T139 -12Q123 -20 110 -38T97 -76Q97 -102 133 -118T221 -134Q242 -134 267 -130T316 -118T357 -94T373 -59'], - - // LATIN SMALL LETTER H - 0x68: [694,0,517,73,513,'416 321Q416 379 336 379Q276 379 237 302Q226 276 209 202T180 66T166 2V0H119Q73 0 73 1L82 46Q92 90 111 177T147 348L221 694H265Q310 694 310 693T279 544L247 395Q325 455 403 455Q513 455 513 358Q513 334 508 309Q507 304 476 156T443 2V0H350V2L357 34Q364 65 373 110T392 200T409 281T416 321'], - - // LATIN SMALL LETTER I - 0x69: [680,0,239,74,315,'189 578Q190 579 199 627T211 678V680H315V678Q313 675 304 627T293 578V576H189V578ZM168 442T168 443T213 444T258 443T212 225T164 2V0H74V2Q75 7 121 224'], - - // LATIN SMALL LETTER J - 0x6A: [680,204,267,-96,336,'211 577L233 680H284Q336 680 336 679L315 576H263Q211 576 211 577ZM19 -204Q-12 -204 -40 -196T-82 -179T-96 -170Q-96 -168 -78 -132L-61 -95L-54 -103Q-32 -126 3 -126Q26 -126 50 -116Q76 -101 83 -85Q84 -79 140 180T196 443Q196 444 241 444T286 443Q286 441 232 186T175 -75Q163 -120 122 -162T19 -204'], - - // LATIN SMALL LETTER K - 0x6B: [694,0,489,76,542,'150 348L224 694H310V691Q218 259 218 258L232 270Q245 281 274 306T327 351L435 444H489L542 443Q542 442 443 357L344 272L471 1L422 0H372L366 14Q359 27 347 54T323 105L273 210Q271 210 231 174L190 139L160 0H118Q76 0 76 1L86 46Q95 90 114 177T150 348'], - - // LATIN SMALL LETTER L - 0x6C: [694,0,239,74,311,'148 348L222 694H311V691Q311 690 238 348T164 2V0H119Q74 0 74 1L84 46Q93 90 112 177T148 348'], - - // LATIN SMALL LETTER M - 0x6D: [455,0,794,73,790,'416 321Q416 379 336 379Q276 379 237 302Q226 276 209 202T180 66T166 2V0H119Q73 0 73 2L121 226L169 449Q169 450 213 450H256L249 421Q248 417 247 412T246 404T245 398T244 394T244 392Q250 398 261 407T307 433T379 454H392H400Q451 454 472 439Q482 434 489 427T500 412T506 399T510 388L511 384Q511 384 517 388Q563 431 620 446Q648 455 680 455Q790 455 790 358Q790 334 785 309Q784 304 753 156T720 2V0H627V2L634 34Q641 65 650 110T669 200T686 281T693 321Q693 379 613 379Q553 379 514 302Q503 276 486 202T457 66T443 2V0H350V2L357 34Q364 65 373 110T392 200T409 281T416 321'], - - // LATIN SMALL LETTER N - 0x6E: [454,0,517,73,514,'416 321Q416 379 336 379Q276 379 237 302Q226 276 209 202T180 66T166 2V0H119Q73 0 73 2L121 226L169 449Q169 450 213 450H256L249 421Q248 417 247 412T246 404T245 398T244 394T244 392Q250 398 261 407T307 433T379 454H392Q416 454 433 452T470 440T502 411T513 358Q513 334 508 309Q507 304 476 156T443 2V0H350V2L357 34Q364 65 373 110T392 200T409 281T416 321'], - - // LATIN SMALL LETTER O - 0x6F: [461,11,500,69,523,'69 169Q69 238 107 306T211 417T348 461Q419 461 471 412T523 271Q523 161 438 75T247 -11Q170 -11 120 39T69 169ZM432 279Q432 338 401 361T333 385Q280 385 240 352T182 273T164 178Q164 119 195 94T265 68Q306 68 344 94Q380 115 406 169T432 279'], - - // LATIN SMALL LETTER P - 0x70: [455,194,517,34,538,'259 443Q251 405 251 404L260 409Q269 414 286 421T324 436T375 449T434 455Q482 455 510 417T538 303Q538 169 463 79T302 -11Q226 -11 176 39V36Q175 35 151 -80L127 -193Q127 -194 80 -194H34V-191L102 127L169 443Q169 444 214 444T259 443ZM269 65Q332 65 386 124T441 262Q441 304 422 334T370 373Q356 375 339 375Q293 375 238 331L193 118Q200 103 206 94T229 75T269 65'], - - // LATIN SMALL LETTER Q - 0x71: [455,194,517,72,538,'72 149Q72 272 146 363T304 455Q340 455 371 442T409 423T436 398Q438 411 442 427L448 455H538L400 -193Q400 -194 354 -194Q307 -194 307 -193L356 37V41Q355 41 350 38T332 27T302 13Q247 -10 191 -10H179Q138 -10 105 32T72 149ZM414 298Q402 376 341 376Q277 376 223 317T169 182Q169 121 198 93T265 65Q319 65 365 111L377 123L414 298'], - - // LATIN SMALL LETTER R - 0x72: [455,0,342,74,424,'240 377L244 380Q248 384 255 390T272 404T296 419T325 434T361 446T401 454Q403 454 408 454T416 455H424L421 442Q419 435 413 405T406 373Q351 373 294 336T216 237Q213 231 201 173T178 60T164 2V0H119Q74 0 74 2L122 226L170 449Q170 450 213 450H255L247 414Q246 409 245 403T243 393T241 385T240 379T240 377'], - - // LATIN SMALL LETTER S - 0x73: [461,11,383,35,436,'99 299Q99 318 106 341T133 393T195 441T298 461Q336 461 370 453T420 437L436 429Q436 428 421 389T405 350Q356 386 273 386H265Q248 386 237 384T211 371T191 337Q189 329 189 326Q189 320 190 315T194 306T200 299T209 293T218 289T228 285T239 283T251 281T263 278L270 276Q278 275 283 274T298 270T316 264T333 255T351 243T367 228T380 209T388 186T391 157Q391 96 341 43T193 -11Q171 -11 150 -8T114 -1T84 9T61 19T45 28T35 33Q35 36 67 116L76 109Q132 67 211 67Q258 67 279 88T301 135Q301 159 280 170T224 187T180 197Q141 212 120 239T99 299'], - - // LATIN SMALL LETTER T - 0x74: [571,11,361,97,410,'245 68Q267 68 289 75T322 90L334 98Q338 94 338 28V24L324 19Q268 -4 218 -8Q198 -11 177 -11Q118 -11 118 75Q118 98 123 127Q125 137 149 251T174 369Q174 371 135 371H97V373L105 410L112 444H152L192 445L200 478Q208 512 213 541L219 571H261Q303 571 303 570T290 506L276 444H343Q410 444 410 443Q410 440 403 407T395 371H328Q261 371 261 369Q211 152 211 118Q211 68 245 68'], - - // LATIN SMALL LETTER U - 0x75: [444,10,517,90,537,'166 -10H160Q146 -10 137 -8T115 0T97 22T90 63Q90 79 130 268L167 443Q167 444 214 444Q260 444 260 443L224 273Q187 97 187 86Q187 70 202 65T250 59Q303 59 336 83T379 139Q380 143 412 292T444 443Q444 444 491 444Q537 444 537 443T491 225T443 2V0H353V2L361 38L352 34Q344 29 326 22T286 7T232 -5T166 -10'], - - // LATIN SMALL LETTER V - 0x76: [444,0,461,108,540,'177 6L108 442V444H201V442Q202 441 213 371T235 213T246 90V65Q259 117 429 406L450 444H495Q540 444 540 443Q539 442 411 221L282 1L230 0H178L177 6'], - - // LATIN SMALL LETTER W - 0x77: [444,0,683,108,762,'148 5Q147 8 128 222T109 440L108 444H199V442Q200 441 204 385T214 253T219 140Q219 108 215 76Q215 72 214 67V65L215 66Q219 95 278 221L390 444H475V437Q497 203 497 121Q497 90 494 70Q494 67 494 67L496 73Q520 143 654 405L674 444H718Q762 444 762 443L534 1L483 0H432V5Q429 28 422 126T413 283Q413 343 416 370L417 378Q416 377 416 376Q401 303 248 12L242 0H148V5'], - - // LATIN SMALL LETTER X - 0x78: [444,0,461,1,537,'317 229Q453 9 460 0H409L359 1L312 88Q266 176 265 176Q265 177 254 165T223 132T182 88L100 0H1L15 14Q29 28 61 59T118 115L236 229L226 244Q108 433 100 444H201L290 294L438 444H537L528 435Q526 432 512 418T468 376T418 327L317 229'], - - // LATIN SMALL LETTER Y - 0x79: [444,205,461,1,540,'11 -117L20 -120Q28 -124 46 -128T84 -132H100Q124 -122 149 -85Q200 -6 200 1Q200 17 155 204T109 442Q109 444 156 444H203Q203 443 208 419T221 357T235 277T248 190T254 114Q254 81 250 67V65Q251 65 251 67Q256 94 297 177Q339 259 422 397L450 444H540Q540 443 386 186T219 -90Q179 -153 145 -179T73 -205Q52 -205 34 -202Q29 -202 21 -201T7 -198L1 -197Q1 -196 6 -157T11 -117'], - - // LATIN SMALL LETTER Z - 0x7A: [444,0,435,28,494,'129 408L136 444H315Q494 444 494 443Q494 441 489 419L484 396L164 76L291 77Q418 77 418 76T411 41T402 2V0H215Q28 0 28 2L34 27L38 50L360 371L240 370Q121 370 121 371Q124 388 129 408'], - - // TILDE - 0x7E: [327,-193,500,199,560,'330 327Q356 326 388 298T446 269Q470 269 484 327H522Q560 327 560 325L557 316Q554 306 549 292T535 263T512 232T480 208Q453 193 429 193T370 222T315 251Q285 251 275 193H199V197Q214 257 251 292T330 327'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/SansSerif/Italic/BasicLatin.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/CombDiacritMarks.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/CombDiacritMarks.js deleted file mode 100644 index 657f4c332e..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/CombDiacritMarks.js +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/SansSerif/Italic/CombDiacritMarks.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_SansSerif-italic'], - { - // COMBINING GRAVE ACCENT - 0x300: [694,-527,0,-270,-87,'-262 681L-270 694H-177L-132 612Q-89 530 -87 528Q-87 527 -125 527H-163L-208 598Q-254 670 -262 681'], - - // COMBINING ACUTE ACCENT - 0x301: [694,-527,0,-190,63,'-96 625L-29 694H63Q42 673 -31 605L-114 527H-190L-176 541Q-160 559 -96 625'], - - // COMBINING CIRCUMFLEX ACCENT - 0x302: [694,-527,0,-310,33,'-310 527L-140 694H-66L-16 611Q33 528 33 527H-43L-110 632L-115 639L-234 527H-310'], - - // COMBINING TILDE - 0x303: [677,-543,0,-301,60,'-170 677Q-144 676 -112 648T-54 619Q-30 619 -16 677H22Q60 677 60 675L57 666Q54 656 49 642T35 613T12 582T-20 558Q-47 543 -71 543T-130 572T-185 601Q-215 601 -225 543H-301V547Q-286 607 -249 642T-170 677'], - - // COMBINING MACRON - 0x304: [631,-552,0,-314,64,'-314 553L-297 631H-116Q64 631 64 630Q60 612 56 591L47 553L-133 552Q-314 552 -314 553'], - - // COMBINING BREVE - 0x306: [694,-508,0,-284,73,'-142 508Q-205 508 -244 548T-284 652Q-284 666 -281 683L-280 694H-204Q-205 689 -205 677Q-205 650 -196 631T-173 604T-147 593T-125 590Q-85 590 -50 618T-5 686L-2 694H73V690Q53 610 -10 559T-142 508'], - - // COMBINING DOT ABOVE - 0x307: [680,-576,0,-180,-54,'-180 578Q-179 579 -170 627T-158 678V680H-54V678Q-56 675 -65 627T-76 578V576H-180V578'], - - // COMBINING DIAERESIS - 0x308: [680,-582,0,-273,40,'-273 584Q-272 585 -262 632L-252 678V680H-154V678L-164 632Q-174 585 -175 584Q-175 582 -224 582T-273 584ZM-78 586Q-78 587 -69 632T-58 678V680H40L39 677Q39 676 38 670T34 651T29 628L19 583L-30 582H-79L-78 586'], - - // COMBINING RING ABOVE - 0x30A: [693,-527,0,-227,-2,'-227 597Q-227 639 -186 666T-102 693H-97Q-29 693 -8 649Q-2 637 -2 623Q-2 582 -43 555T-132 527Q-171 527 -199 546T-227 597ZM-59 619Q-59 635 -68 643T-104 652Q-142 652 -156 636T-171 602Q-171 569 -123 569Q-119 569 -111 570T-99 571Q-59 582 -59 619'], - - // COMBINING DOUBLE ACUTE ACCENT - 0x30B: [694,-527,0,-287,63,'-236 619L-195 694H-149Q-103 694 -103 693L-211 527H-287L-282 536Q-281 539 -236 619ZM-70 619L-29 694H17Q63 694 63 693L-45 527H-121L-116 536Q-115 539 -70 619'], - - // COMBINING CARON - 0x30C: [654,-487,0,-283,60,'-283 654H-207L-140 549L-135 542L-16 654H60L-109 487H-147L-184 488L-234 570Q-283 653 -283 654'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/SansSerif/Italic/CombDiacritMarks.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/Main.js deleted file mode 100644 index 9cf9ef2625..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/Main.js +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/SansSerif/Italic/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_SansSerif-italic'] = { - directory: 'SansSerif/Italic', - family: 'MathJax_SansSerif', - id: 'MJSSI', - style: 'italic', - Ranges: [ - [0x0,0x7F,"BasicLatin"], - [0x80,0xFFFF,"Other"], - [0x300,0x36F,"CombDiacritMarks"] - ] - - -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/SansSerif/Italic/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/Other.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/Other.js deleted file mode 100644 index 549114ba5a..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/Other.js +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/SansSerif/Italic/Other.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_SansSerif-italic'], - { - // LATIN SMALL LETTER DOTLESS I - 0x131: [444,0,239,74,258,'168 442T168 443T213 444T258 443T212 225T164 2V0H74V2Q75 7 121 224'], - - // LATIN SMALL LETTER DOTLESS J - 0x237: [444,204,267,-97,286,'-54 -96L-48 -104Q-41 -111 -27 -118T7 -126Q60 -126 82 -87Q85 -81 140 181L196 443Q196 444 241 444T286 443Q286 441 232 186T175 -75Q163 -120 122 -162T19 -204Q-13 -204 -41 -196T-83 -180T-96 -170Q-55 -96 -54 -96'], - - // GREEK CAPITAL LETTER GAMMA - 0x393: [691,0,542,87,646,'87 2Q88 4 160 346T234 689Q234 691 440 691T646 689Q643 686 629 611H475L321 612Q193 4 191 2V0H87V2'], - - // GREEK CAPITAL LETTER DELTA - 0x394: [694,0,833,42,790,'273 343L510 694H617Q790 2 790 0H416L42 1L273 343ZM539 576Q536 597 536 600Q536 602 535 605Q534 607 534 607Q527 580 222 130L201 98H651L648 110Q645 123 639 149T627 198Q554 489 539 576'], - - // GREEK CAPITAL LETTER THETA - 0x398: [715,22,778,119,804,'119 260Q119 348 157 433T254 579T387 677T533 715Q701 715 772 574Q804 511 804 431Q804 315 744 209T586 41T384 -22Q262 -22 191 59T119 260ZM706 426Q706 524 655 582T525 640Q454 640 395 600T293 502Q256 447 237 383T218 266Q218 168 269 112T401 55Q518 55 612 166T706 426ZM283 349L293 397H473Q652 397 652 396Q647 374 642 347L632 299H452Q273 299 273 300Q278 322 283 349'], - - // GREEK CAPITAL LETTER LAMDA - 0x39B: [694,0,611,28,582,'28 0L401 694H504V690Q505 686 543 345T582 1Q582 0 528 0H473V3Q472 6 460 113T435 359T422 558Q422 593 424 603L425 610L424 608Q414 572 343 431Q287 316 143 49L117 1L73 0H28'], - - // GREEK CAPITAL LETTER XI - 0x39E: [688,0,667,42,765,'193 687Q193 688 479 688H765V686Q764 685 755 642L747 600H461L175 601Q175 602 184 645L193 687ZM196 400Q196 401 418 401T640 400L622 315Q622 314 400 314T178 315L196 400ZM42 2Q43 3 51 44T60 87H64Q68 87 75 87T93 87T119 87T151 88T190 88T237 88T291 88T352 88H643Q638 66 634 44T627 13T624 2V0H42V2'], - - // GREEK CAPITAL LETTER PI - 0x3A0: [691,0,708,86,768,'86 2Q88 4 160 346T233 689Q233 691 501 691Q768 691 768 689Q766 688 694 346T621 2V0H517V2Q518 3 582 304T646 609L648 615H321L190 0H86V2'], - - // GREEK CAPITAL LETTER SIGMA - 0x3A3: [694,0,722,55,813,'194 655L202 694H508Q813 694 813 693Q809 675 805 653L797 614H559L321 615Q327 606 405 478L485 347Q449 311 348 203T247 86Q247 84 294 84Q303 84 359 84T465 85H684Q684 84 675 42L666 0H360L55 1L195 154Q346 319 347 320L359 333L273 473Q187 614 186 614L187 620Q188 625 190 635T194 655'], - - // GREEK CAPITAL LETTER UPSILON - 0x3A5: [716,0,778,173,843,'357 637Q320 637 297 612T266 555H173Q178 576 188 598Q214 651 265 683T373 716Q497 716 497 542V509L504 526Q579 715 711 715Q773 715 808 677T843 589Q843 576 840 555H747L748 557Q748 559 748 563T749 574V580Q749 604 731 622Q715 638 693 638Q591 638 543 465Q531 425 506 309T462 98T441 2V0H337V2Q425 401 436 486Q438 504 438 526Q438 637 364 637H357'], - - // GREEK CAPITAL LETTER PHI - 0x3A6: [694,0,722,124,743,'124 308Q124 399 208 481T433 587Q437 587 437 589Q438 590 449 643L459 694H508Q557 694 557 693Q557 691 546 641T535 587Q543 587 562 583T614 565T674 531T722 472T743 387Q743 288 656 209T449 110L433 106Q411 3 410 2Q410 0 361 0H312L313 3Q313 5 324 56L335 107H331L321 108Q311 110 297 114T266 124T228 141T190 168Q124 225 124 308ZM227 315Q227 282 239 257T270 218T306 197T338 186L350 184H351L386 346Q420 507 420 509H419Q411 509 393 505T342 485T284 444Q227 387 227 315ZM642 381Q642 413 629 437T599 475T563 496T533 507T519 510Q518 510 484 348T450 184Q544 201 593 258T642 381'], - - // GREEK CAPITAL LETTER PSI - 0x3A8: [694,0,778,171,854,'325 556Q325 524 310 447T294 330Q294 289 304 260Q314 234 333 216T364 192T380 187L488 694H585V691Q584 689 531 438L478 188H479Q485 188 503 195T555 231T613 305Q637 352 654 435Q662 470 669 496T681 538T690 562T698 578T704 587Q719 609 733 615T772 621H802H854V619L838 546Q838 545 832 545Q775 539 749 418Q716 274 638 196Q616 173 590 156T543 131T503 117T473 110T460 106Q460 105 450 54T438 2V0H340V2Q341 3 351 54T362 106Q363 107 358 108T344 111T322 117T295 128T267 145T239 171T216 207T200 256T194 319Q194 356 203 408T213 483Q213 517 203 530T182 544T171 546Q184 609 187 619V621H239Q286 621 294 620T309 612Q325 596 325 556'], - - // GREEK CAPITAL LETTER OMEGA - 0x3A9: [716,0,722,44,769,'148 407Q148 475 182 534T269 633T386 694T511 716Q622 716 695 658T769 507Q769 461 747 409T699 321T628 225T562 136Q533 90 533 86Q542 85 557 85Q564 85 583 85T614 86Q695 86 695 85Q679 9 677 2V0H425Q426 3 433 30T447 72T480 131T549 241L554 248Q558 254 563 261T576 281T592 306T609 335T625 366T640 400T653 434T661 466T664 498Q664 562 618 601T497 640Q416 640 351 596T262 482Q250 441 250 392T276 237T302 70V56Q302 28 296 2V0H44V2L62 85Q62 86 143 86L225 85V88Q224 89 224 89T224 91T224 95T223 101T222 110T220 123T216 140T209 163T200 191T188 227Q148 344 148 407'], - - // EN DASH - 0x2013: [312,-236,500,50,565,'59 275L66 312H316Q565 312 565 311T558 275T549 238Q549 236 299 236Q50 236 50 237L52 242Q53 247 55 257T59 275'], - - // EM DASH - 0x2014: [312,-236,1000,50,1065,'59 275L66 312H566Q1065 312 1065 311T1058 275T1049 238Q1049 236 549 236Q50 236 50 237L52 242Q53 247 55 257T59 275'], - - // LEFT SINGLE QUOTATION MARK - 0x2018: [694,-471,278,190,335,'309 567L299 520Q289 474 288 473Q288 471 239 471T190 473L192 480Q193 486 196 499T201 522L211 569L287 694H312L335 693L332 685Q328 677 321 661T307 630L279 570L294 569Q309 569 309 567'], - - // RIGHT SINGLE QUOTATION MARK - 0x2019: [694,-471,278,190,335,'228 647L237 694H286Q335 694 335 693L334 686Q332 680 330 668T325 644L315 597L239 471H214Q190 471 190 472L246 595Q246 596 231 596H217V598Q217 601 228 647'], - - // LEFT DOUBLE QUOTATION MARK - 0x201C: [694,-471,500,274,613,'393 567L383 520Q373 474 372 473Q372 471 323 471T274 473L276 480Q277 486 280 499T285 522L295 569L371 694H396L419 693L416 685Q412 677 405 661T391 630L363 570L378 569Q393 569 393 567ZM587 567L577 520Q567 474 566 473Q566 471 517 471T468 473L470 480Q471 486 474 499T479 522L489 569L565 694H590L613 693L610 685Q606 677 599 661T585 630L557 570L572 569Q587 569 587 567'], - - // RIGHT DOUBLE QUOTATION MARK - 0x201D: [694,-471,500,133,472,'171 647L180 694H229Q278 694 278 693L276 686Q275 680 273 668T268 644L258 597L182 471H157Q133 471 133 472L189 595Q189 596 174 596H160V598Q160 601 171 647ZM365 647L374 694H423Q472 694 472 693L470 686Q469 680 467 668T462 644L452 597L376 471H351Q327 471 327 472L383 595Q383 596 368 596H354V598Q354 601 365 647'], - - // INCREMENT - 0x2206: [694,0,833,42,790,''] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/SansSerif/Italic/Other.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/BasicLatin.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/BasicLatin.js deleted file mode 100644 index abfc0b7a2e..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/BasicLatin.js +++ /dev/null @@ -1,290 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/SansSerif/Regular/BasicLatin.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_SansSerif'], - { - // SPACE - 0x20: [0,0,250,0,0,''], - - // EXCLAMATION MARK - 0x21: [694,0,319,110,208,'120 187Q120 225 115 440T110 693Q110 694 159 694T208 693Q208 655 203 440T198 187Q198 186 159 186T120 187ZM110 0V98H208V0H110'], - - // QUOTATION MARK - 0x22: [694,-471,500,32,325,'33 596V694H131V597L82 471H32L47 532Q62 593 63 594Q63 596 48 596H33ZM227 596V694H325V597L276 471H226L241 532Q256 593 257 594Q257 596 242 596H227'], - - // NUMBER SIGN - 0x23: [694,194,833,56,777,'56 350Q56 363 70 370H192Q314 370 314 371L356 526Q396 676 401 685Q406 694 416 694Q423 694 429 689T436 677Q436 673 396 523T355 371Q355 370 449 370Q544 370 544 371L586 526Q628 682 630 685Q636 694 646 694Q653 694 659 689T665 678Q665 670 645 593T605 444L585 371Q585 370 673 370H762Q777 362 777 350Q777 337 767 334T723 330H668H573L567 305Q560 282 545 226L530 171L646 170H721Q756 170 766 167T777 150Q777 138 762 130H640Q518 130 518 129L476 -26Q434 -182 432 -185Q426 -194 416 -194Q409 -194 403 -189T397 -178Q397 -170 417 -93T457 56L477 129Q477 130 383 130Q288 130 288 129L246 -26Q204 -182 202 -185Q196 -194 186 -194Q179 -194 173 -189T167 -178Q167 -170 187 -94T227 56L247 129Q247 130 159 130H70Q56 137 56 150Q56 165 72 170H259L265 195Q273 222 287 275L302 330H186L70 331Q63 334 58 339Q56 343 56 350ZM489 170L532 330H343L337 305Q330 282 315 226L300 171L394 170H489'], - - // DOLLAR SIGN - 0x24: [750,56,500,43,444,'55 509Q55 585 103 638T213 701V750H286V703H289Q312 703 354 689Q372 682 399 666T427 646L413 569Q413 568 403 575Q352 615 291 624H286V405Q357 389 400 331T444 199Q444 128 402 69T286 -7V-56H213V-9Q167 -3 125 14T63 44T44 60Q44 61 52 101L59 140L69 132Q78 125 87 119T107 107T124 97T141 90T157 84T173 80T187 76T201 73T213 70V317L202 319Q141 335 98 386T55 509ZM213 424V620L203 615Q143 587 143 522Q143 455 213 424ZM356 187Q356 208 350 227T334 258T315 280T298 293T287 297Q286 297 286 186V75Q356 110 356 187'], - - // PERCENT SIGN - 0x25: [750,56,833,56,776,'56 549Q56 639 98 694T195 750Q248 750 290 694T332 548Q332 455 290 401T195 347Q141 347 99 403T56 549ZM248 549Q248 602 234 638T195 674Q145 674 145 549Q145 423 195 423Q219 423 233 459T248 549ZM197 -56Q187 -56 182 -49T176 -35Q176 -33 178 -27Q179 -25 399 356T623 741Q626 750 639 750Q648 750 654 744T659 729Q657 721 435 336T207 -52Q203 -56 197 -56ZM500 146Q500 235 542 291T639 347Q692 347 734 293T776 146Q776 53 733 -1T639 -56Q587 -56 544 -2T500 146ZM692 146Q692 199 678 235T639 271Q589 271 589 146Q589 20 639 20Q663 20 677 56T692 146'], - - // AMPERSAND - 0x26: [716,22,758,42,702,'156 502Q156 600 198 658T302 716Q367 716 405 665T444 549Q444 531 442 523Q426 446 304 348L287 334Q305 297 340 249T402 170T430 139T443 149T472 181T509 231T549 303T583 394Q584 398 586 404Q587 408 587 409Q588 409 626 399T665 388Q663 381 660 369T644 322T614 253T567 176T502 98L491 87Q534 57 584 57Q653 57 700 75Q702 75 702 34T700 -7Q652 -22 586 -22H580Q505 -22 434 26L421 34Q419 33 405 25T374 11T336 -4T285 -17T226 -22Q143 -22 93 31T42 152Q42 184 51 211T81 260T111 291T144 317L184 348L178 365Q156 430 156 502ZM359 552Q359 588 345 614T302 640Q292 640 282 636T260 622T241 590T233 535Q236 474 253 417L257 407L271 419Q312 454 330 479Q359 514 359 552ZM345 102Q262 190 216 277Q215 277 204 267T180 247T165 236Q135 208 135 159Q135 123 152 97T198 61Q207 58 227 58Q286 58 357 89L345 102'], - - // APOSTROPHE - 0x27: [694,-471,278,89,188,'90 596V694H188V597L139 471H89L104 532Q119 593 120 594Q120 596 105 596H90'], - - // LEFT PARENTHESIS - 0x28: [750,250,389,74,333,'74 250Q74 564 240 733L257 750H333L323 739Q167 573 167 250T323 -239L333 -250H257L240 -233Q74 -63 74 250'], - - // RIGHT PARENTHESIS - 0x29: [750,250,389,55,314,'221 -73T221 250T65 739L55 750H131L148 733Q314 567 314 250T148 -233L131 -250H55L65 -239Q221 -73 221 250'], - - // ASTERISK - 0x2A: [750,-306,500,63,436,'208 717Q211 731 222 740T250 750Q265 750 277 741T291 717Q291 706 290 675T286 617L285 591L329 622Q369 651 376 655T393 659Q411 659 423 647T436 616Q436 609 434 603T429 594T419 585T407 577T389 567T368 556L316 528L368 500Q421 472 429 464Q436 455 436 440Q436 422 423 409T393 396Q390 396 388 396T384 397T380 398T375 401T367 406T358 413T346 422T329 434L285 465Q284 465 285 438T289 381T291 347Q291 327 278 317T250 306Q234 306 222 315T208 339Q208 350 209 381T212 439L214 465L170 434Q130 405 123 401T106 397Q88 397 76 409T63 440Q63 447 65 453T70 462T80 471T92 479T110 489T131 500L183 528L131 556Q78 584 70 592Q63 601 63 616Q63 634 76 647T106 660Q109 660 111 660T115 659T119 658T124 655T132 650T141 643T153 634T170 622L214 591L212 617Q211 643 210 674T208 717'], - - // PLUS SIGN - 0x2B: [583,82,778,56,722,'56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250'], - - // COMMA - 0x2C: [98,125,278,89,188,'90 0V98H188V1L139 -125H89L104 -64Q119 -3 120 -2Q120 0 105 0H90'], - - // HYPHEN-MINUS - 0x2D: [259,-186,333,11,277,'11 186V259H277V186H11'], - - // FULL STOP - 0x2E: [98,0,278,90,188,'90 0V98H188V0H90'], - - // SOLIDUS - 0x2F: [750,250,500,56,444,'423 750Q432 750 438 744T444 730Q444 725 271 248T92 -240Q85 -250 75 -250Q68 -250 62 -245T56 -231Q56 -221 230 257T407 740Q411 750 423 750'], - - // DIGIT ZERO - 0x30: [678,22,500,39,460,'117 621Q174 678 247 678Q305 678 351 647Q396 617 424 557Q460 472 460 328Q460 271 455 224Q448 154 427 104T376 27T314 -10T249 -22Q201 -22 160 1T91 67Q39 154 39 316Q39 541 117 621ZM250 55Q274 55 293 66T324 93T344 136T357 185T364 240T366 291T367 340Q367 373 367 393T363 449T352 507T332 553T299 589T250 601Q217 601 194 584T159 542T141 479T133 411T132 340V331Q132 299 133 277T137 219T147 157T167 107T201 68T250 55'], - - // DIGIT ONE - 0x31: [678,0,500,83,430,'94 612Q172 616 211 632T284 678H307V73H430V0H88V73H213V317Q213 560 212 560Q210 558 197 554T155 546T96 540L83 539V612H94'], - - // DIGIT TWO - 0x32: [677,0,500,42,449,'222 599Q190 599 166 585T128 550T108 509T97 474T93 459L67 492L42 526L47 539Q72 608 120 642T225 677Q304 677 355 644Q449 579 449 454Q449 373 361 290Q351 280 315 250T199 144Q156 103 137 85L293 86H449V0H50V79L216 242Q284 302 317 349T351 456Q351 517 315 558T222 599'], - - // DIGIT THREE - 0x33: [678,22,500,42,457,'333 521Q333 554 313 579T243 604Q154 604 99 514L78 546Q56 577 56 579Q56 580 62 589T82 611T114 637T162 662T222 677Q224 677 231 677T242 678H245Q318 678 374 634T430 520Q430 483 417 452T382 398T351 369T329 354L328 353Q369 333 373 330Q408 306 432 268T457 184Q457 103 397 41T242 -22Q131 -22 51 58L42 68L49 105L55 142L58 138Q62 134 66 130T77 120T91 108T108 96T129 83T152 72T179 63T209 57T242 54Q285 54 319 86T353 184Q353 231 331 267T260 315L213 316H166V354Q166 392 167 392Q233 395 257 405Q290 418 311 450T333 521'], - - // DIGIT FOUR - 0x34: [656,0,500,28,471,'271 654L272 656H380V235H471V159H380V0H286V159H28V235L149 443Q269 652 271 654ZM292 235V607Q292 604 290 591T286 571T280 548T269 517T252 476T226 422T189 354T140 267Q136 260 132 253T126 240L123 236Q123 235 207 235H292'], - - // DIGIT FIVE - 0x35: [656,21,500,33,449,'257 350Q236 350 218 342T189 323T171 301T160 281L157 273Q157 272 116 272H75V656H416V577H162V486Q162 396 163 396T174 403T207 418T258 426Q339 426 394 360T449 203Q449 113 386 46T226 -21H223Q188 -21 156 -11T102 13T64 42T41 66T33 77Q34 78 44 95T64 128L73 144Q93 112 117 93Q165 54 223 54Q270 54 306 86T345 197Q345 350 257 350'], - - // DIGIT SIX - 0x36: [678,22,500,42,457,'42 318Q42 396 61 460T109 564T173 629T237 666T289 677H301H317Q359 677 408 658V621Q408 585 407 585H406Q359 605 308 605Q246 605 203 556T146 421Q143 403 144 403Q145 402 152 409Q216 469 299 469Q333 469 357 457T407 405Q457 330 457 226Q457 126 402 57Q340 -22 251 -22Q216 -22 183 -7T116 43T63 149T42 318ZM260 393Q216 393 188 365T150 306T141 243Q141 153 172 104Q192 68 230 56Q238 54 251 54Q311 54 342 116Q360 152 360 226Q360 297 344 332Q320 382 277 392Q275 392 270 392T260 393'], - - // DIGIT SEVEN - 0x37: [656,11,500,42,457,'42 570V656H457V577L447 564Q345 439 295 289T244 0V-11H145V12Q160 330 356 550Q360 556 365 561T374 571L208 570H42'], - - // DIGIT EIGHT - 0x38: [678,23,500,43,456,'55 500Q55 568 109 623T250 678Q327 678 385 627T444 501Q444 445 410 410T336 357L329 353H330Q378 335 417 293T456 184Q456 93 393 36T249 -22T106 35T43 184Q43 251 82 293T169 353Q171 354 166 356Q165 356 163 357Q113 378 84 416T55 500ZM358 496Q358 557 325 581T250 605Q206 605 174 580T141 496Q141 446 171 420T250 393Q298 393 328 419T358 496ZM245 316Q205 316 172 285T139 185V179Q139 79 222 57Q231 55 250 55H254Q295 55 327 84Q360 120 360 188Q360 254 326 285Q295 316 245 316'], - - // DIGIT NINE - 0x39: [677,22,500,42,457,'44 476Q57 561 116 619T245 677H255Q308 677 349 647Q392 619 424 545T457 334Q457 178 382 78T205 -22Q168 -22 135 -10T86 14L72 25Q73 25 91 58L110 91Q127 78 136 72T163 60T203 54Q238 54 265 71T308 110T335 164T350 214T357 253V257L347 248Q284 187 200 187Q165 187 140 201T87 258Q42 332 42 430Q42 458 44 476ZM269 604Q265 605 254 605Q222 605 199 591T164 554T148 517T141 487Q140 478 140 430T141 373Q146 335 164 307T207 269Q223 263 247 263Q299 266 328 308T358 417Q358 435 356 456T346 511T318 570T269 604'], - - // COLON - 0x3A: [444,0,278,90,188,'90 346V444H188V346H90ZM90 0V98H188V0H90'], - - // SEMICOLON - 0x3B: [444,125,278,89,188,'90 346V444H188V346H90ZM90 0V98H188V1L139 -125H89L104 -64Q119 -3 120 -2Q120 0 105 0H90'], - - // EQUALS SIGN - 0x3D: [370,-130,778,56,722,'56 350Q56 363 70 370H707Q722 362 722 350Q722 339 708 331L390 330H72Q56 335 56 350ZM56 150Q56 165 72 170H708Q722 160 722 150Q722 138 707 130H70Q56 137 56 150'], - - // QUESTION MARK - 0x3F: [704,0,472,55,416,'55 652Q63 658 77 666T132 689T214 704T265 703Q303 698 332 684T376 653T401 615T413 578T416 546Q416 475 360 426Q325 396 303 365T273 303T263 256T261 216V186H183V225Q184 281 194 322Q206 368 232 409T276 469T306 495Q323 517 323 550Q323 596 297 612T223 629Q187 629 157 618Q122 607 91 583L83 576L55 652ZM173 0V98H271V0H173'], - - // COMMERCIAL AT - 0x40: [704,11,667,56,612,'422 576Q440 576 456 573T480 566L488 563Q488 565 484 571T472 588T452 607T424 622T387 629Q294 629 220 550T146 347Q146 233 210 155T365 66Q376 65 400 65Q465 68 517 86L532 91H612L598 76Q511 -11 388 -11Q250 -11 153 93T56 347Q56 454 107 538T231 663T378 704Q446 704 492 680T564 608T599 506T611 376Q611 320 607 299Q595 227 546 173T422 118Q343 118 288 185T232 347Q232 444 287 510T422 576ZM520 347Q520 429 487 465T421 501Q385 501 354 461T323 347Q323 270 355 232T422 193Q454 193 487 229T520 347'], - - // LATIN CAPITAL LETTER A - 0x41: [694,0,667,28,638,'183 181Q183 179 152 91T118 0H28L154 346L280 693Q281 694 333 694H385L511 349Q636 4 638 2Q638 0 584 0H530L464 183H184L183 181ZM324 606Q319 578 292 492T238 332T210 256Q210 254 324 254T438 255L429 281L419 308Q409 336 395 378T365 465T339 551T324 611V606'], - - // LATIN CAPITAL LETTER B - 0x42: [694,0,667,90,610,'425 363Q438 363 465 353T526 324T585 270T610 192Q610 132 561 78T426 7Q404 2 387 2T240 0H90V694H227Q373 693 396 689Q484 673 533 623T583 517Q583 494 574 473T551 437T520 409T487 388T456 374T433 366L425 363ZM490 516Q490 527 485 539T467 568T423 599T347 621Q340 622 262 623H188V399H261H286Q432 399 478 475Q490 496 490 516ZM514 190Q514 245 462 280T343 322Q336 323 259 323H188V71H274Q365 72 388 77Q445 88 479 121T514 190'], - - // LATIN CAPITAL LETTER C - 0x43: [706,12,639,58,587,'59 347Q59 440 100 521T218 654T392 705Q473 705 550 680Q577 670 577 667Q576 666 572 642T564 595T559 571Q515 601 479 613T392 626Q300 626 232 549T164 347Q164 231 229 150T397 68Q453 68 489 80T568 120L581 129L582 110Q584 91 585 71T587 46Q580 40 566 31T502 5T396 -11Q296 -11 218 41T99 174T59 347'], - - // LATIN CAPITAL LETTER D - 0x44: [694,0,722,88,666,'88 0V694H237H258H316Q383 694 425 686T511 648Q578 604 622 525T666 343Q666 190 564 86Q494 18 400 3Q387 1 237 0H88ZM565 341Q565 409 546 463T495 550T429 600T359 621Q348 623 267 623H189V71H267Q272 71 286 71T310 70Q461 70 527 184Q565 251 565 341'], - - // LATIN CAPITAL LETTER E - 0x45: [691,0,597,86,554,'86 0V691H541V611H366L190 612V397H513V321H190V85H372L554 86V0H86'], - - // LATIN CAPITAL LETTER F - 0x46: [691,0,569,86,526,'86 0V691H526V611H358L190 612V384H485V308H190V0H86'], - - // LATIN CAPITAL LETTER G - 0x47: [704,11,667,58,599,'59 346Q59 499 157 601T384 704Q436 704 466 700T541 679Q551 674 560 670T575 664T583 660T588 658T590 656Q590 652 582 605T573 557L564 564Q489 626 392 626Q301 626 233 549T164 347T233 145T392 68Q441 68 506 84V223H388V299H599V38L588 33Q494 -11 393 -11Q296 -11 219 40T100 172T59 346'], - - // LATIN CAPITAL LETTER H - 0x48: [694,0,708,86,621,'86 0V694H190V399H517V694H621V0H517V323H190V0H86'], - - // LATIN CAPITAL LETTER I - 0x49: [694,0,278,87,191,'87 0V694H191V0H87'], - - // LATIN CAPITAL LETTER J - 0x4A: [694,22,472,43,388,'181 53Q200 53 215 56T241 66T259 79T272 95T280 109T285 122L287 129V694H388V415V229Q388 135 385 112T369 63Q364 51 355 39T328 12T280 -12T212 -22Q172 -22 130 -12T66 8T43 20L46 42Q50 65 54 88L58 110Q58 111 65 104Q107 53 181 53'], - - // LATIN CAPITAL LETTER K - 0x4B: [694,0,694,88,651,'88 0V694H188V519L189 343L525 694H638L375 419L651 0H541L309 351L188 225V0H88'], - - // LATIN CAPITAL LETTER L - 0x4C: [694,0,542,87,499,'87 0V694H191V79L297 80H451L499 81V0H87'], - - // LATIN CAPITAL LETTER M - 0x4D: [694,0,875,92,782,'92 0V694H228L233 680Q236 675 284 547T382 275T436 106Q446 149 497 292T594 558L640 680L645 694H782V0H689V305L688 606Q688 577 500 78L479 23H392L364 96Q364 97 342 156T296 280T246 418T203 544T186 609V588Q185 568 185 517T185 427T185 305V0H92'], - - // LATIN CAPITAL LETTER N - 0x4E: [694,0,708,88,619,'88 0V694H235L252 659Q261 639 364 428T526 84V694H619V0H472L455 35Q453 39 330 294T185 601L181 611V0H88'], - - // LATIN CAPITAL LETTER O - 0x4F: [715,22,736,55,680,'55 345Q55 504 149 609T361 715Q386 715 406 713Q521 696 600 592T680 344Q680 193 590 86T368 -22Q239 -22 147 84T55 345ZM276 59T368 59T518 146T576 360Q576 473 525 545T401 634Q371 637 362 637Q284 637 222 562T159 360T217 147'], - - // LATIN CAPITAL LETTER P - 0x50: [694,0,639,88,583,'88 0V694H230Q347 693 370 692T410 686Q487 667 535 611T583 485Q583 409 527 348T379 276Q369 274 279 274H192V0H88ZM486 485Q486 523 471 551T432 593T391 612T357 621Q350 622 268 623H189V347H268Q350 348 357 349Q370 351 383 354T416 368T450 391T475 429T486 485'], - - // LATIN CAPITAL LETTER Q - 0x51: [715,125,736,55,680,'55 345Q55 504 149 609T361 715Q386 715 406 713Q521 696 600 592T680 344Q680 284 665 231T629 143T587 85T551 48L536 35L648 -120L652 -125H531L452 -8L440 -12Q407 -22 369 -22Q239 -22 147 85T55 345ZM579 345Q579 473 517 555T369 637Q279 637 218 554T156 345Q156 223 215 141T368 58Q376 58 382 58T392 58T397 59T401 60T403 61H404Q404 63 360 128T315 194H421L453 150Q485 105 486 105Q490 108 496 113T517 138T545 182T567 247T579 334V345'], - - // LATIN CAPITAL LETTER R - 0x52: [694,0,646,88,617,'88 0V694H227H259H302Q365 694 399 689T474 663Q528 637 558 595T589 504Q589 482 584 462T569 426T547 396T522 372T495 353T470 338T449 328T434 322L429 320L440 300Q452 280 477 238T523 160L617 1L565 0Q513 0 512 1Q512 2 424 156L337 309H189V0H88ZM492 504Q492 600 367 620Q354 622 271 623H189V385H271Q363 386 388 392Q432 402 462 430T492 504'], - - // LATIN CAPITAL LETTER S - 0x53: [716,22,556,43,500,'55 514Q55 589 115 652T283 716Q315 716 345 711T396 699T432 685T457 672T467 667Q467 666 459 618T449 568Q383 634 282 634Q214 634 182 600T150 525Q150 507 155 492T172 465T194 446T222 432T247 423T272 416T289 412Q353 396 378 384Q432 358 466 307T500 194Q500 110 438 44T272 -22Q215 -22 159 -5T73 28T44 50Q45 51 49 75T57 122T62 146L65 143Q68 140 74 136T88 125T107 111T131 98T160 85T194 74T232 66T274 63H286Q327 63 366 96T406 182Q406 245 352 280Q329 296 265 310T173 339Q124 363 90 409T55 514'], - - // LATIN CAPITAL LETTER T - 0x54: [688,0,681,36,644,'36 608V688H644V608H518L392 609V0H288V609L162 608H36'], - - // LATIN CAPITAL LETTER U - 0x55: [694,22,688,87,600,'87 450V694H191V449Q192 203 193 194Q200 148 220 117T266 72T311 54T347 49Q404 49 446 84T501 178Q505 195 505 218T507 449V694H600V450Q600 414 600 356Q599 198 595 181Q594 178 594 177Q575 89 505 34T345 -22Q258 -22 184 34T89 196Q88 205 87 450'], - - // LATIN CAPITAL LETTER V - 0x56: [694,0,667,14,652,'14 692Q14 694 68 694H122L146 633Q325 165 339 90Q340 87 341 87Q341 124 530 619L558 694H605Q652 694 652 692Q650 690 523 354T390 10L387 0H279L276 10Q271 18 144 354T14 692'], - - // LATIN CAPITAL LETTER W - 0x57: [694,0,944,14,929,'115 694Q115 693 156 550T233 266T270 90L271 85Q272 86 272 92Q272 153 405 616L427 694H524L553 590Q672 174 681 95L682 84L684 95Q689 138 728 287T803 563T841 692Q841 694 885 694T929 693Q929 691 829 346L730 0H679L628 1L606 75Q478 524 470 600L469 611L467 600Q458 518 338 101L310 0H213L114 346Q14 691 14 693Q14 694 64 694H115'], - - // LATIN CAPITAL LETTER X - 0x58: [694,0,667,14,652,'14 0Q16 5 144 184T275 367L153 528Q121 571 88 615T42 674T28 694H150L228 584Q315 463 316 461L326 448L497 694H610L609 692Q606 689 492 528Q440 454 409 410T378 366Q378 365 515 182L652 0H531L326 292Q326 293 299 254T226 146L128 0H14'], - - // LATIN CAPITAL LETTER Y - 0x59: [694,0,667,4,663,'4 693L64 694H125L174 621Q335 378 340 364L341 362Q361 398 395 450L558 694H663L383 277V0H282V278L143 485Q112 531 75 586T21 668L4 693'], - - // LATIN CAPITAL LETTER Z - 0x5A: [694,0,611,55,560,'69 617V694H555V643L373 362Q190 81 190 79H234Q244 79 272 79T344 80T419 81H560V0H55V53L237 334Q420 615 420 617Q413 618 387 618Q380 618 334 618T245 617H69'], - - // LEFT SQUARE BRACKET - 0x5B: [750,250,289,94,266,'94 -250V750H266V674H181V-174H266V-250H94'], - - // RIGHT SQUARE BRACKET - 0x5D: [750,250,289,22,194,'22 674V750H194V-250H22V-174H107V674H22'], - - // CIRCUMFLEX ACCENT - 0x5E: [694,-527,500,79,421,'146 612L212 694H287L353 612Q417 532 420 529Q421 528 418 527Q414 527 383 527H345L250 639Q244 633 199 580L154 527H116Q79 528 79 529Q82 532 146 612'], - - // LOW LINE - 0x5F: [-38,114,500,0,499,'0 -114V-38H499V-114H0'], - - // LATIN SMALL LETTER A - 0x61: [460,10,481,38,408,'236 387Q209 387 184 382T141 370T111 355T91 342T83 337L82 355Q80 373 79 393T77 417Q77 419 81 421Q86 423 91 426Q155 460 227 460H238Q319 460 368 400Q393 371 400 341T408 252Q408 240 408 207T407 152V0H317V39L306 32Q244 -10 159 -10H152Q109 -10 77 22Q38 61 38 126Q38 142 39 146Q55 199 130 223T295 252H314V277Q314 305 313 310Q308 342 287 364T236 387ZM303 186Q124 180 124 126Q124 105 144 86T208 66Q284 66 309 124Q314 137 314 166V186H303'], - - // LATIN SMALL LETTER B - 0x62: [694,11,517,75,482,'303 -11Q280 -11 259 -6T222 6T194 21T176 33T168 38V0H75V694H165V550L166 405Q247 455 336 455Q397 455 439 389T482 226Q482 115 428 52T303 -11ZM390 221Q390 283 361 331T265 379Q214 379 177 342L168 334V118Q203 66 258 66Q316 66 353 106T390 221'], - - // LATIN SMALL LETTER C - 0x63: [460,10,444,34,414,'34 223Q34 327 99 393T245 460Q290 460 301 459Q328 455 354 445T395 427T410 415L396 338L386 344Q377 349 362 357T335 370Q305 381 258 381H252Q182 381 146 315Q126 275 126 224Q126 158 159 113T255 68Q329 68 394 106L408 114L410 93Q411 72 412 52L414 32Q407 27 394 20T338 2T252 -10Q156 -10 95 58T34 223'], - - // LATIN SMALL LETTER D - 0x64: [694,10,517,33,441,'33 224Q33 321 81 388T197 455Q277 455 342 414L351 408V694H441V0H348V44L338 37Q278 -10 198 -10Q177 -10 168 -8Q99 11 62 90Q33 148 33 224ZM348 337Q307 378 263 378Q260 378 256 378T251 379Q239 379 223 374T182 355T142 305T126 220Q126 90 225 67Q231 66 250 66H255Q306 66 342 115L348 124V337'], - - // LATIN SMALL LETTER E - 0x65: [461,10,444,28,415,'28 226Q28 329 91 395T235 461Q258 461 279 456T325 436T368 397T399 332T415 238V219H113V215Q113 163 151 114T248 65Q273 65 298 70T341 82T373 96T396 108L403 113Q403 106 406 76T409 38Q409 34 408 33T393 24Q325 -10 252 -10Q155 -10 92 59T28 226ZM340 289L338 297Q335 305 333 310T327 326T317 343T304 358T286 372T263 381T233 385Q212 385 193 376T162 353T140 325T127 301T123 289H340'], - - // LATIN SMALL LETTER F - 0x66: [705,0,306,27,347,'262 705H267Q300 705 347 694V612L336 616Q303 628 274 628H266Q224 628 199 605Q187 590 184 579T181 541V507V444H287V371H184V0H94V371H27V444H94V492Q94 544 95 550Q102 617 151 661T262 705'], - - // LATIN SMALL LETTER G - 0x67: [456,206,500,28,485,'55 286Q55 357 105 406T224 455Q280 455 323 421L322 423L318 427Q318 428 339 434T396 448T465 455H471L478 416L485 377Q484 377 474 379T445 383T401 385Q397 385 391 385T381 384L362 383L357 387Q358 386 364 375T375 354T384 325T389 287Q389 217 340 168T221 119Q178 119 138 142Q133 145 131 143Q125 131 125 117Q125 82 155 72L227 71Q230 71 251 71T280 71T310 69T343 65T373 57T403 46T428 30T449 7Q471 -26 471 -62V-71Q471 -136 384 -178Q326 -206 250 -206Q159 -206 102 -172T30 -92Q28 -84 28 -68T31 -37T40 -12T52 7T64 21T75 31T82 38Q60 68 60 106Q60 145 80 180L86 189L80 199Q55 240 55 286ZM304 233T304 287T279 362T220 383Q189 383 165 361T140 287Q140 243 161 217T220 191Q253 191 278 212ZM250 -134Q298 -134 331 -122T375 -96T387 -69Q387 -21 306 -7Q288 -5 216 -5Q161 -5 153 -7Q146 -9 139 -13T122 -31T113 -66Q113 -75 113 -80T127 -97T166 -121Q203 -134 250 -134'], - - // LATIN SMALL LETTER H - 0x68: [694,0,517,73,443,'163 395Q223 455 307 455Q417 455 438 354Q442 331 443 164V0H350V157Q349 315 348 320Q334 378 259 378H253Q224 378 204 358Q180 334 173 301T165 209Q165 198 165 172T166 129V0H73V694H163V395'], - - // LATIN SMALL LETTER I - 0x69: [680,0,239,67,171,'67 576V680H171V576H67ZM74 0V444H164V0H74'], - - // LATIN SMALL LETTER J - 0x6A: [680,205,267,-60,192,'88 576V680H192V576H88ZM31 -126Q40 -126 48 -125T62 -122T73 -117T82 -111T89 -105T94 -99T98 -92L102 -86V444H192V180Q191 -45 191 -70T184 -113Q171 -152 140 -178T63 -205Q34 -205 4 -197T-43 -181T-59 -171T-51 -133T-41 -96L-38 -99Q-34 -102 -28 -106T-13 -115T7 -123T31 -126'], - - // LATIN SMALL LETTER K - 0x6B: [694,0,489,76,471,'76 0V694H163V257L340 444H449L286 272L292 263Q296 259 378 138T463 12L471 0H372L309 92Q294 114 277 139T250 179T237 198L228 211L160 139V0H76'], - - // LATIN SMALL LETTER L - 0x6C: [694,0,239,74,164,'74 0V694H164V0H74'], - - // LATIN SMALL LETTER M - 0x6D: [455,0,794,73,720,'160 392Q223 455 304 455Q359 455 386 436T430 383L437 391Q495 455 584 455Q694 455 715 354Q719 331 720 164V0H627V157Q626 315 625 320Q611 378 536 378H530Q501 378 481 358Q457 334 450 301T442 209Q442 198 442 172T443 129V0H350V157Q349 315 348 320Q334 378 259 378H253Q224 378 204 358Q180 334 173 301T165 209Q165 198 165 172T166 129V0H73V450H160V392'], - - // LATIN SMALL LETTER N - 0x6E: [455,0,517,73,443,'160 392Q214 446 283 454Q285 454 292 454T303 455H306Q417 455 438 354Q442 331 443 164V0H350V157Q349 315 348 320Q334 378 259 378H253Q224 378 204 358Q180 334 173 301T165 209Q165 198 165 172T166 129V0H73V450H160V392'], - - // LATIN SMALL LETTER O - 0x6F: [460,10,500,28,471,'28 222Q28 323 95 391T244 460Q275 460 281 459Q364 445 417 377T471 219Q471 124 408 57T250 -10Q158 -10 93 57T28 222ZM377 230Q377 277 364 310T328 358T287 379T248 385Q233 385 219 382T186 369T155 342T132 297T122 230Q122 146 159 108T250 69H253Q263 69 274 70T305 81T339 106T365 154T377 230'], - - // LATIN SMALL LETTER P - 0x70: [455,194,517,75,483,'166 404Q194 424 241 439T337 455H341Q410 455 451 370Q483 307 483 222Q483 128 433 59T306 -10Q282 -10 260 -5T222 7T194 21T176 33T168 38V-194H75V444H165V424L166 404ZM390 222Q390 287 354 331T266 376T177 340L168 332V118Q200 66 257 66Q313 66 351 112T390 222'], - - // LATIN SMALL LETTER Q - 0x71: [455,194,517,33,441,'33 220Q33 325 87 389T206 454Q286 454 341 406L351 398V455H441V-194H348V41L338 35Q276 -8 198 -11Q171 -11 154 -5Q102 12 68 74T33 220ZM126 220Q126 160 161 113T251 65Q305 65 351 123V298L350 301Q349 304 347 308T342 319T336 331T327 343T315 355T300 365T283 373Q273 375 256 375Q208 375 167 332T126 220'], - - // LATIN SMALL LETTER R - 0x72: [455,0,342,74,327,'171 389Q237 455 320 455H327V373H317Q262 369 220 336T167 248Q165 239 164 119V0H74V450H159V377L171 389'], - - // LATIN SMALL LETTER S - 0x73: [460,10,383,28,360,'33 326Q33 376 60 408T117 450T175 460H190Q245 460 272 454T345 429Q345 428 338 388L331 349Q278 386 188 386H183Q119 386 119 336Q119 307 142 295T210 276T278 256Q360 213 360 130Q360 108 354 88T332 43T281 5T195 -10Q152 -10 111 1T49 22T28 35Q29 36 32 56T39 95T43 115T51 110T72 99T102 85T143 73T193 68Q274 68 274 123Q274 152 248 167Q234 178 187 186T115 207Q66 229 46 273Q33 298 33 326'], - - // LATIN SMALL LETTER T - 0x74: [571,10,361,18,333,'333 27Q333 24 314 16T257 -1T184 -10H172Q146 -10 128 14T105 58T99 91Q95 113 95 251V371H18V444H98V571H182V444H316V371H182V253Q183 128 189 104Q199 68 234 68Q277 72 314 98Q315 93 323 61T333 27'], - - // LATIN SMALL LETTER U - 0x75: [444,11,517,73,443,'353 39Q352 38 344 34T331 27T315 19T295 11T270 3T241 -3T207 -8T168 -10H162Q148 -10 137 -8T111 2T87 30T74 81Q73 89 73 268V444H166V268L167 92Q171 79 174 74T192 64T238 59Q317 59 344 116Q349 128 349 148T350 291V444H443V0H353V39'], - - // LATIN SMALL LETTER V - 0x76: [444,0,461,14,446,'178 0Q15 441 14 442Q14 444 60 444Q107 444 107 442Q108 441 136 364T196 194T232 67Q233 98 280 234T356 442Q356 444 401 444T446 442L282 0H178'], - - // LATIN SMALL LETTER W - 0x77: [444,0,683,14,668,'14 444H105L108 434Q192 160 200 74V65L201 75Q206 144 282 399L296 444H381L399 381Q480 112 480 69L481 70Q481 113 562 386L580 444H668L534 1L483 0H432L429 10Q343 294 338 367L337 377Q336 375 336 370Q336 340 313 250T269 88T245 11L242 0H195L148 1L14 444'], - - // LATIN SMALL LETTER X - 0x78: [444,0,461,0,460,'187 229L6 444H107L227 294L344 444H393L442 443Q439 437 299 268L267 229L460 0H359L294 88Q280 107 262 131T236 166L227 177L100 0H0Q1 1 47 58T140 171T187 229'], - - // LATIN SMALL LETTER Y - 0x79: [444,204,461,14,446,'113 -204Q83 -204 63 -200L43 -197Q43 -196 40 -157T36 -117L48 -121Q79 -133 114 -133Q124 -133 130 -132T145 -121T163 -94Q169 -82 184 -42T200 1L188 29Q176 57 152 115T107 223T62 330T26 416L14 443Q14 444 61 444H109L122 411Q230 155 236 75L237 65V74Q245 161 348 424L356 444H401Q446 444 446 443L396 313Q345 183 293 49T236 -93Q191 -204 123 -204H113'], - - // LATIN SMALL LETTER Z - 0x7A: [444,0,435,28,402,'42 370V444H400V395L156 76L279 77H402V0H28V51L273 371L157 370H42'], - - // TILDE - 0x7E: [327,-193,500,83,416,'83 204Q86 254 113 290T186 327Q211 327 251 299T312 270Q337 270 340 315V327H416V316Q413 258 382 226T315 193Q289 193 249 221T187 250Q162 250 159 205V193H83V204'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/SansSerif/Regular/BasicLatin.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/CombDiacritMarks.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/CombDiacritMarks.js deleted file mode 100644 index ca85d99e4c..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/CombDiacritMarks.js +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/SansSerif/Regular/CombDiacritMarks.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_SansSerif'], - { - // COMBINING GRAVE ACCENT - 0x300: [694,-527,0,-417,-200,'-415 692L-417 694H-324L-262 612Q-249 594 -233 572T-208 539L-200 528L-237 527H-275L-344 608Q-359 625 -378 647T-406 680T-415 692'], - - // COMBINING ACUTE ACCENT - 0x301: [694,-527,0,-301,-84,'-239 612L-177 694H-84L-86 692Q-86 691 -95 681T-123 648T-157 608L-226 527H-264L-301 528L-293 539Q-285 550 -269 572T-239 612'], - - // COMBINING CIRCUMFLEX ACCENT - 0x302: [694,-527,0,-421,-79,'-354 612L-288 694H-213L-147 612Q-83 532 -80 529Q-79 528 -82 527Q-86 527 -117 527H-155L-250 639Q-256 633 -301 580L-346 527H-384Q-421 528 -421 529Q-418 532 -354 612'], - - // COMBINING TILDE - 0x303: [677,-543,0,-417,-84,'-417 554Q-414 604 -387 640T-314 677Q-289 677 -249 649T-188 620Q-163 620 -160 665V677H-84V666Q-87 608 -118 576T-185 543Q-211 543 -251 571T-313 600Q-338 600 -341 555V543H-417V554'], - - // COMBINING MACRON - 0x304: [631,-552,0,-431,-70,'-431 552V631H-70V552H-431'], - - // COMBINING BREVE - 0x306: [694,-508,0,-427,-74,'-250 508Q-331 508 -379 567T-427 689V694H-351V685Q-348 649 -321 620T-250 591Q-206 591 -180 619T-150 685V694H-74V689Q-74 624 -122 566T-250 508'], - - // COMBINING DOT ABOVE - 0x307: [680,-576,0,-302,-198,'-302 576V680H-198V576H-302'], - - // COMBINING DIAERESIS - 0x308: [680,-582,0,-397,-104,'-397 582V680H-299V582H-397ZM-202 582V680H-104V582H-202'], - - // COMBINING RING ABOVE - 0x30A: [694,-526,0,-319,-99,'-319 611Q-319 649 -285 671T-211 694Q-164 694 -132 671T-99 611Q-99 572 -133 550T-209 527T-285 549T-319 611ZM-155 610Q-155 635 -171 643T-215 651Q-263 651 -263 610Q-263 570 -211 570H-209H-207Q-155 570 -155 610'], - - // COMBINING DOUBLE ACUTE ACCENT - 0x30B: [694,-527,0,-399,-84,'-250 693Q-317 544 -323 527H-399L-343 694H-296Q-250 694 -250 693ZM-84 693Q-151 544 -157 527H-233L-177 694H-130Q-84 694 -84 693'], - - // COMBINING CARON - 0x30C: [654,-487,0,-422,-80,'-421 652Q-422 653 -419 654Q-415 654 -384 654H-346L-301 601Q-287 585 -275 571T-258 551T-250 542L-155 654H-117Q-80 653 -80 652Q-83 649 -147 569L-213 487H-288L-354 569Q-418 649 -421 652'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/SansSerif/Regular/CombDiacritMarks.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/Main.js deleted file mode 100644 index d7260985c1..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/Main.js +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/SansSerif/Regular/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_SansSerif'] = { - directory: 'SansSerif/Regular', - family: 'MathJax_SansSerif', - id: 'MJSS', - Ranges: [ - [0x0,0x7F,"BasicLatin"], - [0x80,0xFFFF,"Other"], - [0x300,0x36F,"CombDiacritMarks"] - ] - - -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/SansSerif/Regular/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/Other.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/Other.js deleted file mode 100644 index 93d25b5c99..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/Other.js +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/SansSerif/Regular/Other.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_SansSerif'], - { - // LATIN SMALL LETTER DOTLESS I - 0x131: [444,0,239,74,164,'74 0V444H164V0H74'], - - // LATIN SMALL LETTER DOTLESS J - 0x237: [444,205,267,-60,192,'-35 -95Q-4 -126 34 -126Q58 -126 76 -116T100 -88Q102 -82 102 181V444H192V180Q191 -45 191 -70T184 -113Q171 -152 140 -178T63 -205Q34 -205 4 -197T-43 -181T-59 -171L-47 -133L-35 -95'], - - // GREEK CAPITAL LETTER GAMMA - 0x393: [691,0,542,87,499,'87 0V691H499V611H345L191 612V0H87'], - - // GREEK CAPITAL LETTER DELTA - 0x394: [694,0,833,42,790,'203 348L362 694H470L629 348Q789 2 790 1Q790 0 416 0T42 1Q43 2 203 348ZM630 98Q630 100 584 198T481 422T407 603L405 610L403 600Q388 544 191 122L180 99L405 98H630'], - - // GREEK CAPITAL LETTER THETA - 0x398: [716,21,778,56,722,'56 344Q56 430 86 502T164 619T271 690T388 716Q448 716 506 691T613 619T692 501T722 344Q722 188 624 84T389 -21Q252 -21 154 83T56 344ZM624 345Q624 423 597 488T513 596T380 639Q343 639 305 621T232 568T175 475T153 344Q153 216 222 136T388 56Q487 56 555 138T624 345ZM209 299V397H568V299H209'], - - // GREEK CAPITAL LETTER LAMDA - 0x39B: [694,0,611,28,582,'294 606Q294 574 252 430T163 144T117 0H72Q28 0 28 1T141 348L254 694H357L469 348Q582 2 582 1T527 0L473 1L469 11Q469 13 427 141T343 411T296 599L294 610V606'], - - // GREEK CAPITAL LETTER XI - 0x39E: [688,0,667,42,624,'47 600V688H619V600H47ZM111 314V401H555V314H111ZM42 0V88H624V0H42'], - - // GREEK CAPITAL LETTER PI - 0x3A0: [691,0,708,86,621,'86 0V691H621V0H517V615H190V0H86'], - - // GREEK CAPITAL LETTER SIGMA - 0x3A3: [694,0,722,55,666,'55 0Q56 3 171 167T288 332Q288 334 172 474L55 615V694H666V614H428L190 615L412 347L322 218Q236 97 228 84L447 85H666V0H55'], - - // GREEK CAPITAL LETTER UPSILON - 0x3A5: [716,0,778,55,722,'55 565Q59 625 105 670T219 716H222Q310 716 353 627Q376 583 386 524L389 510L393 532Q397 555 407 584T433 644T482 695T557 716Q621 716 669 673T722 565V555H629V563Q627 592 607 615T557 638Q530 638 511 629T479 598T459 553T447 488T442 411T441 319V202V0H337V202Q337 453 331 497Q313 634 226 638Q185 638 167 612T148 563V555H55V565'], - - // GREEK CAPITAL LETTER PHI - 0x3A6: [694,0,722,55,666,'666 347Q666 326 661 302T638 247T594 190T520 140T413 107H410V0H312V54Q312 107 311 107Q286 107 229 128T125 192Q55 260 55 347Q55 396 77 438T131 507T200 552T265 579T311 587Q312 587 312 641V694H410V587H413Q476 576 524 552T598 502T640 444T661 390T666 347ZM310 510Q305 510 291 507T252 492T208 464T172 416T157 347T171 279T204 233T247 205T286 190T310 184H312V347Q312 510 310 510ZM564 347Q564 385 549 416T514 463T470 491T433 505T414 509L410 510V184Q413 184 426 187T464 200T510 227T548 275T564 347'], - - // GREEK CAPITAL LETTER PSI - 0x3A8: [694,0,778,55,722,'340 187V694H438V187Q481 206 495 219Q518 239 533 267T553 332T560 386T562 435Q562 576 593 608Q608 621 637 621H670H722V545H719Q718 545 715 545T710 544Q679 536 666 487Q664 474 662 429T654 344T633 259T580 175T486 119Q450 109 438 108V0H340V108L326 110Q122 149 117 415Q116 460 111 487Q98 536 67 544Q65 544 62 544T58 545H55V621H107Q160 621 163 620Q191 613 202 573Q213 536 213 473T220 351T256 249Q262 239 270 230T285 216T301 205T316 197T329 192T340 187'], - - // GREEK CAPITAL LETTER OMEGA - 0x3A9: [716,0,722,44,677,'55 462Q55 561 141 638T359 716Q492 716 579 640T666 462Q666 407 642 347T579 222T529 126Q515 91 515 86Q517 85 528 85Q530 85 552 85T596 86H677V0H425V14Q429 79 465 168L492 228Q494 232 504 254T516 283T527 310T539 340T548 368T556 399T560 428T562 460Q562 531 510 585T361 639Q263 639 211 585T159 460Q159 422 170 378T192 309T229 228L256 168Q292 79 296 14V0H44V86H125Q146 86 168 86T193 85L206 86Q206 103 183 148T131 241T79 352T55 462'], - - // EN DASH - 0x2013: [312,-236,500,0,499,'0 236V312H499V236H0'], - - // EM DASH - 0x2014: [312,-236,1000,0,999,'0 236V312H999V236H0'], - - // LEFT SINGLE QUOTATION MARK - 0x2018: [694,-471,278,90,189,'90 568L140 694H189L174 633Q159 572 158 571Q158 569 173 569H188V471H90V568'], - - // RIGHT SINGLE QUOTATION MARK - 0x2019: [694,-471,278,89,188,'90 596V694H188V597L139 471H89L104 532Q119 593 120 594Q120 596 105 596H90'], - - // LEFT DOUBLE QUOTATION MARK - 0x201C: [694,-471,500,174,467,'174 568L224 694H273L258 633Q243 572 242 571Q242 569 257 569H272V471H174V568ZM368 568L418 694H467L452 633Q437 572 436 571Q436 569 451 569H466V471H368V568'], - - // RIGHT DOUBLE QUOTATION MARK - 0x201D: [694,-471,500,32,325,'33 596V694H131V597L82 471H32L47 532Q62 593 63 594Q63 596 48 596H33ZM227 596V694H325V597L276 471H226L241 532Q256 593 257 594Q257 596 242 596H227'], - - // INCREMENT - 0x2206: [694,0,833,42,790,''] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/SansSerif/Regular/Other.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Script/Regular/BasicLatin.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Script/Regular/BasicLatin.js deleted file mode 100644 index 23b3a0654a..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Script/Regular/BasicLatin.js +++ /dev/null @@ -1,107 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Script/Regular/BasicLatin.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Script'], - { - // SPACE - 0x20: [0,0,250,0,0,''], - - // LATIN CAPITAL LETTER A - 0x41: [718,8,803,35,1016,'76 60Q83 29 135 29Q190 29 264 81Q280 93 280 95T277 99T265 106T248 118Q189 166 189 237Q189 307 245 388Q267 421 299 436Q336 455 386 455Q488 455 550 403L559 395L571 405Q727 544 944 679L957 687L966 701Q968 704 970 707T973 712T975 714T978 716T982 717T989 717H995Q1004 717 1007 717T1013 714T1016 708Q1016 705 829 403L636 92L630 83Q659 93 685 110T728 143L745 158Q758 158 752 138L748 127L740 119Q676 58 605 42L593 22Q590 17 587 12T583 6T579 2T573 0T564 0H530H484Q480 3 480 8Q480 15 489 26T498 39T497 40Q477 40 423 49T327 74L316 78L302 68Q200 -8 121 -8Q85 -8 60 7T35 53T60 113T123 144Q144 144 153 132T162 106Q162 89 143 75T99 61Q90 61 76 65V60ZM904 614L905 615Q901 615 840 573T700 469T581 369L587 359Q600 340 608 315T618 273T622 238T624 216L764 414Q904 612 904 614ZM525 363Q493 405 379 418H375Q342 418 309 378Q251 300 251 234Q251 174 306 137Q318 128 322 131Q323 132 329 139Q351 161 362 180Q430 273 509 348L525 363ZM579 205Q579 245 571 278T556 323T546 337L521 311Q461 248 422 196T362 121L353 111Q427 85 499 79Q517 77 520 77L525 76L549 111Q551 114 556 121T563 131T568 138T573 147T575 157T577 169T578 185T579 205'], - - // LATIN CAPITAL LETTER B - 0x42: [708,28,908,31,928,'256 262Q161 262 161 351Q161 408 203 471T289 570Q380 645 475 676T617 707L627 708Q637 708 644 708Q759 708 831 675L844 669L857 677Q892 700 896 700Q902 700 907 685Q907 683 907 681T908 678T909 676T909 673Q909 671 909 670T906 667T903 664T897 660T889 655L878 647L889 636Q928 598 928 548Q928 529 923 510T907 474T886 442T861 412T837 388T815 368T800 355Q847 323 847 270V263Q847 205 806 145Q766 82 695 37T564 -8Q527 -8 506 10T484 58Q484 85 501 117T543 172Q607 226 685 228Q695 228 698 226Q703 220 692 206Q684 194 682 193T665 191Q625 189 595 172T550 133T529 93T522 66Q522 29 576 29Q642 29 705 109Q785 211 785 270Q785 287 779 300T769 316T755 327L740 319Q682 290 634 290Q611 290 592 294H588L565 261Q559 252 544 231T522 201T504 178T481 151T455 123Q394 63 314 18T159 -28Q103 -28 67 -6T31 54Q31 88 57 123T123 158Q144 158 154 146T164 119Q164 102 142 89T100 75Q94 75 87 77T76 80L72 81Q69 78 69 65Q69 35 102 22T175 9Q184 9 198 11Q248 23 300 70T403 187T508 331T636 489T789 629L801 639Q796 642 786 647T732 661T633 670Q592 670 558 665Q481 651 409 613T286 520Q274 507 258 485T222 424T202 354Q202 299 269 299Q282 299 295 301T318 307T339 317T358 329T376 345T391 362T406 380T420 398T433 417T445 435Q496 512 496 547Q496 559 497 560T516 569Q526 574 530 574Q538 574 538 540Q538 414 427 325Q342 262 256 262ZM689 382Q708 382 753 375L765 387Q860 482 860 555Q860 594 839 610L822 592Q794 563 752 511T680 420T651 380Q655 381 660 381Q664 382 689 382ZM697 344Q692 345 681 345H675Q671 345 665 345T655 344T650 344L648 342Q646 339 645 338Q643 333 639 327H653Q670 329 676 330Q706 342 706 343Q702 344 697 344'], - - // LATIN CAPITAL LETTER C - 0x43: [728,26,666,26,819,'367 89Q367 84 353 77T334 70Q325 70 312 83T298 120Q298 169 364 233T496 298Q538 298 563 275T588 220V213Q588 132 501 53T306 -26Q251 -26 211 6T170 114Q171 148 181 184T205 248T232 298T255 334T265 349T246 350Q127 350 77 390T26 480Q26 533 71 581T178 656T295 683Q312 683 312 676Q312 674 311 672L302 660Q294 648 292 647L286 646Q280 646 276 646Q197 641 145 583T93 476Q93 387 265 387Q271 387 277 387T287 388T292 388T313 414T373 483T451 562Q618 712 732 727Q733 727 740 727T753 728Q790 727 804 708T819 665Q819 643 810 617T773 553T699 481T572 414T385 361Q381 361 367 341Q247 172 247 86Q247 11 325 11Q404 11 465 95Q518 165 528 208Q529 212 529 220Q529 237 518 249T480 261Q431 261 387 209T343 126Q343 111 355 101T367 89ZM777 658Q777 691 738 691Q704 691 658 662T570 590T491 504T432 432T410 400H411Q416 400 440 405T505 423T589 455T675 506T743 576Q777 627 777 658'], - - // LATIN CAPITAL LETTER D - 0x44: [708,31,774,68,855,'251 272Q199 272 168 298T136 374Q136 432 175 496T267 603Q321 645 395 676T552 708Q610 708 655 694T724 659T763 618T784 584L790 569Q792 569 800 572T819 576T840 578Q855 578 855 571Q855 566 846 554T829 541Q824 541 817 539T804 533T799 529Q802 517 802 483Q802 376 742 256T585 53T392 -31Q353 -31 300 -7L289 -2L277 -6Q242 -17 192 -17Q141 -17 113 -13T77 -3T68 14Q68 20 73 28T93 45T131 58Q152 62 197 62Q241 62 272 48L282 44Q308 65 334 93Q380 145 467 266T622 454Q644 476 664 493T694 517T720 534T740 547Q699 671 540 671Q461 671 385 625T276 534Q265 520 251 499T219 438T202 368Q202 309 267 309Q325 309 396 383T491 545Q492 548 493 552Q494 558 496 559T511 564Q513 565 514 565Q523 568 527 568Q534 568 534 560Q534 554 529 537Q507 442 420 357T251 272ZM332 20Q332 19 341 15T368 6T400 2Q425 2 457 13T531 49T614 125T690 248Q750 376 750 476V490L738 479Q698 436 646 366T554 239T455 121T332 20ZM226 20Q226 25 186 25Q181 25 174 24H166Q161 24 158 23H152Q170 21 197 21Q205 21 213 21T223 20H226'], - - // LATIN CAPITAL LETTER E - 0x45: [707,8,562,46,718,'280 398L279 400Q278 402 277 405T275 413T272 426T271 443Q271 494 302 544T379 629T472 685T553 707H565H573Q630 707 664 689Q718 661 718 604Q718 548 662 492T553 436Q525 436 508 451T490 492Q490 534 531 579T619 630Q632 630 632 623Q632 619 624 606Q614 593 602 592T578 580Q566 568 549 541T532 497Q532 474 565 474Q577 474 587 476Q600 481 611 489Q630 503 651 535T672 596Q672 660 553 660H548Q494 660 450 616Q421 587 384 531T343 439Q341 420 344 415H345Q346 415 352 415T369 417T391 418Q421 418 440 412T466 398T473 382Q473 367 452 353T398 339Q370 339 348 345T315 359L304 366Q297 365 284 360T234 321T163 234Q120 160 120 117Q120 83 149 57T252 30Q311 30 357 60Q386 79 414 114T452 179Q454 186 454 200Q454 230 415 242Q401 246 373 246Q353 246 347 244Q328 236 313 219T288 184T274 149T265 121T261 109Q260 107 247 102T230 97Q223 97 223 105Q223 148 271 216T386 284Q446 284 483 260T520 195Q520 121 427 57T239 -8Q192 -8 152 2T79 46T46 133Q46 212 107 285T269 394L280 398ZM427 376Q427 377 402 380Q386 380 386 379L425 375L427 376'], - - // LATIN CAPITAL LETTER F - 0x46: [735,37,895,39,990,'258 428Q258 489 322 562T482 685T661 735Q726 735 824 693T977 651Q990 651 990 644Q990 639 971 612T948 581Q947 580 938 580Q878 580 784 621T617 663Q544 663 480 635T379 568T320 492T299 431Q299 387 362 387Q404 387 438 402T493 438T527 486T546 531T551 563Q551 569 550 575T549 584T549 590Q551 593 563 602T579 611Q584 611 592 605T608 584T616 548Q616 513 595 477T554 423Q518 392 464 372T349 351Q258 351 258 428ZM324 187T305 187T286 196Q286 202 301 217Q327 242 383 262T484 290L527 297L567 356Q624 441 643 467T688 521Q715 550 752 581T795 613T804 603T808 587T778 547T702 444T626 300H637Q663 302 685 306L697 308L703 317Q745 376 792 400Q806 406 818 406Q849 406 849 375Q847 355 831 338T797 312T763 296L747 290Q744 289 735 266T724 241Q722 240 702 232T664 217T645 210Q638 210 638 218Q638 224 653 246T669 270Q669 271 668 271Q663 270 624 264L607 263Q570 199 529 152Q513 133 484 106T409 45T305 -13T193 -36Q109 -36 74 -10T39 50Q39 86 64 121T128 158Q171 158 171 121Q171 97 141 83Q125 75 107 75Q93 75 80 83Q76 71 76 62Q76 29 117 15T207 0Q324 0 494 248L501 258H495Q368 239 330 195Q324 187 305 187ZM775 335Q806 358 806 368Q805 369 804 369Q800 369 791 360Q774 336 775 335'], - - // LATIN CAPITAL LETTER G - 0x47: [717,37,610,12,739,'206 318L249 320Q249 327 259 352T282 399Q312 447 366 510T465 610Q588 717 661 717Q695 717 716 701T738 653T704 577Q663 522 610 474T512 397T424 346T359 315T333 306Q331 304 327 290T323 267Q323 229 368 229Q402 229 439 254T505 312T571 382T638 435Q642 437 644 437Q658 437 658 409Q655 403 647 399T624 379T595 326Q583 296 564 267T523 179Q504 126 483 91T423 27Q335 -37 231 -37Q191 -37 157 -30T95 -2T67 53Q67 89 94 123T159 158Q180 158 190 146T200 119Q200 102 178 89T136 75Q128 75 120 78T110 81Q105 81 105 62Q105 38 129 24T180 5T238 1H244Q282 1 319 32Q349 55 371 85T436 190L465 239Q413 192 354 192Q300 192 274 217T245 276Q245 284 242 284Q220 280 187 280Q106 280 59 315T12 409Q12 457 43 508T118 597T210 659T295 683Q308 683 308 675Q308 670 299 658T282 646Q266 646 240 633Q182 606 118 511Q76 448 76 400Q76 368 105 343T206 318ZM677 660Q677 680 646 680Q616 680 565 629Q537 601 514 571Q493 544 455 492T389 398T360 355Q366 357 386 367Q463 406 534 473T641 591T677 660'], - - // LATIN CAPITAL LETTER H - 0x48: [718,36,969,29,1241,'331 505Q331 519 382 574T472 629H480Q512 629 529 614T547 576Q547 555 534 532T520 504Q520 493 549 493Q590 493 623 506T668 533L681 546Q731 600 772 641T832 700T852 717Q857 717 860 711T865 697L866 690Q866 688 813 617T708 475T656 403Q682 403 714 404H771L780 416Q1004 707 1167 707Q1209 707 1225 689T1241 646Q1241 604 1209 547T1118 447Q1081 422 1034 405T952 382T888 374T857 370H852L826 334Q733 204 708 144Q691 104 691 76Q691 29 748 29Q768 31 791 48T831 83T862 122T881 146Q883 148 900 148H917Q921 143 921 140T914 127Q810 -8 723 -8Q611 -4 611 100Q611 142 631 191T676 275T721 337T742 367Q716 367 685 366H628L620 355Q618 352 558 268Q486 168 461 141Q405 79 339 34T215 -28Q188 -36 153 -36Q86 -36 58 -11T29 46Q29 82 55 120T123 158Q144 158 154 146T164 119Q164 102 143 89T100 75Q92 75 86 76T77 80T72 82Q67 82 67 60Q67 28 99 14T170 0Q214 0 272 47T419 224L505 340L518 357Q513 357 504 356T467 347T415 330T360 300T308 253Q296 238 295 237H278H274Q256 237 256 243Q256 248 263 256Q291 294 330 321T407 362T476 382T530 393T552 398Q556 402 573 423T600 454Q602 457 604 460T608 465L610 467Q565 455 532 455Q465 455 449 483Q447 487 447 498Q447 513 463 538T479 579Q479 593 463 593Q436 593 385 519Q374 504 371 502T360 499H353H349Q331 499 331 505ZM1195 634Q1195 643 1195 648T1185 662T1157 671Q1130 671 1092 644T1019 579T952 502T901 436L882 409L891 410Q900 411 913 412T934 415Q1081 439 1144 520Q1195 590 1195 634'], - - // LATIN CAPITAL LETTER I - 0x49: [717,17,809,59,946,'487 225Q398 255 398 342Q398 410 455 492Q491 545 552 582T669 636T800 673T918 712Q930 717 933 717Q939 717 942 706T946 689Q946 686 915 664T830 591T729 480Q691 429 657 351T615 260Q628 260 663 279T733 339T769 426Q769 442 767 459T764 479Q764 484 766 486Q769 488 781 493T797 498Q802 498 803 494T808 472Q813 442 813 425Q813 369 761 315Q692 246 605 224L592 220L584 209Q547 155 487 106T358 25Q270 -17 191 -17Q143 -17 101 1T59 59Q59 96 85 127T148 158Q169 158 179 146T189 119Q189 102 167 89T125 75Q116 75 109 77T101 81T97 80Q96 77 96 72Q96 50 123 36T204 21H216Q249 21 302 49T411 134Q439 161 459 187Q487 220 487 225ZM460 334Q460 308 472 290T498 268L510 263Q515 263 545 313T626 438T723 561Q751 589 775 609T808 636T817 644H816Q813 644 732 618Q681 601 645 584T585 548T549 514T518 476Q460 390 460 334'], - - // LATIN CAPITAL LETTER J - 0x4A: [717,314,1052,92,1133,'829 148Q845 148 845 143T841 130T823 109T788 83T730 54T644 22Q637 20 634 19T627 16T622 13T618 10T612 3T604 -6Q510 -112 396 -203T201 -312Q190 -314 171 -314H166Q156 -314 147 -312T123 -304T101 -283T92 -245Q92 -203 117 -160T175 -93Q214 -65 280 -41T390 -6T509 22L532 27L547 47Q673 219 673 225L665 228Q657 231 648 235T627 249T606 270T591 300T584 341Q584 389 614 447T686 544Q735 588 799 615T959 667T1108 713Q1118 717 1119 717Q1125 717 1129 705T1133 689Q1133 686 1115 673Q1051 627 1001 579T918 481T867 403T828 328T805 277Q802 271 801 267T798 261T798 259Q849 270 900 317Q956 371 956 421Q956 438 953 457T950 480Q950 481 950 482L951 484Q953 487 966 492T985 498Q989 498 994 473Q1000 441 1000 423Q1000 362 934 302T790 223L775 220L767 207Q757 191 731 158T685 98T662 63Q662 61 690 70T755 99T811 142L816 148H829ZM646 332Q646 308 659 291T685 268L698 263L735 320Q828 465 865 511Q923 582 1003 643L1005 645Q1004 645 924 620Q775 572 716 492Q646 401 646 332ZM184 -278Q233 -278 311 -212T444 -80L498 -15H496Q468 -20 424 -30T293 -70T174 -133Q167 -140 158 -153T138 -190T127 -232Q127 -278 184 -278'], - - // LATIN CAPITAL LETTER K - 0x4B: [717,37,914,29,1204,'521 506Q521 493 549 493Q608 493 660 527Q667 531 690 555L736 604Q750 619 777 646T825 694T848 716T852 717Q857 717 860 711T865 697L866 690Q866 687 812 615Q654 404 654 401Q655 401 656 401T659 402T665 403T680 404Q718 404 734 374Q735 370 743 376Q745 377 752 382Q806 416 852 466T933 563T982 623Q1028 666 1075 686T1155 706Q1165 706 1173 705T1186 703T1194 699T1199 695T1201 692T1202 688V687L1204 677Q1204 667 1191 670Q1189 670 1183 670T1174 671Q1137 671 1086 643T1001 564Q970 517 899 449T749 339L739 333L736 322Q730 295 703 253T652 165T628 77Q628 21 681 21Q692 21 698 23Q751 46 817 134L827 148H844Q861 148 864 146Q869 140 859 127Q818 75 761 29T665 -17Q649 -17 633 -12T598 4T569 40T558 100Q558 128 563 152T585 205T609 245T643 294Q647 300 645 300Q633 297 615 297Q607 297 600 298T589 300T584 301Q581 301 569 284T536 236T488 171T418 97T331 28Q233 -37 155 -37Q104 -37 68 -17T29 44Q29 82 55 120T123 158Q144 158 154 146T164 119Q164 102 143 89T100 75Q92 75 86 76T77 80T72 82Q68 82 68 59Q68 37 85 23T123 5T167 0Q203 0 238 21T311 85T382 174T468 288T563 410Q576 426 588 440T607 462T615 472L605 468Q568 456 533 456H527Q490 456 463 483Q451 496 451 508T468 545T486 581Q486 593 465 593Q448 593 425 568T384 518T364 493Q364 492 347 492Q326 492 326 499T351 537T414 599T477 630Q509 630 528 615T547 576Q547 556 534 533T521 506ZM675 357Q675 368 665 368Q656 368 644 363Q631 355 616 333H628Q640 334 672 341Q675 354 675 357'], - - // LATIN CAPITAL LETTER L - 0x4C: [717,17,874,14,1035,'572 704Q607 704 607 693Q607 681 590 664H588Q586 664 584 664T578 663Q504 658 434 592T363 457Q363 426 386 401Q417 371 481 361Q490 360 527 360H562Q565 363 595 404T666 494T755 596T854 682T945 717Q986 717 1010 696T1035 637Q1035 593 996 531T873 414Q809 378 753 360T674 338T651 333Q650 333 633 308T588 245T544 185Q498 126 426 78L413 68H414Q498 47 575 47Q626 47 676 74T755 139L762 148H779H783Q802 148 802 142Q802 137 795 129Q760 81 691 33T544 -16Q470 -16 366 20L341 29L331 24Q239 -17 155 -17H141Q90 -17 61 -12T23 1T14 22Q14 44 39 65T103 95Q126 101 180 101Q224 101 258 98T309 90T330 86Q332 86 353 103T389 135Q401 146 412 158T431 179T450 203T466 225T485 252T505 280L535 322H509Q391 322 340 362T289 452Q289 495 321 547T396 630Q438 665 486 684T572 704ZM978 635Q978 644 977 650T973 661T968 668T961 673T954 676T946 678T938 680Q929 680 925 677Q893 659 795 531T682 377Q683 377 711 385T755 401T801 421T856 453T906 495Q927 516 952 557T978 635ZM274 50Q274 51 258 54T216 61T166 65Q160 65 151 65T140 64Q115 58 102 48T88 31Q88 20 159 20Q191 20 219 27T261 42L274 50'], - - // LATIN CAPITAL LETTER M - 0x4D: [721,51,1080,30,1216,'112 -7Q86 -7 58 6T30 48T54 103T113 130Q129 130 141 121T153 94Q153 71 132 59T90 47H80Q95 30 133 30Q180 30 228 63T311 137T402 249T500 361Q566 425 703 529T910 693Q942 721 945 721T958 716T970 709Q974 704 964 691Q961 688 905 622T847 554L595 181Q553 121 527 77T496 19L492 5Q497 5 531 46Q579 98 685 224T850 409L972 524Q994 543 1004 556Q1012 567 1097 643T1186 720Q1194 720 1206 715T1215 703Q1215 701 1191 671T1133 599T1080 530Q1036 461 983 357T862 152Q802 64 799 17Q799 7 800 5T811 2Q836 2 882 37T969 126Q972 130 974 134T978 138T983 139T996 140H1012Q1018 134 1018 132Q1018 122 981 83T889 4T795 -35Q761 -35 745 -12T728 48Q728 122 781 190Q833 269 890 370L927 434L914 422Q848 360 752 245Q643 117 582 51T498 -33T461 -50Q424 -48 424 -4Q424 84 481 172L714 495Q591 406 523 333Q507 316 430 226T313 95Q263 48 221 24T162 -4T120 -7H112'], - - // LATIN CAPITAL LETTER N - 0x4E: [726,36,902,29,1208,'764 513Q764 482 772 423T780 330Q780 304 778 285T775 256T773 245Q778 252 826 328T932 484T1042 617Q1077 652 1114 678T1173 715T1200 726Q1208 726 1208 717Q1208 711 1206 695L1203 679L1199 675Q1197 675 1187 670T1161 657T1133 639Q1050 583 959 456Q906 381 858 307T779 179T725 83T691 18T679 -6Q677 -8 660 -8H656Q639 -8 639 -1Q639 4 646 17Q685 93 685 173V196Q685 233 681 288T676 380Q676 438 687 487L664 454Q505 230 454 170Q366 64 290 14T163 -36H152Q87 -36 58 -11T29 46Q29 82 55 120T123 158Q144 158 154 146T164 119Q164 102 143 89T100 75Q92 75 86 76T77 80T72 82Q67 82 67 59Q67 37 89 19T167 1Q187 1 197 3Q221 9 246 22T292 52T336 91T375 132T411 174T440 212T463 245T478 266Q779 695 784 698Q786 700 802 700H818Q824 694 824 692T809 668T779 604T764 513'], - - // LATIN CAPITAL LETTER O - 0x4F: [707,8,738,96,805,'259 -8Q230 -7 205 0T153 24T112 74T96 153Q96 254 174 379T374 599T607 707H621Q732 707 778 661Q805 634 805 598Q805 558 775 517T696 452L684 447V441Q684 378 626 273T484 97Q379 7 288 -7Q279 -8 259 -8ZM760 594Q760 670 608 670Q562 670 493 622T347 472Q174 240 174 131Q174 76 205 53T279 29Q294 29 306 32Q405 60 507 205Q592 325 616 401Q625 426 625 435Q625 436 621 436T603 440T569 449Q524 466 515 475Q513 477 513 481T525 496T541 508L548 504Q555 501 565 497T587 488T609 480T625 476Q627 476 626 481Q626 486 623 494T613 513T589 533T548 541Q495 541 413 454T286 281Q265 241 254 201T240 141T235 120Q234 118 217 111T197 104Q195 104 192 107T189 112Q190 125 193 147T220 231T280 348Q335 428 407 493T539 576Q548 578 563 578Q594 578 617 568T653 546T672 518T681 494T683 482Q683 481 684 481Q690 481 707 495T742 538T760 594'], - - // LATIN CAPITAL LETTER P - 0x50: [716,37,1013,90,1031,'571 345Q571 384 612 418T687 452Q698 452 698 445Q698 436 679 417Q677 415 670 415Q650 412 633 389T615 350Q615 340 621 331T634 319T643 315L663 342Q751 462 817 536Q873 595 896 614L907 625Q843 680 701 680Q594 680 499 632T344 516Q317 486 296 449T267 384Q262 366 262 354Q262 332 276 316T326 299H327Q374 299 426 338Q481 376 537 456T597 598Q597 616 599 617Q601 619 614 624T630 630Q639 630 639 604V587V581Q639 519 597 456Q544 377 462 320T318 262Q278 262 250 282T222 350Q222 418 285 504Q360 597 480 656T702 716Q773 716 825 707T898 688T951 660Q962 670 985 685T1012 700Q1018 700 1022 690T1026 673Q1026 670 1019 664Q988 633 988 631Q988 630 999 618T1020 580T1031 522Q1031 471 1003 419T928 330Q854 275 765 264Q757 262 733 262H714L701 245Q615 121 473 42T218 -37Q159 -37 125 -15T90 46Q90 82 116 120T185 158Q203 158 213 147T224 121Q224 110 219 102Q198 75 159 75Q154 75 149 76T143 77T140 77Q137 72 137 53Q138 37 149 26T177 9T205 2T228 0Q313 0 419 74T602 257L620 281L614 285Q607 289 601 294T587 306T576 323T571 345ZM950 529Q950 576 943 576Q940 576 840 439T741 299H751Q804 300 845 334T924 438Q949 490 950 529'], - - // LATIN CAPITAL LETTER Q - 0x51: [717,17,883,54,885,'330 387Q330 331 402 331Q463 331 514 371T589 459T613 542Q613 559 608 570T598 588T593 596Q593 601 617 610Q632 617 636 616Q675 585 675 527Q675 464 629 409T516 324T387 294Q271 294 271 394V402Q271 438 292 478Q344 582 457 649T672 717Q765 717 825 675T885 548Q885 433 771 298T498 76Q493 73 491 72T486 69T484 67T485 66Q539 41 607 41Q655 41 703 71T780 139L787 148H804Q806 148 809 148Q826 149 826 140Q826 128 786 91T687 19T589 -16H576Q503 -16 414 20L396 27Q279 -17 192 -17Q130 -17 92 2T54 53Q54 92 107 123T222 155Q303 155 401 106L431 91L441 97Q476 118 527 157Q622 236 711 361T801 573Q801 591 795 607T775 641T732 668T660 679Q592 679 528 644T422 560T355 464T330 387ZM201 20Q232 20 267 27T322 40T342 49Q342 52 315 60T243 77T160 86Q150 88 144 88Q130 88 122 79T112 62L111 53Q111 20 201 20'], - - // LATIN CAPITAL LETTER R - 0x52: [717,17,850,-2,887,'224 266Q185 266 156 286T127 354Q127 419 176 487T282 594Q346 642 433 679T615 717Q732 717 802 680L815 673Q824 680 840 690T860 700Q864 700 867 693T872 680L873 673Q873 668 858 659L845 651L853 642Q887 605 887 561Q887 500 840 439Q790 379 681 336Q693 312 693 292Q692 276 689 263T672 229T653 198T620 152L575 87Q557 57 557 33Q557 24 560 17T566 8L569 5Q546 5 508 25T470 76Q470 83 473 92T545 198T616 310Q616 317 615 318T612 319Q603 319 575 315H560L545 291Q492 201 429 135T277 23Q202 -17 142 -17H130Q50 -17 16 17Q-2 35 -2 57Q-2 95 24 126T88 158Q106 158 116 147T127 121Q127 110 122 102Q116 93 99 84T63 75Q58 75 53 76T47 77T45 75T44 67Q45 52 57 42T88 27T120 21T144 19Q174 19 208 36T267 76T324 134T369 189T406 239Q462 319 504 374T616 503T755 631L770 644Q767 647 753 654T697 670T602 680Q493 680 399 631T247 516Q218 485 193 440T168 359Q168 328 188 316T234 303Q255 303 273 315T304 340T343 389T390 448Q428 490 441 510T456 548Q456 557 458 559Q459 560 476 567T496 575Q505 575 505 558Q505 511 434 412Q429 406 427 403Q397 360 378 343Q342 308 300 287T224 266ZM819 564Q819 595 800 619L784 606Q729 557 692 512T605 387L591 365L610 364Q622 364 631 363T641 361Q643 361 651 363Q725 388 772 449T819 564ZM794 141Q794 123 725 63T612 3Q609 3 612 5Q612 5 615 7Q639 19 678 57T742 131L755 148H772H780Q794 148 794 141ZM588 -3Q590 0 593 0H594L593 -1Q592 -1 590 -2L588 -3'], - - // LATIN CAPITAL LETTER S - 0x53: [708,36,868,29,1016,'346 463Q346 419 406 386T576 352H588L613 384L681 476Q767 594 842 651T973 708Q1016 708 1016 661Q1016 621 987 562T894 449Q802 375 696 338L682 334L665 312Q638 279 605 233T547 158T482 97Q418 46 332 5T158 -36Q87 -36 58 -11T29 48Q29 82 55 120T123 158Q144 158 154 146T164 119Q164 102 143 89T100 75Q92 75 86 76T77 80T72 82Q67 82 67 59Q67 28 98 14T166 0Q232 0 320 55T491 226Q530 279 551 305L558 314Q558 315 543 315Q417 321 353 365T289 460Q289 566 488 632Q578 662 660 665H679Q685 660 685 657T676 642Q670 633 666 629L664 628Q663 628 661 628T655 628Q606 628 546 615T426 568T350 486Q346 475 346 463ZM976 653Q976 671 959 671Q938 671 919 661T883 629T858 593T835 554Q832 548 830 545Q802 495 775 455T734 400T721 382L736 388Q876 449 946 568Q948 572 949 573Q976 622 976 653'], - - // LATIN CAPITAL LETTER T - 0x54: [735,37,747,92,996,'354 350Q264 350 264 426Q264 442 265 448Q279 514 347 582T503 692T662 735Q719 735 774 714T882 672T983 651Q996 651 996 644Q996 639 977 612T954 581Q953 580 938 580Q909 582 884 587L869 591L870 587Q870 583 849 557T796 491T748 422Q729 391 692 313T620 188Q555 105 454 34T253 -37Q214 -37 181 -30T120 -2T92 53Q92 89 119 123T184 158Q205 158 215 146T225 119Q225 102 203 89T161 75Q153 75 145 78T135 81Q130 81 130 62Q130 39 153 24T204 5T267 0Q311 0 358 29T454 117T539 226T629 358T710 476Q726 496 744 516T778 551T807 577T828 595L836 601L785 623Q743 642 713 651T668 661T626 663Q564 663 509 644T418 596T356 535T317 475T305 431Q305 416 312 408Q323 388 369 388Q429 388 465 411T530 480Q557 526 557 565Q557 573 556 579T555 587T555 590Q555 591 568 600T584 611Q588 612 600 603Q622 581 622 549Q622 516 600 475T536 405Q454 350 354 350'], - - // LATIN CAPITAL LETTER U - 0x55: [717,17,800,55,960,'55 377Q55 443 122 523T290 660T478 717Q533 717 575 689T618 594Q618 565 611 538T585 477T552 422T506 355T458 288L357 146Q307 68 307 31Q307 20 318 20Q326 20 331 21Q367 27 411 57T490 128L767 500L861 617H908H939Q953 617 956 616T960 609Q960 605 928 566T816 423T648 198Q587 113 571 86Q540 34 540 21Q540 20 545 20Q580 25 623 55T696 124Q702 132 704 133T722 134H739Q744 130 744 127T735 113Q713 80 655 38T548 -14Q527 -17 524 -17Q475 -17 473 47V63L462 55Q364 -17 302 -17Q235 -17 235 69Q235 88 239 105T248 135T268 171T292 205T328 251T369 304Q376 313 395 338T423 374T450 408T476 445T499 479T519 514T534 546T545 579T548 608Q548 647 522 663T460 680Q355 680 243 591T99 406Q97 399 97 383V377Q97 339 153 339Q169 339 175 340Q215 350 241 373T298 444Q333 496 349 535T367 588T374 603Q402 616 408 616Q416 616 416 608Q416 563 393 492T320 378Q233 302 140 302H132Q75 302 57 353Q55 361 55 377'], - - // LATIN CAPITAL LETTER V - 0x56: [717,17,622,56,850,'540 717Q542 717 545 717Q562 717 562 710Q562 708 557 702T541 678T517 632T485 544T448 407Q447 405 443 388T438 366T433 345T427 321T420 299T411 274T400 250T387 223T372 197Q363 181 364 181L388 203Q476 284 527 354T620 490T718 612Q754 647 790 673T835 700Q839 700 842 691T848 672L850 662Q850 657 842 653Q803 630 768 600T699 527T653 467T610 405Q554 322 518 282T368 138Q307 84 273 51T231 9T218 -5L207 -17H175Q169 -11 169 -9Q169 -4 183 10Q227 56 258 120T302 234T330 350T356 445Q357 450 360 458L362 464Q317 434 276 434Q221 437 221 479Q221 498 240 521T259 552Q259 565 235 565Q209 565 174 546T105 482Q103 480 102 478T99 474T97 472T95 470T93 468T90 467T86 467T81 467H75Q56 467 56 475Q56 482 82 511T156 570T253 601Q289 601 311 590T334 557Q334 543 312 517T289 478Q289 471 297 471Q327 471 378 514Q384 519 390 531T412 571T451 632Q482 675 524 717H540'], - - // LATIN CAPITAL LETTER W - 0x57: [717,17,805,46,1026,'232 504Q232 492 263 492Q304 492 356 515L367 520L379 537Q443 632 515 705L527 717H543H552Q564 717 564 709Q564 705 562 703T554 694T540 677T518 643T488 589T448 504T398 385Q368 309 353 281L349 270L523 472L669 634Q726 695 737 706T757 717H765Q786 717 786 710Q786 704 776 691T738 627T675 497Q630 394 609 354T541 244Q456 120 449 111L447 107L448 108Q630 240 700 327Q734 368 788 463Q821 520 841 550T898 619T980 683Q1010 700 1018 700Q1020 700 1023 697T1026 692Q1026 688 1024 671T1020 652Q1018 650 1007 645T988 635Q940 609 902 565T842 477T781 374T699 272Q653 226 535 133Q423 47 373 -2L358 -17H342Q320 -17 320 -11Q320 -7 328 5T354 46T390 112Q416 161 439 217T488 326T564 453L589 490Q587 490 523 414T352 217T166 14Q138 -16 137 -16Q136 -17 120 -17Q106 -17 103 -16T99 -9Q99 -5 100 -3T106 3T116 14T132 35T154 72T184 129T222 212T270 327Q310 426 337 471L326 467Q278 455 243 455Q209 455 188 462T161 478T155 496Q155 508 176 533T198 576Q198 579 198 581T192 588T178 593Q151 593 100 519Q89 504 86 502T75 499H68Q46 499 46 506Q46 510 63 534T112 587T170 627Q178 629 195 629Q235 629 252 613T270 577Q270 556 251 532T232 504'], - - // LATIN CAPITAL LETTER X - 0x58: [717,17,944,103,1131,'351 351Q308 351 290 373T272 426Q272 487 329 566T478 688Q538 717 584 717Q635 717 681 696T745 620Q752 598 752 564T745 498L741 485Q742 486 769 516T825 573T889 634T962 689T1027 716Q1035 717 1060 717Q1083 716 1096 714T1120 705T1131 686Q1131 668 1109 647T1055 626Q1035 626 1026 638T1016 663Q1016 667 1020 679H1015Q971 671 886 589T728 413L688 360Q688 359 725 359H750Q762 359 766 357T770 348Q769 345 761 335T750 322Q748 321 704 321H660Q651 311 632 282T589 199T565 107Q565 25 653 20Q684 20 720 44T779 95T826 152T850 183L856 184Q861 184 865 184Q888 184 888 173Q883 163 845 117Q770 37 723 10T638 -17Q584 -14 554 17T523 101Q523 147 534 167L532 166Q530 164 526 160T518 153Q378 15 256 -15Q250 -16 226 -16Q161 -16 132 7T103 59Q103 93 129 125T194 158Q232 158 232 121Q233 118 233 113T221 96T188 77Q182 75 168 75T150 78V70Q150 43 178 32T241 20Q340 20 527 286L552 321H524Q489 321 489 330Q489 333 497 344T509 358Q511 359 545 359H579Q580 362 597 389T631 445T661 514T675 586Q675 637 645 658T572 680Q506 680 444 632T348 527T314 434Q314 388 361 388H364H366Q380 388 389 390T416 408T457 454Q487 497 505 536T526 594L529 613Q531 615 545 622T560 630Q568 630 573 613T578 577Q578 518 532 455Q504 413 453 382T351 351'], - - // LATIN CAPITAL LETTER Y - 0x59: [716,17,710,57,959,'155 280Q116 280 87 300T57 368Q57 409 87 466T192 589Q269 653 345 684T472 716Q572 716 613 675Q644 644 644 599Q644 585 643 574T637 550T629 529T616 505T600 481T578 450T554 416Q494 330 493 328L480 306Q466 278 466 256Q466 227 492 227H496Q514 227 534 234Q541 237 544 241T571 279L762 559Q777 579 792 595Q818 620 856 646T919 686T946 700Q951 700 955 692T959 677Q959 673 947 665T911 639T866 595Q816 538 749 408T640 225Q574 138 464 61T248 -17Q190 -17 144 1T98 62Q98 81 109 102T131 135Q156 156 183 158Q226 158 226 121Q226 111 224 107Q215 93 196 84T162 74Q154 74 147 77H144V70Q146 41 185 31T263 20Q363 20 493 175L507 192H504Q500 191 498 191Q484 189 476 189Q430 189 405 219T379 287Q379 294 379 299T382 311T385 322T391 335T398 347T408 363T420 379T434 399T450 422Q455 429 469 449T488 475T504 499T520 523T533 543T544 565T552 583T557 603T559 620Q559 680 467 680Q402 680 333 646T213 563T131 462T98 373Q98 343 119 330T169 317Q187 317 212 333Q242 354 291 423T352 555Q354 562 355 588Q355 612 356 612Q357 614 371 622T387 630Q391 630 397 623T409 597T415 556Q415 507 380 448T294 344Q216 280 155 280'], - - // LATIN CAPITAL LETTER Z - 0x5A: [717,16,821,82,1032,'221 428Q221 487 280 555T425 670T583 717H587Q641 717 665 695T689 646Q689 625 674 600T658 564Q658 550 671 541T695 530T710 528L718 539Q779 613 821 646Q894 707 964 707H970Q1010 707 1025 675Q1032 661 1032 645Q1032 626 1022 607Q1008 579 980 560T897 522Q867 512 836 505T788 496L771 493Q768 493 760 477T736 429T702 370Q700 367 698 363Q696 360 696 359H805Q809 355 809 350Q809 340 791 322Q789 321 728 321H668Q562 179 433 88L419 78L434 73Q505 54 554 54Q609 54 654 82T720 140H752Q758 134 758 132Q758 128 747 113Q711 67 657 32T552 -14Q540 -16 517 -16T480 -15T439 -3T375 27L354 38L338 30Q257 -8 191 -8H184Q154 -8 133 -5T103 1T88 10T83 19T83 29Q83 35 86 44T100 65T127 88T173 105T241 112Q286 112 342 99L360 95L372 105Q434 157 523 270L560 320Q560 321 533 321L507 322Q502 325 502 330Q502 339 521 358Q523 359 556 359H588L669 474L682 491Q676 492 665 494T647 498T632 503T614 510T596 521Q556 547 556 570Q556 585 579 618T603 663Q603 679 568 679Q510 679 452 650T354 581T288 500T262 431Q262 407 280 397T321 387Q331 387 341 390T360 398T376 409T390 423T400 435T409 447L414 454Q457 514 460 562Q460 575 461 576Q461 577 475 586T492 595Q496 595 503 588T514 572Q520 559 520 539Q520 473 452 412T308 351Q269 351 245 370T221 428ZM989 642Q989 667 953 671Q905 671 871 644Q853 632 832 604T799 554T787 531H788Q801 531 842 539T916 561Q989 592 989 642ZM198 29Q230 29 257 36T295 52L306 59Q306 63 259 73Q251 74 209 74Q177 74 158 66T134 48L130 40Q130 29 198 29'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Script/Regular/BasicLatin.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Script/Regular/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Script/Regular/Main.js deleted file mode 100644 index 5715031cbb..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Script/Regular/Main.js +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Script/Regular/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Script'] = { - directory: 'Script/Regular', - family: 'MathJax_Script', - id: 'MJSCR', - skew: { - 0x41: 0.389, - 0x42: 0.194, - 0x43: 0.278, - 0x44: 0.111, - 0x45: 0.139, - 0x46: 0.222, - 0x47: 0.25, - 0x48: 0.333, - 0x49: 0.333, - 0x4A: 0.417, - 0x4B: 0.361, - 0x4C: 0.306, - 0x4D: 0.444, - 0x4E: 0.389, - 0x4F: 0.167, - 0x50: 0.222, - 0x51: 0.278, - 0x52: 0.194, - 0x53: 0.333, - 0x54: 0.222, - 0x55: 0.25, - 0x56: 0.222, - 0x57: 0.25, - 0x58: 0.278, - 0x59: 0.194, - 0x5A: 0.306 - }, - Ranges: [ - [0x0,0x7F,"BasicLatin"] - ] - - -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Script/Regular/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Size1/Regular/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Size1/Regular/Main.js deleted file mode 100644 index f600ca650d..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Size1/Regular/Main.js +++ /dev/null @@ -1,159 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Size1/Regular/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Size1'] = { - directory: 'Size1/Regular', - family: 'MathJax_Size1', - id: 'MJSZ1', - - // SPACE - 0x20: [0,0,250,0,0,''], - - // LEFT PARENTHESIS - 0x28: [850,349,458,152,422,'152 251Q152 646 388 850H416Q422 844 422 841Q422 837 403 816T357 753T302 649T255 482T236 250Q236 124 255 19T301 -147T356 -251T403 -315T422 -340Q422 -343 416 -349H388Q359 -325 332 -296T271 -213T212 -97T170 56T152 251'], - - // RIGHT PARENTHESIS - 0x29: [850,349,458,35,305,'305 251Q305 -145 69 -349H56Q43 -349 39 -347T35 -338Q37 -333 60 -307T108 -239T160 -136T204 27T221 250T204 473T160 636T108 740T60 807T35 839Q35 850 50 850H56H69Q197 743 256 566Q305 425 305 251'], - - // SOLIDUS - 0x2F: [850,349,578,55,522,'481 838Q489 850 500 850Q508 850 515 844T522 827Q521 824 311 248T96 -337Q90 -349 77 -349Q68 -349 62 -343T55 -326Q56 -323 266 253T481 838'], - - // LEFT SQUARE BRACKET - 0x5B: [850,349,417,202,394,'202 -349V850H394V810H242V-309H394V-349H202'], - - // REVERSE SOLIDUS - 0x5C: [850,349,578,54,522,'522 -326Q522 -337 515 -343T500 -349Q487 -349 481 -337Q477 -328 267 248T55 827Q54 835 60 842T76 850Q89 850 96 838Q100 829 310 253T522 -326'], - - // RIGHT SQUARE BRACKET - 0x5D: [850,349,417,22,214,'22 810V850H214V-349H22V-309H174V810H22'], - - // LEFT CURLY BRACKET - 0x7B: [851,349,583,105,477,'477 -343L471 -349H458Q432 -349 367 -325T273 -263Q258 -245 250 -212L249 -51Q249 -27 249 12Q248 118 244 128Q243 129 243 130Q220 189 121 228Q109 232 107 235T105 250Q105 256 105 257T105 261T107 265T111 268T118 272T128 276T142 283T162 291Q224 324 243 371Q243 372 244 373Q248 384 249 469Q249 475 249 489Q249 528 249 552L250 714Q253 728 256 736T271 761T299 789T347 816T422 843Q440 849 441 849H443Q445 849 447 849T452 850T457 850H471L477 844V830Q477 820 476 817T470 811T459 807T437 801T404 785Q353 760 338 724Q333 710 333 550Q333 526 333 492T334 447Q334 393 327 368T295 318Q257 280 181 255L169 251L184 245Q318 198 332 112Q333 106 333 -49Q333 -209 338 -223Q351 -255 391 -277T469 -309Q477 -311 477 -329V-343'], - - // RIGHT CURLY BRACKET - 0x7D: [850,349,583,105,477,'110 849L115 850Q120 850 125 850Q151 850 215 826T309 764Q324 747 332 714L333 552Q333 528 333 489Q334 383 338 373Q339 372 339 371Q353 336 391 310T469 271Q477 268 477 251Q477 241 476 237T472 232T456 225T428 214Q357 179 339 130Q339 129 338 128Q334 117 333 32Q333 26 333 12Q333 -27 333 -51L332 -212Q328 -228 323 -240T302 -271T255 -307T175 -338Q139 -349 125 -349T108 -346T105 -329Q105 -314 107 -312T130 -304Q233 -271 248 -209Q249 -203 249 -49V57Q249 106 253 125T273 167Q307 213 398 245L413 251L401 255Q265 300 250 389Q249 395 249 550Q249 710 244 724Q224 774 112 811Q105 813 105 830Q105 845 110 849'], - - // MODIFIER LETTER CIRCUMFLEX ACCENT - 0x2C6: [744,-551,556,-8,564,'279 669Q273 669 142 610T9 551L0 569Q-8 585 -8 587Q-8 588 -7 588L12 598Q30 608 66 628T136 666L277 744L564 587L555 569Q549 556 547 554T544 552Q539 555 410 612T279 669'], - - // SMALL TILDE - 0x2DC: [722,-597,556,1,554,'374 597Q337 597 269 627T160 658Q101 658 34 606L24 597L12 611Q1 624 1 626Q1 627 27 648T55 671Q120 722 182 722Q219 722 286 692T395 661Q454 661 521 713L531 722L543 708Q554 695 554 693Q554 692 528 671T500 648Q434 597 374 597'], - - // COMBINING CIRCUMFLEX ACCENT - 0x302: [744,-551,0,-564,8,'-277 669Q-283 669 -414 610T-547 551L-556 569Q-564 585 -564 587Q-564 588 -563 588L-544 598Q-526 608 -490 628T-420 666L-279 744L8 587L-1 569Q-7 556 -9 554T-12 552Q-17 555 -146 612T-277 669'], - - // COMBINING TILDE - 0x303: [722,-597,0,-555,-2,'-182 597Q-219 597 -287 627T-396 658Q-455 658 -522 606L-532 597L-544 611Q-555 624 -555 626Q-555 627 -529 648T-501 671Q-436 722 -374 722Q-337 722 -270 692T-161 661Q-102 661 -35 713L-25 722L-13 708Q-2 695 -2 693Q-2 692 -28 671T-56 648Q-122 597 -182 597'], - - // DOUBLE VERTICAL LINE - 0x2016: [602,0,778,257,521,'257 0V602H300V0H257ZM478 0V602H521V0H478'], - - // UPWARDS ARROW - 0x2191: [600,0,667,112,555,'112 421L120 424Q127 427 136 430T161 441T191 458T224 481T260 510T295 546T328 591L333 600L340 589Q380 527 431 489T555 421V377L543 381Q445 418 368 492L355 504V0H312V504L299 492Q222 418 124 381L112 377V421'], - - // DOWNWARDS ARROW - 0x2193: [600,0,667,112,555,'312 96V600H355V96L368 108Q445 182 543 219L555 223V179L546 176Q538 173 529 169T505 158T475 141T442 119T407 90T372 53T339 9L334 0L327 11Q287 73 236 111T112 179V223L124 219Q222 182 299 108L312 96'], - - // UPWARDS DOUBLE ARROW - 0x21D1: [599,0,778,57,721,'142 329Q300 419 389 599Q389 598 399 579T420 541T452 494T497 438T558 383T636 329T708 294L721 289V246Q718 246 694 256T623 293T532 356L522 364L521 182V0H478V405L466 417Q436 450 389 516Q388 515 378 500T352 463T312 417L300 405V0H257V364L247 356Q202 320 155 293T82 256L57 246V289L70 294Q101 305 142 329'], - - // DOWNWARDS DOUBLE ARROW - 0x21D3: [600,-1,778,57,721,'257 236V600H300V195L312 183Q342 150 389 84Q390 85 400 100T426 137T466 183L478 195V600H521V418L522 236L532 244Q576 280 623 307T696 344L721 354V311L708 306Q677 295 636 271Q478 181 389 1Q389 2 379 21T358 59T326 106T281 162T220 217T142 271T70 306L57 311V354Q60 354 83 345T154 308T247 244L257 236'], - - // N-ARY PRODUCT - 0x220F: [750,250,944,55,888,'158 656Q147 684 131 694Q110 707 69 710H55V750H888V710H874Q840 708 820 698T795 678T786 656V-155Q798 -206 874 -210H888V-250H570V-210H584Q618 -208 638 -197T663 -178T673 -155V710H270V277L271 -155Q283 -206 359 -210H373V-250H55V-210H69Q103 -208 123 -197T148 -178T158 -155V656'], - - // N-ARY COPRODUCT - 0x2210: [750,250,944,55,888,'158 656Q147 684 131 694Q110 707 69 710H55V750H373V710H359Q325 708 305 698T280 678T271 656L270 223V-210H673V656Q666 672 663 679T639 697T584 710H570V750H888V710H874Q840 708 820 698T795 678T786 656V-155Q798 -206 874 -210H888V-250H55V-210H69Q103 -208 123 -197T148 -178T158 -155V656'], - - // N-ARY SUMMATION - 0x2211: [750,250,1056,56,999,'61 748Q64 750 489 750H913L954 640Q965 609 976 579T993 533T999 516H979L959 517Q936 579 886 621T777 682Q724 700 655 705T436 710H319Q183 710 183 709Q186 706 348 484T511 259Q517 250 513 244L490 216Q466 188 420 134T330 27L149 -187Q149 -188 362 -188Q388 -188 436 -188T506 -189Q679 -189 778 -162T936 -43Q946 -27 959 6H999L913 -249L489 -250Q65 -250 62 -248Q56 -246 56 -239Q56 -234 118 -161Q186 -81 245 -11L428 206Q428 207 242 462L57 717L56 728Q56 744 61 748'], - - // SQUARE ROOT - 0x221A: [850,350,1000,111,1020,'263 249Q264 249 315 130T417 -108T470 -228L725 302Q981 837 982 839Q989 850 1001 850Q1008 850 1013 844T1020 832V826L741 243Q645 43 540 -176Q479 -303 469 -324T453 -348Q449 -350 436 -350L424 -349L315 -96Q206 156 205 156L171 130Q138 104 137 104L111 130L263 249'], - - // DIVIDES - 0x2223: [627,15,333,144,188,'146 612Q151 627 166 627Q182 627 187 612Q188 610 188 306T187 0Q184 -15 166 -15Q149 -15 146 0V10Q146 19 146 35T146 73T146 122T145 179T145 241T145 306T145 370T145 433T145 489T146 538T146 576T146 602V612'], - - // PARALLEL TO - 0x2225: [627,15,556,144,410,'146 612Q151 627 166 627Q182 627 187 612Q188 610 188 306T187 0Q184 -15 166 -15Q149 -15 146 0V10Q146 19 146 35T146 73T146 122T145 179T145 241T145 306T145 370T145 433T145 489T146 538T146 576T146 602V612ZM368 612Q373 627 388 627Q404 627 409 612Q410 610 410 306T409 0Q406 -15 389 -15Q371 -15 368 0V10Q368 19 368 35T368 73T368 122T367 179T367 241T367 306T367 370T367 433T367 489T368 538T368 576T368 602V612'], - - // INTEGRAL - 0x222B: [805,306,472,55,610,'113 -244Q113 -246 119 -251T139 -263T167 -269Q186 -269 199 -260Q220 -247 232 -218T251 -133T262 -15T276 155T297 367Q300 390 305 438T314 512T325 580T340 647T361 703T390 751T428 784T479 804Q481 804 488 804T501 805Q552 802 581 769T610 695Q610 669 594 657T561 645Q542 645 527 658T512 694Q512 705 516 714T526 729T538 737T548 742L552 743Q552 745 545 751T525 762T498 768Q475 768 460 756T434 716T418 652T407 559T398 444T387 300T369 133Q349 -38 337 -102T303 -207Q256 -306 169 -306Q119 -306 87 -272T55 -196Q55 -170 71 -158T104 -146Q123 -146 138 -159T153 -195Q153 -206 149 -215T139 -230T127 -238T117 -242L113 -244'], - - // DOUBLE INTEGRAL - 0x222C: [805,306,819,55,957,'113 -244Q113 -246 119 -251T139 -263T167 -269Q186 -269 199 -260Q220 -247 232 -218T251 -133T262 -15T276 155T297 367Q300 390 305 438T314 512T325 580T340 647T361 703T390 751T428 784T479 804Q481 804 488 804T501 805Q552 802 581 769T610 695Q610 669 594 657T561 645Q542 645 527 658T512 694Q512 705 516 714T526 729T538 737T548 742L552 743Q552 745 545 751T525 762T498 768Q475 768 460 756T434 716T418 652T407 559T398 444T387 300T369 133Q349 -38 337 -102T303 -207Q256 -306 169 -306Q119 -306 87 -272T55 -196Q55 -170 71 -158T104 -146Q123 -146 138 -159T153 -195Q153 -206 149 -215T139 -230T127 -238T117 -242L113 -244ZM460 -244Q460 -246 466 -251T486 -263T514 -269Q532 -269 546 -260Q567 -247 579 -218T598 -133T609 -15T623 155T644 367Q647 390 652 438T661 512T672 580T687 647T708 703T737 751T775 784T826 804Q828 804 835 804T848 805Q899 802 928 769T957 695Q957 669 941 657T908 645Q889 645 874 658T859 694Q859 705 863 714T873 729T885 737T895 742L899 743Q899 745 892 751T872 762T845 768Q822 768 807 756T781 716T765 652T754 559T745 444T734 300T716 133Q696 -38 684 -102T650 -207Q603 -306 516 -306Q466 -306 434 -272T402 -196Q402 -170 418 -158T451 -146Q470 -146 485 -159T500 -195Q500 -206 496 -215T486 -230T474 -238T464 -242L460 -244'], - - // TRIPLE INTEGRAL - 0x222D: [805,306,1166,55,1304,'113 -244Q113 -246 119 -251T139 -263T167 -269Q186 -269 199 -260Q220 -247 232 -218T251 -133T262 -15T276 155T297 367Q300 390 305 438T314 512T325 580T340 647T361 703T390 751T428 784T479 804Q481 804 488 804T501 805Q552 802 581 769T610 695Q610 669 594 657T561 645Q542 645 527 658T512 694Q512 705 516 714T526 729T538 737T548 742L552 743Q552 745 545 751T525 762T498 768Q475 768 460 756T434 716T418 652T407 559T398 444T387 300T369 133Q349 -38 337 -102T303 -207Q256 -306 169 -306Q119 -306 87 -272T55 -196Q55 -170 71 -158T104 -146Q123 -146 138 -159T153 -195Q153 -206 149 -215T139 -230T127 -238T117 -242L113 -244ZM460 -244Q460 -246 466 -251T486 -263T514 -269Q532 -269 546 -260Q567 -247 579 -218T598 -133T609 -15T623 155T644 367Q647 390 652 438T661 512T672 580T687 647T708 703T737 751T775 784T826 804Q828 804 835 804T848 805Q899 802 928 769T957 695Q957 669 941 657T908 645Q889 645 874 658T859 694Q859 705 863 714T873 729T885 737T895 742L899 743Q899 745 892 751T872 762T845 768Q822 768 807 756T781 716T765 652T754 559T745 444T734 300T716 133Q696 -38 684 -102T650 -207Q603 -306 516 -306Q466 -306 434 -272T402 -196Q402 -170 418 -158T451 -146Q470 -146 485 -159T500 -195Q500 -206 496 -215T486 -230T474 -238T464 -242L460 -244ZM807 -244Q807 -246 813 -251T833 -263T861 -269Q880 -269 893 -260Q914 -247 926 -218T945 -133T956 -15T970 155T991 367Q994 390 999 438T1008 512T1019 580T1034 647T1055 703T1084 751T1122 784T1173 804Q1175 804 1182 804T1195 805Q1246 802 1275 769T1304 695Q1304 669 1288 657T1255 645Q1236 645 1221 658T1206 694Q1206 705 1210 714T1220 729T1232 737T1242 742L1246 743Q1246 745 1239 751T1219 762T1192 768Q1169 768 1154 756T1128 716T1112 652T1101 559T1092 444T1081 300T1063 133Q1043 -38 1031 -102T997 -207Q950 -306 863 -306Q813 -306 781 -272T749 -196Q749 -170 765 -158T798 -146Q817 -146 832 -159T847 -195Q847 -206 843 -215T833 -230T821 -238T811 -242L807 -244'], - - // CONTOUR INTEGRAL - 0x222E: [805,306,472,55,610,'269 74L256 80Q244 85 227 97T191 128T161 179T148 250Q148 332 199 379T302 433L306 434L307 444Q309 456 313 495T321 553T331 607T345 664T365 712T393 756T431 785T479 804Q481 804 488 804T501 805Q552 802 581 769T610 695Q610 669 594 657T561 645Q542 645 527 658T512 694Q512 705 516 714T526 729T538 737T548 742L552 743Q552 745 545 751T525 762T498 768Q471 768 454 752T427 693T414 626T406 536Q405 530 405 527L397 425L404 422Q410 419 421 413T445 399T470 376T494 345T511 303T518 250Q518 205 502 169T460 112T410 80T364 66L360 65L359 55Q357 38 353 4T346 -43T340 -81T333 -118T326 -148T316 -179T303 -207Q256 -306 169 -306Q119 -306 87 -272T55 -196Q55 -170 71 -158T104 -146Q123 -146 138 -159T153 -195Q153 -206 149 -215T139 -230T127 -238T117 -242L113 -244Q113 -246 119 -251T139 -263T167 -269Q186 -269 199 -260Q231 -241 242 -183T266 33L269 74ZM272 122Q272 156 300 391Q300 392 299 392Q287 392 263 379T213 331T187 249Q187 211 205 180T239 137T272 116V122ZM366 107Q378 107 402 119T453 167T479 249Q479 340 394 383V377Q394 375 394 374T393 371T393 366T392 357T391 342T389 321T386 291T382 251T377 199T369 133Q366 112 366 107'], - - // N-ARY LOGICAL AND - 0x22C0: [750,249,833,55,777,'119 -249T97 -249T65 -235T55 -207Q55 -201 56 -198Q58 -190 218 268T380 729Q392 750 416 750Q438 750 451 732Q453 728 534 498T695 36L775 -194Q777 -204 777 -208Q777 -222 767 -235T735 -249Q713 -249 700 -231Q696 -225 557 177L416 579L276 177Q136 -226 132 -231Q119 -249 97 -249'], - - // N-ARY LOGICAL OR - 0x22C1: [750,249,833,55,777,'55 708Q55 729 68 739T96 750Q119 750 132 731Q136 726 276 323L416 -79L557 323Q696 725 700 731Q713 749 735 749Q756 749 766 736T777 708Q777 700 696 466T533 1T451 -232Q436 -249 416 -249Q402 -249 391 -241Q384 -236 380 -226Q368 -198 219 230Q55 697 55 708'], - - // N-ARY INTERSECTION - 0x22C2: [750,249,833,54,777,'139 -217Q127 -241 114 -246Q106 -249 97 -249Q67 -249 57 -220Q55 -214 55 102Q55 152 55 221T54 312Q54 422 60 464T91 554Q120 612 165 654T257 714T337 741T392 749Q393 750 402 750Q414 750 422 749Q557 749 660 659T776 430Q777 422 777 102Q777 -214 775 -220Q765 -249 735 -249Q716 -249 708 -241T694 -217L692 428L690 441Q674 540 597 603T416 666H409Q388 666 364 662T294 638T212 581Q156 523 142 441L140 428L139 105V-217'], - - // N-ARY UNION - 0x22C3: [750,249,833,55,777,'96 750Q103 750 109 748T120 744T127 737T133 730T137 723T139 718V395L140 73L142 60Q159 -43 237 -104T416 -166Q521 -166 597 -103T690 60L692 73L694 718Q708 749 735 749Q765 749 775 720Q777 714 777 398Q777 78 776 71Q766 -51 680 -140Q571 -249 416 -249H411Q261 -249 152 -140Q66 -51 56 71Q55 78 55 398Q55 714 57 720Q60 734 70 740Q80 750 96 750'], - - // LEFT CEILING - 0x2308: [850,349,472,202,449,'202 -349V850H449V810H242V-349H202'], - - // RIGHT CEILING - 0x2309: [850,349,472,22,269,'22 810V850H269V-349H229V810H22'], - - // LEFT FLOOR - 0x230A: [850,349,472,202,449,'202 -349V850H242V-309H449V-349H202'], - - // RIGHT FLOOR - 0x230B: [850,349,472,22,269,'229 -309V850H269V-349H22V-309H229'], - - // VERTICAL LINE EXTENSION (used to extend arrows) - 0x23D0: [602,0,667,312,355,'312 0V602H355V0H312'], - - // MATHEMATICAL LEFT ANGLE BRACKET - 0x27E8: [850,350,472,96,394,'373 850Q392 850 394 832Q394 825 267 538L139 250L267 -38Q394 -325 394 -332Q392 -350 375 -350Q361 -350 356 -338Q354 -331 289 -186T161 103T97 250T160 397T289 685T356 838Q362 850 373 850'], - - // MATHEMATICAL RIGHT ANGLE BRACKET - 0x27E9: [850,350,472,77,375,'77 832Q77 837 82 843T98 850Q110 849 115 838Q117 831 182 686T310 397T374 250T311 103T182 -185T115 -338Q110 -350 96 -350Q79 -350 77 -332Q77 -325 204 -38L332 250L204 538Q77 825 77 832'], - - // N-ARY CIRCLED DOT OPERATOR - 0x2A00: [750,250,1111,56,1054,'555 -250Q420 -250 306 -185T124 -4T56 250Q56 453 193 595T526 749Q528 750 539 750Q554 750 562 749Q688 749 800 687T983 508T1054 250Q1054 112 987 -3T806 -184T555 -250ZM555 -165Q672 -165 767 -108T916 44T970 250Q970 418 861 532T600 664Q591 665 548 665Q446 665 353 614T200 466T140 250V243Q140 88 248 -30Q262 -46 280 -62T338 -105T434 -148T555 -165ZM478 250Q478 288 503 307T551 326Q586 326 609 305T632 250Q632 217 610 196T555 174T500 196T478 250'], - - // N-ARY CIRCLED PLUS OPERATOR - 0x2A01: [750,250,1111,56,1054,'555 -250Q420 -250 306 -185T124 -4T56 250Q56 453 193 595T526 749Q528 750 539 750Q554 750 562 749Q688 749 800 687T983 508T1054 250Q1054 112 987 -3T806 -184T555 -250ZM513 478Q513 664 512 664Q504 664 481 660T406 637T313 588Q281 564 255 537T211 483T181 431T161 382T150 342T144 310T141 292H513V478ZM798 588Q758 616 711 634T639 658T602 663L597 664V292H969Q969 293 967 309T960 341T949 381T930 430T900 482T856 537T798 588ZM513 -164V208H141Q142 205 144 189T149 160T158 125T173 83T196 39T229 -9Q249 -34 273 -55T318 -92T363 -119T405 -138T444 -150T475 -158T499 -162T513 -164ZM775 -103Q801 -87 823 -68T863 -30T894 10T919 49T937 88T950 123T959 154T964 180T968 198L969 208H597V-164Q599 -163 616 -161T647 -155T683 -145T728 -128T775 -103'], - - // N-ARY CIRCLED TIMES OPERATOR - 0x2A02: [750,250,1111,56,1054,'555 -250Q420 -250 306 -185T124 -4T56 250Q56 453 193 595T526 749Q528 750 539 750Q554 750 562 749Q688 749 800 687T983 508T1054 250Q1054 112 987 -3T806 -184T555 -250ZM600 664Q591 665 548 665Q414 665 306 583L292 573L423 441L555 310L687 441L818 573L804 583Q714 650 600 664ZM364 118L495 250L364 382L232 513L223 500Q140 391 140 250Q140 107 223 0L232 -13L364 118ZM970 250Q970 389 887 501L878 512Q878 513 861 496T812 447T746 381L615 250L746 118L878 -13L887 0Q970 109 970 250ZM687 59L555 190L423 59L292 -73L306 -83Q416 -166 555 -166T804 -83L818 -73L687 59'], - - // N-ARY UNION OPERATOR WITH PLUS - 0x2A04: [750,249,833,55,777,'96 750Q103 750 109 748T120 744T127 737T133 730T137 723T139 718V395L140 73L142 60Q159 -43 237 -104T416 -166Q521 -166 597 -103T690 60L692 73L694 718Q708 749 735 749Q765 749 775 720Q777 714 777 398Q777 78 776 71Q766 -51 680 -140Q571 -249 416 -249H411Q261 -249 152 -140Q66 -51 56 71Q55 78 55 398Q55 714 57 720Q60 734 70 740Q80 750 96 750ZM223 276Q223 282 224 287T227 296T232 302T238 308T243 313T250 316L254 319H374V376V406Q374 438 382 454T418 470Q443 467 450 453T458 410V376V319H579Q580 319 583 317T589 313T594 308T600 302T604 295T608 287T609 276Q609 253 587 241Q577 235 513 235H458V178Q458 176 458 166T459 148Q459 84 415 84Q401 84 390 93T375 117Q374 120 374 178V235H319Q317 235 307 235T290 234Q223 234 223 276'], - - // N-ARY SQUARE UNION OPERATOR - 0x2A06: [750,249,833,55,777,'777 -217Q766 -244 745 -249H88Q64 -242 57 -220Q55 -214 55 250T57 720Q60 734 70 740Q80 750 96 750Q127 750 137 720Q139 714 139 274V-166H693V274Q693 714 695 720Q705 749 735 749Q766 749 775 719Q777 713 777 248V-217'] -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Size1/Regular/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Size2/Regular/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Size2/Regular/Main.js deleted file mode 100644 index 676541927d..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Size2/Regular/Main.js +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Size2/Regular/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Size2'] = { - directory: 'Size2/Regular', - family: 'MathJax_Size2', - id: 'MJSZ2', - - // SPACE - 0x20: [0,0,250,0,0,''], - - // LEFT PARENTHESIS - 0x28: [1150,649,597,180,561,'180 96T180 250T205 541T266 770T353 944T444 1069T527 1150H555Q561 1144 561 1141Q561 1137 545 1120T504 1072T447 995T386 878T330 721T288 513T272 251Q272 133 280 56Q293 -87 326 -209T399 -405T475 -531T536 -609T561 -640Q561 -643 555 -649H527Q483 -612 443 -568T353 -443T266 -270T205 -41'], - - // RIGHT PARENTHESIS - 0x29: [1150,649,597,35,417,'35 1138Q35 1150 51 1150H56H69Q113 1113 153 1069T243 944T330 771T391 541T416 250T391 -40T330 -270T243 -443T152 -568T69 -649H56Q43 -649 39 -647T35 -637Q65 -607 110 -548Q283 -316 316 56Q324 133 324 251Q324 368 316 445Q278 877 48 1123Q36 1137 35 1138'], - - // SOLIDUS - 0x2F: [1150,649,811,56,754,'78 -649Q56 -646 56 -625Q56 -614 382 261T712 1140Q716 1150 732 1150Q754 1147 754 1126Q754 1116 428 240T98 -639Q94 -649 78 -649'], - - // LEFT SQUARE BRACKET - 0x5B: [1150,649,472,224,455,'224 -649V1150H455V1099H275V-598H455V-649H224'], - - // REVERSE SOLIDUS - 0x5C: [1150,649,811,54,754,'754 -625Q754 -649 731 -649Q715 -649 712 -639Q709 -635 383 242T55 1124Q54 1135 61 1142T80 1150Q92 1150 98 1140Q101 1137 427 262T754 -625'], - - // RIGHT SQUARE BRACKET - 0x5D: [1150,649,472,16,247,'16 1099V1150H247V-649H16V-598H196V1099H16'], - - // LEFT CURLY BRACKET - 0x7B: [1150,649,667,119,547,'547 -643L541 -649H528Q515 -649 503 -645Q324 -582 293 -466Q289 -449 289 -428T287 -200L286 42L284 53Q274 98 248 135T196 190T146 222L121 235Q119 239 119 250Q119 262 121 266T133 273Q262 336 284 449L286 460L287 701Q287 737 287 794Q288 949 292 963Q293 966 293 967Q325 1080 508 1148Q516 1150 527 1150H541L547 1144V1130Q547 1117 546 1115T536 1109Q480 1086 437 1046T381 950L379 940L378 699Q378 657 378 594Q377 452 374 438Q373 437 373 436Q350 348 243 282Q192 257 186 254L176 251L188 245Q211 236 234 223T287 189T340 135T373 65Q373 64 374 63Q377 49 378 -93Q378 -156 378 -198L379 -438L381 -449Q393 -504 436 -544T536 -608Q544 -611 545 -613T547 -629V-643'], - - // RIGHT CURLY BRACKET - 0x7D: [1150,649,667,119,547,'119 1130Q119 1144 121 1147T135 1150H139Q151 1150 182 1138T252 1105T326 1046T373 964Q378 942 378 702Q378 469 379 462Q386 394 439 339Q482 296 535 272Q544 268 545 266T547 251Q547 241 547 238T542 231T531 227T510 217T477 194Q390 129 379 39Q378 32 378 -201Q378 -441 373 -463Q342 -580 165 -644Q152 -649 139 -649Q125 -649 122 -646T119 -629Q119 -622 119 -619T121 -614T124 -610T132 -607T143 -602Q195 -579 235 -539T285 -447Q286 -435 287 -199T289 51Q294 74 300 91T329 138T390 197Q412 213 436 226T475 244L489 250L472 258Q455 265 430 279T377 313T327 366T293 434Q289 451 289 472T287 699Q286 941 285 948Q279 978 262 1005T227 1048T184 1080T151 1100T129 1109L127 1110Q119 1113 119 1130'], - - // MODIFIER LETTER CIRCUMFLEX ACCENT - 0x2C6: [772,-565,1000,-5,1004,'1004 603Q1004 600 999 583T991 565L960 574Q929 582 866 599T745 631L500 698Q497 698 254 631Q197 616 134 599T39 574L8 565Q5 565 0 582T-5 603L26 614Q58 624 124 646T248 687L499 772Q999 604 1004 603'], - - // SMALL TILDE - 0x2DC: [750,-611,1000,0,999,'296 691Q258 691 216 683T140 663T79 639T34 619T16 611Q13 619 8 628L0 644L36 662Q206 749 321 749Q410 749 517 710T703 670Q741 670 783 678T859 698T920 722T965 742T983 750Q986 742 991 733L999 717L963 699Q787 611 664 611Q594 611 484 651T296 691'], - - // COMBINING CIRCUMFLEX ACCENT - 0x302: [772,-565,0,-1005,4,'4 603Q4 600 -1 583T-9 565L-40 574Q-71 582 -134 599T-255 631L-500 698Q-503 698 -746 631Q-803 616 -866 599T-961 574L-992 565Q-995 565 -1000 582T-1005 603L-974 614Q-942 624 -876 646T-752 687L-501 772Q-1 604 4 603'], - - // COMBINING TILDE - 0x303: [750,-611,0,-1000,-1,'-704 691Q-742 691 -784 683T-860 663T-921 639T-966 619T-984 611Q-987 619 -992 628L-1000 644L-964 662Q-794 749 -679 749Q-590 749 -483 710T-297 670Q-259 670 -217 678T-141 698T-80 722T-35 742T-17 750Q-14 742 -9 733L-1 717L-37 699Q-213 611 -336 611Q-405 611 -515 651T-704 691'], - - // N-ARY PRODUCT - 0x220F: [950,450,1278,56,1221,'220 812Q220 813 218 819T214 829T208 840T199 853T185 866T166 878T140 887T107 893T66 896H56V950H1221V896H1211Q1080 896 1058 812V-311Q1076 -396 1211 -396H1221V-450H725V-396H735Q864 -396 888 -314Q889 -312 889 -311V896H388V292L389 -311Q405 -396 542 -396H552V-450H56V-396H66Q195 -396 219 -314Q220 -312 220 -311V812'], - - // N-ARY COPRODUCT - 0x2210: [950,450,1278,56,1221,'220 812Q220 813 218 819T214 829T208 840T199 853T185 866T166 878T140 887T107 893T66 896H56V950H552V896H542Q411 896 389 812L388 208V-396H889V812Q889 813 887 819T883 829T877 840T868 853T854 866T835 878T809 887T776 893T735 896H725V950H1221V896H1211Q1080 896 1058 812V-311Q1076 -396 1211 -396H1221V-450H56V-396H66Q195 -396 219 -314Q220 -312 220 -311V812'], - - // N-ARY SUMMATION - 0x2211: [950,450,1444,55,1388,'60 948Q63 950 665 950H1267L1325 815Q1384 677 1388 669H1348L1341 683Q1320 724 1285 761Q1235 809 1174 838T1033 881T882 898T699 902H574H543H251L259 891Q722 258 724 252Q725 250 724 246Q721 243 460 -56L196 -356Q196 -357 407 -357Q459 -357 548 -357T676 -358Q812 -358 896 -353T1063 -332T1204 -283T1307 -196Q1328 -170 1348 -124H1388Q1388 -125 1381 -145T1356 -210T1325 -294L1267 -449L666 -450Q64 -450 61 -448Q55 -446 55 -439Q55 -437 57 -433L590 177Q590 178 557 222T452 366T322 544L56 909L55 924Q55 945 60 948'], - - // SQUARE ROOT - 0x221A: [1150,650,1000,111,1020,'1001 1150Q1017 1150 1020 1132Q1020 1127 741 244L460 -643Q453 -650 436 -650H424Q423 -647 423 -645T421 -640T419 -631T415 -617T408 -594T399 -560T385 -512T367 -448T343 -364T312 -259L203 119L138 41L111 67L212 188L264 248L472 -474L983 1140Q988 1150 1001 1150'], - - // INTEGRAL - 0x222B: [1361,862,556,55,944,'114 -798Q132 -824 165 -824H167Q195 -824 223 -764T275 -600T320 -391T362 -164Q365 -143 367 -133Q439 292 523 655T645 1127Q651 1145 655 1157T672 1201T699 1257T733 1306T777 1346T828 1360Q884 1360 912 1325T944 1245Q944 1220 932 1205T909 1186T887 1183Q866 1183 849 1198T832 1239Q832 1287 885 1296L882 1300Q879 1303 874 1307T866 1313Q851 1323 833 1323Q819 1323 807 1311T775 1255T736 1139T689 936T633 628Q574 293 510 -5T410 -437T355 -629Q278 -862 165 -862Q125 -862 92 -831T55 -746Q55 -711 74 -698T112 -685Q133 -685 150 -700T167 -741Q167 -789 114 -798'], - - // DOUBLE INTEGRAL - 0x222C: [1361,862,1084,55,1472,'114 -798Q132 -824 165 -824H167Q195 -824 223 -764T275 -600T320 -391T362 -164Q365 -143 367 -133Q439 292 523 655T645 1127Q651 1145 655 1157T672 1201T699 1257T733 1306T777 1346T828 1360Q884 1360 912 1325T944 1245Q944 1220 932 1205T909 1186T887 1183Q866 1183 849 1198T832 1239Q832 1287 885 1296L882 1300Q879 1303 874 1307T866 1313Q851 1323 833 1323Q819 1323 807 1311T775 1255T736 1139T689 936T633 628Q574 293 510 -5T410 -437T355 -629Q278 -862 165 -862Q125 -862 92 -831T55 -746Q55 -711 74 -698T112 -685Q133 -685 150 -700T167 -741Q167 -789 114 -798ZM642 -798Q660 -824 693 -824H695Q723 -824 751 -764T803 -600T848 -391T890 -164Q893 -143 895 -133Q967 292 1051 655T1173 1127Q1179 1145 1183 1157T1200 1201T1227 1257T1261 1306T1305 1346T1356 1360Q1412 1360 1440 1325T1472 1245Q1472 1220 1460 1205T1437 1186T1415 1183Q1394 1183 1377 1198T1360 1239Q1360 1287 1413 1296L1410 1300Q1407 1303 1402 1307T1394 1313Q1379 1323 1361 1323Q1347 1323 1335 1311T1303 1255T1264 1139T1217 936T1161 628Q1102 293 1038 -5T938 -437T883 -629Q806 -862 693 -862Q653 -862 620 -831T583 -746Q583 -711 602 -698T640 -685Q661 -685 678 -700T695 -741Q695 -789 642 -798'], - - // TRIPLE INTEGRAL - 0x222D: [1361,862,1592,55,1980,'114 -798Q132 -824 165 -824H167Q195 -824 223 -764T275 -600T320 -391T362 -164Q365 -143 367 -133Q439 292 523 655T645 1127Q651 1145 655 1157T672 1201T699 1257T733 1306T777 1346T828 1360Q884 1360 912 1325T944 1245Q944 1220 932 1205T909 1186T887 1183Q866 1183 849 1198T832 1239Q832 1287 885 1296L882 1300Q879 1303 874 1307T866 1313Q851 1323 833 1323Q819 1323 807 1311T775 1255T736 1139T689 936T633 628Q574 293 510 -5T410 -437T355 -629Q278 -862 165 -862Q125 -862 92 -831T55 -746Q55 -711 74 -698T112 -685Q133 -685 150 -700T167 -741Q167 -789 114 -798ZM642 -798Q660 -824 693 -824H695Q723 -824 751 -764T803 -600T848 -391T890 -164Q893 -143 895 -133Q967 292 1051 655T1173 1127Q1179 1145 1183 1157T1200 1201T1227 1257T1261 1306T1305 1346T1356 1360Q1412 1360 1440 1325T1472 1245Q1472 1220 1460 1205T1437 1186T1415 1183Q1394 1183 1377 1198T1360 1239Q1360 1287 1413 1296L1410 1300Q1407 1303 1402 1307T1394 1313Q1379 1323 1361 1323Q1347 1323 1335 1311T1303 1255T1264 1139T1217 936T1161 628Q1102 293 1038 -5T938 -437T883 -629Q806 -862 693 -862Q653 -862 620 -831T583 -746Q583 -711 602 -698T640 -685Q661 -685 678 -700T695 -741Q695 -789 642 -798ZM1150 -798Q1168 -824 1201 -824H1203Q1231 -824 1259 -764T1311 -600T1356 -391T1398 -164Q1401 -143 1403 -133Q1475 292 1559 655T1681 1127Q1687 1145 1691 1157T1708 1201T1735 1257T1769 1306T1813 1346T1864 1360Q1920 1360 1948 1325T1980 1245Q1980 1220 1968 1205T1945 1186T1923 1183Q1902 1183 1885 1198T1868 1239Q1868 1287 1921 1296L1918 1300Q1915 1303 1910 1307T1902 1313Q1887 1323 1869 1323Q1855 1323 1843 1311T1811 1255T1772 1139T1725 936T1669 628Q1610 293 1546 -5T1446 -437T1391 -629Q1314 -862 1201 -862Q1161 -862 1128 -831T1091 -746Q1091 -711 1110 -698T1148 -685Q1169 -685 1186 -700T1203 -741Q1203 -789 1150 -798'], - - // CONTOUR INTEGRAL - 0x222E: [1360,862,556,55,944,'114 -798Q132 -824 165 -824H167Q195 -824 223 -764T275 -600T320 -391T362 -164Q365 -143 367 -133Q382 -52 390 2Q314 40 276 99Q230 167 230 249Q230 363 305 436T484 519H494L503 563Q587 939 632 1087T727 1298Q774 1360 828 1360Q884 1360 912 1325T944 1245Q944 1220 932 1205T909 1186T887 1183Q866 1183 849 1198T832 1239Q832 1287 885 1296L882 1300Q879 1303 874 1307T866 1313Q851 1323 833 1323Q766 1323 688 929Q662 811 610 496Q770 416 770 249Q770 147 701 68T516 -21H506L497 -65Q407 -464 357 -623T237 -837Q203 -862 165 -862Q125 -862 92 -831T55 -746Q55 -711 74 -698T112 -685Q133 -685 150 -700T167 -741Q167 -789 114 -798ZM480 478Q460 478 435 470T380 444T327 401T287 335T271 249Q271 124 375 56L397 43L431 223L485 478H480ZM519 20Q545 20 578 33T647 72T706 144T730 249Q730 383 603 455Q603 454 597 421T582 343T569 276Q516 22 515 20H519'], - - // N-ARY LOGICAL AND - 0x22C0: [950,450,1111,55,1055,'1055 -401Q1055 -419 1042 -434T1007 -450Q977 -450 963 -423Q959 -417 757 167L555 750L353 167Q151 -417 147 -423Q134 -450 104 -450Q84 -450 70 -436T55 -401Q55 -394 56 -390Q59 -381 284 270T512 925Q525 950 555 950Q583 950 597 926Q599 923 825 270T1054 -391Q1055 -394 1055 -401'], - - // N-ARY LOGICAL OR - 0x22C1: [950,450,1111,55,1055,'55 900Q55 919 69 934T103 950Q134 950 147 924Q152 913 353 333L555 -250L757 333Q958 913 963 924Q978 950 1007 950Q1028 950 1041 935T1055 901Q1055 894 1054 891Q1052 884 826 231T597 -426Q583 -450 556 -450Q527 -450 512 -424Q510 -421 285 229T56 890Q55 893 55 900'], - - // N-ARY INTERSECTION - 0x22C2: [949,451,1111,55,1055,'57 516Q68 602 104 675T190 797T301 882T423 933T542 949Q594 949 606 948Q780 928 901 815T1048 545Q1053 516 1053 475T1055 49Q1055 -406 1054 -410Q1051 -427 1037 -438T1006 -450T976 -439T958 -411Q957 -407 957 37Q957 484 956 494Q945 643 831 747T554 852Q481 852 411 826Q301 786 232 696T154 494Q153 484 153 37Q153 -407 152 -411Q148 -428 135 -439T104 -450T73 -439T56 -410Q55 -406 55 49Q56 505 57 516'], - - // N-ARY UNION - 0x22C3: [950,449,1111,55,1055,'56 911Q58 926 71 938T103 950Q120 950 134 939T152 911Q153 907 153 463Q153 16 154 6Q165 -143 279 -247T556 -352Q716 -352 830 -248T956 6Q957 16 957 463Q957 907 958 911Q962 928 975 939T1006 950T1037 939T1054 911Q1055 906 1055 451Q1054 -5 1053 -16Q1029 -207 889 -328T555 -449Q363 -449 226 -331T62 -45Q57 -16 57 25T55 451Q55 906 56 911'], - - // LEFT CEILING - 0x2308: [1150,649,528,224,511,'224 -649V1150H511V1099H275V-649H224'], - - // RIGHT CEILING - 0x2309: [1150,649,528,16,303,'16 1099V1150H303V-649H252V1099H16'], - - // LEFT FLOOR - 0x230A: [1150,649,528,224,511,'224 -649V1150H275V-598H511V-649H224'], - - // RIGHT FLOOR - 0x230B: [1150,649,528,16,303,'252 -598V1150H303V-649H16V-598H252'], - - // MATHEMATICAL LEFT ANGLE BRACKET - 0x27E8: [1150,649,611,112,524,'112 244V258L473 1130Q482 1150 498 1150Q511 1150 517 1142T523 1125V1118L344 685Q304 587 257 473T187 305L165 251L344 -184L523 -616V-623Q524 -634 517 -641T499 -649Q484 -649 473 -629L112 244'], - - // MATHEMATICAL RIGHT ANGLE BRACKET - 0x27E9: [1150,649,611,85,498,'112 -649Q103 -649 95 -642T87 -623V-616L266 -184L445 251Q445 252 356 466T178 898T86 1123Q85 1134 93 1142T110 1150Q126 1150 133 1137Q134 1136 317 695L498 258V244L317 -194Q134 -635 133 -636Q126 -649 112 -649'], - - // N-ARY CIRCLED DOT OPERATOR - 0x2A00: [949,449,1511,56,1454,'668 944Q697 949 744 949Q803 949 814 948Q916 937 1006 902T1154 826T1262 730T1336 638T1380 563Q1454 415 1454 250Q1454 113 1402 -14T1258 -238T1036 -391T755 -449Q608 -449 477 -392T255 -240T110 -16T56 250Q56 387 105 510T239 723T434 871T668 944ZM755 -352Q922 -352 1061 -269T1278 -48T1356 250Q1356 479 1202 652T809 850Q798 851 747 851Q634 851 527 806T337 682T204 491T154 251Q154 128 201 17T329 -176T521 -304T755 -352ZM665 250Q665 290 692 315T758 341Q792 339 818 315T845 250Q845 211 819 186T755 160Q716 160 691 186T665 250'], - - // N-ARY CIRCLED PLUS OPERATOR - 0x2A01: [949,449,1511,56,1454,'668 944Q697 949 744 949Q803 949 814 948Q916 937 1006 902T1154 826T1262 730T1336 638T1380 563Q1454 415 1454 250Q1454 113 1402 -14T1258 -238T1036 -391T755 -449Q608 -449 477 -392T255 -240T110 -16T56 250Q56 387 105 510T239 723T434 871T668 944ZM706 299V850H704Q519 832 386 725T198 476Q181 433 169 379T156 300Q156 299 431 299H706ZM1116 732Q1054 778 982 807T871 842T810 849L804 850V299H1079Q1354 299 1354 300Q1354 311 1352 329T1336 402T1299 506T1228 620T1116 732ZM706 -350V201H431Q156 201 156 200Q156 189 158 171T174 98T211 -6T282 -120T395 -232Q428 -257 464 -277T527 -308T587 -328T636 -339T678 -346T706 -350ZM1354 200Q1354 201 1079 201H804V-350Q808 -349 838 -345T887 -338T940 -323T1010 -295Q1038 -282 1067 -265T1144 -208T1229 -121T1301 0T1349 158Q1354 188 1354 200'], - - // N-ARY CIRCLED TIMES OPERATOR - 0x2A02: [949,449,1511,56,1454,'668 944Q697 949 744 949Q803 949 814 948Q916 937 1006 902T1154 826T1262 730T1336 638T1380 563Q1454 415 1454 250Q1454 113 1402 -14T1258 -238T1036 -391T755 -449Q608 -449 477 -392T255 -240T110 -16T56 250Q56 387 105 510T239 723T434 871T668 944ZM1143 709Q1138 714 1129 722T1086 752T1017 791T925 826T809 850Q798 851 747 851H728Q659 851 571 823T408 741Q367 713 367 709L755 320L1143 709ZM297 639Q296 639 282 622T247 570T205 491T169 382T154 250T168 118T204 9T247 -70T282 -122L297 -139L685 250L297 639ZM1213 -139Q1214 -139 1228 -122T1263 -70T1305 9T1341 118T1356 250T1342 382T1306 491T1263 570T1228 622L1213 639L825 250L1213 -139ZM367 -209Q373 -215 384 -224T434 -258T514 -302T622 -336T755 -352T887 -338T996 -302T1075 -259T1126 -224L1143 -209L755 180Q754 180 561 -14T367 -209'], - - // N-ARY UNION OPERATOR WITH PLUS - 0x2A04: [950,449,1111,55,1055,'56 911Q58 926 71 938T103 950Q120 950 134 939T152 911Q153 907 153 463Q153 16 154 6Q165 -143 279 -247T556 -352Q716 -352 830 -248T956 6Q957 16 957 463Q957 907 958 911Q962 928 975 939T1006 950T1037 939T1054 911Q1055 906 1055 451Q1054 -5 1053 -16Q1029 -207 889 -328T555 -449Q363 -449 226 -331T62 -45Q57 -16 57 25T55 451Q55 906 56 911ZM507 554Q511 570 523 581T554 593Q571 593 585 582T603 554Q604 551 604 443V338H709Q817 338 820 337Q835 334 847 321T859 290Q859 254 819 241Q816 240 709 240H604V134Q604 48 604 34T598 11Q583 -15 555 -15Q526 -15 512 11Q507 20 507 34T506 134V240H401H344Q292 240 278 246Q251 259 251 290Q251 309 264 321T290 337Q293 338 401 338H506V443Q506 551 507 554'], - - // N-ARY SQUARE UNION OPERATOR - 0x2A06: [950,450,1111,54,1056,'56 911Q60 927 72 938T103 950Q120 950 134 939T152 911Q153 907 153 277V-352H957V277Q957 907 958 911Q962 928 975 939T1006 950T1036 939T1054 911V891Q1054 871 1054 836T1054 754T1054 647T1055 525T1055 390T1055 250T1055 111T1055 -24T1055 -147T1054 -253T1054 -335T1054 -391V-411Q1047 -442 1016 -449Q1011 -450 552 -450L94 -449Q63 -439 56 -411V-391Q56 -371 56 -336T56 -254T56 -147T55 -25T55 110T55 250T55 389T55 524T55 647T56 753T56 835T56 891V911'] -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Size2/Regular/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Size3/Regular/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Size3/Regular/Main.js deleted file mode 100644 index ea9a8be6fe..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Size3/Regular/Main.js +++ /dev/null @@ -1,87 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Size3/Regular/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Size3'] = { - directory: 'Size3/Regular', - family: 'MathJax_Size3', - id: 'MJSZ3', - - // SPACE - 0x20: [0,0,250,0,0,''], - - // LEFT PARENTHESIS - 0x28: [1450,949,736,208,701,'701 -940Q701 -943 695 -949H664Q662 -947 636 -922T591 -879T537 -818T475 -737T412 -636T350 -511T295 -362T250 -186T221 17T209 251Q209 962 573 1361Q596 1386 616 1405T649 1437T664 1450H695Q701 1444 701 1441Q701 1436 681 1415T629 1356T557 1261T476 1118T400 927T340 675T308 359Q306 321 306 250Q306 -139 400 -430T690 -924Q701 -936 701 -940'], - - // RIGHT PARENTHESIS - 0x29: [1450,949,736,34,527,'34 1438Q34 1446 37 1448T50 1450H56H71Q73 1448 99 1423T144 1380T198 1319T260 1238T323 1137T385 1013T440 864T485 688T514 485T526 251Q526 134 519 53Q472 -519 162 -860Q139 -885 119 -904T86 -936T71 -949H56Q43 -949 39 -947T34 -937Q88 -883 140 -813Q428 -430 428 251Q428 453 402 628T338 922T245 1146T145 1309T46 1425Q44 1427 42 1429T39 1433T36 1436L34 1438'], - - // SOLIDUS - 0x2F: [1450,949,1044,55,988,'81 -949Q71 -949 63 -941T55 -921Q55 -917 56 -915Q59 -906 498 264T939 1438Q945 1450 960 1450Q972 1450 980 1441T988 1421Q982 1403 839 1020L398 -155Q107 -934 103 -938Q96 -949 81 -949'], - - // LEFT SQUARE BRACKET - 0x5B: [1450,949,528,247,516,'247 -949V1450H516V1388H309V-887H516V-949H247'], - - // REVERSE SOLIDUS - 0x5C: [1450,949,1044,56,988,'988 -922Q988 -933 980 -941T962 -949Q947 -949 940 -938Q936 -934 645 -155L204 1020Q56 1416 56 1424Q56 1433 62 1441T84 1450Q97 1448 103 1439Q107 1435 398 656L839 -519Q988 -918 988 -922'], - - // RIGHT SQUARE BRACKET - 0x5D: [1450,949,528,11,280,'11 1388V1450H280V-949H11V-887H218V1388H11'], - - // LEFT CURLY BRACKET - 0x7B: [1450,949,750,130,618,'618 -943L612 -949H582L568 -943Q472 -903 411 -841T332 -703Q327 -682 327 -653T325 -350Q324 -28 323 -18Q317 24 301 61T264 124T221 171T179 205T147 225T132 234Q130 238 130 250Q130 255 130 258T131 264T132 267T134 269T139 272T144 275Q207 308 256 367Q310 436 323 519Q324 529 325 851Q326 1124 326 1154T332 1205Q369 1358 566 1443L582 1450H612L618 1444V1429Q618 1413 616 1411L608 1406Q599 1402 585 1393T552 1372T515 1343T479 1305T449 1257T429 1200Q425 1180 425 1152T423 851Q422 579 422 549T416 498Q407 459 388 424T346 364T297 318T250 284T214 264T197 254L188 251L205 242Q290 200 345 138T416 3Q421 -18 421 -48T423 -349Q423 -397 423 -472Q424 -677 428 -694Q429 -697 429 -699Q434 -722 443 -743T465 -782T491 -816T519 -845T548 -868T574 -886T595 -899T610 -908L616 -910Q618 -912 618 -928V-943'], - - // RIGHT CURLY BRACKET - 0x7D: [1450,949,750,131,618,'131 1414T131 1429T133 1447T148 1450H153H167L182 1444Q276 1404 336 1343T415 1207Q421 1184 421 1154T423 851L424 531L426 517Q434 462 460 415T518 339T571 296T608 274Q615 270 616 267T618 251Q618 241 618 238T615 232T608 227Q542 194 491 132T426 -15L424 -29L423 -350Q422 -622 422 -652T415 -706Q397 -780 337 -841T182 -943L167 -949H153Q137 -949 134 -946T131 -928Q131 -914 132 -911T144 -904Q146 -903 148 -902Q299 -820 323 -680Q324 -663 325 -349T327 -19Q355 145 541 241L561 250L541 260Q356 355 327 520Q326 537 325 850T323 1181Q315 1227 293 1267T244 1332T193 1374T151 1401T132 1413Q131 1414 131 1429'], - - // MODIFIER LETTER CIRCUMFLEX ACCENT - 0x2C6: [772,-564,1444,-4,1447,'1439 564Q1434 564 1080 631T722 698Q719 698 362 631Q7 564 4 564L0 583Q-4 602 -4 603L720 772L1083 688Q1446 603 1447 603Q1447 602 1443 583L1439 564'], - - // SMALL TILDE - 0x2DC: [749,-609,1444,1,1442,'1 643Q1 646 76 671T271 722T476 749Q555 749 626 736T742 706T856 676T999 662Q1088 662 1192 684T1363 727T1432 749Q1432 745 1437 731T1442 716Q1442 714 1381 693T1212 645T1012 611Q1000 610 955 610Q851 610 701 653T444 697Q355 697 251 676T80 632T11 610Q11 614 6 628T1 643'], - - // COMBINING CIRCUMFLEX ACCENT - 0x302: [772,-564,0,-1448,3,'-5 564Q-9 564 -363 631T-722 698Q-725 698 -1082 631Q-1437 564 -1440 564L-1444 583Q-1448 602 -1448 603L-724 772L-361 688Q2 603 3 603Q3 602 -1 583L-5 564'], - - // COMBINING TILDE - 0x303: [749,-609,0,-1443,-2,'-1443 643Q-1443 646 -1368 671T-1173 722T-968 749Q-889 749 -818 736T-702 706T-588 676T-445 662Q-356 662 -252 684T-81 727T-12 749Q-12 745 -7 731T-2 716Q-2 714 -63 693T-232 645T-432 611Q-444 610 -489 610Q-593 610 -743 653T-1000 697Q-1089 697 -1193 676T-1364 632T-1433 610Q-1433 614 -1438 628T-1443 643'], - - // SQUARE ROOT - 0x221A: [1450,950,1000,111,1020,'424 -948Q422 -947 313 -434T202 80L170 31Q165 24 157 10Q137 -21 137 -21Q131 -16 124 -8L111 5L264 248L473 -720Q473 -717 727 359T983 1440Q989 1450 1001 1450Q1007 1450 1013 1445T1020 1433Q1020 1425 742 244T460 -941Q458 -950 439 -950H436Q424 -950 424 -948'], - - // LEFT CEILING - 0x2308: [1450,949,583,246,571,'246 -949V1450H571V1388H308V-949H246'], - - // RIGHT CEILING - 0x2309: [1450,949,583,11,336,'11 1388V1450H336V-949H274V1388H11'], - - // LEFT FLOOR - 0x230A: [1450,949,583,246,571,'246 -949V1450H308V-887H571V-949H246'], - - // RIGHT FLOOR - 0x230B: [1450,949,583,11,336,'274 -887V1450H336V-949H11V-887H274'], - - // MATHEMATICAL LEFT ANGLE BRACKET - 0x27E8: [1450,950,750,126,654,'126 242V259L361 845Q595 1431 597 1435Q610 1450 624 1450Q634 1450 644 1443T654 1419V1411L422 831Q190 253 190 250T422 -331L654 -910V-919Q654 -936 644 -943T624 -950Q612 -950 597 -935Q595 -931 361 -345L126 242'], - - // MATHEMATICAL RIGHT ANGLE BRACKET - 0x27E9: [1450,949,750,94,623,'94 1424Q94 1426 97 1432T107 1444T124 1450Q141 1450 152 1435Q154 1431 388 845L623 259V242L388 -345Q153 -933 152 -934Q142 -949 127 -949H125Q95 -949 95 -919V-910L327 -331Q559 247 559 250T327 831Q94 1411 94 1424'] -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Size3/Regular/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Size4/Regular/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Size4/Regular/Main.js deleted file mode 100644 index 5bcb438488..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Size4/Regular/Main.js +++ /dev/null @@ -1,168 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Size4/Regular/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Size4'] = { - directory: 'Size4/Regular', - family: 'MathJax_Size4', - id: 'MJSZ4', - - // SPACE - 0x20: [0,0,250,0,0,''], - - // LEFT PARENTHESIS - 0x28: [1750,1249,792,237,758,'758 -1237T758 -1240T752 -1249H736Q718 -1249 717 -1248Q711 -1245 672 -1199Q237 -706 237 251T672 1700Q697 1730 716 1749Q718 1750 735 1750H752Q758 1744 758 1741Q758 1737 740 1713T689 1644T619 1537T540 1380T463 1176Q348 802 348 251Q348 -242 441 -599T744 -1218Q758 -1237 758 -1240'], - - // RIGHT PARENTHESIS - 0x29: [1750,1250,792,33,554,'33 1741Q33 1750 51 1750H60H65Q73 1750 81 1743T119 1700Q554 1207 554 251Q554 -707 119 -1199Q76 -1250 66 -1250Q65 -1250 62 -1250T56 -1249Q55 -1249 53 -1249T49 -1250Q33 -1250 33 -1239Q33 -1236 50 -1214T98 -1150T163 -1052T238 -910T311 -727Q443 -335 443 251Q443 402 436 532T405 831T339 1142T224 1438T50 1716Q33 1737 33 1741'], - - // SOLIDUS - 0x2F: [1750,1249,1278,56,1221,'1166 1738Q1176 1750 1189 1750T1211 1742T1221 1721Q1221 1720 1221 1718T1220 1715Q1219 1708 666 238T111 -1237Q102 -1249 86 -1249Q74 -1249 65 -1240T56 -1220Q56 -1219 56 -1217T57 -1214Q58 -1207 611 263T1166 1738'], - - // LEFT SQUARE BRACKET - 0x5B: [1750,1249,583,269,577,'269 -1249V1750H577V1677H342V-1176H577V-1249H269'], - - // REVERSE SOLIDUS - 0x5C: [1750,1249,1278,56,1221,'56 1720Q56 1732 64 1741T85 1750Q104 1750 111 1738Q113 1734 666 264T1220 -1214Q1220 -1215 1220 -1217T1221 -1220Q1221 -1231 1212 -1240T1191 -1249Q1175 -1249 1166 -1237Q1164 -1233 611 237T57 1715Q57 1716 56 1718V1720'], - - // RIGHT SQUARE BRACKET - 0x5D: [1750,1249,583,5,313,'5 1677V1750H313V-1249H5V-1176H240V1677H5'], - - // LEFT CURLY BRACKET - 0x7B: [1750,1249,806,144,661,'661 -1243L655 -1249H622L604 -1240Q503 -1190 434 -1107T348 -909Q346 -897 346 -499L345 -98L343 -82Q335 3 287 87T157 223Q146 232 145 236Q144 240 144 250Q144 265 145 268T157 278Q242 333 288 417T343 583L345 600L346 1001Q346 1398 348 1410Q379 1622 600 1739L622 1750H655L661 1744V1727V1721Q661 1712 661 1710T657 1705T648 1700T630 1690T602 1668Q589 1659 574 1643T531 1593T484 1508T459 1398Q458 1389 458 1001Q458 614 457 605Q441 435 301 316Q254 277 202 251L250 222Q260 216 301 185Q443 66 457 -104Q458 -113 458 -501Q458 -888 459 -897Q463 -944 478 -988T509 -1060T548 -1114T580 -1149T602 -1167Q620 -1183 634 -1192T653 -1202T659 -1207T661 -1220V-1226V-1243'], - - // RIGHT CURLY BRACKET - 0x7D: [1750,1249,806,144,661,'144 1727Q144 1743 146 1746T162 1750H167H183L203 1740Q274 1705 325 1658T403 1562T440 1478T456 1410Q458 1398 458 1001Q459 661 459 624T465 558Q470 526 480 496T502 441T529 395T559 356T588 325T615 301T637 284T654 273L660 269V266Q660 263 660 259T661 250V239Q661 236 661 234T660 232T656 229T649 224Q577 179 528 105T465 -57Q460 -86 460 -123T458 -499V-661Q458 -857 457 -893T447 -955Q425 -1048 359 -1120T203 -1239L183 -1249H168Q150 -1249 147 -1246T144 -1226Q144 -1213 145 -1210T153 -1202Q169 -1193 186 -1181T232 -1140T282 -1081T322 -1000T345 -897Q346 -888 346 -501Q346 -113 347 -104Q359 58 503 184Q554 226 603 250Q504 299 430 393T347 605Q346 614 346 1002Q346 1389 345 1398Q338 1493 288 1573T153 1703Q146 1707 145 1710T144 1727'], - - // MODIFIER LETTER CIRCUMFLEX ACCENT - 0x2C6: [845,-561,1889,-14,1902,'5 561Q-4 561 -9 582T-14 618Q-14 623 -13 625Q-11 628 461 736T943 845Q945 845 1417 738T1896 628Q1902 628 1902 618Q1902 607 1897 584T1883 561Q1881 561 1412 654L945 750L476 654Q6 561 5 561'], - - // SMALL TILDE - 0x2DC: [823,-582,1889,0,1885,'1212 583Q1124 583 1048 603T923 647T799 691T635 711Q524 711 375 679T120 615L16 583Q14 584 12 587T9 592Q-2 650 2 659Q2 669 38 687Q54 696 146 723T309 767Q527 823 666 823Q759 823 837 803T964 759T1088 715T1252 695Q1363 695 1512 727T1764 791T1871 823Q1872 822 1874 819T1878 814Q1885 783 1885 753Q1885 748 1884 747Q1884 738 1849 719Q1836 712 1740 682T1484 617T1212 583'], - - // COMBINING CIRCUMFLEX ACCENT - 0x302: [845,-561,0,-1903,13,'-1884 561Q-1893 561 -1898 582T-1903 618Q-1903 623 -1902 625Q-1900 628 -1428 736T-946 845Q-944 845 -472 738T7 628Q13 628 13 618Q13 607 8 584T-6 561Q-8 561 -477 654L-944 750L-1413 654Q-1883 561 -1884 561'], - - // COMBINING TILDE - 0x303: [823,-582,0,-1889,-4,'-677 583Q-765 583 -841 603T-966 647T-1090 691T-1254 711Q-1365 711 -1514 679T-1768 615L-1873 583Q-1875 584 -1877 587T-1880 592Q-1891 650 -1887 659Q-1887 669 -1851 687Q-1835 696 -1743 723T-1580 767Q-1362 823 -1223 823Q-1130 823 -1052 803T-925 759T-801 715T-637 695Q-526 695 -377 727T-125 791T-18 823Q-17 822 -15 819T-11 814Q-4 782 -4 753Q-4 748 -5 747Q-5 738 -40 719Q-53 712 -149 682T-405 617T-677 583'], - - // SQUARE ROOT - 0x221A: [1750,1250,1000,111,1020,'983 1739Q988 1750 1001 1750Q1008 1750 1013 1745T1020 1733Q1020 1726 742 244T460 -1241Q458 -1250 439 -1250H436Q424 -1250 424 -1248L410 -1166Q395 -1083 367 -920T312 -601L201 44L137 -83L111 -57L187 96L264 247Q265 246 369 -357Q470 -958 473 -963L727 384Q979 1729 983 1739'], - - // LEFT CEILING - 0x2308: [1750,1249,639,269,633,'269 -1249V1750H633V1677H342V-1249H269'], - - // RIGHT CEILING - 0x2309: [1750,1249,639,5,369,'5 1677V1750H369V-1249H296V1677H5'], - - // LEFT FLOOR - 0x230A: [1750,1249,639,269,633,'269 -1249V1750H342V-1176H633V-1249H269'], - - // RIGHT FLOOR - 0x230B: [1750,1249,639,5,369,'296 -1176V1750H369V-1249H5V-1176H296'], - - // LEFT PARENTHESIS UPPER HOOK - 0x239B: [1155,655,875,291,843,'837 1154Q843 1148 843 1145Q843 1141 818 1106T753 1002T667 841T574 604T494 299Q417 -84 417 -609Q417 -641 416 -647T411 -654Q409 -655 366 -655Q299 -655 297 -654Q292 -652 292 -643T291 -583Q293 -400 304 -242T347 110T432 470T574 813T785 1136Q787 1139 790 1142T794 1147T796 1150T799 1152T802 1153T807 1154T813 1154H819H837'], - - // LEFT PARENTHESIS EXTENSION - 0x239C: [610,11,875,291,417,'413 -9Q412 -9 407 -9T388 -10T354 -10Q300 -10 297 -9Q294 -8 293 -5Q291 5 291 127V300Q291 602 292 605L296 609Q298 610 366 610Q382 610 392 610T407 610T412 609Q416 609 416 592T417 473V127Q417 -9 413 -9'], - - // LEFT PARENTHESIS LOWER HOOK - 0x239D: [1165,644,875,291,843,'843 -635Q843 -638 837 -644H820Q801 -644 800 -643Q792 -635 785 -626Q684 -503 605 -363T473 -75T385 216T330 518T302 809T291 1093Q291 1144 291 1153T296 1164Q298 1165 366 1165Q409 1165 411 1164Q415 1163 416 1157T417 1119Q417 529 517 109T833 -617Q843 -631 843 -635'], - - // RIGHT PARENTHESIS UPPER HOOK - 0x239E: [1154,655,875,31,583,'31 1143Q31 1154 49 1154H59Q72 1154 75 1152T89 1136Q190 1013 269 873T401 585T489 294T544 -8T572 -299T583 -583Q583 -634 583 -643T577 -654Q575 -655 508 -655Q465 -655 463 -654Q459 -653 458 -647T457 -609Q457 -58 371 340T100 1037Q87 1059 61 1098T31 1143'], - - // RIGHT PARENTHESIS EXTENSION - 0x239F: [610,11,875,457,583,'579 -9Q578 -9 573 -9T554 -10T520 -10Q466 -10 463 -9Q460 -8 459 -5Q457 5 457 127V300Q457 602 458 605L462 609Q464 610 532 610Q548 610 558 610T573 610T578 609Q582 609 582 592T583 473V127Q583 -9 579 -9'], - - // RIGHT PARENTHESIS LOWER HOOK - 0x23A0: [1165,644,875,31,583,'56 -644H50Q31 -644 31 -635Q31 -632 37 -622Q69 -579 100 -527Q286 -228 371 170T457 1119Q457 1161 462 1164Q464 1165 520 1165Q575 1165 577 1164Q582 1162 582 1153T583 1093Q581 910 570 752T527 400T442 40T300 -303T89 -626Q78 -640 75 -642T61 -644H56'], - - // LEFT SQUARE BRACKET UPPER CORNER - 0x23A1: [1154,645,667,319,666,'319 -645V1154H666V1070H403V-645H319'], - - // LEFT SQUARE BRACKET EXTENSION - 0x23A2: [602,0,667,319,403,'319 0V602H403V0H319'], - - // LEFT SQUARE BRACKET LOWER CORNER - 0x23A3: [1155,644,667,319,666,'319 -644V1155H403V-560H666V-644H319'], - - // RIGHT SQUARE BRACKET UPPER CORNER - 0x23A4: [1154,645,667,0,347,'0 1070V1154H347V-645H263V1070H0'], - - // RIGHT SQUARE BRACKET EXTENSION - 0x23A5: [602,0,667,263,347,'263 0V602H347V0H263'], - - // RIGHT SQUARE BRACKET LOWER CORNER - 0x23A6: [1155,644,667,0,347,'263 -560V1155H347V-644H0V-560H263'], - - // LEFT CURLY BRACKET UPPER HOOK - 0x23A7: [899,10,889,383,718,'712 899L718 893V876V865Q718 854 704 846Q627 793 577 710T510 525Q510 524 509 521Q505 493 504 349Q504 345 504 334Q504 277 504 240Q504 -2 503 -4Q502 -8 494 -9T444 -10Q392 -10 390 -9Q387 -8 386 -5Q384 5 384 230Q384 262 384 312T383 382Q383 481 392 535T434 656Q510 806 664 892L677 899H712'], - - // LEFT CURLY BRACKET MIDDLE PIECE - 0x23A8: [1160,660,889,170,504,'389 1159Q391 1160 455 1160Q496 1160 498 1159Q501 1158 502 1155Q504 1145 504 924Q504 691 503 682Q494 549 425 439T243 259L229 250L243 241Q349 175 421 66T503 -182Q504 -191 504 -424Q504 -600 504 -629T499 -659H498Q496 -660 444 -660T390 -659Q387 -658 386 -655Q384 -645 384 -425V-282Q384 -176 377 -116T342 10Q325 54 301 92T255 155T214 196T183 222T171 232Q170 233 170 250T171 268Q171 269 191 284T240 331T300 407T354 524T383 679Q384 691 384 925Q384 1152 385 1155L389 1159'], - - // LEFT CURLY BRACKET LOWER HOOK - 0x23A9: [10,899,889,384,718,'718 -893L712 -899H677L666 -893Q542 -825 468 -714T385 -476Q384 -466 384 -282Q384 3 385 5L389 9Q392 10 444 10Q486 10 494 9T503 4Q504 2 504 -239V-310V-366Q504 -470 508 -513T530 -609Q546 -657 569 -698T617 -767T661 -812T699 -843T717 -856T718 -876V-893'], - - // CURLY BRACKET EXTENSION - 0x23AA: [310,10,889,384,504,'384 150V266Q384 304 389 309Q391 310 455 310Q496 310 498 309Q502 308 503 298Q504 283 504 150Q504 32 504 12T499 -9H498Q496 -10 444 -10T390 -9Q386 -8 385 2Q384 17 384 150'], - - // RIGHT CURLY BRACKET UPPER HOOK - 0x23AB: [899,10,889,170,504,'170 875Q170 892 172 895T189 899H194H211L222 893Q345 826 420 715T503 476Q504 467 504 230Q504 51 504 21T499 -9H498Q496 -10 444 -10Q402 -10 394 -9T385 -4Q384 -2 384 240V311V366Q384 469 380 513T358 609Q342 657 319 698T271 767T227 812T189 843T171 856T170 875'], - - // RIGHT CURLY BRACKET MIDDLE PIECE - 0x23AC: [1160,660,889,384,718,'389 1159Q391 1160 455 1160Q496 1160 498 1159Q501 1158 502 1155Q504 1145 504 925V782Q504 676 511 616T546 490Q563 446 587 408T633 345T674 304T705 278T717 268Q718 267 718 250T717 232Q717 231 697 216T648 169T588 93T534 -24T505 -179Q504 -191 504 -425Q504 -600 504 -629T499 -659H498Q496 -660 444 -660T390 -659Q387 -658 386 -655Q384 -645 384 -424Q384 -191 385 -182Q394 -49 463 61T645 241L659 250L645 259Q539 325 467 434T385 682Q384 692 384 873Q384 1153 385 1155L389 1159'], - - // RIGHT CURLY BRACKET LOWER HOOK - 0x23AD: [10,899,889,170,505,'384 -239V-57Q384 4 389 9Q391 10 455 10Q496 10 498 9Q501 8 502 5Q504 -5 504 -230Q504 -261 504 -311T505 -381Q505 -486 492 -551T435 -691Q357 -820 222 -893L211 -899H195Q176 -899 173 -896T170 -874Q170 -858 171 -855T184 -846Q262 -793 312 -709T378 -525Q378 -524 379 -522Q383 -493 384 -351Q384 -345 384 -334Q384 -276 384 -239'], - - // RADICAL SYMBOL BOTTOM - 0x23B7: [935,885,1056,111,742,'742 -871Q740 -873 737 -876T733 -880T730 -882T724 -884T714 -885H702L222 569L180 484Q138 399 137 399Q131 404 124 412L111 425L265 736L702 -586V168L703 922Q713 935 722 935Q734 935 742 920V-871'], - - // MATHEMATICAL LEFT ANGLE BRACKET - 0x27E8: [1750,1248,806,140,703,'140 242V260L386 994Q633 1729 635 1732Q643 1745 657 1749Q658 1749 662 1749T668 1750Q682 1749 692 1740T702 1714V1705L214 251L703 -1204L702 -1213Q702 -1230 692 -1239T667 -1248H664Q647 -1248 635 -1231Q633 -1228 386 -493L140 242'], - - // MATHEMATICAL RIGHT ANGLE BRACKET - 0x27E9: [1750,1248,806,103,665,'103 1714Q103 1732 114 1741T137 1750Q157 1750 170 1732Q172 1729 419 994L665 260V242L419 -493Q172 -1228 170 -1231Q158 -1248 141 -1248H138Q123 -1248 113 -1239T103 -1213V-1204L591 251L103 1705V1714'], - - // stix-radical symbol vertical extender - 0xE000: [625,14,1056,702,742,'722 -14H720Q708 -14 702 0V306L703 612Q713 625 722 625Q734 625 742 610V0Q734 -14 724 -14H722'], - - // stix-radical symbol top corner piece - 0xE001: [605,14,1056,702,1076,'702 589Q706 601 718 605H1061Q1076 597 1076 585Q1076 572 1061 565H742V0Q734 -14 724 -14H722H720Q708 -14 702 0V589'], - - // stix-horizontal brace, down left piece - 0xE150: [120,213,450,-24,460,'-18 -213L-24 -207V-172L-16 -158Q75 2 260 84Q334 113 415 119Q418 119 427 119T440 120Q454 120 457 117T460 98V60V25Q460 7 457 4T441 0Q308 0 193 -55T25 -205Q21 -211 18 -212T-1 -213H-18'], - - // stix-horizontal brace, down right piece - 0xE151: [120,213,450,-10,474,'-10 60Q-10 104 -10 111T-5 118Q-1 120 10 120Q96 120 190 84Q375 2 466 -158L474 -172V-207L468 -213H451H447Q437 -213 434 -213T428 -209T423 -202T414 -187T396 -163Q331 -82 224 -41T9 0Q-4 0 -7 3T-10 25V60'], - - // stix-horizontal brace, upper left piece - 0xE152: [333,0,450,-24,460,'-24 327L-18 333H-1Q11 333 15 333T22 329T27 322T35 308T54 284Q115 203 225 162T441 120Q454 120 457 117T460 95V60V28Q460 8 457 4T442 0Q355 0 260 36Q75 118 -16 278L-24 292V327'], - - // stix-horizontal brace, upper right piece - 0xE153: [333,0,450,-10,474,'-10 60V95Q-10 113 -7 116T9 120Q151 120 250 171T396 284Q404 293 412 305T424 324T431 331Q433 333 451 333H468L474 327V292L466 278Q375 118 190 36Q95 0 8 0Q-5 0 -7 3T-10 24V60'], - - // stix-oblique open face capital letter A - 0xE154: [120,0,400,-10,410,'-10 0V120H410V0H-10'] -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Size4/Regular/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/BasicLatin.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/BasicLatin.js deleted file mode 100644 index f3b160f041..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/BasicLatin.js +++ /dev/null @@ -1,314 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Typewriter/Regular/BasicLatin.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Typewriter'], - { - // SPACE - 0x20: [0,0,250,0,0,''], - - // EXCLAMATION MARK - 0x21: [622,0,525,206,320,'206 565Q206 590 222 606T265 622Q287 621 303 606T319 565T314 392L308 216Q299 194 273 194H262Q247 194 241 195T228 200T217 216L211 392Q206 539 206 565ZM206 56Q206 83 223 99T265 115Q288 113 304 99T320 58Q320 33 303 17T262 0Q237 0 222 17T206 56'], - - // QUOTATION MARK - 0x22: [623,-333,525,122,402,'122 575Q122 593 137 608T173 623Q196 623 210 608T225 575Q225 562 218 464Q212 373 211 361T201 341Q193 333 173 333Q154 333 146 341Q138 348 137 360T129 464Q122 561 122 575ZM299 575Q299 593 314 608T350 623Q373 623 387 608T402 575Q402 562 395 464Q389 373 388 361T378 341Q370 333 350 333Q331 333 323 341Q315 348 314 360T306 464Q299 561 299 575'], - - // NUMBER SIGN - 0x23: [612,0,525,36,489,'93 163Q74 163 65 164T46 173T36 198Q36 210 40 215T61 233H131V236Q132 239 140 307T149 377Q149 379 105 379L61 380Q36 392 36 414Q36 450 86 450Q91 450 99 450T112 449H159Q163 480 167 517Q168 524 170 545T174 573T180 591T191 607T210 611Q223 611 232 604T243 588L245 580Q245 565 238 511T230 451Q230 449 282 449H333Q337 480 341 517Q342 524 343 537T345 556T348 573T352 589T359 600T370 608T384 611Q395 611 406 602T419 580Q419 565 412 511T404 451Q404 449 431 449H442Q477 449 485 429Q489 421 489 414Q489 392 463 380L428 379H394V376Q393 373 385 305T376 235Q376 233 419 233H463L468 230Q472 227 473 227T477 223T482 218T486 213T488 206T489 198Q489 162 436 162Q430 162 422 162T412 163H366V161Q364 159 357 92Q356 85 355 73T353 54T350 37T346 22T339 11T328 3T314 0Q303 0 292 9T279 31Q279 37 287 96T295 162Q295 163 244 163H192V161Q190 159 183 92Q182 85 181 73T179 54T176 37T172 22T165 11T154 3T140 0Q129 0 118 9T105 31Q105 37 113 96T121 162Q121 163 93 163ZM323 377Q323 379 272 379H220V376Q219 373 211 305T202 235Q202 233 253 233H305V236Q306 239 314 307T323 377'], - - // DOLLAR SIGN - 0x24: [694,82,525,58,466,'415 397Q392 397 377 411T362 448Q362 464 376 485Q369 498 362 506T346 520T332 528T315 533T300 538V445L301 353L311 350Q382 334 424 284T466 174Q466 115 425 65T303 -2L300 -3V-30Q300 -64 291 -74Q283 -82 262 -82H255Q234 -82 225 -60L224 -32V-4L213 -2Q152 6 106 51T59 170V180Q59 197 74 213Q89 227 110 227T146 213T162 174Q162 156 147 137Q153 123 161 112T176 95T191 85T205 79T216 76T224 74V283L213 285Q147 298 103 343T58 449Q58 516 108 560T224 614V643V654Q224 666 226 673T237 687T264 694Q289 693 294 683T300 642V615H303Q355 607 390 587T440 540T460 493T466 453Q466 425 451 411T415 397ZM137 452Q137 425 158 404T198 376T223 369Q224 369 224 453T223 537Q198 532 168 509T137 452ZM301 75Q307 75 325 83T365 116T387 171Q387 238 300 267V171Q300 75 301 75'], - - // PERCENT SIGN - 0x25: [694,83,525,35,489,'35 560Q35 607 54 645T110 693Q111 693 116 693T125 694Q165 692 187 651T210 560Q210 506 186 467T123 428Q84 428 60 466T35 560ZM139 560Q139 574 136 587T130 608T124 615Q122 617 120 614Q106 595 106 561Q106 516 121 506Q123 504 125 507Q139 526 139 560ZM123 -83Q107 -83 98 -73T88 -48Q88 -43 89 -41Q90 -37 229 316T370 675Q381 694 400 694Q416 694 426 684T436 659Q436 654 435 652Q434 647 295 294T153 -65Q144 -83 123 -83ZM314 50Q314 104 338 143T400 183Q439 183 464 144T489 50T465 -43T402 -82Q358 -82 336 -41T314 50ZM417 50Q417 71 413 85T405 102L401 106Q386 95 386 50Q386 29 390 15T398 -2L402 -6Q417 5 417 50'], - - // AMPERSAND - 0x26: [622,11,525,28,490,'96 462Q96 546 132 584T211 622Q255 622 284 583T314 474Q314 395 224 305L208 288Q213 275 226 251L265 185L269 179Q273 184 299 246L332 333L342 363Q342 364 341 365Q334 365 334 393Q334 406 334 410T340 420T356 431H412H440Q467 431 478 424T490 393Q490 376 484 367T470 357T448 355H441H415L399 312Q349 176 322 127L315 115L323 106Q360 65 393 65Q405 65 410 80T416 109Q416 140 452 140Q487 140 487 105Q487 56 460 23T391 -11L286 41L273 53L262 42Q212 -11 151 -11Q97 -11 63 33T28 143Q28 161 30 176T38 205T47 227T60 247T72 261T84 274T94 283L122 311L119 323Q96 392 96 462ZM243 474Q243 533 218 545L215 546Q212 546 210 546Q182 546 169 501Q167 492 167 466Q167 419 179 368L188 377Q234 425 242 461Q243 465 243 474ZM217 129Q185 174 154 235Q121 214 115 176Q113 168 113 143Q113 83 139 67Q141 66 152 66Q191 66 228 112L217 129'], - - // APOSTROPHE - 0x27: [611,-287,525,175,349,'205 554Q205 577 221 594T263 611Q302 611 325 577T349 490Q349 409 298 347Q285 330 258 309T214 287Q203 289 189 302T175 327Q175 341 185 349T213 369T245 402Q269 437 273 483V497Q264 496 263 496Q240 496 223 513T205 554'], - - // LEFT PARENTHESIS - 0x28: [694,82,525,166,437,'437 -53Q437 -82 399 -82H394Q377 -82 342 -55Q259 7 213 102T166 306Q166 412 211 507T342 667Q377 694 393 694H399Q437 694 437 665Q437 654 426 643T397 620T356 584T311 525Q301 511 290 488T264 412T250 306Q250 191 300 105T422 -27Q437 -37 437 -53'], - - // RIGHT PARENTHESIS - 0x29: [694,82,525,87,358,'87 664Q87 694 126 694Q138 694 147 690T183 667Q266 605 312 510T358 306Q358 193 307 93T161 -70Q142 -82 126 -82Q105 -82 96 -73T87 -53Q87 -47 88 -44Q92 -36 116 -19T173 34T230 119Q273 206 273 306Q273 408 231 494T109 635Q87 649 87 664'], - - // ASTERISK - 0x2A: [520,-89,525,68,456,'222 487Q224 501 235 510T262 520Q279 520 289 510T302 487Q302 458 301 429Q301 421 301 413T301 398T300 386T300 377V374Q300 373 301 373Q304 373 353 403T416 434Q432 434 444 423T456 393Q456 389 456 386T454 379T451 373T448 368T442 363T436 358T427 353T417 348T405 342T391 334Q345 309 339 305L388 279Q400 273 412 266T432 255T441 250Q456 238 456 218Q456 200 445 189T417 177Q403 177 354 207T301 238Q300 238 300 237V234Q300 231 300 226T300 214T301 199T301 182Q302 153 302 124Q300 109 289 100T262 90T235 100T222 124Q222 153 223 182Q223 190 223 198T223 213T224 225T224 234V237Q224 238 223 238Q220 238 171 208T108 177Q92 177 80 188T68 218Q68 237 79 246T134 277Q180 303 185 306L136 332Q124 338 112 345T92 356T83 361Q68 373 68 393Q68 411 79 422T107 434Q121 434 170 404T223 373Q224 373 224 374V377Q224 380 224 385T224 397T223 412T223 429Q222 458 222 487'], - - // PLUS SIGN - 0x2B: [531,-81,525,38,487,'147 271Q138 271 122 271T98 270Q68 270 53 277T38 306T53 335T98 342Q105 342 121 342T147 341H227V423L228 505Q241 531 262 531Q268 531 273 530T282 525T287 519T293 511L297 505V341H377H430Q457 341 467 338T483 321Q487 313 487 306Q487 295 480 286T463 273Q457 271 377 271H297V107Q281 81 262 81Q250 81 242 87T230 100L228 107L227 189V271H147'], - - // COMMA - 0x2C: [140,139,525,173,353,'193 37T193 70T213 121T260 140Q302 140 327 108T353 36Q353 -7 336 -43T294 -98T249 -128T215 -139Q204 -139 189 -125Q177 -111 174 -101Q172 -84 183 -77T217 -61T253 -33Q261 -24 272 1L265 0Q234 0 214 18'], - - // HYPHEN-MINUS - 0x2D: [341,-271,525,57,468,'57 306Q57 333 86 341H438Q468 332 468 306T438 271H86Q57 280 57 306'], - - // FULL STOP - 0x2E: [140,-1,525,193,332,'193 70Q193 105 214 122T258 140Q291 140 311 120T332 70Q332 44 314 23T262 1Q234 1 214 18T193 70'], - - // SOLIDUS - 0x2F: [694,83,525,58,466,'94 -83Q78 -83 68 -73T58 -48Q58 -44 60 -36Q62 -31 227 314T399 673Q410 694 431 694Q445 694 455 684T466 659Q466 656 464 648Q463 643 298 298T125 -62Q114 -83 94 -83'], - - // DIGIT ZERO - 0x30: [621,10,525,42,482,'42 305Q42 450 111 535T257 621Q335 621 390 562Q482 468 482 306Q482 174 418 82T262 -10T106 82T42 305ZM257 545Q209 545 168 481T126 320Q126 220 162 147Q204 65 262 65Q318 65 358 139T398 320V328Q395 411 364 470T284 543Q270 545 257 545'], - - // DIGIT ONE - 0x31: [622,-1,525,99,450,'99 461Q99 470 99 474T104 487T120 498T151 502Q213 517 251 596Q264 622 283 622Q308 622 319 597V76H373H401Q428 76 439 69T450 38Q450 11 428 1H127Q104 10 104 38Q104 62 115 69T153 76H181H235V269Q235 461 234 461Q184 426 137 424H133Q124 424 119 425T109 431T99 447V461'], - - // DIGIT TWO - 0x32: [622,-1,525,52,472,'52 462Q52 528 110 575T247 622H250Q343 622 407 565T472 421Q472 371 446 324T390 248T308 178Q307 177 275 151T214 101L185 77Q185 76 286 76H388V87Q388 105 397 114T430 123T463 114Q470 107 471 100T472 61V42Q472 24 468 16T450 1H75Q53 10 53 32V38V48Q53 57 63 67T127 122Q153 144 169 157L289 256Q388 345 388 419Q388 473 346 509T231 545H224Q176 545 146 499L144 494Q155 476 155 459Q154 459 155 455T154 444T148 430T136 417T114 408Q113 408 110 408T104 407Q80 407 66 422T52 462'], - - // DIGIT THREE - 0x33: [622,11,525,44,479,'260 546Q233 546 211 541T180 531T171 524L174 514Q177 505 177 497Q177 476 162 461T125 446Q106 446 90 459T73 504Q76 540 98 565T150 601T203 616T239 621Q241 622 265 622Q322 620 362 602T420 558T444 513T451 478Q451 386 369 329L375 326Q381 323 386 320T401 311T419 298T436 283T452 263T466 240T475 212T479 180Q479 99 416 44T259 -11T105 28T44 130Q44 154 59 168T95 183Q117 183 132 169T148 131Q148 119 139 101Q175 65 260 65Q316 65 355 97T395 179Q395 211 375 240Q336 292 253 292H234H215Q194 292 185 299T175 330Q175 350 184 359Q192 368 238 370T309 384Q336 398 351 423T367 474Q367 496 350 513Q321 546 260 546'], - - // DIGIT FOUR - 0x34: [623,-1,525,29,495,'235 1Q213 10 213 32V38V46Q213 65 230 73Q236 76 274 76H314V168H183L52 169Q37 175 33 182T29 205V218L30 244Q53 283 155 443T264 613Q276 623 298 623H323H363Q378 616 385 601V244H429H450Q474 244 484 237T495 206Q495 179 477 171Q471 168 429 168H385V76H425H442Q466 76 476 69T487 38Q487 10 465 1H235ZM314 244V554L117 245L215 244H314'], - - // DIGIT FIVE - 0x35: [612,10,525,52,472,'387 189Q387 244 354 278T273 313Q230 313 205 301T163 271T138 249H120Q102 249 97 251Q85 258 83 266T80 311Q80 320 80 359T81 430Q81 587 82 591Q88 605 103 610H108Q112 610 120 610T138 610T163 610T192 611T225 611T260 611H415Q416 610 421 607T428 602T432 596T436 587T437 573Q437 567 437 562T434 554T431 548T427 543T423 540T418 538L415 536L289 535H164V363L170 366Q175 368 184 372T207 380T238 386T276 389Q357 389 414 331T472 187Q472 116 412 53T245 -10Q218 -10 209 -9Q126 5 89 48T52 137Q52 164 68 177T104 191Q130 191 143 175T156 141Q156 132 154 125T149 113T146 107Q146 104 155 95T188 76T245 65Q298 65 342 98T387 189'], - - // DIGIT SIX - 0x36: [622,11,525,44,479,'357 536Q357 546 318 546Q258 546 205 497T133 357V353L144 361Q210 402 285 402Q362 402 414 350Q479 285 479 193Q479 111 418 50T263 -11Q234 -11 207 -3T149 26T97 81T60 171T45 301Q45 444 129 533T319 622Q388 622 421 589T454 510Q454 491 442 475T402 458Q373 458 362 475T350 510Q350 520 354 528L357 536ZM319 326T269 326T179 298T136 223Q136 202 143 174T176 112T237 68Q246 66 265 66Q319 66 360 107Q395 146 395 197Q395 250 356 289Q319 326 269 326'], - - // DIGIT SEVEN - 0x37: [627,10,525,44,480,'204 -10Q162 -10 162 40Q162 146 198 261T310 477Q311 478 321 491T342 517T358 535H128V524Q128 506 119 497Q111 489 86 489H78Q55 489 46 508Q44 513 44 557V580Q44 605 52 616T88 627H93Q114 627 125 611H458Q474 598 477 593T480 573Q480 559 478 553T469 543T446 521T408 477Q252 290 246 49Q246 43 246 37T246 27T245 22Q243 11 233 1T204 -10'], - - // DIGIT EIGHT - 0x38: [621,10,525,45,480,'58 460Q58 523 117 572T254 621Q290 621 298 620Q376 607 421 560T466 460Q466 441 460 424T443 393T421 370T397 352T374 340T357 332L350 330L356 328Q363 325 371 321T392 310T415 295T439 274T459 249T473 217T479 179Q479 102 418 46T262 -10T106 46T45 179Q45 202 52 222T70 257T96 284T123 305T148 319T167 328L174 330L170 332Q166 333 159 336T145 343Q104 362 81 393T58 460ZM382 458Q382 491 349 518T263 546Q215 546 179 521T142 458Q142 421 178 395T262 368Q315 368 348 396T382 458ZM396 178Q396 223 358 257T263 292Q206 292 167 258T128 178Q128 137 163 102T262 66Q324 66 360 101T396 178'], - - // DIGIT NINE - 0x39: [622,11,525,46,479,'392 259Q333 210 236 210H233Q163 210 109 262Q46 325 46 411T99 550Q164 622 264 622Q293 622 319 615T376 587T428 532T464 440T479 304Q479 167 400 78T217 -11Q140 -11 105 22T70 101Q70 124 84 138T122 153Q150 153 162 137T174 101Q174 91 168 76Q179 65 216 65Q267 65 300 93Q322 109 339 130T366 173T380 210T388 242T392 259ZM388 389Q388 438 357 492T268 546T185 520Q129 479 129 415Q129 384 138 363Q145 349 156 334T195 302T255 285Q305 285 345 313T388 389'], - - // COLON - 0x3A: [431,-1,525,193,332,'193 361Q193 396 214 413T258 431Q291 431 311 411T332 361Q332 335 314 314T262 292Q234 292 214 309T193 361ZM193 70Q193 105 214 122T258 140Q291 140 311 120T332 70Q332 44 314 23T262 1Q234 1 214 18T193 70'], - - // SEMICOLON - 0x3B: [431,139,525,175,337,'193 361Q193 396 214 413T258 431Q291 431 311 411T332 361Q332 335 314 314T262 292Q234 292 214 309T193 361ZM193 70Q193 105 214 122T259 140Q301 140 319 108T337 33Q337 -38 291 -88T214 -139Q203 -139 189 -126T175 -97Q175 -85 182 -78T200 -66T225 -50T249 -17Q256 -3 256 0Q252 1 248 1Q242 2 235 5T218 15T200 36T193 70'], - - // LESS-THAN SIGN - 0x3C: [557,-55,525,57,469,'468 90Q468 76 458 66T433 55Q426 55 419 58Q413 61 243 168T68 280Q57 291 57 306T68 332Q72 335 241 442T416 553Q424 557 432 557Q447 557 457 547T468 522T456 496Q454 494 305 399L158 306L305 213Q341 190 390 159Q443 125 452 119T464 106V105Q468 97 468 90'], - - // EQUALS SIGN - 0x3D: [417,-195,525,38,487,'38 382Q38 409 67 417H457Q487 408 487 382Q487 358 461 348H64Q51 352 45 360T38 376V382ZM67 195Q38 204 38 230Q38 255 62 264Q66 265 264 265H461L464 264Q467 262 469 261T475 256T481 249T485 240T487 230Q487 204 457 195H67'], - - // GREATER-THAN SIGN - 0x3E: [557,-55,525,57,468,'57 522Q57 539 67 548T90 557Q98 557 105 554Q111 551 281 444T456 332Q468 320 468 306T456 280Q452 276 282 169T105 58Q98 55 91 55Q79 55 68 63T57 90Q57 105 68 116Q70 118 219 213L366 306L219 399Q75 491 71 494Q57 507 57 522'], - - // QUESTION MARK - 0x3F: [617,1,525,62,462,'62 493Q62 540 107 578T253 617Q366 617 414 578T462 490Q462 459 445 434T411 400L394 390Q315 347 296 287Q294 278 293 247V217Q285 201 278 198T246 194T216 197T201 215V245V253Q201 379 351 456Q366 464 375 477Q377 482 377 490Q377 517 339 528T251 540Q182 540 159 517Q166 503 166 490Q166 468 151 453T114 438Q96 438 79 451T62 493ZM190 58Q190 85 208 100T249 115Q272 113 288 99T304 58Q304 33 287 17T246 0T206 16T190 58'], - - // COMMERCIAL AT - 0x40: [617,6,525,44,481,'44 306Q44 445 125 531T302 617Q332 617 358 607T411 574T456 502T479 387Q481 361 481 321Q481 203 421 143Q381 103 332 103Q266 103 225 165T183 307Q183 390 227 449T332 508Q358 508 378 498Q350 541 304 541Q229 541 172 473T115 305Q115 208 171 140T306 71H310Q358 71 397 105Q409 115 436 115Q458 115 462 113Q481 106 481 86Q481 73 468 61Q401 -6 305 -6Q262 -6 217 14T133 71T69 170T44 306ZM410 306Q410 361 386 396T333 431Q300 431 277 394T254 305Q254 256 276 218T332 180Q364 180 387 217T410 306'], - - // LATIN CAPITAL LETTER A - 0x41: [623,-1,525,28,496,'191 76Q212 75 220 68T229 38Q229 10 208 1H129H80Q48 1 38 7T28 38Q28 51 29 57T40 69T70 76Q89 76 89 78Q90 79 117 205T173 461T205 599Q212 623 250 623H262H273Q312 623 319 599Q322 591 350 461T406 205T435 78Q435 76 454 76H458Q484 76 493 59Q496 53 496 38Q496 11 478 3Q474 1 395 1H317Q295 8 295 38Q295 65 311 73Q316 75 333 76L348 77V78Q348 80 341 112L334 143H190L183 112Q176 80 176 78Q175 76 178 76Q180 76 191 76ZM318 221Q313 238 288 366T263 519Q263 526 262 527Q261 527 261 520Q261 493 236 365T206 221Q206 219 262 219T318 221'], - - // LATIN CAPITAL LETTER B - 0x42: [611,-1,525,17,482,'39 1Q17 10 17 32V38V46Q17 65 34 73Q40 76 61 76H84V535H61H54Q27 535 19 553Q17 557 17 573Q17 583 17 587T23 599T39 610Q40 611 179 611Q320 610 332 607Q332 607 339 605Q394 591 427 547T461 454Q461 413 436 378T369 325L358 320Q405 311 443 270T482 169Q482 112 445 64T345 3L334 1H39ZM309 533Q302 535 234 535H168V356H230Q284 357 296 358T323 368Q346 380 361 402T377 452Q377 482 358 505T309 533ZM398 176Q396 218 371 246T315 279Q310 280 237 280H168V76H239Q316 77 327 81Q329 82 334 84Q398 107 398 176'], - - // LATIN CAPITAL LETTER C - 0x43: [622,11,525,40,485,'40 305Q40 437 110 529T281 622Q315 622 343 611T387 589T404 578Q409 585 415 596T425 611T435 618T452 622Q472 622 478 609T485 566Q485 559 485 540T484 508V460Q484 413 478 403T442 393Q417 393 409 402Q400 409 400 420Q400 428 395 445T380 487T347 528T295 546Q235 546 180 483T124 306Q124 245 141 197T186 121T241 80T296 66Q346 66 373 103T400 178Q400 209 435 209H442H450Q484 209 484 172Q480 96 421 43T281 -11Q177 -11 109 84T40 305'], - - // LATIN CAPITAL LETTER D - 0x44: [612,-1,525,16,485,'38 1Q16 8 16 38Q16 62 32 73Q39 76 58 76H78V535H58Q40 535 32 538Q16 548 16 573Q16 587 17 591Q23 604 34 607T83 611H166H176Q188 611 209 611T239 612Q299 612 337 597T415 530Q485 438 485 300Q485 180 431 100T301 3L291 1H38ZM400 301Q400 363 385 410T346 482T303 519T267 534Q261 535 210 535H162V76H214L267 77Q323 89 361 148T400 301'], - - // LATIN CAPITAL LETTER E - 0x45: [612,-1,525,18,502,'374 271Q374 241 367 232T332 223Q307 223 299 231Q290 240 290 263V279H173V76H418V118V144Q418 167 426 176T460 186Q491 186 500 166Q502 161 502 93V52Q502 25 499 17T480 1H41Q19 9 19 32V38Q19 63 36 73Q42 76 65 76H89V535H65H55Q44 535 38 537T25 548T19 573Q19 602 41 610H47Q53 610 63 610T88 610T121 610T160 611T204 611T251 611H458Q460 609 465 606T471 602T475 598T478 593T479 586T480 576T480 562V526V488Q480 452 462 444Q458 442 438 442Q413 442 405 450Q398 457 397 463T396 501V535H173V355H290V371Q290 394 299 403T332 412Q363 412 372 392Q374 387 374 317V271'], - - // LATIN CAPITAL LETTER F - 0x46: [612,-1,525,22,490,'384 260Q384 230 377 221T342 212Q317 212 309 220Q300 229 300 252V268H179V76H249Q264 67 267 61T271 38Q271 10 249 1H44Q22 9 22 32V38Q22 63 39 73Q45 76 69 76H95V535H69H59Q42 535 32 542T22 573Q22 602 44 610H50Q56 610 66 610T91 610T125 610T164 611T208 611T257 611H468Q470 609 475 606T481 602T485 598T488 593T489 586T490 576T490 562V526V488Q490 452 472 444Q468 442 448 442Q423 442 415 450Q408 457 407 463T406 501V535H179V344H300V360Q300 383 309 392T342 401Q373 401 382 381Q384 376 384 306V260'], - - // LATIN CAPITAL LETTER G - 0x47: [623,11,525,38,496,'38 306Q38 447 105 534T261 622Q280 622 298 618T329 608T350 596T366 585L371 581Q373 581 377 591T390 612T417 622Q437 622 443 609T450 566Q450 559 450 540T449 508V460Q449 413 443 403T407 393Q392 393 386 394T373 402T364 426Q360 472 335 509T271 546Q214 546 168 477T121 308Q121 210 164 138T271 65Q293 65 310 78T337 109T352 147T360 180T362 195Q362 196 333 196L304 197Q282 204 282 227V234Q282 247 282 251T288 261T304 272H474Q488 263 492 256T496 234Q496 211 479 199Q475 197 461 196H449V21Q441 6 434 3T412 -1H407H402Q385 -1 379 3T364 28Q350 14 322 2T260 -11Q173 -11 106 76T38 306'], - - // LATIN CAPITAL LETTER H - 0x48: [611,-1,525,16,508,'16 571Q16 597 27 604T74 611H125H208Q223 602 226 596T230 573Q230 559 227 551T217 540T204 536T186 535H165V356H359V535H338H333Q306 535 297 552Q295 556 295 573Q295 586 295 590T301 600T317 611H486Q501 602 504 596T508 573Q508 559 505 551T495 540T482 536T464 535H443V76H464H470Q482 76 489 75T502 64T508 38Q508 10 486 1H317Q306 5 301 11T296 21T295 38V44Q295 66 311 73Q318 76 338 76H359V280H165V76H186H192Q204 76 211 75T224 64T230 38Q230 10 208 1H39Q28 5 23 11T18 21T17 38V44Q17 66 33 73Q40 76 60 76H81V535H60Q45 535 38 536T24 545T16 571'], - - // LATIN CAPITAL LETTER I - 0x49: [611,-1,525,72,452,'400 76Q431 76 441 69T452 38Q452 29 452 26T450 18T443 9T430 1H95Q84 6 79 12T73 23T72 38Q72 65 90 73Q96 76 157 76H220V535H157H124Q93 535 83 542T72 573Q72 603 93 610Q97 611 264 611H430Q432 609 436 607T444 602T449 594Q452 588 452 573Q452 546 434 538Q428 535 367 535H304V76H367H400'], - - // LATIN CAPITAL LETTER J - 0x4A: [612,11,525,57,479,'202 543T202 573T224 610H228Q231 610 237 610T251 610T269 610T291 611T315 611T342 611H457Q471 602 475 595T479 573Q479 549 462 538Q454 535 432 535H408V328Q408 159 408 133T402 93Q386 48 340 19T229 -11Q158 -11 108 16T57 100Q57 129 73 141T108 154Q128 154 143 140T159 102Q159 93 155 79Q188 65 228 65H230Q290 65 318 106Q323 115 323 139T324 329V535H274L224 536Q202 543 202 573'], - - // LATIN CAPITAL LETTER K - 0x4B: [611,-1,525,18,495,'18 549T18 573T29 604T70 611H118H193Q207 603 210 596T214 573Q214 549 198 538Q191 535 172 535H152V421Q152 344 152 326T153 309L242 422L329 534Q327 535 322 536T314 538T308 542T303 548T300 558T298 573Q298 600 316 608Q322 611 392 611H463Q477 602 481 595T485 573Q485 535 446 535H441H420L281 357L436 77L454 76Q473 75 478 73Q495 62 495 38Q495 10 473 1H345Q334 5 329 11T324 21T323 38Q323 51 324 56T332 68T355 77L233 296L152 192V76H172Q191 76 198 73Q214 63 214 38Q214 9 193 1H41Q18 8 18 38Q18 61 35 73Q42 76 61 76H81V535H61Q42 535 35 538Q18 549 18 573'], - - // LATIN CAPITAL LETTER L - 0x4C: [611,0,525,25,488,'27 594Q34 605 43 608T84 611H154H213Q258 611 269 605T281 573Q281 546 263 538Q257 535 222 535H185V76H404V118V145Q404 168 411 177T446 186H453Q478 186 486 167Q488 161 488 93V50Q488 24 485 17T466 1L258 0H147H99Q47 0 36 6T25 38Q25 59 35 69Q44 76 76 76H101V535H76H64Q36 535 27 552Q25 557 25 573T27 594'], - - // LATIN CAPITAL LETTER M - 0x4D: [611,-1,525,11,512,'50 535Q37 536 31 537T18 547T12 573Q12 598 22 604T62 611H91H121Q147 611 158 607T178 587Q183 579 222 446T261 293Q261 289 262 288Q263 288 263 292Q263 311 298 434T346 588Q353 603 365 607T402 611H435H450Q488 611 500 605T512 573Q512 556 506 547T493 537T474 535H459V76H474Q487 75 493 74T505 64T512 38Q512 11 494 3Q490 1 424 1H386Q355 1 345 7T335 38Q335 55 341 64T354 74T373 76H388V302Q388 512 387 519Q382 482 346 359T304 228Q292 204 262 204T220 228Q215 237 179 359T137 519Q136 512 136 302V76H151Q164 75 170 74T182 64T189 38Q189 11 171 3Q167 1 101 1H63Q32 1 22 7T12 38Q12 55 18 64T31 74T50 76H65V535H50'], - - // LATIN CAPITAL LETTER N - 0x4E: [611,0,525,20,504,'20 571Q20 598 30 604T73 611H105H136Q152 611 160 611T177 607T189 601T198 587T206 568T217 537T231 497Q354 142 365 95L368 84V535H347H342Q314 535 306 552Q304 556 304 573Q304 586 304 590T310 600T326 611H482Q497 602 500 596T504 573Q504 559 501 551T491 540T478 536T460 535H439V25Q432 7 424 4T389 0H374Q334 0 322 31L293 115Q171 468 159 517L156 528V76H177H183Q195 76 202 75T215 64T221 38Q221 10 199 1H43Q32 5 27 11T22 21T21 38V44Q21 66 37 73Q44 76 64 76H85V535H64Q49 535 42 536T28 545T20 571'], - - // LATIN CAPITAL LETTER O - 0x4F: [621,10,525,56,468,'102 588Q140 621 240 621Q323 621 335 620Q393 613 422 588Q450 560 459 493T468 306Q468 185 460 118T422 23Q382 -10 289 -10H262H235Q142 -10 102 23Q74 50 65 118T56 306Q56 427 64 494T102 588ZM363 513Q357 523 347 530T324 540T302 544T280 546H268Q192 546 167 521Q150 501 145 452T140 300Q140 235 142 197T151 130T172 89T207 71T262 65Q317 65 341 81T374 144T384 300Q384 474 363 513'], - - // LATIN CAPITAL LETTER P - 0x50: [612,-1,525,19,480,'41 1Q19 9 19 32V38Q19 63 36 73Q42 76 65 76H89V535H65H55Q38 535 29 543T19 576Q19 603 41 610H49Q57 610 70 610T100 610T136 611T175 611Q190 611 216 611T255 612Q321 612 363 598T441 537Q480 486 480 427V421Q480 354 447 311T378 251Q339 230 275 230H239H173V76H197Q220 76 227 73Q244 62 244 38Q244 10 222 1H41ZM396 421Q396 461 369 491T300 533Q294 534 233 535H173V306H233Q294 307 300 308Q345 319 370 352T396 421'], - - // LATIN CAPITAL LETTER Q - 0x51: [622,138,525,56,468,'56 306Q56 380 58 426T68 510T87 568T120 600T170 617T240 621Q323 621 335 620Q393 613 422 588Q450 560 459 493T468 306Q468 124 447 66Q433 23 394 6L424 -53Q454 -112 454 -118Q454 -128 441 -138H377Q367 -135 363 -129T333 -69L304 -11H254Q205 -10 180 -8T128 6T91 36T70 92T58 178T56 306ZM227 151Q227 171 262 171H276H281Q292 171 296 171T305 170T313 165T317 158T323 145T332 127L353 88Q356 88 361 95T372 131T382 202Q384 228 384 306Q384 452 371 492T304 544Q296 545 251 545Q230 545 215 543T188 534T169 520T155 497T147 466T143 423T141 371T140 306Q140 248 141 217T146 154T157 109T178 83T212 68T262 65H266L264 70Q261 75 256 85T247 105Q227 145 227 151'], - - // LATIN CAPITAL LETTER R - 0x52: [612,11,525,16,522,'16 571Q16 598 27 605T76 612Q84 612 108 612T148 611Q268 611 294 605Q346 592 389 550T432 440Q432 394 410 359Q393 329 366 310L358 303Q387 273 399 239Q405 219 405 178T408 106T421 68Q426 65 428 65Q433 65 435 74T438 96T441 112Q450 130 480 130H485Q519 130 522 100Q522 79 516 56T488 11T434 -11Q421 -11 408 -8T377 5T344 37T324 93Q322 101 322 154L321 209Q304 257 257 267Q252 268 207 268H165V76H186H192Q204 76 211 75T224 64T230 38Q230 10 208 1H39Q28 5 23 11T18 21T17 38V44Q17 66 33 73Q40 76 60 76H81V535H60Q45 535 38 536T24 545T16 571ZM348 440Q348 478 321 502T260 532Q252 534 208 535H165V344H208Q212 344 223 344T239 345T252 346T266 348T278 351T293 358Q348 387 348 440'], - - // LATIN CAPITAL LETTER S - 0x53: [622,11,525,51,472,'52 454Q52 524 107 572T229 621Q266 621 274 620Q326 610 360 588L371 581Q377 594 379 598T386 610T397 619T412 622Q433 622 439 610T446 570Q446 563 446 545T445 515V479Q445 441 444 432T436 417Q428 408 403 408T370 417Q361 424 361 434Q361 439 360 448T351 476T331 509T295 535T238 546Q194 546 163 522T132 458Q132 435 148 412Q155 401 166 393T192 380T218 371T247 364T270 359Q341 342 349 339Q389 325 418 296T461 229Q472 201 472 164Q469 92 417 41T287 -11Q240 -11 200 -1T143 19L126 29Q117 6 109 -2Q100 -11 84 -11Q64 -11 58 1T51 42Q51 49 51 66T52 95V135Q52 173 53 180T61 194Q70 203 95 203Q119 203 127 194Q136 186 136 168Q143 66 284 66H290Q325 66 350 85Q391 115 391 165Q391 204 369 228T322 260Q320 260 255 275T185 293Q123 309 88 355T52 454'], - - // LATIN CAPITAL LETTER T - 0x54: [612,-1,525,26,498,'129 38Q129 51 129 55T135 65T151 76H220V535H110V501Q110 470 109 464T101 450Q93 442 68 442H60Q37 442 28 461Q26 466 26 527L27 589Q36 607 49 610H55Q61 610 72 610T97 610T131 610T170 611T215 611T264 611H476Q478 609 483 606T489 602T493 598T496 593T497 586T498 576T498 562V526V488Q498 452 480 444Q476 442 456 442Q431 442 423 450Q416 457 415 463T414 501V535H304V76H374Q389 67 392 61T396 38Q396 10 374 1H151Q140 5 135 11T130 21T129 38'], - - // LATIN CAPITAL LETTER U - 0x55: [612,11,525,-4,528,'-3 573Q-3 597 8 604T50 612Q57 612 77 612T111 611H200Q214 602 218 595T222 573Q222 549 205 538Q198 535 175 535H151V359Q151 333 151 291Q152 177 156 162Q157 160 157 159Q165 123 193 95T262 66Q303 66 330 94T367 159Q371 175 371 191T373 359V535H349H339Q328 535 322 537T309 548T303 573T306 595T325 611H506Q520 602 524 595T528 573Q528 549 511 538Q504 535 481 535H457V364Q457 189 456 182Q448 101 394 45T262 -11Q189 -11 132 43T68 182Q67 189 67 364V535H43H33Q22 535 16 537T3 548T-3 573'], - - // LATIN CAPITAL LETTER V - 0x56: [613,7,525,19,505,'19 578Q19 585 20 590T23 598T29 604T38 608T48 610T62 611T78 612T97 611T119 611H195Q210 602 213 596T217 573Q217 561 216 555T206 542T179 535H164Q166 529 188 435T235 231T261 94L262 84V88Q263 91 263 94Q265 121 289 231T336 438L360 535H345Q308 535 308 566V573Q308 586 308 590T314 600T330 611H484Q499 602 502 595T505 573Q505 560 504 554T493 541T465 535H447L384 278Q321 19 319 14Q309 -7 278 -7H262H246Q215 -7 205 14Q203 19 140 278L78 535H59Q45 535 38 536T25 547T19 573V578'], - - // LATIN CAPITAL LETTER W - 0x57: [611,7,525,12,512,'459 611Q491 611 501 605T512 573Q512 538 482 535H474L439 276Q406 26 402 11Q398 2 389 -3Q387 -3 386 -4L380 -7H359H349Q324 -7 313 13Q307 29 285 139T263 275Q263 283 262 283Q261 282 261 274Q261 248 239 137T211 13Q200 -7 175 -7H165H144Q136 -3 127 3Q121 10 117 36T85 276L50 535H42Q26 536 19 545T12 564V573Q12 603 33 610Q37 611 101 611H134Q165 611 175 604T186 573Q186 563 186 559T182 547T169 538T143 535H122V531Q124 517 133 446T155 266T172 96V84L173 102Q176 157 192 243T215 346Q227 367 259 367H262H265Q297 367 309 346Q316 329 332 243T351 102L352 84V96Q356 161 368 266T390 444T402 531V535H381Q366 535 359 536T345 547T338 573Q338 600 356 608Q362 611 425 611H459'], - - // LATIN CAPITAL LETTER X - 0x58: [611,-1,525,28,495,'39 571Q39 597 49 604T93 611H141H218Q233 602 236 595T239 573Q239 538 210 535Q202 535 202 534T215 507T243 454L257 428L307 535H298Q266 538 266 573Q266 584 267 588T273 598T289 611H366H401Q442 611 454 605T466 573Q466 546 448 538Q442 535 421 535H398L299 327Q299 323 362 201L426 77L449 76Q467 76 475 75T489 65T495 38Q495 11 477 3Q473 1 395 1H317Q295 8 295 38Q295 73 325 76L334 77Q333 78 314 117T276 196L257 235L239 196Q221 157 204 118T186 77Q190 76 196 76Q211 74 218 67T227 55T228 38Q228 28 227 24T221 13T206 1H50Q28 9 28 32V38Q28 63 45 73Q51 76 73 76H96L214 324Q215 327 162 431L108 535H85H79Q67 535 60 536T46 546T39 571'], - - // LATIN CAPITAL LETTER Y - 0x59: [611,-1,525,20,505,'20 573Q20 597 30 604T72 611H121H198Q212 602 216 595T220 573Q220 568 219 563T217 555T214 549T211 544T207 541T203 538T198 537T194 536T190 536L188 535Q179 535 179 534L188 516Q196 497 208 470T232 415T252 363T261 332Q261 329 262 329T263 332Q263 354 333 508L345 534Q345 535 336 535Q305 538 305 567V573Q305 589 308 595T327 611H483Q505 598 505 573Q505 549 488 538Q481 535 460 535H438L304 245V76H325H331Q343 76 350 75T363 64T369 38Q369 10 347 1H178Q167 5 162 11T157 21T156 38V44Q156 66 172 73Q180 76 199 76H220V245L86 535H64Q44 535 36 538Q20 548 20 573'], - - // LATIN CAPITAL LETTER Z - 0x5A: [612,-1,525,48,481,'71 1Q60 5 55 11T49 23T48 39V46Q48 56 58 73T131 183Q171 242 197 282L366 535H144V501Q144 470 143 464T135 450Q127 442 102 442H94Q71 442 62 461Q60 466 60 527L61 589Q70 607 83 610H88Q93 610 102 610T124 610T154 610T188 611T227 611T270 611H454Q456 609 461 606T467 601T471 597T474 591T475 584T476 572V565Q476 555 466 538T393 428Q353 369 327 329L158 76H397V120V146Q397 169 405 179T439 189Q470 189 479 169Q481 164 481 95V48Q481 24 478 16T459 1H71'], - - // LEFT SQUARE BRACKET - 0x5B: [694,82,525,214,484,'237 -82Q221 -78 214 -58V305Q214 669 216 673Q220 687 231 690T278 694H350H461Q462 693 467 690T474 685T478 679T482 670T483 656Q483 632 471 625T428 617Q422 617 406 617T379 618H298V-7H379H420Q459 -7 471 -13T483 -45Q483 -55 483 -59T477 -70T461 -82H237'], - - // REVERSE SOLIDUS - 0x5C: [694,83,525,58,466,'58 659Q58 673 68 683T93 694Q114 694 125 673Q132 659 297 314T464 -36Q466 -44 466 -48Q466 -66 454 -74T431 -83Q410 -83 399 -62Q391 -47 226 298T60 648Q58 656 58 659'], - - // RIGHT SQUARE BRACKET - 0x5D: [695,82,525,41,310,'41 656Q41 681 53 688T99 695Q107 695 133 695T177 694H288Q307 681 310 669V-58Q303 -76 288 -82H64Q41 -73 41 -45Q41 -21 53 -14T96 -6Q102 -6 118 -6T145 -7H226V618H145H100Q67 618 54 625T41 656'], - - // CIRCUMFLEX ACCENT - 0x5E: [611,-460,525,96,428,'138 460Q121 460 109 479T96 512Q96 527 106 534Q109 536 178 571T253 609Q256 611 264 611Q272 610 343 574Q357 567 369 561T389 550T402 543T411 538T416 535T420 532T422 529T425 525Q428 518 428 512Q428 498 416 479T386 460H384Q377 460 316 496L262 526L208 496Q147 460 138 460'], - - // LOW LINE - 0x5F: [-25,95,525,57,468,'57 -60Q57 -33 86 -25H438Q468 -34 468 -60T438 -95H86Q57 -86 57 -60'], - - // GRAVE ACCENT - 0x60: [681,-357,525,176,350,'176 479Q176 563 227 622T310 681Q324 680 337 667T350 641Q350 627 340 619T312 599T280 566Q256 531 252 485V471Q261 472 262 472Q285 472 302 455T320 414Q320 389 303 373T261 357Q223 357 200 391T176 479'], - - // LATIN SMALL LETTER A - 0x61: [439,6,525,48,524,'126 306Q105 306 90 321T74 359Q74 439 211 439Q268 439 276 438Q343 426 383 390T430 306Q431 301 431 190V81Q446 79 465 78T492 76T509 72T521 60T524 38Q524 11 506 3Q502 1 466 1Q426 1 406 5T379 14T355 36L345 30Q284 -6 205 -6Q135 -6 92 39T48 141Q48 182 79 212T158 256T252 278T342 285H347V290Q347 315 325 335T267 362Q258 363 224 363Q189 363 185 362H179L178 358Q178 353 178 352T176 345T174 337T170 330T165 322T158 316T150 311T139 308T126 306ZM132 140Q132 115 157 93T224 70Q269 70 302 87T344 133Q346 139 347 175V211H339Q256 209 194 190T132 140'], - - // LATIN SMALL LETTER B - 0x62: [611,6,525,4,492,'4 573Q4 596 15 603T52 611H90H124Q146 611 155 608T171 591Q173 586 173 491V396L182 402Q217 424 256 431Q280 437 309 437Q376 437 434 379T492 217Q492 162 473 118T422 47T358 8T293 -6Q229 -6 174 38Q171 13 163 7T135 1H131H122Q99 1 90 23L89 279V535H58L27 536Q4 543 4 573ZM409 215Q409 269 377 315T283 361Q255 361 224 344T177 297L173 290V167Q189 124 213 97T278 70Q330 70 369 111T409 215'], - - // LATIN SMALL LETTER C - 0x63: [440,6,525,66,466,'291 -6Q196 -6 131 60T66 216Q66 296 119 361Q154 403 200 421T273 439Q275 440 293 440H313Q400 440 433 409Q454 388 454 359Q454 335 439 321T402 306Q380 306 365 321T350 357V362L340 363Q339 363 326 363T303 364Q280 364 266 362Q217 352 184 313T151 215Q151 153 199 112T313 70Q341 70 357 85T381 118T394 140Q402 146 424 146Q443 146 447 144Q466 137 466 117Q466 106 457 88T429 47T374 10T291 -6'], - - // LATIN SMALL LETTER D - 0x64: [611,6,525,31,520,'266 573Q266 596 277 603T314 611H352H385Q411 611 419 607T435 586V76H498Q512 67 516 60T520 38Q520 9 498 1H436Q429 1 417 1T398 0Q375 0 363 7T351 34V43L342 36Q288 -6 223 -6Q143 -6 87 58T31 216Q31 307 88 372T230 437Q292 437 342 405L351 399V535H320L289 536Q266 543 266 573ZM351 290Q347 302 337 316T302 346T244 361Q193 361 154 319T115 215Q115 152 152 111T235 70Q314 70 351 170V290'], - - // LATIN SMALL LETTER E - 0x65: [440,6,525,48,465,'48 217Q48 295 100 361T248 439L258 440Q268 440 274 440Q329 438 369 416T428 359T456 292T464 228Q464 215 461 208T454 198T442 190L288 189H135L138 179Q153 132 199 102T303 71Q336 71 353 86T380 120T398 143Q404 146 422 146Q453 146 462 126Q464 120 464 116Q464 84 416 39T285 -6Q187 -6 118 59T48 217ZM377 264Q371 291 365 306T341 338T294 362Q288 363 264 363Q225 363 190 336T139 264H377'], - - // LATIN SMALL LETTER F - 0x66: [617,-1,525,35,437,'43 395Q44 405 44 408T47 416T53 423T66 431H176V461Q176 500 182 518Q201 570 252 593T353 617Q399 614 418 593T437 548Q437 528 424 514T387 499Q365 499 353 511T338 537V541H328Q275 536 261 494Q260 490 260 460V431H327Q334 431 346 431T364 432Q392 432 404 425T416 393T405 362T365 355H327H260V76H319Q375 76 388 71T401 38Q401 27 400 23T395 12T379 1H58Q47 6 42 12T36 23T35 38Q35 65 53 73Q59 76 117 76H176V355H121H93Q64 355 54 362T43 395'], - - // LATIN SMALL LETTER G - 0x67: [442,229,525,28,510,'60 274Q60 337 107 386T233 436Q278 436 316 417L329 410L338 416Q384 442 427 442T489 423T509 381T494 345T460 332Q449 332 440 338Q432 341 427 348T419 360T415 365Q414 364 410 364L383 355Q406 320 406 274Q406 211 358 162T233 112Q189 112 155 128L146 133Q142 125 142 115Q142 99 150 85T175 71Q182 72 187 70Q188 70 195 70T218 70T254 69Q259 69 275 69T297 69T318 68T340 66T361 62T384 57T405 49T428 38Q495 -1 495 -76Q495 -143 427 -186T262 -229Q161 -229 94 -185T29 -73Q30 -60 33 -48T39 -26T47 -8T57 8T67 20T77 30T86 38L91 43Q91 44 86 53T75 80T70 117Q70 142 89 183L83 194Q60 232 60 274ZM321 274Q321 312 296 337T230 362Q197 362 171 338T145 274Q145 235 170 211T233 187Q273 187 297 212T321 274ZM422 -78Q422 -54 408 -38T366 -15T315 -6T255 -4H200Q198 -4 193 -4T183 -3Q148 -3 125 -26T102 -78Q102 -110 151 -132T261 -154Q321 -154 371 -132T422 -78'], - - // LATIN SMALL LETTER H - 0x68: [611,-1,525,4,520,'4 573Q4 596 15 603T52 611H90H124Q146 611 155 608T171 591Q173 586 173 489Q173 394 175 394L186 402Q197 410 219 420T269 434Q278 436 306 436Q343 436 371 423Q411 402 423 365T436 265Q436 257 436 239T435 211V198V76H498Q512 67 516 60T520 38Q520 9 498 1H308Q286 10 286 32V38V46Q286 65 303 73Q309 76 329 76H351V188Q351 204 351 230T352 266Q352 321 341 341T288 361Q253 361 222 341T176 274L174 264L173 170V76H236Q250 67 254 60T258 38Q258 9 236 1H27Q4 8 4 38Q4 53 8 60T27 76H89V535H58L27 536Q4 543 4 573'], - - // LATIN SMALL LETTER I - 0x69: [612,-1,525,72,462,'202 538T202 559T218 596T260 612Q283 612 300 597T317 560Q317 538 300 523T260 507Q235 507 219 522ZM411 76Q441 76 451 69T462 38Q462 29 462 26T460 18T453 9T440 1H94Q72 8 72 33V38Q72 46 72 49T74 58T81 68T94 76H233V355H167L102 356Q80 363 80 393Q80 418 91 425T138 432Q145 432 165 432T200 431H295Q297 429 303 425T310 420T314 415T317 404T317 389T318 363Q318 354 318 314T317 241V76H378H411'], - - // LATIN SMALL LETTER J - 0x6A: [612,228,525,48,377,'261 559Q261 580 277 596T319 612Q342 612 359 597T376 560T360 523T320 507Q296 507 279 523T261 559ZM75 -91T100 -91T138 -107T152 -144V-150L160 -151H193H203Q241 -151 267 -121Q284 -97 288 -73T292 23V151V355H218L145 356Q123 365 123 387V393Q123 422 145 430H148Q151 430 156 430T169 430T185 430T205 431T227 431T251 431H354Q356 430 360 427T365 424T369 420T372 416T373 410T375 402T376 391T377 376T377 356Q377 345 377 286T376 176Q376 -67 371 -88Q362 -123 342 -151T299 -194Q254 -228 180 -228Q84 -226 56 -177Q49 -162 48 -148Q48 -122 61 -107'], - - // LATIN SMALL LETTER K - 0x6B: [611,0,525,13,507,'13 42Q13 63 23 69T69 76H102V535H69H54Q34 535 24 542T13 573Q13 588 15 593Q22 605 29 608T56 611H95Q113 611 122 611T140 610T152 609T159 607T163 603T167 597T173 589V413L174 237L295 355H275Q260 355 253 356T239 367T232 393Q232 419 243 425T304 431H359H464Q479 422 482 415T485 393Q485 364 464 356L431 355H398L293 254L427 76H486Q501 67 504 60T507 38Q507 28 507 24T501 12T486 1H314Q292 8 292 38Q292 62 308 73Q312 75 326 76L338 77L290 140Q279 154 267 171T248 196L242 204L207 171L173 139V76H206H221Q241 76 251 69T262 38Q262 11 244 3Q240 1 138 1Q123 1 100 1T70 0Q32 0 23 7T13 42'], - - // LATIN SMALL LETTER L - 0x6C: [612,-1,525,51,474,'51 573Q51 602 73 610H76Q79 610 84 610T97 610T113 610T133 611T155 611T179 611H282Q301 598 304 586V76H452Q466 67 470 60T474 38Q474 10 452 1H73Q51 9 51 32V38Q51 54 54 60T73 76H220V535H146L73 536Q51 545 51 567V573'], - - // LATIN SMALL LETTER M - 0x6D: [437,-1,525,-12,536,'133 76Q156 74 164 67T172 38Q172 9 151 1H11Q-12 8 -12 38Q-12 61 5 73Q10 75 28 76H45V355H28Q10 356 5 358Q-12 370 -12 393Q-12 419 11 431H52H70Q91 431 100 427T116 405Q163 436 200 436Q255 436 281 390L285 394Q289 398 292 400T301 407T314 415T329 423T346 429T366 434T389 436H392Q425 436 448 411Q469 390 474 360T480 268V232V203V76H497Q520 74 528 67T536 38Q536 9 515 1H396Q374 9 374 32V38Q374 73 402 76H409V191V242Q409 317 404 339T375 361Q343 361 323 332T299 264Q298 258 298 165V76H315Q338 74 346 67T354 38Q354 9 333 1H214Q192 9 192 32V38Q192 73 220 76H227V191V242Q227 317 222 339T193 361Q161 361 141 332T117 264Q116 258 116 165V76H133'], - - // LATIN SMALL LETTER N - 0x6E: [436,-1,525,4,520,'89 431Q94 431 105 431T122 432Q173 432 173 399Q173 394 175 394Q176 394 190 404T233 425T298 436Q343 436 371 423Q411 402 423 365T436 265Q436 257 436 239T435 211V198V76H498Q512 67 516 60T520 38Q520 9 498 1H308Q286 9 286 32V38V45Q286 65 303 73Q309 76 329 76H351V188Q351 204 351 230T352 266Q352 321 341 341T288 361Q253 361 222 341T176 274L174 264L173 170V76H236Q250 67 254 60T258 38Q258 9 236 1H27Q4 8 4 38Q4 53 8 60T27 76H89V355H58L27 356Q4 363 4 393Q4 408 8 415T27 431H89'], - - // LATIN SMALL LETTER O - 0x6F: [440,6,525,52,472,'52 216Q52 318 118 379T261 440Q343 440 407 378T472 216Q472 121 410 58T262 -6Q176 -6 114 58T52 216ZM388 225Q388 281 351 322T261 364Q213 364 175 325T136 225Q136 158 174 114T262 70T350 114T388 225'], - - // LATIN SMALL LETTER P - 0x70: [437,221,525,4,492,'89 431Q93 431 104 431T121 432Q173 432 173 401V396L182 402Q237 437 305 437Q376 437 434 378T492 217Q492 146 459 93T382 17T291 -6Q261 -6 232 5T188 26L174 37Q173 37 173 -54V-146H236Q250 -155 254 -162T258 -184Q258 -213 236 -221H27Q4 -214 4 -184Q4 -169 8 -162T27 -146H89V355H58L27 356Q4 363 4 393Q4 408 8 415T27 431H89ZM409 215Q409 269 377 315T283 361Q255 361 224 344T177 297L173 290V167Q189 124 213 97T278 70Q330 70 369 111T409 215'], - - // LATIN SMALL LETTER Q - 0x71: [437,222,525,34,545,'34 215Q34 309 91 368T222 436Q224 436 231 436T242 437Q309 437 372 390V401Q372 419 381 428T414 437Q426 437 432 436T444 430T456 412V-146H489H504Q524 -146 534 -153T545 -184Q545 -211 527 -219Q523 -221 414 -221Q398 -221 374 -221T342 -222Q304 -222 294 -216T283 -184Q283 -157 301 -149Q307 -146 339 -146H372V-51Q372 43 371 43L364 38Q357 33 345 26T318 12T280 -1T236 -6Q155 -6 95 55T34 215ZM117 215Q117 152 157 111T250 70Q289 70 318 92T363 146Q372 163 372 192V215L371 263Q339 360 254 360Q206 360 162 321T117 215'], - - // LATIN SMALL LETTER R - 0x72: [437,-1,525,24,487,'327 76Q359 76 369 70T380 38Q380 10 359 1H47Q24 8 24 38Q24 54 28 61T47 76H145V355H96L47 356Q24 363 24 393Q24 409 28 416T47 431H207Q223 419 226 414T229 393V387V369Q297 437 394 437Q436 437 461 417T487 368Q487 347 473 332T438 317Q428 317 420 320T407 327T398 337T393 347T390 356L388 361Q348 356 324 345Q228 299 228 170Q228 161 228 151T229 138V76H293H327'], - - // LATIN SMALL LETTER S - 0x73: [440,6,525,71,458,'72 317Q72 361 108 396T229 439Q231 439 245 439T268 440Q303 439 324 435T353 427T363 423L372 432Q380 440 397 440Q430 440 430 395Q430 390 430 380T429 366V335Q429 311 422 302T387 293Q364 293 355 300T346 316T343 336T325 353Q306 364 257 364Q209 364 178 351T147 317Q147 284 231 272Q327 256 357 247Q458 210 458 129V121Q458 74 413 34T271 -6Q246 -6 224 -3T189 5T165 14T150 22T144 26Q142 23 139 18T135 11T132 6T128 1T124 -2T119 -4T113 -5T104 -6Q84 -6 78 6T71 43Q71 48 71 60T72 79Q72 132 73 141T81 157Q90 166 115 166Q135 166 142 162T157 140Q168 108 191 90T260 70Q297 70 323 76T361 91T379 110T384 129Q384 157 346 171T247 195T165 212Q119 228 96 256T72 317'], - - // LATIN SMALL LETTER T - 0x74: [554,6,525,25,448,'25 395Q26 405 26 408T29 416T35 423T48 431H145V481L146 532Q154 547 161 550T184 554H189Q218 554 227 534Q229 529 229 480V431H405Q406 430 411 427T418 422T422 416T426 407T427 393Q427 387 427 382T424 374T421 368T417 363T413 360T408 358L405 356L317 355H229V249Q229 237 229 214T228 179Q228 126 241 98T295 70Q354 70 365 149Q366 167 375 174Q383 182 407 182H415Q438 182 446 166Q448 161 448 148Q448 84 398 39T282 -6Q226 -6 189 29T146 128Q145 134 145 247V355H96H72Q45 355 35 362T25 395'], - - // LATIN SMALL LETTER U - 0x75: [431,5,525,4,520,'4 393Q4 416 15 423T52 431H90Q141 431 151 429T168 417Q171 412 173 409V254L174 100Q182 70 244 70Q320 70 344 119Q349 130 350 144T351 248V355H320L289 356Q266 363 266 393Q266 408 270 415T289 431H351H386Q409 431 418 428T433 411Q435 406 435 241V76H498Q512 67 516 60T520 38Q520 9 498 1H436H394Q372 1 364 5T351 26L342 21Q293 -5 227 -5Q118 -5 96 67Q91 82 90 101T89 227V355H58L27 356Q4 363 4 393'], - - // LATIN SMALL LETTER V - 0x76: [432,4,525,24,500,'24 392Q24 417 36 424T79 432Q85 432 103 432T132 431H215Q229 422 233 415T237 393Q237 355 198 355H193H172L262 77L352 355H331H323Q288 355 288 393Q288 409 291 415T310 431H478Q491 423 495 416T500 393Q500 364 478 356L452 355H426L374 190Q320 24 318 20Q307 -4 273 -4H262H251Q217 -4 206 20Q204 24 150 190L98 355H72L47 356Q24 363 24 392'], - - // LATIN SMALL LETTER W - 0x77: [431,4,525,16,508,'54 355Q16 355 16 388V393Q16 423 37 430Q41 431 125 431H162Q206 431 218 425T230 393Q230 366 212 358Q206 355 174 355Q141 355 141 354L150 296Q181 110 181 89V84Q182 85 183 96Q185 118 199 173T218 237Q223 247 245 259H264H268Q294 259 309 240Q315 229 329 174T343 92Q343 84 344 84V86Q344 88 344 91T345 97Q347 125 356 187T374 301T383 354Q383 355 350 355H333Q314 355 304 362T294 393Q294 420 312 428Q318 431 401 431H440Q485 431 496 425T508 393Q508 382 508 377T498 363T470 355L455 354Q455 353 441 271T413 104T396 16Q384 -4 355 -4H351Q315 -4 305 9T280 79Q278 90 276 96Q265 149 265 169Q265 176 264 169Q263 166 263 162Q261 130 248 79T230 18Q220 -4 183 -4H175L151 -3Q134 5 127 17L112 102Q97 188 83 270T69 354Q62 355 54 355'], - - // LATIN SMALL LETTER X - 0x78: [432,-1,525,29,495,'35 393Q35 417 46 424T89 432Q95 432 112 432T141 431H223Q238 422 241 415T244 393Q244 389 244 383T237 367T216 355Q209 355 209 354L234 319Q259 286 260 286L308 354Q308 355 301 355Q285 356 278 365T270 384L271 393Q271 420 289 428Q295 431 376 431H459Q460 430 465 427T472 422T476 416T480 407T481 393Q481 368 470 362T434 355H425H392L344 290Q295 225 295 223Q294 223 309 203T350 149L405 77L439 76H453Q474 76 484 69T495 38Q495 10 473 1H303Q281 9 281 32V38Q281 49 282 54T290 67T313 76Q324 76 324 77L259 173L197 77Q202 76 209 76Q225 75 233 68T241 55T242 38Q242 28 242 24T236 12T221 1H51Q29 9 29 32V38Q29 48 29 51T31 59T38 67T51 76H117L171 149Q224 222 224 223L124 355H90H78Q54 355 45 361T35 393'], - - // LATIN SMALL LETTER Y - 0x79: [431,228,525,26,501,'26 393Q26 417 37 424T80 431H134H217Q232 422 235 416T239 393Q239 379 236 371T226 360T214 356T197 355L179 354V353L188 330Q197 306 209 272T235 201T259 133T271 89V84L274 95Q279 122 298 185T335 300T352 354Q352 355 331 355Q312 355 304 358Q288 368 288 393Q288 408 291 415T310 431H478Q479 430 484 427T491 422T495 416T499 407T500 393Q500 376 493 367T479 357T458 355H452Q426 355 425 353Q420 337 351 124T280 -94Q240 -195 168 -220Q147 -228 125 -228Q89 -228 66 -201T42 -139Q42 -116 56 -102T93 -87Q117 -87 130 -102T144 -135V-138H126Q121 -148 121 -150T130 -152Q182 -147 207 -87Q211 -78 223 -40T236 1Q230 10 102 355H75L49 356Q26 363 26 393'], - - // LATIN SMALL LETTER Z - 0x7A: [432,-1,525,34,475,'56 1Q40 7 37 14T34 41Q34 59 36 64Q39 67 43 73Q65 95 191 213T341 355H133V334Q133 306 124 297Q116 289 91 289H83Q60 289 51 308Q49 313 49 361L50 409Q59 427 72 430H78Q83 430 92 430T115 430T144 430T179 431T219 431T262 431H450Q452 430 455 428T459 424T463 422T466 419T468 416T469 413T470 409T471 404T472 398T472 391Q472 374 469 368L462 358Q453 349 315 218Q210 122 164 76H391V103Q391 136 400 146Q409 155 433 155Q464 155 473 135Q475 130 475 78V46Q475 24 472 16T453 1H56'], - - // LEFT CURLY BRACKET - 0x7B: [694,83,525,50,475,'430 -7H436Q449 -7 456 -8T469 -19T475 -45Q475 -69 466 -76T434 -83H419Q386 -82 363 -80T308 -69T253 -41T223 7L221 17L220 118V220L218 224Q215 229 214 230T210 235T204 241T195 246T184 252T170 257T151 262T127 265Q118 267 100 267T69 270T52 283Q50 288 50 306V314Q50 335 67 341Q68 342 102 343T172 355T217 386L220 392V493L221 595Q225 611 230 621T251 650T304 679T395 693L406 694Q418 694 426 694Q458 694 466 685Q475 676 475 656T466 627Q458 618 430 618Q319 618 305 587L304 486Q304 476 304 458T305 431Q305 385 295 358T251 311L243 306Q243 305 254 298T281 274T302 231Q304 223 304 125L305 25Q309 16 316 10T352 -1T430 -7'], - - // VERTICAL LINE - 0x7C: [694,82,525,228,297,'228 668Q241 694 262 694Q268 694 273 693T282 688T287 682T293 674L297 668V-57Q282 -82 262 -82Q239 -82 228 -57V668'], - - // RIGHT CURLY BRACKET - 0x7D: [694,83,525,49,475,'49 655Q49 674 56 682T73 692T106 694Q141 693 167 690T224 677T275 647T303 595L305 392Q313 367 347 356T417 344T457 341Q475 335 475 306Q475 292 473 285T464 273T451 269T430 267Q352 262 327 246Q311 236 305 220L303 17L301 7Q294 -16 277 -33T242 -60T196 -74T150 -80T106 -83Q78 -83 72 -82T58 -74Q49 -65 49 -44Q49 -24 58 -16Q66 -7 94 -7Q143 -7 171 -1T207 10T220 25V125Q220 223 222 231Q228 257 243 274T270 299L281 306Q234 329 222 381Q220 387 220 486V587Q212 597 207 601T173 612T94 618Q66 618 58 627Q49 635 49 655'], - - // TILDE - 0x7E: [611,-466,525,87,437,'125 467Q113 467 100 480T87 509Q88 520 111 543Q172 602 209 609Q219 611 224 611Q246 611 263 596T290 566T304 551Q319 551 367 594Q383 610 396 610H400Q411 610 424 597T437 568Q436 557 413 534Q348 469 305 466Q278 466 260 481T234 511T220 526Q205 526 157 483Q141 467 129 467H125'], - - // ?? - 0x7F: [612,-519,525,104,421,'104 565Q104 590 120 600T155 611Q175 611 180 610Q217 599 217 565Q217 545 202 532T166 519H159H155Q120 519 107 547Q104 553 104 565ZM307 565Q307 580 317 593T346 610Q348 610 350 610T354 611Q355 612 367 612Q395 611 408 597T421 565T409 534T365 519H358Q336 519 322 532T307 565'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Typewriter/Regular/BasicLatin.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/CombDiacritMarks.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/CombDiacritMarks.js deleted file mode 100644 index 9ee14f8fa4..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/CombDiacritMarks.js +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Typewriter/Regular/CombDiacritMarks.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Typewriter'], - { - // COMBINING GRAVE ACCENT - 0x300: [611,-485,0,-409,-195,'-409 569Q-409 586 -399 596T-377 610Q-376 610 -372 610T-365 611Q-355 610 -284 588T-210 563Q-195 556 -195 537Q-195 533 -197 522T-208 498T-229 485Q-238 485 -312 508T-388 533Q-400 538 -405 552Q-409 559 -409 569'], - - // COMBINING ACUTE ACCENT - 0x301: [611,-485,0,-331,-117,'-297 485Q-315 485 -323 505T-331 537Q-331 556 -316 563Q-307 569 -170 610Q-169 610 -165 610T-157 611Q-141 609 -131 600T-119 584T-117 569Q-117 555 -124 545T-138 533Q-140 531 -214 508T-297 485'], - - // COMBINING CIRCUMFLEX ACCENT - 0x302: [611,-460,0,-429,-97,'-387 460Q-404 460 -416 479T-429 512Q-429 527 -419 534Q-416 536 -347 571T-272 609Q-269 611 -261 611Q-254 610 -182 574Q-168 567 -156 561T-136 550T-123 543T-114 538T-109 535T-105 532T-103 529T-100 525Q-97 518 -97 512Q-97 498 -109 479T-139 460H-141Q-148 460 -209 496L-263 526L-317 496Q-378 460 -387 460'], - - // COMBINING TILDE - 0x303: [611,-466,0,-438,-88,'-400 467Q-412 467 -425 480T-438 509Q-437 520 -414 543Q-353 602 -316 609Q-306 611 -301 611Q-279 611 -262 596T-235 566T-221 551Q-206 551 -158 594Q-142 610 -129 610H-125Q-114 610 -101 597T-88 568Q-89 557 -112 534Q-177 469 -220 466Q-247 466 -265 481T-291 511T-305 526Q-320 526 -368 483Q-384 467 -396 467H-400'], - - // COMBINING MACRON - 0x304: [578,-500,0,-452,-74,'-429 500Q-440 504 -445 511T-450 522T-452 536Q-452 552 -451 556Q-445 571 -434 574T-379 578Q-369 578 -330 578T-261 577H-96Q-94 575 -90 573T-85 569T-81 564T-77 558T-75 550T-74 538Q-74 522 -78 515T-96 500H-429'], - - // COMBINING BREVE - 0x306: [611,-504,0,-447,-79,'-446 579Q-446 611 -412 611H-407Q-383 609 -378 599T-358 587Q-340 583 -263 583H-235Q-159 583 -152 593Q-145 611 -120 611H-117H-115Q-79 611 -79 577Q-80 552 -95 536T-140 514T-191 506T-251 504H-263H-274Q-311 504 -334 505T-386 513T-431 536T-446 579'], - - // COMBINING DIAERESIS - 0x308: [612,-519,0,-421,-104,'-421 565Q-421 590 -405 600T-370 611Q-350 611 -345 610Q-308 599 -308 565Q-308 545 -323 532T-359 519H-366H-370Q-405 519 -418 547Q-421 553 -421 565ZM-218 565Q-218 580 -208 593T-179 610Q-177 610 -175 610T-171 611Q-170 612 -158 612Q-130 611 -117 597T-104 565T-116 534T-160 519H-167Q-189 519 -203 532T-218 565'], - - // COMBINING RING ABOVE - 0x30A: [619,-499,0,-344,-182,'-344 558Q-344 583 -321 601T-262 619Q-225 619 -204 600T-182 560Q-182 536 -205 518T-264 499Q-301 499 -322 519T-344 558ZM-223 559Q-223 570 -234 579T-261 588T-289 580T-303 559Q-303 549 -293 540T-263 530T-234 539T-223 559'], - - // COMBINING CARON - 0x30C: [577,-449,0,-427,-99,'-427 525Q-427 542 -417 559T-392 577Q-385 577 -323 553L-263 530L-203 553Q-143 576 -136 576Q-118 576 -109 559T-99 525Q-99 508 -107 502T-161 481Q-177 475 -186 472Q-256 449 -263 449Q-272 449 -339 472T-412 498Q-420 501 -423 508T-427 520V525'] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Typewriter/Regular/CombDiacritMarks.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/Main.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/Main.js deleted file mode 100644 index fe74dedcb9..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/Main.js +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Typewriter/Regular/Main.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Typewriter'] = { - directory: 'Typewriter/Regular', - family: 'MathJax_Typewriter', - id: 'MJTT', - Ranges: [ - [0x0,0x7F,"BasicLatin"], - [0x80,0xFFFF,"Other"], - [0x300,0x36F,"CombDiacritMarks"] - ] - - -}; - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Typewriter/Regular/Main.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/Other.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/Other.js deleted file mode 100644 index f0f230afb4..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/Other.js +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/svg/Typewriter/Regular/Other.js - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -MathJax.Hub.Insert( - MathJax.OutputJax.SVG.FONTDATA.FONTS['MathJax_Typewriter'], - { - // LATIN SMALL LETTER DOTLESS I - 0x131: [432,-1,525,72,462,'411 76Q441 76 451 69T462 38Q462 29 462 26T460 18T453 9T440 1H94Q72 8 72 33V38Q72 46 72 49T74 58T81 68T94 76H233V355H167L102 356Q80 363 80 393Q80 418 91 425T138 432Q145 432 165 432T200 431H295Q297 429 303 425T310 420T314 415T317 404T317 389T318 363Q318 354 318 314T317 241V76H378H411'], - - // LATIN SMALL LETTER DOTLESS J - 0x237: [432,228,525,48,377,'75 -91T100 -91T138 -107T152 -144V-150L160 -151H193H203Q241 -151 267 -121Q284 -97 288 -73T292 23V151V355H218L145 356Q123 365 123 387V393Q123 422 145 430H148Q151 430 156 430T169 430T185 430T205 431T227 431T251 431H354Q356 430 360 427T365 424T369 420T372 416T373 410T375 402T376 391T377 376T377 356Q377 345 377 286T376 176Q376 -67 371 -88Q362 -123 342 -151T299 -194Q254 -228 180 -228Q84 -226 56 -177Q49 -162 48 -148Q48 -122 61 -107'], - - // GREEK CAPITAL LETTER GAMMA - 0x393: [611,0,525,25,488,'466 611Q468 609 473 606T479 602T483 598T486 593T487 586T488 576T488 562V526V488Q488 452 470 444Q466 442 446 442Q421 442 413 450Q406 457 405 463T404 501V535H185V76H222H239Q260 76 270 69T281 38Q281 12 270 6T209 0H155H104Q48 0 37 5T25 38Q25 59 35 69Q44 76 76 76H101V535H76H64Q36 535 27 552Q25 557 25 573T27 594Q33 606 43 608T106 611H258H466'], - - // GREEK CAPITAL LETTER DELTA - 0x394: [623,0,525,35,489,'232 622H237Q242 622 249 622T264 623H293Q295 622 300 619T308 613T314 608T319 601Q322 597 405 316T489 19Q489 9 473 1Q471 0 262 0T51 1Q35 9 35 19Q35 34 118 315T205 601Q214 616 232 622ZM267 501Q266 504 265 510T263 521T261 526V523Q261 508 211 332Q142 91 138 82H386Q385 84 345 224Q281 439 267 501'], - - // GREEK CAPITAL LETTER THETA - 0x398: [621,10,525,56,468,'102 588Q140 621 240 621Q323 621 335 620Q393 613 422 588Q450 560 459 493T468 306Q468 185 460 118T422 23Q382 -10 289 -10H262H235Q142 -10 102 23Q74 50 65 118T56 306Q56 427 64 494T102 588ZM262 66Q285 66 300 67T329 74T351 86T366 108T376 138T381 181T383 235T384 306Q384 452 371 492T304 544Q296 545 251 545Q230 545 215 543T188 534T169 520T155 497T147 466T143 423T141 371T140 306Q140 247 141 215T146 151T158 107T179 82T212 69T262 66ZM179 356Q187 378 219 378H223Q240 377 249 372T260 360L261 355Q261 353 262 353T263 355Q263 362 272 369Q280 377 304 377H310Q325 377 331 374T346 356V256Q338 241 331 238T309 234H304Q280 234 272 242Q263 249 263 256Q263 258 262 258T261 256Q261 249 252 242Q244 234 220 234H216Q186 234 179 256V356'], - - // GREEK CAPITAL LETTER LAMDA - 0x39B: [623,-1,525,30,495,'30 38Q30 57 38 66T70 76Q88 76 88 78Q89 79 117 207T173 466T205 602Q213 617 231 622H236Q241 622 249 622T264 623H294Q315 609 319 602Q321 598 350 468T407 208T435 78Q436 76 454 76Q470 76 478 73Q495 62 495 38Q495 10 473 1H313Q290 10 290 38Q290 56 297 65T310 74T331 76Q350 76 350 78Q349 80 328 176T285 383T263 520Q263 526 262 527Q261 527 261 521Q261 497 240 388T198 181T174 78Q174 76 193 76Q220 75 227 65Q234 56 234 38Q234 28 234 24T228 13T212 1H52Q30 9 30 32V38'], - - // GREEK CAPITAL LETTER XI - 0x39E: [612,-1,525,33,491,'37 555V569Q37 605 60 610H66Q71 610 81 610T105 610T137 610T175 611T217 611T264 611H465Q467 609 471 606T477 602T481 599T484 594T485 588T487 580T487 570T487 554Q487 526 486 520T478 506Q470 498 445 498T412 506Q403 515 403 531V539H121V531Q121 498 86 498H79H71Q48 498 39 517Q37 522 37 555ZM109 318V346Q109 366 113 374T132 389H170Q193 379 193 359V354H331V359Q331 379 354 389H392Q407 381 411 373T415 342V318V290Q415 270 411 262T392 247H354Q331 257 331 277V282H193V277Q193 257 170 247H132Q117 255 113 263T109 294V318ZM56 1Q41 7 37 15T33 42V58V80Q33 101 41 110T77 119Q87 118 91 118T103 114T114 103T117 83V72H407V83Q407 101 416 110T449 119T482 110Q489 103 490 97T491 59V41Q491 24 487 16T469 1H56'], - - // GREEK CAPITAL LETTER PI - 0x3A0: [611,-1,525,16,508,'60 535Q45 535 38 536T24 545T16 571Q16 603 36 609Q41 611 264 611H486Q501 602 504 596T508 573Q508 559 505 551T495 540T482 536T464 535H443V76H464H470Q482 76 489 75T502 64T508 38Q508 10 486 1H317Q306 5 301 11T296 21T295 38V44Q295 66 311 73Q318 76 338 76H359V535H165V76H186H192Q204 76 211 75T224 64T230 38Q230 10 208 1H39Q28 5 23 11T18 21T17 38V44Q17 66 33 73Q40 76 60 76H81V535H60'], - - // GREEK CAPITAL LETTER SIGMA - 0x3A3: [612,-1,525,39,484,'40 575Q40 576 40 579T41 583T41 588T43 593T46 597T50 602T55 606T63 610H68Q74 610 84 610T108 610T139 610T176 611T219 611T264 611H462Q464 609 469 606T475 602T479 598T482 593T483 586T484 576T484 562V526V488Q484 452 466 444Q462 442 442 442Q417 442 409 450Q402 457 401 463T400 501V535H153Q153 533 218 430Q233 405 250 378T276 336T286 319Q290 311 290 307Q290 296 239 211Q229 194 223 184L161 78H400V112Q400 142 401 149T409 163Q418 172 442 172Q473 172 482 152Q484 147 484 86V49Q484 25 481 17T462 1H63Q41 10 41 31Q41 39 43 44Q43 45 81 109T157 238L195 303Q195 307 119 430T41 557T40 575'], - - // GREEK CAPITAL LETTER UPSILON - 0x3A5: [623,-1,525,38,486,'38 494Q38 549 74 585T152 621Q168 621 179 619T209 606T241 566T262 492Q262 494 265 507T270 526T276 547T285 569T298 589T315 606T337 617T365 622Q416 622 451 584T486 494Q486 470 469 461Q464 459 445 459H437Q416 459 406 476Q404 479 403 502T393 541T365 558Q350 558 340 548T323 519T312 475T307 419T305 354T304 282Q304 254 304 239V76H358Q372 67 376 60T380 38Q380 10 358 1H167Q145 9 145 32V38Q145 54 148 60T167 76H220V239Q220 256 220 289T220 338T219 383T217 426T214 463T209 497T201 522T189 543T174 555Q168 558 159 558Q139 558 131 541T121 502T118 476Q108 459 84 459H79H71Q38 459 38 494'], - - // GREEK CAPITAL LETTER PHI - 0x3A6: [612,-1,525,41,483,'139 573V578Q139 603 161 610H166Q172 610 182 610T204 610T232 611T264 611H364Q379 602 382 595T385 573Q385 544 364 536L334 535H304V441H306Q313 440 325 438T367 426T421 403T464 364T483 306Q483 251 430 216T317 172Q315 172 313 172T308 170H306H304V76H364Q379 67 382 60T385 38Q385 28 385 24T379 12T364 1H161Q139 8 139 33V38Q139 46 139 49T141 58T148 68T161 76H220V170H218Q211 171 199 173T157 185T103 208T60 248T41 306Q41 361 94 396T208 439Q210 439 212 439T216 440L218 441H220V535H190L161 536Q139 543 139 573ZM124 306Q124 286 147 271T194 252L218 247Q220 247 220 306V364H218Q212 364 192 359T148 340T124 306ZM400 305Q400 325 377 340T330 360L306 364Q304 364 304 306Q304 247 306 247Q312 247 332 252T376 271T400 305'], - - // GREEK CAPITAL LETTER PSI - 0x3A8: [611,-1,525,37,487,'37 439Q38 451 40 457T52 469T77 475H79Q96 475 107 473T132 456T152 411Q152 409 153 396T154 372V365Q154 291 198 261Q215 251 219 251Q220 251 220 393V535H193L167 536Q145 545 145 567V573Q145 602 167 610Q168 611 264 611H358Q372 602 376 595T380 573Q380 545 358 536L331 535H304V393Q304 251 305 251Q307 251 310 252T323 259T339 272T355 295T367 331Q368 337 370 372Q370 382 371 395T372 411Q376 434 384 448T404 467T425 474T447 475Q461 474 467 473T480 463T487 437Q487 419 481 412Q476 403 459 398Q457 390 453 344T431 263Q415 228 383 205T332 177T306 172H304V76H358Q372 67 376 60T380 38Q380 10 358 1H167Q145 9 145 32V38Q145 54 148 60T167 76H220V172H218Q211 172 192 177T141 205T93 263Q74 298 71 343T67 391L66 398Q47 403 42 411T37 433V439'], - - // GREEK CAPITAL LETTER OMEGA - 0x3A9: [622,-1,525,32,492,'40 404Q40 498 106 560T258 622Q357 622 420 558T484 406Q484 359 469 311T428 205T392 117Q382 84 382 78Q382 76 402 76H421V87Q421 110 431 116T457 123Q474 123 483 114Q490 107 491 100T492 61V42Q492 11 474 3Q470 1 397 1H324Q302 9 302 32V39Q302 104 351 225T400 405Q400 462 361 504T262 546Q200 546 162 504T124 405Q124 346 171 230T223 42V36Q223 11 205 3Q201 1 128 1H55Q39 7 33 23L32 60V80Q32 94 34 102T44 116T68 123Q103 123 103 87V76H123Q142 76 142 78Q142 100 117 156T66 282T40 404'], - - // ?? - 0x7E2: [611,-287,525,175,349,'205 554Q205 577 221 594T263 611Q302 611 325 577T349 490Q349 409 298 347Q285 330 258 309T214 287Q203 289 189 302T175 327Q175 341 185 349T213 369T245 402Q269 437 273 483V497Q264 496 263 496Q240 496 223 513T205 554'], - - // ?? - 0x7E3: [681,-357,525,176,350,'176 479Q176 563 227 622T310 681Q324 680 337 667T350 641Q350 627 340 619T312 599T280 566Q256 531 252 485V471Q261 472 262 472Q285 472 302 455T320 414Q320 389 303 373T261 357Q223 357 200 391T176 479'], - - // PRIME - 0x2032: [623,-334,525,211,313,'211 572Q211 593 226 608T262 623Q281 623 297 610T313 573Q313 561 307 465Q301 370 299 357T284 336Q279 334 262 334Q240 334 231 343Q226 350 225 362T217 465Q211 549 211 572'], - - // INCREMENT - 0x2206: [623,0,525,35,489,''] - } -); - -MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Typewriter/Regular/Other.js"); diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/fontdata-extra.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/fontdata-extra.js deleted file mode 100644 index 5b1c995efb..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/fontdata-extra.js +++ /dev/null @@ -1,239 +0,0 @@ -/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ - -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/fontdata-extra.js - * - * Adds extra stretchy characters to the TeX font data. - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function (SVG) { - var VERSION = "2.6.0"; - - var DELIMITERS = SVG.FONTDATA.DELIMITERS; - - var MAIN = "MathJax_Main", - BOLD = "MathJax_Main-bold", - AMS = "MathJax_AMS", - SIZE1 = "MathJax_Size1", - SIZE4 = "MathJax_Size4"; - var H = "H", V = "V"; - - var delim = { - 0x003D: // equal sign - { - dir: H, HW: [[.767,MAIN]], stretch: {rep:[0x003D,MAIN]} - }, - 0x219E: // left two-headed arrow - { - dir: H, HW: [[1,AMS]], stretch: {left:[0x219E,AMS], rep:[0x2212,MAIN]} - }, - 0x21A0: // right two-headed arrow - { - dir: H, HW: [[1,AMS]], stretch: {right:[0x21A0,AMS], rep:[0x2212,MAIN]} - }, - 0x21A4: // left arrow from bar - { - dir: H, HW: [], - stretch: {min:1, left:[0x2190,MAIN], rep:[0x2212,MAIN], right:[0x2223,SIZE1,0,-.05,.9]} - }, - 0x21A5: // up arrow from bar - { - dir: V, HW: [], - stretch: {min:.6, bot:[0x22A5,BOLD,0,0,.75], ext:[0x23D0,SIZE1], top:[0x2191,SIZE1]} - }, - 0x21A6: // right arrow from bar - { - dir: H, HW: [[1,MAIN]], - stretch: {left:[0x2223,SIZE1,-.09,-.05,.9], rep:[0x2212,MAIN], right:[0x2192,MAIN]} - }, - 0x21A7: // down arrow from bar - { - dir: V, HW: [], - stretch: {min:.6, top:[0x22A4,BOLD,0,0,.75], ext:[0x23D0,SIZE1], bot:[0x2193,SIZE1]} - }, - 0x21B0: // up arrow with top leftwards - { - dir: V, HW: [[.722,AMS]], - stretch: {top:[0x21B0,AMS], ext:[0x23D0,SIZE1,.097]} - }, - 0x21B1: // up arrow with top right - { - dir: V, HW: [[.722,AMS]], - stretch: {top:[0x21B1,AMS,.27], ext:[0x23D0,SIZE1]} - }, - 0x21BC: // left harpoon with barb up - { - dir: H, HW: [[1,MAIN]], - stretch: {left:[0x21BC,MAIN], rep:[0x2212,MAIN]} - }, - 0x21BD: // left harpoon with barb down - { - dir: H, HW: [[1,MAIN]], - stretch: {left:[0x21BD,MAIN], rep:[0x2212,MAIN]} - }, - 0x21BE: // up harpoon with barb right - { - dir: V, HW: [[.888,AMS]], - stretch: {top:[0x21BE,AMS,.12,0,1.1], ext:[0x23D0,SIZE1]} - }, - 0x21BF: // up harpoon with barb left - { - dir: V, HW: [[.888,AMS]], - stretch: {top:[0x21BF,AMS,.12,0,1.1], ext:[0x23D0,SIZE1]} - }, - 0x21C0: // right harpoon with barb up - { - dir: H, HW: [[1,MAIN]], - stretch: {right:[0x21C0,MAIN], rep:[0x2212,MAIN]} - }, - 0x21C1: // right harpoon with barb down - { - dir: H, HW: [[1,MAIN]], - stretch: {right:[0x21C1,MAIN], rep:[0x2212,MAIN]} - }, - 0x21C2: // down harpoon with barb right - { - dir: V, HW: [[.888,AMS]], - stretch: {bot:[0x21C2,AMS,.12,0,1.1], ext:[0x23D0,SIZE1]} - }, - 0x21C3: // down harpoon with barb left - { - dir: V, HW: [[.888,AMS]], - stretch: {bot:[0x21C3,AMS,.12,0,1.1], ext:[0x23D0,SIZE1]} - }, - 0x21DA: // left triple arrow - { - dir: H, HW: [[1,AMS]], - stretch: {left:[0x21DA,AMS], rep:[0x2261,MAIN]} - }, - 0x21DB: // right triple arrow - { - dir: H, HW: [[1,AMS]], - stretch: {right:[0x21DB,AMS], rep:[0x2261,MAIN]} - }, - 0x23B4: // top square bracket - { - dir: H, HW: [], - stretch: {min:.5, left:[0x250C,AMS,0,-.1], rep:[0x2212,MAIN,0,.325], right:[0x2510,AMS,0,-.1]} - }, - 0x23B5: // bottom square bracket - { - dir: H, HW: [], - stretch: {min:.5, left:[0x2514,AMS,0,.26], rep:[0x2212,MAIN,0,0,0,.25], right:[0x2518,AMS,0,.26]} - }, - 0x23DC: // top paren - { - dir: H, HW: [[.778,AMS,0,0x2322],[1,MAIN,0,0x2322]], - stretch: {left:[0xE150,SIZE4], rep:[0xE154,SIZE4], right:[0xE151,SIZE4]} - }, - 0x23DD: // bottom paren - { - dir: H, HW: [[.778,AMS,0,0x2323],[1,MAIN,0,0x2323]], - stretch: {left:[0xE152,SIZE4], rep:[0xE154,SIZE4], right:[0xE153,SIZE4]} - }, - 0x23E0: // top tortoise shell - { - dir: H, HW: [], - stretch: {min:1.25, left:[0x2CA,MAIN,-.1], rep:[0x2C9,MAIN,-.05,.13], right:[0x2CB,MAIN], fullExtenders:true} - }, - 0x23E1: // bottom tortoise shell - { - dir: H, HW: [], - stretch: {min:1.5, left:[0x2CB,MAIN,-.1,.1], rep:[0x2C9,MAIN,-.1], right:[0x2CA,MAIN,-.1,.1], fullExtenders:true} - }, - 0x2906: // leftwards double arrow from bar - { - dir: H, HW: [], - stretch: {min:1, left:[0x21D0,MAIN], rep:[0x3D,MAIN], right:[0x2223,SIZE1,0,-.1]} - }, - 0x2907: // rightwards double arrow from bar - { - dir: H, HW: [], - stretch: {min:.7, left:[0x22A8,AMS,0,-.12], rep:[0x3D,MAIN], right:[0x21D2,MAIN]} - }, - 0x294E: // left barb up right barb up harpoon - { - dir: H, HW: [], - stretch: {min:.5, left:[0x21BC,MAIN], rep:[0x2212,MAIN], right:[0x21C0,MAIN]} - }, - 0x294F: // up barb right down barb right harpoon - { - dir: V, HW: [], - stretch: {min:.5, top:[0x21BE,AMS,.12,0,1.1], ext:[0x23D0,SIZE1], bot:[0x21C2,AMS,.12,0,1.1]} - }, - 0x2950: // left barb dow right barb down harpoon - { - dir: H, HW: [], - stretch: {min:.5, left:[0x21BD,MAIN], rep:[0x2212,MAIN], right:[0x21C1,MAIN]} - }, - 0x2951: // up barb left down barb left harpoon - { - dir: V, HW: [], - stretch: {min:.5, top:[0x21BF,AMS,.12,0,1.1], ext:[0x23D0,SIZE1], bot:[0x21C3,AMS,.12,0,1.1]} - }, - 0x295A: // leftwards harpoon with barb up from bar - { - dir: H, HW: [], - stretch: {min:1, left:[0x21BC,MAIN], rep:[0x2212,MAIN], right:[0x2223,SIZE1,0,-.05,.9]} - }, - 0x295B: // rightwards harpoon with barb up from bar - { - dir: H, HW: [], - stretch: {min:1, left:[0x2223,SIZE1,-.05,-.05,.9], rep:[0x2212,MAIN], right:[0x21C0,MAIN]} - }, - 0x295C: // up harpoon with barb right from bar - { - dir: V, HW: [], - stretch: {min:.7, bot:[0x22A5,BOLD,0,0,.75], ext:[0x23D0,SIZE1], top:[0x21BE,AMS,.12,0,1.1]} - }, - 0x295D: // down harpoon with barb right from bar - { - dir: V, HW: [], - stretch: {min:.7, top:[0x22A4,BOLD,0,0,.75], ext:[0x23D0,SIZE1], bot:[0x21C2,AMS,.12,0,1.1]} - }, - 0x295E: // leftwards harpoon with barb down from bar - { - dir: H, HW: [], - stretch: {min:1, left:[0x21BD,MAIN], rep:[0x2212,MAIN], right:[0x2223,SIZE1,0,-.05,.9]} - }, - 0x295F: // rightwards harpoon with barb down from bar - { - dir: H, HW: [], - stretch: {min:1, left:[0x2223,SIZE1,-.05,-.05,.9], rep:[0x2212,MAIN], right:[0x21C1,MAIN]} - }, - 0x2960: // up harpoon with barb left from bar - { - dir: V, HW: [], - stretch: {min:.7, bot:[0x22A5,BOLD,0,0,.75], ext:[0x23D0,SIZE1], top:[0x21BF,AMS,.12,0,1.1]} - }, - 0x2961: // down harpoon with barb left from bar - { - dir: V, HW: [], - stretch: {min:.7, top:[0x22A4,BOLD,0,0,.75], ext:[0x23D0,SIZE1], bot:[0x21C3,AMS,.12,0,1.1]} - } - }; - - for (var id in delim) {if (delim.hasOwnProperty(id)) {DELIMITERS[id] = delim[id]}}; - - MathJax.Ajax.loadComplete(SVG.fontDir + "/fontdata-extra.js"); - -})(MathJax.OutputJax.SVG); - diff --git a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/fontdata.js b/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/fontdata.js deleted file mode 100644 index 752df6866c..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/fonts/TeX/fontdata.js +++ /dev/null @@ -1,1605 +0,0 @@ -/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ - -/************************************************************* - * - * MathJax/jax/output/SVG/fonts/TeX/fontdata.js - * - * Initializes the SVG OutputJax to use the MathJax TeX fonts - * for displaying mathematics. - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function (SVG,MML,AJAX,HUB) { - var VERSION = "2.6.0"; - - var MAIN = "MathJax_Main", - BOLD = "MathJax_Main-bold", - ITALIC = "MathJax_Math-italic", - AMS = "MathJax_AMS", - SIZE1 = "MathJax_Size1", - SIZE2 = "MathJax_Size2", - SIZE3 = "MathJax_Size3", - SIZE4 = "MathJax_Size4"; - var H = "H", V = "V", EXTRAH = {load:"extra", dir:H}, EXTRAV = {load:"extra", dir:V}; - var STDHW = [[1000,MAIN],[1200,SIZE1],[1800,SIZE2],[2400,SIZE3],[3000,SIZE4]]; - var ARROWREP = [0x2212,MAIN,0,0,0,0,.1]; // add depth for arrow extender - var DARROWREP = [0x3D,MAIN,0,0,0,0,.1]; // add depth for arrow extender - - SVG.Augment({ - FONTDATA: { - version: VERSION, - - baselineskip: 1200, - lineH: 800, lineD: 200, - - FONTS: { - "MathJax_Main": "Main/Regular/Main.js", - "MathJax_Main-bold": "Main/Bold/Main.js", - "MathJax_Main-italic": "Main/Italic/Main.js", - "MathJax_Math-italic": "Math/Italic/Main.js", - "MathJax_Math-bold-italic": "Math/BoldItalic/Main.js", - "MathJax_Caligraphic": "Caligraphic/Regular/Main.js", - "MathJax_Size1": "Size1/Regular/Main.js", - "MathJax_Size2": "Size2/Regular/Main.js", - "MathJax_Size3": "Size3/Regular/Main.js", - "MathJax_Size4": "Size4/Regular/Main.js", - "MathJax_AMS": "AMS/Regular/Main.js", - "MathJax_Fraktur": "Fraktur/Regular/Main.js", - "MathJax_Fraktur-bold": "Fraktur/Bold/Main.js", - "MathJax_SansSerif": "SansSerif/Regular/Main.js", - "MathJax_SansSerif-bold": "SansSerif/Bold/Main.js", - "MathJax_SansSerif-italic": "SansSerif/Italic/Main.js", - "MathJax_Script": "Script/Regular/Main.js", - "MathJax_Typewriter": "Typewriter/Regular/Main.js", - "MathJax_Caligraphic-bold": "Caligraphic/Bold/Main.js" - }, - - VARIANT: { - "normal": {fonts:[MAIN,SIZE1,AMS], - offsetG: 0x03B1, variantG: "italic", - remap: {0x391:0x41, 0x392:0x42, 0x395:0x45, 0x396:0x5A, 0x397:0x48, - 0x399:0x49, 0x39A:0x4B, 0x39C:0x4D, 0x39D:0x4E, 0x39F:0x4F, - 0x3A1:0x50, 0x3A4:0x54, 0x3A7:0x58, - 0x2216:[0x2216,"-TeX-variant"], // \smallsetminus - 0x210F:[0x210F,"-TeX-variant"], // \hbar - 0x2032:[0x27,"sans-serif-italic"], // HACK: a smaller prime - 0x29F8:[0x002F,MML.VARIANT.ITALIC]}}, - "bold": {fonts:[BOLD,SIZE1,AMS], bold:true, - offsetG: 0x03B1, variantG: "bold-italic", - remap: {0x391:0x41, 0x392:0x42, 0x395:0x45, 0x396:0x5A, 0x397:0x48, - 0x399:0x49, 0x39A:0x4B, 0x39C:0x4D, 0x39D:0x4E, 0x39F:0x4F, - 0x3A1:0x50, 0x3A4:0x54, 0x3A7:0x58, 0x29F8:[0x002F,"bold-italic"], - 0x219A:"\u2190\u0338", 0x219B:"\u2192\u0338", 0x21AE:"\u2194\u0338", - 0x21CD:"\u21D0\u0338", 0x21CE:"\u21D4\u0338", 0x21CF:"\u21D2\u0338", - 0x2204:"\u2203\u0338", 0x2224:"\u2223\u0338", 0x2226:"\u2225\u0338", - 0x2241:"\u223C\u0338", 0x2247:"\u2245\u0338", - 0x226E:"<\u0338", 0x226F:">\u0338", - 0x2270:"\u2264\u0338", 0x2271:"\u2265\u0338", - 0x2280:"\u227A\u0338", 0x2281:"\u227B\u0338", - 0x2288:"\u2286\u0338", 0x2289:"\u2287\u0338", - 0x22AC:"\u22A2\u0338", 0x22AD:"\u22A8\u0338", -// 0x22AE:"\u22A9\u0338", 0x22AF:"\u22AB\u0338", - 0x22E0:"\u227C\u0338", 0x22E1:"\u227D\u0338"//, -// 0x22EA:"\u22B2\u0338", 0x22EB:"\u22B3\u0338", -// 0x22EC:"\u22B4\u0338", 0x22ED:"\u22B5\u0338" - }}, - "italic": {fonts:[ITALIC,"MathJax_Main-italic",MAIN,SIZE1,AMS], italic:true, - remap: {0x391:0x41, 0x392:0x42, 0x395:0x45, 0x396:0x5A, 0x397:0x48, - 0x399:0x49, 0x39A:0x4B, 0x39C:0x4D, 0x39D:0x4E, 0x39F:0x4F, - 0x3A1:0x50, 0x3A4:0x54, 0x3A7:0x58}}, - "bold-italic": {fonts:["MathJax_Math-bold-italic",BOLD,SIZE1,AMS], bold:true, italic:true, - remap: {0x391:0x41, 0x392:0x42, 0x395:0x45, 0x396:0x5A, 0x397:0x48, - 0x399:0x49, 0x39A:0x4B, 0x39C:0x4D, 0x39D:0x4E, 0x39F:0x4F, - 0x3A1:0x50, 0x3A4:0x54, 0x3A7:0x58}}, - "double-struck": {fonts:[AMS, MAIN]}, - "fraktur": {fonts:["MathJax_Fraktur",MAIN,SIZE1,AMS]}, - "bold-fraktur": {fonts:["MathJax_Fraktur-bold",BOLD,SIZE1,AMS], bold:true}, - "script": {fonts:["MathJax_Script",MAIN,SIZE1,AMS]}, - "bold-script": {fonts:["MathJax_Script",BOLD,SIZE1,AMS], bold:true}, - "sans-serif": {fonts:["MathJax_SansSerif",MAIN,SIZE1,AMS]}, - "bold-sans-serif": {fonts:["MathJax_SansSerif-bold",BOLD,SIZE1,AMS], bold:true}, - "sans-serif-italic": {fonts:["MathJax_SansSerif-italic","MathJax_Main-italic",SIZE1,AMS], italic:true}, - "sans-serif-bold-italic": {fonts:["MathJax_SansSerif-italic","MathJax_Main-italic",SIZE1,AMS], bold:true, italic:true}, - "monospace": {fonts:["MathJax_Typewriter",MAIN,SIZE1,AMS]}, - "-tex-caligraphic": {fonts:["MathJax_Caligraphic",MAIN], offsetA: 0x41, variantA: "italic"}, - "-tex-oldstyle": {fonts:["MathJax_Caligraphic",MAIN]}, - "-tex-mathit": {fonts:["MathJax_Main-italic",ITALIC,MAIN,SIZE1,AMS], italic:true, noIC: true, - remap: {0x391:0x41, 0x392:0x42, 0x395:0x45, 0x396:0x5A, 0x397:0x48, - 0x399:0x49, 0x39A:0x4B, 0x39C:0x4D, 0x39D:0x4E, 0x39F:0x4F, - 0x3A1:0x50, 0x3A4:0x54, 0x3A7:0x58}}, - "-TeX-variant": {fonts:[AMS,MAIN,SIZE1], // HACK: to get larger prime for \prime - remap: { - 0x2268: 0xE00C, 0x2269: 0xE00D, 0x2270: 0xE011, 0x2271: 0xE00E, - 0x2A87: 0xE010, 0x2A88: 0xE00F, 0x2224: 0xE006, 0x2226: 0xE007, - 0x2288: 0xE016, 0x2289: 0xE018, 0x228A: 0xE01A, 0x228B: 0xE01B, - 0x2ACB: 0xE017, 0x2ACC: 0xE019, 0x03DC: 0xE008, 0x03F0: 0xE009, - 0x2216:[0x2216,MML.VARIANT.NORMAL], // \setminus - 0x210F:[0x210F,MML.VARIANT.NORMAL] // \hslash - }}, - "-largeOp": {fonts:[SIZE2,SIZE1,MAIN]}, - "-smallOp": {fonts:[SIZE1,MAIN]}, - "-tex-caligraphic-bold": {fonts:["MathJax_Caligraphic-bold","MathJax_Main-bold","MathJax_Main","MathJax_Math","MathJax_Size1"], bold:true, - offsetA: 0x41, variantA: "bold-italic"}, - "-tex-oldstyle-bold": {fonts:["MathJax_Caligraphic-bold","MathJax_Main-bold","MathJax_Main","MathJax_Math","MathJax_Size1"], bold:true} - }, - - RANGES: [ - {name: "alpha", low: 0x61, high: 0x7A, offset: "A", add: 32}, - {name: "number", low: 0x30, high: 0x39, offset: "N"}, - {name: "greek", low: 0x03B1, high: 0x03F6, offset: "G"} - ], - - RULECHAR: 0x2212, - - REMAP: { - 0x00A0: 0x20, // non-breaking space - 0x203E: 0x2C9, // overline - 0x20D0: 0x21BC, 0x20D1: 0x21C0, // combining left and right harpoons - 0x20D6: 0x2190, 0x20E1: 0x2194, // combining left arrow and lef-right arrow - 0x20EC: 0x21C1, 0x20ED: 0x21BD, // combining low right and left harpoons - 0x20EE: 0x2190, 0x20EF: 0x2192, // combining low left and right arrows - 0x20F0: 0x2A, // combining asterisk - 0xFE37: 0x23DE, 0xFE38: 0x23DF, // OverBrace, UnderBrace - - 0xB7: 0x22C5, // center dot - 0x2B9: 0x2032, // prime, - 0x3D2: 0x3A5, // Upsilon - 0x2015: 0x2014, 0x2017: 0x5F, // horizontal bars - 0x2022: 0x2219, 0x2044: 0x2F, // bullet, fraction slash - 0x2305: 0x22BC, 0x2306: 0x2A5E, // barwedge, doublebarwedge - 0x25AA: 0x25A0, 0x25B4: 0x25B2, // blacksquare, blacktriangle - 0x25B5: 0x25B3, 0x25B8: 0x25B6, // triangle, blacktriangleright - 0x25BE: 0x25BC, 0x25BF: 0x25BD, // blacktriangledown, triangledown - 0x25C2: 0x25C0, // blacktriangleleft - 0x2329: 0x27E8, 0x232A: 0x27E9, // langle, rangle - 0x3008: 0x27E8, 0x3009: 0x27E9, // langle, rangle - 0x2758: 0x2223, // VerticalSeparator - 0x2A2F: 0xD7, // cross product - - 0x25FB: 0x25A1, 0x25FC: 0x25A0, // square, blacksquare - - // - // Letter-like symbols (that appear elsewhere) - // - 0x2102: [0x0043,MML.VARIANT.DOUBLESTRUCK], -// 0x210A: [0x0067,MML.VARIANT.SCRIPT], - 0x210B: [0x0048,MML.VARIANT.SCRIPT], - 0x210C: [0x0048,MML.VARIANT.FRAKTUR], - 0x210D: [0x0048,MML.VARIANT.DOUBLESTRUCK], - 0x210E: [0x0068,MML.VARIANT.ITALIC], - 0x2110: [0x004A,MML.VARIANT.SCRIPT], - 0x2111: [0x0049,MML.VARIANT.FRAKTUR], - 0x2112: [0x004C,MML.VARIANT.SCRIPT], - 0x2115: [0x004E,MML.VARIANT.DOUBLESTRUCK], - 0x2119: [0x0050,MML.VARIANT.DOUBLESTRUCK], - 0x211A: [0x0051,MML.VARIANT.DOUBLESTRUCK], - 0x211B: [0x0052,MML.VARIANT.SCRIPT], - 0x211C: [0x0052,MML.VARIANT.FRAKTUR], - 0x211D: [0x0052,MML.VARIANT.DOUBLESTRUCK], - 0x2124: [0x005A,MML.VARIANT.DOUBLESTRUCK], - 0x2126: [0x03A9,MML.VARIANT.NORMAL], - 0x2128: [0x005A,MML.VARIANT.FRAKTUR], - 0x212C: [0x0042,MML.VARIANT.SCRIPT], - 0x212D: [0x0043,MML.VARIANT.FRAKTUR], -// 0x212F: [0x0065,MML.VARIANT.SCRIPT], - 0x2130: [0x0045,MML.VARIANT.SCRIPT], - 0x2131: [0x0046,MML.VARIANT.SCRIPT], - 0x2133: [0x004D,MML.VARIANT.SCRIPT], -// 0x2134: [0x006F,MML.VARIANT.SCRIPT], - - 0x2247: 0x2246, // wrong placement of this character - 0x231C: 0x250C, 0x231D:0x2510, // wrong placement of \ulcorner, \urcorner - 0x231E: 0x2514, 0x231F:0x2518, // wrong placement of \llcorner, \lrcorner - - // - // compound symbols not in these fonts - // - 0x2204: "\u2203\u0338", // \not\exists - 0x220C: "\u220B\u0338", // \not\ni - 0x2244: "\u2243\u0338", // \not\simeq - 0x2249: "\u2248\u0338", // \not\approx - 0x2262: "\u2261\u0338", // \not\equiv - 0x226D: "\u224D\u0338", // \not\asymp - 0x2274: "\u2272\u0338", // \not\lesssim - 0x2275: "\u2273\u0338", // \not\gtrsim - 0x2278: "\u2276\u0338", // \not\lessgtr - 0x2279: "\u2277\u0338", // \not\gtrless - 0x2284: "\u2282\u0338", // \not\subset - 0x2285: "\u2283\u0338", // \not\supset - 0x22E2: "\u2291\u0338", // \not\sqsubseteq - 0x22E3: "\u2292\u0338", // \not\sqsupseteq - - 0x2A0C: "\u222C\u222C", // quadruple integral - - 0x2033: "\u2032\u2032", // double prime - 0x2034: "\u2032\u2032\u2032", // triple prime - 0x2036: "\u2035\u2035", // double back prime - 0x2037: "\u2035\u2035\u2035", // trile back prime - 0x2057: "\u2032\u2032\u2032\u2032", // quadruple prime - 0x20DB: "...", // combining three dots above (only works with mover/under) - 0x20DC: "...." // combining four dots above (only works with mover/under) - }, - - REMAPACCENT: { - "\u2192":"\u20D7", - "\u2032":"'", - "\u2035":"`" - }, - REMAPACCENTUNDER: { - }, - - PLANE1MAP: [ - [0x1D400,0x1D419, 0x41, MML.VARIANT.BOLD], - [0x1D41A,0x1D433, 0x61, MML.VARIANT.BOLD], - [0x1D434,0x1D44D, 0x41, MML.VARIANT.ITALIC], - [0x1D44E,0x1D467, 0x61, MML.VARIANT.ITALIC], - [0x1D468,0x1D481, 0x41, MML.VARIANT.BOLDITALIC], - [0x1D482,0x1D49B, 0x61, MML.VARIANT.BOLDITALIC], - [0x1D49C,0x1D4B5, 0x41, MML.VARIANT.SCRIPT], -// [0x1D4B6,0x1D4CF, 0x61, MML.VARIANT.SCRIPT], -// [0x1D4D0,0x1D4E9, 0x41, MML.VARIANT.BOLDSCRIPT], -// [0x1D4EA,0x1D503, 0x61, MML.VARIANT.BOLDSCRIPT], - [0x1D504,0x1D51D, 0x41, MML.VARIANT.FRAKTUR], - [0x1D51E,0x1D537, 0x61, MML.VARIANT.FRAKTUR], - [0x1D538,0x1D551, 0x41, MML.VARIANT.DOUBLESTRUCK], -// [0x1D552,0x1D56B, 0x61, MML.VARIANT.DOUBLESTRUCK], - [0x1D56C,0x1D585, 0x41, MML.VARIANT.BOLDFRAKTUR], - [0x1D586,0x1D59F, 0x61, MML.VARIANT.BOLDFRAKTUR], - [0x1D5A0,0x1D5B9, 0x41, MML.VARIANT.SANSSERIF], - [0x1D5BA,0x1D5D3, 0x61, MML.VARIANT.SANSSERIF], - [0x1D5D4,0x1D5ED, 0x41, MML.VARIANT.BOLDSANSSERIF], - [0x1D5EE,0x1D607, 0x61, MML.VARIANT.BOLDSANSSERIF], - [0x1D608,0x1D621, 0x41, MML.VARIANT.SANSSERIFITALIC], - [0x1D622,0x1D63B, 0x61, MML.VARIANT.SANSSERIFITALIC], -// [0x1D63C,0x1D655, 0x41, MML.VARIANT.SANSSERIFBOLDITALIC], -// [0x1D656,0x1D66F, 0x61, MML.VARIANT.SANSSERIFBOLDITALIC], - [0x1D670,0x1D689, 0x41, MML.VARIANT.MONOSPACE], - [0x1D68A,0x1D6A3, 0x61, MML.VARIANT.MONOSPACE], - - [0x1D6A8,0x1D6C1, 0x391, MML.VARIANT.BOLD], -// [0x1D6C2,0x1D6E1, 0x3B1, MML.VARIANT.BOLD], - [0x1D6E2,0x1D6FA, 0x391, MML.VARIANT.ITALIC], - [0x1D6FC,0x1D71B, 0x3B1, MML.VARIANT.ITALIC], - [0x1D71C,0x1D734, 0x391, MML.VARIANT.BOLDITALIC], - [0x1D736,0x1D755, 0x3B1, MML.VARIANT.BOLDITALIC], - [0x1D756,0x1D76E, 0x391, MML.VARIANT.BOLDSANSSERIF], -// [0x1D770,0x1D78F, 0x3B1, MML.VARIANT.BOLDSANSSERIF], - [0x1D790,0x1D7A8, 0x391, MML.VARIANT.SANSSERIFBOLDITALIC], -// [0x1D7AA,0x1D7C9, 0x3B1, MML.VARIANT.SANSSERIFBOLDITALIC], - - [0x1D7CE,0x1D7D7, 0x30, MML.VARIANT.BOLD], -// [0x1D7D8,0x1D7E1, 0x30, MML.VARIANT.DOUBLESTRUCK], - [0x1D7E2,0x1D7EB, 0x30, MML.VARIANT.SANSSERIF], - [0x1D7EC,0x1D7F5, 0x30, MML.VARIANT.BOLDSANSSERIF], - [0x1D7F6,0x1D7FF, 0x30, MML.VARIANT.MONOSPACE] - ], - - REMAPGREEK: { - 0x391: 0x41, 0x392: 0x42, 0x395: 0x45, 0x396: 0x5A, - 0x397: 0x48, 0x399: 0x49, 0x39A: 0x4B, 0x39C: 0x4D, - 0x39D: 0x4E, 0x39F: 0x4F, 0x3A1: 0x50, 0x3A2: 0x398, - 0x3A4: 0x54, 0x3A7: 0x58, 0x3AA: 0x2207, - 0x3CA: 0x2202, 0x3CB: 0x3F5, 0x3CC: 0x3D1, 0x3CD: 0x3F0, - 0x3CE: 0x3D5, 0x3CF: 0x3F1, 0x3D0: 0x3D6 - }, - - RemapPlane1: function (n,variant) { - for (var i = 0, m = this.PLANE1MAP.length; i < m; i++) { - if (n < this.PLANE1MAP[i][0]) break; - if (n <= this.PLANE1MAP[i][1]) { - n = n - this.PLANE1MAP[i][0] + this.PLANE1MAP[i][2]; - if (this.REMAPGREEK[n]) {n = this.REMAPGREEK[n]} - variant = this.VARIANT[this.PLANE1MAP[i][3]]; - break; - } - } - return {n: n, variant: variant}; - }, - - DELIMITERS: { - 0x0028: // ( - { - dir: V, HW: STDHW, - stretch: {top: [0x239B,SIZE4], ext: [0x239C,SIZE4], bot: [0x239D,SIZE4]} - }, - 0x0029: // ) - { - dir: V, HW: STDHW, - stretch: {top:[0x239E,SIZE4], ext:[0x239F,SIZE4], bot:[0x23A0,SIZE4]} - }, - 0x002F: // / - { - dir: V, HW: STDHW - }, - 0x005B: // [ - { - dir: V, HW: STDHW, - stretch: {top:[0x23A1,SIZE4], ext:[0x23A2,SIZE4], bot:[0x23A3,SIZE4]} - }, - 0x005C: // \ - { - dir: V, HW: STDHW - }, - 0x005D: // ] - { - dir: V, HW: STDHW, - stretch: {top:[0x23A4,SIZE4], ext:[0x23A5,SIZE4], bot:[0x23A6,SIZE4]} - }, - 0x007B: // { - { - dir: V, HW: STDHW, - stretch: {top:[0x23A7,SIZE4], mid:[0x23A8,SIZE4], bot:[0x23A9,SIZE4], ext:[0x23AA,SIZE4]} - }, - 0x007C: // | - { - dir: V, HW: [[1000,MAIN]], stretch: {ext:[0x2223,MAIN]} - }, - 0x007D: // } - { - dir: V, HW: STDHW, - stretch: {top: [0x23AB,SIZE4], mid:[0x23AC,SIZE4], bot: [0x23AD,SIZE4], ext: [0x23AA,SIZE4]} - }, - 0x00AF: // macron - { - dir: H, HW: [[.59,MAIN]], stretch: {rep:[0xAF,MAIN]} - }, - 0x02C6: // wide hat - { - dir: H, HW: [[267+250,MAIN],[567+250,SIZE1],[1005+330,SIZE2],[1447+330,SIZE3],[1909,SIZE4]] - }, - 0x02DC: // wide tilde - { - dir: H, HW: [[333+250,MAIN],[555+250,SIZE1],[1000+330,SIZE2],[1443+330,SIZE3],[1887,SIZE4]] - }, - 0x2016: // vertical arrow extension - { - dir: V, HW: [[602,SIZE1],[1000,MAIN,null,0x2225]], stretch: {ext:[0x2225,MAIN]} - }, - 0x2190: // left arrow - { - dir: H, HW: [[1000,MAIN]], stretch: {left:[0x2190,MAIN], rep:ARROWREP, fuzz:300} - }, - 0x2191: // \uparrow - { - dir: V, HW: [[888,MAIN]], stretch: {top:[0x2191,SIZE1], ext:[0x23D0,SIZE1]} - }, - 0x2192: // right arrow - { - dir: H, HW: [[1000,MAIN]], stretch: {rep:ARROWREP, right:[0x2192,MAIN], fuzz:300} - }, - 0x2193: // \downarrow - { - dir: V, HW: [[888,MAIN]], stretch: {ext:[0x23D0,SIZE1], bot:[0x2193,SIZE1]} - }, - 0x2194: // left-right arrow - { - dir: H, HW: [[1000,MAIN]], - stretch: {left:[0x2190,MAIN], rep:ARROWREP, right:[0x2192,MAIN], fuzz:300} - }, - 0x2195: // \updownarrow - { - dir: V, HW: [[1044,MAIN]], - stretch: {top:[0x2191,SIZE1], ext:[0x23D0,SIZE1], bot:[0x2193,SIZE1]} - }, - 0x21D0: // left double arrow - { - dir: H, HW: [[1000,MAIN]], stretch: {left:[0x21D0,MAIN], rep:DARROWREP, fuzz:300} - }, - 0x21D1: // \Uparrow - { - dir: V, HW: [[888,MAIN]], stretch: {top:[0x21D1,SIZE1], ext:[0x2016,SIZE1]} - }, - 0x21D2: // right double arrow - { - dir: H, HW: [[1000,MAIN]], stretch: {rep:DARROWREP, right:[0x21D2,MAIN], fuzz:300} - }, - 0x21D3: // \Downarrow - { - dir: V, HW: [[888,MAIN]], stretch: {ext:[0x2016,SIZE1], bot:[0x21D3,SIZE1]} - }, - 0x21D4: // left-right double arrow - { - dir: H, HW: [[1000,MAIN]], - stretch: {left:[0x21D0,MAIN], rep:DARROWREP, right:[0x21D2,MAIN], fuzz:300} - }, - 0x21D5: // \Updownarrow - { - dir: V, HW: [[1044,MAIN]], - stretch: {top:[0x21D1,SIZE1], ext:[0x2016,SIZE1], bot:[0x21D3,SIZE1]} - }, - 0x2212: // horizontal line - { - dir: H, HW: [[778,MAIN]], stretch: {rep:[0x2212,MAIN], fuzz:300} - }, - 0x221A: // \surd - { - dir: V, HW: STDHW, - stretch: {top:[0xE001,SIZE4], ext:[0xE000,SIZE4], bot:[0x23B7,SIZE4], fullExtenders:true} - }, - 0x2223: // \vert - { - dir: V, HW: [[1000,MAIN]], stretch: {ext:[0x2223,MAIN]} - }, - 0x2225: // \Vert - { - dir: V, HW: [[1000,MAIN]], stretch: {ext:[0x2225,MAIN]} - }, - 0x2308: // \lceil - { - dir: V, HW: STDHW, stretch: {top:[0x23A1,SIZE4], ext:[0x23A2,SIZE4]} - }, - 0x2309: // \rceil - { - dir: V, HW: STDHW, stretch: {top:[0x23A4,SIZE4], ext:[0x23A5,SIZE4]} - }, - 0x230A: // \lfloor - { - dir: V, HW: STDHW, stretch: {ext:[0x23A2,SIZE4], bot:[0x23A3,SIZE4]} - }, - 0x230B: // \rfloor - { - dir: V, HW: STDHW, stretch: {ext:[0x23A5,SIZE4], bot:[0x23A6,SIZE4]} - }, - 0x23AA: // \bracevert - { - dir: V, HW: [[320,SIZE4]], - stretch: {top:[0x23AA,SIZE4], ext:[0x23AA,SIZE4], bot:[0x23AA,SIZE4]} - }, - 0x23B0: // \lmoustache - { - dir: V, HW: [[989,MAIN]], - stretch: {top:[0x23A7,SIZE4], ext:[0x23AA,SIZE4], bot:[0x23AD,SIZE4]} - }, - 0x23B1: // \rmoustache - { - dir: V, HW: [[989,MAIN]], - stretch: {top:[0x23AB,SIZE4], ext:[0x23AA,SIZE4], bot:[0x23A9,SIZE4]} - }, - 0x23D0: // vertical line extension - { - dir: V, HW: [[602,SIZE1],[1000,MAIN,null,0x2223]], stretch: {ext:[0x2223,MAIN]} - }, - 0x23DE: // horizontal brace down - { - dir: H, HW: [], - stretch: {min:.9, left:[0xE150,SIZE4], mid:[[0xE153,0xE152],SIZE4], right:[0xE151,SIZE4], rep:[0xE154,SIZE4]} - }, - 0x23DF: // horizontal brace up - { - dir: H, HW: [], - stretch: {min:.9, left:[0xE152,SIZE4], mid:[[0xE151,0xE150],SIZE4], right:[0xE153,SIZE4], rep:[0xE154,SIZE4]} - }, - 0x27E8: // \langle - { - dir: V, HW: STDHW - }, - 0x27E9: // \rangle - { - dir: V, HW: STDHW - }, - 0x27EE: // \lgroup - { - dir: V, HW: [[989,MAIN]], - stretch: {top:[0x23A7,SIZE4], ext:[0x23AA,SIZE4], bot:[0x23A9,SIZE4]} - }, - 0x27EF: // \rgroup - { - dir: V, HW: [[989,MAIN]], - stretch: {top:[0x23AB,SIZE4], ext:[0x23AA,SIZE4], bot:[0x23AD,SIZE4]} - }, - 0x002D: {alias: 0x2212, dir:H}, // minus - 0x005E: {alias: 0x02C6, dir:H}, // wide hat - 0x005F: {alias: 0x2212, dir:H}, // low line - 0x007E: {alias: 0x02DC, dir:H}, // wide tilde - 0x02C9: {alias: 0x00AF, dir:H}, // macron - 0x0302: {alias: 0x02C6, dir:H}, // wide hat - 0x0303: {alias: 0x02DC, dir:H}, // wide tilde - 0x030C: {alias: 0x02C7, dir:H}, // wide caron - 0x0332: {alias: 0x2212, dir:H}, // combining low line - 0x2015: {alias: 0x2212, dir:H}, // horizontal line - 0x2017: {alias: 0x2212, dir:H}, // horizontal line - 0x203E: {alias: 0x00AF, dir:H}, // over line - 0x2215: {alias: 0x002F, dir:V}, // division slash - 0x2329: {alias: 0x27E8, dir:V}, // langle - 0x232A: {alias: 0x27E9, dir:V}, // rangle - 0x23AF: {alias: 0x2212, dir:H}, // horizontal line extension - 0x2500: {alias: 0x2212, dir:H}, // horizontal line - 0x2758: {alias: 0x2223, dir:V}, // vertical separator - 0x3008: {alias: 0x27E8, dir:V}, // langle - 0x3009: {alias: 0x27E9, dir:V}, // rangle - 0xFE37: {alias: 0x23DE, dir:H}, // horizontal brace down - 0xFE38: {alias: 0x23DF, dir:H}, // horizontal brace up - - 0x003D: EXTRAH, // equal sign - 0x219E: EXTRAH, // left two-headed arrow - 0x21A0: EXTRAH, // right two-headed arrow - 0x21A4: EXTRAH, // left arrow from bar - 0x21A5: EXTRAV, // up arrow from bar - 0x21A6: EXTRAH, // right arrow from bar - 0x21A7: EXTRAV, // down arrow from bar - 0x21B0: EXTRAV, // up arrow with top leftwards - 0x21B1: EXTRAV, // up arrow with top right - 0x21BC: EXTRAH, // left harpoon with barb up - 0x21BD: EXTRAH, // left harpoon with barb down - 0x21BE: EXTRAV, // up harpoon with barb right - 0x21BF: EXTRAV, // up harpoon with barb left - 0x21C0: EXTRAH, // right harpoon with barb up - 0x21C1: EXTRAH, // right harpoon with barb down - 0x21C2: EXTRAV, // down harpoon with barb right - 0x21C3: EXTRAV, // down harpoon with barb left - 0x21DA: EXTRAH, // left triple arrow - 0x21DB: EXTRAH, // right triple arrow - 0x23B4: EXTRAH, // top square bracket - 0x23B5: EXTRAH, // bottom square bracket - 0x23DC: EXTRAH, // top paren - 0x23DD: EXTRAH, // bottom paren - 0x23E0: EXTRAH, // top tortoise shell - 0x23E1: EXTRAH, // bottom tortoise shell - 0x2906: EXTRAH, // leftwards double arrow from bar - 0x2907: EXTRAH, // rightwards double arrow from bar - 0x294E: EXTRAH, // left barb up right barb up harpoon - 0x294F: EXTRAV, // up barb right down barb right harpoon - 0x2950: EXTRAH, // left barb dow right barb down harpoon - 0x2951: EXTRAV, // up barb left down barb left harpoon - 0x295A: EXTRAH, // leftwards harpoon with barb up from bar - 0x295B: EXTRAH, // rightwards harpoon with barb up from bar - 0x295C: EXTRAV, // up harpoon with barb right from bar - 0x295D: EXTRAV, // down harpoon with barb right from bar - 0x295E: EXTRAH, // leftwards harpoon with barb down from bar - 0x295F: EXTRAH, // rightwards harpoon with barb down from bar - 0x2960: EXTRAV, // up harpoon with barb left from bar - 0x2961: EXTRAV, // down harpoon with barb left from bar - 0x2312: {alias: 0x23DC, dir:H}, // arc - 0x2322: {alias: 0x23DC, dir:H}, // frown - 0x2323: {alias: 0x23DD, dir:H}, // smile - 0x27F5: {alias: 0x2190, dir:H}, // long left arrow - 0x27F6: {alias: 0x2192, dir:H}, // long right arrow - 0x27F7: {alias: 0x2194, dir:H}, // long left-right arrow - 0x27F8: {alias: 0x21D0, dir:H}, // long left double arrow - 0x27F9: {alias: 0x21D2, dir:H}, // long right double arrow - 0x27FA: {alias: 0x21D4, dir:H}, // long left-right double arrow - 0x27FB: {alias: 0x21A4, dir:H}, // long left arrow from bar - 0x27FC: {alias: 0x21A6, dir:H}, // long right arrow from bar - 0x27FD: {alias: 0x2906, dir:H}, // long left double arrow from bar - 0x27FE: {alias: 0x2907, dir:H} // long right double arrow from bar - } - } - }); - - - SVG.FONTDATA.FONTS['MathJax_Main'] = { - directory: 'Main/Regular', - family: 'MathJax_Main', - id: 'MJMAIN', - skew: { - 0x131: 0.0278, - 0x237: 0.0833, - 0x2113: 0.111, - 0x2118: 0.111, - 0x2202: 0.0833 - }, - Ranges: [ - [0x20,0x7F,"BasicLatin"], - [0x100,0x17F,"LatinExtendedA"], - [0x180,0x24F,"LatinExtendedB"], - [0x2B0,0x2FF,"SpacingModLetters"], - [0x300,0x36F,"CombDiacritMarks"], - [0x370,0x3FF,"GreekAndCoptic"], - [0x2100,0x214F,"LetterlikeSymbols"], - [0x2200,0x22FF,"MathOperators"], - [0x25A0,0x25FF,"GeometricShapes"], - [0x2600,0x26FF,"MiscSymbols"], - [0x2A00,0x2AFF,"SuppMathOperators"] - ], - - // SPACE - 0x20: [0,0,250,0,0,''], - - // LEFT PARENTHESIS - 0x28: [750,250,389,94,333,'94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250'], - - // RIGHT PARENTHESIS - 0x29: [750,250,389,55,294,'60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749'], - - // PLUS SIGN - 0x2B: [583,82,778,56,722,'56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250'], - - // COMMA - 0x2C: [121,195,278,78,210,'78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17'], - - // FULL STOP - 0x2E: [120,0,278,78,199,'78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60'], - - // SOLIDUS - 0x2F: [750,250,500,56,444,'423 750Q432 750 438 744T444 730Q444 725 271 248T92 -240Q85 -250 75 -250Q68 -250 62 -245T56 -231Q56 -221 230 257T407 740Q411 750 423 750'], - - // DIGIT ZERO - 0x30: [666,22,500,39,460,'96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597'], - - // DIGIT ONE - 0x31: [666,0,500,83,427,'213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578'], - - // DIGIT TWO - 0x32: [666,0,500,50,449,'109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429'], - - // DIGIT THREE - 0x33: [665,22,500,42,457,'127 463Q100 463 85 480T69 524Q69 579 117 622T233 665Q268 665 277 664Q351 652 390 611T430 522Q430 470 396 421T302 350L299 348Q299 347 308 345T337 336T375 315Q457 262 457 175Q457 96 395 37T238 -22Q158 -22 100 21T42 130Q42 158 60 175T105 193Q133 193 151 175T169 130Q169 119 166 110T159 94T148 82T136 74T126 70T118 67L114 66Q165 21 238 21Q293 21 321 74Q338 107 338 175V195Q338 290 274 322Q259 328 213 329L171 330L168 332Q166 335 166 348Q166 366 174 366Q202 366 232 371Q266 376 294 413T322 525V533Q322 590 287 612Q265 626 240 626Q208 626 181 615T143 592T132 580H135Q138 579 143 578T153 573T165 566T175 555T183 540T186 520Q186 498 172 481T127 463'], - - // DIGIT FOUR - 0x34: [677,0,500,28,471,'462 0Q444 3 333 3Q217 3 199 0H190V46H221Q241 46 248 46T265 48T279 53T286 61Q287 63 287 115V165H28V211L179 442Q332 674 334 675Q336 677 355 677H373L379 671V211H471V165H379V114Q379 73 379 66T385 54Q393 47 442 46H471V0H462ZM293 211V545L74 212L183 211H293'], - - // DIGIT FIVE - 0x35: [666,22,500,50,449,'164 157Q164 133 148 117T109 101H102Q148 22 224 22Q294 22 326 82Q345 115 345 210Q345 313 318 349Q292 382 260 382H254Q176 382 136 314Q132 307 129 306T114 304Q97 304 95 310Q93 314 93 485V614Q93 664 98 664Q100 666 102 666Q103 666 123 658T178 642T253 634Q324 634 389 662Q397 666 402 666Q410 666 410 648V635Q328 538 205 538Q174 538 149 544L139 546V374Q158 388 169 396T205 412T256 420Q337 420 393 355T449 201Q449 109 385 44T229 -22Q148 -22 99 32T50 154Q50 178 61 192T84 210T107 214Q132 214 148 197T164 157'], - - // DIGIT SIX - 0x36: [666,22,500,41,456,'42 313Q42 476 123 571T303 666Q372 666 402 630T432 550Q432 525 418 510T379 495Q356 495 341 509T326 548Q326 592 373 601Q351 623 311 626Q240 626 194 566Q147 500 147 364L148 360Q153 366 156 373Q197 433 263 433H267Q313 433 348 414Q372 400 396 374T435 317Q456 268 456 210V192Q456 169 451 149Q440 90 387 34T253 -22Q225 -22 199 -14T143 16T92 75T56 172T42 313ZM257 397Q227 397 205 380T171 335T154 278T148 216Q148 133 160 97T198 39Q222 21 251 21Q302 21 329 59Q342 77 347 104T352 209Q352 289 347 316T329 361Q302 397 257 397'], - - // DIGIT SEVEN - 0x37: [676,22,500,55,485,'55 458Q56 460 72 567L88 674Q88 676 108 676H128V672Q128 662 143 655T195 646T364 644H485V605L417 512Q408 500 387 472T360 435T339 403T319 367T305 330T292 284T284 230T278 162T275 80Q275 66 275 52T274 28V19Q270 2 255 -10T221 -22Q210 -22 200 -19T179 0T168 40Q168 198 265 368Q285 400 349 489L395 552H302Q128 552 119 546Q113 543 108 522T98 479L95 458V455H55V458'], - - // DIGIT EIGHT - 0x38: [666,22,500,43,457,'70 417T70 494T124 618T248 666Q319 666 374 624T429 515Q429 485 418 459T392 417T361 389T335 371T324 363L338 354Q352 344 366 334T382 323Q457 264 457 174Q457 95 399 37T249 -22Q159 -22 101 29T43 155Q43 263 172 335L154 348Q133 361 127 368Q70 417 70 494ZM286 386L292 390Q298 394 301 396T311 403T323 413T334 425T345 438T355 454T364 471T369 491T371 513Q371 556 342 586T275 624Q268 625 242 625Q201 625 165 599T128 534Q128 511 141 492T167 463T217 431Q224 426 228 424L286 386ZM250 21Q308 21 350 55T392 137Q392 154 387 169T375 194T353 216T330 234T301 253T274 270Q260 279 244 289T218 306L210 311Q204 311 181 294T133 239T107 157Q107 98 150 60T250 21'], - - // DIGIT NINE - 0x39: [666,22,500,42,456,'352 287Q304 211 232 211Q154 211 104 270T44 396Q42 412 42 436V444Q42 537 111 606Q171 666 243 666Q245 666 249 666T257 665H261Q273 665 286 663T323 651T370 619T413 560Q456 472 456 334Q456 194 396 97Q361 41 312 10T208 -22Q147 -22 108 7T68 93T121 149Q143 149 158 135T173 96Q173 78 164 65T148 49T135 44L131 43Q131 41 138 37T164 27T206 22H212Q272 22 313 86Q352 142 352 280V287ZM244 248Q292 248 321 297T351 430Q351 508 343 542Q341 552 337 562T323 588T293 615T246 625Q208 625 181 598Q160 576 154 546T147 441Q147 358 152 329T172 282Q197 248 244 248'], - - // COLON - 0x3A: [430,0,278,78,199,'78 370Q78 394 95 412T138 430Q162 430 180 414T199 371Q199 346 182 328T139 310T96 327T78 370ZM78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60'], - - // SEMICOLON - 0x3B: [430,194,278,78,202,'78 370Q78 394 95 412T138 430Q162 430 180 414T199 371Q199 346 182 328T139 310T96 327T78 370ZM78 60Q78 85 94 103T137 121Q202 121 202 8Q202 -44 183 -94T144 -169T118 -194Q115 -194 106 -186T95 -174Q94 -171 107 -155T137 -107T160 -38Q161 -32 162 -22T165 -4T165 4Q165 5 161 4T142 0Q110 0 94 18T78 60'], - - // LESS-THAN SIGN - 0x3C: [540,40,778,83,695,'694 -11T694 -19T688 -33T678 -40Q671 -40 524 29T234 166L90 235Q83 240 83 250Q83 261 91 266Q664 540 678 540Q681 540 687 534T694 519T687 505Q686 504 417 376L151 250L417 124Q686 -4 687 -5Q694 -11 694 -19'], - - // EQUALS SIGN - 0x3D: [367,-133,778,56,722,'56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153'], - - // GREATER-THAN SIGN - 0x3E: [540,40,778,82,694,'84 520Q84 528 88 533T96 539L99 540Q106 540 253 471T544 334L687 265Q694 260 694 250T687 235Q685 233 395 96L107 -40H101Q83 -38 83 -20Q83 -19 83 -17Q82 -10 98 -1Q117 9 248 71Q326 108 378 132L626 250L378 368Q90 504 86 509Q84 513 84 520'], - - // LEFT SQUARE BRACKET - 0x5B: [750,250,278,118,255,'118 -250V750H255V710H158V-210H255V-250H118'], - - // REVERSE SOLIDUS - 0x5C: [750,250,500,56,444,'56 731Q56 740 62 745T75 750Q85 750 92 740Q96 733 270 255T444 -231Q444 -239 438 -244T424 -250Q414 -250 407 -240Q404 -236 230 242T56 731'], - - // RIGHT SQUARE BRACKET - 0x5D: [750,250,278,22,159,'22 710V750H159V-250H22V-210H119V710H22'], - - // CIRCUMFLEX ACCENT - 0x5E: [694,-531,500,112,387,'112 560L249 694L257 686Q387 562 387 560L361 531Q359 532 303 581L250 627L195 580Q182 569 169 557T148 538L140 532Q138 530 125 546L112 560'], - - // LATIN SMALL LETTER A - 0x61: [448,11,500,34,493,'137 305T115 305T78 320T63 359Q63 394 97 421T218 448Q291 448 336 416T396 340Q401 326 401 309T402 194V124Q402 76 407 58T428 40Q443 40 448 56T453 109V145H493V106Q492 66 490 59Q481 29 455 12T400 -6T353 12T329 54V58L327 55Q325 52 322 49T314 40T302 29T287 17T269 6T247 -2T221 -8T190 -11Q130 -11 82 20T34 107Q34 128 41 147T68 188T116 225T194 253T304 268H318V290Q318 324 312 340Q290 411 215 411Q197 411 181 410T156 406T148 403Q170 388 170 359Q170 334 154 320ZM126 106Q126 75 150 51T209 26Q247 26 276 49T315 109Q317 116 318 175Q318 233 317 233Q309 233 296 232T251 223T193 203T147 166T126 106'], - - // LATIN SMALL LETTER B - 0x62: [695,11,556,20,522,'307 -11Q234 -11 168 55L158 37Q156 34 153 28T147 17T143 10L138 1L118 0H98V298Q98 599 97 603Q94 622 83 628T38 637H20V660Q20 683 22 683L32 684Q42 685 61 686T98 688Q115 689 135 690T165 693T176 694H179V543Q179 391 180 391L183 394Q186 397 192 401T207 411T228 421T254 431T286 439T323 442Q401 442 461 379T522 216Q522 115 458 52T307 -11ZM182 98Q182 97 187 90T196 79T206 67T218 55T233 44T250 35T271 29T295 26Q330 26 363 46T412 113Q424 148 424 212Q424 287 412 323Q385 405 300 405Q270 405 239 390T188 347L182 339V98'], - - // LATIN SMALL LETTER C - 0x63: [448,12,444,34,415,'370 305T349 305T313 320T297 358Q297 381 312 396Q317 401 317 402T307 404Q281 408 258 408Q209 408 178 376Q131 329 131 219Q131 137 162 90Q203 29 272 29Q313 29 338 55T374 117Q376 125 379 127T395 129H409Q415 123 415 120Q415 116 411 104T395 71T366 33T318 2T249 -11Q163 -11 99 53T34 214Q34 318 99 383T250 448T370 421T404 357Q404 334 387 320'], - - // LATIN SMALL LETTER D - 0x64: [695,11,556,34,535,'376 495Q376 511 376 535T377 568Q377 613 367 624T316 637H298V660Q298 683 300 683L310 684Q320 685 339 686T376 688Q393 689 413 690T443 693T454 694H457V390Q457 84 458 81Q461 61 472 55T517 46H535V0Q533 0 459 -5T380 -11H373V44L365 37Q307 -11 235 -11Q158 -11 96 50T34 215Q34 315 97 378T244 442Q319 442 376 393V495ZM373 342Q328 405 260 405Q211 405 173 369Q146 341 139 305T131 211Q131 155 138 120T173 59Q203 26 251 26Q322 26 373 103V342'], - - // LATIN SMALL LETTER E - 0x65: [448,11,444,28,415,'28 218Q28 273 48 318T98 391T163 433T229 448Q282 448 320 430T378 380T406 316T415 245Q415 238 408 231H126V216Q126 68 226 36Q246 30 270 30Q312 30 342 62Q359 79 369 104L379 128Q382 131 395 131H398Q415 131 415 121Q415 117 412 108Q393 53 349 21T250 -11Q155 -11 92 58T28 218ZM333 275Q322 403 238 411H236Q228 411 220 410T195 402T166 381T143 340T127 274V267H333V275'], - - // LATIN SMALL LETTER F - 0x66: [705,0,306,26,372,'273 0Q255 3 146 3Q43 3 34 0H26V46H42Q70 46 91 49Q99 52 103 60Q104 62 104 224V385H33V431H104V497L105 564L107 574Q126 639 171 668T266 704Q267 704 275 704T289 705Q330 702 351 679T372 627Q372 604 358 590T321 576T284 590T270 627Q270 647 288 667H284Q280 668 273 668Q245 668 223 647T189 592Q183 572 182 497V431H293V385H185V225Q185 63 186 61T189 57T194 54T199 51T206 49T213 48T222 47T231 47T241 46T251 46H282V0H273'], - - // LATIN SMALL LETTER G - 0x67: [453,206,500,29,485,'329 409Q373 453 429 453Q459 453 472 434T485 396Q485 382 476 371T449 360Q416 360 412 390Q410 404 415 411Q415 412 416 414V415Q388 412 363 393Q355 388 355 386Q355 385 359 381T368 369T379 351T388 325T392 292Q392 230 343 187T222 143Q172 143 123 171Q112 153 112 133Q112 98 138 81Q147 75 155 75T227 73Q311 72 335 67Q396 58 431 26Q470 -13 470 -72Q470 -139 392 -175Q332 -206 250 -206Q167 -206 107 -175Q29 -140 29 -75Q29 -39 50 -15T92 18L103 24Q67 55 67 108Q67 155 96 193Q52 237 52 292Q52 355 102 398T223 442Q274 442 318 416L329 409ZM299 343Q294 371 273 387T221 404Q192 404 171 388T145 343Q142 326 142 292Q142 248 149 227T179 192Q196 182 222 182Q244 182 260 189T283 207T294 227T299 242Q302 258 302 292T299 343ZM403 -75Q403 -50 389 -34T348 -11T299 -2T245 0H218Q151 0 138 -6Q118 -15 107 -34T95 -74Q95 -84 101 -97T122 -127T170 -155T250 -167Q319 -167 361 -139T403 -75'], - - // LATIN SMALL LETTER H - 0x68: [695,0,556,25,542,'41 46H55Q94 46 102 60V68Q102 77 102 91T102 124T102 167T103 217T103 272T103 329Q103 366 103 407T103 482T102 542T102 586T102 603Q99 622 88 628T43 637H25V660Q25 683 27 683L37 684Q47 685 66 686T103 688Q120 689 140 690T170 693T181 694H184V367Q244 442 328 442Q451 442 463 329Q464 322 464 190V104Q464 66 466 59T477 49Q498 46 526 46H542V0H534L510 1Q487 2 460 2T422 3Q319 3 310 0H302V46H318Q379 46 379 62Q380 64 380 200Q379 335 378 343Q372 371 358 385T334 402T308 404Q263 404 229 370Q202 343 195 315T187 232V168V108Q187 78 188 68T191 55T200 49Q221 46 249 46H265V0H257L234 1Q210 2 183 2T145 3Q42 3 33 0H25V46H41'], - - // LATIN SMALL LETTER I - 0x69: [669,0,278,26,255,'69 609Q69 637 87 653T131 669Q154 667 171 652T188 609Q188 579 171 564T129 549Q104 549 87 564T69 609ZM247 0Q232 3 143 3Q132 3 106 3T56 1L34 0H26V46H42Q70 46 91 49Q100 53 102 60T104 102V205V293Q104 345 102 359T88 378Q74 385 41 385H30V408Q30 431 32 431L42 432Q52 433 70 434T106 436Q123 437 142 438T171 441T182 442H185V62Q190 52 197 50T232 46H255V0H247'], - - // LATIN SMALL LETTER J - 0x6A: [669,205,306,-55,218,'98 609Q98 637 116 653T160 669Q183 667 200 652T217 609Q217 579 200 564T158 549Q133 549 116 564T98 609ZM28 -163Q58 -168 64 -168Q124 -168 135 -77Q137 -65 137 141T136 353Q132 371 120 377T72 385H52V408Q52 431 54 431L58 432Q62 432 70 432T87 433T108 434T133 436Q151 437 171 438T202 441T214 442H218V184Q217 -36 217 -59T211 -98Q195 -145 153 -175T58 -205Q9 -205 -23 -179T-55 -117Q-55 -94 -40 -79T-2 -64T36 -79T52 -118Q52 -143 28 -163'], - - // LATIN SMALL LETTER K - 0x6B: [695,0,528,20,511,'36 46H50Q89 46 97 60V68Q97 77 97 91T97 124T98 167T98 217T98 272T98 329Q98 366 98 407T98 482T98 542T97 586T97 603Q94 622 83 628T38 637H20V660Q20 683 22 683L32 684Q42 685 61 686T98 688Q115 689 135 690T165 693T176 694H179V463L180 233L240 287Q300 341 304 347Q310 356 310 364Q310 383 289 385H284V431H293Q308 428 412 428Q475 428 484 431H489V385H476Q407 380 360 341Q286 278 286 274Q286 273 349 181T420 79Q434 60 451 53T500 46H511V0H505Q496 3 418 3Q322 3 307 0H299V46H306Q330 48 330 65Q330 72 326 79Q323 84 276 153T228 222L176 176V120V84Q176 65 178 59T189 49Q210 46 238 46H254V0H246Q231 3 137 3T28 0H20V46H36'], - - // LATIN SMALL LETTER L - 0x6C: [695,0,278,26,263,'42 46H56Q95 46 103 60V68Q103 77 103 91T103 124T104 167T104 217T104 272T104 329Q104 366 104 407T104 482T104 542T103 586T103 603Q100 622 89 628T44 637H26V660Q26 683 28 683L38 684Q48 685 67 686T104 688Q121 689 141 690T171 693T182 694H185V379Q185 62 186 60Q190 52 198 49Q219 46 247 46H263V0H255L232 1Q209 2 183 2T145 3T107 3T57 1L34 0H26V46H42'], - - // LATIN SMALL LETTER M - 0x6D: [443,0,833,25,819,'41 46H55Q94 46 102 60V68Q102 77 102 91T102 122T103 161T103 203Q103 234 103 269T102 328V351Q99 370 88 376T43 385H25V408Q25 431 27 431L37 432Q47 433 65 434T102 436Q119 437 138 438T167 441T178 442H181V402Q181 364 182 364T187 369T199 384T218 402T247 421T285 437Q305 442 336 442Q351 442 364 440T387 434T406 426T421 417T432 406T441 395T448 384T452 374T455 366L457 361L460 365Q463 369 466 373T475 384T488 397T503 410T523 422T546 432T572 439T603 442Q729 442 740 329Q741 322 741 190V104Q741 66 743 59T754 49Q775 46 803 46H819V0H811L788 1Q764 2 737 2T699 3Q596 3 587 0H579V46H595Q656 46 656 62Q657 64 657 200Q656 335 655 343Q649 371 635 385T611 402T585 404Q540 404 506 370Q479 343 472 315T464 232V168V108Q464 78 465 68T468 55T477 49Q498 46 526 46H542V0H534L510 1Q487 2 460 2T422 3Q319 3 310 0H302V46H318Q379 46 379 62Q380 64 380 200Q379 335 378 343Q372 371 358 385T334 402T308 404Q263 404 229 370Q202 343 195 315T187 232V168V108Q187 78 188 68T191 55T200 49Q221 46 249 46H265V0H257L234 1Q210 2 183 2T145 3Q42 3 33 0H25V46H41'], - - // LATIN SMALL LETTER N - 0x6E: [443,0,556,25,542,'41 46H55Q94 46 102 60V68Q102 77 102 91T102 122T103 161T103 203Q103 234 103 269T102 328V351Q99 370 88 376T43 385H25V408Q25 431 27 431L37 432Q47 433 65 434T102 436Q119 437 138 438T167 441T178 442H181V402Q181 364 182 364T187 369T199 384T218 402T247 421T285 437Q305 442 336 442Q450 438 463 329Q464 322 464 190V104Q464 66 466 59T477 49Q498 46 526 46H542V0H534L510 1Q487 2 460 2T422 3Q319 3 310 0H302V46H318Q379 46 379 62Q380 64 380 200Q379 335 378 343Q372 371 358 385T334 402T308 404Q263 404 229 370Q202 343 195 315T187 232V168V108Q187 78 188 68T191 55T200 49Q221 46 249 46H265V0H257L234 1Q210 2 183 2T145 3Q42 3 33 0H25V46H41'], - - // LATIN SMALL LETTER O - 0x6F: [448,10,500,28,471,'28 214Q28 309 93 378T250 448Q340 448 405 380T471 215Q471 120 407 55T250 -10Q153 -10 91 57T28 214ZM250 30Q372 30 372 193V225V250Q372 272 371 288T364 326T348 362T317 390T268 410Q263 411 252 411Q222 411 195 399Q152 377 139 338T126 246V226Q126 130 145 91Q177 30 250 30'], - - // LATIN SMALL LETTER P - 0x70: [443,194,556,20,522,'36 -148H50Q89 -148 97 -134V-126Q97 -119 97 -107T97 -77T98 -38T98 6T98 55T98 106Q98 140 98 177T98 243T98 296T97 335T97 351Q94 370 83 376T38 385H20V408Q20 431 22 431L32 432Q42 433 61 434T98 436Q115 437 135 438T165 441T176 442H179V416L180 390L188 397Q247 441 326 441Q407 441 464 377T522 216Q522 115 457 52T310 -11Q242 -11 190 33L182 40V-45V-101Q182 -128 184 -134T195 -145Q216 -148 244 -148H260V-194H252L228 -193Q205 -192 178 -192T140 -191Q37 -191 28 -194H20V-148H36ZM424 218Q424 292 390 347T305 402Q234 402 182 337V98Q222 26 294 26Q345 26 384 80T424 218'], - - // LATIN SMALL LETTER Q - 0x71: [442,194,528,33,535,'33 218Q33 308 95 374T236 441H246Q330 441 381 372L387 364Q388 364 404 403L420 442H457V156Q457 -132 458 -134Q462 -142 470 -145Q491 -148 519 -148H535V-194H527L504 -193Q480 -192 453 -192T415 -191Q312 -191 303 -194H295V-148H311Q339 -148 360 -145Q369 -141 371 -135T373 -106V-41V49Q313 -11 236 -11Q154 -11 94 53T33 218ZM376 300Q346 389 278 401Q275 401 269 401T261 402Q211 400 171 350T131 214Q131 137 165 82T253 27Q296 27 328 54T376 118V300'], - - // LATIN SMALL LETTER R - 0x72: [443,0,392,20,364,'36 46H50Q89 46 97 60V68Q97 77 97 91T98 122T98 161T98 203Q98 234 98 269T98 328L97 351Q94 370 83 376T38 385H20V408Q20 431 22 431L32 432Q42 433 60 434T96 436Q112 437 131 438T160 441T171 442H174V373Q213 441 271 441H277Q322 441 343 419T364 373Q364 352 351 337T313 322Q288 322 276 338T263 372Q263 381 265 388T270 400T273 405Q271 407 250 401Q234 393 226 386Q179 341 179 207V154Q179 141 179 127T179 101T180 81T180 66V61Q181 59 183 57T188 54T193 51T200 49T207 48T216 47T225 47T235 46T245 46H276V0H267Q249 3 140 3Q37 3 28 0H20V46H36'], - - // LATIN SMALL LETTER S - 0x73: [448,11,394,33,359,'295 316Q295 356 268 385T190 414Q154 414 128 401Q98 382 98 349Q97 344 98 336T114 312T157 287Q175 282 201 278T245 269T277 256Q294 248 310 236T342 195T359 133Q359 71 321 31T198 -10H190Q138 -10 94 26L86 19L77 10Q71 4 65 -1L54 -11H46H42Q39 -11 33 -5V74V132Q33 153 35 157T45 162H54Q66 162 70 158T75 146T82 119T101 77Q136 26 198 26Q295 26 295 104Q295 133 277 151Q257 175 194 187T111 210Q75 227 54 256T33 318Q33 357 50 384T93 424T143 442T187 447H198Q238 447 268 432L283 424L292 431Q302 440 314 448H322H326Q329 448 335 442V310L329 304H301Q295 310 295 316'], - - // LATIN SMALL LETTER T - 0x74: [615,10,389,18,333,'27 422Q80 426 109 478T141 600V615H181V431H316V385H181V241Q182 116 182 100T189 68Q203 29 238 29Q282 29 292 100Q293 108 293 146V181H333V146V134Q333 57 291 17Q264 -10 221 -10Q187 -10 162 2T124 33T105 68T98 100Q97 107 97 248V385H18V422H27'], - - // LATIN SMALL LETTER U - 0x75: [443,11,556,25,542,'383 58Q327 -10 256 -10H249Q124 -10 105 89Q104 96 103 226Q102 335 102 348T96 369Q86 385 36 385H25V408Q25 431 27 431L38 432Q48 433 67 434T105 436Q122 437 142 438T172 441T184 442H187V261Q188 77 190 64Q193 49 204 40Q224 26 264 26Q290 26 311 35T343 58T363 90T375 120T379 144Q379 145 379 161T380 201T380 248V315Q380 361 370 372T320 385H302V431Q304 431 378 436T457 442H464V264Q464 84 465 81Q468 61 479 55T524 46H542V0Q540 0 467 -5T390 -11H383V58'], - - // LATIN SMALL LETTER V - 0x76: [431,11,528,19,508,'338 431Q344 429 422 429Q479 429 503 431H508V385H497Q439 381 423 345Q421 341 356 172T288 -2Q283 -11 263 -11Q244 -11 239 -2Q99 359 98 364Q93 378 82 381T43 385H19V431H25L33 430Q41 430 53 430T79 430T104 429T122 428Q217 428 232 431H240V385H226Q187 384 184 370Q184 366 235 234L286 102L377 341V349Q377 363 367 372T349 383T335 385H331V431H338'], - - // LATIN SMALL LETTER W - 0x77: [431,11,722,18,703,'90 368Q84 378 76 380T40 385H18V431H24L43 430Q62 430 84 429T116 428Q206 428 221 431H229V385H215Q177 383 177 368Q177 367 221 239L265 113L339 328L333 345Q323 374 316 379Q308 384 278 385H258V431H264Q270 428 348 428Q439 428 454 431H461V385H452Q404 385 404 369Q404 366 418 324T449 234T481 143L496 100L537 219Q579 341 579 347Q579 363 564 373T530 385H522V431H529Q541 428 624 428Q692 428 698 431H703V385H697Q696 385 691 385T682 384Q635 377 619 334L559 161Q546 124 528 71Q508 12 503 1T487 -11H479Q460 -11 456 -4Q455 -3 407 133L361 267Q359 263 266 -4Q261 -11 243 -11H238Q225 -11 220 -3L90 368'], - - // LATIN SMALL LETTER X - 0x78: [431,0,528,11,516,'201 0Q189 3 102 3Q26 3 17 0H11V46H25Q48 47 67 52T96 61T121 78T139 96T160 122T180 150L226 210L168 288Q159 301 149 315T133 336T122 351T113 363T107 370T100 376T94 379T88 381T80 383Q74 383 44 385H16V431H23Q59 429 126 429Q219 429 229 431H237V385Q201 381 201 369Q201 367 211 353T239 315T268 274L272 270L297 304Q329 345 329 358Q329 364 327 369T322 376T317 380T310 384L307 385H302V431H309Q324 428 408 428Q487 428 493 431H499V385H492Q443 385 411 368Q394 360 377 341T312 257L296 236L358 151Q424 61 429 57T446 50Q464 46 499 46H516V0H510H502Q494 1 482 1T457 2T432 2T414 3Q403 3 377 3T327 1L304 0H295V46H298Q309 46 320 51T331 63Q331 65 291 120L250 175Q249 174 219 133T185 88Q181 83 181 74Q181 63 188 55T206 46Q208 46 208 23V0H201'], - - // LATIN SMALL LETTER Y - 0x79: [431,204,528,19,508,'69 -66Q91 -66 104 -80T118 -116Q118 -134 109 -145T91 -160Q84 -163 97 -166Q104 -168 111 -168Q131 -168 148 -159T175 -138T197 -106T213 -75T225 -43L242 0L170 183Q150 233 125 297Q101 358 96 368T80 381Q79 382 78 382Q66 385 34 385H19V431H26L46 430Q65 430 88 429T122 428Q129 428 142 428T171 429T200 430T224 430L233 431H241V385H232Q183 385 185 366L286 112Q286 113 332 227L376 341V350Q376 365 366 373T348 383T334 385H331V431H337H344Q351 431 361 431T382 430T405 429T422 429Q477 429 503 431H508V385H497Q441 380 422 345Q420 343 378 235T289 9T227 -131Q180 -204 113 -204Q69 -204 44 -177T19 -116Q19 -89 35 -78T69 -66'], - - // LATIN SMALL LETTER Z - 0x7A: [431,0,444,28,401,'42 263Q44 270 48 345T53 423V431H393Q399 425 399 415Q399 403 398 402L381 378Q364 355 331 309T265 220L134 41L182 40H206Q254 40 283 46T331 77Q352 105 359 185L361 201Q361 202 381 202H401V196Q401 195 393 103T384 6V0H209L34 1L31 3Q28 8 28 17Q28 30 29 31T160 210T294 394H236Q169 393 152 388Q127 382 113 367Q89 344 82 264V255H42V263'], - - // LEFT CURLY BRACKET - 0x7B: [750,250,500,65,434,'434 -231Q434 -244 428 -250H410Q281 -250 230 -184Q225 -177 222 -172T217 -161T213 -148T211 -133T210 -111T209 -84T209 -47T209 0Q209 21 209 53Q208 142 204 153Q203 154 203 155Q189 191 153 211T82 231Q71 231 68 234T65 250T68 266T82 269Q116 269 152 289T203 345Q208 356 208 377T209 529V579Q209 634 215 656T244 698Q270 724 324 740Q361 748 377 749Q379 749 390 749T408 750H428Q434 744 434 732Q434 719 431 716Q429 713 415 713Q362 710 332 689T296 647Q291 634 291 499V417Q291 370 288 353T271 314Q240 271 184 255L170 250L184 245Q202 239 220 230T262 196T290 137Q291 131 291 1Q291 -134 296 -147Q306 -174 339 -192T415 -213Q429 -213 431 -216Q434 -219 434 -231'], - - // VERTICAL LINE - 0x7C: [750,249,278,119,159,'139 -249H137Q125 -249 119 -235V251L120 737Q130 750 139 750Q152 750 159 735V-235Q151 -249 141 -249H139'], - - // RIGHT CURLY BRACKET - 0x7D: [750,250,500,65,434,'65 731Q65 745 68 747T88 750Q171 750 216 725T279 670Q288 649 289 635T291 501Q292 362 293 357Q306 312 345 291T417 269Q428 269 431 266T434 250T431 234T417 231Q380 231 345 210T298 157Q293 143 292 121T291 -28V-79Q291 -134 285 -156T256 -198Q202 -250 89 -250Q71 -250 68 -247T65 -230Q65 -224 65 -223T66 -218T69 -214T77 -213Q91 -213 108 -210T146 -200T183 -177T207 -139Q208 -134 209 3L210 139Q223 196 280 230Q315 247 330 250Q305 257 280 270Q225 304 212 352L210 362L209 498Q208 635 207 640Q195 680 154 696T77 713Q68 713 67 716T65 731'], - - // DIAERESIS - 0xA8: [669,-554,500,95,405,'95 612Q95 633 112 651T153 669T193 652T210 612Q210 588 194 571T152 554L127 560Q95 577 95 612ZM289 611Q289 634 304 649T335 668Q336 668 340 668T346 669Q369 669 386 652T404 612T387 572T346 554Q323 554 306 570T289 611'], - - // NOT SIGN - 0xAC: [356,-89,667,56,611,'56 323T56 336T70 356H596Q603 353 611 343V102Q598 89 591 89Q587 89 584 90T579 94T575 98T572 102L571 209V316H70Q56 323 56 336'], - - // MACRON - 0xAF: [590,-544,500,69,430,'69 544V590H430V544H69'], - - // DEGREE SIGN - 0xB0: [715,-542,500,147,352,'147 628Q147 669 179 692T244 715Q298 715 325 689T352 629Q352 592 323 567T249 542Q202 542 175 567T147 628ZM313 628Q313 660 300 669T259 678H253Q248 678 242 678T234 679Q217 679 207 674T192 659T188 644T187 629Q187 600 198 590Q210 579 250 579H265Q279 579 288 581T305 595T313 628'], - - // PLUS-MINUS SIGN - 0xB1: [666,0,778,56,722,'56 320T56 333T70 353H369V502Q369 651 371 655Q376 666 388 666Q402 666 405 654T409 596V500V353H707Q722 345 722 333Q722 320 707 313H409V40H707Q722 32 722 20T707 0H70Q56 7 56 20T70 40H369V313H70Q56 320 56 333'], - - // ACUTE ACCENT - 0xB4: [699,-505,500,203,393,'349 699Q367 699 380 686T393 656Q393 651 392 647T387 637T380 627T367 616T351 602T330 585T303 563L232 505L217 519Q203 533 204 533Q204 534 229 567T282 636T313 678L316 681Q318 684 321 686T328 692T337 697T349 699'], - - // MULTIPLICATION SIGN - 0xD7: [491,-9,778,147,630,'630 29Q630 9 609 9Q604 9 587 25T493 118L389 222L284 117Q178 13 175 11Q171 9 168 9Q160 9 154 15T147 29Q147 36 161 51T255 146L359 250L255 354Q174 435 161 449T147 471Q147 480 153 485T168 490Q173 490 175 489Q178 487 284 383L389 278L493 382Q570 459 587 475T609 491Q630 491 630 471Q630 464 620 453T522 355L418 250L522 145Q606 61 618 48T630 29'], - - // DIVISION SIGN - 0xF7: [537,36,778,56,721,'318 466Q318 500 339 518T386 537Q418 537 438 517T458 466Q458 438 440 417T388 396Q355 396 337 417T318 466ZM56 237T56 250T70 270H706Q721 262 721 250T706 230H70Q56 237 56 250ZM318 34Q318 68 339 86T386 105Q418 105 438 85T458 34Q458 6 440 -15T388 -36Q355 -36 337 -15T318 34'], - - // MODIFIER LETTER CIRCUMFLEX ACCENT - 0x2C6: [694,-531,500,112,387,'112 560L249 694L257 686Q387 562 387 560L361 531Q359 532 303 581L250 627L195 580Q182 569 169 557T148 538L140 532Q138 530 125 546L112 560'], - - // CARON - 0x2C7: [644,-513,500,114,385,'114 611L127 630L136 644Q138 644 193 612Q248 581 250 581L306 612Q361 644 363 644L385 611L318 562L249 513L114 611'], - - // MODIFIER LETTER MACRON - 0x2C9: [590,-544,500,69,430,'69 544V590H430V544H69'], - - // MODIFIER LETTER ACUTE ACCENT - 0x2CA: [699,-505,500,203,393,'349 699Q367 699 380 686T393 656Q393 651 392 647T387 637T380 627T367 616T351 602T330 585T303 563L232 505L217 519Q203 533 204 533Q204 534 229 567T282 636T313 678L316 681Q318 684 321 686T328 692T337 697T349 699'], - - // MODIFIER LETTER GRAVE ACCENT - 0x2CB: [699,-505,500,106,296,'106 655Q106 671 119 685T150 699Q166 699 177 688Q190 671 222 629T275 561T295 533T282 519L267 505L196 563Q119 626 113 634Q106 643 106 655'], - - // BREVE - 0x2D8: [694,-515,500,92,407,'250 515Q179 515 138 565T92 683V694H129V689Q129 688 129 683T130 675Q137 631 169 599T248 567Q304 567 337 608T370 689V694H407V683Q403 617 361 566T250 515'], - - // DOT ABOVE - 0x2D9: [669,-549,500,190,309,'190 609Q190 637 208 653T252 669Q275 667 292 652T309 609Q309 579 292 564T250 549Q225 549 208 564T190 609'], - - // SMALL TILDE - 0x2DC: [668,-565,500,83,416,'179 601Q164 601 151 595T131 584T111 565L97 577L83 588Q83 589 95 603T121 633T142 654Q165 668 187 668T253 650T320 632Q335 632 348 638T368 649T388 668L402 656L416 645Q375 586 344 572Q330 565 313 565Q292 565 248 583T179 601'], - - // EN DASH - 0x2013: [285,-248,500,0,499,'0 248V285H499V248H0'], - - // EM DASH - 0x2014: [285,-248,1000,0,999,'0 248V285H999V248H0'], - - // LEFT SINGLE QUOTATION MARK - 0x2018: [694,-379,278,64,199,'64 494Q64 548 86 597T131 670T160 694Q163 694 172 685T182 672Q182 669 170 656T144 625T116 573T101 501Q101 489 102 489T107 491T120 497T138 500Q163 500 180 483T198 440T181 397T139 379Q110 379 87 405T64 494'], - - // RIGHT SINGLE QUOTATION MARK - 0x2019: [694,-379,278,78,212,'78 634Q78 659 95 676T138 694Q166 694 189 668T212 579Q212 525 190 476T146 403T118 379Q114 379 105 388T95 401Q95 404 107 417T133 448T161 500T176 572Q176 584 175 584T170 581T157 576T139 573Q114 573 96 590T78 634'], - - // LEFT DOUBLE QUOTATION MARK - 0x201C: [694,-379,500,128,466,'128 494Q128 528 137 560T158 616T185 658T209 685T223 694T236 685T245 670Q244 668 231 654T204 622T178 571T164 501Q164 489 165 489T170 491T183 497T201 500Q226 500 244 483T262 440T245 397T202 379Q173 379 151 405T128 494ZM332 494Q332 528 341 560T362 616T389 658T413 685T427 694T439 685T449 672Q449 669 437 656T411 625T383 573T368 501Q368 489 369 489T374 491T387 497T405 500Q430 500 448 483T466 440T449 397T406 379Q377 379 355 405T332 494'], - - // RIGHT DOUBLE QUOTATION MARK - 0x201D: [694,-379,500,34,372,'34 634Q34 659 50 676T93 694Q121 694 144 668T168 579Q168 525 146 476T101 403T73 379Q69 379 60 388T50 401Q50 404 62 417T88 448T116 500T131 572Q131 584 130 584T125 581T112 576T94 573Q69 573 52 590T34 634ZM238 634Q238 659 254 676T297 694Q325 694 348 668T372 579Q372 525 350 476T305 403T277 379Q273 379 264 388T254 401Q254 404 266 417T292 448T320 500T335 572Q335 584 334 584T329 581T316 576T298 573Q273 573 256 590T238 634'], - - // DAGGER - 0x2020: [705,216,444,54,389,'182 675Q195 705 222 705Q234 705 243 700T253 691T263 675L262 655Q262 620 252 549T240 454V449Q250 451 288 461T346 472T377 461T389 431Q389 417 379 404T346 390Q327 390 288 401T243 412H240V405Q245 367 250 339T258 301T261 274T263 225Q263 124 255 -41T239 -213Q236 -216 222 -216H217Q206 -216 204 -212T200 -186Q199 -175 199 -168Q181 38 181 225Q181 265 182 280T191 327T204 405V412H201Q196 412 157 401T98 390Q76 390 66 403T55 431T65 458T98 472Q116 472 155 462T205 449Q204 452 204 460T201 490T193 547Q182 619 182 655V675'], - - // DOUBLE DAGGER - 0x2021: [705,205,444,54,389,'181 658Q181 705 222 705T263 658Q263 633 252 572T240 497Q240 496 241 496Q243 496 285 507T345 519Q365 519 376 508T388 478Q388 466 384 458T375 447T361 438H344Q318 438 282 448T241 459Q240 458 240 456Q240 449 251 384T263 297Q263 278 255 267T238 253T222 250T206 252T190 266T181 297Q181 323 192 383T204 458Q204 459 203 459Q198 459 162 449T101 438H84Q74 443 70 446T61 457T56 478Q56 497 67 508T99 519Q117 519 159 508T203 496Q204 496 204 499Q204 507 193 572T181 658ZM181 202Q181 249 222 249T263 202Q263 185 259 161T249 103T240 48V41H243Q248 41 287 52T346 63T377 52T389 22Q389 8 379 -5T346 -19Q327 -19 288 -8T243 3H240V-4Q243 -24 249 -58T259 -117T263 -158Q263 -177 255 -188T238 -202T222 -205T206 -203T190 -189T181 -158Q181 -141 185 -117T195 -59T204 -4V3H201Q196 3 157 -8T98 -19Q76 -19 66 -6T55 22T65 49T98 63Q117 63 156 52T201 41H204V48Q201 68 195 102T185 161T181 202'], - - // HORIZONTAL ELLIPSIS - 0x2026: [120,0,1172,78,1093,'78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60ZM525 60Q525 84 542 102T585 120Q609 120 627 104T646 61Q646 36 629 18T586 0T543 17T525 60ZM972 60Q972 84 989 102T1032 120Q1056 120 1074 104T1093 61Q1093 36 1076 18T1033 0T990 17T972 60'], - - // PRIME - 0x2032: [560,-43,275,30,262,'79 43Q73 43 52 49T30 61Q30 68 85 293T146 528Q161 560 198 560Q218 560 240 545T262 501Q262 496 260 486Q259 479 173 263T84 45T79 43'], - - // COMBINING RIGHT ARROW ABOVE - 0x20D7: [714,-516,0,-471,-29,'-123 694Q-123 702 -118 708T-103 714Q-93 714 -88 706T-80 687T-67 660T-40 633Q-29 626 -29 615Q-29 606 -36 600T-53 590T-83 571T-121 531Q-135 516 -143 516T-157 522T-163 536T-152 559T-129 584T-116 595H-287L-458 596Q-459 597 -461 599T-466 602T-469 607T-471 615Q-471 622 -458 635H-99Q-123 673 -123 694'], - - // LEFTWARDS ARROW - 0x2190: [511,11,1000,55,944,'944 261T944 250T929 230H165Q167 228 182 216T211 189T244 152T277 96T303 25Q308 7 308 0Q308 -11 288 -11Q281 -11 278 -11T272 -7T267 2T263 21Q245 94 195 151T73 236Q58 242 55 247Q55 254 59 257T73 264Q121 283 158 314T215 375T247 434T264 480L267 497Q269 503 270 505T275 509T288 511Q308 511 308 500Q308 493 303 475Q293 438 278 406T246 352T215 315T185 287T165 270H929Q944 261 944 250'], - - // UPWARDS ARROW - 0x2191: [694,193,500,17,483,'27 414Q17 414 17 433Q17 437 17 439T17 444T19 447T20 450T22 452T26 453T30 454T36 456Q80 467 120 494T180 549Q227 607 238 678Q240 694 251 694Q259 694 261 684Q261 677 265 659T284 608T320 549Q340 525 363 507T405 479T440 463T467 455T479 451Q483 447 483 433Q483 413 472 413Q467 413 458 416Q342 448 277 545L270 555V-179Q262 -193 252 -193H250H248Q236 -193 230 -179V555L223 545Q192 499 146 467T70 424T27 414'], - - // RIGHTWARDS ARROW - 0x2192: [511,11,1000,56,944,'56 237T56 250T70 270H835Q719 357 692 493Q692 494 692 496T691 499Q691 511 708 511H711Q720 511 723 510T729 506T732 497T735 481T743 456Q765 389 816 336T935 261Q944 258 944 250Q944 244 939 241T915 231T877 212Q836 186 806 152T761 85T740 35T732 4Q730 -6 727 -8T711 -11Q691 -11 691 0Q691 7 696 25Q728 151 835 230H70Q56 237 56 250'], - - // DOWNWARDS ARROW - 0x2193: [694,194,500,17,483,'473 86Q483 86 483 67Q483 63 483 61T483 56T481 53T480 50T478 48T474 47T470 46T464 44Q428 35 391 14T316 -55T264 -168Q264 -170 263 -173T262 -180T261 -184Q259 -194 251 -194Q242 -194 238 -176T221 -121T180 -49Q169 -34 155 -21T125 2T95 20T67 33T44 42T27 47L21 49Q17 53 17 67Q17 87 28 87Q33 87 42 84Q158 52 223 -45L230 -55V312Q230 391 230 482T229 591Q229 662 231 676T243 693Q244 694 251 694Q264 692 270 679V-55L277 -45Q307 1 353 33T430 76T473 86'], - - // LEFT RIGHT ARROW - 0x2194: [511,11,1000,55,944,'263 479Q267 501 271 506T288 511Q308 511 308 500Q308 493 303 475Q293 438 278 406T246 352T215 315T185 287T165 270H835Q729 349 696 475Q691 493 691 500Q691 511 711 511Q720 511 723 510T729 506T732 497T735 481T743 456Q765 389 816 336T935 261Q944 258 944 250Q944 244 939 241T915 231T877 212Q836 186 806 152T761 85T740 35T732 4Q730 -6 727 -8T711 -11Q691 -11 691 0Q691 7 696 25Q728 151 835 230H165Q167 228 182 216T211 189T244 152T277 96T303 25Q308 7 308 0Q308 -11 288 -11Q281 -11 278 -11T272 -7T267 2T263 21Q245 94 195 151T73 236Q58 242 55 247Q55 254 59 257T73 264Q144 292 194 349T263 479'], - - // UP DOWN ARROW - 0x2195: [772,272,500,17,483,'27 492Q17 492 17 511Q17 515 17 517T17 522T19 525T20 528T22 530T26 531T30 532T36 534Q80 545 120 572T180 627Q210 664 223 701T238 755T250 772T261 762Q261 757 264 741T282 691T319 628Q352 589 390 566T454 536L479 529Q483 525 483 511Q483 491 472 491Q467 491 458 494Q342 526 277 623L270 633V-133L277 -123Q307 -77 353 -45T430 -2T473 8Q483 8 483 -11Q483 -15 483 -17T483 -22T481 -25T480 -28T478 -30T474 -31T470 -32T464 -34Q407 -49 364 -84T300 -157T270 -223T261 -262Q259 -272 250 -272Q242 -272 239 -255T223 -201T180 -127Q169 -112 155 -99T125 -76T95 -58T67 -45T44 -36T27 -31L21 -29Q17 -25 17 -11Q17 9 28 9Q33 9 42 6Q158 -26 223 -123L230 -133V633L223 623Q192 577 146 545T70 502T27 492'], - - // NORTH WEST ARROW - 0x2196: [720,195,1000,29,944,'204 662Q257 662 301 676T369 705T394 720Q398 720 407 711T417 697Q417 688 389 671T310 639T212 623Q176 623 153 628Q151 628 221 557T546 232Q942 -164 943 -168Q944 -170 944 -174Q944 -182 938 -188T924 -195Q922 -195 916 -193Q912 -191 517 204Q440 281 326 394T166 553L121 598Q126 589 126 541Q126 438 70 349Q59 332 52 332Q48 332 39 341T29 355Q29 358 38 372T57 407T77 464T86 545Q86 583 78 614T63 663T55 683Q55 693 65 693Q73 693 82 688Q136 662 204 662'], - - // NORTH EAST ARROW - 0x2197: [720,195,1000,55,971,'582 697Q582 701 591 710T605 720Q607 720 630 706T697 677T795 662Q830 662 863 670T914 686T934 694Q942 694 944 685Q944 680 936 663T921 615T913 545Q913 490 927 446T956 379T970 355Q970 351 961 342T947 332Q940 332 929 349Q874 436 874 541Q874 590 878 598L832 553Q787 508 673 395T482 204Q87 -191 83 -193Q77 -195 75 -195Q67 -195 61 -189T55 -174Q55 -170 56 -168Q58 -164 453 232Q707 487 777 557T847 628Q824 623 787 623Q689 623 599 679Q582 690 582 697'], - - // SOUTH EAST ARROW - 0x2198: [695,220,1000,55,970,'55 675Q55 683 60 689T75 695Q77 695 83 693Q87 691 482 296Q532 246 605 174T717 62T799 -20T859 -80T878 -97Q874 -93 874 -41Q874 64 929 151Q940 168 947 168Q951 168 960 159T970 145Q970 143 956 121T928 54T913 -45Q913 -83 920 -114T936 -163T944 -185Q942 -194 934 -194Q932 -194 914 -186T864 -170T795 -162Q743 -162 698 -176T630 -205T605 -220Q601 -220 592 -211T582 -197Q582 -187 611 -170T691 -138T787 -123Q824 -123 847 -128Q848 -128 778 -57T453 268Q58 664 56 668Q55 670 55 675'], - - // SOUTH WEST ARROW - 0x2199: [695,220,1000,29,944,'126 -41Q126 -92 121 -97Q121 -98 139 -80T200 -20T281 61T394 173T517 296Q909 690 916 693Q922 695 924 695Q932 695 938 689T944 674Q944 670 943 668Q942 664 546 268Q292 13 222 -57T153 -128Q176 -123 212 -123Q310 -123 400 -179Q417 -190 417 -197Q417 -201 408 -210T394 -220Q392 -220 369 -206T302 -177T204 -162Q131 -162 67 -194Q63 -195 59 -192T55 -183Q55 -180 62 -163T78 -115T86 -45Q86 10 72 54T44 120T29 145Q29 149 38 158T52 168Q59 168 70 151Q126 62 126 -41'], - - // RIGHTWARDS ARROW FROM BAR - 0x21A6: [511,11,1000,54,944,'95 155V109Q95 83 92 73T75 63Q61 63 58 74T54 130Q54 140 54 180T55 250Q55 421 57 425Q61 437 75 437Q88 437 91 428T95 393V345V270H835Q719 357 692 493Q692 494 692 496T691 499Q691 511 708 511H711Q720 511 723 510T729 506T732 497T735 481T743 456Q765 389 816 336T935 261Q944 258 944 250Q944 244 939 241T915 231T877 212Q836 186 806 152T761 85T740 35T732 4Q730 -6 727 -8T711 -11Q691 -11 691 0Q691 7 696 25Q728 151 835 230H95V155'], - - // LEFTWARDS ARROW WITH HOOK - 0x21A9: [511,11,1126,55,1070,'903 424T903 444T929 464Q976 464 1023 434T1070 347Q1070 316 1055 292T1016 256T971 237T929 230H165Q167 228 182 216T211 189T244 152T277 96T303 25Q308 7 308 0Q308 -11 288 -11Q281 -11 278 -11T272 -7T267 2T263 21Q245 94 195 151T73 236Q58 242 55 247Q55 254 59 257T73 264Q121 283 158 314T215 375T247 434T264 480L267 497Q269 503 270 505T275 509T288 511Q308 511 308 500Q308 493 303 475Q293 438 278 406T246 352T215 315T185 287T165 270H926Q929 270 941 271T960 275T978 280T998 290T1015 307Q1030 325 1030 347Q1030 355 1027 364T1014 387T983 411T929 424H928Q903 424 903 444'], - - // RIGHTWARDS ARROW WITH HOOK - 0x21AA: [511,11,1126,55,1070,'55 347Q55 380 72 404T113 441T159 458T197 464Q222 464 222 444Q222 429 204 426T157 417T110 387Q95 369 95 347Q95 339 98 330T111 307T142 283T196 270H961Q845 357 818 493Q818 494 818 496T817 499Q817 511 834 511H837Q846 511 849 510T855 506T858 497T861 481T869 456Q891 389 942 336T1061 261Q1070 258 1070 250Q1070 244 1065 241T1041 231T1003 212Q962 186 932 152T887 85T866 35T858 4Q856 -6 853 -8T837 -11Q817 -11 817 0Q817 7 822 25Q854 151 961 230H196Q149 230 102 260T55 347'], - - // LEFTWARDS HARPOON WITH BARB UPWARDS - 0x21BC: [511,-230,1000,55,944,'62 230Q56 236 55 244Q55 252 57 255T69 265Q114 292 151 326T208 391T243 448T265 491T273 509Q276 511 288 511Q304 511 306 505Q309 501 303 484Q293 456 279 430T251 383T223 344T196 313T173 291T156 276L148 270H929Q944 261 944 250T929 230H62'], - - // LEFTWARDS HARPOON WITH BARB DOWNWARDS - 0x21BD: [270,11,1000,55,944,'55 256Q56 264 62 270H929Q944 261 944 250T929 230H148Q149 229 165 215T196 185T231 145T270 87T303 16Q309 -1 306 -5Q304 -11 288 -11Q279 -11 276 -10T269 -4T264 10T253 36T231 75Q172 173 69 235Q59 242 57 245T55 256'], - - // RIGHTWARDS HARPOON WITH BARB UPWARDS - 0x21C0: [511,-230,1000,56,945,'691 500Q691 511 711 511Q720 511 723 510T730 504T735 490T746 464T768 425Q796 378 835 339T897 285T933 263Q941 258 942 256T944 245T937 230H70Q56 237 56 250T70 270H852Q802 308 762 364T707 455T691 500'], - - // RIGHTWARDS HARPOON WITH BARB DOWNWARDS - 0x21C1: [270,11,1000,56,944,'56 237T56 250T70 270H937Q944 263 944 256Q944 251 944 250T943 246T940 242T933 238Q794 153 734 7Q729 -7 726 -9T711 -11Q695 -11 693 -5Q690 -1 696 16Q721 84 763 139T852 230H70Q56 237 56 250'], - - // RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON - 0x21CC: [671,11,1000,55,945,'691 660Q691 671 711 671Q720 671 723 670T730 664T735 650T746 624T768 585Q797 538 836 499T897 445T933 423Q941 418 942 416T944 405T937 390H70Q56 397 56 410T70 430H852Q802 468 762 524T707 615T691 660ZM55 256Q56 264 62 270H929Q944 261 944 250T929 230H148Q149 229 165 215T196 185T231 145T270 87T303 16Q309 -1 306 -5Q304 -11 288 -11Q279 -11 276 -10T269 -4T264 10T253 36T231 75Q172 173 69 235Q59 242 57 245T55 256'], - - // LEFTWARDS DOUBLE ARROW - 0x21D0: [525,24,1000,56,945,'944 153Q944 140 929 133H318L328 123Q379 69 414 0Q419 -13 419 -17Q419 -24 399 -24Q388 -24 385 -23T377 -12Q332 77 253 144T72 237Q62 240 59 242T56 250T59 257T70 262T89 268T119 278T160 296Q303 366 377 512Q382 522 385 523T401 525Q419 524 419 515Q419 510 414 500Q379 431 328 377L318 367H929Q944 359 944 347Q944 336 930 328L602 327H274L264 319Q225 289 147 250Q148 249 165 241T210 217T264 181L274 173H930Q931 172 933 171T936 169T938 167T941 164T942 162T943 158T944 153'], - - // UPWARDS DOUBLE ARROW - 0x21D1: [694,194,611,31,579,'228 -179Q227 -180 226 -182T223 -186T221 -189T218 -192T214 -193T208 -194Q196 -194 189 -181L188 125V430L176 419Q122 369 59 338Q46 330 40 330Q38 330 31 337V350Q31 362 33 365T46 374Q60 381 77 390T128 426T190 484T247 567T292 677Q295 688 298 692Q302 694 305 694Q313 694 318 677Q334 619 363 568T420 485T481 427T532 391T564 374Q575 368 577 365T579 350V337Q572 330 570 330Q564 330 551 338Q487 370 435 419L423 430L422 125V-181Q409 -194 401 -194Q397 -194 394 -193T388 -189T385 -184T382 -180V-177V475L373 487Q331 541 305 602Q304 601 300 591T290 571T278 548T260 519T238 488L229 476L228 148V-179'], - - // RIGHTWARDS DOUBLE ARROW - 0x21D2: [525,24,1000,56,944,'580 514Q580 525 596 525Q601 525 604 525T609 525T613 524T615 523T617 520T619 517T622 512Q659 438 720 381T831 300T927 263Q944 258 944 250T935 239T898 228T840 204Q696 134 622 -12Q618 -21 615 -22T600 -24Q580 -24 580 -17Q580 -13 585 0Q620 69 671 123L681 133H70Q56 140 56 153Q56 168 72 173H725L735 181Q774 211 852 250Q851 251 834 259T789 283T735 319L725 327H72Q56 332 56 347Q56 360 70 367H681L671 377Q638 412 609 458T580 514'], - - // DOWNWARDS DOUBLE ARROW - 0x21D3: [694,194,611,31,579,'401 694Q412 694 422 681V375L423 70L435 81Q487 130 551 162Q564 170 570 170Q572 170 579 163V150Q579 138 577 135T564 126Q541 114 518 99T453 48T374 -46T318 -177Q313 -194 305 -194T293 -178T272 -119T225 -31Q158 70 46 126Q35 132 33 135T31 150V163Q38 170 40 170Q46 170 59 162Q122 131 176 81L188 70V375L189 681Q199 694 208 694Q219 694 228 680V352L229 25L238 12Q279 -42 305 -102Q344 -23 373 13L382 25V678Q387 692 401 694'], - - // LEFT RIGHT DOUBLE ARROW - 0x21D4: [526,25,1000,33,966,'308 524Q318 526 323 526Q340 526 340 514Q340 507 336 499Q326 476 314 454T292 417T274 391T260 374L255 368Q255 367 500 367Q744 367 744 368L739 374Q734 379 726 390T707 416T685 453T663 499Q658 511 658 515Q658 525 680 525Q687 524 690 523T695 519T701 507Q766 359 902 287Q921 276 939 269T961 259T966 250Q966 246 965 244T960 240T949 236T930 228T902 213Q763 137 701 -7Q697 -16 695 -19T690 -23T680 -25Q658 -25 658 -15Q658 -11 663 1Q673 24 685 46T707 83T725 109T739 126L744 132Q744 133 500 133Q255 133 255 132L260 126Q265 121 273 110T292 84T314 47T336 1Q341 -11 341 -15Q341 -25 319 -25Q312 -24 309 -23T304 -19T298 -7Q233 141 97 213Q83 221 70 227T51 235T41 239T35 243T34 250T35 256T40 261T51 265T70 273T97 287Q235 363 299 509Q305 522 308 524ZM792 319L783 327H216Q183 294 120 256L110 250L120 244Q173 212 207 181L216 173H783L792 181Q826 212 879 244L889 250L879 256Q826 288 792 319'], - - // UP DOWN DOUBLE ARROW - 0x21D5: [772,272,611,31,579,'290 755Q298 772 305 772T318 757T343 706T393 633Q431 588 473 558T545 515T579 497V484Q579 464 570 464Q564 464 550 470Q485 497 423 550L422 400V100L423 -50Q485 3 550 30Q565 36 570 36Q579 36 579 16V3Q575 -1 549 -12T480 -53T393 -132Q361 -172 342 -208T318 -258T305 -272T293 -258T268 -208T217 -132Q170 -80 128 -51T61 -12T31 3V16Q31 36 40 36Q46 36 61 30Q86 19 109 6T146 -18T173 -38T188 -50V550Q186 549 173 539T147 519T110 495T61 470Q46 464 40 464Q31 464 31 484V497Q34 500 63 513T135 557T217 633Q267 692 290 755ZM374 598Q363 610 351 625T332 651T316 676T305 695L294 676Q282 657 267 636T236 598L228 589V-89L236 -98Q247 -110 259 -125T278 -151T294 -176T305 -195L316 -176Q328 -157 343 -136T374 -98L382 -89V589L374 598'], - - // FOR ALL - 0x2200: [694,22,556,0,556,'0 673Q0 684 7 689T20 694Q32 694 38 680T82 567L126 451H430L473 566Q483 593 494 622T512 668T519 685Q524 694 538 694Q556 692 556 674Q556 670 426 329T293 -15Q288 -22 278 -22T263 -15Q260 -11 131 328T0 673ZM414 410Q414 411 278 411T142 410L278 55L414 410'], - - // PARTIAL DIFFERENTIAL - 0x2202: [715,22,531,42,567,'202 508Q179 508 169 520T158 547Q158 557 164 577T185 624T230 675T301 710L333 715H345Q378 715 384 714Q447 703 489 661T549 568T566 457Q566 362 519 240T402 53Q321 -22 223 -22Q123 -22 73 56Q42 102 42 148V159Q42 276 129 370T322 465Q383 465 414 434T455 367L458 378Q478 461 478 515Q478 603 437 639T344 676Q266 676 223 612Q264 606 264 572Q264 547 246 528T202 508ZM430 306Q430 372 401 400T333 428Q270 428 222 382Q197 354 183 323T150 221Q132 149 132 116Q132 21 232 21Q244 21 250 22Q327 35 374 112Q389 137 409 196T430 306'], - - // THERE EXISTS - 0x2203: [694,0,556,56,500,'56 661T56 674T70 694H487Q497 686 500 679V15Q497 10 487 1L279 0H70Q56 7 56 20T70 40H460V327H84Q70 334 70 347T84 367H460V654H70Q56 661 56 674'], - - // EMPTY SET - 0x2205: [772,78,500,39,460,'331 696Q335 708 339 722T345 744T350 759T357 769T367 772Q374 772 381 767T388 754Q388 746 377 712L366 673L378 661Q460 575 460 344Q460 281 456 234T432 126T373 27Q319 -22 250 -22Q214 -22 180 -7Q168 -3 168 -4L159 -33Q148 -71 142 -75Q138 -78 132 -78Q124 -78 118 -72T111 -60Q111 -52 122 -18L133 21L125 29Q39 111 39 344Q39 596 137 675Q187 716 251 716Q265 716 278 714T296 710T315 703T331 696ZM276 676Q264 679 246 679Q196 679 159 631Q134 597 128 536T121 356Q121 234 127 174T151 80L234 366Q253 430 275 506T308 618L318 654Q318 656 294 669L276 676ZM181 42Q207 16 250 16Q291 16 324 47Q354 78 366 136T378 356Q378 470 372 528T349 616L348 613Q348 611 264 326L181 42'], - - // NABLA - 0x2207: [683,33,833,46,786,'46 676Q46 679 51 683H781Q786 679 786 676Q786 674 617 326T444 -26Q439 -33 416 -33T388 -26Q385 -22 216 326T46 676ZM697 596Q697 597 445 597T193 596Q195 591 319 336T445 80L697 596'], - - // ELEMENT OF - 0x2208: [541,41,667,84,583,'84 250Q84 372 166 450T360 539Q361 539 377 539T419 540T469 540H568Q583 532 583 520Q583 511 570 501L466 500Q355 499 329 494Q280 482 242 458T183 409T147 354T129 306T124 272V270H568Q583 262 583 250T568 230H124V228Q124 207 134 177T167 112T231 48T328 7Q355 1 466 0H570Q583 -10 583 -20Q583 -32 568 -40H471Q464 -40 446 -40T417 -41Q262 -41 172 45Q84 127 84 250'], - - // stix-negated (vert) set membership, variant - 0x2209: [716,215,667,84,584,'196 25Q84 109 84 250Q84 372 166 450T360 539Q361 539 375 539T413 540T460 540L547 707Q550 716 563 716Q570 716 575 712T581 703T583 696T505 540H568Q583 532 583 520Q583 511 570 501L484 500L366 270H568Q583 262 583 250T568 230H346L247 38Q284 16 328 7Q355 1 466 0H570Q583 -10 583 -20Q583 -32 568 -40H471Q464 -40 447 -40T419 -41Q304 -41 228 3Q117 -211 115 -212Q111 -215 104 -215T92 -212T86 -204T84 -197Q84 -190 89 -183L196 25ZM214 61L301 230H124V228Q124 196 147 147T214 61ZM321 270L440 500Q353 499 329 494Q280 482 242 458T183 409T147 354T129 306T124 272V270H321'], - - // CONTAINS AS MEMBER - 0x220B: [541,40,667,83,582,'83 520Q83 532 98 540H195Q202 540 220 540T249 541Q404 541 494 455Q582 374 582 250Q582 165 539 99T434 0T304 -39Q297 -40 195 -40H98Q83 -32 83 -20Q83 -10 96 0H200Q311 1 337 6Q369 14 401 28Q422 39 445 55Q484 85 508 127T537 191T542 228V230H98Q84 237 84 250T98 270H542V272Q542 280 539 295T527 336T497 391T445 445Q422 461 401 472Q386 479 374 483T347 491T325 495T298 498T273 499T239 500T200 500L96 501Q83 511 83 520'], - - // MINUS SIGN - 0x2212: [270,-230,778,84,694,'84 237T84 250T98 270H679Q694 262 694 250T679 230H98Q84 237 84 250'], - - // MINUS-OR-PLUS SIGN - 0x2213: [500,166,778,56,722,'56 467T56 480T70 500H707Q722 492 722 480T707 460H409V187H707Q722 179 722 167Q722 154 707 147H409V0V-93Q409 -144 406 -155T389 -166Q376 -166 372 -155T368 -105Q368 -96 368 -62T369 -2V147H70Q56 154 56 167T70 187H369V460H70Q56 467 56 480'], - - // DIVISION SLASH - 0x2215: [750,250,500,56,444,'423 750Q432 750 438 744T444 730Q444 725 271 248T92 -240Q85 -250 75 -250Q68 -250 62 -245T56 -231Q56 -221 230 257T407 740Q411 750 423 750'], - - // SET MINUS - 0x2216: [750,250,500,56,444,'56 731Q56 740 62 745T75 750Q85 750 92 740Q96 733 270 255T444 -231Q444 -239 438 -244T424 -250Q414 -250 407 -240Q404 -236 230 242T56 731'], - - // ASTERISK OPERATOR - 0x2217: [465,-35,500,64,435,'229 286Q216 420 216 436Q216 454 240 464Q241 464 245 464T251 465Q263 464 273 456T283 436Q283 419 277 356T270 286L328 328Q384 369 389 372T399 375Q412 375 423 365T435 338Q435 325 425 315Q420 312 357 282T289 250L355 219L425 184Q434 175 434 161Q434 146 425 136T401 125Q393 125 383 131T328 171L270 213Q283 79 283 63Q283 53 276 44T250 35Q231 35 224 44T216 63Q216 80 222 143T229 213L171 171Q115 130 110 127Q106 124 100 124Q87 124 76 134T64 161Q64 166 64 169T67 175T72 181T81 188T94 195T113 204T138 215T170 230T210 250L74 315Q65 324 65 338Q65 353 74 363T98 374Q106 374 116 368T171 328L229 286'], - - // RING OPERATOR - 0x2218: [444,-55,500,55,444,'55 251Q55 328 112 386T249 444T386 388T444 249Q444 171 388 113T250 55Q170 55 113 112T55 251ZM245 403Q188 403 142 361T96 250Q96 183 141 140T250 96Q284 96 313 109T354 135T375 160Q403 197 403 250Q403 313 360 358T245 403'], - - // BULLET OPERATOR - 0x2219: [444,-55,500,55,444,'55 251Q55 328 112 386T249 444T386 388T444 249Q444 171 388 113T250 55Q170 55 113 112T55 251'], - - // SQUARE ROOT - 0x221A: [800,200,833,71,853,'95 178Q89 178 81 186T72 200T103 230T169 280T207 309Q209 311 212 311H213Q219 311 227 294T281 177Q300 134 312 108L397 -77Q398 -77 501 136T707 565T814 786Q820 800 834 800Q841 800 846 794T853 782V776L620 293L385 -193Q381 -200 366 -200Q357 -200 354 -197Q352 -195 256 15L160 225L144 214Q129 202 113 190T95 178'], - - // PROPORTIONAL TO - 0x221D: [442,11,778,56,722,'56 124T56 216T107 375T238 442Q260 442 280 438T319 425T352 407T382 385T406 361T427 336T442 315T455 297T462 285L469 297Q555 442 679 442Q687 442 722 437V398H718Q710 400 694 400Q657 400 623 383T567 343T527 294T503 253T495 235Q495 231 520 192T554 143Q625 44 696 44Q717 44 719 46H722V-5Q695 -11 678 -11Q552 -11 457 141Q455 145 454 146L447 134Q362 -11 235 -11Q157 -11 107 56ZM93 213Q93 143 126 87T220 31Q258 31 292 48T349 88T389 137T413 178T421 196Q421 200 396 239T362 288Q322 345 288 366T213 387Q163 387 128 337T93 213'], - - // INFINITY - 0x221E: [442,11,1000,55,944,'55 217Q55 305 111 373T254 442Q342 442 419 381Q457 350 493 303L507 284L514 294Q618 442 747 442Q833 442 888 374T944 214Q944 128 889 59T743 -11Q657 -11 580 50Q542 81 506 128L492 147L485 137Q381 -11 252 -11Q166 -11 111 57T55 217ZM907 217Q907 285 869 341T761 397Q740 397 720 392T682 378T648 359T619 335T594 310T574 285T559 263T548 246L543 238L574 198Q605 158 622 138T664 94T714 61T765 51Q827 51 867 100T907 217ZM92 214Q92 145 131 89T239 33Q357 33 456 193L425 233Q364 312 334 337Q285 380 233 380Q171 380 132 331T92 214'], - - // ANGLE - 0x2220: [694,0,722,55,666,'71 0L68 2Q65 3 63 5T58 11T55 20Q55 22 57 28Q67 43 346 361Q397 420 474 508Q595 648 616 671T647 694T661 688T666 674Q666 668 663 663Q662 662 627 622T524 503T390 350L120 41L386 40H653Q666 30 666 20Q666 8 651 0H71'], - - // DIVIDES - 0x2223: [750,249,278,119,159,'139 -249H137Q125 -249 119 -235V251L120 737Q130 750 139 750Q152 750 159 735V-235Q151 -249 141 -249H139'], - - // PARALLEL TO - 0x2225: [750,250,500,132,368,'133 736Q138 750 153 750Q164 750 170 739Q172 735 172 250T170 -239Q164 -250 152 -250Q144 -250 138 -244L137 -243Q133 -241 133 -179T132 250Q132 731 133 736ZM329 739Q334 750 346 750Q353 750 361 744L362 743Q366 741 366 679T367 250T367 -178T362 -243L361 -244Q355 -250 347 -250Q335 -250 329 -239Q327 -235 327 250T329 739'], - - // LOGICAL AND - 0x2227: [598,22,667,55,611,'318 591Q325 598 333 598Q344 598 348 591Q349 590 414 445T545 151T611 -4Q609 -22 591 -22Q588 -22 586 -21T581 -20T577 -17T575 -13T572 -9T570 -4L333 528L96 -4Q87 -20 80 -21Q78 -22 75 -22Q57 -22 55 -4Q55 2 120 150T251 444T318 591'], - - // LOGICAL OR - 0x2228: [598,22,667,55,611,'55 580Q56 587 61 592T75 598Q86 598 96 580L333 48L570 580Q579 596 586 597Q588 598 591 598Q609 598 611 580Q611 574 546 426T415 132T348 -15Q343 -22 333 -22T318 -15Q317 -14 252 131T121 425T55 580'], - - // stix-intersection, serifs - 0x2229: [598,22,667,55,611,'88 -21T75 -21T55 -7V200Q55 231 55 280Q56 414 60 428Q61 430 61 431Q77 500 152 549T332 598Q443 598 522 544T610 405Q611 399 611 194V-7Q604 -22 591 -22Q582 -22 572 -9L570 405Q563 433 556 449T529 485Q498 519 445 538T334 558Q251 558 179 518T96 401Q95 396 95 193V-7Q88 -21 75 -21'], - - // stix-union, serifs - 0x222A: [598,22,667,55,611,'591 598H592Q604 598 611 583V376Q611 345 611 296Q610 162 606 148Q605 146 605 145Q586 68 507 23T333 -22Q268 -22 209 -1T106 66T56 173Q55 180 55 384L56 585Q66 598 75 598Q85 598 95 585V378L96 172L98 162Q112 95 181 57T332 18Q415 18 487 58T570 175Q571 180 571 383V583Q579 598 591 598'], - - // INTEGRAL - 0x222B: [716,216,417,55,472,'151 -112Q151 -150 106 -161Q106 -165 114 -172T134 -179Q155 -179 170 -146Q181 -120 188 -64T206 101T232 310Q256 472 277 567Q308 716 392 716Q434 716 453 681T472 613Q472 590 458 577T424 564Q404 564 390 578T376 612Q376 650 421 661Q421 663 418 667T407 675T393 679Q387 679 380 675Q360 665 350 619T326 438Q302 190 253 -57Q235 -147 201 -186Q174 -213 138 -216Q93 -216 74 -181T55 -113Q55 -91 69 -78T103 -64Q123 -64 137 -78T151 -112'], - - // TILDE OPERATOR - 0x223C: [367,-133,778,55,722,'55 166Q55 241 101 304T222 367Q260 367 296 349T362 304T421 252T484 208T554 189Q616 189 655 236T694 338Q694 350 698 358T708 367Q722 367 722 334Q722 260 677 197T562 134H554Q517 134 481 152T414 196T355 248T292 293T223 311Q179 311 145 286Q109 257 96 218T80 156T69 133Q55 133 55 166'], - - // WREATH PRODUCT - 0x2240: [583,83,278,55,222,'55 569Q55 583 83 583Q122 583 151 565T194 519T215 464T222 411Q222 360 194 304T139 193T111 89Q111 38 134 -7T195 -55Q222 -57 222 -69Q222 -83 189 -83Q130 -83 93 -33T55 90Q55 130 72 174T110 252T148 328T166 411Q166 462 144 507T83 555Q55 556 55 569'], - - // ASYMPTOTICALLY EQUAL TO - 0x2243: [464,-36,778,55,722,'55 283Q55 356 103 409T217 463Q262 463 297 447T395 382Q431 355 446 344T493 320T554 307H558Q613 307 652 344T694 433Q694 464 708 464T722 432Q722 356 673 304T564 251H554Q510 251 465 275T387 329T310 382T223 407H219Q164 407 122 367Q91 333 85 295T76 253T69 250Q55 250 55 283ZM56 56Q56 71 72 76H706Q722 70 722 56Q722 44 707 36H70Q56 43 56 56'], - - // APPROXIMATELY EQUAL TO - 0x2245: [589,-22,1000,55,722,'55 388Q55 463 101 526T222 589Q260 589 296 571T362 526T421 474T484 430T554 411Q616 411 655 458T694 560Q694 572 698 580T708 589Q722 589 722 556Q722 482 677 419T562 356H554Q517 356 481 374T414 418T355 471T292 515T223 533Q179 533 145 508Q109 479 96 440T80 378T69 355Q55 355 55 388ZM56 236Q56 249 70 256H707Q722 248 722 236Q722 225 708 217L390 216H72Q56 221 56 236ZM56 42Q56 57 72 62H708Q722 52 722 42Q722 30 707 22H70Q56 29 56 42'], - - // ALMOST EQUAL TO - 0x2248: [483,-55,778,55,722,'55 319Q55 360 72 393T114 444T163 472T205 482Q207 482 213 482T223 483Q262 483 296 468T393 413L443 381Q502 346 553 346Q609 346 649 375T694 454Q694 465 698 474T708 483Q722 483 722 452Q722 386 675 338T555 289Q514 289 468 310T388 357T308 404T224 426Q164 426 125 393T83 318Q81 289 69 289Q55 289 55 319ZM55 85Q55 126 72 159T114 210T163 238T205 248Q207 248 213 248T223 249Q262 249 296 234T393 179L443 147Q502 112 553 112Q609 112 649 141T694 220Q694 249 708 249T722 217Q722 153 675 104T555 55Q514 55 468 76T388 123T308 170T224 192Q164 192 125 159T83 84Q80 55 69 55Q55 55 55 85'], - - // EQUIVALENT TO - 0x224D: [484,-16,778,55,722,'55 464Q55 471 60 477T74 484Q80 484 108 464T172 420T268 376T389 356Q436 356 483 368T566 399T630 436T675 467T695 482Q701 484 703 484Q711 484 716 478T722 464Q722 454 707 442Q550 316 389 316Q338 316 286 329T195 362T124 402T76 437T57 456Q55 462 55 464ZM57 45Q66 58 109 88T230 151T381 183Q438 183 494 168T587 135T658 94T703 61T720 45Q722 39 722 36Q722 28 717 22T703 16Q697 16 669 36T606 80T510 124T389 144Q341 144 294 132T211 101T147 64T102 33T82 18Q76 16 74 16Q66 16 61 22T55 36Q55 39 57 45'], - - // APPROACHES THE LIMIT - 0x2250: [670,-133,778,56,722,'56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153ZM329 610Q329 634 346 652T389 670Q413 670 431 654T450 611Q450 586 433 568T390 550T347 567T329 610'], - - // stix-not (vert) equals - 0x2260: [716,215,778,56,722,'166 -215T159 -215T147 -212T141 -204T139 -197Q139 -190 144 -183L306 133H70Q56 140 56 153Q56 168 72 173H327L406 327H72Q56 332 56 347Q56 360 70 367H426Q597 702 602 707Q605 716 618 716Q625 716 630 712T636 703T638 696Q638 692 471 367H707Q722 359 722 347Q722 336 708 328L451 327L371 173H708Q722 163 722 153Q722 140 707 133H351Q175 -210 170 -212Q166 -215 159 -215'], - - // IDENTICAL TO - 0x2261: [464,-36,778,56,722,'56 444Q56 457 70 464H707Q722 456 722 444Q722 430 706 424H72Q56 429 56 444ZM56 237T56 250T70 270H707Q722 262 722 250T707 230H70Q56 237 56 250ZM56 56Q56 71 72 76H706Q722 70 722 56Q722 44 707 36H70Q56 43 56 56'], - - // LESS-THAN OR EQUAL TO - 0x2264: [636,138,778,83,694,'674 636Q682 636 688 630T694 615T687 601Q686 600 417 472L151 346L399 228Q687 92 691 87Q694 81 694 76Q694 58 676 56H670L382 192Q92 329 90 331Q83 336 83 348Q84 359 96 365Q104 369 382 500T665 634Q669 636 674 636ZM84 -118Q84 -108 99 -98H678Q694 -104 694 -118Q694 -130 679 -138H98Q84 -131 84 -118'], - - // GREATER-THAN OR EQUAL TO - 0x2265: [636,138,778,82,694,'83 616Q83 624 89 630T99 636Q107 636 253 568T543 431T687 361Q694 356 694 346T687 331Q685 329 395 192L107 56H101Q83 58 83 76Q83 77 83 79Q82 86 98 95Q117 105 248 167Q326 204 378 228L626 346L360 472Q291 505 200 548Q112 589 98 597T83 616ZM84 -118Q84 -108 99 -98H678Q694 -104 694 -118Q694 -130 679 -138H98Q84 -131 84 -118'], - - // MUCH LESS-THAN - 0x226A: [568,67,1000,56,944,'639 -48Q639 -54 634 -60T619 -67H618Q612 -67 536 -26Q430 33 329 88Q61 235 59 239Q56 243 56 250T59 261Q62 266 336 415T615 567L619 568Q622 567 625 567Q639 562 639 548Q639 540 633 534Q632 532 374 391L117 250L374 109Q632 -32 633 -34Q639 -40 639 -48ZM944 -48Q944 -54 939 -60T924 -67H923Q917 -67 841 -26Q735 33 634 88Q366 235 364 239Q361 243 361 250T364 261Q367 266 641 415T920 567L924 568Q927 567 930 567Q944 562 944 548Q944 540 938 534Q937 532 679 391L422 250L679 109Q937 -32 938 -34Q944 -40 944 -48'], - - // MUCH GREATER-THAN - 0x226B: [567,67,1000,55,944,'55 539T55 547T60 561T74 567Q81 567 207 498Q297 449 365 412Q633 265 636 261Q639 255 639 250Q639 241 626 232Q614 224 365 88Q83 -65 79 -66Q76 -67 73 -67Q65 -67 60 -61T55 -47Q55 -39 61 -33Q62 -33 95 -15T193 39T320 109L321 110H322L323 111H324L325 112L326 113H327L329 114H330L331 115H332L333 116L334 117H335L336 118H337L338 119H339L340 120L341 121H342L343 122H344L345 123H346L347 124L348 125H349L351 126H352L353 127H354L355 128L356 129H357L358 130H359L360 131H361L362 132L363 133H364L365 134H366L367 135H368L369 136H370L371 137L372 138H373L374 139H375L376 140L378 141L576 251Q63 530 62 533Q55 539 55 547ZM360 539T360 547T365 561T379 567Q386 567 512 498Q602 449 670 412Q938 265 941 261Q944 255 944 250Q944 241 931 232Q919 224 670 88Q388 -65 384 -66Q381 -67 378 -67Q370 -67 365 -61T360 -47Q360 -39 366 -33Q367 -33 400 -15T498 39T625 109L626 110H627L628 111H629L630 112L631 113H632L634 114H635L636 115H637L638 116L639 117H640L641 118H642L643 119H644L645 120L646 121H647L648 122H649L650 123H651L652 124L653 125H654L656 126H657L658 127H659L660 128L661 129H662L663 130H664L665 131H666L667 132L668 133H669L670 134H671L672 135H673L674 136H675L676 137L677 138H678L679 139H680L681 140L683 141L881 251Q368 530 367 533Q360 539 360 547'], - - // PRECEDES - 0x227A: [539,41,778,84,694,'84 249Q84 262 91 266T117 270Q120 270 126 270T137 269Q388 273 512 333T653 512Q657 539 676 539Q685 538 689 532T694 520V515Q689 469 672 431T626 366T569 320T500 286T435 265T373 249Q379 248 404 242T440 233T477 221T533 199Q681 124 694 -17Q694 -41 674 -41Q658 -41 653 -17Q646 41 613 84T533 154T418 197T284 220T137 229H114Q104 229 98 230T88 235T84 249'], - - // SUCCEEDS - 0x227B: [539,41,778,83,694,'84 517Q84 539 102 539Q115 539 119 529T125 503T137 459T171 404Q277 275 640 269H661Q694 269 694 249T661 229H640Q526 227 439 214T283 173T173 98T124 -17Q118 -41 103 -41Q83 -41 83 -17Q88 29 105 67T151 132T208 178T277 212T342 233T404 249Q401 250 380 254T345 263T302 276T245 299Q125 358 92 468Q84 502 84 517'], - - // SUBSET OF - 0x2282: [541,41,778,84,694,'84 250Q84 372 166 450T360 539Q361 539 370 539T395 539T430 540T475 540T524 540H679Q694 532 694 520Q694 511 681 501L522 500H470H441Q366 500 338 496T266 472Q244 461 224 446T179 404T139 337T124 250V245Q124 157 185 89Q244 25 328 7Q348 2 366 2T522 0H681Q694 -10 694 -20Q694 -32 679 -40H526Q510 -40 480 -40T434 -41Q350 -41 289 -25T172 45Q84 127 84 250'], - - // SUPERSET OF - 0x2283: [541,40,778,83,693,'83 520Q83 532 98 540H251Q267 540 297 540T343 541Q427 541 488 525T605 455Q693 374 693 250Q693 165 650 99T545 0T415 -39Q407 -40 251 -40H98Q83 -32 83 -20Q83 -10 96 0H255H308H337Q412 0 439 4T512 28Q533 39 553 54T599 96T639 163T654 250Q654 341 592 411Q557 449 512 472Q468 491 439 495T335 500H306H255L96 501Q83 511 83 520'], - - // SUBSET OF OR EQUAL TO - 0x2286: [637,138,778,84,694,'84 346Q84 468 166 546T360 635Q361 635 370 635T395 635T430 636T475 636T524 636H679Q694 628 694 616Q694 607 681 597L522 596H470H441Q366 596 338 592T266 568Q244 557 224 542T179 500T139 433T124 346V341Q124 253 185 185Q244 121 328 103Q348 98 366 98T522 96H681Q694 86 694 76Q694 64 679 56H526Q510 56 480 56T434 55Q350 55 289 71T172 141Q84 223 84 346ZM104 -131T104 -118T118 -98H679Q694 -106 694 -118T679 -138H118Q104 -131 104 -118'], - - // SUPERSET OF OR EQUAL TO - 0x2287: [637,138,778,83,693,'83 616Q83 628 98 636H251Q267 636 297 636T343 637Q427 637 488 621T605 551Q693 470 693 346Q693 261 650 195T545 96T415 57Q407 56 251 56H98Q83 64 83 76Q83 86 96 96H255H308H337Q412 96 439 100T512 124Q533 135 553 150T599 192T639 259T654 346Q654 437 592 507Q557 545 512 568Q468 587 439 591T335 596H306H255L96 597Q83 607 83 616ZM84 -131T84 -118T98 -98H659Q674 -106 674 -118T659 -138H98Q84 -131 84 -118'], - - // MULTISET UNION - 0x228E: [598,22,667,55,611,'591 598H592Q604 598 611 583V376Q611 345 611 296Q610 162 606 148Q605 146 605 145Q586 68 507 23T333 -22Q268 -22 209 -1T106 66T56 173Q55 180 55 384L56 585Q66 598 75 598Q85 598 95 585V378L96 172L98 162Q112 95 181 57T332 18Q415 18 487 58T570 175Q571 180 571 383V583Q579 598 591 598ZM313 406Q313 417 313 435T312 459Q312 483 316 493T333 503T349 494T353 461V406V325H515Q516 325 519 323T527 316T531 305T527 294T520 287T515 285H353V204V152Q353 127 350 117T333 107T316 117T312 152Q312 158 312 175T313 204V285H151Q150 285 147 287T139 294T135 305T139 316T146 323T151 325H313V406'], - - // SQUARE IMAGE OF OR EQUAL TO - 0x2291: [636,138,778,84,714,'94 620Q98 632 110 636H699Q714 628 714 616T699 596H134V96H698Q714 90 714 76Q714 64 699 56H109Q104 59 95 69L94 344V620ZM84 -118Q84 -103 100 -98H698Q714 -104 714 -118Q714 -130 699 -138H98Q84 -131 84 -118'], - - // SQUARE ORIGINAL OF OR EQUAL TO - 0x2292: [636,138,778,64,694,'64 603T64 616T78 636H668Q675 633 683 623V69Q675 59 668 56H78Q64 63 64 76Q64 91 80 96H643V596H78Q64 603 64 616ZM64 -118Q64 -108 79 -98H678Q694 -104 694 -118Q694 -130 679 -138H78Q64 -131 64 -118'], - - // stix-square intersection, serifs - 0x2293: [598,0,667,61,605,'83 0Q79 0 76 1T71 3T67 6T65 9T63 13T61 16V301L62 585Q70 595 76 598H592Q602 590 605 583V15Q598 2 587 0Q583 0 580 1T575 3T571 6T569 9T567 13T565 16V558H101V15Q94 2 83 0'], - - // stix-square union, serifs - 0x2294: [598,0,667,61,605,'77 0Q65 4 61 16V301L62 585Q72 598 81 598Q94 598 101 583V40H565V583Q573 598 585 598Q598 598 605 583V15Q602 10 592 1L335 0H77'], - - // stix-circled plus (with rim) - 0x2295: [583,83,778,56,722,'56 250Q56 394 156 488T384 583Q530 583 626 485T722 250Q722 110 625 14T390 -83Q249 -83 153 14T56 250ZM364 542Q308 539 251 509T148 418T96 278V270H369V542H364ZM681 278Q675 338 650 386T592 462T522 509T458 535T412 542H409V270H681V278ZM96 222Q104 150 139 95T219 12T302 -29T366 -42H369V230H96V222ZM681 222V230H409V-42H412Q429 -42 456 -36T521 -10T590 37T649 113T681 222'], - - // CIRCLED MINUS - 0x2296: [583,83,778,56,722,'56 250Q56 394 156 488T384 583Q530 583 626 485T722 250Q722 110 625 14T390 -83Q249 -83 153 14T56 250ZM681 278Q669 385 591 463T381 542Q283 542 196 471T96 278V270H681V278ZM275 -42T388 -42T585 32T681 222V230H96V222Q108 107 191 33'], - - // stix-circled times (with rim) - 0x2297: [583,83,778,56,722,'56 250Q56 394 156 488T384 583Q530 583 626 485T722 250Q722 110 625 14T390 -83Q249 -83 153 14T56 250ZM582 471Q531 510 496 523Q446 542 381 542Q324 542 272 519T196 471L389 278L485 375L582 471ZM167 442Q95 362 95 250Q95 137 167 58L359 250L167 442ZM610 58Q682 138 682 250Q682 363 610 442L418 250L610 58ZM196 29Q209 16 230 2T295 -27T388 -42Q409 -42 429 -40T465 -33T496 -23T522 -11T544 1T561 13T574 22T582 29L388 222L196 29'], - - // CIRCLED DIVISION SLASH - 0x2298: [583,83,778,56,722,'56 250Q56 394 156 488T384 583Q530 583 626 485T722 250Q722 110 625 14T390 -83Q249 -83 153 14T56 250ZM582 471Q581 472 571 480T556 491T539 502T517 514T491 525T460 534T424 539T381 542Q272 542 184 460T95 251Q95 198 113 150T149 80L167 58L582 471ZM388 -42Q513 -42 597 44T682 250Q682 363 610 442L196 29Q209 16 229 2T295 -27T388 -42'], - - // CIRCLED DOT OPERATOR - 0x2299: [583,83,778,56,722,'56 250Q56 394 156 488T384 583Q530 583 626 485T722 250Q722 110 625 14T390 -83Q249 -83 153 14T56 250ZM682 250Q682 322 649 387T546 497T381 542Q272 542 184 459T95 250Q95 132 178 45T389 -42Q515 -42 598 45T682 250ZM311 250Q311 285 332 304T375 328Q376 328 382 328T392 329Q424 326 445 305T466 250Q466 217 445 195T389 172Q354 172 333 195T311 250'], - - // RIGHT TACK - 0x22A2: [695,0,611,55,555,'55 678Q55 679 56 681T58 684T61 688T65 691T70 693T77 694Q88 692 95 679V367H540Q555 359 555 347Q555 334 540 327H95V15Q88 2 77 0Q73 0 70 1T65 3T61 6T59 9T57 13T55 16V678'], - - // LEFT TACK - 0x22A3: [695,0,611,54,555,'515 678Q515 679 516 681T518 684T521 688T525 691T530 693T537 694Q548 692 555 679V15Q548 2 537 0Q533 0 530 1T525 3T521 6T519 9T517 13T515 16V327H71Q70 327 67 329T59 336T55 347T59 358T66 365T71 367H515V678'], - - // DOWN TACK - 0x22A4: [668,0,778,55,723,'55 642T55 648T59 659T66 666T71 668H708Q723 660 723 648T708 628H409V15Q402 2 391 0Q387 0 384 1T379 3T375 6T373 9T371 13T369 16V628H71Q70 628 67 630T59 637'], - - // UP TACK - 0x22A5: [669,0,778,54,723,'369 652Q369 653 370 655T372 658T375 662T379 665T384 667T391 668Q402 666 409 653V40H708Q723 32 723 20T708 0H71Q70 0 67 2T59 9T55 20T59 31T66 38T71 40H369V652'], - - // TRUE - 0x22A8: [750,249,867,119,812,'139 -249H137Q125 -249 119 -235V251L120 737Q130 750 139 750Q152 750 159 735V367H796Q811 359 811 347Q811 336 797 328L479 327H161L159 328V172L161 173H797Q798 172 800 171T803 169T805 167T808 164T809 162T810 158T811 153Q811 140 796 133H159V-235Q151 -249 141 -249H139'], - - // DIAMOND OPERATOR - 0x22C4: [488,-12,500,12,488,'242 486Q245 488 250 488Q256 488 258 486Q262 484 373 373T486 258T488 250T486 242T373 127T258 14Q256 12 250 12Q245 12 242 14Q237 16 127 126T14 242Q12 245 12 250T14 258Q16 263 126 373T242 486ZM439 250L250 439L61 250L250 61L439 250'], - - // DOT OPERATOR - 0x22C5: [310,-190,278,78,199,'78 250Q78 274 95 292T138 310Q162 310 180 294T199 251Q199 226 182 208T139 190T96 207T78 250'], - - // STAR OPERATOR - 0x22C6: [486,-16,500,3,497,'210 282Q210 284 225 381T241 480Q241 484 245 484Q249 486 251 486Q258 486 260 477T272 406Q275 390 276 380Q290 286 290 282L388 299Q484 314 487 314H488Q497 314 497 302Q497 297 434 266Q416 257 404 251L315 206L361 118Q372 98 383 75T401 40L407 28Q407 16 395 16Q394 16 392 16L390 17L250 159L110 17L108 16Q106 16 105 16Q93 16 93 28L99 40Q105 52 116 75T139 118L185 206L96 251Q6 296 4 300Q3 301 3 302Q3 314 12 314H13Q16 314 112 299L210 282'], - - // BOWTIE - 0x22C8: [505,5,900,26,873,'833 50T833 250T832 450T659 351T487 250T658 150T832 50Q833 50 833 250ZM873 10Q866 -5 854 -5Q851 -5 845 -3L449 226L260 115Q51 -5 43 -5Q39 -5 35 -1T28 7L26 11V489Q33 505 43 505Q51 505 260 385L449 274L845 503Q851 505 853 505Q866 505 873 490V10ZM412 250L67 450Q66 450 66 250T67 50Q69 51 240 150T412 250'], - - // VERTICAL ELLIPSIS - 0x22EE: [900,30,278,78,199,'78 30Q78 54 95 72T138 90Q162 90 180 74T199 31Q199 6 182 -12T139 -30T96 -13T78 30ZM78 440Q78 464 95 482T138 500Q162 500 180 484T199 441Q199 416 182 398T139 380T96 397T78 440ZM78 840Q78 864 95 882T138 900Q162 900 180 884T199 841Q199 816 182 798T139 780T96 797T78 840'], - - // MIDLINE HORIZONTAL ELLIPSIS - 0x22EF: [310,-190,1172,78,1093,'78 250Q78 274 95 292T138 310Q162 310 180 294T199 251Q199 226 182 208T139 190T96 207T78 250ZM525 250Q525 274 542 292T585 310Q609 310 627 294T646 251Q646 226 629 208T586 190T543 207T525 250ZM972 250Q972 274 989 292T1032 310Q1056 310 1074 294T1093 251Q1093 226 1076 208T1033 190T990 207T972 250'], - - // DOWN RIGHT DIAGONAL ELLIPSIS - 0x22F1: [820,-100,1282,133,1148,'133 760Q133 784 150 802T193 820Q217 820 235 804T254 761Q254 736 237 718T194 700T151 717T133 760ZM580 460Q580 484 597 502T640 520Q664 520 682 504T701 461Q701 436 684 418T641 400T598 417T580 460ZM1027 160Q1027 184 1044 202T1087 220Q1111 220 1129 204T1148 161Q1148 136 1131 118T1088 100T1045 117T1027 160'], - - // LEFT CEILING - 0x2308: [750,250,444,174,422,'174 734Q178 746 190 750H298H369Q400 750 411 747T422 730T411 713T372 709Q365 709 345 709T310 710H214V-235Q206 -248 196 -250Q192 -250 189 -249T184 -247T180 -244T178 -241T176 -237T174 -234V734'], - - // RIGHT CEILING - 0x2309: [750,250,444,21,269,'21 717T21 730T32 746T75 750H147H256Q266 742 269 735V-235Q262 -248 251 -250Q247 -250 244 -249T239 -247T235 -244T233 -241T231 -237T229 -234V710H133Q119 710 99 710T71 709Q43 709 32 713'], - - // LEFT FLOOR - 0x230A: [751,251,444,174,423,'174 734Q174 735 175 737T177 740T180 744T184 747T189 749T196 750Q206 748 214 735V-210H310H373Q401 -210 411 -213T422 -230T411 -247T369 -251Q362 -251 338 -251T298 -250H190Q178 -246 174 -234V734'], - - // RIGHT FLOOR - 0x230B: [751,250,444,21,269,'229 734Q229 735 230 737T232 740T235 744T239 747T244 749T251 750Q262 748 269 735V-235Q266 -240 256 -249L147 -250H77Q43 -250 32 -247T21 -230T32 -213T72 -209Q79 -209 99 -209T133 -210H229V734'], - - // stix-small down curve - 0x2322: [388,-122,1000,55,944,'55 141Q55 149 72 174T125 234T209 303T329 360T478 388H526Q649 383 765 319Q814 291 858 250T923 179T944 141Q944 133 938 128T924 122Q914 124 912 125T902 139Q766 328 500 328Q415 328 342 308T225 258T150 199T102 148T84 124Q81 122 75 122Q55 127 55 141'], - - // stix-small up curve - 0x2323: [378,-134,1000,55,944,'923 378Q944 378 944 358Q944 345 912 311T859 259Q710 134 500 134Q288 134 140 259Q55 336 55 358Q55 366 61 372T75 378Q78 378 84 376Q86 376 101 356T147 310T221 257T339 212T500 193Q628 193 734 236Q841 282 903 363Q914 378 923 378'], - - // UPPER LEFT OR LOWER RIGHT CURLY BRACKET SECTION - 0x23B0: [744,244,412,56,357,'357 741V726Q357 720 349 715Q261 655 242 539Q240 526 240 454T239 315T239 247Q240 235 240 124V40Q240 -17 233 -53T201 -130Q155 -206 78 -244H69H64Q58 -244 57 -243T56 -234Q56 -232 56 -231V-225Q56 -218 63 -215Q153 -153 170 -39Q172 -25 173 119V219Q173 245 174 249Q173 258 173 376V460Q173 515 178 545T201 611Q244 695 327 741L334 744H354L357 741'], - - // UPPER RIGHT OR LOWER LEFT CURLY BRACKET SECTION - 0x23B1: [744,244,412,55,357,'78 744Q153 706 196 640T239 492V376Q239 341 239 314T238 271T238 253Q239 251 239 223V119V49Q239 -39 254 -85Q263 -111 275 -134T301 -172T326 -197T346 -213T356 -221T357 -232V-241L354 -244H334Q264 -209 222 -146T174 -12Q173 -6 173 95Q173 134 173 191T174 250Q173 258 173 382V451Q173 542 159 585Q145 626 120 658T75 706T56 723V731Q56 741 57 742T66 744H78'], - - // MATHEMATICAL LEFT ANGLE BRACKET - 0x27E8: [750,250,389,109,333,'333 -232Q332 -239 327 -244T313 -250Q303 -250 296 -240Q293 -233 202 6T110 250T201 494T296 740Q299 745 306 749L309 750Q312 750 313 750Q331 750 333 732Q333 727 243 489Q152 252 152 250T243 11Q333 -227 333 -232'], - - // MATHEMATICAL RIGHT ANGLE BRACKET - 0x27E9: [750,250,389,55,279,'55 732Q56 739 61 744T75 750Q85 750 92 740Q95 733 186 494T278 250T187 6T92 -240Q85 -250 75 -250Q67 -250 62 -245T55 -232Q55 -227 145 11Q236 248 236 250T145 489Q55 727 55 732'], - - // MATHEMATICAL LEFT FLATTENED PARENTHESIS - 0x27EE: [744,244,412,173,357,'357 741V726Q357 720 349 715Q261 655 242 539Q240 526 240 394V331Q240 259 239 250Q240 242 240 119V49Q240 -42 254 -85Q263 -111 275 -134T301 -172T326 -197T346 -213T356 -221T357 -232V-241L354 -244H334Q264 -209 222 -146T174 -12Q173 -6 173 95Q173 134 173 191T174 250Q173 260 173 376V460Q173 515 178 545T201 611Q244 695 327 741L334 744H354L357 741'], - - // MATHEMATICAL RIGHT FLATTENED PARENTHESIS - 0x27EF: [744,244,412,55,240,'78 744Q153 706 196 640T239 492V376Q239 339 239 311T238 269T238 252Q240 236 240 124V40Q240 -18 233 -53T202 -130Q156 -206 79 -244H70H65Q58 -244 57 -242T56 -231T57 -220T64 -215Q153 -154 170 -39Q173 -18 174 119V247Q173 249 173 382V451Q173 542 159 585Q145 626 120 658T75 706T56 723V731Q56 741 57 742T66 744H78'], - - // LONG LEFTWARDS ARROW - 0x27F5: [511,11,1609,55,1525,'165 270H1510Q1525 262 1525 250T1510 230H165Q167 228 182 216T211 189T244 152T277 96T303 25Q308 7 308 0Q308 -11 288 -11Q281 -11 278 -11T272 -7T267 2T263 21Q245 94 195 151T73 236Q58 242 55 247Q55 254 59 257T73 264Q121 283 158 314T215 375T247 434T264 480L267 497Q269 503 270 505T275 509T288 511Q308 511 308 500Q308 493 303 475Q293 438 278 406T246 352T215 315T185 287T165 270'], - - // LONG RIGHTWARDS ARROW - 0x27F6: [511,11,1638,84,1553,'84 237T84 250T98 270H1444Q1328 357 1301 493Q1301 494 1301 496T1300 499Q1300 511 1317 511H1320Q1329 511 1332 510T1338 506T1341 497T1344 481T1352 456Q1374 389 1425 336T1544 261Q1553 258 1553 250Q1553 244 1548 241T1524 231T1486 212Q1445 186 1415 152T1370 85T1349 35T1341 4Q1339 -6 1336 -8T1320 -11Q1300 -11 1300 0Q1300 7 1305 25Q1337 151 1444 230H98Q84 237 84 250'], - - // LONG LEFT RIGHT ARROW - 0x27F7: [511,11,1859,55,1803,'165 270H1694Q1578 357 1551 493Q1551 494 1551 496T1550 499Q1550 511 1567 511H1570Q1579 511 1582 510T1588 506T1591 497T1594 481T1602 456Q1624 389 1675 336T1794 261Q1803 258 1803 250Q1803 244 1798 241T1774 231T1736 212Q1695 186 1665 152T1620 85T1599 35T1591 4Q1589 -6 1586 -8T1570 -11Q1550 -11 1550 0Q1550 7 1555 25Q1587 151 1694 230H165Q167 228 182 216T211 189T244 152T277 96T303 25Q308 7 308 0Q308 -11 288 -11Q281 -11 278 -11T272 -7T267 2T263 21Q245 94 195 151T73 236Q58 242 55 247Q55 254 59 257T73 264Q121 283 158 314T215 375T247 434T264 480L267 497Q269 503 270 505T275 509T288 511Q308 511 308 500Q308 493 303 475Q293 438 278 406T246 352T215 315T185 287T165 270'], - - // LONG LEFTWARDS DOUBLE ARROW - 0x27F8: [525,24,1609,56,1554,'274 173H1539Q1540 172 1542 171T1545 169T1547 167T1550 164T1551 162T1552 158T1553 153Q1553 140 1538 133H318L328 123Q379 69 414 0Q419 -13 419 -17Q419 -24 399 -24Q388 -24 385 -23T377 -12Q332 77 253 144T72 237Q62 240 59 242T56 250T59 257T70 262T89 268T119 278T160 296Q303 366 377 512Q382 522 385 523T401 525Q419 524 419 515Q419 510 414 500Q379 431 328 377L318 367H1538Q1553 359 1553 347Q1553 336 1539 328L1221 327H903L900 328L602 327H274L264 319Q225 289 147 250Q148 249 165 241T210 217T264 181L274 173'], - - // LONG RIGHTWARDS DOUBLE ARROW - 0x27F9: [525,24,1638,56,1582,'1218 514Q1218 525 1234 525Q1239 525 1242 525T1247 525T1251 524T1253 523T1255 520T1257 517T1260 512Q1297 438 1358 381T1469 300T1565 263Q1582 258 1582 250T1573 239T1536 228T1478 204Q1334 134 1260 -12Q1256 -21 1253 -22T1238 -24Q1218 -24 1218 -17Q1218 -13 1223 0Q1258 69 1309 123L1319 133H70Q56 140 56 153Q56 168 72 173H1363L1373 181Q1412 211 1490 250Q1489 251 1472 259T1427 283T1373 319L1363 327H710L707 328L390 327H72Q56 332 56 347Q56 360 70 367H1319L1309 377Q1276 412 1247 458T1218 514'], - - // LONG LEFT RIGHT DOUBLE ARROW - 0x27FA: [525,24,1858,56,1802,'1438 514Q1438 525 1454 525Q1459 525 1462 525T1467 525T1471 524T1473 523T1475 520T1477 517T1480 512Q1517 438 1578 381T1689 300T1785 263Q1802 258 1802 250T1793 239T1756 228T1698 204Q1554 134 1480 -12Q1476 -21 1473 -22T1458 -24Q1438 -24 1438 -17Q1438 -13 1443 0Q1478 69 1529 123L1539 133H318L328 123Q379 69 414 0Q419 -13 419 -17Q419 -24 399 -24Q388 -24 385 -23T377 -12Q332 77 253 144T72 237Q62 240 59 242T56 250T59 257T70 262T89 268T119 278T160 296Q303 366 377 512Q382 522 385 523T401 525Q419 524 419 515Q419 510 414 500Q379 431 328 377L318 367H1539L1529 377Q1496 412 1467 458T1438 514ZM274 173H1583L1593 181Q1632 211 1710 250Q1709 251 1692 259T1647 283T1593 319L1583 327H930L927 328L602 327H274L264 319Q225 289 147 250Q148 249 165 241T210 217T264 181L274 173'], - - // LONG RIGHTWARDS ARROW FROM BAR - 0x27FC: [511,11,1638,54,1553,'95 155V109Q95 83 92 73T75 63Q61 63 58 74T54 130Q54 140 54 180T55 250Q55 421 57 425Q61 437 75 437Q88 437 91 428T95 393V345V270H1444Q1328 357 1301 493Q1301 494 1301 496T1300 499Q1300 511 1317 511H1320Q1329 511 1332 510T1338 506T1341 497T1344 481T1352 456Q1374 389 1425 336T1544 261Q1553 258 1553 250Q1553 244 1548 241T1524 231T1486 212Q1445 186 1415 152T1370 85T1349 35T1341 4Q1339 -6 1336 -8T1320 -11Q1300 -11 1300 0Q1300 7 1305 25Q1337 151 1444 230H95V155'], - - // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN - 0x2AAF: [636,138,778,84,694,'84 346Q84 359 91 363T117 367Q120 367 126 367T137 366Q388 370 512 430T653 609Q657 636 676 636Q685 635 689 629T694 618V612Q689 566 672 528T626 463T569 417T500 383T435 362T373 346Q379 345 404 339T440 330T477 318T533 296Q592 266 630 223T681 145T694 78Q694 57 674 57Q662 57 657 67T652 92T640 135T606 191Q500 320 137 326H114Q104 326 98 327T88 332T84 346ZM84 -131T84 -118T98 -98H679Q694 -106 694 -118T679 -138H98Q84 -131 84 -118'], - - // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN - 0x2AB0: [636,138,778,83,694,'84 614Q84 636 102 636Q115 636 119 626T125 600T137 556T171 501Q277 372 640 366H661Q694 366 694 346T661 326H640Q578 325 526 321T415 307T309 280T222 237T156 172T124 83Q122 66 118 62T103 57Q100 57 98 57T95 58T93 59T90 62T85 67Q83 71 83 80Q88 126 105 164T151 229T208 275T277 309T342 330T404 346Q401 347 380 351T345 360T302 373T245 396Q125 455 92 565Q84 599 84 614ZM84 -131T84 -118T98 -98H679Q694 -106 694 -118T679 -138H98Q84 -131 84 -118'] - }; - - SVG.FONTDATA.FONTS['MathJax_Math-italic'] = { - directory: 'Math/Italic', - family: 'MathJax_Math', - id: 'MJMATHI', - style: 'italic', - skew: { - 0x41: 0.139, - 0x42: 0.0833, - 0x43: 0.0833, - 0x44: 0.0556, - 0x45: 0.0833, - 0x46: 0.0833, - 0x47: 0.0833, - 0x48: 0.0556, - 0x49: 0.111, - 0x4A: 0.167, - 0x4B: 0.0556, - 0x4C: 0.0278, - 0x4D: 0.0833, - 0x4E: 0.0833, - 0x4F: 0.0833, - 0x50: 0.0833, - 0x51: 0.0833, - 0x52: 0.0833, - 0x53: 0.0833, - 0x54: 0.0833, - 0x55: 0.0278, - 0x58: 0.0833, - 0x5A: 0.0833, - 0x63: 0.0556, - 0x64: 0.167, - 0x65: 0.0556, - 0x66: 0.167, - 0x67: 0.0278, - 0x68: -0.0278, - 0x6C: 0.0833, - 0x6F: 0.0556, - 0x70: 0.0833, - 0x71: 0.0833, - 0x72: 0.0556, - 0x73: 0.0556, - 0x74: 0.0833, - 0x75: 0.0278, - 0x76: 0.0278, - 0x77: 0.0833, - 0x78: 0.0278, - 0x79: 0.0556, - 0x7A: 0.0556, - 0x393: 0.0833, - 0x394: 0.167, - 0x398: 0.0833, - 0x39B: 0.167, - 0x39E: 0.0833, - 0x3A0: 0.0556, - 0x3A3: 0.0833, - 0x3A5: 0.0556, - 0x3A6: 0.0833, - 0x3A8: 0.0556, - 0x3A9: 0.0833, - 0x3B1: 0.0278, - 0x3B2: 0.0833, - 0x3B4: 0.0556, - 0x3B5: 0.0833, - 0x3B6: 0.0833, - 0x3B7: 0.0556, - 0x3B8: 0.0833, - 0x3B9: 0.0556, - 0x3BC: 0.0278, - 0x3BD: 0.0278, - 0x3BE: 0.111, - 0x3BF: 0.0556, - 0x3C1: 0.0833, - 0x3C2: 0.0833, - 0x3C4: 0.0278, - 0x3C5: 0.0278, - 0x3C6: 0.0833, - 0x3C7: 0.0556, - 0x3C8: 0.111, - 0x3D1: 0.0833, - 0x3D5: 0.0833, - 0x3F1: 0.0833, - 0x3F5: 0.0556 - }, - - // SPACE - 0x20: [0,0,250,0,0,''], - - // SOLIDUS - 0x2F: [716,215,778,139,638,'166 -215T159 -215T147 -212T141 -204T139 -197Q139 -190 144 -183Q157 -157 378 274T602 707Q605 716 618 716Q625 716 630 712T636 703T638 696Q638 691 406 241T170 -212Q166 -215 159 -215'], - - // LATIN CAPITAL LETTER A - 0x41: [716,0,750,35,726,'208 74Q208 50 254 46Q272 46 272 35Q272 34 270 22Q267 8 264 4T251 0Q249 0 239 0T205 1T141 2Q70 2 50 0H42Q35 7 35 11Q37 38 48 46H62Q132 49 164 96Q170 102 345 401T523 704Q530 716 547 716H555H572Q578 707 578 706L606 383Q634 60 636 57Q641 46 701 46Q726 46 726 36Q726 34 723 22Q720 7 718 4T704 0Q701 0 690 0T651 1T578 2Q484 2 455 0H443Q437 6 437 9T439 27Q443 40 445 43L449 46H469Q523 49 533 63L521 213H283L249 155Q208 86 208 74ZM516 260Q516 271 504 416T490 562L463 519Q447 492 400 412L310 260L413 259Q516 259 516 260'], - - // LATIN CAPITAL LETTER B - 0x42: [683,0,759,35,756,'231 637Q204 637 199 638T194 649Q194 676 205 682Q206 683 335 683Q594 683 608 681Q671 671 713 636T756 544Q756 480 698 429T565 360L555 357Q619 348 660 311T702 219Q702 146 630 78T453 1Q446 0 242 0Q42 0 39 2Q35 5 35 10Q35 17 37 24Q42 43 47 45Q51 46 62 46H68Q95 46 128 49Q142 52 147 61Q150 65 219 339T288 628Q288 635 231 637ZM649 544Q649 574 634 600T585 634Q578 636 493 637Q473 637 451 637T416 636H403Q388 635 384 626Q382 622 352 506Q352 503 351 500L320 374H401Q482 374 494 376Q554 386 601 434T649 544ZM595 229Q595 273 572 302T512 336Q506 337 429 337Q311 337 310 336Q310 334 293 263T258 122L240 52Q240 48 252 48T333 46Q422 46 429 47Q491 54 543 105T595 229'], - - // LATIN CAPITAL LETTER C - 0x43: [705,22,715,50,760,'50 252Q50 367 117 473T286 641T490 704Q580 704 633 653Q642 643 648 636T656 626L657 623Q660 623 684 649Q691 655 699 663T715 679T725 690L740 705H746Q760 705 760 698Q760 694 728 561Q692 422 692 421Q690 416 687 415T669 413H653Q647 419 647 422Q647 423 648 429T650 449T651 481Q651 552 619 605T510 659Q484 659 454 652T382 628T299 572T226 479Q194 422 175 346T156 222Q156 108 232 58Q280 24 350 24Q441 24 512 92T606 240Q610 253 612 255T628 257Q648 257 648 248Q648 243 647 239Q618 132 523 55T319 -22Q206 -22 128 53T50 252'], - - // LATIN CAPITAL LETTER D - 0x44: [683,0,828,33,803,'287 628Q287 635 230 637Q207 637 200 638T193 647Q193 655 197 667T204 682Q206 683 403 683Q570 682 590 682T630 676Q702 659 752 597T803 431Q803 275 696 151T444 3L430 1L236 0H125H72Q48 0 41 2T33 11Q33 13 36 25Q40 41 44 43T67 46Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628ZM703 469Q703 507 692 537T666 584T629 613T590 629T555 636Q553 636 541 636T512 636T479 637H436Q392 637 386 627Q384 623 313 339T242 52Q242 48 253 48T330 47Q335 47 349 47T373 46Q499 46 581 128Q617 164 640 212T683 339T703 469'], - - // LATIN CAPITAL LETTER E - 0x45: [680,0,738,31,764,'492 213Q472 213 472 226Q472 230 477 250T482 285Q482 316 461 323T364 330H312Q311 328 277 192T243 52Q243 48 254 48T334 46Q428 46 458 48T518 61Q567 77 599 117T670 248Q680 270 683 272Q690 274 698 274Q718 274 718 261Q613 7 608 2Q605 0 322 0H133Q31 0 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 659Q197 676 203 680H757Q764 676 764 669Q764 664 751 557T737 447Q735 440 717 440H705Q698 445 698 453L701 476Q704 500 704 528Q704 558 697 578T678 609T643 625T596 632T532 634H485Q397 633 392 631Q388 629 386 622Q385 619 355 499T324 377Q347 376 372 376H398Q464 376 489 391T534 472Q538 488 540 490T557 493Q562 493 565 493T570 492T572 491T574 487T577 483L544 351Q511 218 508 216Q505 213 492 213'], - - // LATIN CAPITAL LETTER F - 0x46: [680,0,643,31,749,'48 1Q31 1 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 659Q197 676 203 680H742Q749 676 749 669Q749 664 736 557T722 447Q720 440 702 440H690Q683 445 683 453Q683 454 686 477T689 530Q689 560 682 579T663 610T626 626T575 633T503 634H480Q398 633 393 631Q388 629 386 623Q385 622 352 492L320 363H375Q378 363 398 363T426 364T448 367T472 374T489 386Q502 398 511 419T524 457T529 475Q532 480 548 480H560Q567 475 567 470Q567 467 536 339T502 207Q500 200 482 200H470Q463 206 463 212Q463 215 468 234T473 274Q473 303 453 310T364 317H309L277 190Q245 66 245 60Q245 46 334 46H359Q365 40 365 39T363 19Q359 6 353 0H336Q295 2 185 2Q120 2 86 2T48 1'], - - // LATIN CAPITAL LETTER G - 0x47: [705,22,786,50,760,'50 252Q50 367 117 473T286 641T490 704Q580 704 633 653Q642 643 648 636T656 626L657 623Q660 623 684 649Q691 655 699 663T715 679T725 690L740 705H746Q760 705 760 698Q760 694 728 561Q692 422 692 421Q690 416 687 415T669 413H653Q647 419 647 422Q647 423 648 429T650 449T651 481Q651 552 619 605T510 659Q492 659 471 656T418 643T357 615T294 567T236 496T189 394T158 260Q156 242 156 221Q156 173 170 136T206 79T256 45T308 28T353 24Q407 24 452 47T514 106Q517 114 529 161T541 214Q541 222 528 224T468 227H431Q425 233 425 235T427 254Q431 267 437 273H454Q494 271 594 271Q634 271 659 271T695 272T707 272Q721 272 721 263Q721 261 719 249Q714 230 709 228Q706 227 694 227Q674 227 653 224Q646 221 643 215T629 164Q620 131 614 108Q589 6 586 3Q584 1 581 1Q571 1 553 21T530 52Q530 53 528 52T522 47Q448 -22 322 -22Q201 -22 126 55T50 252'], - - // LATIN CAPITAL LETTER H - 0x48: [683,0,831,31,888,'228 637Q194 637 192 641Q191 643 191 649Q191 673 202 682Q204 683 219 683Q260 681 355 681Q389 681 418 681T463 682T483 682Q499 682 499 672Q499 670 497 658Q492 641 487 638H485Q483 638 480 638T473 638T464 637T455 637Q416 636 405 634T387 623Q384 619 355 500Q348 474 340 442T328 395L324 380Q324 378 469 378H614L615 381Q615 384 646 504Q674 619 674 627T617 637Q594 637 587 639T580 648Q580 650 582 660Q586 677 588 679T604 682Q609 682 646 681T740 680Q802 680 835 681T871 682Q888 682 888 672Q888 645 876 638H874Q872 638 869 638T862 638T853 637T844 637Q805 636 794 634T776 623Q773 618 704 340T634 58Q634 51 638 51Q646 48 692 46H723Q729 38 729 37T726 19Q722 6 716 0H701Q664 2 567 2Q533 2 504 2T458 2T437 1Q420 1 420 10Q420 15 423 24Q428 43 433 45Q437 46 448 46H454Q481 46 514 49Q520 50 522 50T528 55T534 64T540 82T547 110T558 153Q565 181 569 198Q602 330 602 331T457 332H312L279 197Q245 63 245 58Q245 51 253 49T303 46H334Q340 38 340 37T337 19Q333 6 327 0H312Q275 2 178 2Q144 2 115 2T69 2T48 1Q31 1 31 10Q31 12 34 24Q39 43 44 45Q48 46 59 46H65Q92 46 125 49Q139 52 144 61Q147 65 216 339T285 628Q285 635 228 637'], - - // LATIN CAPITAL LETTER I - 0x49: [683,0,440,26,504,'43 1Q26 1 26 10Q26 12 29 24Q34 43 39 45Q42 46 54 46H60Q120 46 136 53Q137 53 138 54Q143 56 149 77T198 273Q210 318 216 344Q286 624 286 626Q284 630 284 631Q274 637 213 637H193Q184 643 189 662Q193 677 195 680T209 683H213Q285 681 359 681Q481 681 487 683H497Q504 676 504 672T501 655T494 639Q491 637 471 637Q440 637 407 634Q393 631 388 623Q381 609 337 432Q326 385 315 341Q245 65 245 59Q245 52 255 50T307 46H339Q345 38 345 37T342 19Q338 6 332 0H316Q279 2 179 2Q143 2 113 2T65 2T43 1'], - - // LATIN CAPITAL LETTER J - 0x4A: [683,22,555,57,633,'447 625Q447 637 354 637H329Q323 642 323 645T325 664Q329 677 335 683H352Q393 681 498 681Q541 681 568 681T605 682T619 682Q633 682 633 672Q633 670 630 658Q626 642 623 640T604 637Q552 637 545 623Q541 610 483 376Q420 128 419 127Q397 64 333 21T195 -22Q137 -22 97 8T57 88Q57 130 80 152T132 174Q177 174 182 130Q182 98 164 80T123 56Q115 54 115 53T122 44Q148 15 197 15Q235 15 271 47T324 130Q328 142 387 380T447 625'], - - // LATIN CAPITAL LETTER K - 0x4B: [683,0,849,31,889,'285 628Q285 635 228 637Q205 637 198 638T191 647Q191 649 193 661Q199 681 203 682Q205 683 214 683H219Q260 681 355 681Q389 681 418 681T463 682T483 682Q500 682 500 674Q500 669 497 660Q496 658 496 654T495 648T493 644T490 641T486 639T479 638T470 637T456 637Q416 636 405 634T387 623L306 305Q307 305 490 449T678 597Q692 611 692 620Q692 635 667 637Q651 637 651 648Q651 650 654 662T659 677Q662 682 676 682Q680 682 711 681T791 680Q814 680 839 681T869 682Q889 682 889 672Q889 650 881 642Q878 637 862 637Q787 632 726 586Q710 576 656 534T556 455L509 418L518 396Q527 374 546 329T581 244Q656 67 661 61Q663 59 666 57Q680 47 717 46H738Q744 38 744 37T741 19Q737 6 731 0H720Q680 3 625 3Q503 3 488 0H478Q472 6 472 9T474 27Q478 40 480 43T491 46H494Q544 46 544 71Q544 75 517 141T485 216L427 354L359 301L291 248L268 155Q245 63 245 58Q245 51 253 49T303 46H334Q340 37 340 35Q340 19 333 5Q328 0 317 0Q314 0 280 1T180 2Q118 2 85 2T49 1Q31 1 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q147 65 216 339T285 628'], - - // LATIN CAPITAL LETTER L - 0x4C: [683,2,681,32,647,'228 637Q194 637 192 641Q191 643 191 649Q191 673 202 682Q204 683 217 683Q271 680 344 680Q485 680 506 683H518Q524 677 524 674T522 656Q517 641 513 637H475Q406 636 394 628Q387 624 380 600T313 336Q297 271 279 198T252 88L243 52Q243 48 252 48T311 46H328Q360 46 379 47T428 54T478 72T522 106T564 161Q580 191 594 228T611 270Q616 273 628 273H641Q647 264 647 262T627 203T583 83T557 9Q555 4 553 3T537 0T494 -1Q483 -1 418 -1T294 0H116Q32 0 32 10Q32 17 34 24Q39 43 44 45Q48 46 59 46H65Q92 46 125 49Q139 52 144 61Q147 65 216 339T285 628Q285 635 228 637'], - - // LATIN CAPITAL LETTER M - 0x4D: [684,0,970,35,1051,'289 629Q289 635 232 637Q208 637 201 638T194 648Q194 649 196 659Q197 662 198 666T199 671T201 676T203 679T207 681T212 683T220 683T232 684Q238 684 262 684T307 683Q386 683 398 683T414 678Q415 674 451 396L487 117L510 154Q534 190 574 254T662 394Q837 673 839 675Q840 676 842 678T846 681L852 683H948Q965 683 988 683T1017 684Q1051 684 1051 673Q1051 668 1048 656T1045 643Q1041 637 1008 637Q968 636 957 634T939 623Q936 618 867 340T797 59Q797 55 798 54T805 50T822 48T855 46H886Q892 37 892 35Q892 19 885 5Q880 0 869 0Q864 0 828 1T736 2Q675 2 644 2T609 1Q592 1 592 11Q592 13 594 25Q598 41 602 43T625 46Q652 46 685 49Q699 52 704 61Q706 65 742 207T813 490T848 631L654 322Q458 10 453 5Q451 4 449 3Q444 0 433 0Q418 0 415 7Q413 11 374 317L335 624L267 354Q200 88 200 79Q206 46 272 46H282Q288 41 289 37T286 19Q282 3 278 1Q274 0 267 0Q265 0 255 0T221 1T157 2Q127 2 95 1T58 0Q43 0 39 2T35 11Q35 13 38 25T43 40Q45 46 65 46Q135 46 154 86Q158 92 223 354T289 629'], - - // LATIN CAPITAL LETTER N - 0x4E: [683,0,803,31,888,'234 637Q231 637 226 637Q201 637 196 638T191 649Q191 676 202 682Q204 683 299 683Q376 683 387 683T401 677Q612 181 616 168L670 381Q723 592 723 606Q723 633 659 637Q635 637 635 648Q635 650 637 660Q641 676 643 679T653 683Q656 683 684 682T767 680Q817 680 843 681T873 682Q888 682 888 672Q888 650 880 642Q878 637 858 637Q787 633 769 597L620 7Q618 0 599 0Q585 0 582 2Q579 5 453 305L326 604L261 344Q196 88 196 79Q201 46 268 46H278Q284 41 284 38T282 19Q278 6 272 0H259Q228 2 151 2Q123 2 100 2T63 2T46 1Q31 1 31 10Q31 14 34 26T39 40Q41 46 62 46Q130 49 150 85Q154 91 221 362L289 634Q287 635 234 637'], - - // LATIN CAPITAL LETTER O - 0x4F: [704,22,763,50,740,'740 435Q740 320 676 213T511 42T304 -22Q207 -22 138 35T51 201Q50 209 50 244Q50 346 98 438T227 601Q351 704 476 704Q514 704 524 703Q621 689 680 617T740 435ZM637 476Q637 565 591 615T476 665Q396 665 322 605Q242 542 200 428T157 216Q157 126 200 73T314 19Q404 19 485 98T608 313Q637 408 637 476'], - - // LATIN CAPITAL LETTER P - 0x50: [683,0,642,33,751,'287 628Q287 635 230 637Q206 637 199 638T192 648Q192 649 194 659Q200 679 203 681T397 683Q587 682 600 680Q664 669 707 631T751 530Q751 453 685 389Q616 321 507 303Q500 302 402 301H307L277 182Q247 66 247 59Q247 55 248 54T255 50T272 48T305 46H336Q342 37 342 35Q342 19 335 5Q330 0 319 0Q316 0 282 1T182 2Q120 2 87 2T51 1Q33 1 33 11Q33 13 36 25Q40 41 44 43T67 46Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628ZM645 554Q645 567 643 575T634 597T609 619T560 635Q553 636 480 637Q463 637 445 637T416 636T404 636Q391 635 386 627Q384 621 367 550T332 412T314 344Q314 342 395 342H407H430Q542 342 590 392Q617 419 631 471T645 554'], - - // LATIN CAPITAL LETTER Q - 0x51: [704,194,791,50,740,'399 -80Q399 -47 400 -30T402 -11V-7L387 -11Q341 -22 303 -22Q208 -22 138 35T51 201Q50 209 50 244Q50 346 98 438T227 601Q351 704 476 704Q514 704 524 703Q621 689 680 617T740 435Q740 255 592 107Q529 47 461 16L444 8V3Q444 2 449 -24T470 -66T516 -82Q551 -82 583 -60T625 -3Q631 11 638 11Q647 11 649 2Q649 -6 639 -34T611 -100T557 -165T481 -194Q399 -194 399 -87V-80ZM636 468Q636 523 621 564T580 625T530 655T477 665Q429 665 379 640Q277 591 215 464T153 216Q153 110 207 59Q231 38 236 38V46Q236 86 269 120T347 155Q372 155 390 144T417 114T429 82T435 55L448 64Q512 108 557 185T619 334T636 468ZM314 18Q362 18 404 39L403 49Q399 104 366 115Q354 117 347 117Q344 117 341 117T337 118Q317 118 296 98T274 52Q274 18 314 18'], - - // LATIN CAPITAL LETTER R - 0x52: [683,21,759,33,755,'230 637Q203 637 198 638T193 649Q193 676 204 682Q206 683 378 683Q550 682 564 680Q620 672 658 652T712 606T733 563T739 529Q739 484 710 445T643 385T576 351T538 338L545 333Q612 295 612 223Q612 212 607 162T602 80V71Q602 53 603 43T614 25T640 16Q668 16 686 38T712 85Q717 99 720 102T735 105Q755 105 755 93Q755 75 731 36Q693 -21 641 -21H632Q571 -21 531 4T487 82Q487 109 502 166T517 239Q517 290 474 313Q459 320 449 321T378 323H309L277 193Q244 61 244 59Q244 55 245 54T252 50T269 48T302 46H333Q339 38 339 37T336 19Q332 6 326 0H311Q275 2 180 2Q146 2 117 2T71 2T50 1Q33 1 33 10Q33 12 36 24Q41 43 46 45Q50 46 61 46H67Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628Q287 635 230 637ZM630 554Q630 586 609 608T523 636Q521 636 500 636T462 637H440Q393 637 386 627Q385 624 352 494T319 361Q319 360 388 360Q466 361 492 367Q556 377 592 426Q608 449 619 486T630 554'], - - // LATIN CAPITAL LETTER S - 0x53: [705,22,613,52,645,'308 24Q367 24 416 76T466 197Q466 260 414 284Q308 311 278 321T236 341Q176 383 176 462Q176 523 208 573T273 648Q302 673 343 688T407 704H418H425Q521 704 564 640Q565 640 577 653T603 682T623 704Q624 704 627 704T632 705Q645 705 645 698T617 577T585 459T569 456Q549 456 549 465Q549 471 550 475Q550 478 551 494T553 520Q553 554 544 579T526 616T501 641Q465 662 419 662Q362 662 313 616T263 510Q263 480 278 458T319 427Q323 425 389 408T456 390Q490 379 522 342T554 242Q554 216 546 186Q541 164 528 137T492 78T426 18T332 -20Q320 -22 298 -22Q199 -22 144 33L134 44L106 13Q83 -14 78 -18T65 -22Q52 -22 52 -14Q52 -11 110 221Q112 227 130 227H143Q149 221 149 216Q149 214 148 207T144 186T142 153Q144 114 160 87T203 47T255 29T308 24'], - - // LATIN CAPITAL LETTER T - 0x54: [677,0,584,21,704,'40 437Q21 437 21 445Q21 450 37 501T71 602L88 651Q93 669 101 677H569H659Q691 677 697 676T704 667Q704 661 687 553T668 444Q668 437 649 437Q640 437 637 437T631 442L629 445Q629 451 635 490T641 551Q641 586 628 604T573 629Q568 630 515 631Q469 631 457 630T439 622Q438 621 368 343T298 60Q298 48 386 46Q418 46 427 45T436 36Q436 31 433 22Q429 4 424 1L422 0Q419 0 415 0Q410 0 363 1T228 2Q99 2 64 0H49Q43 6 43 9T45 27Q49 40 55 46H83H94Q174 46 189 55Q190 56 191 56Q196 59 201 76T241 233Q258 301 269 344Q339 619 339 625Q339 630 310 630H279Q212 630 191 624Q146 614 121 583T67 467Q60 445 57 441T43 437H40'], - - // LATIN CAPITAL LETTER U - 0x55: [683,22,683,60,767,'107 637Q73 637 71 641Q70 643 70 649Q70 673 81 682Q83 683 98 683Q139 681 234 681Q268 681 297 681T342 682T362 682Q378 682 378 672Q378 670 376 658Q371 641 366 638H364Q362 638 359 638T352 638T343 637T334 637Q295 636 284 634T266 623Q265 621 238 518T184 302T154 169Q152 155 152 140Q152 86 183 55T269 24Q336 24 403 69T501 205L552 406Q599 598 599 606Q599 633 535 637Q511 637 511 648Q511 650 513 660Q517 676 519 679T529 683Q532 683 561 682T645 680Q696 680 723 681T752 682Q767 682 767 672Q767 650 759 642Q756 637 737 637Q666 633 648 597Q646 592 598 404Q557 235 548 205Q515 105 433 42T263 -22Q171 -22 116 34T60 167V183Q60 201 115 421Q164 622 164 628Q164 635 107 637'], - - // LATIN CAPITAL LETTER V - 0x56: [683,22,583,52,769,'52 648Q52 670 65 683H76Q118 680 181 680Q299 680 320 683H330Q336 677 336 674T334 656Q329 641 325 637H304Q282 635 274 635Q245 630 242 620Q242 618 271 369T301 118L374 235Q447 352 520 471T595 594Q599 601 599 609Q599 633 555 637Q537 637 537 648Q537 649 539 661Q542 675 545 679T558 683Q560 683 570 683T604 682T668 681Q737 681 755 683H762Q769 676 769 672Q769 655 760 640Q757 637 743 637Q730 636 719 635T698 630T682 623T670 615T660 608T652 599T645 592L452 282Q272 -9 266 -16Q263 -18 259 -21L241 -22H234Q216 -22 216 -15Q213 -9 177 305Q139 623 138 626Q133 637 76 637H59Q52 642 52 648'], - - // LATIN CAPITAL LETTER W - 0x57: [683,22,944,51,1048,'436 683Q450 683 486 682T553 680Q604 680 638 681T677 682Q695 682 695 674Q695 670 692 659Q687 641 683 639T661 637Q636 636 621 632T600 624T597 615Q597 603 613 377T629 138L631 141Q633 144 637 151T649 170T666 200T690 241T720 295T759 362Q863 546 877 572T892 604Q892 619 873 628T831 637Q817 637 817 647Q817 650 819 660Q823 676 825 679T839 682Q842 682 856 682T895 682T949 681Q1015 681 1034 683Q1048 683 1048 672Q1048 666 1045 655T1038 640T1028 637Q1006 637 988 631T958 617T939 600T927 584L923 578L754 282Q586 -14 585 -15Q579 -22 561 -22Q546 -22 542 -17Q539 -14 523 229T506 480L494 462Q472 425 366 239Q222 -13 220 -15T215 -19Q210 -22 197 -22Q178 -22 176 -15Q176 -12 154 304T131 622Q129 631 121 633T82 637H58Q51 644 51 648Q52 671 64 683H76Q118 680 176 680Q301 680 313 683H323Q329 677 329 674T327 656Q322 641 318 637H297Q236 634 232 620Q262 160 266 136L501 550L499 587Q496 629 489 632Q483 636 447 637Q428 637 422 639T416 648Q416 650 418 660Q419 664 420 669T421 676T424 680T428 682T436 683'], - - // LATIN CAPITAL LETTER X - 0x58: [683,0,828,26,852,'42 0H40Q26 0 26 11Q26 15 29 27Q33 41 36 43T55 46Q141 49 190 98Q200 108 306 224T411 342Q302 620 297 625Q288 636 234 637H206Q200 643 200 645T202 664Q206 677 212 683H226Q260 681 347 681Q380 681 408 681T453 682T473 682Q490 682 490 671Q490 670 488 658Q484 643 481 640T465 637Q434 634 411 620L488 426L541 485Q646 598 646 610Q646 628 622 635Q617 635 609 637Q594 637 594 648Q594 650 596 664Q600 677 606 683H618Q619 683 643 683T697 681T738 680Q828 680 837 683H845Q852 676 852 672Q850 647 840 637H824Q790 636 763 628T722 611T698 593L687 584Q687 585 592 480L505 384Q505 383 536 304T601 142T638 56Q648 47 699 46Q734 46 734 37Q734 35 732 23Q728 7 725 4T711 1Q708 1 678 1T589 2Q528 2 496 2T461 1Q444 1 444 10Q444 11 446 25Q448 35 450 39T455 44T464 46T480 47T506 54Q523 62 523 64Q522 64 476 181L429 299Q241 95 236 84Q232 76 232 72Q232 53 261 47Q262 47 267 47T273 46Q276 46 277 46T280 45T283 42T284 35Q284 26 282 19Q279 6 276 4T261 1Q258 1 243 1T201 2T142 2Q64 2 42 0'], - - // LATIN CAPITAL LETTER Y - 0x59: [683,-1,581,30,763,'66 637Q54 637 49 637T39 638T32 641T30 647T33 664T42 682Q44 683 56 683Q104 680 165 680Q288 680 306 683H316Q322 677 322 674T320 656Q316 643 310 637H298Q242 637 242 624Q242 619 292 477T343 333L346 336Q350 340 358 349T379 373T411 410T454 461Q546 568 561 587T577 618Q577 634 545 637Q528 637 528 647Q528 649 530 661Q533 676 535 679T549 683Q551 683 578 682T657 680Q684 680 713 681T746 682Q763 682 763 673Q763 669 760 657T755 643Q753 637 734 637Q662 632 617 587Q608 578 477 424L348 273L322 169Q295 62 295 57Q295 46 363 46Q379 46 384 45T390 35Q390 33 388 23Q384 6 382 4T366 1Q361 1 324 1T232 2Q170 2 138 2T102 1Q84 1 84 9Q84 14 87 24Q88 27 89 30T90 35T91 39T93 42T96 44T101 45T107 45T116 46T129 46Q168 47 180 50T198 63Q201 68 227 171L252 274L129 623Q128 624 127 625T125 627T122 629T118 631T113 633T105 634T96 635T83 636T66 637'], - - // LATIN CAPITAL LETTER Z - 0x5A: [683,0,683,58,723,'58 8Q58 23 64 35Q64 36 329 334T596 635L586 637Q575 637 512 637H500H476Q442 637 420 635T365 624T311 598T266 548T228 469Q227 466 226 463T224 458T223 453T222 450L221 448Q218 443 202 443Q185 443 182 453L214 561Q228 606 241 651Q249 679 253 681Q256 683 487 683H718Q723 678 723 675Q723 673 717 649Q189 54 188 52L185 49H274Q369 50 377 51Q452 60 500 100T579 247Q587 272 590 277T603 282H607Q628 282 628 271Q547 5 541 2Q538 0 300 0H124Q58 0 58 8'], - - // LATIN SMALL LETTER A - 0x61: [441,10,529,33,506,'33 157Q33 258 109 349T280 441Q331 441 370 392Q386 422 416 422Q429 422 439 414T449 394Q449 381 412 234T374 68Q374 43 381 35T402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487Q506 153 506 144Q506 138 501 117T481 63T449 13Q436 0 417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157ZM351 328Q351 334 346 350T323 385T277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q217 26 254 59T298 110Q300 114 325 217T351 328'], - - // LATIN SMALL LETTER B - 0x62: [694,11,429,40,422,'73 647Q73 657 77 670T89 683Q90 683 161 688T234 694Q246 694 246 685T212 542Q204 508 195 472T180 418L176 399Q176 396 182 402Q231 442 283 442Q345 442 383 396T422 280Q422 169 343 79T173 -11Q123 -11 82 27T40 150V159Q40 180 48 217T97 414Q147 611 147 623T109 637Q104 637 101 637H96Q86 637 83 637T76 640T73 647ZM336 325V331Q336 405 275 405Q258 405 240 397T207 376T181 352T163 330L157 322L136 236Q114 150 114 114Q114 66 138 42Q154 26 178 26Q211 26 245 58Q270 81 285 114T318 219Q336 291 336 325'], - - // LATIN SMALL LETTER C - 0x63: [442,12,433,34,430,'34 159Q34 268 120 355T306 442Q362 442 394 418T427 355Q427 326 408 306T360 285Q341 285 330 295T319 325T330 359T352 380T366 386H367Q367 388 361 392T340 400T306 404Q276 404 249 390Q228 381 206 359Q162 315 142 235T121 119Q121 73 147 50Q169 26 205 26H209Q321 26 394 111Q403 121 406 121Q410 121 419 112T429 98T420 83T391 55T346 25T282 0T202 -11Q127 -11 81 37T34 159'], - - // LATIN SMALL LETTER D - 0x64: [694,10,520,33,523,'366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326'], - - // LATIN SMALL LETTER E - 0x65: [443,11,466,39,430,'39 168Q39 225 58 272T107 350T174 402T244 433T307 442H310Q355 442 388 420T421 355Q421 265 310 237Q261 224 176 223Q139 223 138 221Q138 219 132 186T125 128Q125 81 146 54T209 26T302 45T394 111Q403 121 406 121Q410 121 419 112T429 98T420 82T390 55T344 24T281 -1T205 -11Q126 -11 83 42T39 168ZM373 353Q367 405 305 405Q272 405 244 391T199 357T170 316T154 280T149 261Q149 260 169 260Q282 260 327 284T373 353'], - - // LATIN SMALL LETTER F - 0x66: [705,205,490,55,550,'118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162'], - - // LATIN SMALL LETTER G - 0x67: [442,205,477,10,480,'311 43Q296 30 267 15T206 0Q143 0 105 45T66 160Q66 265 143 353T314 442Q361 442 401 394L404 398Q406 401 409 404T418 412T431 419T447 422Q461 422 470 413T480 394Q480 379 423 152T363 -80Q345 -134 286 -169T151 -205Q10 -205 10 -137Q10 -111 28 -91T74 -71Q89 -71 102 -80T116 -111Q116 -121 114 -130T107 -144T99 -154T92 -162L90 -164H91Q101 -167 151 -167Q189 -167 211 -155Q234 -144 254 -122T282 -75Q288 -56 298 -13Q311 35 311 43ZM384 328L380 339Q377 350 375 354T369 368T359 382T346 393T328 402T306 405Q262 405 221 352Q191 313 171 233T151 117Q151 38 213 38Q269 38 323 108L331 118L384 328'], - - // LATIN SMALL LETTER H - 0x68: [694,11,576,48,555,'137 683Q138 683 209 688T282 694Q294 694 294 685Q294 674 258 534Q220 386 220 383Q220 381 227 388Q288 442 357 442Q411 442 444 415T478 336Q478 285 440 178T402 50Q403 36 407 31T422 26Q450 26 474 56T513 138Q516 149 519 151T535 153Q555 153 555 145Q555 144 551 130Q535 71 500 33Q466 -10 419 -10H414Q367 -10 346 17T325 74Q325 90 361 192T398 345Q398 404 354 404H349Q266 404 205 306L198 293L164 158Q132 28 127 16Q114 -11 83 -11Q69 -11 59 -2T48 16Q48 30 121 320L195 616Q195 629 188 632T149 637H128Q122 643 122 645T124 664Q129 683 137 683'], - - // LATIN SMALL LETTER I - 0x69: [661,11,345,21,302,'184 600Q184 624 203 642T247 661Q265 661 277 649T290 619Q290 596 270 577T226 557Q211 557 198 567T184 600ZM21 287Q21 295 30 318T54 369T98 420T158 442Q197 442 223 419T250 357Q250 340 236 301T196 196T154 83Q149 61 149 51Q149 26 166 26Q175 26 185 29T208 43T235 78T260 137Q263 149 265 151T282 153Q302 153 302 143Q302 135 293 112T268 61T223 11T161 -11Q129 -11 102 10T74 74Q74 91 79 106T122 220Q160 321 166 341T173 380Q173 404 156 404H154Q124 404 99 371T61 287Q60 286 59 284T58 281T56 279T53 278T49 278T41 278H27Q21 284 21 287'], - - // LATIN SMALL LETTER J - 0x6A: [661,204,412,-12,403,'297 596Q297 627 318 644T361 661Q378 661 389 651T403 623Q403 595 384 576T340 557Q322 557 310 567T297 596ZM288 376Q288 405 262 405Q240 405 220 393T185 362T161 325T144 293L137 279Q135 278 121 278H107Q101 284 101 286T105 299Q126 348 164 391T252 441Q253 441 260 441T272 442Q296 441 316 432Q341 418 354 401T367 348V332L318 133Q267 -67 264 -75Q246 -125 194 -164T75 -204Q25 -204 7 -183T-12 -137Q-12 -110 7 -91T53 -71Q70 -71 82 -81T95 -112Q95 -148 63 -167Q69 -168 77 -168Q111 -168 139 -140T182 -74L193 -32Q204 11 219 72T251 197T278 308T289 365Q289 372 288 376'], - - // LATIN SMALL LETTER K - 0x6B: [694,11,521,48,503,'121 647Q121 657 125 670T137 683Q138 683 209 688T282 694Q294 694 294 686Q294 679 244 477Q194 279 194 272Q213 282 223 291Q247 309 292 354T362 415Q402 442 438 442Q468 442 485 423T503 369Q503 344 496 327T477 302T456 291T438 288Q418 288 406 299T394 328Q394 353 410 369T442 390L458 393Q446 405 434 405H430Q398 402 367 380T294 316T228 255Q230 254 243 252T267 246T293 238T320 224T342 206T359 180T365 147Q365 130 360 106T354 66Q354 26 381 26Q429 26 459 145Q461 153 479 153H483Q499 153 499 144Q499 139 496 130Q455 -11 378 -11Q333 -11 305 15T277 90Q277 108 280 121T283 145Q283 167 269 183T234 206T200 217T182 220H180Q168 178 159 139T145 81T136 44T129 20T122 7T111 -2Q98 -11 83 -11Q66 -11 57 -1T48 16Q48 26 85 176T158 471L195 616Q196 629 188 632T149 637H144Q134 637 131 637T124 640T121 647'], - - // LATIN SMALL LETTER L - 0x6C: [695,12,298,38,266,'117 59Q117 26 142 26Q179 26 205 131Q211 151 215 152Q217 153 225 153H229Q238 153 241 153T246 151T248 144Q247 138 245 128T234 90T214 43T183 6T137 -11Q101 -11 70 11T38 85Q38 97 39 102L104 360Q167 615 167 623Q167 626 166 628T162 632T157 634T149 635T141 636T132 637T122 637Q112 637 109 637T101 638T95 641T94 647Q94 649 96 661Q101 680 107 682T179 688Q194 689 213 690T243 693T254 694Q266 694 266 686Q266 675 193 386T118 83Q118 81 118 75T117 65V59'], - - // LATIN SMALL LETTER M - 0x6D: [443,11,878,21,857,'21 287Q22 293 24 303T36 341T56 388T88 425T132 442T175 435T205 417T221 395T229 376L231 369Q231 367 232 367L243 378Q303 442 384 442Q401 442 415 440T441 433T460 423T475 411T485 398T493 385T497 373T500 364T502 357L510 367Q573 442 659 442Q713 442 746 415T780 336Q780 285 742 178T704 50Q705 36 709 31T724 26Q752 26 776 56T815 138Q818 149 821 151T837 153Q857 153 857 145Q857 144 853 130Q845 101 831 73T785 17T716 -10Q669 -10 648 17T627 73Q627 92 663 193T700 345Q700 404 656 404H651Q565 404 506 303L499 291L466 157Q433 26 428 16Q415 -11 385 -11Q372 -11 364 -4T353 8T350 18Q350 29 384 161L420 307Q423 322 423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 181Q151 335 151 342Q154 357 154 369Q154 405 129 405Q107 405 92 377T69 316T57 280Q55 278 41 278H27Q21 284 21 287'], - - // LATIN SMALL LETTER N - 0x6E: [443,11,600,21,580,'21 287Q22 293 24 303T36 341T56 388T89 425T135 442Q171 442 195 424T225 390T231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336T465 179T427 52Q427 26 444 26Q450 26 453 27Q482 32 505 65T540 145Q542 153 560 153Q580 153 580 145Q580 144 576 130Q568 101 554 73T508 17T439 -10Q392 -10 371 17T350 73Q350 92 386 193T423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 180T152 343Q153 348 153 366Q153 405 129 405Q91 405 66 305Q60 285 60 284Q58 278 41 278H27Q21 284 21 287'], - - // LATIN SMALL LETTER O - 0x6F: [441,11,485,34,476,'201 -11Q126 -11 80 38T34 156Q34 221 64 279T146 380Q222 441 301 441Q333 441 341 440Q354 437 367 433T402 417T438 387T464 338T476 268Q476 161 390 75T201 -11ZM121 120Q121 70 147 48T206 26Q250 26 289 58T351 142Q360 163 374 216T388 308Q388 352 370 375Q346 405 306 405Q243 405 195 347Q158 303 140 230T121 120'], - - // LATIN SMALL LETTER P - 0x70: [443,194,503,-39,497,'23 287Q24 290 25 295T30 317T40 348T55 381T75 411T101 433T134 442Q209 442 230 378L240 387Q302 442 358 442Q423 442 460 395T497 281Q497 173 421 82T249 -10Q227 -10 210 -4Q199 1 187 11T168 28L161 36Q160 35 139 -51T118 -138Q118 -144 126 -145T163 -148H188Q194 -155 194 -157T191 -175Q188 -187 185 -190T172 -194Q170 -194 161 -194T127 -193T65 -192Q-5 -192 -24 -194H-32Q-39 -187 -39 -183Q-37 -156 -26 -148H-6Q28 -147 33 -136Q36 -130 94 103T155 350Q156 355 156 364Q156 405 131 405Q109 405 94 377T71 316T59 280Q57 278 43 278H29Q23 284 23 287ZM178 102Q200 26 252 26Q282 26 310 49T356 107Q374 141 392 215T411 325V331Q411 405 350 405Q339 405 328 402T306 393T286 380T269 365T254 350T243 336T235 326L232 322Q232 321 229 308T218 264T204 212Q178 106 178 102'], - - // LATIN SMALL LETTER Q - 0x71: [442,194,446,33,460,'33 157Q33 258 109 349T280 441Q340 441 372 389Q373 390 377 395T388 406T404 418Q438 442 450 442Q454 442 457 439T460 434Q460 425 391 149Q320 -135 320 -139Q320 -147 365 -148H390Q396 -156 396 -157T393 -175Q389 -188 383 -194H370Q339 -192 262 -192Q234 -192 211 -192T174 -192T157 -193Q143 -193 143 -185Q143 -182 145 -170Q149 -154 152 -151T172 -148Q220 -148 230 -141Q238 -136 258 -53T279 32Q279 33 272 29Q224 -10 172 -10Q117 -10 75 30T33 157ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326'], - - // LATIN SMALL LETTER R - 0x72: [443,11,451,21,430,'21 287Q22 290 23 295T28 317T38 348T53 381T73 411T99 433T132 442Q161 442 183 430T214 408T225 388Q227 382 228 382T236 389Q284 441 347 441H350Q398 441 422 400Q430 381 430 363Q430 333 417 315T391 292T366 288Q346 288 334 299T322 328Q322 376 378 392Q356 405 342 405Q286 405 239 331Q229 315 224 298T190 165Q156 25 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 114 189T154 366Q154 405 128 405Q107 405 92 377T68 316T57 280Q55 278 41 278H27Q21 284 21 287'], - - // LATIN SMALL LETTER S - 0x73: [443,10,469,53,419,'131 289Q131 321 147 354T203 415T300 442Q362 442 390 415T419 355Q419 323 402 308T364 292Q351 292 340 300T328 326Q328 342 337 354T354 372T367 378Q368 378 368 379Q368 382 361 388T336 399T297 405Q249 405 227 379T204 326Q204 301 223 291T278 274T330 259Q396 230 396 163Q396 135 385 107T352 51T289 7T195 -10Q118 -10 86 19T53 87Q53 126 74 143T118 160Q133 160 146 151T160 120Q160 94 142 76T111 58Q109 57 108 57T107 55Q108 52 115 47T146 34T201 27Q237 27 263 38T301 66T318 97T323 122Q323 150 302 164T254 181T195 196T148 231Q131 256 131 289'], - - // LATIN SMALL LETTER T - 0x74: [626,11,361,19,330,'26 385Q19 392 19 395Q19 399 22 411T27 425Q29 430 36 430T87 431H140L159 511Q162 522 166 540T173 566T179 586T187 603T197 615T211 624T229 626Q247 625 254 615T261 596Q261 589 252 549T232 470L222 433Q222 431 272 431H323Q330 424 330 420Q330 398 317 385H210L174 240Q135 80 135 68Q135 26 162 26Q197 26 230 60T283 144Q285 150 288 151T303 153H307Q322 153 322 145Q322 142 319 133Q314 117 301 95T267 48T216 6T155 -11Q125 -11 98 4T59 56Q57 64 57 83V101L92 241Q127 382 128 383Q128 385 77 385H26'], - - // LATIN SMALL LETTER U - 0x75: [442,11,572,21,551,'21 287Q21 295 30 318T55 370T99 420T158 442Q204 442 227 417T250 358Q250 340 216 246T182 105Q182 62 196 45T238 27T291 44T328 78L339 95Q341 99 377 247Q407 367 413 387T427 416Q444 431 463 431Q480 431 488 421T496 402L420 84Q419 79 419 68Q419 43 426 35T447 26Q469 29 482 57T512 145Q514 153 532 153Q551 153 551 144Q550 139 549 130T540 98T523 55T498 17T462 -8Q454 -10 438 -10Q372 -10 347 46Q345 45 336 36T318 21T296 6T267 -6T233 -11Q189 -11 155 7Q103 38 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287'], - - // LATIN SMALL LETTER V - 0x76: [443,11,485,21,467,'173 380Q173 405 154 405Q130 405 104 376T61 287Q60 286 59 284T58 281T56 279T53 278T49 278T41 278H27Q21 284 21 287Q21 294 29 316T53 368T97 419T160 441Q202 441 225 417T249 361Q249 344 246 335Q246 329 231 291T200 202T182 113Q182 86 187 69Q200 26 250 26Q287 26 319 60T369 139T398 222T409 277Q409 300 401 317T383 343T365 361T357 383Q357 405 376 424T417 443Q436 443 451 425T467 367Q467 340 455 284T418 159T347 40T241 -11Q177 -11 139 22Q102 54 102 117Q102 148 110 181T151 298Q173 362 173 380'], - - // LATIN SMALL LETTER W - 0x77: [443,11,716,21,690,'580 385Q580 406 599 424T641 443Q659 443 674 425T690 368Q690 339 671 253Q656 197 644 161T609 80T554 12T482 -11Q438 -11 404 5T355 48Q354 47 352 44Q311 -11 252 -11Q226 -11 202 -5T155 14T118 53T104 116Q104 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Q21 293 29 315T52 366T96 418T161 441Q204 441 227 416T250 358Q250 340 217 250T184 111Q184 65 205 46T258 26Q301 26 334 87L339 96V119Q339 122 339 128T340 136T341 143T342 152T345 165T348 182T354 206T362 238T373 281Q402 395 406 404Q419 431 449 431Q468 431 475 421T483 402Q483 389 454 274T422 142Q420 131 420 107V100Q420 85 423 71T442 42T487 26Q558 26 600 148Q609 171 620 213T632 273Q632 306 619 325T593 357T580 385'], - - // LATIN SMALL LETTER X - 0x78: [442,11,572,35,522,'52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289'], - - // LATIN SMALL LETTER Y - 0x79: [443,205,490,21,497,'21 287Q21 301 36 335T84 406T158 442Q199 442 224 419T250 355Q248 336 247 334Q247 331 231 288T198 191T182 105Q182 62 196 45T238 27Q261 27 281 38T312 61T339 94Q339 95 344 114T358 173T377 247Q415 397 419 404Q432 431 462 431Q475 431 483 424T494 412T496 403Q496 390 447 193T391 -23Q363 -106 294 -155T156 -205Q111 -205 77 -183T43 -117Q43 -95 50 -80T69 -58T89 -48T106 -45Q150 -45 150 -87Q150 -107 138 -122T115 -142T102 -147L99 -148Q101 -153 118 -160T152 -167H160Q177 -167 186 -165Q219 -156 247 -127T290 -65T313 -9T321 21L315 17Q309 13 296 6T270 -6Q250 -11 231 -11Q185 -11 150 11T104 82Q103 89 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287'], - - // LATIN SMALL LETTER Z - 0x7A: [442,11,465,35,468,'347 338Q337 338 294 349T231 360Q211 360 197 356T174 346T162 335T155 324L153 320Q150 317 138 317Q117 317 117 325Q117 330 120 339Q133 378 163 406T229 440Q241 442 246 442Q271 442 291 425T329 392T367 375Q389 375 411 408T434 441Q435 442 449 442H462Q468 436 468 434Q468 430 463 420T449 399T432 377T418 358L411 349Q368 298 275 214T160 106L148 94L163 93Q185 93 227 82T290 71Q328 71 360 90T402 140Q406 149 409 151T424 153Q443 153 443 143Q443 138 442 134Q425 72 376 31T278 -11Q252 -11 232 6T193 40T155 57Q111 57 76 -3Q70 -11 59 -11H54H41Q35 -5 35 -2Q35 13 93 84Q132 129 225 214T340 322Q352 338 347 338'], - - // GREEK CAPITAL LETTER GAMMA - 0x393: [680,-1,615,31,721,'49 1Q31 1 31 10Q31 12 34 24Q39 43 44 45Q48 46 59 46H65Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 661Q197 674 203 680H714Q721 676 721 669Q721 664 708 557T694 447Q692 440 674 440H662Q655 445 655 454Q655 455 658 480T661 534Q661 572 652 592Q638 619 603 626T501 634H471Q398 633 393 630Q389 628 386 622Q385 619 315 341T245 60Q245 46 333 46H345Q366 46 366 35Q366 33 363 21T358 6Q356 1 339 1Q334 1 292 1T187 2Q122 2 88 2T49 1'], - - // GREEK CAPITAL LETTER THETA - 0x398: [704,22,763,50,740,'740 435Q740 320 676 213T511 42T304 -22Q207 -22 138 35T51 201Q50 209 50 244Q50 346 98 438T227 601Q351 704 476 704Q514 704 524 703Q621 689 680 617T740 435ZM640 466Q640 523 625 565T583 628T532 658T479 668Q370 668 273 559T151 255Q150 245 150 213Q150 156 165 116T207 55T259 26T313 17Q385 17 451 63T561 184Q590 234 615 312T640 466ZM510 276Q510 278 512 288L515 298Q515 299 384 299H253L250 285Q246 271 244 268T231 265H227Q216 265 214 266T207 274Q207 278 223 345T244 416Q247 419 260 419H263Q280 419 280 408Q280 406 278 396L275 386Q275 385 406 385H537L540 399Q544 413 546 416T559 419H563Q574 419 576 418T583 410Q583 403 566 339Q549 271 544 267Q542 265 538 265H530H527Q510 265 510 276'], - - // GREEK CAPITAL LETTER LAMDA - 0x39B: [716,0,694,35,670,'135 2Q114 2 90 2T60 1Q35 1 35 11Q35 28 42 40Q45 46 55 46Q119 46 151 94Q153 97 325 402T498 709Q505 716 526 716Q543 716 549 710Q550 709 560 548T580 224T591 57Q594 52 595 52Q603 47 638 46H663Q670 39 670 35Q669 12 657 0H644Q613 2 530 2Q497 2 469 2T424 2T405 1Q388 1 388 10Q388 15 391 24Q392 27 393 32T395 38T397 41T401 44T406 45T415 46Q473 46 487 64L472 306Q468 365 465 426T459 518L457 550Q456 550 328 322T198 88Q196 80 196 77Q196 49 243 46Q261 46 261 35Q261 34 259 22Q256 7 254 4T240 0Q237 0 211 1T135 2'], - - // GREEK CAPITAL LETTER XI - 0x39E: [678,0,742,53,777,'222 668Q222 670 229 677H654Q677 677 705 677T740 678Q764 678 770 676T777 667Q777 662 764 594Q761 579 757 559T751 528L749 519Q747 512 729 512H717Q710 519 710 525Q712 532 715 559T719 591Q718 595 711 595Q682 598 486 598Q252 598 246 592Q239 587 228 552L216 517Q214 512 197 512H185Q178 517 178 522Q178 524 198 591T222 668ZM227 262Q218 262 215 262T209 266L207 270L227 356Q247 435 250 439Q253 443 260 443H267H280Q287 438 287 433Q287 430 285 420T280 402L278 393Q278 392 431 392H585L590 415Q595 436 598 439T612 443H628Q635 438 635 433Q635 431 615 351T594 268Q592 262 575 262H572Q556 262 556 272Q556 280 560 293L565 313H258L252 292Q248 271 245 267T230 262H227ZM60 0Q53 4 53 11Q53 14 68 89T84 169Q88 176 98 176H104H116Q123 169 123 163Q122 160 117 127T112 88Q112 80 243 80H351H454Q554 80 574 81T597 88V89Q603 100 610 121T622 157T630 174Q633 176 646 176H658Q665 171 665 166Q665 164 643 89T618 7Q616 2 607 1T548 0H335H60'], - - // GREEK CAPITAL LETTER PI - 0x3A0: [681,0,831,31,887,'48 1Q31 1 31 10Q31 12 34 24Q39 43 44 45Q48 46 59 46H65Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 661Q197 674 203 680H541Q621 680 709 680T812 681Q841 681 855 681T877 679T886 676T887 670Q887 663 885 656Q880 637 875 635Q871 634 860 634H854Q827 634 794 631Q780 628 775 619Q773 614 704 338T634 58Q634 51 638 51Q646 48 692 46H723Q729 38 729 37T726 19Q722 6 716 0H701Q664 2 567 2Q533 2 504 2T458 2T437 1Q420 1 420 10Q420 15 423 24Q428 43 433 45Q437 46 448 46H454Q481 46 514 49Q528 52 533 61Q536 67 572 209T642 491T678 632Q678 634 533 634H388Q387 631 316 347T245 59Q245 55 246 54T253 50T270 48T303 46H334Q340 38 340 37T337 19Q333 6 327 0H312Q275 2 178 2Q144 2 115 2T69 2T48 1'], - - // GREEK CAPITAL LETTER SIGMA - 0x3A3: [683,0,780,58,806,'65 0Q58 4 58 11Q58 16 114 67Q173 119 222 164L377 304Q378 305 340 386T261 552T218 644Q217 648 219 660Q224 678 228 681Q231 683 515 683H799Q804 678 806 674Q806 667 793 559T778 448Q774 443 759 443Q747 443 743 445T739 456Q739 458 741 477T743 516Q743 552 734 574T710 609T663 627T596 635T502 637Q480 637 469 637H339Q344 627 411 486T478 341V339Q477 337 477 336L457 318Q437 300 398 265T322 196L168 57Q167 56 188 56T258 56H359Q426 56 463 58T537 69T596 97T639 146T680 225Q686 243 689 246T702 250H705Q726 250 726 239Q726 238 683 123T639 5Q637 1 610 1Q577 0 348 0H65'], - - // GREEK CAPITAL LETTER UPSILON - 0x3A5: [706,0,583,28,700,'45 535Q34 535 31 536T28 544Q28 554 39 578T70 631T126 683T206 705Q230 705 251 698T295 671T330 612T344 514Q344 477 342 473V472Q343 472 347 480T361 509T380 547Q471 704 596 704Q615 704 625 702Q659 692 679 663T700 595Q700 565 696 552T687 537T670 535Q656 535 653 536T649 543Q649 544 649 550T650 562Q650 589 629 605T575 621Q502 621 448 547T365 361Q290 70 290 60Q290 46 379 46H404Q410 40 410 39T408 19Q404 6 398 0H381Q340 2 225 2Q184 2 149 2T94 2T69 1Q61 1 58 1T53 4T51 10Q51 11 53 23Q54 25 55 30T56 36T58 40T60 43T62 44T67 46T73 46T82 46H89Q144 46 163 49T190 62L198 93Q206 124 217 169T241 262T262 350T274 404Q281 445 281 486V494Q281 621 185 621Q147 621 116 601T74 550Q71 539 66 537T45 535'], - - // GREEK CAPITAL LETTER PHI - 0x3A6: [683,0,667,24,642,'356 624Q356 637 267 637H243Q237 642 237 645T239 664Q243 677 249 683H264Q342 681 429 681Q565 681 571 683H583Q589 677 589 674T587 656Q582 641 578 637H540Q516 637 504 637T479 633T463 630T454 623T448 613T443 597T438 576Q436 566 434 556T430 539L428 533Q442 533 472 526T543 502T613 451T642 373Q642 301 567 241T386 158L336 150Q332 150 331 146Q310 66 310 60Q310 46 399 46H424Q430 40 430 39T428 19Q424 6 418 0H401Q360 2 247 2Q207 2 173 2T119 2T95 1Q87 1 84 1T79 4T77 10Q77 11 79 23Q80 25 81 30T82 36T84 40T86 43T88 44T93 46T99 46T108 46H115Q170 46 189 49T216 62Q220 74 228 107L239 150L223 152Q139 164 82 205T24 311Q24 396 125 462Q207 517 335 533L346 578Q356 619 356 624ZM130 291Q130 203 241 188H249Q249 190 287 342L325 495H324Q313 495 291 491T229 466T168 414Q130 357 130 291ZM536 393Q536 440 507 463T418 496L341 187L351 189Q443 201 487 255Q536 314 536 393'], - - // GREEK CAPITAL LETTER PSI - 0x3A8: [683,0,612,21,692,'216 151Q48 174 48 329Q48 361 56 403T65 458Q65 482 58 494T43 507T28 510T21 520Q21 528 23 534T29 544L32 546H72H94Q110 546 119 544T139 536T154 514T159 476V465Q159 445 149 399T138 314Q142 229 197 201Q223 187 226 190L233 218Q240 246 253 300T280 407Q333 619 333 625Q333 637 244 637H220Q214 642 214 645T216 664Q220 677 226 683H241Q321 681 405 681Q543 681 549 683H560Q566 677 566 674T564 656Q559 641 555 637H517Q448 636 436 628Q429 623 423 600T373 404L320 192Q370 201 419 248Q451 281 469 317T500 400T518 457Q529 486 542 505T569 532T594 543T621 546H644H669Q692 546 692 536Q691 509 676 509Q623 509 593 399Q587 377 579 355T552 301T509 244T446 195T359 159Q324 151 314 151Q311 151 310 150T298 106T287 60Q287 46 376 46H401Q407 40 407 39T405 19Q401 6 395 0H378Q337 2 224 2Q184 2 150 2T96 2T72 1Q64 1 61 1T56 4T54 10Q54 11 56 23Q57 25 58 30T59 36T61 40T63 43T65 44T70 46T76 46T85 46H92Q147 46 166 49T193 62L204 106Q216 149 216 151'], - - // GREEK CAPITAL LETTER OMEGA - 0x3A9: [704,0,772,80,786,'125 84Q127 78 194 76H243V78Q243 122 208 215T165 350Q164 359 162 389Q162 522 272 610Q328 656 396 680T525 704Q628 704 698 661Q734 637 755 601T781 544T786 504Q786 439 747 374T635 226T537 109Q518 81 518 77Q537 76 557 76Q608 76 620 78T640 92Q646 100 656 119T673 155T683 172Q690 173 698 173Q718 173 718 162Q718 161 681 82T642 2Q639 0 550 0H461Q455 5 455 9T458 28Q472 78 510 149T584 276T648 402T677 525Q677 594 636 631T530 668Q476 668 423 641T335 568Q284 499 271 400Q270 388 270 348Q270 298 277 228T285 115Q285 82 280 49T271 6Q269 1 258 1T175 0H87Q83 3 80 7V18Q80 22 82 98Q84 156 85 163T91 172Q94 173 104 173T119 172Q124 169 124 126Q125 104 125 84'], - - // GREEK SMALL LETTER ALPHA - 0x3B1: [442,11,640,34,603,'34 156Q34 270 120 356T309 442Q379 442 421 402T478 304Q484 275 485 237V208Q534 282 560 374Q564 388 566 390T582 393Q603 393 603 385Q603 376 594 346T558 261T497 161L486 147L487 123Q489 67 495 47T514 26Q528 28 540 37T557 60Q559 67 562 68T577 70Q597 70 597 62Q597 56 591 43Q579 19 556 5T512 -10H505Q438 -10 414 62L411 69L400 61Q390 53 370 41T325 18T267 -2T203 -11Q124 -11 79 39T34 156ZM208 26Q257 26 306 47T379 90L403 112Q401 255 396 290Q382 405 304 405Q235 405 183 332Q156 292 139 224T121 120Q121 71 146 49T208 26'], - - // GREEK SMALL LETTER BETA - 0x3B2: [705,194,566,23,573,'29 -194Q23 -188 23 -186Q23 -183 102 134T186 465Q208 533 243 584T309 658Q365 705 429 705H431Q493 705 533 667T573 570Q573 465 469 396L482 383Q533 332 533 252Q533 139 448 65T257 -10Q227 -10 203 -2T165 17T143 40T131 59T126 65L62 -188Q60 -194 42 -194H29ZM353 431Q392 431 427 419L432 422Q436 426 439 429T449 439T461 453T472 471T484 495T493 524T501 560Q503 569 503 593Q503 611 502 616Q487 667 426 667Q384 667 347 643T286 582T247 514T224 455Q219 439 186 308T152 168Q151 163 151 147Q151 99 173 68Q204 26 260 26Q302 26 349 51T425 137Q441 171 449 214T457 279Q457 337 422 372Q380 358 347 358H337Q258 358 258 389Q258 396 261 403Q275 431 353 431'], - - // GREEK SMALL LETTER GAMMA - 0x3B3: [441,216,518,11,543,'31 249Q11 249 11 258Q11 275 26 304T66 365T129 418T206 441Q233 441 239 440Q287 429 318 386T371 255Q385 195 385 170Q385 166 386 166L398 193Q418 244 443 300T486 391T508 430Q510 431 524 431H537Q543 425 543 422Q543 418 522 378T463 251T391 71Q385 55 378 6T357 -100Q341 -165 330 -190T303 -216Q286 -216 286 -188Q286 -138 340 32L346 51L347 69Q348 79 348 100Q348 257 291 317Q251 355 196 355Q148 355 108 329T51 260Q49 251 47 251Q45 249 31 249'], - - // GREEK SMALL LETTER DELTA - 0x3B4: [717,10,444,36,451,'195 609Q195 656 227 686T302 717Q319 716 351 709T407 697T433 690Q451 682 451 662Q451 644 438 628T403 612Q382 612 348 641T288 671T249 657T235 628Q235 584 334 463Q401 379 401 292Q401 169 340 80T205 -10H198Q127 -10 83 36T36 153Q36 286 151 382Q191 413 252 434Q252 435 245 449T230 481T214 521T201 566T195 609ZM112 130Q112 83 136 55T204 27Q233 27 256 51T291 111T309 178T316 232Q316 267 309 298T295 344T269 400L259 396Q215 381 183 342T137 256T118 179T112 130'], - - // GREEK SMALL LETTER EPSILON - 0x3B5: [452,23,466,27,428,'190 -22Q124 -22 76 11T27 107Q27 174 97 232L107 239L99 248Q76 273 76 304Q76 364 144 408T290 452H302Q360 452 405 421Q428 405 428 392Q428 381 417 369T391 356Q382 356 371 365T338 383T283 392Q217 392 167 368T116 308Q116 289 133 272Q142 263 145 262T157 264Q188 278 238 278H243Q308 278 308 247Q308 206 223 206Q177 206 142 219L132 212Q68 169 68 112Q68 39 201 39Q253 39 286 49T328 72T345 94T362 105Q376 103 376 88Q376 79 365 62T334 26T275 -8T190 -22'], - - // GREEK SMALL LETTER ZETA - 0x3B6: [704,204,438,44,471,'296 643Q298 704 324 704Q342 704 342 687Q342 682 339 664T336 633Q336 623 337 618T338 611Q339 612 341 612Q343 614 354 616T374 618L384 619H394Q471 619 471 586Q467 548 386 546H372Q338 546 320 564L311 558Q235 506 175 398T114 190Q114 171 116 155T125 127T137 104T153 86T171 72T192 61T213 53T235 46T256 39L322 16Q389 -10 389 -80Q389 -119 364 -154T300 -202Q292 -204 274 -204Q247 -204 225 -196Q210 -192 193 -182T172 -167Q167 -159 173 -148Q180 -139 191 -139Q195 -139 221 -153T283 -168Q298 -166 310 -152T322 -117Q322 -91 302 -75T250 -51T183 -29T116 4T65 62T44 160Q44 287 121 410T293 590L302 595Q296 613 296 643'], - - // GREEK SMALL LETTER ETA - 0x3B7: [443,216,497,21,503,'21 287Q22 290 23 295T28 317T38 348T53 381T73 411T99 433T132 442Q156 442 175 435T205 417T221 395T229 376L231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336V326Q503 302 439 53Q381 -182 377 -189Q364 -216 332 -216Q319 -216 310 -208T299 -186Q299 -177 358 57L420 307Q423 322 423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 114 189T154 366Q154 405 128 405Q107 405 92 377T68 316T57 280Q55 278 41 278H27Q21 284 21 287'], - - // GREEK SMALL LETTER THETA - 0x3B8: [705,10,469,35,462,'35 200Q35 302 74 415T180 610T319 704Q320 704 327 704T339 705Q393 701 423 656Q462 596 462 495Q462 380 417 261T302 66T168 -10H161Q125 -10 99 10T60 63T41 130T35 200ZM383 566Q383 668 330 668Q294 668 260 623T204 521T170 421T157 371Q206 370 254 370L351 371Q352 372 359 404T375 484T383 566ZM113 132Q113 26 166 26Q181 26 198 36T239 74T287 161T335 307L340 324H145Q145 321 136 286T120 208T113 132'], - - // GREEK SMALL LETTER IOTA - 0x3B9: [442,10,354,48,333,'139 -10Q111 -10 92 0T64 25T52 52T48 74Q48 89 55 109T85 199T135 375L137 384Q139 394 140 397T145 409T151 422T160 431T173 439T190 442Q202 442 213 435T225 410Q225 404 214 358T181 238T137 107Q126 74 126 54Q126 43 126 39T130 31T142 27H147Q206 27 255 78Q272 98 281 114T290 138T295 149T313 153Q321 153 324 153T329 152T332 149T332 143Q332 106 276 48T145 -10H139'], - - // GREEK SMALL LETTER KAPPA - 0x3BA: [442,11,576,48,554,'83 -11Q70 -11 62 -4T51 8T49 17Q49 30 96 217T147 414Q160 442 193 442Q205 441 213 435T223 422T225 412Q225 401 208 337L192 270Q193 269 208 277T235 292Q252 304 306 349T396 412T467 431Q489 431 500 420T512 391Q512 366 494 347T449 327Q430 327 418 338T405 368Q405 370 407 380L397 375Q368 360 315 315L253 266L240 257H245Q262 257 300 251T366 230Q422 203 422 150Q422 140 417 114T411 67Q411 26 437 26Q484 26 513 137Q516 149 519 151T535 153Q554 153 554 144Q554 121 527 64T457 -7Q447 -10 431 -10Q386 -10 360 17T333 90Q333 108 336 122T339 146Q339 170 320 186T271 209T222 218T185 221H180L155 122Q129 22 126 16Q113 -11 83 -11'], - - // GREEK SMALL LETTER LAMDA - 0x3BB: [694,12,583,47,557,'166 673Q166 685 183 694H202Q292 691 316 644Q322 629 373 486T474 207T524 67Q531 47 537 34T546 15T551 6T555 2T556 -2T550 -11H482Q457 3 450 18T399 152L354 277L340 262Q327 246 293 207T236 141Q211 112 174 69Q123 9 111 -1T83 -12Q47 -12 47 20Q47 37 61 52T199 187Q229 216 266 252T321 306L338 322Q338 323 288 462T234 612Q214 657 183 657Q166 657 166 673'], - - // GREEK SMALL LETTER MU - 0x3BC: [442,216,603,23,580,'58 -216Q44 -216 34 -208T23 -186Q23 -176 96 116T173 414Q186 442 219 442Q231 441 239 435T249 423T251 413Q251 401 220 279T187 142Q185 131 185 107V99Q185 26 252 26Q261 26 270 27T287 31T302 38T315 45T327 55T338 65T348 77T356 88T365 100L372 110L408 253Q444 395 448 404Q461 431 491 431Q504 431 512 424T523 412T525 402L449 84Q448 79 448 68Q448 43 455 35T476 26Q485 27 496 35Q517 55 537 131Q543 151 547 152Q549 153 557 153H561Q580 153 580 144Q580 138 575 117T555 63T523 13Q510 0 491 -8Q483 -10 467 -10Q446 -10 429 -4T402 11T385 29T376 44T374 51L368 45Q362 39 350 30T324 12T288 -4T246 -11Q199 -11 153 12L129 -85Q108 -167 104 -180T92 -202Q76 -216 58 -216'], - - // GREEK SMALL LETTER NU - 0x3BD: [442,2,494,45,530,'74 431Q75 431 146 436T219 442Q231 442 231 434Q231 428 185 241L137 51H140L150 55Q161 59 177 67T214 86T261 119T312 165Q410 264 445 394Q458 442 496 442Q509 442 519 434T530 411Q530 390 516 352T469 262T388 162T267 70T106 5Q81 -2 71 -2Q66 -2 59 -1T51 1Q45 5 45 11Q45 13 88 188L132 364Q133 377 125 380T86 385H65Q59 391 59 393T61 412Q65 431 74 431'], - - // GREEK SMALL LETTER XI - 0x3BE: [704,205,438,21,443,'268 632Q268 704 296 704Q314 704 314 687Q314 682 311 664T308 635T309 620V616H315Q342 619 360 619Q443 619 443 586Q439 548 358 546H344Q326 546 317 549T290 566Q257 550 226 505T195 405Q195 381 201 364T211 342T218 337Q266 347 298 347Q375 347 375 314Q374 297 359 288T327 277T280 275Q234 275 208 283L195 286Q149 260 119 214T88 130Q88 116 90 108Q101 79 129 63T229 20Q238 17 243 15Q337 -21 354 -33Q383 -53 383 -94Q383 -137 351 -171T273 -205Q240 -205 202 -190T158 -167Q156 -163 156 -159Q156 -151 161 -146T176 -140Q182 -140 189 -143Q232 -168 274 -168Q286 -168 292 -165Q313 -151 313 -129Q313 -112 301 -104T232 -75Q214 -68 204 -64Q198 -62 171 -52T136 -38T107 -24T78 -8T56 12T36 37T26 66T21 103Q21 149 55 206T145 301L154 307L148 313Q141 319 136 323T124 338T111 358T103 382T99 413Q99 471 143 524T259 602L271 607Q268 618 268 632'], - - // GREEK SMALL LETTER OMICRON - 0x3BF: [441,11,485,34,476,'201 -11Q126 -11 80 38T34 156Q34 221 64 279T146 380Q222 441 301 441Q333 441 341 440Q354 437 367 433T402 417T438 387T464 338T476 268Q476 161 390 75T201 -11ZM121 120Q121 70 147 48T206 26Q250 26 289 58T351 142Q360 163 374 216T388 308Q388 352 370 375Q346 405 306 405Q243 405 195 347Q158 303 140 230T121 120'], - - // GREEK SMALL LETTER PI - 0x3C0: [431,11,570,19,573,'132 -11Q98 -11 98 22V33L111 61Q186 219 220 334L228 358H196Q158 358 142 355T103 336Q92 329 81 318T62 297T53 285Q51 284 38 284Q19 284 19 294Q19 300 38 329T93 391T164 429Q171 431 389 431Q549 431 553 430Q573 423 573 402Q573 371 541 360Q535 358 472 358H408L405 341Q393 269 393 222Q393 170 402 129T421 65T431 37Q431 20 417 5T381 -10Q370 -10 363 -7T347 17T331 77Q330 86 330 121Q330 170 339 226T357 318T367 358H269L268 354Q268 351 249 275T206 114T175 17Q164 -11 132 -11'], - - // GREEK SMALL LETTER RHO - 0x3C1: [442,216,517,23,510,'58 -216Q25 -216 23 -186Q23 -176 73 26T127 234Q143 289 182 341Q252 427 341 441Q343 441 349 441T359 442Q432 442 471 394T510 276Q510 219 486 165T425 74T345 13T266 -10H255H248Q197 -10 165 35L160 41L133 -71Q108 -168 104 -181T92 -202Q76 -216 58 -216ZM424 322Q424 359 407 382T357 405Q322 405 287 376T231 300Q217 269 193 170L176 102Q193 26 260 26Q298 26 334 62Q367 92 389 158T418 266T424 322'], - - // GREEK SMALL LETTER FINAL SIGMA - 0x3C2: [442,107,363,30,405,'31 207Q31 306 115 374T302 442Q341 442 373 430T405 400Q405 392 399 383T379 374Q373 375 348 390T296 405Q222 405 160 357T98 249Q98 232 103 218T112 195T132 175T154 159T186 141T219 122Q234 114 255 102T286 85T299 78L302 74Q306 71 308 69T315 61T322 51T328 40T332 25T334 8Q334 -31 305 -69T224 -107Q194 -107 163 -92Q156 -88 156 -80Q156 -73 162 -67T178 -61Q186 -61 190 -63Q209 -71 224 -71Q244 -71 253 -59T263 -30Q263 -25 263 -21T260 -12T255 -4T248 3T239 9T227 17T213 25T195 34T174 46Q170 48 150 58T122 74T97 90T70 112T51 137T36 169T31 207'], - - // GREEK SMALL LETTER SIGMA - 0x3C3: [431,11,571,31,572,'184 -11Q116 -11 74 34T31 147Q31 247 104 333T274 430Q275 431 414 431H552Q553 430 555 429T559 427T562 425T565 422T567 420T569 416T570 412T571 407T572 401Q572 357 507 357Q500 357 490 357T476 358H416L421 348Q439 310 439 263Q439 153 359 71T184 -11ZM361 278Q361 358 276 358Q152 358 115 184Q114 180 114 178Q106 141 106 117Q106 67 131 47T188 26Q242 26 287 73Q316 103 334 153T356 233T361 278'], - - // GREEK SMALL LETTER TAU - 0x3C4: [431,13,437,18,517,'39 284Q18 284 18 294Q18 301 45 338T99 398Q134 425 164 429Q170 431 332 431Q492 431 497 429Q517 424 517 402Q517 388 508 376T485 360Q479 358 389 358T299 356Q298 355 283 274T251 109T233 20Q228 5 215 -4T186 -13Q153 -13 153 20V30L203 192Q214 228 227 272T248 336L254 357Q254 358 208 358Q206 358 197 358T183 359Q105 359 61 295Q56 287 53 286T39 284'], - - // GREEK SMALL LETTER UPSILON - 0x3C5: [443,10,540,21,523,'413 384Q413 406 432 424T473 443Q492 443 507 425T523 367Q523 334 508 270T468 153Q424 63 373 27T282 -10H268Q220 -10 186 2T135 36T111 78T104 121Q104 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Q21 299 34 333T82 404T161 441Q200 441 225 419T250 355Q248 336 247 334Q247 331 232 291T201 199T185 118Q185 68 211 47T275 26Q317 26 355 57T416 132T452 216T465 277Q465 301 457 318T439 343T421 361T413 384'], - - // GREEK SMALL LETTER PHI - 0x3C6: [442,218,654,50,618,'92 210Q92 176 106 149T142 108T185 85T220 72L235 70L237 71L250 112Q268 170 283 211T322 299T370 375T429 423T502 442Q547 442 582 410T618 302Q618 224 575 152T457 35T299 -10Q273 -10 273 -12L266 -48Q260 -83 252 -125T241 -179Q236 -203 215 -212Q204 -218 190 -218Q159 -215 159 -185Q159 -175 214 -2L209 0Q204 2 195 5T173 14T147 28T120 46T94 71T71 103T56 142T50 190Q50 238 76 311T149 431H162Q183 431 183 423Q183 417 175 409Q134 361 114 300T92 210ZM574 278Q574 320 550 344T486 369Q437 369 394 329T323 218Q309 184 295 109L286 64Q304 62 306 62Q423 62 498 131T574 278'], - - // GREEK SMALL LETTER CHI - 0x3C7: [443,204,626,24,600,'576 -125Q576 -147 547 -175T487 -204H476Q394 -204 363 -157Q334 -114 293 26L284 59Q283 58 248 19T170 -66T92 -151T53 -191Q49 -194 43 -194Q36 -194 31 -189T25 -177T38 -154T151 -30L272 102L265 131Q189 405 135 405Q104 405 87 358Q86 351 68 351Q48 351 48 361Q48 369 56 386T89 423T148 442Q224 442 258 400Q276 375 297 320T330 222L341 180Q344 180 455 303T573 429Q579 431 582 431Q600 431 600 414Q600 407 587 392T477 270Q356 138 353 134L362 102Q392 -10 428 -89T490 -168Q504 -168 517 -156T536 -126Q539 -116 543 -115T557 -114T571 -115Q576 -118 576 -125'], - - // GREEK SMALL LETTER PSI - 0x3C8: [694,205,651,21,634,'161 441Q202 441 226 417T250 358Q250 338 218 252T187 127Q190 85 214 61Q235 43 257 37Q275 29 288 29H289L371 360Q455 691 456 692Q459 694 472 694Q492 694 492 687Q492 678 411 356Q329 28 329 27T335 26Q421 26 498 114T576 278Q576 302 568 319T550 343T532 361T524 384Q524 405 541 424T583 443Q602 443 618 425T634 366Q634 337 623 288T605 220Q573 125 492 57T329 -11H319L296 -104Q272 -198 272 -199Q270 -205 252 -205H239Q233 -199 233 -197Q233 -192 256 -102T279 -9Q272 -8 265 -8Q106 14 106 139Q106 174 139 264T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Q21 299 34 333T82 404T161 441'], - - // GREEK SMALL LETTER OMEGA - 0x3C9: [443,12,622,15,604,'495 384Q495 406 514 424T555 443Q574 443 589 425T604 364Q604 334 592 278T555 155T483 38T377 -11Q297 -11 267 66Q266 68 260 61Q201 -11 125 -11Q15 -11 15 139Q15 230 56 325T123 434Q135 441 147 436Q160 429 160 418Q160 406 140 379T94 306T62 208Q61 202 61 187Q61 124 85 100T143 76Q201 76 245 129L253 137V156Q258 297 317 297Q348 297 348 261Q348 243 338 213T318 158L308 135Q309 133 310 129T318 115T334 97T358 83T393 76Q456 76 501 148T546 274Q546 305 533 325T508 357T495 384'], - - // GREEK THETA SYMBOL - 0x3D1: [705,11,591,21,563,'537 500Q537 474 533 439T524 383L521 362Q558 355 561 351Q563 349 563 345Q563 321 552 318Q542 318 521 323L510 326Q496 261 459 187T362 51T241 -11Q100 -11 100 105Q100 139 127 242T154 366Q154 405 128 405Q107 405 92 377T68 316T57 280Q55 278 41 278H27Q21 284 21 287Q21 291 27 313T47 368T79 418Q103 442 134 442Q169 442 201 419T233 344Q232 330 206 228T180 98Q180 26 247 26Q292 26 332 90T404 260L427 349Q422 349 398 359T339 392T289 440Q265 476 265 520Q265 590 312 647T417 705Q463 705 491 670T528 592T537 500ZM464 564Q464 668 413 668Q373 668 339 622T304 522Q304 494 317 470T349 431T388 406T421 391T435 387H436L443 415Q450 443 457 485T464 564'], - - // GREEK PHI SYMBOL - 0x3D5: [694,205,596,42,579,'409 688Q413 694 421 694H429H442Q448 688 448 686Q448 679 418 563Q411 535 404 504T392 458L388 442Q388 441 397 441T429 435T477 418Q521 397 550 357T579 260T548 151T471 65T374 11T279 -10H275L251 -105Q245 -128 238 -160Q230 -192 227 -198T215 -205H209Q189 -205 189 -198Q189 -193 211 -103L234 -11Q234 -10 226 -10Q221 -10 206 -8T161 6T107 36T62 89T43 171Q43 231 76 284T157 370T254 422T342 441Q347 441 348 445L378 567Q409 686 409 688ZM122 150Q122 116 134 91T167 53T203 35T237 27H244L337 404Q333 404 326 403T297 395T255 379T211 350T170 304Q152 276 137 237Q122 191 122 150ZM500 282Q500 320 484 347T444 385T405 400T381 404H378L332 217L284 29Q284 27 285 27Q293 27 317 33T357 47Q400 66 431 100T475 170T494 234T500 282'], - - // GREEK PI SYMBOL - 0x3D6: [431,10,828,19,823,'206 -10Q158 -10 136 24T114 110Q114 233 199 349L205 358H184Q144 358 121 347Q108 340 95 330T75 312T61 295T53 285Q51 284 38 284Q19 284 19 294Q19 300 38 329T93 391T164 429Q171 431 532 431Q799 431 803 430Q823 423 823 402Q823 377 801 364Q790 358 766 358Q748 358 748 357Q748 355 749 348T752 327T754 297Q754 258 738 207T693 107T618 24T520 -10Q488 -10 466 2T432 36T416 77T411 120Q411 128 410 128T404 122Q373 71 323 31T206 -10ZM714 296Q714 316 707 358H251Q250 357 244 348T230 328T212 301T193 267T176 229T164 187T159 144Q159 62 222 62Q290 62 349 127T432 285Q433 286 434 288T435 291T437 293T440 294T444 294T452 294H466Q472 288 472 286Q472 285 464 244T456 170Q456 62 534 62Q604 62 659 139T714 296'], - - // GREEK RHO SYMBOL - 0x3F1: [442,194,517,67,510,'205 -174Q136 -174 102 -153T67 -76Q67 -25 91 85T127 234Q143 289 182 341Q252 427 341 441Q343 441 349 441T359 442Q432 442 471 394T510 276Q510 169 431 80T253 -10Q226 -10 204 -2T169 19T146 44T132 64L128 73Q128 72 124 53T116 5T112 -44Q112 -68 117 -78T150 -95T236 -102Q327 -102 356 -111T386 -154Q386 -166 384 -178Q381 -190 378 -192T361 -194H348Q342 -188 342 -179Q342 -169 315 -169Q294 -169 264 -171T205 -174ZM424 322Q424 359 407 382T357 405Q322 405 287 376T231 300Q221 276 204 217Q188 152 188 116Q188 68 210 47T259 26Q297 26 334 62Q367 92 389 158T418 266T424 322'], - - // GREEK LUNATE EPSILON SYMBOL - 0x3F5: [431,11,406,40,382,'227 -11Q149 -11 95 41T40 174Q40 262 87 322Q121 367 173 396T287 430Q289 431 329 431H367Q382 426 382 411Q382 385 341 385H325H312Q191 385 154 277L150 265H327Q340 256 340 246Q340 228 320 219H138V217Q128 187 128 143Q128 77 160 52T231 26Q258 26 284 36T326 57T343 68Q350 68 354 58T358 39Q358 36 357 35Q354 31 337 21T289 0T227 -11'], - - // INCREMENT - 0x2206: [716,0,833,48,788,''] - }; - - SVG.FONTDATA.FONTS['MathJax_Main'][0x22EE][0] += 400; // adjust height for \vdots - SVG.FONTDATA.FONTS['MathJax_Main'][0x22F1][0] += 700; // adjust height for \ddots - - // - // Add some spacing characters (more will come later) - // - MathJax.Hub.Insert(SVG.FONTDATA.FONTS['MathJax_Main'],{ - 0x2000: [0,0,500,0,0,{space:1}], // en quad - 0x2001: [0,0,1000,0,0,{space:1}], // em quad - 0x2002: [0,0,500,0,0,{space:1}], // en space - 0x2003: [0,0,1000,0,0,{space:1}], // em space - 0x2004: [0,0,333,0,0,{space:1}], // 3-per-em space - 0x2005: [0,0,250,0,0,{space:1}], // 4-per-em space - 0x2006: [0,0,167,0,0,{space:1}], // 6-per-em space - 0x2009: [0,0,167,0,0,{space:1}], // thin space - 0x200A: [0,0,83,0,0,{space:1}], // hair space - 0x200B: [0,0,0,0,0,{space:1}], // zero-width space - 0xEEE0: [0,0,-575,0,0,{space:1}], - 0xEEE1: [0,0,-300,0,0,{space:1}], - 0xEEE8: [0,0,25,0,0,{space:1}] - }); - - HUB.Register.StartupHook("SVG Jax Require",function () { - HUB.Register.LoadHook(SVG.fontDir+"/Size4/Regular/Main.js",function () { - SVG.FONTDATA.FONTS['MathJax_Size4'][0xE154][0] += 200; // adjust height for brace extender - SVG.FONTDATA.FONTS['MathJax_Size4'][0xE154][1] += 200; // adjust depth for brace extender - }); - - SVG.FONTDATA.FONTS['MathJax_Main'][0x2245][2] -= 222; // fix incorrect right bearing in font - HUB.Register.LoadHook(SVG.fontDir+"/Main/Bold/MathOperators.js",function () { - SVG.FONTDATA.FONTS['MathJax_Main-bold'][0x2245][2] -= 106; // fix incorrect right bearing in font - }); - - HUB.Register.LoadHook(SVG.fontDir+"/Typewriter/Regular/BasicLatin.js",function () { - SVG.FONTDATA.FONTS['MathJax_Typewriter'][0x20][2] += 275; // fix incorrect width - }); - - AJAX.loadComplete(SVG.fontDir + "/fontdata.js"); - }); - -})(MathJax.OutputJax.SVG,MathJax.ElementJax.mml,MathJax.Ajax,MathJax.Hub); - diff --git a/resources/viewer/mathjax/jax/output/SVG/jax.js b/resources/viewer/mathjax/jax/output/SVG/jax.js deleted file mode 100644 index 3970d70488..0000000000 --- a/resources/viewer/mathjax/jax/output/SVG/jax.js +++ /dev/null @@ -1,2206 +0,0 @@ -/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ - -/************************************************************* - * - * MathJax/jax/output/SVG/jax.js - * - * Implements the SVG OutputJax that displays mathematics using - * SVG (or VML in IE) to position the characters from math fonts - * in their proper locations. - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2011-2015 The MathJax Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -(function (AJAX,HUB,HTML,SVG) { - var MML; - - var SVGNS = "http://www.w3.org/2000/svg"; - var XLINKNS = "http://www.w3.org/1999/xlink"; - - SVG.Augment({ - HFUZZ: 2, // adjustments for height and depth of final svg element - DFUZZ: 2, // to get baselines right (fragile). - - config: { - styles: { - ".MathJax_SVG": { - "display": "inline", - "font-style": "normal", - "font-weight": "normal", - "line-height": "normal", - "font-size": "100%", - "font-size-adjust":"none", - "text-indent": 0, - "text-align": "left", - "text-transform": "none", - "letter-spacing": "normal", - "word-spacing": "normal", - "word-wrap": "normal", - "white-space": "nowrap", - "float": "none", - "direction": "ltr", - "max-width": "none", "max-height": "none", - "min-width": 0, "min-height": 0, - border: 0, padding: 0, margin: 0 - }, - - ".MathJax_SVG_Display": { - position: "relative", - display: "block!important", - "text-indent": 0, - "max-width": "none", "max-height": "none", - "min-width": 0, "min-height": 0, - width: "100%" - }, - - ".MathJax_SVG *": { - transition: "none", - "-webkit-transition": "none", - "-moz-transition": "none", - "-ms-transition": "none", - "-o-transition": "none" - }, - - ".mjx-svg-href": { - fill: "blue", stroke: "blue" - }, - - ".MathJax_SVG_Processing": { - visibility: "hidden", position:"absolute", top:0, left:0, - width:0, height: 0, overflow:"hidden", display:"block!important" - }, - ".MathJax_SVG_Processed": {display:"none!important"}, - - ".MathJax_SVG_ExBox": { - display:"block!important", overflow:"hidden", - width:"1px", height:"60ex", - "min-height": 0, "max-height":"none", - padding:0, border: 0, margin: 0 - }, - - "#MathJax_SVG_Tooltip": { - position: "absolute", left: 0, top: 0, - width: "auto", height: "auto", - display: "none" - } - } - }, - - hideProcessedMath: true, // use display:none until all math is processed - - fontNames: ["TeX","STIX","STIX-Web","Asana-Math", - "Gyre-Termes","Gyre-Pagella","Latin-Modern","Neo-Euler"], - - - Config: function () { - this.SUPER(arguments).Config.apply(this,arguments); - var settings = HUB.config.menuSettings, config = this.config, font = settings.font; - if (settings.scale) {config.scale = settings.scale} - if (font && font !== "Auto") { - font = font.replace(/(Local|Web|Image)$/i,""); - font = font.replace(/([a-z])([A-Z])/,"$1-$2"); - this.fontInUse = font; - } else { - this.fontInUse = config.font || "TeX"; - } - if (this.fontNames.indexOf(this.fontInUse) < 0) {this.fontInUse = "TeX"} - this.fontDir += "/" + this.fontInUse; - if (!this.require) {this.require = []} - this.require.push(this.fontDir+"/fontdata.js"); - this.require.push(MathJax.OutputJax.extensionDir+"/MathEvents.js"); - }, - - Startup: function () { - // Set up event handling - EVENT = MathJax.Extension.MathEvents.Event; - TOUCH = MathJax.Extension.MathEvents.Touch; - HOVER = MathJax.Extension.MathEvents.Hover; - this.ContextMenu = EVENT.ContextMenu; - this.Mousedown = EVENT.AltContextMenu; - this.Mouseover = HOVER.Mouseover; - this.Mouseout = HOVER.Mouseout; - this.Mousemove = HOVER.Mousemove; - - // Make hidden div for doing tests and storing global SVG - this.hiddenDiv = HTML.Element("div",{ - style:{visibility:"hidden", overflow:"hidden", position:"absolute", top:0, - height:"1px", width: "auto", padding:0, border:0, margin:0, - textAlign:"left", textIndent:0, textTransform:"none", - lineHeight:"normal", letterSpacing:"normal", wordSpacing:"normal"} - }); - if (!document.body.firstChild) {document.body.appendChild(this.hiddenDiv)} - else {document.body.insertBefore(this.hiddenDiv,document.body.firstChild)} - this.hiddenDiv = HTML.addElement(this.hiddenDiv,"div",{id:"MathJax_SVG_Hidden"}); - - // Determine pixels-per-inch and em-size - var div = HTML.addElement(this.hiddenDiv,"div",{style:{width:"5in"}}); - this.pxPerInch = div.offsetWidth/5; this.hiddenDiv.removeChild(div); - - // Used for measuring text sizes - this.textSVG = this.Element("svg"); - - // Global defs for font glyphs - BBOX.GLYPH.defs = this.addElement(this.addElement(this.hiddenDiv.parentNode,"svg"), - "defs",{id:"MathJax_SVG_glyphs"}); - - // Used in preTranslate to get scaling factors - this.ExSpan = HTML.Element("span", - {style:{position:"absolute","font-size-adjust":"none"}}, - [["span",{className:"MathJax_SVG_ExBox"}]] - ); - - // Used in preTranslate to get linebreak width - this.linebreakSpan = HTML.Element("span",null, - [["hr",{style: {width:"auto", size:1, padding:0, border:0, margin:0}}]]); - - // Set up styles - return AJAX.Styles(this.config.styles,["InitializeSVG",this]); - }, - - // - // Handle initialization that requires styles to be set up - // - InitializeSVG: function () { - // - // Get the default sizes (need styles in place to do this) - // - document.body.appendChild(this.ExSpan); - document.body.appendChild(this.linebreakSpan); - this.defaultEx = this.ExSpan.firstChild.offsetHeight/60; - this.defaultWidth = this.linebreakSpan.firstChild.offsetWidth; - document.body.removeChild(this.linebreakSpan); - document.body.removeChild(this.ExSpan); - }, - - preTranslate: function (state) { - var scripts = state.jax[this.id], i, m = scripts.length, - script, prev, span, div, test, jax, ex, em, maxwidth, relwidth = false, cwidth, - linebreak = this.config.linebreaks.automatic, width = this.config.linebreaks.width; - if (linebreak) { - relwidth = (width.match(/^\s*(\d+(\.\d*)?%\s*)?container\s*$/) != null); - if (relwidth) {width = width.replace(/\s*container\s*/,"")} - else {maxwidth = this.defaultWidth} - if (width === "") {width = "100%"} - } else {maxwidth = 100000} // a big width, so no implicit line breaks - // - // Loop through the scripts - // - for (i = 0; i < m; i++) { - script = scripts[i]; if (!script.parentNode) continue; - // - // Remove any existing output - // - prev = script.previousSibling; - if (prev && String(prev.className).match(/^MathJax(_SVG)?(_Display)?( MathJax(_SVG)?_Processing)?$/)) - {prev.parentNode.removeChild(prev)} - // - // Add the span, and a div if in display mode, - // then set the role and mark it as being processed - // - jax = script.MathJax.elementJax; if (!jax) continue; - jax.SVG = {display: (jax.root.Get("display") === "block")} - span = div = HTML.Element("span",{ - style: {"font-size": this.config.scale+"%", display:"inline-block"}, - className:"MathJax_SVG", id:jax.inputID+"-Frame", isMathJax:true, jaxID:this.id, - oncontextmenu:EVENT.Menu, onmousedown: EVENT.Mousedown, - onmouseover:EVENT.Mouseover, onmouseout:EVENT.Mouseout, onmousemove:EVENT.Mousemove, - onclick:EVENT.Click, ondblclick:EVENT.DblClick, - // Added for keyboard accessible menu. - onkeydown: EVENT.Keydown, tabIndex: HUB.getTabOrder(jax) - }); - if (HUB.Browser.noContextMenu) { - span.ontouchstart = TOUCH.start; - span.ontouchend = TOUCH.end; - } - if (jax.SVG.display) { - div = HTML.Element("div",{className:"MathJax_SVG_Display"}); - div.appendChild(span); - } - div.className += " MathJax_SVG_Processing"; - script.parentNode.insertBefore(div,script); - // - // Add the test span for determining scales and linebreak widths - // - script.parentNode.insertBefore(this.ExSpan.cloneNode(true),script); - div.parentNode.insertBefore(this.linebreakSpan.cloneNode(true),div); - } - // - // Determine the scaling factors for each script - // (this only requires one reflow rather than a reflow for each equation) - // - for (i = 0; i < m; i++) { - script = scripts[i]; if (!script.parentNode) continue; - test = script.previousSibling; div = test.previousSibling; - jax = script.MathJax.elementJax; if (!jax) continue; - ex = test.firstChild.offsetHeight/60; - cwidth = div.previousSibling.firstChild.offsetWidth / this.config.scale * 100; - if (relwidth) {maxwidth = cwidth} - if (ex === 0 || ex === "NaN") { - // can't read width, so move to hidden div for processing - // (this will cause a reflow for each math element that is hidden) - this.hiddenDiv.appendChild(div); - jax.SVG.isHidden = true; - ex = this.defaultEx; cwidth = this.defaultWidth; - if (relwidth) {maxwidth = cwidth} - } - jax.SVG.ex = ex; - jax.SVG.em = em = ex / SVG.TeX.x_height * 1000; // scale ex to x_height - jax.SVG.cwidth = cwidth/em * 1000; - jax.SVG.lineWidth = (linebreak ? this.length2em(width,1,maxwidth/em*1000) : SVG.BIGDIMEN); - } - // - // Remove the test spans used for determining scales and linebreak widths - // - for (i = 0; i < m; i++) { - script = scripts[i]; if (!script.parentNode) continue; - test = scripts[i].previousSibling; span = test.previousSibling; - jax = scripts[i].MathJax.elementJax; if (!jax) continue; - if (!jax.SVG.isHidden) {span = span.previousSibling} - span.parentNode.removeChild(span); - test.parentNode.removeChild(test); - } - // - // Set state variables used for displaying equations in chunks - // - state.SVGeqn = state.SVGlast = 0; state.SVGi = -1; - state.SVGchunk = this.config.EqnChunk; - state.SVGdelay = false; - }, - - Translate: function (script,state) { - if (!script.parentNode) return; - - // - // If we are supposed to do a chunk delay, do it - // - if (state.SVGdelay) { - state.SVGdelay = false; - HUB.RestartAfter(MathJax.Callback.Delay(this.config.EqnChunkDelay)); - } - - // - // Get the data about the math - // - var jax = script.MathJax.elementJax, math = jax.root, - span = document.getElementById(jax.inputID+"-Frame"), - div = (jax.SVG.display ? (span||{}).parentNode : span), - localCache = (SVG.config.useFontCache && !SVG.config.useGlobalCache); - if (!div) return; - // - // Set the font metrics - // - this.em = MML.mbase.prototype.em = jax.SVG.em; this.ex = jax.SVG.ex; - this.linebreakWidth = jax.SVG.lineWidth; this.cwidth = jax.SVG.cwidth; - // - // Typeset the math - // - this.mathDiv = div; - span.appendChild(this.textSVG); - if (localCache) {SVG.resetGlyphs()} - this.initSVG(math,span); - math.setTeXclass(); - try {math.toSVG(span,div)} catch (err) { - if (err.restart) {while (span.firstChild) {span.removeChild(span.firstChild)}} - if (localCache) {BBOX.GLYPH.n--} - throw err; - } - span.removeChild(this.textSVG); - // - // Put it in place, and remove the processing marker - // - if (jax.SVG.isHidden) {script.parentNode.insertBefore(div,script)} - div.className = div.className.split(/ /)[0]; - // - // Check if we are hiding the math until more is processed - // - if (this.hideProcessedMath) { - // - // Hide the math and don't let its preview be removed - // - div.className += " MathJax_SVG_Processed"; - if (script.MathJax.preview) { - jax.SVG.preview = script.MathJax.preview; - delete script.MathJax.preview; - } - // - // Check if we should show this chunk of equations - // - state.SVGeqn += (state.i - state.SVGi); state.SVGi = state.i; - if (state.SVGeqn >= state.SVGlast + state.SVGchunk) { - this.postTranslate(state,true); - state.SVGchunk = Math.floor(state.SVGchunk*this.config.EqnChunkFactor); - state.SVGdelay = true; // delay if there are more scripts - } - } - }, - - postTranslate: function (state,partial) { - var scripts = state.jax[this.id]; - if (!this.hideProcessedMath) return; - // - // Reveal this chunk of math - // - for (var i = state.SVGlast, m = state.SVGeqn; i < m; i++) { - var script = scripts[i]; - if (script && script.MathJax.elementJax) { - // - // Remove the processed marker - // - script.previousSibling.className = script.previousSibling.className.split(/ /)[0]; - var data = script.MathJax.elementJax.SVG; - // - // Remove the preview, if any - // - if (data.preview) { - data.preview.innerHTML = ""; - script.MathJax.preview = data.preview; - delete data.preview; - } - } - } - // - // Save our place so we know what is revealed - // - state.SVGlast = state.SVGeqn; - }, - - resetGlyphs: function (reset) { - if (this.config.useFontCache) { - var GLYPH = BBOX.GLYPH; - if (this.config.useGlobalCache) { - GLYPH.defs = document.getElementById("MathJax_SVG_glyphs"); - GLYPH.defs.innerHTML = ""; - } else { - GLYPH.defs = this.Element("defs"); - GLYPH.n++; - } - GLYPH.glyphs = {}; - if (reset) {GLYPH.n = 0} - } - }, - - // - // Return the containing HTML element rather than the SVG element, since - // most browsers can't position to an SVG element properly. - // - hashCheck: function (target) { - if (target && target.nodeName.toLowerCase() === "g") - {do {target = target.parentNode} while (target && target.firstChild.nodeName !== "svg")} - return target; - }, - - getJaxFromMath: function (math) { - if (math.parentNode.className === "MathJax_SVG_Display") {math = math.parentNode} - do {math = math.nextSibling} while (math && math.nodeName.toLowerCase() !== "script"); - return HUB.getJaxFor(math); - }, - getHoverSpan: function (jax,math) { - math.style.position = "relative"; // make sure inline containers have position set - return math.firstChild; - }, - getHoverBBox: function (jax,span,math) { - var bbox = EVENT.getBBox(span.parentNode); - bbox.h += 2; bbox.d -= 2; // bbox seems to be a bit off, so compensate (FIXME) - return bbox; - }, - - Zoom: function (jax,span,math,Mw,Mh) { - // - // Re-render at larger size - // - span.className = "MathJax_SVG"; - - // - // get em size (taken from this.preTranslate) - // - var emex = span.appendChild(this.ExSpan.cloneNode(true)); - var ex = emex.firstChild.offsetHeight/60; - this.em = MML.mbase.prototype.em = ex / SVG.TeX.x_height * 1000; this.ex = ex; - this.linebreakWidth = jax.SVG.lineWidth; this.cwidth = jax.SVG.cwidth; - emex.parentNode.removeChild(emex); - - span.appendChild(this.textSVG); - this.mathDIV = span; this.zoomScale = parseInt(HUB.config.menuSettings.zscale) / 100; - var tw = jax.root.data[0].SVGdata.tw; if (tw && tw < this.cwidth) this.cwidth = tw; - this.idPostfix = "-zoom"; jax.root.toSVG(span,span); this.idPostfix = ""; - this.zoomScale = 1; - span.removeChild(this.textSVG); - - // - // Don't allow overlaps on any edge - // - var svg = span.getElementsByTagName("svg")[0].style; - svg.marginTop = svg.marginRight = svg.marginLeft = 0; - if (svg.marginBottom.charAt(0) === "-") - span.style.marginBottom = svg.marginBottom.substr(1); - - if (this.operaZoomRefresh) - {setTimeout(function () {span.firstChild.style.border="1px solid transparent"},1)} - // - // WebKit bug (issue #749) - // - if (span.offsetWidth < span.firstChild.offsetWidth) { - span.style.minWidth = span.firstChild.offsetWidth + "px"; - math.style.minWidth = math.firstChild.offsetWidth + "px"; - } - // - // Get height and width of zoomed math and original math - // - span.style.position = math.style.position = "absolute"; - var zW = span.offsetWidth, zH = span.offsetHeight, - mH = math.offsetHeight, mW = math.offsetWidth; - span.style.position = math.style.position = ""; - // - return {Y:-EVENT.getBBox(span).h, mW:mW, mH:mH, zW:zW, zH:zH}; - }, - - initSVG: function (math,span) {}, - - Remove: function (jax) { - var span = document.getElementById(jax.inputID+"-Frame"); - if (span) { - if (jax.SVG.display) {span = span.parentNode} - span.parentNode.removeChild(span); - } - delete jax.SVG; - }, - - Em: function (m) { - if (Math.abs(m) < .0006) return "0"; - return m.toFixed(3).replace(/\.?0+$/,"") + "em"; - }, - Ex: function (m) { - m = m / this.TeX.x_height; - if (Math.abs(m) < .0006) return "0"; - return m.toFixed(3).replace(/\.?0+$/,"") + "ex"; - }, - Percent: function (m) { - return (100*m).toFixed(1).replace(/\.?0+$/,"") + "%"; - }, - Fixed: function (m,n) { - if (Math.abs(m) < .0006) return "0"; - return m.toFixed(n||3).replace(/\.?0+$/,""); - }, - length2em: function (length,mu,size) { - if (typeof(length) !== "string") {length = length.toString()} - if (length === "") {return ""} - if (length === MML.SIZE.NORMAL) {return 1000} - if (length === MML.SIZE.BIG) {return 2000} - if (length === MML.SIZE.SMALL) {return 710} - if (length === "infinity") {return SVG.BIGDIMEN} - if (length.match(/mathspace$/)) {return 1000*SVG.MATHSPACE[length]} - var emFactor = (this.zoomScale || 1) / SVG.em; - var match = length.match(/^\s*([-+]?(?:\.\d+|\d+(?:\.\d*)?))?(pt|em|ex|mu|px|pc|in|mm|cm|%)?/); - var m = parseFloat(match[1]||"1") * 1000, unit = match[2]; - if (size == null) {size = 1000}; if (mu == null) {mu = 1} - if (unit === "em") {return m} - if (unit === "ex") {return m * SVG.TeX.x_height/1000} - if (unit === "%") {return m / 100 * size / 1000} - if (unit === "px") {return m * emFactor} - if (unit === "pt") {return m / 10} // 10 pt to an em - if (unit === "pc") {return m * 1.2} // 12 pt to a pc - if (unit === "in") {return m * this.pxPerInch * emFactor} - if (unit === "cm") {return m * this.pxPerInch * emFactor / 2.54} // 2.54 cm to an inch - if (unit === "mm") {return m * this.pxPerInch * emFactor / 25.4} // 10 mm to a cm - if (unit === "mu") {return m / 18 * mu} - return m*size / 1000; // relative to given size (or 1em as default) - }, - thickness2em: function (length,mu) { - var thick = SVG.TeX.rule_thickness; - if (length === MML.LINETHICKNESS.MEDIUM) {return thick} - if (length === MML.LINETHICKNESS.THIN) {return .67*thick} - if (length === MML.LINETHICKNESS.THICK) {return 1.67*thick} - return this.length2em(length,mu,thick); - }, - - getPadding: function (styles) { - var padding = {top:0, right:0, bottom:0, left:0}, has = false; - for (var id in padding) {if (padding.hasOwnProperty(id)) { - var pad = styles["padding"+id.charAt(0).toUpperCase()+id.substr(1)]; - if (pad) {padding[id] = this.length2em(pad); has = true;} - }} - return (has ? padding : false); - }, - getBorders: function (styles) { - var border = {top:0, right:0, bottom:0, left:0}, has = false; - for (var id in border) {if (border.hasOwnProperty(id)) { - var ID = "border"+id.charAt(0).toUpperCase()+id.substr(1); - var style = styles[ID+"Style"]; - if (style && style !== "none") { - has = true; - border[id] = this.length2em(styles[ID+"Width"]); - border[id+"Style"] = styles[ID+"Style"]; - border[id+"Color"] = styles[ID+"Color"]; - if (border[id+"Color"] === "initial") {border[id+"Color"] = ""} - } else {delete border[id]} - }} - return (has ? border : false); - }, - - Element: function (type,def) { - var obj = (typeof(type) === "string" ? document.createElementNS(SVGNS,type) : type); - obj.isMathJax = true; - if (def) {for (var id in def) {if (def.hasOwnProperty(id)) {obj.setAttribute(id,def[id].toString())}}} - return obj; - }, - addElement: function (parent,type,def) {return parent.appendChild(this.Element(type,def))}, - TextNode: HTML.TextNode, - addText: HTML.addText, - ucMatch: HTML.ucMatch, - - HandleVariant: function (variant,scale,text) { - var svg = BBOX.G(); - var n, N, c, font, VARIANT, i, m, id, M, RANGES; - if (!variant) {variant = this.FONTDATA.VARIANT[MML.VARIANT.NORMAL]} - if (variant.forceFamily) { - text = BBOX.TEXT(scale,text,variant.font); - if (variant.h != null) {text.h = variant.h}; if (variant.d != null) {text.d = variant.d} - svg.Add(text); text = ""; - } - VARIANT = variant; - for (i = 0, m = text.length; i < m; i++) { - variant = VARIANT; - n = text.charCodeAt(i); c = text.charAt(i); - if (n >= 0xD800 && n < 0xDBFF) { - i++; n = (((n-0xD800)<<10)+(text.charCodeAt(i)-0xDC00))+0x10000; - if (this.FONTDATA.RemapPlane1) { - var nv = this.FONTDATA.RemapPlane1(n,variant); - n = nv.n; variant = nv.variant; - } - } else { - RANGES = this.FONTDATA.RANGES; - for (id = 0, M = RANGES.length; id < M; id++) { - if (RANGES[id].name === "alpha" && variant.noLowerCase) continue; - N = variant["offset"+RANGES[id].offset]; - if (N && n >= RANGES[id].low && n <= RANGES[id].high) { - if (RANGES[id].remap && RANGES[id].remap[n]) { - n = N + RANGES[id].remap[n]; - } else { - n = n - RANGES[id].low + N; - if (RANGES[id].add) {n += RANGES[id].add} - } - if (variant["variant"+RANGES[id].offset]) - {variant = this.FONTDATA.VARIANT[variant["variant"+RANGES[id].offset]]} - break; - } - } - } - if (variant.remap && variant.remap[n]) { - n = variant.remap[n]; - if (variant.remap.variant) {variant = this.FONTDATA.VARIANT[variant.remap.variant]} - } else if (this.FONTDATA.REMAP[n] && !variant.noRemap) { - n = this.FONTDATA.REMAP[n]; - } - if (n instanceof Array) {variant = this.FONTDATA.VARIANT[n[1]]; n = n[0]} - if (typeof(n) === "string") { - text = n+text.substr(i+1); - m = text.length; i = -1; - continue; - } - font = this.lookupChar(variant,n); c = font[n]; - if (c) { - if ((c[5] && c[5].space) || (c[5] === "" && c[0]+c[1] === 0)) {svg.w += c[2]} else { - c = [scale,font.id+"-"+n.toString(16).toUpperCase()].concat(c); - svg.Add(BBOX.GLYPH.apply(BBOX,c),svg.w,0); - } - } else if (this.FONTDATA.DELIMITERS[n]) { - c = this.createDelimiter(n,0,1,font); - svg.Add(c,svg.w,(this.FONTDATA.DELIMITERS[n].dir === "V" ? c.d: 0)); - } else { - if (n <= 0xFFFF) {c = String.fromCharCode(n)} else { - N = n - 0x10000; - c = String.fromCharCode((N>>10)+0xD800) - + String.fromCharCode((N&0x3FF)+0xDC00); - } - var box = BBOX.TEXT(scale*100/SVG.config.scale,c,{ - "font-family":variant.defaultFamily||SVG.config.undefinedFamily, - "font-style":(variant.italic?"italic":""), - "font-weight":(variant.bold?"bold":"") - }) - if (variant.h != null) {box.h = variant.h}; if (variant.d != null) {box.d = variant.d} - c = BBOX.G(); c.Add(box); svg.Add(c,svg.w,0); - HUB.signal.Post(["SVG Jax - unknown char",n,variant]); - } - } - if (text.length == 1 && font.skew && font.skew[n]) {svg.skew = font.skew[n]*1000} - if (svg.element.childNodes.length === 1 && !svg.element.firstChild.getAttribute("x")) { - svg.element = svg.element.firstChild; - svg.removeable = false; svg.scale = scale; - } - return svg; - }, - - lookupChar: function (variant,n) { - var i, m; - if (!variant.FONTS) { - var FONTS = this.FONTDATA.FONTS; - var fonts = (variant.fonts || this.FONTDATA.VARIANT.normal.fonts); - if (!(fonts instanceof Array)) {fonts = [fonts]} - if (variant.fonts != fonts) {variant.fonts = fonts} - variant.FONTS = []; - for (i = 0, m = fonts.length; i < m; i++) { - if (FONTS[fonts[i]]) {variant.FONTS.push(FONTS[fonts[i]])} - } - } - for (i = 0, m = variant.FONTS.length; i < m; i++) { - var font = variant.FONTS[i]; - if (typeof(font) === "string") {delete variant.FONTS; this.loadFont(font)} - if (font[n]) {return font} else {this.findBlock(font,n)} - } - return {id:"unknown"}; - }, - - findBlock: function (font,c) { - if (font.Ranges) { - // FIXME: do binary search? - for (var i = 0, m = font.Ranges.length; i < m; i++) { - if (c < font.Ranges[i][0]) return; - if (c <= font.Ranges[i][1]) { - var file = font.Ranges[i][2]; - for (var j = font.Ranges.length-1; j >= 0; j--) - {if (font.Ranges[j][2] == file) {font.Ranges.splice(j,1)}} - this.loadFont(font.directory+"/"+file+".js"); - } - } - } - }, - - loadFont: function (file) { - HUB.RestartAfter(AJAX.Require(this.fontDir+"/"+file)); - }, - - createDelimiter: function (code,HW,scale,font) { - if (!scale) {scale = 1}; - var svg = BBOX.G(); - if (!code) { - svg.Clean(); delete svg.element; - svg.w = svg.r = this.TeX.nulldelimiterspace * scale; - return svg; - } - if (!(HW instanceof Array)) {HW = [HW,HW]} - var hw = HW[1]; HW = HW[0]; - var delim = {alias: code}; - while (delim.alias) { - code = delim.alias; delim = this.FONTDATA.DELIMITERS[code]; - if (!delim) {delim = {HW: [0,this.FONTDATA.VARIANT[MML.VARIANT.NORMAL]]}} - } - if (delim.load) {HUB.RestartAfter(AJAX.Require(this.fontDir+"/fontdata-"+delim.load+".js"))} - for (var i = 0, m = delim.HW.length; i < m; i++) { - if (delim.HW[i][0]*scale >= HW-10-SVG.config.blacker || (i == m-1 && !delim.stretch)) { - if (delim.HW[i][2]) {scale *= delim.HW[i][2]} - if (delim.HW[i][3]) {code = delim.HW[i][3]} - return this.createChar(scale,[code,delim.HW[i][1]],font).With({stretched: true}); - } - } - if (delim.stretch) {this["extendDelimiter"+delim.dir](svg,hw,delim.stretch,scale,font)} - return svg; - }, - createChar: function (scale,data,font) { - var text = "", variant = {fonts: [data[1]], noRemap:true}; - if (font && font === MML.VARIANT.BOLD) {variant.fonts = [data[1]+"-bold",data[1]]} - if (typeof(data[1]) !== "string") {variant = data[1]} - if (data[0] instanceof Array) { - for (var i = 0, m = data[0].length; i < m; i++) {text += String.fromCharCode(data[0][i])} - } else {text = String.fromCharCode(data[0])} - if (data[4]) {scale = scale*data[4]} - var svg = this.HandleVariant(variant,scale,text); - if (data[2]) {svg.x = data[2]*1000} - if (data[3]) {svg.y = data[3]*1000} - if (data[5]) {svg.h += data[5]*1000} - if (data[6]) {svg.d += data[6]*1000} - return svg; - }, - extendDelimiterV: function (svg,H,delim,scale,font) { - var top = this.createChar(scale,(delim.top||delim.ext),font); - var bot = this.createChar(scale,(delim.bot||delim.ext),font); - var h = top.h + top.d + bot.h + bot.d; - var y = -top.h; svg.Add(top,0,y); y -= top.d; - if (delim.mid) {var mid = this.createChar(scale,delim.mid,font); h += mid.h + mid.d} - if (delim.min && H < h*delim.min) {H = h*delim.min} - if (H > h) { - var ext = this.createChar(scale,delim.ext,font); - var k = (delim.mid ? 2 : 1), eH = (H-h) / k, s = (eH+100) / (ext.h+ext.d); - while (k-- > 0) { - var g = SVG.Element("g",{transform:"translate("+ext.y+","+(y-s*ext.h+50+ext.y)+") scale(1,"+s+")"}); - g.appendChild(ext.element.cloneNode(false)); svg.element.appendChild(g); y -= eH; - if (delim.mid && k) {svg.Add(mid,0,y-mid.h); y -= (mid.h+mid.d)} - } - } else if (delim.mid) { - y += (h - H)/2; svg.Add(mid,0,y-mid.h); y += -(mid.h + mid.d) + (h - H)/2; - } else { - y += (h - H); - } - svg.Add(bot,0,y-bot.h); svg.Clean(); - svg.scale = scale; - svg.isMultiChar = true; - }, - extendDelimiterH: function (svg,W,delim,scale,font) { - var left = this.createChar(scale,(delim.left||delim.rep),font); - var right = this.createChar(scale,(delim.right||delim.rep),font); - svg.Add(left,-left.l,0); - var w = (left.r - left.l) + (right.r - right.l), x = left.r - left.l; - if (delim.mid) {var mid = this.createChar(scale,delim.mid,font); w += mid.w} - if (delim.min && W < w*delim.min) {W = w*delim.min} - if (W > w) { - var rep = this.createChar(scale,delim.rep,font), fuzz = delim.fuzz || 0; - var k = (delim.mid ? 2 : 1), rW = (W-w) / k, s = (rW+fuzz) / (rep.r-rep.l); - while (k-- > 0) { - var g = SVG.Element("g",{transform:"translate("+(x-fuzz/2-s*rep.l+rep.x)+","+rep.y+") scale("+s+",1)"}); - g.appendChild(rep.element.cloneNode(false)); svg.element.appendChild(g); x += rW; - if (delim.mid && k) {svg.Add(mid,x,0); x += mid.w} - } - } else if (delim.mid) { - x -= (w - W)/2; svg.Add(mid,x,0); x += mid.w - (w - W)/2; - } else { - x -= (w - W); - } - svg.Add(right,x-right.l,0); svg.Clean(); - svg.scale = scale; - svg.isMultiChar = true; - }, - - - MATHSPACE: { - veryverythinmathspace: 1/18, - verythinmathspace: 2/18, - thinmathspace: 3/18, - mediummathspace: 4/18, - thickmathspace: 5/18, - verythickmathspace: 6/18, - veryverythickmathspace: 7/18, - negativeveryverythinmathspace: -1/18, - negativeverythinmathspace: -2/18, - negativethinmathspace: -3/18, - negativemediummathspace: -4/18, - negativethickmathspace: -5/18, - negativeverythickmathspace: -6/18, - negativeveryverythickmathspace: -7/18 - }, - - // - // Units are em/1000 so quad is 1em - // - TeX: { - x_height: 430.554, - quad: 1000, - num1: 676.508, - num2: 393.732, - num3: 443.73, - denom1: 685.951, - denom2: 344.841, - sup1: 412.892, - sup2: 362.892, - sup3: 288.888, - sub1: 150, - sub2: 247.217, - sup_drop: 386.108, - sub_drop: 50, - delim1: 2390, - delim2: 1000, - axis_height: 250, - rule_thickness: 60, - big_op_spacing1: 111.111, - big_op_spacing2: 166.666, - big_op_spacing3: 200, - big_op_spacing4: 600, - big_op_spacing5: 100, - - scriptspace: 100, - nulldelimiterspace: 120, - delimiterfactor: 901, - delimitershortfall: 300, - - min_rule_thickness: 1.25, // in pixels - min_root_space: 1.5 // in pixels - }, - - BIGDIMEN: 10000000, - NBSP: "\u00A0" - }); - - var BBOX = SVG.BBOX = MathJax.Object.Subclass({ - type: "g", removeable: true, - Init: function (def) { - this.h = this.d = -SVG.BIGDIMEN; this.H = this.D = 0; - this.w = this.r = 0; this.l = SVG.BIGDIMEN; - this.x = this.y = 0; this.scale = 1; this.n = 0; - if (this.type) {this.element = SVG.Element(this.type,def)} - }, - With: function (def) {return HUB.Insert(this,def)}, - Add: function (svg,dx,dy,forcew,infront) { - if (dx) {svg.x += dx}; if (dy) {svg.y += dy}; - if (svg.element) { - if (svg.removeable && svg.element.childNodes.length === 1 && svg.n === 1) { - var child = svg.element.firstChild, nodeName = child.nodeName.toLowerCase(); - if (nodeName === "use" || nodeName === "rect") { - svg.element = child; svg.scale = svg.childScale; - var x = svg.childX, y = svg.childY; - svg.x += x; svg.y += y; - svg.h -= y; svg.d += y; svg.H -= y; svg.D +=y; - svg.w -= x; svg.r -= x; svg.l += x; - svg.removeable = false; - child.setAttribute("x",Math.floor(svg.x/svg.scale)); - child.setAttribute("y",Math.floor(svg.y/svg.scale)); - } - } - if (Math.abs(svg.x) < 1 && Math.abs(svg.y) < 1) { - svg.remove = svg.removeable; - } else { - nodeName = svg.element.nodeName.toLowerCase(); - if (nodeName === "g") { - if (!svg.element.firstChild) {svg.remove = svg.removeable} - else {svg.element.setAttribute("transform","translate("+Math.floor(svg.x)+","+Math.floor(svg.y)+")")} - } else if (nodeName === "line" || nodeName === "polygon" || - nodeName === "path" || nodeName === "a") { - var transform = svg.element.getAttribute("transform") || ""; - if (transform) transform = " "+transform; - transform = "translate("+Math.floor(svg.x)+","+Math.floor(svg.y)+")"+transform; - svg.element.setAttribute("transform",transform); - } else { - svg.element.setAttribute("x",Math.floor(svg.x/svg.scale)); - svg.element.setAttribute("y",Math.floor(svg.y/svg.scale)); - } - } - if (svg.remove) { - this.n += svg.n; - while (svg.element.firstChild) { - if (infront && this.element.firstChild) { - this.element.insertBefore(svg.element.firstChild,this.element.firstChild); - } else { - this.element.appendChild(svg.element.firstChild); - } - } - } else { - if (infront) {this.element.insertBefore(svg.element,this.element.firstChild)} - else {this.element.appendChild(svg.element)} - } - delete svg.element; - } - if (svg.hasIndent) {this.hasIndent = svg.hasIndent} - if (svg.tw != null) {this.tw = svg.tw} - if (svg.d - svg.y > this.d) {this.d = svg.d - svg.y; if (this.d > this.D) {this.D = this.d}} - if (svg.y + svg.h > this.h) {this.h = svg.y + svg.h; if (this.h > this.H) {this.H = this.h}} - if (svg.D - svg.y > this.D) {this.D = svg.D - svg.y} - if (svg.y + svg.H > this.H) {this.H = svg.y + svg.H} - if (svg.x + svg.l < this.l) {this.l = svg.x + svg.l} - if (svg.x + svg.r > this.r) {this.r = svg.x + svg.r} - if (forcew || svg.x + svg.w + (svg.X||0) > this.w) {this.w = svg.x + svg.w + (svg.X||0)} - this.childScale = svg.scale; this.childX = svg.x; this.childY = svg.y; this.n++; - return svg; - }, - Align: function (svg,align,dx,dy,shift) { - dx = ({left: dx, center: (this.w - svg.w)/2, right: this.w - svg.w - dx})[align] || 0; - var w = this.w; this.Add(svg,dx+(shift||0),dy); this.w = w; - }, - Clean: function () { - if (this.h === -SVG.BIGDIMEN) {this.h = this.d = this.l = 0} - return this; - } - }); - - BBOX.ROW = BBOX.Subclass({ - Init: function () { - this.SUPER(arguments).Init.call(this); - this.svg = []; this.sh = this.sd = 0; - }, - Check: function (data) { - var svg = data.toSVG(); this.svg.push(svg); - if (data.SVGcanStretch("Vertical")) {svg.mml = data} - if (svg.h > this.sh) {this.sh = svg.h} - if (svg.d > this.sd) {this.sd = svg.d} - }, - Stretch: function () { - for (var i = 0, m = this.svg.length; i < m; i++) - { - var svg = this.svg[i], mml = svg.mml; - if (mml) { - if (mml.forceStretch || mml.SVGdata.h !== this.sh || mml.SVGdata.d !== this.sd) { - svg = mml.SVGstretchV(this.sh,this.sd); - } - mml.SVGdata.HW = this.sh; mml.SVGdata.D = this.sd; - } - if (svg.ic) {this.ic = svg.ic} else {delete this.ic} - this.Add(svg,this.w,0,true); - } - delete this.svg; - } - }); - - BBOX.RECT = BBOX.Subclass({ - type: "rect", removeable: false, - Init: function (h,d,w,def) { - if (def == null) {def = {stroke:"none"}} - def.width = Math.floor(w); def.height = Math.floor(h+d); - this.SUPER(arguments).Init.call(this,def); - this.w = this.r = w; this.h = this.H = h+d; this.d = this.D = this.l = 0; this.y = -d; - } - }); - - BBOX.FRAME = BBOX.Subclass({ - type: "rect", removeable: false, - Init: function (h,d,w,t,dash,color,def) { - if (def == null) {def = {}}; def.fill = "none"; - def["stroke-width"] = SVG.Fixed(t,2); - def.width = Math.floor(w-t); def.height = Math.floor(h+d-t); - def.transform = "translate("+Math.floor(t/2)+","+Math.floor(-d+t/2)+")"; - if (dash === "dashed") - {def["stroke-dasharray"] = [Math.floor(6*SVG.em),Math.floor(6*SVG.em)].join(" ")} - this.SUPER(arguments).Init.call(this,def); - this.w = this.r = w; this.h = this.H = h; - this.d = this.D = d; this.l = 0; - } - }); - - BBOX.HLINE = BBOX.Subclass({ - type: "line", removeable: false, - Init: function (w,t,dash,color,def) { - if (def == null) {def = {"stroke-linecap":"square"}} - if (color && color !== "") {def.stroke = color} - def["stroke-width"] = SVG.Fixed(t,2); - def.x1 = def.y1 = def.y2 = Math.floor(t/2); def.x2 = Math.floor(w-t/2); - if (dash === "dashed") { - var n = Math.floor(Math.max(0,w-t)/(6*t)), m = Math.floor(Math.max(0,w-t)/(2*n+1)); - def["stroke-dasharray"] = m+" "+m; - } - if (dash === "dotted") { - def["stroke-dasharray"] = [1,Math.max(150,Math.floor(2*t))].join(" "); - def["stroke-linecap"] = "round"; - } - this.SUPER(arguments).Init.call(this,def); - this.w = this.r = w; this.l = 0; this.h = this.H = t; this.d = this.D = 0; - } - }); - - BBOX.VLINE = BBOX.Subclass({ - type: "line", removeable: false, - Init: function (h,t,dash,color,def) { - if (def == null) {def = {"stroke-linecap":"square"}} - if (color && color !== "") {def.stroke = color} - def["stroke-width"] = SVG.Fixed(t,2); - def.x1 = def.x2 = def.y1 = Math.floor(t/2); def.y2 = Math.floor(h-t/2); - if (dash === "dashed") { - var n = Math.floor(Math.max(0,h-t)/(6*t)), m = Math.floor(Math.max(0,h-t)/(2*n+1)); - def["stroke-dasharray"] = m+" "+m; - } - if (dash === "dotted") { - def["stroke-dasharray"] = [1,Math.max(150,Math.floor(2*t))].join(" "); - def["stroke-linecap"] = "round"; - } - this.SUPER(arguments).Init.call(this,def); - this.w = this.r = t; this.l = 0; this.h = this.H = h; this.d = this.D = 0; - } - }); - - BBOX.TEXT = BBOX.Subclass({ - type: "text", removeable: false, - Init: function (scale,text,def) { - if (!def) {def = {}}; def.stroke = "none"; - if (def["font-style"] === "") delete def["font-style"]; - if (def["font-weight"] === "") delete def["font-weight"]; - this.SUPER(arguments).Init.call(this,def); - SVG.addText(this.element,text); - SVG.textSVG.appendChild(this.element); - var bbox = this.element.getBBox(); - SVG.textSVG.removeChild(this.element); - scale *= 1000/SVG.em; - this.element.setAttribute("transform","scale("+SVG.Fixed(scale)+") matrix(1 0 0 -1 0 0)"); - this.w = this.r = bbox.width*scale; this.l = 0; - this.h = this.H = -bbox.y*scale; - this.d = this.D = (bbox.height + bbox.y)*scale; - } - }); - - BBOX.G = BBOX; - - BBOX.NULL = BBOX.Subclass({ - Init: function () { - this.SUPER(arguments).Init.apply(this,arguments); - this.Clean(); - } - }); - - BBOX.GLYPH = BBOX.Subclass({ - type: "path", removeable: false, - Init: function (scale,id,h,d,w,l,r,p) { - var def, t = SVG.config.blacker, GLYPH = BBOX.GLYPH; - var cache = SVG.config.useFontCache; - var transform = (scale === 1 ? null : "scale("+SVG.Fixed(scale)+")"); - if (cache && !SVG.config.useGlobalCache) {id = "E"+GLYPH.n+"-"+id} - if (!cache || !GLYPH.glyphs[id]) { - def = {"stroke-width":t}; - if (cache) {def.id = id} else if (transform) {def.transform = transform} - def.d = (p ? "M"+p+"Z" : ""); - this.SUPER(arguments).Init.call(this,def); - if (cache) {GLYPH.defs.appendChild(this.element); GLYPH.glyphs[id] = true;} - } - if (cache) { - def = {}; if (transform) {def.transform = transform} - this.element = SVG.Element("use",def); - this.element.setAttributeNS(XLINKNS,"href","#"+id); - } - this.h = (h+t) * scale; this.d = (d+t) * scale; this.w = (w+t/2) *scale; - this.l = (l+t/2) * scale; this.r = (r+t/2) * scale; - this.H = Math.max(0,this.h); this.D = Math.max(0,this.d); - this.x = this.y = 0; this.scale = scale; - } - },{ - glyphs: {}, // which glpyhs have been used - defs: null, // the SVG element where glyphs are stored - n: 0 // the ID for local for self-contained SVG elements - }); - - HUB.Register.StartupHook("mml Jax Ready",function () { - - MML = MathJax.ElementJax.mml; - - MML.mbase.Augment({ - SVG: BBOX, - toSVG: function () { - this.SVGgetStyles(); - var variant = this.SVGgetVariant(); - var svg = this.SVG(); this.SVGgetScale(svg); - this.SVGhandleSpace(svg); - for (var i = 0, m = this.data.length; i < m; i++) { - if (this.data[i]) { - var child = svg.Add(this.data[i].toSVG(variant,svg.scale),svg.w,0,true); - if (child.skew) {svg.skew = child.skew} - } - } - svg.Clean(); var text = this.data.join(""); - if (svg.skew && text.length !== 1) {delete svg.skew} - if (svg.r > svg.w && text.length === 1 && !variant.noIC) - {svg.ic = svg.r - svg.w; svg.w = svg.r} - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - }, - - SVGchildSVG: function (i) { - return (this.data[i] ? this.data[i].toSVG() : BBOX()); - }, - - SVGdataStretched: function (i,HW,D) { - this.SVGdata = {HW:HW, D:D}; - if (!this.data[i]) {return BBOX()} - if (D != null) {return this.data[i].SVGstretchV(HW,D)} - if (HW != null) {return this.data[i].SVGstretchH(HW)} - return this.data[i].toSVG(); - }, - - SVGsaveData: function (svg) { - if (!this.SVGdata) {this.SVGdata = {}} - this.SVGdata.w = svg.w, this.SVGdata.x = svg.x; - this.SVGdata.h = svg.h, this.SVGdata.d = svg.d; - if (svg.y) {this.SVGdata.h += svg.y; this.SVGdata.d -= svg.y} - if (svg.X != null) {this.SVGdata.X = svg.X} - if (svg.tw != null) {this.SVGdata.tw = svg.tw} - if (svg.skew) {this.SVGdata.skew = svg.skew} - if (svg.ic) {this.SVGdata.ic = svg.ic} - if (this["class"]) {svg.removeable = false; SVG.Element(svg.element,{"class":this["class"]})} - // FIXME: if an element is split by linebreaking, the ID will be the same on both parts - // FIXME: if an element has an id, its zoomed copy will have the same ID - if (this.id) {svg.removeable = false; SVG.Element(svg.element,{"id":this.id})} - if (this.href) { - var a = SVG.Element("a",{"class":"mjx-svg-href"}); - a.setAttributeNS(XLINKNS,"href",this.href); - a.onclick = this.SVGlink; - SVG.addElement(a,"rect",{width:svg.w, height:svg.h+svg.d, y:-svg.d, - fill:"none", stroke:"none", "pointer-events":"all"}); - if (svg.type === "svg") { - // for svg element, put inside the main element - var g = svg.element.firstChild; - while (g.firstChild) {a.appendChild(g.firstChild)} - g.appendChild(a); - } else { - a.appendChild(svg.element); svg.element = a; - } - svg.removeable = false; - } - if (SVG.config.addMMLclasses) { - this.SVGaddClass(svg.element,"mjx-svg-"+this.type); - svg.removeable = false; - } - var style = this.style; - if (style && svg.element) { - svg.element.style.cssText = style; - if (svg.element.style.fontSize) {svg.element.style.fontSize = ""} // handled by scale - svg.element.style.border = svg.element.style.padding = ""; - if (svg.removeable) {svg.removeable = (svg.element.style.cssText === "")} - } - this.SVGaddAttributes(svg); - }, - SVGaddClass: function (node,name) { - var classes = node.getAttribute("class"); - node.setAttribute("class",(classes ? classes+" " : "")+name); - }, - SVGaddAttributes: function (svg) { - // - // Copy RDFa, aria, and other tags from the MathML to the HTML-CSS - // output spans Don't copy those in the MML.nocopyAttributes list, - // the ignoreMMLattributes configuration list, or anything tha - // already exists as a property of the span (e.g., no "onlick", etc.) - // If a name in the ignoreMMLattributes object is set to false, then - // the attribute WILL be copied. - // - if (this.attrNames) { - var copy = this.attrNames, skip = MML.nocopyAttributes, ignore = HUB.config.ignoreMMLattributes; - var defaults = (this.type === "mstyle" ? MML.math.prototype.defaults : this.defaults); - for (var i = 0, m = copy.length; i < m; i++) { - var id = copy[i]; - if (ignore[id] == false || (!skip[id] && !ignore[id] && - defaults[id] == null && typeof(svg.element[id]) === "undefined")) { - svg.element.setAttribute(id,this.attr[id]); - svg.removeable = false; - } - } - } - }, - // - // WebKit currently scrolls to the BOTTOM of an svg element if it contains the - // target of the link, so implement link by hand, to the containing span element. - // - SVGlink: function () { - var href = this.href.animVal; - if (href.charAt(0) === "#") { - var target = SVG.hashCheck(document.getElementById(href.substr(1))); - if (target && target.scrollIntoView) - {setTimeout(function () {target.parentNode.scrollIntoView(true)},1)} - } - document.location = href; - }, - - SVGgetStyles: function () { - if (this.style) { - var span = HTML.Element("span"); - span.style.cssText = this.style; - this.styles = this.SVGprocessStyles(span.style); - } - }, - SVGprocessStyles: function (style) { - var styles = {border:SVG.getBorders(style), padding:SVG.getPadding(style)}; - if (!styles.border) {delete styles.border} - if (!styles.padding) {delete styles.padding} - if (style.fontSize) {styles.fontSize = style.fontSize} - if (style.color) {styles.color = style.color} - if (style.backgroundColor) {styles.background = style.backgroundColor} - if (style.fontStyle) {styles.fontStyle = style.fontStyle} - if (style.fontWeight) {styles.fontWeight = style.fontWeight} - if (style.fontFamily) {styles.fontFamily = style.fontFamily} - if (styles.fontWeight && styles.fontWeight.match(/^\d+$/)) - {styles.fontWeight = (parseInt(styles.fontWeight) > 600 ? "bold" : "normal")} - return styles; - }, - - SVGhandleSpace: function (svg) { - if (this.useMMLspacing) { - if (this.type !== "mo") return; - var values = this.getValues("scriptlevel","lspace","rspace"); - if (values.scriptlevel <= 0 || this.hasValue("lspace") || this.hasValue("rspace")) { - var mu = this.SVGgetMu(svg); - values.lspace = Math.max(0,SVG.length2em(values.lspace,mu)); - values.rspace = Math.max(0,SVG.length2em(values.rspace,mu)); - var core = this, parent = this.Parent(); - while (parent && parent.isEmbellished() && parent.Core() === core) - {core = parent; parent = parent.Parent()} - if (values.lspace) {svg.x += values.lspace} - if (values.rspace) {svg.X = values.rspace} - } - } else { - var space = this.texSpacing(); - this.SVGgetScale(); - if (space !== "") {svg.x += SVG.length2em(space,this.scale)*this.mscale} - } - }, - - SVGhandleColor: function (svg) { - var values = this.getValues("mathcolor","color"); - if (this.styles && this.styles.color && !values.color) {values.color = this.styles.color} - if (values.color && !this.mathcolor) {values.mathcolor = values.color} - if (values.mathcolor) { - SVG.Element(svg.element,{fill:values.mathcolor,stroke:values.mathcolor}) - svg.removeable = false; - } - var borders = (this.styles||{}).border, padding = (this.styles||{}).padding, - bleft = ((borders||{}).left||0), pleft = ((padding||{}).left||0), id; - values.background = (this.mathbackground || this.background || - (this.styles||{}).background || MML.COLOR.TRANSPARENT); - if (bleft + pleft) { - // - // Make a box and move the contents of svg to it, - // then add it back into svg, but offset by the left amount - // - var dup = BBOX(); for (id in svg) {if (svg.hasOwnProperty(id)) {dup[id] = svg[id]}} - dup.x = 0; dup.y = 0; - svg.element = SVG.Element("g"); svg.removeable = true; - svg.Add(dup,bleft+pleft,0); - } - // - // Adjust size by padding and dashed borders (left is taken care of above) - // - if (padding) {svg.w += padding.right||0; svg.h += padding.top||0; svg.d += padding.bottom||0} - if (borders) {svg.w += borders.right||0; svg.h += borders.top||0; svg.d += borders.bottom||0} - // - // Add background color - // - if (values.background !== MML.COLOR.TRANSPARENT) { - var nodeName = svg.element.nodeName.toLowerCase(); - if (nodeName !== "g" && nodeName !== "svg") { - var g = SVG.Element("g"); g.appendChild(svg.element); - svg.element = g; svg.removeable = true; - } - svg.Add(BBOX.RECT(svg.h,svg.d,svg.w,{fill:values.background,stroke:"none"}),0,0,false,true) - } - // - // Add borders - // - if (borders) { - var dd = 5; // fuzz factor to avoid anti-alias problems at edges - var sides = { - left: ["V",svg.h+svg.d,-dd,-svg.d], - right: ["V",svg.h+svg.d,svg.w-borders.right+dd,-svg.d], - top: ["H",svg.w,0,svg.h-borders.top+dd], - bottom:["H",svg.w,0,-svg.d-dd] - } - for (id in sides) {if (sides.hasOwnProperty(id)) { - if (borders[id]) { - var side = sides[id], box = BBOX[side[0]+"LINE"]; - svg.Add(box(side[1],borders[id],borders[id+"Style"],borders[id+"Color"]),side[2],side[3]); - } - }} - } - }, - - SVGhandleVariant: function (variant,scale,text) { - return SVG.HandleVariant(variant,scale,text); - }, - - SVGgetVariant: function () { - var values = this.getValues("mathvariant","fontfamily","fontweight","fontstyle"); - var variant = values.mathvariant; - if (this.variantForm) variant = "-"+SVG.fontInUse+"-variant"; - values.hasVariant = this.Get("mathvariant",true); // null if not explicitly specified - if (!values.hasVariant) { - values.family = values.fontfamily; - values.weight = values.fontweight; - values.style = values.fontstyle; - } - if (this.styles) { - if (!values.style && this.styles.fontStyle) {values.style = this.styles.fontStyle} - if (!values.weight && this.styles.fontWeight) {values.weight = this.styles.fontWeight} - if (!values.family && this.styles.fontFamily) {values.family = this.styles.fontFamily} - } - if (values.family && !values.hasVariant) { - if (!values.weight && values.mathvariant.match(/bold/)) {values.weight = "bold"} - if (!values.style && values.mathvariant.match(/italic/)) {values.style = "italic"} - variant = {forceFamily: true, font: {"font-family":values.family}}; - if (values.style) {variant.font["font-style"] = values.style} - if (values.weight) {variant.font["font-weight"] = values.weight} - return variant; - } - if (values.weight === "bold") { - variant = { - normal:MML.VARIANT.BOLD, italic:MML.VARIANT.BOLDITALIC, - fraktur:MML.VARIANT.BOLDFRAKTUR, script:MML.VARIANT.BOLDSCRIPT, - "sans-serif":MML.VARIANT.BOLDSANSSERIF, - "sans-serif-italic":MML.VARIANT.SANSSERIFBOLDITALIC - }[variant]||variant; - } else if (values.weight === "normal") { - variant = { - bold:MML.VARIANT.normal, "bold-italic":MML.VARIANT.ITALIC, - "bold-fraktur":MML.VARIANT.FRAKTUR, "bold-script":MML.VARIANT.SCRIPT, - "bold-sans-serif":MML.VARIANT.SANSSERIF, - "sans-serif-bold-italic":MML.VARIANT.SANSSERIFITALIC - }[variant]||variant; - } - if (values.style === "italic") { - variant = { - normal:MML.VARIANT.ITALIC, bold:MML.VARIANT.BOLDITALIC, - "sans-serif":MML.VARIANT.SANSSERIFITALIC, - "bold-sans-serif":MML.VARIANT.SANSSERIFBOLDITALIC - }[variant]||variant; - } else if (values.style === "normal") { - variant = { - italic:MML.VARIANT.NORMAL, "bold-italic":MML.VARIANT.BOLD, - "sans-serif-italic":MML.VARIANT.SANSSERIF, - "sans-serif-bold-italic":MML.VARIANT.BOLDSANSSERIF - }[variant]||variant; - } - if (!(variant in SVG.FONTDATA.VARIANT)) { - // If the mathvariant value is invalid or not supported by this - // font, fallback to normal. See issue 363. - variant = "normal"; - } - return SVG.FONTDATA.VARIANT[variant]; - }, - - SVGgetScale: function (svg) { - var scale = 1; - if (this.mscale) { - scale = this.scale; - } else { - var values = this.getValues("scriptlevel","fontsize"); - values.mathsize = (this.isToken ? this : this.Parent()).Get("mathsize"); - if ((this.styles||{}).fontSize && !values.fontsize) {values.fontsize = this.styles.fontSize} - if (values.fontsize && !this.mathsize) {values.mathsize = values.fontsize} - if (values.scriptlevel !== 0) { - if (values.scriptlevel > 2) {values.scriptlevel = 2} - scale = Math.pow(this.Get("scriptsizemultiplier"),values.scriptlevel); - values.scriptminsize = SVG.length2em(this.Get("scriptminsize"))/1000; - if (scale < values.scriptminsize) {scale = values.scriptminsize} - } - this.scale = scale; this.mscale = SVG.length2em(values.mathsize)/1000; - } - if (svg) {svg.scale = scale; if (this.isToken) {svg.scale *= this.mscale}} - return scale * this.mscale; - }, - SVGgetMu: function (svg) { - var mu = 1, values = this.getValues("scriptlevel","scriptsizemultiplier"); - if (svg.scale && svg.scale !== 1) {mu = 1/svg.scale} - if (values.scriptlevel !== 0) { - if (values.scriptlevel > 2) {values.scriptlevel = 2} - mu = Math.sqrt(Math.pow(values.scriptsizemultiplier,values.scriptlevel)); - } - return mu; - }, - - SVGnotEmpty: function (data) { - while (data) { - if ((data.type !== "mrow" && data.type !== "texatom") || - data.data.length > 1) {return true} - data = data.data[0]; - } - return false; - }, - - SVGcanStretch: function (direction) { - var can = false; - if (this.isEmbellished()) { - var core = this.Core(); - if (core && core !== this) { - can = core.SVGcanStretch(direction); - if (can && core.forceStretch) {this.forceStretch = true} - } - } - return can; - }, - SVGstretchV: function (h,d) {return this.toSVG(h,d)}, - SVGstretchH: function (w) {return this.toSVG(w)}, - - SVGlineBreaks: function () {return false} - - },{ - SVGemptySVG: function () { - var svg = this.SVG(); - svg.Clean(); - this.SVGsaveData(svg); - return svg; - }, - SVGautoload: function () { - var file = SVG.autoloadDir+"/"+this.type+".js"; - HUB.RestartAfter(AJAX.Require(file)); - }, - SVGautoloadFile: function (name) { - var file = SVG.autoloadDir+"/"+name+".js"; - HUB.RestartAfter(AJAX.Require(file)); - } - }); - - MML.chars.Augment({ - toSVG: function (variant,scale,remap,chars) { - var text = this.data.join("").replace(/[\u2061-\u2064]/g,""); // remove invisibles - if (remap) {text = remap(text,chars)} - return this.SVGhandleVariant(variant,scale,text); - } - }); - MML.entity.Augment({ - toSVG: function (variant,scale,remap,chars) { - var text = this.toString().replace(/[\u2061-\u2064]/g,""); // remove invisibles - if (remap) {text = remap(text,chars)} - return this.SVGhandleVariant(variant,scale,text); - } - }); - - MML.mo.Augment({ - toSVG: function (HW,D) { - this.SVGgetStyles(); - var svg = this.svg = this.SVG(); - var scale = this.SVGgetScale(svg); - this.SVGhandleSpace(svg); - if (this.data.length == 0) {svg.Clean(); this.SVGsaveData(svg); return svg} - // - // Stretch the operator, if that is requested - // - if (D != null) {return this.SVGstretchV(HW,D)} - else if (HW != null) {return this.SVG.strechH(HW)} - // - // Get the variant, and check for operator size - // - var variant = this.SVGgetVariant(); - var values = this.getValues("largeop","displaystyle"); - if (values.largeop) - {variant = SVG.FONTDATA.VARIANT[values.displaystyle ? "-largeOp" : "-smallOp"]} - // - // Get character translation for superscript and accents - // - var parent = this.CoreParent(), - isScript = (parent && parent.isa(MML.msubsup) && this !== parent.data[0]), - mapchars = (isScript?this.remapChars:null); - if (this.data.join("").length === 1 && parent && parent.isa(MML.munderover) && - this.CoreText(parent.data[parent.base]).length === 1) { - var over = parent.data[parent.over], under = parent.data[parent.under]; - if (over && this === over.CoreMO() && parent.Get("accent")) {mapchars = SVG.FONTDATA.REMAPACCENT} - else if (under && this === under.CoreMO() && parent.Get("accentunder")) {mapchars = SVG.FONTDATA.REMAPACCENTUNDER} - } - // - // Primes must come from another font - // - if (isScript && this.data.join("").match(/['`"\u00B4\u2032-\u2037\u2057]/)) - {variant = SVG.FONTDATA.VARIANT["-"+SVG.fontInUse+"-variant"]} - // - // Typeset contents - // - for (var i = 0, m = this.data.length; i < m; i++) { - if (this.data[i]) { - var text = this.data[i].toSVG(variant,scale,this.remap,mapchars), x = svg.w; - if (x === 0 && -text.l > 10*text.w) {x += -text.l} // initial combining character doesn't combine - svg.Add(text,x,0,true); - if (text.skew) {svg.skew = text.skew} - } - } - svg.Clean(); - if (this.data.join("").length !== 1) {delete svg.skew} - // - // Handle large operator centering - // - if (values.largeop) { - svg.y = SVG.TeX.axis_height - (svg.h - svg.d)/2/scale; - if (svg.r > svg.w) {svg.ic = svg.r - svg.w; svg.w = svg.r} - } - // - // Finish up - // - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - }, - SVGcanStretch: function (direction) { - if (!this.Get("stretchy")) {return false} - var c = this.data.join(""); - if (c.length > 1) {return false} - var parent = this.CoreParent(); - if (parent && parent.isa(MML.munderover) && - this.CoreText(parent.data[parent.base]).length === 1) { - var over = parent.data[parent.over], under = parent.data[parent.under]; - if (over && this === over.CoreMO() && parent.Get("accent")) {c = SVG.FONTDATA.REMAPACCENT[c]||c} - else if (under && this === under.CoreMO() && parent.Get("accentunder")) {c = SVG.FONTDATA.REMAPACCENTUNDER[c]||c} - } - c = SVG.FONTDATA.DELIMITERS[c.charCodeAt(0)]; - var can = (c && c.dir == direction.substr(0,1)); - if (!can) {delete this.svg} - this.forceStretch = can && (this.Get("minsize",true) || this.Get("maxsize",true)); - return can; - }, - SVGstretchV: function (h,d) { - var svg = this.svg || this.toSVG(); - var values = this.getValues("symmetric","maxsize","minsize"); - var axis = SVG.TeX.axis_height*svg.scale, mu = this.SVGgetMu(svg), H; - if (values.symmetric) {H = 2*Math.max(h-axis,d+axis)} else {H = h + d} - values.maxsize = SVG.length2em(values.maxsize,mu,svg.h+svg.d); - values.minsize = SVG.length2em(values.minsize,mu,svg.h+svg.d); - H = Math.max(values.minsize,Math.min(values.maxsize,H)); - if (H != values.minsize) - {H = [Math.max(H*SVG.TeX.delimiterfactor/1000,H-SVG.TeX.delimitershortfall),H]} - svg = SVG.createDelimiter(this.data.join("").charCodeAt(0),H,svg.scale); - if (values.symmetric) {H = (svg.h + svg.d)/2 + axis} - else {H = (svg.h + svg.d) * h/(h + d)} - svg.y = H - svg.h; - this.SVGhandleSpace(svg); - this.SVGhandleColor(svg); - delete this.svg.element; - this.SVGsaveData(svg); - svg.stretched = true; - return svg; - }, - SVGstretchH: function (w) { - var svg = this.svg || this.toSVG(), mu = this.SVGgetMu(svg); - var values = this.getValues("maxsize","minsize","mathvariant","fontweight"); - // FIXME: should take style="font-weight:bold" into account as well - if ((values.fontweight === "bold" || parseInt(values.fontweight) >= 600) && - !this.Get("mathvariant",true)) {values.mathvariant = MML.VARIANT.BOLD} - values.maxsize = SVG.length2em(values.maxsize,mu,svg.w); - values.minsize = SVG.length2em(values.minsize,mu,svg.w); - w = Math.max(values.minsize,Math.min(values.maxsize,w)); - svg = SVG.createDelimiter(this.data.join("").charCodeAt(0),w,svg.scale,values.mathvariant); - this.SVGhandleSpace(svg); - this.SVGhandleColor(svg); - delete this.svg.element; - this.SVGsaveData(svg); - svg.stretched = true; - return svg; - } - }); - - MML.mtext.Augment({ - toSVG: function () { - if (SVG.config.mtextFontInherit || this.Parent().type === "merror") { - this.SVGgetStyles(); - var svg = this.SVG(), scale = this.SVGgetScale(svg); - this.SVGhandleSpace(svg); - var variant = this.SVGgetVariant(), def = {direction:this.Get("dir")}; - if (variant.bold) {def["font-weight"] = "bold"} - if (variant.italic) {def["font-style"] = "italic"} - variant = this.Get("mathvariant"); - if (variant === "monospace") {def["class"] = "MJX-monospace"} - else if (variant.match(/sans-serif/)) {def["class"] = "MJX-sans-serif"} - svg.Add(BBOX.TEXT(scale*100/SVG.config.scale,this.data.join(""),def)); svg.Clean(); - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - } else { - return this.SUPER(arguments).toSVG.call(this); - } - } - }); - - MML.merror.Augment({ - toSVG: function (HW,D) { - this.SVGgetStyles(); - var svg = this.SVG(), scale = SVG.length2em(this.styles.fontSize||1)/1000; - this.SVGhandleSpace(svg); - var def = (scale !== 1 ? {transform:"scale("+SVG.Fixed(scale)+")"} : {}); - var bbox = BBOX(def); - bbox.Add(this.SVGchildSVG(0)); bbox.Clean(); - if (scale !== 1) { - bbox.removeable = false; - var adjust = ["w","h","d","l","r","D","H"]; - for (var i = 0, m = adjust.length; i < m; i++) {bbox[adjust[i]] *= scale} - } - svg.Add(bbox); svg.Clean(); - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - }, - SVGgetStyles: function () { - var span = HTML.Element("span",{style: SVG.config.merrorStyle}); - this.styles = this.SVGprocessStyles(span.style); - if (this.style) { - span.style.cssText = this.style; - HUB.Insert(this.styles,this.SVGprocessStyles(span.style)); - } - } - }); - - MML.ms.Augment({toSVG: MML.mbase.SVGautoload}); - - MML.mglyph.Augment({toSVG: MML.mbase.SVGautoload}); - - MML.mspace.Augment({ - toSVG: function () { - this.SVGgetStyles(); - var values = this.getValues("height","depth","width"); - values.mathbackground = this.mathbackground; - if (this.background && !this.mathbackground) {values.mathbackground = this.background} - var svg = this.SVG(); this.SVGgetScale(svg); - var scale = this.mscale, mu = this.SVGgetMu(svg); - svg.h = SVG.length2em(values.height,mu) * scale; - svg.d = SVG.length2em(values.depth,mu) * scale; - svg.w = svg.r = SVG.length2em(values.width,mu) * scale; - if (svg.w < 0) {svg.x = svg.w; svg.w = svg.r = 0} - if (svg.h < -svg.d) {svg.d = -svg.h} - svg.l = 0; svg.Clean(); - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - } - }); - - MML.mphantom.Augment({ - toSVG: function (HW,D) { - this.SVGgetStyles(); - var svg = this.SVG(); this.SVGgetScale(svg); - if (this.data[0] != null) { - this.SVGhandleSpace(svg); svg.Add(this.SVGdataStretched(0,HW,D)); svg.Clean(); - while (svg.element.firstChild) {svg.element.removeChild(svg.element.firstChild)} - } - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - if (svg.removeable && !svg.element.firstChild) {delete svg.element} - return svg; - } - }); - - MML.mpadded.Augment({ - toSVG: function (HW,D) { - this.SVGgetStyles(); - var svg = this.SVG(); - if (this.data[0] != null) { - this.SVGgetScale(svg); this.SVGhandleSpace(svg); - var pad = this.SVGdataStretched(0,HW,D), mu = this.SVGgetMu(svg); - var values = this.getValues("height","depth","width","lspace","voffset"), X = 0, Y = 0; - if (values.lspace) {X = this.SVGlength2em(pad,values.lspace,mu)} - if (values.voffset) {Y = this.SVGlength2em(pad,values.voffset,mu)} - var h = pad.h, d = pad.d, w = pad.w, y = pad.y; // these can change durring the Add() - svg.Add(pad,X,Y); svg.Clean(); - svg.h = h+y; svg.d = d-y; svg.w = w; svg.removeable = false; - if (values.height !== "") {svg.h = this.SVGlength2em(svg,values.height,mu,"h",0)} - if (values.depth !== "") {svg.d = this.SVGlength2em(svg,values.depth,mu,"d",0)} - if (values.width !== "") {svg.w = this.SVGlength2em(svg,values.width,mu,"w",0)} - if (svg.h > svg.H) {svg.H = svg.h}; if (svg.d > svg.D) {svg.D = svg.d} - } - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - }, - SVGlength2em: function (svg,length,mu,d,m) { - if (m == null) {m = -SVG.BIGDIMEN} - var match = String(length).match(/width|height|depth/); - var size = (match ? svg[match[0].charAt(0)] : (d ? svg[d] : 0)); - var v = SVG.length2em(length,mu,size/this.mscale)*this.mscale; - if (d && String(length).match(/^\s*[-+]/)) - {return Math.max(m,svg[d]+v)} else {return v} - } - }); - - MML.mrow.Augment({ - SVG: BBOX.ROW, - toSVG: function (h,d) { - this.SVGgetStyles(); - var svg = this.SVG(); - this.SVGhandleSpace(svg); - if (d != null) {svg.sh = h; svg.sd = d} - for (var i = 0, m = this.data.length; i < m; i++) - {if (this.data[i]) {svg.Check(this.data[i])}} - svg.Stretch(); svg.Clean(); - if (this.data.length === 1 && this.data[0]) { - var data = this.data[0].SVGdata; - if (data.skew) {svg.skew = data.skew} - } - if (this.SVGlineBreaks(svg)) {svg = this.SVGmultiline(svg)} - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - }, - SVGlineBreaks: function (svg) { - if (!this.parent.linebreakContainer) {return false} - return (SVG.config.linebreaks.automatic && - svg.w > SVG.linebreakWidth) || this.hasNewline(); - }, - SVGmultiline: function (span) {MML.mbase.SVGautoloadFile("multiline")}, - SVGstretchH: function (w) { - var svg = this.SVG(); - this.SVGhandleSpace(svg); - for (var i = 0, m = this.data.length; i < m; i++) - {svg.Add(this.SVGdataStretched(i,w),svg.w,0)} - svg.Clean(); - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - } - }); - - MML.mstyle.Augment({ - toSVG: function () { - this.SVGgetStyles(); - var svg = this.SVG(); - if (this.data[0] != null) { - this.SVGhandleSpace(svg); - var math = svg.Add(this.data[0].toSVG()); svg.Clean(); - if (math.ic) {svg.ic = math.ic} - this.SVGhandleColor(svg); - } - this.SVGsaveData(svg); - return svg; - }, - SVGstretchH: function (w) { - return (this.data[0] != null ? this.data[0].SVGstretchH(w) : BBOX.NULL()); - }, - SVGstretchV: function (h,d) { - return (this.data[0] != null ? this.data[0].SVGstretchV(h,d) : BBOX.NULL()); - } - }); - - MML.mfrac.Augment({ - toSVG: function () { - this.SVGgetStyles(); - var svg = this.SVG(), scale = this.SVGgetScale(svg); - var frac = BBOX(); frac.scale = svg.scale; this.SVGhandleSpace(frac); - var num = this.SVGchildSVG(0), den = this.SVGchildSVG(1); - var values = this.getValues("displaystyle","linethickness","numalign","denomalign","bevelled"); - var isDisplay = values.displaystyle; - var a = SVG.TeX.axis_height * scale; - if (values.bevelled) { - var delta = (isDisplay ? 400 : 150); - var H = Math.max(num.h+num.d,den.h+den.d)+2*delta; - var bevel = SVG.createDelimiter(0x2F,H); - frac.Add(num,0,(num.d-num.h)/2+a+delta); - frac.Add(bevel,num.w-delta/2,(bevel.d-bevel.h)/2+a); - frac.Add(den,num.w+bevel.w-delta,(den.d-den.h)/2+a-delta); - } else { - var W = Math.max(num.w,den.w); - var t = SVG.thickness2em(values.linethickness,this.scale)*this.mscale, p,q, u,v; - var mt = SVG.TeX.min_rule_thickness/SVG.em * 1000; - if (isDisplay) {u = SVG.TeX.num1; v = SVG.TeX.denom1} - else {u = (t === 0 ? SVG.TeX.num3 : SVG.TeX.num2); v = SVG.TeX.denom2} - u *= scale; v *= scale; - if (t === 0) {// \atop - p = Math.max((isDisplay ? 7 : 3) * SVG.TeX.rule_thickness, 2*mt); // force to at least 2 px - q = (u - num.d) - (den.h - v); - if (q < p) {u += (p - q)/2; v += (p - q)/2} - frac.w = W; t = 0; - } else {// \over - p = Math.max((isDisplay ? 2 : 0) * mt + t, t/2 + 1.5*mt); // force to be at least 1.5px - q = (u - num.d) - (a + t/2); if (q < p) {u += p - q} - q = (a - t/2) - (den.h - v); if (q < p) {v += p - q} - frac.Add(BBOX.RECT(t/2,t/2,W+2*t),0,a); - } - frac.Align(num,values.numalign,t,u); - frac.Align(den,values.denomalign,t,-v); - } - frac.Clean(); svg.Add(frac,0,0); svg.Clean(); - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - }, - SVGcanStretch: function (direction) {return false}, - SVGhandleSpace: function (svg) { - if (!this.texWithDelims && !this.useMMLspacing) { - // - // Add nulldelimiterspace around the fraction - // (TeXBook pg 150 and Appendix G rule 15e) - // - svg.x = svg.X = SVG.TeX.nulldelimiterspace * this.mscale; - } - this.SUPER(arguments).SVGhandleSpace.call(this,svg); - } - }); - - MML.msqrt.Augment({ - toSVG: function () { - this.SVGgetStyles(); - var svg = this.SVG(), scale = this.SVGgetScale(svg); this.SVGhandleSpace(svg); - var base = this.SVGchildSVG(0), rule, surd; - var t = SVG.TeX.rule_thickness * scale, p,q, H, x = 0; - if (this.Get("displaystyle")) {p = SVG.TeX.x_height * scale} else {p = t} - q = Math.max(t + p/4,1000*SVG.TeX.min_root_space/SVG.em); - H = base.h + base.d + q + t; - surd = SVG.createDelimiter(0x221A,H,scale); - if (surd.h + surd.d > H) {q = ((surd.h+surd.d) - (H-t)) / 2} - rule = BBOX.RECT(t,0,base.w); - H = base.h + q + t; - x = this.SVGaddRoot(svg,surd,x,surd.h+surd.d-H,scale); - svg.Add(surd,x,H-surd.h); - svg.Add(rule,x+surd.w,H-rule.h); - svg.Add(base,x+surd.w,0); - svg.Clean(); - svg.h += t; svg.H += t; - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - }, - SVGaddRoot: function (svg,surd,x,d,scale) {return x} - }); - - MML.mroot.Augment({ - toSVG: MML.msqrt.prototype.toSVG, - SVGaddRoot: function (svg,surd,x,d,scale) { - var dx = (surd.isMultiChar ? .55 : .65) * surd.w; - if (this.data[1]) { - var root = this.data[1].toSVG(); root.x = 0; - var h = this.SVGrootHeight(surd.h+surd.d,scale,root)-d; - var w = Math.min(root.w,root.r); // remove extra right-hand padding, if any - x = Math.max(w,dx); - svg.Add(root,x-w,h); - } else {dx = x} - return x - dx; - }, - SVGrootHeight: function (d,scale,root) { - return .45*(d-900*scale) + 600*scale + Math.max(0,root.d-75); - } - }); - - MML.mfenced.Augment({ - SVG: BBOX.ROW, - toSVG: function () { - this.SVGgetStyles(); - var svg = this.SVG(); - this.SVGhandleSpace(svg); - if (this.data.open) {svg.Check(this.data.open)} - if (this.data[0] != null) {svg.Check(this.data[0])} - for (var i = 1, m = this.data.length; i < m; i++) { - if (this.data[i]) { - if (this.data["sep"+i]) {svg.Check(this.data["sep"+i])} - svg.Check(this.data[i]); - } - } - if (this.data.close) {svg.Check(this.data.close)} - svg.Stretch(); svg.Clean(); - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - } - }); - - MML.menclose.Augment({toSVG: MML.mbase.SVGautoload}); - MML.maction.Augment({toSVG: MML.mbase.SVGautoload}); - - MML.semantics.Augment({ - toSVG: function () { - this.SVGgetStyles(); - var svg = this.SVG(); - if (this.data[0] != null) { - this.SVGhandleSpace(svg); - svg.Add(this.data[0].toSVG()); svg.Clean(); - } else {svg.Clean()} - this.SVGsaveData(svg); - return svg; - }, - SVGstretchH: function (w) { - return (this.data[0] != null ? this.data[0].SVGstretchH(w) : BBOX.NULL()); - }, - SVGstretchV: function (h,d) { - return (this.data[0] != null ? this.data[0].SVGstretchV(h,d) : BBOX.NULL()); - } - }); - - MML.munderover.Augment({ - toSVG: function (HW,D) { - this.SVGgetStyles(); - var values = this.getValues("displaystyle","accent","accentunder","align"); - var base = this.data[this.base]; - if (!values.displaystyle && base != null && - (base.movablelimits || base.CoreMO().Get("movablelimits"))) - {return MML.msubsup.prototype.toSVG.call(this)} - var svg = this.SVG(), scale = this.SVGgetScale(svg); this.SVGhandleSpace(svg); - var boxes = [], stretch = [], box, i, m, W = -SVG.BIGDIMEN, WW = W; - for (i = 0, m = this.data.length; i < m; i++) { - if (this.data[i] != null) { - if (i == this.base) { - boxes[i] = this.SVGdataStretched(i,HW,D); - stretch[i] = (D != null || HW == null) && this.data[i].SVGcanStretch("Horizontal"); - } else { - boxes[i] = this.data[i].toSVG(); boxes[i].x = 0; delete boxes[i].X; - stretch[i] = this.data[i].SVGcanStretch("Horizontal"); - } - if (boxes[i].w > WW) {WW = boxes[i].w} - if (!stretch[i] && WW > W) {W = WW} - } - } - if (D == null && HW != null) {W = HW} else if (W == -SVG.BIGDIMEN) {W = WW} - for (i = WW = 0, m = this.data.length; i < m; i++) {if (this.data[i]) { - if (stretch[i]) { - boxes[i] = this.data[i].SVGstretchH(W); - if (i !== this.base) {boxes[i].x = 0; delete boxes[i].X} - } - if (boxes[i].w > WW) {WW = boxes[i].w} - }} - var t = SVG.TeX.rule_thickness * this.mscale; - var x, y, z1, z2, z3, dw, k, delta = 0; - base = boxes[this.base] || {w:0, h:0, d:0, H:0, D:0, l:0, r:0, y:0, scale:scale}; - if (base.ic) {delta = 1.3*base.ic + .05} // adjust faked IC to be more in line with expeted results - for (i = 0, m = this.data.length; i < m; i++) { - if (this.data[i] != null) { - box = boxes[i]; - z3 = SVG.TeX.big_op_spacing5 * scale; - var accent = (i != this.base && values[this.ACCENTS[i]]); - if (accent && box.w <= 1) { - box.x = -box.l; - boxes[i] = BBOX.G().With({removeable: false}); - boxes[i].Add(box); boxes[i].Clean(); - boxes[i].w = -box.l; box = boxes[i]; - } - dw = {left:0, center:(WW-box.w)/2, right:WW-box.w}[values.align]; - x = dw; y = 0; - if (i == this.over) { - if (accent) { - k = t * scale; z3 = 0; - if (base.skew) { - x += base.skew; svg.skew = base.skew; - if (x+box.w > WW) {svg.skew += (WW-box.w-x)/2} - } - } else { - z1 = SVG.TeX.big_op_spacing1 * scale; - z2 = SVG.TeX.big_op_spacing3 * scale; - k = Math.max(z1,z2-Math.max(0,box.d)); - } - k = Math.max(k,1500/SVG.em); - x += delta/2; y = base.y + base.h + box.d + k; - box.h += z3; if (box.h > box.H) {box.H = box.h} - } else if (i == this.under) { - if (accent) { - k = 3*t * scale; z3 = 0; - } else { - z1 = SVG.TeX.big_op_spacing2 * scale; - z2 = SVG.TeX.big_op_spacing4 * scale; - k = Math.max(z1,z2-box.h); - } - k = Math.max(k,1500/SVG.em); - x -= delta/2; y = base.y -(base.d + box.h + k); - box.d += z3; if (box.d > box.D) {box.D = box.d} - } - svg.Add(box,x,y); - } - } - svg.Clean(); - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - } - }); - - MML.msubsup.Augment({ - toSVG: function (HW,D) { - this.SVGgetStyles(); - var svg = this.SVG(), scale = this.SVGgetScale(svg); this.SVGhandleSpace(svg); - var mu = this.SVGgetMu(svg); - var base = svg.Add(this.SVGdataStretched(this.base,HW,D)); - var sscale = (this.data[this.sup] || this.data[this.sub] || this).SVGgetScale(); - var x_height = SVG.TeX.x_height * scale, s = SVG.TeX.scriptspace * scale; - var sup, sub; - if (this.SVGnotEmpty(this.data[this.sup])) { - sup = this.data[this.sup].toSVG(); - sup.w += s; sup.r = Math.max(sup.w,sup.r); - } - if (this.SVGnotEmpty(this.data[this.sub])) { - sub = this.data[this.sub].toSVG(); - sub.w += s; sub.r = Math.max(sub.w,sub.r); - } - var q = SVG.TeX.sup_drop * sscale, r = SVG.TeX.sub_drop * sscale; - var u = base.h+(base.y||0) - q, v = base.d-(base.y||0) + r, delta = 0, p; - if (base.ic) { - base.w -= base.ic; // remove IC (added by mo and mi) - delta = 1.3*base.ic+.05; // adjust faked IC to be more in line with expeted results - } - if (this.data[this.base] && - (this.data[this.base].type === "mi" || this.data[this.base].type === "mo")) { - if (this.data[this.base].data.join("").length === 1 && base.scale === 1 && - !base.stretched && !this.data[this.base].Get("largeop")) {u = v = 0} - } - var min = this.getValues("subscriptshift","superscriptshift"); - min.subscriptshift = (min.subscriptshift === "" ? 0 : SVG.length2em(min.subscriptshift,mu)); - min.superscriptshift = (min.superscriptshift === "" ? 0 : SVG.length2em(min.superscriptshift,mu)); - var x = base.w + base.x; - if (!sup) { - if (sub) { - v = Math.max(v,SVG.TeX.sub1*scale,sub.h-(4/5)*x_height,min.subscriptshift); - svg.Add(sub,x,-v); this.data[this.sub].SVGdata.dy = -v; - } - } else { - if (!sub) { - values = this.getValues("displaystyle","texprimestyle"); - p = SVG.TeX[(values.displaystyle ? "sup1" : (values.texprimestyle ? "sup3" : "sup2"))]; - u = Math.max(u,p*scale,sup.d+(1/4)*x_height,min.superscriptshift); - svg.Add(sup,x+delta,u); - this.data[this.sup].SVGdata.dx = delta; - this.data[this.sup].SVGdata.dy = u; - } else { - v = Math.max(v,SVG.TeX.sub2*scale); - var t = SVG.TeX.rule_thickness * scale; - if ((u - sup.d) - (sub.h - v) < 3*t) { - v = 3*t - u + sup.d + sub.h; - q = (4/5)*x_height - (u - sup.d); - if (q > 0) {u += q; v -= q} - } - svg.Add(sup,x+delta,Math.max(u,min.superscriptshift)); - svg.Add(sub,x,-Math.max(v,min.subscriptshift)); - this.data[this.sup].SVGdata.dx = delta; - this.data[this.sup].SVGdata.dy = Math.max(u,min.superscriptshift); - this.data[this.sub].SVGdata.dy = -Math.max(v,min.subscriptshift); - } - } - svg.Clean(); - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - } - }); - - MML.mmultiscripts.Augment({toSVG: MML.mbase.SVGautoload}); - MML.mtable.Augment({toSVG: MML.mbase.SVGautoload}); - MML["annotation-xml"].Augment({toSVG: MML.mbase.SVGautoload}); - - MML.math.Augment({ - SVG: BBOX.Subclass({type:"svg", removeable: false}), - toSVG: function (span,div) { - var CONFIG = SVG.config; - // - // All the data should be in an inferrerd row - // - if (this.data[0]) { - this.SVGgetStyles(); - MML.mbase.prototype.displayAlign = HUB.config.displayAlign; - MML.mbase.prototype.displayIndent = HUB.config.displayIndent; - if (String(HUB.config.displayIndent).match(/^0($|[a-z%])/i)) - MML.mbase.prototype.displayIndent = "0"; - // - // Put content in a with defaults and matrix that flips y axis. - // Put that in an with xlink defined. - // - var box = BBOX.G(); box.Add(this.data[0].toSVG(),0,0,true); box.Clean(); - this.SVGhandleColor(box); - SVG.Element(box.element,{ - stroke:"currentColor", fill:"currentColor", "stroke-width":0, - transform: "matrix(1 0 0 -1 0 0)" - }); - box.removeable = false; - var svg = this.SVG(); - svg.element.setAttribute("xmlns:xlink",XLINKNS); - if (CONFIG.useFontCache && !CONFIG.useGlobalCache) - {svg.element.appendChild(BBOX.GLYPH.defs)} - svg.Add(box); svg.Clean(); - this.SVGsaveData(svg); - // - // If this element is not the top-level math element - // remove the transform and return the svg object - // (issue #614). - // - if (!span) { - svg.element = svg.element.firstChild; // remove element - svg.element.removeAttribute("transform"); - svg.removable = true; - return svg; - } - // - // Style the to get the right size and placement - // - var l = Math.max(-svg.l,0), r = Math.max(svg.r-svg.w,0); - var style = svg.element.style, px = SVG.TeX.x_height/SVG.ex; - var H = (Math.ceil(svg.H/px)+1)*px+SVG.HFUZZ, // round to pixels and add padding - D = (Math.ceil(svg.D/px)+1)*px+SVG.DFUZZ; - svg.element.setAttribute("width",SVG.Ex(l+svg.w+r)); - svg.element.setAttribute("height",SVG.Ex(H+D)); - style.verticalAlign = SVG.Ex(-D); - if (l) style.marginLeft = SVG.Ex(-l); - if (r) style.marginRight = SVG.Ex(-r); - svg.element.setAttribute("viewBox",SVG.Fixed(-l,1)+" "+SVG.Fixed(-H,1)+" "+ - SVG.Fixed(l+svg.w+r,1)+" "+SVG.Fixed(H+D,1)); - // - // If there is extra height or depth, hide that - // - if (svg.H > svg.h) style.marginTop = SVG.Ex(svg.h-H); - if (svg.D > svg.d) { - style.marginBottom = SVG.Ex(svg.d-D); - style.verticalAlign = SVG.Ex(-svg.d); - } - // - // Add it to the MathJax span - // - var alttext = this.Get("alttext"); - if (alttext && !svg.element.getAttribute("aria-label")) svg.element.setAttribute("aria-label",alttext); - if (!svg.element.getAttribute("role")) svg.element.setAttribute("role","img"); - svg.element.setAttribute("focusable","false"); - span.appendChild(svg.element); - svg.element = null; - // - // Handle indentalign and indentshift for single-line displays - // - if (!this.isMultiline && this.Get("display") === "block" && !svg.hasIndent) { - var values = this.getValues("indentalignfirst","indentshiftfirst","indentalign","indentshift"); - if (values.indentalignfirst !== MML.INDENTALIGN.INDENTALIGN) {values.indentalign = values.indentalignfirst} - if (values.indentalign === MML.INDENTALIGN.AUTO) {values.indentalign = this.displayAlign} - if (values.indentshiftfirst !== MML.INDENTSHIFT.INDENTSHIFT) {values.indentshift = values.indentshiftfirst} - if (values.indentshift === "auto") {values.indentshift = "0"} - var shift = SVG.length2em(values.indentshift,1,SVG.cwidth); - if (this.displayIndent !== "0") { - var indent = SVG.length2em(this.displayIndent,1,SVG.cwidth); - shift += (values.indentalign === MML.INDENTALIGN.RIGHT ? -indent : indent); - } - div.style.textAlign = values.indentalign; - if (shift) { - HUB.Insert(style,({ - left: {marginLeft: SVG.Ex(shift)}, - right: {marginRight: SVG.Ex(-shift), marginLeft: SVG.Ex(Math.max(0,shift-(l+svg.w+r)))}, - center: {marginLeft: SVG.Ex(shift), marginRight: SVG.Ex(-shift)} - })[values.indentalign]); - } - } - } - return span; - } - }); - - MML.TeXAtom.Augment({ - toSVG: function (HW,D) { - this.SVGgetStyles(); - var svg = this.SVG(); - this.SVGhandleSpace(svg); - if (this.data[0] != null) { - var box = this.SVGdataStretched(0,HW,D), y = 0; - if (this.texClass === MML.TEXCLASS.VCENTER) - {y = SVG.TeX.axis_height - (box.h+box.d)/2 + box.d} - svg.Add(box,0,y); - svg.ic = box.ic; svg.skew = box.skew; - } - this.SVGhandleColor(svg); - this.SVGsaveData(svg); - return svg; - } - }); - - // - // Make sure these don't generate output - // - MML.maligngroup.Augment({toSVG: MML.mbase.SVGemptySVG}); - MML.malignmark.Augment({toSVG: MML.mbase.SVGemptySVG}); - MML.mprescripts.Augment({toSVG: MML.mbase.SVGemptySVG}); - MML.none.Augment({toSVG: MML.mbase.SVGemptySVG}); - - // - // Loading isn't complete until the element jax is modified, - // but can't call loadComplete within the callback for "mml Jax Ready" - // (it would call SVG's Require routine, asking for the mml jax again) - // so wait until after the mml jax has finished processing. - // - // We also need to wait for the onload handler to run, since the loadComplete - // will call Config and Startup, which need to modify the body. - // - HUB.Register.StartupHook("onLoad",function () { - setTimeout(MathJax.Callback(["loadComplete",SVG,"jax.js"]),0); - }); - }); - - HUB.Browser.Select({ - Opera: function (browser) { - SVG.Augment({ - operaZoomRefresh: true // Opera needs a kick to redraw zoomed equations - }); - } - }); - - HUB.Register.StartupHook("End Cookie", function () { - if (HUB.config.menuSettings.zoom !== "None") - {AJAX.Require("[MathJax]/extensions/MathZoom.js")} - }); - - if (!document.createElementNS) { - // - // Try to handle SVG in IE8 and below, but fail - // (but don't crash on loading the file, so no delay for loadComplete) - // - if (!document.namespaces.svg) {document.namespaces.add("svg",SVGNS)} - SVG.Augment({ - Element: function (type,def) { - var obj = (typeof(type) === "string" ? document.createElement("svg:"+type) : type); - obj.isMathJax = true; - if (def) {for (var id in def) {if (def.hasOwnProperty(id)) {obj.setAttribute(id,def[id].toString())}}} - return obj; - } - }); - } - -})(MathJax.Ajax, MathJax.Hub, MathJax.HTML, MathJax.OutputJax.SVG); diff --git a/src/calibre/ebooks/oeb/display/mathjax.coffee b/src/calibre/ebooks/oeb/display/mathjax.coffee index c6f8d0f9df..28a9efc0a7 100644 --- a/src/calibre/ebooks/oeb/display/mathjax.coffee +++ b/src/calibre/ebooks/oeb/display/mathjax.coffee @@ -9,6 +9,18 @@ log = window.calibre_utils.log +startswith = (string, q) -> + return string.substring(0, q.length) == q + +init_mathjax = () -> + orig = window.MathJax.Ajax.fileURL.bind(window.MathJax.Ajax) + window.MathJax.Ajax.fileURL = (mathjax_name) -> + ans = orig(mathjax_name) + if startswith(mathjax_name, '[MathJax]/../fonts') + ans = ans.replace('/../fonts', '/fonts') + return ans + + class MathJax # This class is a namespace to expose functions via the # window.mathjax object. The most important functions are: @@ -29,7 +41,6 @@ class MathJax return null script = document.createElement('script') - scale = if is_windows then 160 else 100 script.type = 'text/javascript' script.onerror = (ev) -> @@ -38,14 +49,14 @@ class MathJax if base.substr(base.length - 1) != '/' base += '/' script.src = base + 'MathJax.js' + window.MathJax = {AuthorInit: init_mathjax} script.text = user_config + (''' MathJax.Hub.signal.Interest(function (message) {if (String(message).match(/error/i)) {console.log(message)}}); MathJax.Hub.Config({ positionToHash: false, showMathMenu: false, extensions: ["tex2jax.js", "asciimath2jax.js", "mml2jax.js"], - jax: ["input/TeX","input/MathML","input/AsciiMath","output/SVG"], - SVG : { linebreaks : { automatic : true }, scale: __scale__ }, + jax: ["input/TeX","input/MathML","input/AsciiMath","output/CommonHTML"], TeX: { extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"] } @@ -53,7 +64,7 @@ class MathJax MathJax.Hub.Startup.onload(); MathJax.Hub.Register.StartupHook("End", window.mathjax.load_finished); window.mathjax.hub = MathJax.Hub - ''').replace('__scale__', scale) + ''') document.head.appendChild(script) load_finished: () => diff --git a/src/calibre/ebooks/pdf/render/from_html.py b/src/calibre/ebooks/pdf/render/from_html.py index 1178cc89cd..94a9907b2a 100644 --- a/src/calibre/ebooks/pdf/render/from_html.py +++ b/src/calibre/ebooks/pdf/render/from_html.py @@ -23,7 +23,7 @@ from calibre.ebooks.oeb.display.webview import load_html from calibre.ebooks.pdf.render.common import (inch, cm, mm, pica, cicero, didot, PAPER_SIZES, current_log) from calibre.ebooks.pdf.render.engine import PdfDevice -from calibre.ptempfile import PersistentTemporaryFile +from calibre.ptempfile import PersistentTemporaryFile, PersistentTemporaryDirectory from calibre.utils.resources import load_hyphenator_dicts @@ -150,6 +150,7 @@ class PDFWriter(QObject): QObject.__init__(self) self.logger = self.log = log + self.mathjax_tdir = None current_log(log) self.opts = opts self.cover_data = cover_data @@ -309,7 +310,12 @@ class PDFWriter(QObject): def load_mathjax(self): evaljs = self.view.page().mainFrame().evaluateJavaScript - mjpath = P(u'viewer/mathjax').replace(os.sep, '/') + if self.mathjax_tdir is None: + self.mathjax_tdir = PersistentTemporaryDirectory('jax') + from calibre.srv.books import get_mathjax_manifest + get_mathjax_manifest(self.mathjax_tdir) + + mjpath = os.path.join(self.mathjax_tdir, 'mathjax').replace(os.sep, '/') if iswindows: mjpath = u'/' + mjpath if bool(evaljs(''' @@ -319,6 +325,9 @@ class PDFWriter(QObject): self.log.debug('Math present, loading MathJax') while not bool(evaljs('mathjax.math_loaded')): self.loop.processEvents(self.loop.ExcludeUserInputEvents) + # give the MathJax fonts time to load + for i in range(5): + self.loop.processEvents(self.loop.ExcludeUserInputEvents) evaljs('document.getElementById("MathJax_Message").style.display="none";') def load_header_footer_images(self): diff --git a/src/calibre/gui2/viewer/fake_net.py b/src/calibre/gui2/viewer/fake_net.py index 7663e9a815..c8e1a7f5db 100644 --- a/src/calibre/gui2/viewer/fake_net.py +++ b/src/calibre/gui2/viewer/fake_net.py @@ -9,6 +9,7 @@ import os from PyQt5.Qt import QNetworkReply, QNetworkAccessManager, QUrl, QNetworkRequest, QTimer, pyqtSignal, QByteArray from calibre import guess_type as _guess_type, prints +from calibre.ptempfile import PersistentTemporaryDirectory from calibre.constants import FAKE_HOST, FAKE_PROTOCOL, DEBUG from calibre.ebooks.oeb.base import OEB_DOCS from calibre.ebooks.oeb.display.webview import cleanup_html, load_as_html @@ -106,6 +107,7 @@ class NetworkAccessManager(QNetworkAccessManager): self.mathjax_base = '%s://%s/%s/' % (FAKE_PROTOCOL, FAKE_HOST, self.mathjax_prefix) self.root = self.orig_root = os.path.dirname(P('viewer/blank.html', allow_user_override=False)) self.mime_map, self.single_pages, self.codec_map = {}, set(), {} + self.mathjax_tdir = None def set_book_data(self, root, spine): self.orig_root = root @@ -166,7 +168,11 @@ class NetworkAccessManager(QNetworkAccessManager): if operation == QNetworkAccessManager.GetOperation and qurl.host() == FAKE_HOST: name = qurl.path()[1:] if name.startswith(self.mathjax_prefix): - base = normpath(P('viewer/mathjax')) + if self.mathjax_tdir is None: + self.mathjax_tdir = PersistentTemporaryDirectory('ev-jax') + from calibre.srv.books import get_mathjax_manifest + get_mathjax_manifest(self.mathjax_tdir) + base = normpath(os.path.join(self.mathjax_tdir, 'mathjax')) path = normpath(os.path.join(base, name.partition('/')[2])) else: base = self.root From f78a7dad581aa2c29800598e371a42889d6e0eb7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 4 Jan 2019 21:53:06 +0530 Subject: [PATCH 0113/2613] Do not use a compressed archive for mathjax Improves performance for local clients such as PDF output and the viewer. Since we have now removed the old unbundled mathjax, the file count in the resources directory does not go up too much. --- .gitignore | 3 +- session.vim | 2 +- setup/mathjax.py | 50 +++++++++++----------- setup/resources.py | 2 +- src/calibre/ebooks/pdf/render/from_html.py | 9 +--- src/calibre/gui2/viewer/fake_net.py | 8 +--- src/calibre/srv/books.py | 28 ++++-------- 7 files changed, 39 insertions(+), 63 deletions(-) diff --git a/.gitignore b/.gitignore index 6122bbe6d7..ccbeab143b 100644 --- a/.gitignore +++ b/.gitignore @@ -28,8 +28,7 @@ resources/viewer.html resources/content-server/index-generated.html resources/content-server/calibre.appcache resources/content-server/locales.zip -resources/content-server/mathjax.zip.xz -resources/content-server/mathjax.version +resources/mathjax resources/mozilla-ca-certs.pem resources/user-agent-data.json icons/icns/*.iconset diff --git a/session.vim b/session.vim index 0251e760db..a1918c47e4 100644 --- a/session.vim +++ b/session.vim @@ -16,7 +16,7 @@ let g:syntastic_python_flake8_exec = 'flake8-python2' let g:syntastic_python_flake8_args = '--filename='. shellescape('*.py,*.recipe') let g:python_version_2 = 1 -set wildignore+=resources/viewer/mathjax/* +set wildignore+=resources/mathjax/* set wildignore+=resources/rapydscript/lib/* set wildignore+=build/* set wildignore+=dist/* diff --git a/setup/mathjax.py b/setup/mathjax.py index 72d7b53dff..b65bba6935 100644 --- a/setup/mathjax.py +++ b/setup/mathjax.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import os, shutil +import os, shutil, json from io import BytesIO from zipfile import ZipFile, ZIP_STORED, ZipInfo from hashlib import sha1 @@ -36,44 +36,42 @@ class MathJax(Command): zf.extractall(tdir) return os.path.join(tdir, 'MathJax-' + self.MATH_JAX_VERSION) - def add_file(self, zf, path, name): + def add_file(self, path, name): with open(path, 'rb') as f: raw = f.read() self.h.update(raw) - zi = ZipInfo(name) - zi.external_attr = 0o444 << 16 - zf.writestr(zi, raw) + self.mathjax_files[name] = len(raw) + dest = self.j(self.mathjax_dir, *name.split('/')) + base = os.path.dirname(dest) + if not os.path.exists(base): + os.makedirs(base) + with open(dest, 'wb') as f: + f.write(raw) - def add_tree(self, zf, base, prefix, ignore=lambda n:False): + def add_tree(self, base, prefix): for dirpath, dirnames, filenames in os.walk(base): for fname in filenames: f = os.path.join(dirpath, fname) name = prefix + '/' + os.path.relpath(f, base).replace(os.sep, '/') - if not ignore(name): - self.add_file(zf, f, name) - - def ignore_fonts(self, name): - return '/fonts/' in name and self.FONT_FAMILY not in name + self.add_file(f, name) def run(self, opts): - from lzma.xz import compress self.h = sha1() + self.mathjax_dir = self.j(self.RESOURCES, 'mathjax') + self.mathjax_files = {} + if os.path.exists(self.mathjax_dir): + shutil.rmtree(self.mathjax_dir) + os.mkdir(self.mathjax_dir) tdir = mkdtemp('calibre-mathjax-build') try: src = opts.path_to_mathjax or self.download_mathjax_release(tdir, opts.mathjax_url) - self.info('Compressing MathJax...') - t = SpooledTemporaryFile() - with ZipFile(t, 'w', ZIP_STORED) as zf: - self.add_file(zf, self.j(src, 'unpacked', 'MathJax.js'), 'MathJax.js') - self.add_tree(zf, self.j(src, 'fonts', 'HTML-CSS', self.FONT_FAMILY, 'woff'), 'fonts/HTML-CSS/%s/woff' % self.FONT_FAMILY) - for d in 'extensions jax/element jax/input jax/output/CommonHTML'.split(): - self.add_tree(zf, self.j(src, 'unpacked', *d.split('/')), d) - - zf.comment = self.h.hexdigest() - t.seek(0) - with open(self.j(self.RESOURCES, 'content-server', 'mathjax.zip.xz'), 'wb') as f: - compress(t, f, level=4 if is_ci else 9) - with open(self.j(self.RESOURCES, 'content-server', 'mathjax.version'), 'wb') as f: - f.write(zf.comment) + self.info('Adding MathJax...') + self.add_file(self.j(src, 'unpacked', 'MathJax.js'), 'MathJax.js') + self.add_tree(self.j(src, 'fonts', 'HTML-CSS', self.FONT_FAMILY, 'woff'), 'fonts/HTML-CSS/%s/woff' % self.FONT_FAMILY) + for d in 'extensions jax/element jax/input jax/output/CommonHTML'.split(): + self.add_tree(self.j(src, 'unpacked', *d.split('/')), d) + etag = self.h.hexdigest() + with open(self.j(self.RESOURCES, 'mathjax', 'manifest.json'), 'wb') as f: + f.write(json.dumps({'etag': etag, 'files': self.mathjax_files}, indent=2).encode('utf-8')) finally: shutil.rmtree(tdir) diff --git a/setup/resources.py b/setup/resources.py index 2dd246d8af..8fea7c2512 100644 --- a/setup/resources.py +++ b/setup/resources.py @@ -287,7 +287,7 @@ class RapydScript(Command): # {{{ class Resources(Command): # {{{ description = 'Compile various needed calibre resources' - sub_commands = ['kakasi', 'coffee', 'rapydscript'] + sub_commands = ['kakasi', 'coffee', 'rapydscript', 'mathjax'] def run(self, opts): from calibre.utils.serialize import msgpack_dumps diff --git a/src/calibre/ebooks/pdf/render/from_html.py b/src/calibre/ebooks/pdf/render/from_html.py index 94a9907b2a..962917966c 100644 --- a/src/calibre/ebooks/pdf/render/from_html.py +++ b/src/calibre/ebooks/pdf/render/from_html.py @@ -150,7 +150,7 @@ class PDFWriter(QObject): QObject.__init__(self) self.logger = self.log = log - self.mathjax_tdir = None + self.mathjax_dir = P('mathjax', allow_user_override=False) current_log(log) self.opts = opts self.cover_data = cover_data @@ -310,12 +310,7 @@ class PDFWriter(QObject): def load_mathjax(self): evaljs = self.view.page().mainFrame().evaluateJavaScript - if self.mathjax_tdir is None: - self.mathjax_tdir = PersistentTemporaryDirectory('jax') - from calibre.srv.books import get_mathjax_manifest - get_mathjax_manifest(self.mathjax_tdir) - - mjpath = os.path.join(self.mathjax_tdir, 'mathjax').replace(os.sep, '/') + mjpath = self.mathjax_dir.replace(os.sep, '/') if iswindows: mjpath = u'/' + mjpath if bool(evaljs(''' diff --git a/src/calibre/gui2/viewer/fake_net.py b/src/calibre/gui2/viewer/fake_net.py index c8e1a7f5db..12c7f28752 100644 --- a/src/calibre/gui2/viewer/fake_net.py +++ b/src/calibre/gui2/viewer/fake_net.py @@ -107,7 +107,7 @@ class NetworkAccessManager(QNetworkAccessManager): self.mathjax_base = '%s://%s/%s/' % (FAKE_PROTOCOL, FAKE_HOST, self.mathjax_prefix) self.root = self.orig_root = os.path.dirname(P('viewer/blank.html', allow_user_override=False)) self.mime_map, self.single_pages, self.codec_map = {}, set(), {} - self.mathjax_tdir = None + self.mathjax_dir = P('mathjax', allow_user_override=False) def set_book_data(self, root, spine): self.orig_root = root @@ -168,11 +168,7 @@ class NetworkAccessManager(QNetworkAccessManager): if operation == QNetworkAccessManager.GetOperation and qurl.host() == FAKE_HOST: name = qurl.path()[1:] if name.startswith(self.mathjax_prefix): - if self.mathjax_tdir is None: - self.mathjax_tdir = PersistentTemporaryDirectory('ev-jax') - from calibre.srv.books import get_mathjax_manifest - get_mathjax_manifest(self.mathjax_tdir) - base = normpath(os.path.join(self.mathjax_tdir, 'mathjax')) + base = normpath(self.mathjax_dir) path = normpath(os.path.join(base, name.partition('/')[2])) else: base = self.root diff --git a/src/calibre/srv/books.py b/src/calibre/srv/books.py index 565b42308b..641cd80305 100644 --- a/src/calibre/srv/books.py +++ b/src/calibre/srv/books.py @@ -227,33 +227,21 @@ mathjax_lock = Lock() mathjax_manifest = None -def get_mathjax_manifest(tdir=None): +def manifest_as_json(): + return P('mathjax/manifest.json', data=True, allow_user_override=False) + + +def get_mathjax_manifest(): global mathjax_manifest with mathjax_lock: if mathjax_manifest is None: - mathjax_manifest = {} - f = decompress(P('content-server/mathjax.zip.xz', data=True, allow_user_override=False)) - f.seek(0) - tdir = os.path.join(tdir, 'mathjax') - os.mkdir(tdir) - zf = ZipFile(f) - zf.extractall(tdir) - mathjax_manifest['etag'] = type('')(zf.comment) - mathjax_manifest['files'] = {type('')(zi.filename):zi.file_size for zi in zf.infolist()} - zf.close(), f.close() - return mathjax_manifest - - -def manifest_as_json(): - ans = jsonlib.dumps(get_mathjax_manifest(), ensure_ascii=False) - if not isinstance(ans, bytes): - ans = ans.encode('utf-8') - return ans + mathjax_manifest = jsonlib.loads(manifest_as_json()) + return mathjax_manifest @endpoint('/mathjax/{+which=""}', auth_required=False) def mathjax(ctx, rd, which): - manifest = get_mathjax_manifest(rd.tdir) + manifest = get_mathjax_manifest() if not which: return rd.etagged_dynamic_response(manifest['etag'], manifest_as_json, content_type='application/json; charset=UTF-8') if which not in manifest['files']: From c184fe37c7295148366c7a14d6eae68f00970a5c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 4 Jan 2019 21:54:57 +0530 Subject: [PATCH 0114/2613] Remove unused code --- setup/mathjax.py | 1 - src/calibre/ebooks/pdf/render/from_html.py | 2 +- src/calibre/gui2/tag_browser/model.py | 6 ++---- src/calibre/gui2/viewer/fake_net.py | 1 - src/calibre/srv/books.py | 2 -- 5 files changed, 3 insertions(+), 9 deletions(-) diff --git a/setup/mathjax.py b/setup/mathjax.py index b65bba6935..5a49f07ce9 100644 --- a/setup/mathjax.py +++ b/setup/mathjax.py @@ -12,7 +12,6 @@ from io import BytesIO from zipfile import ZipFile, ZIP_STORED, ZipInfo from hashlib import sha1 from tempfile import mkdtemp, SpooledTemporaryFile -is_ci = os.environ.get('CI', '').lower() == 'true' from setup import Command, download_securely diff --git a/src/calibre/ebooks/pdf/render/from_html.py b/src/calibre/ebooks/pdf/render/from_html.py index 962917966c..b3e81f0a12 100644 --- a/src/calibre/ebooks/pdf/render/from_html.py +++ b/src/calibre/ebooks/pdf/render/from_html.py @@ -23,7 +23,7 @@ from calibre.ebooks.oeb.display.webview import load_html from calibre.ebooks.pdf.render.common import (inch, cm, mm, pica, cicero, didot, PAPER_SIZES, current_log) from calibre.ebooks.pdf.render.engine import PdfDevice -from calibre.ptempfile import PersistentTemporaryFile, PersistentTemporaryDirectory +from calibre.ptempfile import PersistentTemporaryFile from calibre.utils.resources import load_hyphenator_dicts diff --git a/src/calibre/gui2/tag_browser/model.py b/src/calibre/gui2/tag_browser/model.py index ce45ec0441..3077a28969 100644 --- a/src/calibre/gui2/tag_browser/model.py +++ b/src/calibre/gui2/tag_browser/model.py @@ -423,10 +423,8 @@ class TagsModel(QAbstractItemModel): # {{{ if self.category_custom_icons.get(key, None) is None: self.category_custom_icons[key] = QIcon(I( - category_icon_map['gst'] if is_gst else - category_icon_map.get(key, - (category_icon_map['user:'] if key.startswith('@') else - category_icon_map['custom:'])))) + category_icon_map['gst'] if is_gst else category_icon_map.get( + key, (category_icon_map['user:'] if key.startswith('@') else category_icon_map['custom:'])))) if key.startswith('@'): path_parts = [p for p in key.split('.')] diff --git a/src/calibre/gui2/viewer/fake_net.py b/src/calibre/gui2/viewer/fake_net.py index 12c7f28752..a8d5159a22 100644 --- a/src/calibre/gui2/viewer/fake_net.py +++ b/src/calibre/gui2/viewer/fake_net.py @@ -9,7 +9,6 @@ import os from PyQt5.Qt import QNetworkReply, QNetworkAccessManager, QUrl, QNetworkRequest, QTimer, pyqtSignal, QByteArray from calibre import guess_type as _guess_type, prints -from calibre.ptempfile import PersistentTemporaryDirectory from calibre.constants import FAKE_HOST, FAKE_PROTOCOL, DEBUG from calibre.ebooks.oeb.base import OEB_DOCS from calibre.ebooks.oeb.display.webview import cleanup_html, load_as_html diff --git a/src/calibre/srv/books.py b/src/calibre/srv/books.py index 641cd80305..eb59b425d7 100644 --- a/src/calibre/srv/books.py +++ b/src/calibre/srv/books.py @@ -8,10 +8,8 @@ from hashlib import sha1 from functools import partial from threading import RLock, Lock from cPickle import dumps -from zipfile import ZipFile import errno, os, tempfile, shutil, time, json as jsonlib -from lzma.xz import decompress from calibre.constants import cache_dir, iswindows from calibre.customize.ui import plugin_for_input_format from calibre.srv.metadata import book_as_json From 98a2f53d90307e9896731e3370df1953823c3146 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 4 Jan 2019 21:59:01 +0530 Subject: [PATCH 0115/2613] Remove mathjax from bootstrap since it is now under resources --- setup/install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/install.py b/setup/install.py index 82b828be80..71fce72459 100644 --- a/setup/install.py +++ b/setup/install.py @@ -335,7 +335,7 @@ class Bootstrap(Command): description = 'Bootstrap a fresh checkout of calibre from git to a state where it can be installed. Requires various development tools/libraries/headers' TRANSLATIONS_REPO = 'https://github.com/kovidgoyal/calibre-translations.git' - sub_commands = 'build iso639 iso3166 translations gui resources cacerts recent_uas mathjax'.split() + sub_commands = 'build iso639 iso3166 translations gui resources cacerts recent_uas'.split() def add_options(self, parser): parser.add_option('--ephemeral', default=False, action='store_true', From d08e0a33e1dcefad0ea558c42d3323926663c651 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 4 Jan 2019 22:15:26 +0530 Subject: [PATCH 0116/2613] Implement clean for mathjax builder --- setup/mathjax.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/setup/mathjax.py b/setup/mathjax.py index 5a49f07ce9..561d161433 100644 --- a/setup/mathjax.py +++ b/setup/mathjax.py @@ -9,9 +9,9 @@ __docformat__ = 'restructuredtext en' import os, shutil, json from io import BytesIO -from zipfile import ZipFile, ZIP_STORED, ZipInfo +from zipfile import ZipFile from hashlib import sha1 -from tempfile import mkdtemp, SpooledTemporaryFile +from tempfile import mkdtemp from setup import Command, download_securely @@ -54,12 +54,15 @@ class MathJax(Command): name = prefix + '/' + os.path.relpath(f, base).replace(os.sep, '/') self.add_file(f, name) - def run(self, opts): - self.h = sha1() + def clean(self): self.mathjax_dir = self.j(self.RESOURCES, 'mathjax') - self.mathjax_files = {} if os.path.exists(self.mathjax_dir): shutil.rmtree(self.mathjax_dir) + + def run(self, opts): + self.h = sha1() + self.mathjax_files = {} + self.clean() os.mkdir(self.mathjax_dir) tdir = mkdtemp('calibre-mathjax-build') try: From 77ccbc4cf6a419759b8c34e478f01b1b03f0de0e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 5 Jan 2019 09:27:34 +0530 Subject: [PATCH 0117/2613] Add buttons to easily select all/none in the configuration window for the book details popup. Fixes #1786663 [Add option to hide details in the Book details window](https://bugs.launchpad.net/calibre/+bug/1786663) --- src/calibre/gui2/dialogs/book_info.py | 10 ++++++++++ src/calibre/gui2/preferences/look_feel.py | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/src/calibre/gui2/dialogs/book_info.py b/src/calibre/gui2/dialogs/book_info.py index e82ee95c0f..2871c85615 100644 --- a/src/calibre/gui2/dialogs/book_info.py +++ b/src/calibre/gui2/dialogs/book_info.py @@ -55,9 +55,19 @@ class Configure(Dialog): b = self.bb.addButton(_('Restore &defaults'), self.bb.ActionRole) b.clicked.connect(self.restore_defaults) + b = self.bb.addButton(_('Select &all'), self.bb.ActionRole) + b.clicked.connect(self.select_all) + b = self.bb.addButton(_('Select &none'), self.bb.ActionRole) + b.clicked.connect(self.select_none) self.l.addWidget(self.bb) self.setMinimumHeight(500) + def select_all(self): + self.model.toggle_all(True) + + def select_none(self): + self.model.toggle_all(False) + def restore_defaults(self): self.model.initialize(use_defaults=True) diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py index ff93430c19..7a771b3202 100644 --- a/src/calibre/gui2/preferences/look_feel.py +++ b/src/calibre/gui2/preferences/look_feel.py @@ -256,6 +256,12 @@ class DisplayedFields(QAbstractListModel): # {{{ return QIcon(I('column.png')) return None + def toggle_all(self, show=True): + for i in range(self.rowCount()): + idx = self.index(i) + if idx.isValid(): + self.setData(idx, show, Qt.CheckStateRole) + def flags(self, index): ans = QAbstractListModel.flags(self, index) return ans | Qt.ItemIsUserCheckable From 7fa1b3ffc0bb71435cc6dc4937d03b82a3225d1d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 5 Jan 2019 09:30:46 +0530 Subject: [PATCH 0118/2613] Fix #1810552 [Request: Highlight last library when removing libraries](https://bugs.launchpad.net/calibre/+bug/1810552) --- src/calibre/gui2/actions/choose_library.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/gui2/actions/choose_library.py b/src/calibre/gui2/actions/choose_library.py index 886b9bad05..3a85bb44dc 100644 --- a/src/calibre/gui2/actions/choose_library.py +++ b/src/calibre/gui2/actions/choose_library.py @@ -374,6 +374,8 @@ class ChooseLibraryAction(InterfaceAction): name, loc))) delete_actions.append(ac) ac.setStatusTip(_('Remove: %s') % loc) + if is_prev_lib: + ac.setFont(f) qs_actions = [] locations_by_frequency = locations From cd69272e7d6217200eaf772c9a59bddaa1ffde5d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 6 Jan 2019 09:07:52 +0530 Subject: [PATCH 0119/2613] Ignore invalid keys when applying saved sort order --- src/calibre/gui2/library/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index 7a221c3229..d247ef3617 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -655,7 +655,10 @@ class BooksView(QTableView): # {{{ if self.is_library_view: for col, order in reversed(self.cleanup_sort_history( saved_history, ignore_column_map=True)[:max_sort_levels]): - self.sort_by_named_field(col, order) + try: + self.sort_by_named_field(col, order) + except KeyError: + pass else: for col, order in reversed(self.cleanup_sort_history( saved_history)[:max_sort_levels]): From e5e558b456846262c571e3c005f996c2b9e5f42a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 6 Jan 2019 21:31:03 +0530 Subject: [PATCH 0120/2613] Clarify how to use custom columns int he server custom book list template --- src/calibre/gui2/preferences/server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/preferences/server.py b/src/calibre/gui2/preferences/server.py index 528d5fbeca..f3b87fe1ba 100644 --- a/src/calibre/gui2/preferences/server.py +++ b/src/calibre/gui2/preferences/server.py @@ -834,7 +834,8 @@ class CustomList(QWidget): # {{{ self.la1 = la = QLabel('

' + _( 'The template below will be interpreted as HTML and all {{fields}} will be replaced' - ' by the actual metadata, if available. You can use {0} as a separator' + ' by the actual metadata, if available. For custom columns use the column lookup' + ' name, for example: #mytags. You can use {0} as a separator' ' to split a line into multiple columns.').format('|||')) la.setWordWrap(True) l.addRow(la) From d59dff1fb4781aa7a7d8a3b4b1212695cee00b7f Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Sun, 6 Jan 2019 17:19:30 +0000 Subject: [PATCH 0121/2613] Fix /opds not respecting the 'advanced' displayed_fields option (Restrict displayed user-defined fields). --- src/calibre/srv/opds.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/srv/opds.py b/src/calibre/srv/opds.py index 903a1fd54b..c5320319cf 100644 --- a/src/calibre/srv/opds.py +++ b/src/calibre/srv/opds.py @@ -492,6 +492,8 @@ def opds(ctx, rd): return x for category in sorted(categories, key=lambda x: sort_key(getter(x))): + if not rc.ctx.is_field_displayable(category): + continue if len(categories[category]) == 0: continue if category in ('formats', 'identifiers'): From 7f6bc637339d98e3101e16be44e0785b6a949b4a Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Sun, 6 Jan 2019 21:07:30 +0000 Subject: [PATCH 0122/2613] Finish the fix for selecting custom fields in /opds --- src/calibre/srv/opds.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/srv/opds.py b/src/calibre/srv/opds.py index c5320319cf..be2fd0a4d3 100644 --- a/src/calibre/srv/opds.py +++ b/src/calibre/srv/opds.py @@ -491,8 +491,9 @@ def opds(ctx, rd): except KeyError: return x + fm = rc.db.field_metadata for category in sorted(categories, key=lambda x: sort_key(getter(x))): - if not rc.ctx.is_field_displayable(category): + if fm.is_ignorable_field(category) and not rc.ctx.is_field_displayable(category): continue if len(categories[category]) == 0: continue From cd2354c027bd1b5a39ba9dbbdece734a97c5521d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 7 Jan 2019 06:39:48 +0530 Subject: [PATCH 0123/2613] Forgot to add an entry about cssutils switching --- Changelog.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog.yaml b/Changelog.yaml index d6e3fc80f0..a2368f63ae 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -24,6 +24,8 @@ date: 2019-01-04 bug fixes: + - title: "Switch from cssutils to css_parser for parsing CSS. Fixes various minor long, standing bugs" + - title: "calibredb: Fix adding books from directories to a remote server running on Windows not working" - title: "Edit Book: Fix style attribute on tags not being preserved when editing AZW3 files." From 7ad1640b23ea8056622bdac59e8e49d9c9c94550 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 7 Jan 2019 06:47:04 +0530 Subject: [PATCH 0124/2613] ... --- Changelog.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.yaml b/Changelog.yaml index a2368f63ae..1c0dddf18b 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -24,7 +24,7 @@ date: 2019-01-04 bug fixes: - - title: "Switch from cssutils to css_parser for parsing CSS. Fixes various minor long, standing bugs" + - title: "Switch from cssutils to css_parser for parsing CSS. Fixes various minor, long standing bugs" - title: "calibredb: Fix adding books from directories to a remote server running on Windows not working" From 9774ed7413686c447ce4643e22b03d7f02bcf247 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 7 Jan 2019 23:32:02 +1100 Subject: [PATCH 0125/2613] Catch exception if the series index is somehow None I can't see how you can get to this line with the series index not set, but someone has, and it should have been done this way for safety. --- src/calibre/devices/kobo/driver.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index ab4ed4b795..308900ceda 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -3033,7 +3033,7 @@ class KOBOTOUCH(KOBO): series_changed = not (newmi.series == kobo_metadata.series) series_number_changed = False - if kobo_metadata.series_index: + if kobo_metadata.series_index is not None: try: kobo_series_number = float(book.kobo_series_number) except: @@ -3041,9 +3041,12 @@ class KOBOTOUCH(KOBO): series_number_changed = not (kobo_series_number == newmi.series_index) if series_changed or series_number_changed: - if newmi.series: + if newmi.series is not None: new_series = newmi.series - new_series_number = "%g" % newmi.series_index + try: + new_series_number = "%g" % newmi.series_index + except: + new_series_number = None else: new_series = None new_series_number = None From 4e66140e8a94afe9fb72bf3dad2ee338c7b6f2a4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 7 Jan 2019 20:09:44 +0530 Subject: [PATCH 0126/2613] ... --- src/calibre/devices/kobo/driver.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 308900ceda..57de76ec7c 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -1,7 +1,6 @@ #!/usr/bin/env python2 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai -from __future__ import division -from __future__ import print_function +from __future__ import print_function, division __license__ = 'GPL v3' __copyright__ = '2010-2012, Timothy Legge , Kovid Goyal and David Forrester ' From 041ebc3edfd5f43e47c7e4c193969df149897120 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 9 Jan 2019 09:57:25 +0530 Subject: [PATCH 0127/2613] Nicer way to get the current SciAm issue --- recipes/scientific_american.recipe | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/recipes/scientific_american.recipe b/recipes/scientific_american.recipe index 32ce75f5df..544f24ea3c 100644 --- a/recipes/scientific_american.recipe +++ b/recipes/scientific_american.recipe @@ -2,7 +2,6 @@ __license__ = 'GPL v3' from calibre.web.feeds.news import BasicNewsRecipe -from calibre.utils.date import now from css_selectors import Select @@ -11,6 +10,7 @@ def absurl(url): url = 'http://www.scientificamerican.com' + url return url + keep_classes = {'article-header', 'article-content', 'article-media', 'article-author', 'article-text'} remove_classes = {'aside-banner', 'moreToExplore', 'article-footer'} @@ -55,18 +55,8 @@ class ScientificAmerican(BasicNewsRecipe): root = self.index_to_soup( 'http://www.scientificamerican.com/sciammag/', as_tree=True) select = Select(root) - for a in select('#sa_body .store-listing__img a[href]'): - url = absurl(a.get('href')) - month = int(filter(None, url.split('/'))[-1].partition('-')[0]) - if month > now().month: - continue - for source in a.xpath('descendant::source'): - self.cover_url = absurl(source.get('srcset').split()[0]) - break - break - else: - raise ValueError( - 'The Scientific American website has changed, this recipe needs to be updated') + url = [x.get('content', '') for x in select('html > head meta') if x.get('property',None) == "og:url"][0] + self.cover_url = [x.get('src', '') for x in select('main .product-detail__image picture img')][0] # Now parse the actual issue to get the list of articles select = Select(self.index_to_soup(url, as_tree=True)) From ec7a9059aeff73902671255a6c1323feea361e28 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 9 Jan 2019 10:09:23 +0530 Subject: [PATCH 0128/2613] Nature by Jose Ortiz --- recipes/nature.recipe | 77 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 recipes/nature.recipe diff --git a/recipes/nature.recipe b/recipes/nature.recipe new file mode 100644 index 0000000000..b384d13e23 --- /dev/null +++ b/recipes/nature.recipe @@ -0,0 +1,77 @@ +#!/usr/bin/env python2 + +from collections import defaultdict +from calibre.web.feeds.news import BasicNewsRecipe + +BASE = 'https://www.nature.com' + + +def absurl(url): + if url.startswith('/'): + url = BASE + url + elif url.startswith('http://'): + url = 'https' + url[4:] + return url + + +def check_words(words): + return lambda x: x and frozenset(words.split()).intersection(x.split()) + + +class Nature(BasicNewsRecipe): + title = 'Nature' + __author__ = 'Jose Ortiz' + description = ('Nature is a weekly international multidisciplinary scientific journal' + ' publishing peer-reviewed research in all fields of science and' + ' technology on the basis of its originality, importance,' + ' interdisciplinary interest, timeliness, accessibility, elegance and' + ' surprising conclusions. Nature also provides rapid, authoritative,' + ' insightful and arresting news and interpretation of topical and coming' + ' trends affecting science, scientists and the wider public.') + language = 'en' + encoding = 'UTF-8' + no_javascript = True + no_stylesheets = True + + keep_only_tags = [ + dict(name='div',attrs={'data-component' : check_words('article-container')}) + ] + + remove_tags = [ + dict(attrs={'class' : check_words('hide-print')}) + ] + + def parse_index(self): + soup = self.index_to_soup(BASE + '/nature/current-issue') + self.cover_url = 'https:' + soup.find('img',attrs={'data-test' : 'issue-cover-image'})['src'] + section_tags = soup.find('div', {'data-container-type' : check_words('issue-section-list')}) + section_tags = section_tags.findAll('div', {'class' : check_words('article-section')}) + + sections = defaultdict(list) + ordered_sec_titles = [] + index = [] + + for sec in section_tags: + sec_title = self.tag_to_string(sec.find('h2')) + ordered_sec_titles.append(sec_title) + for article in sec.findAll('article'): + title = self.tag_to_string(article.find('h3', {'itemprop' : check_words('name headline')})) + date = ' [' + self.tag_to_string(article.find('time', {'itemprop' : check_words('datePublished')})) + ']' + author = self.tag_to_string(article.find('li', {'itemprop' : check_words('creator')})) + url = absurl(article.find('a',{'itemprop' : check_words('url')})['href']) + label = self.tag_to_string(article.find(attrs={'data-test' : check_words('article.type')})) + description = label + ': ' + self.tag_to_string(article.find('div', attrs={'itemprop' : check_words('description')})) + sections[sec_title].append( + {'title' : title, 'url' : url, 'description' : description, 'date' : date, 'author' : author}) + + for k in ordered_sec_titles: + index.append((k, sections[k])) + return index + + def preprocess_html(self, soup): + for img in soup.findAll('img',{'data-src' : True}): + if img['data-src'].startswith('//'): + img['src'] = 'https:' + img['data-src'] + else: + img['src'] = img['data-src'] + return soup From dbf8c10e4c08872e149a59265f800c7d6d3ba8b7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 10 Jan 2019 16:06:35 +0530 Subject: [PATCH 0129/2613] Subset fonts: Fix error when trying to subset unicode characters that require two UTF-16 code points on Windows. Fixes #1811224 [Can not subset embed fonts for a epub with "wide" Unicode char](https://bugs.launchpad.net/calibre/+bug/1811224) --- src/calibre/utils/fonts/sfnt/subset.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/calibre/utils/fonts/sfnt/subset.py b/src/calibre/utils/fonts/sfnt/subset.py index 69f0e7af0e..8c7b5901a5 100644 --- a/src/calibre/utils/fonts/sfnt/subset.py +++ b/src/calibre/utils/fonts/sfnt/subset.py @@ -12,7 +12,7 @@ from collections import OrderedDict from operator import itemgetter from functools import partial -from calibre.utils.icu import safe_chr +from calibre.utils.icu import safe_chr, ord_string from calibre.utils.fonts.sfnt.container import Sfnt from calibre.utils.fonts.sfnt.errors import UnsupportedFont, NoGlyphs @@ -105,16 +105,20 @@ def pdf_subset(sfnt, glyphs): 'or PostScript outlines') +def safe_ord(x): + return ord_string(unicode(x))[0] + + def subset(raw, individual_chars, ranges=(), warnings=None): warn = partial(do_warn, warnings) - chars = set(map(ord, individual_chars)) + chars = set(map(safe_ord, individual_chars)) for r in ranges: - chars |= set(xrange(ord(r[0]), ord(r[1])+1)) + chars |= set(xrange(safe_ord(r[0]), safe_ord(r[1])+1)) # Always add the space character for ease of use from the command line - if ord(' ') not in chars: - chars.add(ord(' ')) + if safe_ord(' ') not in chars: + chars.add(safe_ord(' ')) sfnt = Sfnt(raw) old_sizes = sfnt.sizes() From c1bd466d07f471d6f7864eb278a091a7b9941f95 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 14 Jan 2019 08:25:54 +0530 Subject: [PATCH 0130/2613] Better fix for polish progress bar --- src/calibre/gui2/actions/polish.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/actions/polish.py b/src/calibre/gui2/actions/polish.py index 65e98596a8..d4eddd1c70 100644 --- a/src/calibre/gui2/actions/polish.py +++ b/src/calibre/gui2/actions/polish.py @@ -258,14 +258,14 @@ class Polish(QDialog): # {{{ self.jobs = [] self.pd.reject() return - num, book_id = self.queue.pop() + num, book_id = self.queue.pop(0) try: self.do_book(num, book_id, self.book_id_map[book_id]) except: self.pd.reject() raise else: - self.pd.set_value(self.pd.max - num) + self.pd.set_value(num) QTimer.singleShot(0, self.do_one) def do_book(self, num, book_id, formats): @@ -291,7 +291,7 @@ class Polish(QDialog): # {{{ desc = ngettext(_('Polish %s')%mi.title, _('Polish book %(nums)s of %(tot)s (%(title)s)')%dict( - nums=num, tot=len(self.book_id_map), + nums=self.pd.max - num, tot=len(self.book_id_map), title=mi.title), len(self.book_id_map)) if hasattr(self, 'pd'): self.pd.set_msg(_('Queueing book %(nums)s of %(tot)s (%(title)s)')%dict( From 469b633e7e35d58d86b490dafda3988a635bfe7b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 14 Jan 2019 08:37:21 +0530 Subject: [PATCH 0131/2613] EPUB/MOBI Catalogs: Fix exclusion by tag not working for tags that have spaces in them --- src/calibre/library/catalogs/epub_mobi_builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/library/catalogs/epub_mobi_builder.py b/src/calibre/library/catalogs/epub_mobi_builder.py index bf0e00dd66..9d114a9170 100644 --- a/src/calibre/library/catalogs/epub_mobi_builder.py +++ b/src/calibre/library/catalogs/epub_mobi_builder.py @@ -1021,7 +1021,7 @@ class CatalogBuilder(object): if self.excluded_tags: search_terms = [] for tag in self.excluded_tags: - search_terms.append("tag:=%s" % tag) + search_terms.append('tags:"=%s"' % tag) search_phrase = "not (%s)" % " or ".join(search_terms) # If a list of ids are provided, don't use search_text From b53f33db0e3d5ca688e75b51f0bc0e4cd837c176 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 14 Jan 2019 08:39:58 +0530 Subject: [PATCH 0132/2613] EPUB/MOBI Catalogs: Fix prefix rules not working when calibre UI language is something other than English --- src/calibre/library/catalogs/epub_mobi_builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/library/catalogs/epub_mobi_builder.py b/src/calibre/library/catalogs/epub_mobi_builder.py index 9d114a9170..fb305b9db7 100644 --- a/src/calibre/library/catalogs/epub_mobi_builder.py +++ b/src/calibre/library/catalogs/epub_mobi_builder.py @@ -581,7 +581,7 @@ class CatalogBuilder(object): # Compare the record to each rule looking for a match for rule in self.prefix_rules: # Literal comparison for Tags field - if rule['field'].lower() == 'tags': + if rule['field'].lower() == 'tags' or rule['field'] == _('Tags'): if rule['pattern'].lower() in map(unicode.lower, record['tags']): if self.DEBUG and self.opts.verbose: self.opts.log.info(" %s '%s' by %s (%s: Tags includes '%s')" % From 57438b58ef465a75ee058f7ae12987f88a632be5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 14 Jan 2019 15:17:25 +0530 Subject: [PATCH 0133/2613] DOCX Output: Fix heading styles that have the same font size as body text getting incorrect font sizes after conversion. Fixes #1811616 [Word to EPUB changes size of Heading 2 style](https://bugs.launchpad.net/calibre/+bug/1811616) --- src/calibre/ebooks/docx/styles.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/docx/styles.py b/src/calibre/ebooks/docx/styles.py index b995897ccd..d4dbf7e6f3 100644 --- a/src/calibre/ebooks/docx/styles.py +++ b/src/calibre/ebooks/docx/styles.py @@ -445,8 +445,9 @@ class Styles(object): /* In word all paragraphs have zero margins unless explicitly specified in a style */ p, h1, h2, h3, h4, h5, h6, div { margin: 0; padding: 0 } - /* In word headings only have bold font if explicitly specified */ - h1, h2, h3, h4, h5, h6 { font-weight: normal } + /* In word headings only have bold font if explicitly specified, + similarly the font size is the body font size, unless explicitly set. */ + h1, h2, h3, h4, h5, h6 { font-weight: normal; font-size: 1rem } /* Setting padding-left to zero breaks rendering of lists, so we only set the other values to zero and leave padding-left for the user-agent */ ul, ol { margin: 0; padding-top: 0; padding-bottom: 0; padding-right: 0 } From 087012501909c81634e1dab074655c8f66957c9b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 14 Jan 2019 18:34:13 +0530 Subject: [PATCH 0134/2613] Edit book: Add a convenience function to jump to the line corresponding to a cfi To use, boss.show_partial_cfi_in_editor(filename, cfi) --- src/calibre/ebooks/epub/cfi/parse.py | 37 ++++++++++++++++++++++++++++ src/calibre/ebooks/epub/cfi/tests.py | 36 ++++++++++++++++++++++++++- src/calibre/gui2/tweak_book/boss.py | 18 ++++++++++++++ 3 files changed, 90 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/epub/cfi/parse.py b/src/calibre/ebooks/epub/cfi/parse.py index 74c6a98599..25c4f688af 100644 --- a/src/calibre/ebooks/epub/cfi/parse.py +++ b/src/calibre/ebooks/epub/cfi/parse.py @@ -204,3 +204,40 @@ def cfi_sort_key(cfi, only_path=True): step = steps[-1] if steps else {} offsets = (step.get('temporal_offset', 0), tuple(reversed(step.get('spatial_offset', (0, 0)))), step.get('text_offset', 0), ) return (step_nums, offsets) + + +def decode_cfi(root, cfi): + from lxml.etree import XPathEvalError + p = parser() + try: + pcfi = p.parse_path(cfi)[0] + except Exception: + import traceback + traceback.print_exc() + return + if not pcfi: + import sys + print ('Failed to parse CFI: %r' % pcfi, file=sys.stderr) + return + steps = get_steps(pcfi) + ans = root + for step in steps: + num = step.get('num', 0) + node_id = step.get('id') + try: + match = ans.xpath('descendant::*[@id="%s"]' % node_id) + except XPathEvalError: + match = () + if match: + ans = match[0] + continue + index = 0 + for child in ans.iterchildren('*'): + index |= 1 # increment index by 1 if it is even + index += 1 + if index == num: + ans = child + break + else: + return + return ans diff --git a/src/calibre/ebooks/epub/cfi/tests.py b/src/calibre/ebooks/epub/cfi/tests.py index 88baac1f2e..969e69536d 100644 --- a/src/calibre/ebooks/epub/cfi/tests.py +++ b/src/calibre/ebooks/epub/cfi/tests.py @@ -9,7 +9,7 @@ __copyright__ = '2014, Kovid Goyal ' import unittest from polyglot.builtins import map -from calibre.ebooks.epub.cfi.parse import parser, cfi_sort_key +from calibre.ebooks.epub.cfi.parse import parser, cfi_sort_key, decode_cfi class Tests(unittest.TestCase): @@ -96,6 +96,40 @@ class Tests(unittest.TestCase): ]: self.assertEqual(p.parse_path(raw), (path, leftover)) + def test_cfi_decode(self): + from calibre.ebooks.oeb.polish.parsing import parse + root = parse(''' + + + +

+

+

+

+

xxxyyy0123456789

+

+

+ … +

+

hellogoodbyetext hereadieutext there

+ + +''', line_numbers=True, linenumber_attribute='data-lnum') + body = root[-1] + + def test(cfi, expected): + self.assertIs(decode_cfi(root, cfi), expected) + + for cfi in '/4 /4[body01] /900[body01] /2[body01]'.split(): + test(cfi, body) + + for i in range(len(body)): + test('/4/{}'.format((i + 1)*2), body[i]) + + p = body[4] + test('/4/999[para05]', p) + test('/4/999[para05]/2', p[0]) + def find_tests(): return unittest.TestLoader().loadTestsFromTestCase(Tests) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index 40ab7a165d..f1f4e27054 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -1404,6 +1404,24 @@ class Boss(QObject): if name is not None and getattr(ed, 'syntax', None) == 'html': self.gui.preview.sync_to_editor(name, ed.current_tag()) + def show_partial_cfi_in_editor(self, name, cfi): + editor = self.edit_file(name, 'html') + if not editor or not editor.has_line_numbers: + return False + from calibre.ebooks.oeb.polish.parsing import parse + from calibre.ebooks.epub.cfi.parse import decode_cfi + root = parse( + editor.get_raw_data(), decoder=lambda x: x.decode('utf-8'), + line_numbers=True, linenumber_attribute='data-lnum') + node = decode_cfi(root, cfi) + if node is not None: + lnum = node.get('data-lnum') + if lnum: + lnum = int(lnum) + editor.current_line = lnum + return True + return False + def goto_style_declaration(self, data): name = data['name'] editor = self.edit_file(name, syntax=data['syntax']) From b00246070eddbefbac582d76ba7361b2086e1758 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 16 Jan 2019 09:57:52 +0530 Subject: [PATCH 0135/2613] Add a test for dual stack sockets --- src/calibre/srv/tests/base.py | 6 ++++-- src/calibre/srv/tests/loop.py | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/calibre/srv/tests/base.py b/src/calibre/srv/tests/base.py index ddc0f19aa6..e62dcc605d 100644 --- a/src/calibre/srv/tests/base.py +++ b/src/calibre/srv/tests/base.py @@ -115,10 +115,12 @@ class TestServer(Thread): self.loop.stop() self.join(self.loop.opts.shutdown_timeout) - def connect(self, timeout=None): + def connect(self, timeout=None, interface=None): if timeout is None: timeout = self.loop.opts.timeout - return httplib.HTTPConnection(self.address[0], self.address[1], strict=True, timeout=timeout) + if interface is None: + interface = self.address[0] + return httplib.HTTPConnection(interface, self.address[1], strict=True, timeout=timeout) def change_handler(self, handler): from calibre.srv.http_response import create_http_handler diff --git a/src/calibre/srv/tests/loop.py b/src/calibre/srv/tests/loop.py index ff72a0cf3a..a3b1dbb962 100644 --- a/src/calibre/srv/tests/loop.py +++ b/src/calibre/srv/tests/loop.py @@ -126,6 +126,17 @@ class LoopTest(BaseTest): self.assertTrue(b.stopped.wait(5), 'BonJour not stopped') + def test_dual_stack(self): + with TestServer(lambda data:(data.path[0] + data.read()), listen_on='::') as server: + self.ae(server.address[0], '::') + self.ae(server.loop.socket.getsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY), 0) + for interface in ('::1', '127.0.0.1'): + conn = server.connect(interface=interface) + conn.request('GET', '/test', 'body') + r = conn.getresponse() + self.ae(r.status, httplib.OK) + self.ae(r.read(), b'testbody') + def test_ring_buffer(self): 'Test the ring buffer used for reads' class FakeSocket(object): From 5eafba6889de2afe1fdcd9b2ec3910f524d0366e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 16 Jan 2019 10:10:36 +0530 Subject: [PATCH 0136/2613] Content server: Fix dual stack sockets not working on Windows --- src/calibre/srv/loop.py | 4 ++-- src/calibre/srv/tests/loop.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/calibre/srv/loop.py b/src/calibre/srv/loop.py index 2d489b7c5a..1a60c1adc3 100644 --- a/src/calibre/srv/loop.py +++ b/src/calibre/srv/loop.py @@ -28,6 +28,7 @@ from calibre.utils.mdns import get_external_ip READ, WRITE, RDWR, WAIT = 'READ', 'WRITE', 'RDWR', 'WAIT' WAKEUP, JOB_DONE = bytes(bytearray(xrange(2))) +IPPROTO_IPV6 = getattr(socket, "IPPROTO_IPV6", 41) class ReadBuffer(object): # {{{ @@ -485,8 +486,7 @@ class ServerLoop(object): if (hasattr(socket, 'AF_INET6') and self.socket.family == socket.AF_INET6 and self.bind_address[0] in ('::', '::0', '::0.0.0.0')): try: - self.socket.setsockopt( - socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0) + self.socket.setsockopt(IPPROTO_IPV6, socket.IPV6_V6ONLY, 0) except (AttributeError, socket.error): # Apparently, the socket option is not available in # this machine's TCP stack diff --git a/src/calibre/srv/tests/loop.py b/src/calibre/srv/tests/loop.py index a3b1dbb962..695f8f85b7 100644 --- a/src/calibre/srv/tests/loop.py +++ b/src/calibre/srv/tests/loop.py @@ -127,15 +127,18 @@ class LoopTest(BaseTest): self.assertTrue(b.stopped.wait(5), 'BonJour not stopped') def test_dual_stack(self): + from calibre.srv.loop import IPPROTO_IPV6 with TestServer(lambda data:(data.path[0] + data.read()), listen_on='::') as server: self.ae(server.address[0], '::') - self.ae(server.loop.socket.getsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY), 0) + self.ae(server.loop.socket.getsockopt(IPPROTO_IPV6, socket.IPV6_V6ONLY), 0) for interface in ('::1', '127.0.0.1'): conn = server.connect(interface=interface) conn.request('GET', '/test', 'body') r = conn.getresponse() self.ae(r.status, httplib.OK) self.ae(r.read(), b'testbody') + r.close() + conn.close() def test_ring_buffer(self): 'Test the ring buffer used for reads' From 57724b67b6c2b9d4a53e4f7f500230fcc9539ccf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 16 Jan 2019 10:19:44 +0530 Subject: [PATCH 0137/2613] Modify dual stack test to account for sadness of Travis --- src/calibre/srv/tests/loop.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/calibre/srv/tests/loop.py b/src/calibre/srv/tests/loop.py index 695f8f85b7..bed3820e29 100644 --- a/src/calibre/srv/tests/loop.py +++ b/src/calibre/srv/tests/loop.py @@ -131,14 +131,11 @@ class LoopTest(BaseTest): with TestServer(lambda data:(data.path[0] + data.read()), listen_on='::') as server: self.ae(server.address[0], '::') self.ae(server.loop.socket.getsockopt(IPPROTO_IPV6, socket.IPV6_V6ONLY), 0) - for interface in ('::1', '127.0.0.1'): - conn = server.connect(interface=interface) - conn.request('GET', '/test', 'body') - r = conn.getresponse() - self.ae(r.status, httplib.OK) - self.ae(r.read(), b'testbody') - r.close() - conn.close() + conn = server.connect(interface='127.0.0.1') + conn.request('GET', '/test', 'body') + r = conn.getresponse() + self.ae(r.status, httplib.OK) + self.ae(r.read(), b'testbody') def test_ring_buffer(self): 'Test the ring buffer used for reads' From 4344028bfc8821285a6979dc43adde5179cc8945 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 16 Jan 2019 10:43:36 +0530 Subject: [PATCH 0138/2613] Tag browser: When using the Find function have unaccented characters match their accented equivalents, if the setting for it is set in Preferences->Searching --- src/calibre/gui2/tag_browser/model.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/tag_browser/model.py b/src/calibre/gui2/tag_browser/model.py index 3077a28969..c517228ffb 100644 --- a/src/calibre/gui2/tag_browser/model.py +++ b/src/calibre/gui2/tag_browser/model.py @@ -18,8 +18,8 @@ from calibre.constants import config_dir from calibre.ebooks.metadata import rating_to_stars from calibre.gui2 import gprefs, config, error_dialog, file_icon_provider from calibre.db.categories import Tag -from calibre.utils.config import tweaks -from calibre.utils.icu import sort_key, lower, strcmp, collation_order +from calibre.utils.config import tweaks, prefs +from calibre.utils.icu import sort_key, lower, strcmp, collation_order, primary_strcmp, primary_contains, contains from calibre.library.field_metadata import category_icon_map from calibre.gui2.dialogs.confirm_delete import confirm from calibre.utils.formatter import EvalFormatter @@ -1460,6 +1460,12 @@ class TagsModel(QAbstractItemModel): # {{{ self.path_found = None if start_path is None: start_path = [] + if prefs['use_primary_find_in_search']: + final_strcmp = primary_strcmp + final_contains = primary_contains + else: + final_strcmp = strcmp + final_contains = contains def process_tag(depth, tag_index, tag_item, start_path): path = self.path_for_index(tag_index) @@ -1469,8 +1475,8 @@ class TagsModel(QAbstractItemModel): # {{{ if tag is None: return False name = tag.original_name - if (equals_match and strcmp(name, txt) == 0) or \ - (not equals_match and lower(name).find(txt) >= 0): + if (equals_match and final_strcmp(name, txt) == 0) or \ + (not equals_match and final_contains(txt, name)): self.path_found = path return True for i,c in enumerate(tag_item.children): From ecb302fa0498d7918941f881f2330233a3582282 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 16 Jan 2019 19:29:06 +0530 Subject: [PATCH 0139/2613] Update New York Times Book Review --- recipes/nytimesbook.recipe | 56 ++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/recipes/nytimesbook.recipe b/recipes/nytimesbook.recipe index 2112226b31..afe5fe4e85 100644 --- a/recipes/nytimesbook.recipe +++ b/recipes/nytimesbook.recipe @@ -6,6 +6,12 @@ def classes(classes): return dict(attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)}) +def absolutize(url): + if url.startswith('/'): + url = 'https://www.nytimes.com' + url + return url + + class NewYorkTimesBookReview(BasicNewsRecipe): title = u'New York Times Book Review' language = 'en' @@ -18,42 +24,27 @@ class NewYorkTimesBookReview(BasicNewsRecipe): encoding = 'utf-8' keep_only_tags = [ - dict(id='story'), - ] - remove_tags = [ - dict(attrs={'aria-label':'tools'.split()}), - dict(attrs={'aria-label': lambda x: x and 'New York Times Logo' in x}), - dict(href='#site-content #site-index'.split()), - dict(attrs={'aria-hidden':'true'}), - dict(attrs={'data-videoid':True}), - dict(name='button meta link'.split()), - dict(id=lambda x: x and x.startswith('story-ad-')), - dict(name='head'), - dict(role='toolbar'), - dict(name='a', href=lambda x: x and '#story-continues-' in x), - dict(name='a', href=lambda x: x and '#whats-next' in x), - dict(id=lambda x: x and 'sharetools-' in x), - dict(id='newsletter-promo supported-by-ad bottom-wrapper'.split()), - classes('story-print-citation supported-by accessibility-ad-header visually-hidden bottom-of-article ad nav-wrapper'), - dict(attrs={'class': lambda x: x and ( - 'SectionBar' in x or 'recirculation' in x or 'ResponsiveAd' in x or 'accessibility-visuallyHidden' in x or 'RelatedCoverage' in x)}), + dict(name='h1'), + dict(attrs={'data-testid':'photoviewer-wrapper'}), + dict(itemprop=['author creator', 'articleBody']), ] def parse_index(self): soup = self.index_to_soup( - 'http://www.nytimes.com/pages/books/review/index.html') + 'https://www.nytimes.com/pages/books/review/index.html') # Find TOC - toc = soup.find('div', attrs={'class': 'rank'}) + toc = soup.find('section', id='collection-book-review').find('section').find('ol') main_articles, articles = [], [] feeds = [('Features', main_articles), ('Latest', articles)] - for h2 in toc.findAll('h2', attrs={'class': 'headline'}): + for li in toc.findAll('li'): + h2 = li.find('h2') a = h2.find('a', href=True) if a is not None: title = self.tag_to_string(a) - url = a['href'] + url = absolutize(a['href']) desc = '' - p = h2.findNextSibling('p', attrs={'class': 'summary'}) + p = h2.findNextSibling('p') if p: desc = self.tag_to_string(p) main_articles.append( @@ -61,14 +52,15 @@ class NewYorkTimesBookReview(BasicNewsRecipe): self.log('Found:', title, 'at', url) if desc: self.log('\t', desc) - for li in soup.find(id='latest-panel').find('ol').findAll('li'): - a = li.find('a', attrs={'class': 'story-link'}, href=True) - if a is None: - continue - url = a['href'] - m = a.find(attrs={'class': 'story-meta'}) - title = self.tag_to_string(m.find('h2')) - desc = self.tag_to_string(m.find(attrs={'class': 'summary'})) + for li in soup.find(id='stream-panel').find('ol').findAll('li'): + h2 = li.find('h2') + a = h2.findParent('a') + url = absolutize(a['href']) + p = h2.findNextSibling('p') + title = self.tag_to_string(h2) + desc = '' + if p: + desc = self.tag_to_string(p) articles.append({'title': title, 'url': url, 'description': desc}) self.log('Found:', title, 'at', url) if desc: From 473bff43e3f41c410caecb23945819c6d3e71ad2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Jan 2019 09:21:50 +0530 Subject: [PATCH 0140/2613] Fix exception when trying to read ajax responsetext in error handler --- src/pyj/ajax.pyj | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pyj/ajax.pyj b/src/pyj/ajax.pyj index 341ce5c95b..7a8c453e5e 100644 --- a/src/pyj/ajax.pyj +++ b/src/pyj/ajax.pyj @@ -77,7 +77,10 @@ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET', q elif event is 'abort': xhr.error_html = str.format(_('Failed to communicate with "{}", aborted'), xhr.request_path) else: - rtext = xhr.responseText or '' + try: + rtext = xhr.responseText or '' + except: + rtext = '' xhr.error_html = str.format(_('Failed to communicate with "{}", with status: [{}] {}

{}'), xhr.request_path, xhr.status, xhr.statusText, rtext[:200]) def progress_callback(ev): From 64ad30d9100194522d35a77acc8784da44f10020 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Jan 2019 09:25:55 +0530 Subject: [PATCH 0141/2613] Content server: Fix a regression in the previous release that broke viewing math ebooks in the browser viewer. Fixes #1810884 [recent changes to mathjax broke server](https://bugs.launchpad.net/calibre/+bug/1810884) --- src/calibre/srv/books.py | 4 ++-- src/calibre/utils/rapydscript.py | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/calibre/srv/books.py b/src/calibre/srv/books.py index eb59b425d7..db4567f53d 100644 --- a/src/calibre/srv/books.py +++ b/src/calibre/srv/books.py @@ -244,7 +244,7 @@ def mathjax(ctx, rd, which): return rd.etagged_dynamic_response(manifest['etag'], manifest_as_json, content_type='application/json; charset=UTF-8') if which not in manifest['files']: raise HTTPNotFound('No MathJax file named: %s' % which) - path = os.path.abspath(os.path.join(rd.tdir, 'mathjax', which)) - if not path.startswith(rd.tdir): + path = os.path.abspath(P('mathjax/' + which, allow_user_override=False)) + if not path.startswith(P('mathjax', allow_user_override=False)): raise HTTPNotFound('No MathJax file named: %s' % which) return rd.filesystem_file_with_constant_etag(lopen(path, 'rb'), manifest['etag']) diff --git a/src/calibre/utils/rapydscript.py b/src/calibre/utils/rapydscript.py index 8c7bfc5f1c..946be0f5a4 100644 --- a/src/calibre/utils/rapydscript.py +++ b/src/calibre/utils/rapydscript.py @@ -211,12 +211,7 @@ def compile_srv(): rb = os.path.join(base, 'src', 'calibre', 'srv', 'render_book.py') with lopen(rb, 'rb') as f: rv = str(int(re.search(br'^RENDER_VERSION\s+=\s+(\d+)', f.read(), re.M).group(1))) - try: - mathjax_version = P('content-server/mathjax.version', data=True, allow_user_override=False).decode('utf-8') - except EnvironmentError as e: - if e.errno != errno.ENOENT: - raise - mathjax_version = '0' + mathjax_version = json.loads(P('mathjax/manifest.json', data=True, allow_user_override=False))['etag'] base = os.path.join(base, 'resources', 'content-server') fname = os.path.join(rapydscript_dir, 'srv.pyj') with lopen(fname, 'rb') as f: From 2ae2d14d629888dfd3c5617ff604278c68501640 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Jan 2019 09:36:16 +0530 Subject: [PATCH 0142/2613] Rapydscript must be built after mathjax --- setup/resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/resources.py b/setup/resources.py index 8fea7c2512..1554b5551f 100644 --- a/setup/resources.py +++ b/setup/resources.py @@ -287,7 +287,7 @@ class RapydScript(Command): # {{{ class Resources(Command): # {{{ description = 'Compile various needed calibre resources' - sub_commands = ['kakasi', 'coffee', 'rapydscript', 'mathjax'] + sub_commands = ['kakasi', 'coffee', 'mathjax', 'rapydscript'] def run(self, opts): from calibre.utils.serialize import msgpack_dumps From 59daec163429c1d4c07830b9bdef1a12466eb3b6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Jan 2019 09:50:06 +0530 Subject: [PATCH 0143/2613] String changes --- Changelog.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Changelog.yaml b/Changelog.yaml index 1c0dddf18b..b8a731575c 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -65,7 +65,7 @@ bug fixes: - title: "Kobo driver: Fix a regression in the last release that caused book title -to appear as unknown if metadata management was set to manual in calibre." +to appear as Unknown if metadata management was set to manual in calibre." tickets: [1807914] - title: "PDF Output: Do not fail if one of the fonts from the source document has no name metadata" @@ -313,7 +313,7 @@ to appear as unknown if metadata management was set to manual in calibre." - title: "Content server: When defining a color scheme for the in browser viewer allow specifying the link color as well as the foreground and background." tickets: [1735904] - - title: "Edit book: Show a popup after a fix all html/beautify all files so the user can easily see what was changed, if needed." + - title: "Edit book: Show a popup after a fix all HTML/Beautify all files so the user can easily see what was changed, if needed." tickets: [1785482] - title: "Kindle driver: Create cover thumbnails on the device when transferring KFX format books" From b011cddc4a663c8443b9cfb909be462c038df6ae Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Jan 2019 10:08:43 +0530 Subject: [PATCH 0144/2613] Update Chicago Tribune --- recipes/chicago_tribune.recipe | 122 +++++++++------------------------ 1 file changed, 31 insertions(+), 91 deletions(-) diff --git a/recipes/chicago_tribune.recipe b/recipes/chicago_tribune.recipe index b005c1f675..9989128d85 100644 --- a/recipes/chicago_tribune.recipe +++ b/recipes/chicago_tribune.recipe @@ -6,92 +6,48 @@ __docformat__ = 'restructuredtext en' from calibre.web.feeds.news import BasicNewsRecipe +def classes(classes): + q = frozenset(classes.split(' ')) + return dict(attrs={ + 'class': lambda x: x and frozenset(x.split()).intersection(q)}) + + class ChicagoTribune(BasicNewsRecipe): title = 'Chicago Tribune' - __author__ = 'Kovid Goyal, Sujata Raman and a.peter' + __author__ = 'Kovid Goyal' description = 'Politics, local and business news from Chicago' language = 'en' - version = 2 - use_embedded_content = False no_stylesheets = True remove_javascript = True - recursions = 1 - keep_only_tags = [dict(name='div', attrs={'class': ["story", "entry-asset asset hentry"]}), - dict(name='div', attrs={ - 'id': ["pagebody", "story", "maincontentcontainer"]}), - ] - remove_tags_after = [{'class': ['photo_article', ]}] - remove_empty_feeds = True - - match_regexps = [r'page=[0-9]+'] - - remove_tags = [ - {'id': ["moduleArticleTools", "content-bottom", "rail", "articleRelates module", "toolSet", - "relatedrailcontent", "div-wrapper", "beta", "atp-comments", "footer", 'gallery-subcontent', 'subFooter']}, - {'class': ["clearfix", "relatedTitle", "articleRelates module", - "asset-footer", "tools", "comments", "featurePromo", "featurePromo fp-topjobs brownBackground", 'ndn_embed', - "clearfix fullSpan brownBackground", "curvedContent", 'nextgen-share-tools', 'outbrainTools', 'google-ad-story-bottom']}, - dict(name='font', attrs={'id': ["cr-other-headlines"]})] - extra_css = ''' - h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;} - h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;} - .byline {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} - .date {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;} - p{font-family:Arial,Helvetica,sans-serif;font-size:small;} - .copyright {font-family:Arial,Helvetica,sans-serif;font-size:xx-small;text-align:center} - .story{font-family:Arial,Helvetica,sans-serif;font-size:small;} - .entry-asset asset hentry{font-family:Arial,Helvetica,sans-serif;font-size:small;} - .pagebody{font-family:Arial,Helvetica,sans-serif;font-size:small;} - .maincontentcontainer{font-family:Arial,Helvetica,sans-serif;font-size:small;} - .story-body{font-family:Arial,Helvetica,sans-serif;font-size:small;} - body{font-family:Helvetica,Arial,sans-serif;font-size:small;} - ''' - feeds = [ - ('Latest news', 'http://feeds.chicagotribune.com/chicagotribune/news/'), - ('Local news', 'http://feeds.chicagotribune.com/chicagotribune/news/local/'), - ('Nation/world', 'http://feeds.chicagotribune.com/chicagotribune/news/nationworld/'), - ('Hot topics', 'http://feeds.chicagotribune.com/chicagotribune/hottopics/'), - ('Most E-mailed stories', 'http://feeds.chicagotribune.com/chicagotribune/email/'), - ('Opinion', 'http://feeds.chicagotribune.com/chicagotribune/opinion/'), - ('Off Topic', 'http://feeds.chicagotribune.com/chicagotribune/offtopic/'), - ('Politics', 'http://feeds.feedburner.com/chicagotribune/cloutstreet/'), - ('Business news', 'http://feeds.chicagotribune.com/chicagotribune/business/'), - ('Jobs and Careers', 'http://feeds.chicagotribune.com/chicagotribune/career/'), - ('Local scene', 'http://feeds.chicagotribune.com/chicagohomes/localscene/'), - ('Phil Rosenthal', 'http://feeds.chicagotribune.com/chicagotribune/rosenthal/'), - ('Your Money', 'http://feeds.chicagotribune.com/chicagotribune/yourmoney/'), - ('Jon Hilkevitch - Getting around', - 'http://feeds.chicagotribune.com/chicagotribune/gettingaround/'), - ('Jon Yates - What\'s your problem?', - 'http://feeds.chicagotribune.com/chicagotribune/problem/'), - ('Garisson Keillor', 'http://feeds.chicagotribune.com/chicagotribune/keillor/'), - ('Marks Jarvis - On Money', - 'http://feeds.chicagotribune.com/chicagotribune/marksjarvisonmoney/'), - ('Sports', 'http://feeds.chicagotribune.com/chicagotribune/sports/'), - ('Arts and Architecture', - 'http://feeds.chicagotribune.com/chicagotribune/arts/'), - ('Books', 'http://feeds.chicagotribune.com/chicagotribune/books/'), - ('Movies', 'http://feeds.chicagotribune.com/chicagotribune/movies/'), - ('Music', 'http://feeds.chicagotribune.com/chicagotribune/music/'), - ('TV', 'http://feeds.chicagotribune.com/chicagotribune/tv/'), - ('Hypertext', 'http://feeds.chicagotribune.com/chicagotribune/hypertext/'), - ('iPhone Blog', 'http://feeds.feedburner.com/redeye/iphoneblog'), - ('Julie\'s Health Club', - 'http://feeds.chicagotribune.com/chicagotribune_julieshealthclub/'), + keep_only_tags = [ + dict(name='h1'), + dict(attrs={'data-content-size': 'leadart'}), + dict(itemprop='articleBody'), ] - def get_article_url(self, article): - url = BasicNewsRecipe.get_article_url(self, article) - url = url.split('/')[-2] - encoding = {'0B': '.', '0C': '/', '0A': '0', '0F': '=', '0G': '&', - '0D': '?', '0E': '-', '0N': '.com', '0L': 'http://', '0S': - 'www.', '0I': '_', '0H': ','} - for k, v in encoding.iteritems(): - url = url.replace(k, v) - return url.partition('?')[0] + remove_tags = [ + classes('trb_ar_cont trb_ar_main_ad trb_em_r_cc'), + ] + + feeds = [ + ('Breaking news', 'https://www.chicagotribune.com/news/local/breaking/rss2.0.xml'), + ('Trending news', 'https://www.chicagotribune.com/news/trending/rss2.0.xml'), + ('Opinion', 'https://www.chicagotribune.com/news/opinion/rss2.0.xml'), + ('Business news', 'https://www.chicagotribune.com/business/rss2.0.xml'), + ('Sports', 'https://www.chicagotribune.com/sports/rss2.0.xml'), + ('Arts and Entertainment', + 'https://www.chicagotribune.com/entertainment/rss2.0.xml'), + ('Life & Style', + 'https://www.chicagotribune.com/lifestyles/rss2.0.xml'), + ] + + def preprocess_html(self, soup): + for img in soup.findAll('img', attrs={'data-baseurl': True}): + img['src'] = img['data-baseurl'] + return soup def skip_ad_pages(self, soup): text = soup.find(text='click here to continue to article') @@ -100,19 +56,3 @@ class ChicagoTribune(BasicNewsRecipe): url = a.get('href') if url: return self.index_to_soup(url, raw=True) - - def postprocess_html(self, soup, first_fetch): - # Remove the navigation bar. It was kept until now to be able to follow - # the links to further pages. But now we don't need them anymore. - for nav in soup.findAll(attrs={'class': ['toppaginate', 'article-nav clearfix']}): - nav.extract() - - for t in soup.findAll(['table', 'tr', 'td']): - t.name = 'div' - - for tag in soup.findAll('form', dict(attrs={'name': ["comments_form"]})): - tag.extract() - for tag in soup.findAll('font', dict(attrs={'id': ["cr-other-headlines"]})): - tag.extract() - - return soup From 32e5760eea9cc427cd97a23c6650124c2d6db58c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Jan 2019 10:39:53 +0530 Subject: [PATCH 0145/2613] Catalogs: Set the language of created catalogs to the calibre interface language instead of English Fixes #1810936 [Feature: language in metadata of created catalog set to calibre installation language](https://bugs.launchpad.net/calibre/+bug/1810936) --- src/calibre/library/catalogs/epub_mobi_builder.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/calibre/library/catalogs/epub_mobi_builder.py b/src/calibre/library/catalogs/epub_mobi_builder.py index fb305b9db7..0a4c2c981b 100644 --- a/src/calibre/library/catalogs/epub_mobi_builder.py +++ b/src/calibre/library/catalogs/epub_mobi_builder.py @@ -25,6 +25,7 @@ from calibre.utils.formatter import TemplateFormatter from calibre.utils.icu import capitalize, collation_order, sort_key from calibre.utils.img import scale_image from calibre.utils.zipfile import ZipFile +from calibre.utils.localization import get_lang, lang_as_iso639_1 class Formatter(TemplateFormatter): @@ -4014,19 +4015,22 @@ class CatalogBuilder(object): """ self.update_progress_full_step(_("Generating OPF")) + lang = get_lang() or 'en' + if lang_as_iso639_1(lang): + lang = lang_as_iso639_1(lang) header = ''' - en-US + LANG - ''' + '''.replace('LANG', lang) # Add the supplied metadata tags soup = BeautifulStoneSoup(header, selfClosingTags=['item', 'itemref', 'meta', 'reference']) metadata = soup.find('metadata') From 51e6cf8ac40bb46aab2afad20e6ef80e00fec200 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Jan 2019 11:39:01 +0530 Subject: [PATCH 0146/2613] Compress news images when downloading from chicago tribune --- recipes/chicago_tribune.recipe | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/chicago_tribune.recipe b/recipes/chicago_tribune.recipe index 9989128d85..72a651d96e 100644 --- a/recipes/chicago_tribune.recipe +++ b/recipes/chicago_tribune.recipe @@ -21,6 +21,8 @@ class ChicagoTribune(BasicNewsRecipe): use_embedded_content = False no_stylesheets = True remove_javascript = True + compress_news_images = True + compress_news_images_auto_size = 5 keep_only_tags = [ dict(name='h1'), From 78f093f1a3c3609c60790b1f5897037b003cc4bb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Jan 2019 12:10:50 +0530 Subject: [PATCH 0147/2613] DOCX Input: Do not display section breaks that have a numbering style applied to them. Fixes #1811611 [Word to EPUB adds a digit at the end of some chapters](https://bugs.launchpad.net/calibre/+bug/1811611) --- src/calibre/ebooks/docx/styles.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/docx/styles.py b/src/calibre/ebooks/docx/styles.py index d4dbf7e6f3..1b1847236d 100644 --- a/src/calibre/ebooks/docx/styles.py +++ b/src/calibre/ebooks/docx/styles.py @@ -213,12 +213,15 @@ class Styles(object): ans = self.para_cache[p] = ParagraphStyle(self.namespace) ans.style_name = None direct_formatting = None + is_section_break = False for pPr in self.namespace.XPath('./w:pPr')(p): ps = ParagraphStyle(self.namespace, pPr) if direct_formatting is None: direct_formatting = ps else: direct_formatting.update(ps) + if self.namespace.XPath('./w:sectPr')(pPr): + is_section_break = True if direct_formatting is None: direct_formatting = ParagraphStyle(self.namespace) @@ -246,7 +249,8 @@ class Styles(object): self.para_char_cache[p] = default_para.character_style is_numbering = direct_formatting.numbering is not inherit - if is_numbering: + is_section_break = is_section_break and not self.namespace.XPath('./w:r')(p) + if is_numbering and not is_section_break: num_id, lvl = direct_formatting.numbering if num_id is not None: p.set('calibre_num_id', '%s:%s' % (lvl, num_id)) @@ -254,7 +258,9 @@ class Styles(object): ps = self.numbering.get_para_style(num_id, lvl) if ps is not None: parent_styles.append(ps) - if not is_numbering and linked_style is not None and getattr(linked_style.paragraph_style, 'numbering', inherit) is not inherit: + if ( + not is_numbering and not is_section_break and linked_style is not None and getattr( + linked_style.paragraph_style, 'numbering', inherit) is not inherit): num_id, lvl = linked_style.paragraph_style.numbering if num_id is not None: p.set('calibre_num_id', '%s:%s' % (lvl, num_id)) From 31bf791ad66fe935721adde60778cd42f2a70afb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Jan 2019 15:04:51 +0530 Subject: [PATCH 0148/2613] DOCX Input: When converting indices, put each sub-entry on its own line. See #1811611 (Word to EPUB adds a digit at the end of some chapters) --- src/calibre/ebooks/docx/index.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/docx/index.py b/src/calibre/ebooks/docx/index.py index d7631bc4a0..b4bd00b792 100644 --- a/src/calibre/ebooks/docx/index.py +++ b/src/calibre/ebooks/docx/index.py @@ -59,9 +59,11 @@ def make_block(expand, style, parent, pos): def add_xe(xe, t, expand): - text = xe.get('text', '') + run = t.getparent() + idx = run.index(t) + t.text = xe.get('text') or ' ' pt = xe.get('page-number-text', None) - t.text = text or ' ' + if pt: p = t.getparent().getparent() r = p.makeelement(expand('w:r')) @@ -70,7 +72,9 @@ def add_xe(xe, t, expand): t2.set(expand('xml:space'), 'preserve') t2.text = ' [%s]' % pt r.append(t2) - return xe['anchor'], t.getparent() + # put separate entries on separate lines + run.insert(idx + 1, run.makeelement(expand('w:br'))) + return xe['anchor'], run def process_index(field, index, xe_fields, log, XPath, expand): @@ -139,6 +143,7 @@ def split_up_block(block, a, text, parts, ldict): span.append(a) ldict[span] = len(prefix) + """ The merge algorithm is a little tricky. We start with a list of elementary blocks. Each is an HtmlElement, a p node @@ -255,6 +260,9 @@ def polish_index_markup(index, blocks): span.append(a[0]) ldict[span] = 0 + for br in block.xpath('descendant::br'): + br.tail = None + # We want a single block for each main entry prev_block = blocks[0] for block in blocks[1:]: @@ -263,4 +271,3 @@ def polish_index_markup(index, blocks): merge_blocks(prev_block, block, 0, 0, pn, ldict) else: prev_block = block - From 13c4366e5172dcc30d4691462c414670a5d8517e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Jan 2019 15:26:52 +0530 Subject: [PATCH 0149/2613] Mark some vendored and generated files --- .gitattributes | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.gitattributes b/.gitattributes index 0d97bfac69..5d89af48ff 100644 --- a/.gitattributes +++ b/.gitattributes @@ -38,3 +38,16 @@ # Prevent certain files from being exported: .gitattributes export-ignore .gitignore export-ignore + +# Mark vendored files +resources/mathjax/* linguist-vendored=true +resources/coffee-script.js linguist-vendored=true +resources/csscolorparser.js linguist-vendored=true +resources/viewer/hyphen* linguist-vendored=true +resources/viewer/jquery* linguist-vendored=true + +# Mark generated files +resources/content-server/index-generated.html linguist-generated=true +resources/editor.js linguist-generated=true +resources/viewer.js linguist-generated=true +resources/viewer.html linguist-generated=true From 49ee941c6dea83cc1fae21dca39e7274a75f1971 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Jan 2019 20:11:21 +0530 Subject: [PATCH 0150/2613] PDF Output: Fix conversion failing when fonts with non-English names are used. Fixes #1812218 [convert to pdf failed](https://bugs.launchpad.net/calibre/+bug/1812218) --- src/calibre/ebooks/pdf/render/fonts.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/ebooks/pdf/render/fonts.py b/src/calibre/ebooks/pdf/render/fonts.py index 48b48fe919..19acaa8dc9 100644 --- a/src/calibre/ebooks/pdf/render/fonts.py +++ b/src/calibre/ebooks/pdf/render/fonts.py @@ -108,6 +108,10 @@ class CMap(Stream): for m in maps: meat = '\n'.join('%s %s'%(k, v) for k, v in m.iteritems()) mapping.append('%d beginbfchar\n%s\nendbfchar'%(len(m), meat)) + try: + name = name.encode('ascii').decode('ascii') + except Exception: + name = uuid4() self.write(self.skeleton.format(name=name, mapping='\n'.join(mapping))) From e4b3f75c27fe0ca52df38b38f9cf0b72e9c2d270 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Jan 2019 20:13:10 +0530 Subject: [PATCH 0151/2613] Remove duplicated import --- src/calibre/ebooks/pdf/render/fonts.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/calibre/ebooks/pdf/render/fonts.py b/src/calibre/ebooks/pdf/render/fonts.py index 19acaa8dc9..c31996eefc 100644 --- a/src/calibre/ebooks/pdf/render/fonts.py +++ b/src/calibre/ebooks/pdf/render/fonts.py @@ -188,7 +188,6 @@ class Font(object): try: name = self.metrics.postscript_name except KeyError: - from calibre.utils.short_uuid import uuid4 name = uuid4() cmap = CMap(name, self.metrics.glyph_map, compress=self.compress) self.font_dict['ToUnicode'] = objects.add(cmap) From 60e3bece0b533c1399260f8040dcfe0797817f61 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 18 Jan 2019 06:14:22 +0530 Subject: [PATCH 0152/2613] Update Nature --- recipes/nature.recipe | 82 +++++++++++++++++++++++++++++++------------ 1 file changed, 59 insertions(+), 23 deletions(-) diff --git a/recipes/nature.recipe b/recipes/nature.recipe index b384d13e23..d8af3dd1a6 100644 --- a/recipes/nature.recipe +++ b/recipes/nature.recipe @@ -18,34 +18,44 @@ def check_words(words): return lambda x: x and frozenset(words.split()).intersection(x.split()) +def has_all_of(words): + return lambda x: x and frozenset(words.split()).issubset(x.split()) + + class Nature(BasicNewsRecipe): title = 'Nature' __author__ = 'Jose Ortiz' - description = ('Nature is a weekly international multidisciplinary scientific journal' - ' publishing peer-reviewed research in all fields of science and' - ' technology on the basis of its originality, importance,' - ' interdisciplinary interest, timeliness, accessibility, elegance and' - ' surprising conclusions. Nature also provides rapid, authoritative,' - ' insightful and arresting news and interpretation of topical and coming' - ' trends affecting science, scientists and the wider public.') + description = ( + 'Nature is a weekly international multidisciplinary scientific journal' + ' publishing peer-reviewed research in all fields of science and' + ' technology on the basis of its originality, importance,' + ' interdisciplinary interest, timeliness, accessibility, elegance and' + ' surprising conclusions. Nauture also provides rapid, authoritative,' + ' insightful and arresting news and interpretation of topical and coming' + ' trends affecting science, scientists and the wider public.' + ) language = 'en' encoding = 'UTF-8' no_javascript = True no_stylesheets = True keep_only_tags = [ - dict(name='div',attrs={'data-component' : check_words('article-container')}) + dict(name='div', attrs={'data-component': check_words('article-container')}) ] - remove_tags = [ - dict(attrs={'class' : check_words('hide-print')}) - ] + remove_tags = [dict(attrs={'class': check_words('hide-print')})] def parse_index(self): soup = self.index_to_soup(BASE + '/nature/current-issue') - self.cover_url = 'https:' + soup.find('img',attrs={'data-test' : 'issue-cover-image'})['src'] - section_tags = soup.find('div', {'data-container-type' : check_words('issue-section-list')}) - section_tags = section_tags.findAll('div', {'class' : check_words('article-section')}) + self.cover_url = 'https:' + soup.find( + 'img', attrs={'data-test': check_words('issue-cover-image')} + )['src'] + section_tags = soup.find( + 'div', {'data-container-type': check_words('issue-section-list')} + ) + section_tags = section_tags.findAll( + 'div', {'class': check_words('article-section')} + ) sections = defaultdict(list) ordered_sec_titles = [] @@ -55,23 +65,49 @@ class Nature(BasicNewsRecipe): sec_title = self.tag_to_string(sec.find('h2')) ordered_sec_titles.append(sec_title) for article in sec.findAll('article'): - title = self.tag_to_string(article.find('h3', {'itemprop' : check_words('name headline')})) - date = ' [' + self.tag_to_string(article.find('time', {'itemprop' : check_words('datePublished')})) + ']' - author = self.tag_to_string(article.find('li', {'itemprop' : check_words('creator')})) - url = absurl(article.find('a',{'itemprop' : check_words('url')})['href']) - label = self.tag_to_string(article.find(attrs={'data-test' : check_words('article.type')})) - description = label + ': ' + self.tag_to_string(article.find('div', attrs={'itemprop' : check_words('description')})) - sections[sec_title].append( - {'title' : title, 'url' : url, 'description' : description, 'date' : date, 'author' : author}) + try: + url = absurl( + article.find('a', {'itemprop': check_words('url')})['href'] + ) + except TypeError: + continue + title = self.tag_to_string( + article.find('h3', {'itemprop': has_all_of('name headline')}) + ) + date = ' [' + self.tag_to_string( + article.find('time', {'itemprop': check_words('datePublished')}) + ) + ']' + author = self.tag_to_string( + article.find('li', {'itemprop': check_words('creator')}) + ) + description = self.tag_to_string( + article.find(attrs={'data-test': check_words('article.type')}) + ) + u' • ' + description += self.tag_to_string( + article.find( + 'div', attrs={'itemprop': check_words('description')} + ) + ) + sections[sec_title].append({ + 'title': title, + 'url': url, + 'description': description, + 'date': date, + 'author': author + }) for k in ordered_sec_titles: index.append((k, sections[k])) return index def preprocess_html(self, soup): - for img in soup.findAll('img',{'data-src' : True}): + for img in soup.findAll('img', {'data-src': True}): if img['data-src'].startswith('//'): img['src'] = 'https:' + img['data-src'] else: img['src'] = img['data-src'] + for div in soup.findAll( + 'div', {'data-component': check_words('article-container')} + )[1:]: + div.extract() return soup From 22ff7be0ee573a8e77b78464b61a2b9916fee9d8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 18 Jan 2019 07:32:07 +0530 Subject: [PATCH 0153/2613] version 3.38.0 --- Changelog.yaml | 48 ++++++++++++++++++++++++++++++++++++++++ src/calibre/constants.py | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/Changelog.yaml b/Changelog.yaml index b8a731575c..f9661b1ff6 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -20,6 +20,54 @@ # new recipes: # - title: +- version: 3.38.0 + date: 2019-01-18 + + new features: + - title: "Tag browser: When using the Find function have unaccented characters match their accented equivalents, if the setting for it is set in Preferences->Searching" + + - title: "DOCX Input: When converting indices, put each sub-entry on its own line." + tickets: [1811611] + + - title: "Edit book: Insert hyperlink: Add history for the template" + + - title: "Edit book: Insert hyperlink: Add a few more variables for the link template: _SOURCE_FILENAME_, _DEST_FILENAME_ and _ANCHOR_" + + bug fixes: + - title: "Catalogs: Set the language of created catalogs to the calibre interface language instead of English" + tickets: [1810936] + + - title: "DOCX Input: Do not display section breaks that have a numbering style applied to them." + tickets: [1811611] + + - title: "Content server: Fix listening on :: not also listening on IPv4 interfaces on Windows" + + - title: "DOCX Output: Fix heading styles that have the same font size as body text getting incorrect font sizes after conversion." + tickets: [1811616] + + - title: "EPUB/MOBI Catalogs: Fix prefix rules not working when calibre UI language is something other than English" + + - title: "EPUB/MOBI Catalogs: Fix exclusion by tag not working for tags that have spaces in them" + + - title: "Subset fonts: Fix error when trying to subset unicode characters that require two UTF-16 code points on Windows." + tickets: [1811224] + + - title: "Content server: Fix option to restrict displayed user field not working in the /opds view" + + - title: "Tag browser: Fix incorrect icon for user categories." + tickets: [1810217] + + - title: "PDF Output: Fix conversion failing when fonts with non-English names are used." + tickets: [1812218] + + improved recipes: + - Chicago Tribune + - New York Times Book Review + + new recipes: + - title: Nature + author: Jose Ortiz + - version: 3.37.0 date: 2019-01-04 diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 6a50502541..82f39d82a7 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -6,7 +6,7 @@ from polyglot.builtins import map import sys, locale, codecs, os, importlib, collections __appname__ = u'calibre' -numeric_version = (3, 37, 0) +numeric_version = (3, 38, 0) __version__ = u'.'.join(map(unicode, numeric_version)) __author__ = u"Kovid Goyal " From bd9de17f374a4a51b2ac90fc716b16f2b8ae2542 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 18 Jan 2019 10:55:59 +0530 Subject: [PATCH 0154/2613] Fix info() deprecation in sphinx --- manual/custom.py | 8 +- manual/latex.py | 7 +- manual/qthelp.py | 296 ----------------------------------------------- 3 files changed, 12 insertions(+), 299 deletions(-) delete mode 100644 manual/qthelp.py diff --git a/manual/custom.py b/manual/custom.py index d4599936b3..2f6a402bd4 100644 --- a/manual/custom.py +++ b/manual/custom.py @@ -8,6 +8,7 @@ import os, re, textwrap from functools import partial from sphinx.util.console import bold +from sphinx.util.logging import getLogger from calibre.linux import entry_points, cli_index_strings from epub import EPUBHelpBuilder @@ -18,6 +19,10 @@ def substitute(app, doctree): pass +def info(*a): + getLogger(__name__).info(*a) + + include_pat = re.compile(r'^.. include:: (\S+.rst)', re.M) @@ -205,7 +210,7 @@ def update_cli_doc(name, raw, app): path, path) for line in lines: print(line) - app.builder.info('creating '+os.path.splitext(os.path.basename(path))[0]) + info('creating '+os.path.splitext(os.path.basename(path))[0]) p = os.path.dirname(path) if p and not os.path.exists(p): os.makedirs(p) @@ -271,7 +276,6 @@ def get_cli_docs(): def cli_docs(app): - info = app.builder.info info(bold('creating CLI documentation...')) documented_cmds, undocumented_cmds = get_cli_docs() diff --git a/manual/latex.py b/manual/latex.py index 517aed0adb..4992901a80 100644 --- a/manual/latex.py +++ b/manual/latex.py @@ -9,6 +9,11 @@ __docformat__ = 'restructuredtext en' import os from sphinx.builders.latex import LaTeXBuilder +from sphinx.util.logging import getLogger + + +def info(*a): + getLogger(__name__).info(*a) class LaTeXHelpBuilder(LaTeXBuilder): @@ -16,7 +21,7 @@ class LaTeXHelpBuilder(LaTeXBuilder): def finish(self): LaTeXBuilder.finish(self) - self.info('Fixing Cyrillic characters...') + info('Fixing Cyrillic characters...') tex = os.path.join(self.outdir, 'calibre.tex') with open(tex, 'r+b') as f: raw = f.read().decode('utf-8') diff --git a/manual/qthelp.py b/manual/qthelp.py deleted file mode 100644 index ad56cfff88..0000000000 --- a/manual/qthelp.py +++ /dev/null @@ -1,296 +0,0 @@ -# -*- coding: utf-8 -*- -import os -import re -import cgi -import subprocess -from os import path - -from docutils import nodes - -from sphinx import addnodes -from sphinx.builders.html import StandaloneHTMLBuilder - -_idpattern = re.compile( - r'(?P.+) (\((?P<id>[\w\.]+)( (?P<descr>\w+))?\))$') - - -# Qt Help Collection Project (.qhcp). -# Is the input file for the help collection generator. -# It contains references to compressed help files which should be -# included in the collection. -# It may contain various other information for customizing Qt Assistant. -collection_template = '''\ -<?xml version="1.0" encoding="utf-8" ?> -<QHelpCollectionProject version="1.0"> - <docFiles> - <generate> - <file> - <input>%(outname)s.qhp</input> - <output>%(outname)s.qch</output> - </file> - </generate> - <register> - <file>%(outname)s.qch</file> - </register> - </docFiles> - <assistant> - <title>calibre User Manual - _static/logo.png - false - true - calibre/user_manual - - About calibre - - - about.txt - _static/logo.png - - - -''' - -ABOUT='''\ -calibre is the one stop solution for all your ebook needs. It was created -originally by Kovid Goyal, to help him manage his ebook collection and is now -very actively developed by an international community of ebook enthusiasts. - -Its goal is to empower you, the user, to do whatever you like with the ebooks -in your collection. You can convert them to many different formats, read them -on your computer, send them to many different devices, edit their metadata -and covers, etc. - -calibre also allows you to download news from a variety of different sources all -over the Internet and read conveniently in ebooks form. In keeping with its -philosophy of empowering the user, it has a simple system to allow you to add -your own favorite news sources. In fact, most the built-in news sources in -calibre were originally contributed by users. -''' - -# Qt Help Project (.qhp) -# This is the input file for the help generator. -# It contains the table of contents, indices and references to the -# actual documentation files (*.html). -# In addition it defines a unique namespace for the documentation. -project_template = '''\ - - - %(outname)s.org.%(outname)s.%(nversion)s - doc - - %(outname)s - %(version)s - - - %(outname)s - %(version)s - -
-%(sections)s -
-
- -%(files)s - -
-
-''' - -section_template = '
' -file_template = ' '*12 + '%(filename)s' - - -class QtHelpBuilder(StandaloneHTMLBuilder): - """ - Builder that also outputs Qt help project, contents and index files. - """ - name = 'qthelp' - - # don't copy the reST source - copysource = False - supported_image_types = ['image/svg+xml', 'image/png', 'image/gif', - 'image/jpeg'] - - # don't add links - add_permalinks = False - # don't add sidebar etc. - embedded = True - - def init(self): - StandaloneHTMLBuilder.init(self) - # the output files for HTML help must be .html only - self.out_suffix = '.html' - self.link_suffix = '.html' - #self.config.html_style = 'traditional.css' - - def handle_finish(self): - self.build_qhcp(self.outdir, self.config.qthelp_basename) - self.build_qhp(self.outdir, self.config.qthelp_basename) - self.build_qhc(self.outdir, self.config.qthelp_basename) - - def build_qhc(self, outdir, outname): - self.info('create Qt Help Collection...') - with open(os.path.join(outdir, 'about.txt'), 'wb') as f: - f.write(ABOUT) - qhcp = os.path.abspath(os.path.join(outdir, outname+'.qhcp')) - subprocess.check_call(['qcollectiongenerator', qhcp]) - qhc = qhcp[:-5]+'.qhc' - self.info('Qt Help Collection: '+qhc) - self.info('To test: assistant -collectionFile '+qhc) - - def build_qhcp(self, outdir, outname): - self.info('writing collection project file...') - f = open(path.join(outdir, outname+'.qhcp'), 'w') - try: - f.write(collection_template % {'outname': outname}) - finally: - f.close() - - def build_qhp(self, outdir, outname): - self.info('writing project file...') - - # sections - tocdoc = self.env.get_and_resolve_doctree(self.config.master_doc, self, - prune_toctrees=False) - istoctree = lambda node: ( - isinstance(node, addnodes.compact_paragraph) - and node.has_key('toctree')) - sections = [] - for node in tocdoc.traverse(istoctree): - sections.extend(self.write_toc(node)) - - if self.config.html_use_modindex: - item = section_template % {'title': 'Global Module Index', - 'ref': 'modindex.html'} - sections.append(' '*4*4 + item) - sections = '\n'.join(sections) - - # keywords - keywords = [] - index = self.env.create_index(self) - for (key, group) in index: - for title, (refs, subitems) in group: - keywords.extend(self.build_keywords(title, refs, subitems)) - keywords = '\n'.join(keywords) - - # files - if not outdir.endswith(os.sep): - outdir += os.sep - olen = len(outdir) - projectfiles = [] - staticdir = path.join(outdir, '_static') - imagesdir = path.join(outdir, '_images') - for root, dirs, files in os.walk(outdir): - resourcedir = root.startswith(staticdir) or root.startswith(imagesdir) - for fn in files: - if (resourcedir and not fn.endswith('.js')) or \ - fn.endswith('.html'): - filename = path.join(root, fn)[olen:] - #filename = filename.replace(os.sep, '\\') # XXX - projectfiles.append(file_template % {'filename': filename}) - projectfiles = '\n'.join(projectfiles) - - # write the project file - f = open(path.join(outdir, outname+'.qhp'), 'w') - try: - nversion = self.config.version.replace('.', '_') - nversion = nversion.replace(' ', '_') - f.write(project_template % {'outname': outname, - 'title': self.config.html_title, - 'version': self.config.version, - 'project': self.config.project, - 'nversion': nversion, - 'masterdoc': self.config.master_doc, - 'sections': sections, - 'keywords': keywords, - 'files': projectfiles}) - finally: - f.close() - - def isdocnode(self, node): - if not isinstance(node, nodes.list_item): - return False - if len(node.children) != 2: - return False - if not isinstance(node.children[0], addnodes.compact_paragraph): - return False - if not isinstance(node.children[0][0], nodes.reference): - return False - if not isinstance(node.children[1], nodes.bullet_list): - return False - return True - - def write_toc(self, node, indentlevel=4): - parts = [] - if self.isdocnode(node): - refnode = node.children[0][0] - link = refnode['refuri'] - title = cgi.escape(refnode.astext()).replace('"','"') - item = '
' % { - 'title': title, - 'ref': link} - parts.append(' '*4*indentlevel + item) - for subnode in node.children[1]: - parts.extend(self.write_toc(subnode, indentlevel+1)) - parts.append(' '*4*indentlevel + '
') - elif isinstance(node, nodes.list_item): - for subnode in node: - parts.extend(self.write_toc(subnode, indentlevel)) - elif isinstance(node, nodes.reference): - link = node['refuri'] - title = cgi.escape(node.astext()).replace('"','"') - item = section_template % {'title': title, 'ref': link} - item = ' '*4*indentlevel + item.encode('ascii', 'xmlcharrefreplace') - parts.append(item.encode('ascii', 'xmlcharrefreplace')) - elif isinstance(node, nodes.bullet_list): - for subnode in node: - parts.extend(self.write_toc(subnode, indentlevel)) - elif isinstance(node, addnodes.compact_paragraph): - for subnode in node: - parts.extend(self.write_toc(subnode, indentlevel)) - - return parts - - def keyword_item(self, name, ref): - matchobj = _idpattern.match(name) - if matchobj: - groupdict = matchobj.groupdict() - shortname = groupdict['title'] - id = groupdict.get('id') -# descr = groupdict.get('descr') - if shortname.endswith('()'): - shortname = shortname[:-2] - id = '%s.%s' % (id, shortname) - else: - id = None - - if id: - item = ' '*12 + '' % ( - name, id, ref) - else: - item = ' '*12 + '' % (name, ref) - item.encode('ascii', 'xmlcharrefreplace') - return item - - def build_keywords(self, title, refs, subitems): - keywords = [] - - title = cgi.escape(title) -# if len(refs) == 0: # XXX -# write_param('See Also', title) - if len(refs) == 1: - keywords.append(self.keyword_item(title, refs[0])) - elif len(refs) > 1: - for i, ref in enumerate(refs): # XXX -# item = (' '*12 + -# '' % ( -# title, i, ref)) -# item.encode('ascii', 'xmlcharrefreplace') -# keywords.append(item) - keywords.append(self.keyword_item(title, ref)) - - if subitems: - for subitem in subitems: - keywords.extend(self.build_keywords(subitem[0], subitem[1], [])) - - return keywords From b5dff9ba898ac486ad37ed6aa71cc98856fc69aa Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 18 Jan 2019 11:01:48 +0530 Subject: [PATCH 0155/2613] Fix sphinx get_toc_tree deprecation --- manual/sidebar_toc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/manual/sidebar_toc.py b/manual/sidebar_toc.py index 828eb7cad2..8e7aaf6e0c 100644 --- a/manual/sidebar_toc.py +++ b/manual/sidebar_toc.py @@ -3,6 +3,7 @@ from docutils import nodes from itertools import count +from sphinx.environment.adapters.toctree import TocTree id_counter = count() ID = 'sidebar-collapsible-toc' @@ -69,7 +70,8 @@ def modify_li(li): def create_toc(app, pagename): - toctree = app.env.get_toc_for(pagename, app.builder) + tt = TocTree(app.env) + toctree = tt.get_toc_for(pagename, app.builder) if toctree is not None: subtree = toctree[toctree.first_child_matching_class(nodes.list_item)] bl = subtree.first_child_matching_class(nodes.bullet_list) From 6adedd860355bfcfd8eab1ca82a9c26428aebc15 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 19 Dec 2018 02:14:00 -0500 Subject: [PATCH 0156/2613] setup/mathjax: fallback to using packed versions of resources Some mathjax distributions come with the unpacked versions removed as per the upstream instructions for optimizing an installation. Only use the unpacked versions if they exist; otherwise fallback on the packed versions. Also filter the .woff files to make sure they are actually .woff files, since they may be files like fonts.dir, fonts.scale, .uuid (created by xorg-mkfontdir, xorg-mkfontscale, fontconfig). --- setup/mathjax.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/setup/mathjax.py b/setup/mathjax.py index 561d161433..3dc38a7b27 100644 --- a/setup/mathjax.py +++ b/setup/mathjax.py @@ -47,12 +47,13 @@ class MathJax(Command): with open(dest, 'wb') as f: f.write(raw) - def add_tree(self, base, prefix): + def add_tree(self, base, prefix, ignore=lambda n:False): for dirpath, dirnames, filenames in os.walk(base): for fname in filenames: f = os.path.join(dirpath, fname) name = prefix + '/' + os.path.relpath(f, base).replace(os.sep, '/') - self.add_file(f, name) + if not ignore(name): + self.add_file(f, name) def clean(self): self.mathjax_dir = self.j(self.RESOURCES, 'mathjax') @@ -68,10 +69,11 @@ class MathJax(Command): try: src = opts.path_to_mathjax or self.download_mathjax_release(tdir, opts.mathjax_url) self.info('Adding MathJax...') - self.add_file(self.j(src, 'unpacked', 'MathJax.js'), 'MathJax.js') - self.add_tree(self.j(src, 'fonts', 'HTML-CSS', self.FONT_FAMILY, 'woff'), 'fonts/HTML-CSS/%s/woff' % self.FONT_FAMILY) + unpacked = 'unpacked' if self.e(self.j(src, 'unpacked')) else '' + self.add_file(self.j(src, unpacked, 'MathJax.js'), 'MathJax.js') + self.add_tree(self.j(src, 'fonts', 'HTML-CSS', self.FONT_FAMILY, 'woff'), 'fonts/HTML-CSS/%s/woff' % self.FONT_FAMILY, lambda x: not x.endswith('.woff')) for d in 'extensions jax/element jax/input jax/output/CommonHTML'.split(): - self.add_tree(self.j(src, 'unpacked', *d.split('/')), d) + self.add_tree(self.j(src, unpacked, *d.split('/')), d) etag = self.h.hexdigest() with open(self.j(self.RESOURCES, 'mathjax', 'manifest.json'), 'wb') as f: f.write(json.dumps({'etag': etag, 'files': self.mathjax_files}, indent=2).encode('utf-8')) From 82617d3a74954d4d9cc7d779fa563ad3d212867a Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Fri, 28 Dec 2018 00:28:39 -0500 Subject: [PATCH 0157/2613] build: add option to symlink to system mathjax installation --- setup/mathjax.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/setup/mathjax.py b/setup/mathjax.py index 3dc38a7b27..fbd9e242ec 100644 --- a/setup/mathjax.py +++ b/setup/mathjax.py @@ -27,6 +27,8 @@ class MathJax(Command): def add_options(self, parser): parser.add_option('--path-to-mathjax', help='Path to the MathJax source code') parser.add_option('--mathjax-url', default=self.MATH_JAX_URL, help='URL to MathJax source archive in zip format') + parser.add_option('--system-mathjax', default=False, action='store_true', + help='Treat MathJax as system copy and symlink instead of copy') def download_mathjax_release(self, tdir, url): self.info('Downloading MathJax:', url) @@ -44,8 +46,11 @@ class MathJax(Command): base = os.path.dirname(dest) if not os.path.exists(base): os.makedirs(base) - with open(dest, 'wb') as f: - f.write(raw) + if self.use_symlinks: + os.symlink(path, dest) + else: + with open(dest, 'wb') as f: + f.write(raw) def add_tree(self, base, prefix, ignore=lambda n:False): for dirpath, dirnames, filenames in os.walk(base): @@ -63,6 +68,7 @@ class MathJax(Command): def run(self, opts): self.h = sha1() self.mathjax_files = {} + self.use_symlinks = opts.system_mathjax self.clean() os.mkdir(self.mathjax_dir) tdir = mkdtemp('calibre-mathjax-build') From 8c8d520ff62fcab83441c5e104971cb69934a492 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 18 Jan 2019 20:00:51 +0530 Subject: [PATCH 0158/2613] Fix #1812388 [problem with polish fonction - version 3.38](https://bugs.launchpad.net/calibre/+bug/1812388) --- src/calibre/gui2/actions/polish.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/actions/polish.py b/src/calibre/gui2/actions/polish.py index d4eddd1c70..fc089bae4d 100644 --- a/src/calibre/gui2/actions/polish.py +++ b/src/calibre/gui2/actions/polish.py @@ -289,9 +289,13 @@ class Polish(QDialog): # {{{ db.copy_format_to(book_id, fmt, f, index_is_id=True) data['files'].append(f.name) + nums = num + if hasattr(self, 'pd'): + nums = self.pd.max - num + desc = ngettext(_('Polish %s')%mi.title, _('Polish book %(nums)s of %(tot)s (%(title)s)')%dict( - nums=self.pd.max - num, tot=len(self.book_id_map), + nums=nums, tot=len(self.book_id_map), title=mi.title), len(self.book_id_map)) if hasattr(self, 'pd'): self.pd.set_msg(_('Queueing book %(nums)s of %(tot)s (%(title)s)')%dict( From 5c335d041864b9e5be2ae9279518277995475498 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 18 Jan 2019 20:10:27 +0530 Subject: [PATCH 0159/2613] version 3.38.1 --- Changelog.yaml | 4 +++- src/calibre/constants.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Changelog.yaml b/Changelog.yaml index f9661b1ff6..de1250c385 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -20,7 +20,7 @@ # new recipes: # - title: -- version: 3.38.0 +- version: 3.38.1 date: 2019-01-18 new features: @@ -60,6 +60,8 @@ - title: "PDF Output: Fix conversion failing when fonts with non-English names are used." tickets: [1812218] + - title: "3.38.1 fixes a typo in 3.38.0 that caused the Polish books function to not work when polishing small numbers of books" + improved recipes: - Chicago Tribune - New York Times Book Review diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 82f39d82a7..f5cd2ee24a 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -6,7 +6,7 @@ from polyglot.builtins import map import sys, locale, codecs, os, importlib, collections __appname__ = u'calibre' -numeric_version = (3, 38, 0) +numeric_version = (3, 38, 1) __version__ = u'.'.join(map(unicode, numeric_version)) __author__ = u"Kovid Goyal " From f0cc46958cc38917078e7df7863e592a799b51e7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 19 Jan 2019 11:52:34 +0530 Subject: [PATCH 0160/2613] Fix #1812400 [Cursor missplace on show_partial_cfi_in_editor() function](https://bugs.launchpad.net/calibre/+bug/1812400) --- src/calibre/gui2/tweak_book/boss.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index f1f4e27054..436da352ab 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -1417,8 +1417,13 @@ class Boss(QObject): if node is not None: lnum = node.get('data-lnum') if lnum: + tags_before = [] + for tag in root.xpath('//*[data-lnum="%s"]' % lnum): + tags_before.append(tag) + if tag is node: + break lnum = int(lnum) - editor.current_line = lnum + editor.goto_sourceline(lnum, tags_before, attribute='id' if node.get('id') else None) return True return False From 0ac2fa01887f3a9a42c548d6cc353fc52b8b9264 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 19 Jan 2019 12:17:52 +0530 Subject: [PATCH 0161/2613] Mark hunspell as vendored --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 5d89af48ff..41c12d81df 100644 --- a/.gitattributes +++ b/.gitattributes @@ -45,6 +45,7 @@ resources/coffee-script.js linguist-vendored=true resources/csscolorparser.js linguist-vendored=true resources/viewer/hyphen* linguist-vendored=true resources/viewer/jquery* linguist-vendored=true +src/hunspell linguist-vendored=true # Mark generated files resources/content-server/index-generated.html linguist-generated=true From be713e1a80f16fdcaf72448f69d80e2e4490a24c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 19 Jan 2019 18:06:31 +0530 Subject: [PATCH 0162/2613] Fix error when calling goto_sourceline with no tags --- src/calibre/gui2/tweak_book/editor/smarts/html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/editor/smarts/html.py b/src/calibre/gui2/tweak_book/editor/smarts/html.py index d44704f09e..fc75b8c913 100644 --- a/src/calibre/gui2/tweak_book/editor/smarts/html.py +++ b/src/calibre/gui2/tweak_book/editor/smarts/html.py @@ -531,7 +531,7 @@ class Smarts(NullSmarts): ud = block.userData() all_tags = [] if ud is None else [t for t in ud.tags if (t.is_start and not t.closing)] tag_names = [t.name for t in all_tags] - if tag_names[:len(tags)] == tags: + if all_tags and tag_names[:len(tags)] == tags: c.setPosition(block.position() + all_tags[len(tags)-1].offset) found_tag = True else: From 0a0c9039e09754c9ee3d9dc2d87922f4e7b768e6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 20 Jan 2019 10:42:02 +0530 Subject: [PATCH 0163/2613] Update Il Post --- recipes/il_post.recipe | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/recipes/il_post.recipe b/recipes/il_post.recipe index f4d03563c5..1728cafc63 100644 --- a/recipes/il_post.recipe +++ b/recipes/il_post.recipe @@ -21,8 +21,7 @@ sections = [ ("Mondo", "https://www.ilpost.it/mondo/"), ("Politica", "https://www.ilpost.it/politica/"), ("Tecnologia", "https://www.ilpost.it/tecnologia/"), - ("Internet", - "https://www.ilpost.it/internet/"), + ("Internet", "https://www.ilpost.it/internet/"), ("Scienza", "https://www.ilpost.it/scienza/"), ("Cultura", "https://www.ilpost.it/cultura/"), ("Economia", "https://www.ilpost.it/economia/"), @@ -49,9 +48,11 @@ class IlPost(BasicNewsRecipe): title = "Il Post" language = "it" - description = ('Puoi decidere quali sezioni scaricare modificando la ricetta.' - ' Di default le immagini sono convertite in scala di grigio per risparmiare spazio,' - ' la ricetta puo\' essere configurata per tenerle a colori') + description = ( + 'Puoi decidere quali sezioni scaricare modificando la ricetta.' + ' Di default le immagini sono convertite in scala di grigio per risparmiare spazio,' + ' la ricetta puo\' essere configurata per tenerle a colori' + ) tags = "news" cover_url = "https://www.ilpost.it/wp-content/themes/ilpost/images/ilpost.svg" ignore_duplicate_articles = {"title", "url"} @@ -103,3 +104,9 @@ class IlPost(BasicNewsRecipe): img.type = "GrayscaleType" img.save(iurl) return soup + + def preprocess_html(self, soup): + galleryItems = soup.findAll("figure", {"class": "gallery-item"}) + if galleryItems: + self.abort_article() + return soup From fd5ea1552e8dba306fd17a5b3554709af966c9cb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 20 Jan 2019 12:45:34 +0530 Subject: [PATCH 0164/2613] More robust use of goto_sourceline --- src/calibre/gui2/tweak_book/boss.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index 436da352ab..be5b4eea01 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -1422,9 +1422,10 @@ class Boss(QObject): tags_before.append(tag) if tag is node: break + else: + tags_before.append(node) lnum = int(lnum) - editor.goto_sourceline(lnum, tags_before, attribute='id' if node.get('id') else None) - return True + return editor.goto_sourceline(lnum, tags_before, attribute='id' if node.get('id') else None) return False def goto_style_declaration(self, data): From 804e3fbf1c10cbc91993d0667809f61fb2d4482d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 20 Jan 2019 12:57:16 +0530 Subject: [PATCH 0165/2613] Should be passing barenames to goto_sourceline --- src/calibre/gui2/tweak_book/boss.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index be5b4eea01..bac2180a4c 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -1414,16 +1414,20 @@ class Boss(QObject): editor.get_raw_data(), decoder=lambda x: x.decode('utf-8'), line_numbers=True, linenumber_attribute='data-lnum') node = decode_cfi(root, cfi) + + def barename(x): + return x.tag.partition('}')[-1] + if node is not None: lnum = node.get('data-lnum') if lnum: tags_before = [] for tag in root.xpath('//*[data-lnum="%s"]' % lnum): - tags_before.append(tag) + tags_before.append(barename(tag)) if tag is node: break else: - tags_before.append(node) + tags_before.append(barename(node)) lnum = int(lnum) return editor.goto_sourceline(lnum, tags_before, attribute='id' if node.get('id') else None) return False From 3f1cc2725a054c0704cf03173e147d146c1a6f73 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 20 Jan 2019 15:53:53 +0530 Subject: [PATCH 0166/2613] Ensure highlighting is done when going to sourceline --- src/calibre/gui2/tweak_book/editor/smarts/html.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/calibre/gui2/tweak_book/editor/smarts/html.py b/src/calibre/gui2/tweak_book/editor/smarts/html.py index fc75b8c913..e26e55d64e 100644 --- a/src/calibre/gui2/tweak_book/editor/smarts/html.py +++ b/src/calibre/gui2/tweak_book/editor/smarts/html.py @@ -527,6 +527,7 @@ class Smarts(NullSmarts): block = editor.document().findBlockByNumber(sourceline - 1) # blockNumber() is zero based if not block.isValid(): return found_tag + editor.highlighter.join() c = editor.textCursor() ud = block.userData() all_tags = [] if ud is None else [t for t in ud.tags if (t.is_start and not t.closing)] From 18ad088bda0d8961e04d7083068f542b3349aed4 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 20 Jan 2019 04:22:43 -0500 Subject: [PATCH 0167/2613] build: preserve symlinks when installing Without this, python's default behavior was to dereference the mathjax symlinks and install the file contents instead. --- setup/install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/install.py b/setup/install.py index 71fce72459..827cc26da6 100644 --- a/setup/install.py +++ b/setup/install.py @@ -259,7 +259,7 @@ class Install(Develop): if os.path.exists(dest): shutil.rmtree(dest) self.info('Installing resources to', dest) - shutil.copytree(self.RESOURCES, dest) + shutil.copytree(self.RESOURCES, dest, symlinks=True) self.manifest.append(dest) def success(self): From 31ccd4f63272446568c454d925427938aae5ba82 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 21 Jan 2019 15:28:51 +0530 Subject: [PATCH 0168/2613] Forgot the @ when matching on data-lnum --- src/calibre/gui2/tweak_book/boss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index bac2180a4c..ba560e08a8 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -1422,7 +1422,7 @@ class Boss(QObject): lnum = node.get('data-lnum') if lnum: tags_before = [] - for tag in root.xpath('//*[data-lnum="%s"]' % lnum): + for tag in root.xpath('//*[@data-lnum="%s"]' % lnum): tags_before.append(barename(tag)) if tag is node: break From aa1bdda90052dc3f546fc7aaa5f88925774f939f Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Mon, 21 Jan 2019 11:31:28 +0000 Subject: [PATCH 0169/2613] Sort-of fix for #1812560: editing datetimes with iso format doesn't work --- src/calibre/gui2/custom_column_widgets.py | 4 ++++ src/calibre/gui2/dialogs/metadata_bulk.py | 2 ++ src/calibre/gui2/library/delegates.py | 6 ++++-- src/calibre/gui2/metadata/basic_widgets.py | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/custom_column_widgets.py b/src/calibre/gui2/custom_column_widgets.py index 31390813c0..155d5964ab 100644 --- a/src/calibre/gui2/custom_column_widgets.py +++ b/src/calibre/gui2/custom_column_widgets.py @@ -308,6 +308,8 @@ class DateTime(Base): format_ = cm['display'].get('date_format','') if not format_: format_ = 'dd MMM yyyy hh:mm' + elif format_ == 'iso': + format_ = 'yyyy-MM-ddTHH:mm:ss' w.setDisplayFormat(format_) w.setCalendarPopup(True) w.setMinimumDateTime(UNDEFINED_QDATETIME) @@ -1027,6 +1029,8 @@ class BulkDateTime(BulkBase): format = cm['display'].get('date_format','') if not format: format = 'dd MMM yyyy' + elif format == 'iso': + format = 'yyyy-MM-ddTHH:mm:ss' w.setDisplayFormat(format) w.setCalendarPopup(True) w.setMinimumDateTime(UNDEFINED_QDATETIME) diff --git a/src/calibre/gui2/dialogs/metadata_bulk.py b/src/calibre/gui2/dialogs/metadata_bulk.py index a537859eee..7146e00a9e 100644 --- a/src/calibre/gui2/dialogs/metadata_bulk.py +++ b/src/calibre/gui2/dialogs/metadata_bulk.py @@ -503,6 +503,8 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): self.pubdate_cw = CalendarWidget(self.pubdate) self.pubdate.setCalendarWidget(self.pubdate_cw) pubdate_format = tweaks['gui_pubdate_display_format'] + if pubdate_format == 'iso': + pubdate_format = 'yyyy-MM-ddTHH:mm:ss' if pubdate_format is not None: self.pubdate.setDisplayFormat(pubdate_format) self.pubdate.setSpecialValueText(_('Undefined')) diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index 4e0aa5cdb8..b81592a8cd 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -111,13 +111,15 @@ class UpdateEditorGeometry(object): class DateTimeEdit(QDateTimeEdit): # {{{ - def __init__(self, parent, format): + def __init__(self, parent, format_): QDateTimeEdit.__init__(self, parent) self.setFrame(False) self.setMinimumDateTime(UNDEFINED_QDATETIME) self.setSpecialValueText(_('Undefined')) self.setCalendarPopup(True) - self.setDisplayFormat(format) + if format_ == 'iso': + format_ = 'yyyy-MM-ddTHH:mm:ss' + self.setDisplayFormat(format_) def contextMenuEvent(self, ev): m = QMenu(self) diff --git a/src/calibre/gui2/metadata/basic_widgets.py b/src/calibre/gui2/metadata/basic_widgets.py index 0cb8ccdae4..80720c1468 100644 --- a/src/calibre/gui2/metadata/basic_widgets.py +++ b/src/calibre/gui2/metadata/basic_widgets.py @@ -1838,6 +1838,8 @@ class DateEdit(make_undoable(QDateTimeEdit), ToMetadataMixin): fmt = tweaks[self.TWEAK] if fmt is None: fmt = self.FMT + elif fmt == 'iso': + fmt = 'yyyy-MM-ddTHH:mm:ss' self.setDisplayFormat(fmt) self.setCalendarPopup(True) self.cw = CalendarWidget(self) From c8e97f6f507d4be1ae942b98f7158d18783c6d77 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Mon, 21 Jan 2019 11:34:30 +0000 Subject: [PATCH 0170/2613] Rest of fix --- src/calibre/gui2/custom_column_widgets.py | 12 ++++++------ src/calibre/gui2/dialogs/metadata_bulk.py | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/calibre/gui2/custom_column_widgets.py b/src/calibre/gui2/custom_column_widgets.py index 155d5964ab..b955c7ee4a 100644 --- a/src/calibre/gui2/custom_column_widgets.py +++ b/src/calibre/gui2/custom_column_widgets.py @@ -1026,12 +1026,12 @@ class BulkDateTime(BulkBase): l.addStretch(2) w = self.main_widget - format = cm['display'].get('date_format','') - if not format: - format = 'dd MMM yyyy' - elif format == 'iso': - format = 'yyyy-MM-ddTHH:mm:ss' - w.setDisplayFormat(format) + format_ = cm['display'].get('date_format','') + if not format_: + format_ = 'dd MMM yyyy' + elif format_ == 'iso': + format_ = 'yyyy-MM-ddTHH:mm:ss' + w.setDisplayFormat(format_) w.setCalendarPopup(True) w.setMinimumDateTime(UNDEFINED_QDATETIME) w.setSpecialValueText(_('Undefined')) diff --git a/src/calibre/gui2/dialogs/metadata_bulk.py b/src/calibre/gui2/dialogs/metadata_bulk.py index 7146e00a9e..581f34be75 100644 --- a/src/calibre/gui2/dialogs/metadata_bulk.py +++ b/src/calibre/gui2/dialogs/metadata_bulk.py @@ -515,6 +515,8 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): self.adddate_cw = CalendarWidget(self.adddate) self.adddate.setCalendarWidget(self.adddate_cw) adddate_format = tweaks['gui_timestamp_display_format'] + if adddate_format == 'iso': + adddate_format = 'yyyy-MM-ddTHH:mm:ss' if adddate_format is not None: self.adddate.setDisplayFormat(adddate_format) self.adddate.setSpecialValueText(_('Undefined')) From d7d7810a4498e4a62c8fb2a02a433b04404b586c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 22 Jan 2019 09:46:27 +0530 Subject: [PATCH 0171/2613] Science Advances by Jose Ortiz --- recipes/science_advances.recipe | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 recipes/science_advances.recipe diff --git a/recipes/science_advances.recipe b/recipes/science_advances.recipe new file mode 100644 index 0000000000..9fc4065374 --- /dev/null +++ b/recipes/science_advances.recipe @@ -0,0 +1,49 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +from __future__ import unicode_literals, division, absolute_import, print_function +from calibre.web.feeds.news import BasicNewsRecipe + + +def check_words(words): + return lambda x: x and frozenset(words.split()).intersection(x.split()) + + +class ScienceAdvances(BasicNewsRecipe): + title = 'Science Advances' + __author__ = 'Jose Ortiz' + description = ( + 'Science Advances is a peer-reviewed multidisciplinary open-access' + ' scientific journal established in early 2015. The journal\'s scope' + ' includes all areas of science, including the life sciences, physical' + ' sciences, social sciences, computer sciences, and environmental' + ' sciences.' + ) + language = 'en' + encoding = 'UTF-8' + max_articles_per_feed = 100 + publication_type = 'magazine' + keep_only_tags = [dict(name='article', attrs={'class': check_words('primary')})] + feeds = [ + ( + 'Science Advances: Current Issue', + 'http://advances.sciencemag.org/rss/current.xml' + ), + ] + + def get_cover_url(self): + soup = self.index_to_soup('http://advances.sciencemag.org/') + img = soup.find(id='content-block').find( + 'img', attrs={'class': check_words('cover-img')} + ) + return img['src'] + + def preprocess_html(self, soup): + for img in soup.findAll('img', attrs={'data-src': True}): + if img['data-src'].endswith('medium.gif'): + img['src'] = img['data-src'][:-10] + 'large.jpg' + a = img.findParent(attrs={'href': True}) + if a is not None and a['href'].startswith(img['src']): + del a['href'] + else: + img['src'] = img['data-src'] + return soup From eab43eb63e5ef4e5db33ebfc1a016209d678198e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 22 Jan 2019 12:29:37 +0530 Subject: [PATCH 0172/2613] Nicer error message for /cdb/set-fields with invalid data --- src/calibre/srv/cdb.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/calibre/srv/cdb.py b/src/calibre/srv/cdb.py index 8a7ffbb69b..9f04e77392 100644 --- a/src/calibre/srv/cdb.py +++ b/src/calibre/srv/cdb.py @@ -140,9 +140,15 @@ def cdb_set_fields(ctx, rd, book_id, library_id): data = json_loads(raw) else: raise HTTPBadRequest('Only JSON or msgpack requests are supported') - changes, loaded_book_ids = data['changes'], frozenset(map(int, data['loaded_book_ids'])) except Exception: raise HTTPBadRequest('Invalid encoded data') + try: + changes, loaded_book_ids = data['changes'], frozenset(map(int, data.get('loaded_book_ids', ()))) + if not isinstance(changes, dict): + raise TypeError('changes must be a dict') + except Exception: + raise HTTPBadRequest( + '''Data must be of the form {'changes': {'title': 'New Title', ...}, 'loaded_book_ids':[book_id1, book_id2, ...]'}''') dirtied = set() cdata = changes.pop('cover', False) if cdata is not False: From 8fbdd7bc9a2b0fc8049564570242c9368875c788 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 22 Jan 2019 13:38:33 +0530 Subject: [PATCH 0173/2613] Add a flag to cdb/set-fields to avoid needing to pass all book ids for dirtied updates --- src/calibre/srv/cdb.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/srv/cdb.py b/src/calibre/srv/cdb.py index 9f04e77392..81d86d46d1 100644 --- a/src/calibre/srv/cdb.py +++ b/src/calibre/srv/cdb.py @@ -144,6 +144,7 @@ def cdb_set_fields(ctx, rd, book_id, library_id): raise HTTPBadRequest('Invalid encoded data') try: changes, loaded_book_ids = data['changes'], frozenset(map(int, data.get('loaded_book_ids', ()))) + all_dirtied = bool(data.get('all_dirtied')) if not isinstance(changes, dict): raise TypeError('changes must be a dict') except Exception: @@ -168,4 +169,6 @@ def cdb_set_fields(ctx, rd, book_id, library_id): for field, value in changes.iteritems(): dirtied |= db.set_field(field, {book_id: value}) ctx.notify_changes(db.backend.library_path, metadata(dirtied)) - return {bid: book_as_json(db, book_id) for bid in (dirtied & loaded_book_ids) | {book_id}} + all_ids = dirtied if all_dirtied else (dirtied & loaded_book_ids) + all_ids |= {book_id} + return {bid: book_as_json(db, book_id) for bid in all_ids} From a64579338cbad23d717c8a2da48dd07587876b76 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 23 Jan 2019 08:03:00 +0530 Subject: [PATCH 0174/2613] Dont download MathJax if it is already present Fixes #1812891 [calibre-3.38.1 tries to download mathjax during build](https://bugs.launchpad.net/calibre/+bug/1812891) --- setup/mathjax.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/setup/mathjax.py b/setup/mathjax.py index fbd9e242ec..a0ac198d8e 100644 --- a/setup/mathjax.py +++ b/setup/mathjax.py @@ -60,15 +60,27 @@ class MathJax(Command): if not ignore(name): self.add_file(f, name) + @property + def mathjax_dir(self): + return self.j(self.RESOURCES, 'mathjax') + + def already_present(self): + manifest = self.j(self.mathjax_dir, 'manifest.json') + if os.path.exists(manifest): + with open(manifest, 'rb') as f: + return json.load(f).get('version') == self.MATH_JAX_VERSION + return False + def clean(self): - self.mathjax_dir = self.j(self.RESOURCES, 'mathjax') if os.path.exists(self.mathjax_dir): shutil.rmtree(self.mathjax_dir) def run(self, opts): + if not opts.system_mathjax and self.already_present(): + self.info('MathJax already present in the resources directory, not downloading') + self.use_symlinks = opts.system_mathjax self.h = sha1() self.mathjax_files = {} - self.use_symlinks = opts.system_mathjax self.clean() os.mkdir(self.mathjax_dir) tdir = mkdtemp('calibre-mathjax-build') @@ -77,11 +89,14 @@ class MathJax(Command): self.info('Adding MathJax...') unpacked = 'unpacked' if self.e(self.j(src, 'unpacked')) else '' self.add_file(self.j(src, unpacked, 'MathJax.js'), 'MathJax.js') - self.add_tree(self.j(src, 'fonts', 'HTML-CSS', self.FONT_FAMILY, 'woff'), 'fonts/HTML-CSS/%s/woff' % self.FONT_FAMILY, lambda x: not x.endswith('.woff')) + self.add_tree( + self.j(src, 'fonts', 'HTML-CSS', self.FONT_FAMILY, 'woff'), + 'fonts/HTML-CSS/%s/woff' % self.FONT_FAMILY, + lambda x: not x.endswith('.woff')) for d in 'extensions jax/element jax/input jax/output/CommonHTML'.split(): self.add_tree(self.j(src, unpacked, *d.split('/')), d) etag = self.h.hexdigest() with open(self.j(self.RESOURCES, 'mathjax', 'manifest.json'), 'wb') as f: - f.write(json.dumps({'etag': etag, 'files': self.mathjax_files}, indent=2).encode('utf-8')) + f.write(json.dumps({'etag': etag, 'files': self.mathjax_files, 'version': self.MATH_JAX_VERSION}, indent=2).encode('utf-8')) finally: shutil.rmtree(tdir) From 54c2add3967a27b6357b077a3ccb77dfefab39f1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 26 Jan 2019 11:05:02 +0530 Subject: [PATCH 0175/2613] Remove not working recipe --- recipes/der_spiegel.recipe | 87 -------------------------------------- 1 file changed, 87 deletions(-) delete mode 100644 recipes/der_spiegel.recipe diff --git a/recipes/der_spiegel.recipe b/recipes/der_spiegel.recipe deleted file mode 100644 index da3577b896..0000000000 --- a/recipes/der_spiegel.recipe +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env python2 - -__license__ = 'GPL v3' -__copyright__ = '2011, Nikolas Mangold ' -''' -spiegel.de -''' -from calibre.web.feeds.news import BasicNewsRecipe -from calibre import strftime -from calibre import re - - -class DerSpiegel(BasicNewsRecipe): - title = 'Der Spiegel' - __author__ = 'Nikolas Mangold' - description = 'Der Spiegel, Printed Edition. Access to paid content.' - publisher = 'SPIEGEL-VERLAG RUDOLF AUGSTEIN GMBH & CO. KG' - category = 'news, politics, Germany' - no_stylesheets = True - encoding = 'cp1252' - needs_subscription = True - remove_empty_feeds = True - delay = 1 - PREFIX = 'http://m.spiegel.de' - INDEX = PREFIX + '/spiegel/print/epaper/index-heftaktuell.html' - use_embedded_content = False - masthead_url = 'http://upload.wikimedia.org/wikipedia/en/thumb/1/17/Der_Spiegel_logo.svg/200px-Der_Spiegel_logo.svg.png' - language = 'de' - publication_type = 'magazine' - extra_css = ' body{font-family: Arial,Helvetica,sans-serif} ' - timefmt = '[%W/%Y]' - empty_articles = ['Titelbild'] - preprocess_regexps = [ - (re.compile(r'

', re.DOTALL | - re.IGNORECASE), lambda match: '
'), - ] - - def get_browser(self): - def has_login_name(form): - try: - form.find_control(name="f.loginName") - except: - return False - else: - return True - - br = BasicNewsRecipe.get_browser(self) - if self.username is not None and self.password is not None: - br.open(self.PREFIX + '/meinspiegel/login.html?backUrl=' + - self.PREFIX + '/spiegel/print') - br.select_form(predicate=has_login_name) - br['f.loginName'] = self.username - br['f.password'] = self.password - br.submit() - return br - - remove_tags_before = dict(attrs={'class': 'spArticleContent'}) - remove_tags_after = dict(attrs={'class': 'spArticleCredit'}) - - def parse_index(self): - soup = self.index_to_soup(self.INDEX) - - cover = soup.find('img', width=248) - if cover is not None: - self.cover_url = cover['src'] - - index = soup.find('dl') - - feeds = [] - for section in index.findAll('dt'): - section_title = self.tag_to_string(section).strip() - self.log('Found section ', section_title) - - articles = [] - for article in section.findNextSiblings(['dd', 'dt']): - if article.name == 'dt': - break - link = article.find('a', href=True) - title = self.tag_to_string(link).strip() - if title in self.empty_articles: - continue - self.log('Found article ', title) - url = self.PREFIX + link['href'] - articles.append( - {'title': title, 'date': strftime(self.timefmt), 'url': url}) - feeds.append((section_title, articles)) - return feeds From aa79ffcb1ca8faf230481535ea05106cbb2e48ae Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Jan 2019 08:08:00 +0530 Subject: [PATCH 0176/2613] BSI News by Volker Heggemann --- recipes/bsi_news.recipe | 69 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 recipes/bsi_news.recipe diff --git a/recipes/bsi_news.recipe b/recipes/bsi_news.recipe new file mode 100644 index 0000000000..baac5acce8 --- /dev/null +++ b/recipes/bsi_news.recipe @@ -0,0 +1,69 @@ +#!/usr/bin/env python2 +from __future__ import absolute_import, division, print_function, unicode_literals + +from datetime import datetime + +from calibre.web.feeds.news import BasicNewsRecipe + + +class germanyBSI(BasicNewsRecipe): + # Titel of the Recipe + # title = 'News des Bundesamt für Sicherheit in der Informationstechnik' + title = 'BSI News - DE' + cover_url = 'https://www.bsi.bund.de/SiteGlobals/Frontend/Images/BSI/logo.png' + # Author + __author__ = 'Volker Heggemann, VoHe' + # oldes article to download (in days) ---- can be edit by user + oldest_article = 7 + # describes itself, ---- can be edit by user + max_articles_per_feed = 100 + # speed up the download on fast computers be carefull (I test max.20) + # ---- can be edit by user + simultaneous_downloads = 10 + # description, some Reader show this in titlepage + description = u'News from BSI' + # add date to description so for dayly downloads you can find them easier + # ---- can be edit by user + description = description + ' fetched: ' + \ + datetime.now().strftime("%Y-%m-%d") # %H:%M:%S") + # Who published the content? + publisher = u'Newsfeeds des BSI' + # What is the content of? + category = u'Sie erfahren, wenn neue Nachrichten auf der Internetseite des BSI veröffentlicht werden' + # describes itself, ---- can be edit by user + use_embedded_content = False + # describes itself, ---- can be edit by user + language = 'de' + # encoding of content. e.g. utf-8, None, ... + # ---- can be edit by user + encoding = None # 'utf-8' doesn't work here + # Removes javascript- why keep this, we only want static content + remove_javascript = True + # Removes empty feeds - why keep them!? + remove_empty_feeds = True + + # remove the rubbish (in ebook) + auto_cleanup = True + # now the content description and URL follows + # feel free to add, wipe out what you need ---- can be edit by user + # + # some of this are double + # + # + # Make some tests, may you first comment all of them out, and step by step you add what you'll need? + # + + feeds = [ + ('BSI - Germany - Sicherheitshinweise des Buerger-CERT', + 'https://www.bsi-fuer-buerger.de/SiteGlobals/Functions/RSSFeed/RSSNewsfessBSIFB/RSSNewsfeed_BuergerCERT.xml' + ), + ('BSI - Germany - Aktuelle Informationen BSI f\xfcr B\xfcrger', + 'https://www.bsi-fuer-buerger.de/SiteGlobals/Functions/RSSFeed/RSSNewsfessBSIFB/RSSNewsfeed_Buerger_aktuelle_Informationen.xml' + ), + ('Kurzinformationen des CERT-Bund zu Sicherheitsl\xfccken und Schwachstellen in IT-Systemen', + 'https://www.bsi.bund.de/SiteGlobals/Functions/RSSFeed/RSSNewsfeed/RSSNewsfeed_WID.xml' + ), + ('BSI - Germany - RSS-Newsfeed (Presse-, Kurzmitteilungen und Veranstaltungshinweise)', + 'https://www.bsi.bund.de/SiteGlobals/Functions/RSSFeed/RSSNewsfeed/RSSNewsfeed.xml' + ), + ] From 4543fc14c9c77dec9fa7f4e2d3b6a3192807c99a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Jan 2019 09:53:47 +0530 Subject: [PATCH 0177/2613] Improve Spiegel Online --- recipes/spiegelde.recipe | 218 +++++++++++++++++++++++++++++++++++---- 1 file changed, 198 insertions(+), 20 deletions(-) diff --git a/recipes/spiegelde.recipe b/recipes/spiegelde.recipe index 77d9558f95..7e7ee6c167 100644 --- a/recipes/spiegelde.recipe +++ b/recipes/spiegelde.recipe @@ -1,43 +1,221 @@ #!/usr/bin/env python2 - -__license__ = 'GPL v3' -__copyright__ = '2009, Darko Miletic ' -''' -spiegel.de -''' +# License: 'CC-BY-4.0' +# Copyright: '2019, vohe Based on the recipe by Darko Miletic ' +from datetime import datetime from calibre.web.feeds.news import BasicNewsRecipe +''' +spiegel germany free newsfeed +its free, read here: http://www.spiegel.de/dienste/besser-surfen-auf-spiegel-online-so-funktioniert-rss-a-1040321.html +this: ... Sie können unsere Nachrichten-Feeds kostenlos abonnieren - ... +''' +''' +feel free to modify this to your own needs +''' -class Spiegel_ger(BasicNewsRecipe): - title = 'Spiegel Online - German' - __author__ = 'Darko Miletic' - description = "Immer die neueste Meldung auf dem Schirm, sekundenaktuell und uebersichtlich: Mit dem RSS-Angebot von SPIEGEL ONLINE entgeht Ihnen keine wichtige Meldung mehr, selbst wenn Sie keinen Internet-Browser geoeffnet haben. Sie koennen unsere Nachrichten-Feeds ganz einfach abonnieren - unkompliziert, kostenlos und nach Ihren persoenlichen Themen-Vorlieben." # noqa - publisher = 'SPIEGEL ONLINE Gmbh' - category = 'SPIEGEL ONLINE, DER SPIEGEL, Nachrichten, News,Dienste, RSS, RSS, Feedreader, Newsfeed, iGoogle, Netvibes, Widget' +class Spiegel_DE_all(BasicNewsRecipe): + # Titel of the Recipe + title = u'Spiegel Online RSS - German alle Themen' + # Author + __author__ = u'Volker Heggemann, VoHe' + # oldes article to download (in days) ---- can be edit by user + # be careful, if there is a lot of news, the file size exceeds! oldest_article = 7 + # describes itself, ---- can be edit by user max_articles_per_feed = 100 + # speed up the download on fast computers be carefull (I test max.20) + # ---- can be edit by user + simultaneous_downloads = 10 + # description, some Reader show this in titlepage + # add date to description so for dayly downloads you can find them easier + # ---- can be edit by user + # description = ( + # "Ständig die neueste Meldung auf dem Schirm, sekundenaktuell und übersichtlich: Mit unserem RSS-Angebot entgeht Ihnen keine wichtige Meldung," + # "selbst wenn Sie keinen Internet-Browser geöffnet haben. Sie können unsere Nachrichten-Feeds kostenlos abonnieren - nach Ihren Themenvorlieben.") + # above a long description, but we use a shorter one + description = u'Spiegel Online RSS News' + # add fetching date to the description + description = description + ' fetched: ' + datetime.now( + ).strftime("%Y-%m-%d") # %H:%M:%S") + # Who published the content? + publisher = u'SPIEGEL ONLINE Gmbh' + cover_url = 'https://de.m.wikipedia.org/wiki/Datei:Spiegel_Online_logo.svg' + # What is the content of? + category = 'SPIEGEL ONLINE RSS' + # describes itself, ---- can be edit by user language = 'de' lang = 'de-DE' no_stylesheets = True + # describes itself, ---- can be edit by user use_embedded_content = False + # encoding of content. e.g. utf-8, None, ... + # ---- can be edit by user encoding = 'UTF-8' # AGe 2016-05-09 old: cp1252 + # Removes javascript- why keep this, we only want static content + remove_javascript = True + # Removes empty feeds - why keep them!? + remove_empty_feeds = True + resolve_internal_links = True + # remove the rubbish (in ebook) + auto_cleanup = True + # now the content description and URL follows + # feel free to add, wipe out what you need ---- can be edit by user + # + # Make some tests, may you first comment all of them out, and step by step you add what you'll need? + # + ''' keep_only_tags = [ dict(name='h2', attrs={'class': 'article-title'}), dict(id=['js-article-top-wide-asset', 'js-article-column']), ] + ''' remove_tags = [ dict(attrs={'class': lambda x: x and 'asset-html-box' in x.split()}), - dict( - attrs={'class': lambda x: x and 'article-social-bookmark' in x.split()}), - dict(attrs={'class': lambda x: x and 'article-newsfeed-box' in x.split()}), - dict(attrs={'class': lambda x: x and 'article-comments-box' in x.split()}), - dict( - attrs={'class': lambda x: x and 'article-functions-bottom' in x.split()}), + dict(attrs={ + 'class': lambda x: x and 'article-social-bookmark' in x.split() + }), + dict(attrs={ + 'class': lambda x: x and 'article-newsfeed-box' in x.split() + }), + dict(attrs={ + 'class': lambda x: x and 'article-comments-box' in x.split() + }), + dict(attrs={ + 'class': lambda x: x and 'article-functions-bottom' in x.split() + }), ] + # omit articles already linked in Schlagzeilen feed + ignore_duplicate_articles = {'title', 'url'} + conversion_options = { - 'comment': description, 'tags': category, 'publisher': publisher, 'language': lang + 'comment': description, + 'tags': category, + 'publisher': publisher, + 'language': lang } - feeds = [(u'Spiegel Online', u'http://www.spiegel.de/schlagzeilen/index.rss')] + feeds = [ # Content / Inhalt + # Add or Remove the '#' symbol in front of line, to get or discard this rss-feed + # de: lösche oder füge am Anfang jeder Zeile das # Zeichen. Damit wird die Zeile entfernt oder + # hinugefügt und damit der Inhalt im Text erscheinen. + # + # ---- each line can be edit by user + # de: jede Zeile kann verändert werden. + # + # Sample: + # Theme of the following news + # (u'Alle Ressort',u'http://www.spiegel.de/schlagzeilen/index.rss'), + # Beispiel + # Theme of the following news + # (u'Spiegel Online', u'http://www.spiegel.de/schlagzeilen/index.rss'), + # + # + # "Alles" enthält die Themen Politik, Wirtschaft, Panorama , uws.... + # wenn Sie alles und die Unterthemen wählen, dann erscheinen News doppelt. + # + # Alles + # (u'Spiegel Online alle Schlagzeilen', u'http://www.spiegel.de/schlagzeilen/index.rss'), + # (u'Spiegel Online nur Topnews',u'http://www.spiegel.de/schlagzeilen/tops/index.rss'), + # (u'Spiegel Online nur Eilmeldungen', u'http://www.spiegel.de/schlagzeilen/eilmeldungen/index.rss'), + # (u'Spiegel Online alle Videos',u'http://www.spiegel.de/video/index.rss'), + # Politik / Politics + # (u'Politics global',u'http://www.spiegel.de/politik/index.rss'), + (u'Politics foreign countries', + u'http://www.spiegel.de/politik/ausland/index.rss'), + (u'Politik DE', + u'http://www.spiegel.de/politik/deutschland/index.rss'), + # Wirtschaft / economy + # (u'Wirtschaft alles', u'http://www.spiegel.de/wirtschaft/index.rss'), + (u'Wirtschaft Verbraucher und Service', + u'http://www.spiegel.de/wirtschaft/service/index.rss'), + (u'Wirtschaft Unternehmen und Märkte', + u'http://www.spiegel.de/wirtschaft/unternehmen/index.rss'), + (u'Wirtschaft Staat und Soziales', + u'http://www.spiegel.de/wirtschaft/soziales/index.rss'), + (u'Wirtschaft Videos aus Politik und Wirtschaft', + u'http://www.spiegel.de/video/politik_wirtschaft/index.rss'), + # Panorama / panorama (overview) + # (u'Panorama alles', u'http://www.spiegel.de/panorama/index.rss'), + (u'Panorama Justiz', + u'http://www.spiegel.de/panorama/justiz/index.rss'), + (u'Panorama Gesellschaft', + u'http://www.spiegel.de/panorama/gesellschaft/index.rss'), + (u'Panorama Leute', u'http://www.spiegel.de/panorama/leute/index.rss'), + (u'Panorama Videos aus Panorama', + u'http://www.spiegel.de/video/panorama/index.rss'), + # Sport / Sports + (u'Sport alles', u'http://www.spiegel.de/sport/index.rss'), + # (u'Sport Fußball', u'http://www.spiegel.de/sport/fussball/index.rss'), + # (u'Sport Formel1', u'http://www.spiegel.de/sport/formel1/index.rss'), + # (u'Sport Videos', u'http://www.spiegel.de/video/sport/index.rss'), + # Kultur / culture + # (u'Kultur alles', u'http://www.spiegel.de/kultur/index.rss'), + (u'Kultur Kino', u'http://www.spiegel.de/kultur/kino/index.rss'), + (u'Kultur Musik', u'http://www.spiegel.de/kultur/musik/index.rss'), + (u'Kultur TV', u'http://www.spiegel.de/kultur/tv/index.rss'), + (u'Kultur Literatur', + u'http://www.spiegel.de/kultur/literatur/index.rss'), + (u'Kultur Videos zu Kino', + u'http://www.spiegel.de/video/kino/index.rss'), + (u'Kultur Videos zu Kultur', + u'http://www.spiegel.de/video/kultur/index.rss'), + # Netzwelt / TheNet + # (u'Netzwelt alles', u'http://www.spiegel.de/netzwelt/index.rss'), + (u'Netzwelt Politk', + u'http://www.spiegel.de/netzwelt/netzpolitik/index.rss'), + (u'Netzwelt TheWeb', u'http://www.spiegel.de/netzwelt/web/index.rss'), + (u'Netzwelt Gadgets', + u'http://www.spiegel.de/netzwelt/gadgets/index.rss'), + (u'Netzwelt Games', u'http://www.spiegel.de/netzwelt/games/index.rss'), + (u'Videos zu Wissenschaft und Technik', + u'http://www.spiegel.de/video/wissenschaft_technik/index.rss'), + # Foto + (u'Fotografie', u'http://www.spiegel.de/thema/fotografie/index.rss'), + # Wissenschaft / Technologie + # (u'Wissenschaft alles', u'http://www.spiegel.de/wissenschaft/index.rss'), + (u'Wissenschaft Mensch', + u'http://www.spiegel.de/wissenschaft/mensch/index.rss'), + (u'Wissenschaft Natur', + u'http://www.spiegel.de/wissenschaft/natur/index.rss'), + (u'Wissenschaft Technik', + u'http://www.spiegel.de/wissenschaft/technik/index.rss'), + (u'Wissenschaft Weltall', + u'http://www.spiegel.de/wissenschaft/weltall/index.rss'), + (u'Wissenschaft Medizin', + u'http://www.spiegel.de/wissenschaft/medizin/index.rss'), + (u'Videos zu Wissenschaft', + u'http://www.spiegel.de/video/wissenschaft_technik/index.rss'), + # Gesundheit / Health + # (u'Gesundheit alles', u'http://www.spiegel.de/gesundheit/index.rss'), + (u'Gesundheit Diagnose und Therapie', + u'http://www.spiegel.de/gesundheit/diagnose/index.rss'), + (u'Gesundheit Ernährung und Fitness', + u'http://www.spiegel.de/gesundheit/ernaehrung/index.rss'), + (u'Gesundheit Psychologie', + u'http://www.spiegel.de/gesundheit/psychologie/index.rss'), + (u'Gesundheit Sex und Partnerschaft', + u'http://www.spiegel.de/gesundheit/sex/index.rss'), + (u'Gesundheit Schwangerschaft und Kind', + u'http://www.spiegel.de/gesundheit/schwangerschaft/index.rss'), + # Karriere / Career + # (u'Karriere alles', u'http://www.spiegel.de/karriere/index.rss'), + (u'Karriere Berufsstart', + u'http://www.spiegel.de/karriere/berufsstart/index.rss'), + (u'Karriere Beruf', + u'http://www.spiegel.de/karriere/berufsleben/index.rss'), + (u'Karriere Ausland', + u'http://www.spiegel.de/karriere/ausland/index.rss'), + # Uni und Schule + (u'Uni und Schule', u'http://www.spiegel.de/unispiegel/index.rss'), + # Reise / Travel + # (u'Reise alles', u'http://www.spiegel.de/reise/index.rss'), + (u'Reise Städte', u'http://www.spiegel.de/reise/staedte/index.rss'), + (u'Reise Detuschland', + u'http://www.spiegel.de/reise/deutschland/index.rss'), + (u'Reise Europa', u'http://www.spiegel.de/reise/europa/index.rss'), + (u'Reise Fernweh', u'http://www.spiegel.de/reise/fernweh/index.rss'), + # Auto + (u'Auto', u'http://www.spiegel.de/auto/index.rss'), + ] From 57a68ad841f46551d6f3545607d810dae7a2be32 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Jan 2019 19:55:52 +0530 Subject: [PATCH 0178/2613] Refactor copy to library backend code to make it re-useable Also add tests for it --- src/calibre/db/copy_to_library.py | 111 ++++++++++++++++++ src/calibre/db/tests/add_remove.py | 46 ++++++++ src/calibre/gui2/actions/copy_to_library.py | 122 +++----------------- 3 files changed, 176 insertions(+), 103 deletions(-) create mode 100644 src/calibre/db/copy_to_library.py diff --git a/src/calibre/db/copy_to_library.py b/src/calibre/db/copy_to_library.py new file mode 100644 index 0000000000..1141b01052 --- /dev/null +++ b/src/calibre/db/copy_to_library.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +# License: GPL v3 Copyright: 2019, Kovid Goyal + +from __future__ import absolute_import, division, print_function, unicode_literals + +from calibre.db.utils import find_identical_books +from calibre.utils.config import tweaks +from calibre.utils.date import now +from polyglot.builtins import iteritems + + +def automerge_book(automerge_action, book_id, mi, identical_book_list, newdb, format_map): + seen_fmts = set() + replace = automerge_action == 'overwrite' + for identical_book in identical_book_list: + ib_fmts = newdb.formats(identical_book) + if ib_fmts: + seen_fmts |= {fmt.upper() for fmt in ib_fmts} + for fmt, path in iteritems(format_map): + newdb.add_format(identical_book, fmt, path, replace=replace, run_hooks=False) + + if automerge_action == 'new record': + incoming_fmts = {fmt.upper() for fmt in format_map} + + if incoming_fmts.intersection(seen_fmts): + # There was at least one duplicate format + # so create a new record and put the + # incoming formats into it + # We should arguably put only the duplicate + # formats, but no real harm is done by having + # all formats + return newdb.add_books( + [(mi, format_map)], add_duplicates=True, apply_import_tags=tweaks['add_new_book_tags_when_importing_books'], + preserve_uuid=False, run_hooks=False)[0][0] + + +def postprocess_copy(book_id, new_book_id, new_authors, db, newdb, identical_books_data, duplicate_action): + if not new_book_id: + return + if new_authors: + author_id_map = db.get_item_ids('authors', new_authors) + sort_map, link_map = {}, {} + for author, aid in iteritems(author_id_map): + if aid is not None: + adata = db.author_data((aid,)).get(aid) + if adata is not None: + aid = newdb.get_item_id('authors', author) + if aid is not None: + asv = adata.get('sort') + if asv: + sort_map[aid] = asv + alv = adata.get('link') + if alv: + link_map[aid] = alv + if sort_map: + newdb.set_sort_for_authors(sort_map, update_books=False) + if link_map: + newdb.set_link_for_authors(link_map) + + co = db.conversion_options(book_id, 'PIPE') + if co is not None: + newdb.set_conversion_options(new_book_id, 'PIPE', co) + if identical_books_data is not None and duplicate_action != 'add': + newdb.update_data_for_find_identical_books(new_book_id, identical_books_data) + + +def copy_one_book( + book_id, src_db, dest_db, duplicate_action='add', automerge_action='overwrite', + preserve_date=True, identical_books_data=None, preserve_uuid=False): + db = src_db.new_api + newdb = dest_db.new_api + with db.safe_read_lock, newdb.write_lock: + mi = db.get_metadata(book_id, get_cover=True, cover_as_data=True) + if not preserve_date: + mi.timestamp = now() + format_map = {} + fmts = list(db.formats(book_id, verify_formats=False)) + for fmt in fmts: + path = db.format_abspath(book_id, fmt) + if path: + format_map[fmt.upper()] = path + identical_book_list = set() + new_authors = {k for k, v in iteritems(newdb.get_item_ids('authors', mi.authors)) if v is None} + new_book_id = None + return_data = { + 'book_id': book_id, 'title': mi.title, 'authors': mi.authors, 'author': mi.format_field('authors')[1], + 'action': 'add', 'new_book_id': None + } + if duplicate_action != 'add': + # Scanning for dupes can be slow on a large library so + # only do it if the option is set + if identical_books_data is None: + identical_books_data = identical_books_data = newdb.data_for_find_identical_books() + identical_book_list = find_identical_books(mi, identical_books_data) + if identical_book_list: # books with same author and nearly same title exist in newdb + if duplicate_action == 'add_formats_to_existing': + new_book_id = automerge_book(automerge_action, book_id, mi, identical_book_list, newdb, format_map) + return_data['action'] = 'automerge' + return_data['new_book_id'] = new_book_id + postprocess_copy(book_id, new_book_id, new_authors, db, newdb, identical_books_data, duplicate_action) + else: + return_data['action'] = 'duplicate' + return return_data + + new_book_id = newdb.add_books( + [(mi, format_map)], add_duplicates=True, apply_import_tags=tweaks['add_new_book_tags_when_importing_books'], + preserve_uuid=preserve_uuid, run_hooks=False)[0][0] + postprocess_copy(book_id, new_book_id, new_authors, db, newdb, identical_books_data, duplicate_action) + return_data['new_book_id'] = new_book_id + return return_data diff --git a/src/calibre/db/tests/add_remove.py b/src/calibre/db/tests/add_remove.py index d9c2b3f88c..7dee5d33ec 100644 --- a/src/calibre/db/tests/add_remove.py +++ b/src/calibre/db/tests/add_remove.py @@ -305,3 +305,49 @@ class AddRemoveTest(BaseTest): self.assertEqual(len(old), len(new)) self.assertNotIn(prefix, cache.fields['formats'].format_fname(1, 'FMT1')) # }}} + + def test_copy_to_library(self): # {{{ + from calibre.db.copy_to_library import copy_one_book + from calibre.ebooks.metadata import authors_to_string + src_db = self.init_cache() + dest_db = self.init_cache(self.cloned_library) + + def make_rdata(book_id=1, new_book_id=None, action='add'): + return { + 'title': src_db.field_for('title', book_id), + 'authors': list(src_db.field_for('authors', book_id)), + 'author': authors_to_string(src_db.field_for('authors', book_id)), + 'book_id': book_id, 'new_book_id': new_book_id, 'action': action + } + + def compare_field(field, func=self.assertEqual): + func(src_db.field_for(field, rdata['book_id']), dest_db.field_for(field, rdata['new_book_id'])) + + rdata = copy_one_book(1, src_db, dest_db) + self.assertEqual(rdata, make_rdata(new_book_id=max(dest_db.all_book_ids()))) + compare_field('timestamp') + compare_field('uuid', self.assertNotEqual) + rdata = copy_one_book(1, src_db, dest_db, preserve_date=False, preserve_uuid=True) + self.assertEqual(rdata, make_rdata(new_book_id=max(dest_db.all_book_ids()))) + compare_field('timestamp', self.assertNotEqual) + compare_field('uuid') + rdata = copy_one_book(1, src_db, dest_db, duplicate_action='ignore') + self.assertIsNone(rdata['new_book_id']) + self.assertEqual(rdata['action'], 'duplicate') + src_db.add_format(1, 'FMT1', BytesIO(b'replaced'), run_hooks=False) + rdata = copy_one_book(1, src_db, dest_db, duplicate_action='add_formats_to_existing') + self.assertEqual(rdata['action'], 'automerge') + for new_book_id in (1, 4, 5): + self.assertEqual(dest_db.format(new_book_id, 'FMT1'), b'replaced') + src_db.add_format(1, 'FMT1', BytesIO(b'second-round'), run_hooks=False) + rdata = copy_one_book(1, src_db, dest_db, duplicate_action='add_formats_to_existing', automerge_action='ignore') + self.assertEqual(rdata['action'], 'automerge') + for new_book_id in (1, 4, 5): + self.assertEqual(dest_db.format(new_book_id, 'FMT1'), b'replaced') + rdata = copy_one_book(1, src_db, dest_db, duplicate_action='add_formats_to_existing', automerge_action='new record') + self.assertEqual(rdata['action'], 'automerge') + for new_book_id in (1, 4, 5): + self.assertEqual(dest_db.format(new_book_id, 'FMT1'), b'replaced') + self.assertEqual(dest_db.format(rdata['new_book_id'], 'FMT1'), b'second-round') + + # }}} diff --git a/src/calibre/gui2/actions/copy_to_library.py b/src/calibre/gui2/actions/copy_to_library.py index ed4e88d35c..f9a1e269e4 100644 --- a/src/calibre/gui2/actions/copy_to_library.py +++ b/src/calibre/gui2/actions/copy_to_library.py @@ -18,15 +18,14 @@ from PyQt5.Qt import ( from calibre import as_unicode from calibre.constants import isosx -from calibre.db.utils import find_identical_books from calibre.gui2.actions import InterfaceAction from calibre.gui2 import (error_dialog, Dispatcher, warning_dialog, gprefs, info_dialog, choose_dir) from calibre.gui2.dialogs.progress import ProgressDialog from calibre.gui2.widgets2 import Dialog -from calibre.utils.config import prefs, tweaks -from calibre.utils.date import now +from calibre.utils.config import prefs from calibre.utils.icu import sort_key, numeric_sort_key +from calibre.db.copy_to_library import copy_one_book def ask_about_cc_mismatch(gui, db, newdb, missing_cols, incompatible_cols): # {{{ @@ -140,17 +139,11 @@ class Worker(Thread): # {{{ self.done() - def add_formats(self, id_, paths, newdb, replace=True): - for path in paths: - fmt = os.path.splitext(path)[-1].replace('.', '').upper() - with lopen(path, 'rb') as f: - newdb.add_format(id_, fmt, f, index_is_id=True, - notify=False, replace=replace) - def doit(self): from calibre.gui2.ui import get_gui library_broker = get_gui().library_broker newdb = library_broker.get_library(self.loc) + self.find_identical_books_data = None try: if self.check_for_duplicates: self.find_identical_books_data = newdb.new_api.data_for_find_identical_books() @@ -171,102 +164,25 @@ class Worker(Thread): # {{{ self.failed_books[x] = (err, as_unicode(traceback.format_exc())) def do_one(self, num, book_id, newdb): - mi = self.db.get_metadata(book_id, index_is_id=True, get_cover=True, cover_as_data=True) - if not gprefs['preserve_date_on_ctl']: - mi.timestamp = now() - self.progress(num, mi.title) - fmts = self.db.formats(book_id, index_is_id=True) - if not fmts: - fmts = [] - else: - fmts = fmts.split(',') - identical_book_list = set() - paths = [] - for fmt in fmts: - p = self.db.format(book_id, fmt, index_is_id=True, - as_path=True) - if p: - paths.append(p) - try: - if self.check_for_duplicates: - # Scanning for dupes can be slow on a large library so - # only do it if the option is set - identical_book_list = find_identical_books(mi, self.find_identical_books_data) - if identical_book_list: # books with same author and nearly same title exist in newdb - if prefs['add_formats_to_existing']: - self.automerge_book(book_id, mi, identical_book_list, paths, newdb) - else: # Report duplicates for later processing - self.duplicate_ids[book_id] = (mi.title, mi.authors) - return - - new_authors = {k for k, v in newdb.new_api.get_item_ids('authors', mi.authors).iteritems() if v is None} - new_book_id = newdb.import_book(mi, paths, notify=False, import_hooks=False, - apply_import_tags=tweaks['add_new_book_tags_when_importing_books'], - preserve_uuid=self.delete_after) - if new_authors: - author_id_map = self.db.new_api.get_item_ids('authors', new_authors) - sort_map, link_map = {}, {} - for author, aid in author_id_map.iteritems(): - if aid is not None: - adata = self.db.new_api.author_data((aid,)).get(aid) - if adata is not None: - aid = newdb.new_api.get_item_id('authors', author) - if aid is not None: - asv = adata.get('sort') - if asv: - sort_map[aid] = asv - alv = adata.get('link') - if alv: - link_map[aid] = alv - if sort_map: - newdb.new_api.set_sort_for_authors(sort_map, update_books=False) - if link_map: - newdb.new_api.set_link_for_authors(link_map) - - co = self.db.conversion_options(book_id, 'PIPE') - if co is not None: - newdb.set_conversion_options(new_book_id, 'PIPE', co) - if self.check_for_duplicates: - newdb.new_api.update_data_for_find_identical_books(new_book_id, self.find_identical_books_data) - self.processed.add(book_id) - finally: - for path in paths: - try: - os.remove(path) - except: - pass - - def automerge_book(self, book_id, mi, identical_book_list, paths, newdb): - self.auto_merged_ids[book_id] = _('%(title)s by %(author)s') % dict(title=mi.title, author=mi.format_field('authors')[1]) - seen_fmts = set() + duplicate_action = 'add' + if self.check_for_duplicates: + duplicate_action = 'add_formats_to_existing' if prefs['add_formats_to_existing'] else 'ignore' + rdata = copy_one_book( + book_id, self.db, newdb, + preserve_date=gprefs['preserve_date_on_ctl'], + duplicate_action=duplicate_action, automerge_action=gprefs['automerge'], + identical_books_data=self.find_identical_books_data, + preserve_uuid=self.delete_after + ) + self.progress(num, rdata['title']) + if rdata['action'] == 'automerge': + self.auto_merged_ids[book_id] = _('%(title)s by %(author)s') % dict(title=rdata['title'], author=rdata['author']) + elif rdata['action'] == 'duplicate': + self.duplicate_ids[book_id] = (rdata['title'], rdata['authors']) self.processed.add(book_id) - for identical_book in identical_book_list: - ib_fmts = newdb.formats(identical_book, index_is_id=True) - if ib_fmts: - seen_fmts |= set(ib_fmts.split(',')) - replace = gprefs['automerge'] == 'overwrite' - self.add_formats(identical_book, paths, newdb, - replace=replace) - - if gprefs['automerge'] == 'new record': - incoming_fmts = \ - {os.path.splitext(path)[-1].replace('.', - '').upper() for path in paths} - - if incoming_fmts.intersection(seen_fmts): - # There was at least one duplicate format - # so create a new record and put the - # incoming formats into it - # We should arguably put only the duplicate - # formats, but no real harm is done by having - # all formats - newdb.import_book(mi, paths, notify=False, import_hooks=False, - apply_import_tags=tweaks['add_new_book_tags_when_importing_books'], - preserve_uuid=False) - - # }}} + class ChooseLibrary(Dialog): # {{{ def __init__(self, parent, locations): From 0bd223a88a0235e9e8ce67ec9f1b048416724c29 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Jan 2019 21:07:03 +0530 Subject: [PATCH 0179/2613] Use native code for setting thread names Fixes #924 (Fixed exception not caught in Startup.py thrown by "pthread_setname_np" on Linux) --- src/calibre/startup.py | 46 ++++++++++++---------------- src/calibre/utils/speedup.c | 60 +++++++++++++++++++++++++++++++++---- 2 files changed, 73 insertions(+), 33 deletions(-) diff --git a/src/calibre/startup.py b/src/calibre/startup.py index c18375b6fc..100d7110dc 100644 --- a/src/calibre/startup.py +++ b/src/calibre/startup.py @@ -17,7 +17,7 @@ __builtin__.__dict__['_'] = lambda s: s # immediately translated to the environment language __builtin__.__dict__['__'] = lambda s: s -from calibre.constants import iswindows, preferred_encoding, plugins, isosx, islinux, isfrozen, DEBUG +from calibre.constants import iswindows, preferred_encoding, plugins, isosx, islinux, isfrozen, DEBUG, isfreebsd _run_once = False winutil = winutilerror = None @@ -172,36 +172,28 @@ if not _run_once: bound_signal.connect(slot, **kw) __builtin__.__dict__['connect_lambda'] = connect_lambda - if islinux: + if islinux or isosx or isfreebsd: # Name all threads at the OS level created using the threading module, see # http://bugs.python.org/issue15500 - import ctypes, ctypes.util, threading - libpthread_path = ctypes.util.find_library("pthread") - if libpthread_path: - libpthread = ctypes.CDLL(libpthread_path) - if hasattr(libpthread, "pthread_setname_np"): - pthread_setname_np = libpthread.pthread_setname_np - pthread_setname_np.argtypes = [ctypes.c_void_p, ctypes.c_char_p] - pthread_setname_np.restype = ctypes.c_int - orig_start = threading.Thread.start + import threading - def new_start(self): - orig_start(self) - try: + orig_start = threading.Thread.start + + def new_start(self): + orig_start(self) + try: + name = self.name + if not name or name.startswith('Thread-'): + name = self.__class__.__name__ + if name == 'Thread': name = self.name - if not name or name.startswith('Thread-'): - name = self.__class__.__name__ - if name == 'Thread': - name = self.name - if name: - if isinstance(name, unicode): - name = name.encode('ascii', 'replace') - ident = getattr(self, "ident", None) - if ident is not None: - pthread_setname_np(ident, name[:15]) - except Exception: - pass # Don't care about failure to set name - threading.Thread.start = new_start + if name: + if isinstance(name, unicode): + name = name.encode('ascii', 'replace').decode('ascii') + plugins['speedup'][0].set_thread_name(name[:15]) + except Exception: + pass # Don't care about failure to set name + threading.Thread.start = new_start def test_lopen(): diff --git a/src/calibre/utils/speedup.c b/src/calibre/utils/speedup.c index 69e2631233..daf07e5f21 100644 --- a/src/calibre/utils/speedup.c +++ b/src/calibre/utils/speedup.c @@ -1,10 +1,12 @@ #define UNICODE #include #include +#include #include #include #include +#include #define _USE_MATH_DEFINES #include #include @@ -42,7 +44,7 @@ speedup_parse_date(PyObject *self, PyObject *args) { year = strtol(raw, &end, 10); if ((end - raw) != 4) Py_RETURN_NONE; raw += 5; - + month = strtol(raw, &end, 10); if ((end - raw) != 2) Py_RETURN_NONE; @@ -51,7 +53,7 @@ speedup_parse_date(PyObject *self, PyObject *args) { day = strtol(raw, &end, 10); if ((end - raw) != 2) Py_RETURN_NONE; raw += 3; - + hour = strtol(raw, &end, 10); if ((end - raw) != 2) Py_RETURN_NONE; raw += 3; @@ -88,7 +90,7 @@ static PyObject* speedup_pdf_float(PyObject *self, PyObject *args) { double f = 0.0, a = 0.0; char *buf = "0", *dot; - void *free_buf = NULL; + void *free_buf = NULL; int precision = 6, l = 0; PyObject *ret; @@ -215,7 +217,7 @@ speedup_create_texture(PyObject *self, PyObject *args, PyObject *kw) { } } - // Create the texture in PPM (P6) format + // Create the texture in PPM (P6) format memcpy(ppm, header, strlen(header)); t = ppm + strlen(header); for (i = 0, j = 0; j < width * height; i += 3, j += 1) { @@ -340,7 +342,7 @@ clean_xml_chars(PyObject *self, PyObject *text) { for (; i < PyUnicode_GET_SIZE(text); i++) { ch = PyUnicode_AS_UNICODE(text)[i]; #ifdef Py_UNICODE_WIDE - if ((0x20 <= ch && ch <= 0xd7ff && ch != 0x7f) || ch == 9 || ch == 10 || ch == 13 || (0xe000 <= ch && ch <= 0xfffd) || (0xffff < ch && ch <= 0x10ffff)) + if ((0x20 <= ch && ch <= 0xd7ff && ch != 0x7f) || ch == 9 || ch == 10 || ch == 13 || (0xe000 <= ch && ch <= 0xfffd) || (0xffff < ch && ch <= 0x10ffff)) buf[j++] = ch; #else if ((0x20 <= ch && ch <= 0xd7ff && ch != 0x7f) || ch == 9 || ch == 10 || ch == 13 || (0xd000 <= ch && ch <= 0xfffd)) { @@ -349,7 +351,7 @@ clean_xml_chars(PyObject *self, PyObject *text) { if (ch <= 0xdbff && i + 1 < PyUnicode_GET_SIZE(text) && 0xdc00 <= PyUnicode_AS_UNICODE(text)[i + 1] && PyUnicode_AS_UNICODE(text)[i+1] <= 0xdfff) { buf[j++] = ch; buf[j++] = PyUnicode_AS_UNICODE(text)[++i]; } - } else + } else buf[j++] = ch; } #endif @@ -490,6 +492,48 @@ speedup_iso_8601(PyObject *self, PyObject *args) { return Py_BuildValue("NOi", PyDateTime_FromDateAndTime(year, month, day, hour, minute, second, usecond), (tzhour == 1000) ? Py_False : Py_True, tzsign*60*(tzhour*60 + tzminute)); } +#if defined(__FreeBSD__) || defined(__OpenBSD__) +#define FREEBSD_SET_NAME +#endif +#if defined(__APPLE__) +// I cant figure out how to get pthread.h to include this definition on macOS. MACOSX_DEPLOYMENT_TARGET does not work. +extern int pthread_setname_np(const char *name); +#elif defined(FREEBSD_SET_NAME) +// Function has a different name on FreeBSD +void pthread_set_name_np(pthread_t tid, const char *name); +#else +// Need _GNU_SOURCE for pthread_setname_np on linux and that causes other issues on systems with old glibc +extern int pthread_setname_np(pthread_t, const char *name); +#endif + + +static PyObject* +set_thread_name(PyObject *self, PyObject *args) { + (void)(self); (void)(args); +#if defined(_MSC_VER) + PyErr_SetString(PyExc_OSError, "Setting thread names not supported on windows"); + return NULL; +#else + char *name; + int ret; + if (!PyArg_ParseTuple(args, "s", &name)) return NULL; + while (1) { + errno = 0; +#if defined(__APPLE__) + ret = pthread_setname_np(name); +#elif defined(FREEBSD_SET_NAME) + pthread_set_name_np(pthread_self(), name); + ret = 0; +#else + ret = pthread_setname_np(pthread_self(), name); +#endif + if (ret != 0 && (errno == EINTR || errno == EAGAIN)) continue; + break; + } + if (ret != 0) { PyErr_SetFromErrno(PyExc_OSError); return NULL; } + Py_RETURN_NONE; +#endif +} static PyMethodDef speedup_methods[] = { {"parse_date", speedup_parse_date, METH_VARARGS, @@ -534,6 +578,10 @@ static PyMethodDef speedup_methods[] = { "clean_xml_chars(unicode_object)\n\nRemove codepoints in unicode_object that are not allowed in XML" }, + {"set_thread_name", set_thread_name, METH_VARARGS, + "set_thread_name(name)\n\nWrapper for pthread_setname_np" + }, + {NULL, NULL, 0, NULL} }; From 51193d113bc0620ead036ef3bbf8b2fa5df16423 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Jan 2019 21:12:29 +0530 Subject: [PATCH 0180/2613] Dont include pthread.h on windows --- src/calibre/utils/speedup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/utils/speedup.c b/src/calibre/utils/speedup.c index daf07e5f21..70a691e369 100644 --- a/src/calibre/utils/speedup.c +++ b/src/calibre/utils/speedup.c @@ -6,7 +6,6 @@ #include #include #include -#include #define _USE_MATH_DEFINES #include #include @@ -492,6 +491,9 @@ speedup_iso_8601(PyObject *self, PyObject *args) { return Py_BuildValue("NOi", PyDateTime_FromDateAndTime(year, month, day, hour, minute, second, usecond), (tzhour == 1000) ? Py_False : Py_True, tzsign*60*(tzhour*60 + tzminute)); } +#ifndef _MSC_VER +#include +#endif #if defined(__FreeBSD__) || defined(__OpenBSD__) #define FREEBSD_SET_NAME #endif From c81c6c13b6f6105b16fa5d2d0af41b91bbafa35e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Jan 2019 21:16:53 +0530 Subject: [PATCH 0181/2613] ... --- src/calibre/utils/speedup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/utils/speedup.c b/src/calibre/utils/speedup.c index 70a691e369..850c1f11c6 100644 --- a/src/calibre/utils/speedup.c +++ b/src/calibre/utils/speedup.c @@ -493,7 +493,6 @@ speedup_iso_8601(PyObject *self, PyObject *args) { #ifndef _MSC_VER #include -#endif #if defined(__FreeBSD__) || defined(__OpenBSD__) #define FREEBSD_SET_NAME #endif @@ -507,6 +506,7 @@ void pthread_set_name_np(pthread_t tid, const char *name); // Need _GNU_SOURCE for pthread_setname_np on linux and that causes other issues on systems with old glibc extern int pthread_setname_np(pthread_t, const char *name); #endif +#endif static PyObject* From 0daad01a040e0e18eaf5a0807c92d7399b9127c6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Jan 2019 21:20:35 +0530 Subject: [PATCH 0182/2613] Better error when setting thread names on Windows --- src/calibre/utils/speedup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/utils/speedup.c b/src/calibre/utils/speedup.c index 850c1f11c6..bdad0a7c6d 100644 --- a/src/calibre/utils/speedup.c +++ b/src/calibre/utils/speedup.c @@ -513,7 +513,7 @@ static PyObject* set_thread_name(PyObject *self, PyObject *args) { (void)(self); (void)(args); #if defined(_MSC_VER) - PyErr_SetString(PyExc_OSError, "Setting thread names not supported on windows"); + PyErr_SetString(PyExc_RuntimeError, "Setting thread names not supported on Windows"); return NULL; #else char *name; From 053056c0d98bb7103e117eb1e7a40cd49670084d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 28 Jan 2019 14:41:59 +0530 Subject: [PATCH 0183/2613] Content server: Implement the "Copy to library" function. To use it click the three dots in the top right corner of a book's page and choose "Copy to library". Fixes #1810486 [[Feature] Copy to another library on the server](https://bugs.launchpad.net/calibre/+bug/1810486) --- src/calibre/srv/cdb.py | 72 +++++++++++++++--- src/pyj/book_list/book_details.pyj | 113 +++++++++++++++++++++++++++-- src/pyj/book_list/delete_book.pyj | 16 ++-- src/pyj/book_list/home.pyj | 5 +- src/pyj/book_list/library_data.pyj | 6 ++ 5 files changed, 185 insertions(+), 27 deletions(-) diff --git a/src/calibre/srv/cdb.py b/src/calibre/srv/cdb.py index 81d86d46d1..54251bf769 100644 --- a/src/calibre/srv/cdb.py +++ b/src/calibre/srv/cdb.py @@ -124,24 +124,28 @@ def cdb_set_cover(ctx, rd, book_id, library_id): return tuple(dirtied) +def load_payload_data(rd): + raw = rd.read() + ct = rd.inheaders.get('Content-Type', all=True) + ct = {x.lower().partition(';')[0] for x in ct} + try: + if MSGPACK_MIME in ct: + return msgpack_loads(raw) + elif 'application/json' in ct: + return json_loads(raw) + else: + raise HTTPBadRequest('Only JSON or msgpack requests are supported') + except Exception: + raise HTTPBadRequest('Invalid encoded data') + + @endpoint('/cdb/set-fields/{book_id}/{library_id=None}', types={'book_id': int}, needs_db_write=True, postprocess=msgpack_or_json, methods=receive_data_methods, cache_control='no-cache') def cdb_set_fields(ctx, rd, book_id, library_id): db = get_db(ctx, rd, library_id) if ctx.restriction_for(rd, db): raise HTTPForbidden('Cannot use the set fields interface with a user who has per library restrictions') - raw = rd.read() - ct = rd.inheaders.get('Content-Type', all=True) - ct = {x.lower().partition(';')[0] for x in ct} - try: - if MSGPACK_MIME in ct: - data = msgpack_loads(raw) - elif 'application/json' in ct: - data = json_loads(raw) - else: - raise HTTPBadRequest('Only JSON or msgpack requests are supported') - except Exception: - raise HTTPBadRequest('Invalid encoded data') + data = load_payload_data(rd) try: changes, loaded_book_ids = data['changes'], frozenset(map(int, data.get('loaded_book_ids', ()))) all_dirtied = bool(data.get('all_dirtied')) @@ -172,3 +176,47 @@ def cdb_set_fields(ctx, rd, book_id, library_id): all_ids = dirtied if all_dirtied else (dirtied & loaded_book_ids) all_ids |= {book_id} return {bid: book_as_json(db, book_id) for bid in all_ids} + + +@endpoint('/cdb/copy-to-library/{target_library_id}/{library_id=None}', needs_db_write=True, + postprocess=msgpack_or_json, methods=receive_data_methods, cache_control='no-cache') +def cdb_copy_to_library(ctx, rd, target_library_id, library_id): + db_src = get_db(ctx, rd, library_id) + db_dest = get_db(ctx, rd, target_library_id) + if ctx.restriction_for(rd, db_src) or ctx.restriction_for(rd, db_dest): + raise HTTPForbidden('Cannot use the copy to library interface with a user who has per library restrictions') + data = load_payload_data(rd) + try: + book_ids = {int(x) for x in data['book_ids']} + move_books = bool(data.get('move', False)) + preserve_date = bool(data.get('preserve_date', True)) + duplicate_action = data.get('duplicate_action') or 'add' + automerge_action = data.get('automerge_action') or 'overwrite' + except Exception: + raise HTTPBadRequest('Invalid encoded data, must be of the form: {book_ids: [id1, id2, ..]}') + if duplicate_action not in ('add', 'add_formats_to_existing'): + raise HTTPBadRequest('duplicate_action must be one of: add, add_formats_to_existing') + if automerge_action not in ('overwrite', 'ignore', 'new record'): + raise HTTPBadRequest('automerge_action must be one of: overwrite, ignore, new record') + response = {} + identical_books_data = None + if duplicate_action != 'add': + identical_books_data = db_dest.data_for_find_identical_books() + to_remove = set() + from calibre.db.copy_to_library import copy_one_book + for book_id in book_ids: + try: + rdata = copy_one_book( + book_id, db_src, db_dest, duplicate_action=duplicate_action, automerge_action=automerge_action, + preserve_uuid=move_books, preserve_date=preserve_date, identical_books_data=identical_books_data) + if move_books: + to_remove.add(book_id) + response[book_id] = {'ok': True, 'payload': rdata} + except Exception: + import traceback + response[book_id] = {'ok': False, 'payload': traceback.format_exc()} + + if to_remove: + db_src.remove_books(to_remove, permanent=True) + + return response diff --git a/src/pyj/book_list/book_details.pyj b/src/pyj/book_list/book_details.pyj index 6e1ff3df5a..e2c3231d05 100644 --- a/src/pyj/book_list/book_details.pyj +++ b/src/pyj/book_list/book_details.pyj @@ -6,13 +6,14 @@ import traceback from elementmaker import E from gettext import gettext as _ -from ajax import ajax, encode_query_component -from book_list.delete_book import start_delete_book +from ajax import ajax, ajax_send, encode_query_component +from book_list.delete_book import refresh_after_delete, start_delete_book from book_list.globals import get_session_data from book_list.item_list import create_item, create_item_list from book_list.library_data import ( - book_metadata, cover_url, current_library_id, current_virtual_library, - download_url, library_data, load_status, set_book_metadata + all_libraries, book_metadata, cover_url, current_library_id, + current_virtual_library, download_url, library_data, load_status, + set_book_metadata ) from book_list.router import back, home, open_book, report_a_load_failure from book_list.theme import get_color, get_font_size @@ -20,8 +21,8 @@ from book_list.top_bar import add_button, clear_buttons, create_top_bar, set_tit from book_list.ui import query_as_href, set_panel_handler, show_panel from book_list.views import search_query_for from date import format_date -from dom import add_extra_css, build_rule, clear, svgicon -from modals import create_custom_dialog, error_dialog +from dom import add_extra_css, build_rule, clear, ensure_id, svgicon +from modals import create_custom_dialog, error_dialog, warning_dialog from session import get_interface_data from utils import ( conditional_timeout, debounce, fmt_sidx, human_readable, parse_url_params, @@ -33,6 +34,7 @@ bd_counter = 0 CLASS_NAME = 'book-details-panel' SEARCH_INTERNET_CLASS = 'book-details-search-internet' +COPY_TO_LIBRARY_CLASS = 'book-details-copy-to-library' FORMAT_PRIORITIES = [ 'EPUB', 'AZW3', 'DOCX', 'LIT', 'MOBI', 'ODT', 'RTF', 'MD', 'MARKDOWN', 'TXT', 'PDF' ] @@ -384,6 +386,9 @@ add_extra_css(def(): style += build_rule(sel, margin='1ex 1em') style += build_rule(sel + ' ul > li', list_style_type='none') style += build_rule(sel + ' ul > li > a', padding='2ex 1em', display='block', width='100%') + + sel = '.' + COPY_TO_LIBRARY_CLASS + style += build_rule(sel, margin='1ex 1em') return style ) @@ -611,7 +616,13 @@ def create_more_actions_panel(container_id): action=def(): show_subsequent_panel('search_internet', replace=True) ), + create_item(title, subtitle=subtitle, action=toggle_fields), + + create_item(_('Copy to library'), subtitle=_('Copy or move this book to another calibre library'), + action=def(): + show_subsequent_panel('copy_to_library', replace=True) + ), ] container.appendChild(E.div()) create_item_list(container.lastChild, items) @@ -663,9 +674,99 @@ def search_internet(container_id): )) +def do_copy_to_library(book_id, target_library_id, target_library_name): + + def handle_result(move, close_func, end_type, xhr, ev): + close_func() + title = book_metadata(book_id).title + return_to_book_details() + if end_type is 'abort': + return + if end_type is not 'load': + error_dialog(_('Failed to copy book'), _( + 'Failed to copy the book "{}" click "Show details" for more information.').format(title), + xhr.error_html) + return + try: + response = JSON.parse(xhr.responseText)[book_id] + if not response: + raise Exception('bad') + except: + error_dialog(_('Failed to copy book'), _( + 'Failed to copy the book "{}" got an invalid response from calibre').format(title)) + return + if not response.ok: + error_dialog(_('Failed to copy book'), _( + 'Failed to copy the book "{}" click "Show details" for more information.').format(title), + response.payload + ) + return + if response.action is 'duplicate': + warning_dialog(_('Book already exists'), _( + 'Could not copy as a book with the same title and authors already exists in the {} library').format(target_library_name)) + + elif response.action is 'automerge': + warning_dialog(_('Book merged'), _( + 'The files from the book were merged into a book with the same title and authors in the {} library').format(target_library_name)) + if move: + refresh_after_delete(book_id, current_library_id()) + + + def trigger_copy(container_id, move, close_func): + data = {'book_ids':v'[book_id]', 'move': move} + container = document.getElementById(container_id) + clear(container) + container.appendChild(E.div( + _('Contacting calibre to copy book, please wait...'))) + ajax_send(f'cdb/copy-to-library/{target_library_id}/{current_library_id()}', + data, handle_result.bind(None, move, close_func)) + + create_custom_dialog(_('Copy to library'), def (container, close_func): + mi = book_metadata(book_id) + container_id = ensure_id(container) + container.appendChild(E.div( + E.div(_( + 'Copy "{title}" to the library "{target_library_name}"?').format( + title=mi.title, target_library_name=target_library_name) + ), + E.div( + class_='button-box', + create_button(_('Copy'), None, trigger_copy.bind(None, container_id, False, close_func), highlight=True), + '\xa0', + create_button(_('Move'), None, trigger_copy.bind(None, container_id, True, close_func)), + '\xa0', + create_button(_('Cancel'), None, close_func), + ) + )) + ) + + +def copy_to_library(container_id): + if not render_book.book_id or not book_metadata(render_book.book_id): + return return_to_book_details() + container = document.getElementById(container_id) + create_top_bar(container, title=_('Copy to library'), action=back, icon='close') + libraries = all_libraries() + container.appendChild(E.div(class_=COPY_TO_LIBRARY_CLASS)) + container = container.lastChild + if libraries.length < 2: + container.appendChild(E.div(_('There are no other calibre libraries available to copy the book to'))) + return + container.appendChild(E.h2(_('Choose the library to copy to below'))) + items = [] + for library_id, library_name in libraries: + if library_id is current_library_id(): + continue + items.push(create_item(library_name, action=do_copy_to_library.bind(None, render_book.book_id, library_id, library_name))) + container.appendChild(E.div()) + create_item_list(container.lastChild, items) + + + def delete_book(): start_delete_book(current_library_id(), render_book.book_id, render_book.title or _('Unknown')) set_panel_handler('book_details', init) set_panel_handler('book_details^more_actions', create_more_actions_panel) set_panel_handler('book_details^search_internet', search_internet) +set_panel_handler('book_details^copy_to_library', copy_to_library) diff --git a/src/pyj/book_list/delete_book.pyj b/src/pyj/book_list/delete_book.pyj index 0a23342202..6347700596 100644 --- a/src/pyj/book_list/delete_book.pyj +++ b/src/pyj/book_list/delete_book.pyj @@ -22,6 +22,15 @@ def delete_from_cache(library_id, book_id, title): db.delete_books_matching(library_id, book_id) +def refresh_after_delete(book_id, library_id): + force_refresh_on_next_load() + next_book_id = book_after(book_id) + if next_book_id: + show_panel('book_details', {'book_id': str(next_book_id), 'library_id': library_id}, True) + else: + back() + + def do_delete_from_library(parent, close_modal, library_id, book_id, title): parent.appendChild(E.div(_('Deleting {0} from library, please wait...').format(title))) @@ -29,12 +38,7 @@ def do_delete_from_library(parent, close_modal, library_id, book_id, title): if end_type is 'load' or end_type is 'abort': close_modal() if end_type is 'load': - force_refresh_on_next_load() - next_book_id = book_after(book_id) - if next_book_id: - show_panel('book_details', {'book_id': str(next_book_id), 'library_id': library_id}, True) - else: - back() + refresh_after_delete(book_id, library_id) return clear(parent) msg = E.div() diff --git a/src/pyj/book_list/home.pyj b/src/pyj/book_list/home.pyj index 1f49471de8..da55ad2878 100644 --- a/src/pyj/book_list/home.pyj +++ b/src/pyj/book_list/home.pyj @@ -9,7 +9,7 @@ from ajax import ajax_send from book_list.constants import has_offline_support from book_list.cover_grid import BORDER_RADIUS from book_list.globals import get_db -from book_list.library_data import last_virtual_library_for, sync_library_books +from book_list.library_data import last_virtual_library_for, sync_library_books, all_libraries from book_list.router import open_book, update_window_title from book_list.top_bar import add_button, create_top_bar from book_list.ui import set_default_panel_handler, show_panel @@ -241,8 +241,7 @@ def init(container_id): container.appendChild(E.h2(_('Choose the calibre library to browse…'))) container.appendChild(E.div(style='display: flex; flex-wrap: wrap')) cl = container.lastChild - lids = sorted(interface_data.library_map, key=def(x): return interface_data.library_map[x];) - for library_id in lids: + for library_id, library_name in all_libraries(): library_name = interface_data.library_map[library_id] if library_name: cl.appendChild( diff --git a/src/pyj/book_list/library_data.pyj b/src/pyj/book_list/library_data.pyj index 19da14bcdb..1f2e72aea2 100644 --- a/src/pyj/book_list/library_data.pyj +++ b/src/pyj/book_list/library_data.pyj @@ -19,6 +19,12 @@ def current_library_id(): return q.library_id or get_interface_data().default_library_id +def all_libraries(): + interface_data = get_interface_data() + lids = sorted(interface_data.library_map, key=def(x): return interface_data.library_map[x];) + return [(lid, interface_data.library_map[lid]) for lid in lids] + + def current_virtual_library(): q = parse_url_params() return q.vl or '' From 6ff8b2a97a50364d759bb2f75b59abc651e025f1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 29 Jan 2019 11:24:16 +0530 Subject: [PATCH 0184/2613] Allow controlling behavior for dupes when copying to library in the server --- src/calibre/srv/cdb.py | 4 +-- src/pyj/book_list/book_details.pyj | 42 ++++++++++++++++++++++++------ src/pyj/session.pyj | 1 + 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/calibre/srv/cdb.py b/src/calibre/srv/cdb.py index 54251bf769..6e69357efe 100644 --- a/src/calibre/srv/cdb.py +++ b/src/calibre/srv/cdb.py @@ -194,8 +194,8 @@ def cdb_copy_to_library(ctx, rd, target_library_id, library_id): automerge_action = data.get('automerge_action') or 'overwrite' except Exception: raise HTTPBadRequest('Invalid encoded data, must be of the form: {book_ids: [id1, id2, ..]}') - if duplicate_action not in ('add', 'add_formats_to_existing'): - raise HTTPBadRequest('duplicate_action must be one of: add, add_formats_to_existing') + if duplicate_action not in ('add', 'add_formats_to_existing', 'ignore'): + raise HTTPBadRequest('duplicate_action must be one of: add, add_formats_to_existing, ignore') if automerge_action not in ('overwrite', 'ignore', 'new record'): raise HTTPBadRequest('automerge_action must be one of: overwrite, ignore, new record') response = {} diff --git a/src/pyj/book_list/book_details.pyj b/src/pyj/book_list/book_details.pyj index e2c3231d05..12adda7316 100644 --- a/src/pyj/book_list/book_details.pyj +++ b/src/pyj/book_list/book_details.pyj @@ -21,7 +21,7 @@ from book_list.top_bar import add_button, clear_buttons, create_top_bar, set_tit from book_list.ui import query_as_href, set_panel_handler, show_panel from book_list.views import search_query_for from date import format_date -from dom import add_extra_css, build_rule, clear, ensure_id, svgicon +from dom import add_extra_css, build_rule, clear, ensure_id, svgicon, unique_id from modals import create_custom_dialog, error_dialog, warning_dialog from session import get_interface_data from utils import ( @@ -674,6 +674,8 @@ def search_internet(container_id): )) +# Copy to library {{{ + def do_copy_to_library(book_id, target_library_id, target_library_name): def handle_result(move, close_func, end_type, xhr, ev): @@ -713,7 +715,14 @@ def do_copy_to_library(book_id, target_library_id, target_library_name): def trigger_copy(container_id, move, close_func): - data = {'book_ids':v'[book_id]', 'move': move} + try: + choice = document.querySelector(f'#{dupes_id} input[name="dupes"]:checked').value + except: + choice = document.querySelector(f'#{dupes_id} input[name="dupes"]').value + sd.set('copy_to_library_dupes', choice) + duplicate_action, automerge_action = choice.split(';', 2) + + data = {'book_ids':v'[book_id]', 'move': move, 'duplicate_action': duplicate_action, 'automerge_action': automerge_action} container = document.getElementById(container_id) clear(container) container.appendChild(E.div( @@ -721,13 +730,27 @@ def do_copy_to_library(book_id, target_library_id, target_library_name): ajax_send(f'cdb/copy-to-library/{target_library_id}/{current_library_id()}', data, handle_result.bind(None, move, close_func)) - create_custom_dialog(_('Copy to library'), def (container, close_func): - mi = book_metadata(book_id) + def radio(value, text): + return E.div(style='margin-top: 1rem', E.input(type='radio', name='dupes', value=value, checked=value is saved_value), '\xa0', E.span(text)) + + title = book_metadata(book_id).title + dupes_id = unique_id() + sd = get_session_data() + saved_value = sd.get('copy_to_library_dupes') + create_custom_dialog(_( + 'Copy book to "{target_library_name}"').format(target_library_name=target_library_name), + def (container, close_func): container_id = ensure_id(container) container.appendChild(E.div( - E.div(_( - 'Copy "{title}" to the library "{target_library_name}"?').format( - title=mi.title, target_library_name=target_library_name) + E.div(_('Copying: {}').format(title)), + E.div(id=dupes_id, + E.p(_('If there are already existing books in "{}" with the same title and authors,' + ' how would you like to handle them?').format(target_library_name)), + radio('add;overwrite', _('Copy anyway')), + radio('ignore;overwrite', _('Do not copy')), + radio('add_formats_to_existing;overwrite', _('Merge into existing books, overwriting existing files')), + radio('add_formats_to_existing;ignore', _('Merge into existing books, keeping existing files')), + radio('add_formats_to_existing;new record', _('Merge into existing books, putting conflicting files into a new book record')), ), E.div( class_='button-box', @@ -738,6 +761,9 @@ def do_copy_to_library(book_id, target_library_id, target_library_name): create_button(_('Cancel'), None, close_func), ) )) + if not container.querySelector(f'#{dupes_id} input[name="dupes"]:checked'): + container.querySelector(f'#{dupes_id} input[name="dupes"]').checked = True + ) @@ -760,7 +786,7 @@ def copy_to_library(container_id): items.push(create_item(library_name, action=do_copy_to_library.bind(None, render_book.book_id, library_id, library_name))) container.appendChild(E.div()) create_item_list(container.lastChild, items) - +# }}} def delete_book(): diff --git a/src/pyj/session.pyj b/src/pyj/session.pyj index 889feb2096..5870d87cae 100644 --- a/src/pyj/session.pyj +++ b/src/pyj/session.pyj @@ -13,6 +13,7 @@ defaults = { 'sort': 'timestamp.desc', # comma separated list of items of the form: field.order 'last_sort_order': {}, 'show_all_metadata': False, # show all metadata fields in the book details panel + 'copy_to_library_dupes': 'add;overwrite', # Tag Browser settings 'partition_method': 'first letter', # other choices: 'disable', 'partition' From d8ff047cb970afffb08082f60d689e77056bd162 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 30 Jan 2019 09:26:44 +0530 Subject: [PATCH 0185/2613] Content server: Fix editing metadata that affects multiple books causing all the metadata for all the books to become the same. Fixes #1812781 [400 bad request from server API](https://bugs.launchpad.net/calibre/+bug/1812781) --- src/calibre/srv/cdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/srv/cdb.py b/src/calibre/srv/cdb.py index 6e69357efe..7f2cf13d0a 100644 --- a/src/calibre/srv/cdb.py +++ b/src/calibre/srv/cdb.py @@ -175,7 +175,7 @@ def cdb_set_fields(ctx, rd, book_id, library_id): ctx.notify_changes(db.backend.library_path, metadata(dirtied)) all_ids = dirtied if all_dirtied else (dirtied & loaded_book_ids) all_ids |= {book_id} - return {bid: book_as_json(db, book_id) for bid in all_ids} + return {bid: book_as_json(db, bid) for bid in all_ids} @endpoint('/cdb/copy-to-library/{target_library_id}/{library_id=None}', needs_db_write=True, From 768774a7bea309f4fd6b4c3fa9d488845bf85b29 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 30 Jan 2019 09:58:37 +0530 Subject: [PATCH 0186/2613] Content server: Fix heading for custom comments columns being duplicated in the book details page --- src/pyj/book_list/book_details.pyj | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pyj/book_list/book_details.pyj b/src/pyj/book_list/book_details.pyj index 12adda7316..3e2cc2edfb 100644 --- a/src/pyj/book_list/book_details.pyj +++ b/src/pyj/book_list/book_details.pyj @@ -302,8 +302,6 @@ def render_metadata(mi, table, book_id): # {{{ if hp is 'side': add_row(name, val, is_html=True) return - if hp is 'above': - val = E.h3(name).outerHTML + val comments.push(v'[field, val]') return func = None From 6fc6abc26381e142a4f7e58cc7f2f9950cb8a5fd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 30 Jan 2019 10:23:31 +0530 Subject: [PATCH 0187/2613] Content server: Add Next/Previous buttons to the book details page --- src/pyj/book_list/book_details.pyj | 17 ++++++++++++++++- src/pyj/book_list/library_data.pyj | 10 +++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/pyj/book_list/book_details.pyj b/src/pyj/book_list/book_details.pyj index 3e2cc2edfb..72348a8c9f 100644 --- a/src/pyj/book_list/book_details.pyj +++ b/src/pyj/book_list/book_details.pyj @@ -11,7 +11,7 @@ from book_list.delete_book import refresh_after_delete, start_delete_book from book_list.globals import get_session_data from book_list.item_list import create_item, create_item_list from book_list.library_data import ( - all_libraries, book_metadata, cover_url, current_library_id, + all_libraries, book_after, book_metadata, cover_url, current_library_id, current_virtual_library, download_url, library_data, load_status, set_book_metadata ) @@ -465,6 +465,21 @@ def render_book(container_id, book_id): table = E.table(class_='metadata') container.appendChild(md) md.appendChild(table) + + def next_book(delta): + next_book_id = book_after(book_id, delta) + if next_book_id: + q = parse_url_params() + q.book_id = next_book_id + '' + show_panel('book_details', query=q) + + md.appendChild(E.div( + style='margin-top: 1.5ex', + create_button(_('Previous'), 'arrow-left', next_book.bind(None, -1)), + '\xa0\xa0\xa0', + create_button(_('Next'), 'arrow-right', next_book.bind(None, 1)), + )) + render_metadata(metadata, table, book_id) diff --git a/src/pyj/book_list/library_data.pyj b/src/pyj/book_list/library_data.pyj index 1f2e72aea2..cb430402ea 100644 --- a/src/pyj/book_list/library_data.pyj +++ b/src/pyj/book_list/library_data.pyj @@ -106,14 +106,14 @@ def current_book_ids(): return library_data.previous_book_ids.concat(library_data.search_result.book_ids) -def book_after(book_id): +def book_after(book_id, delta): + if not delta: + delta = 1 ids = current_book_ids() idx = ids.indexOf(int(book_id)) if idx > -1: - if idx < ids.length - 1: - return ids[idx + 1] - if idx > 0: # wrap around - return ids[0] + new_idx = (idx + ids.length + delta) % ids.length + return ids[new_idx] def on_data_loaded(end_type, xhr, ev): From b0867660647f8a369171809bbe44b1897f339d75 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 30 Jan 2019 14:59:33 +0530 Subject: [PATCH 0188/2613] Content server: Try to detect if a book file has been edited outside of calibre and serve the updated copy --- src/calibre/srv/books.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/srv/books.py b/src/calibre/srv/books.py index db4567f53d..ee4ce4ab83 100644 --- a/src/calibre/srv/books.py +++ b/src/calibre/srv/books.py @@ -131,7 +131,7 @@ def book_manifest(ctx, rd, book_id, fmt): if not ctx.has_id(rd, db, book_id): raise BookNotFound(book_id, db) with db.safe_read_lock: - fm = db.format_metadata(book_id, fmt) + fm = db.format_metadata(book_id, fmt, allow_cache=False) if not fm: raise HTTPNotFound('No %s format for the book (id:%s) in the library: %s' % (fmt, book_id, library_id)) size, mtime = map(int, (fm['size'], time.mktime(fm['mtime'].utctimetuple())*10)) From 8fac38cf4d92a3f961dc776efdcc1af600f09b36 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 30 Jan 2019 15:24:48 +0530 Subject: [PATCH 0189/2613] Fix font mime-types not being auto-corrected when upgrading EPUBs from 2 to 3 --- src/calibre/ebooks/oeb/polish/upgrade.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/polish/upgrade.py b/src/calibre/ebooks/oeb/polish/upgrade.py index 5dfe37a7ac..ff6ff7d972 100644 --- a/src/calibre/ebooks/oeb/polish/upgrade.py +++ b/src/calibre/ebooks/oeb/polish/upgrade.py @@ -25,7 +25,7 @@ def add_properties(item, *props): def fix_font_mime_types(container): for item in container.opf_xpath('//opf:manifest/opf:item[@href and @media-type]'): mt = item.get('media-type') or '' - if mt.lower() not in OEB_FONTS: + if mt.lower() in OEB_FONTS: name = container.href_to_name(item.get('href'), container.opf_name) item.set('media-type', container.guess_type(name)) From 4590d36660c30a9df5693dcb27aea04823b693d5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 30 Jan 2019 15:26:25 +0530 Subject: [PATCH 0190/2613] Edit book: Check book: Follow recent releases of epubcheck in expecting .ttf files to have the mime-type application/vnd.ms-opentype in EPUB 3 books --- src/calibre/ebooks/oeb/polish/container.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/oeb/polish/container.py b/src/calibre/ebooks/oeb/polish/container.py index d9f5f5aac2..ece50b23c5 100644 --- a/src/calibre/ebooks/oeb/polish/container.py +++ b/src/calibre/ebooks/oeb/polish/container.py @@ -149,8 +149,14 @@ class ContainerBase(object): # {{{ ans = guess_type(name) if ans == 'text/html': ans = 'application/xhtml+xml' - if ans in {'application/x-font-truetype', 'application/vnd.ms-opentype'} and self.opf_version_parsed[:2] > (3, 0): - return 'application/font-sfnt' + if ans in {'application/x-font-truetype', 'application/vnd.ms-opentype'}: + opfversion = self.opf_version_parsed[:2] + if opfversion > (3, 0): + return 'application/font-sfnt' + if opfversion >= (3, 0): + # bloody epubcheck has recently decided it likes this mimetype + # for ttf files + return 'application/vnd.ms-opentype' return ans def decode(self, data, normalize_to_nfc=True): From 9ef0060c3393711ce5f1e48e83d0233f0f58fda5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 30 Jan 2019 15:52:39 +0530 Subject: [PATCH 0191/2613] ZIP Output: Fix an error when building the ToC on macOS for some books with non-ASCII ToC entries Fixes #1813905 [ebook convert successfully in GUI but failed in command line](https://bugs.launchpad.net/calibre/+bug/1813905) [ebook convert successfully in GUI but failed in command line](https://bugs.launchpad.net/calibre/+bug/1813905) --- src/calibre/ebooks/conversion/plugins/html_output.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/conversion/plugins/html_output.py b/src/calibre/ebooks/conversion/plugins/html_output.py index 7e732015c6..4ea5f630e4 100644 --- a/src/calibre/ebooks/conversion/plugins/html_output.py +++ b/src/calibre/ebooks/conversion/plugins/html_output.py @@ -49,6 +49,7 @@ class HTMLOutput(OutputFormatPlugin): from urllib import unquote from calibre.ebooks.oeb.base import element + from calibre.utils.cleantext import clean_xml_chars with CurrentDir(output_dir): def build_node(current_node, parent=None): if parent is None: @@ -58,11 +59,15 @@ class HTMLOutput(OutputFormatPlugin): for node in current_node.nodes: point = element(parent, 'li') href = relpath(abspath(unquote(node.href)), dirname(ref_url)) - link = element(point, 'a', href=href) + if isinstance(href, bytes): + href = href.decode('utf-8') + link = element(point, 'a', href=clean_xml_chars(href)) title = node.title + if isinstance(title, bytes): + title = title.decode('utf-8') if title: title = re.sub(r'\s+', ' ', title) - link.text=title + link.text = clean_xml_chars(title) build_node(node, point) return parent wrap = etree.Element('div') From 90998fabf37a4f745373edec73db1ac8e5789522 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 30 Jan 2019 21:55:39 +0530 Subject: [PATCH 0192/2613] Add a test to ensure msgpack can handle large binary payloads --- src/calibre/test_build.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index de4d0cdb2a..162354dd4d 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -113,6 +113,8 @@ class BuildTest(unittest.TestCase): self.assertEqual(obj, msgpack_loads(s)) self.assertEqual(type(msgpack_loads(msgpack_dumps(b'b'))), bytes) self.assertEqual(type(msgpack_loads(msgpack_dumps(u'b'))), type(u'')) + large = b'x' * (100 * 1024 * 1024) + msgpack_loads(msgpack_dumps(large)) @unittest.skipUnless(isosx, 'FSEvents only present on OS X') def test_fsevents(self): From db97e7ca3dee6a2636b40f35a0dfc136edf680a1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 31 Jan 2019 09:28:57 +0530 Subject: [PATCH 0193/2613] Fix merging books not updating author if the source book has no title --- src/calibre/gui2/actions/edit_metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/actions/edit_metadata.py b/src/calibre/gui2/actions/edit_metadata.py index b7222c028b..de9282c550 100644 --- a/src/calibre/gui2/actions/edit_metadata.py +++ b/src/calibre/gui2/actions/edit_metadata.py @@ -650,7 +650,7 @@ class EditMetadataAction(InterfaceAction): dest_mi.comments = unicode(dest_mi.comments) + u'\n\n' + unicode(src_mi.comments) if src_mi.title and (not dest_mi.title or dest_mi.title == _('Unknown')): dest_mi.title = src_mi.title - if src_mi.title and (not dest_mi.authors or dest_mi.authors[0] == _('Unknown')): + if (src_mi.authors and src_mi.authors[0] != _('Unknown')) and (not dest_mi.authors or dest_mi.authors[0] == _('Unknown')): dest_mi.authors = src_mi.authors dest_mi.author_sort = src_mi.author_sort if src_mi.tags: From 6dba8ca5361ea6cc054c456797c817f9abebe443 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 31 Jan 2019 13:45:57 +0530 Subject: [PATCH 0194/2613] Also allow .cmd files in open with --- src/calibre/gui2/open_with.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/open_with.py b/src/calibre/gui2/open_with.py index 45d509e3dc..31ba41968d 100644 --- a/src/calibre/gui2/open_with.py +++ b/src/calibre/gui2/open_with.py @@ -104,7 +104,7 @@ if iswindows: ans = choose_files( parent, 'choose-open-with-program-manually-win', _('Choose a program to open %s files') % filetype.upper(), - filters=[(_('Executable files'), ['exe', 'bat', 'com'])], select_only_single_file=True) + filters=[(_('Executable files'), ['exe', 'bat', 'com', 'cmd'])], select_only_single_file=True) if ans: ans = os.path.abspath(ans[0]) if not os.access(ans, os.X_OK): From b0e7526a0d4ec0ebc12eeca83bb78ef53a136199 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 31 Jan 2019 13:56:03 +0530 Subject: [PATCH 0195/2613] Open With: Fix using .bat files as the program not working. Fixes #1811045 [Open With won't run BAT files](https://bugs.launchpad.net/calibre/+bug/1811045) --- src/calibre/gui2/open_with.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/open_with.py b/src/calibre/gui2/open_with.py index 31ba41968d..565dcfdc50 100644 --- a/src/calibre/gui2/open_with.py +++ b/src/calibre/gui2/open_with.py @@ -123,12 +123,20 @@ if iswindows: del run_program def run_program(entry, path, parent): # noqa + import re cmdline = entry_to_cmdline(entry, path) - print('Running Open With commandline:', repr(entry['cmdline']), ' |==> ', repr(cmdline)) + flags = win32con.CREATE_DEFAULT_ERROR_MODE | win32con.CREATE_NEW_PROCESS_GROUP + if re.match(r'"[^"]+?(.bat|.cmd|.com)"', cmdline, flags=re.I): + flags |= win32con.CREATE_NO_WINDOW + console = ' (console)' + else: + flags |= win32con.DETACHED_PROCESS + console = '' + print('Running Open With commandline%s:' % console, repr(entry['cmdline']), ' |==> ', repr(cmdline)) try: with sanitize_env_vars(): process_handle, thread_handle, process_id, thread_id = CreateProcess( - None, cmdline, None, None, False, win32con.CREATE_DEFAULT_ERROR_MODE | win32con.CREATE_NEW_PROCESS_GROUP | win32con.DETACHED_PROCESS, + None, cmdline, None, None, False, flags, None, None, STARTUPINFO()) WaitForInputIdle(process_handle, 2000) except Exception as err: From ede9b90eea3795512f3f1f5cda52756d7fe5b84d Mon Sep 17 00:00:00 2001 From: Rromotpd <41323080+Rromotpd@users.noreply.github.com> Date: Thu, 31 Jan 2019 14:28:01 +0100 Subject: [PATCH 0196/2613] update setup.py Changed '%x' to new format style --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index ad12525766..fb8b0991c4 100755 --- a/setup.py +++ b/setup.py @@ -65,7 +65,7 @@ def main(args=sys.argv): print('\nWhere command is one of:') print() for x in sorted(commands.__all__): - print('%-20s -' % x, end=' ') + print('{:20} -'.format(x), end=' ') c = getattr(commands, x) desc = getattr(c, 'short_description', c.description) print(desc) @@ -85,7 +85,7 @@ def main(args=sys.argv): parser = option_parser() command.add_all_options(parser) parser.set_usage( - 'Usage: python setup.py %s [options]\n\n' % args[1] + command.description) + 'Usage: python setup.py {} [options]\n\n'.format(args[1]) + command.description) opts, args = parser.parse_args(args) From b1c9b2ba71e6caa2f29b27fbd2818e184081d991 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Feb 2019 08:54:52 +0530 Subject: [PATCH 0197/2613] version 3.39.0 --- Changelog.yaml | 43 ++++++++++++++++++++++++++++++++++++++++ src/calibre/constants.py | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/Changelog.yaml b/Changelog.yaml index de1250c385..16f5fe1393 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -20,6 +20,49 @@ # new recipes: # - title: +- version: 3.39.0 + date: 2019-02-01 + + new features: + - title: "Content server: Implement the \"Copy to library\" function. To use it click the three dots in the top right corner of a book's page and choose \"Copy to library\"" + tickets: [1810486] + + - title: "Content server: Add Next/Previous buttons to the book details page" + + bug fixes: + - title: "Content server: Fix editing metadata that affects multiple books causing all the metadata for all the books to become the same." + tickets: [1812781] + + - title: "Open With: Fix using .bat files as the program not working." + tickets: [1811045] + + - title: "ZIP Output: Fix an error when building the ToC on macOS for some books with non-ASCII ToC entries" + tickets: [1813905] + + - title: "Edit book: Check book: Follow recent releases of epubcheck in expecting .ttf files to have the mime-type application/vnd.ms-opentype in EPUB 3 books" + + - title: "Fix font mime-types not being auto-corrected when upgrading EPUBs from 2 to 3" + + - title: "Content server: Try to detect if a book file has been edited outside of calibre and serve the updated copy" + + - title: "Fix merging books not updating author if the source book has no title" + + - title: "Content server: Fix heading for custom comments columns being duplicated in the book details page" + + - title: "Fix editing of dates not working is the date format is set to iso." + tickets: [1812560] + + improved recipes: + - Spiegel Online + - Il Post + + new recipes: + - title: BSI News + author: Volker Heggemann + + - title: Science Advances + author: Jose Ortiz + - version: 3.38.1 date: 2019-01-18 diff --git a/src/calibre/constants.py b/src/calibre/constants.py index f5cd2ee24a..cc2474438f 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -6,7 +6,7 @@ from polyglot.builtins import map import sys, locale, codecs, os, importlib, collections __appname__ = u'calibre' -numeric_version = (3, 38, 1) +numeric_version = (3, 39, 0) __version__ = u'.'.join(map(unicode, numeric_version)) __author__ = u"Kovid Goyal " From e0d5a021dd58075acaa0ee5796b753f1a6a26cb6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Feb 2019 13:38:48 +0530 Subject: [PATCH 0198/2613] Fix #1812891 [calibre-3.38.1 tries to download mathjax during build](https://bugs.launchpad.net/calibre/+bug/1812891) again --- setup/mathjax.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup/mathjax.py b/setup/mathjax.py index a0ac198d8e..2efbd98b2c 100644 --- a/setup/mathjax.py +++ b/setup/mathjax.py @@ -78,6 +78,7 @@ class MathJax(Command): def run(self, opts): if not opts.system_mathjax and self.already_present(): self.info('MathJax already present in the resources directory, not downloading') + return self.use_symlinks = opts.system_mathjax self.h = sha1() self.mathjax_files = {} From 437170afe989f8e29b114103c27d667efb2da62f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Feb 2019 23:07:44 +0530 Subject: [PATCH 0199/2613] Fix a regression in 3.39 that caused a harmless error message when using copy to library for books that have been converted Fixes #1814279 [3.39 breaks copying between libraries using the GUI](https://bugs.launchpad.net/calibre/+bug/1814279) --- src/calibre/db/copy_to_library.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/db/copy_to_library.py b/src/calibre/db/copy_to_library.py index 1141b01052..0a5b18f453 100644 --- a/src/calibre/db/copy_to_library.py +++ b/src/calibre/db/copy_to_library.py @@ -58,9 +58,9 @@ def postprocess_copy(book_id, new_book_id, new_authors, db, newdb, identical_boo if link_map: newdb.set_link_for_authors(link_map) - co = db.conversion_options(book_id, 'PIPE') + co = db.conversion_options(book_id) if co is not None: - newdb.set_conversion_options(new_book_id, 'PIPE', co) + newdb.set_conversion_options({new_book_id:co}) if identical_books_data is not None and duplicate_action != 'add': newdb.update_data_for_find_identical_books(new_book_id, identical_books_data) From b287374cddc471dd3605baef05d33ccb8b00130b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Feb 2019 23:13:29 +0530 Subject: [PATCH 0200/2613] version 3.39.1 --- Changelog.yaml | 5 ++++- src/calibre/constants.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changelog.yaml b/Changelog.yaml index 16f5fe1393..9ef98f162a 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -20,7 +20,7 @@ # new recipes: # - title: -- version: 3.39.0 +- version: 3.39.1 date: 2019-02-01 new features: @@ -52,6 +52,9 @@ - title: "Fix editing of dates not working is the date format is set to iso." tickets: [1812560] + - title: "Version 3.39.1 fixes a bug in 3.39.0 that broke copy to library for books that have saved conversion options" + tickets: [1814279] + improved recipes: - Spiegel Online - Il Post diff --git a/src/calibre/constants.py b/src/calibre/constants.py index cc2474438f..1944e77e60 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -6,7 +6,7 @@ from polyglot.builtins import map import sys, locale, codecs, os, importlib, collections __appname__ = u'calibre' -numeric_version = (3, 39, 0) +numeric_version = (3, 39, 1) __version__ = u'.'.join(map(unicode, numeric_version)) __author__ = u"Kovid Goyal " From afa9120940c9d5a30e9f8bd1118ff1e8ce07687c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 4 Feb 2019 11:18:59 +0530 Subject: [PATCH 0201/2613] EPUB/MOBI Catalogs: Fix multiple books with the same title but different authors in a genre not being listed. Fixes #1415990 [Duplicate titles not showing in catalog](https://bugs.launchpad.net/calibre/+bug/1415990) --- src/calibre/library/catalogs/epub_mobi_builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/library/catalogs/epub_mobi_builder.py b/src/calibre/library/catalogs/epub_mobi_builder.py index 0a4c2c981b..b0aa19c818 100644 --- a/src/calibre/library/catalogs/epub_mobi_builder.py +++ b/src/calibre/library/catalogs/epub_mobi_builder.py @@ -2107,7 +2107,7 @@ class CatalogBuilder(object): new_book = None if key == normalized_tag: for book in existing_genre[key]: - if book['title'] == this_book['title']: + if (book['title'], book['author']) == (this_book['title'], this_book['author']): new_book = False break else: From 7c5184cef8139695c441b1798502700be4f19eb4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 4 Feb 2019 13:54:13 +0530 Subject: [PATCH 0202/2613] Simplify elif chain --- src/calibre/gui2/catalog/catalog_epub_mobi.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/calibre/gui2/catalog/catalog_epub_mobi.py b/src/calibre/gui2/catalog/catalog_epub_mobi.py index 09da96c2f2..d067647ab7 100644 --- a/src/calibre/gui2/catalog/catalog_epub_mobi.py +++ b/src/calibre/gui2/catalog/catalog_epub_mobi.py @@ -140,18 +140,17 @@ class PluginWidget(QWidget,Ui_Form): # Skip disabled and incomplete rules if not rule['enabled']: continue - elif not rule['field'] or not rule['pattern']: + if not rule['field'] or not rule['pattern']: continue - elif 'prefix' in rule and rule['prefix'] is None: + if 'prefix' in rule and rule['prefix'] is None: continue - else: - if rule['field'] != _('Tags'): - # Look up custom column friendly name - rule['field'] = self.eligible_custom_fields[rule['field']]['field'] - if rule['pattern'] in [_('any value'),_('any date')]: - rule['pattern'] = '.*' - elif rule['pattern'] == _('unspecified'): - rule['pattern'] = 'None' + if rule['field'] != _('Tags'): + # Look up custom column friendly name + rule['field'] = self.eligible_custom_fields[rule['field']]['field'] + if rule['pattern'] in [_('any value'),_('any date')]: + rule['pattern'] = '.*' + elif rule['pattern'] == _('unspecified'): + rule['pattern'] = 'None' if 'prefix' in rule: pr = (rule['name'],rule['field'],rule['pattern'],rule['prefix']) else: From 58442a478a10733d98374f200f1858ae80a646da Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 4 Feb 2019 19:34:11 +0530 Subject: [PATCH 0203/2613] RPUB/MOBI Catalog generation: Allow matching empty fields in exclusion rules. Fixes #1814458 [catalog builder ignore "any" and "undefined"](https://bugs.launchpad.net/calibre/+bug/1814458) --- src/calibre/library/catalogs/epub_mobi_builder.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/calibre/library/catalogs/epub_mobi_builder.py b/src/calibre/library/catalogs/epub_mobi_builder.py index b0aa19c818..7826d5b898 100644 --- a/src/calibre/library/catalogs/epub_mobi_builder.py +++ b/src/calibre/library/catalogs/epub_mobi_builder.py @@ -4807,6 +4807,8 @@ class CatalogBuilder(object): field_contents = self.db.get_field(record['id'], field, index_is_id=True) + if field_contents == '': + field_contents = None if (self.db.metadata_for_field(field)['datatype'] == 'bool' and field_contents is None): @@ -4839,6 +4841,10 @@ class CatalogBuilder(object): else: if record not in filtered_data_set: filtered_data_set.append(record) + elif field_contents is None and pat == 'None': + exclusion_set.append(record) + if record in filtered_data_set: + filtered_data_set.remove(record) else: if (record not in filtered_data_set and record not in exclusion_set): From 1f203ba7b64d2a7dcd4c5b631cb045c4d0840bc2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 5 Feb 2019 09:20:46 +0530 Subject: [PATCH 0204/2613] Update Spektrum der Wissenchaft --- recipes/spektrum.recipe | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/recipes/spektrum.recipe b/recipes/spektrum.recipe index 52586c0ecb..693ed5f7a3 100644 --- a/recipes/spektrum.recipe +++ b/recipes/spektrum.recipe @@ -1,7 +1,8 @@ +#!/usr/bin/env python2 ## # Written: October 2012 (new coding) # Version: 9.0 -# Last update: 2018-02-22 +# Last update: 2019-02-02 ## __license__ = 'GPL v3' @@ -21,9 +22,9 @@ def classes(classes): from calibre.web.feeds.recipes import BasicNewsRecipe -class AdvancedUserRecipe1303841067(BasicNewsRecipe): +class Spektrum(BasicNewsRecipe): title = u'Spektrum der Wissenschaft' - __author__ = 'Armin Geller, Bratzzo, Rainer Zenz' # Update AGE 2014-02-25, UDe 2018-02-22 + __author__ = 'Armin Geller, Bratzzo, Rainer Zenz' # Update AGE 2014-02-25, UDe 2019-02-02 description = u'German online portal of Spektrum der Wissenschaft' publisher = 'Spektrum der Wissenschaft Verlagsgesellschaft mbH' category = 'science news, Germany' @@ -36,7 +37,7 @@ class AdvancedUserRecipe1303841067(BasicNewsRecipe): encoding = 'utf8' ignore_duplicate_articles = {'title'} - cover_url = 'https://www.spektrum.de/fm/862/thumbnails/Cover_SdW01-2018.jpg.2786617.jpg' + cover_url = 'https://www.spektrum.de/js_css/sde/assets/img/svg/sdw_dark.svg' masthead_url = 'http://www.spektrum.de/fm/861/spektrum.de.png' feeds = [ @@ -60,4 +61,10 @@ class AdvancedUserRecipe1303841067(BasicNewsRecipe): remove_tags = [ classes('hide-for-print content__meta content__author content__video'), dict(name='div', attrs={'role': 'navigation'}), + dict(name='span', attrs={'class': 'sr-only'}), ] + + def preprocess_html(self, soup, *a): + for img in soup.findAll('img', attrs={'data-src': True}): + img['src'] = img['data-src'] + return soup From 848934643ed663631ac859e0b7e8703e14e76fcc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 5 Feb 2019 10:07:09 +0530 Subject: [PATCH 0205/2613] Work on Foreign Affairs --- recipes/foreignaffairs.recipe | 63 +++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/recipes/foreignaffairs.recipe b/recipes/foreignaffairs.recipe index ffacbd8e88..a3f5436d61 100644 --- a/recipes/foreignaffairs.recipe +++ b/recipes/foreignaffairs.recipe @@ -9,6 +9,12 @@ def select_form(form): return form.attrs.get('id', None) == 'user-login' +def classes(classes): + q = frozenset(classes.split(' ')) + return dict(attrs={ + 'class': lambda x: x and frozenset(x.split()).intersection(q)}) + + class ForeignAffairsRecipe(BasicNewsRecipe): ''' there are three modifications: @@ -37,7 +43,7 @@ class ForeignAffairsRecipe(BasicNewsRecipe): remove_javascript = True needs_subscription = True - INDEX = 'http://www.foreignaffairs.com' + INDEX = 'https://www.foreignaffairs.com' FRONTPAGE = INDEX + '/magazine' keep_only_tags = [ @@ -50,36 +56,39 @@ class ForeignAffairsRecipe(BasicNewsRecipe): def parse_index(self): answer = [] - soup = self.index_to_soup(html.tostring(self.clean_fa_html( - self.index_to_soup(self.FRONTPAGE, as_tree=True)))) + soup = self.index_to_soup(self.FRONTPAGE) div = soup.find( - 'div', attrs={'class': 'magazine-hero__image image_auto_width'}) - self.cover_url = div.find('img')['src'] + 'div', attrs={'class': 'magazine-actions'}) + self.cover_url = div.find('img')['ng-src'] # get dates - date = re.split('\s\|\s', self.tag_to_string( + date = re.split(r'\s\|\s', self.tag_to_string( soup.head.title.string))[0] self.title = "Foreign Affairs ({})".format(date) self.timefmt = u' [%s]' % date - for section in soup.findAll(attrs={'class':lambda x: x and 'magazine-list' in x.split()}): + # Fetching article list does not work as site uses javascript + # to load articles dynamically + for section in soup.findAll('section', attrs={'class':lambda x: x and 'magazine-list' in x.split()}): articles = [] - section_title = self.tag_to_string(section.find('h1')) - for h2 in section.findAll('h2'): - a = h2.parent - if a.get('href'): - title = self.tag_to_string(h2) - url = a['href'] - atr = a.findNextSibling(attrs={'class':'author'}) - author = self.tag_to_string(atr) if atr else '' - desc = a.findNextSibling(attrs={'class': 'deck'}) - if desc is not None: - description = self.tag_to_string(desc) - else: - description = '' - articles.append({'title': title, 'url': url, - 'description': description, 'author': author}) - self.log(title) - self.log('\t' + url) + section_title = self.tag_to_string(section.find('h2')) + if 'special_section.title' in section_title: + section_title = 'Special' + self.log('\nSection:', section_title) + for h3 in section.findAll(attrs={'class': lambda x: x and 'magazine-title' in x.split()}): + a = h3.findParent('a', href=True) + title = self.tag_to_string(h3) + url = a['href'] + atr = a.findNextSibling(attrs={'class':'author'}) + author = self.tag_to_string(atr) if atr else '' + desc = a.findNextSibling(attrs={'class': 'deck'}) + if desc is not None: + description = self.tag_to_string(desc) + else: + description = '' + articles.append({'title': title, 'url': url, + 'description': description, 'author': author}) + self.log(title) + self.log('\t' + url) if articles: answer.append((section_title, articles)) return answer @@ -98,10 +107,8 @@ class ForeignAffairsRecipe(BasicNewsRecipe): return html.tostring(root) def preprocess_html(self, soup): - for img in soup.findAll('img', attrs={'src': True}): - if not img['src'].startswith('http'): - img['src'] = self.INDEX + img['src'] - + for img in soup.findAll('img', attrs={'ng-src': True}): + img['src'] = img['ng-src'] return soup def get_browser(self): From 0c815cd06d2418dd0e625e0564da32dbff309d3e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 5 Feb 2019 11:27:09 +0530 Subject: [PATCH 0206/2613] Update Caravan Magazine --- recipes/caravan_magazine.recipe | 151 ++++++++------------------------ 1 file changed, 37 insertions(+), 114 deletions(-) diff --git a/recipes/caravan_magazine.recipe b/recipes/caravan_magazine.recipe index f2166fac86..455c251546 100644 --- a/recipes/caravan_magazine.recipe +++ b/recipes/caravan_magazine.recipe @@ -1,10 +1,11 @@ # coding: utf-8 -import html5lib -import re -from lxml import etree from calibre.web.feeds.recipes import BasicNewsRecipe -from calibre.utils.cleantext import clean_xml_chars -from calibre.ebooks.BeautifulSoup import Tag, NavigableString + + +def classes(classes): + q = frozenset(classes.split(' ')) + return dict(attrs={ + 'class': lambda x: x and frozenset(x.split()).intersection(q)}) class CaravanMagazine(BasicNewsRecipe): @@ -18,125 +19,47 @@ class CaravanMagazine(BasicNewsRecipe): no_stylesheets = True keep_only_tags = [ - dict(attrs={'class': ['post-title']}), - dict(attrs={'class': ['post-subhheading', - 'authorndate', 'rg-thumbs', 'entry-content']}), + classes('post-title short-desc author-details cover'), + dict(itemprop='articleBody'), ] remove_tags = [ + dict(name='meta'), dict(attrs={'class': ['share-with']}), ] - def preprocess_raw_html(self, raw_html, url): - root = html5lib.parse( - clean_xml_chars(raw_html), treebuilder='lxml', - namespaceHTMLElements=False) - for s in root.xpath('//script'): - s.getparent().remove(s) - return etree.tostring(root, encoding=unicode) - - def preprocess_html(self, soup): - # Handle the image carousel - carousel = soup.find('div', {'class': 'rg-thumbs'}) - if carousel is not None: - # create a new container to collect all images - all_images = Tag(soup, 'div') - # all_images['class'] = 'rg-thumbs' - for index, img in enumerate(carousel.findAll('img')): - # create a new div to contain image and caption - div = Tag(soup, 'div') - div['style'] = 'text-align:left;font-size:70%;margin-bottom: 0.4em;' - ns = NavigableString(img['data-caption']) - img['src'] = img['data-large'] - del img['data-large'] - del img['data-caption'] - del img['data-credit'] - img.extract() - div.insert(0, img) - div.insert(1, Tag(soup, 'br')) - div.insert(3, ns) - div.insert(3, Tag(soup, 'br')) - - all_images.insert(index, div) - - # extracted all images, replace carousel with extracted images - carousel.replaceWith(all_images) - - return soup - # To parse artice toc def parse_index(self): - - base_url = 'http://www.caravanmagazine.in' - raw = self.index_to_soup('{0}/current-issue'.format(base_url), - raw=True) - raw = raw.decode('utf-8') - raw = self.preprocess_raw_html(raw, None) - soup = self.index_to_soup(raw) + base_url = 'https://www.caravanmagazine.in/' + soup = self.index_to_soup('{0}magazine'.format(base_url)) # find current issue cover - try: - cover_img = soup.find('div', {'class': 'issue-image'}).find('img') - # a = soup.find('a', rel=lambda x:x and '[field_c_issues_image]' in x) - # if a is not None: - self.cover_url = cover_img['src'] - except: - pass - - # ci = soup.find(attrs={'class': 'current-issue-block'}) - ci = soup.findAll(attrs={'class': re.compile('archive-story.*')}) - current_section = 'Section' - current_articles = [] feeds = [] - - # define some reusable constants - heading_class = 'subject-heading' - content_class = 'subject-content' - stories_re = re.compile('({0}|{1}).*'.format(heading_class, - content_class)) - - for story in ci: - for ele in story.findAll(attrs={'class': stories_re}): - if ele['class'].startswith(heading_class): - # heading section - if current_articles: - self.log('Adding {0} articles to {1}'.format( - len(current_articles), current_section)) - feeds.append((current_section, current_articles)) - current_section = self.tag_to_string(ele) - current_articles = [] - self.log('Section:', current_section) - pass - else: - # content Section - for art in ele.findAll('article', - attrs={'id': re.compile('post-.*')}): - title = art.find('h1') - if title is not None: - a = title.find('a', href=True) - if a is not None: - href = a['href'] - - # convert relative url to absolute url - if href.startswith('/'): - href = '{0}{1}'.format(base_url, href) - article = { - 'title': self.tag_to_string(title), - 'url': href - } - title.extract() - desc = self.tag_to_string(art).strip() - if desc: - article['description'] = desc - current_articles.append(article) - self.log('\t' + article['title']) - self.log('\t\t' + article['url']) - - # append any remaining articles that were probably from last section, - # we ran out of heading_class to push them - if current_articles: - self.log('Adding {0} articles to {1}'.format( - len(current_articles), current_section)) - feeds.append((current_section, current_articles)) + sections = soup.find(attrs={'class': lambda x: x and 'current-magazine-issue' in x.split()}).find( + attrs={'class': lambda x: x and 'sections' in x.split()}) + for section in sections.findAll(attrs={'class': lambda x: x and 'section' in x.split()}): + a = section.find('a') + section_title = self.tag_to_string(a) + self.log('\nSection:', section_title) + articles = [] + for article in section.findAll('article'): + details = article.find(attrs={'class': lambda x: x and 'details' in x.split()}) + pre = details.find(attrs={'class': lambda x: x and 'pre-heading' in x.split()}) + if pre is not None: + pre.extract() + a = details.find('a') + url = base_url + a['href'] + title = self.tag_to_string(a) + desc = self.tag_to_string(details.find('div')) + self.log('\t', title, url) + articles.append({'title': title, 'description': desc, 'url': url}) + if articles: + feeds.append((section_title, articles)) return feeds + + def preprocess_html(self, soup): + for div in soup.findAll(itemprop='image'): + for img in div.findAll('img'): + img['src'] = div['content'] + return soup From aafc038b177a5555b890cd7380aeff72da26e082 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 5 Feb 2019 13:21:58 +0530 Subject: [PATCH 0207/2613] Move replacement of nbsp in pdftohtml output from pipeline to input plugin. Makes viewing PDF in the viewer a bit better. See #1814626 (Text goes over to other page) --- src/calibre/ebooks/conversion/preprocess.py | 3 --- src/calibre/ebooks/pdf/pdftohtml.py | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/calibre/ebooks/conversion/preprocess.py b/src/calibre/ebooks/conversion/preprocess.py index 58a7dc6c25..d92cc2aa1f 100644 --- a/src/calibre/ebooks/conversion/preprocess.py +++ b/src/calibre/ebooks/conversion/preprocess.py @@ -531,9 +531,6 @@ class HTMLPreProcessor(object): rules = [] start_rules = [] - if is_pdftohtml: - # Remove non breaking spaces - start_rules.append((re.compile(unicode(r'\u00a0')), lambda match : ' ')) if not getattr(self.extra_opts, 'keep_ligatures', False): html = _ligpat.sub(lambda m:LIGATURES[m.group()], html) diff --git a/src/calibre/ebooks/pdf/pdftohtml.py b/src/calibre/ebooks/pdf/pdftohtml.py index 44da4e8095..1cbf66daef 100644 --- a/src/calibre/ebooks/pdf/pdftohtml.py +++ b/src/calibre/ebooks/pdf/pdftohtml.py @@ -107,6 +107,7 @@ def pdftohtml(output_dir, pdf_path, no_images, as_xml=False): raw = re.sub(r'
Date: Thu, 7 Feb 2019 09:51:04 +0530 Subject: [PATCH 0208/2613] Sort keys in JSON config files for easier diffing Fixes #1814990 [Sort JSON keys in configuration files](https://bugs.launchpad.net/calibre/+bug/1814990) --- src/calibre/utils/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py index 2ab5276bf3..a7e956b991 100644 --- a/src/calibre/utils/config.py +++ b/src/calibre/utils/config.py @@ -412,7 +412,7 @@ class JSONConfig(XMLConfig): return json.loads(raw.decode('utf-8'), object_hook=from_json) def to_raw(self): - return json.dumps(self, indent=2, default=to_json) + return json.dumps(self, indent=2, default=to_json, sort_keys=True) def __getitem__(self, key): try: From 2e141a617573a99228ea6d949093864734bf8d75 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 7 Feb 2019 10:03:43 +0530 Subject: [PATCH 0209/2613] TXT Input: Fix option to remove indents at the start of lines breaking conversion of markdown documents. Fixes #1814989 ["Remove indents at the beginning of lines" setting removes paragraph breaks in conversion](https://bugs.launchpad.net/calibre/+bug/1814989) --- src/calibre/ebooks/txt/processor.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/calibre/ebooks/txt/processor.py b/src/calibre/ebooks/txt/processor.py index 0845e6c944..22ace69037 100644 --- a/src/calibre/ebooks/txt/processor.py +++ b/src/calibre/ebooks/txt/processor.py @@ -200,8 +200,7 @@ def remove_indents(txt): ''' Remove whitespace at the beginning of each line. ''' - txt = re.sub('(?miu)^\s+', '', txt) - return txt + return '\n'.join([l.lstrip() for l in txt.splitlines()]) def opf_writer(path, opf_name, manifest, spine, mi): From 6b64c0111d1be97073c9a506d31c4ebd98e7160e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 7 Feb 2019 10:07:18 +0530 Subject: [PATCH 0210/2613] pep8 --- src/calibre/ebooks/txt/processor.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/calibre/ebooks/txt/processor.py b/src/calibre/ebooks/txt/processor.py index 22ace69037..6a20703cbb 100644 --- a/src/calibre/ebooks/txt/processor.py +++ b/src/calibre/ebooks/txt/processor.py @@ -37,8 +37,8 @@ def clean_txt(txt): txt = re.sub('[ ]{2,}', ' ', txt) # Remove blank space from the beginning and end of the document. - txt = re.sub('^\s+(?=.)', '', txt) - txt = re.sub('(?<=.)\s+$', '', txt) + txt = re.sub(r'^\s+(?=.)', '', txt) + txt = re.sub(r'(?<=.)\s+$', '', txt) # Remove excessive line breaks. txt = re.sub('\n{5,}', '\n\n\n\n', txt) # remove ASCII invalid chars : 0 to 8 and 11-14 to 24 @@ -178,7 +178,7 @@ def separate_hard_scene_breaks(txt): return '\n%s\n' % line else: return line - txt = re.sub(u'(?miu)^[ \t-=~\/_]+$', lambda mo: sep_break(mo.group()), txt) + txt = re.sub(type(u'')(r'(?miu)^[ \t-=~\/_]+$'), lambda mo: sep_break(mo.group()), txt) return txt @@ -216,7 +216,7 @@ def split_string_separator(txt, size): Splits the text by putting \n\n at the point size. ''' if len(txt) > size: - txt = ''.join([re.sub(u'\.(?P[^.]*)$', '.\n\n\g', + txt = ''.join([re.sub(type(u'')(r'\.(?P[^.]*)$'), r'.\n\n\g', txt[i:i+size], 1) for i in xrange(0, len(txt), size)]) return txt @@ -236,7 +236,7 @@ def detect_paragraph_type(txt): ''' txt = txt.replace('\r\n', '\n') txt = txt.replace('\r', '\n') - txt_line_count = len(re.findall('(?mu)^\s*.+$', txt)) + txt_line_count = len(re.findall(r'(?mu)^\s*.+$', txt)) # Check for hard line breaks - true if 55% of the doc breaks in the same region docanalysis = DocAnalysis('txt', txt) @@ -244,11 +244,11 @@ def detect_paragraph_type(txt): if hardbreaks: # Determine print percentage - tab_line_count = len(re.findall('(?mu)^(\t|\s{2,}).+$', txt)) + tab_line_count = len(re.findall(r'(?mu)^(\t|\s{2,}).+$', txt)) print_percent = tab_line_count / float(txt_line_count) # Determine block percentage - empty_line_count = len(re.findall('(?mu)^\s*$', txt)) + empty_line_count = len(re.findall(r'(?mu)^\s*$', txt)) block_percent = empty_line_count / float(txt_line_count) # Compare the two types - the type with the larger number of instances wins @@ -286,9 +286,9 @@ def detect_formatting_type(txt): markdown_count += len(re.findall('(?mu)^=+$', txt)) markdown_count += len(re.findall('(?mu)^-+$', txt)) # Images - markdown_count += len(re.findall('(?u)!\[.*?\](\[|\()', txt)) + markdown_count += len(re.findall(r'(?u)!\[.*?\](\[|\()', txt)) # Links - markdown_count += len(re.findall('(?u)^|[^!]\[.*?\](\[|\()', txt)) + markdown_count += len(re.findall(r'(?u)^|[^!]\[.*?\](\[|\()', txt)) # Check for textile # Headings From 362a3f408848e3d6b78b7d8acb05e59c9c714d8d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 7 Feb 2019 10:38:03 +0530 Subject: [PATCH 0211/2613] Add test to ensure that all markdown extensions are present --- src/calibre/test_build.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index 162354dd4d..47b991868b 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -270,7 +270,8 @@ class BuildTest(unittest.TestCase): def test_markdown(self): from calibre.ebooks.markdown import Markdown - Markdown(extensions=['extra']) + from calibre.ebooks.conversion.plugins.txt_input import MD_EXTENSIONS + Markdown(extensions=MD_EXTENSIONS) from calibre.library.comments import sanitize_comments_html sanitize_comments_html(b'''xxx''') From 0c77b8503ae8f70d43e8c607671c1488f24c2883 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 7 Feb 2019 10:52:48 +0530 Subject: [PATCH 0212/2613] Remove vendored copy of feedparser --- src/calibre/startup.py | 13 + src/calibre/web/feeds/feedparser.py | 4000 --------------------------- 2 files changed, 13 insertions(+), 4000 deletions(-) delete mode 100755 src/calibre/web/feeds/feedparser.py diff --git a/src/calibre/startup.py b/src/calibre/startup.py index 100d7110dc..b40f9fac74 100644 --- a/src/calibre/startup.py +++ b/src/calibre/startup.py @@ -38,6 +38,19 @@ if not _run_once: sys.meta_path.insert(0, PyQt4Ban()) + class DeVendor(object): + + def find_module(self, fullname, path=None): + if fullname == 'calibre.web.feeds.feedparser': + return self + + def load_module(self, fullname): + if fullname == 'calibre.web.feeds.feedparser': + from importlib import import_module + return import_module('feedparser') + + sys.meta_path.insert(0, DeVendor()) + # # Platform specific modules if iswindows: diff --git a/src/calibre/web/feeds/feedparser.py b/src/calibre/web/feeds/feedparser.py deleted file mode 100755 index ccbee27b9c..0000000000 --- a/src/calibre/web/feeds/feedparser.py +++ /dev/null @@ -1,4000 +0,0 @@ -"""Universal feed parser - -Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds - -Visit https://code.google.com/p/feedparser/ for the latest version -Visit http://packages.python.org/feedparser/ for the latest documentation - -Required: Python 2.4 or later -Recommended: iconv_codec -""" - -__version__ = "5.1.3" -__license__ = """ -Copyright (c) 2010-2012 Kurt McKee -Copyright (c) 2002-2008 Mark Pilgrim -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE.""" -__author__ = "Mark Pilgrim " -__contributors__ = ["Jason Diamond ", - "John Beimler ", - "Fazal Majid ", - "Aaron Swartz ", - "Kevin Marks ", - "Sam Ruby ", - "Ade Oshineye ", - "Martin Pool ", - "Kurt McKee ", - "Bernd Schlapsi ",] - -# HTTP "User-Agent" header to send to servers when downloading feeds. -# If you are embedding feedparser in a larger application, you should -# change this to your application name and URL. -USER_AGENT = "UniversalFeedParser/%s +https://code.google.com/p/feedparser/" % __version__ - -# HTTP "Accept" header to send to servers when downloading feeds. If you don't -# want to send an Accept header, set this to None. -ACCEPT_HEADER = "application/atom+xml,application/rdf+xml,application/rss+xml,application/x-netcdf,application/xml;q=0.9,text/xml;q=0.2,*/*;q=0.1" - -# List of preferred XML parsers, by SAX driver name. These will be tried first, -# but if they're not installed, Python will keep searching through its own list -# of pre-installed parsers until it finds one that supports everything we need. -PREFERRED_XML_PARSERS = ["drv_libxml2"] - -# If you want feedparser to automatically run HTML markup through HTML Tidy, set -# this to 1. Requires mxTidy -# or utidylib . -TIDY_MARKUP = 0 - -# List of Python interfaces for HTML Tidy, in order of preference. Only useful -# if TIDY_MARKUP = 1 -PREFERRED_TIDY_INTERFACES = ["uTidy", "mxTidy"] - -# If you want feedparser to automatically resolve all relative URIs, set this -# to 1. -RESOLVE_RELATIVE_URIS = 1 - -# If you want feedparser to automatically sanitize all potentially unsafe -# HTML content, set this to 1. -SANITIZE_HTML = 1 - -# If you want feedparser to automatically parse microformat content embedded -# in entry contents, set this to 1 -PARSE_MICROFORMATS = 1 - -# ---------- Python 3 modules (make it work if possible) ---------- -try: - import rfc822 -except ImportError: - from email import _parseaddr as rfc822 - -try: - # Python 3.1 introduces bytes.maketrans and simultaneously - # deprecates string.maketrans; use bytes.maketrans if possible - _maketrans = bytes.maketrans -except (NameError, AttributeError): - import string - _maketrans = string.maketrans - -# base64 support for Atom feeds that contain embedded binary data -try: - import base64, binascii -except ImportError: - base64 = binascii = None -else: - # Python 3.1 deprecates decodestring in favor of decodebytes - _base64decode = getattr(base64, 'decodebytes', base64.decodestring) - -# _s2bytes: convert a UTF-8 str to bytes if the interpreter is Python 3 -# _l2bytes: convert a list of ints to bytes if the interpreter is Python 3 -try: - if bytes is str: - # In Python 2.5 and below, bytes doesn't exist (NameError) - # In Python 2.6 and above, bytes and str are the same type - raise NameError -except NameError: - # Python 2 - def _s2bytes(s): - return s - def _l2bytes(l): - return ''.join(map(chr, l)) -else: - # Python 3 - def _s2bytes(s): - return bytes(s, 'utf8') - def _l2bytes(l): - return bytes(l) - -# If you want feedparser to allow all URL schemes, set this to () -# List culled from Python's urlparse documentation at: -# http://docs.python.org/library/urlparse.html -# as well as from "URI scheme" at Wikipedia: -# https://secure.wikimedia.org/wikipedia/en/wiki/URI_scheme -# Many more will likely need to be added! -ACCEPTABLE_URI_SCHEMES = ( - 'file', 'ftp', 'gopher', 'h323', 'hdl', 'http', 'https', 'imap', 'magnet', - 'mailto', 'mms', 'news', 'nntp', 'prospero', 'rsync', 'rtsp', 'rtspu', - 'sftp', 'shttp', 'sip', 'sips', 'snews', 'svn', 'svn+ssh', 'telnet', - 'wais', - # Additional common-but-unofficial schemes - 'aim', 'callto', 'cvs', 'facetime', 'feed', 'git', 'gtalk', 'irc', 'ircs', - 'irc6', 'itms', 'mms', 'msnim', 'skype', 'ssh', 'smb', 'svn', 'ymsg', -) -#ACCEPTABLE_URI_SCHEMES = () - -# ---------- required modules (should come with any Python distribution) ---------- -import cgi -import codecs -import copy -import datetime -import re -import struct -import time -import types -import urllib -import urllib2 -import urlparse -import warnings - -from htmlentitydefs import name2codepoint, codepoint2name, entitydefs - -try: - from io import BytesIO as _StringIO -except ImportError: - try: - from cStringIO import StringIO as _StringIO - except ImportError: - from StringIO import StringIO as _StringIO - -# ---------- optional modules (feedparser will work without these, but with reduced functionality) ---------- - -# gzip is included with most Python distributions, but may not be available if you compiled your own -try: - import gzip -except ImportError: - gzip = None -try: - import zlib -except ImportError: - zlib = None - -# If a real XML parser is available, feedparser will attempt to use it. feedparser has -# been tested with the built-in SAX parser and libxml2. On platforms where the -# Python distribution does not come with an XML parser (such as Mac OS X 10.2 and some -# versions of FreeBSD), feedparser will quietly fall back on regex-based parsing. -try: - import xml.sax - from xml.sax.saxutils import escape as _xmlescape -except ImportError: - _XML_AVAILABLE = 0 - def _xmlescape(data,entities={}): - data = data.replace('&', '&') - data = data.replace('>', '>') - data = data.replace('<', '<') - for char, entity in entities: - data = data.replace(char, entity) - return data -else: - try: - xml.sax.make_parser(PREFERRED_XML_PARSERS) # test for valid parsers - except xml.sax.SAXReaderNotAvailable: - _XML_AVAILABLE = 0 - else: - _XML_AVAILABLE = 1 - -# sgmllib is not available by default in Python 3; if the end user doesn't have -# it available then we'll lose illformed XML parsing, content santizing, and -# microformat support (at least while feedparser depends on BeautifulSoup). -try: - import sgmllib -except ImportError: - import _feedparser_sgmllib as sgmllib - -if True: - _SGML_AVAILABLE = 1 - - # sgmllib defines a number of module-level regular expressions that are - # insufficient for the XML parsing feedparser needs. Rather than modify - # the variables directly in sgmllib, they're defined here using the same - # names, and the compiled code objects of several sgmllib.SGMLParser - # methods are copied into _BaseHTMLProcessor so that they execute in - # feedparser's scope instead of sgmllib's scope. - charref = re.compile('&#(\d+|[xX][0-9a-fA-F]+);') - tagfind = re.compile('[a-zA-Z][-_.:a-zA-Z0-9]*') - attrfind = re.compile( - r'\s*([a-zA-Z_][-:.a-zA-Z_0-9]*)[$]?(\s*=\s*' - r'(\'[^\']*\'|"[^"]*"|[][\-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~\'"@]*))?' - ) - - # Unfortunately, these must be copied over to prevent NameError exceptions - entityref = sgmllib.entityref - incomplete = sgmllib.incomplete - interesting = sgmllib.interesting - shorttag = sgmllib.shorttag - shorttagopen = sgmllib.shorttagopen - starttagopen = sgmllib.starttagopen - - class _EndBracketRegEx: - def __init__(self): - # Overriding the built-in sgmllib.endbracket regex allows the - # parser to find angle brackets embedded in element attributes. - self.endbracket = re.compile('''([^'"<>]|"[^"]*"(?=>|/|\s|\w+=)|'[^']*'(?=>|/|\s|\w+=))*(?=[<>])|.*?(?=[<>])''') - def search(self, target, index=0): - match = self.endbracket.match(target, index) - if match is not None: - # Returning a new object in the calling thread's context - # resolves a thread-safety. - return EndBracketMatch(match) - return None - class EndBracketMatch: - def __init__(self, match): - self.match = match - def start(self, n): - return self.match.end(n) - endbracket = _EndBracketRegEx() - - -# iconv_codec provides support for more character encodings. -# It's available from http://cjkpython.i18n.org/ -try: - import iconv_codec -except ImportError: - pass - -# chardet library auto-detects character encodings -# Download from http://chardet.feedparser.org/ -try: - import chardet -except ImportError: - chardet = None - -# BeautifulSoup is used to extract microformat content from HTML -# feedparser is tested using BeautifulSoup 3.2.0 -# http://www.crummy.com/software/BeautifulSoup/ -try: - import BeautifulSoup -except ImportError: - BeautifulSoup = None - PARSE_MICROFORMATS = False - -# ---------- don't touch these ---------- -class ThingsNobodyCaresAboutButMe(Exception): pass -class CharacterEncodingOverride(ThingsNobodyCaresAboutButMe): pass -class CharacterEncodingUnknown(ThingsNobodyCaresAboutButMe): pass -class NonXMLContentType(ThingsNobodyCaresAboutButMe): pass -class UndeclaredNamespace(Exception): pass - -SUPPORTED_VERSIONS = {'': u'unknown', - 'rss090': u'RSS 0.90', - 'rss091n': u'RSS 0.91 (Netscape)', - 'rss091u': u'RSS 0.91 (Userland)', - 'rss092': u'RSS 0.92', - 'rss093': u'RSS 0.93', - 'rss094': u'RSS 0.94', - 'rss20': u'RSS 2.0', - 'rss10': u'RSS 1.0', - 'rss': u'RSS (unknown version)', - 'atom01': u'Atom 0.1', - 'atom02': u'Atom 0.2', - 'atom03': u'Atom 0.3', - 'atom10': u'Atom 1.0', - 'atom': u'Atom (unknown version)', - 'cdf': u'CDF', - } - -class FeedParserDict(dict): - keymap = {'channel': 'feed', - 'items': 'entries', - 'guid': 'id', - 'date': 'updated', - 'date_parsed': 'updated_parsed', - 'description': ['summary', 'subtitle'], - 'description_detail': ['summary_detail', 'subtitle_detail'], - 'url': ['href'], - 'modified': 'updated', - 'modified_parsed': 'updated_parsed', - 'issued': 'published', - 'issued_parsed': 'published_parsed', - 'copyright': 'rights', - 'copyright_detail': 'rights_detail', - 'tagline': 'subtitle', - 'tagline_detail': 'subtitle_detail'} - def __getitem__(self, key): - if key == 'category': - try: - return dict.__getitem__(self, 'tags')[0]['term'] - except IndexError: - raise KeyError("object doesn't have key 'category'") - elif key == 'enclosures': - norel = lambda link: FeedParserDict([(name,value) for (name,value) in link.items() if name!='rel']) - return [norel(link) for link in dict.__getitem__(self, 'links') if link['rel']==u'enclosure'] - elif key == 'license': - for link in dict.__getitem__(self, 'links'): - if link['rel']==u'license' and 'href' in link: - return link['href'] - elif key == 'updated': - # Temporarily help developers out by keeping the old - # broken behavior that was reported in issue 310. - # This fix was proposed in issue 328. - if not dict.__contains__(self, 'updated') and \ - dict.__contains__(self, 'published'): - warnings.warn("To avoid breaking existing software while " - "fixing issue 310, a temporary mapping has been created " - "from `updated` to `published` if `updated` doesn't " - "exist. This fallback will be removed in a future version " - "of feedparser.", DeprecationWarning) - return dict.__getitem__(self, 'published') - return dict.__getitem__(self, 'updated') - elif key == 'updated_parsed': - if not dict.__contains__(self, 'updated_parsed') and \ - dict.__contains__(self, 'published_parsed'): - warnings.warn("To avoid breaking existing software while " - "fixing issue 310, a temporary mapping has been created " - "from `updated_parsed` to `published_parsed` if " - "`updated_parsed` doesn't exist. This fallback will be " - "removed in a future version of feedparser.", - DeprecationWarning) - return dict.__getitem__(self, 'published_parsed') - return dict.__getitem__(self, 'updated_parsed') - else: - realkey = self.keymap.get(key, key) - if isinstance(realkey, list): - for k in realkey: - if dict.__contains__(self, k): - return dict.__getitem__(self, k) - elif dict.__contains__(self, realkey): - return dict.__getitem__(self, realkey) - return dict.__getitem__(self, key) - - def __contains__(self, key): - if key in ('updated', 'updated_parsed'): - # Temporarily help developers out by keeping the old - # broken behavior that was reported in issue 310. - # This fix was proposed in issue 328. - return dict.__contains__(self, key) - try: - self.__getitem__(key) - except KeyError: - return False - else: - return True - - has_key = __contains__ - - def get(self, key, default=None): - try: - return self.__getitem__(key) - except KeyError: - return default - - def __setitem__(self, key, value): - key = self.keymap.get(key, key) - if isinstance(key, list): - key = key[0] - return dict.__setitem__(self, key, value) - - def setdefault(self, key, value): - if key not in self: - self[key] = value - return value - return self[key] - - def __getattr__(self, key): - # __getattribute__() is called first; this will be called - # only if an attribute was not already found - try: - return self.__getitem__(key) - except KeyError: - raise AttributeError("object has no attribute '%s'" % key) - - def __hash__(self): - return id(self) - -_cp1252 = { - 128: unichr(8364), # euro sign - 130: unichr(8218), # single low-9 quotation mark - 131: unichr( 402), # latin small letter f with hook - 132: unichr(8222), # double low-9 quotation mark - 133: unichr(8230), # horizontal ellipsis - 134: unichr(8224), # dagger - 135: unichr(8225), # double dagger - 136: unichr( 710), # modifier letter circumflex accent - 137: unichr(8240), # per mille sign - 138: unichr( 352), # latin capital letter s with caron - 139: unichr(8249), # single left-pointing angle quotation mark - 140: unichr( 338), # latin capital ligature oe - 142: unichr( 381), # latin capital letter z with caron - 145: unichr(8216), # left single quotation mark - 146: unichr(8217), # right single quotation mark - 147: unichr(8220), # left double quotation mark - 148: unichr(8221), # right double quotation mark - 149: unichr(8226), # bullet - 150: unichr(8211), # en dash - 151: unichr(8212), # em dash - 152: unichr( 732), # small tilde - 153: unichr(8482), # trade mark sign - 154: unichr( 353), # latin small letter s with caron - 155: unichr(8250), # single right-pointing angle quotation mark - 156: unichr( 339), # latin small ligature oe - 158: unichr( 382), # latin small letter z with caron - 159: unichr( 376), # latin capital letter y with diaeresis -} - -_urifixer = re.compile('^([A-Za-z][A-Za-z0-9+-.]*://)(/*)(.*?)') -def _urljoin(base, uri): - uri = _urifixer.sub(r'\1\3', uri) - #try: - if not isinstance(uri, unicode): - uri = uri.decode('utf-8', 'ignore') - uri = urlparse.urljoin(base, uri) - if not isinstance(uri, unicode): - return uri.decode('utf-8', 'ignore') - return uri - #except: - # uri = urlparse.urlunparse([urllib.quote(part) for part in urlparse.urlparse(uri)]) - # return urlparse.urljoin(base, uri) - -class _FeedParserMixin: - namespaces = { - '': '', - 'http://backend.userland.com/rss': '', - 'http://blogs.law.harvard.edu/tech/rss': '', - 'http://purl.org/rss/1.0/': '', - 'http://my.netscape.com/rdf/simple/0.9/': '', - 'http://example.com/newformat#': '', - 'http://example.com/necho': '', - 'http://purl.org/echo/': '', - 'uri/of/echo/namespace#': '', - 'http://purl.org/pie/': '', - 'http://purl.org/atom/ns#': '', - 'http://www.w3.org/2005/Atom': '', - 'http://purl.org/rss/1.0/modules/rss091#': '', - - 'http://webns.net/mvcb/': 'admin', - 'http://purl.org/rss/1.0/modules/aggregation/': 'ag', - 'http://purl.org/rss/1.0/modules/annotate/': 'annotate', - 'http://media.tangent.org/rss/1.0/': 'audio', - 'http://backend.userland.com/blogChannelModule': 'blogChannel', - 'http://web.resource.org/cc/': 'cc', - 'http://backend.userland.com/creativeCommonsRssModule': 'creativeCommons', - 'http://purl.org/rss/1.0/modules/company': 'co', - 'http://purl.org/rss/1.0/modules/content/': 'content', - 'http://my.theinfo.org/changed/1.0/rss/': 'cp', - 'http://purl.org/dc/elements/1.1/': 'dc', - 'http://purl.org/dc/terms/': 'dcterms', - 'http://purl.org/rss/1.0/modules/email/': 'email', - 'http://purl.org/rss/1.0/modules/event/': 'ev', - 'http://rssnamespace.org/feedburner/ext/1.0': 'feedburner', - 'http://freshmeat.net/rss/fm/': 'fm', - 'http://xmlns.com/foaf/0.1/': 'foaf', - 'http://www.w3.org/2003/01/geo/wgs84_pos#': 'geo', - 'http://postneo.com/icbm/': 'icbm', - 'http://purl.org/rss/1.0/modules/image/': 'image', - 'http://www.itunes.com/DTDs/PodCast-1.0.dtd': 'itunes', - 'http://example.com/DTDs/PodCast-1.0.dtd': 'itunes', - 'http://purl.org/rss/1.0/modules/link/': 'l', - 'http://search.yahoo.com/mrss': 'media', - # Version 1.1.2 of the Media RSS spec added the trailing slash on the namespace - 'http://search.yahoo.com/mrss/': 'media', - 'http://madskills.com/public/xml/rss/module/pingback/': 'pingback', - 'http://prismstandard.org/namespaces/1.2/basic/': 'prism', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#': 'rdf', - 'http://www.w3.org/2000/01/rdf-schema#': 'rdfs', - 'http://purl.org/rss/1.0/modules/reference/': 'ref', - 'http://purl.org/rss/1.0/modules/richequiv/': 'reqv', - 'http://purl.org/rss/1.0/modules/search/': 'search', - 'http://purl.org/rss/1.0/modules/slash/': 'slash', - 'http://schemas.xmlsoap.org/soap/envelope/': 'soap', - 'http://purl.org/rss/1.0/modules/servicestatus/': 'ss', - 'http://hacks.benhammersley.com/rss/streaming/': 'str', - 'http://purl.org/rss/1.0/modules/subscription/': 'sub', - 'http://purl.org/rss/1.0/modules/syndication/': 'sy', - 'http://schemas.pocketsoap.com/rss/myDescModule/': 'szf', - 'http://purl.org/rss/1.0/modules/taxonomy/': 'taxo', - 'http://purl.org/rss/1.0/modules/threading/': 'thr', - 'http://purl.org/rss/1.0/modules/textinput/': 'ti', - 'http://madskills.com/public/xml/rss/module/trackback/': 'trackback', - 'http://wellformedweb.org/commentAPI/': 'wfw', - 'http://purl.org/rss/1.0/modules/wiki/': 'wiki', - 'http://www.w3.org/1999/xhtml': 'xhtml', - 'http://www.w3.org/1999/xlink': 'xlink', - 'http://www.w3.org/XML/1998/namespace': 'xml', - } - _matchnamespaces = {} - - can_be_relative_uri = {'link', 'id', 'wfw_comment', 'wfw_commentrss', 'docs', 'url', 'href', 'comments', 'icon', 'logo'} - can_contain_relative_uris = {'content', 'title', 'summary', 'info', 'tagline', 'subtitle', 'copyright', 'rights', 'description'} - can_contain_dangerous_markup = {'content', 'title', 'summary', 'info', 'tagline', 'subtitle', 'copyright', 'rights', 'description'} - html_types = [u'text/html', u'application/xhtml+xml'] - - def __init__(self, baseuri=None, baselang=None, encoding=u'utf-8'): - if not self._matchnamespaces: - for k, v in self.namespaces.items(): - self._matchnamespaces[k.lower()] = v - self.feeddata = FeedParserDict() # feed-level data - self.encoding = encoding # character encoding - self.entries = [] # list of entry-level data - self.version = u'' # feed type/version, see SUPPORTED_VERSIONS - self.namespacesInUse = {} # dictionary of namespaces defined by the feed - - # the following are used internally to track state; - # this is really out of control and should be refactored - self.infeed = 0 - self.inentry = 0 - self.incontent = 0 - self.intextinput = 0 - self.inimage = 0 - self.inauthor = 0 - self.incontributor = 0 - self.inpublisher = 0 - self.insource = 0 - self.sourcedata = FeedParserDict() - self.contentparams = FeedParserDict() - self._summaryKey = None - self.namespacemap = {} - self.elementstack = [] - self.basestack = [] - self.langstack = [] - self.baseuri = baseuri or u'' - self.lang = baselang or None - self.svgOK = 0 - self.title_depth = -1 - self.depth = 0 - if baselang: - self.feeddata['language'] = baselang.replace('_','-') - - # A map of the following form: - # { - # object_that_value_is_set_on: { - # property_name: depth_of_node_property_was_extracted_from, - # other_property: depth_of_node_property_was_extracted_from, - # }, - # } - self.property_depth_map = {} - - def _normalize_attributes(self, kv): - k = kv[0].lower() - v = k in ('rel', 'type') and kv[1].lower() or kv[1] - # the sgml parser doesn't handle entities in attributes, nor - # does it pass the attribute values through as unicode, while - # strict xml parsers do -- account for this difference - if isinstance(self, _LooseFeedParser): - v = v.replace('&', '&') - if not isinstance(v, unicode): - v = v.decode('utf-8') - return (k, v) - - def unknown_starttag(self, tag, attrs): - # increment depth counter - self.depth += 1 - - # normalize attrs - attrs = map(self._normalize_attributes, attrs) - - # track xml:base and xml:lang - attrsD = dict(attrs) - baseuri = attrsD.get('xml:base', attrsD.get('base')) or self.baseuri - if not isinstance(baseuri, unicode): - baseuri = baseuri.decode(self.encoding, 'ignore') - # ensure that self.baseuri is always an absolute URI that - # uses a whitelisted URI scheme (e.g. not `javscript:`) - if self.baseuri: - self.baseuri = _makeSafeAbsoluteURI(self.baseuri, baseuri) or self.baseuri - else: - self.baseuri = _urljoin(self.baseuri, baseuri) - lang = attrsD.get('xml:lang', attrsD.get('lang')) - if lang == '': - # xml:lang could be explicitly set to '', we need to capture that - lang = None - elif lang is None: - # if no xml:lang is specified, use parent lang - lang = self.lang - if lang: - if tag in ('feed', 'rss', 'rdf:RDF'): - self.feeddata['language'] = lang.replace('_','-') - self.lang = lang - self.basestack.append(self.baseuri) - self.langstack.append(lang) - - # track namespaces - for prefix, uri in attrs: - if prefix.startswith('xmlns:'): - self.trackNamespace(prefix[6:], uri) - elif prefix == 'xmlns': - self.trackNamespace(None, uri) - - # track inline content - if self.incontent and not self.contentparams.get('type', u'xml').endswith(u'xml'): - if tag in ('xhtml:div', 'div'): - return # typepad does this 10/2007 - # element declared itself as escaped markup, but it isn't really - self.contentparams['type'] = u'application/xhtml+xml' - if self.incontent and self.contentparams.get('type') == u'application/xhtml+xml': - if tag.find(':') != -1: - prefix, tag = tag.split(':', 1) - namespace = self.namespacesInUse.get(prefix, '') - if tag=='math' and namespace=='http://www.w3.org/1998/Math/MathML': - attrs.append(('xmlns',namespace)) - if tag=='svg' and namespace=='http://www.w3.org/2000/svg': - attrs.append(('xmlns',namespace)) - if tag == 'svg': - self.svgOK += 1 - return self.handle_data('<%s%s>' % (tag, self.strattrs(attrs)), escape=0) - - # match namespaces - if tag.find(':') != -1: - prefix, suffix = tag.split(':', 1) - else: - prefix, suffix = '', tag - prefix = self.namespacemap.get(prefix, prefix) - if prefix: - prefix = prefix + '_' - - # special hack for better tracking of empty textinput/image elements in illformed feeds - if (not prefix) and tag not in ('title', 'link', 'description', 'name'): - self.intextinput = 0 - if (not prefix) and tag not in ('title', 'link', 'description', 'url', 'href', 'width', 'height'): - self.inimage = 0 - - # call special handler (if defined) or default handler - methodname = '_start_' + prefix + suffix - try: - method = getattr(self, methodname) - return method(attrsD) - except AttributeError: - # Since there's no handler or something has gone wrong we explicitly add the element and its attributes - unknown_tag = prefix + suffix - if len(attrsD) == 0: - # No attributes so merge it into the encosing dictionary - return self.push(unknown_tag, 1) - else: - # Has attributes so create it in its own dictionary - context = self._getContext() - context[unknown_tag] = attrsD - - def unknown_endtag(self, tag): - # match namespaces - if tag.find(':') != -1: - prefix, suffix = tag.split(':', 1) - else: - prefix, suffix = '', tag - prefix = self.namespacemap.get(prefix, prefix) - if prefix: - prefix = prefix + '_' - if suffix == 'svg' and self.svgOK: - self.svgOK -= 1 - - # call special handler (if defined) or default handler - methodname = '_end_' + prefix + suffix - try: - if self.svgOK: - raise AttributeError() - method = getattr(self, methodname) - method() - except AttributeError: - self.pop(prefix + suffix) - - # track inline content - if self.incontent and not self.contentparams.get('type', u'xml').endswith(u'xml'): - # element declared itself as escaped markup, but it isn't really - if tag in ('xhtml:div', 'div'): - return # typepad does this 10/2007 - self.contentparams['type'] = u'application/xhtml+xml' - if self.incontent and self.contentparams.get('type') == u'application/xhtml+xml': - tag = tag.split(':')[-1] - self.handle_data('' % tag, escape=0) - - # track xml:base and xml:lang going out of scope - if self.basestack: - self.basestack.pop() - if self.basestack and self.basestack[-1]: - self.baseuri = self.basestack[-1] - if self.langstack: - self.langstack.pop() - if self.langstack: # and (self.langstack[-1] is not None): - self.lang = self.langstack[-1] - - self.depth -= 1 - - def handle_charref(self, ref): - # called for each character reference, e.g. for ' ', ref will be '160' - if not self.elementstack: - return - ref = ref.lower() - if ref in ('34', '38', '39', '60', '62', 'x22', 'x26', 'x27', 'x3c', 'x3e'): - text = '&#%s;' % ref - else: - if ref[0] == 'x': - c = int(ref[1:], 16) - else: - c = int(ref) - text = unichr(c).encode('utf-8') - self.elementstack[-1][2].append(text) - - def handle_entityref(self, ref): - # called for each entity reference, e.g. for '©', ref will be 'copy' - if not self.elementstack: - return - if ref in ('lt', 'gt', 'quot', 'amp', 'apos'): - text = '&%s;' % ref - elif ref in self.entities: - text = self.entities[ref] - if text.startswith('&#') and text.endswith(';'): - return self.handle_entityref(text) - else: - try: - name2codepoint[ref] - except KeyError: - text = '&%s;' % ref - else: - text = unichr(name2codepoint[ref]).encode('utf-8') - self.elementstack[-1][2].append(text) - - def handle_data(self, text, escape=1): - # called for each block of plain text, i.e. outside of any tag and - # not containing any character or entity references - if not self.elementstack: - return - if escape and self.contentparams.get('type') == u'application/xhtml+xml': - text = _xmlescape(text) - self.elementstack[-1][2].append(text) - - def handle_comment(self, text): - # called for each comment, e.g. - pass - - def handle_pi(self, text): - # called for each processing instruction, e.g. - pass - - def handle_decl(self, text): - pass - - def parse_declaration(self, i): - # override internal declaration handler to handle CDATA blocks - if self.rawdata[i:i+9] == '', i) - if k == -1: - # CDATA block began but didn't finish - k = len(self.rawdata) - return k - self.handle_data(_xmlescape(self.rawdata[i+9:k]), 0) - return k+3 - else: - k = self.rawdata.find('>', i) - if k >= 0: - return k+1 - else: - # We have an incomplete CDATA block. - return k - - def mapContentType(self, contentType): - contentType = contentType.lower() - if contentType == 'text' or contentType == 'plain': - contentType = u'text/plain' - elif contentType == 'html': - contentType = u'text/html' - elif contentType == 'xhtml': - contentType = u'application/xhtml+xml' - return contentType - - def trackNamespace(self, prefix, uri): - loweruri = uri.lower() - if not self.version: - if (prefix, loweruri) == (None, 'http://my.netscape.com/rdf/simple/0.9/'): - self.version = u'rss090' - elif loweruri == 'http://purl.org/rss/1.0/': - self.version = u'rss10' - elif loweruri == 'http://www.w3.org/2005/atom': - self.version = u'atom10' - if loweruri.find(u'backend.userland.com/rss') != -1: - # match any backend.userland.com namespace - uri = u'http://backend.userland.com/rss' - loweruri = uri - if loweruri in self._matchnamespaces: - self.namespacemap[prefix] = self._matchnamespaces[loweruri] - self.namespacesInUse[self._matchnamespaces[loweruri]] = uri - else: - self.namespacesInUse[prefix or ''] = uri - - def resolveURI(self, uri): - return _urljoin(self.baseuri or u'', uri) - - def decodeEntities(self, element, data): - return data - - def strattrs(self, attrs): - return ''.join([' %s="%s"' % (t[0],_xmlescape(t[1],{'"':'"'})) for t in attrs]) - - def push(self, element, expectingText): - self.elementstack.append([element, expectingText, []]) - - def pop(self, element, stripWhitespace=1): - if not self.elementstack: - return - if self.elementstack[-1][0] != element: - return - - element, expectingText, pieces = self.elementstack.pop() - - if self.version == u'atom10' and self.contentparams.get('type', u'text') == u'application/xhtml+xml': - # remove enclosing child element, but only if it is a
and - # only if all the remaining content is nested underneath it. - # This means that the divs would be retained in the following: - #
foo
bar
- while pieces and len(pieces)>1 and not pieces[-1].strip(): - del pieces[-1] - while pieces and len(pieces)>1 and not pieces[0].strip(): - del pieces[0] - if pieces and (pieces[0] == '
' or pieces[0].startswith('
': - depth = 0 - for piece in pieces[:-1]: - if piece.startswith(''): - depth += 1 - else: - pieces = pieces[1:-1] - - # Ensure each piece is a str for Python 3 - for (i, v) in enumerate(pieces): - if not isinstance(v, unicode): - pieces[i] = v.decode('utf-8') - - output = u''.join(pieces) - if stripWhitespace: - output = output.strip() - if not expectingText: - return output - - # decode base64 content - if base64 and self.contentparams.get('base64', 0): - try: - output = _base64decode(output) - except binascii.Error: - pass - except binascii.Incomplete: - pass - except TypeError: - # In Python 3, base64 takes and outputs bytes, not str - # This may not be the most correct way to accomplish this - output = _base64decode(output.encode('utf-8')).decode('utf-8') - - # resolve relative URIs - if (element in self.can_be_relative_uri) and output: - output = self.resolveURI(output) - - # decode entities within embedded markup - if not self.contentparams.get('base64', 0): - output = self.decodeEntities(element, output) - - # some feed formats require consumers to guess - # whether the content is html or plain text - if not self.version.startswith(u'atom') and self.contentparams.get('type') == u'text/plain': - if self.lookslikehtml(output): - self.contentparams['type'] = u'text/html' - - # remove temporary cruft from contentparams - try: - del self.contentparams['mode'] - except KeyError: - pass - try: - del self.contentparams['base64'] - except KeyError: - pass - - is_htmlish = self.mapContentType(self.contentparams.get('type', u'text/html')) in self.html_types - # resolve relative URIs within embedded markup - if is_htmlish and RESOLVE_RELATIVE_URIS: - if element in self.can_contain_relative_uris: - output = _resolveRelativeURIs(output, self.baseuri, self.encoding, self.contentparams.get('type', u'text/html')) - - # parse microformats - # (must do this before sanitizing because some microformats - # rely on elements that we sanitize) - if PARSE_MICROFORMATS and is_htmlish and element in ['content', 'description', 'summary']: - mfresults = _parseMicroformats(output, self.baseuri, self.encoding) - if mfresults: - for tag in mfresults.get('tags', []): - self._addTag(tag['term'], tag['scheme'], tag['label']) - for enclosure in mfresults.get('enclosures', []): - self._start_enclosure(enclosure) - for xfn in mfresults.get('xfn', []): - self._addXFN(xfn['relationships'], xfn['href'], xfn['name']) - vcard = mfresults.get('vcard') - if vcard: - self._getContext()['vcard'] = vcard - - # sanitize embedded markup - if is_htmlish and SANITIZE_HTML: - if element in self.can_contain_dangerous_markup: - output = _sanitizeHTML(output, self.encoding, self.contentparams.get('type', u'text/html')) - - if self.encoding and not isinstance(output, unicode): - output = output.decode(self.encoding, 'ignore') - - # address common error where people take data that is already - # utf-8, presume that it is iso-8859-1, and re-encode it. - if self.encoding in (u'utf-8', u'utf-8_INVALID_PYTHON_3') and isinstance(output, unicode): - try: - output = output.encode('iso-8859-1').decode('utf-8') - except (UnicodeEncodeError, UnicodeDecodeError): - pass - - # map win-1252 extensions to the proper code points - if isinstance(output, unicode): - output = output.translate(_cp1252) - - # categories/tags/keywords/whatever are handled in _end_category - if element == 'category': - return output - - if element == 'title' and -1 < self.title_depth <= self.depth: - return output - - # store output in appropriate place(s) - if self.inentry and not self.insource: - if element == 'content': - self.entries[-1].setdefault(element, []) - contentparams = copy.deepcopy(self.contentparams) - contentparams['value'] = output - self.entries[-1][element].append(contentparams) - elif element == 'link': - if not self.inimage: - # query variables in urls in link elements are improperly - # converted from `?a=1&b=2` to `?a=1&b;=2` as if they're - # unhandled character references. fix this special case. - output = re.sub("&([A-Za-z0-9_]+);", "&\g<1>", output) - self.entries[-1][element] = output - if output: - self.entries[-1]['links'][-1]['href'] = output - else: - if element == 'description': - element = 'summary' - old_value_depth = self.property_depth_map.setdefault(self.entries[-1], {}).get(element) - if old_value_depth is None or self.depth <= old_value_depth: - self.property_depth_map[self.entries[-1]][element] = self.depth - self.entries[-1][element] = output - if self.incontent: - contentparams = copy.deepcopy(self.contentparams) - contentparams['value'] = output - self.entries[-1][element + '_detail'] = contentparams - elif (self.infeed or self.insource):# and (not self.intextinput) and (not self.inimage): - context = self._getContext() - if element == 'description': - element = 'subtitle' - context[element] = output - if element == 'link': - # fix query variables; see above for the explanation - output = re.sub("&([A-Za-z0-9_]+);", "&\g<1>", output) - context[element] = output - context['links'][-1]['href'] = output - elif self.incontent: - contentparams = copy.deepcopy(self.contentparams) - contentparams['value'] = output - context[element + '_detail'] = contentparams - return output - - def pushContent(self, tag, attrsD, defaultContentType, expectingText): - self.incontent += 1 - if self.lang: - self.lang=self.lang.replace('_','-') - self.contentparams = FeedParserDict({ - 'type': self.mapContentType(attrsD.get('type', defaultContentType)), - 'language': self.lang, - 'base': self.baseuri}) - self.contentparams['base64'] = self._isBase64(attrsD, self.contentparams) - self.push(tag, expectingText) - - def popContent(self, tag): - value = self.pop(tag) - self.incontent -= 1 - self.contentparams.clear() - return value - - # a number of elements in a number of RSS variants are nominally plain - # text, but this is routinely ignored. This is an attempt to detect - # the most common cases. As false positives often result in silent - # data loss, this function errs on the conservative side. - @staticmethod - def lookslikehtml(s): - # must have a close tag or an entity reference to qualify - if not (re.search(r'',s) or re.search("&#?\w+;",s)): - return - - # all tags must be in a restricted subset of valid HTML tags - if filter(lambda t: t.lower() not in _HTMLSanitizer.acceptable_elements, - re.findall(r'', u'') - author = author.replace(u'<>', u'') - author = author.strip() - if author and (author[0] == u'('): - author = author[1:] - if author and (author[-1] == u')'): - author = author[:-1] - author = author.strip() - if author or email: - context.setdefault('%s_detail' % key, FeedParserDict()) - if author: - context['%s_detail' % key]['name'] = author - if email: - context['%s_detail' % key]['email'] = email - - def _start_subtitle(self, attrsD): - self.pushContent('subtitle', attrsD, u'text/plain', 1) - _start_tagline = _start_subtitle - _start_itunes_subtitle = _start_subtitle - - def _end_subtitle(self): - self.popContent('subtitle') - _end_tagline = _end_subtitle - _end_itunes_subtitle = _end_subtitle - - def _start_rights(self, attrsD): - self.pushContent('rights', attrsD, u'text/plain', 1) - _start_dc_rights = _start_rights - _start_copyright = _start_rights - - def _end_rights(self): - self.popContent('rights') - _end_dc_rights = _end_rights - _end_copyright = _end_rights - - def _start_item(self, attrsD): - self.entries.append(FeedParserDict()) - self.push('item', 0) - self.inentry = 1 - self.guidislink = 0 - self.title_depth = -1 - id = self._getAttribute(attrsD, 'rdf:about') - if id: - context = self._getContext() - context['id'] = id - self._cdf_common(attrsD) - _start_entry = _start_item - - def _end_item(self): - self.pop('item') - self.inentry = 0 - _end_entry = _end_item - - def _start_dc_language(self, attrsD): - self.push('language', 1) - _start_language = _start_dc_language - - def _end_dc_language(self): - self.lang = self.pop('language') - _end_language = _end_dc_language - - def _start_dc_publisher(self, attrsD): - self.push('publisher', 1) - _start_webmaster = _start_dc_publisher - - def _end_dc_publisher(self): - self.pop('publisher') - self._sync_author_detail('publisher') - _end_webmaster = _end_dc_publisher - - def _start_published(self, attrsD): - self.push('published', 1) - _start_dcterms_issued = _start_published - _start_issued = _start_published - _start_pubdate = _start_published - - def _end_published(self): - value = self.pop('published') - self._save('published_parsed', _parse_date(value), overwrite=True) - _end_dcterms_issued = _end_published - _end_issued = _end_published - _end_pubdate = _end_published - - def _start_updated(self, attrsD): - self.push('updated', 1) - _start_modified = _start_updated - _start_dcterms_modified = _start_updated - _start_dc_date = _start_updated - _start_lastbuilddate = _start_updated - - def _end_updated(self): - value = self.pop('updated') - parsed_value = _parse_date(value) - self._save('updated_parsed', parsed_value, overwrite=True) - _end_modified = _end_updated - _end_dcterms_modified = _end_updated - _end_dc_date = _end_updated - _end_lastbuilddate = _end_updated - - def _start_created(self, attrsD): - self.push('created', 1) - _start_dcterms_created = _start_created - - def _end_created(self): - value = self.pop('created') - self._save('created_parsed', _parse_date(value), overwrite=True) - _end_dcterms_created = _end_created - - def _start_expirationdate(self, attrsD): - self.push('expired', 1) - - def _end_expirationdate(self): - self._save('expired_parsed', _parse_date(self.pop('expired')), overwrite=True) - - def _start_cc_license(self, attrsD): - context = self._getContext() - value = self._getAttribute(attrsD, 'rdf:resource') - attrsD = FeedParserDict() - attrsD['rel'] = u'license' - if value: - attrsD['href']=value - context.setdefault('links', []).append(attrsD) - - def _start_creativecommons_license(self, attrsD): - self.push('license', 1) - _start_creativeCommons_license = _start_creativecommons_license - - def _end_creativecommons_license(self): - value = self.pop('license') - context = self._getContext() - attrsD = FeedParserDict() - attrsD['rel'] = u'license' - if value: - attrsD['href'] = value - context.setdefault('links', []).append(attrsD) - del context['license'] - _end_creativeCommons_license = _end_creativecommons_license - - def _addXFN(self, relationships, href, name): - context = self._getContext() - xfn = context.setdefault('xfn', []) - value = FeedParserDict({'relationships': relationships, 'href': href, 'name': name}) - if value not in xfn: - xfn.append(value) - - def _addTag(self, term, scheme, label): - context = self._getContext() - tags = context.setdefault('tags', []) - if (not term) and (not scheme) and (not label): - return - value = FeedParserDict({'term': term, 'scheme': scheme, 'label': label}) - if value not in tags: - tags.append(value) - - def _start_category(self, attrsD): - term = attrsD.get('term') - scheme = attrsD.get('scheme', attrsD.get('domain')) - label = attrsD.get('label') - self._addTag(term, scheme, label) - self.push('category', 1) - _start_dc_subject = _start_category - _start_keywords = _start_category - - def _start_media_category(self, attrsD): - attrsD.setdefault('scheme', u'http://search.yahoo.com/mrss/category_schema') - self._start_category(attrsD) - - def _end_itunes_keywords(self): - for term in self.pop('itunes_keywords').split(','): - if term.strip(): - self._addTag(term.strip(), u'http://www.itunes.com/', None) - - def _start_itunes_category(self, attrsD): - self._addTag(attrsD.get('text'), u'http://www.itunes.com/', None) - self.push('category', 1) - - def _end_category(self): - value = self.pop('category') - if not value: - return - context = self._getContext() - tags = context['tags'] - if value and len(tags) and not tags[-1]['term']: - tags[-1]['term'] = value - else: - self._addTag(value, None, None) - _end_dc_subject = _end_category - _end_keywords = _end_category - _end_itunes_category = _end_category - _end_media_category = _end_category - - def _start_cloud(self, attrsD): - self._getContext()['cloud'] = FeedParserDict(attrsD) - - def _start_link(self, attrsD): - attrsD.setdefault('rel', u'alternate') - if attrsD['rel'] == u'self': - attrsD.setdefault('type', u'application/atom+xml') - else: - attrsD.setdefault('type', u'text/html') - context = self._getContext() - attrsD = self._itsAnHrefDamnIt(attrsD) - if 'href' in attrsD: - attrsD['href'] = self.resolveURI(attrsD['href']) - expectingText = self.infeed or self.inentry or self.insource - context.setdefault('links', []) - if not (self.inentry and self.inimage): - context['links'].append(FeedParserDict(attrsD)) - if 'href' in attrsD: - expectingText = 0 - if (attrsD.get('rel') == u'alternate') and (self.mapContentType(attrsD.get('type')) in self.html_types): - context['link'] = attrsD['href'] - else: - self.push('link', expectingText) - - def _end_link(self): - value = self.pop('link') - - def _start_guid(self, attrsD): - self.guidislink = (attrsD.get('ispermalink', 'true') == 'true') - self.push('id', 1) - _start_id = _start_guid - - def _end_guid(self): - value = self.pop('id') - self._save('guidislink', self.guidislink and 'link' not in self._getContext()) - if self.guidislink: - # guid acts as link, but only if 'ispermalink' is not present or is 'true', - # and only if the item doesn't already have a link element - self._save('link', value) - _end_id = _end_guid - - def _start_title(self, attrsD): - if self.svgOK: - return self.unknown_starttag('title', attrsD.items()) - self.pushContent('title', attrsD, u'text/plain', self.infeed or self.inentry or self.insource) - _start_dc_title = _start_title - _start_media_title = _start_title - - def _end_title(self): - if self.svgOK: - return - value = self.popContent('title') - if not value: - return - self.title_depth = self.depth - _end_dc_title = _end_title - - def _end_media_title(self): - title_depth = self.title_depth - self._end_title() - self.title_depth = title_depth - - def _start_description(self, attrsD): - context = self._getContext() - if 'summary' in context: - self._summaryKey = 'content' - self._start_content(attrsD) - else: - self.pushContent('description', attrsD, u'text/html', self.infeed or self.inentry or self.insource) - _start_dc_description = _start_description - - def _start_abstract(self, attrsD): - self.pushContent('description', attrsD, u'text/plain', self.infeed or self.inentry or self.insource) - - def _end_description(self): - if self._summaryKey == 'content': - self._end_content() - else: - value = self.popContent('description') - self._summaryKey = None - _end_abstract = _end_description - _end_dc_description = _end_description - - def _start_info(self, attrsD): - self.pushContent('info', attrsD, u'text/plain', 1) - _start_feedburner_browserfriendly = _start_info - - def _end_info(self): - self.popContent('info') - _end_feedburner_browserfriendly = _end_info - - def _start_generator(self, attrsD): - if attrsD: - attrsD = self._itsAnHrefDamnIt(attrsD) - if 'href' in attrsD: - attrsD['href'] = self.resolveURI(attrsD['href']) - self._getContext()['generator_detail'] = FeedParserDict(attrsD) - self.push('generator', 1) - - def _end_generator(self): - value = self.pop('generator') - context = self._getContext() - if 'generator_detail' in context: - context['generator_detail']['name'] = value - - def _start_admin_generatoragent(self, attrsD): - self.push('generator', 1) - value = self._getAttribute(attrsD, 'rdf:resource') - if value: - self.elementstack[-1][2].append(value) - self.pop('generator') - self._getContext()['generator_detail'] = FeedParserDict({'href': value}) - - def _start_admin_errorreportsto(self, attrsD): - self.push('errorreportsto', 1) - value = self._getAttribute(attrsD, 'rdf:resource') - if value: - self.elementstack[-1][2].append(value) - self.pop('errorreportsto') - - def _start_summary(self, attrsD): - context = self._getContext() - if 'summary' in context: - self._summaryKey = 'content' - self._start_content(attrsD) - else: - self._summaryKey = 'summary' - self.pushContent(self._summaryKey, attrsD, u'text/plain', 1) - _start_itunes_summary = _start_summary - - def _end_summary(self): - if self._summaryKey == 'content': - self._end_content() - else: - self.popContent(self._summaryKey or 'summary') - self._summaryKey = None - _end_itunes_summary = _end_summary - - def _start_enclosure(self, attrsD): - attrsD = self._itsAnHrefDamnIt(attrsD) - context = self._getContext() - attrsD['rel'] = u'enclosure' - context.setdefault('links', []).append(FeedParserDict(attrsD)) - - def _start_source(self, attrsD): - if 'url' in attrsD: - # This means that we're processing a source element from an RSS 2.0 feed - self.sourcedata['href'] = attrsD[u'url'] - self.push('source', 1) - self.insource = 1 - self.title_depth = -1 - - def _end_source(self): - self.insource = 0 - value = self.pop('source') - if value: - self.sourcedata['title'] = value - self._getContext()['source'] = copy.deepcopy(self.sourcedata) - self.sourcedata.clear() - - def _start_content(self, attrsD): - self.pushContent('content', attrsD, u'text/plain', 1) - src = attrsD.get('src') - if src: - self.contentparams['src'] = src - self.push('content', 1) - - def _start_body(self, attrsD): - self.pushContent('content', attrsD, u'application/xhtml+xml', 1) - _start_xhtml_body = _start_body - - def _start_content_encoded(self, attrsD): - self.pushContent('content', attrsD, u'text/html', 1) - _start_fullitem = _start_content_encoded - - def _end_content(self): - copyToSummary = self.mapContentType(self.contentparams.get('type')) in ([u'text/plain'] + self.html_types) - value = self.popContent('content') - if copyToSummary: - self._save('summary', value) - - _end_body = _end_content - _end_xhtml_body = _end_content - _end_content_encoded = _end_content - _end_fullitem = _end_content - - def _start_itunes_image(self, attrsD): - self.push('itunes_image', 0) - if attrsD.get('href'): - self._getContext()['image'] = FeedParserDict({'href': attrsD.get('href')}) - elif attrsD.get('url'): - self._getContext()['image'] = FeedParserDict({'href': attrsD.get('url')}) - _start_itunes_link = _start_itunes_image - - def _end_itunes_block(self): - value = self.pop('itunes_block', 0) - self._getContext()['itunes_block'] = (value == 'yes') and 1 or 0 - - def _end_itunes_explicit(self): - value = self.pop('itunes_explicit', 0) - # Convert 'yes' -> True, 'clean' to False, and any other value to None - # False and None both evaluate as False, so the difference can be ignored - # by applications that only need to know if the content is explicit. - self._getContext()['itunes_explicit'] = (None, False, True)[(value == 'yes' and 2) or value == 'clean' or 0] - - def _start_media_content(self, attrsD): - context = self._getContext() - context.setdefault('media_content', []) - context['media_content'].append(attrsD) - - def _start_media_thumbnail(self, attrsD): - context = self._getContext() - context.setdefault('media_thumbnail', []) - self.push('url', 1) # new - context['media_thumbnail'].append(attrsD) - - def _end_media_thumbnail(self): - url = self.pop('url') - context = self._getContext() - if url != None and len(url.strip()) != 0: - if 'url' not in context['media_thumbnail'][-1]: - context['media_thumbnail'][-1]['url'] = url - - def _start_media_player(self, attrsD): - self.push('media_player', 0) - self._getContext()['media_player'] = FeedParserDict(attrsD) - - def _end_media_player(self): - value = self.pop('media_player') - context = self._getContext() - context['media_player']['content'] = value - - def _start_newlocation(self, attrsD): - self.push('newlocation', 1) - - def _end_newlocation(self): - url = self.pop('newlocation') - context = self._getContext() - # don't set newlocation if the context isn't right - if context is not self.feeddata: - return - context['newlocation'] = _makeSafeAbsoluteURI(self.baseuri, url.strip()) - -if _XML_AVAILABLE: - class _StrictFeedParser(_FeedParserMixin, xml.sax.handler.ContentHandler): - def __init__(self, baseuri, baselang, encoding): - xml.sax.handler.ContentHandler.__init__(self) - _FeedParserMixin.__init__(self, baseuri, baselang, encoding) - self.bozo = 0 - self.exc = None - self.decls = {} - - def startPrefixMapping(self, prefix, uri): - if not uri: - return - # Jython uses '' instead of None; standardize on None - prefix = prefix or None - self.trackNamespace(prefix, uri) - if prefix and uri == 'http://www.w3.org/1999/xlink': - self.decls['xmlns:' + prefix] = uri - - def startElementNS(self, name, qname, attrs): - namespace, localname = name - lowernamespace = str(namespace or '').lower() - if lowernamespace.find(u'backend.userland.com/rss') != -1: - # match any backend.userland.com namespace - namespace = u'http://backend.userland.com/rss' - lowernamespace = namespace - if qname and qname.find(':') > 0: - givenprefix = qname.split(':')[0] - else: - givenprefix = None - prefix = self._matchnamespaces.get(lowernamespace, givenprefix) - if givenprefix and (prefix == None or (prefix == '' and lowernamespace == '')) and givenprefix not in self.namespacesInUse: - raise UndeclaredNamespace("'%s' is not associated with a namespace" % givenprefix) - localname = str(localname).lower() - - # qname implementation is horribly broken in Python 2.1 (it - # doesn't report any), and slightly broken in Python 2.2 (it - # doesn't report the xml: namespace). So we match up namespaces - # with a known list first, and then possibly override them with - # the qnames the SAX parser gives us (if indeed it gives us any - # at all). Thanks to MatejC for helping me test this and - # tirelessly telling me that it didn't work yet. - attrsD, self.decls = self.decls, {} - if localname=='math' and namespace=='http://www.w3.org/1998/Math/MathML': - attrsD['xmlns']=namespace - if localname=='svg' and namespace=='http://www.w3.org/2000/svg': - attrsD['xmlns']=namespace - - if prefix: - localname = prefix.lower() + ':' + localname - elif namespace and not qname: #Expat - for name,value in self.namespacesInUse.items(): - if name and value == namespace: - localname = name + ':' + localname - break - - for (namespace, attrlocalname), attrvalue in attrs.items(): - lowernamespace = (namespace or '').lower() - prefix = self._matchnamespaces.get(lowernamespace, '') - if prefix: - attrlocalname = prefix + ':' + attrlocalname - attrsD[str(attrlocalname).lower()] = attrvalue - for qname in attrs.getQNames(): - attrsD[str(qname).lower()] = attrs.getValueByQName(qname) - self.unknown_starttag(localname, attrsD.items()) - - def characters(self, text): - self.handle_data(text) - - def endElementNS(self, name, qname): - namespace, localname = name - lowernamespace = str(namespace or '').lower() - if qname and qname.find(':') > 0: - givenprefix = qname.split(':')[0] - else: - givenprefix = '' - prefix = self._matchnamespaces.get(lowernamespace, givenprefix) - if prefix: - localname = prefix + ':' + localname - elif namespace and not qname: #Expat - for name,value in self.namespacesInUse.items(): - if name and value == namespace: - localname = name + ':' + localname - break - localname = str(localname).lower() - self.unknown_endtag(localname) - - def error(self, exc): - self.bozo = 1 - self.exc = exc - - # drv_libxml2 calls warning() in some cases - warning = error - - def fatalError(self, exc): - self.error(exc) - raise exc - -class _BaseHTMLProcessor(sgmllib.SGMLParser): - special = re.compile('''[<>'"]''') - bare_ampersand = re.compile("&(?!#\d+;|#x[0-9a-fA-F]+;|\w+;)") - elements_no_end_tag = { - 'area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', - 'hr', 'img', 'input', 'isindex', 'keygen', 'link', 'meta', 'param', - 'source', 'track', 'wbr' - } - - def __init__(self, encoding, _type): - self.encoding = encoding - self._type = _type - sgmllib.SGMLParser.__init__(self) - - def reset(self): - self.pieces = [] - sgmllib.SGMLParser.reset(self) - - def _shorttag_replace(self, match): - tag = match.group(1) - if tag in self.elements_no_end_tag: - return '<' + tag + ' />' - else: - return '<' + tag + '>' - - # By declaring these methods and overriding their compiled code - # with the code from sgmllib, the original code will execute in - # feedparser's scope instead of sgmllib's. This means that the - # `tagfind` and `charref` regular expressions will be found as - # they're declared above, not as they're declared in sgmllib. - def goahead(self, i): - pass - goahead.func_code = sgmllib.SGMLParser.goahead.func_code - - def __parse_starttag(self, i): - pass - __parse_starttag.func_code = sgmllib.SGMLParser.parse_starttag.func_code - - def parse_starttag(self,i): - j = self.__parse_starttag(i) - if self._type == 'application/xhtml+xml': - if j>2 and self.rawdata[j-2:j]=='/>': - self.unknown_endtag(self.lasttag) - return j - - def feed(self, data): - data = re.compile(r'\s]+?)\s*/>', self._shorttag_replace, data) - data = data.replace(''', "'") - data = data.replace('"', '"') - try: - bytes - if bytes is str: - raise NameError - self.encoding = self.encoding + u'_INVALID_PYTHON_3' - except NameError: - if self.encoding and isinstance(data, unicode): - data = data.encode(self.encoding) - sgmllib.SGMLParser.feed(self, data) - sgmllib.SGMLParser.close(self) - - def normalize_attrs(self, attrs): - if not attrs: - return attrs - # utility method to be called by descendants - attrs = dict([(k.lower(), v) for k, v in attrs]).items() - attrs = [(k, k in ('rel', 'type') and v.lower() or v) for k, v in attrs] - attrs.sort() - return attrs - - def unknown_starttag(self, tag, attrs): - # called for each start tag - # attrs is a list of (attr, value) tuples - # e.g. for
, tag='pre', attrs=[('class', 'screen')]
-        uattrs = []
-        strattrs=''
-        if attrs:
-            for key, value in attrs:
-                value=value.replace('>','>').replace('<','<').replace('"','"')
-                value = self.bare_ampersand.sub("&", value)
-                # thanks to Kevin Marks for this breathtaking hack to deal with (valid) high-bit attribute values in UTF-8 feeds
-                if not isinstance(value, unicode):
-                    value = value.decode(self.encoding, 'ignore')
-                try:
-                    # Currently, in Python 3 the key is already a str, and cannot be decoded again
-                    uattrs.append((unicode(key, self.encoding), value))
-                except TypeError:
-                    uattrs.append((key, value))
-            strattrs = u''.join([u' %s="%s"' % (key, value) for key, value in uattrs])
-            if self.encoding:
-                try:
-                    strattrs = strattrs.encode(self.encoding)
-                except (UnicodeEncodeError, LookupError):
-                    pass
-        if tag in self.elements_no_end_tag:
-            self.pieces.append('<%s%s />' % (tag, strattrs))
-        else:
-            self.pieces.append('<%s%s>' % (tag, strattrs))
-
-    def unknown_endtag(self, tag):
-        # called for each end tag, e.g. for 
, tag will be 'pre' - # Reconstruct the original end tag. - if tag not in self.elements_no_end_tag: - self.pieces.append("" % tag) - - def handle_charref(self, ref): - # called for each character reference, e.g. for ' ', ref will be '160' - # Reconstruct the original character reference. - ref = ref.lower() - if ref.startswith('x'): - value = int(ref[1:], 16) - else: - value = int(ref) - - if value in _cp1252: - self.pieces.append('&#%s;' % hex(ord(_cp1252[value]))[1:]) - else: - self.pieces.append('&#%s;' % ref) - - def handle_entityref(self, ref): - # called for each entity reference, e.g. for '©', ref will be 'copy' - # Reconstruct the original entity reference. - if ref in name2codepoint or ref == 'apos': - self.pieces.append('&%s;' % ref) - else: - self.pieces.append('&%s' % ref) - - def handle_data(self, text): - # called for each block of plain text, i.e. outside of any tag and - # not containing any character or entity references - # Store the original text verbatim. - self.pieces.append(text) - - def handle_comment(self, text): - # called for each HTML comment, e.g. - # Reconstruct the original comment. - self.pieces.append('' % text) - - def handle_pi(self, text): - # called for each processing instruction, e.g. - # Reconstruct original processing instruction. - self.pieces.append('' % text) - - def handle_decl(self, text): - # called for the DOCTYPE, if present, e.g. - # - # Reconstruct original DOCTYPE - self.pieces.append('' % text) - - _new_declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9:]*\s*').match - def _scan_name(self, i, declstartpos): - rawdata = self.rawdata - n = len(rawdata) - if i == n: - return None, -1 - m = self._new_declname_match(rawdata, i) - if m: - s = m.group() - name = s.strip() - if (i + len(s)) == n: - return None, -1 # end of buffer - return name.lower(), m.end() - else: - self.handle_data(rawdata) -# self.updatepos(declstartpos, i) - return None, -1 - - def convert_charref(self, name): - return '&#%s;' % name - - def convert_entityref(self, name): - return '&%s;' % name - - def output(self): - '''Return processed HTML as a single string''' - return ''.join([str(p) for p in self.pieces]) - - def parse_declaration(self, i): - try: - return sgmllib.SGMLParser.parse_declaration(self, i) - except sgmllib.SGMLParseError: - # escape the doctype declaration and continue parsing - self.handle_data('<') - return i+1 - -class _LooseFeedParser(_FeedParserMixin, _BaseHTMLProcessor): - def __init__(self, baseuri, baselang, encoding, entities): - sgmllib.SGMLParser.__init__(self) - _FeedParserMixin.__init__(self, baseuri, baselang, encoding) - _BaseHTMLProcessor.__init__(self, encoding, 'application/xhtml+xml') - self.entities=entities - - def decodeEntities(self, element, data): - data = data.replace('<', '<') - data = data.replace('<', '<') - data = data.replace('<', '<') - data = data.replace('>', '>') - data = data.replace('>', '>') - data = data.replace('>', '>') - data = data.replace('&', '&') - data = data.replace('&', '&') - data = data.replace('"', '"') - data = data.replace('"', '"') - data = data.replace(''', ''') - data = data.replace(''', ''') - if not self.contentparams.get('type', u'xml').endswith(u'xml'): - data = data.replace('<', '<') - data = data.replace('>', '>') - data = data.replace('&', '&') - data = data.replace('"', '"') - data = data.replace(''', "'") - return data - - def strattrs(self, attrs): - return ''.join([' %s="%s"' % (n,v.replace('"','"')) for n,v in attrs]) - -class _MicroformatsParser: - STRING = 1 - DATE = 2 - URI = 3 - NODE = 4 - EMAIL = 5 - - known_xfn_relationships = {'contact', 'acquaintance', 'friend', 'met', 'co-worker', 'coworker', 'colleague', 'co-resident', 'coresident', 'neighbor', 'child', 'parent', 'sibling', 'brother', 'sister', 'spouse', 'wife', 'husband', 'kin', 'relative', 'muse', 'crush', 'date', 'sweetheart', 'me'} - known_binary_extensions = {'zip','rar','exe','gz','tar','tgz','tbz2','bz2','z','7z','dmg','img','sit','sitx','hqx','deb','rpm','bz2','jar','rar','iso','bin','msi','mp2','mp3','ogg','ogm','mp4','m4v','m4a','avi','wma','wmv'} - - def __init__(self, data, baseuri, encoding): - self.document = BeautifulSoup.BeautifulSoup(data) - self.baseuri = baseuri - self.encoding = encoding - if isinstance(data, unicode): - data = data.encode(encoding) - self.tags = [] - self.enclosures = [] - self.xfn = [] - self.vcard = None - - def vcardEscape(self, s): - if isinstance(s, basestring): - s = s.replace(',', '\\,').replace(';', '\\;').replace('\n', '\\n') - return s - - def vcardFold(self, s): - s = re.sub(';+$', '', s) - sFolded = '' - iMax = 75 - sPrefix = '' - while len(s) > iMax: - sFolded += sPrefix + s[:iMax] + '\n' - s = s[iMax:] - sPrefix = ' ' - iMax = 74 - sFolded += sPrefix + s - return sFolded - - def normalize(self, s): - return re.sub(r'\s+', ' ', s).strip() - - def unique(self, aList): - results = [] - for element in aList: - if element not in results: - results.append(element) - return results - - def toISO8601(self, dt): - return time.strftime('%Y-%m-%dT%H:%M:%SZ', dt) - - def getPropertyValue(self, elmRoot, sProperty, iPropertyType=4, bAllowMultiple=0, bAutoEscape=0): - all = lambda x: 1 - sProperty = sProperty.lower() - bFound = 0 - bNormalize = 1 - propertyMatch = {'class': re.compile(r'\b%s\b' % sProperty)} - if bAllowMultiple and (iPropertyType != self.NODE): - snapResults = [] - containers = elmRoot(['ul', 'ol'], propertyMatch) - for container in containers: - snapResults.extend(container('li')) - bFound = (len(snapResults) != 0) - if not bFound: - snapResults = elmRoot(all, propertyMatch) - bFound = (len(snapResults) != 0) - if (not bFound) and (sProperty == 'value'): - snapResults = elmRoot('pre') - bFound = (len(snapResults) != 0) - bNormalize = not bFound - if not bFound: - snapResults = [elmRoot] - bFound = (len(snapResults) != 0) - arFilter = [] - if sProperty == 'vcard': - snapFilter = elmRoot(all, propertyMatch) - for node in snapFilter: - if node.findParent(all, propertyMatch): - arFilter.append(node) - arResults = [] - for node in snapResults: - if node not in arFilter: - arResults.append(node) - bFound = (len(arResults) != 0) - if not bFound: - if bAllowMultiple: - return [] - elif iPropertyType == self.STRING: - return '' - elif iPropertyType == self.DATE: - return None - elif iPropertyType == self.URI: - return '' - elif iPropertyType == self.NODE: - return None - else: - return None - arValues = [] - for elmResult in arResults: - sValue = None - if iPropertyType == self.NODE: - if bAllowMultiple: - arValues.append(elmResult) - continue - else: - return elmResult - sNodeName = elmResult.name.lower() - if (iPropertyType == self.EMAIL) and (sNodeName == 'a'): - sValue = (elmResult.get('href') or '').split('mailto:').pop().split('?')[0] - if sValue: - sValue = bNormalize and self.normalize(sValue) or sValue.strip() - if (not sValue) and (sNodeName == 'abbr'): - sValue = elmResult.get('title') - if sValue: - sValue = bNormalize and self.normalize(sValue) or sValue.strip() - if (not sValue) and (iPropertyType == self.URI): - if sNodeName == 'a': - sValue = elmResult.get('href') - elif sNodeName == 'img': - sValue = elmResult.get('src') - elif sNodeName == 'object': - sValue = elmResult.get('data') - if sValue: - sValue = bNormalize and self.normalize(sValue) or sValue.strip() - if (not sValue) and (sNodeName == 'img'): - sValue = elmResult.get('alt') - if sValue: - sValue = bNormalize and self.normalize(sValue) or sValue.strip() - if not sValue: - sValue = elmResult.renderContents() - sValue = re.sub(r'<\S[^>]*>', '', sValue) - sValue = sValue.replace('\r\n', '\n') - sValue = sValue.replace('\r', '\n') - if sValue: - sValue = bNormalize and self.normalize(sValue) or sValue.strip() - if not sValue: - continue - if iPropertyType == self.DATE: - sValue = _parse_date_iso8601(sValue) - if bAllowMultiple: - arValues.append(bAutoEscape and self.vcardEscape(sValue) or sValue) - else: - return bAutoEscape and self.vcardEscape(sValue) or sValue - return arValues - - def findVCards(self, elmRoot, bAgentParsing=0): - sVCards = '' - - if not bAgentParsing: - arCards = self.getPropertyValue(elmRoot, 'vcard', bAllowMultiple=1) - else: - arCards = [elmRoot] - - for elmCard in arCards: - arLines = [] - - def processSingleString(sProperty): - sValue = self.getPropertyValue(elmCard, sProperty, self.STRING, bAutoEscape=1).decode(self.encoding) - if sValue: - arLines.append(self.vcardFold(sProperty.upper() + ':' + sValue)) - return sValue or u'' - - def processSingleURI(sProperty): - sValue = self.getPropertyValue(elmCard, sProperty, self.URI) - if sValue: - sContentType = '' - sEncoding = '' - sValueKey = '' - if sValue.startswith('data:'): - sEncoding = ';ENCODING=b' - sContentType = sValue.split(';')[0].split('/').pop() - sValue = sValue.split(',', 1).pop() - else: - elmValue = self.getPropertyValue(elmCard, sProperty) - if elmValue: - if sProperty != 'url': - sValueKey = ';VALUE=uri' - sContentType = elmValue.get('type', '').strip().split('/').pop().strip() - sContentType = sContentType.upper() - if sContentType == 'OCTET-STREAM': - sContentType = '' - if sContentType: - sContentType = ';TYPE=' + sContentType.upper() - arLines.append(self.vcardFold(sProperty.upper() + sEncoding + sContentType + sValueKey + ':' + sValue)) - - def processTypeValue(sProperty, arDefaultType, arForceType=None): - arResults = self.getPropertyValue(elmCard, sProperty, bAllowMultiple=1) - for elmResult in arResults: - arType = self.getPropertyValue(elmResult, 'type', self.STRING, 1, 1) - if arForceType: - arType = self.unique(arForceType + arType) - if not arType: - arType = arDefaultType - sValue = self.getPropertyValue(elmResult, 'value', self.EMAIL, 0) - if sValue: - arLines.append(self.vcardFold(sProperty.upper() + ';TYPE=' + ','.join(arType) + ':' + sValue)) - - # AGENT - # must do this before all other properties because it is destructive - # (removes nested class="vcard" nodes so they don't interfere with - # this vcard's other properties) - arAgent = self.getPropertyValue(elmCard, 'agent', bAllowMultiple=1) - for elmAgent in arAgent: - if re.compile(r'\bvcard\b').search(elmAgent.get('class')): - sAgentValue = self.findVCards(elmAgent, 1) + '\n' - sAgentValue = sAgentValue.replace('\n', '\\n') - sAgentValue = sAgentValue.replace(';', '\\;') - if sAgentValue: - arLines.append(self.vcardFold('AGENT:' + sAgentValue)) - # Completely remove the agent element from the parse tree - elmAgent.extract() - else: - sAgentValue = self.getPropertyValue(elmAgent, 'value', self.URI, bAutoEscape=1); - if sAgentValue: - arLines.append(self.vcardFold('AGENT;VALUE=uri:' + sAgentValue)) - - # FN (full name) - sFN = processSingleString('fn') - - # N (name) - elmName = self.getPropertyValue(elmCard, 'n') - if elmName: - sFamilyName = self.getPropertyValue(elmName, 'family-name', self.STRING, bAutoEscape=1) - sGivenName = self.getPropertyValue(elmName, 'given-name', self.STRING, bAutoEscape=1) - arAdditionalNames = self.getPropertyValue(elmName, 'additional-name', self.STRING, 1, 1) + self.getPropertyValue(elmName, 'additional-names', self.STRING, 1, 1) - arHonorificPrefixes = self.getPropertyValue(elmName, 'honorific-prefix', self.STRING, 1, 1) + self.getPropertyValue(elmName, 'honorific-prefixes', self.STRING, 1, 1) - arHonorificSuffixes = self.getPropertyValue(elmName, 'honorific-suffix', self.STRING, 1, 1) + self.getPropertyValue(elmName, 'honorific-suffixes', self.STRING, 1, 1) - arLines.append(self.vcardFold('N:' + sFamilyName + ';' + - sGivenName + ';' + - ','.join(arAdditionalNames) + ';' + - ','.join(arHonorificPrefixes) + ';' + - ','.join(arHonorificSuffixes))) - elif sFN: - # implied "N" optimization - # http://microformats.org/wiki/hcard#Implied_.22N.22_Optimization - arNames = self.normalize(sFN).split() - if len(arNames) == 2: - bFamilyNameFirst = (arNames[0].endswith(',') or - len(arNames[1]) == 1 or - ((len(arNames[1]) == 2) and (arNames[1].endswith('.')))) - if bFamilyNameFirst: - arLines.append(self.vcardFold('N:' + arNames[0] + ';' + arNames[1])) - else: - arLines.append(self.vcardFold('N:' + arNames[1] + ';' + arNames[0])) - - # SORT-STRING - sSortString = self.getPropertyValue(elmCard, 'sort-string', self.STRING, bAutoEscape=1) - if sSortString: - arLines.append(self.vcardFold('SORT-STRING:' + sSortString)) - - # NICKNAME - arNickname = self.getPropertyValue(elmCard, 'nickname', self.STRING, 1, 1) - if arNickname: - arLines.append(self.vcardFold('NICKNAME:' + ','.join(arNickname))) - - # PHOTO - processSingleURI('photo') - - # BDAY - dtBday = self.getPropertyValue(elmCard, 'bday', self.DATE) - if dtBday: - arLines.append(self.vcardFold('BDAY:' + self.toISO8601(dtBday))) - - # ADR (address) - arAdr = self.getPropertyValue(elmCard, 'adr', bAllowMultiple=1) - for elmAdr in arAdr: - arType = self.getPropertyValue(elmAdr, 'type', self.STRING, 1, 1) - if not arType: - arType = ['intl','postal','parcel','work'] # default adr types, see RFC 2426 section 3.2.1 - sPostOfficeBox = self.getPropertyValue(elmAdr, 'post-office-box', self.STRING, 0, 1) - sExtendedAddress = self.getPropertyValue(elmAdr, 'extended-address', self.STRING, 0, 1) - sStreetAddress = self.getPropertyValue(elmAdr, 'street-address', self.STRING, 0, 1) - sLocality = self.getPropertyValue(elmAdr, 'locality', self.STRING, 0, 1) - sRegion = self.getPropertyValue(elmAdr, 'region', self.STRING, 0, 1) - sPostalCode = self.getPropertyValue(elmAdr, 'postal-code', self.STRING, 0, 1) - sCountryName = self.getPropertyValue(elmAdr, 'country-name', self.STRING, 0, 1) - arLines.append(self.vcardFold('ADR;TYPE=' + ','.join(arType) + ':' + - sPostOfficeBox + ';' + - sExtendedAddress + ';' + - sStreetAddress + ';' + - sLocality + ';' + - sRegion + ';' + - sPostalCode + ';' + - sCountryName)) - - # LABEL - processTypeValue('label', ['intl','postal','parcel','work']) - - # TEL (phone number) - processTypeValue('tel', ['voice']) - - # EMAIL - processTypeValue('email', ['internet'], ['internet']) - - # MAILER - processSingleString('mailer') - - # TZ (timezone) - processSingleString('tz') - - # GEO (geographical information) - elmGeo = self.getPropertyValue(elmCard, 'geo') - if elmGeo: - sLatitude = self.getPropertyValue(elmGeo, 'latitude', self.STRING, 0, 1) - sLongitude = self.getPropertyValue(elmGeo, 'longitude', self.STRING, 0, 1) - arLines.append(self.vcardFold('GEO:' + sLatitude + ';' + sLongitude)) - - # TITLE - processSingleString('title') - - # ROLE - processSingleString('role') - - # LOGO - processSingleURI('logo') - - # ORG (organization) - elmOrg = self.getPropertyValue(elmCard, 'org') - if elmOrg: - sOrganizationName = self.getPropertyValue(elmOrg, 'organization-name', self.STRING, 0, 1) - if not sOrganizationName: - # implied "organization-name" optimization - # http://microformats.org/wiki/hcard#Implied_.22organization-name.22_Optimization - sOrganizationName = self.getPropertyValue(elmCard, 'org', self.STRING, 0, 1) - if sOrganizationName: - arLines.append(self.vcardFold('ORG:' + sOrganizationName)) - else: - arOrganizationUnit = self.getPropertyValue(elmOrg, 'organization-unit', self.STRING, 1, 1) - arLines.append(self.vcardFold('ORG:' + sOrganizationName + ';' + ';'.join(arOrganizationUnit))) - - # CATEGORY - arCategory = self.getPropertyValue(elmCard, 'category', self.STRING, 1, 1) + self.getPropertyValue(elmCard, 'categories', self.STRING, 1, 1) - if arCategory: - arLines.append(self.vcardFold('CATEGORIES:' + ','.join(arCategory))) - - # NOTE - processSingleString('note') - - # REV - processSingleString('rev') - - # SOUND - processSingleURI('sound') - - # UID - processSingleString('uid') - - # URL - processSingleURI('url') - - # CLASS - processSingleString('class') - - # KEY - processSingleURI('key') - - if arLines: - arLines = [u'BEGIN:vCard',u'VERSION:3.0'] + arLines + [u'END:vCard'] - # XXX - this is super ugly; properly fix this with issue 148 - for i, s in enumerate(arLines): - if not isinstance(s, unicode): - arLines[i] = s.decode('utf-8', 'ignore') - sVCards += u'\n'.join(arLines) + u'\n' - - return sVCards.strip() - - def isProbablyDownloadable(self, elm): - attrsD = elm.attrMap - if 'href' not in attrsD: - return 0 - linktype = attrsD.get('type', '').strip() - if linktype.startswith('audio/') or \ - linktype.startswith('video/') or \ - (linktype.startswith('application/') and not linktype.endswith('xml')): - return 1 - try: - path = urlparse.urlparse(attrsD['href'])[2] - except ValueError: - return 0 - if path.find('.') == -1: - return 0 - fileext = path.split('.').pop().lower() - return fileext in self.known_binary_extensions - - def findTags(self): - all = lambda x: 1 - for elm in self.document(all, {'rel': re.compile(r'\btag\b')}): - href = elm.get('href') - if not href: - continue - urlscheme, domain, path, params, query, fragment = \ - urlparse.urlparse(_urljoin(self.baseuri, href)) - segments = path.split('/') - tag = segments.pop() - if not tag: - if segments: - tag = segments.pop() - else: - # there are no tags - continue - tagscheme = urlparse.urlunparse((urlscheme, domain, '/'.join(segments), '', '', '')) - if not tagscheme.endswith('/'): - tagscheme += '/' - self.tags.append(FeedParserDict({"term": tag, "scheme": tagscheme, "label": elm.string or ''})) - - def findEnclosures(self): - all = lambda x: 1 - enclosure_match = re.compile(r'\benclosure\b') - for elm in self.document(all, {'href': re.compile(r'.+')}): - if not enclosure_match.search(elm.get('rel', u'')) and not self.isProbablyDownloadable(elm): - continue - if elm.attrMap not in self.enclosures: - self.enclosures.append(elm.attrMap) - if elm.string and not elm.get('title'): - self.enclosures[-1]['title'] = elm.string - - def findXFN(self): - all = lambda x: 1 - for elm in self.document(all, {'rel': re.compile('.+'), 'href': re.compile('.+')}): - rels = elm.get('rel', u'').split() - xfn_rels = [r for r in rels if r in self.known_xfn_relationships] - if xfn_rels: - self.xfn.append({"relationships": xfn_rels, "href": elm.get('href', ''), "name": elm.string}) - -def _parseMicroformats(htmlSource, baseURI, encoding): - if not BeautifulSoup: - return - try: - p = _MicroformatsParser(htmlSource, baseURI, encoding) - except UnicodeEncodeError: - # sgmllib throws this exception when performing lookups of tags - # with non-ASCII characters in them. - return - p.vcard = p.findVCards(p.document) - p.findTags() - p.findEnclosures() - p.findXFN() - return {"tags": p.tags, "enclosures": p.enclosures, "xfn": p.xfn, "vcard": p.vcard} - -class _RelativeURIResolver(_BaseHTMLProcessor): - relative_uris = {('a', 'href'), - ('applet', 'codebase'), - ('area', 'href'), - ('blockquote', 'cite'), - ('body', 'background'), - ('del', 'cite'), - ('form', 'action'), - ('frame', 'longdesc'), - ('frame', 'src'), - ('iframe', 'longdesc'), - ('iframe', 'src'), - ('head', 'profile'), - ('img', 'longdesc'), - ('img', 'src'), - ('img', 'usemap'), - ('input', 'src'), - ('input', 'usemap'), - ('ins', 'cite'), - ('link', 'href'), - ('object', 'classid'), - ('object', 'codebase'), - ('object', 'data'), - ('object', 'usemap'), - ('q', 'cite'), - ('script', 'src'), - ('video', 'poster')} - - def __init__(self, baseuri, encoding, _type): - _BaseHTMLProcessor.__init__(self, encoding, _type) - self.baseuri = baseuri - - def resolveURI(self, uri): - return _makeSafeAbsoluteURI(self.baseuri, uri.strip()) - - def unknown_starttag(self, tag, attrs): - attrs = self.normalize_attrs(attrs) - attrs = [(key, ((tag, key) in self.relative_uris) and self.resolveURI(value) or value) for key, value in attrs] - _BaseHTMLProcessor.unknown_starttag(self, tag, attrs) - -def _resolveRelativeURIs(htmlSource, baseURI, encoding, _type): - p = _RelativeURIResolver(baseURI, encoding, _type) - p.feed(htmlSource) - return p.output() - -def _makeSafeAbsoluteURI(base, rel=None): - # bail if ACCEPTABLE_URI_SCHEMES is empty - if not ACCEPTABLE_URI_SCHEMES: - try: - return _urljoin(base, rel or u'') - except ValueError: - return u'' - if not base: - return rel or u'' - if not rel: - try: - scheme = urlparse.urlparse(base)[0] - except ValueError: - return u'' - if not scheme or scheme in ACCEPTABLE_URI_SCHEMES: - return base - return u'' - try: - uri = _urljoin(base, rel) - except ValueError: - return u'' - if uri.strip().split(':', 1)[0] not in ACCEPTABLE_URI_SCHEMES: - return u'' - return uri - -class _HTMLSanitizer(_BaseHTMLProcessor): - acceptable_elements = {'a', 'abbr', 'acronym', 'address', 'area', - 'article', 'aside', 'audio', 'b', 'big', 'blockquote', 'br', 'button', - 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', - 'command', 'datagrid', 'datalist', 'dd', 'del', 'details', 'dfn', - 'dialog', 'dir', 'div', 'dl', 'dt', 'em', 'event-source', 'fieldset', - 'figcaption', 'figure', 'footer', 'font', 'form', 'header', 'h1', - 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'input', 'ins', - 'keygen', 'kbd', 'label', 'legend', 'li', 'm', 'map', 'menu', 'meter', - 'multicol', 'nav', 'nextid', 'ol', 'output', 'optgroup', 'option', - 'p', 'pre', 'progress', 'q', 's', 'samp', 'section', 'select', - 'small', 'sound', 'source', 'spacer', 'span', 'strike', 'strong', - 'sub', 'sup', 'table', 'tbody', 'td', 'textarea', 'time', 'tfoot', - 'th', 'thead', 'tr', 'tt', 'u', 'ul', 'var', 'video', 'noscript'} - - acceptable_attributes = {'abbr', 'accept', 'accept-charset', 'accesskey', - 'action', 'align', 'alt', 'autocomplete', 'autofocus', 'axis', - 'background', 'balance', 'bgcolor', 'bgproperties', 'border', - 'bordercolor', 'bordercolordark', 'bordercolorlight', 'bottompadding', - 'cellpadding', 'cellspacing', 'ch', 'challenge', 'char', 'charoff', - 'choff', 'charset', 'checked', 'cite', 'class', 'clear', 'color', 'cols', - 'colspan', 'compact', 'contenteditable', 'controls', 'coords', 'data', - 'datafld', 'datapagesize', 'datasrc', 'datetime', 'default', 'delay', - 'dir', 'disabled', 'draggable', 'dynsrc', 'enctype', 'end', 'face', 'for', - 'form', 'frame', 'galleryimg', 'gutter', 'headers', 'height', 'hidefocus', - 'hidden', 'high', 'href', 'hreflang', 'hspace', 'icon', 'id', 'inputmode', - 'ismap', 'keytype', 'label', 'leftspacing', 'lang', 'list', 'longdesc', - 'loop', 'loopcount', 'loopend', 'loopstart', 'low', 'lowsrc', 'max', - 'maxlength', 'media', 'method', 'min', 'multiple', 'name', 'nohref', - 'noshade', 'nowrap', 'open', 'optimum', 'pattern', 'ping', 'point-size', - 'poster', 'pqg', 'preload', 'prompt', 'radiogroup', 'readonly', 'rel', - 'repeat-max', 'repeat-min', 'replace', 'required', 'rev', 'rightspacing', - 'rows', 'rowspan', 'rules', 'scope', 'selected', 'shape', 'size', 'span', - 'src', 'start', 'step', 'summary', 'suppress', 'tabindex', 'target', - 'template', 'title', 'toppadding', 'type', 'unselectable', 'usemap', - 'urn', 'valign', 'value', 'variable', 'volume', 'vspace', 'vrml', - 'width', 'wrap', 'xml:lang'} - - unacceptable_elements_with_end_tag = {'script', 'applet', 'style'} - - acceptable_css_properties = {'azimuth', 'background-color', - 'border-bottom-color', 'border-collapse', 'border-color', - 'border-left-color', 'border-right-color', 'border-top-color', 'clear', - 'color', 'cursor', 'direction', 'display', 'elevation', 'float', 'font', - 'font-family', 'font-size', 'font-style', 'font-variant', 'font-weight', - 'height', 'letter-spacing', 'line-height', 'overflow', 'pause', - 'pause-after', 'pause-before', 'pitch', 'pitch-range', 'richness', - 'speak', 'speak-header', 'speak-numeral', 'speak-punctuation', - 'speech-rate', 'stress', 'text-align', 'text-decoration', 'text-indent', - 'unicode-bidi', 'vertical-align', 'voice-family', 'volume', - 'white-space', 'width'} - - # survey of common keywords found in feeds - acceptable_css_keywords = {'auto', 'aqua', 'black', 'block', 'blue', - 'bold', 'both', 'bottom', 'brown', 'center', 'collapse', 'dashed', - 'dotted', 'fuchsia', 'gray', 'green', '!important', 'italic', 'left', - 'lime', 'maroon', 'medium', 'none', 'navy', 'normal', 'nowrap', 'olive', - 'pointer', 'purple', 'red', 'right', 'solid', 'silver', 'teal', 'top', - 'transparent', 'underline', 'white', 'yellow'} - - valid_css_values = re.compile('^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|' + - '\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$') - - mathml_elements = {'annotation', 'annotation-xml', 'maction', 'math', - 'merror', 'mfenced', 'mfrac', 'mi', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', - 'mphantom', 'mprescripts', 'mroot', 'mrow', 'mspace', 'msqrt', 'mstyle', - 'msub', 'msubsup', 'msup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', - 'munderover', 'none', 'semantics'} - - mathml_attributes = {'actiontype', 'align', 'columnalign', 'columnalign', - 'columnalign', 'close', 'columnlines', 'columnspacing', 'columnspan', 'depth', - 'display', 'displaystyle', 'encoding', 'equalcolumns', 'equalrows', - 'fence', 'fontstyle', 'fontweight', 'frame', 'height', 'linethickness', - 'lspace', 'mathbackground', 'mathcolor', 'mathvariant', 'mathvariant', - 'maxsize', 'minsize', 'open', 'other', 'rowalign', 'rowalign', 'rowalign', - 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'scriptlevel', 'selection', - 'separator', 'separators', 'stretchy', 'width', 'width', 'xlink:href', - 'xlink:show', 'xlink:type', 'xmlns', 'xmlns:xlink'} - - # svgtiny - foreignObject + linearGradient + radialGradient + stop - svg_elements = {'a', 'animate', 'animateColor', 'animateMotion', - 'animateTransform', 'circle', 'defs', 'desc', 'ellipse', 'foreignObject', - 'font-face', 'font-face-name', 'font-face-src', 'g', 'glyph', 'hkern', - 'linearGradient', 'line', 'marker', 'metadata', 'missing-glyph', 'mpath', - 'path', 'polygon', 'polyline', 'radialGradient', 'rect', 'set', 'stop', - 'svg', 'switch', 'text', 'title', 'tspan', 'use'} - - # svgtiny + class + opacity + offset + xmlns + xmlns:xlink - svg_attributes = {'accent-height', 'accumulate', 'additive', 'alphabetic', - 'arabic-form', 'ascent', 'attributeName', 'attributeType', - 'baseProfile', 'bbox', 'begin', 'by', 'calcMode', 'cap-height', - 'class', 'color', 'color-rendering', 'content', 'cx', 'cy', 'd', 'dx', - 'dy', 'descent', 'display', 'dur', 'end', 'fill', 'fill-opacity', - 'fill-rule', 'font-family', 'font-size', 'font-stretch', 'font-style', - 'font-variant', 'font-weight', 'from', 'fx', 'fy', 'g1', 'g2', - 'glyph-name', 'gradientUnits', 'hanging', 'height', 'horiz-adv-x', - 'horiz-origin-x', 'id', 'ideographic', 'k', 'keyPoints', 'keySplines', - 'keyTimes', 'lang', 'mathematical', 'marker-end', 'marker-mid', - 'marker-start', 'markerHeight', 'markerUnits', 'markerWidth', 'max', - 'min', 'name', 'offset', 'opacity', 'orient', 'origin', - 'overline-position', 'overline-thickness', 'panose-1', 'path', - 'pathLength', 'points', 'preserveAspectRatio', 'r', 'refX', 'refY', - 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', - 'restart', 'rotate', 'rx', 'ry', 'slope', 'stemh', 'stemv', - 'stop-color', 'stop-opacity', 'strikethrough-position', - 'strikethrough-thickness', 'stroke', 'stroke-dasharray', - 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', - 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', - 'target', 'text-anchor', 'to', 'transform', 'type', 'u1', 'u2', - 'underline-position', 'underline-thickness', 'unicode', 'unicode-range', - 'units-per-em', 'values', 'version', 'viewBox', 'visibility', 'width', - 'widths', 'x', 'x-height', 'x1', 'x2', 'xlink:actuate', 'xlink:arcrole', - 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', - 'xml:base', 'xml:lang', 'xml:space', 'xmlns', 'xmlns:xlink', 'y', 'y1', - 'y2', 'zoomAndPan'} - - svg_attr_map = None - svg_elem_map = None - - acceptable_svg_properties = { 'fill', 'fill-opacity', 'fill-rule', - 'stroke', 'stroke-width', 'stroke-linecap', 'stroke-linejoin', - 'stroke-opacity'} - - def reset(self): - _BaseHTMLProcessor.reset(self) - self.unacceptablestack = 0 - self.mathmlOK = 0 - self.svgOK = 0 - - def unknown_starttag(self, tag, attrs): - acceptable_attributes = self.acceptable_attributes - keymap = {} - if not tag in self.acceptable_elements or self.svgOK: - if tag in self.unacceptable_elements_with_end_tag: - self.unacceptablestack += 1 - - # add implicit namespaces to html5 inline svg/mathml - if self._type.endswith('html'): - if not dict(attrs).get('xmlns'): - if tag=='svg': - attrs.append( ('xmlns','http://www.w3.org/2000/svg') ) - if tag=='math': - attrs.append( ('xmlns','http://www.w3.org/1998/Math/MathML') ) - - # not otherwise acceptable, perhaps it is MathML or SVG? - if tag=='math' and ('xmlns','http://www.w3.org/1998/Math/MathML') in attrs: - self.mathmlOK += 1 - if tag=='svg' and ('xmlns','http://www.w3.org/2000/svg') in attrs: - self.svgOK += 1 - - # chose acceptable attributes based on tag class, else bail - if self.mathmlOK and tag in self.mathml_elements: - acceptable_attributes = self.mathml_attributes - elif self.svgOK and tag in self.svg_elements: - # for most vocabularies, lowercasing is a good idea. Many - # svg elements, however, are camel case - if not self.svg_attr_map: - lower=[attr.lower() for attr in self.svg_attributes] - mix=[a for a in self.svg_attributes if a not in lower] - self.svg_attributes = lower - self.svg_attr_map = dict([(a.lower(),a) for a in mix]) - - lower=[attr.lower() for attr in self.svg_elements] - mix=[a for a in self.svg_elements if a not in lower] - self.svg_elements = lower - self.svg_elem_map = dict([(a.lower(),a) for a in mix]) - acceptable_attributes = self.svg_attributes - tag = self.svg_elem_map.get(tag,tag) - keymap = self.svg_attr_map - elif not tag in self.acceptable_elements: - return - - # declare xlink namespace, if needed - if self.mathmlOK or self.svgOK: - if filter(lambda n_v: n_v[0].startswith('xlink:'),attrs): - if not ('xmlns:xlink','http://www.w3.org/1999/xlink') in attrs: - attrs.append(('xmlns:xlink','http://www.w3.org/1999/xlink')) - - clean_attrs = [] - for key, value in self.normalize_attrs(attrs): - if key in acceptable_attributes: - key=keymap.get(key,key) - # make sure the uri uses an acceptable uri scheme - if key == u'href': - value = _makeSafeAbsoluteURI(value) - clean_attrs.append((key,value)) - elif key=='style': - clean_value = self.sanitize_style(value) - if clean_value: - clean_attrs.append((key,clean_value)) - _BaseHTMLProcessor.unknown_starttag(self, tag, clean_attrs) - - def unknown_endtag(self, tag): - if not tag in self.acceptable_elements: - if tag in self.unacceptable_elements_with_end_tag: - self.unacceptablestack -= 1 - if self.mathmlOK and tag in self.mathml_elements: - if tag == 'math' and self.mathmlOK: - self.mathmlOK -= 1 - elif self.svgOK and tag in self.svg_elements: - tag = self.svg_elem_map.get(tag,tag) - if tag == 'svg' and self.svgOK: - self.svgOK -= 1 - else: - return - _BaseHTMLProcessor.unknown_endtag(self, tag) - - def handle_pi(self, text): - pass - - def handle_decl(self, text): - pass - - def handle_data(self, text): - if not self.unacceptablestack: - _BaseHTMLProcessor.handle_data(self, text) - - def sanitize_style(self, style): - # disallow urls - style=re.compile('url\s*\(\s*[^\s)]+?\s*\)\s*').sub(' ',style) - - # gauntlet - if not re.match("""^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$""", style): - return '' - # This replaced a regexp that used re.match and was prone to pathological back-tracking. - if re.sub("\s*[-\w]+\s*:\s*[^:;]*;?", '', style).strip(): - return '' - - clean = [] - for prop,value in re.findall("([-\w]+)\s*:\s*([^:;]*)",style): - if not value: - continue - if prop.lower() in self.acceptable_css_properties: - clean.append(prop + ': ' + value + ';') - elif prop.split('-')[0].lower() in ['background','border','margin','padding']: - for keyword in value.split(): - if not keyword in self.acceptable_css_keywords and \ - not self.valid_css_values.match(keyword): - break - else: - clean.append(prop + ': ' + value + ';') - elif self.svgOK and prop.lower() in self.acceptable_svg_properties: - clean.append(prop + ': ' + value + ';') - - return ' '.join(clean) - - def parse_comment(self, i, report=1): - ret = _BaseHTMLProcessor.parse_comment(self, i, report) - if ret >= 0: - return ret - # if ret == -1, this may be a malicious attempt to circumvent - # sanitization, or a page-destroying unclosed comment - match = re.compile(r'--[^>]*>').search(self.rawdata, i+4) - if match: - return match.end() - # unclosed comment; deliberately fail to handle_data() - return len(self.rawdata) - - -def _sanitizeHTML(htmlSource, encoding, _type): - p = _HTMLSanitizer(encoding, _type) - htmlSource = htmlSource.replace(''): - data = data.split('>', 1)[1] - if data.count(' stream - - This function lets you define parsers that take any input source - (URL, pathname to local or network file, or actual data as a string) - and deal with it in a uniform manner. Returned object is guaranteed - to have all the basic stdio read methods (read, readline, readlines). - Just .close() the object when you're done with it. - - If the etag argument is supplied, it will be used as the value of an - If-None-Match request header. - - If the modified argument is supplied, it can be a tuple of 9 integers - (as returned by gmtime() in the standard Python time module) or a date - string in any format supported by feedparser. Regardless, it MUST - be in GMT (Greenwich Mean Time). It will be reformatted into an - RFC 1123-compliant date and used as the value of an If-Modified-Since - request header. - - If the agent argument is supplied, it will be used as the value of a - User-Agent request header. - - If the referrer argument is supplied, it will be used as the value of a - Referer[sic] request header. - - If handlers is supplied, it is a list of handlers used to build a - urllib2 opener. - - if request_headers is supplied it is a dictionary of HTTP request headers - that will override the values generated by FeedParser. - """ - - if hasattr(url_file_stream_or_string, 'read'): - return url_file_stream_or_string - - if isinstance(url_file_stream_or_string, basestring) \ - and urlparse.urlparse(url_file_stream_or_string)[0] in ('http', 'https', 'ftp', 'file', 'feed'): - # Deal with the feed URI scheme - if url_file_stream_or_string.startswith('feed:http'): - url_file_stream_or_string = url_file_stream_or_string[5:] - elif url_file_stream_or_string.startswith('feed:'): - url_file_stream_or_string = 'http:' + url_file_stream_or_string[5:] - if not agent: - agent = USER_AGENT - # Test for inline user:password credentials for HTTP basic auth - auth = None - if base64 and not url_file_stream_or_string.startswith('ftp:'): - urltype, rest = urllib.splittype(url_file_stream_or_string) - realhost, rest = urllib.splithost(rest) - if realhost: - user_passwd, realhost = urllib.splituser(realhost) - if user_passwd: - url_file_stream_or_string = '%s://%s%s' % (urltype, realhost, rest) - auth = base64.standard_b64encode(user_passwd).strip() - - # iri support - if isinstance(url_file_stream_or_string, unicode): - url_file_stream_or_string = _convert_to_idn(url_file_stream_or_string) - - # try to open with urllib2 (to use optional headers) - request = _build_urllib2_request(url_file_stream_or_string, agent, etag, modified, referrer, auth, request_headers) - opener = urllib2.build_opener(*tuple(handlers + [_FeedURLHandler()])) - opener.addheaders = [] # RMK - must clear so we only send our custom User-Agent - try: - return opener.open(request) - finally: - opener.close() # JohnD - - # try to open with native open function (if url_file_stream_or_string is a filename) - try: - return open(url_file_stream_or_string, 'rb') - except (IOError, UnicodeEncodeError, TypeError): - # if url_file_stream_or_string is a unicode object that - # cannot be converted to the encoding returned by - # sys.getfilesystemencoding(), a UnicodeEncodeError - # will be thrown - # If url_file_stream_or_string is a string that contains NULL - # (such as an XML document encoded in UTF-32), TypeError will - # be thrown. - pass - - # treat url_file_stream_or_string as string - if isinstance(url_file_stream_or_string, unicode): - return _StringIO(url_file_stream_or_string.encode('utf-8')) - return _StringIO(url_file_stream_or_string) - -def _convert_to_idn(url): - """Convert a URL to IDN notation""" - # this function should only be called with a unicode string - # strategy: if the host cannot be encoded in ascii, then - # it'll be necessary to encode it in idn form - parts = list(urlparse.urlsplit(url)) - try: - parts[1].encode('ascii') - except UnicodeEncodeError: - # the url needs to be converted to idn notation - host = parts[1].rsplit(':', 1) - newhost = [] - port = u'' - if len(host) == 2: - port = host.pop() - for h in host[0].split('.'): - newhost.append(h.encode('idna').decode('utf-8')) - parts[1] = '.'.join(newhost) - if port: - parts[1] += ':' + port - return urlparse.urlunsplit(parts) - else: - return url - -def _build_urllib2_request(url, agent, etag, modified, referrer, auth, request_headers): - request = urllib2.Request(url) - request.add_header('User-Agent', agent) - if etag: - request.add_header('If-None-Match', etag) - if isinstance(modified, basestring): - modified = _parse_date(modified) - elif isinstance(modified, datetime.datetime): - modified = modified.utctimetuple() - if modified: - # format into an RFC 1123-compliant timestamp. We can't use - # time.strftime() since the %a and %b directives can be affected - # by the current locale, but RFC 2616 states that dates must be - # in English. - short_weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] - months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] - request.add_header('If-Modified-Since', '%s, %02d %s %04d %02d:%02d:%02d GMT' % (short_weekdays[modified[6]], modified[2], months[modified[1] - 1], modified[0], modified[3], modified[4], modified[5])) - if referrer: - request.add_header('Referer', referrer) - if gzip and zlib: - request.add_header('Accept-encoding', 'gzip, deflate') - elif gzip: - request.add_header('Accept-encoding', 'gzip') - elif zlib: - request.add_header('Accept-encoding', 'deflate') - else: - request.add_header('Accept-encoding', '') - if auth: - request.add_header('Authorization', 'Basic %s' % auth) - if ACCEPT_HEADER: - request.add_header('Accept', ACCEPT_HEADER) - # use this for whatever -- cookies, special headers, etc - # [('Cookie','Something'),('x-special-header','Another Value')] - for header_name, header_value in request_headers.items(): - request.add_header(header_name, header_value) - request.add_header('A-IM', 'feed') # RFC 3229 support - return request - -_date_handlers = [] -def registerDateHandler(func): - '''Register a date handler function (takes string, returns 9-tuple date in GMT)''' - _date_handlers.insert(0, func) - -# ISO-8601 date parsing routines written by Fazal Majid. -# The ISO 8601 standard is very convoluted and irregular - a full ISO 8601 -# parser is beyond the scope of feedparser and would be a worthwhile addition -# to the Python library. -# A single regular expression cannot parse ISO 8601 date formats into groups -# as the standard is highly irregular (for instance is 030104 2003-01-04 or -# 0301-04-01), so we use templates instead. -# Please note the order in templates is significant because we need a -# greedy match. -_iso8601_tmpl = ['YYYY-?MM-?DD', 'YYYY-0MM?-?DD', 'YYYY-MM', 'YYYY-?OOO', - 'YY-?MM-?DD', 'YY-?OOO', 'YYYY', - '-YY-?MM', '-OOO', '-YY', - '--MM-?DD', '--MM', - '---DD', - 'CC', ''] -_iso8601_re = [ - tmpl.replace( - 'YYYY', r'(?P\d{4})').replace( - 'YY', r'(?P\d\d)').replace( - 'MM', r'(?P[01]\d)').replace( - 'DD', r'(?P[0123]\d)').replace( - 'OOO', r'(?P[0123]\d\d)').replace( - 'CC', r'(?P\d\d$)') - + r'(T?(?P\d{2}):(?P\d{2})' - + r'(:(?P\d{2}))?' - + r'(\.(?P\d+))?' - + r'(?P[+-](?P\d{2})(:(?P\d{2}))?|Z)?)?' - for tmpl in _iso8601_tmpl] -try: - del tmpl -except NameError: - pass -_iso8601_matches = [re.compile(regex).match for regex in _iso8601_re] -try: - del regex -except NameError: - pass -def _parse_date_iso8601(dateString): - '''Parse a variety of ISO-8601-compatible formats like 20040105''' - m = None - for _iso8601_match in _iso8601_matches: - m = _iso8601_match(dateString) - if m: - break - if not m: - return - if m.span() == (0, 0): - return - params = m.groupdict() - ordinal = params.get('ordinal', 0) - if ordinal: - ordinal = int(ordinal) - else: - ordinal = 0 - year = params.get('year', '--') - if not year or year == '--': - year = time.gmtime()[0] - elif len(year) == 2: - # ISO 8601 assumes current century, i.e. 93 -> 2093, NOT 1993 - year = 100 * int(time.gmtime()[0] / 100) + int(year) - else: - year = int(year) - month = params.get('month', '-') - if not month or month == '-': - # ordinals are NOT normalized by mktime, we simulate them - # by setting month=1, day=ordinal - if ordinal: - month = 1 - else: - month = time.gmtime()[1] - month = int(month) - day = params.get('day', 0) - if not day: - # see above - if ordinal: - day = ordinal - elif params.get('century', 0) or \ - params.get('year', 0) or params.get('month', 0): - day = 1 - else: - day = time.gmtime()[2] - else: - day = int(day) - # special case of the century - is the first year of the 21st century - # 2000 or 2001 ? The debate goes on... - if 'century' in params: - year = (int(params['century']) - 1) * 100 + 1 - # in ISO 8601 most fields are optional - for field in ['hour', 'minute', 'second', 'tzhour', 'tzmin']: - if not params.get(field, None): - params[field] = 0 - hour = int(params.get('hour', 0)) - minute = int(params.get('minute', 0)) - second = int(float(params.get('second', 0))) - # weekday is normalized by mktime(), we can ignore it - weekday = 0 - daylight_savings_flag = -1 - tm = [year, month, day, hour, minute, second, weekday, - ordinal, daylight_savings_flag] - # ISO 8601 time zone adjustments - tz = params.get('tz') - if tz and tz != 'Z': - if tz[0] == '-': - tm[3] += int(params.get('tzhour', 0)) - tm[4] += int(params.get('tzmin', 0)) - elif tz[0] == '+': - tm[3] -= int(params.get('tzhour', 0)) - tm[4] -= int(params.get('tzmin', 0)) - else: - return None - # Python's time.mktime() is a wrapper around the ANSI C mktime(3c) - # which is guaranteed to normalize d/m/y/h/m/s. - # Many implementations have bugs, but we'll pretend they don't. - return time.localtime(time.mktime(tuple(tm))) -registerDateHandler(_parse_date_iso8601) - -# 8-bit date handling routines written by ytrewq1. -_korean_year = u'\ub144' # b3e2 in euc-kr -_korean_month = u'\uc6d4' # bff9 in euc-kr -_korean_day = u'\uc77c' # c0cf in euc-kr -_korean_am = u'\uc624\uc804' # bfc0 c0fc in euc-kr -_korean_pm = u'\uc624\ud6c4' # bfc0 c8c4 in euc-kr - -_korean_onblog_date_re = \ - re.compile('(\d{4})%s\s+(\d{2})%s\s+(\d{2})%s\s+(\d{2}):(\d{2}):(\d{2})' % \ - (_korean_year, _korean_month, _korean_day)) -_korean_nate_date_re = \ - re.compile(u'(\d{4})-(\d{2})-(\d{2})\s+(%s|%s)\s+(\d{,2}):(\d{,2}):(\d{,2})' % \ - (_korean_am, _korean_pm)) -def _parse_date_onblog(dateString): - '''Parse a string according to the OnBlog 8-bit date format''' - m = _korean_onblog_date_re.match(dateString) - if not m: - return - w3dtfdate = '%(year)s-%(month)s-%(day)sT%(hour)s:%(minute)s:%(second)s%(zonediff)s' % \ - {'year': m.group(1), 'month': m.group(2), 'day': m.group(3),\ - 'hour': m.group(4), 'minute': m.group(5), 'second': m.group(6),\ - 'zonediff': '+09:00'} - return _parse_date_w3dtf(w3dtfdate) -registerDateHandler(_parse_date_onblog) - -def _parse_date_nate(dateString): - '''Parse a string according to the Nate 8-bit date format''' - m = _korean_nate_date_re.match(dateString) - if not m: - return - hour = int(m.group(5)) - ampm = m.group(4) - if (ampm == _korean_pm): - hour += 12 - hour = str(hour) - if len(hour) == 1: - hour = '0' + hour - w3dtfdate = '%(year)s-%(month)s-%(day)sT%(hour)s:%(minute)s:%(second)s%(zonediff)s' % \ - {'year': m.group(1), 'month': m.group(2), 'day': m.group(3),\ - 'hour': hour, 'minute': m.group(6), 'second': m.group(7),\ - 'zonediff': '+09:00'} - return _parse_date_w3dtf(w3dtfdate) -registerDateHandler(_parse_date_nate) - -# Unicode strings for Greek date strings -_greek_months = \ - { \ - u'\u0399\u03b1\u03bd': u'Jan', # c9e1ed in iso-8859-7 - u'\u03a6\u03b5\u03b2': u'Feb', # d6e5e2 in iso-8859-7 - u'\u039c\u03ac\u03ce': u'Mar', # ccdcfe in iso-8859-7 - u'\u039c\u03b1\u03ce': u'Mar', # cce1fe in iso-8859-7 - u'\u0391\u03c0\u03c1': u'Apr', # c1f0f1 in iso-8859-7 - u'\u039c\u03ac\u03b9': u'May', # ccdce9 in iso-8859-7 - u'\u039c\u03b1\u03ca': u'May', # cce1fa in iso-8859-7 - u'\u039c\u03b1\u03b9': u'May', # cce1e9 in iso-8859-7 - u'\u0399\u03bf\u03cd\u03bd': u'Jun', # c9effded in iso-8859-7 - u'\u0399\u03bf\u03bd': u'Jun', # c9efed in iso-8859-7 - u'\u0399\u03bf\u03cd\u03bb': u'Jul', # c9effdeb in iso-8859-7 - u'\u0399\u03bf\u03bb': u'Jul', # c9f9eb in iso-8859-7 - u'\u0391\u03cd\u03b3': u'Aug', # c1fde3 in iso-8859-7 - u'\u0391\u03c5\u03b3': u'Aug', # c1f5e3 in iso-8859-7 - u'\u03a3\u03b5\u03c0': u'Sep', # d3e5f0 in iso-8859-7 - u'\u039f\u03ba\u03c4': u'Oct', # cfeaf4 in iso-8859-7 - u'\u039d\u03bf\u03ad': u'Nov', # cdefdd in iso-8859-7 - u'\u039d\u03bf\u03b5': u'Nov', # cdefe5 in iso-8859-7 - u'\u0394\u03b5\u03ba': u'Dec', # c4e5ea in iso-8859-7 - } - -_greek_wdays = \ - { \ - u'\u039a\u03c5\u03c1': u'Sun', # caf5f1 in iso-8859-7 - u'\u0394\u03b5\u03c5': u'Mon', # c4e5f5 in iso-8859-7 - u'\u03a4\u03c1\u03b9': u'Tue', # d4f1e9 in iso-8859-7 - u'\u03a4\u03b5\u03c4': u'Wed', # d4e5f4 in iso-8859-7 - u'\u03a0\u03b5\u03bc': u'Thu', # d0e5ec in iso-8859-7 - u'\u03a0\u03b1\u03c1': u'Fri', # d0e1f1 in iso-8859-7 - u'\u03a3\u03b1\u03b2': u'Sat', # d3e1e2 in iso-8859-7 - } - -_greek_date_format_re = \ - re.compile(u'([^,]+),\s+(\d{2})\s+([^\s]+)\s+(\d{4})\s+(\d{2}):(\d{2}):(\d{2})\s+([^\s]+)') - -def _parse_date_greek(dateString): - '''Parse a string according to a Greek 8-bit date format.''' - m = _greek_date_format_re.match(dateString) - if not m: - return - wday = _greek_wdays[m.group(1)] - month = _greek_months[m.group(3)] - rfc822date = '%(wday)s, %(day)s %(month)s %(year)s %(hour)s:%(minute)s:%(second)s %(zonediff)s' % \ - {'wday': wday, 'day': m.group(2), 'month': month, 'year': m.group(4),\ - 'hour': m.group(5), 'minute': m.group(6), 'second': m.group(7),\ - 'zonediff': m.group(8)} - return _parse_date_rfc822(rfc822date) -registerDateHandler(_parse_date_greek) - -# Unicode strings for Hungarian date strings -_hungarian_months = \ - { \ - u'janu\u00e1r': u'01', # e1 in iso-8859-2 - u'febru\u00e1ri': u'02', # e1 in iso-8859-2 - u'm\u00e1rcius': u'03', # e1 in iso-8859-2 - u'\u00e1prilis': u'04', # e1 in iso-8859-2 - u'm\u00e1ujus': u'05', # e1 in iso-8859-2 - u'j\u00fanius': u'06', # fa in iso-8859-2 - u'j\u00falius': u'07', # fa in iso-8859-2 - u'augusztus': u'08', - u'szeptember': u'09', - u'okt\u00f3ber': u'10', # f3 in iso-8859-2 - u'november': u'11', - u'december': u'12', - } - -_hungarian_date_format_re = \ - re.compile(u'(\d{4})-([^-]+)-(\d{,2})T(\d{,2}):(\d{2})((\+|-)(\d{,2}:\d{2}))') - -def _parse_date_hungarian(dateString): - '''Parse a string according to a Hungarian 8-bit date format.''' - m = _hungarian_date_format_re.match(dateString) - if not m or m.group(2) not in _hungarian_months: - return None - month = _hungarian_months[m.group(2)] - day = m.group(3) - if len(day) == 1: - day = '0' + day - hour = m.group(4) - if len(hour) == 1: - hour = '0' + hour - w3dtfdate = '%(year)s-%(month)s-%(day)sT%(hour)s:%(minute)s%(zonediff)s' % \ - {'year': m.group(1), 'month': month, 'day': day,\ - 'hour': hour, 'minute': m.group(5),\ - 'zonediff': m.group(6)} - return _parse_date_w3dtf(w3dtfdate) -registerDateHandler(_parse_date_hungarian) - -# W3DTF-style date parsing adapted from PyXML xml.utils.iso8601, written by -# Drake and licensed under the Python license. Removed all range checking -# for month, day, hour, minute, and second, since mktime will normalize -# these later -# Modified to also support MSSQL-style datetimes as defined at: -# http://msdn.microsoft.com/en-us/library/ms186724.aspx -# (which basically means allowing a space as a date/time/timezone separator) -def _parse_date_w3dtf(dateString): - def __extract_date(m): - year = int(m.group('year')) - if year < 100: - year = 100 * int(time.gmtime()[0] / 100) + int(year) - if year < 1000: - return 0, 0, 0 - julian = m.group('julian') - if julian: - julian = int(julian) - month = julian / 30 + 1 - day = julian % 30 + 1 - jday = None - while jday != julian: - t = time.mktime((year, month, day, 0, 0, 0, 0, 0, 0)) - jday = time.gmtime(t)[-2] - diff = abs(jday - julian) - if jday > julian: - if diff < day: - day = day - diff - else: - month = month - 1 - day = 31 - elif jday < julian: - if day + diff < 28: - day = day + diff - else: - month = month + 1 - return year, month, day - month = m.group('month') - day = 1 - if month is None: - month = 1 - else: - month = int(month) - day = m.group('day') - if day: - day = int(day) - else: - day = 1 - return year, month, day - - def __extract_time(m): - if not m: - return 0, 0, 0 - hours = m.group('hours') - if not hours: - return 0, 0, 0 - hours = int(hours) - minutes = int(m.group('minutes')) - seconds = m.group('seconds') - if seconds: - seconds = int(seconds) - else: - seconds = 0 - return hours, minutes, seconds - - def __extract_tzd(m): - '''Return the Time Zone Designator as an offset in seconds from UTC.''' - if not m: - return 0 - tzd = m.group('tzd') - if not tzd: - return 0 - if tzd == 'Z': - return 0 - hours = int(m.group('tzdhours')) - minutes = m.group('tzdminutes') - if minutes: - minutes = int(minutes) - else: - minutes = 0 - offset = (hours*60 + minutes) * 60 - if tzd[0] == '+': - return -offset - return offset - - __date_re = ('(?P\d\d\d\d)' - '(?:(?P-|)' - '(?:(?P\d\d)(?:(?P=dsep)(?P\d\d))?' - '|(?P\d\d\d)))?') - __tzd_re = ' ?(?P[-+](?P\d\d)(?::?(?P\d\d))|Z)?' - __time_re = ('(?P\d\d)(?P:|)(?P\d\d)' - '(?:(?P=tsep)(?P\d\d)(?:[.,]\d+)?)?' - + __tzd_re) - __datetime_re = '%s(?:[T ]%s)?' % (__date_re, __time_re) - __datetime_rx = re.compile(__datetime_re) - m = __datetime_rx.match(dateString) - if (m is None) or (m.group() != dateString): - return - gmt = __extract_date(m) + __extract_time(m) + (0, 0, 0) - if gmt[0] == 0: - return - return time.gmtime(time.mktime(gmt) + __extract_tzd(m) - time.timezone) -registerDateHandler(_parse_date_w3dtf) - -# Define the strings used by the RFC822 datetime parser -_rfc822_months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', - 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] -_rfc822_daynames = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] - -# Only the first three letters of the month name matter -_rfc822_month = "(?P%s)(?:[a-z]*,?)" % ('|'.join(_rfc822_months)) -# The year may be 2 or 4 digits; capture the century if it exists -_rfc822_year = "(?P(?:\d{2})?\d{2})" -_rfc822_day = "(?P *\d{1,2})" -_rfc822_date = "%s %s %s" % (_rfc822_day, _rfc822_month, _rfc822_year) - -_rfc822_hour = "(?P\d{2}):(?P\d{2})(?::(?P\d{2}))?" -_rfc822_tz = "(?Put|gmt(?:[+-]\d{2}:\d{2})?|[aecmp][sd]?t|[zamny]|[+-]\d{4})" -_rfc822_tznames = { - 'ut': 0, 'gmt': 0, 'z': 0, - 'adt': -3, 'ast': -4, 'at': -4, - 'edt': -4, 'est': -5, 'et': -5, - 'cdt': -5, 'cst': -6, 'ct': -6, - 'mdt': -6, 'mst': -7, 'mt': -7, - 'pdt': -7, 'pst': -8, 'pt': -8, - 'a': -1, 'n': 1, - 'm': -12, 'y': 12, - } -# The timezone may be prefixed by 'Etc/' -_rfc822_time = "%s (?:etc/)?%s" % (_rfc822_hour, _rfc822_tz) - -_rfc822_dayname = "(?P%s)" % ('|'.join(_rfc822_daynames)) -_rfc822_match = re.compile( - "(?:%s, )?%s(?: %s)?" % (_rfc822_dayname, _rfc822_date, _rfc822_time) -).match - -def _parse_date_group_rfc822(m): - # Calculate a date and timestamp - for k in ('year', 'day', 'hour', 'minute', 'second'): - m[k] = int(m[k]) - m['month'] = _rfc822_months.index(m['month']) + 1 - # If the year is 2 digits, assume everything in the 90's is the 1990's - if m['year'] < 100: - m['year'] += (1900, 2000)[m['year'] < 90] - stamp = datetime.datetime(*[m[i] for i in - ('year', 'month', 'day', 'hour', 'minute', 'second')]) - - # Use the timezone information to calculate the difference between - # the given date and timestamp and Universal Coordinated Time - tzhour = 0 - tzmin = 0 - if m['tz'] and m['tz'].startswith('gmt'): - # Handle GMT and GMT+hh:mm timezone syntax (the trailing - # timezone info will be handled by the next `if` block) - m['tz'] = ''.join(m['tz'][3:].split(':')) or 'gmt' - if not m['tz']: - pass - elif m['tz'].startswith('+'): - tzhour = int(m['tz'][1:3]) - tzmin = int(m['tz'][3:]) - elif m['tz'].startswith('-'): - tzhour = int(m['tz'][1:3]) * -1 - tzmin = int(m['tz'][3:]) * -1 - else: - tzhour = _rfc822_tznames[m['tz']] - delta = datetime.timedelta(0, 0, 0, 0, tzmin, tzhour) - - # Return the date and timestamp in UTC - return (stamp - delta).utctimetuple() - -def _parse_date_rfc822(dt): - """Parse RFC 822 dates and times, with one minor - difference: years may be 4DIGIT or 2DIGIT. - http://tools.ietf.org/html/rfc822#section-5""" - try: - m = _rfc822_match(dt.lower()).groupdict(0) - except AttributeError: - return None - - return _parse_date_group_rfc822(m) -registerDateHandler(_parse_date_rfc822) - -def _parse_date_rfc822_grubby(dt): - """Parse date format similar to RFC 822, but - the comma after the dayname is optional and - month/day are inverted""" - _rfc822_date_grubby = "%s %s %s" % (_rfc822_month, _rfc822_day, _rfc822_year) - _rfc822_match_grubby = re.compile( - "(?:%s[,]? )?%s(?: %s)?" % (_rfc822_dayname, _rfc822_date_grubby, _rfc822_time) - ).match - - try: - m = _rfc822_match_grubby(dt.lower()).groupdict(0) - except AttributeError: - return None - - return _parse_date_group_rfc822(m) -registerDateHandler(_parse_date_rfc822_grubby) - -def _parse_date_asctime(dt): - """Parse asctime-style dates""" - dayname, month, day, remainder = dt.split(None, 3) - # Convert month and day into zero-padded integers - month = '%02i ' % (_rfc822_months.index(month.lower()) + 1) - day = '%02i ' % (int(day),) - dt = month + day + remainder - return time.strptime(dt, '%m %d %H:%M:%S %Y')[:-1] + (0, ) -registerDateHandler(_parse_date_asctime) - -def _parse_date_perforce(aDateString): - """parse a date in yyyy/mm/dd hh:mm:ss TTT format""" - # Fri, 2006/09/15 08:19:53 EDT - _my_date_pattern = re.compile( \ - r'(\w{,3}), (\d{,4})/(\d{,2})/(\d{2}) (\d{,2}):(\d{2}):(\d{2}) (\w{,3})') - - m = _my_date_pattern.search(aDateString) - if m is None: - return None - dow, year, month, day, hour, minute, second, tz = m.groups() - months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] - dateString = "%s, %s %s %s %s:%s:%s %s" % (dow, day, months[int(month) - 1], year, hour, minute, second, tz) - tm = rfc822.parsedate_tz(dateString) - if tm: - return time.gmtime(rfc822.mktime_tz(tm)) -registerDateHandler(_parse_date_perforce) - -def _parse_date(dateString): - '''Parses a variety of date formats into a 9-tuple in GMT''' - if not dateString: - return None - for handler in _date_handlers: - try: - date9tuple = handler(dateString) - except (KeyError, OverflowError, ValueError): - continue - if not date9tuple: - continue - if len(date9tuple) != 9: - continue - return date9tuple - return None - -# Each marker represents some of the characters of the opening XML -# processing instruction (' -RE_XML_DECLARATION = re.compile('^<\?xml[^>]*?>') - -# Capture the value of the XML processing instruction's encoding attribute. -# Example: -RE_XML_PI_ENCODING = re.compile(_s2bytes('^<\?.*encoding=[\'"](.*?)[\'"].*\?>')) - -def convert_to_utf8(http_headers, data): - '''Detect and convert the character encoding to UTF-8. - - http_headers is a dictionary - data is a raw string (not Unicode)''' - - # This is so much trickier than it sounds, it's not even funny. - # According to RFC 3023 ('XML Media Types'), if the HTTP Content-Type - # is application/xml, application/*+xml, - # application/xml-external-parsed-entity, or application/xml-dtd, - # the encoding given in the charset parameter of the HTTP Content-Type - # takes precedence over the encoding given in the XML prefix within the - # document, and defaults to 'utf-8' if neither are specified. But, if - # the HTTP Content-Type is text/xml, text/*+xml, or - # text/xml-external-parsed-entity, the encoding given in the XML prefix - # within the document is ALWAYS IGNORED and only the encoding given in - # the charset parameter of the HTTP Content-Type header should be - # respected, and it defaults to 'us-ascii' if not specified. - - # Furthermore, discussion on the atom-syntax mailing list with the - # author of RFC 3023 leads me to the conclusion that any document - # served with a Content-Type of text/* and no charset parameter - # must be treated as us-ascii. (We now do this.) And also that it - # must always be flagged as non-well-formed. (We now do this too.) - - # If Content-Type is unspecified (input was local file or non-HTTP source) - # or unrecognized (server just got it totally wrong), then go by the - # encoding given in the XML prefix of the document and default to - # 'iso-8859-1' as per the HTTP specification (RFC 2616). - - # Then, assuming we didn't find a character encoding in the HTTP headers - # (and the HTTP Content-type allowed us to look in the body), we need - # to sniff the first few bytes of the XML data and try to determine - # whether the encoding is ASCII-compatible. Section F of the XML - # specification shows the way here: - # http://www.w3.org/TR/REC-xml/#sec-guessing-no-ext-info - - # If the sniffed encoding is not ASCII-compatible, we need to make it - # ASCII compatible so that we can sniff further into the XML declaration - # to find the encoding attribute, which will tell us the true encoding. - - # Of course, none of this guarantees that we will be able to parse the - # feed in the declared character encoding (assuming it was declared - # correctly, which many are not). iconv_codec can help a lot; - # you should definitely install it if you can. - # http://cjkpython.i18n.org/ - - bom_encoding = u'' - xml_encoding = u'' - rfc3023_encoding = u'' - - # Look at the first few bytes of the document to guess what - # its encoding may be. We only need to decode enough of the - # document that we can use an ASCII-compatible regular - # expression to search for an XML encoding declaration. - # The heuristic follows the XML specification, section F: - # http://www.w3.org/TR/REC-xml/#sec-guessing-no-ext-info - # Check for BOMs first. - if data[:4] == codecs.BOM_UTF32_BE: - bom_encoding = u'utf-32be' - data = data[4:] - elif data[:4] == codecs.BOM_UTF32_LE: - bom_encoding = u'utf-32le' - data = data[4:] - elif data[:2] == codecs.BOM_UTF16_BE and data[2:4] != ZERO_BYTES: - bom_encoding = u'utf-16be' - data = data[2:] - elif data[:2] == codecs.BOM_UTF16_LE and data[2:4] != ZERO_BYTES: - bom_encoding = u'utf-16le' - data = data[2:] - elif data[:3] == codecs.BOM_UTF8: - bom_encoding = u'utf-8' - data = data[3:] - # Check for the characters '''' - if RE_XML_DECLARATION.search(data): - data = RE_XML_DECLARATION.sub(new_declaration, data) - else: - data = new_declaration + u'\n' + data - data = data.encode('utf-8') - break - # if still no luck, give up - if not known_encoding: - error = CharacterEncodingUnknown( - 'document encoding unknown, I tried ' + - '%s, %s, utf-8, windows-1252, and iso-8859-2 but nothing worked' % - (rfc3023_encoding, xml_encoding)) - rfc3023_encoding = u'' - elif proposed_encoding != rfc3023_encoding: - error = CharacterEncodingOverride( - 'document declared as %s, but parsed as %s' % - (rfc3023_encoding, proposed_encoding)) - rfc3023_encoding = proposed_encoding - - return data, rfc3023_encoding, error - -# Match XML entity declarations. -# Example: -RE_ENTITY_PATTERN = re.compile(_s2bytes(r'^\s*]*?)>'), re.MULTILINE) - -# Match XML DOCTYPE declarations. -# Example: -RE_DOCTYPE_PATTERN = re.compile(_s2bytes(r'^\s*]*?)>'), re.MULTILINE) - -# Match safe entity declarations. -# This will allow hexadecimal character references through, -# as well as text, but not arbitrary nested entities. -# Example: cubed "³" -# Example: copyright "(C)" -# Forbidden: explode1 "&explode2;&explode2;" -RE_SAFE_ENTITY_PATTERN = re.compile(_s2bytes('\s+(\w+)\s+"(&#\w+;|[^&"]*)"')) - -def replace_doctype(data): - '''Strips and replaces the DOCTYPE, returns (rss_version, stripped_data) - - rss_version may be 'rss091n' or None - stripped_data is the same XML document with a replaced DOCTYPE - ''' - - # Divide the document into two groups by finding the location - # of the first element that doesn't begin with '\n\n]>') - data = RE_DOCTYPE_PATTERN.sub(replacement, head) + data - - # Precompute the safe entities for the loose parser. - safe_entities = dict((k.decode('utf-8'), v.decode('utf-8')) - for k, v in RE_SAFE_ENTITY_PATTERN.findall(replacement)) - return version, data, safe_entities - -def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None, handlers=None, request_headers=None, response_headers=None): - '''Parse a feed from a URL, file, stream, or string. - - request_headers, if given, is a dict from http header name to value to add - to the request; this overrides internally generated values. - ''' - - if handlers is None: - handlers = [] - if request_headers is None: - request_headers = {} - if response_headers is None: - response_headers = {} - - result = FeedParserDict() - result['feed'] = FeedParserDict() - result['entries'] = [] - result['bozo'] = 0 - if not isinstance(handlers, list): - handlers = [handlers] - try: - f = _open_resource(url_file_stream_or_string, etag, modified, agent, referrer, handlers, request_headers) - data = f.read() - except Exception as e: - result['bozo'] = 1 - result['bozo_exception'] = e - data = None - f = None - - if hasattr(f, 'headers'): - result['headers'] = dict(f.headers) - # overwrite existing headers using response_headers - if 'headers' in result: - result['headers'].update(response_headers) - elif response_headers: - result['headers'] = copy.deepcopy(response_headers) - - # lowercase all of the HTTP headers for comparisons per RFC 2616 - if 'headers' in result: - http_headers = dict((k.lower(), v) for k, v in result['headers'].items()) - else: - http_headers = {} - - # if feed is gzip-compressed, decompress it - if f and data and http_headers: - if gzip and 'gzip' in http_headers.get('content-encoding', ''): - try: - data = gzip.GzipFile(fileobj=_StringIO(data)).read() - except (IOError, struct.error) as e: - # IOError can occur if the gzip header is bad. - # struct.error can occur if the data is damaged. - result['bozo'] = 1 - result['bozo_exception'] = e - if isinstance(e, struct.error): - # A gzip header was found but the data is corrupt. - # Ideally, we should re-request the feed without the - # 'Accept-encoding: gzip' header, but we don't. - data = None - elif zlib and 'deflate' in http_headers.get('content-encoding', ''): - try: - data = zlib.decompress(data) - except zlib.error as e: - try: - # The data may have no headers and no checksum. - data = zlib.decompress(data, -15) - except zlib.error as e: - result['bozo'] = 1 - result['bozo_exception'] = e - - # save HTTP headers - if http_headers: - if 'etag' in http_headers: - etag = http_headers.get('etag', u'') - if not isinstance(etag, unicode): - etag = etag.decode('utf-8', 'ignore') - if etag: - result['etag'] = etag - if 'last-modified' in http_headers: - modified = http_headers.get('last-modified', u'') - if modified: - result['modified'] = modified - result['modified_parsed'] = _parse_date(modified) - if hasattr(f, 'url'): - if not isinstance(f.url, unicode): - result['href'] = f.url.decode('utf-8', 'ignore') - else: - result['href'] = f.url - result['status'] = 200 - if hasattr(f, 'status'): - result['status'] = f.status - if hasattr(f, 'close'): - f.close() - - if data is None: - return result - - # Stop processing if the server sent HTTP 304 Not Modified. - if getattr(f, 'code', 0) == 304: - result['version'] = u'' - result['debug_message'] = 'The feed has not changed since you last checked, ' + \ - 'so the server sent no data. This is a feature, not a bug!' - return result - - data, result['encoding'], error = convert_to_utf8(http_headers, data) - use_strict_parser = result['encoding'] and True or False - if error is not None: - result['bozo'] = 1 - result['bozo_exception'] = error - - result['version'], data, entities = replace_doctype(data) - - # Ensure that baseuri is an absolute URI using an acceptable URI scheme. - contentloc = http_headers.get('content-location', u'') - href = result.get('href', u'') - baseuri = _makeSafeAbsoluteURI(href, contentloc) or _makeSafeAbsoluteURI(contentloc) or href - - baselang = http_headers.get('content-language', None) - if not isinstance(baselang, unicode) and baselang is not None: - baselang = baselang.decode('utf-8', 'ignore') - - if not _XML_AVAILABLE: - use_strict_parser = 0 - if use_strict_parser: - # initialize the SAX parser - feedparser = _StrictFeedParser(baseuri, baselang, 'utf-8') - saxparser = xml.sax.make_parser(PREFERRED_XML_PARSERS) - saxparser.setFeature(xml.sax.handler.feature_namespaces, 1) - try: - # disable downloading external doctype references, if possible - saxparser.setFeature(xml.sax.handler.feature_external_ges, 0) - except xml.sax.SAXNotSupportedException: - pass - saxparser.setContentHandler(feedparser) - saxparser.setErrorHandler(feedparser) - source = xml.sax.xmlreader.InputSource() - source.setByteStream(_StringIO(data)) - try: - saxparser.parse(source) - except xml.sax.SAXException as e: - result['bozo'] = 1 - result['bozo_exception'] = feedparser.exc or e - use_strict_parser = 0 - if not use_strict_parser: - feedparser = _LooseFeedParser(baseuri, baselang, 'utf-8', entities) - feedparser.feed(data.decode('utf-8', 'replace')) - result['feed'] = feedparser.feeddata - result['entries'] = feedparser.entries - result['version'] = result['version'] or feedparser.version - result['namespaces'] = feedparser.namespacesInUse - return result From d436e2d7565d1f7ea7c97e0020b16f347e2800e7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 7 Feb 2019 11:04:51 +0530 Subject: [PATCH 0213/2613] Add a build test for feedparser --- src/calibre/test_build.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index 47b991868b..c38baac7bf 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -275,6 +275,14 @@ class BuildTest(unittest.TestCase): from calibre.library.comments import sanitize_comments_html sanitize_comments_html(b'''xxx''') + def test_feedparser(self): + from calibre.web.feeds.feedparser import parse + # sgmllib is needed for feedparser parsing malformed feeds + # on python3 you can get it by taking it from python2 stdlib and + # running 2to3 on it + import sgmllib + sgmllib, parse + def test_openssl(self): import ssl ssl.PROTOCOL_TLSv1_2 From 87ff440f74db647c73a0de6654f7e9e110458f3b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 7 Feb 2019 13:19:01 +0530 Subject: [PATCH 0214/2613] TXT Input: Use markdown 3.0 with support for new extensions such as code highlighting and smarten punctuation. Fixes #927 (Devendor markdown and feedparser) --- .../ebooks/conversion/plugins/txt_input.py | 7 +- src/calibre/ebooks/markdown/__init__.py | 533 ---------------- src/calibre/ebooks/markdown/__main__.py | 136 ----- src/calibre/ebooks/markdown/__version__.py | 29 - src/calibre/ebooks/markdown/blockparser.py | 100 --- .../ebooks/markdown/blockprocessors.py | 572 ------------------ .../ebooks/markdown/extensions/__init__.py | 100 --- .../ebooks/markdown/extensions/abbr.py | 91 --- .../ebooks/markdown/extensions/admonition.py | 96 --- .../ebooks/markdown/extensions/attr_list.py | 177 ------ .../ebooks/markdown/extensions/codehilite.py | 265 -------- .../ebooks/markdown/extensions/def_list.py | 115 ---- .../ebooks/markdown/extensions/extra.py | 132 ---- .../ebooks/markdown/extensions/fenced_code.py | 112 ---- .../ebooks/markdown/extensions/footnotes.py | 321 ---------- .../ebooks/markdown/extensions/headerid.py | 97 --- .../ebooks/markdown/extensions/meta.py | 78 --- .../ebooks/markdown/extensions/nl2br.py | 35 -- .../ebooks/markdown/extensions/sane_lists.py | 55 -- .../markdown/extensions/smart_strong.py | 41 -- .../ebooks/markdown/extensions/tables.py | 149 ----- src/calibre/ebooks/markdown/extensions/toc.py | 309 ---------- .../ebooks/markdown/extensions/wikilinks.py | 89 --- src/calibre/ebooks/markdown/inlinepatterns.py | 529 ---------------- src/calibre/ebooks/markdown/odict.py | 191 ------ src/calibre/ebooks/markdown/postprocessors.py | 108 ---- src/calibre/ebooks/markdown/preprocessors.py | 346 ----------- src/calibre/ebooks/markdown/serializers.py | 282 --------- src/calibre/ebooks/markdown/treeprocessors.py | 371 ------------ src/calibre/ebooks/markdown/util.py | 177 ------ src/calibre/startup.py | 5 +- 31 files changed, 9 insertions(+), 5639 deletions(-) delete mode 100644 src/calibre/ebooks/markdown/__init__.py delete mode 100644 src/calibre/ebooks/markdown/__main__.py delete mode 100644 src/calibre/ebooks/markdown/__version__.py delete mode 100644 src/calibre/ebooks/markdown/blockparser.py delete mode 100644 src/calibre/ebooks/markdown/blockprocessors.py delete mode 100644 src/calibre/ebooks/markdown/extensions/__init__.py delete mode 100644 src/calibre/ebooks/markdown/extensions/abbr.py delete mode 100644 src/calibre/ebooks/markdown/extensions/admonition.py delete mode 100644 src/calibre/ebooks/markdown/extensions/attr_list.py delete mode 100644 src/calibre/ebooks/markdown/extensions/codehilite.py delete mode 100644 src/calibre/ebooks/markdown/extensions/def_list.py delete mode 100644 src/calibre/ebooks/markdown/extensions/extra.py delete mode 100644 src/calibre/ebooks/markdown/extensions/fenced_code.py delete mode 100644 src/calibre/ebooks/markdown/extensions/footnotes.py delete mode 100644 src/calibre/ebooks/markdown/extensions/headerid.py delete mode 100644 src/calibre/ebooks/markdown/extensions/meta.py delete mode 100644 src/calibre/ebooks/markdown/extensions/nl2br.py delete mode 100644 src/calibre/ebooks/markdown/extensions/sane_lists.py delete mode 100644 src/calibre/ebooks/markdown/extensions/smart_strong.py delete mode 100644 src/calibre/ebooks/markdown/extensions/tables.py delete mode 100644 src/calibre/ebooks/markdown/extensions/toc.py delete mode 100644 src/calibre/ebooks/markdown/extensions/wikilinks.py delete mode 100644 src/calibre/ebooks/markdown/inlinepatterns.py delete mode 100644 src/calibre/ebooks/markdown/odict.py delete mode 100644 src/calibre/ebooks/markdown/postprocessors.py delete mode 100644 src/calibre/ebooks/markdown/preprocessors.py delete mode 100644 src/calibre/ebooks/markdown/serializers.py delete mode 100644 src/calibre/ebooks/markdown/treeprocessors.py delete mode 100644 src/calibre/ebooks/markdown/util.py diff --git a/src/calibre/ebooks/conversion/plugins/txt_input.py b/src/calibre/ebooks/conversion/plugins/txt_input.py index 4c09919201..bf12f3247a 100644 --- a/src/calibre/ebooks/conversion/plugins/txt_input.py +++ b/src/calibre/ebooks/conversion/plugins/txt_input.py @@ -14,12 +14,17 @@ MD_EXTENSIONS = { 'abbr': _('Abbreviations'), 'admonition': _('Support admonitions'), 'attr_list': _('Add attribute to HTML tags'), + 'codehilite': _('Add code highlighting via Pygments'), 'def_list': _('Definition lists'), 'extra': _('Enables various common extensions'), 'fenced_code': _('Alternative code block syntax'), 'footnotes': _('Footnotes'), - 'headerid': _('Allow ids as part of a header'), + 'legacy_attrs': _('Use legacy element attributes'), + 'legacy_em': _('Use legacy underscore handling for connected words'), 'meta': _('Metadata in the document'), + 'nl2br': _('Treat newlines as hard breaks'), + 'sane_lists': _('Do not allow mixing list types'), + 'smarty': _('Use markdown\'s internal smartypants parser'), 'tables': _('Support tables'), 'toc': _('Generate a table of contents'), 'wikilinks': _('Wiki style links'), diff --git a/src/calibre/ebooks/markdown/__init__.py b/src/calibre/ebooks/markdown/__init__.py deleted file mode 100644 index 332752e501..0000000000 --- a/src/calibre/ebooks/markdown/__init__.py +++ /dev/null @@ -1,533 +0,0 @@ -""" -Python Markdown -=============== - -Python Markdown converts Markdown to HTML and can be used as a library or -called from the command line. - -## Basic usage as a module: - - import markdown - html = markdown.markdown(your_text_string) - -See for more -information and instructions on how to extend the functionality of -Python Markdown. Read that before you try modifying this file. - -## Authors and License - -Started by [Manfred Stienstra](http://www.dwerg.net/). Continued and -maintained by [Yuri Takhteyev](http://www.freewisdom.org), [Waylan -Limberg](http://achinghead.com/) and [Artem Yunusov](http://blog.splyer.com). - -Contact: markdown@freewisdom.org - -Copyright 2007-2013 The Python Markdown Project (v. 1.7 and later) -Copyright 200? Django Software Foundation (OrderedDict implementation) -Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) -Copyright 2004 Manfred Stienstra (the original version) - -License: BSD (see LICENSE for details). -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from .__version__ import version, version_info # noqa -import codecs -import sys -import logging -import warnings -import importlib -from . import util -from .preprocessors import build_preprocessors -from .blockprocessors import build_block_parser -from .treeprocessors import build_treeprocessors -from .inlinepatterns import build_inlinepatterns -from .postprocessors import build_postprocessors -from .extensions import Extension -from .serializers import to_html_string, to_xhtml_string - -__all__ = ['Markdown', 'markdown', 'markdownFromFile'] - - -logger = logging.getLogger('MARKDOWN') - - -class Markdown(object): - """Convert Markdown to HTML.""" - - doc_tag = "div" # Element used to wrap document - later removed - - option_defaults = { - 'html_replacement_text': '[HTML_REMOVED]', - 'tab_length': 4, - 'enable_attributes': True, - 'smart_emphasis': True, - 'lazy_ol': True, - } - - output_formats = { - 'html': to_html_string, - 'html4': to_html_string, - 'html5': to_html_string, - 'xhtml': to_xhtml_string, - 'xhtml1': to_xhtml_string, - 'xhtml5': to_xhtml_string, - } - - ESCAPED_CHARS = ['\\', '`', '*', '_', '{', '}', '[', ']', - '(', ')', '>', '#', '+', '-', '.', '!'] - - def __init__(self, *args, **kwargs): - """ - Creates a new Markdown instance. - - Keyword arguments: - - * extensions: A list of extensions. - If they are of type string, the module mdx_name.py will be loaded. - If they are a subclass of markdown.Extension, they will be used - as-is. - * extension_configs: Configuration settings for extensions. - * output_format: Format of output. Supported formats are: - * "xhtml1": Outputs XHTML 1.x. Default. - * "xhtml5": Outputs XHTML style tags of HTML 5 - * "xhtml": Outputs latest supported version of XHTML - (currently XHTML 1.1). - * "html4": Outputs HTML 4 - * "html5": Outputs HTML style tags of HTML 5 - * "html": Outputs latest supported version of HTML - (currently HTML 4). - Note that it is suggested that the more specific formats ("xhtml1" - and "html4") be used as "xhtml" or "html" may change in the future - if it makes sense at that time. - * safe_mode: Deprecated! Disallow raw html. One of "remove", "replace" - or "escape". - * html_replacement_text: Deprecated! Text used when safe_mode is set - to "replace". - * tab_length: Length of tabs in the source. Default: 4 - * enable_attributes: Enable the conversion of attributes. Default: True - * smart_emphasis: Treat `_connected_words_` intelligently Default: True - * lazy_ol: Ignore number of first item of ordered lists. Default: True - - """ - - # For backward compatibility, loop through old positional args - pos = ['extensions', 'extension_configs', 'safe_mode', 'output_format'] - for c, arg in enumerate(args): - if pos[c] not in kwargs: - kwargs[pos[c]] = arg - if c+1 == len(pos): # pragma: no cover - # ignore any additional args - break - if len(args): - warnings.warn('Positional arguments are deprecated in Markdown. ' - 'Use keyword arguments only.', - DeprecationWarning) - - # Loop through kwargs and assign defaults - for option, default in self.option_defaults.items(): - setattr(self, option, kwargs.get(option, default)) - - self.safeMode = kwargs.get('safe_mode', False) - if self.safeMode and 'enable_attributes' not in kwargs: - # Disable attributes in safeMode when not explicitly set - self.enable_attributes = False - - if 'safe_mode' in kwargs: - warnings.warn('"safe_mode" is deprecated in Python-Markdown. ' - 'Use an HTML sanitizer (like ' - 'Bleach http://bleach.readthedocs.org/) ' - 'if you are parsing untrusted markdown text. ' - 'See the 2.6 release notes for more info', - DeprecationWarning) - - if 'html_replacement_text' in kwargs: - warnings.warn('The "html_replacement_text" keyword is ' - 'deprecated along with "safe_mode".', - DeprecationWarning) - - self.registeredExtensions = [] - self.docType = "" - self.stripTopLevelTags = True - - self.build_parser() - - self.references = {} - self.htmlStash = util.HtmlStash() - self.registerExtensions(extensions=kwargs.get('extensions', []), - configs=kwargs.get('extension_configs', {})) - self.set_output_format(kwargs.get('output_format', 'xhtml1')) - self.reset() - - def build_parser(self): - """ Build the parser from the various parts. """ - self.preprocessors = build_preprocessors(self) - self.parser = build_block_parser(self) - self.inlinePatterns = build_inlinepatterns(self) - self.treeprocessors = build_treeprocessors(self) - self.postprocessors = build_postprocessors(self) - return self - - def registerExtensions(self, extensions, configs): - """ - Register extensions with this instance of Markdown. - - Keyword arguments: - - * extensions: A list of extensions, which can either - be strings or objects. See the docstring on Markdown. - * configs: A dictionary mapping module names to config options. - - """ - for ext in extensions: - if isinstance(ext, util.string_type): - ext = self.build_extension(ext, configs.get(ext, {})) - if isinstance(ext, Extension): - ext.extendMarkdown(self, globals()) - logger.debug( - 'Successfully loaded extension "%s.%s".' - % (ext.__class__.__module__, ext.__class__.__name__) - ) - elif ext is not None: - raise TypeError( - 'Extension "%s.%s" must be of type: "markdown.Extension"' - % (ext.__class__.__module__, ext.__class__.__name__)) - - return self - - def build_extension(self, ext_name, configs): - """Build extension by name, then return the module. - - The extension name may contain arguments as part of the string in the - following format: "extname(key1=value1,key2=value2)" - - """ - - configs = dict(configs) - - # Parse extensions config params (ignore the order) - pos = ext_name.find("(") # find the first "(" - if pos > 0: - ext_args = ext_name[pos+1:-1] - ext_name = ext_name[:pos] - pairs = [x.split("=") for x in ext_args.split(",")] - configs.update([(x.strip(), y.strip()) for (x, y) in pairs]) - warnings.warn('Setting configs in the Named Extension string is ' - 'deprecated. It is recommended that you ' - 'pass an instance of the extension class to ' - 'Markdown or use the "extension_configs" keyword. ' - 'The current behavior will raise an error in version 2.7. ' - 'See the Release Notes for Python-Markdown version ' - '2.6 for more info.', DeprecationWarning) - - # Get class name (if provided): `path.to.module:ClassName` - ext_name, class_name = ext_name.split(':', 1) \ - if ':' in ext_name else (ext_name, '') - if '.' not in ext_name: - ext_name = 'markdown.extensions.' + ext_name - if ext_name.startswith('markdown.'): - ext_name = 'calibre.ebooks.' + ext_name - - # Try loading the extension first from one place, then another - try: - # Assume string uses dot syntax (`path.to.some.module`) - module = importlib.import_module(ext_name) - logger.debug( - 'Successfuly imported extension module "%s".' % ext_name - ) - # For backward compat (until deprecation) - # check that this is an extension. - if ('.' not in ext_name and not (hasattr(module, 'makeExtension') or - (class_name and hasattr(module, class_name)))): - # We have a name conflict - # eg: extensions=['tables'] and PyTables is installed - raise ImportError - except ImportError: - # Preppend `markdown.extensions.` to name - module_name = '.'.join(['markdown.extensions', ext_name]) - try: - module = importlib.import_module(module_name) - logger.debug( - 'Successfuly imported extension module "%s".' % - module_name - ) - warnings.warn('Using short names for Markdown\'s builtin ' - 'extensions is deprecated. Use the ' - 'full path to the extension with Python\'s dot ' - 'notation (eg: "%s" instead of "%s"). The ' - 'current behavior will raise an error in version ' - '2.7. See the Release Notes for ' - 'Python-Markdown version 2.6 for more info.' % - (module_name, ext_name), - DeprecationWarning) - except ImportError: - # Preppend `mdx_` to name - module_name_old_style = '_'.join(['mdx', ext_name]) - try: - module = importlib.import_module(module_name_old_style) - logger.debug( - 'Successfuly imported extension module "%s".' % - module_name_old_style) - warnings.warn('Markdown\'s behavior of prepending "mdx_" ' - 'to an extension name is deprecated. ' - 'Use the full path to the ' - 'extension with Python\'s dot notation ' - '(eg: "%s" instead of "%s"). The current ' - 'behavior will raise an error in version 2.7. ' - 'See the Release Notes for Python-Markdown ' - 'version 2.6 for more info.' % - (module_name_old_style, ext_name), - DeprecationWarning) - except ImportError as e: - message = "Failed loading extension '%s' from '%s', '%s' " \ - "or '%s'" % (ext_name, ext_name, module_name, - module_name_old_style) - e.args = (message,) + e.args[1:] - raise - - if class_name: - # Load given class name from module. - return getattr(module, class_name)(**configs) - else: - # Expect makeExtension() function to return a class. - try: - return module.makeExtension(**configs) - except AttributeError as e: - message = e.args[0] - message = "Failed to initiate extension " \ - "'%s': %s" % (ext_name, message) - e.args = (message,) + e.args[1:] - raise - - def registerExtension(self, extension): - """ This gets called by the extension """ - self.registeredExtensions.append(extension) - return self - - def reset(self): - """ - Resets all state variables so that we can start with a new text. - """ - self.htmlStash.reset() - self.references.clear() - - for extension in self.registeredExtensions: - if hasattr(extension, 'reset'): - extension.reset() - - return self - - def set_output_format(self, format): - """ Set the output format for the class instance. """ - self.output_format = format.lower() - try: - self.serializer = self.output_formats[self.output_format] - except KeyError as e: - valid_formats = list(self.output_formats.keys()) - valid_formats.sort() - message = 'Invalid Output Format: "%s". Use one of %s.' \ - % (self.output_format, - '"' + '", "'.join(valid_formats) + '"') - e.args = (message,) + e.args[1:] - raise - return self - - def convert(self, source): - """ - Convert markdown to serialized XHTML or HTML. - - Keyword arguments: - - * source: Source text as a Unicode string. - - Markdown processing takes place in five steps: - - 1. A bunch of "preprocessors" munge the input text. - 2. BlockParser() parses the high-level structural elements of the - pre-processed text into an ElementTree. - 3. A bunch of "treeprocessors" are run against the ElementTree. One - such treeprocessor runs InlinePatterns against the ElementTree, - detecting inline markup. - 4. Some post-processors are run against the text after the ElementTree - has been serialized into text. - 5. The output is written to a string. - - """ - - # Fixup the source text - if not source.strip(): - return '' # a blank unicode string - - try: - source = util.text_type(source) - except UnicodeDecodeError as e: - # Customise error message while maintaining original trackback - e.reason += '. -- Note: Markdown only accepts unicode input!' - raise - - # Split into lines and run the line preprocessors. - self.lines = source.split("\n") - for prep in self.preprocessors.values(): - self.lines = prep.run(self.lines) - - # Parse the high-level elements. - root = self.parser.parseDocument(self.lines).getroot() - - # Run the tree-processors - for treeprocessor in self.treeprocessors.values(): - newRoot = treeprocessor.run(root) - if newRoot is not None: - root = newRoot - - # Serialize _properly_. Strip top-level tags. - output = self.serializer(root) - if self.stripTopLevelTags: - try: - start = output.index( - '<%s>' % self.doc_tag) + len(self.doc_tag) + 2 - end = output.rindex('' % self.doc_tag) - output = output[start:end].strip() - except ValueError: # pragma: no cover - if output.strip().endswith('<%s />' % self.doc_tag): - # We have an empty document - output = '' - else: - # We have a serious problem - raise ValueError('Markdown failed to strip top-level ' - 'tags. Document=%r' % output.strip()) - - # Run the text post-processors - for pp in self.postprocessors.values(): - output = pp.run(output) - - return output.strip() - - def convertFile(self, input=None, output=None, encoding=None): - """Converts a Markdown file and returns the HTML as a Unicode string. - - Decodes the file using the provided encoding (defaults to utf-8), - passes the file content to markdown, and outputs the html to either - the provided stream or the file with provided name, using the same - encoding as the source file. The 'xmlcharrefreplace' error handler is - used when encoding the output. - - **Note:** This is the only place that decoding and encoding of Unicode - takes place in Python-Markdown. (All other code is Unicode-in / - Unicode-out.) - - Keyword arguments: - - * input: File object or path. Reads from stdin if `None`. - * output: File object or path. Writes to stdout if `None`. - * encoding: Encoding of input and output files. Defaults to utf-8. - - """ - - encoding = encoding or "utf-8" - - # Read the source - if input: - if isinstance(input, util.string_type): - input_file = codecs.open(input, mode="r", encoding=encoding) - else: - input_file = codecs.getreader(encoding)(input) - text = input_file.read() - input_file.close() - else: - text = sys.stdin.read() - if not isinstance(text, util.text_type): - text = text.decode(encoding) - - text = text.lstrip('\ufeff') # remove the byte-order mark - - # Convert - html = self.convert(text) - - # Write to file or stdout - if output: - if isinstance(output, util.string_type): - output_file = codecs.open(output, "w", - encoding=encoding, - errors="xmlcharrefreplace") - output_file.write(html) - output_file.close() - else: - writer = codecs.getwriter(encoding) - output_file = writer(output, errors="xmlcharrefreplace") - output_file.write(html) - # Don't close here. User may want to write more. - else: - # Encode manually and write bytes to stdout. - html = html.encode(encoding, "xmlcharrefreplace") - try: - # Write bytes directly to buffer (Python 3). - sys.stdout.buffer.write(html) - except AttributeError: - # Probably Python 2, which works with bytes by default. - sys.stdout.write(html) - - return self - - -""" -EXPORTED FUNCTIONS -============================================================================= - -Those are the two functions we really mean to export: markdown() and -markdownFromFile(). -""" - - -def markdown(text, *args, **kwargs): - """Convert a Markdown string to HTML and return HTML as a Unicode string. - - This is a shortcut function for `Markdown` class to cover the most - basic use case. It initializes an instance of Markdown, loads the - necessary extensions and runs the parser on the given text. - - Keyword arguments: - - * text: Markdown formatted text as Unicode or ASCII string. - * Any arguments accepted by the Markdown class. - - Returns: An HTML document as a string. - - """ - md = Markdown(*args, **kwargs) - return md.convert(text) - - -def markdownFromFile(*args, **kwargs): - """Read markdown code from a file and write it to a file or a stream. - - This is a shortcut function which initializes an instance of Markdown, - and calls the convertFile method rather than convert. - - Keyword arguments: - - * input: a file name or readable object. - * output: a file name or writable object. - * encoding: Encoding of input and output. - * Any arguments accepted by the Markdown class. - - """ - # For backward compatibility loop through positional args - pos = ['input', 'output', 'extensions', 'encoding'] - c = 0 - for arg in args: - if pos[c] not in kwargs: - kwargs[pos[c]] = arg - c += 1 - if c == len(pos): - break - if len(args): - warnings.warn('Positional arguments are depreacted in ' - 'Markdown and will raise an error in version 2.7. ' - 'Use keyword arguments only.', - DeprecationWarning) - - md = Markdown(**kwargs) - md.convertFile(kwargs.get('input', None), - kwargs.get('output', None), - kwargs.get('encoding', None)) diff --git a/src/calibre/ebooks/markdown/__main__.py b/src/calibre/ebooks/markdown/__main__.py deleted file mode 100644 index 7c1f54a64b..0000000000 --- a/src/calibre/ebooks/markdown/__main__.py +++ /dev/null @@ -1,136 +0,0 @@ -""" -COMMAND-LINE SPECIFIC STUFF -============================================================================= - -""" - -import sys -import optparse -import codecs -import warnings -import calibre.ebooks.markdown as markdown -try: - import yaml -except ImportError: # pragma: no cover - import json as yaml - -import logging -from logging import DEBUG, WARNING, CRITICAL - -logger = logging.getLogger('MARKDOWN') - - -def parse_options(args=None, values=None): - """ - Define and parse `optparse` options for command-line usage. - """ - usage = """%prog [options] [INPUTFILE] - (STDIN is assumed if no INPUTFILE is given)""" - desc = "A Python implementation of John Gruber's Markdown. " \ - "https://pythonhosted.org/Markdown/" - ver = "%%prog %s" % markdown.version - - parser = optparse.OptionParser(usage=usage, description=desc, version=ver) - parser.add_option("-f", "--file", dest="filename", default=None, - help="Write output to OUTPUT_FILE. Defaults to STDOUT.", - metavar="OUTPUT_FILE") - parser.add_option("-e", "--encoding", dest="encoding", - help="Encoding for input and output files.",) - parser.add_option("-s", "--safe", dest="safe", default=False, - metavar="SAFE_MODE", - help="Deprecated! 'replace', 'remove' or 'escape' HTML " - "tags in input") - parser.add_option("-o", "--output_format", dest="output_format", - default='xhtml1', metavar="OUTPUT_FORMAT", - help="'xhtml1' (default), 'html4' or 'html5'.") - parser.add_option("-n", "--no_lazy_ol", dest="lazy_ol", - action='store_false', default=True, - help="Observe number of first item of ordered lists.") - parser.add_option("-x", "--extension", action="append", dest="extensions", - help="Load extension EXTENSION.", metavar="EXTENSION") - parser.add_option("-c", "--extension_configs", - dest="configfile", default=None, - help="Read extension configurations from CONFIG_FILE. " - "CONFIG_FILE must be of JSON or YAML format. YAML" - "format requires that a python YAML library be " - "installed. The parsed JSON or YAML must result in a " - "python dictionary which would be accepted by the " - "'extension_configs' keyword on the markdown.Markdown " - "class. The extensions must also be loaded with the " - "`--extension` option.", - metavar="CONFIG_FILE") - parser.add_option("-q", "--quiet", default=CRITICAL, - action="store_const", const=CRITICAL+10, dest="verbose", - help="Suppress all warnings.") - parser.add_option("-v", "--verbose", - action="store_const", const=WARNING, dest="verbose", - help="Print all warnings.") - parser.add_option("--noisy", - action="store_const", const=DEBUG, dest="verbose", - help="Print debug messages.") - - (options, args) = parser.parse_args(args, values) - - if len(args) == 0: - input_file = None - else: - input_file = args[0] - - if not options.extensions: - options.extensions = [] - - extension_configs = {} - if options.configfile: - with codecs.open( - options.configfile, mode="r", encoding=options.encoding - ) as fp: - try: - extension_configs = yaml.load(fp) - except Exception as e: - message = "Failed parsing extension config file: %s" % \ - options.configfile - e.args = (message,) + e.args[1:] - raise - - opts = { - 'input': input_file, - 'output': options.filename, - 'extensions': options.extensions, - 'extension_configs': extension_configs, - 'encoding': options.encoding, - 'output_format': options.output_format, - 'lazy_ol': options.lazy_ol - } - - if options.safe: - # Avoid deprecation warning if user didn't set option - opts['safe_mode'] = options.safe - - return opts, options.verbose - - -def run(): # pragma: no cover - """Run Markdown from the command line.""" - - # Parse options and adjust logging level if necessary - options, logging_level = parse_options() - if not options: - sys.exit(2) - logger.setLevel(logging_level) - console_handler = logging.StreamHandler() - logger.addHandler(console_handler) - if logging_level <= WARNING: - # Ensure deprecation warnings get displayed - warnings.filterwarnings('default') - logging.captureWarnings(True) - warn_logger = logging.getLogger('py.warnings') - warn_logger.addHandler(console_handler) - - # Run - markdown.markdownFromFile(**options) - - -if __name__ == '__main__': # pragma: no cover - # Support running module as a commandline command. - # Python 2.7 & 3.x do: `python -m markdown [options] [args]`. - run() diff --git a/src/calibre/ebooks/markdown/__version__.py b/src/calibre/ebooks/markdown/__version__.py deleted file mode 100644 index f7c109988b..0000000000 --- a/src/calibre/ebooks/markdown/__version__.py +++ /dev/null @@ -1,29 +0,0 @@ -# -# markdown/__version__.py -# -# version_info should conform to PEP 386 -# (major, minor, micro, alpha/beta/rc/final, #) -# (1, 1, 2, 'alpha', 0) => "1.1.2.dev" -# (1, 2, 0, 'beta', 2) => "1.2b2" -version_info = (2, 6, 3, 'final', 0) - - -def _get_version(): - " Returns a PEP 386-compliant version number from version_info. " - assert len(version_info) == 5 - assert version_info[3] in ('alpha', 'beta', 'rc', 'final') - - parts = 2 if version_info[2] == 0 else 3 - main = '.'.join(map(str, version_info[:parts])) - - sub = '' - if version_info[3] == 'alpha' and version_info[4] == 0: - # TODO: maybe append some sort of git info here?? - sub = '.dev' - elif version_info[3] != 'final': - mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'} - sub = mapping[version_info[3]] + str(version_info[4]) - - return str(main + sub) - -version = _get_version() diff --git a/src/calibre/ebooks/markdown/blockparser.py b/src/calibre/ebooks/markdown/blockparser.py deleted file mode 100644 index 32d3254cdf..0000000000 --- a/src/calibre/ebooks/markdown/blockparser.py +++ /dev/null @@ -1,100 +0,0 @@ -from __future__ import unicode_literals -from __future__ import absolute_import -from . import util -from . import odict - - -class State(list): - """ Track the current and nested state of the parser. - - This utility class is used to track the state of the BlockParser and - support multiple levels if nesting. It's just a simple API wrapped around - a list. Each time a state is set, that state is appended to the end of the - list. Each time a state is reset, that state is removed from the end of - the list. - - Therefore, each time a state is set for a nested block, that state must be - reset when we back out of that level of nesting or the state could be - corrupted. - - While all the methods of a list object are available, only the three - defined below need be used. - - """ - - def set(self, state): - """ Set a new state. """ - self.append(state) - - def reset(self): - """ Step back one step in nested state. """ - self.pop() - - def isstate(self, state): - """ Test that top (current) level is of given state. """ - if len(self): - return self[-1] == state - else: - return False - - -class BlockParser: - """ Parse Markdown blocks into an ElementTree object. - - A wrapper class that stitches the various BlockProcessors together, - looping through them and creating an ElementTree object. - """ - - def __init__(self, markdown): - self.blockprocessors = odict.OrderedDict() - self.state = State() - self.markdown = markdown - - def parseDocument(self, lines): - """ Parse a markdown document into an ElementTree. - - Given a list of lines, an ElementTree object (not just a parent - Element) is created and the root element is passed to the parser - as the parent. The ElementTree object is returned. - - This should only be called on an entire document, not pieces. - - """ - # Create a ElementTree from the lines - self.root = util.etree.Element(self.markdown.doc_tag) - self.parseChunk(self.root, '\n'.join(lines)) - return util.etree.ElementTree(self.root) - - def parseChunk(self, parent, text): - """ Parse a chunk of markdown text and attach to given etree node. - - While the ``text`` argument is generally assumed to contain multiple - blocks which will be split on blank lines, it could contain only one - block. Generally, this method would be called by extensions when - block parsing is required. - - The ``parent`` etree Element passed in is altered in place. - Nothing is returned. - - """ - self.parseBlocks(parent, text.split('\n\n')) - - def parseBlocks(self, parent, blocks): - """ Process blocks of markdown text and attach to given etree node. - - Given a list of ``blocks``, each blockprocessor is stepped through - until there are no blocks left. While an extension could potentially - call this method directly, it's generally expected to be used - internally. - - This is a public method as an extension may need to add/alter - additional BlockProcessors which call this method to recursively - parse a nested block. - - """ - while blocks: - for processor in self.blockprocessors.values(): - if processor.test(parent, blocks[0]): - if processor.run(parent, blocks) is not False: - # run returns True or None - break diff --git a/src/calibre/ebooks/markdown/blockprocessors.py b/src/calibre/ebooks/markdown/blockprocessors.py deleted file mode 100644 index 870151bec7..0000000000 --- a/src/calibre/ebooks/markdown/blockprocessors.py +++ /dev/null @@ -1,572 +0,0 @@ -""" -CORE MARKDOWN BLOCKPARSER -=========================================================================== - -This parser handles basic parsing of Markdown blocks. It doesn't concern -itself with inline elements such as **bold** or *italics*, but rather just -catches blocks, lists, quotes, etc. - -The BlockParser is made up of a bunch of BlockProssors, each handling a -different type of block. Extensions may add/replace/remove BlockProcessors -as they need to alter how markdown blocks are parsed. -""" - -from __future__ import absolute_import -from __future__ import division -from __future__ import unicode_literals -import logging -import re -from . import util -from .blockparser import BlockParser - -logger = logging.getLogger('MARKDOWN') - - -def build_block_parser(md_instance, **kwargs): - """ Build the default block parser used by Markdown. """ - parser = BlockParser(md_instance) - parser.blockprocessors['empty'] = EmptyBlockProcessor(parser) - parser.blockprocessors['indent'] = ListIndentProcessor(parser) - parser.blockprocessors['code'] = CodeBlockProcessor(parser) - parser.blockprocessors['hashheader'] = HashHeaderProcessor(parser) - parser.blockprocessors['setextheader'] = SetextHeaderProcessor(parser) - parser.blockprocessors['hr'] = HRProcessor(parser) - parser.blockprocessors['olist'] = OListProcessor(parser) - parser.blockprocessors['ulist'] = UListProcessor(parser) - parser.blockprocessors['quote'] = BlockQuoteProcessor(parser) - parser.blockprocessors['paragraph'] = ParagraphProcessor(parser) - return parser - - -class BlockProcessor(object): - """ Base class for block processors. - - Each subclass will provide the methods below to work with the source and - tree. Each processor will need to define it's own ``test`` and ``run`` - methods. The ``test`` method should return True or False, to indicate - whether the current block should be processed by this processor. If the - test passes, the parser will call the processors ``run`` method. - - """ - - def __init__(self, parser): - self.parser = parser - self.tab_length = parser.markdown.tab_length - - def lastChild(self, parent): - """ Return the last child of an etree element. """ - if len(parent): - return parent[-1] - else: - return None - - def detab(self, text): - """ Remove a tab from the front of each line of the given text. """ - newtext = [] - lines = text.split('\n') - for line in lines: - if line.startswith(' '*self.tab_length): - newtext.append(line[self.tab_length:]) - elif not line.strip(): - newtext.append('') - else: - break - return '\n'.join(newtext), '\n'.join(lines[len(newtext):]) - - def looseDetab(self, text, level=1): - """ Remove a tab from front of lines but allowing dedented lines. """ - lines = text.split('\n') - for i in range(len(lines)): - if lines[i].startswith(' '*self.tab_length*level): - lines[i] = lines[i][self.tab_length*level:] - return '\n'.join(lines) - - def test(self, parent, block): - """ Test for block type. Must be overridden by subclasses. - - As the parser loops through processors, it will call the ``test`` - method on each to determine if the given block of text is of that - type. This method must return a boolean ``True`` or ``False``. The - actual method of testing is left to the needs of that particular - block type. It could be as simple as ``block.startswith(some_string)`` - or a complex regular expression. As the block type may be different - depending on the parent of the block (i.e. inside a list), the parent - etree element is also provided and may be used as part of the test. - - Keywords: - - * ``parent``: A etree element which will be the parent of the block. - * ``block``: A block of text from the source which has been split at - blank lines. - """ - pass # pragma: no cover - - def run(self, parent, blocks): - """ Run processor. Must be overridden by subclasses. - - When the parser determines the appropriate type of a block, the parser - will call the corresponding processor's ``run`` method. This method - should parse the individual lines of the block and append them to - the etree. - - Note that both the ``parent`` and ``etree`` keywords are pointers - to instances of the objects which should be edited in place. Each - processor must make changes to the existing objects as there is no - mechanism to return new/different objects to replace them. - - This means that this method should be adding SubElements or adding text - to the parent, and should remove (``pop``) or add (``insert``) items to - the list of blocks. - - Keywords: - - * ``parent``: A etree element which is the parent of the current block. - * ``blocks``: A list of all remaining blocks of the document. - """ - pass # pragma: no cover - - -class ListIndentProcessor(BlockProcessor): - """ Process children of list items. - - Example: - * a list item - process this part - - or this part - - """ - - ITEM_TYPES = ['li'] - LIST_TYPES = ['ul', 'ol'] - - def __init__(self, *args): - super(ListIndentProcessor, self).__init__(*args) - self.INDENT_RE = re.compile(r'^(([ ]{%s})+)' % self.tab_length) - - def test(self, parent, block): - return block.startswith(' '*self.tab_length) and \ - not self.parser.state.isstate('detabbed') and \ - (parent.tag in self.ITEM_TYPES or - (len(parent) and parent[-1] is not None and - (parent[-1].tag in self.LIST_TYPES))) - - def run(self, parent, blocks): - block = blocks.pop(0) - level, sibling = self.get_level(parent, block) - block = self.looseDetab(block, level) - - self.parser.state.set('detabbed') - if parent.tag in self.ITEM_TYPES: - # It's possible that this parent has a 'ul' or 'ol' child list - # with a member. If that is the case, then that should be the - # parent. This is intended to catch the edge case of an indented - # list whose first member was parsed previous to this point - # see OListProcessor - if len(parent) and parent[-1].tag in self.LIST_TYPES: - self.parser.parseBlocks(parent[-1], [block]) - else: - # The parent is already a li. Just parse the child block. - self.parser.parseBlocks(parent, [block]) - elif sibling.tag in self.ITEM_TYPES: - # The sibling is a li. Use it as parent. - self.parser.parseBlocks(sibling, [block]) - elif len(sibling) and sibling[-1].tag in self.ITEM_TYPES: - # The parent is a list (``ol`` or ``ul``) which has children. - # Assume the last child li is the parent of this block. - if sibling[-1].text: - # If the parent li has text, that text needs to be moved to a p - # The p must be 'inserted' at beginning of list in the event - # that other children already exist i.e.; a nested sublist. - p = util.etree.Element('p') - p.text = sibling[-1].text - sibling[-1].text = '' - sibling[-1].insert(0, p) - self.parser.parseChunk(sibling[-1], block) - else: - self.create_item(sibling, block) - self.parser.state.reset() - - def create_item(self, parent, block): - """ Create a new li and parse the block with it as the parent. """ - li = util.etree.SubElement(parent, 'li') - self.parser.parseBlocks(li, [block]) - - def get_level(self, parent, block): - """ Get level of indent based on list level. """ - # Get indent level - m = self.INDENT_RE.match(block) - if m: - indent_level = len(m.group(1))/self.tab_length - else: - indent_level = 0 - if self.parser.state.isstate('list'): - # We're in a tightlist - so we already are at correct parent. - level = 1 - else: - # We're in a looselist - so we need to find parent. - level = 0 - # Step through children of tree to find matching indent level. - while indent_level > level: - child = self.lastChild(parent) - if (child is not None and - (child.tag in self.LIST_TYPES or child.tag in self.ITEM_TYPES)): - if child.tag in self.LIST_TYPES: - level += 1 - parent = child - else: - # No more child levels. If we're short of indent_level, - # we have a code block. So we stop here. - break - return level, parent - - -class CodeBlockProcessor(BlockProcessor): - """ Process code blocks. """ - - def test(self, parent, block): - return block.startswith(' '*self.tab_length) - - def run(self, parent, blocks): - sibling = self.lastChild(parent) - block = blocks.pop(0) - theRest = '' - if (sibling is not None and sibling.tag == "pre" and - len(sibling) and sibling[0].tag == "code"): - # The previous block was a code block. As blank lines do not start - # new code blocks, append this block to the previous, adding back - # linebreaks removed from the split into a list. - code = sibling[0] - block, theRest = self.detab(block) - code.text = util.AtomicString( - '%s\n%s\n' % (code.text, block.rstrip()) - ) - else: - # This is a new codeblock. Create the elements and insert text. - pre = util.etree.SubElement(parent, 'pre') - code = util.etree.SubElement(pre, 'code') - block, theRest = self.detab(block) - code.text = util.AtomicString('%s\n' % block.rstrip()) - if theRest: - # This block contained unindented line(s) after the first indented - # line. Insert these lines as the first block of the master blocks - # list for future processing. - blocks.insert(0, theRest) - - -class BlockQuoteProcessor(BlockProcessor): - - RE = re.compile(r'(^|\n)[ ]{0,3}>[ ]?(.*)') - - def test(self, parent, block): - return bool(self.RE.search(block)) - - def run(self, parent, blocks): - block = blocks.pop(0) - m = self.RE.search(block) - if m: - before = block[:m.start()] # Lines before blockquote - # Pass lines before blockquote in recursively for parsing forst. - self.parser.parseBlocks(parent, [before]) - # Remove ``> `` from begining of each line. - block = '\n'.join( - [self.clean(line) for line in block[m.start():].split('\n')] - ) - sibling = self.lastChild(parent) - if sibling is not None and sibling.tag == "blockquote": - # Previous block was a blockquote so set that as this blocks parent - quote = sibling - else: - # This is a new blockquote. Create a new parent element. - quote = util.etree.SubElement(parent, 'blockquote') - # Recursively parse block with blockquote as parent. - # change parser state so blockquotes embedded in lists use p tags - self.parser.state.set('blockquote') - self.parser.parseChunk(quote, block) - self.parser.state.reset() - - def clean(self, line): - """ Remove ``>`` from beginning of a line. """ - m = self.RE.match(line) - if line.strip() == ">": - return "" - elif m: - return m.group(2) - else: - return line - - -class OListProcessor(BlockProcessor): - """ Process ordered list blocks. """ - - TAG = 'ol' - # The integer (python string) with which the lists starts (default=1) - # Eg: If list is intialized as) - # 3. Item - # The ol tag will get starts="3" attribute - STARTSWITH = '1' - # List of allowed sibling tags. - SIBLING_TAGS = ['ol', 'ul'] - - def __init__(self, parser): - super(OListProcessor, self).__init__(parser) - # Detect an item (``1. item``). ``group(1)`` contains contents of item. - self.RE = re.compile(r'^[ ]{0,%d}\d+\.[ ]+(.*)' % (self.tab_length - 1)) - # Detect items on secondary lines. they can be of either list type. - self.CHILD_RE = re.compile(r'^[ ]{0,%d}((\d+\.)|[*+-])[ ]+(.*)' % - (self.tab_length - 1)) - # Detect indented (nested) items of either type - self.INDENT_RE = re.compile(r'^[ ]{%d,%d}((\d+\.)|[*+-])[ ]+.*' % - (self.tab_length, self.tab_length * 2 - 1)) - - def test(self, parent, block): - return bool(self.RE.match(block)) - - def run(self, parent, blocks): - # Check fr multiple items in one block. - items = self.get_items(blocks.pop(0)) - sibling = self.lastChild(parent) - - if sibling is not None and sibling.tag in self.SIBLING_TAGS: - # Previous block was a list item, so set that as parent - lst = sibling - # make sure previous item is in a p- if the item has text, - # then it isn't in a p - if lst[-1].text: - # since it's possible there are other children for this - # sibling, we can't just SubElement the p, we need to - # insert it as the first item. - p = util.etree.Element('p') - p.text = lst[-1].text - lst[-1].text = '' - lst[-1].insert(0, p) - # if the last item has a tail, then the tail needs to be put in a p - # likely only when a header is not followed by a blank line - lch = self.lastChild(lst[-1]) - if lch is not None and lch.tail: - p = util.etree.SubElement(lst[-1], 'p') - p.text = lch.tail.lstrip() - lch.tail = '' - - # parse first block differently as it gets wrapped in a p. - li = util.etree.SubElement(lst, 'li') - self.parser.state.set('looselist') - firstitem = items.pop(0) - self.parser.parseBlocks(li, [firstitem]) - self.parser.state.reset() - elif parent.tag in ['ol', 'ul']: - # this catches the edge case of a multi-item indented list whose - # first item is in a blank parent-list item: - # * * subitem1 - # * subitem2 - # see also ListIndentProcessor - lst = parent - else: - # This is a new list so create parent with appropriate tag. - lst = util.etree.SubElement(parent, self.TAG) - # Check if a custom start integer is set - if not self.parser.markdown.lazy_ol and self.STARTSWITH != '1': - lst.attrib['start'] = self.STARTSWITH - - self.parser.state.set('list') - # Loop through items in block, recursively parsing each with the - # appropriate parent. - for item in items: - if item.startswith(' '*self.tab_length): - # Item is indented. Parse with last item as parent - self.parser.parseBlocks(lst[-1], [item]) - else: - # New item. Create li and parse with it as parent - li = util.etree.SubElement(lst, 'li') - self.parser.parseBlocks(li, [item]) - self.parser.state.reset() - - def get_items(self, block): - """ Break a block into list items. """ - items = [] - for line in block.split('\n'): - m = self.CHILD_RE.match(line) - if m: - # This is a new list item - # Check first item for the start index - if not items and self.TAG == 'ol': - # Detect the integer value of first list item - INTEGER_RE = re.compile('(\d+)') - self.STARTSWITH = INTEGER_RE.match(m.group(1)).group() - # Append to the list - items.append(m.group(3)) - elif self.INDENT_RE.match(line): - # This is an indented (possibly nested) item. - if items[-1].startswith(' '*self.tab_length): - # Previous item was indented. Append to that item. - items[-1] = '%s\n%s' % (items[-1], line) - else: - items.append(line) - else: - # This is another line of previous item. Append to that item. - items[-1] = '%s\n%s' % (items[-1], line) - return items - - -class UListProcessor(OListProcessor): - """ Process unordered list blocks. """ - - TAG = 'ul' - - def __init__(self, parser): - super(UListProcessor, self).__init__(parser) - # Detect an item (``1. item``). ``group(1)`` contains contents of item. - self.RE = re.compile(r'^[ ]{0,%d}[*+-][ ]+(.*)' % (self.tab_length - 1)) - - -class HashHeaderProcessor(BlockProcessor): - """ Process Hash Headers. """ - - # Detect a header at start of any line in block - RE = re.compile(r'(^|\n)(?P#{1,6})(?P
.*?)#*(\n|$)') - - def test(self, parent, block): - return bool(self.RE.search(block)) - - def run(self, parent, blocks): - block = blocks.pop(0) - m = self.RE.search(block) - if m: - before = block[:m.start()] # All lines before header - after = block[m.end():] # All lines after header - if before: - # As the header was not the first line of the block and the - # lines before the header must be parsed first, - # recursively parse this lines as a block. - self.parser.parseBlocks(parent, [before]) - # Create header using named groups from RE - h = util.etree.SubElement(parent, 'h%d' % len(m.group('level'))) - h.text = m.group('header').strip() - if after: - # Insert remaining lines as first block for future parsing. - blocks.insert(0, after) - else: # pragma: no cover - # This should never happen, but just in case... - logger.warn("We've got a problem header: %r" % block) - - -class SetextHeaderProcessor(BlockProcessor): - """ Process Setext-style Headers. """ - - # Detect Setext-style header. Must be first 2 lines of block. - RE = re.compile(r'^.*?\n[=-]+[ ]*(\n|$)', re.MULTILINE) - - def test(self, parent, block): - return bool(self.RE.match(block)) - - def run(self, parent, blocks): - lines = blocks.pop(0).split('\n') - # Determine level. ``=`` is 1 and ``-`` is 2. - if lines[1].startswith('='): - level = 1 - else: - level = 2 - h = util.etree.SubElement(parent, 'h%d' % level) - h.text = lines[0].strip() - if len(lines) > 2: - # Block contains additional lines. Add to master blocks for later. - blocks.insert(0, '\n'.join(lines[2:])) - - -class HRProcessor(BlockProcessor): - """ Process Horizontal Rules. """ - - RE = r'^[ ]{0,3}((-+[ ]{0,2}){3,}|(_+[ ]{0,2}){3,}|(\*+[ ]{0,2}){3,})[ ]*' - # Detect hr on any line of a block. - SEARCH_RE = re.compile(RE, re.MULTILINE) - - def test(self, parent, block): - m = self.SEARCH_RE.search(block) - # No atomic grouping in python so we simulate it here for performance. - # The regex only matches what would be in the atomic group - the HR. - # Then check if we are at end of block or if next char is a newline. - if m and (m.end() == len(block) or block[m.end()] == '\n'): - # Save match object on class instance so we can use it later. - self.match = m - return True - return False - - def run(self, parent, blocks): - block = blocks.pop(0) - # Check for lines in block before hr. - prelines = block[:self.match.start()].rstrip('\n') - if prelines: - # Recursively parse lines before hr so they get parsed first. - self.parser.parseBlocks(parent, [prelines]) - # create hr - util.etree.SubElement(parent, 'hr') - # check for lines in block after hr. - postlines = block[self.match.end():].lstrip('\n') - if postlines: - # Add lines after hr to master blocks for later parsing. - blocks.insert(0, postlines) - - -class EmptyBlockProcessor(BlockProcessor): - """ Process blocks that are empty or start with an empty line. """ - - def test(self, parent, block): - return not block or block.startswith('\n') - - def run(self, parent, blocks): - block = blocks.pop(0) - filler = '\n\n' - if block: - # Starts with empty line - # Only replace a single line. - filler = '\n' - # Save the rest for later. - theRest = block[1:] - if theRest: - # Add remaining lines to master blocks for later. - blocks.insert(0, theRest) - sibling = self.lastChild(parent) - if (sibling is not None and sibling.tag == 'pre' and - len(sibling) and sibling[0].tag == 'code'): - # Last block is a codeblock. Append to preserve whitespace. - sibling[0].text = util.AtomicString( - '%s%s' % (sibling[0].text, filler) - ) - - -class ParagraphProcessor(BlockProcessor): - """ Process Paragraph blocks. """ - - def test(self, parent, block): - return True - - def run(self, parent, blocks): - block = blocks.pop(0) - if block.strip(): - # Not a blank block. Add to parent, otherwise throw it away. - if self.parser.state.isstate('list'): - # The parent is a tight-list. - # - # Check for any children. This will likely only happen in a - # tight-list when a header isn't followed by a blank line. - # For example: - # - # * # Header - # Line 2 of list item - not part of header. - sibling = self.lastChild(parent) - if sibling is not None: - # Insetrt after sibling. - if sibling.tail: - sibling.tail = '%s\n%s' % (sibling.tail, block) - else: - sibling.tail = '\n%s' % block - else: - # Append to parent.text - if parent.text: - parent.text = '%s\n%s' % (parent.text, block) - else: - parent.text = block.lstrip() - else: - # Create a regular paragraph - p = util.etree.SubElement(parent, 'p') - p.text = block.lstrip() diff --git a/src/calibre/ebooks/markdown/extensions/__init__.py b/src/calibre/ebooks/markdown/extensions/__init__.py deleted file mode 100644 index 6e7a08a1e1..0000000000 --- a/src/calibre/ebooks/markdown/extensions/__init__.py +++ /dev/null @@ -1,100 +0,0 @@ -""" -Extensions ------------------------------------------------------------------------------ -""" - -from __future__ import unicode_literals -from ..util import parseBoolValue -import warnings - - -class Extension(object): - """ Base class for extensions to subclass. """ - - # Default config -- to be overriden by a subclass - # Must be of the following format: - # { - # 'key': ['value', 'description'] - # } - # Note that Extension.setConfig will raise a KeyError - # if a default is not set here. - config = {} - - def __init__(self, *args, **kwargs): - """ Initiate Extension and set up configs. """ - - # check for configs arg for backward compat. - # (there only ever used to be one so we use arg[0]) - if len(args): - if args[0] is not None: - self.setConfigs(args[0]) - warnings.warn('Extension classes accepting positional args is ' - 'pending Deprecation. Each setting should be ' - 'passed into the Class as a keyword. Positional ' - 'args are deprecated and will raise ' - 'an error in version 2.7. See the Release Notes for ' - 'Python-Markdown version 2.6 for more info.', - DeprecationWarning) - # check for configs kwarg for backward compat. - if 'configs' in kwargs.keys(): - if kwargs['configs'] is not None: - self.setConfigs(kwargs.pop('configs', {})) - warnings.warn('Extension classes accepting a dict on the single ' - 'keyword "config" is pending Deprecation. Each ' - 'setting should be passed into the Class as a ' - 'keyword directly. The "config" keyword is ' - 'deprecated and raise an error in ' - 'version 2.7. See the Release Notes for ' - 'Python-Markdown version 2.6 for more info.', - DeprecationWarning) - # finally, use kwargs - self.setConfigs(kwargs) - - def getConfig(self, key, default=''): - """ Return a setting for the given key or an empty string. """ - if key in self.config: - return self.config[key][0] - else: - return default - - def getConfigs(self): - """ Return all configs settings as a dict. """ - return dict([(key, self.getConfig(key)) for key in self.config.keys()]) - - def getConfigInfo(self): - """ Return all config descriptions as a list of tuples. """ - return [(key, self.config[key][1]) for key in self.config.keys()] - - def setConfig(self, key, value): - """ Set a config setting for `key` with the given `value`. """ - if isinstance(self.config[key][0], bool): - value = parseBoolValue(value) - if self.config[key][0] is None: - value = parseBoolValue(value, preserve_none=True) - self.config[key][0] = value - - def setConfigs(self, items): - """ Set multiple config settings given a dict or list of tuples. """ - if hasattr(items, 'items'): - # it's a dict - items = items.items() - for key, value in items: - self.setConfig(key, value) - - def extendMarkdown(self, md, md_globals): - """ - Add the various proccesors and patterns to the Markdown Instance. - - This method must be overriden by every extension. - - Keyword arguments: - - * md: The Markdown instance. - - * md_globals: Global variables in the markdown module namespace. - - """ - raise NotImplementedError( - 'Extension "%s.%s" must define an "extendMarkdown"' - 'method.' % (self.__class__.__module__, self.__class__.__name__) - ) diff --git a/src/calibre/ebooks/markdown/extensions/abbr.py b/src/calibre/ebooks/markdown/extensions/abbr.py deleted file mode 100644 index 353d126f6f..0000000000 --- a/src/calibre/ebooks/markdown/extensions/abbr.py +++ /dev/null @@ -1,91 +0,0 @@ -''' -Abbreviation Extension for Python-Markdown -========================================== - -This extension adds abbreviation handling to Python-Markdown. - -See -for documentation. - -Oringinal code Copyright 2007-2008 [Waylan Limberg](http://achinghead.com/) and - [Seemant Kulleen](http://www.kulleen.org/) - -All changes Copyright 2008-2014 The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -''' - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..preprocessors import Preprocessor -from ..inlinepatterns import Pattern -from ..util import etree, AtomicString -import re - -# Global Vars -ABBR_REF_RE = re.compile(r'[*]\[(?P[^\]]*)\][ ]?:\s*(?P.*)') - - -class AbbrExtension(Extension): - """ Abbreviation Extension for Python-Markdown. """ - - def extendMarkdown(self, md, md_globals): - """ Insert AbbrPreprocessor before ReferencePreprocessor. """ - md.preprocessors.add('abbr', AbbrPreprocessor(md), '<reference') - - -class AbbrPreprocessor(Preprocessor): - """ Abbreviation Preprocessor - parse text for abbr references. """ - - def run(self, lines): - ''' - Find and remove all Abbreviation references from the text. - Each reference is set as a new AbbrPattern in the markdown instance. - - ''' - new_text = [] - for line in lines: - m = ABBR_REF_RE.match(line) - if m: - abbr = m.group('abbr').strip() - title = m.group('title').strip() - self.markdown.inlinePatterns['abbr-%s' % abbr] = \ - AbbrPattern(self._generate_pattern(abbr), title) - else: - new_text.append(line) - return new_text - - def _generate_pattern(self, text): - ''' - Given a string, returns an regex pattern to match that string. - - 'HTML' -> r'(?P<abbr>[H][T][M][L])' - - Note: we force each char as a literal match (in brackets) as we don't - know what they will be beforehand. - - ''' - chars = list(text) - for i in range(len(chars)): - chars[i] = r'[%s]' % chars[i] - return r'(?P<abbr>\b%s\b)' % (r''.join(chars)) - - -class AbbrPattern(Pattern): - """ Abbreviation inline pattern. """ - - def __init__(self, pattern, title): - super(AbbrPattern, self).__init__(pattern) - self.title = title - - def handleMatch(self, m): - abbr = etree.Element('abbr') - abbr.text = AtomicString(m.group('abbr')) - abbr.set('title', self.title) - return abbr - - -def makeExtension(*args, **kwargs): - return AbbrExtension(*args, **kwargs) diff --git a/src/calibre/ebooks/markdown/extensions/admonition.py b/src/calibre/ebooks/markdown/extensions/admonition.py deleted file mode 100644 index 76e0fb588c..0000000000 --- a/src/calibre/ebooks/markdown/extensions/admonition.py +++ /dev/null @@ -1,96 +0,0 @@ -""" -Admonition extension for Python-Markdown -======================================== - -Adds rST-style admonitions. Inspired by [rST][] feature with the same name. - -[rST]: http://docutils.sourceforge.net/docs/ref/rst/directives.html#specific-admonitions # noqa - -See <https://pythonhosted.org/Markdown/extensions/admonition.html> -for documentation. - -Original code Copyright [Tiago Serafim](http://www.tiagoserafim.com/). - -All changes Copyright The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..blockprocessors import BlockProcessor -from ..util import etree -import re - - -class AdmonitionExtension(Extension): - """ Admonition extension for Python-Markdown. """ - - def extendMarkdown(self, md, md_globals): - """ Add Admonition to Markdown instance. """ - md.registerExtension(self) - - md.parser.blockprocessors.add('admonition', - AdmonitionProcessor(md.parser), - '_begin') - - -class AdmonitionProcessor(BlockProcessor): - - CLASSNAME = 'admonition' - CLASSNAME_TITLE = 'admonition-title' - RE = re.compile(r'(?:^|\n)!!!\ ?([\w\-]+)(?:\ "(.*?)")?') - - def test(self, parent, block): - sibling = self.lastChild(parent) - return self.RE.search(block) or \ - (block.startswith(' ' * self.tab_length) and sibling is not None and - sibling.get('class', '').find(self.CLASSNAME) != -1) - - def run(self, parent, blocks): - sibling = self.lastChild(parent) - block = blocks.pop(0) - m = self.RE.search(block) - - if m: - block = block[m.end() + 1:] # removes the first line - - block, theRest = self.detab(block) - - if m: - klass, title = self.get_class_and_title(m) - div = etree.SubElement(parent, 'div') - div.set('class', '%s %s' % (self.CLASSNAME, klass)) - if title: - p = etree.SubElement(div, 'p') - p.text = title - p.set('class', self.CLASSNAME_TITLE) - else: - div = sibling - - self.parser.parseChunk(div, block) - - if theRest: - # This block contained unindented line(s) after the first indented - # line. Insert these lines as the first block of the master blocks - # list for future processing. - blocks.insert(0, theRest) - - def get_class_and_title(self, match): - klass, title = match.group(1).lower(), match.group(2) - if title is None: - # no title was provided, use the capitalized classname as title - # e.g.: `!!! note` will render - # `<p class="admonition-title">Note</p>` - title = klass.capitalize() - elif title == '': - # an explicit blank title should not be rendered - # e.g.: `!!! warning ""` will *not* render `p` with a title - title = None - return klass, title - - -def makeExtension(*args, **kwargs): - return AdmonitionExtension(*args, **kwargs) diff --git a/src/calibre/ebooks/markdown/extensions/attr_list.py b/src/calibre/ebooks/markdown/extensions/attr_list.py deleted file mode 100644 index 683bdf831c..0000000000 --- a/src/calibre/ebooks/markdown/extensions/attr_list.py +++ /dev/null @@ -1,177 +0,0 @@ -""" -Attribute List Extension for Python-Markdown -============================================ - -Adds attribute list syntax. Inspired by -[maruku](http://maruku.rubyforge.org/proposal.html#attribute_lists)'s -feature of the same name. - -See <https://pythonhosted.org/Markdown/extensions/attr_list.html> -for documentation. - -Original code Copyright 2011 [Waylan Limberg](http://achinghead.com/). - -All changes Copyright 2011-2014 The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..treeprocessors import Treeprocessor -from ..util import isBlockLevel -import re - -try: - Scanner = re.Scanner -except AttributeError: # pragma: no cover - # must be on Python 2.4 - from sre import Scanner - - -def _handle_double_quote(s, t): - k, v = t.split('=') - return k, v.strip('"') - - -def _handle_single_quote(s, t): - k, v = t.split('=') - return k, v.strip("'") - - -def _handle_key_value(s, t): - return t.split('=') - - -def _handle_word(s, t): - if t.startswith('.'): - return '.', t[1:] - if t.startswith('#'): - return 'id', t[1:] - return t, t - -_scanner = Scanner([ - (r'[^ ]+=".*?"', _handle_double_quote), - (r"[^ ]+='.*?'", _handle_single_quote), - (r'[^ ]+=[^ =]+', _handle_key_value), - (r'[^ =]+', _handle_word), - (r' ', None) -]) - - -def get_attrs(str): - """ Parse attribute list and return a list of attribute tuples. """ - return _scanner.scan(str)[0] - - -def isheader(elem): - return elem.tag in ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] - - -class AttrListTreeprocessor(Treeprocessor): - - BASE_RE = r'\{\:?([^\}]*)\}' - HEADER_RE = re.compile(r'[ ]+%s[ ]*$' % BASE_RE) - BLOCK_RE = re.compile(r'\n[ ]*%s[ ]*$' % BASE_RE) - INLINE_RE = re.compile(r'^%s' % BASE_RE) - NAME_RE = re.compile(r'[^A-Z_a-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02ff' - r'\u0370-\u037d\u037f-\u1fff\u200c-\u200d' - r'\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff' - r'\uf900-\ufdcf\ufdf0-\ufffd' - r'\:\-\.0-9\u00b7\u0300-\u036f\u203f-\u2040]+') - - def run(self, doc): - for elem in doc.getiterator(): - if isBlockLevel(elem.tag): - # Block level: check for attrs on last line of text - RE = self.BLOCK_RE - if isheader(elem) or elem.tag == 'dt': - # header or def-term: check for attrs at end of line - RE = self.HEADER_RE - if len(elem) and elem.tag == 'li': - # special case list items. children may include a ul or ol. - pos = None - # find the ul or ol position - for i, child in enumerate(elem): - if child.tag in ['ul', 'ol']: - pos = i - break - if pos is None and elem[-1].tail: - # use tail of last child. no ul or ol. - m = RE.search(elem[-1].tail) - if m: - self.assign_attrs(elem, m.group(1)) - elem[-1].tail = elem[-1].tail[:m.start()] - elif pos is not None and pos > 0 and elem[pos-1].tail: - # use tail of last child before ul or ol - m = RE.search(elem[pos-1].tail) - if m: - self.assign_attrs(elem, m.group(1)) - elem[pos-1].tail = elem[pos-1].tail[:m.start()] - elif elem.text: - # use text. ul is first child. - m = RE.search(elem.text) - if m: - self.assign_attrs(elem, m.group(1)) - elem.text = elem.text[:m.start()] - elif len(elem) and elem[-1].tail: - # has children. Get from tail of last child - m = RE.search(elem[-1].tail) - if m: - self.assign_attrs(elem, m.group(1)) - elem[-1].tail = elem[-1].tail[:m.start()] - if isheader(elem): - # clean up trailing #s - elem[-1].tail = elem[-1].tail.rstrip('#').rstrip() - elif elem.text: - # no children. Get from text. - m = RE.search(elem.text) - if not m and elem.tag == 'td': - m = re.search(self.BASE_RE, elem.text) - if m: - self.assign_attrs(elem, m.group(1)) - elem.text = elem.text[:m.start()] - if isheader(elem): - # clean up trailing #s - elem.text = elem.text.rstrip('#').rstrip() - else: - # inline: check for attrs at start of tail - if elem.tail: - m = self.INLINE_RE.match(elem.tail) - if m: - self.assign_attrs(elem, m.group(1)) - elem.tail = elem.tail[m.end():] - - def assign_attrs(self, elem, attrs): - """ Assign attrs to element. """ - for k, v in get_attrs(attrs): - if k == '.': - # add to class - cls = elem.get('class') - if cls: - elem.set('class', '%s %s' % (cls, v)) - else: - elem.set('class', v) - else: - # assign attr k with v - elem.set(self.sanitize_name(k), v) - - def sanitize_name(self, name): - """ - Sanitize name as 'an XML Name, minus the ":"'. - See http://www.w3.org/TR/REC-xml-names/#NT-NCName - """ - return self.NAME_RE.sub('_', name) - - -class AttrListExtension(Extension): - def extendMarkdown(self, md, md_globals): - md.treeprocessors.add( - 'attr_list', AttrListTreeprocessor(md), '>prettify' - ) - - -def makeExtension(*args, **kwargs): - return AttrListExtension(*args, **kwargs) diff --git a/src/calibre/ebooks/markdown/extensions/codehilite.py b/src/calibre/ebooks/markdown/extensions/codehilite.py deleted file mode 100644 index 0657c37681..0000000000 --- a/src/calibre/ebooks/markdown/extensions/codehilite.py +++ /dev/null @@ -1,265 +0,0 @@ -""" -CodeHilite Extension for Python-Markdown -======================================== - -Adds code/syntax highlighting to standard Python-Markdown code blocks. - -See <https://pythonhosted.org/Markdown/extensions/code_hilite.html> -for documentation. - -Original code Copyright 2006-2008 [Waylan Limberg](http://achinghead.com/). - -All changes Copyright 2008-2014 The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..treeprocessors import Treeprocessor - -try: - from pygments import highlight - from pygments.lexers import get_lexer_by_name, guess_lexer - from pygments.formatters import get_formatter_by_name - pygments = True -except ImportError: - pygments = False - - -def parse_hl_lines(expr): - """Support our syntax for emphasizing certain lines of code. - - expr should be like '1 2' to emphasize lines 1 and 2 of a code block. - Returns a list of ints, the line numbers to emphasize. - """ - if not expr: - return [] - - try: - return list(map(int, expr.split())) - except ValueError: - return [] - - -# ------------------ The Main CodeHilite Class ---------------------- -class CodeHilite(object): - """ - Determine language of source code, and pass it into pygments hilighter. - - Basic Usage: - >>> code = CodeHilite(src = 'some text') - >>> html = code.hilite() - - * src: Source string or any object with a .readline attribute. - - * linenums: (Boolean) Set line numbering to 'on' (True), - 'off' (False) or 'auto'(None). Set to 'auto' by default. - - * guess_lang: (Boolean) Turn language auto-detection - 'on' or 'off' (on by default). - - * css_class: Set class name of wrapper div ('codehilite' by default). - - * hl_lines: (List of integers) Lines to emphasize, 1-indexed. - - Low Level Usage: - >>> code = CodeHilite() - >>> code.src = 'some text' # String or anything with a .readline attr. - >>> code.linenos = True # Turns line numbering on or of. - >>> html = code.hilite() - - """ - - def __init__(self, src=None, linenums=None, guess_lang=True, - css_class="codehilite", lang=None, style='default', - noclasses=False, tab_length=4, hl_lines=None, use_pygments=True): - self.src = src - self.lang = lang - self.linenums = linenums - self.guess_lang = guess_lang - self.css_class = css_class - self.style = style - self.noclasses = noclasses - self.tab_length = tab_length - self.hl_lines = hl_lines or [] - self.use_pygments = use_pygments - - def hilite(self): - """ - Pass code to the [Pygments](http://pygments.pocoo.org/) highliter with - optional line numbers. The output should then be styled with css to - your liking. No styles are applied by default - only styling hooks - (i.e.: <span class="k">). - - returns : A string of html. - - """ - - self.src = self.src.strip('\n') - - if self.lang is None: - self._parseHeader() - - if pygments and self.use_pygments: - try: - lexer = get_lexer_by_name(self.lang) - except ValueError: - try: - if self.guess_lang: - lexer = guess_lexer(self.src) - else: - lexer = get_lexer_by_name('text') - except ValueError: - lexer = get_lexer_by_name('text') - formatter = get_formatter_by_name('html', - linenos=self.linenums, - cssclass=self.css_class, - style=self.style, - noclasses=self.noclasses, - hl_lines=self.hl_lines) - return highlight(self.src, lexer, formatter) - else: - # just escape and build markup usable by JS highlighting libs - txt = self.src.replace('&', '&') - txt = txt.replace('<', '<') - txt = txt.replace('>', '>') - txt = txt.replace('"', '"') - classes = [] - if self.lang: - classes.append('language-%s' % self.lang) - if self.linenums: - classes.append('linenums') - class_str = '' - if classes: - class_str = ' class="%s"' % ' '.join(classes) - return '<pre class="%s"><code%s>%s</code></pre>\n' % \ - (self.css_class, class_str, txt) - - def _parseHeader(self): - """ - Determines language of a code block from shebang line and whether said - line should be removed or left in place. If the sheband line contains a - path (even a single /) then it is assumed to be a real shebang line and - left alone. However, if no path is given (e.i.: #!python or :::python) - then it is assumed to be a mock shebang for language identifitation of - a code fragment and removed from the code block prior to processing for - code highlighting. When a mock shebang (e.i: #!python) is found, line - numbering is turned on. When colons are found in place of a shebang - (e.i.: :::python), line numbering is left in the current state - off - by default. - - Also parses optional list of highlight lines, like: - - :::python hl_lines="1 3" - """ - - import re - - # split text into lines - lines = self.src.split("\n") - # pull first line to examine - fl = lines.pop(0) - - c = re.compile(r''' - (?:(?:^::+)|(?P<shebang>^[#]!)) # Shebang or 2 or more colons - (?P<path>(?:/\w+)*[/ ])? # Zero or 1 path - (?P<lang>[\w+-]*) # The language - \s* # Arbitrary whitespace - # Optional highlight lines, single- or double-quote-delimited - (hl_lines=(?P<quot>"|')(?P<hl_lines>.*?)(?P=quot))? - ''', re.VERBOSE) - # search first line for shebang - m = c.search(fl) - if m: - # we have a match - try: - self.lang = m.group('lang').lower() - except IndexError: - self.lang = None - if m.group('path'): - # path exists - restore first line - lines.insert(0, fl) - if self.linenums is None and m.group('shebang'): - # Overridable and Shebang exists - use line numbers - self.linenums = True - - self.hl_lines = parse_hl_lines(m.group('hl_lines')) - else: - # No match - lines.insert(0, fl) - - self.src = "\n".join(lines).strip("\n") - - -# ------------------ The Markdown Extension ------------------------------- - - -class HiliteTreeprocessor(Treeprocessor): - """ Hilight source code in code blocks. """ - - def run(self, root): - """ Find code blocks and store in htmlStash. """ - blocks = root.iter('pre') - for block in blocks: - if len(block) == 1 and block[0].tag == 'code': - code = CodeHilite( - block[0].text, - linenums=self.config['linenums'], - guess_lang=self.config['guess_lang'], - css_class=self.config['css_class'], - style=self.config['pygments_style'], - noclasses=self.config['noclasses'], - tab_length=self.markdown.tab_length, - use_pygments=self.config['use_pygments'] - ) - placeholder = self.markdown.htmlStash.store(code.hilite(), - safe=True) - # Clear codeblock in etree instance - block.clear() - # Change to p element which will later - # be removed when inserting raw html - block.tag = 'p' - block.text = placeholder - - -class CodeHiliteExtension(Extension): - """ Add source code hilighting to markdown codeblocks. """ - - def __init__(self, *args, **kwargs): - # define default configs - self.config = { - 'linenums': [None, - "Use lines numbers. True=yes, False=no, None=auto"], - 'guess_lang': [True, - "Automatic language detection - Default: True"], - 'css_class': ["codehilite", - "Set class name for wrapper <div> - " - "Default: codehilite"], - 'pygments_style': ['default', - 'Pygments HTML Formatter Style ' - '(Colorscheme) - Default: default'], - 'noclasses': [False, - 'Use inline styles instead of CSS classes - ' - 'Default false'], - 'use_pygments': [True, - 'Use Pygments to Highlight code blocks. ' - 'Disable if using a JavaScript library. ' - 'Default: True'] - } - - super(CodeHiliteExtension, self).__init__(*args, **kwargs) - - def extendMarkdown(self, md, md_globals): - """ Add HilitePostprocessor to Markdown instance. """ - hiliter = HiliteTreeprocessor(md) - hiliter.config = self.getConfigs() - md.treeprocessors.add("hilite", hiliter, "<inline") - - md.registerExtension(self) - - -def makeExtension(*args, **kwargs): - return CodeHiliteExtension(*args, **kwargs) diff --git a/src/calibre/ebooks/markdown/extensions/def_list.py b/src/calibre/ebooks/markdown/extensions/def_list.py deleted file mode 100644 index 77cca6eb8b..0000000000 --- a/src/calibre/ebooks/markdown/extensions/def_list.py +++ /dev/null @@ -1,115 +0,0 @@ -""" -Definition List Extension for Python-Markdown -============================================= - -Adds parsing of Definition Lists to Python-Markdown. - -See <https://pythonhosted.org/Markdown/extensions/definition_lists.html> -for documentation. - -Original code Copyright 2008 [Waylan Limberg](http://achinghead.com) - -All changes Copyright 2008-2014 The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..blockprocessors import BlockProcessor, ListIndentProcessor -from ..util import etree -import re - - -class DefListProcessor(BlockProcessor): - """ Process Definition Lists. """ - - RE = re.compile(r'(^|\n)[ ]{0,3}:[ ]{1,3}(.*?)(\n|$)') - NO_INDENT_RE = re.compile(r'^[ ]{0,3}[^ :]') - - def test(self, parent, block): - return bool(self.RE.search(block)) - - def run(self, parent, blocks): - - raw_block = blocks.pop(0) - m = self.RE.search(raw_block) - terms = [l.strip() for l in - raw_block[:m.start()].split('\n') if l.strip()] - block = raw_block[m.end():] - no_indent = self.NO_INDENT_RE.match(block) - if no_indent: - d, theRest = (block, None) - else: - d, theRest = self.detab(block) - if d: - d = '%s\n%s' % (m.group(2), d) - else: - d = m.group(2) - sibling = self.lastChild(parent) - if not terms and sibling is None: - # This is not a definition item. Most likely a paragraph that - # starts with a colon at the begining of a document or list. - blocks.insert(0, raw_block) - return False - if not terms and sibling.tag == 'p': - # The previous paragraph contains the terms - state = 'looselist' - terms = sibling.text.split('\n') - parent.remove(sibling) - # Aquire new sibling - sibling = self.lastChild(parent) - else: - state = 'list' - - if sibling is not None and sibling.tag == 'dl': - # This is another item on an existing list - dl = sibling - if not terms and len(dl) and dl[-1].tag == 'dd' and len(dl[-1]): - state = 'looselist' - else: - # This is a new list - dl = etree.SubElement(parent, 'dl') - # Add terms - for term in terms: - dt = etree.SubElement(dl, 'dt') - dt.text = term - # Add definition - self.parser.state.set(state) - dd = etree.SubElement(dl, 'dd') - self.parser.parseBlocks(dd, [d]) - self.parser.state.reset() - - if theRest: - blocks.insert(0, theRest) - - -class DefListIndentProcessor(ListIndentProcessor): - """ Process indented children of definition list items. """ - - ITEM_TYPES = ['dd'] - LIST_TYPES = ['dl'] - - def create_item(self, parent, block): - """ Create a new dd and parse the block with it as the parent. """ - dd = etree.SubElement(parent, 'dd') - self.parser.parseBlocks(dd, [block]) - - -class DefListExtension(Extension): - """ Add definition lists to Markdown. """ - - def extendMarkdown(self, md, md_globals): - """ Add an instance of DefListProcessor to BlockParser. """ - md.parser.blockprocessors.add('defindent', - DefListIndentProcessor(md.parser), - '>indent') - md.parser.blockprocessors.add('deflist', - DefListProcessor(md.parser), - '>ulist') - - -def makeExtension(*args, **kwargs): - return DefListExtension(*args, **kwargs) diff --git a/src/calibre/ebooks/markdown/extensions/extra.py b/src/calibre/ebooks/markdown/extensions/extra.py deleted file mode 100644 index de5db03cd6..0000000000 --- a/src/calibre/ebooks/markdown/extensions/extra.py +++ /dev/null @@ -1,132 +0,0 @@ -""" -Python-Markdown Extra Extension -=============================== - -A compilation of various Python-Markdown extensions that imitates -[PHP Markdown Extra](http://michelf.com/projects/php-markdown/extra/). - -Note that each of the individual extensions still need to be available -on your PYTHONPATH. This extension simply wraps them all up as a -convenience so that only one extension needs to be listed when -initiating Markdown. See the documentation for each individual -extension for specifics about that extension. - -There may be additional extensions that are distributed with -Python-Markdown that are not included here in Extra. Those extensions -are not part of PHP Markdown Extra, and therefore, not part of -Python-Markdown Extra. If you really would like Extra to include -additional extensions, we suggest creating your own clone of Extra -under a differant name. You could also edit the `extensions` global -variable defined below, but be aware that such changes may be lost -when you upgrade to any future version of Python-Markdown. - -See <https://pythonhosted.org/Markdown/extensions/extra.html> -for documentation. - -Copyright The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..blockprocessors import BlockProcessor -from .. import util -import re - -extensions = [ - 'markdown.extensions.smart_strong', - 'markdown.extensions.fenced_code', - 'markdown.extensions.footnotes', - 'markdown.extensions.attr_list', - 'markdown.extensions.def_list', - 'markdown.extensions.tables', - 'markdown.extensions.abbr' -] - - -class ExtraExtension(Extension): - """ Add various extensions to Markdown class.""" - - def __init__(self, *args, **kwargs): - """ config is a dumb holder which gets passed to actual ext later. """ - self.config = kwargs.pop('configs', {}) - self.config.update(kwargs) - - def extendMarkdown(self, md, md_globals): - """ Register extension instances. """ - md.registerExtensions(extensions, self.config) - if not md.safeMode: - # Turn on processing of markdown text within raw html - md.preprocessors['html_block'].markdown_in_raw = True - md.parser.blockprocessors.add('markdown_block', - MarkdownInHtmlProcessor(md.parser), - '_begin') - md.parser.blockprocessors.tag_counter = -1 - md.parser.blockprocessors.contain_span_tags = re.compile( - r'^(p|h[1-6]|li|dd|dt|td|th|legend|address)$', re.IGNORECASE) - - -def makeExtension(*args, **kwargs): - return ExtraExtension(*args, **kwargs) - - -class MarkdownInHtmlProcessor(BlockProcessor): - """Process Markdown Inside HTML Blocks.""" - def test(self, parent, block): - return block == util.TAG_PLACEHOLDER % \ - str(self.parser.blockprocessors.tag_counter + 1) - - def _process_nests(self, element, block): - """Process the element's child elements in self.run.""" - # Build list of indexes of each nest within the parent element. - nest_index = [] # a list of tuples: (left index, right index) - i = self.parser.blockprocessors.tag_counter + 1 - while len(self._tag_data) > i and self._tag_data[i]['left_index']: - left_child_index = self._tag_data[i]['left_index'] - right_child_index = self._tag_data[i]['right_index'] - nest_index.append((left_child_index - 1, right_child_index)) - i += 1 - - # Create each nest subelement. - for i, (left_index, right_index) in enumerate(nest_index[:-1]): - self.run(element, block[left_index:right_index], - block[right_index:nest_index[i + 1][0]], True) - self.run(element, block[nest_index[-1][0]:nest_index[-1][1]], # last - block[nest_index[-1][1]:], True) # nest - - def run(self, parent, blocks, tail=None, nest=False): - self._tag_data = self.parser.markdown.htmlStash.tag_data - - self.parser.blockprocessors.tag_counter += 1 - tag = self._tag_data[self.parser.blockprocessors.tag_counter] - - # Create Element - markdown_value = tag['attrs'].pop('markdown') - element = util.etree.SubElement(parent, tag['tag'], tag['attrs']) - - # Slice Off Block - if nest: - self.parser.parseBlocks(parent, tail) # Process Tail - block = blocks[1:] - else: # includes nests since a third level of nesting isn't supported - block = blocks[tag['left_index'] + 1: tag['right_index']] - del blocks[:tag['right_index']] - - # Process Text - if (self.parser.blockprocessors.contain_span_tags.match( # Span Mode - tag['tag']) and markdown_value != 'block') or \ - markdown_value == 'span': - element.text = '\n'.join(block) - else: # Block Mode - i = self.parser.blockprocessors.tag_counter + 1 - if len(self._tag_data) > i and self._tag_data[i]['left_index']: - first_subelement_index = self._tag_data[i]['left_index'] - 1 - self.parser.parseBlocks( - element, block[:first_subelement_index]) - if not nest: - block = self._process_nests(element, block) - else: - self.parser.parseBlocks(element, block) diff --git a/src/calibre/ebooks/markdown/extensions/fenced_code.py b/src/calibre/ebooks/markdown/extensions/fenced_code.py deleted file mode 100644 index 4af8891a8b..0000000000 --- a/src/calibre/ebooks/markdown/extensions/fenced_code.py +++ /dev/null @@ -1,112 +0,0 @@ -""" -Fenced Code Extension for Python Markdown -========================================= - -This extension adds Fenced Code Blocks to Python-Markdown. - -See <https://pythonhosted.org/Markdown/extensions/fenced_code_blocks.html> -for documentation. - -Original code Copyright 2007-2008 [Waylan Limberg](http://achinghead.com/). - - -All changes Copyright 2008-2014 The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..preprocessors import Preprocessor -from .codehilite import CodeHilite, CodeHiliteExtension, parse_hl_lines -import re - - -class FencedCodeExtension(Extension): - - def extendMarkdown(self, md, md_globals): - """ Add FencedBlockPreprocessor to the Markdown instance. """ - md.registerExtension(self) - - md.preprocessors.add('fenced_code_block', - FencedBlockPreprocessor(md), - ">normalize_whitespace") - - -class FencedBlockPreprocessor(Preprocessor): - FENCED_BLOCK_RE = re.compile(r''' -(?P<fence>^(?:~{3,}|`{3,}))[ ]* # Opening ``` or ~~~ -(\{?\.?(?P<lang>[a-zA-Z0-9_+-]*))?[ ]* # Optional {, and lang -# Optional highlight lines, single- or double-quote-delimited -(hl_lines=(?P<quot>"|')(?P<hl_lines>.*?)(?P=quot))?[ ]* -}?[ ]*\n # Optional closing } -(?P<code>.*?)(?<=\n) -(?P=fence)[ ]*$''', re.MULTILINE | re.DOTALL | re.VERBOSE) - CODE_WRAP = '<pre><code%s>%s</code></pre>' - LANG_TAG = ' class="%s"' - - def __init__(self, md): - super(FencedBlockPreprocessor, self).__init__(md) - - self.checked_for_codehilite = False - self.codehilite_conf = {} - - def run(self, lines): - """ Match and store Fenced Code Blocks in the HtmlStash. """ - - # Check for code hilite extension - if not self.checked_for_codehilite: - for ext in self.markdown.registeredExtensions: - if isinstance(ext, CodeHiliteExtension): - self.codehilite_conf = ext.config - break - - self.checked_for_codehilite = True - - text = "\n".join(lines) - while 1: - m = self.FENCED_BLOCK_RE.search(text) - if m: - lang = '' - if m.group('lang'): - lang = self.LANG_TAG % m.group('lang') - - # If config is not empty, then the codehighlite extension - # is enabled, so we call it to highlight the code - if self.codehilite_conf: - highliter = CodeHilite( - m.group('code'), - linenums=self.codehilite_conf['linenums'][0], - guess_lang=self.codehilite_conf['guess_lang'][0], - css_class=self.codehilite_conf['css_class'][0], - style=self.codehilite_conf['pygments_style'][0], - lang=(m.group('lang') or None), - noclasses=self.codehilite_conf['noclasses'][0], - hl_lines=parse_hl_lines(m.group('hl_lines')) - ) - - code = highliter.hilite() - else: - code = self.CODE_WRAP % (lang, - self._escape(m.group('code'))) - - placeholder = self.markdown.htmlStash.store(code, safe=True) - text = '%s\n%s\n%s' % (text[:m.start()], - placeholder, - text[m.end():]) - else: - break - return text.split("\n") - - def _escape(self, txt): - """ basic html escaping """ - txt = txt.replace('&', '&') - txt = txt.replace('<', '<') - txt = txt.replace('>', '>') - txt = txt.replace('"', '"') - return txt - - -def makeExtension(*args, **kwargs): - return FencedCodeExtension(*args, **kwargs) diff --git a/src/calibre/ebooks/markdown/extensions/footnotes.py b/src/calibre/ebooks/markdown/extensions/footnotes.py deleted file mode 100644 index 362aa20b64..0000000000 --- a/src/calibre/ebooks/markdown/extensions/footnotes.py +++ /dev/null @@ -1,321 +0,0 @@ -""" -Footnotes Extension for Python-Markdown -======================================= - -Adds footnote handling to Python-Markdown. - -See <https://pythonhosted.org/Markdown/extensions/footnotes.html> -for documentation. - -Copyright The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..preprocessors import Preprocessor -from ..inlinepatterns import Pattern -from ..treeprocessors import Treeprocessor -from ..postprocessors import Postprocessor -from ..util import etree, text_type -from ..odict import OrderedDict -import re - -FN_BACKLINK_TEXT = "zz1337820767766393qq" -NBSP_PLACEHOLDER = "qq3936677670287331zz" -DEF_RE = re.compile(r'[ ]{0,3}\[\^([^\]]*)\]:\s*(.*)') -TABBED_RE = re.compile(r'((\t)|( ))(.*)') - - -class FootnoteExtension(Extension): - """ Footnote Extension. """ - - def __init__(self, *args, **kwargs): - """ Setup configs. """ - - self.config = { - 'PLACE_MARKER': - ["///Footnotes Go Here///", - "The text string that marks where the footnotes go"], - 'UNIQUE_IDS': - [False, - "Avoid name collisions across " - "multiple calls to reset()."], - "BACKLINK_TEXT": - ["↩", - "The text string that links from the footnote " - "to the reader's place."] - } - super(FootnoteExtension, self).__init__(*args, **kwargs) - - # In multiple invocations, emit links that don't get tangled. - self.unique_prefix = 0 - - self.reset() - - def extendMarkdown(self, md, md_globals): - """ Add pieces to Markdown. """ - md.registerExtension(self) - self.parser = md.parser - self.md = md - # Insert a preprocessor before ReferencePreprocessor - md.preprocessors.add( - "footnote", FootnotePreprocessor(self), "<reference" - ) - # Insert an inline pattern before ImageReferencePattern - FOOTNOTE_RE = r'\[\^([^\]]*)\]' # blah blah [^1] blah - md.inlinePatterns.add( - "footnote", FootnotePattern(FOOTNOTE_RE, self), "<reference" - ) - # Insert a tree-processor that would actually add the footnote div - # This must be before all other treeprocessors (i.e., inline and - # codehilite) so they can run on the contents of the div. - md.treeprocessors.add( - "footnote", FootnoteTreeprocessor(self), "_begin" - ) - # Insert a postprocessor after amp_substitute oricessor - md.postprocessors.add( - "footnote", FootnotePostprocessor(self), ">amp_substitute" - ) - - def reset(self): - """ Clear footnotes on reset, and prepare for distinct document. """ - self.footnotes = OrderedDict() - self.unique_prefix += 1 - - def findFootnotesPlaceholder(self, root): - """ Return ElementTree Element that contains Footnote placeholder. """ - def finder(element): - for child in element: - if child.text: - if child.text.find(self.getConfig("PLACE_MARKER")) > -1: - return child, element, True - if child.tail: - if child.tail.find(self.getConfig("PLACE_MARKER")) > -1: - return child, element, False - child_res = finder(child) - if child_res is not None: - return child_res - return None - - res = finder(root) - return res - - def setFootnote(self, id, text): - """ Store a footnote for later retrieval. """ - self.footnotes[id] = text - - def get_separator(self): - if self.md.output_format in ['html5', 'xhtml5']: - return '-' - return ':' - - def makeFootnoteId(self, id): - """ Return footnote link id. """ - if self.getConfig("UNIQUE_IDS"): - return 'fn%s%d-%s' % (self.get_separator(), self.unique_prefix, id) - else: - return 'fn%s%s' % (self.get_separator(), id) - - def makeFootnoteRefId(self, id): - """ Return footnote back-link id. """ - if self.getConfig("UNIQUE_IDS"): - return 'fnref%s%d-%s' % (self.get_separator(), - self.unique_prefix, id) - else: - return 'fnref%s%s' % (self.get_separator(), id) - - def makeFootnotesDiv(self, root): - """ Return div of footnotes as et Element. """ - - if not list(self.footnotes.keys()): - return None - - div = etree.Element("div") - div.set('class', 'footnote') - etree.SubElement(div, "hr") - ol = etree.SubElement(div, "ol") - - for id in self.footnotes.keys(): - li = etree.SubElement(ol, "li") - li.set("id", self.makeFootnoteId(id)) - self.parser.parseChunk(li, self.footnotes[id]) - backlink = etree.Element("a") - backlink.set("href", "#" + self.makeFootnoteRefId(id)) - if self.md.output_format not in ['html5', 'xhtml5']: - backlink.set("rev", "footnote") # Invalid in HTML5 - backlink.set("class", "footnote-backref") - backlink.set( - "title", - "Jump back to footnote %d in the text" % - (self.footnotes.index(id)+1) - ) - backlink.text = FN_BACKLINK_TEXT - - if li.getchildren(): - node = li[-1] - if node.tag == "p": - node.text = node.text + NBSP_PLACEHOLDER - node.append(backlink) - else: - p = etree.SubElement(li, "p") - p.append(backlink) - return div - - -class FootnotePreprocessor(Preprocessor): - """ Find all footnote references and store for later use. """ - - def __init__(self, footnotes): - self.footnotes = footnotes - - def run(self, lines): - """ - Loop through lines and find, set, and remove footnote definitions. - - Keywords: - - * lines: A list of lines of text - - Return: A list of lines of text with footnote definitions removed. - - """ - newlines = [] - i = 0 - while True: - m = DEF_RE.match(lines[i]) - if m: - fn, _i = self.detectTabbed(lines[i+1:]) - fn.insert(0, m.group(2)) - i += _i-1 # skip past footnote - self.footnotes.setFootnote(m.group(1), "\n".join(fn)) - else: - newlines.append(lines[i]) - if len(lines) > i+1: - i += 1 - else: - break - return newlines - - def detectTabbed(self, lines): - """ Find indented text and remove indent before further proccesing. - - Keyword arguments: - - * lines: an array of strings - - Returns: a list of post processed items and the index of last line. - - """ - items = [] - blank_line = False # have we encountered a blank line yet? - i = 0 # to keep track of where we are - - def detab(line): - match = TABBED_RE.match(line) - if match: - return match.group(4) - - for line in lines: - if line.strip(): # Non-blank line - detabbed_line = detab(line) - if detabbed_line: - items.append(detabbed_line) - i += 1 - continue - elif not blank_line and not DEF_RE.match(line): - # not tabbed but still part of first par. - items.append(line) - i += 1 - continue - else: - return items, i+1 - - else: # Blank line: _maybe_ we are done. - blank_line = True - i += 1 # advance - - # Find the next non-blank line - for j in range(i, len(lines)): - if lines[j].strip(): - next_line = lines[j] - break - else: - break # There is no more text; we are done. - - # Check if the next non-blank line is tabbed - if detab(next_line): # Yes, more work to do. - items.append("") - continue - else: - break # No, we are done. - else: - i += 1 - - return items, i - - -class FootnotePattern(Pattern): - """ InlinePattern for footnote markers in a document's body text. """ - - def __init__(self, pattern, footnotes): - super(FootnotePattern, self).__init__(pattern) - self.footnotes = footnotes - - def handleMatch(self, m): - id = m.group(2) - if id in self.footnotes.footnotes.keys(): - sup = etree.Element("sup") - a = etree.SubElement(sup, "a") - sup.set('id', self.footnotes.makeFootnoteRefId(id)) - a.set('href', '#' + self.footnotes.makeFootnoteId(id)) - if self.footnotes.md.output_format not in ['html5', 'xhtml5']: - a.set('rel', 'footnote') # invalid in HTML5 - a.set('class', 'footnote-ref') - a.text = text_type(self.footnotes.footnotes.index(id) + 1) - return sup - else: - return None - - -class FootnoteTreeprocessor(Treeprocessor): - """ Build and append footnote div to end of document. """ - - def __init__(self, footnotes): - self.footnotes = footnotes - - def run(self, root): - footnotesDiv = self.footnotes.makeFootnotesDiv(root) - if footnotesDiv is not None: - result = self.footnotes.findFootnotesPlaceholder(root) - if result: - child, parent, isText = result - ind = parent.getchildren().index(child) - if isText: - parent.remove(child) - parent.insert(ind, footnotesDiv) - else: - parent.insert(ind + 1, footnotesDiv) - child.tail = None - else: - root.append(footnotesDiv) - - -class FootnotePostprocessor(Postprocessor): - """ Replace placeholders with html entities. """ - def __init__(self, footnotes): - self.footnotes = footnotes - - def run(self, text): - text = text.replace( - FN_BACKLINK_TEXT, self.footnotes.getConfig("BACKLINK_TEXT") - ) - return text.replace(NBSP_PLACEHOLDER, " ") - - -def makeExtension(*args, **kwargs): - """ Return an instance of the FootnoteExtension """ - return FootnoteExtension(*args, **kwargs) diff --git a/src/calibre/ebooks/markdown/extensions/headerid.py b/src/calibre/ebooks/markdown/extensions/headerid.py deleted file mode 100644 index 2cb20b97ab..0000000000 --- a/src/calibre/ebooks/markdown/extensions/headerid.py +++ /dev/null @@ -1,97 +0,0 @@ -""" -HeaderID Extension for Python-Markdown -====================================== - -Auto-generate id attributes for HTML headers. - -See <https://pythonhosted.org/Markdown/extensions/header_id.html> -for documentation. - -Original code Copyright 2007-2011 [Waylan Limberg](http://achinghead.com/). - -All changes Copyright 2011-2014 The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..treeprocessors import Treeprocessor -from ..util import parseBoolValue -from .toc import slugify, unique, stashedHTML2text -import warnings - - -class HeaderIdTreeprocessor(Treeprocessor): - """ Assign IDs to headers. """ - - IDs = set() - - def run(self, doc): - start_level, force_id = self._get_meta() - slugify = self.config['slugify'] - sep = self.config['separator'] - for elem in doc: - if elem.tag in ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']: - if force_id: - if "id" in elem.attrib: - id = elem.get('id') - else: - id = stashedHTML2text(''.join(elem.itertext()), self.md) - id = slugify(id, sep) - elem.set('id', unique(id, self.IDs)) - if start_level: - level = int(elem.tag[-1]) + start_level - if level > 6: - level = 6 - elem.tag = 'h%d' % level - - def _get_meta(self): - """ Return meta data suported by this ext as a tuple """ - level = int(self.config['level']) - 1 - force = parseBoolValue(self.config['forceid']) - if hasattr(self.md, 'Meta'): - if 'header_level' in self.md.Meta: - level = int(self.md.Meta['header_level'][0]) - 1 - if 'header_forceid' in self.md.Meta: - force = parseBoolValue(self.md.Meta['header_forceid'][0]) - return level, force - - -class HeaderIdExtension(Extension): - def __init__(self, *args, **kwargs): - # set defaults - self.config = { - 'level': ['1', 'Base level for headers.'], - 'forceid': ['True', 'Force all headers to have an id.'], - 'separator': ['-', 'Word separator.'], - 'slugify': [slugify, 'Callable to generate anchors'] - } - - super(HeaderIdExtension, self).__init__(*args, **kwargs) - - warnings.warn( - 'The HeaderId Extension is pending deprecation. Use the TOC Extension instead.', - PendingDeprecationWarning - ) - - def extendMarkdown(self, md, md_globals): - md.registerExtension(self) - self.processor = HeaderIdTreeprocessor() - self.processor.md = md - self.processor.config = self.getConfigs() - if 'attr_list' in md.treeprocessors.keys(): - # insert after attr_list treeprocessor - md.treeprocessors.add('headerid', self.processor, '>attr_list') - else: - # insert after 'prettify' treeprocessor. - md.treeprocessors.add('headerid', self.processor, '>prettify') - - def reset(self): - self.processor.IDs = set() - - -def makeExtension(*args, **kwargs): - return HeaderIdExtension(*args, **kwargs) diff --git a/src/calibre/ebooks/markdown/extensions/meta.py b/src/calibre/ebooks/markdown/extensions/meta.py deleted file mode 100644 index 711235ef4a..0000000000 --- a/src/calibre/ebooks/markdown/extensions/meta.py +++ /dev/null @@ -1,78 +0,0 @@ -""" -Meta Data Extension for Python-Markdown -======================================= - -This extension adds Meta Data handling to markdown. - -See <https://pythonhosted.org/Markdown/extensions/meta_data.html> -for documentation. - -Original code Copyright 2007-2008 [Waylan Limberg](http://achinghead.com). - -All changes Copyright 2008-2014 The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..preprocessors import Preprocessor -import re -import logging - -log = logging.getLogger('MARKDOWN') - -# Global Vars -META_RE = re.compile(r'^[ ]{0,3}(?P<key>[A-Za-z0-9_-]+):\s*(?P<value>.*)') -META_MORE_RE = re.compile(r'^[ ]{4,}(?P<value>.*)') -BEGIN_RE = re.compile(r'^-{3}(\s.*)?') -END_RE = re.compile(r'^(-{3}|\.{3})(\s.*)?') - - -class MetaExtension (Extension): - """ Meta-Data extension for Python-Markdown. """ - - def extendMarkdown(self, md, md_globals): - """ Add MetaPreprocessor to Markdown instance. """ - md.preprocessors.add("meta", - MetaPreprocessor(md), - ">normalize_whitespace") - - -class MetaPreprocessor(Preprocessor): - """ Get Meta-Data. """ - - def run(self, lines): - """ Parse Meta-Data and store in Markdown.Meta. """ - meta = {} - key = None - if lines and BEGIN_RE.match(lines[0]): - lines.pop(0) - while lines: - line = lines.pop(0) - m1 = META_RE.match(line) - if line.strip() == '' or END_RE.match(line): - break # blank line or end of YAML header - done - if m1: - key = m1.group('key').lower().strip() - value = m1.group('value').strip() - try: - meta[key].append(value) - except KeyError: - meta[key] = [value] - else: - m2 = META_MORE_RE.match(line) - if m2 and key: - # Add another line to existing key - meta[key].append(m2.group('value').strip()) - else: - lines.insert(0, line) - break # no meta data - done - self.markdown.Meta = meta - return lines - - -def makeExtension(*args, **kwargs): - return MetaExtension(*args, **kwargs) diff --git a/src/calibre/ebooks/markdown/extensions/nl2br.py b/src/calibre/ebooks/markdown/extensions/nl2br.py deleted file mode 100644 index 8acd60c2e1..0000000000 --- a/src/calibre/ebooks/markdown/extensions/nl2br.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -NL2BR Extension -=============== - -A Python-Markdown extension to treat newlines as hard breaks; like -GitHub-flavored Markdown does. - -See <https://pythonhosted.org/Markdown/extensions/nl2br.html> -for documentation. - -Oringinal code Copyright 2011 [Brian Neal](http://deathofagremmie.com/) - -All changes Copyright 2011-2014 The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..inlinepatterns import SubstituteTagPattern - -BR_RE = r'\n' - - -class Nl2BrExtension(Extension): - - def extendMarkdown(self, md, md_globals): - br_tag = SubstituteTagPattern(BR_RE, 'br') - md.inlinePatterns.add('nl', br_tag, '_end') - - -def makeExtension(*args, **kwargs): - return Nl2BrExtension(*args, **kwargs) diff --git a/src/calibre/ebooks/markdown/extensions/sane_lists.py b/src/calibre/ebooks/markdown/extensions/sane_lists.py deleted file mode 100644 index 828ae7ab34..0000000000 --- a/src/calibre/ebooks/markdown/extensions/sane_lists.py +++ /dev/null @@ -1,55 +0,0 @@ -""" -Sane List Extension for Python-Markdown -======================================= - -Modify the behavior of Lists in Python-Markdown to act in a sane manor. - -See <https://pythonhosted.org/Markdown/extensions/sane_lists.html> -for documentation. - -Original code Copyright 2011 [Waylan Limberg](http://achinghead.com) - -All changes Copyright 2011-2014 The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..blockprocessors import OListProcessor, UListProcessor -import re - - -class SaneOListProcessor(OListProcessor): - - SIBLING_TAGS = ['ol'] - - def __init__(self, parser): - super(SaneOListProcessor, self).__init__(parser) - self.CHILD_RE = re.compile(r'^[ ]{0,%d}((\d+\.))[ ]+(.*)' % - (self.tab_length - 1)) - - -class SaneUListProcessor(UListProcessor): - - SIBLING_TAGS = ['ul'] - - def __init__(self, parser): - super(SaneUListProcessor, self).__init__(parser) - self.CHILD_RE = re.compile(r'^[ ]{0,%d}(([*+-]))[ ]+(.*)' % - (self.tab_length - 1)) - - -class SaneListExtension(Extension): - """ Add sane lists to Markdown. """ - - def extendMarkdown(self, md, md_globals): - """ Override existing Processors. """ - md.parser.blockprocessors['olist'] = SaneOListProcessor(md.parser) - md.parser.blockprocessors['ulist'] = SaneUListProcessor(md.parser) - - -def makeExtension(*args, **kwargs): - return SaneListExtension(*args, **kwargs) diff --git a/src/calibre/ebooks/markdown/extensions/smart_strong.py b/src/calibre/ebooks/markdown/extensions/smart_strong.py deleted file mode 100644 index 58570bb55e..0000000000 --- a/src/calibre/ebooks/markdown/extensions/smart_strong.py +++ /dev/null @@ -1,41 +0,0 @@ -''' -Smart_Strong Extension for Python-Markdown -========================================== - -This extention adds smarter handling of double underscores within words. - -See <https://pythonhosted.org/Markdown/extensions/smart_strong.html> -for documentation. - -Original code Copyright 2011 [Waylan Limberg](http://achinghead.com) - -All changes Copyright 2011-2014 The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -''' - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..inlinepatterns import SimpleTagPattern - -SMART_STRONG_RE = r'(?<!\w)(_{2})(?!_)(.+?)(?<!_)\2(?!\w)' -STRONG_RE = r'(\*{2})(.+?)\2' - - -class SmartEmphasisExtension(Extension): - """ Add smart_emphasis extension to Markdown class.""" - - def extendMarkdown(self, md, md_globals): - """ Modify inline patterns. """ - md.inlinePatterns['strong'] = SimpleTagPattern(STRONG_RE, 'strong') - md.inlinePatterns.add( - 'strong2', - SimpleTagPattern(SMART_STRONG_RE, 'strong'), - '>emphasis2' - ) - - -def makeExtension(*args, **kwargs): - return SmartEmphasisExtension(*args, **kwargs) diff --git a/src/calibre/ebooks/markdown/extensions/tables.py b/src/calibre/ebooks/markdown/extensions/tables.py deleted file mode 100644 index 494aaeb3e4..0000000000 --- a/src/calibre/ebooks/markdown/extensions/tables.py +++ /dev/null @@ -1,149 +0,0 @@ -""" -Tables Extension for Python-Markdown -==================================== - -Added parsing of tables to Python-Markdown. - -See <https://pythonhosted.org/Markdown/extensions/tables.html> -for documentation. - -Original code Copyright 2009 [Waylan Limberg](http://achinghead.com) - -All changes Copyright 2008-2014 The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..blockprocessors import BlockProcessor -from ..inlinepatterns import BacktickPattern, BACKTICK_RE -from ..util import etree - - -class TableProcessor(BlockProcessor): - """ Process Tables. """ - - def test(self, parent, block): - rows = block.split('\n') - return (len(rows) > 1 and '|' in rows[0] and - '|' in rows[1] and '-' in rows[1] and - rows[1].strip()[0] in ['|', ':', '-']) - - def run(self, parent, blocks): - """ Parse a table block and build table. """ - block = blocks.pop(0).split('\n') - header = block[0].strip() - seperator = block[1].strip() - rows = [] if len(block) < 3 else block[2:] - # Get format type (bordered by pipes or not) - border = False - if header.startswith('|'): - border = True - # Get alignment of columns - align = [] - for c in self._split_row(seperator, border): - if c.startswith(':') and c.endswith(':'): - align.append('center') - elif c.startswith(':'): - align.append('left') - elif c.endswith(':'): - align.append('right') - else: - align.append(None) - # Build table - table = etree.SubElement(parent, 'table') - thead = etree.SubElement(table, 'thead') - self._build_row(header, thead, align, border) - tbody = etree.SubElement(table, 'tbody') - for row in rows: - self._build_row(row.strip(), tbody, align, border) - - def _build_row(self, row, parent, align, border): - """ Given a row of text, build table cells. """ - tr = etree.SubElement(parent, 'tr') - tag = 'td' - if parent.tag == 'thead': - tag = 'th' - cells = self._split_row(row, border) - # We use align here rather than cells to ensure every row - # contains the same number of columns. - for i, a in enumerate(align): - c = etree.SubElement(tr, tag) - try: - if isinstance(cells[i], str) or isinstance(cells[i], unicode): - c.text = cells[i].strip() - else: - # we've already inserted a code element - c.append(cells[i]) - except IndexError: # pragma: no cover - c.text = "" - if a: - c.set('align', a) - - def _split_row(self, row, border): - """ split a row of text into list of cells. """ - if border: - if row.startswith('|'): - row = row[1:] - if row.endswith('|'): - row = row[:-1] - return self._split(row, '|') - - def _split(self, row, marker): - """ split a row of text with some code into a list of cells. """ - if self._row_has_unpaired_backticks(row): - # fallback on old behaviour - return row.split(marker) - # modify the backtick pattern to only match at the beginning of the search string - backtick_pattern = BacktickPattern('^' + BACKTICK_RE) - elements = [] - current = '' - i = 0 - while i < len(row): - letter = row[i] - if letter == marker: - if current != '' or len(elements) == 0: - # Don't append empty string unless it is the first element - # The border is already removed when we get the row, then the line is strip()'d - # If the first element is a marker, then we have an empty first cell - elements.append(current) - current = '' - else: - match = backtick_pattern.getCompiledRegExp().match(row[i:]) - if not match: - current += letter - else: - groups = match.groups() - delim = groups[1] # the code block delimeter (ie 1 or more backticks) - row_contents = groups[2] # the text contained inside the code block - i += match.start(4) # jump pointer to the beginning of the rest of the text (group #4) - element = delim + row_contents + delim # reinstert backticks - current += element - i += 1 - elements.append(current) - return elements - - def _row_has_unpaired_backticks(self, row): - count_total_backtick = row.count('`') - count_escaped_backtick = row.count('\`') - count_backtick = count_total_backtick - count_escaped_backtick - # odd number of backticks, - # we won't be able to build correct code blocks - return count_backtick & 1 - - -class TableExtension(Extension): - """ Add tables to Markdown. """ - - def extendMarkdown(self, md, md_globals): - """ Add an instance of TableProcessor to BlockParser. """ - md.parser.blockprocessors.add('table', - TableProcessor(md.parser), - '<hashheader') - - -def makeExtension(*args, **kwargs): - return TableExtension(*args, **kwargs) diff --git a/src/calibre/ebooks/markdown/extensions/toc.py b/src/calibre/ebooks/markdown/extensions/toc.py deleted file mode 100644 index b3cf898f42..0000000000 --- a/src/calibre/ebooks/markdown/extensions/toc.py +++ /dev/null @@ -1,309 +0,0 @@ -""" -Table of Contents Extension for Python-Markdown -=============================================== - -See <https://pythonhosted.org/Markdown/extensions/toc.html> -for documentation. - -Oringinal code Copyright 2008 [Jack Miller](http://codezen.org) - -All changes Copyright 2008-2014 The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..treeprocessors import Treeprocessor -from ..util import etree, parseBoolValue, AMP_SUBSTITUTE, HTML_PLACEHOLDER_RE, string_type -import re -import unicodedata - - -def slugify(value, separator): - """ Slugify a string, to make it URL friendly. """ - value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore') - value = re.sub('[^\w\s-]', '', value.decode('ascii')).strip().lower() - return re.sub('[%s\s]+' % separator, separator, value) - - -IDCOUNT_RE = re.compile(r'^(.*)_([0-9]+)$') - - -def unique(id, ids): - """ Ensure id is unique in set of ids. Append '_1', '_2'... if not """ - while id in ids or not id: - m = IDCOUNT_RE.match(id) - if m: - id = '%s_%d' % (m.group(1), int(m.group(2))+1) - else: - id = '%s_%d' % (id, 1) - ids.add(id) - return id - - -def stashedHTML2text(text, md): - """ Extract raw HTML from stash, reduce to plain text and swap with placeholder. """ - def _html_sub(m): - """ Substitute raw html with plain text. """ - try: - raw, safe = md.htmlStash.rawHtmlBlocks[int(m.group(1))] - except (IndexError, TypeError): # pragma: no cover - return m.group(0) - if md.safeMode and not safe: # pragma: no cover - return '' - # Strip out tags and entities - leaveing text - return re.sub(r'(<[^>]+>)|(&[\#a-zA-Z0-9]+;)', '', raw) - - return HTML_PLACEHOLDER_RE.sub(_html_sub, text) - - -def nest_toc_tokens(toc_list): - """Given an unsorted list with errors and skips, return a nested one. - [{'level': 1}, {'level': 2}] - => - [{'level': 1, 'children': [{'level': 2, 'children': []}]}] - - A wrong list is also converted: - [{'level': 2}, {'level': 1}] - => - [{'level': 2, 'children': []}, {'level': 1, 'children': []}] - """ - - ordered_list = [] - if len(toc_list): - # Initialize everything by processing the first entry - last = toc_list.pop(0) - last['children'] = [] - levels = [last['level']] - ordered_list.append(last) - parents = [] - - # Walk the rest nesting the entries properly - while toc_list: - t = toc_list.pop(0) - current_level = t['level'] - t['children'] = [] - - # Reduce depth if current level < last item's level - if current_level < levels[-1]: - # Pop last level since we know we are less than it - levels.pop() - - # Pop parents and levels we are less than or equal to - to_pop = 0 - for p in reversed(parents): - if current_level <= p['level']: - to_pop += 1 - else: # pragma: no cover - break - if to_pop: - levels = levels[:-to_pop] - parents = parents[:-to_pop] - - # Note current level as last - levels.append(current_level) - - # Level is the same, so append to - # the current parent (if available) - if current_level == levels[-1]: - (parents[-1]['children'] if parents - else ordered_list).append(t) - - # Current level is > last item's level, - # So make last item a parent and append current as child - else: - last['children'].append(t) - parents.append(last) - levels.append(current_level) - last = t - - return ordered_list - - -class TocTreeprocessor(Treeprocessor): - def __init__(self, md, config): - super(TocTreeprocessor, self).__init__(md) - - self.marker = config["marker"] - self.title = config["title"] - self.base_level = int(config["baselevel"]) - 1 - self.slugify = config["slugify"] - self.sep = config["separator"] - self.use_anchors = parseBoolValue(config["anchorlink"]) - self.use_permalinks = parseBoolValue(config["permalink"], False) - if self.use_permalinks is None: - self.use_permalinks = config["permalink"] - - self.header_rgx = re.compile("[Hh][123456]") - - def iterparent(self, root): - ''' Iterator wrapper to get parent and child all at once. ''' - for parent in root.iter(): - for child in parent: - yield parent, child - - def replace_marker(self, root, elem): - ''' Replace marker with elem. ''' - for (p, c) in self.iterparent(root): - text = ''.join(c.itertext()).strip() - if not text: - continue - - # To keep the output from screwing up the - # validation by putting a <div> inside of a <p> - # we actually replace the <p> in its entirety. - # We do not allow the marker inside a header as that - # would causes an enless loop of placing a new TOC - # inside previously generated TOC. - if c.text and c.text.strip() == self.marker and \ - not self.header_rgx.match(c.tag) and c.tag not in ['pre', 'code']: - for i in range(len(p)): - if p[i] == c: - p[i] = elem - break - - def set_level(self, elem): - ''' Adjust header level according to base level. ''' - level = int(elem.tag[-1]) + self.base_level - if level > 6: - level = 6 - elem.tag = 'h%d' % level - - def add_anchor(self, c, elem_id): # @ReservedAssignment - anchor = etree.Element("a") - anchor.text = c.text - anchor.attrib["href"] = "#" + elem_id - anchor.attrib["class"] = "toclink" - c.text = "" - for elem in c: - anchor.append(elem) - c.remove(elem) - c.append(anchor) - - def add_permalink(self, c, elem_id): - permalink = etree.Element("a") - permalink.text = ("%spara;" % AMP_SUBSTITUTE - if self.use_permalinks is True - else self.use_permalinks) - permalink.attrib["href"] = "#" + elem_id - permalink.attrib["class"] = "headerlink" - permalink.attrib["title"] = "Permanent link" - c.append(permalink) - - def build_toc_div(self, toc_list): - """ Return a string div given a toc list. """ - div = etree.Element("div") - div.attrib["class"] = "toc" - - # Add title to the div - if self.title: - header = etree.SubElement(div, "span") - header.attrib["class"] = "toctitle" - header.text = self.title - - def build_etree_ul(toc_list, parent): - ul = etree.SubElement(parent, "ul") - for item in toc_list: - # List item link, to be inserted into the toc div - li = etree.SubElement(ul, "li") - link = etree.SubElement(li, "a") - link.text = item.get('name', '') - link.attrib["href"] = '#' + item.get('id', '') - if item['children']: - build_etree_ul(item['children'], li) - return ul - - build_etree_ul(toc_list, div) - prettify = self.markdown.treeprocessors.get('prettify') - if prettify: - prettify.run(div) - return div - - def run(self, doc): - # Get a list of id attributes - used_ids = set() - for el in doc.iter(): - if "id" in el.attrib: - used_ids.add(el.attrib["id"]) - - toc_tokens = [] - for el in doc.iter(): - if isinstance(el.tag, string_type) and self.header_rgx.match(el.tag): - self.set_level(el) - text = ''.join(el.itertext()).strip() - - # Do not override pre-existing ids - if "id" not in el.attrib: - innertext = stashedHTML2text(text, self.markdown) - el.attrib["id"] = unique(self.slugify(innertext, self.sep), used_ids) - - toc_tokens.append({ - 'level': int(el.tag[-1]), - 'id': el.attrib["id"], - 'name': text - }) - - if self.use_anchors: - self.add_anchor(el, el.attrib["id"]) - if self.use_permalinks: - self.add_permalink(el, el.attrib["id"]) - - div = self.build_toc_div(nest_toc_tokens(toc_tokens)) - if self.marker: - self.replace_marker(doc, div) - - # serialize and attach to markdown instance. - toc = self.markdown.serializer(div) - for pp in self.markdown.postprocessors.values(): - toc = pp.run(toc) - self.markdown.toc = toc - - -class TocExtension(Extension): - - TreeProcessorClass = TocTreeprocessor - - def __init__(self, *args, **kwargs): - self.config = { - "marker": ['[TOC]', - 'Text to find and replace with Table of Contents - ' - 'Set to an empty string to disable. Defaults to "[TOC]"'], - "title": ["", - "Title to insert into TOC <div> - " - "Defaults to an empty string"], - "anchorlink": [False, - "True if header should be a self link - " - "Defaults to False"], - "permalink": [0, - "True or link text if a Sphinx-style permalink should " - "be added - Defaults to False"], - "baselevel": ['1', 'Base level for headers.'], - "slugify": [slugify, - "Function to generate anchors based on header text - " - "Defaults to the headerid ext's slugify function."], - 'separator': ['-', 'Word separator. Defaults to "-".'] - } - - super(TocExtension, self).__init__(*args, **kwargs) - - def extendMarkdown(self, md, md_globals): - md.registerExtension(self) - self.md = md - self.reset() - tocext = self.TreeProcessorClass(md, self.getConfigs()) - # Headerid ext is set to '>prettify'. With this set to '_end', - # it should always come after headerid ext (and honor ids assinged - # by the header id extension) if both are used. Same goes for - # attr_list extension. This must come last because we don't want - # to redefine ids after toc is created. But we do want toc prettified. - md.treeprocessors.add("toc", tocext, "_end") - - def reset(self): - self.md.toc = '' - - -def makeExtension(*args, **kwargs): - return TocExtension(*args, **kwargs) diff --git a/src/calibre/ebooks/markdown/extensions/wikilinks.py b/src/calibre/ebooks/markdown/extensions/wikilinks.py deleted file mode 100644 index 94e1b67948..0000000000 --- a/src/calibre/ebooks/markdown/extensions/wikilinks.py +++ /dev/null @@ -1,89 +0,0 @@ -''' -WikiLinks Extension for Python-Markdown -====================================== - -Converts [[WikiLinks]] to relative links. - -See <https://pythonhosted.org/Markdown/extensions/wikilinks.html> -for documentation. - -Original code Copyright [Waylan Limberg](http://achinghead.com/). - -All changes Copyright The Python Markdown Project - -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) - -''' - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import Extension -from ..inlinepatterns import Pattern -from ..util import etree -import re - - -def build_url(label, base, end): - """ Build a url from the label, a base, and an end. """ - clean_label = re.sub(r'([ ]+_)|(_[ ]+)|([ ]+)', '_', label) - return '%s%s%s' % (base, clean_label, end) - - -class WikiLinkExtension(Extension): - - def __init__(self, *args, **kwargs): - self.config = { - 'base_url': ['/', 'String to append to beginning or URL.'], - 'end_url': ['/', 'String to append to end of URL.'], - 'html_class': ['wikilink', 'CSS hook. Leave blank for none.'], - 'build_url': [build_url, 'Callable formats URL from label.'], - } - - super(WikiLinkExtension, self).__init__(*args, **kwargs) - - def extendMarkdown(self, md, md_globals): - self.md = md - - # append to end of inline patterns - WIKILINK_RE = r'\[\[([\w0-9_ -]+)\]\]' - wikilinkPattern = WikiLinks(WIKILINK_RE, self.getConfigs()) - wikilinkPattern.md = md - md.inlinePatterns.add('wikilink', wikilinkPattern, "<not_strong") - - -class WikiLinks(Pattern): - def __init__(self, pattern, config): - super(WikiLinks, self).__init__(pattern) - self.config = config - - def handleMatch(self, m): - if m.group(2).strip(): - base_url, end_url, html_class = self._getMeta() - label = m.group(2).strip() - url = self.config['build_url'](label, base_url, end_url) - a = etree.Element('a') - a.text = label - a.set('href', url) - if html_class: - a.set('class', html_class) - else: - a = '' - return a - - def _getMeta(self): - """ Return meta data or config data. """ - base_url = self.config['base_url'] - end_url = self.config['end_url'] - html_class = self.config['html_class'] - if hasattr(self.md, 'Meta'): - if 'wiki_base_url' in self.md.Meta: - base_url = self.md.Meta['wiki_base_url'][0] - if 'wiki_end_url' in self.md.Meta: - end_url = self.md.Meta['wiki_end_url'][0] - if 'wiki_html_class' in self.md.Meta: - html_class = self.md.Meta['wiki_html_class'][0] - return base_url, end_url, html_class - - -def makeExtension(*args, **kwargs): - return WikiLinkExtension(*args, **kwargs) diff --git a/src/calibre/ebooks/markdown/inlinepatterns.py b/src/calibre/ebooks/markdown/inlinepatterns.py deleted file mode 100644 index 95d358d715..0000000000 --- a/src/calibre/ebooks/markdown/inlinepatterns.py +++ /dev/null @@ -1,529 +0,0 @@ -""" -INLINE PATTERNS -============================================================================= - -Inline patterns such as *emphasis* are handled by means of auxiliary -objects, one per pattern. Pattern objects must be instances of classes -that extend markdown.Pattern. Each pattern object uses a single regular -expression and needs support the following methods: - - pattern.getCompiledRegExp() # returns a regular expression - - pattern.handleMatch(m) # takes a match object and returns - # an ElementTree element or just plain text - -All of python markdown's built-in patterns subclass from Pattern, -but you can add additional patterns that don't. - -Also note that all the regular expressions used by inline must -capture the whole block. For this reason, they all start with -'^(.*)' and end with '(.*)!'. In case with built-in expression -Pattern takes care of adding the "^(.*)" and "(.*)!". - -Finally, the order in which regular expressions are applied is very -important - e.g. if we first replace http://.../ links with <a> tags -and _then_ try to replace inline html, we would end up with a mess. -So, we apply the expressions in the following order: - -* escape and backticks have to go before everything else, so - that we can preempt any markdown patterns by escaping them. - -* then we handle auto-links (must be done before inline html) - -* then we handle inline HTML. At this point we will simply - replace all inline HTML strings with a placeholder and add - the actual HTML to a hash. - -* then inline images (must be done before links) - -* then bracketed links, first regular then reference-style - -* finally we apply strong and emphasis -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import util -from . import odict -import re -try: # pragma: no cover - from urllib.parse import urlparse, urlunparse -except ImportError: # pragma: no cover - from urlparse import urlparse, urlunparse -try: # pragma: no cover - from html import entities -except ImportError: # pragma: no cover - import htmlentitydefs as entities - - -def build_inlinepatterns(md_instance, **kwargs): - """ Build the default set of inline patterns for Markdown. """ - inlinePatterns = odict.OrderedDict() - inlinePatterns["backtick"] = BacktickPattern(BACKTICK_RE) - inlinePatterns["escape"] = EscapePattern(ESCAPE_RE, md_instance) - inlinePatterns["reference"] = ReferencePattern(REFERENCE_RE, md_instance) - inlinePatterns["link"] = LinkPattern(LINK_RE, md_instance) - inlinePatterns["image_link"] = ImagePattern(IMAGE_LINK_RE, md_instance) - inlinePatterns["image_reference"] = ImageReferencePattern( - IMAGE_REFERENCE_RE, md_instance - ) - inlinePatterns["short_reference"] = ReferencePattern( - SHORT_REF_RE, md_instance - ) - inlinePatterns["autolink"] = AutolinkPattern(AUTOLINK_RE, md_instance) - inlinePatterns["automail"] = AutomailPattern(AUTOMAIL_RE, md_instance) - inlinePatterns["linebreak"] = SubstituteTagPattern(LINE_BREAK_RE, 'br') - if md_instance.safeMode != 'escape': - inlinePatterns["html"] = HtmlPattern(HTML_RE, md_instance) - inlinePatterns["entity"] = HtmlPattern(ENTITY_RE, md_instance) - inlinePatterns["not_strong"] = SimpleTextPattern(NOT_STRONG_RE) - inlinePatterns["em_strong"] = DoubleTagPattern(EM_STRONG_RE, 'strong,em') - inlinePatterns["strong_em"] = DoubleTagPattern(STRONG_EM_RE, 'em,strong') - inlinePatterns["strong"] = SimpleTagPattern(STRONG_RE, 'strong') - inlinePatterns["emphasis"] = SimpleTagPattern(EMPHASIS_RE, 'em') - if md_instance.smart_emphasis: - inlinePatterns["emphasis2"] = SimpleTagPattern(SMART_EMPHASIS_RE, 'em') - else: - inlinePatterns["emphasis2"] = SimpleTagPattern(EMPHASIS_2_RE, 'em') - return inlinePatterns - -""" -The actual regular expressions for patterns ------------------------------------------------------------------------------ -""" - -NOBRACKET = r'[^\]\[]*' -BRK = ( - r'\[(' + - (NOBRACKET + r'(\[')*6 + - (NOBRACKET + r'\])*')*6 + - NOBRACKET + r')\]' -) -NOIMG = r'(?<!\!)' - -# `e=f()` or ``e=f("`")`` -BACKTICK_RE = r'(?<!\\)(`+)(.+?)(?<!`)\2(?!`)' - -# \< -ESCAPE_RE = r'\\(.)' - -# *emphasis* -EMPHASIS_RE = r'(\*)([^\*]+)\2' - -# **strong** -STRONG_RE = r'(\*{2}|_{2})(.+?)\2' - -# ***strongem*** or ***em*strong** -EM_STRONG_RE = r'(\*|_)\2{2}(.+?)\2(.*?)\2{2}' - -# ***strong**em* -STRONG_EM_RE = r'(\*|_)\2{2}(.+?)\2{2}(.*?)\2' - -# _smart_emphasis_ -SMART_EMPHASIS_RE = r'(?<!\w)(_)(?!_)(.+?)(?<!_)\2(?!\w)' - -# _emphasis_ -EMPHASIS_2_RE = r'(_)(.+?)\2' - -# [text](url) or [text](<url>) or [text](url "title") -LINK_RE = NOIMG + BRK + \ - r'''\(\s*(<.*?>|((?:(?:\(.*?\))|[^\(\)]))*?)\s*((['"])(.*?)\12\s*)?\)''' - -# ![alttxt](http://x.com/) or ![alttxt](<http://x.com/>) -IMAGE_LINK_RE = r'\!' + BRK + r'\s*\((<.*?>|([^")]+"[^"]*"|[^\)]*))\)' - -# [Google][3] -REFERENCE_RE = NOIMG + BRK + r'\s?\[([^\]]*)\]' - -# [Google] -SHORT_REF_RE = NOIMG + r'\[([^\]]+)\]' - -# ![alt text][2] -IMAGE_REFERENCE_RE = r'\!' + BRK + '\s?\[([^\]]*)\]' - -# stand-alone * or _ -NOT_STRONG_RE = r'((^| )(\*|_)( |$))' - -# <http://www.123.com> -AUTOLINK_RE = r'<((?:[Ff]|[Hh][Tt])[Tt][Pp][Ss]?://[^>]*)>' - -# <me@example.com> -AUTOMAIL_RE = r'<([^> \!]*@[^> ]*)>' - -# <...> -HTML_RE = r'(\<([a-zA-Z/][^\>]*?|\!--.*?--)\>)' - -# & -ENTITY_RE = r'(&[\#a-zA-Z0-9]*;)' - -# two spaces at end of line -LINE_BREAK_RE = r' \n' - - -def dequote(string): - """Remove quotes from around a string.""" - if ((string.startswith('"') and string.endswith('"')) or - (string.startswith("'") and string.endswith("'"))): - return string[1:-1] - else: - return string - - -ATTR_RE = re.compile("\{@([^\}]*)=([^\}]*)}") # {@id=123} - - -def handleAttributes(text, parent): - """Set values of an element based on attribute definitions ({@id=123}).""" - def attributeCallback(match): - parent.set(match.group(1), match.group(2).replace('\n', ' ')) - return ATTR_RE.sub(attributeCallback, text) - - -""" -The pattern classes ------------------------------------------------------------------------------ -""" - - -class Pattern(object): - """Base class that inline patterns subclass. """ - - def __init__(self, pattern, markdown_instance=None): - """ - Create an instant of an inline pattern. - - Keyword arguments: - - * pattern: A regular expression that matches a pattern - - """ - self.pattern = pattern - self.compiled_re = re.compile("^(.*?)%s(.*?)$" % pattern, - re.DOTALL | re.UNICODE) - - # Api for Markdown to pass safe_mode into instance - self.safe_mode = False - if markdown_instance: - self.markdown = markdown_instance - - def getCompiledRegExp(self): - """ Return a compiled regular expression. """ - return self.compiled_re - - def handleMatch(self, m): - """Return a ElementTree element from the given match. - - Subclasses should override this method. - - Keyword arguments: - - * m: A re match object containing a match of the pattern. - - """ - pass # pragma: no cover - - def type(self): - """ Return class name, to define pattern type """ - return self.__class__.__name__ - - def unescape(self, text): - """ Return unescaped text given text with an inline placeholder. """ - try: - stash = self.markdown.treeprocessors['inline'].stashed_nodes - except KeyError: # pragma: no cover - return text - - def itertext(el): # pragma: no cover - ' Reimplement Element.itertext for older python versions ' - tag = el.tag - if not isinstance(tag, util.string_type) and tag is not None: - return - if el.text: - yield el.text - for e in el: - for s in itertext(e): - yield s - if e.tail: - yield e.tail - - def get_stash(m): - id = m.group(1) - if id in stash: - value = stash.get(id) - if isinstance(value, util.string_type): - return value - else: - # An etree Element - return text content only - return ''.join(itertext(value)) - return util.INLINE_PLACEHOLDER_RE.sub(get_stash, text) - - -class SimpleTextPattern(Pattern): - """ Return a simple text of group(2) of a Pattern. """ - def handleMatch(self, m): - return m.group(2) - - -class EscapePattern(Pattern): - """ Return an escaped character. """ - - def handleMatch(self, m): - char = m.group(2) - if char in self.markdown.ESCAPED_CHARS: - return '%s%s%s' % (util.STX, ord(char), util.ETX) - else: - return None - - -class SimpleTagPattern(Pattern): - """ - Return element of type `tag` with a text attribute of group(3) - of a Pattern. - - """ - def __init__(self, pattern, tag): - Pattern.__init__(self, pattern) - self.tag = tag - - def handleMatch(self, m): - el = util.etree.Element(self.tag) - el.text = m.group(3) - return el - - -class SubstituteTagPattern(SimpleTagPattern): - """ Return an element of type `tag` with no children. """ - def handleMatch(self, m): - return util.etree.Element(self.tag) - - -class BacktickPattern(Pattern): - """ Return a `<code>` element containing the matching text. """ - def __init__(self, pattern): - Pattern.__init__(self, pattern) - self.tag = "code" - - def handleMatch(self, m): - el = util.etree.Element(self.tag) - el.text = util.AtomicString(m.group(3).strip()) - return el - - -class DoubleTagPattern(SimpleTagPattern): - """Return a ElementTree element nested in tag2 nested in tag1. - - Useful for strong emphasis etc. - - """ - def handleMatch(self, m): - tag1, tag2 = self.tag.split(",") - el1 = util.etree.Element(tag1) - el2 = util.etree.SubElement(el1, tag2) - el2.text = m.group(3) - if len(m.groups()) == 5: - el2.tail = m.group(4) - return el1 - - -class HtmlPattern(Pattern): - """ Store raw inline html and return a placeholder. """ - def handleMatch(self, m): - rawhtml = self.unescape(m.group(2)) - place_holder = self.markdown.htmlStash.store(rawhtml) - return place_holder - - def unescape(self, text): - """ Return unescaped text given text with an inline placeholder. """ - try: - stash = self.markdown.treeprocessors['inline'].stashed_nodes - except KeyError: # pragma: no cover - return text - - def get_stash(m): - id = m.group(1) - value = stash.get(id) - if value is not None: - try: - return self.markdown.serializer(value) - except: - return '\%s' % value - - return util.INLINE_PLACEHOLDER_RE.sub(get_stash, text) - - -class LinkPattern(Pattern): - """ Return a link element from the given match. """ - def handleMatch(self, m): - el = util.etree.Element("a") - el.text = m.group(2) - title = m.group(13) - href = m.group(9) - - if href: - if href[0] == "<": - href = href[1:-1] - el.set("href", self.sanitize_url(self.unescape(href.strip()))) - else: - el.set("href", "") - - if title: - title = dequote(self.unescape(title)) - el.set("title", title) - return el - - def sanitize_url(self, url): - """ - Sanitize a url against xss attacks in "safe_mode". - - Rather than specifically blacklisting `javascript:alert("XSS")` and all - its aliases (see <http://ha.ckers.org/xss.html>), we whitelist known - safe url formats. Most urls contain a network location, however some - are known not to (i.e.: mailto links). Script urls do not contain a - location. Additionally, for `javascript:...`, the scheme would be - "javascript" but some aliases will appear to `urlparse()` to have no - scheme. On top of that relative links (i.e.: "foo/bar.html") have no - scheme. Therefore we must check "path", "parameters", "query" and - "fragment" for any literal colons. We don't check "scheme" for colons - because it *should* never have any and "netloc" must allow the form: - `username:password@host:port`. - - """ - if not self.markdown.safeMode: - # Return immediately bipassing parsing. - return url - - try: - scheme, netloc, path, params, query, fragment = url = urlparse(url) - except ValueError: # pragma: no cover - # Bad url - so bad it couldn't be parsed. - return '' - - locless_schemes = ['', 'mailto', 'news'] - allowed_schemes = locless_schemes + ['http', 'https', 'ftp', 'ftps'] - if scheme not in allowed_schemes: - # Not a known (allowed) scheme. Not safe. - return '' - - if netloc == '' and scheme not in locless_schemes: # pragma: no cover - # This should not happen. Treat as suspect. - return '' - - for part in url[2:]: - if ":" in part: - # A colon in "path", "parameters", "query" - # or "fragment" is suspect. - return '' - - # Url passes all tests. Return url as-is. - return urlunparse(url) - - -class ImagePattern(LinkPattern): - """ Return a img element from the given match. """ - def handleMatch(self, m): - el = util.etree.Element("img") - src_parts = m.group(9).split() - if src_parts: - src = src_parts[0] - if src[0] == "<" and src[-1] == ">": - src = src[1:-1] - el.set('src', self.sanitize_url(self.unescape(src))) - else: - el.set('src', "") - if len(src_parts) > 1: - el.set('title', dequote(self.unescape(" ".join(src_parts[1:])))) - - if self.markdown.enable_attributes: - truealt = handleAttributes(m.group(2), el) - else: - truealt = m.group(2) - - el.set('alt', self.unescape(truealt)) - return el - - -class ReferencePattern(LinkPattern): - """ Match to a stored reference and return link element. """ - - NEWLINE_CLEANUP_RE = re.compile(r'[ ]?\n', re.MULTILINE) - - def handleMatch(self, m): - try: - id = m.group(9).lower() - except IndexError: - id = None - if not id: - # if we got something like "[Google][]" or "[Goggle]" - # we'll use "google" as the id - id = m.group(2).lower() - - # Clean up linebreaks in id - id = self.NEWLINE_CLEANUP_RE.sub(' ', id) - if id not in self.markdown.references: # ignore undefined refs - return None - href, title = self.markdown.references[id] - - text = m.group(2) - return self.makeTag(href, title, text) - - def makeTag(self, href, title, text): - el = util.etree.Element('a') - - el.set('href', self.sanitize_url(href)) - if title: - el.set('title', title) - - el.text = text - return el - - -class ImageReferencePattern(ReferencePattern): - """ Match to a stored reference and return img element. """ - def makeTag(self, href, title, text): - el = util.etree.Element("img") - el.set("src", self.sanitize_url(href)) - if title: - el.set("title", title) - - if self.markdown.enable_attributes: - text = handleAttributes(text, el) - - el.set("alt", self.unescape(text)) - return el - - -class AutolinkPattern(Pattern): - """ Return a link Element given an autolink (`<http://example/com>`). """ - def handleMatch(self, m): - el = util.etree.Element("a") - el.set('href', self.unescape(m.group(2))) - el.text = util.AtomicString(m.group(2)) - return el - - -class AutomailPattern(Pattern): - """ - Return a mailto link Element given an automail link (`<foo@example.com>`). - """ - def handleMatch(self, m): - el = util.etree.Element('a') - email = self.unescape(m.group(2)) - if email.startswith("mailto:"): - email = email[len("mailto:"):] - - def codepoint2name(code): - """Return entity definition by code, or the code if not defined.""" - entity = entities.codepoint2name.get(code) - if entity: - return "%s%s;" % (util.AMP_SUBSTITUTE, entity) - else: - return "%s#%d;" % (util.AMP_SUBSTITUTE, code) - - letters = [codepoint2name(ord(letter)) for letter in email] - el.text = util.AtomicString(''.join(letters)) - - mailto = "mailto:" + email - mailto = "".join([util.AMP_SUBSTITUTE + '#%d;' % - ord(letter) for letter in mailto]) - el.set('href', mailto) - return el diff --git a/src/calibre/ebooks/markdown/odict.py b/src/calibre/ebooks/markdown/odict.py deleted file mode 100644 index 584ad7c173..0000000000 --- a/src/calibre/ebooks/markdown/odict.py +++ /dev/null @@ -1,191 +0,0 @@ -from __future__ import unicode_literals -from __future__ import absolute_import -from . import util -from copy import deepcopy - - -class OrderedDict(dict): - """ - A dictionary that keeps its keys in the order in which they're inserted. - - Copied from Django's SortedDict with some modifications. - - """ - def __new__(cls, *args, **kwargs): - instance = super(OrderedDict, cls).__new__(cls, *args, **kwargs) - instance.keyOrder = [] - return instance - - def __init__(self, data=None): - if data is None or isinstance(data, dict): - data = data or [] - super(OrderedDict, self).__init__(data) - self.keyOrder = list(data) if data else [] - else: - super(OrderedDict, self).__init__() - super_set = super(OrderedDict, self).__setitem__ - for key, value in data: - # Take the ordering from first key - if key not in self: - self.keyOrder.append(key) - # But override with last value in data (dict() does this) - super_set(key, value) - - def __deepcopy__(self, memo): - return self.__class__([(key, deepcopy(value, memo)) - for key, value in self.items()]) - - def __copy__(self): - # The Python's default copy implementation will alter the state - # of self. The reason for this seems complex but is likely related to - # subclassing dict. - return self.copy() - - def __setitem__(self, key, value): - if key not in self: - self.keyOrder.append(key) - super(OrderedDict, self).__setitem__(key, value) - - def __delitem__(self, key): - super(OrderedDict, self).__delitem__(key) - self.keyOrder.remove(key) - - def __iter__(self): - return iter(self.keyOrder) - - def __reversed__(self): - return reversed(self.keyOrder) - - def pop(self, k, *args): - result = super(OrderedDict, self).pop(k, *args) - try: - self.keyOrder.remove(k) - except ValueError: - # Key wasn't in the dictionary in the first place. No problem. - pass - return result - - def popitem(self): - result = super(OrderedDict, self).popitem() - self.keyOrder.remove(result[0]) - return result - - def _iteritems(self): - for key in self.keyOrder: - yield key, self[key] - - def _iterkeys(self): - for key in self.keyOrder: - yield key - - def _itervalues(self): - for key in self.keyOrder: - yield self[key] - - if util.PY3: # pragma: no cover - items = _iteritems - keys = _iterkeys - values = _itervalues - else: # pragma: no cover - iteritems = _iteritems - iterkeys = _iterkeys - itervalues = _itervalues - - def items(self): - return [(k, self[k]) for k in self.keyOrder] - - def keys(self): - return self.keyOrder[:] - - def values(self): - return [self[k] for k in self.keyOrder] - - def update(self, dict_): - for k in dict_: - self[k] = dict_[k] - - def setdefault(self, key, default): - if key not in self: - self.keyOrder.append(key) - return super(OrderedDict, self).setdefault(key, default) - - def value_for_index(self, index): - """Returns the value of the item at the given zero-based index.""" - return self[self.keyOrder[index]] - - def insert(self, index, key, value): - """Inserts the key, value pair before the item with the given index.""" - if key in self.keyOrder: - n = self.keyOrder.index(key) - del self.keyOrder[n] - if n < index: - index -= 1 - self.keyOrder.insert(index, key) - super(OrderedDict, self).__setitem__(key, value) - - def copy(self): - """Returns a copy of this object.""" - # This way of initializing the copy means it works for subclasses, too. - return self.__class__(self) - - def __repr__(self): - """ - Replaces the normal dict.__repr__ with a version that returns the keys - in their Ordered order. - """ - return '{%s}' % ', '.join( - ['%r: %r' % (k, v) for k, v in self._iteritems()] - ) - - def clear(self): - super(OrderedDict, self).clear() - self.keyOrder = [] - - def index(self, key): - """ Return the index of a given key. """ - try: - return self.keyOrder.index(key) - except ValueError: - raise ValueError("Element '%s' was not found in OrderedDict" % key) - - def index_for_location(self, location): - """ Return index or None for a given location. """ - if location == '_begin': - i = 0 - elif location == '_end': - i = None - elif location.startswith('<') or location.startswith('>'): - i = self.index(location[1:]) - if location.startswith('>'): - if i >= len(self): - # last item - i = None - else: - i += 1 - else: - raise ValueError('Not a valid location: "%s". Location key ' - 'must start with a ">" or "<".' % location) - return i - - def add(self, key, value, location): - """ Insert by key location. """ - i = self.index_for_location(location) - if i is not None: - self.insert(i, key, value) - else: - self.__setitem__(key, value) - - def link(self, key, location): - """ Change location of an existing item. """ - n = self.keyOrder.index(key) - del self.keyOrder[n] - try: - i = self.index_for_location(location) - if i is not None: - self.keyOrder.insert(i, key) - else: - self.keyOrder.append(key) - except Exception as e: - # restore to prevent data loss and reraise - self.keyOrder.insert(n, key) - raise e diff --git a/src/calibre/ebooks/markdown/postprocessors.py b/src/calibre/ebooks/markdown/postprocessors.py deleted file mode 100644 index 2d4dcb589e..0000000000 --- a/src/calibre/ebooks/markdown/postprocessors.py +++ /dev/null @@ -1,108 +0,0 @@ -""" -POST-PROCESSORS -============================================================================= - -Markdown also allows post-processors, which are similar to preprocessors in -that they need to implement a "run" method. However, they are run after core -processing. - -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import util -from . import odict -import re - - -def build_postprocessors(md_instance, **kwargs): - """ Build the default postprocessors for Markdown. """ - postprocessors = odict.OrderedDict() - postprocessors["raw_html"] = RawHtmlPostprocessor(md_instance) - postprocessors["amp_substitute"] = AndSubstitutePostprocessor() - postprocessors["unescape"] = UnescapePostprocessor() - return postprocessors - - -class Postprocessor(util.Processor): - """ - Postprocessors are run after the ElementTree it converted back into text. - - Each Postprocessor implements a "run" method that takes a pointer to a - text string, modifies it as necessary and returns a text string. - - Postprocessors must extend markdown.Postprocessor. - - """ - - def run(self, text): - """ - Subclasses of Postprocessor should implement a `run` method, which - takes the html document as a single text string and returns a - (possibly modified) string. - - """ - pass # pragma: no cover - - -class RawHtmlPostprocessor(Postprocessor): - """ Restore raw html to the document. """ - - def run(self, text): - """ Iterate over html stash and restore "safe" html. """ - for i in range(self.markdown.htmlStash.html_counter): - html, safe = self.markdown.htmlStash.rawHtmlBlocks[i] - if self.markdown.safeMode and not safe: - if str(self.markdown.safeMode).lower() == 'escape': - html = self.escape(html) - elif str(self.markdown.safeMode).lower() == 'remove': - html = '' - else: - html = self.markdown.html_replacement_text - if (self.isblocklevel(html) and - (safe or not self.markdown.safeMode)): - text = text.replace( - "<p>%s</p>" % - (self.markdown.htmlStash.get_placeholder(i)), - html + "\n" - ) - text = text.replace( - self.markdown.htmlStash.get_placeholder(i), html - ) - return text - - def escape(self, html): - """ Basic html escaping """ - html = html.replace('&', '&') - html = html.replace('<', '<') - html = html.replace('>', '>') - return html.replace('"', '"') - - def isblocklevel(self, html): - m = re.match(r'^\<\/?([^ >]+)', html) - if m: - if m.group(1)[0] in ('!', '?', '@', '%'): - # Comment, php etc... - return True - return util.isBlockLevel(m.group(1)) - return False - - -class AndSubstitutePostprocessor(Postprocessor): - """ Restore valid entities """ - - def run(self, text): - text = text.replace(util.AMP_SUBSTITUTE, "&") - return text - - -class UnescapePostprocessor(Postprocessor): - """ Restore escaped chars """ - - RE = re.compile('%s(\d+)%s' % (util.STX, util.ETX)) - - def unescape(self, m): - return util.int2str(int(m.group(1))) - - def run(self, text): - return self.RE.sub(self.unescape, text) diff --git a/src/calibre/ebooks/markdown/preprocessors.py b/src/calibre/ebooks/markdown/preprocessors.py deleted file mode 100644 index 7ea4fcf9f5..0000000000 --- a/src/calibre/ebooks/markdown/preprocessors.py +++ /dev/null @@ -1,346 +0,0 @@ -""" -PRE-PROCESSORS -============================================================================= - -Preprocessors work on source text before we start doing anything too -complicated. -""" - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import util -from . import odict -import re - - -def build_preprocessors(md_instance, **kwargs): - """ Build the default set of preprocessors used by Markdown. """ - preprocessors = odict.OrderedDict() - preprocessors['normalize_whitespace'] = NormalizeWhitespace(md_instance) - if md_instance.safeMode != 'escape': - preprocessors["html_block"] = HtmlBlockPreprocessor(md_instance) - preprocessors["reference"] = ReferencePreprocessor(md_instance) - return preprocessors - - -class Preprocessor(util.Processor): - """ - Preprocessors are run after the text is broken into lines. - - Each preprocessor implements a "run" method that takes a pointer to a - list of lines of the document, modifies it as necessary and returns - either the same pointer or a pointer to a new list. - - Preprocessors must extend markdown.Preprocessor. - - """ - def run(self, lines): - """ - Each subclass of Preprocessor should override the `run` method, which - takes the document as a list of strings split by newlines and returns - the (possibly modified) list of lines. - - """ - pass # pragma: no cover - - -class NormalizeWhitespace(Preprocessor): - """ Normalize whitespace for consistant parsing. """ - - def run(self, lines): - source = '\n'.join(lines) - source = source.replace(util.STX, "").replace(util.ETX, "") - source = source.replace("\r\n", "\n").replace("\r", "\n") + "\n\n" - source = source.expandtabs(self.markdown.tab_length) - source = re.sub(r'(?<=\n) +\n', '\n', source) - return source.split('\n') - - -class HtmlBlockPreprocessor(Preprocessor): - """Remove html blocks from the text and store them for later retrieval.""" - - right_tag_patterns = ["</%s>", "%s>"] - attrs_pattern = r""" - \s+(?P<attr>[^>"'/= ]+)=(?P<q>['"])(?P<value>.*?)(?P=q) # attr="value" - | # OR - \s+(?P<attr1>[^>"'/= ]+)=(?P<value1>[^> ]+) # attr=value - | # OR - \s+(?P<attr2>[^>"'/= ]+) # attr - """ - left_tag_pattern = r'^\<(?P<tag>[^> ]+)(?P<attrs>(%s)*)\s*\/?\>?' % \ - attrs_pattern - attrs_re = re.compile(attrs_pattern, re.VERBOSE) - left_tag_re = re.compile(left_tag_pattern, re.VERBOSE) - markdown_in_raw = False - - def _get_left_tag(self, block): - m = self.left_tag_re.match(block) - if m: - tag = m.group('tag') - raw_attrs = m.group('attrs') - attrs = {} - if raw_attrs: - for ma in self.attrs_re.finditer(raw_attrs): - if ma.group('attr'): - if ma.group('value'): - attrs[ma.group('attr').strip()] = ma.group('value') - else: - attrs[ma.group('attr').strip()] = "" - elif ma.group('attr1'): - if ma.group('value1'): - attrs[ma.group('attr1').strip()] = ma.group( - 'value1' - ) - else: - attrs[ma.group('attr1').strip()] = "" - elif ma.group('attr2'): - attrs[ma.group('attr2').strip()] = "" - return tag, len(m.group(0)), attrs - else: - tag = block[1:].split(">", 1)[0].lower() - return tag, len(tag)+2, {} - - def _recursive_tagfind(self, ltag, rtag, start_index, block): - while 1: - i = block.find(rtag, start_index) - if i == -1: - return -1 - j = block.find(ltag, start_index) - # if no ltag, or rtag found before another ltag, return index - if (j > i or j == -1): - return i + len(rtag) - # another ltag found before rtag, use end of ltag as starting - # point and search again - j = block.find('>', j) - start_index = self._recursive_tagfind(ltag, rtag, j + 1, block) - if start_index == -1: - # HTML potentially malformed- ltag has no corresponding - # rtag - return -1 - - def _get_right_tag(self, left_tag, left_index, block): - for p in self.right_tag_patterns: - tag = p % left_tag - i = self._recursive_tagfind( - "<%s" % left_tag, tag, left_index, block - ) - if i > 2: - return tag.lstrip("<").rstrip(">"), i - return block.rstrip()[-left_index:-1].lower(), len(block) - - def _equal_tags(self, left_tag, right_tag): - if left_tag[0] in ['?', '@', '%']: # handle PHP, etc. - return True - if ("/" + left_tag) == right_tag: - return True - if (right_tag == "--" and left_tag == "--"): - return True - elif left_tag == right_tag[1:] and right_tag[0] == "/": - return True - else: - return False - - def _is_oneliner(self, tag): - return (tag in ['hr', 'hr/']) - - def _stringindex_to_listindex(self, stringindex, items): - """ - Same effect as concatenating the strings in items, - finding the character to which stringindex refers in that string, - and returning the index of the item in which that character resides. - """ - items.append('dummy') - i, count = 0, 0 - while count <= stringindex: - count += len(items[i]) - i += 1 - return i - 1 - - def _nested_markdown_in_html(self, items): - """Find and process html child elements of the given element block.""" - for i, item in enumerate(items): - if self.left_tag_re.match(item): - left_tag, left_index, attrs = \ - self._get_left_tag(''.join(items[i:])) - right_tag, data_index = self._get_right_tag( - left_tag, left_index, ''.join(items[i:])) - right_listindex = \ - self._stringindex_to_listindex(data_index, items[i:]) + i - if 'markdown' in attrs.keys(): - items[i] = items[i][left_index:] # remove opening tag - placeholder = self.markdown.htmlStash.store_tag( - left_tag, attrs, i + 1, right_listindex + 1) - items.insert(i, placeholder) - if len(items) - right_listindex <= 1: # last nest, no tail - right_listindex -= 1 - items[right_listindex] = items[right_listindex][ - :-len(right_tag) - 2] # remove closing tag - else: # raw html - if len(items) - right_listindex <= 1: # last element - right_listindex -= 1 - if right_listindex <= i: - right_listindex = i + 1 - placeholder = self.markdown.htmlStash.store('\n\n'.join( - items[i:right_listindex])) - del items[i:right_listindex] - items.insert(i, placeholder) - return items - - def run(self, lines): - text = "\n".join(lines) - new_blocks = [] - text = text.rsplit("\n\n") - items = [] - left_tag = '' - right_tag = '' - in_tag = False # flag - - while text: - block = text[0] - if block.startswith("\n"): - block = block[1:] - text = text[1:] - - if block.startswith("\n"): - block = block[1:] - - if not in_tag: - if block.startswith("<") and len(block.strip()) > 1: - - if block[1:4] == "!--": - # is a comment block - left_tag, left_index, attrs = "--", 2, {} - else: - left_tag, left_index, attrs = self._get_left_tag(block) - right_tag, data_index = self._get_right_tag(left_tag, - left_index, - block) - # keep checking conditions below and maybe just append - - if data_index < len(block) and (util.isBlockLevel(left_tag) or left_tag == '--'): - text.insert(0, block[data_index:]) - block = block[:data_index] - - if not (util.isBlockLevel(left_tag) or block[1] in ["!", "?", "@", "%"]): - new_blocks.append(block) - continue - - if self._is_oneliner(left_tag): - new_blocks.append(block.strip()) - continue - - if block.rstrip().endswith(">") \ - and self._equal_tags(left_tag, right_tag): - if self.markdown_in_raw and 'markdown' in attrs.keys(): - block = block[left_index:-len(right_tag) - 2] - new_blocks.append(self.markdown.htmlStash. - store_tag(left_tag, attrs, 0, 2)) - new_blocks.extend([block]) - else: - new_blocks.append( - self.markdown.htmlStash.store(block.strip())) - continue - else: - # if is block level tag and is not complete - if (not self._equal_tags(left_tag, right_tag)) and \ - (util.isBlockLevel(left_tag) or left_tag == "--"): - items.append(block.strip()) - in_tag = True - else: - new_blocks.append( - self.markdown.htmlStash.store(block.strip()) - ) - continue - - else: - new_blocks.append(block) - - else: - items.append(block) - - right_tag, data_index = self._get_right_tag(left_tag, 0, block) - - if self._equal_tags(left_tag, right_tag): - # if find closing tag - - if data_index < len(block): - # we have more text after right_tag - items[-1] = block[:data_index] - text.insert(0, block[data_index:]) - - in_tag = False - if self.markdown_in_raw and 'markdown' in attrs.keys(): - items[0] = items[0][left_index:] - items[-1] = items[-1][:-len(right_tag) - 2] - if items[len(items) - 1]: # not a newline/empty string - right_index = len(items) + 3 - else: - right_index = len(items) + 2 - new_blocks.append(self.markdown.htmlStash.store_tag( - left_tag, attrs, 0, right_index)) - placeholderslen = len(self.markdown.htmlStash.tag_data) - new_blocks.extend( - self._nested_markdown_in_html(items)) - nests = len(self.markdown.htmlStash.tag_data) - \ - placeholderslen - self.markdown.htmlStash.tag_data[-1 - nests][ - 'right_index'] += nests - 2 - else: - new_blocks.append( - self.markdown.htmlStash.store('\n\n'.join(items))) - items = [] - - if items: - if self.markdown_in_raw and 'markdown' in attrs.keys(): - items[0] = items[0][left_index:] - items[-1] = items[-1][:-len(right_tag) - 2] - if items[len(items) - 1]: # not a newline/empty string - right_index = len(items) + 3 - else: - right_index = len(items) + 2 - new_blocks.append( - self.markdown.htmlStash.store_tag( - left_tag, attrs, 0, right_index)) - placeholderslen = len(self.markdown.htmlStash.tag_data) - new_blocks.extend(self._nested_markdown_in_html(items)) - nests = len(self.markdown.htmlStash.tag_data) - placeholderslen - self.markdown.htmlStash.tag_data[-1 - nests][ - 'right_index'] += nests - 2 - else: - new_blocks.append( - self.markdown.htmlStash.store('\n\n'.join(items))) - new_blocks.append('\n') - - new_text = "\n\n".join(new_blocks) - return new_text.split("\n") - - -class ReferencePreprocessor(Preprocessor): - """ Remove reference definitions from text and store for later use. """ - - TITLE = r'[ ]*(\"(.*)\"|\'(.*)\'|\((.*)\))[ ]*' - RE = re.compile( - r'^[ ]{0,3}\[([^\]]*)\]:\s*([^ ]*)[ ]*(%s)?$' % TITLE, re.DOTALL - ) - TITLE_RE = re.compile(r'^%s$' % TITLE) - - def run(self, lines): - new_text = [] - while lines: - line = lines.pop(0) - m = self.RE.match(line) - if m: - id = m.group(1).strip().lower() - link = m.group(2).lstrip('<').rstrip('>') - t = m.group(5) or m.group(6) or m.group(7) - if not t: - # Check next line for title - tm = self.TITLE_RE.match(lines[0]) - if tm: - lines.pop(0) - t = tm.group(2) or tm.group(3) or tm.group(4) - self.markdown.references[id] = (link, t) - else: - new_text.append(line) - - return new_text # + "\n" diff --git a/src/calibre/ebooks/markdown/serializers.py b/src/calibre/ebooks/markdown/serializers.py deleted file mode 100644 index 1e8d9dd288..0000000000 --- a/src/calibre/ebooks/markdown/serializers.py +++ /dev/null @@ -1,282 +0,0 @@ -# markdown/searializers.py -# -# Add x/html serialization to Elementree -# Taken from ElementTree 1.3 preview with slight modifications -# -# Copyright (c) 1999-2007 by Fredrik Lundh. All rights reserved. -# -# fredrik@pythonware.com -# http://www.pythonware.com -# -# -------------------------------------------------------------------- -# The ElementTree toolkit is -# -# Copyright (c) 1999-2007 by Fredrik Lundh -# -# By obtaining, using, and/or copying this software and/or its -# associated documentation, you agree that you have read, understood, -# and will comply with the following terms and conditions: -# -# Permission to use, copy, modify, and distribute this software and -# its associated documentation for any purpose and without fee is -# hereby granted, provided that the above copyright notice appears in -# all copies, and that both that copyright notice and this permission -# notice appear in supporting documentation, and that the name of -# Secret Labs AB or the author not be used in advertising or publicity -# pertaining to distribution of the software without specific, written -# prior permission. -# -# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD -# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- -# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR -# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY -# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS -# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -# OF THIS SOFTWARE. -# -------------------------------------------------------------------- - - -from __future__ import absolute_import -from __future__ import unicode_literals -from . import util -ElementTree = util.etree.ElementTree -QName = util.etree.QName -if hasattr(util.etree, 'test_comment'): # pragma: no cover - Comment = util.etree.test_comment -else: # pragma: no cover - Comment = util.etree.Comment -PI = util.etree.PI -ProcessingInstruction = util.etree.ProcessingInstruction - -__all__ = ['to_html_string', 'to_xhtml_string'] - -HTML_EMPTY = ("area", "base", "basefont", "br", "col", "frame", "hr", - "img", "input", "isindex", "link", "meta" "param") - -try: - HTML_EMPTY = set(HTML_EMPTY) -except NameError: # pragma: no cover - pass - -_namespace_map = { - # "well-known" namespace prefixes - "http://www.w3.org/XML/1998/namespace": "xml", - "http://www.w3.org/1999/xhtml": "html", - "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", - "http://schemas.xmlsoap.org/wsdl/": "wsdl", - # xml schema - "http://www.w3.org/2001/XMLSchema": "xs", - "http://www.w3.org/2001/XMLSchema-instance": "xsi", - # dublic core - "http://purl.org/dc/elements/1.1/": "dc", -} - - -def _raise_serialization_error(text): # pragma: no cover - raise TypeError( - "cannot serialize %r (type %s)" % (text, type(text).__name__) - ) - - -def _encode(text, encoding): - try: - return text.encode(encoding, "xmlcharrefreplace") - except (TypeError, AttributeError): # pragma: no cover - _raise_serialization_error(text) - - -def _escape_cdata(text): - # escape character data - try: - # it's worth avoiding do-nothing calls for strings that are - # shorter than 500 character, or so. assume that's, by far, - # the most common case in most applications. - if "&" in text: - text = text.replace("&", "&") - if "<" in text: - text = text.replace("<", "<") - if ">" in text: - text = text.replace(">", ">") - return text - except (TypeError, AttributeError): # pragma: no cover - _raise_serialization_error(text) - - -def _escape_attrib(text): - # escape attribute value - try: - if "&" in text: - text = text.replace("&", "&") - if "<" in text: - text = text.replace("<", "<") - if ">" in text: - text = text.replace(">", ">") - if "\"" in text: - text = text.replace("\"", """) - if "\n" in text: - text = text.replace("\n", " ") - return text - except (TypeError, AttributeError): # pragma: no cover - _raise_serialization_error(text) - - -def _escape_attrib_html(text): - # escape attribute value - try: - if "&" in text: - text = text.replace("&", "&") - if "<" in text: - text = text.replace("<", "<") - if ">" in text: - text = text.replace(">", ">") - if "\"" in text: - text = text.replace("\"", """) - return text - except (TypeError, AttributeError): # pragma: no cover - _raise_serialization_error(text) - - -def _serialize_html(write, elem, qnames, namespaces, format): - tag = elem.tag - text = elem.text - if tag is Comment: - write("<!--%s-->" % _escape_cdata(text)) - elif tag is ProcessingInstruction: - write("<?%s?>" % _escape_cdata(text)) - else: - tag = qnames[tag] - if tag is None: - if text: - write(_escape_cdata(text)) - for e in elem: - _serialize_html(write, e, qnames, None, format) - else: - write("<" + tag) - items = elem.items() - if items or namespaces: - items = sorted(items) # lexical order - for k, v in items: - if isinstance(k, QName): - k = k.text - if isinstance(v, QName): - v = qnames[v.text] - else: - v = _escape_attrib_html(v) - if qnames[k] == v and format == 'html': - # handle boolean attributes - write(" %s" % v) - else: - write(" %s=\"%s\"" % (qnames[k], v)) - if namespaces: - items = namespaces.items() - items.sort(key=lambda x: x[1]) # sort on prefix - for v, k in items: - if k: - k = ":" + k - write(" xmlns%s=\"%s\"" % (k, _escape_attrib(v))) - if format == "xhtml" and tag.lower() in HTML_EMPTY: - write(" />") - else: - write(">") - if text: - if tag.lower() in ["script", "style"]: - write(text) - else: - write(_escape_cdata(text)) - for e in elem: - _serialize_html(write, e, qnames, None, format) - if tag.lower() not in HTML_EMPTY: - write("</" + tag + ">") - if elem.tail: - write(_escape_cdata(elem.tail)) - - -def _write_html(root, - encoding=None, - default_namespace=None, - format="html"): - assert root is not None - data = [] - write = data.append - qnames, namespaces = _namespaces(root, default_namespace) - _serialize_html(write, root, qnames, namespaces, format) - if encoding is None: - return "".join(data) - else: - return _encode("".join(data)) - - -# -------------------------------------------------------------------- -# serialization support - -def _namespaces(elem, default_namespace=None): - # identify namespaces used in this tree - - # maps qnames to *encoded* prefix:local names - qnames = {None: None} - - # maps uri:s to prefixes - namespaces = {} - if default_namespace: - namespaces[default_namespace] = "" - - def add_qname(qname): - # calculate serialized qname representation - try: - if qname[:1] == "{": - uri, tag = qname[1:].split("}", 1) - prefix = namespaces.get(uri) - if prefix is None: - prefix = _namespace_map.get(uri) - if prefix is None: - prefix = "ns%d" % len(namespaces) - if prefix != "xml": - namespaces[uri] = prefix - if prefix: - qnames[qname] = "%s:%s" % (prefix, tag) - else: - qnames[qname] = tag # default element - else: - if default_namespace: - raise ValueError( - "cannot use non-qualified names with " - "default_namespace option" - ) - qnames[qname] = qname - except TypeError: # pragma: no cover - _raise_serialization_error(qname) - - # populate qname and namespaces table - try: - iterate = elem.iter - except AttributeError: - iterate = elem.getiterator # cET compatibility - for elem in iterate(): - tag = elem.tag - if isinstance(tag, QName) and tag.text not in qnames: - add_qname(tag.text) - elif isinstance(tag, util.string_type): - if tag not in qnames: - add_qname(tag) - elif tag is not None and tag is not Comment and tag is not PI: - _raise_serialization_error(tag) - for key, value in elem.items(): - if isinstance(key, QName): - key = key.text - if key not in qnames: - add_qname(key) - if isinstance(value, QName) and value.text not in qnames: - add_qname(value.text) - text = elem.text - if isinstance(text, QName) and text.text not in qnames: - add_qname(text.text) - return qnames, namespaces - - -def to_html_string(element): - return _write_html(ElementTree(element).getroot(), format="html") - - -def to_xhtml_string(element): - return _write_html(ElementTree(element).getroot(), format="xhtml") diff --git a/src/calibre/ebooks/markdown/treeprocessors.py b/src/calibre/ebooks/markdown/treeprocessors.py deleted file mode 100644 index d06f192885..0000000000 --- a/src/calibre/ebooks/markdown/treeprocessors.py +++ /dev/null @@ -1,371 +0,0 @@ -from __future__ import unicode_literals -from __future__ import absolute_import -from . import util -from . import odict -from . import inlinepatterns - - -def build_treeprocessors(md_instance, **kwargs): - """ Build the default treeprocessors for Markdown. """ - treeprocessors = odict.OrderedDict() - treeprocessors["inline"] = InlineProcessor(md_instance) - treeprocessors["prettify"] = PrettifyTreeprocessor(md_instance) - return treeprocessors - - -def isString(s): - """ Check if it's string """ - if not isinstance(s, util.AtomicString): - return isinstance(s, util.string_type) - return False - - -class Treeprocessor(util.Processor): - """ - Treeprocessors are run on the ElementTree object before serialization. - - Each Treeprocessor implements a "run" method that takes a pointer to an - ElementTree, modifies it as necessary and returns an ElementTree - object. - - Treeprocessors must extend markdown.Treeprocessor. - - """ - def run(self, root): - """ - Subclasses of Treeprocessor should implement a `run` method, which - takes a root ElementTree. This method can return another ElementTree - object, and the existing root ElementTree will be replaced, or it can - modify the current tree and return None. - """ - pass # pragma: no cover - - -class InlineProcessor(Treeprocessor): - """ - A Treeprocessor that traverses a tree, applying inline patterns. - """ - - def __init__(self, md): - self.__placeholder_prefix = util.INLINE_PLACEHOLDER_PREFIX - self.__placeholder_suffix = util.ETX - self.__placeholder_length = 4 + len(self.__placeholder_prefix) \ - + len(self.__placeholder_suffix) - self.__placeholder_re = util.INLINE_PLACEHOLDER_RE - self.markdown = md - self.inlinePatterns = md.inlinePatterns - - def __makePlaceholder(self, type): - """ Generate a placeholder """ - id = "%04d" % len(self.stashed_nodes) - hash = util.INLINE_PLACEHOLDER % id - return hash, id - - def __findPlaceholder(self, data, index): - """ - Extract id from data string, start from index - - Keyword arguments: - - * data: string - * index: index, from which we start search - - Returns: placeholder id and string index, after the found placeholder. - - """ - m = self.__placeholder_re.search(data, index) - if m: - return m.group(1), m.end() - else: - return None, index + 1 - - def __stashNode(self, node, type): - """ Add node to stash """ - placeholder, id = self.__makePlaceholder(type) - self.stashed_nodes[id] = node - return placeholder - - def __handleInline(self, data, patternIndex=0): - """ - Process string with inline patterns and replace it - with placeholders - - Keyword arguments: - - * data: A line of Markdown text - * patternIndex: The index of the inlinePattern to start with - - Returns: String with placeholders. - - """ - if not isinstance(data, util.AtomicString): - startIndex = 0 - while patternIndex < len(self.inlinePatterns): - data, matched, startIndex = self.__applyPattern( - self.inlinePatterns.value_for_index(patternIndex), - data, patternIndex, startIndex) - if not matched: - patternIndex += 1 - return data - - def __processElementText(self, node, subnode, isText=True): - """ - Process placeholders in Element.text or Element.tail - of Elements popped from self.stashed_nodes. - - Keywords arguments: - - * node: parent node - * subnode: processing node - * isText: bool variable, True - it's text, False - it's tail - - Returns: None - - """ - if isText: - text = subnode.text - subnode.text = None - else: - text = subnode.tail - subnode.tail = None - - childResult = self.__processPlaceholders(text, subnode, isText) - - if not isText and node is not subnode: - pos = list(node).index(subnode) + 1 - else: - pos = 0 - - childResult.reverse() - for newChild in childResult: - node.insert(pos, newChild) - - def __processPlaceholders(self, data, parent, isText=True): - """ - Process string with placeholders and generate ElementTree tree. - - Keyword arguments: - - * data: string with placeholders instead of ElementTree elements. - * parent: Element, which contains processing inline data - - Returns: list with ElementTree elements with applied inline patterns. - - """ - def linkText(text): - if text: - if result: - if result[-1].tail: - result[-1].tail += text - else: - result[-1].tail = text - elif not isText: - if parent.tail: - parent.tail += text - else: - parent.tail = text - else: - if parent.text: - parent.text += text - else: - parent.text = text - result = [] - strartIndex = 0 - while data: - index = data.find(self.__placeholder_prefix, strartIndex) - if index != -1: - id, phEndIndex = self.__findPlaceholder(data, index) - - if id in self.stashed_nodes: - node = self.stashed_nodes.get(id) - - if index > 0: - text = data[strartIndex:index] - linkText(text) - - if not isString(node): # it's Element - for child in [node] + list(node): - if child.tail: - if child.tail.strip(): - self.__processElementText( - node, child, False - ) - if child.text: - if child.text.strip(): - self.__processElementText(child, child) - else: # it's just a string - linkText(node) - strartIndex = phEndIndex - continue - - strartIndex = phEndIndex - result.append(node) - - else: # wrong placeholder - end = index + len(self.__placeholder_prefix) - linkText(data[strartIndex:end]) - strartIndex = end - else: - text = data[strartIndex:] - if isinstance(data, util.AtomicString): - # We don't want to loose the AtomicString - text = util.AtomicString(text) - linkText(text) - data = "" - - return result - - def __applyPattern(self, pattern, data, patternIndex, startIndex=0): - """ - Check if the line fits the pattern, create the necessary - elements, add it to stashed_nodes. - - Keyword arguments: - - * data: the text to be processed - * pattern: the pattern to be checked - * patternIndex: index of current pattern - * startIndex: string index, from which we start searching - - Returns: String with placeholders instead of ElementTree elements. - - """ - match = pattern.getCompiledRegExp().match(data[startIndex:]) - leftData = data[:startIndex] - - if not match: - return data, False, 0 - - node = pattern.handleMatch(match) - - if node is None: - return data, True, len(leftData)+match.span(len(match.groups()))[0] - - if not isString(node): - if not isinstance(node.text, util.AtomicString): - # We need to process current node too - for child in [node] + list(node): - if not isString(node): - if child.text: - child.text = self.__handleInline( - child.text, patternIndex + 1 - ) - if child.tail: - child.tail = self.__handleInline( - child.tail, patternIndex - ) - - placeholder = self.__stashNode(node, pattern.type()) - - return "%s%s%s%s" % (leftData, - match.group(1), - placeholder, match.groups()[-1]), True, 0 - - def run(self, tree): - """Apply inline patterns to a parsed Markdown tree. - - Iterate over ElementTree, find elements with inline tag, apply inline - patterns and append newly created Elements to tree. If you don't - want to process your data with inline paterns, instead of normal - string, use subclass AtomicString: - - node.text = markdown.AtomicString("This will not be processed.") - - Arguments: - - * tree: ElementTree object, representing Markdown tree. - - Returns: ElementTree object with applied inline patterns. - - """ - self.stashed_nodes = {} - - stack = [tree] - - while stack: - currElement = stack.pop() - insertQueue = [] - for child in currElement: - if child.text and not isinstance( - child.text, util.AtomicString - ): - text = child.text - child.text = None - lst = self.__processPlaceholders( - self.__handleInline(text), child - ) - stack += lst - insertQueue.append((child, lst)) - if child.tail: - tail = self.__handleInline(child.tail) - dumby = util.etree.Element('d') - child.tail = None - tailResult = self.__processPlaceholders(tail, dumby, False) - if dumby.tail: - child.tail = dumby.tail - pos = list(currElement).index(child) + 1 - tailResult.reverse() - for newChild in tailResult: - currElement.insert(pos, newChild) - if len(child): - stack.append(child) - - for element, lst in insertQueue: - if self.markdown.enable_attributes: - if element.text and isString(element.text): - element.text = inlinepatterns.handleAttributes( - element.text, element - ) - i = 0 - for newChild in lst: - if self.markdown.enable_attributes: - # Processing attributes - if newChild.tail and isString(newChild.tail): - newChild.tail = inlinepatterns.handleAttributes( - newChild.tail, element - ) - if newChild.text and isString(newChild.text): - newChild.text = inlinepatterns.handleAttributes( - newChild.text, newChild - ) - element.insert(i, newChild) - i += 1 - return tree - - -class PrettifyTreeprocessor(Treeprocessor): - """ Add linebreaks to the html document. """ - - def _prettifyETree(self, elem): - """ Recursively add linebreaks to ElementTree children. """ - - i = "\n" - if util.isBlockLevel(elem.tag) and elem.tag not in ['code', 'pre']: - if (not elem.text or not elem.text.strip()) \ - and len(elem) and util.isBlockLevel(elem[0].tag): - elem.text = i - for e in elem: - if util.isBlockLevel(e.tag): - self._prettifyETree(e) - if not elem.tail or not elem.tail.strip(): - elem.tail = i - if not elem.tail or not elem.tail.strip(): - elem.tail = i - - def run(self, root): - """ Add linebreaks to ElementTree root object. """ - - self._prettifyETree(root) - # Do <br />'s seperately as they are often in the middle of - # inline content and missed by _prettifyETree. - brs = root.getiterator('br') - for br in brs: - if not br.tail or not br.tail.strip(): - br.tail = '\n' - else: - br.tail = '\n%s' % br.tail - # Clean up extra empty lines at end of code blocks. - pres = root.getiterator('pre') - for pre in pres: - if len(pre) and pre[0].tag == 'code': - pre[0].text = util.AtomicString(pre[0].text.rstrip() + '\n') diff --git a/src/calibre/ebooks/markdown/util.py b/src/calibre/ebooks/markdown/util.py deleted file mode 100644 index d3d48f0999..0000000000 --- a/src/calibre/ebooks/markdown/util.py +++ /dev/null @@ -1,177 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals -import re -import sys - - -""" -Python 3 Stuff -============================================================================= -""" -PY3 = sys.version_info[0] == 3 - -if PY3: # pragma: no cover - string_type = str - text_type = str - int2str = chr -else: # pragma: no cover - string_type = basestring # noqa - text_type = unicode # noqa - int2str = unichr # noqa - - -""" -Constants you might want to modify ------------------------------------------------------------------------------ -""" - - -BLOCK_LEVEL_ELEMENTS = re.compile( - "^(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul" - "|script|noscript|form|fieldset|iframe|math" - "|hr|hr/|style|li|dt|dd|thead|tbody" - "|tr|th|td|section|footer|header|group|figure" - "|figcaption|aside|article|canvas|output" - "|progress|video|nav)$", - re.IGNORECASE -) -# Placeholders -STX = '\u0002' # Use STX ("Start of text") for start-of-placeholder -ETX = '\u0003' # Use ETX ("End of text") for end-of-placeholder -INLINE_PLACEHOLDER_PREFIX = STX+"klzzwxh:" -INLINE_PLACEHOLDER = INLINE_PLACEHOLDER_PREFIX + "%s" + ETX -INLINE_PLACEHOLDER_RE = re.compile(INLINE_PLACEHOLDER % r'([0-9]+)') -AMP_SUBSTITUTE = STX+"amp"+ETX -HTML_PLACEHOLDER = STX + "wzxhzdk:%s" + ETX -HTML_PLACEHOLDER_RE = re.compile(HTML_PLACEHOLDER % r'([0-9]+)') -TAG_PLACEHOLDER = STX + "hzzhzkh:%s" + ETX - - -""" -Constants you probably do not need to change ------------------------------------------------------------------------------ -""" - -RTL_BIDI_RANGES = ( - ('\u0590', '\u07FF'), - # Hebrew (0590-05FF), Arabic (0600-06FF), - # Syriac (0700-074F), Arabic supplement (0750-077F), - # Thaana (0780-07BF), Nko (07C0-07FF). - ('\u2D30', '\u2D7F') # Tifinagh -) - -# Extensions should use "markdown.util.etree" instead of "etree" (or do `from -# markdown.util import etree`). Do not import it by yourself. - -try: # pragma: no cover - # Is the C implementation of ElementTree available? - import xml.etree.cElementTree as etree - from xml.etree.ElementTree import Comment - # Serializers (including ours) test with non-c Comment - etree.test_comment = Comment - if etree.VERSION < "1.0.5": - raise RuntimeError("cElementTree version 1.0.5 or higher is required.") -except (ImportError, RuntimeError): # pragma: no cover - # Use the Python implementation of ElementTree? - import xml.etree.ElementTree as etree - if etree.VERSION < "1.1": - raise RuntimeError("ElementTree version 1.1 or higher is required") - - -""" -AUXILIARY GLOBAL FUNCTIONS -============================================================================= -""" - - -def isBlockLevel(tag): - """Check if the tag is a block level HTML tag.""" - if isinstance(tag, string_type): - return BLOCK_LEVEL_ELEMENTS.match(tag) - # Some ElementTree tags are not strings, so return False. - return False - - -def parseBoolValue(value, fail_on_errors=True, preserve_none=False): - """Parses a string representing bool value. If parsing was successful, - returns True or False. If preserve_none=True, returns True, False, - or None. If parsing was not successful, raises ValueError, or, if - fail_on_errors=False, returns None.""" - if not isinstance(value, string_type): - if preserve_none and value is None: - return value - return bool(value) - elif preserve_none and value.lower() == 'none': - return None - elif value.lower() in ('true', 'yes', 'y', 'on', '1'): - return True - elif value.lower() in ('false', 'no', 'n', 'off', '0', 'none'): - return False - elif fail_on_errors: - raise ValueError('Cannot parse bool value: %r' % value) - - -""" -MISC AUXILIARY CLASSES -============================================================================= -""" - - -class AtomicString(text_type): - """A string which should not be further processed.""" - pass - - -class Processor(object): - def __init__(self, markdown_instance=None): - if markdown_instance: - self.markdown = markdown_instance - - -class HtmlStash(object): - """ - This class is used for stashing HTML objects that we extract - in the beginning and replace with place-holders. - """ - - def __init__(self): - """ Create a HtmlStash. """ - self.html_counter = 0 # for counting inline html segments - self.rawHtmlBlocks = [] - self.tag_counter = 0 - self.tag_data = [] # list of dictionaries in the order tags appear - - def store(self, html, safe=False): - """ - Saves an HTML segment for later reinsertion. Returns a - placeholder string that needs to be inserted into the - document. - - Keyword arguments: - - * html: an html segment - * safe: label an html segment as safe for safemode - - Returns : a placeholder string - - """ - self.rawHtmlBlocks.append((html, safe)) - placeholder = self.get_placeholder(self.html_counter) - self.html_counter += 1 - return placeholder - - def reset(self): - self.html_counter = 0 - self.rawHtmlBlocks = [] - - def get_placeholder(self, key): - return HTML_PLACEHOLDER % key - - def store_tag(self, tag, attrs, left_index, right_index): - """Store tag data and return a placeholder.""" - self.tag_data.append({'tag': tag, 'attrs': attrs, - 'left_index': left_index, - 'right_index': right_index}) - placeholder = TAG_PLACEHOLDER % str(self.tag_counter) - self.tag_counter += 1 # equal to the tag's index in self.tag_data - return placeholder diff --git a/src/calibre/startup.py b/src/calibre/startup.py index b40f9fac74..b1be5025f7 100644 --- a/src/calibre/startup.py +++ b/src/calibre/startup.py @@ -41,13 +41,14 @@ if not _run_once: class DeVendor(object): def find_module(self, fullname, path=None): - if fullname == 'calibre.web.feeds.feedparser': + if fullname == 'calibre.web.feeds.feedparser' or fullname.startswith('calibre.ebooks.markdown'): return self def load_module(self, fullname): + from importlib import import_module if fullname == 'calibre.web.feeds.feedparser': - from importlib import import_module return import_module('feedparser') + return import_module(fullname[len('calibre.ebooks.'):]) sys.meta_path.insert(0, DeVendor()) From 2866c8dcbfeaceb98c91e297bbce4bf71ef18f18 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Thu, 7 Feb 2019 13:56:37 +0530 Subject: [PATCH 0215/2613] calibredb: Fix adding books with an OPF file to a remote server not picking up the cover specified in the OPF file --- src/calibre/db/cli/cmd_add.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/calibre/db/cli/cmd_add.py b/src/calibre/db/cli/cmd_add.py index 1f9d33356c..dade7b7207 100644 --- a/src/calibre/db/cli/cmd_add.py +++ b/src/calibre/db/cli/cmd_add.py @@ -76,7 +76,7 @@ def book(db, notify_changes, is_remote, args): def format_group(db, notify_changes, is_remote, args): - formats, add_duplicates = args + formats, add_duplicates, cover_data = args with add_ctx(), TemporaryDirectory('add-multiple') as tdir, run_import_plugins_before_metadata(tdir): if is_remote: paths = [] @@ -90,6 +90,8 @@ def format_group(db, notify_changes, is_remote, args): mi = metadata_from_formats(paths) if mi.title is None: return None, set(), False + if cover_data and not mi.cover_data or not mi.cover_data[1]: + mi.cover_data = 'jpeg', cover_data ids, dups = db.add_books([(mi, create_format_map(paths))], add_duplicates=add_duplicates, run_hooks=False) if is_remote: notify_changes(books_added(ids)) @@ -171,8 +173,22 @@ def do_add( scanner = cdb_recursive_find if recurse else cdb_find_in_dir for dpath in dirs: for formats in scanner(dpath, one_book_per_directory, compiled_rules): + cover_data = None + for fmt in formats: + if fmt.lower().endswith('.opf'): + with lopen(fmt, 'rb') as f: + mi = get_metadata(f, stream_type='opf') + if mi.cover_data and mi.cover_data[1]: + cover_data = mi.cover_data[1] + elif mi.cover: + try: + with lopen(mi.cover, 'rb') as f: + cover_data = f.read() + except EnvironmentError: + pass + book_title, ids, dups = dbctx.run( - 'add', 'format_group', tuple(map(dbctx.path, formats)), add_duplicates) + 'add', 'format_group', tuple(map(dbctx.path, formats)), add_duplicates, cover_data) if book_title is not None: added_ids |= set(ids) if dups: From 65d117baf9041bfe6f70d1cdfde428dce400d8be Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Sun, 10 Feb 2019 08:51:44 +0530 Subject: [PATCH 0216/2613] Update Pro Physik --- recipes/pro_physik.recipe | 46 ++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/recipes/pro_physik.recipe b/recipes/pro_physik.recipe index 9cd6231fca..18768538c9 100644 --- a/recipes/pro_physik.recipe +++ b/recipes/pro_physik.recipe @@ -4,47 +4,39 @@ from calibre.web.feeds.recipes import BasicNewsRecipe class AdvancedUserRecipe1303841067(BasicNewsRecipe): title = u'Pro Physik' - __author__ = 'schuster, Armin Geller' # AGE Upd. 2012-11-28 + __author__ = 'schuster, Armin Geller' # AGE Upd. 2012-11-28, # AGe Upd 2019-02-09 oldest_article = 4 max_articles_per_feed = 100 no_stylesheets = True remove_javascript = True remove_empty_feeds = True - language = 'de' + language = 'de_DE' cover_url = 'http://www.pro-physik.de/prophy/images/bg_logo_prophy.gif' + extra_css = ''' + h1 {font-size: 1.6em; text-align: left} + h2, h3 {font-size: 1.3em;text-align: left} + h2.subtitle {font-size: 1.2em;text-align: left;font-style: italic} + h4, h5, h6 {font-size: 1em;text-align: left} + .flex-caption {font-size: .75em; font-weight: normal;margin-bottom: .75em} + .slides {list-style-type: none} + ''' + # .slides: get rid of <ul><li> list dot in front of pictures + keep_only_tags = [ - dict(name='div', attrs={'class': ['leftColRight']}) + dict(name='div', attrs={'class': ['news-item view-mode-default']}) ] remove_tags = [ - dict(name='div', attrs={ - 'class': ["withMargin socialWrapper addthis_toolbox addthis_default_style"]}), - # AGe: If you don't like to see further informations for the article - # and additional links please remove # in belows next line - # dict(name='div', attrs={'class':["insideBox"]}), + # dict(name='div', attrs={'class':["withMargin socialWrapper addthis_toolbox addthis_default_style"]}), + # dict(name='div', attrs={'class':["insideBox"]}), ] feeds = [ - (u'Nachrichten', u'http://www.pro-physik.de/graphicalrss/prophy/newsFeed.xml'), - (u'Forschung', u'http://www.pro-physik.de/graphicalrss/prophy/newsforschungFeed.xml'), - (u'Techologie', u'http://www.pro-physik.de/graphicalrss/prophy/newstechnologieFeed.xml'), - (u'Industrie', u'http://www.pro-physik.de/graphicalrss/prophy/newsindustrieFeed.xml'), - (u'Hochschule', u'http://www.pro-physik.de/graphicalrss/prophy/newshochschuleFeed.xml'), - (u'Panorama', u'http://www.pro-physik.de/graphicalrss/prophy/newspanoramaFeed.xml'), - (u'DPG', u'http://www.pro-physik.de/graphicalrss/prophy/newsdpgFeed.xml'), - (u'Physik Jornal', - u'http://www.pro-physik.de/graphicalrss/prophy/pjnewsFeed.xml'), - (u'Veranstaltungen', u'http://www.pro-physik.de/rss/prophy/eventsFeed.xml'), - - # AGe if you like to see job offers please remove # on next lines below - - # (u'Stellenmarkt', u'http://www.pro-physik.de/rss/prophy/jobsFeed.xml'), - # (u'Industrie Stellenanzeigen', u'http://www.pro-physik.de/rss/prophy/jobsindustrieFeed.xml'), - # (u'PhD Stellenanzeigen', u'http://www.pro-physik.de/rss/prophy/jobsphdFeed.xml'), - # (u'PostDoc Stellenanzeigen', u'http://www.pro-physik.de/rss/prophy/jobspostdocFeed.xml'), - # (u'Öffentlicher Dienst Stellenanzeigen', u'http://www.pro-physik.de/rss/prophy/jobsdienstFeed.xml'), - # (u'Hochschule Stellenanzeigen', u'http://www.pro-physik.de/rss/prophy/jobshochschuleFeed.xml'), + (u'Nachrichten', + u'https://www.pro-physik.de/rss/news.xml'), # AGe 2019-02-09 + (u'Veranstaltungen', + u'https://www.pro-physik.de/rss/events.xml'), # AGe 2019-02-09 ] From f9ab883383a62ff0c54f4baca7738e7813684224 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Sun, 10 Feb 2019 08:54:49 +0530 Subject: [PATCH 0217/2613] ... --- recipes/pro_physik.recipe | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/recipes/pro_physik.recipe b/recipes/pro_physik.recipe index 18768538c9..87b36c5925 100644 --- a/recipes/pro_physik.recipe +++ b/recipes/pro_physik.recipe @@ -13,16 +13,14 @@ class AdvancedUserRecipe1303841067(BasicNewsRecipe): remove_empty_feeds = True language = 'de_DE' - cover_url = 'http://www.pro-physik.de/prophy/images/bg_logo_prophy.gif' - extra_css = ''' - h1 {font-size: 1.6em; text-align: left} - h2, h3 {font-size: 1.3em;text-align: left} - h2.subtitle {font-size: 1.2em;text-align: left;font-style: italic} - h4, h5, h6 {font-size: 1em;text-align: left} - .flex-caption {font-size: .75em; font-weight: normal;margin-bottom: .75em} - .slides {list-style-type: none} - ''' + h1 {font-size: 1.6em; text-align: left} + h2, h3 {font-size: 1.3em;text-align: left} + h2.subtitle {font-size: 1.2em;text-align: left;font-style: italic} + h4, h5, h6 {font-size: 1em;text-align: left} + .flex-caption {font-size: .75em; font-weight: normal;margin-bottom: .75em} + .slides {list-style-type: none} + ''' # .slides: get rid of <ul><li> list dot in front of pictures keep_only_tags = [ From 2b0811b31a4cf7c2e41a319932292f48403b5db7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Sun, 10 Feb 2019 09:30:51 +0530 Subject: [PATCH 0218/2613] Update 1843 --- recipes/1843.recipe | 44 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/recipes/1843.recipe b/recipes/1843.recipe index 199f576948..e5a2b663b4 100644 --- a/recipes/1843.recipe +++ b/recipes/1843.recipe @@ -20,43 +20,11 @@ class E1843(BasicNewsRecipe): no_stylesheets = True remove_javascript = True encoding = 'utf-8' - - keep_only_tags = [ - dict(name='h1', attrs={'class': 'title'}), - classes('field-name-field-rubric-summary article-header__overlay-main-image meta-info__author article__body'), + feeds = [ + 'https://www.1843magazine.com/rss/content', ] - def parse_index(self): - soup = self.index_to_soup('https://www.1843magazine.com') - a = soup.find(text='Print edition').parent - soup = self.index_to_soup(a['href']) - h1 = soup.find(**classes('cover-image__main')) - self.timefmt = ' [%s]' % self.tag_to_string(h1) - img = soup.find(**classes('cover-image__image')).find('img') - self.cover_url = img['src'] - - ans = [] - current_section = articles = None - - for div in soup.findAll(**classes('field-name-field-header node-article')): - if 'field-header' in div['class']: - if current_section and articles: - ans.append((current_section, articles)) - current_section = self.tag_to_string(div) - self.log(current_section) - articles = [] - else: - a = div.find('a', href=True) - title = self.tag_to_string(a) - url = a['href'] - self.log('\t', title, ' at ', url) - desc = '' - r = div.find(**classes('article-rubric')) - if r is not None: - desc = self.tag_to_string(r) - articles.append( - {'title': title, 'url': url, 'description': desc}) - - if current_section and articles: - ans.append((current_section, articles)) - return ans + keep_only_tags = [ + dict(name='h1', attrs={'class': lambda x: x and 'title' in x.split()}), + classes('field-name-field-rubric-summary article-header__overlay-main-image meta-info__author article__body'), + ] From 30da5e106184bd6f11820b2e6c6591502fff90c6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Sun, 10 Feb 2019 12:42:36 +0530 Subject: [PATCH 0219/2613] Allow setting bytes data in registry keys --- src/calibre/utils/winreg/lib.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/calibre/utils/winreg/lib.py b/src/calibre/utils/winreg/lib.py index 7f12f4eb2b..b9cee2ed8f 100644 --- a/src/calibre/utils/winreg/lib.py +++ b/src/calibre/utils/winreg/lib.py @@ -42,6 +42,7 @@ def default_errcheck(result, func, args): raise ctypes.WinError(result) return args + null = object() @@ -62,6 +63,7 @@ def cwrap(name, restype, *args, **kw): func.errcheck = kw.get('errcheck', default_errcheck) return func + RegOpenKey = cwrap( 'RegOpenKeyExW', LONG, a('key', HKEY), a('sub_key', LPCWSTR), a('options', DWORD, 0), a('access', ULONG, KEY_READ), a('result', PHKEY, in_arg=False)) RegCreateKey = cwrap( @@ -78,6 +80,8 @@ def enum_value_errcheck(result, func, args): if result == winerror.ERROR_NO_MORE_ITEMS: raise StopIteration() raise ctypes.WinError(result) + + RegEnumValue = cwrap( 'RegEnumValueW', LONG, a('key', HKEY), a('index', DWORD), a('value_name', LPWSTR), a('value_name_size', LPDWORD), a('reserved', LPDWORD), a('value_type', LPDWORD), a('data', LPBYTE), a('data_size', LPDWORD), errcheck=enum_value_errcheck) @@ -87,6 +91,8 @@ def last_error_errcheck(result, func, args): if result == 0: raise ctypes.WinError() return args + + ExpandEnvironmentStrings = cwrap( 'ExpandEnvironmentStringsW', DWORD, a('src', LPCWSTR), a('dest', LPWSTR), a('size', DWORD), errcheck=last_error_errcheck, lib=ctypes.windll.kernel32) @@ -113,6 +119,9 @@ def convert_to_registry_data(value, has_expansions=False): raw = struct.pack(str('Q'), value), win32con.REG_QWORD buf = ctypes.create_string_buffer(raw) return buf, dtype, len(buf) + if isinstance(value, bytes): + buf = ctypes.create_string_buffer(value) + return buf, winreg.REG_BINARY, len(buf) raise ValueError('Unknown data type: %r' % value) @@ -138,6 +147,7 @@ def convert_registry_data(raw, size, dtype): return ctypes.cast(raw, ctypes.POINTER(ctypes.c_uint64)).contents.value raise ValueError('Unsupported data type: %r' % dtype) + try: RegSetKeyValue = cwrap( 'RegSetKeyValueW', LONG, a('key', HKEY), a('sub_key', LPCWSTR, None), a('name', LPCWSTR, None), @@ -153,6 +163,8 @@ def delete_value_errcheck(result, func, args): if result != 0: raise ctypes.WinError(result) return args + + RegDeleteKeyValue = cwrap( 'RegDeleteKeyValueW', LONG, a('key', HKEY), a('sub_key', LPCWSTR, None), a('name', LPCWSTR, None), errcheck=delete_value_errcheck) RegDeleteTree = cwrap( @@ -171,6 +183,8 @@ def get_value_errcheck(result, func, args): if result == winerror.ERROR_FILE_NOT_FOUND: raise KeyError('No such value found') raise ctypes.WinError(result) + + RegGetValue = cwrap( 'RegGetValueW', LONG, a('key', HKEY), a('sub_key', LPCWSTR, None), a('value_name', LPCWSTR, None), a('flags', DWORD, RRF_RT_ANY), a('data_type', LPDWORD, 0), a('data', ctypes.c_void_p, 0), a('size', LPDWORD, 0), errcheck=get_value_errcheck @@ -341,6 +355,7 @@ class Key(object): def __del__(self): self.close() + if __name__ == '__main__': from pprint import pprint k = Key(open_at=r'Software\RegisteredApplications', root=HKLM) From 637ddf7d4e6829c0a11122aa0470d158b43527f6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Sun, 10 Feb 2019 13:23:57 +0530 Subject: [PATCH 0220/2613] Edit book: Allow copying files from one editor instance to another by right clicking on them in the File browser --- manual/edit.rst | 8 +- src/calibre/gui2/tweak_book/boss.py | 114 +++++++++++++++++------ src/calibre/gui2/tweak_book/file_list.py | 35 ++++--- 3 files changed, 115 insertions(+), 42 deletions(-) diff --git a/manual/edit.rst b/manual/edit.rst index 52ec6f9234..45bb93202b 100644 --- a/manual/edit.rst +++ b/manual/edit.rst @@ -175,6 +175,12 @@ book, by right clicking on the file again and choosing :guilabel:`Replace with file...` which will allow you to replace the file in the book with the previously exported file. +You can also copy files between multiple editor instances. Select +the files you want to copy in the :guilabel:`File browser`, then right click +and choose, :guilabel:`Copy selected files to another editor instance`. Then, +in the other editor instance, right click in the :guilabel:`File browser` +and choose :guilabel:`Paste file from other editor instance`. + Adding new images/fonts/etc. or creating new blank files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -726,7 +732,7 @@ Checking external links You can use this tool to check all links in your book that point to external websites. The tool will try to visit every externally linked website, and -if the visit fails, it will report all broken links in a convenient format for +if the visit fails, it will report all broken links in a convenient format for you to fix. diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index ba560e08a8..080aa81613 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -1,55 +1,76 @@ #!/usr/bin/env python2 # vim:fileencoding=utf-8 -from __future__ import (unicode_literals, division, absolute_import, - print_function) +# License: GPLv3 Copyright: 2013, Kovid Goyal <kovid at kovidgoyal.net> +from __future__ import absolute_import, division, print_function, unicode_literals -__license__ = 'GPL v3' -__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' - -import tempfile, shutil, sys, os, errno +import errno +import os +import shutil +import sys +import tempfile from functools import partial, wraps from urlparse import urlparse from PyQt5.Qt import ( - QObject, QApplication, QDialog, QGridLayout, QLabel, QSize, Qt, QCheckBox, - QDialogButtonBox, QIcon, QInputDialog, QUrl, pyqtSignal, QVBoxLayout) + QApplication, QCheckBox, QDialog, QDialogButtonBox, QGridLayout, QIcon, + QInputDialog, QLabel, QMimeData, QObject, QSize, Qt, QUrl, QVBoxLayout, + pyqtSignal +) -from calibre import prints, isbytestring +from calibre import isbytestring, prints from calibre.constants import cache_dir, iswindows -from calibre.ptempfile import TemporaryDirectory from calibre.ebooks.oeb.base import urlnormalize -from calibre.ebooks.oeb.polish.main import SUPPORTED, tweak_polish -from calibre.ebooks.oeb.polish.container import get_container as _gc, clone_container, guess_type, OEB_DOCS, OEB_STYLES -from calibre.ebooks.oeb.polish.cover import mark_as_cover, mark_as_titlepage, set_cover +from calibre.ebooks.oeb.polish.container import ( + OEB_DOCS, OEB_STYLES, clone_container, get_container as _gc, guess_type +) +from calibre.ebooks.oeb.polish.cover import ( + mark_as_cover, mark_as_titlepage, set_cover +) from calibre.ebooks.oeb.polish.css import filter_css +from calibre.ebooks.oeb.polish.main import SUPPORTED, tweak_polish from calibre.ebooks.oeb.polish.pretty import fix_all_html, pretty_all -from calibre.ebooks.oeb.polish.replace import rename_files, replace_file, get_recommended_folders, rationalize_folders -from calibre.ebooks.oeb.polish.split import split, merge, AbortError, multisplit -from calibre.ebooks.oeb.polish.toc import remove_names_from_toc, create_inline_toc -from calibre.ebooks.oeb.polish.utils import link_stylesheets, setup_css_parser_serialization as scs -from calibre.gui2 import error_dialog, choose_files, question_dialog, info_dialog, choose_save_file, open_url, choose_dir, add_to_recent_docs +from calibre.ebooks.oeb.polish.replace import ( + get_recommended_folders, rationalize_folders, rename_files, replace_file +) +from calibre.ebooks.oeb.polish.split import AbortError, merge, multisplit, split +from calibre.ebooks.oeb.polish.toc import create_inline_toc, remove_names_from_toc +from calibre.ebooks.oeb.polish.utils import ( + link_stylesheets, setup_css_parser_serialization as scs +) +from calibre.gui2 import ( + add_to_recent_docs, choose_dir, choose_files, choose_save_file, error_dialog, + info_dialog, open_url, question_dialog +) from calibre.gui2.dialogs.confirm_delete import confirm from calibre.gui2.tweak_book import ( - set_current_container, current_container, tprefs, actions, editors, - set_book_locale, dictionaries, editor_name) + actions, current_container, dictionaries, editor_name, editors, set_book_locale, + set_current_container, tprefs +) from calibre.gui2.tweak_book.completion.worker import completion_worker -from calibre.gui2.tweak_book.undo import GlobalUndoHistory -from calibre.gui2.tweak_book.file_list import NewFileDialog -from calibre.gui2.tweak_book.save import SaveManager, save_container, find_first_existing_ancestor -from calibre.gui2.tweak_book.preview import parse_worker -from calibre.gui2.tweak_book.toc import TOCEditor from calibre.gui2.tweak_book.editor import editor_from_syntax, syntax_from_mime -from calibre.gui2.tweak_book.editor.insert_resource import get_resource_data, NewBook +from calibre.gui2.tweak_book.editor.insert_resource import NewBook, get_resource_data +from calibre.gui2.tweak_book.file_list import FILE_COPY_MIME, NewFileDialog from calibre.gui2.tweak_book.preferences import Preferences -from calibre.gui2.tweak_book.search import validate_search_request, run_search -from calibre.gui2.tweak_book.spell import find_next as find_next_word, find_next_error +from calibre.gui2.tweak_book.preview import parse_worker +from calibre.gui2.tweak_book.save import ( + SaveManager, find_first_existing_ancestor, save_container +) +from calibre.gui2.tweak_book.search import run_search, validate_search_request +from calibre.gui2.tweak_book.spell import ( + find_next as find_next_word, find_next_error +) +from calibre.gui2.tweak_book.toc import TOCEditor +from calibre.gui2.tweak_book.undo import GlobalUndoHistory from calibre.gui2.tweak_book.widgets import ( - RationalizeFolders, MultiSplit, ImportForeign, QuickOpen, InsertLink, - InsertSemantics, BusyCursor, InsertTag, FilterCSS, AddCover) + AddCover, BusyCursor, FilterCSS, ImportForeign, InsertLink, InsertSemantics, + InsertTag, MultiSplit, QuickOpen, RationalizeFolders +) +from calibre.ptempfile import TemporaryDirectory from calibre.utils.config import JSONConfig from calibre.utils.icu import numeric_sort_key from calibre.utils.imghdr import identify from calibre.utils.tdir_in_cache import tdir_in_cache +from polyglot.builtins import iteritems _diff_dialogs = [] last_used_transform_rules = [] @@ -115,6 +136,8 @@ class Boss(QObject): fl.export_requested.connect(self.export_requested) fl.replace_requested.connect(self.replace_requested) fl.link_stylesheets_requested.connect(self.link_stylesheets_requested) + fl.initiate_file_copy.connect(self.copy_files_to_clipboard) + fl.initiate_file_paste.connect(self.paste_files_from_clipboard) self.gui.central.current_editor_changed.connect(self.apply_current_editor_state) self.gui.central.close_requested.connect(self.editor_close_requested) self.gui.central.search_panel.search_triggered.connect(self.search) @@ -1326,6 +1349,37 @@ class Boss(QObject): raise self.export_file(name, dest) + @in_thread_job + def copy_files_to_clipboard(self, names): + names = tuple(names) + for name in names: + if name in editors and not editors[name].is_synced_to_container: + self.commit_editor_to_container(name) + container = current_container() + md = QMimeData() + url_map = { + name:container.get_file_path_for_processing(name, allow_modification=False) + for name in names + } + md.setUrls(list(map(QUrl.fromLocalFile, url_map.values()))) + import json + md.setData(FILE_COPY_MIME, json.dumps({ + name: (url_map[name], container.mime_map.get(name)) for name in names + })) + QApplication.instance().clipboard().setMimeData(md) + + @in_thread_job + def paste_files_from_clipboard(self): + md = QApplication.instance().clipboard().mimeData() + if md.hasUrls() and md.hasFormat(FILE_COPY_MIME): + import json + name_map = json.loads(bytes(md.data(FILE_COPY_MIME))) + container = current_container() + for name, (path, mt) in iteritems(name_map): + with lopen(path, 'rb') as f: + container.add_file(name, f.read(), media_type=mt) + self.apply_container_update_to_gui() + def export_file(self, name, path): if name in editors and not editors[name].is_synced_to_container: self.commit_editor_to_container(name) diff --git a/src/calibre/gui2/tweak_book/file_list.py b/src/calibre/gui2/tweak_book/file_list.py index 2e42c97816..7b714520f2 100644 --- a/src/calibre/gui2/tweak_book/file_list.py +++ b/src/calibre/gui2/tweak_book/file_list.py @@ -12,15 +12,12 @@ from collections import Counter, OrderedDict, defaultdict from functools import partial from PyQt5.Qt import ( - QCheckBox, QDialog, QDialogButtonBox, QFont, QFormLayout, QGridLayout, QIcon, - QInputDialog, QLabel, QLineEdit, QListWidget, QListWidgetItem, QMenu, QPainter, - QPixmap, QRadioButton, QScrollArea, QSize, QSpinBox, QStyle, QStyledItemDelegate, - Qt, QTimer, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget, pyqtSignal + QApplication, QCheckBox, QDialog, QDialogButtonBox, QFont, QFormLayout, + QGridLayout, QIcon, QInputDialog, QLabel, QLineEdit, QListWidget, + QListWidgetItem, QMenu, QPainter, QPixmap, QRadioButton, QScrollArea, QSize, + QSpinBox, QStyle, QStyledItemDelegate, Qt, QTimer, QTreeWidget, QTreeWidgetItem, + QVBoxLayout, QWidget, pyqtSignal ) -try: - from PyQt5 import sip -except ImportError: - import sip from calibre import human_readable, plugins, sanitize_file_name_unicode from calibre.ebooks.oeb.base import OEB_DOCS, OEB_STYLES @@ -42,7 +39,15 @@ from calibre.gui2.tweak_book import ( from calibre.gui2.tweak_book.editor import syntax_from_mime from calibre.gui2.tweak_book.templates import template_for from calibre.utils.icu import numeric_sort_key +from polyglot.builtins import iteritems +try: + from PyQt5 import sip +except ImportError: + import sip + + +FILE_COPY_MIME = 'application/calibre-edit-book-files' TOP_ICON_SIZE = 24 NAME_ROLE = Qt.UserRole CATEGORY_ROLE = NAME_ROLE + 1 @@ -194,6 +199,8 @@ class FileList(QTreeWidget): export_requested = pyqtSignal(object, object) replace_requested = pyqtSignal(object, object, object, object) link_stylesheets_requested = pyqtSignal(object, object, object) + initiate_file_copy = pyqtSignal(object) + initiate_file_paste = pyqtSignal() def __init__(self, parent=None): QTreeWidget.__init__(self, parent) @@ -228,13 +235,13 @@ class FileList(QTreeWidget): self.rendered_emblem_cache = {} self.top_level_pixmap_cache = { name : QIcon(I(icon)).pixmap(TOP_ICON_SIZE, TOP_ICON_SIZE) - for name, icon in { + for name, icon in iteritems({ 'text':'keyboard-prefs.png', 'styles':'lookfeel.png', 'fonts':'font.png', 'misc':'mimetypes/dir.png', 'images':'view-image.png', - }.iteritems()} + })} self.itemActivated.connect(self.item_double_clicked) def mimeTypes(self): @@ -527,6 +534,9 @@ class FileList(QTreeWidget): '&Copy the selected file to another editor instance', '&Copy the {} selected files to another editor instance', num).format(num), self.copy_selected_files) m.addSeparator() + md = QApplication.instance().clipboard().mimeData() + if md.hasUrls() and md.hasFormat(FILE_COPY_MIME): + m.addAction(_('Paste files from other editor instance'), self.paste_from_other_instance) selected_map = defaultdict(list) for item in sel: @@ -648,7 +658,10 @@ class FileList(QTreeWidget): return ans def copy_selected_files(self): - pass + self.initiate_file_copy.emit(self.selected_names) + + def paste_from_other_instance(self): + self.initiate_file_paste.emit() def request_delete(self): names = self.selected_names From ea99a041d33192dfb1b626929cbed53bde8250ae Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Sun, 10 Feb 2019 15:46:45 +0530 Subject: [PATCH 0221/2613] Fix clicking on an empty published field in the book list to edit it setting the initial date to Jan 2000 instead of today's date --- src/calibre/gui2/library/delegates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index b81592a8cd..46eaf29add 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -300,7 +300,7 @@ class PubDateDelegate(QStyledItemDelegate, UpdateEditorGeometry): # {{{ elif check_key_modifier(Qt.ShiftModifier + Qt.ControlModifier): val = now() elif is_date_undefined(val): - val = QDate(2000, 1, 1) + val = QDate.currentDate() if isinstance(val, QDateTime): val = val.date() editor.setDate(val) From 0242b3d1c1d35b6a04168781d861075996a80b26 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Sun, 10 Feb 2019 16:05:55 +0530 Subject: [PATCH 0222/2613] Use un-prefixed names for markdown extension loading --- src/calibre/ebooks/txt/processor.py | 21 +++++++++++---------- src/calibre/test_build.py | 4 ++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/calibre/ebooks/txt/processor.py b/src/calibre/ebooks/txt/processor.py index 6a20703cbb..b2a6292748 100644 --- a/src/calibre/ebooks/txt/processor.py +++ b/src/calibre/ebooks/txt/processor.py @@ -102,25 +102,26 @@ def convert_basic(txt, title='', epub_split_size_kb=0): DEFAULT_MD_EXTENSIONS = ('footnotes', 'tables', 'toc') -def convert_markdown(txt, title='', extensions=DEFAULT_MD_EXTENSIONS): - from calibre.ebooks.conversion.plugins.txt_input import MD_EXTENSIONS +def create_markdown_object(extensions): from calibre.ebooks.markdown import Markdown - extensions = ['calibre.ebooks.markdown.extensions.' + x.lower() for x in extensions if x.lower() in MD_EXTENSIONS] + from calibre.ebooks.conversion.plugins.txt_input import MD_EXTENSIONS + extensions = [x.lower() for x in extensions if x.lower() in MD_EXTENSIONS] md = Markdown(extensions=extensions) + return md + + +def convert_markdown(txt, title='', extensions=DEFAULT_MD_EXTENSIONS): + md = create_markdown_object(extensions) return HTML_TEMPLATE % (title, md.convert(txt)) def convert_markdown_with_metadata(txt, title='', extensions=DEFAULT_MD_EXTENSIONS): - from calibre.ebooks.conversion.plugins.txt_input import MD_EXTENSIONS - from calibre.ebooks.markdown import Markdown from calibre.ebooks.metadata.book.base import Metadata from calibre.utils.date import parse_only_date from calibre.db.write import get_series_values - extensions = ['calibre.ebooks.markdown.extensions.' + x.lower() for x in extensions if x.lower() in MD_EXTENSIONS] - meta_ext = 'calibre.ebooks.markdown.extensions.meta' - if meta_ext not in extensions: - extensions.append(meta_ext) - md = Markdown(extensions=extensions) + if 'meta' not in extensions: + extensions.append('meta') + md = create_markdown_object(extensions) html = md.convert(txt) mi = Metadata(title or _('Unknown')) m = md.Meta diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index c38baac7bf..64470fa025 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -269,9 +269,9 @@ class BuildTest(unittest.TestCase): del readline def test_markdown(self): - from calibre.ebooks.markdown import Markdown + from calibre.ebooks.txt.processor import create_markdown_object from calibre.ebooks.conversion.plugins.txt_input import MD_EXTENSIONS - Markdown(extensions=MD_EXTENSIONS) + create_markdown_object(MD_EXTENSIONS) from calibre.library.comments import sanitize_comments_html sanitize_comments_html(b'''<script>moo</script>xxx<img src="http://moo.com/x.jpg">''') From c4a5afcf24769ec9adde99bc80f1ed33c9ee5e78 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Sun, 10 Feb 2019 19:14:26 +0530 Subject: [PATCH 0223/2613] Allow loading builtin markdown extensions without relying on pkg_resources --- src/calibre/ebooks/txt/processor.py | 22 ++++++++++++++++++++-- src/calibre/test_build.py | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/txt/processor.py b/src/calibre/ebooks/txt/processor.py index b2a6292748..7a729f859e 100644 --- a/src/calibre/ebooks/txt/processor.py +++ b/src/calibre/ebooks/txt/processor.py @@ -103,10 +103,28 @@ DEFAULT_MD_EXTENSIONS = ('footnotes', 'tables', 'toc') def create_markdown_object(extensions): + # Need to load markdown extensions without relying on pkg_resources + import importlib from calibre.ebooks.markdown import Markdown + from markdown import Extension + + class NotBrainDeadMarkdown(Markdown): + def build_extension(self, ext_name, configs): + if '.' in ext_name or ':' in ext_name: + return Markdown.build_extension(self, ext_name, configs) + ext_name = 'markdown.extensions.' + ext_name + module = importlib.import_module(ext_name) + if hasattr(module, 'makeExtension'): + return module.makeExtension(**configs) + for name, x in vars(module).items(): + if type(x) is type and issubclass(x, Extension) and x is not Extension: + return x(**configs) + raise ImportError('No extension class in {}'.format(ext_name)) + from calibre.ebooks.conversion.plugins.txt_input import MD_EXTENSIONS - extensions = [x.lower() for x in extensions if x.lower() in MD_EXTENSIONS] - md = Markdown(extensions=extensions) + extensions = [x.lower() for x in extensions] + extensions = [x for x in extensions if x in MD_EXTENSIONS] + md = NotBrainDeadMarkdown(extensions=extensions) return md diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index 64470fa025..f450e91744 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -271,7 +271,7 @@ class BuildTest(unittest.TestCase): def test_markdown(self): from calibre.ebooks.txt.processor import create_markdown_object from calibre.ebooks.conversion.plugins.txt_input import MD_EXTENSIONS - create_markdown_object(MD_EXTENSIONS) + create_markdown_object(sorted(MD_EXTENSIONS)) from calibre.library.comments import sanitize_comments_html sanitize_comments_html(b'''<script>moo</script>xxx<img src="http://moo.com/x.jpg">''') From 19bb59e70ef0668bf8bfbd28a196cf6cc6030840 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Sun, 10 Feb 2019 19:37:32 +0530 Subject: [PATCH 0224/2613] ... --- src/calibre/utils/winreg/lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/utils/winreg/lib.py b/src/calibre/utils/winreg/lib.py index b9cee2ed8f..3393bc09f3 100644 --- a/src/calibre/utils/winreg/lib.py +++ b/src/calibre/utils/winreg/lib.py @@ -281,7 +281,7 @@ class Key(object): def set(self, name=None, value=None, sub_key=None, has_expansions=False): ''' Set a value for this key (with optional sub-key). If name is None, - the Default value is set. value can be an integer, a string or a list + the Default value is set. value can be an integer, a string, bytes or a list of strings. If you want to use expansions, set has_expansions=True. ''' value, dtype, size = convert_to_registry_data(value, has_expansions=has_expansions) RegSetKeyValue(self.hkey, sub_key, name, dtype, value, size) From de18e1fdc26c3071935cd6a026a730fd95509fcb Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Mon, 11 Feb 2019 10:55:20 +0530 Subject: [PATCH 0225/2613] Fetch all articles from 1843 RSS feed --- recipes/1843.recipe | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/1843.recipe b/recipes/1843.recipe index e5a2b663b4..bbff61247c 100644 --- a/recipes/1843.recipe +++ b/recipes/1843.recipe @@ -19,6 +19,7 @@ class E1843(BasicNewsRecipe): language = 'en' no_stylesheets = True remove_javascript = True + oldest_article = 365 encoding = 'utf-8' feeds = [ 'https://www.1843magazine.com/rss/content', From 15e5d7cb11d6a1f89951c7dbed84de4ad04d94fa Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Mon, 11 Feb 2019 13:50:28 +0530 Subject: [PATCH 0226/2613] FB2 Output: Fix comments from the input document not present in the output. Fixes #1815357 [Field "Comments" are lost when converting epub to fb2](https://bugs.launchpad.net/calibre/+bug/1815357) --- src/calibre/ebooks/fb2/fb2ml.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/calibre/ebooks/fb2/fb2ml.py b/src/calibre/ebooks/fb2/fb2ml.py index a1981e01ee..d01dd494d3 100644 --- a/src/calibre/ebooks/fb2/fb2ml.py +++ b/src/calibre/ebooks/fb2/fb2ml.py @@ -185,6 +185,14 @@ class FB2MLizer(object): if key not in ('author', 'cover', 'sequence', 'keywords', 'year', 'publisher', 'isbn'): metadata[key] = prepare_string_for_xml(value) + try: + comments = self.oeb_book.metadata['description'][0] + except Exception: + metadata['comments'] = '' + else: + from calibre.utils.html2text import html2text + metadata['comments'] = '<annotation>{}</annotation>'.format(prepare_string_for_xml(html2text(comments.value.strip()))) + return textwrap.dedent(u''' <FictionBook xmlns="http://www.gribuser.ru/xml/fictionbook/2.0" xmlns:xlink="http://www.w3.org/1999/xlink"> <description> @@ -196,6 +204,7 @@ class FB2MLizer(object): <lang>%(lang)s</lang> %(keywords)s %(sequence)s + %(comments)s </title-info> <document-info> %(author)s From fda7618627242d4ec250278047719a9e76a77c01 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Mon, 11 Feb 2019 14:31:34 +0530 Subject: [PATCH 0227/2613] Windows: Add a button to Preferences->Sharing over the net to set calibre to run when the computer starts --- src/calibre/gui2/preferences/server.py | 104 ++++++++++++++++++++++++- src/calibre/utils/windows/winutil.c | 2 + 2 files changed, 102 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/preferences/server.py b/src/calibre/gui2/preferences/server.py index f3b87fe1ba..7dcfa07960 100644 --- a/src/calibre/gui2/preferences/server.py +++ b/src/calibre/gui2/preferences/server.py @@ -5,6 +5,7 @@ import errno import json import os +import sys import textwrap import time @@ -14,12 +15,9 @@ from PyQt5.Qt import ( QPushButton, QScrollArea, QSize, QSizePolicy, QSpinBox, Qt, QTabWidget, QTimer, QToolButton, QUrl, QVBoxLayout, QWidget, pyqtSignal ) -try: - from PyQt5 import sip -except ImportError: - import sip from calibre import as_unicode +from calibre.constants import isportable, iswindows from calibre.gui2 import ( choose_files, choose_save_file, config, error_dialog, gprefs, info_dialog, open_url, warning_dialog @@ -34,6 +32,81 @@ from calibre.srv.users import ( ) from calibre.utils.icu import primary_sort_key +try: + from PyQt5 import sip +except ImportError: + import sip + + +if iswindows and not isportable: + def get_exe(): + exe_base = os.path.abspath(os.path.dirname(sys.executable)) + exe = os.path.join(exe_base, 'calibre.exe') + if isinstance(exe, bytes): + exe = exe.decode('mbcs') + return exe + + def startup_shortcut_path(): + from win32com.shell import shell, shellcon + startup_path = shell.SHGetFolderPath(0, shellcon.CSIDL_STARTUP, 0, 0) + return os.path.join(startup_path, "calibre.lnk") + + class Shortcut(object): + + def __enter__(self): + import pythoncom + from win32com.shell import shell + pythoncom.CoInitialize() + self.instance = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink) + self.persist_file = self.instance.QueryInterface(pythoncom.IID_IPersistFile) + return self + + def __exit__(self, *a): + import pythoncom + del self.instance + del self.persist_file + pythoncom.CoUninitialize() + + def create_at(self, shortcut_path, target, description, *args): + shortcut = self.instance + shortcut.SetPath(target) + shortcut.SetIconLocation(target, 0) + shortcut.SetDescription(description) + if args: + quoted_args = [] + for arg in args: + quoted_args.append('"{}"'.format(arg)) + shortcut.SetArguments(' '.join(quoted_args)) + self.persist_file.Save(shortcut_path, 0) + + def exists_at(self, shortcut_path, target): + if not os.access(shortcut_path, os.R_OK): + return False + self.persist_file.Load(shortcut_path) + name = self.instance.GetPath(8)[0] + return os.path.normcase(os.path.abspath(name)) == os.path.normcase(os.path.abspath(get_exe())) + + def set_run_at_startup(run_at_startup=True): + if run_at_startup: + with Shortcut() as shortcut: + shortcut.create_at(startup_shortcut_path(), get_exe(), 'calibre - E-book management', '--start-in-tray') + else: + shortcut_path = startup_shortcut_path() + if os.path.exists(shortcut_path): + os.remove(shortcut_path) + + def is_set_to_run_at_startup(): + try: + with Shortcut() as shortcut: + return shortcut.exists_at(startup_shortcut_path(), get_exe()) + except Exception: + import traceback + traceback.print_exc() + +else: + set_run_at_startup = is_set_to_run_at_startup = None + + # Advanced {{{ @@ -294,8 +367,31 @@ class MainTab(QWidget): # {{{ get_gui().iactions['Connect Share'].share_conn_menu.server_state_changed_signal.connect(self.update_ip_info) l.addSpacing(10) l.addWidget(self.ip_info) + if set_run_at_startup is not None: + self.run_at_start_button = b = QPushButton('', self) + self.set_run_at_start_text() + b.clicked.connect(self.toggle_run_at_startup) + l.addSpacing(10) + l.addWidget(b) + l.addSpacing(10) + l.addStretch(10) + def set_run_at_start_text(self): + is_autostarted = is_set_to_run_at_startup() + self.run_at_start_button.setText( + _('Do not start calibre automatically when computer is started') if is_autostarted else + _('Start calibre when the computer is started') + ) + self.run_at_start_button.setToolTip('<p>' + ( + _('''Currently calibre is set to run automatically when the + computer starts. Use this button to disable that.''') if is_autostarted else + _('''Start calibre in the system tray automatically when the computer starts'''))) + + def toggle_run_at_startup(self): + set_run_at_startup(not is_set_to_run_at_startup()) + self.set_run_at_start_text() + def update_ip_info(self): from calibre.gui2.ui import get_gui t = get_gui().iactions['Connect Share'].share_conn_menu.ip_text diff --git a/src/calibre/utils/windows/winutil.c b/src/calibre/utils/windows/winutil.c index 7e3484f636..a68cf22307 100644 --- a/src/calibre/utils/windows/winutil.c +++ b/src/calibre/utils/windows/winutil.c @@ -488,5 +488,7 @@ initwinutil(void) { PyModule_AddIntConstant(m, "CSIDL_SYSTEM", CSIDL_SYSTEM); PyModule_AddIntConstant(m, "CSIDL_WINDOWS", CSIDL_WINDOWS); PyModule_AddIntConstant(m, "CSIDL_PROFILE", CSIDL_PROFILE); + PyModule_AddIntConstant(m, "CSIDL_STARTUP", CSIDL_STARTUP); + PyModule_AddIntConstant(m, "CSIDL_COMMON_STARTUP", CSIDL_COMMON_STARTUP); } From f2315801db3f406d381c41bb901970e827b4041b Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Thu, 14 Feb 2019 09:37:13 +0530 Subject: [PATCH 0228/2613] Update China Daily --- recipes/chinadaily.recipe | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/recipes/chinadaily.recipe b/recipes/chinadaily.recipe index e1704d6f09..f534c7eff7 100644 --- a/recipes/chinadaily.recipe +++ b/recipes/chinadaily.recipe @@ -41,10 +41,6 @@ class Pagina12(BasicNewsRecipe): } feeds = [ - - (u'China', u'http://www.chinadaily.com.cn/rss/china_rss.xml'), - (u'Business', u'http://www.chinadaily.com.cn/rss/bizchina_rss.xml'), - (u'World', u'http://www.chinadaily.com.cn/rss/world_rss.xml'), - (u'Sports', u'http://www.chinadaily.com.cn/rss/sports_rss.xml'), - (u'Opinions', u'http://www.chinadaily.com.cn/rss/opinion_rss.xml') + (u'China Daily', u'http://www.chinadaily.com.cn/rss/cndy_rss.xml'), + (u'HK Edition', u'http://www.chinadaily.com.cn/rss/hk_rss.xml'), ] From 15a3bb4b8d2061c28683f30284d38a9b81350002 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Thu, 14 Feb 2019 18:48:18 +0530 Subject: [PATCH 0229/2613] Fix building on NetBSD Thanks to Thomas Klausner --- src/calibre/utils/speedup.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/utils/speedup.c b/src/calibre/utils/speedup.c index bdad0a7c6d..1d3d5763db 100644 --- a/src/calibre/utils/speedup.c +++ b/src/calibre/utils/speedup.c @@ -502,6 +502,8 @@ extern int pthread_setname_np(const char *name); #elif defined(FREEBSD_SET_NAME) // Function has a different name on FreeBSD void pthread_set_name_np(pthread_t tid, const char *name); +#elif defined(__NetBSD__) +// pthread.h provides the symbol #else // Need _GNU_SOURCE for pthread_setname_np on linux and that causes other issues on systems with old glibc extern int pthread_setname_np(pthread_t, const char *name); @@ -526,6 +528,8 @@ set_thread_name(PyObject *self, PyObject *args) { #elif defined(FREEBSD_SET_NAME) pthread_set_name_np(pthread_self(), name); ret = 0; +#elif defined(__NetBSD__) + ret = pthread_setname_np(pthread_self(), "%s", name); #else ret = pthread_setname_np(pthread_self(), name); #endif From 8d86d10e5a8b401bff7bc69fb162ba3e66f53588 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Sun, 17 Feb 2019 10:13:42 +0530 Subject: [PATCH 0230/2613] Tag browser: Have pressing the Enter key find the next match. Fixes #1816276 [Find the first/next matching item with Enter](https://bugs.launchpad.net/calibre/+bug/1816276) --- src/calibre/gui2/tag_browser/ui.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tag_browser/ui.py b/src/calibre/gui2/tag_browser/ui.py index 37fcd55923..e6db960949 100644 --- a/src/calibre/gui2/tag_browser/ui.py +++ b/src/calibre/gui2/tag_browser/ui.py @@ -457,6 +457,7 @@ class TagBrowserBar(QWidget): # {{{ self.toggle_search_button.setVisible(True) self.search_button.setVisible(False) self.item_search.setVisible(False) + # }}} @@ -477,7 +478,6 @@ class TagBrowserWidget(QFrame): # {{{ self.current_find_position = None self.search_button.clicked.connect(self.find) - self.item_search.lineEdit().returnPressed.connect(self.do_find) self.item_search.lineEdit().textEdited.connect(self.find_text_changed) self.item_search.activated[str].connect(self.do_find) @@ -587,10 +587,14 @@ class TagBrowserWidget(QFrame): # {{{ self.current_find_position = None self.find() + @property + def find_text(self): + return unicode(self.item_search.currentText()).strip() + def find(self): model = self.tags_view.model() model.clear_boxed() - txt = unicode(self.item_search.currentText()).strip() + txt = self.find_text if txt.startswith('*'): model.set_categories_filter(txt[1:]) @@ -636,4 +640,12 @@ class TagBrowserWidget(QFrame): # {{{ def not_found_label_timer_event(self): self.not_found_label.setVisible(False) + def keyPressEvent(self, ev): + if ev.key() in (Qt.Key_Enter, Qt.Key_Return) and self.find_text: + self.find() + ev.accept() + return + return QFrame.keyPressEvent(self, ev) + + # }}} From 8c430a5945333ee0e2be2319f4970db406aac512 Mon Sep 17 00:00:00 2001 From: Charles Haley <cbhaley@i.wont.say.com> Date: Sun, 17 Feb 2019 11:57:42 +0000 Subject: [PATCH 0231/2613] Enhancement #1816274: add a "Search using saved search expression" action to the tag browser context menu. --- src/calibre/gui2/search_box.py | 4 ++-- src/calibre/gui2/tag_browser/view.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/search_box.py b/src/calibre/gui2/search_box.py index 153881fb19..c95a8d5d32 100644 --- a/src/calibre/gui2/search_box.py +++ b/src/calibre/gui2/search_box.py @@ -608,10 +608,10 @@ class SavedSearchBoxMixin(object): # {{{ self.current_db.new_api.ensure_has_search_category(fail_on_existing=False) self.do_rebuild_saved_searches() - def get_saved_search_text(self): + def get_saved_search_text(self, search_name=None): db = self.current_db try: - current_search = self.search.currentText() + current_search = search_name if search_name else self.search.currentText() if not current_search.startswith('search:'): raise ValueError() # This strange expression accounts for the four ways a search can be written: diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index 5edd8bc134..3445db6215 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -149,6 +149,7 @@ class TagsView(QTreeView): # {{{ self.setAutoExpandDelay(500) self.pane_is_visible = False self.search_icon = QIcon(I('search.png')) + self.search_copy_icon = QIcon(I("search_copy_saved.png")) self.user_category_icon = QIcon(I('tb_folder.png')) self.delete_icon = QIcon(I('list_remove.png')) self.rename_icon = QIcon(I('edit-undo.png')) @@ -413,6 +414,10 @@ class TagsView(QTreeView): # {{{ if action == 'search': self._toggle(index, set_to=search_state) return + if action == "raw_search": + from calibre.gui2.ui import get_gui + get_gui().get_saved_search_text(search_name='search:' + key) + return if action == 'add_to_category': tag = index.tag if len(index.children) > 0: @@ -589,6 +594,11 @@ class TagsView(QTreeView): # {{{ partial(self.context_menu_handler, action='search', search_state=TAG_SEARCH_STATES['mark_minus'], index=index)) + self.context_menu.addAction(self.search_copy_icon, + _('Search using saved search expression'), + partial(self.context_menu_handler, action='raw_search', + key=tag.name)) + self.context_menu.addSeparator() elif key.startswith('@') and not item.is_gst: if item.can_be_edited: From 3abd63304fec0f36cd683872f57c13deda77bd45 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Mon, 18 Feb 2019 10:58:56 +0530 Subject: [PATCH 0232/2613] Update New York Times (Web) Fixes #1816305 [New York Time news not complete](https://bugs.launchpad.net/calibre/+bug/1816305) --- recipes/nytimes.recipe | 28 +++++++++++++--------------- recipes/nytimes_sub.recipe | 28 +++++++++++++--------------- 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/recipes/nytimes.recipe b/recipes/nytimes.recipe index 32bf4e983c..8ef35ee375 100644 --- a/recipes/nytimes.recipe +++ b/recipes/nytimes.recipe @@ -226,16 +226,19 @@ class NewYorkTimes(BasicNewsRecipe): # raise SystemExit(1) return feeds - def parse_highlights(self, container): - for article in container.findAll('article', **classes('story')): + def parse_article_group(self, container): + for li in container.findAll('li'): + article = li.find('article') h2 = article.find('h2') if h2 is not None: title = self.tag_to_string(h2) a = h2.find('a', href=True) if a is not None: url = a['href'] + if url.startswith('/'): + url = 'https://www.nytimes.com' + url desc = '' - p = article.find(**classes('summary')) + p = h2.findNextSibling('p') if p is not None: desc = self.tag_to_string(p) date = '' @@ -257,18 +260,13 @@ class NewYorkTimes(BasicNewsRecipe): self.log('\t\t', article['description']) container = soup.find(itemtype='http://schema.org/CollectionPage') - highlights = container.find('section', **classes('highlights')) - if highlights is not None: - for article in self.parse_highlights(highlights): - log(article) - yield article - extra = container.find('section', attrs={'data-collection-type': True}) - if extra is not None: - title = self.tag_to_string(extra.find('h2')) - for article in self.parse_highlights(extra): - article['title'] = '{}: {}'.format(title, article['title']) - log(article) - yield article + container.find('header').extract() + div = container.find('div') + for section in div.findAll('section'): + for ol in section.findAll('ol'): + for article in self.parse_article_group(ol): + log(article) + yield article def parse_web_sections(self): self.read_nyt_metadata() diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index 7399a96415..0670acc39f 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -226,16 +226,19 @@ class NewYorkTimes(BasicNewsRecipe): # raise SystemExit(1) return feeds - def parse_highlights(self, container): - for article in container.findAll('article', **classes('story')): + def parse_article_group(self, container): + for li in container.findAll('li'): + article = li.find('article') h2 = article.find('h2') if h2 is not None: title = self.tag_to_string(h2) a = h2.find('a', href=True) if a is not None: url = a['href'] + if url.startswith('/'): + url = 'https://www.nytimes.com' + url desc = '' - p = article.find(**classes('summary')) + p = h2.findNextSibling('p') if p is not None: desc = self.tag_to_string(p) date = '' @@ -257,18 +260,13 @@ class NewYorkTimes(BasicNewsRecipe): self.log('\t\t', article['description']) container = soup.find(itemtype='http://schema.org/CollectionPage') - highlights = container.find('section', **classes('highlights')) - if highlights is not None: - for article in self.parse_highlights(highlights): - log(article) - yield article - extra = container.find('section', attrs={'data-collection-type': True}) - if extra is not None: - title = self.tag_to_string(extra.find('h2')) - for article in self.parse_highlights(extra): - article['title'] = '{}: {}'.format(title, article['title']) - log(article) - yield article + container.find('header').extract() + div = container.find('div') + for section in div.findAll('section'): + for ol in section.findAll('ol'): + for article in self.parse_article_group(ol): + log(article) + yield article def parse_web_sections(self): self.read_nyt_metadata() From 5595655b69a8878e8a7a5e7a03dd1fd613886cf4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Mon, 18 Feb 2019 11:28:31 +0530 Subject: [PATCH 0233/2613] Update South China Morning Post Fixes #1816307 [recipe broken South China Morning News](https://bugs.launchpad.net/calibre/+bug/1816307) --- recipes/scmp.recipe | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/recipes/scmp.recipe b/recipes/scmp.recipe index 8f1c7af8c2..46c5d24aad 100644 --- a/recipes/scmp.recipe +++ b/recipes/scmp.recipe @@ -3,6 +3,7 @@ scmp.com ''' from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import Tag def classes(classes): @@ -29,8 +30,7 @@ class SCMP(BasicNewsRecipe): keep_only_tags = [ dict(name='h1'), - classes('field-name-field-subheading scmp-gallery-swiper pane-node-body field-name-field-authors'), - dict(itemprop='dateCreated dateModified'.split()), + classes('info__subHeadline article-author main__right'), ] remove_tags = [ dict(name='button') @@ -50,16 +50,29 @@ class SCMP(BasicNewsRecipe): return br feeds = [ - (u'Business', u'http://www.scmp.com/rss/business.xml'), - (u'Hong Kong', u'http://www.scmp.com/rss/hong_kong.xml'), - (u'China', u'http://www.scmp.com/rss/china.xml'), - (u'Asia & World', u'http://www.scmp.com/rss/news_asia_world.xml'), - (u'Opinion', u'http://www.scmp.com/rss/opinion.xml'), - (u'LifeSTYLE', u'http://www.scmp.com/rss/lifestyle.xml'), - (u'Sport', u'http://www.scmp.com/rss/sport.xml') + ('Hong Kong', 'https://www.scmp.com/rss/2/feed'), + ('China', 'https://www.scmp.com/rss/4/feed'), + ('Asia', 'https://www.scmp.com/rss/3/feed'), + ('World', 'https://www.scmp.com/rss/5/feed'), + ('Business', 'https://www.scmp.com/rss/92/feed'), + ('Tech', 'https://www.scmp.com/rss/36/feed'), + ('Life', 'https://www.scmp.com/rss/94/feed'), + ('Culture', 'https://www.scmp.com/rss/322296/feed'), + ('Sport', 'https://www.scmp.com/rss/95/feed'), + ('Post Mag', 'https://www.scmp.com/rss/71/feed'), + ('Style', 'https://www.scmp.com/rss/72/feed'), ] def preprocess_html(self, soup): for img in soup.findAll("img", attrs={'data-original':True}): img['src'] = img['data-original'] + meta = soup.find('meta', attrs={'name':'twitter:image:src'}, content=True) + if meta is not None: + wrapper = soup.find(**classes('image-wrapper__placeholder')) + if wrapper is not None: + p = wrapper.parent + img = Tag(soup, 'img') + img['src'] = meta['content'] + p.append(img) + wrapper.extract() return soup From 0b362bea08347713ffea9414c5b897f2b68f4a12 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Wed, 20 Feb 2019 18:09:02 +0530 Subject: [PATCH 0234/2613] Update Granma --- recipes/granma.recipe | 35 ++++++----------------------------- recipes/icons/granma.png | Bin 301 -> 1094 bytes 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/recipes/granma.recipe b/recipes/granma.recipe index 8f2dfebba1..157e04633e 100644 --- a/recipes/granma.recipe +++ b/recipes/granma.recipe @@ -1,9 +1,9 @@ #!/usr/bin/env python2 __license__ = 'GPL v3' -__copyright__ = '2008-2009, Darko Miletic <darko.miletic at gmail.com>' +__copyright__ = '2008-2019, Darko Miletic <darko.miletic at gmail.com>' ''' -granma.cubaweb.cu +granma.cu ''' from calibre.web.feeds.news import BasicNewsRecipe @@ -19,33 +19,10 @@ class Granma(BasicNewsRecipe): max_articles_per_feed = 100 no_stylesheets = True use_embedded_content = False - encoding = 'cp1252' - cover_url = 'http://www.granma.cubaweb.cu/imagenes/granweb229d.jpg' + encoding = 'utf8' + masthead_url = 'http://www.granma.cu/static/img/granma-logo.png' language = 'es_CU' - + auto_cleanup = True remove_javascript = True - html2lrf_options = [ - '--comment', description, '--category', category, '--publisher', publisher, '--ignore-tables' - ] - - html2epub_options = 'publisher="' + publisher + '"\ncomments="' + \ - description + '"\ntags="' + category + '"\nlinearize_tables=True' - - keep_only_tags = [dict(name='table', attrs={'height': '466'})] - - remove_tags = [dict(name=['embed', 'link', 'object'])] - - feeds = [(u'Noticias', u'http://www.granma.cubaweb.cu/noticias.xml')] - - def preprocess_html(self, soup): - mtag = '<meta http-equiv="Content-Language" content="es-CU"/>' - soup.head.insert(0, mtag) - for item in soup.findAll('table'): - if item.has_key('width'): # noqa - del item['width'] - if item.has_key('height'): # noqa - del item['height'] - for item in soup.findAll(style=True): - del item['style'] - return soup + feeds = [(u'Noticias', u'http://www.granma.cu/feed')] diff --git a/recipes/icons/granma.png b/recipes/icons/granma.png index d80760470be1902b5bcb8319be3374842431f23f..592a73bc60fab8aae4cf7e47aaad713f91db69b5 100644 GIT binary patch literal 1094 zcmV-M1iAZ(P)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00009a7bBm000ie z000ie0hKEb8vp<R8FWQhbW?9;ba!ELWdK2BZ(?O2No`?gWm08fWO;GPWjp`?0ncev zSaeuTOgdw4Z7yMCZ(?OGcx`Y10RUB0MlCo1SWQeiV{dIPVPtP&WiEJaZ~!QgeNxeG z+aMJE6+~Y)X*R}=ofy@tGP}|G;HpX^b*~Q42BiiBWOnmwd)O!K7lzY1ohG@62kzyZ zd(VY)dDZKN?zsb7{v>1p|NQ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E}5S5A_l?ZoQ_smVD7-8B@!qpZ}gAD)~0{68_kKNnlfmQwUrsQ>@~ M07*qoM6N<$f<J}uG5`Po literal 301 zcmV+|0n+}7P)<h;3K|Lk000e1NJLTq001xm001xu0{{R3VB86{0000IP)t-s|NsBM zz`%fjfdBshfPeu1006KgE{6aB0M<!FK~#9!t(8Fz!ypg?@e=<3<zAu!EQ3*1AHlOW zDm3Lk(yMEGdv(R=X`|$)uR8nNMwj-GC)VyVM6OXgZ3?Y3oIfpA<Ik(d1MHS{2#D=E z2gH652f&6XKr|^YcffZF^!GgsAmSd-2~g3bVH=L1HcMZE8r9u%69F;N!#x!PWm~Es zfP~=Z2g2N!bPNU{f&n7@6_%!MGC&R@fZr_x9MBa%KSSX^6_v#R=oIMponiv8Q$Rpc zop<$+KR1vh;XUH-C;K}=ekQ`$ZO8+DKw$g_myi+wIx`c<00000NkvXXu0mjfu3C8H From 8e853a3ff8b8c08266808511bddbe9a3331e67e0 Mon Sep 17 00:00:00 2001 From: Eli Schwartz <eschwartz@archlinux.org> Date: Mon, 4 Feb 2019 23:48:51 -0500 Subject: [PATCH 0235/2613] python3: add polyglot compat layer for builtins / __builtin__ --- src/calibre/__init__.py | 5 +++-- src/calibre/gui2/wizard/__init__.py | 4 ++-- src/calibre/startup.py | 16 ++++++++-------- src/calibre/utils/resources.py | 7 ++++--- src/polyglot/builtins.py | 9 ++++++--- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/calibre/__init__.py b/src/calibre/__init__.py index d72b709f07..6665dd38db 100644 --- a/src/calibre/__init__.py +++ b/src/calibre/__init__.py @@ -3,8 +3,9 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal <kovid@kovidgoyal.net>' __docformat__ = 'restructuredtext en' -import sys, os, re, time, random, __builtin__, warnings -__builtin__.__dict__['dynamic_property'] = lambda func: func(None) +import sys, os, re, time, random, warnings +from polyglot.builtins import builtins +builtins.__dict__['dynamic_property'] = lambda func: func(None) from math import floor from functools import partial diff --git a/src/calibre/gui2/wizard/__init__.py b/src/calibre/gui2/wizard/__init__.py index 0fb0d7efb4..39b9aaa119 100644 --- a/src/calibre/gui2/wizard/__init__.py +++ b/src/calibre/gui2/wizard/__init__.py @@ -689,8 +689,8 @@ class LibraryPage(QWizardPage, LibraryUI): def change_language(self, idx): prefs['language'] = str(self.language.itemData(self.language.currentIndex()) or '') - import __builtin__ - __builtin__.__dict__['_'] = lambda x: x + from polyglot.builtins import builtins + builtins.__dict__['_'] = lambda x: x from calibre.utils.localization import set_translators from calibre.gui2 import qt_app from calibre.ebooks.metadata.book.base import reset_field_metadata diff --git a/src/calibre/startup.py b/src/calibre/startup.py index b1be5025f7..481d8780ab 100644 --- a/src/calibre/startup.py +++ b/src/calibre/startup.py @@ -10,12 +10,12 @@ Perform various initialization tasks. import locale, sys # Default translation is NOOP -import __builtin__ -__builtin__.__dict__['_'] = lambda s: s +from polyglot.builtins import builtins +builtins.__dict__['_'] = lambda s: s # For strings which belong in the translation tables, but which shouldn't be # immediately translated to the environment language -__builtin__.__dict__['__'] = lambda s: s +builtins.__dict__['__'] = lambda s: s from calibre.constants import iswindows, preferred_encoding, plugins, isosx, islinux, isfrozen, DEBUG, isfreebsd @@ -161,12 +161,12 @@ if not _run_once: supports_mode_e = True return ans - __builtin__.__dict__['lopen'] = local_open + builtins.__dict__['lopen'] = local_open from calibre.utils.icu import title_case, lower as icu_lower, upper as icu_upper - __builtin__.__dict__['icu_lower'] = icu_lower - __builtin__.__dict__['icu_upper'] = icu_upper - __builtin__.__dict__['icu_title'] = title_case + builtins.__dict__['icu_lower'] = icu_lower + builtins.__dict__['icu_upper'] = icu_upper + builtins.__dict__['icu_title'] = title_case def connect_lambda(bound_signal, self, func, **kw): import weakref @@ -184,7 +184,7 @@ if not _run_once: func(ctx, *args) bound_signal.connect(slot, **kw) - __builtin__.__dict__['connect_lambda'] = connect_lambda + builtins.__dict__['connect_lambda'] = connect_lambda if islinux or isosx or isfreebsd: # Name all threads at the OS level created using the threading module, see diff --git a/src/calibre/utils/resources.py b/src/calibre/utils/resources.py index 4b2952c92f..0a7c2fb56c 100644 --- a/src/calibre/utils/resources.py +++ b/src/calibre/utils/resources.py @@ -8,9 +8,10 @@ __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>' __docformat__ = 'restructuredtext en' -import __builtin__, sys, os +import sys, os from calibre import config_dir +from polyglot.builtins import builtins class PathResolver(object): @@ -150,5 +151,5 @@ def load_hyphenator_dicts(hp_cache, lang, default_lang='en'): return js, lang -__builtin__.__dict__['P'] = get_path -__builtin__.__dict__['I'] = get_image_path +builtins.__dict__['P'] = get_path +builtins.__dict__['I'] = get_image_path diff --git a/src/polyglot/builtins.py b/src/polyglot/builtins.py index 6f4fc35ddd..2872b24009 100644 --- a/src/polyglot/builtins.py +++ b/src/polyglot/builtins.py @@ -20,9 +20,11 @@ if is_py3: value = None tb = None - zip = __builtins__['zip'] - map = __builtins__['map'] - filter = __builtins__['filter'] + import builtins + + zip = builtins.__dict__['zip'] + map = builtins.__dict__['map'] + filter = builtins.__dict__['filter'] def iteritems(d): return iter(d.items()) @@ -42,6 +44,7 @@ else: """) from future_builtins import zip, map, filter # noqa + import __builtin__ as builtins def iteritems(d): return d.iteritems() From dcf58e9a151f3cc9f3bb01dae28c20bc20f939aa Mon Sep 17 00:00:00 2001 From: Eli Schwartz <eschwartz@archlinux.org> Date: Thu, 10 Jan 2019 02:40:15 -0500 Subject: [PATCH 0236/2613] Port bzzdec plugin to build on python2/python3 --- src/calibre/ebooks/djvu/bzzdecoder.c | 63 ++++++++++++++++++---------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/src/calibre/ebooks/djvu/bzzdecoder.c b/src/calibre/ebooks/djvu/bzzdecoder.c index 1e355609f9..63d79587d9 100644 --- a/src/calibre/ebooks/djvu/bzzdecoder.c +++ b/src/calibre/ebooks/djvu/bzzdecoder.c @@ -23,7 +23,7 @@ typedef uint8_t bool; -typedef struct Table { +typedef struct Table { uint16_t p; uint16_t m; uint8_t up; @@ -315,11 +315,11 @@ static Table default_ztable[256] = // {{{ #define MIN(x, y) ((x < y) ? x : y) -#define ffz(ffzt, x) ((x>=0xff00) ? (ffzt[x&0xff]+8) : (ffzt[(x>>8)&0xff])) +#define ffz(ffzt, x) ((x>=0xff00) ? (ffzt[x&0xff]+8) : (ffzt[(x>>8)&0xff])) #define TRUE 1 #define FALSE 0 -#define MAXBLOCK 4096 +#define MAXBLOCK 4096 #define FREQMAX 4 #define CTXIDS 3 @@ -397,7 +397,7 @@ static inline int32_t decode_sub_simple(State *state, int32_t mps, uint32_t z) { } state->fence = MIN(state->code, 0x7fff); return mps ^ 1; - } + } /* MPS renormalization */ state->scount -= 1; @@ -543,10 +543,10 @@ static bool decode(State *state, uint8_t *ctx) { ctxid = 2 * CTXIDS; for (j = 1; j < 8; j++) { - if (zpcodec_decode(state, ctx, ctxid)) { - mtfno = (1 << j) + decode_binary(state, ctx, ctxid, j); - state->buf[i] = mtf[mtfno]; - goto rotate; + if (zpcodec_decode(state, ctx, ctxid)) { + mtfno = (1 << j) + decode_binary(state, ctx, ctxid, j); + state->buf[i] = mtf[mtfno]; + goto rotate; } ctxid += 1 << j; } @@ -571,7 +571,7 @@ static bool decode(State *state, uint8_t *ctx) { // Relocate new char according to new freq fc = fadd; if (mtfno < FREQMAX) fc += freq[mtfno]; - for (k=mtfno; k>=FREQMAX; k--) + for (k=mtfno; k>=FREQMAX; k--) mtf[k] = mtf[k-1]; for (; k>0 && fc>=freq[k-1]; k--) { mtf[k] = mtf[k-1]; @@ -585,7 +585,7 @@ static bool decode(State *state, uint8_t *ctx) { if (markerpos<1 || (uint32_t)markerpos>=state->xsize) { CORRUPT; goto end; } // Allocate pointers // Fill count buffer - for (i=0; i<(uint32_t)markerpos; i++) + for (i=0; i<(uint32_t)markerpos; i++) { c = state->buf[i]; posn[i] = (c<<24) | (count[c] & 0xffffff); @@ -682,8 +682,10 @@ end: if (PyErr_Occurred()) return NULL; return ans; } - -static PyMethodDef bzzdecmethods[] = { + +static char bzzdec_doc[] = "Decompress BZZ encoded strings (used in DJVU)"; + +static PyMethodDef bzzdec_methods[] = { {"decompress", bzz_decompress, METH_VARARGS, "decompress(bytestring) -> decompressed bytestring\n\n" "Decompress a BZZ compressed byte string. " @@ -692,15 +694,32 @@ static PyMethodDef bzzdecmethods[] = { {NULL, NULL, 0, NULL} }; +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&bzzdec_module) +static struct PyModuleDef bzzdec_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "bzzdec", + /* m_doc */ bzzdec_doc, + /* m_size */ -1, + /* m_methods */ bzzdec_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; +CALIBRE_MODINIT_FUNC PyInit_bzzdec(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("bzzdec", bzzdec_methods, bzzdec_doc) +CALIBRE_MODINIT_FUNC initbzzdec(void) { +#endif - -CALIBRE_MODINIT_FUNC -initbzzdec(void) { - PyObject *m; - m = Py_InitModule3("bzzdec", bzzdecmethods, - "Decompress BZZ encoded strings (used in DJVU)" - ); - if (m == NULL) return; + PyObject *m = INITMODULE; + if (m == NULL) { + INITERROR; + } +#if PY_MAJOR_VERSION >= 3 + return m; +#endif } - - From 482b24e8880ed32bd731c7d5cfab6c215588280a Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Thu, 21 Feb 2019 10:24:56 +0530 Subject: [PATCH 0237/2613] Forgot to change fmt string for build value as well --- src/calibre/ebooks/djvu/bzzdecoder.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/djvu/bzzdecoder.c b/src/calibre/ebooks/djvu/bzzdecoder.c index 340ea3d510..f249d617e3 100644 --- a/src/calibre/ebooks/djvu/bzzdecoder.c +++ b/src/calibre/ebooks/djvu/bzzdecoder.c @@ -633,10 +633,11 @@ bzz_decompress(PyObject *self, PyObject *args) { PyObject *ans = NULL; #if PY_MAJOR_VERSION >= 3 - if (!PyArg_ParseTuple(args, "y#", &(state.raw), &input_len)) +#define BYTES_FMT "y#" #else - if (!PyArg_ParseTuple(args, "s#", &(state.raw), &input_len)) +#define BYTES_FMT "s#" #endif + if (!PyArg_ParseTuple(args, BYTES_FMT, &(state.raw), &input_len)) return NULL; state.end = state.raw + input_len - 1; @@ -680,7 +681,7 @@ end: for (i = 0; i < 3; i++) { buflen <<= 8; buflen += (uint8_t)buf[i]; } - ans = Py_BuildValue("s#", buf + 3, MIN(buflen, pos - buf)); + ans = Py_BuildValue(BYTES_FMT, buf + 3, MIN(buflen, pos - buf)); } if (buf != NULL) free(buf); if (PyErr_Occurred()) return NULL; From 306959fd4aa546f8b8d989e6942f22ea4d5dfcf0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Sat, 23 Feb 2019 08:56:19 +0530 Subject: [PATCH 0238/2613] Update General Knowledge Today Fixes #1817256 [Unable to fetch "General Knowledge today"](https://bugs.launchpad.net/calibre/+bug/1817256) --- recipes/gkt.recipe | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/recipes/gkt.recipe b/recipes/gkt.recipe index 6da219cb3a..a5e2d24054 100644 --- a/recipes/gkt.recipe +++ b/recipes/gkt.recipe @@ -1,7 +1,7 @@ from calibre.web.feeds.news import BasicNewsRecipe -class Politics(BasicNewsRecipe): +class GKT(BasicNewsRecipe): title = u'General Knowledge Today' language = 'en_IN' __author__ = 'Kovid Goyal' @@ -12,8 +12,13 @@ class Politics(BasicNewsRecipe): no_javascript = True auto_cleanup = True - def parse_gkt_section(self, url): - root = self.index_to_soup(url, as_tree=True) + def parse_gkt_section(self, url, ignore_error=False): + try: + root = self.index_to_soup(url, as_tree=True) + except Exception: + if ignore_error: + return + raise for a in root.xpath('//div[@class="post-content"]/h1/a[@href]'): title = self.tag_to_string(a).strip() url = a.get('href') @@ -28,12 +33,12 @@ class Politics(BasicNewsRecipe): h3 = root.xpath('//h3[@class="widget-title"]')[1] for a in h3.getparent().xpath('descendant::li/a[@href]'): category = self.tag_to_string(a).strip() - if 'PDF' in category: + if 'PDF' in category or not category: continue url = a.get('href') self.log('Found section:', category) articles = list(self.parse_gkt_section(url)) + \ - list(self.parse_gkt_section(url + '/page/2')) + list(self.parse_gkt_section(url + '/page/2', ignore_error=True)) if articles: ans.append((category, articles)) return ans From a0f92e9fbb8abe0412c4297cbb1d60afd657730d Mon Sep 17 00:00:00 2001 From: Charles Haley <cbhaley@i.wont.say.com> Date: Sat, 23 Feb 2019 14:11:53 +0000 Subject: [PATCH 0239/2613] Enhancement: add restricting to the current VL in the tag browser category editor. See https://www.mobileread.com/forums/showthread.php?t=315414 --- src/calibre/gui2/dialogs/tag_list_editor.py | 36 ++++++++++++++------- src/calibre/gui2/dialogs/tag_list_editor.ui | 16 +++++++-- src/calibre/gui2/tag_browser/ui.py | 18 ++++++----- 3 files changed, 48 insertions(+), 22 deletions(-) diff --git a/src/calibre/gui2/dialogs/tag_list_editor.py b/src/calibre/gui2/dialogs/tag_list_editor.py index ae3aa5ede7..49be9c6619 100644 --- a/src/calibre/gui2/dialogs/tag_list_editor.py +++ b/src/calibre/gui2/dialogs/tag_list_editor.py @@ -91,7 +91,7 @@ class EditColumnDelegate(QItemDelegate): class TagListEditor(QDialog, Ui_TagListEditor): - def __init__(self, window, cat_name, tag_to_match, data, sorter): + def __init__(self, window, cat_name, tag_to_match, get_book_ids, sorter): QDialog.__init__(self, window) Ui_TagListEditor.__init__(self) self.setupUi(self) @@ -113,15 +113,9 @@ class TagListEditor(QDialog, Ui_TagListEditor): pass # initialization - self.to_rename = {} - self.to_delete = set([]) - self.all_tags = {} - self.original_names = {} - - for k,v,count in data: - self.all_tags[v] = {'key': k, 'count': count, 'cur_name': v, 'is_deleted': False} - self.original_names[k] = v - self.ordered_tags = sorted(self.all_tags.keys(), key=sorter) + self.ordered_tags = [] + self.sorter = sorter + self.get_book_ids = get_book_ids # Set up the column headings self.down_arrow_icon = QIcon(I('arrow-down.png')) @@ -140,7 +134,7 @@ class TagListEditor(QDialog, Ui_TagListEditor): self.table.setItemDelegate(EditColumnDelegate(self.table)) # Add the data - select_item = self.fill_in_table(self.ordered_tags, tag_to_match) + select_item = self.fill_in_table(None, tag_to_match) # Scroll to the selected item if there is one if select_item is not None: @@ -160,6 +154,8 @@ class TagListEditor(QDialog, Ui_TagListEditor): self.search_button.clicked.connect(self.all_matching_clicked) self.search_button.setDefault(True) + self.apply_vl_checkbox.clicked.connect(self.vl_box_changed) + self.table.setEditTriggers(QTableWidget.EditKeyPressed) try: @@ -171,7 +167,23 @@ class TagListEditor(QDialog, Ui_TagListEditor): except: pass + def vl_box_changed(self): + self.fill_in_table(None, None) + def fill_in_table(self, tags, tag_to_match): + self.to_rename = {} + self.to_delete = set([]) + self.all_tags = {} + self.original_names = {} + + data = self.get_book_ids(self.apply_vl_checkbox.isChecked()) + for k,v,count in data: + self.all_tags[v] = {'key': k, 'count': count, 'cur_name': v, 'is_deleted': False} + self.original_names[k] = v + self.ordered_tags = sorted(self.all_tags.keys(), key=self.sorter) + if tags is None: + tags = self.ordered_tags + select_item = None self.table.blockSignals(True) self.table.clear() @@ -220,7 +232,7 @@ class TagListEditor(QDialog, Ui_TagListEditor): self.all_tags[tag]['is_deleted'] = item.is_deleted search_for = icu_lower(unicode(self.search_box.text())) if len(search_for) == 0: - self.fill_in_table(self.ordered_tags, None) + self.fill_in_table(None, None) result = [] for k in self.ordered_tags: if search_for in icu_lower(unicode(self.all_tags[k]['cur_name'])): diff --git a/src/calibre/gui2/dialogs/tag_list_editor.ui b/src/calibre/gui2/dialogs/tag_list_editor.ui index c7dc4b030a..d38d2b9bb1 100644 --- a/src/calibre/gui2/dialogs/tag_list_editor.ui +++ b/src/calibre/gui2/dialogs/tag_list_editor.ui @@ -59,7 +59,19 @@ </item> </layout> </item> - <item row="1" column="0"> + <item row="1" column="0" colspan="3"> + <widget class="QCheckBox" name="apply_vl_checkbox"> + <property name="toolTip"> + <string><p>Show items in the Available items box only if they appear in the + current virtual library. Applied items not in the VL will be marked + "not on any book".</p></string> + </property> + <property name="text"> + <string>&Show only available items in current virtual library</string> + </property> + </widget> + </item> + <item row="2" column="0"> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> <widget class="QToolButton" name="delete_button"> @@ -132,7 +144,7 @@ </item> </layout> </item> - <item row="1" column="1"> + <item row="2" column="1"> <widget class="QTableWidget" name="table"> <property name="alternatingRowColors"> <bool>true</bool> diff --git a/src/calibre/gui2/tag_browser/ui.py b/src/calibre/gui2/tag_browser/ui.py index e6db960949..d3de5410b3 100644 --- a/src/calibre/gui2/tag_browser/ui.py +++ b/src/calibre/gui2/tag_browser/ui.py @@ -237,13 +237,15 @@ class TagBrowserMixin(object): # {{{ ''' db = self.current_db - data = db.new_api.get_categories() - if category in data: - result = [(t.id, t.original_name, t.count) for t in data[category] if t.count > 0] - else: - result = None - if result is None: - return + + def get_book_ids(use_virtual_library): + book_ids = None if not use_virtual_library else self.tags_view.model().get_book_ids_to_use() + data = db.new_api.get_categories(book_ids=book_ids) + if category in data: + result = [(t.id, t.original_name, t.count) for t in data[category] if t.count > 0] + else: + result = None + return result if category == 'series': key = lambda x:sort_key(title_sort(x)) @@ -251,7 +253,7 @@ class TagBrowserMixin(object): # {{{ key = sort_key d = TagListEditor(self, cat_name=db.field_metadata[category]['name'], - tag_to_match=tag, data=result, sorter=key) + tag_to_match=tag, get_book_ids=get_book_ids, sorter=key) d.exec_() if d.result() == d.Accepted: to_rename = d.to_rename # dict of old id to new name From 31375722078fe5341a2adf0b6839648ae759da75 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Mon, 25 Feb 2019 07:56:48 +0530 Subject: [PATCH 0240/2613] Fix #1817460 [harpers print magazine recipe broken](https://bugs.launchpad.net/calibre/+bug/1817460) --- recipes/harpers_full.recipe | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/recipes/harpers_full.recipe b/recipes/harpers_full.recipe index 52b816bcfd..fd7517600c 100644 --- a/recipes/harpers_full.recipe +++ b/recipes/harpers_full.recipe @@ -4,7 +4,7 @@ # kate: encoding utf-8; syntax python; __license__ = 'GPL v3' -__copyright__ = '2008-2017, Darko Miletic <darko.miletic at gmail.com>' +__copyright__ = '2008-2019, Darko Miletic <darko.miletic at gmail.com>' ''' harpers.org - paid subscription/ printed issue articles This recipe only get's article's published in text format @@ -69,15 +69,14 @@ class Harpers_full(BasicNewsRecipe): def parse_index(self): # find current issue soup = self.index_to_soup('https://harpers.org/') - currentIssue = soup.find('div', attrs={'class': 'mainNavi'}).find( - 'li', attrs={'class': 'curentIssue'}) - currentIssue_url = self.tag_to_string(currentIssue.a['href']) + currentIssue = soup.find('a', attrs={'id':'header-menu-dropdown-1'}) + currentIssue_url = self.tag_to_string(currentIssue['href']) self.log(currentIssue_url) # go to the current issue soup1 = self.index_to_soup(currentIssue_url) currentIssue_title = self.tag_to_string(soup1.head.title.string) - date = re.split('\s\|\s', currentIssue_title)[0] + date = re.split(r'\s\|\s', currentIssue_title)[0] self.timefmt = u' [%s]' % date # get cover From 7d00c4b0f4eb7ac7893bc907de3669081f605616 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Mon, 25 Feb 2019 09:16:06 +0530 Subject: [PATCH 0241/2613] macOS: Respect the system setting for text insertion cursor blink time This value can be changed with the following commands: defaults write -g NSTextInsertionPointBlinkPeriodOff -float 500 defaults write -g NSTextInsertionPointBlinkPeriodOn -float 500 --- setup/extensions.json | 6 ++++ src/calibre/constants.py | 1 + src/calibre/gui2/__init__.py | 8 +++++ src/calibre/utils/cocoa.m | 25 +++++++++++++++ src/calibre/utils/cocoa_wrapper.c | 53 +++++++++++++++++++++++++++++++ 5 files changed, 93 insertions(+) create mode 100644 src/calibre/utils/cocoa.m create mode 100644 src/calibre/utils/cocoa_wrapper.c diff --git a/setup/extensions.json b/setup/extensions.json index 5f69cc405e..a43568541d 100644 --- a/setup/extensions.json +++ b/setup/extensions.json @@ -186,6 +186,12 @@ "sources": "calibre/devices/usbobserver/usbobserver.c", "ldflags": "-framework CoreServices -framework IOKit" }, + { + "name": "cocoa", + "only": "osx", + "sources": "calibre/utils/cocoa.m calibre/utils/cocoa_wrapper.c", + "ldflags": "-framework Cocoa" + }, { "name": "libusb", "only": "osx linux haiku", diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 1944e77e60..aefd0ea4ba 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -189,6 +189,7 @@ class Plugins(collections.Mapping): plugins.extend(['winutil', 'wpd', 'winfonts']) if isosx: plugins.append('usbobserver') + plugins.append('cocoa') if isfreebsd or ishaiku or islinux or isosx: plugins.append('libusb') plugins.append('libmtp') diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 218714d498..5eda4391a3 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -894,6 +894,14 @@ class Application(QApplication): # Qt 5 bug: https://bugreports.qt-project.org/browse/QTBUG-41125 self.aboutToQuit.connect(self.flush_clipboard) + if isosx: + cocoa, err = plugins['cocoa'] + if err: + raise RuntimeError('Failed to load cocoa plugin with error: {}'.format(err)) + cft = cocoa.cursor_blink_time() + if cft >= 0: + self.setCursorFlashTime(int(cft)) + def setup_ui_font(self): f = QFont(QApplication.font()) q = (f.family(), f.pointSize()) diff --git a/src/calibre/utils/cocoa.m b/src/calibre/utils/cocoa.m new file mode 100644 index 0000000000..86ce000304 --- /dev/null +++ b/src/calibre/utils/cocoa.m @@ -0,0 +1,25 @@ +/* + * cocoa.m + * Copyright (C) 2019 Kovid Goyal <kovid at kovidgoyal.net> + * + * Distributed under terms of the GPL3 license. + */ + + +#include <Cocoa/Cocoa.h> + + +double +cocoa_cursor_blink_time(void) { + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + double on_period_ms = [defaults doubleForKey:@"NSTextInsertionPointBlinkPeriodOn"]; + double off_period_ms = [defaults doubleForKey:@"NSTextInsertionPointBlinkPeriodOff"]; + double period_ms = [defaults doubleForKey:@"NSTextInsertionPointBlinkPeriod"]; + double max_value = 60 * 1000.0, ans = -1.0; + if (on_period_ms || off_period_ms) { + ans = on_period_ms + off_period_ms; + } else if (period_ms) { + ans = period_ms; + } + return ans > max_value ? 0.0 : ans; +} diff --git a/src/calibre/utils/cocoa_wrapper.c b/src/calibre/utils/cocoa_wrapper.c new file mode 100644 index 0000000000..1d65c4ecb5 --- /dev/null +++ b/src/calibre/utils/cocoa_wrapper.c @@ -0,0 +1,53 @@ +/* + * cocoa_wrapper.c + * Copyright (C) 2019 Kovid Goyal <kovid at kovidgoyal.net> + * + * Distributed under terms of the GPL3 license. + */ + +#include <Python.h> + +extern double cocoa_cursor_blink_time(void); + +static PyObject* +cursor_blink_time(PyObject *self) { + (void)self; + double ans = cocoa_cursor_blink_time(); + return PyFloat_FromDouble(ans); +} + +static PyMethodDef module_methods[] = { + {"cursor_blink_time", (PyCFunction)cursor_blink_time, METH_NOARGS, ""}, + {NULL, NULL, 0, NULL} /* Sentinel */ +}; + + +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&bzzdec_module) +static struct PyModuleDef cocoa_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "cocoa", + /* m_doc */ "", + /* m_size */ -1, + /* m_methods */ module_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; +CALIBRE_MODINIT_FUNC PyInit_cocoa(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("cocoa", module_methods, "") +CALIBRE_MODINIT_FUNC initcocoa(void) { +#endif + + PyObject *m = INITMODULE; + if (m == NULL) { + INITERROR; + } +#if PY_MAJOR_VERSION >= 3 + return m; +#endif +} From fe291a59587906e78f0eac1ea9ad246f52692173 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Tue, 26 Feb 2019 07:11:25 +0530 Subject: [PATCH 0242/2613] ... --- src/calibre/web/feeds/news.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index 3277d957e0..dcdfc8a122 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -407,7 +407,7 @@ class BasicNewsRecipe(Recipe): :param url: The URL to be followed :param tag: The tag from which the URL was derived ''' - raise NotImplementedError + raise NotImplementedError() def get_extra_css(self): ''' From 7640a27b133dcf0071ad7cdfb885a7e816b9f776 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Tue, 26 Feb 2019 07:44:14 +0530 Subject: [PATCH 0243/2613] Update Taipei Times --- recipes/taipei.recipe | 67 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/recipes/taipei.recipe b/recipes/taipei.recipe index fd16f9212b..e2cdbb4cfe 100644 --- a/recipes/taipei.recipe +++ b/recipes/taipei.recipe @@ -1,6 +1,15 @@ +import re + from calibre.web.feeds.news import BasicNewsRecipe +def classes(classes): + q = frozenset(classes.split(' ')) + return dict( + attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)} + ) + + class TN(BasicNewsRecipe): title = u'Taipei Times' language = 'en_TW' @@ -10,20 +19,50 @@ class TN(BasicNewsRecipe): use_embedded_content = False no_stylesheets = True - auto_cleanup = True - auto_cleanup_keep = '//*[@class="main_ipic"]' + + keep_only_tags = [ + dict(name='h1'), + dict(name='h3', attrs={'class': 'a'}), + classes('main_ipic reporter text page'), + ] feeds = [ - ('Editorials', - 'http://www.taipeitimes.com/xml/editorials.rss'), - ('Taiwan', - 'http://www.taipeitimes.com/xml/taiwan.rss'), - ('Features', - 'http://www.taipeitimes.com/xml/feat.rss'), - ('Business', - 'http://www.taipeitimes.com/xml/biz.rss'), - ('World', - 'http://www.taipeitimes.com/xml/world.rss'), - ('Sports', - 'http://www.taipeitimes.com/xml/sport.rss'), + ('Editorials', 'http://www.taipeitimes.com/xml/editorials.rss'), + ('Taiwan', 'http://www.taipeitimes.com/xml/taiwan.rss'), + ('Features', 'http://www.taipeitimes.com/xml/feat.rss'), + ('Business', 'http://www.taipeitimes.com/xml/biz.rss'), + ('World', 'http://www.taipeitimes.com/xml/world.rss'), + ('Sports', 'http://www.taipeitimes.com/xml/sport.rss'), ] + + def preprocess_html(self, soup, *a): + for div in soup.findAll(**classes('page')): + for a in div.findAll('a', href=True): + a['data-calibre-follow-link'] = '1' + if a['href'].startswith('/'): + a['href'] = 'http://www.taipeitimes.com' + a['href'] + return soup + + recursions = 1 + + def is_link_wanted(self, url, tag): + digit = re.search(r'/(\d+)$', url) + if digit is not None and tag['data-calibre-follow-link'] == '1' and re.match(r'\d+', self.tag_to_string(tag)) is not None: + if int(digit.group(1)) > 1: + return True + return False + + def postprocess_html(self, soup, *a): + for div in soup.findAll(**classes('page')): + div.extract() + return soup + + # def parse_index(self): + # return [( + # 'Articles', [{ + # 'title': + # 'test', + # 'url': + # 'http://www.taipeitimes.com/News/editorials/archives/2019/02/26/2003710411' + # }] + # )] From acd683b3ac285f8d07fe94af43d526fb6afa7984 Mon Sep 17 00:00:00 2001 From: Eli Schwartz <eschwartz@archlinux.org> Date: Tue, 5 Feb 2019 00:17:43 -0500 Subject: [PATCH 0244/2613] remove incorrect use of b'' string There's no need to check on python2 that a string in os.environ is a bytestring, and it breaks hard on python3. --- src/calibre/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/constants.py b/src/calibre/constants.py index aefd0ea4ba..e44683c1ff 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -87,7 +87,7 @@ else: filesystem_encoding = 'utf-8' -DEBUG = b'CALIBRE_DEBUG' in os.environ +DEBUG = 'CALIBRE_DEBUG' in os.environ def debug(): From 2761fd5bd0df2e51f6fd4ea08d53f4cc71c3a39c Mon Sep 17 00:00:00 2001 From: Eli Schwartz <eschwartz@archlinux.org> Date: Mon, 25 Feb 2019 02:46:02 -0500 Subject: [PATCH 0245/2613] C extensions: fix use of self->ob_type everywhere Part of general preparations for the python3 port. --- src/calibre/devices/mtp/unix/libmtp.c | 42 +++++++++++----------- src/calibre/devices/mtp/windows/device.cpp | 11 +++--- src/calibre/utils/fonts/freetype.cpp | 17 +++++---- src/calibre/utils/podofo/doc.cpp | 2 +- src/calibre/utils/podofo/outline.cpp | 4 +-- 5 files changed, 36 insertions(+), 40 deletions(-) diff --git a/src/calibre/devices/mtp/unix/libmtp.c b/src/calibre/devices/mtp/unix/libmtp.c index 086211484c..8d8481d551 100644 --- a/src/calibre/devices/mtp/unix/libmtp.c +++ b/src/calibre/devices/mtp/unix/libmtp.c @@ -123,7 +123,7 @@ static uint16_t data_from_python(void *params, void *priv, uint32_t wantlen, uns static PyObject* build_file_metadata(LIBMTP_file_t *nf, uint32_t storage_id) { PyObject *ans = NULL; - ans = Py_BuildValue("{s:s, s:k, s:k, s:k, s:K, s:L, s:O}", + ans = Py_BuildValue("{s:s, s:k, s:k, s:k, s:K, s:L, s:O}", "name", nf->filename, "id", (unsigned long)nf->item_id, "parent_id", (unsigned long)nf->parent_id, @@ -184,7 +184,7 @@ Device_dealloc(Device* self) Py_XDECREF(self->serial_number); self->serial_number = NULL; Py_XDECREF(self->device_version); self->device_version = NULL; - self->ob_type->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } static int @@ -225,9 +225,9 @@ Device_init(Device *self, PyObject *args, PyObject *kwds) } if (rawdevs != NULL) free(rawdevs); - if (dev == NULL) { - if (tried_count == 0) PyErr_Format(MTPError, "No device with busnum=%lu and devnum=%u found", busnum, devnum); - else PyErr_Format(MTPError, "Unable to open MTP device with busnum=%lu and devnum=%u, tried %d such devices", busnum, devnum, tried_count); + if (dev == NULL) { + if (tried_count == 0) PyErr_Format(MTPError, "No device with busnum=%lu and devnum=%u found", busnum, devnum); + else PyErr_Format(MTPError, "Unable to open MTP device with busnum=%lu and devnum=%u, tried %d such devices", busnum, devnum, tried_count); return -1; } @@ -341,8 +341,8 @@ Device_storage_info(Device *self, void *closure) { // Check if read only storage if (storage->StorageType == ST_FixedROM || storage->StorageType == ST_RemovableROM || (storage->id & 0x0000FFFFU) == 0x00000000U || storage->AccessCapability == AC_ReadOnly || storage->AccessCapability == AC_ReadOnly_with_Object_Deletion) ro = 1; - loc = Py_BuildValue("{s:k,s:O,s:K,s:K,s:K,s:s,s:s,s:O}", - "id", (unsigned long)storage->id, + loc = Py_BuildValue("{s:k,s:O,s:K,s:K,s:K,s:s,s:s,s:O}", + "id", (unsigned long)storage->id, "removable", ((storage->StorageType == ST_RemovableRAM) ? Py_True : Py_False), "capacity", (unsigned long long)storage->MaxCapacity, "freespace_bytes", (unsigned long long)storage->FreeSpaceInBytes, @@ -352,7 +352,7 @@ Device_storage_info(Device *self, void *closure) { "rw", (ro) ? Py_False : Py_True ); - if (loc == NULL) return NULL; + if (loc == NULL) return NULL; if (PyList_Append(ans, loc) != 0) return NULL; Py_DECREF(loc); @@ -382,12 +382,12 @@ static int recursive_get_files(LIBMTP_mtpdevice_t *dev, uint32_t storage_id, uin recurse = (r != NULL && PyObject_IsTrue(r)) ? 1 : 0; Py_XDECREF(r); if (PyList_Append(ans, entry) != 0) { ok = 0; } - Py_DECREF(entry); + Py_DECREF(entry); } if (ok && recurse && f->filetype == LIBMTP_FILETYPE_FOLDER) { if (!recursive_get_files(dev, storage_id, f->item_id, ans, errs, callback, level+1)) { - ok = 0; + ok = 0; } } } @@ -409,7 +409,7 @@ Device_get_filesystem(Device *self, PyObject *args) { ENSURE_DEV(NULL); ENSURE_STORAGE(NULL); - if (!PyArg_ParseTuple(args, "kO", &storage_id, &callback)) return NULL; + if (!PyArg_ParseTuple(args, "kO", &storage_id, &callback)) return NULL; if (!PyCallable_Check(callback)) { PyErr_SetString(PyExc_TypeError, "callback is not a callable"); return NULL; } ans = PyList_New(0); errs = PyList_New(0); @@ -439,7 +439,7 @@ Device_get_file(Device *self, PyObject *args) { ENSURE_DEV(NULL); ENSURE_STORAGE(NULL); - if (!PyArg_ParseTuple(args, "kO|O", &fileid, &stream, &callback)) return NULL; + if (!PyArg_ParseTuple(args, "kO|O", &fileid, &stream, &callback)) return NULL; errs = PyList_New(0); if (errs == NULL) { PyErr_NoMemory(); return NULL; } if (callback == NULL || !PyCallable_Check(callback)) callback = NULL; @@ -451,7 +451,7 @@ Device_get_file(Device *self, PyObject *args) { PyEval_RestoreThread(cb.state); Py_XDECREF(callback); Py_DECREF(stream); - if (ret != 0) { + if (ret != 0) { dump_errorstack(self->device, errs); } Py_XDECREF(PyObject_CallMethod(stream, "flush", NULL)); @@ -472,7 +472,7 @@ Device_put_file(Device *self, PyObject *args) { ENSURE_DEV(NULL); ENSURE_STORAGE(NULL); - if (!PyArg_ParseTuple(args, "kksOK|O", &storage_id, &parent_id, &name, &stream, &filesize, &callback)) return NULL; + if (!PyArg_ParseTuple(args, "kksOK|O", &storage_id, &parent_id, &name, &stream, &filesize, &callback)) return NULL; errs = PyList_New(0); if (errs == NULL) { PyErr_NoMemory(); return NULL; } if (callback == NULL || !PyCallable_Check(callback)) callback = NULL; @@ -569,32 +569,32 @@ static PyMethodDef Device_methods[] = { }; static PyGetSetDef Device_getsetters[] = { - {(char *)"friendly_name", + {(char *)"friendly_name", (getter)Device_friendly_name, NULL, (char *)"The friendly name of this device, can be None.", NULL}, - {(char *)"manufacturer_name", + {(char *)"manufacturer_name", (getter)Device_manufacturer_name, NULL, (char *)"The manufacturer name of this device, can be None.", NULL}, - {(char *)"model_name", + {(char *)"model_name", (getter)Device_model_name, NULL, (char *)"The model name of this device, can be None.", NULL}, - {(char *)"serial_number", + {(char *)"serial_number", (getter)Device_serial_number, NULL, (char *)"The serial number of this device, can be None.", NULL}, - {(char *)"device_version", + {(char *)"device_version", (getter)Device_device_version, NULL, (char *)"The device version of this device, can be None.", NULL}, - {(char *)"ids", + {(char *)"ids", (getter)Device_ids, NULL, (char *)"The ids of the device (busnum, devnum, vendor_id, product_id, usb_serialnum)", NULL}, @@ -719,7 +719,7 @@ initlibmtp(void) { DeviceType.tp_new = PyType_GenericNew; if (PyType_Ready(&DeviceType) < 0) return; - + m = Py_InitModule3("libmtp", libmtp_methods, "Interface to libmtp."); if (m == NULL) return; diff --git a/src/calibre/devices/mtp/windows/device.cpp b/src/calibre/devices/mtp/windows/device.cpp index 88b57776ec..fa8606a8aa 100644 --- a/src/calibre/devices/mtp/windows/device.cpp +++ b/src/calibre/devices/mtp/windows/device.cpp @@ -21,10 +21,10 @@ dealloc(Device* self) if (self->bulk_properties != NULL) { self->bulk_properties->Release(); self->bulk_properties = NULL; } - if (self->device != NULL) { + if (self->device != NULL) { Py_BEGIN_ALLOW_THREADS; self->device->Close(); self->device->Release(); - self->device = NULL; + self->device = NULL; Py_END_ALLOW_THREADS; } @@ -32,7 +32,7 @@ dealloc(Device* self) Py_XDECREF(self->device_information); self->device_information = NULL; - self->ob_type->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } static int @@ -74,7 +74,7 @@ update_data(Device *self, PyObject *args) { Py_XDECREF(self->device_information); self->device_information = di; Py_RETURN_NONE; } // }}} - + // get_filesystem() {{{ static PyObject* py_get_filesystem(Device *self, PyObject *args) { @@ -194,7 +194,7 @@ Device_data(Device *self, void *closure) { static PyGetSetDef Device_getsetters[] = { - {(char *)"data", + {(char *)"data", (getter)Device_data, NULL, (char *)"The basic device information.", NULL}, @@ -244,4 +244,3 @@ PyTypeObject wpd::DeviceType = { // {{{ 0, /* tp_alloc */ 0, /* tp_new */ }; // }}} - diff --git a/src/calibre/utils/fonts/freetype.cpp b/src/calibre/utils/fonts/freetype.cpp index f9242f1fcf..e4251ea0e2 100644 --- a/src/calibre/utils/fonts/freetype.cpp +++ b/src/calibre/utils/fonts/freetype.cpp @@ -10,7 +10,7 @@ #define PY_SSIZE_T_CLEAN #include <Python.h> -#include <ft2build.h> +#include <ft2build.h> #include FT_FREETYPE_H static PyObject *FreeTypeError = NULL; @@ -47,7 +47,7 @@ Face_dealloc(Face* self) Py_XDECREF(self->data); self->data = NULL; - self->ob_type->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } static int @@ -84,12 +84,12 @@ Face_init(Face *self, PyObject *args, PyObject *kwds) static PyObject * family_name(Face *self, void *closure) { return Py_BuildValue("s", self->face->family_name); -} +} static PyObject * style_name(Face *self, void *closure) { return Py_BuildValue("s", self->face->style_name); -} +} static PyObject* supports_text(Face *self, PyObject *args) { @@ -124,12 +124,12 @@ glyph_id(Face *self, PyObject *args) { } static PyGetSetDef Face_getsetters[] = { - {(char *)"family_name", + {(char *)"family_name", (getter)family_name, NULL, (char *)"The family name of this font.", NULL}, - {(char *)"style_name", + {(char *)"style_name", (getter)style_name, NULL, (char *)"The style name of this font.", NULL}, @@ -160,7 +160,7 @@ dealloc(FreeType* self) } self->library = NULL; - self->ob_type->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } static int @@ -288,7 +288,7 @@ static PyTypeObject FreeTypeType = { // {{{ 0, /* tp_new */ }; // }}} -static +static PyMethodDef methods[] = { {NULL, NULL, 0, NULL} }; @@ -319,4 +319,3 @@ initfreetype(void) { PyModule_AddObject(m, "FreeType", (PyObject *)&FreeTypeType); PyModule_AddObject(m, "Face", (PyObject *)&FaceType); } - diff --git a/src/calibre/utils/podofo/doc.cpp b/src/calibre/utils/podofo/doc.cpp index 4a7a615bb2..6e73e729bd 100644 --- a/src/calibre/utils/podofo/doc.cpp +++ b/src/calibre/utils/podofo/doc.cpp @@ -14,7 +14,7 @@ static void PDFDoc_dealloc(PDFDoc* self) { if (self->doc != NULL) delete self->doc; - self->ob_type->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } static PyObject * diff --git a/src/calibre/utils/podofo/outline.cpp b/src/calibre/utils/podofo/outline.cpp index 40f5852204..b7be4aeae8 100644 --- a/src/calibre/utils/podofo/outline.cpp +++ b/src/calibre/utils/podofo/outline.cpp @@ -13,7 +13,7 @@ using namespace pdf; static void dealloc(PDFOutlineItem* self) { - self->ob_type->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } static PyObject * @@ -138,5 +138,3 @@ PyTypeObject pdf::PDFOutlineItemType = { }; // }}} - - From 3258c464e78919af6ef0f5a7f9ebbc335e5dc6ab Mon Sep 17 00:00:00 2001 From: Eli Schwartz <eschwartz@archlinux.org> Date: Thu, 21 Feb 2019 01:09:08 -0500 Subject: [PATCH 0246/2613] Port headless plugin to build on python2/python3 The only thing needed is to port the buildsystem to not pass strings starting with a "b" as build flags. --- setup/build_environment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/build_environment.py b/setup/build_environment.py index 64badfbed4..c30e74631c 100644 --- a/setup/build_environment.py +++ b/setup/build_environment.py @@ -111,8 +111,8 @@ def get_sip_dir(): pyqt['pyqt_sip_dir'] = get_sip_dir() pyqt['sip_inc_dir'] = os.environ.get('SIP_INC_DIR', sysconfig.get_path('include')) -glib_flags = subprocess.check_output([PKGCONFIG, '--libs', 'glib-2.0']).strip() if islinux or ishaiku else '' -fontconfig_flags = subprocess.check_output([PKGCONFIG, '--libs', 'fontconfig']).strip() if islinux or ishaiku else '' +glib_flags = subprocess.check_output([PKGCONFIG, '--libs', 'glib-2.0']).decode().strip() if islinux or ishaiku else '' +fontconfig_flags = subprocess.check_output([PKGCONFIG, '--libs', 'fontconfig']).decode().strip() if islinux or ishaiku else '' qt_inc = pyqt['inc'] qt_lib = pyqt['lib'] ft_lib_dirs = [] From 247e0b557bef931fd43b8fd5a2f504333b55751c Mon Sep 17 00:00:00 2001 From: Eli Schwartz <eschwartz@archlinux.org> Date: Mon, 25 Feb 2019 02:36:54 -0500 Subject: [PATCH 0247/2613] Port qt_hack plugin to build on python2/python3 --- src/calibre/ebooks/pdf/render/qt_hack.cpp | 9 ++++++++- src/calibre/ebooks/pdf/render/qt_hack.h | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/pdf/render/qt_hack.cpp b/src/calibre/ebooks/pdf/render/qt_hack.cpp index d3a2a7da72..81f54d7591 100644 --- a/src/calibre/ebooks/pdf/render/qt_hack.cpp +++ b/src/calibre/ebooks/pdf/render/qt_hack.cpp @@ -48,7 +48,11 @@ PyObject* get_glyphs(const QPointF &p, const QTextItem &text_item) { indices = PyTuple_New(glyphs.count()); if (indices == NULL) { Py_DECREF(points); return PyErr_NoMemory(); } for (int i = 0; i < glyphs.count(); i++) { +#if PY_MAJOR_VERSION >= 3 + temp = PyLong_FromLong((long)glyphs[i]); +#else temp = PyInt_FromLong((long)glyphs[i]); +#endif if (temp == NULL) { Py_DECREF(indices); Py_DECREF(points); return PyErr_NoMemory(); } PyTuple_SET_ITEM(indices, i, temp); temp = NULL; } @@ -74,10 +78,13 @@ PyObject* get_glyph_map(const QTextItem &text_item) { for (uint uc = 0; uc < 0x10000; ++uc) { QChar ch(uc); ti.fontEngine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly); +#if PY_MAJOR_VERSION >= 3 + t = PyLong_FromLong(glyphs.glyphs[0]); +#else t = PyInt_FromLong(glyphs.glyphs[0]); +#endif if (t == NULL) { Py_DECREF(ans); return PyErr_NoMemory(); } PyTuple_SET_ITEM(ans, uc, t); t = NULL; } return ans; } - diff --git a/src/calibre/ebooks/pdf/render/qt_hack.h b/src/calibre/ebooks/pdf/render/qt_hack.h index 43a638bfba..c7c06614fc 100644 --- a/src/calibre/ebooks/pdf/render/qt_hack.h +++ b/src/calibre/ebooks/pdf/render/qt_hack.h @@ -7,14 +7,14 @@ #pragma once +// Per python C-API docs, Python.h must always be the first header +#include <Python.h> #include <QGlyphRun> #include <QTextItem> #include <QPointF> -#include <Python.h> PyObject* get_glyphs(const QPointF &p, const QTextItem &text_item); PyObject* get_sfnt_table(const QTextItem &text_item, const char* tag_name); PyObject* get_glyph_map(const QTextItem &text_item); - From a629e3bf1ac99115f99c93f24730c6d736261d2f Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Tue, 26 Feb 2019 15:12:07 +0530 Subject: [PATCH 0248/2613] ... --- recipes/taipei.recipe | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/taipei.recipe b/recipes/taipei.recipe index e2cdbb4cfe..a753bf526f 100644 --- a/recipes/taipei.recipe +++ b/recipes/taipei.recipe @@ -27,6 +27,7 @@ class TN(BasicNewsRecipe): ] feeds = [ + ('Front Page', 'http://www.taipeitimes.com/xml/front.rss'), ('Editorials', 'http://www.taipeitimes.com/xml/editorials.rss'), ('Taiwan', 'http://www.taipeitimes.com/xml/taiwan.rss'), ('Features', 'http://www.taipeitimes.com/xml/feat.rss'), From acf92b50665e0303051afea12b02a18ee4026280 Mon Sep 17 00:00:00 2001 From: Eli Schwartz <eschwartz@archlinux.org> Date: Tue, 26 Feb 2019 18:05:43 -0500 Subject: [PATCH 0249/2613] Port sqlite_custom plugin to build on python2/python3 --- src/calibre/library/sqlite_custom.c | 44 ++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/src/calibre/library/sqlite_custom.c b/src/calibre/library/sqlite_custom.c index 7af0c51995..6a20ef1128 100644 --- a/src/calibre/library/sqlite_custom.c +++ b/src/calibre/library/sqlite_custom.c @@ -52,7 +52,7 @@ static void sort_concat_step(sqlite3_context *context, int argc, sqlite3_value * list->vals[list->count] = (SortConcatItem*)calloc(1, sizeof(SortConcatItem)); if (list->vals[list->count] == NULL) return; - + idx = sqlite3_value_int(argv[0]); val = sqlite3_value_text(argv[1]); sz = sqlite3_value_bytes(argv[1]); @@ -61,7 +61,7 @@ static void sort_concat_step(sqlite3_context *context, int argc, sqlite3_value * list->vals[list->count]->val = (unsigned char*)calloc(sz, sizeof(unsigned char)); - if (list->vals[list->count]->val == NULL) + if (list->vals[list->count]->val == NULL) {free(list->vals[list->count]); return;} list->vals[list->count]->index = idx; list->vals[list->count]->length = sz; @@ -88,7 +88,7 @@ static unsigned char* sort_concat_do_finalize(SortConcatList *list, const unsign unsigned char *ans, *pos; unsigned int sz = 0, i; - for (i = 0; i < list->count; i++) { + for (i = 0; i < list->count; i++) { sz += list->vals[i]->length; } sz += list->count; @@ -221,7 +221,7 @@ static void identifiers_concat_finalize(sqlite3_context *context) { list = (IdentifiersConcatList*) sqlite3_aggregate_context(context, sizeof(*list)); if (list == NULL || list->vals == NULL || list->count < 1) return; - for (i = 0; i < list->count; i++) { + for (i = 0; i < list->count; i++) { sz += list->vals[i]->length; } sz += list->count; // Space for commas @@ -263,6 +263,8 @@ sqlite_custom_init_funcs(PyObject *self, PyObject *args) { Py_RETURN_NONE; } +static char sqlite_custom_doc[] = "Implementation of custom sqlite methods in C for speed."; + static PyMethodDef sqlite_custom_methods[] = { {"init_funcs", sqlite_custom_init_funcs, METH_VARARGS, "init_funcs()\n\nInitialize module." @@ -271,11 +273,33 @@ static PyMethodDef sqlite_custom_methods[] = { {NULL, NULL, 0, NULL} }; -CALIBRE_MODINIT_FUNC -initsqlite_custom(void) { +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&sqlite_custom_module) +static struct PyModuleDef sqlite_custom_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "sqlite_custom", + /* m_doc */ sqlite_custom_doc, + /* m_size */ -1, + /* m_methods */ sqlite_custom_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; +CALIBRE_MODINIT_FUNC PyInit_sqlite_custom(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("sqlite_custom", sqlite_custom_methods, sqlite_custom_doc) +CALIBRE_MODINIT_FUNC initsqlite_custom(void) { +#endif + PyObject *m; - m = Py_InitModule3("sqlite_custom", sqlite_custom_methods, - "Implementation of custom sqlite methods in C for speed." - ); - if (m == NULL) return; + m = INITMODULE; + if (m == NULL) { + INITERROR; + } +#if PY_MAJOR_VERSION >= 3 + return m; +#endif } From ba87a97308dab65d6b761b851c8eaa488604dc39 Mon Sep 17 00:00:00 2001 From: Eli Schwartz <eschwartz@archlinux.org> Date: Tue, 26 Feb 2019 19:52:15 -0500 Subject: [PATCH 0250/2613] Port freetype plugin to build on python2/python3 --- src/calibre/utils/fonts/freetype.cpp | 212 +++++++++++++++------------ 1 file changed, 120 insertions(+), 92 deletions(-) diff --git a/src/calibre/utils/fonts/freetype.cpp b/src/calibre/utils/fonts/freetype.cpp index e4251ea0e2..11c7bcf839 100644 --- a/src/calibre/utils/fonts/freetype.cpp +++ b/src/calibre/utils/fonts/freetype.cpp @@ -58,7 +58,11 @@ Face_init(Face *self, PyObject *args, PyObject *kwds) Py_ssize_t sz; PyObject *ft; +#if PY_MAJOR_VERSION >= 3 + if (!PyArg_ParseTuple(args, "Oy#", &ft, &data, &sz)) return -1; +#else if (!PyArg_ParseTuple(args, "Os#", &ft, &data, &sz)) return -1; +#endif Py_BEGIN_ALLOW_THREADS; error = FT_New_Memory_Face( ( (FreeType*)ft )->library, @@ -181,45 +185,44 @@ init(FreeType *self, PyObject *args, PyObject *kwds) // }}} static PyTypeObject FaceType = { // {{{ - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "freetype.Face", /*tp_name*/ - sizeof(Face), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)Face_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - "Face", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - Face_methods, /* tp_methods */ - 0, /* tp_members */ - Face_getsetters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Face_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "freetype.Face", + /* tp_basicsize */ sizeof(Face), + /* tp_itemsize */ 0, + /* tp_dealloc */ (destructor)Face_dealloc, + /* tp_print */ 0, + /* tp_getattr */ 0, + /* tp_setattr */ 0, + /* tp_compare */ 0, + /* tp_repr */ 0, + /* tp_as_number */ 0, + /* tp_as_sequence */ 0, + /* tp_as_mapping */ 0, + /* tp_hash */ 0, + /* tp_call */ 0, + /* tp_str */ 0, + /* tp_getattro */ 0, + /* tp_setattro */ 0, + /* tp_as_buffer */ 0, + /* tp_flags */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, + /* tp_doc */ "Face", + /* tp_traverse */ 0, + /* tp_clear */ 0, + /* tp_richcompare */ 0, + /* tp_weaklistoffset */ 0, + /* tp_iter */ 0, + /* tp_iternext */ 0, + /* tp_methods */ Face_methods, + /* tp_members */ 0, + /* tp_getset */ Face_getsetters, + /* tp_base */ 0, + /* tp_dict */ 0, + /* tp_descr_get */ 0, + /* tp_descr_set */ 0, + /* tp_dictoffset */ 0, + /* tp_init */ (initproc)Face_init, + /* tp_alloc */ 0, + /* tp_new */ 0, }; // }}} static PyObject* @@ -247,75 +250,100 @@ static PyMethodDef FreeType_methods[] = { static PyTypeObject FreeTypeType = { // {{{ - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "freetype.FreeType", /*tp_name*/ - sizeof(FreeType), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - "FreeType", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - FreeType_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "freetype.FreeType", + /* tp_basicsize */ sizeof(FreeType), + /* tp_itemsize */ 0, + /* tp_dealloc */ (destructor)dealloc, + /* tp_print */ 0, + /* tp_getattr */ 0, + /* tp_setattr */ 0, + /* tp_compare */ 0, + /* tp_repr */ 0, + /* tp_as_number */ 0, + /* tp_as_sequence */ 0, + /* tp_as_mapping */ 0, + /* tp_hash */ 0, + /* tp_call */ 0, + /* tp_str */ 0, + /* tp_getattro */ 0, + /* tp_setattro */ 0, + /* tp_as_buffer */ 0, + /* tp_flags */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, + /* tp_doc */ "FreeType", + /* tp_traverse */ 0, + /* tp_clear */ 0, + /* tp_richcompare */ 0, + /* tp_weaklistoffset */ 0, + /* tp_iter */ 0, + /* tp_iternext */ 0, + /* tp_methods */ FreeType_methods, + /* tp_members */ 0, + /* tp_getset */ 0, + /* tp_base */ 0, + /* tp_dict */ 0, + /* tp_descr_get */ 0, + /* tp_descr_set */ 0, + /* tp_dictoffset */ 0, + /* tp_init */ (initproc)init, + /* tp_alloc */ 0, + /* tp_new */ 0, }; // }}} -static -PyMethodDef methods[] = { +static char freetype_doc[] = "Interface to freetype"; + +static PyMethodDef freetype_methods[] = { {NULL, NULL, 0, NULL} }; -CALIBRE_MODINIT_FUNC -initfreetype(void) { +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&freetype_module) +static struct PyModuleDef freetype_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "freetype", + /* m_doc */ freetype_doc, + /* m_size */ -1, + /* m_methods */ freetype_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; +CALIBRE_MODINIT_FUNC PyInit_freetype(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("freetype", freetype_methods, freetype_doc) +CALIBRE_MODINIT_FUNC initfreetype(void) { +#endif + PyObject *m; FreeTypeType.tp_new = PyType_GenericNew; - if (PyType_Ready(&FreeTypeType) < 0) - return; + if (PyType_Ready(&FreeTypeType) < 0) { + INITERROR; + } FaceType.tp_new = PyType_GenericNew; - if (PyType_Ready(&FaceType) < 0) - return; + if (PyType_Ready(&FaceType) < 0) { + INITERROR; + } - m = Py_InitModule3( - "freetype", methods, - "FreeType API" - ); - if (m == NULL) return; + m = INITMODULE; + if (m == NULL) { + INITERROR; + } FreeTypeError = PyErr_NewException((char*)"freetype.FreeTypeError", NULL, NULL); - if (FreeTypeError == NULL) return; + if (FreeTypeError == NULL) { + INITERROR; + } PyModule_AddObject(m, "FreeTypeError", FreeTypeError); Py_INCREF(&FreeTypeType); PyModule_AddObject(m, "FreeType", (PyObject *)&FreeTypeType); PyModule_AddObject(m, "Face", (PyObject *)&FaceType); + #if PY_MAJOR_VERSION >= 3 + return m; +#endif } From 7a99290a14aa77231f29252dda5e6962de1b6e8c Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Wed, 27 Feb 2019 08:35:49 +0530 Subject: [PATCH 0251/2613] Port msdes to python 3 Fixes #937 (Port msdes plugin to build on python2/python3 ) --- src/calibre/utils/msdes/msdesmodule.c | 60 ++++++++++++++++++++------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/src/calibre/utils/msdes/msdesmodule.c b/src/calibre/utils/msdes/msdesmodule.c index 66844fa510..8fa98d10e1 100644 --- a/src/calibre/utils/msdes/msdesmodule.c +++ b/src/calibre/utils/msdes/msdesmodule.c @@ -9,8 +9,7 @@ #include <d3des.h> -static char msdes_doc[] = -"Provide LIT-specific DES en/decryption."; +static const char msdes_doc[] = "Provide LIT-specific DES en/decryption."; static PyObject *MsDesError = NULL; @@ -21,7 +20,11 @@ msdes_deskey(PyObject *self, PyObject *args) unsigned int len = 0; short int edf = 0; +#if PY_MAJOR_VERSION >= 3 + if (!PyArg_ParseTuple(args, "y#h", &key, &len, &edf)) { +#else if (!PyArg_ParseTuple(args, "s#h", &key, &len, &edf)) { +#endif return NULL; } @@ -33,10 +36,10 @@ msdes_deskey(PyObject *self, PyObject *args) if ((edf != EN0) && (edf != DE1)) { PyErr_SetString(MsDesError, "En/decryption direction invalid"); return NULL; - } + } deskey(key, edf); - + Py_RETURN_NONE; } @@ -49,7 +52,11 @@ msdes_des(PyObject *self, PyObject *args) unsigned int off = 0; PyObject *retval = NULL; +#if PY_MAJOR_VERSION >= 3 + if (!PyArg_ParseTuple(args, "y#", &inbuf, &len)) { +#else if (!PyArg_ParseTuple(args, "s#", &inbuf, &len)) { +#endif return NULL; } @@ -59,16 +66,16 @@ msdes_des(PyObject *self, PyObject *args) return NULL; } - retval = PyString_FromStringAndSize(NULL, len); + retval = PyBytes_FromStringAndSize(NULL, len); if (retval == NULL) { return NULL; } - outbuf = (unsigned char *)PyString_AS_STRING(retval); + outbuf = (unsigned char *)PyBytes_AS_STRING(retval); for (off = 0; off < len; off += 8) { des((inbuf + off), (outbuf + off)); } - + return retval; } @@ -78,21 +85,44 @@ static PyMethodDef msdes_methods[] = { { NULL, NULL } }; -CALIBRE_MODINIT_FUNC -initmsdes(void) -{ +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&msdes_module) +static struct PyModuleDef msdes_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "msdes", + /* m_doc */ msdes_doc, + /* m_size */ -1, + /* m_methods */ msdes_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; +CALIBRE_MODINIT_FUNC PyInit_msdes(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("msdes", msdes_methods, msdes_doc) +CALIBRE_MODINIT_FUNC initmsdes(void) { +#endif + PyObject *m; - m = Py_InitModule3("msdes", msdes_methods, msdes_doc); + m = INITMODULE; if (m == NULL) { - return; + INITERROR; } - + MsDesError = PyErr_NewException("msdes.MsDesError", NULL, NULL); Py_INCREF(MsDesError); PyModule_AddObject(m, "MsDesError", MsDesError); +#if PY_MAJOR_VERSION >= 3 + PyModule_AddObject(m, "EN0", PyLong_FromLong(EN0)); + PyModule_AddObject(m, "DE1", PyLong_FromLong(DE1)); + + return m; +#else PyModule_AddObject(m, "EN0", PyInt_FromLong(EN0)); PyModule_AddObject(m, "DE1", PyInt_FromLong(DE1)); - - return; +#endif } From 7a6fbdac2c8f72071ea5b41785efebe7a6c5a090 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Wed, 27 Feb 2019 08:40:54 +0530 Subject: [PATCH 0252/2613] Remove trailing spaces --- src/calibre/devices/libusb/libusb.c | 4 +- .../mtp/windows/content_enumeration.cpp | 48 +- .../mtp/windows/device_enumeration.cpp | 18 +- src/calibre/devices/mtp/windows/utils.cpp | 6 +- src/calibre/devices/mtp/windows/wpd.cpp | 8 +- src/calibre/devices/usbobserver/usbobserver.c | 30 +- src/calibre/ebooks/compression/palmdoc.c | 14 +- src/calibre/gui2/pictureflow/pictureflow.cpp | 328 +- .../progress_indicator/QProgressIndicator.cpp | 30 +- .../gui2/tweak_book/editor/syntax/html.c | 24 +- src/calibre/headless/headless_integration.cpp | 6 +- src/calibre/utils/certgen.c | 10 +- src/calibre/utils/fonts/winfonts.cpp | 4 +- src/calibre/utils/imageops/imageops.cpp | 12 +- src/calibre/utils/imageops/quantize.cpp | 22 +- src/calibre/utils/lzx/lzc.c | 22 +- src/calibre/utils/lzx/lzxc.c | 122 +- src/calibre/utils/lzx/lzxd.c | 10 +- src/calibre/utils/matcher.c | 20 +- src/calibre/utils/monotonic.c | 6 +- src/calibre/utils/msdes/des.c | 134 +- src/calibre/utils/podofo/output.cpp | 8 +- src/calibre/utils/podofo/podofo.cpp | 2 +- src/calibre/utils/podofo/test.cpp | 2 +- src/calibre/utils/podofo/utils.cpp | 1 - src/calibre/utils/spell/hunspell_wrapper.cpp | 2 +- src/calibre/utils/zlib2.c | 12 +- src/lzma/LzFind.c | 2088 ++++---- src/lzma/Lzma2Dec.c | 756 +-- src/lzma/Lzma2Enc.c | 1040 ++-- src/lzma/LzmaDec.c | 2200 ++++---- src/lzma/LzmaEnc.c | 4702 ++++++++--------- src/lzma/lzma_binding.c | 10 +- 33 files changed, 5850 insertions(+), 5851 deletions(-) diff --git a/src/calibre/devices/libusb/libusb.c b/src/calibre/devices/libusb/libusb.c index db52d5e46f..a4611367b2 100644 --- a/src/calibre/devices/libusb/libusb.c +++ b/src/calibre/devices/libusb/libusb.c @@ -93,7 +93,7 @@ static PyObject* get_devices(PyObject *self, PyObject *args) { if (t == NULL) { t = read_string_data(dev, desc.iManufacturer, desc.iProduct, desc.iSerialNumber); if (t == NULL) { Py_DECREF(d); break; } - PyDict_SetItem(cache, d, t); + PyDict_SetItem(cache, d, t); Py_DECREF(t); } @@ -129,7 +129,7 @@ initlibusb(void) { // We deliberately use the default context. This is the context used by // libmtp and we want to ensure that the busnum/devnum numbers are the same - // here and for libmtp. + // here and for libmtp. if(libusb_init(NULL) != 0) return; Error = PyErr_NewException("libusb.Error", NULL, NULL); diff --git a/src/calibre/devices/mtp/windows/content_enumeration.cpp b/src/calibre/devices/mtp/windows/content_enumeration.cpp index e642d38131..67fe2b7914 100644 --- a/src/calibre/devices/mtp/windows/content_enumeration.cpp +++ b/src/calibre/devices/mtp/windows/content_enumeration.cpp @@ -62,7 +62,7 @@ static void set_bool_property(PyObject *dict, REFPROPERTYKEY key, const char *py HRESULT hr; hr = properties->GetBoolValue(key, &ok); - if (SUCCEEDED(hr)) + if (SUCCEEDED(hr)) PyDict_SetItemString(dict, pykey, (ok)?Py_True:Py_False); } @@ -147,7 +147,7 @@ public: HRESULT __stdcall OnEnd(REFGUID Context, HRESULT hrStatus) { SetEvent(this->complete); return S_OK; } - ULONG __stdcall AddRef() { InterlockedIncrement((long*) &self_ref); return self_ref; } + ULONG __stdcall AddRef() { InterlockedIncrement((long*) &self_ref); return self_ref; } ULONG __stdcall Release() { ULONG refcnt = self_ref - 1; @@ -169,8 +169,8 @@ public: } return hr; } - - HRESULT __stdcall OnProgress(REFGUID Context, IPortableDeviceValuesCollection* values) { + + HRESULT __stdcall OnProgress(REFGUID Context, IPortableDeviceValuesCollection* values) { DWORD num = 0, i; wchar_t *property = NULL; IPortableDeviceValues *properties = NULL; @@ -194,7 +194,7 @@ public: if (obj == NULL) continue; PyDict_SetItem(this->items, temp, obj); Py_DECREF(obj); // We want a borrowed reference to obj - } + } Py_DECREF(temp); set_properties(obj, properties); @@ -263,7 +263,7 @@ static bool bulk_get_filesystem(unsigned int level, IPortableDevice *device, IPo if (!ok) { bulk_properties->Cancel(guid_context); pump_waiting_messages(); - } + } end: if (ev != NULL) CloseHandle(ev); if (properties != NULL) properties->Release(); @@ -306,7 +306,7 @@ static bool find_objects_in(IPortableDeviceContent *content, IPortableDeviceProp if (SUCCEEDED(hr)) { for(i = 0; i < fetched; i++) { pv.pwszVal = child_ids[i]; - hr2 = object_ids->Add(&pv); + hr2 = object_ids->Add(&pv); pv.pwszVal = NULL; if (FAILED(hr2)) { hresult_set_exc("Failed to add child ids to propvariantcollection", hr2); break; } } @@ -332,11 +332,11 @@ static PyObject* get_object_properties(IPortableDeviceProperties *devprops, IPor hr = devprops->GetValues(object_id, properties, &values); Py_END_ALLOW_THREADS; if (FAILED(hr)) { hresult_set_exc("Failed to get properties for object", hr); goto end; } - + ans = Py_BuildValue("{s:N}", "id", wchar_to_unicode(object_id)); if (ans == NULL) goto end; set_properties(ans, values); - + end: Py_XDECREF(temp); if (values != NULL) values->Release(); @@ -377,7 +377,7 @@ static bool single_get_filesystem(unsigned int level, IPortableDeviceContent *co ok = true; } } else hresult_set_exc("Failed to get item from IPortableDevicePropVariantCollection", hr); - + PropVariantClear(&pv); if (!ok) break; if (recurse != NULL) { @@ -391,7 +391,7 @@ end: if (properties != NULL) properties->Release(); return ok; -} +} // }}} static IPortableDeviceValues* create_object_properties(const wchar_t *parent_id, const wchar_t *name, const GUID content_type, unsigned PY_LONG_LONG size) { // {{{ @@ -452,7 +452,7 @@ static bool get_files_and_folders(unsigned int level, IPortableDevice *device, I else ok = single_get_filesystem(level, content, object_ids, callback, ans, subfolders); if (!ok) goto end; - for (Py_ssize_t i = 0; i < PyList_GET_SIZE(subfolders); i++) { + for (Py_ssize_t i = 0; i < PyList_GET_SIZE(subfolders); i++) { const wchar_t *child_id = unicode_to_wchar(PyList_GET_ITEM(subfolders, i)); if (child_id == NULL) { ok = false; break; } ok = get_files_and_folders(level+1, device, content, bulk_properties, child_id, callback, ans); @@ -471,7 +471,7 @@ PyObject* wpd::get_filesystem(IPortableDevice *device, const wchar_t *storage_id ans = PyDict_New(); if (ans == NULL) return PyErr_NoMemory(); - + Py_BEGIN_ALLOW_THREADS; hr = device->Content(&content); Py_END_ALLOW_THREADS; @@ -534,11 +534,11 @@ PyObject* wpd::get_file(IPortableDevice *device, const wchar_t *object_id, PyObj Py_BEGIN_ALLOW_THREADS; hr = resources->GetStream(object_id, WPD_RESOURCE_DEFAULT, STGM_READ, &bufsize, &stream); Py_END_ALLOW_THREADS; - if (FAILED(hr)) { + if (FAILED(hr)) { if (HRESULT_FROM_WIN32(ERROR_BUSY) == hr) { PyErr_SetString(WPDFileBusy, "Object is in use"); - } else hresult_set_exc("Failed to create stream interface to read from object", hr); - goto end; + } else hresult_set_exc("Failed to create stream interface to read from object", hr); + goto end; } buf = (char *)calloc(bufsize+10, 1); @@ -550,8 +550,8 @@ PyObject* wpd::get_file(IPortableDevice *device, const wchar_t *object_id, PyObj hr = stream->Read(buf, bufsize, &bytes_read); Py_END_ALLOW_THREADS; total_read = total_read + bytes_read; - if (hr == STG_E_ACCESSDENIED) { - PyErr_SetString(PyExc_IOError, "Read access is denied to this object"); break; + if (hr == STG_E_ACCESSDENIED) { + PyErr_SetString(PyExc_IOError, "Read access is denied to this object"); break; } else if (SUCCEEDED(hr)) { if (bytes_read > 0) { res = PyObject_CallMethod(dest, "write", "s#", buf, bytes_read); @@ -561,8 +561,8 @@ PyObject* wpd::get_file(IPortableDevice *device, const wchar_t *object_id, PyObj } } else { hresult_set_exc("Failed to read file from device", hr); break; } - if (bytes_read == 0) { - ok = TRUE; + if (bytes_read == 0) { + ok = TRUE; Py_XDECREF(PyObject_CallMethod(dest, "flush", NULL)); break; } @@ -640,7 +640,7 @@ PyObject* wpd::delete_object(IPortableDevice *device, const wchar_t *object_id) Py_END_ALLOW_THREADS; if (FAILED(hr)) { hresult_set_exc("Failed to create propvariantcollection", hr); goto end; } pv.pwszVal = (wchar_t*)object_id; - hr = object_ids->Add(&pv); + hr = object_ids->Add(&pv); pv.pwszVal = NULL; if (FAILED(hr)) { hresult_set_exc("Failed to add device id to propvariantcollection", hr); goto end; } @@ -697,11 +697,11 @@ PyObject* wpd::put_file(IPortableDevice *device, const wchar_t *parent_id, const Py_BEGIN_ALLOW_THREADS; hr = content->CreateObjectWithPropertiesAndData(values, &temp, &bufsize, NULL); Py_END_ALLOW_THREADS; - if (FAILED(hr)) { + if (FAILED(hr)) { if (HRESULT_FROM_WIN32(ERROR_BUSY) == hr) { PyErr_SetString(WPDFileBusy, "Object is in use"); - } else hresult_set_exc("Failed to create stream interface to write to object", hr); - goto end; + } else hresult_set_exc("Failed to create stream interface to write to object", hr); + goto end; } hr = temp->QueryInterface(IID_PPV_ARGS(&dest)); diff --git a/src/calibre/devices/mtp/windows/device_enumeration.cpp b/src/calibre/devices/mtp/windows/device_enumeration.cpp index 9fa91d9d07..c06c33d403 100644 --- a/src/calibre/devices/mtp/windows/device_enumeration.cpp +++ b/src/calibre/devices/mtp/windows/device_enumeration.cpp @@ -151,7 +151,7 @@ PyObject* get_storage_info(IPortableDevice *device) { // {{{ if (SUCCEEDED(values->GetUnsignedIntegerValue(WPD_STORAGE_ACCESS_CAPABILITY, &access)) && access == WPD_STORAGE_ACCESS_CAPABILITY_READWRITE) desc = Py_True; soid = PyUnicode_FromWideChar(object_ids[i], wcslen(object_ids[i])); if (soid == NULL) { PyErr_NoMemory(); goto end; } - so = Py_BuildValue("{s:K, s:K, s:K, s:K, s:O, s:N}", + so = Py_BuildValue("{s:K, s:K, s:K, s:K, s:O, s:N}", "capacity", capacity, "capacity_objects", capacity_objects, "free_space", free_space, "free_objects", free_objects, "rw", desc, "id", soid); if (so == NULL) { PyErr_NoMemory(); goto end; } if (SUCCEEDED(values->GetStringValue(WPD_STORAGE_DESCRIPTION, &storage_desc))) { @@ -192,7 +192,7 @@ PyObject* get_storage_info(IPortableDevice *device) { // {{{ Py_DECREF(so); } } - } + } for (i = 0; i < fetched; i ++) { CoTaskMemFree(object_ids[i]); object_ids[i] = NULL;} }// if(SUCCEEDED(hr)) } @@ -240,12 +240,12 @@ PyObject* get_device_information(IPortableDevice *device, IPortableDevicePropert hr = keys->Add(WPD_DEVICE_TYPE); Py_END_ALLOW_THREADS; if (FAILED(hr)) {hresult_set_exc("Failed to add keys to IPortableDeviceKeyCollection", hr); goto end;} - + Py_BEGIN_ALLOW_THREADS; hr = device->Content(&content); Py_END_ALLOW_THREADS; if (FAILED(hr)) {hresult_set_exc("Failed to get IPortableDeviceContent", hr); goto end; } - + Py_BEGIN_ALLOW_THREADS; hr = content->Properties(&properties); Py_END_ALLOW_THREADS; @@ -287,7 +287,7 @@ PyObject* get_device_information(IPortableDevice *device, IPortableDevicePropert if (SUCCEEDED(values->GetUnsignedIntegerValue(WPD_DEVICE_TYPE, &ti))) { switch (ti) { - case WPD_DEVICE_TYPE_CAMERA: + case WPD_DEVICE_TYPE_CAMERA: type = "camera"; break; case WPD_DEVICE_TYPE_MEDIA_PLAYER: type = "media player"; break; @@ -357,16 +357,16 @@ PyObject* get_device_information(IPortableDevice *device, IPortableDevicePropert if (storage == NULL) { PyObject *exc_type, *exc_value, *exc_tb; PyErr_Fetch(&exc_type, &exc_value, &exc_tb); - if (exc_type != NULL && exc_value != NULL) { + if (exc_type != NULL && exc_value != NULL) { PyErr_NormalizeException(&exc_type, &exc_value, &exc_tb); - PyDict_SetItemString(ans, "storage_error", exc_value); - Py_DECREF(exc_value); exc_value = NULL; + PyDict_SetItemString(ans, "storage_error", exc_value); + Py_DECREF(exc_value); exc_value = NULL; } Py_XDECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_tb); goto end; } PyDict_SetItemString(ans, "storage", storage); - + } Py_BEGIN_ALLOW_THREADS; diff --git a/src/calibre/devices/mtp/windows/utils.cpp b/src/calibre/devices/mtp/windows/utils.cpp index 7592e0d4a9..32e6ac20cf 100644 --- a/src/calibre/devices/mtp/windows/utils.cpp +++ b/src/calibre/devices/mtp/windows/utils.cpp @@ -9,7 +9,7 @@ using namespace wpd; -PyObject *wpd::hresult_set_exc(const char *msg, HRESULT hr) { +PyObject *wpd::hresult_set_exc(const char *msg, HRESULT hr) { PyObject *o = NULL, *mess; LPWSTR desc = NULL; @@ -55,7 +55,7 @@ int wpd::pump_waiting_messages() { UINT firstMsg = 0, lastMsg = 0; MSG msg; int result = 0; - // Read all of the messages in this next loop, + // Read all of the messages in this next loop, // removing each message as we read it. while (PeekMessage(&msg, NULL, firstMsg, lastMsg, PM_REMOVE)) { // If it's a quit message, we're out of here. @@ -64,7 +64,7 @@ int wpd::pump_waiting_messages() { break; } // Otherwise, dispatch the message. - DispatchMessage(&msg); + DispatchMessage(&msg); } // End of PeekMessage while loop return result; diff --git a/src/calibre/devices/mtp/windows/wpd.cpp b/src/calibre/devices/mtp/windows/wpd.cpp index 6901d5472e..57b5a99f20 100644 --- a/src/calibre/devices/mtp/windows/wpd.cpp +++ b/src/calibre/devices/mtp/windows/wpd.cpp @@ -49,8 +49,8 @@ wpd_init(PyObject *self, PyObject *args) { if (FAILED(hr)) { portable_device_manager = NULL; - PyErr_SetString((hr == REGDB_E_CLASSNOTREG) ? NoWPD : WPDError, (hr == REGDB_E_CLASSNOTREG) ? - "This computer is not running the Windows Portable Device framework. You may need to install Windows Media Player 11 or newer." : + PyErr_SetString((hr == REGDB_E_CLASSNOTREG) ? NoWPD : WPDError, (hr == REGDB_E_CLASSNOTREG) ? + "This computer is not running the Windows Portable Device framework. You may need to install Windows Media Player 11 or newer." : "Failed to create the WPD device manager interface"); return NULL; } @@ -116,7 +116,7 @@ wpd_enumerate_devices(PyObject *self, PyObject *args) { PyTuple_SET_ITEM(ans, i, temp); } } - } else { + } else { hresult_set_exc("Failed to get list of portable devices", hr); } @@ -189,7 +189,7 @@ initwpd(void) { wpd::DeviceType.tp_new = PyType_GenericNew; if (PyType_Ready(&wpd::DeviceType) < 0) return; - + m = Py_InitModule3("wpd", wpd_methods, "Interface to the WPD windows service."); if (m == NULL) return; diff --git a/src/calibre/devices/usbobserver/usbobserver.c b/src/calibre/devices/usbobserver/usbobserver.c index f1f767d291..791559f637 100644 --- a/src/calibre/devices/usbobserver/usbobserver.c +++ b/src/calibre/devices/usbobserver/usbobserver.c @@ -12,7 +12,7 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * + * * Python extension to scan the system for USB devices on OS X machines. * To use * >>> import usbobserver @@ -98,7 +98,7 @@ usbobserver_get_iokit_number_property(io_service_t dev, CFStringRef prop) { if (PropRef) { CFNumberGetValue((CFNumberRef)PropRef, kCFNumberLongType, &val); CFRelease(PropRef); - } + } return PyLong_FromLong(val); } @@ -106,7 +106,7 @@ usbobserver_get_iokit_number_property(io_service_t dev, CFStringRef prop) { static PyObject * usbobserver_get_usb_devices(PyObject *self, PyObject *args) { - + CFMutableDictionaryRef matchingDict; kern_return_t kr; PyObject *devices, *device; @@ -164,7 +164,7 @@ usbobserver_get_usb_devices(PyObject *self, PyObject *args) { NUKE(vendor); NUKE(product); NUKE(bcd); NUKE(manufacturer); NUKE(productn); NUKE(serial); } - + if (iter) IOObjectRelease(iter); return devices; @@ -184,14 +184,14 @@ usbobserver_get_bsd_path(io_object_t dev) { if (!CFStringGetCString(PropRef, cpath + dev_path_length, - MAXPATHLEN - dev_path_length, + MAXPATHLEN - dev_path_length, kCFStringEncodingUTF8)) return NULL; return PyUnicode_DecodeUTF8(cpath, strlen(cpath), "replace"); } -static PyObject* +static PyObject* usbobserver_find_prop(io_registry_entry_t e, CFStringRef key, int is_string ) { char buf[500]; long val = 0; @@ -212,7 +212,7 @@ usbobserver_find_prop(io_registry_entry_t e, CFStringRef key, int is_string ) CFRelease(PropRef); return ans; -} +} static PyObject* usbobserver_get_usb_drives(PyObject *self, PyObject *args) { @@ -289,7 +289,7 @@ usbobserver_get_mounted_filesystems(PyObject *self, PyObject *args) { } num += 10; // In case the number of volumes has increased buf = PyMem_New(fsstat, num); - if (buf == NULL) return PyErr_NoMemory(); + if (buf == NULL) return PyErr_NoMemory(); num = getfsstat(buf, num*sizeof(fsstat), MNT_NOWAIT); if (num == -1) { @@ -458,25 +458,25 @@ end: } static PyMethodDef usbobserver_methods[] = { - {"get_usb_devices", usbobserver_get_usb_devices, METH_VARARGS, + {"get_usb_devices", usbobserver_get_usb_devices, METH_VARARGS, "Get list of connected USB devices. Returns a list of tuples. Each tuple is of the form (vendor_id, product_id, bcd, manufacturer, product, serial number)." }, - {"get_usb_drives", usbobserver_get_usb_drives, METH_VARARGS, + {"get_usb_drives", usbobserver_get_usb_drives, METH_VARARGS, "Get list of mounted drives. Returns a list of tuples, each of the form (name, bsd_path)." }, - {"get_mounted_filesystems", usbobserver_get_mounted_filesystems, METH_VARARGS, + {"get_mounted_filesystems", usbobserver_get_mounted_filesystems, METH_VARARGS, "Get mapping of mounted filesystems. Mapping is from BSD name to mount point." }, - {"send2trash", usbobserver_send2trash, METH_VARARGS, + {"send2trash", usbobserver_send2trash, METH_VARARGS, "send2trash(unicode object) -> Send specified file/dir to trash" }, - {"user_locale", usbobserver_user_locale, METH_VARARGS, + {"user_locale", usbobserver_user_locale, METH_VARARGS, "user_locale() -> The name of the current user's locale or None if an error occurred" }, - {"date_format", usbobserver_date_fmt, METH_VARARGS, + {"date_format", usbobserver_date_fmt, METH_VARARGS, "date_format() -> The (short) date format used by the user's current locale" }, - {"is_mtp_device", usbobserver_is_mtp, METH_VARARGS, + {"is_mtp_device", usbobserver_is_mtp, METH_VARARGS, "is_mtp_device(vendor_id, product_id, bcd, serial) -> Return True if the specified device has an MTP interface" }, diff --git a/src/calibre/ebooks/compression/palmdoc.c b/src/calibre/ebooks/compression/palmdoc.c index 7c29372481..61d00ab04f 100644 --- a/src/calibre/ebooks/compression/palmdoc.c +++ b/src/calibre/ebooks/compression/palmdoc.c @@ -52,7 +52,7 @@ cpalmdoc_decompress(PyObject *self, PyObject *args) { input = (Byte *) PyMem_Malloc(sizeof(Byte)*input_len); if (input == NULL) return PyErr_NoMemory(); // Map chars to bytes - for (j = 0; j < input_len; j++) + for (j = 0; j < input_len; j++) input[j] = (_input[j] < 0) ? _input[j]+256 : _input[j]; output = (char *)PyMem_Malloc(sizeof(char)*(MAX(BUFFER, 8*input_len))); if (output == NULL) return PyErr_NoMemory(); @@ -64,7 +64,7 @@ cpalmdoc_decompress(PyObject *self, PyObject *args) { else if (c <= 0x7F) // 0, 09-7F = self output[o++] = (char)c; - + else if (c >= 0xC0) { // space + ASCII char output[o++] = ' '; output[o++] = c ^ 0x80; @@ -72,7 +72,7 @@ cpalmdoc_decompress(PyObject *self, PyObject *args) { else { // 80-BF repeat sequences c = (c << 8) + input[i++]; di = (c & 0x3FFF) >> 3; - for ( n = (c & 7) + 3; n--; ++o ) + for ( n = (c & 7) + 3; n--; ++o ) output[o] = output[o - di]; } } @@ -82,7 +82,7 @@ cpalmdoc_decompress(PyObject *self, PyObject *args) { return ans; } -static bool +static bool cpalmdoc_memcmp( Byte *a, Byte *b, Py_ssize_t len) { Py_ssize_t i; for (i = 0; i < len; i++) if (a[i] != b[i]) return false; @@ -92,7 +92,7 @@ cpalmdoc_memcmp( Byte *a, Byte *b, Py_ssize_t len) { static Py_ssize_t cpalmdoc_rfind(Byte *data, Py_ssize_t pos, Py_ssize_t chunk_length) { Py_ssize_t i; - for (i = pos - chunk_length; i > -1; i--) + for (i = pos - chunk_length; i > -1; i--) if (cpalmdoc_memcmp(data+i, data+pos, chunk_length)) return i; return pos; } @@ -105,7 +105,7 @@ cpalmdoc_do_compress(buffer *b, char *output) { Byte c, n; bool found; char *head; - buffer temp; + buffer temp; head = output; temp.data = (Byte *)PyMem_Malloc(sizeof(Byte)*8); temp.len = 0; if (temp.data == NULL) return 0; @@ -167,7 +167,7 @@ cpalmdoc_compress(PyObject *self, PyObject *args) { b.data = (Byte *)PyMem_Malloc(sizeof(Byte)*input_len); if (b.data == NULL) return PyErr_NoMemory(); // Map chars to bytes - for (j = 0; j < input_len; j++) + for (j = 0; j < input_len; j++) b.data[j] = (_input[j] < 0) ? _input[j]+256 : _input[j]; b.len = input_len; // Make the output buffer larger than the input as sometimes diff --git a/src/calibre/gui2/pictureflow/pictureflow.cpp b/src/calibre/gui2/pictureflow/pictureflow.cpp index 32e91dc41a..93c4116948 100644 --- a/src/calibre/gui2/pictureflow/pictureflow.cpp +++ b/src/calibre/gui2/pictureflow/pictureflow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -* (C) Copyright 2007 Trolltech ASA +* (C) Copyright 2007 Trolltech ASA * All rights reserved. ** * This is version of the Pictureflow animated image show widget modified by Trolltech ASA. @@ -30,7 +30,7 @@ ****************************************************************************/ -/* +/* ORIGINAL COPYRIGHT HEADER PictureFlow - animated image show widget http://pictureflow.googlecode.com @@ -131,134 +131,134 @@ inline PFreal floatToFixed(float val) // warning: regenerate the table if IANGLE_MAX and PFREAL_SHIFT are changed! static const PFreal sinTable[IANGLE_MAX] = { - 3, 9, 15, 21, 28, 34, 40, 47, - 53, 59, 65, 72, 78, 84, 90, 97, - 103, 109, 115, 122, 128, 134, 140, 147, - 153, 159, 165, 171, 178, 184, 190, 196, - 202, 209, 215, 221, 227, 233, 239, 245, - 251, 257, 264, 270, 276, 282, 288, 294, - 300, 306, 312, 318, 324, 330, 336, 342, - 347, 353, 359, 365, 371, 377, 383, 388, - 394, 400, 406, 412, 417, 423, 429, 434, - 440, 446, 451, 457, 463, 468, 474, 479, - 485, 491, 496, 501, 507, 512, 518, 523, - 529, 534, 539, 545, 550, 555, 561, 566, - 571, 576, 581, 587, 592, 597, 602, 607, - 612, 617, 622, 627, 632, 637, 642, 647, - 652, 656, 661, 666, 671, 675, 680, 685, - 690, 694, 699, 703, 708, 712, 717, 721, - 726, 730, 735, 739, 743, 748, 752, 756, - 760, 765, 769, 773, 777, 781, 785, 789, - 793, 797, 801, 805, 809, 813, 816, 820, - 824, 828, 831, 835, 839, 842, 846, 849, - 853, 856, 860, 863, 866, 870, 873, 876, - 879, 883, 886, 889, 892, 895, 898, 901, - 904, 907, 910, 913, 916, 918, 921, 924, - 927, 929, 932, 934, 937, 939, 942, 944, - 947, 949, 951, 954, 956, 958, 960, 963, - 965, 967, 969, 971, 973, 975, 977, 978, - 980, 982, 984, 986, 987, 989, 990, 992, - 994, 995, 997, 998, 999, 1001, 1002, 1003, - 1004, 1006, 1007, 1008, 1009, 1010, 1011, 1012, - 1013, 1014, 1015, 1015, 1016, 1017, 1018, 1018, - 1019, 1019, 1020, 1020, 1021, 1021, 1022, 1022, - 1022, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1022, - 1022, 1022, 1021, 1021, 1020, 1020, 1019, 1019, - 1018, 1018, 1017, 1016, 1015, 1015, 1014, 1013, - 1012, 1011, 1010, 1009, 1008, 1007, 1006, 1004, - 1003, 1002, 1001, 999, 998, 997, 995, 994, - 992, 990, 989, 987, 986, 984, 982, 980, - 978, 977, 975, 973, 971, 969, 967, 965, - 963, 960, 958, 956, 954, 951, 949, 947, - 944, 942, 939, 937, 934, 932, 929, 927, - 924, 921, 918, 916, 913, 910, 907, 904, - 901, 898, 895, 892, 889, 886, 883, 879, - 876, 873, 870, 866, 863, 860, 856, 853, - 849, 846, 842, 839, 835, 831, 828, 824, - 820, 816, 813, 809, 805, 801, 797, 793, - 789, 785, 781, 777, 773, 769, 765, 760, - 756, 752, 748, 743, 739, 735, 730, 726, - 721, 717, 712, 708, 703, 699, 694, 690, - 685, 680, 675, 671, 666, 661, 656, 652, - 647, 642, 637, 632, 627, 622, 617, 612, - 607, 602, 597, 592, 587, 581, 576, 571, - 566, 561, 555, 550, 545, 539, 534, 529, - 523, 518, 512, 507, 501, 496, 491, 485, - 479, 474, 468, 463, 457, 451, 446, 440, - 434, 429, 423, 417, 412, 406, 400, 394, - 388, 383, 377, 371, 365, 359, 353, 347, - 342, 336, 330, 324, 318, 312, 306, 300, - 294, 288, 282, 276, 270, 264, 257, 251, - 245, 239, 233, 227, 221, 215, 209, 202, - 196, 190, 184, 178, 171, 165, 159, 153, - 147, 140, 134, 128, 122, 115, 109, 103, - 97, 90, 84, 78, 72, 65, 59, 53, - 47, 40, 34, 28, 21, 15, 9, 3, - -4, -10, -16, -22, -29, -35, -41, -48, - -54, -60, -66, -73, -79, -85, -91, -98, - -104, -110, -116, -123, -129, -135, -141, -148, - -154, -160, -166, -172, -179, -185, -191, -197, - -203, -210, -216, -222, -228, -234, -240, -246, - -252, -258, -265, -271, -277, -283, -289, -295, - -301, -307, -313, -319, -325, -331, -337, -343, - -348, -354, -360, -366, -372, -378, -384, -389, - -395, -401, -407, -413, -418, -424, -430, -435, - -441, -447, -452, -458, -464, -469, -475, -480, - -486, -492, -497, -502, -508, -513, -519, -524, - -530, -535, -540, -546, -551, -556, -562, -567, - -572, -577, -582, -588, -593, -598, -603, -608, - -613, -618, -623, -628, -633, -638, -643, -648, - -653, -657, -662, -667, -672, -676, -681, -686, - -691, -695, -700, -704, -709, -713, -718, -722, - -727, -731, -736, -740, -744, -749, -753, -757, - -761, -766, -770, -774, -778, -782, -786, -790, - -794, -798, -802, -806, -810, -814, -817, -821, - -825, -829, -832, -836, -840, -843, -847, -850, - -854, -857, -861, -864, -867, -871, -874, -877, - -880, -884, -887, -890, -893, -896, -899, -902, - -905, -908, -911, -914, -917, -919, -922, -925, - -928, -930, -933, -935, -938, -940, -943, -945, - -948, -950, -952, -955, -957, -959, -961, -964, - -966, -968, -970, -972, -974, -976, -978, -979, - -981, -983, -985, -987, -988, -990, -991, -993, - -995, -996, -998, -999, -1000, -1002, -1003, -1004, - -1005, -1007, -1008, -1009, -1010, -1011, -1012, -1013, - -1014, -1015, -1016, -1016, -1017, -1018, -1019, -1019, - -1020, -1020, -1021, -1021, -1022, -1022, -1023, -1023, - -1023, -1024, -1024, -1024, -1024, -1024, -1024, -1024, - -1024, -1024, -1024, -1024, -1024, -1024, -1024, -1023, - -1023, -1023, -1022, -1022, -1021, -1021, -1020, -1020, - -1019, -1019, -1018, -1017, -1016, -1016, -1015, -1014, - -1013, -1012, -1011, -1010, -1009, -1008, -1007, -1005, - -1004, -1003, -1002, -1000, -999, -998, -996, -995, - -993, -991, -990, -988, -987, -985, -983, -981, - -979, -978, -976, -974, -972, -970, -968, -966, - -964, -961, -959, -957, -955, -952, -950, -948, - -945, -943, -940, -938, -935, -933, -930, -928, - -925, -922, -919, -917, -914, -911, -908, -905, - -902, -899, -896, -893, -890, -887, -884, -880, - -877, -874, -871, -867, -864, -861, -857, -854, - -850, -847, -843, -840, -836, -832, -829, -825, - -821, -817, -814, -810, -806, -802, -798, -794, - -790, -786, -782, -778, -774, -770, -766, -761, - -757, -753, -749, -744, -740, -736, -731, -727, - -722, -718, -713, -709, -704, -700, -695, -691, - -686, -681, -676, -672, -667, -662, -657, -653, - -648, -643, -638, -633, -628, -623, -618, -613, - -608, -603, -598, -593, -588, -582, -577, -572, - -567, -562, -556, -551, -546, -540, -535, -530, - -524, -519, -513, -508, -502, -497, -492, -486, - -480, -475, -469, -464, -458, -452, -447, -441, - -435, -430, -424, -418, -413, -407, -401, -395, - -389, -384, -378, -372, -366, -360, -354, -348, - -343, -337, -331, -325, -319, -313, -307, -301, - -295, -289, -283, -277, -271, -265, -258, -252, - -246, -240, -234, -228, -222, -216, -210, -203, - -197, -191, -185, -179, -172, -166, -160, -154, - -148, -141, -135, -129, -123, -116, -110, -104, - -98, -91, -85, -79, -73, -66, -60, -54, - -48, -41, -35, -29, -22, -16, -10, -4 + 3, 9, 15, 21, 28, 34, 40, 47, + 53, 59, 65, 72, 78, 84, 90, 97, + 103, 109, 115, 122, 128, 134, 140, 147, + 153, 159, 165, 171, 178, 184, 190, 196, + 202, 209, 215, 221, 227, 233, 239, 245, + 251, 257, 264, 270, 276, 282, 288, 294, + 300, 306, 312, 318, 324, 330, 336, 342, + 347, 353, 359, 365, 371, 377, 383, 388, + 394, 400, 406, 412, 417, 423, 429, 434, + 440, 446, 451, 457, 463, 468, 474, 479, + 485, 491, 496, 501, 507, 512, 518, 523, + 529, 534, 539, 545, 550, 555, 561, 566, + 571, 576, 581, 587, 592, 597, 602, 607, + 612, 617, 622, 627, 632, 637, 642, 647, + 652, 656, 661, 666, 671, 675, 680, 685, + 690, 694, 699, 703, 708, 712, 717, 721, + 726, 730, 735, 739, 743, 748, 752, 756, + 760, 765, 769, 773, 777, 781, 785, 789, + 793, 797, 801, 805, 809, 813, 816, 820, + 824, 828, 831, 835, 839, 842, 846, 849, + 853, 856, 860, 863, 866, 870, 873, 876, + 879, 883, 886, 889, 892, 895, 898, 901, + 904, 907, 910, 913, 916, 918, 921, 924, + 927, 929, 932, 934, 937, 939, 942, 944, + 947, 949, 951, 954, 956, 958, 960, 963, + 965, 967, 969, 971, 973, 975, 977, 978, + 980, 982, 984, 986, 987, 989, 990, 992, + 994, 995, 997, 998, 999, 1001, 1002, 1003, + 1004, 1006, 1007, 1008, 1009, 1010, 1011, 1012, + 1013, 1014, 1015, 1015, 1016, 1017, 1018, 1018, + 1019, 1019, 1020, 1020, 1021, 1021, 1022, 1022, + 1022, 1023, 1023, 1023, 1023, 1023, 1023, 1023, + 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1022, + 1022, 1022, 1021, 1021, 1020, 1020, 1019, 1019, + 1018, 1018, 1017, 1016, 1015, 1015, 1014, 1013, + 1012, 1011, 1010, 1009, 1008, 1007, 1006, 1004, + 1003, 1002, 1001, 999, 998, 997, 995, 994, + 992, 990, 989, 987, 986, 984, 982, 980, + 978, 977, 975, 973, 971, 969, 967, 965, + 963, 960, 958, 956, 954, 951, 949, 947, + 944, 942, 939, 937, 934, 932, 929, 927, + 924, 921, 918, 916, 913, 910, 907, 904, + 901, 898, 895, 892, 889, 886, 883, 879, + 876, 873, 870, 866, 863, 860, 856, 853, + 849, 846, 842, 839, 835, 831, 828, 824, + 820, 816, 813, 809, 805, 801, 797, 793, + 789, 785, 781, 777, 773, 769, 765, 760, + 756, 752, 748, 743, 739, 735, 730, 726, + 721, 717, 712, 708, 703, 699, 694, 690, + 685, 680, 675, 671, 666, 661, 656, 652, + 647, 642, 637, 632, 627, 622, 617, 612, + 607, 602, 597, 592, 587, 581, 576, 571, + 566, 561, 555, 550, 545, 539, 534, 529, + 523, 518, 512, 507, 501, 496, 491, 485, + 479, 474, 468, 463, 457, 451, 446, 440, + 434, 429, 423, 417, 412, 406, 400, 394, + 388, 383, 377, 371, 365, 359, 353, 347, + 342, 336, 330, 324, 318, 312, 306, 300, + 294, 288, 282, 276, 270, 264, 257, 251, + 245, 239, 233, 227, 221, 215, 209, 202, + 196, 190, 184, 178, 171, 165, 159, 153, + 147, 140, 134, 128, 122, 115, 109, 103, + 97, 90, 84, 78, 72, 65, 59, 53, + 47, 40, 34, 28, 21, 15, 9, 3, + -4, -10, -16, -22, -29, -35, -41, -48, + -54, -60, -66, -73, -79, -85, -91, -98, + -104, -110, -116, -123, -129, -135, -141, -148, + -154, -160, -166, -172, -179, -185, -191, -197, + -203, -210, -216, -222, -228, -234, -240, -246, + -252, -258, -265, -271, -277, -283, -289, -295, + -301, -307, -313, -319, -325, -331, -337, -343, + -348, -354, -360, -366, -372, -378, -384, -389, + -395, -401, -407, -413, -418, -424, -430, -435, + -441, -447, -452, -458, -464, -469, -475, -480, + -486, -492, -497, -502, -508, -513, -519, -524, + -530, -535, -540, -546, -551, -556, -562, -567, + -572, -577, -582, -588, -593, -598, -603, -608, + -613, -618, -623, -628, -633, -638, -643, -648, + -653, -657, -662, -667, -672, -676, -681, -686, + -691, -695, -700, -704, -709, -713, -718, -722, + -727, -731, -736, -740, -744, -749, -753, -757, + -761, -766, -770, -774, -778, -782, -786, -790, + -794, -798, -802, -806, -810, -814, -817, -821, + -825, -829, -832, -836, -840, -843, -847, -850, + -854, -857, -861, -864, -867, -871, -874, -877, + -880, -884, -887, -890, -893, -896, -899, -902, + -905, -908, -911, -914, -917, -919, -922, -925, + -928, -930, -933, -935, -938, -940, -943, -945, + -948, -950, -952, -955, -957, -959, -961, -964, + -966, -968, -970, -972, -974, -976, -978, -979, + -981, -983, -985, -987, -988, -990, -991, -993, + -995, -996, -998, -999, -1000, -1002, -1003, -1004, + -1005, -1007, -1008, -1009, -1010, -1011, -1012, -1013, + -1014, -1015, -1016, -1016, -1017, -1018, -1019, -1019, + -1020, -1020, -1021, -1021, -1022, -1022, -1023, -1023, + -1023, -1024, -1024, -1024, -1024, -1024, -1024, -1024, + -1024, -1024, -1024, -1024, -1024, -1024, -1024, -1023, + -1023, -1023, -1022, -1022, -1021, -1021, -1020, -1020, + -1019, -1019, -1018, -1017, -1016, -1016, -1015, -1014, + -1013, -1012, -1011, -1010, -1009, -1008, -1007, -1005, + -1004, -1003, -1002, -1000, -999, -998, -996, -995, + -993, -991, -990, -988, -987, -985, -983, -981, + -979, -978, -976, -974, -972, -970, -968, -966, + -964, -961, -959, -957, -955, -952, -950, -948, + -945, -943, -940, -938, -935, -933, -930, -928, + -925, -922, -919, -917, -914, -911, -908, -905, + -902, -899, -896, -893, -890, -887, -884, -880, + -877, -874, -871, -867, -864, -861, -857, -854, + -850, -847, -843, -840, -836, -832, -829, -825, + -821, -817, -814, -810, -806, -802, -798, -794, + -790, -786, -782, -778, -774, -770, -766, -761, + -757, -753, -749, -744, -740, -736, -731, -727, + -722, -718, -713, -709, -704, -700, -695, -691, + -686, -681, -676, -672, -667, -662, -657, -653, + -648, -643, -638, -633, -628, -623, -618, -613, + -608, -603, -598, -593, -588, -582, -577, -572, + -567, -562, -556, -551, -546, -540, -535, -530, + -524, -519, -513, -508, -502, -497, -492, -486, + -480, -475, -469, -464, -458, -452, -447, -441, + -435, -430, -424, -418, -413, -407, -401, -395, + -389, -384, -378, -372, -366, -360, -354, -348, + -343, -337, -331, -325, -319, -313, -307, -301, + -295, -289, -283, -277, -271, -265, -258, -252, + -246, -240, -234, -228, -222, -216, -210, -203, + -197, -191, -185, -179, -172, -166, -160, -154, + -148, -141, -135, -129, -123, -116, -110, -104, + -98, -91, -85, -79, -73, -66, -60, -54, + -48, -41, -35, -29, -22, -16, -10, -4 }; // this is the program the generate the above table @@ -302,7 +302,7 @@ inline PFreal fsin(int iangle) while(iangle < 0) iangle += IANGLE_MAX; return sinTable[iangle & IANGLE_MASK]; -} +} inline PFreal fcos(int iangle) { @@ -375,12 +375,12 @@ public: void setImages(FlowImages *images); void dataChanged(); - + private: PictureFlow* widget; - + FlowImages *slideImages; - + int slideWidth; int slideHeight; int fontSize; @@ -439,7 +439,7 @@ PictureFlowPrivate::PictureFlowPrivate(PictureFlow* w, int queueLength_) triggerTimer.setSingleShot(true); triggerTimer.setInterval(0); QObject::connect(&triggerTimer, SIGNAL(timeout()), widget, SLOT(render())); - + recalc(200, 200); resetSlides(); } @@ -490,7 +490,7 @@ int PictureFlowPrivate::getTarget() const int PictureFlowPrivate::currentSlide() const { return centerIndex; -} +} void PictureFlowPrivate::setCurrentSlide(int index) { @@ -619,12 +619,12 @@ static QImage prepareSurface(QImage srcimg, const int w, const int h, bool doRef QRgb color; // offscreen buffer: black is sweet - QImage result(hs, w, QImage::Format_RGB16); + QImage result(hs, w, QImage::Format_RGB16); result.fill(0); if (preserveAspectRatio) { QImage temp = srcimg.scaled(w, h, Qt::KeepAspectRatio, Qt::SmoothTransformation); - img = QImage(w, h, temp.format()); + img = QImage(w, h, temp.format()); img.fill(0); left = (w - temp.width()) / 2; top = h - temp.height(); @@ -690,7 +690,7 @@ QImage* PictureFlowPrivate::surface(int slideIndex) QPoint p2(slideWidth*6/10, slideHeight); QLinearGradient linearGrad(p1, p2); linearGrad.setColorAt(0, Qt::black); - linearGrad.setColorAt(1, Qt::white); + linearGrad.setColorAt(1, Qt::white); painter.setBrush(linearGrad); painter.fillRect(0, 0, slideWidth, slideHeight, QBrush(linearGrad)); @@ -708,7 +708,7 @@ QImage* PictureFlowPrivate::surface(int slideIndex) } -// Schedules rendering the slides. Call this function to avoid immediate +// Schedules rendering the slides. Call this function to avoid immediate // render and thus cause less flicker. void PictureFlowPrivate::triggerRender(int after_msecs) { @@ -743,7 +743,7 @@ void PictureFlowPrivate::render_text(QPainter *painter, int index) { //printf("top: %d, height: %d\n", brect.top(), brect.height()); // painter->drawText(brect, TEXT_FLAGS, caption); - + brect2.moveTop(buffer_height - brect2.height()); painter->save(); @@ -761,7 +761,7 @@ void PictureFlowPrivate::render() int nright = rightSlides.count(); QRect r; - if (step == 0) + if (step == 0) r = renderCenterSlide(centerSlide); else r = renderSlide(centerSlide); @@ -777,7 +777,7 @@ void PictureFlowPrivate::render() QRect rs = renderSlide(leftSlides[index], alpha, 0, c1-1); if(!rs.isEmpty()) c1 = rs.left(); - } + } for(int index = 0; index < nright-1; index++) { int alpha = (index < nright-2) ? 256 : 128; @@ -796,7 +796,7 @@ void PictureFlowPrivate::render() painter.setPen(Qt::white); //painter.setPen(QColor(255,255,255,127)); - if (centerIndex < slideCount() && centerIndex > -1) { + if (centerIndex < slideCount() && centerIndex > -1) { render_text(&painter, centerIndex); } @@ -820,7 +820,7 @@ void PictureFlowPrivate::render() c1 = rs.left(); alpha = (step > 0) ? 256-fade/2 : 256; - } + } for(int index = 0; index < nright; index++) { int alpha = (index < nright-2) ? 256 : 128; @@ -905,8 +905,8 @@ QRect PictureFlowPrivate::renderSlide(const SlideInfo &slide, int alpha, int col if(!src) return QRect(); - QRect rect(0, 0, 0, 0); - + QRect rect(0, 0, 0, 0); + int sw = src->height(); int sh = src->width(); int h = buffer.height(); @@ -978,10 +978,10 @@ QRect PictureFlowPrivate::renderSlide(const SlideInfo &slide, int alpha, int col } } - rect.setRight(x); + rect.setRight(x); if(!flag) rect.setLeft(x); - flag = true; + flag = true; int y1 = h/2; int y2 = y1+ 1; @@ -1006,7 +1006,7 @@ QRect PictureFlowPrivate::renderSlide(const SlideInfo &slide, int alpha, int col y2++; pixel1 -= pixelstep; pixel2 += pixelstep; - } + } else while((y1 >= 0) && (y2 < h) && (p1 >= 0)) { @@ -1032,8 +1032,8 @@ QRect PictureFlowPrivate::renderSlide(const SlideInfo &slide, int alpha, int col y2++; pixel1 -= pixelstep; pixel2 += pixelstep; - } - } + } + } rect.setTop(0); rect.setBottom(h-1); @@ -1126,7 +1126,7 @@ void PictureFlowPrivate::updateAnimation() int pos = slideFrame & 0xffff; int neg = 65536 - pos; int tick = (step < 0) ? neg : pos; - PFreal ftick = (tick * PFREAL_ONE) >> 16; + PFreal ftick = (tick * PFREAL_ONE) >> 16; // the leftmost and rightmost slide must fade away fade = pos / 256; @@ -1157,7 +1157,7 @@ void PictureFlowPrivate::updateAnimation() step = 0; fade = 256; return; - } + } for(int i = 0; i < leftSlides.count(); i++) { @@ -1188,7 +1188,7 @@ void PictureFlowPrivate::updateAnimation() leftSlides[0].angle = (pos * itilt) >> 16; leftSlides[0].cx = -fmul(offsetX, ftick); leftSlides[0].cy = fmul(offsetY, ftick); - } + } // must change direction ? if(target < index) if(step > 0) @@ -1226,7 +1226,7 @@ PictureFlow::PictureFlow(QWidget* parent, int queueLength): QWidget(parent) PictureFlow::~PictureFlow() { delete d; -} +} QSize PictureFlow::slideSize() const @@ -1274,7 +1274,7 @@ void PictureFlow::setShowReflections(bool show) { d->setShowReflections(show); } -void PictureFlow::setImages(FlowImages *images) +void PictureFlow::setImages(FlowImages *images) { d->setImages(images); } @@ -1321,7 +1321,7 @@ void PictureFlow::keyPressEvent(QKeyEvent* event) { if(event->modifiers() == Qt::ControlModifier) showSlide(currentSlide()-10); - else + else showPrevious(); event->accept(); return; @@ -1387,7 +1387,7 @@ void PictureFlow::mouseMoveEvent(QMouseEvent* event) { speed = ((qAbs(x-d->previousPos.x())*1000) / d->previousPosTimestamp.elapsed()) / (d->buffer.width() / 10); - + if (speed < SPEED_LOWER_THRESHOLD) speed = SPEED_LOWER_THRESHOLD; else if (speed > SPEED_UPPER_LIMIT) @@ -1395,19 +1395,19 @@ void PictureFlow::mouseMoveEvent(QMouseEvent* event) else { speed = SPEED_LOWER_THRESHOLD + (speed / 3); // qDebug() << "ACCELERATION ENABLED Speed = " << speed << ", Distance = " << distanceMovedSinceLastEvent; - + } } - + // qDebug() << "Speed = " << speed; // int incr = ((event->pos().x() - d->previousPos.x())/10) * speed; - + // qDebug() << "Incremented by " << incr; int incr = (distanceMovedSinceLastEvent * speed); - + //qDebug() << "(distanceMovedSinceLastEvent * speed) = " << incr; if (incr > d->pixelsToMovePerSlide*2) { @@ -1438,7 +1438,7 @@ void PictureFlow::mouseMoveEvent(QMouseEvent* event) */ } - + } d->previousPos = event->pos() * device_pixel_ratio(); diff --git a/src/calibre/gui2/progress_indicator/QProgressIndicator.cpp b/src/calibre/gui2/progress_indicator/QProgressIndicator.cpp index 8cba302c33..6cee373cc7 100644 --- a/src/calibre/gui2/progress_indicator/QProgressIndicator.cpp +++ b/src/calibre/gui2/progress_indicator/QProgressIndicator.cpp @@ -35,10 +35,10 @@ void QProgressIndicator::setDisplayedWhenStopped(bool state) update(); } -void QProgressIndicator::setDisplaySize(int size) -{ - m_displaySize = size; - update(); +void QProgressIndicator::setDisplaySize(int size) +{ + m_displaySize = size; + update(); } @@ -106,10 +106,10 @@ void QProgressIndicator::paintEvent(QPaintEvent * /*event*/) return; int width = qMin(this->width(), this->height()); - + QPainter p(this); p.setRenderHint(QPainter::Antialiasing); - + int outerRadius = (width-1)*0.5; int innerRadius = (width-1)*0.5*0.38; @@ -122,7 +122,7 @@ void QProgressIndicator::paintEvent(QPaintEvent * /*event*/) QColor color = m_color; color.setAlphaF(1.0f - (i/12.0f)); p.setPen(Qt::NoPen); - p.setBrush(color); + p.setBrush(color); p.save(); p.translate(rect().center()); p.rotate(m_angle - i*30.0f); @@ -136,7 +136,7 @@ static inline QByteArray detectDesktopEnvironment() const QByteArray xdgCurrentDesktop = qgetenv("XDG_CURRENT_DESKTOP"); if (!xdgCurrentDesktop.isEmpty()) // See http://standards.freedesktop.org/menu-spec/latest/apb.html - return xdgCurrentDesktop.toUpper(); + return xdgCurrentDesktop.toUpper(); // Classic fallbacks if (!qEnvironmentVariableIsEmpty("KDE_FULL_SESSION")) @@ -163,7 +163,7 @@ class CalibreStyle: public QProxyStyle { public: CalibreStyle(QStyle *base, QHash<int, QString> icmap) : QProxyStyle(base), icon_map(icmap) { setObjectName(QString("calibre")); - desktop_environment = detectDesktopEnvironment(); + desktop_environment = detectDesktopEnvironment(); button_layout = static_cast<QDialogButtonBox::ButtonLayout>(QProxyStyle::styleHint(SH_DialogButtonLayout)); if (QLatin1String("GNOME") == desktop_environment || QLatin1String("MATE") == desktop_environment || QLatin1String("UNITY") == desktop_environment || QLatin1String("CINNAMON") == desktop_environment || QLatin1String("X-CINNAMON") == desktop_environment) button_layout = QDialogButtonBox::GnomeLayout; @@ -252,12 +252,12 @@ int load_style(QHash<int,QString> icon_map) { return 0; } -class NoActivateStyle: public QProxyStyle { - public: - int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const { - if (hint == QStyle::SH_ItemView_ActivateItemOnSingleClick) return 0; - return QProxyStyle::styleHint(hint, option, widget, returnData); - } +class NoActivateStyle: public QProxyStyle { + public: + int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const { + if (hint == QStyle::SH_ItemView_ActivateItemOnSingleClick) return 0; + return QProxyStyle::styleHint(hint, option, widget, returnData); + } }; void set_no_activate_on_click(QWidget *widget) { diff --git a/src/calibre/gui2/tweak_book/editor/syntax/html.c b/src/calibre/gui2/tweak_book/editor/syntax/html.c index bf45d92bde..3e750d102e 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/html.c +++ b/src/calibre/gui2/tweak_book/editor/syntax/html.c @@ -164,15 +164,15 @@ static PyTypeObject html_StateType; typedef struct { PyObject_HEAD // Type-specific fields go here. - PyObject *tag_being_defined; - PyObject *tags; - PyObject *is_bold; - PyObject *is_italic; + PyObject *tag_being_defined; + PyObject *tags; + PyObject *is_bold; + PyObject *is_italic; PyObject *current_lang; - PyObject *parse; - PyObject *css_formats; - PyObject *sub_parser_state; - PyObject *default_lang; + PyObject *parse; + PyObject *css_formats; + PyObject *sub_parser_state; + PyObject *default_lang; PyObject *attribute_name; } html_State; @@ -213,7 +213,7 @@ html_State_new(PyTypeObject *type, PyObject *args, PyObject *kwds) self->default_lang = NULL; self->attribute_name = NULL; - if (!PyArg_ParseTuple(args, "|OOOOOOOOOO", + if (!PyArg_ParseTuple(args, "|OOOOOOOOOO", &(self->tag_being_defined), &(self->tags), &(self->is_bold), @@ -401,7 +401,7 @@ static inline long number_to_long(PyObject *number) { static PyObject* html_check_spelling(PyObject *self, PyObject *args) { PyObject *ans = NULL, *temp = NULL, *items = NULL, *text = NULL, *fmt = NULL, *locale = NULL, *sfmt = NULL, *_store_locale = NULL, *t = NULL, *utmp = NULL; - long text_len = 0, start = 0, length = 0, ppos = 0; + long text_len = 0, start = 0, length = 0, ppos = 0; int store_locale = 0, ok = 0; Py_ssize_t i = 0, j = 0; @@ -409,7 +409,7 @@ html_check_spelling(PyObject *self, PyObject *args) { store_locale = PyObject_IsTrue(_store_locale); temp = PyObject_GetAttrString(locale, "langcode"); if (temp == NULL) goto error; - items = PyObject_CallFunctionObjArgs(split, text, temp, NULL); + items = PyObject_CallFunctionObjArgs(split, text, temp, NULL); Py_DECREF(temp); temp = NULL; if (items == NULL) goto error; ans = PyTuple_New((2 * PyList_GET_SIZE(items)) + 1); @@ -466,7 +466,7 @@ html_check_spelling(PyObject *self, PyObject *args) { error: Py_XDECREF(ans); ans = NULL; end: - Py_XDECREF(items); Py_XDECREF(temp); + Py_XDECREF(items); Py_XDECREF(temp); return ans; } diff --git a/src/calibre/headless/headless_integration.cpp b/src/calibre/headless/headless_integration.cpp index 506c9ae8cc..500d7f930d 100644 --- a/src/calibre/headless/headless_integration.cpp +++ b/src/calibre/headless/headless_integration.cpp @@ -39,10 +39,10 @@ class GenericUnixServices : public QGenericUnixServices { * Qt will try to query the nativeInterface() without checking if it exists * leading to a segfault. For example, defaultHintStyleFromMatch() queries * the nativeInterface() without checking that it is NULL. See - * https://bugreports.qt-project.org/browse/QTBUG-40946 - * This is no longer strictly neccessary since we implement our own fontconfig database + * https://bugreports.qt-project.org/browse/QTBUG-40946 + * This is no longer strictly neccessary since we implement our own fontconfig database * (a patched version of the Qt fontconfig database). However, it is probably a good idea to - * keep it unknown, since the headless QPA is used in contexts where a desktop environment + * keep it unknown, since the headless QPA is used in contexts where a desktop environment * does not make sense anyway. */ QByteArray desktopEnvironment() const { return QByteArrayLiteral("UNKNOWN"); } diff --git a/src/calibre/utils/certgen.c b/src/calibre/utils/certgen.c index 2ef066a720..cb84616290 100644 --- a/src/calibre/utils/certgen.c +++ b/src/calibre/utils/certgen.c @@ -61,10 +61,10 @@ static PyObject* create_rsa_keypair(PyObject *self, PyObject *args) { Py_END_ALLOW_THREADS; if (!ret) { set_error("RSA_generate_key_ex"); goto error; } - ans = PyCapsule_New(KeyPair, NULL, free_rsa_keypair); + ans = PyCapsule_New(KeyPair, NULL, free_rsa_keypair); if (ans == NULL) { PyErr_NoMemory(); goto error; } error: - if(BigNumber) BN_free(BigNumber); + if(BigNumber) BN_free(BigNumber); if (!ans && KeyPair) RSA_free(KeyPair); return ans; } @@ -192,7 +192,7 @@ static int certificate_set_serial(X509 *cert) (sno = BN_to_ASN1_INTEGER(bn,sno)) != NULL && X509_set_serialNumber(cert, sno) == 1) rv = 1; - else + else set_error("X509_set_serialNumber"); BN_free(bn); ASN1_INTEGER_free(sno); @@ -270,8 +270,8 @@ static PyObject* create_rsa_cert(PyObject *self, PyObject *args) { ok = 1; error: - if (!ok) { - if (Cert) X509_free(Cert); + if (!ok) { + if (Cert) X509_free(Cert); } return ans; } diff --git a/src/calibre/utils/fonts/winfonts.cpp b/src/calibre/utils/fonts/winfonts.cpp index 9e15bda6e6..428f31d529 100644 --- a/src/calibre/utils/fonts/winfonts.cpp +++ b/src/calibre/utils/fonts/winfonts.cpp @@ -57,7 +57,7 @@ static PyObject* logfont_to_dict(const ENUMLOGFONTEX *lf, const TEXTMETRIC *tm, full_name = wchar_to_unicode(lf->elfFullName); style = wchar_to_unicode(lf->elfStyle); script = wchar_to_unicode(lf->elfScript); - + return Py_BuildValue("{s:N, s:N, s:N, s:N, s:O, s:O, s:O, s:O, s:l}", "name", name, "full_name", full_name, @@ -204,7 +204,7 @@ static PyObject* remove_system_font(PyObject *self, PyObject *args) { return Py_BuildValue("O", ok); } -static +static PyMethodDef winfonts_methods[] = { {"enum_font_families", enum_font_families, METH_VARARGS, "enum_font_families()\n\n" diff --git a/src/calibre/utils/imageops/imageops.cpp b/src/calibre/utils/imageops/imageops.cpp index a7f363e0fc..b1beca7924 100644 --- a/src/calibre/utils/imageops/imageops.cpp +++ b/src/calibre/utils/imageops/imageops.cpp @@ -70,7 +70,7 @@ static unsigned int read_border_row(const QImage &img, const unsigned int width, row = reinterpret_cast<const QRgb*>(img.constScanLine(r)); red_average = 0; green_average = 0; blue_average = 0; for (c = 0, pixel = row; c < width; c++, pixel++) { - reds[c] = qRed(*pixel) / 255.0; greens[c] = qGreen(*pixel) / 255.0; blues[c] = qBlue(*pixel) / 255.0; + reds[c] = qRed(*pixel) / 255.0; greens[c] = qGreen(*pixel) / 255.0; blues[c] = qBlue(*pixel) / 255.0; red_average += reds[c]; green_average += greens[c]; blue_average += blues[c]; } red_average /= MAX(1, width); green_average /= MAX(1, width); blue_average /= MAX(1, width); @@ -106,7 +106,7 @@ QImage remove_borders(const QImage &image, double fuzz) { if (bottom_border < height - 1) { transpose.rotate(90); timg = img.transformed(transpose); - if (timg.isNull()) bad_alloc = true; + if (timg.isNull()) bad_alloc = true; else { left_border = read_border_row(timg, height, width, buf, fuzz, true); if (left_border < width - 1) { @@ -555,7 +555,7 @@ static inline void hull(const int x_offset, const int y_offset, const int w, con *dest = e; \ } -QImage despeckle(const QImage &image) { +QImage despeckle(const QImage &image) { ScopedGILRelease PyGILRelease; int length, x, y, j, i; QRgb *dest; @@ -580,7 +580,7 @@ QImage despeckle(const QImage &image) { } // }}} -// overlay() {{{ +// overlay() {{{ static inline unsigned int BYTE_MUL(unsigned int x, unsigned int a) { quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ffULL) * a; t = (t + ((t >> 8) & 0xff00ff00ff00ffULL) + 0x80008000800080ULL) >> 8; @@ -588,7 +588,7 @@ static inline unsigned int BYTE_MUL(unsigned int x, unsigned int a) { return ((unsigned int)(t)) | ((unsigned int)(t >> 24)); } -void overlay(const QImage &image, QImage &canvas, unsigned int left, unsigned int top) { +void overlay(const QImage &image, QImage &canvas, unsigned int left, unsigned int top) { ScopedGILRelease PyGILRelease; QImage img(image); unsigned int cw = canvas.width(), ch = canvas.height(), iw = img.width(), ih = img.height(), r, c, right = 0, bottom = 0, height, width, s; @@ -618,7 +618,7 @@ void overlay(const QImage &image, QImage &canvas, unsigned int left, unsigned in // Since the canvas has no transparency // the composite pixel is: canvas*(1-alpha) + src * alpha // but src is pre-multiplied, so it is: - // canvas*(1-alpha) + src + // canvas*(1-alpha) + src s = src[c]; if (s >= 0xff000000) dest[left+c] = s; else if (s != 0) dest[left+c] = s + BYTE_MUL(dest[left+c], qAlpha(~s)); diff --git a/src/calibre/utils/imageops/quantize.cpp b/src/calibre/utils/imageops/quantize.cpp index 55a6369659..3eae6ef72f 100644 --- a/src/calibre/utils/imageops/quantize.cpp +++ b/src/calibre/utils/imageops/quantize.cpp @@ -2,7 +2,7 @@ * quantize.cpp * Copyright (C) 2016 Kovid Goyal <kovid at kovidgoyal.net> * - * octree based image quantization. + * octree based image quantization. * See https://www.microsoft.com/msj/archive/S3F1.aspx for a simple to follow * writeup on this algorithm * @@ -112,10 +112,10 @@ public: } // Adding colors to the tree {{{ - + inline Node* create_child(const size_t level, const size_t depth, unsigned int *leaf_count, Node **reducible_nodes, Pool<Node> &node_pool) { Node *c = node_pool.checkout(); - if (level == depth) { + if (level == depth) { c->is_leaf = true; (*leaf_count)++; } else { @@ -150,12 +150,12 @@ public: // }}} // Tree reduction {{{ - + inline uint64_t total_error() const { Node *child = NULL; uint64_t ans = 0; for (int i = 0; i < MAX_DEPTH; i++) { - if ((child = this->children[i]) != NULL) + if ((child = this->children[i]) != NULL) ans += child->error_sum.red + child->error_sum.green + child->error_sum.blue; } return ans; @@ -215,7 +215,7 @@ public: int i; Node *child; if (this->is_leaf) { - color_table[*index] = qRgb(this->avg.red, this->avg.green, this->avg.blue); + color_table[*index] = qRgb(this->avg.red, this->avg.green, this->avg.blue); this->index = (*index)++; } else { for (i = 0; i < MAX_DEPTH; i++) { @@ -224,7 +224,7 @@ public: child->set_palette_colors(color_table, index, compute_parent_averages); if (compute_parent_averages) { this->pixel_count += child->pixel_count; - this->sum.red += child->pixel_count * child->avg.red; + this->sum.red += child->pixel_count * child->avg.red; this->sum.green += child->pixel_count * child->avg.green; this->sum.blue += child->pixel_count * child->avg.blue; } @@ -372,12 +372,12 @@ QImage quantize(const QImage &image, unsigned int maximum_colors, bool dither, c maximum_colors = MAX(2, MIN(MAX_COLORS, maximum_colors)); if (img.hasAlphaChannel()) throw std::out_of_range("Cannot quantize image with transparency"); - if (fmt != QImage::Format_RGB32 && fmt != QImage::Format_Indexed8) { - img = img.convertToFormat(QImage::Format_RGB32); + if (fmt != QImage::Format_RGB32 && fmt != QImage::Format_Indexed8) { + img = img.convertToFormat(QImage::Format_RGB32); if (img.isNull()) throw std::bad_alloc(); - } + } // There can be no more than MAX_LEAVES * 8 nodes. Add 1 in case there is an off by 1 error somewhere. - Pool<Node> node_pool((MAX_LEAVES + 1) * 8); + Pool<Node> node_pool((MAX_LEAVES + 1) * 8); if (palette.size() > 0) { // Quantizing to fixed palette leaf_count = read_colors(palette, root, depth, reducible_nodes, node_pool); diff --git a/src/calibre/utils/lzx/lzc.c b/src/calibre/utils/lzx/lzc.c index 98038391ee..efa3abe2b4 100644 --- a/src/calibre/utils/lzx/lzc.c +++ b/src/calibre/utils/lzx/lzc.c @@ -18,7 +18,7 @@ #define LZ_ONEBUFFER 1 #define LAZY 1 -/* +/* * Document here */ #include <stdio.h> @@ -41,7 +41,7 @@ void lz_init(lz_info *lzi, int wsize, int max_dist, output_match_t output_match, output_literal_t output_literal, void *user_data) { - /* the reason for the separate max_dist value is LZX can't reach the + /* the reason for the separate max_dist value is LZX can't reach the first three characters in its nominal window. But using a smaller window results in inefficiency when dealing with reset intervals which are the length of the nominal window */ @@ -55,12 +55,12 @@ void lz_init(lz_info *lzi, int wsize, int max_dist, lzi->min_match = min_match; if (lzi->min_match < 3) lzi->min_match = 3; - lzi->max_dist = max_dist; - lzi->block_buf_size = wsize + lzi->max_dist; + lzi->max_dist = max_dist; + lzi->block_buf_size = wsize + lzi->max_dist; lzi->block_buf = malloc(lzi->block_buf_size); lzi->block_bufe = lzi->block_buf + lzi->block_buf_size; assert(lzi->block_buf != NULL); - + lzi->cur_loc = 0; lzi->block_loc = 0; lzi->chars_in_buf = 0; @@ -109,7 +109,7 @@ int tmp_output_match(lz_info *lzi, int match_pos, int match_len) { lz_user_data *lzud = (lz_user_data *)lzi->user_data; int mod_match_loc; - + mod_match_loc = match_pos; fprintf(lzud->outfile, "(%d, %d)(%d)\n", match_pos, match_len, mod_match_loc); @@ -275,13 +275,13 @@ static void lz_analyze_block(lz_info *lzi) #endif } -void lz_stop_compressing(lz_info *lzi) +void lz_stop_compressing(lz_info *lzi) { lzi->stop = 1; /* fprintf(stderr, "Stopping...\n");*/ } -int lz_compress(lz_info *lzi, int nchars) +int lz_compress(lz_info *lzi, int nchars) { unsigned char *bbp, *bbe; @@ -306,7 +306,7 @@ int lz_compress(lz_info *lzi, int nchars) #endif memmove(lzi->block_buf, lzi->block_buf + lzi->chars_in_buf - bytes_to_move, bytes_to_move); - + lzi->block_loc = bytes_to_move - residual; lzi->chars_in_buf = bytes_to_move; #ifdef DEBUG_ANALYZE_BLOCK @@ -360,7 +360,7 @@ int lz_compress(lz_info *lzi, int nchars) len = 1; /* this is the lazy eval case */ } - else + else #endif if (lzi->output_match(lzi, (*prevp - lzi->block_buf) - lzi->block_loc, len) < 0) { @@ -370,7 +370,7 @@ int lz_compress(lz_info *lzi, int nchars) } else len = 1; - + if (len < lzi->min_match) { assert(len == 1); lzi->output_literal(lzi, *bbp); diff --git a/src/calibre/utils/lzx/lzxc.c b/src/calibre/utils/lzx/lzxc.c index b57d5cf80f..d3234fa159 100644 --- a/src/calibre/utils/lzx/lzxc.c +++ b/src/calibre/utils/lzx/lzxc.c @@ -107,15 +107,15 @@ static int cmp_leaves(const void *in_a, const void *in_b) { const struct h_elem *a = in_a; const struct h_elem *b = in_b; - + if (!a->freq && b->freq) return 1; if (a->freq && !b->freq) return -1; - + if (a->freq == b->freq) return a->sym - b->sym; - + return a->freq - b->freq; } @@ -124,7 +124,7 @@ cmp_pathlengths(const void *in_a, const void *in_b) { const struct h_elem *a = in_a; const struct h_elem *b = in_b; - + if (a->pathlength == b->pathlength) #if 0 return a->sym - b->sym; @@ -136,7 +136,7 @@ cmp_pathlengths(const void *in_a, const void *in_b) } /* standard huffman building algorithm */ -static void +static void build_huffman_tree(int nelem, int max_code_length, int *freq, huff_entry *tree) { h_elem *leaves = malloc(nelem * sizeof(h_elem)); @@ -180,13 +180,13 @@ build_huffman_tree(int nelem, int max_code_length, int *freq, huff_entry *tree) } assert (!codes_too_long); } - + cur_leaf = leaves; next_inode = cur_inode = inodes; - + do { f1 = f2 = NULL; - if (leaves_left && + if (leaves_left && ((cur_inode == next_inode) || (cur_leaf->freq <= cur_inode->freq))) { f1 = (ih_elem *)cur_leaf++; @@ -195,8 +195,8 @@ build_huffman_tree(int nelem, int max_code_length, int *freq, huff_entry *tree) else if (cur_inode != next_inode) { f1 = cur_inode++; } - - if (leaves_left && + + if (leaves_left && ((cur_inode == next_inode) || (cur_leaf->freq <= cur_inode->freq))) { f2 = (ih_elem *)cur_leaf++; @@ -205,7 +205,7 @@ build_huffman_tree(int nelem, int max_code_length, int *freq, huff_entry *tree) else if (cur_inode != next_inode) { f2 = cur_inode++; } - + #ifdef DEBUG_HUFFMAN fprintf(stderr, "%d %d\n", f1, f2); #endif @@ -231,11 +231,11 @@ build_huffman_tree(int nelem, int max_code_length, int *freq, huff_entry *tree) while (f1 && f2); } while (codes_too_long); - + #ifdef DEBUG_HUFFMAN cur_inode = inodes; while (cur_inode < next_inode) { - fprintf(stderr, "%d l: %3d%c r: %3d%c freq: %8d\n", + fprintf(stderr, "%d l: %3d%c r: %3d%c freq: %8d\n", cur_inode - inodes, (cur_inode->left->sym!=-1)?(((struct h_elem *)cur_inode->left)-leaves):(cur_inode->left-inodes), (cur_inode->left->sym!=-1)?'l':'i', @@ -246,7 +246,7 @@ build_huffman_tree(int nelem, int max_code_length, int *freq, huff_entry *tree) cur_inode++; } #endif - + /* now traverse tree depth-first */ cur_inode = next_inode - 1; pathlength = 0; @@ -262,17 +262,17 @@ build_huffman_tree(int nelem, int max_code_length, int *freq, huff_entry *tree) else { /* mark node */ cur_inode->pathlength = pathlength; -#if 0 +#if 0 if (cur_inode->right) { /* right node of previously unmarked node is unmarked */ cur_inode = cur_inode->right; cur_inode->pathlength = -1; pathlength++; } - else + else #endif { - + /* time to come up. Keep coming up until an unmarked node is reached */ /* or the tree is exhausted */ do { @@ -292,16 +292,16 @@ build_huffman_tree(int nelem, int max_code_length, int *freq, huff_entry *tree) } } while (cur_inode); - + #ifdef DEBUG_HUFFMAN cur_inode = inodes; while (cur_inode < next_inode) { - fprintf(stderr, "%d l: %3d%c r: %3d%c freq: %8d pathlength %4d\n", + fprintf(stderr, "%d l: %3d%c r: %3d%c freq: %8d pathlength %4d\n", cur_inode - inodes, (cur_inode->left->sym!=-1)?(((struct h_elem *)cur_inode->left)-leaves):(cur_inode->left-inodes), (cur_inode->left->sym!=-1)?'l':'i', (cur_inode->right->sym!=-1)?(((struct h_elem *)cur_inode->right)-leaves):(cur_inode->right-inodes), - (cur_inode->right->sym!=-1)?'l':'i', + (cur_inode->right->sym!=-1)?'l':'i', (cur_inode->freq), (cur_inode->pathlength) ); @@ -309,11 +309,11 @@ build_huffman_tree(int nelem, int max_code_length, int *freq, huff_entry *tree) } #endif free(inodes); - + /* the pathlengths are already in order, so this sorts by symbol */ qsort(leaves, nelem, sizeof(h_elem), cmp_pathlengths); - - /** + + /** Microsoft's second condition on its canonical huffman codes is: For each level, starting at the deepest level of the tree and then @@ -321,13 +321,13 @@ build_huffman_tree(int nelem, int max_code_length, int *freq, huff_entry *tree) alternative way of stating this constraint is that if any tree node has children then all tree nodes to the left of it with the same path length must also have children. - + These 'alternatives' are not equivalent. The latter alternative gives the common canonical code where the longest code is all zeros. The former gives an opposite code where the longest code is all ones. Microsoft uses the former alternative. **/ - + #if 0 pathlength = leaves[0].pathlength; cur_code = 0; @@ -355,12 +355,12 @@ build_huffman_tree(int nelem, int max_code_length, int *freq, huff_entry *tree) cur_code++; } #endif - + #ifdef DEBUG_HUFFMAN for (i = 0; i < nleaves; i++) { char code[18]; int j; - + cur_code = leaves[i].code; code[leaves[i].pathlength] = 0; for (j = leaves[i].pathlength-1; j >= 0; j--) { @@ -387,19 +387,19 @@ build_huffman_tree(int nelem, int max_code_length, int *freq, huff_entry *tree) leaves[1].code = 0; } } - + memset(tree, 0, nelem * sizeof(huff_entry)); for (i = 0; i < nleaves; i++) { tree[leaves[i].sym].codelength = leaves[i].pathlength; tree[leaves[i].sym].code = leaves[i].code; } - + free(leaves); } - + /* from Stuart Caie's code -- I'm hoping this code is too small to encumber this file. If not, you could rip it out and hard-code the tables */ - + static void lzx_init_static(void) { int i, j; @@ -478,7 +478,7 @@ lzx_get_chars(lz_info *lzi, int n, unsigned char *buf) lzud->left_in_block -= chars_read; #else lzud->left_in_frame -= chars_read % LZX_FRAME_SIZE; - if (lzud->left_in_frame < 0) + if (lzud->left_in_frame < 0) lzud->left_in_frame += LZX_FRAME_SIZE; #endif if ((chars_read < n) && (lzud->left_in_frame)) { @@ -559,7 +559,7 @@ static int find_match_at(lz_info *lzi, int loc, int match_len, int *match_locp) return -1; } #endif -static void check_entropy(lzxc_data *lzud, int main_index) +static void check_entropy(lzxc_data *lzud, int main_index) { /* entropy = - sum_alphabet P(x) * log2 P(x) */ /* entropy = - sum_alphabet f(x)/N * log2 (f(x)/N) */ @@ -567,12 +567,12 @@ static void check_entropy(lzxc_data *lzud, int main_index) /* entropy = - 1/N (sum_alphabet f(x) * log2 f(x)) - sum_alphabet f(x) log2 N */ /* entropy = - 1/N (sum_alphabet f(x) * log2 f(x)) - log2 N sum_alphabet f(x) */ /* entropy = - 1/N (sum_alphabet f(x) * log2 f(x)) - N * log2 N */ - + /* entropy = - 1/N ((sum_alphabet f(x) * log2 f(x) ) - N * log2 N) */ /* entropy = - 1/N ((sum_alphabet f(x) * ln f(x) * 1/ln 2) - N * ln N * 1/ln 2) */ /* entropy = 1/(N ln 2) (N * ln N - (sum_alphabet f(x) * ln f(x))) */ /* entropy = 1/(N ln 2) (N * ln N + (sum_alphabet -f(x) * ln f(x))) */ - + /* entropy = 1/(N ln 2) ( sum_alphabet ln N * f(x) + (sum_alphabet -f(x) * ln f(x))) */ /* entropy = 1/(N ln 2) ( sum_alphabet ln N * f(x) + (-f(x) * ln f(x))) */ /* entropy = -1/(N ln 2) ( sum_alphabet -ln N * f(x) + (f(x) * ln f(x))) */ @@ -582,14 +582,14 @@ static void check_entropy(lzxc_data *lzud, int main_index) /* entropy = -1/N ( sum_alphabet f(x)(log2 f(x)/N)) */ /* entropy = - ( sum_alphabet f(x)/N(log2 f(x)/N)) */ /* entropy = - ( sum_alphabet P(x)(log2 P(x))) */ - + double freq; double n_ln_n; double rn_ln2; double cur_ratio; int n; - + /* delete old entropy accumulation */ if (lzud->main_freq_table[main_index] != 1) { freq = (double)lzud->main_freq_table[main_index]-1; @@ -638,7 +638,7 @@ lzx_output_match(lz_info *lzi, int match_pos, int match_len) int i; int pos; for (i = 0; i < match_len; i++) { - + #ifdef NONSLIDE pos = match_pos + lzi->block_loc + i; fprintf(stderr, "%c", lzi->block_buf[pos]); @@ -701,13 +701,13 @@ lzx_output_match(lz_info *lzi, int match_pos, int match_len) lzud->R0 = -match_pos; /* calculate position base using binary search of table; if log2 can be - done in hardware, approximation might work; + done in hardware, approximation might work; trunc(log2(formatted_offset*formatted_offset)) gets either the proper position slot or the next one, except for slots 0, 1, and 39-49 Slots 0-1 are handled by the R0-R1 procedures - Slots 36-49 (formatted_offset >= 262144) can be found by + Slots 36-49 (formatted_offset >= 262144) can be found by (formatted_offset/131072) + 34 == (formatted_offset >> 17) + 34; */ @@ -796,7 +796,7 @@ lzx_output_match(lz_info *lzi, int match_pos, int match_len) return 0; /* accept the match */ } -static void +static void lzx_output_literal(lz_info *lzi, unsigned char ch) { lzxc_data *lzud = (lzxc_data *)lzi->user_data; @@ -847,7 +847,7 @@ static void lzx_write_bits(lzxc_data *lzxd, int nbits, uint32_t bits) nbits -= shift_bits; cur_bits = 0; } - /* (cur_bits + nbits) < 16. If nbits = 0, we're done. + /* (cur_bits + nbits) < 16. If nbits = 0, we're done. otherwise move bits in */ shift_bits = nbits; mask_bits = (1U << shift_bits) - 1; @@ -893,18 +893,18 @@ lzx_write_compressed_literals(lzxc_data *lzxd, int block_type) /* * 0x80000000 | bit 31 in intelligent bit ordering * (position_slot << 25) | bits 30-25 - * (position_footer << 8) | bits 8-24 + * (position_footer << 8) | bits 8-24 * (match_len - MIN_MATCH); bits 0-7 * */ - + match_len_m2 = block_code & 0xFF; /* 8 bits */ position_footer = (block_code >> 8)& 0x1FFFF; /* 17 bits */ position_slot = (block_code >> 25) & 0x3F; /* 6 bits */ #ifdef DEBUG_MATCHES_2 fprintf(stderr, "%08x, %3d %2d %d\n", lzxd->len_uncompressed_input + frame_count, match_len_m2, position_slot, position_footer); -#endif +#endif if (match_len_m2 < NUM_PRIMARY_LENGTHS) { length_header = match_len_m2; length_footer = 255; /* personal encoding for NULL */ @@ -955,7 +955,7 @@ lzx_write_compressed_literals(lzxc_data *lzxd, int block_type) lzxd->len_uncompressed_input += frame_count; } -static int +static int lzx_write_compressed_tree(struct lzxc_data *lzxd, struct huff_entry *tree, uint8_t *prevlengths, int treesize) @@ -1011,7 +1011,7 @@ lzx_write_compressed_tree(struct lzxc_data *lzxd, *codep++ = 19; *runp++ = excess; freqs[19]++; - /* right, MS lies again. Code is NOT + /* right, MS lies again. Code is NOT prev_len + len (mod 17), it's prev_len - len (mod 17)*/ *codep = prevlengths[i-cur_run] - last_len; if (*codep > 16) *codep += 17; @@ -1078,7 +1078,7 @@ lzx_write_compressed_tree(struct lzxc_data *lzxd, return 0; } -void +void lzxc_reset(lzxc_data *lzxd) { lzxd->need_1bit_header = 1; @@ -1097,7 +1097,7 @@ int lzxc_compress_block(lzxc_data *lzxd, int block_size, int subdivide) long comp_bits; long comp_bits_ovh; long uncomp_length; - + if ((lzxd->block_size != block_size) || (lzxd->block_codes == NULL)) { if (lzxd->block_codes != NULL) free(lzxd->block_codes); lzxd->block_size = block_size; @@ -1118,13 +1118,13 @@ int lzxc_compress_block(lzxc_data *lzxd, int block_size, int subdivide) lz_compress(lzxd->lzi, lzxd->left_in_block); if (lzxd->left_in_frame == 0) lzxd->left_in_frame = LZX_FRAME_SIZE; - - if ((lzxd->subdivide<0) || !lzxd->left_in_block || + + if ((lzxd->subdivide<0) || !lzxd->left_in_block || (!lz_left_to_process(lzxd->lzi) && lzxd->at_eof(lzxd->in_arg))) { /* now one block is LZ-analyzed. */ /* time to write it out */ uncomp_length = lzxd->block_size - lzxd->left_in_block - written_sofar; - /* uncomp_length will sometimes be 0 when input length is + /* uncomp_length will sometimes be 0 when input length is an exact multiple of frame size */ if (uncomp_length == 0) continue; @@ -1134,7 +1134,7 @@ int lzxc_compress_block(lzxc_data *lzxd, int block_size, int subdivide) #endif lzxd->subdivide = 1; } - + if (lzxd->need_1bit_header) { /* one bit Intel preprocessing header */ /* always 0 because this implementation doesn't do Intel preprocessing */ @@ -1169,32 +1169,32 @@ int lzxc_compress_block(lzxc_data *lzxd, int block_size, int subdivide) /* now write out the aligned offset trees if present */ if (block_type == LZX_ALIGNED_OFFSET_BLOCK) { for (i = 0; i < LZX_ALIGNED_SIZE; i++) { - lzx_write_bits(lzxd, 3, lzxd->aligned_tree[i].codelength); + lzx_write_bits(lzxd, 3, lzxd->aligned_tree[i].codelength); } } /* end extra bits */ build_huffman_tree(lzxd->main_tree_size, LZX_MAX_CODE_LENGTH, lzxd->main_freq_table, lzxd->main_tree); - build_huffman_tree(NUM_SECONDARY_LENGTHS, 16, + build_huffman_tree(NUM_SECONDARY_LENGTHS, 16, lzxd->length_freq_table, lzxd->length_tree); /* now write the pre-tree and tree for main 1 */ lzx_write_compressed_tree(lzxd, lzxd->main_tree, lzxd->prev_main_treelengths, NUM_CHARS); - + /* now write the pre-tree and tree for main 2*/ lzx_write_compressed_tree(lzxd, lzxd->main_tree + NUM_CHARS, lzxd->prev_main_treelengths + NUM_CHARS, lzxd->main_tree_size - NUM_CHARS); - + /* now write the pre tree and tree for length */ lzx_write_compressed_tree(lzxd, lzxd->length_tree, lzxd->prev_length_treelengths, NUM_SECONDARY_LENGTHS); - + /* now write literals */ lzx_write_compressed_literals(lzxd, block_type); - + /* copy treelengths somewhere safe to do delta compression */ for (i = 0; i < lzxd->main_tree_size; i++) { lzxd->prev_main_treelengths[i] = lzxd->main_tree[i].codelength; @@ -1205,7 +1205,7 @@ int lzxc_compress_block(lzxc_data *lzxd, int block_size, int subdivide) lzxd->main_entropy = 0.0; lzxd->last_ratio = 9999999.0; lzxd->block_codesp = lzxd->block_codes; - + memset(lzxd->length_freq_table, 0, NUM_SECONDARY_LENGTHS * sizeof(int)); memset(lzxd->main_freq_table, 0, lzxd->main_tree_size * sizeof(int)); memset(lzxd->aligned_freq_table, 0, LZX_ALIGNED_SIZE * sizeof(int)); @@ -1215,7 +1215,7 @@ int lzxc_compress_block(lzxc_data *lzxd, int block_size, int subdivide) return 0; } -int lzxc_init(struct lzxc_data **lzxdp, int wsize_code, +int lzxc_init(struct lzxc_data **lzxdp, int wsize_code, lzxc_get_bytes_t get_bytes, void *get_bytes_arg, lzxc_at_eof_t at_eof, lzxc_put_bytes_t put_bytes, void *put_bytes_arg, diff --git a/src/calibre/utils/lzx/lzxd.c b/src/calibre/utils/lzx/lzxd.c index ca64f868db..b5b9f35af7 100644 --- a/src/calibre/utils/lzx/lzxd.c +++ b/src/calibre/utils/lzx/lzxd.c @@ -302,7 +302,7 @@ static int lzxd_read_lens(struct lzxd_stream *lzx, unsigned char *lens, int z; RESTORE_BITS; - + /* read lengths for pretree (20 symbols, lengths stored in fixed 4 bits) */ for (x = 0; x < 20; x++) { READ_BITS(y, 4); @@ -525,7 +525,7 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) { j = 0; READ_BITS(i, 1); if (i) { READ_BITS(i, 16); READ_BITS(j, 16); } lzx->intel_filesize = (i << 16) | j; lzx->header_read = 1; - } + } /* calculate size of frame: all frames are 32k except the final frame * which is 32kb or less. this can only be calculated when lzx->length @@ -636,7 +636,7 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) { match_length += length_footer; } match_length += LZX_MIN_MATCH; - + /* get match offset */ switch ((match_offset = (main_element >> 3))) { case 0: match_offset = R0; break; @@ -654,7 +654,7 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) { D(("match ran over window wrap")) return lzx->error = MSPACK_ERR_DECRUNCH; } - + /* copy match */ rundest = &window[window_posn]; i = match_length; @@ -817,7 +817,7 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) { window_posn - lzx->frame_posn, frame_size)) /* Ignored */ #if 0 - return lzx->error = MSPACK_ERR_DECRUNCH; + return lzx->error = MSPACK_ERR_DECRUNCH; #endif } diff --git a/src/calibre/utils/matcher.c b/src/calibre/utils/matcher.c index a42cebaf5c..2f9b9280d4 100644 --- a/src/calibre/utils/matcher.c +++ b/src/calibre/utils/matcher.c @@ -193,7 +193,7 @@ static double process_item(MatchInfo *m, Stack *stack, int32_t *final_positions, // No memoized result, calculate the score for (i = nidx; i < m->needle_len;) { nidx = i; - U16_FWD_1(m->needle, i, m->needle_len);// i now points to next char in needle + U16_FWD_1(m->needle, i, m->needle_len);// i now points to next char in needle search = searches[nidx]; if (search == NULL || m->haystack_len - hidx < m->needle_len - nidx) { score = 0.0; break; } status = U_ZERO_ERROR; // We ignore any errors as we already know that hidx is correct @@ -201,20 +201,20 @@ static double process_item(MatchInfo *m, Stack *stack, int32_t *final_positions, status = U_ZERO_ERROR; pos = usearch_next(search, &status); if (pos == USEARCH_DONE) { score = 0.0; break; } // No matches found - distance = u_countChar32(m->haystack + last_idx, pos - last_idx); + distance = u_countChar32(m->haystack + last_idx, pos - last_idx); if (distance <= 1) score_for_char = m->max_score_per_char; else { - U16_GET(m->haystack, 0, pos, m->haystack_len, hc); + U16_GET(m->haystack, 0, pos, m->haystack_len, hc); j = pos; U16_PREV(m->haystack, 0, j, lc); // lc is the prev character score_for_char = calc_score_for_char(m, lc, hc, distance); } j = pos; - U16_NEXT(m->haystack, j, m->haystack_len, hc); + U16_NEXT(m->haystack, j, m->haystack_len, hc); hidx = j; if (m->haystack_len - hidx >= m->needle_len - nidx) stack_push(stack, hidx, nidx, last_idx, score, positions); - last_idx = pos; - positions[nidx] = pos; + last_idx = pos; + positions[nidx] = pos; score += score_for_char; } // for(i) iterate over needle mem.score = score; memcpy(mem.positions, positions, sizeof(*positions) * m->needle_len); @@ -256,7 +256,7 @@ static void free_searches(UStringSearch **searches, int32_t count) { static bool match(UChar **items, int32_t *item_lengths, uint32_t item_count, UChar *needle, Match *match_results, int32_t *final_positions, int32_t needle_char_len, UCollator *collator, UChar *level1, UChar *level2, UChar *level3) { Stack stack = {0}; - int32_t i = 0, maxhl = 0; + int32_t i = 0, maxhl = 0; int32_t r = 0, *positions = NULL; MatchInfo *matches = NULL; bool ok = FALSE; @@ -340,7 +340,7 @@ static void free_matcher(Matcher *self) { if (self->items != NULL) { for (i = 0; i < self->item_count; i++) { nullfree(self->items[i]); } } - nullfree(self->items); nullfree(self->item_lengths); + nullfree(self->items); nullfree(self->item_lengths); nullfree(self->level1); nullfree(self->level2); nullfree(self->level3); if (self->collator != NULL) ucol_close(self->collator); self->collator = NULL; } @@ -361,7 +361,7 @@ Matcher_init(Matcher *self, PyObject *args, PyObject *kwds) UCollator *col = NULL; if (!PyArg_ParseTuple(args, "OOOOO", &items, &collator, &level1, &level2, &level3)) return -1; - + // Clone the passed in collator (cloning is needed as collators are not thread safe) if (!PyCapsule_CheckExact(collator)) { PyErr_SetString(PyExc_TypeError, "Collator must be a capsule"); return -1; } col = (UCollator*)PyCapsule_GetPointer(collator, NULL); @@ -395,7 +395,7 @@ end: return (PyErr_Occurred()) ? -1 : 0; } // Matcher.__init__() }}} - + // Matcher.calculate_scores {{{ static PyObject * Matcher_calculate_scores(Matcher *self, PyObject *args) { diff --git a/src/calibre/utils/monotonic.c b/src/calibre/utils/monotonic.c index beb8f91f8d..aecb2476fa 100644 --- a/src/calibre/utils/monotonic.c +++ b/src/calibre/utils/monotonic.c @@ -34,10 +34,10 @@ static PyObject* monotonic(PyObject *self, PyObject *args) { /* QueryPerformanceCounter() is wildly inaccurate, so we use the more stable * the lower resolution GetTickCount64() (this is what python 3.x uses) * static LARGE_INTEGER frequency = {0}, ts = {0}; - * static PyObject* monotonic(PyObject *self, PyObject *args) { + * static PyObject* monotonic(PyObject *self, PyObject *args) { * if (!QueryPerformanceCounter(&ts)) { PyErr_SetFromWindowsErr(0); return NULL; } - * return PyFloat_FromDouble(((double)ts.QuadPart)/frequency.QuadPart); - * } + * return PyFloat_FromDouble(((double)ts.QuadPart)/frequency.QuadPart); + * } */ #elif defined(__APPLE__) diff --git a/src/calibre/utils/msdes/des.c b/src/calibre/utils/msdes/des.c index c0f12f11b3..a5592fada3 100644 --- a/src/calibre/utils/msdes/des.c +++ b/src/calibre/utils/msdes/des.c @@ -1,4 +1,4 @@ -/* D3DES (V5.09) - +/* D3DES (V5.09) - * * A portable, public domain, version of the Data Encryption Standard. * @@ -6,7 +6,7 @@ * Thanks to: Dan Hoey for his excellent Initial and Inverse permutation * code; Jim Gillogly & Phil Karn for the DES key schedule code; Dennis * Ferguson, Eric Young and Dana How for comparing notes; and Ray Lau, - * for humouring me on. + * for humouring me on. * * THIS SOFTWARE PLACED IN THE PUBLIC DOMAIN BY THE AUTHOUR * 920825 19:42 EDST @@ -14,14 +14,14 @@ * Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge. * (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992. */ - + #include "d3des.h" - + static void scrunch(unsigned char *, unsigned long *); static void unscrun(unsigned long *, unsigned char *); static void desfunc(unsigned long *, unsigned long *); static void cookey(unsigned long *); - + static unsigned long KnL[32] = { 0L }; /* static unsigned long KnR[32] = { 0L }; @@ -31,10 +31,10 @@ static unsigned char Df_Key[24] = { 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10, 0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 }; */ - + static unsigned short bytebit[8] = { 0200, 0100, 040, 020, 010, 04, 02, 01 }; - + static unsigned long bigbyte[24] = { 0x800000L, 0x400000L, 0x200000L, 0x100000L, 0x80000L, 0x40000L, 0x20000L, 0x10000L, @@ -42,24 +42,24 @@ static unsigned long bigbyte[24] = { 0x800L, 0x400L, 0x200L, 0x100L, 0x80L, 0x40L, 0x20L, 0x10L, 0x8L, 0x4L, 0x2L, 0x1L }; - + /* Use the key schedule specified in the Standard (ANSI X3.92-1981). */ - + static unsigned char pc1[56] = { 56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3 }; - + static unsigned char totrot[16] = { 1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 }; - + static unsigned char pc2[48] = { 13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9, 22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1, 40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47, 43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 }; - + void deskey(key, edf) /* Thanks to James Gillogly & Phil Karn! */ unsigned char *key; short edf; @@ -67,7 +67,7 @@ short edf; int i, j, l, m, n; unsigned char pc1m[56], pcr[56]; unsigned long kn[32]; - + for ( j = 0; j < 56; j++ ) { l = pc1[j]; m = l & 07; @@ -96,14 +96,14 @@ short edf; cookey(kn); return; } - + static void cookey(raw1) unsigned long *raw1; { unsigned long *cook, *raw0; unsigned long dough[32]; int i; - + cook = dough; for( i = 0; i < 16; i++, raw1++ ) { raw0 = raw1++; @@ -119,38 +119,38 @@ unsigned long *raw1; usekey(dough); return; } - + void cpkey(into) unsigned long *into; { unsigned long *from, *endp; - + from = KnL, endp = &KnL[32]; while( from < endp ) *into++ = *from++; return; } - + void usekey(from) unsigned long *from; { unsigned long *to, *endp; - + to = KnL, endp = &KnL[32]; while( to < endp ) *to++ = *from++; return; } - + void des(inblock, outblock) unsigned char *inblock, *outblock; { unsigned long work[2]; - + scrunch(inblock, work); desfunc(work, KnL); unscrun(work, outblock); return; } - + static void scrunch(outof, into) unsigned char *outof; @@ -167,7 +167,7 @@ unsigned long *into; return; } - + static void unscrun(outof, into) unsigned long *outof; unsigned char *into; @@ -184,7 +184,7 @@ unsigned char *into; } #include "spr.h" -/* +/* static unsigned long SP1[64] = { 0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L, 0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L, @@ -202,7 +202,7 @@ static unsigned long SP1[64] = { 0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L, 0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L, 0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L }; - + static unsigned long SP2[64] = { 0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L, 0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L, @@ -220,7 +220,7 @@ static unsigned long SP2[64] = { 0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L, 0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L, 0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L }; - + static unsigned long SP3[64] = { 0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L, 0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L, @@ -238,7 +238,7 @@ static unsigned long SP3[64] = { 0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L, 0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L, 0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L }; - + static unsigned long SP4[64] = { 0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L, 0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L, @@ -256,7 +256,7 @@ static unsigned long SP4[64] = { 0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L, 0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L, 0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L }; - + static unsigned long SP5[64] = { 0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L, 0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L, @@ -274,7 +274,7 @@ static unsigned long SP5[64] = { 0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L, 0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L, 0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L }; - + static unsigned long SP6[64] = { 0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L, 0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L, @@ -292,7 +292,7 @@ static unsigned long SP6[64] = { 0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L, 0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L, 0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L }; - + static unsigned long SP7[64] = { 0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L, 0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L, @@ -310,7 +310,7 @@ static unsigned long SP7[64] = { 0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L, 0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L, 0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L }; - + static unsigned long SP8[64] = { 0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L, 0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L, @@ -330,13 +330,13 @@ static unsigned long SP8[64] = { 0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L }; */ - + static void desfunc(block, keys) unsigned long *block, *keys; { unsigned long fval, work, right, leftt; int round; - + leftt = block[0]; right = block[1]; work = ((leftt >> 4) ^ right) & 0x0f0f0f0fL; @@ -356,7 +356,7 @@ unsigned long *block, *keys; leftt ^= work; right ^= work; leftt = ((leftt << 1) | ((leftt >> 31) & 1L)) & 0xffffffffL; - + for( round = 0; round < 8; round++ ) { work = (right << 28) | (right >> 4); work ^= *keys++; @@ -383,7 +383,7 @@ unsigned long *block, *keys; fval |= SP2[(work >> 24) & 0x3fL]; right ^= fval; } - + right = (right << 31) | (right >> 1); work = (leftt ^ right) & 0xaaaaaaaaL; leftt ^= work; @@ -405,15 +405,15 @@ unsigned long *block, *keys; *block = leftt; return; } - + #ifdef D2_DES - + void des2key(hexkey, mode) /* stomps on Kn3 too */ unsigned char *hexkey; /* unsigned char[16] */ short mode; { short revmod; - + revmod = (mode == EN0) ? DE1 : EN0; deskey(&hexkey[8], revmod); cpkey(KnR); @@ -421,12 +421,12 @@ short mode; cpkey(Kn3); /* Kn3 = KnL */ return; } - + void Ddes(from, into) unsigned char *from, *into; /* unsigned char[8] */ { unsigned long work[2]; - + scrunch(from, work); desfunc(work, KnL); desfunc(work, KnR); @@ -434,14 +434,14 @@ unsigned char *from, *into; /* unsigned char[8] */ unscrun(work, into); return; } - + void D2des(from, into) unsigned char *from; /* unsigned char[16] */ unsigned char *into; /* unsigned char[16] */ { unsigned long *right, *l1, swap; unsigned long leftt[2], bufR[2]; - + right = bufR; l1 = &leftt[1]; scrunch(from, leftt); @@ -462,7 +462,7 @@ unsigned char *into; /* unsigned char[16] */ unscrun(right, &into[8]); return; } - + void makekey(aptr, kptr) char *aptr; /* NULL-terminated */ unsigned char *kptr; /* unsigned char[8] */ @@ -470,7 +470,7 @@ unsigned char *kptr; /* unsigned char[8] */ unsigned char *store; int first, i; unsigned long savek[96]; - + cpDkey(savek); des2key(Df_Key, EN0); for( i = 0; i < 8; i++ ) kptr[i] = Df_Key[i]; @@ -487,7 +487,7 @@ unsigned char *kptr; /* unsigned char[8] */ useDkey(savek); return; } - + void make2key(aptr, kptr) char *aptr; /* NULL-terminated */ unsigned char *kptr; /* unsigned char[16] */ @@ -495,7 +495,7 @@ unsigned char *kptr; /* unsigned char[16] */ unsigned char *store; int first, i; unsigned long savek[96]; - + cpDkey(savek); des2key(Df_Key, EN0); for( i = 0; i < 16; i++ ) kptr[i] = Df_Key[i]; @@ -512,26 +512,26 @@ unsigned char *kptr; /* unsigned char[16] */ useDkey(savek); return; } - + #ifndef D3_DES /* D2_DES only */ - + void cp2key(into) unsigned long *into; /* unsigned long[64] */ { unsigned long *from, *endp; - + cpkey(into); into = &into[32]; from = KnR, endp = &KnR[32]; while( from < endp ) *into++ = *from++; return; } - + void use2key(from) /* stomps on Kn3 too */ unsigned long *from; /* unsigned long[64] */ { unsigned long *to, *endp; - + usekey(from); from = &from[32]; to = KnR, endp = &KnR[32]; @@ -539,16 +539,16 @@ unsigned long *from; /* unsigned long[64] */ cpkey(Kn3); /* Kn3 = KnL */ return; } - + #else /* D3_DES too */ - + void des3key(hexkey, mode) unsigned char *hexkey; /* unsigned char[24] */ short mode; { unsigned char *first, *third; short revmod; - + if( mode == EN0 ) { revmod = DE1; first = hexkey; @@ -566,12 +566,12 @@ short mode; deskey(first, mode); return; } - + void cp3key(into) unsigned long *into; /* unsigned long[96] */ { unsigned long *from, *endp; - + cpkey(into); into = &into[32]; from = KnR, endp = &KnR[32]; @@ -580,12 +580,12 @@ unsigned long *into; /* unsigned long[96] */ while( from < endp ) *into++ = *from++; return; } - + void use3key(from) unsigned long *from; /* unsigned long[96] */ { unsigned long *to, *endp; - + usekey(from); from = &from[32]; to = KnR, endp = &KnR[32]; @@ -594,15 +594,15 @@ unsigned long *from; /* unsigned long[96] */ while( to < endp ) *to++ = *from++; return; } - + static void D3des(unsigned char *, unsigned char *); - + static void D3des(from, into) /* amateur theatrics */ unsigned char *from; /* unsigned char[24] */ unsigned char *into; /* unsigned char[24] */ { unsigned long swap, leftt[2], middl[2], right[2]; - + scrunch(from, leftt); scrunch(&from[8], middl); scrunch(&from[16], right); @@ -631,8 +631,8 @@ unsigned char *into; /* unsigned char[24] */ unscrun(middl, &into[8]); unscrun(right, &into[16]); return; - } - + } + void make3key(aptr, kptr) char *aptr; /* NULL-terminated */ unsigned char *kptr; /* unsigned char[24] */ @@ -640,7 +640,7 @@ unsigned char *kptr; /* unsigned char[24] */ unsigned char *store; int first, i; unsigned long savek[96]; - + cp3key(savek); des3key(Df_Key, EN0); for( i = 0; i < 24; i++ ) kptr[i] = Df_Key[i]; @@ -657,10 +657,10 @@ unsigned char *kptr; /* unsigned char[24] */ use3key(savek); return; } - + #endif /* D3_DES */ #endif /* D2_DES */ - + /* Validation sets: * * Single-length key, single-length plaintext - @@ -690,4 +690,4 @@ unsigned char *kptr; /* unsigned char[24] */ * * d3des V5.09 rwo 9208.04 20:31 Graven Imagery **********************************************************************/ - + diff --git a/src/calibre/utils/podofo/output.cpp b/src/calibre/utils/podofo/output.cpp index 1af1ac0992..a03cc0b188 100644 --- a/src/calibre/utils/podofo/output.cpp +++ b/src/calibre/utils/podofo/output.cpp @@ -31,7 +31,7 @@ class OutputDevice : public PdfOutputDevice { } public: - OutputDevice(PyObject *file) : tell_func(0), seek_func(0), read_func(0), write_func(0), flush_func(0), written(0) { + OutputDevice(PyObject *file) : tell_func(0), seek_func(0), read_func(0), write_func(0), flush_func(0), written(0) { #define GA(f, a) { if((f = PyObject_GetAttrString(file, a)) == NULL) throw pyerr(); } GA(tell_func, "tell"); GA(seek_func, "seek"); @@ -39,7 +39,7 @@ class OutputDevice : public PdfOutputDevice { GA(write_func, "write"); GA(flush_func, "flush"); } - ~OutputDevice() { + ~OutputDevice() { NUKE(tell_func); NUKE(seek_func); NUKE(read_func); NUKE(write_func); NUKE(flush_func); } @@ -64,7 +64,7 @@ class OutputDevice : public PdfOutputDevice { buf = new (std::nothrow) char[lBytes+1]; if (buf == NULL) { PyErr_NoMemory(); throw pyerr(); } - + // Note: PyOS_vsnprintf produces broken output on windows res = vsnprintf(buf, lBytes, pszFormat, args); @@ -184,7 +184,7 @@ PyObject* pdf::write_doc(PdfMemDocument *doc, PyObject *f) { } catch(const PdfError & err) { podofo_set_exception(err); return NULL; } catch (...) { - if (PyErr_Occurred() == NULL) + if (PyErr_Occurred() == NULL) PyErr_SetString(PyExc_Exception, "An unknown error occurred while trying to write the pdf to the file object"); return NULL; } diff --git a/src/calibre/utils/podofo/podofo.cpp b/src/calibre/utils/podofo/podofo.cpp index d4c6b58e91..50f20de8cf 100644 --- a/src/calibre/utils/podofo/podofo.cpp +++ b/src/calibre/utils/podofo/podofo.cpp @@ -39,7 +39,7 @@ class PyLogMessage : public PdfError::LogMessageCallback { PyLogMessage log_message; CALIBRE_MODINIT_FUNC -initpodofo(void) +initpodofo(void) { PyObject* m; diff --git a/src/calibre/utils/podofo/test.cpp b/src/calibre/utils/podofo/test.cpp index fb719fd0cc..af5f434481 100644 --- a/src/calibre/utils/podofo/test.cpp +++ b/src/calibre/utils/podofo/test.cpp @@ -15,7 +15,7 @@ int main(int argc, char **argv) { cout << endl; cout << "is encrypted: " << doc.GetEncrypted() << endl; PdfString old_title = info->GetTitle(); - cout << "is hex: " << old_title.IsHex() << endl; + cout << "is hex: " << old_title.IsHex() << endl; PdfString new_title(reinterpret_cast<const pdf_utf16be*>("\0z\0z\0z"), 3); cout << "is new unicode: " << new_title.IsUnicode() << endl; info->SetTitle(new_title); diff --git a/src/calibre/utils/podofo/utils.cpp b/src/calibre/utils/podofo/utils.cpp index 473eeac195..668ae83e3d 100644 --- a/src/calibre/utils/podofo/utils.cpp +++ b/src/calibre/utils/podofo/utils.cpp @@ -43,4 +43,3 @@ pdf::podofo_convert_pystring_single_byte(PyObject *py) { if (ans == NULL) PyErr_NoMemory(); return ans; } - diff --git a/src/calibre/utils/spell/hunspell_wrapper.cpp b/src/calibre/utils/spell/hunspell_wrapper.cpp index 87dc7083b2..3d3f28f646 100644 --- a/src/calibre/utils/spell/hunspell_wrapper.cpp +++ b/src/calibre/utils/spell/hunspell_wrapper.cpp @@ -13,7 +13,7 @@ #include <hunspell.hxx> typedef struct { - PyObject_HEAD + PyObject_HEAD Hunspell *handle; char *encoding; } Dictionary; diff --git a/src/calibre/utils/zlib2.c b/src/calibre/utils/zlib2.c index aa6f4682a6..77524a1558 100644 --- a/src/calibre/utils/zlib2.c +++ b/src/calibre/utils/zlib2.c @@ -362,16 +362,16 @@ zlib_crc32(PyObject *self, PyObject *args) while ((size_t)len > UINT_MAX) { value = crc32(value, buf, UINT_MAX); buf += (size_t) UINT_MAX; - len -= (size_t) UINT_MAX; - } + len -= (size_t) UINT_MAX; + } signed_val = crc32(value, buf, (unsigned int)len); Py_END_ALLOW_THREADS } else { signed_val = crc32(value, buf, len); - } + } if (indata.obj) PyBuffer_Release(&indata); return PyLong_FromUnsignedLong(signed_val & 0xffffffffU); -} +} static PyMethodDef methods[] = { {"crc32", zlib_crc32, METH_VARARGS, @@ -389,7 +389,7 @@ initzlib2(void) { Comptype.tp_new = PyType_GenericNew; if (PyType_Ready(&Comptype) < 0) return; - + m = Py_InitModule3("zlib2", methods, "Implementation of zlib compression with support for the buffer protocol, which is missing in Python2. Code taken from the Python3 zlib module" ); @@ -422,5 +422,5 @@ initzlib2(void) { if (ZlibError != NULL) { Py_INCREF(ZlibError); PyModule_AddObject(m, "error", ZlibError); - } + } } diff --git a/src/lzma/LzFind.c b/src/lzma/LzFind.c index c335d363ce..73251ef1e0 100644 --- a/src/lzma/LzFind.c +++ b/src/lzma/LzFind.c @@ -1,1044 +1,1044 @@ -/* LzFind.c -- Match finder for LZ algorithms -2015-10-15 : Igor Pavlov : Public domain */ - -#include "Precomp.h" - -#include <string.h> - -#include "LzFind.h" -#include "LzHash.h" - -#define kEmptyHashValue 0 -#define kMaxValForNormalize ((UInt32)0xFFFFFFFF) -#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */ -#define kNormalizeMask (~(UInt32)(kNormalizeStepMin - 1)) -#define kMaxHistorySize ((UInt32)7 << 29) - -#define kStartMaxLen 3 - -static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc) -{ - if (!p->directInput) - { - alloc->Free(alloc, p->bufferBase); - p->bufferBase = NULL; - } -} - -/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */ - -static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc) -{ - UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv; - if (p->directInput) - { - p->blockSize = blockSize; - return 1; - } - if (!p->bufferBase || p->blockSize != blockSize) - { - LzInWindow_Free(p, alloc); - p->blockSize = blockSize; - p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize); - } - return (p->bufferBase != NULL); -} - -Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } - -UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } - -void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) -{ - p->posLimit -= subValue; - p->pos -= subValue; - p->streamPos -= subValue; -} - -static void MatchFinder_ReadBlock(CMatchFinder *p) -{ - if (p->streamEndWasReached || p->result != SZ_OK) - return; - - /* We use (p->streamPos - p->pos) value. (p->streamPos < p->pos) is allowed. */ - - if (p->directInput) - { - UInt32 curSize = 0xFFFFFFFF - (p->streamPos - p->pos); - if (curSize > p->directInputRem) - curSize = (UInt32)p->directInputRem; - p->directInputRem -= curSize; - p->streamPos += curSize; - if (p->directInputRem == 0) - p->streamEndWasReached = 1; - return; - } - - for (;;) - { - Byte *dest = p->buffer + (p->streamPos - p->pos); - size_t size = (p->bufferBase + p->blockSize - dest); - if (size == 0) - return; - - p->result = p->stream->Read(p->stream, dest, &size); - if (p->result != SZ_OK) - return; - if (size == 0) - { - p->streamEndWasReached = 1; - return; - } - p->streamPos += (UInt32)size; - if (p->streamPos - p->pos > p->keepSizeAfter) - return; - } -} - -void MatchFinder_MoveBlock(CMatchFinder *p) -{ - memmove(p->bufferBase, - p->buffer - p->keepSizeBefore, - (size_t)(p->streamPos - p->pos) + p->keepSizeBefore); - p->buffer = p->bufferBase + p->keepSizeBefore; -} - -int MatchFinder_NeedMove(CMatchFinder *p) -{ - if (p->directInput) - return 0; - /* if (p->streamEndWasReached) return 0; */ - return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter); -} - -void MatchFinder_ReadIfRequired(CMatchFinder *p) -{ - if (p->streamEndWasReached) - return; - if (p->keepSizeAfter >= p->streamPos - p->pos) - MatchFinder_ReadBlock(p); -} - -static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p) -{ - if (MatchFinder_NeedMove(p)) - MatchFinder_MoveBlock(p); - MatchFinder_ReadBlock(p); -} - -static void MatchFinder_SetDefaultSettings(CMatchFinder *p) -{ - p->cutValue = 32; - p->btMode = 1; - p->numHashBytes = 4; - p->bigHash = 0; -} - -#define kCrcPoly 0xEDB88320 - -void MatchFinder_Construct(CMatchFinder *p) -{ - UInt32 i; - p->bufferBase = NULL; - p->directInput = 0; - p->hash = NULL; - MatchFinder_SetDefaultSettings(p); - - for (i = 0; i < 256; i++) - { - UInt32 r = i; - unsigned j; - for (j = 0; j < 8; j++) - r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); - p->crc[i] = r; - } -} - -static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc) -{ - alloc->Free(alloc, p->hash); - p->hash = NULL; -} - -void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc) -{ - MatchFinder_FreeThisClassMemory(p, alloc); - LzInWindow_Free(p, alloc); -} - -static CLzRef* AllocRefs(size_t num, ISzAlloc *alloc) -{ - size_t sizeInBytes = (size_t)num * sizeof(CLzRef); - if (sizeInBytes / sizeof(CLzRef) != num) - return NULL; - return (CLzRef *)alloc->Alloc(alloc, sizeInBytes); -} - -int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, - UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, - ISzAlloc *alloc) -{ - UInt32 sizeReserv; - - if (historySize > kMaxHistorySize) - { - MatchFinder_Free(p, alloc); - return 0; - } - - sizeReserv = historySize >> 1; - if (historySize >= ((UInt32)3 << 30)) sizeReserv = historySize >> 3; - else if (historySize >= ((UInt32)2 << 30)) sizeReserv = historySize >> 2; - - sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19); - - p->keepSizeBefore = historySize + keepAddBufferBefore + 1; - p->keepSizeAfter = matchMaxLen + keepAddBufferAfter; - - /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */ - - if (LzInWindow_Create(p, sizeReserv, alloc)) - { - UInt32 newCyclicBufferSize = historySize + 1; - UInt32 hs; - p->matchMaxLen = matchMaxLen; - { - p->fixedHashSize = 0; - if (p->numHashBytes == 2) - hs = (1 << 16) - 1; - else - { - hs = historySize - 1; - hs |= (hs >> 1); - hs |= (hs >> 2); - hs |= (hs >> 4); - hs |= (hs >> 8); - hs >>= 1; - hs |= 0xFFFF; /* don't change it! It's required for Deflate */ - if (hs > (1 << 24)) - { - if (p->numHashBytes == 3) - hs = (1 << 24) - 1; - else - hs >>= 1; - /* if (bigHash) mode, GetHeads4b() in LzFindMt.c needs (hs >= ((1 << 24) - 1))) */ - } - } - p->hashMask = hs; - hs++; - if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size; - if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size; - if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size; - hs += p->fixedHashSize; - } - - { - size_t newSize; - size_t numSons; - p->historySize = historySize; - p->hashSizeSum = hs; - p->cyclicBufferSize = newCyclicBufferSize; - - numSons = newCyclicBufferSize; - if (p->btMode) - numSons <<= 1; - newSize = hs + numSons; - - if (p->hash && p->numRefs == newSize) - return 1; - - MatchFinder_FreeThisClassMemory(p, alloc); - p->numRefs = newSize; - p->hash = AllocRefs(newSize, alloc); - - if (p->hash) - { - p->son = p->hash + p->hashSizeSum; - return 1; - } - } - } - - MatchFinder_Free(p, alloc); - return 0; -} - -static void MatchFinder_SetLimits(CMatchFinder *p) -{ - UInt32 limit = kMaxValForNormalize - p->pos; - UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos; - - if (limit2 < limit) - limit = limit2; - limit2 = p->streamPos - p->pos; - - if (limit2 <= p->keepSizeAfter) - { - if (limit2 > 0) - limit2 = 1; - } - else - limit2 -= p->keepSizeAfter; - - if (limit2 < limit) - limit = limit2; - - { - UInt32 lenLimit = p->streamPos - p->pos; - if (lenLimit > p->matchMaxLen) - lenLimit = p->matchMaxLen; - p->lenLimit = lenLimit; - } - p->posLimit = p->pos + limit; -} - -void MatchFinder_Init_2(CMatchFinder *p, int readData) -{ - UInt32 i; - UInt32 *hash = p->hash; - UInt32 num = p->hashSizeSum; - for (i = 0; i < num; i++) - hash[i] = kEmptyHashValue; - - p->cyclicBufferPos = 0; - p->buffer = p->bufferBase; - p->pos = p->streamPos = p->cyclicBufferSize; - p->result = SZ_OK; - p->streamEndWasReached = 0; - - if (readData) - MatchFinder_ReadBlock(p); - - MatchFinder_SetLimits(p); -} - -void MatchFinder_Init(CMatchFinder *p) -{ - MatchFinder_Init_2(p, True); -} - -static UInt32 MatchFinder_GetSubValue(CMatchFinder *p) -{ - return (p->pos - p->historySize - 1) & kNormalizeMask; -} - -void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems) -{ - size_t i; - for (i = 0; i < numItems; i++) - { - UInt32 value = items[i]; - if (value <= subValue) - value = kEmptyHashValue; - else - value -= subValue; - items[i] = value; - } -} - -static void MatchFinder_Normalize(CMatchFinder *p) -{ - UInt32 subValue = MatchFinder_GetSubValue(p); - MatchFinder_Normalize3(subValue, p->hash, p->numRefs); - MatchFinder_ReduceOffsets(p, subValue); -} - -static void MatchFinder_CheckLimits(CMatchFinder *p) -{ - if (p->pos == kMaxValForNormalize) - MatchFinder_Normalize(p); - if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos) - MatchFinder_CheckAndMoveAndRead(p); - if (p->cyclicBufferPos == p->cyclicBufferSize) - p->cyclicBufferPos = 0; - MatchFinder_SetLimits(p); -} - -static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, - UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, - UInt32 *distances, UInt32 maxLen) -{ - son[_cyclicBufferPos] = curMatch; - for (;;) - { - UInt32 delta = pos - curMatch; - if (cutValue-- == 0 || delta >= _cyclicBufferSize) - return distances; - { - const Byte *pb = cur - delta; - curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; - if (pb[maxLen] == cur[maxLen] && *pb == *cur) - { - UInt32 len = 0; - while (++len != lenLimit) - if (pb[len] != cur[len]) - break; - if (maxLen < len) - { - *distances++ = maxLen = len; - *distances++ = delta - 1; - if (len == lenLimit) - return distances; - } - } - } - } -} - -UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, - UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, - UInt32 *distances, UInt32 maxLen) -{ - CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; - CLzRef *ptr1 = son + (_cyclicBufferPos << 1); - UInt32 len0 = 0, len1 = 0; - for (;;) - { - UInt32 delta = pos - curMatch; - if (cutValue-- == 0 || delta >= _cyclicBufferSize) - { - *ptr0 = *ptr1 = kEmptyHashValue; - return distances; - } - { - CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); - const Byte *pb = cur - delta; - UInt32 len = (len0 < len1 ? len0 : len1); - if (pb[len] == cur[len]) - { - if (++len != lenLimit && pb[len] == cur[len]) - while (++len != lenLimit) - if (pb[len] != cur[len]) - break; - if (maxLen < len) - { - *distances++ = maxLen = len; - *distances++ = delta - 1; - if (len == lenLimit) - { - *ptr1 = pair[0]; - *ptr0 = pair[1]; - return distances; - } - } - } - if (pb[len] < cur[len]) - { - *ptr1 = curMatch; - ptr1 = pair + 1; - curMatch = *ptr1; - len1 = len; - } - else - { - *ptr0 = curMatch; - ptr0 = pair; - curMatch = *ptr0; - len0 = len; - } - } - } -} - -static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, - UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue) -{ - CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; - CLzRef *ptr1 = son + (_cyclicBufferPos << 1); - UInt32 len0 = 0, len1 = 0; - for (;;) - { - UInt32 delta = pos - curMatch; - if (cutValue-- == 0 || delta >= _cyclicBufferSize) - { - *ptr0 = *ptr1 = kEmptyHashValue; - return; - } - { - CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); - const Byte *pb = cur - delta; - UInt32 len = (len0 < len1 ? len0 : len1); - if (pb[len] == cur[len]) - { - while (++len != lenLimit) - if (pb[len] != cur[len]) - break; - { - if (len == lenLimit) - { - *ptr1 = pair[0]; - *ptr0 = pair[1]; - return; - } - } - } - if (pb[len] < cur[len]) - { - *ptr1 = curMatch; - ptr1 = pair + 1; - curMatch = *ptr1; - len1 = len; - } - else - { - *ptr0 = curMatch; - ptr0 = pair; - curMatch = *ptr0; - len0 = len; - } - } - } -} - -#define MOVE_POS \ - ++p->cyclicBufferPos; \ - p->buffer++; \ - if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); - -#define MOVE_POS_RET MOVE_POS return offset; - -static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } - -#define GET_MATCHES_HEADER2(minLen, ret_op) \ - UInt32 lenLimit; UInt32 hv; const Byte *cur; UInt32 curMatch; \ - lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ - cur = p->buffer; - -#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0) -#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue) - -#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue - -#define GET_MATCHES_FOOTER(offset, maxLen) \ - offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \ - distances + offset, maxLen) - distances); MOVE_POS_RET; - -#define SKIP_FOOTER \ - SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; - -#define UPDATE_maxLen { \ - ptrdiff_t diff = (ptrdiff_t)0 - d2; \ - const Byte *c = cur + maxLen; \ - const Byte *lim = cur + lenLimit; \ - for (; c != lim; c++) if (*(c + diff) != *c) break; \ - maxLen = (UInt32)(c - cur); } - -static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -{ - UInt32 offset; - GET_MATCHES_HEADER(2) - HASH2_CALC; - curMatch = p->hash[hv]; - p->hash[hv] = p->pos; - offset = 0; - GET_MATCHES_FOOTER(offset, 1) -} - -UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -{ - UInt32 offset; - GET_MATCHES_HEADER(3) - HASH_ZIP_CALC; - curMatch = p->hash[hv]; - p->hash[hv] = p->pos; - offset = 0; - GET_MATCHES_FOOTER(offset, 2) -} - -static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -{ - UInt32 h2, d2, maxLen, offset, pos; - UInt32 *hash; - GET_MATCHES_HEADER(3) - - HASH3_CALC; - - hash = p->hash; - pos = p->pos; - - d2 = pos - hash[h2]; - - curMatch = hash[kFix3HashSize + hv]; - - hash[h2] = pos; - hash[kFix3HashSize + hv] = pos; - - maxLen = 2; - offset = 0; - - if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur) - { - UPDATE_maxLen - distances[0] = maxLen; - distances[1] = d2 - 1; - offset = 2; - if (maxLen == lenLimit) - { - SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); - MOVE_POS_RET; - } - } - - GET_MATCHES_FOOTER(offset, maxLen) -} - -static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -{ - UInt32 h2, h3, d2, d3, maxLen, offset, pos; - UInt32 *hash; - GET_MATCHES_HEADER(4) - - HASH4_CALC; - - hash = p->hash; - pos = p->pos; - - d2 = pos - hash[ h2]; - d3 = pos - hash[kFix3HashSize + h3]; - - curMatch = hash[kFix4HashSize + hv]; - - hash[ h2] = pos; - hash[kFix3HashSize + h3] = pos; - hash[kFix4HashSize + hv] = pos; - - maxLen = 0; - offset = 0; - - if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur) - { - distances[0] = maxLen = 2; - distances[1] = d2 - 1; - offset = 2; - } - - if (d2 != d3 && d3 < p->cyclicBufferSize && *(cur - d3) == *cur) - { - maxLen = 3; - distances[offset + 1] = d3 - 1; - offset += 2; - d2 = d3; - } - - if (offset != 0) - { - UPDATE_maxLen - distances[offset - 2] = maxLen; - if (maxLen == lenLimit) - { - SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); - MOVE_POS_RET; - } - } - - if (maxLen < 3) - maxLen = 3; - - GET_MATCHES_FOOTER(offset, maxLen) -} - -/* -static UInt32 Bt5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -{ - UInt32 h2, h3, h4, d2, d3, d4, maxLen, offset, pos; - UInt32 *hash; - GET_MATCHES_HEADER(5) - - HASH5_CALC; - - hash = p->hash; - pos = p->pos; - - d2 = pos - hash[ h2]; - d3 = pos - hash[kFix3HashSize + h3]; - d4 = pos - hash[kFix4HashSize + h4]; - - curMatch = hash[kFix5HashSize + hv]; - - hash[ h2] = pos; - hash[kFix3HashSize + h3] = pos; - hash[kFix4HashSize + h4] = pos; - hash[kFix5HashSize + hv] = pos; - - maxLen = 0; - offset = 0; - - if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur) - { - distances[0] = maxLen = 2; - distances[1] = d2 - 1; - offset = 2; - if (*(cur - d2 + 2) == cur[2]) - distances[0] = maxLen = 3; - else if (d3 < p->cyclicBufferSize && *(cur - d3) == *cur) - { - distances[2] = maxLen = 3; - distances[3] = d3 - 1; - offset = 4; - d2 = d3; - } - } - else if (d3 < p->cyclicBufferSize && *(cur - d3) == *cur) - { - distances[0] = maxLen = 3; - distances[1] = d3 - 1; - offset = 2; - d2 = d3; - } - - if (d2 != d4 && d4 < p->cyclicBufferSize - && *(cur - d4) == *cur - && *(cur - d4 + 3) == *(cur + 3)) - { - maxLen = 4; - distances[offset + 1] = d4 - 1; - offset += 2; - d2 = d4; - } - - if (offset != 0) - { - UPDATE_maxLen - distances[offset - 2] = maxLen; - if (maxLen == lenLimit) - { - SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); - MOVE_POS_RET; - } - } - - if (maxLen < 4) - maxLen = 4; - - GET_MATCHES_FOOTER(offset, maxLen) -} -*/ - -static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -{ - UInt32 h2, h3, d2, d3, maxLen, offset, pos; - UInt32 *hash; - GET_MATCHES_HEADER(4) - - HASH4_CALC; - - hash = p->hash; - pos = p->pos; - - d2 = pos - hash[ h2]; - d3 = pos - hash[kFix3HashSize + h3]; - - curMatch = hash[kFix4HashSize + hv]; - - hash[ h2] = pos; - hash[kFix3HashSize + h3] = pos; - hash[kFix4HashSize + hv] = pos; - - maxLen = 0; - offset = 0; - - if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur) - { - distances[0] = maxLen = 2; - distances[1] = d2 - 1; - offset = 2; - } - - if (d2 != d3 && d3 < p->cyclicBufferSize && *(cur - d3) == *cur) - { - maxLen = 3; - distances[offset + 1] = d3 - 1; - offset += 2; - d2 = d3; - } - - if (offset != 0) - { - UPDATE_maxLen - distances[offset - 2] = maxLen; - if (maxLen == lenLimit) - { - p->son[p->cyclicBufferPos] = curMatch; - MOVE_POS_RET; - } - } - - if (maxLen < 3) - maxLen = 3; - - offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), - distances + offset, maxLen) - (distances)); - MOVE_POS_RET -} - -/* -static UInt32 Hc5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -{ - UInt32 h2, h3, h4, d2, d3, d4, maxLen, offset, pos - UInt32 *hash; - GET_MATCHES_HEADER(5) - - HASH5_CALC; - - hash = p->hash; - pos = p->pos; - - d2 = pos - hash[ h2]; - d3 = pos - hash[kFix3HashSize + h3]; - d4 = pos - hash[kFix4HashSize + h4]; - - curMatch = hash[kFix5HashSize + hv]; - - hash[ h2] = pos; - hash[kFix3HashSize + h3] = pos; - hash[kFix4HashSize + h4] = pos; - hash[kFix5HashSize + hv] = pos; - - maxLen = 0; - offset = 0; - - if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur) - { - distances[0] = maxLen = 2; - distances[1] = d2 - 1; - offset = 2; - if (*(cur - d2 + 2) == cur[2]) - distances[0] = maxLen = 3; - else if (d3 < p->cyclicBufferSize && *(cur - d3) == *cur) - { - distances[2] = maxLen = 3; - distances[3] = d3 - 1; - offset = 4; - d2 = d3; - } - } - else if (d3 < p->cyclicBufferSize && *(cur - d3) == *cur) - { - distances[0] = maxLen = 3; - distances[1] = d3 - 1; - offset = 2; - d2 = d3; - } - - if (d2 != d4 && d4 < p->cyclicBufferSize - && *(cur - d4) == *cur - && *(cur - d4 + 3) == *(cur + 3)) - { - maxLen = 4; - distances[offset + 1] = d4 - 1; - offset += 2; - d2 = d4; - } - - if (offset != 0) - { - UPDATE_maxLen - distances[offset - 2] = maxLen; - if (maxLen == lenLimit) - { - p->son[p->cyclicBufferPos] = curMatch; - MOVE_POS_RET; - } - } - - if (maxLen < 4) - maxLen = 4; - - offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), - distances + offset, maxLen) - (distances)); - MOVE_POS_RET -} -*/ - -UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -{ - UInt32 offset; - GET_MATCHES_HEADER(3) - HASH_ZIP_CALC; - curMatch = p->hash[hv]; - p->hash[hv] = p->pos; - offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), - distances, 2) - (distances)); - MOVE_POS_RET -} - -static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -{ - do - { - SKIP_HEADER(2) - HASH2_CALC; - curMatch = p->hash[hv]; - p->hash[hv] = p->pos; - SKIP_FOOTER - } - while (--num != 0); -} - -void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -{ - do - { - SKIP_HEADER(3) - HASH_ZIP_CALC; - curMatch = p->hash[hv]; - p->hash[hv] = p->pos; - SKIP_FOOTER - } - while (--num != 0); -} - -static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -{ - do - { - UInt32 h2; - UInt32 *hash; - SKIP_HEADER(3) - HASH3_CALC; - hash = p->hash; - curMatch = hash[kFix3HashSize + hv]; - hash[h2] = - hash[kFix3HashSize + hv] = p->pos; - SKIP_FOOTER - } - while (--num != 0); -} - -static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -{ - do - { - UInt32 h2, h3; - UInt32 *hash; - SKIP_HEADER(4) - HASH4_CALC; - hash = p->hash; - curMatch = hash[kFix4HashSize + hv]; - hash[ h2] = - hash[kFix3HashSize + h3] = - hash[kFix4HashSize + hv] = p->pos; - SKIP_FOOTER - } - while (--num != 0); -} - -/* -static void Bt5_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -{ - do - { - UInt32 h2, h3, h4; - UInt32 *hash; - SKIP_HEADER(5) - HASH5_CALC; - hash = p->hash; - curMatch = hash[kFix5HashSize + hv]; - hash[ h2] = - hash[kFix3HashSize + h3] = - hash[kFix4HashSize + h4] = - hash[kFix5HashSize + hv] = p->pos; - SKIP_FOOTER - } - while (--num != 0); -} -*/ - -static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -{ - do - { - UInt32 h2, h3; - UInt32 *hash; - SKIP_HEADER(4) - HASH4_CALC; - hash = p->hash; - curMatch = hash[kFix4HashSize + hv]; - hash[ h2] = - hash[kFix3HashSize + h3] = - hash[kFix4HashSize + hv] = p->pos; - p->son[p->cyclicBufferPos] = curMatch; - MOVE_POS - } - while (--num != 0); -} - -/* -static void Hc5_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -{ - do - { - UInt32 h2, h3, h4; - UInt32 *hash; - SKIP_HEADER(5) - HASH5_CALC; - hash = p->hash; - curMatch = p->hash[kFix5HashSize + hv]; - hash[ h2] = - hash[kFix3HashSize + h3] = - hash[kFix4HashSize + h4] = - hash[kFix5HashSize + hv] = p->pos; - p->son[p->cyclicBufferPos] = curMatch; - MOVE_POS - } - while (--num != 0); -} -*/ - -void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -{ - do - { - SKIP_HEADER(3) - HASH_ZIP_CALC; - curMatch = p->hash[hv]; - p->hash[hv] = p->pos; - p->son[p->cyclicBufferPos] = curMatch; - MOVE_POS - } - while (--num != 0); -} - -void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable) -{ - vTable->Init = (Mf_Init_Func)MatchFinder_Init; - vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes; - vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos; - if (!p->btMode) - { - /* if (p->numHashBytes <= 4) */ - { - vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches; - vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip; - } - /* - else - { - vTable->GetMatches = (Mf_GetMatches_Func)Hc5_MatchFinder_GetMatches; - vTable->Skip = (Mf_Skip_Func)Hc5_MatchFinder_Skip; - } - */ - } - else if (p->numHashBytes == 2) - { - vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches; - vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip; - } - else if (p->numHashBytes == 3) - { - vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches; - vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip; - } - else /* if (p->numHashBytes == 4) */ - { - vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; - vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; - } - /* - else - { - vTable->GetMatches = (Mf_GetMatches_Func)Bt5_MatchFinder_GetMatches; - vTable->Skip = (Mf_Skip_Func)Bt5_MatchFinder_Skip; - } - */ -} +/* LzFind.c -- Match finder for LZ algorithms +2015-10-15 : Igor Pavlov : Public domain */ + +#include "Precomp.h" + +#include <string.h> + +#include "LzFind.h" +#include "LzHash.h" + +#define kEmptyHashValue 0 +#define kMaxValForNormalize ((UInt32)0xFFFFFFFF) +#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */ +#define kNormalizeMask (~(UInt32)(kNormalizeStepMin - 1)) +#define kMaxHistorySize ((UInt32)7 << 29) + +#define kStartMaxLen 3 + +static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc) +{ + if (!p->directInput) + { + alloc->Free(alloc, p->bufferBase); + p->bufferBase = NULL; + } +} + +/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */ + +static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc) +{ + UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv; + if (p->directInput) + { + p->blockSize = blockSize; + return 1; + } + if (!p->bufferBase || p->blockSize != blockSize) + { + LzInWindow_Free(p, alloc); + p->blockSize = blockSize; + p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize); + } + return (p->bufferBase != NULL); +} + +Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } + +UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } + +void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) +{ + p->posLimit -= subValue; + p->pos -= subValue; + p->streamPos -= subValue; +} + +static void MatchFinder_ReadBlock(CMatchFinder *p) +{ + if (p->streamEndWasReached || p->result != SZ_OK) + return; + + /* We use (p->streamPos - p->pos) value. (p->streamPos < p->pos) is allowed. */ + + if (p->directInput) + { + UInt32 curSize = 0xFFFFFFFF - (p->streamPos - p->pos); + if (curSize > p->directInputRem) + curSize = (UInt32)p->directInputRem; + p->directInputRem -= curSize; + p->streamPos += curSize; + if (p->directInputRem == 0) + p->streamEndWasReached = 1; + return; + } + + for (;;) + { + Byte *dest = p->buffer + (p->streamPos - p->pos); + size_t size = (p->bufferBase + p->blockSize - dest); + if (size == 0) + return; + + p->result = p->stream->Read(p->stream, dest, &size); + if (p->result != SZ_OK) + return; + if (size == 0) + { + p->streamEndWasReached = 1; + return; + } + p->streamPos += (UInt32)size; + if (p->streamPos - p->pos > p->keepSizeAfter) + return; + } +} + +void MatchFinder_MoveBlock(CMatchFinder *p) +{ + memmove(p->bufferBase, + p->buffer - p->keepSizeBefore, + (size_t)(p->streamPos - p->pos) + p->keepSizeBefore); + p->buffer = p->bufferBase + p->keepSizeBefore; +} + +int MatchFinder_NeedMove(CMatchFinder *p) +{ + if (p->directInput) + return 0; + /* if (p->streamEndWasReached) return 0; */ + return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter); +} + +void MatchFinder_ReadIfRequired(CMatchFinder *p) +{ + if (p->streamEndWasReached) + return; + if (p->keepSizeAfter >= p->streamPos - p->pos) + MatchFinder_ReadBlock(p); +} + +static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p) +{ + if (MatchFinder_NeedMove(p)) + MatchFinder_MoveBlock(p); + MatchFinder_ReadBlock(p); +} + +static void MatchFinder_SetDefaultSettings(CMatchFinder *p) +{ + p->cutValue = 32; + p->btMode = 1; + p->numHashBytes = 4; + p->bigHash = 0; +} + +#define kCrcPoly 0xEDB88320 + +void MatchFinder_Construct(CMatchFinder *p) +{ + UInt32 i; + p->bufferBase = NULL; + p->directInput = 0; + p->hash = NULL; + MatchFinder_SetDefaultSettings(p); + + for (i = 0; i < 256; i++) + { + UInt32 r = i; + unsigned j; + for (j = 0; j < 8; j++) + r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); + p->crc[i] = r; + } +} + +static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->hash); + p->hash = NULL; +} + +void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc) +{ + MatchFinder_FreeThisClassMemory(p, alloc); + LzInWindow_Free(p, alloc); +} + +static CLzRef* AllocRefs(size_t num, ISzAlloc *alloc) +{ + size_t sizeInBytes = (size_t)num * sizeof(CLzRef); + if (sizeInBytes / sizeof(CLzRef) != num) + return NULL; + return (CLzRef *)alloc->Alloc(alloc, sizeInBytes); +} + +int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, + UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, + ISzAlloc *alloc) +{ + UInt32 sizeReserv; + + if (historySize > kMaxHistorySize) + { + MatchFinder_Free(p, alloc); + return 0; + } + + sizeReserv = historySize >> 1; + if (historySize >= ((UInt32)3 << 30)) sizeReserv = historySize >> 3; + else if (historySize >= ((UInt32)2 << 30)) sizeReserv = historySize >> 2; + + sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19); + + p->keepSizeBefore = historySize + keepAddBufferBefore + 1; + p->keepSizeAfter = matchMaxLen + keepAddBufferAfter; + + /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */ + + if (LzInWindow_Create(p, sizeReserv, alloc)) + { + UInt32 newCyclicBufferSize = historySize + 1; + UInt32 hs; + p->matchMaxLen = matchMaxLen; + { + p->fixedHashSize = 0; + if (p->numHashBytes == 2) + hs = (1 << 16) - 1; + else + { + hs = historySize - 1; + hs |= (hs >> 1); + hs |= (hs >> 2); + hs |= (hs >> 4); + hs |= (hs >> 8); + hs >>= 1; + hs |= 0xFFFF; /* don't change it! It's required for Deflate */ + if (hs > (1 << 24)) + { + if (p->numHashBytes == 3) + hs = (1 << 24) - 1; + else + hs >>= 1; + /* if (bigHash) mode, GetHeads4b() in LzFindMt.c needs (hs >= ((1 << 24) - 1))) */ + } + } + p->hashMask = hs; + hs++; + if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size; + if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size; + if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size; + hs += p->fixedHashSize; + } + + { + size_t newSize; + size_t numSons; + p->historySize = historySize; + p->hashSizeSum = hs; + p->cyclicBufferSize = newCyclicBufferSize; + + numSons = newCyclicBufferSize; + if (p->btMode) + numSons <<= 1; + newSize = hs + numSons; + + if (p->hash && p->numRefs == newSize) + return 1; + + MatchFinder_FreeThisClassMemory(p, alloc); + p->numRefs = newSize; + p->hash = AllocRefs(newSize, alloc); + + if (p->hash) + { + p->son = p->hash + p->hashSizeSum; + return 1; + } + } + } + + MatchFinder_Free(p, alloc); + return 0; +} + +static void MatchFinder_SetLimits(CMatchFinder *p) +{ + UInt32 limit = kMaxValForNormalize - p->pos; + UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos; + + if (limit2 < limit) + limit = limit2; + limit2 = p->streamPos - p->pos; + + if (limit2 <= p->keepSizeAfter) + { + if (limit2 > 0) + limit2 = 1; + } + else + limit2 -= p->keepSizeAfter; + + if (limit2 < limit) + limit = limit2; + + { + UInt32 lenLimit = p->streamPos - p->pos; + if (lenLimit > p->matchMaxLen) + lenLimit = p->matchMaxLen; + p->lenLimit = lenLimit; + } + p->posLimit = p->pos + limit; +} + +void MatchFinder_Init_2(CMatchFinder *p, int readData) +{ + UInt32 i; + UInt32 *hash = p->hash; + UInt32 num = p->hashSizeSum; + for (i = 0; i < num; i++) + hash[i] = kEmptyHashValue; + + p->cyclicBufferPos = 0; + p->buffer = p->bufferBase; + p->pos = p->streamPos = p->cyclicBufferSize; + p->result = SZ_OK; + p->streamEndWasReached = 0; + + if (readData) + MatchFinder_ReadBlock(p); + + MatchFinder_SetLimits(p); +} + +void MatchFinder_Init(CMatchFinder *p) +{ + MatchFinder_Init_2(p, True); +} + +static UInt32 MatchFinder_GetSubValue(CMatchFinder *p) +{ + return (p->pos - p->historySize - 1) & kNormalizeMask; +} + +void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems) +{ + size_t i; + for (i = 0; i < numItems; i++) + { + UInt32 value = items[i]; + if (value <= subValue) + value = kEmptyHashValue; + else + value -= subValue; + items[i] = value; + } +} + +static void MatchFinder_Normalize(CMatchFinder *p) +{ + UInt32 subValue = MatchFinder_GetSubValue(p); + MatchFinder_Normalize3(subValue, p->hash, p->numRefs); + MatchFinder_ReduceOffsets(p, subValue); +} + +static void MatchFinder_CheckLimits(CMatchFinder *p) +{ + if (p->pos == kMaxValForNormalize) + MatchFinder_Normalize(p); + if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos) + MatchFinder_CheckAndMoveAndRead(p); + if (p->cyclicBufferPos == p->cyclicBufferSize) + p->cyclicBufferPos = 0; + MatchFinder_SetLimits(p); +} + +static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, + UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, + UInt32 *distances, UInt32 maxLen) +{ + son[_cyclicBufferPos] = curMatch; + for (;;) + { + UInt32 delta = pos - curMatch; + if (cutValue-- == 0 || delta >= _cyclicBufferSize) + return distances; + { + const Byte *pb = cur - delta; + curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; + if (pb[maxLen] == cur[maxLen] && *pb == *cur) + { + UInt32 len = 0; + while (++len != lenLimit) + if (pb[len] != cur[len]) + break; + if (maxLen < len) + { + *distances++ = maxLen = len; + *distances++ = delta - 1; + if (len == lenLimit) + return distances; + } + } + } + } +} + +UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, + UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, + UInt32 *distances, UInt32 maxLen) +{ + CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; + CLzRef *ptr1 = son + (_cyclicBufferPos << 1); + UInt32 len0 = 0, len1 = 0; + for (;;) + { + UInt32 delta = pos - curMatch; + if (cutValue-- == 0 || delta >= _cyclicBufferSize) + { + *ptr0 = *ptr1 = kEmptyHashValue; + return distances; + } + { + CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); + const Byte *pb = cur - delta; + UInt32 len = (len0 < len1 ? len0 : len1); + if (pb[len] == cur[len]) + { + if (++len != lenLimit && pb[len] == cur[len]) + while (++len != lenLimit) + if (pb[len] != cur[len]) + break; + if (maxLen < len) + { + *distances++ = maxLen = len; + *distances++ = delta - 1; + if (len == lenLimit) + { + *ptr1 = pair[0]; + *ptr0 = pair[1]; + return distances; + } + } + } + if (pb[len] < cur[len]) + { + *ptr1 = curMatch; + ptr1 = pair + 1; + curMatch = *ptr1; + len1 = len; + } + else + { + *ptr0 = curMatch; + ptr0 = pair; + curMatch = *ptr0; + len0 = len; + } + } + } +} + +static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, + UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue) +{ + CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; + CLzRef *ptr1 = son + (_cyclicBufferPos << 1); + UInt32 len0 = 0, len1 = 0; + for (;;) + { + UInt32 delta = pos - curMatch; + if (cutValue-- == 0 || delta >= _cyclicBufferSize) + { + *ptr0 = *ptr1 = kEmptyHashValue; + return; + } + { + CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); + const Byte *pb = cur - delta; + UInt32 len = (len0 < len1 ? len0 : len1); + if (pb[len] == cur[len]) + { + while (++len != lenLimit) + if (pb[len] != cur[len]) + break; + { + if (len == lenLimit) + { + *ptr1 = pair[0]; + *ptr0 = pair[1]; + return; + } + } + } + if (pb[len] < cur[len]) + { + *ptr1 = curMatch; + ptr1 = pair + 1; + curMatch = *ptr1; + len1 = len; + } + else + { + *ptr0 = curMatch; + ptr0 = pair; + curMatch = *ptr0; + len0 = len; + } + } + } +} + +#define MOVE_POS \ + ++p->cyclicBufferPos; \ + p->buffer++; \ + if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); + +#define MOVE_POS_RET MOVE_POS return offset; + +static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } + +#define GET_MATCHES_HEADER2(minLen, ret_op) \ + UInt32 lenLimit; UInt32 hv; const Byte *cur; UInt32 curMatch; \ + lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ + cur = p->buffer; + +#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0) +#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue) + +#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue + +#define GET_MATCHES_FOOTER(offset, maxLen) \ + offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \ + distances + offset, maxLen) - distances); MOVE_POS_RET; + +#define SKIP_FOOTER \ + SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; + +#define UPDATE_maxLen { \ + ptrdiff_t diff = (ptrdiff_t)0 - d2; \ + const Byte *c = cur + maxLen; \ + const Byte *lim = cur + lenLimit; \ + for (; c != lim; c++) if (*(c + diff) != *c) break; \ + maxLen = (UInt32)(c - cur); } + +static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 offset; + GET_MATCHES_HEADER(2) + HASH2_CALC; + curMatch = p->hash[hv]; + p->hash[hv] = p->pos; + offset = 0; + GET_MATCHES_FOOTER(offset, 1) +} + +UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 offset; + GET_MATCHES_HEADER(3) + HASH_ZIP_CALC; + curMatch = p->hash[hv]; + p->hash[hv] = p->pos; + offset = 0; + GET_MATCHES_FOOTER(offset, 2) +} + +static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 h2, d2, maxLen, offset, pos; + UInt32 *hash; + GET_MATCHES_HEADER(3) + + HASH3_CALC; + + hash = p->hash; + pos = p->pos; + + d2 = pos - hash[h2]; + + curMatch = hash[kFix3HashSize + hv]; + + hash[h2] = pos; + hash[kFix3HashSize + hv] = pos; + + maxLen = 2; + offset = 0; + + if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur) + { + UPDATE_maxLen + distances[0] = maxLen; + distances[1] = d2 - 1; + offset = 2; + if (maxLen == lenLimit) + { + SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); + MOVE_POS_RET; + } + } + + GET_MATCHES_FOOTER(offset, maxLen) +} + +static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 h2, h3, d2, d3, maxLen, offset, pos; + UInt32 *hash; + GET_MATCHES_HEADER(4) + + HASH4_CALC; + + hash = p->hash; + pos = p->pos; + + d2 = pos - hash[ h2]; + d3 = pos - hash[kFix3HashSize + h3]; + + curMatch = hash[kFix4HashSize + hv]; + + hash[ h2] = pos; + hash[kFix3HashSize + h3] = pos; + hash[kFix4HashSize + hv] = pos; + + maxLen = 0; + offset = 0; + + if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur) + { + distances[0] = maxLen = 2; + distances[1] = d2 - 1; + offset = 2; + } + + if (d2 != d3 && d3 < p->cyclicBufferSize && *(cur - d3) == *cur) + { + maxLen = 3; + distances[offset + 1] = d3 - 1; + offset += 2; + d2 = d3; + } + + if (offset != 0) + { + UPDATE_maxLen + distances[offset - 2] = maxLen; + if (maxLen == lenLimit) + { + SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); + MOVE_POS_RET; + } + } + + if (maxLen < 3) + maxLen = 3; + + GET_MATCHES_FOOTER(offset, maxLen) +} + +/* +static UInt32 Bt5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 h2, h3, h4, d2, d3, d4, maxLen, offset, pos; + UInt32 *hash; + GET_MATCHES_HEADER(5) + + HASH5_CALC; + + hash = p->hash; + pos = p->pos; + + d2 = pos - hash[ h2]; + d3 = pos - hash[kFix3HashSize + h3]; + d4 = pos - hash[kFix4HashSize + h4]; + + curMatch = hash[kFix5HashSize + hv]; + + hash[ h2] = pos; + hash[kFix3HashSize + h3] = pos; + hash[kFix4HashSize + h4] = pos; + hash[kFix5HashSize + hv] = pos; + + maxLen = 0; + offset = 0; + + if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur) + { + distances[0] = maxLen = 2; + distances[1] = d2 - 1; + offset = 2; + if (*(cur - d2 + 2) == cur[2]) + distances[0] = maxLen = 3; + else if (d3 < p->cyclicBufferSize && *(cur - d3) == *cur) + { + distances[2] = maxLen = 3; + distances[3] = d3 - 1; + offset = 4; + d2 = d3; + } + } + else if (d3 < p->cyclicBufferSize && *(cur - d3) == *cur) + { + distances[0] = maxLen = 3; + distances[1] = d3 - 1; + offset = 2; + d2 = d3; + } + + if (d2 != d4 && d4 < p->cyclicBufferSize + && *(cur - d4) == *cur + && *(cur - d4 + 3) == *(cur + 3)) + { + maxLen = 4; + distances[offset + 1] = d4 - 1; + offset += 2; + d2 = d4; + } + + if (offset != 0) + { + UPDATE_maxLen + distances[offset - 2] = maxLen; + if (maxLen == lenLimit) + { + SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); + MOVE_POS_RET; + } + } + + if (maxLen < 4) + maxLen = 4; + + GET_MATCHES_FOOTER(offset, maxLen) +} +*/ + +static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 h2, h3, d2, d3, maxLen, offset, pos; + UInt32 *hash; + GET_MATCHES_HEADER(4) + + HASH4_CALC; + + hash = p->hash; + pos = p->pos; + + d2 = pos - hash[ h2]; + d3 = pos - hash[kFix3HashSize + h3]; + + curMatch = hash[kFix4HashSize + hv]; + + hash[ h2] = pos; + hash[kFix3HashSize + h3] = pos; + hash[kFix4HashSize + hv] = pos; + + maxLen = 0; + offset = 0; + + if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur) + { + distances[0] = maxLen = 2; + distances[1] = d2 - 1; + offset = 2; + } + + if (d2 != d3 && d3 < p->cyclicBufferSize && *(cur - d3) == *cur) + { + maxLen = 3; + distances[offset + 1] = d3 - 1; + offset += 2; + d2 = d3; + } + + if (offset != 0) + { + UPDATE_maxLen + distances[offset - 2] = maxLen; + if (maxLen == lenLimit) + { + p->son[p->cyclicBufferPos] = curMatch; + MOVE_POS_RET; + } + } + + if (maxLen < 3) + maxLen = 3; + + offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), + distances + offset, maxLen) - (distances)); + MOVE_POS_RET +} + +/* +static UInt32 Hc5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 h2, h3, h4, d2, d3, d4, maxLen, offset, pos + UInt32 *hash; + GET_MATCHES_HEADER(5) + + HASH5_CALC; + + hash = p->hash; + pos = p->pos; + + d2 = pos - hash[ h2]; + d3 = pos - hash[kFix3HashSize + h3]; + d4 = pos - hash[kFix4HashSize + h4]; + + curMatch = hash[kFix5HashSize + hv]; + + hash[ h2] = pos; + hash[kFix3HashSize + h3] = pos; + hash[kFix4HashSize + h4] = pos; + hash[kFix5HashSize + hv] = pos; + + maxLen = 0; + offset = 0; + + if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur) + { + distances[0] = maxLen = 2; + distances[1] = d2 - 1; + offset = 2; + if (*(cur - d2 + 2) == cur[2]) + distances[0] = maxLen = 3; + else if (d3 < p->cyclicBufferSize && *(cur - d3) == *cur) + { + distances[2] = maxLen = 3; + distances[3] = d3 - 1; + offset = 4; + d2 = d3; + } + } + else if (d3 < p->cyclicBufferSize && *(cur - d3) == *cur) + { + distances[0] = maxLen = 3; + distances[1] = d3 - 1; + offset = 2; + d2 = d3; + } + + if (d2 != d4 && d4 < p->cyclicBufferSize + && *(cur - d4) == *cur + && *(cur - d4 + 3) == *(cur + 3)) + { + maxLen = 4; + distances[offset + 1] = d4 - 1; + offset += 2; + d2 = d4; + } + + if (offset != 0) + { + UPDATE_maxLen + distances[offset - 2] = maxLen; + if (maxLen == lenLimit) + { + p->son[p->cyclicBufferPos] = curMatch; + MOVE_POS_RET; + } + } + + if (maxLen < 4) + maxLen = 4; + + offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), + distances + offset, maxLen) - (distances)); + MOVE_POS_RET +} +*/ + +UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 offset; + GET_MATCHES_HEADER(3) + HASH_ZIP_CALC; + curMatch = p->hash[hv]; + p->hash[hv] = p->pos; + offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), + distances, 2) - (distances)); + MOVE_POS_RET +} + +static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + SKIP_HEADER(2) + HASH2_CALC; + curMatch = p->hash[hv]; + p->hash[hv] = p->pos; + SKIP_FOOTER + } + while (--num != 0); +} + +void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + SKIP_HEADER(3) + HASH_ZIP_CALC; + curMatch = p->hash[hv]; + p->hash[hv] = p->pos; + SKIP_FOOTER + } + while (--num != 0); +} + +static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + UInt32 h2; + UInt32 *hash; + SKIP_HEADER(3) + HASH3_CALC; + hash = p->hash; + curMatch = hash[kFix3HashSize + hv]; + hash[h2] = + hash[kFix3HashSize + hv] = p->pos; + SKIP_FOOTER + } + while (--num != 0); +} + +static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + UInt32 h2, h3; + UInt32 *hash; + SKIP_HEADER(4) + HASH4_CALC; + hash = p->hash; + curMatch = hash[kFix4HashSize + hv]; + hash[ h2] = + hash[kFix3HashSize + h3] = + hash[kFix4HashSize + hv] = p->pos; + SKIP_FOOTER + } + while (--num != 0); +} + +/* +static void Bt5_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + UInt32 h2, h3, h4; + UInt32 *hash; + SKIP_HEADER(5) + HASH5_CALC; + hash = p->hash; + curMatch = hash[kFix5HashSize + hv]; + hash[ h2] = + hash[kFix3HashSize + h3] = + hash[kFix4HashSize + h4] = + hash[kFix5HashSize + hv] = p->pos; + SKIP_FOOTER + } + while (--num != 0); +} +*/ + +static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + UInt32 h2, h3; + UInt32 *hash; + SKIP_HEADER(4) + HASH4_CALC; + hash = p->hash; + curMatch = hash[kFix4HashSize + hv]; + hash[ h2] = + hash[kFix3HashSize + h3] = + hash[kFix4HashSize + hv] = p->pos; + p->son[p->cyclicBufferPos] = curMatch; + MOVE_POS + } + while (--num != 0); +} + +/* +static void Hc5_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + UInt32 h2, h3, h4; + UInt32 *hash; + SKIP_HEADER(5) + HASH5_CALC; + hash = p->hash; + curMatch = p->hash[kFix5HashSize + hv]; + hash[ h2] = + hash[kFix3HashSize + h3] = + hash[kFix4HashSize + h4] = + hash[kFix5HashSize + hv] = p->pos; + p->son[p->cyclicBufferPos] = curMatch; + MOVE_POS + } + while (--num != 0); +} +*/ + +void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + SKIP_HEADER(3) + HASH_ZIP_CALC; + curMatch = p->hash[hv]; + p->hash[hv] = p->pos; + p->son[p->cyclicBufferPos] = curMatch; + MOVE_POS + } + while (--num != 0); +} + +void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable) +{ + vTable->Init = (Mf_Init_Func)MatchFinder_Init; + vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes; + vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos; + if (!p->btMode) + { + /* if (p->numHashBytes <= 4) */ + { + vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches; + vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip; + } + /* + else + { + vTable->GetMatches = (Mf_GetMatches_Func)Hc5_MatchFinder_GetMatches; + vTable->Skip = (Mf_Skip_Func)Hc5_MatchFinder_Skip; + } + */ + } + else if (p->numHashBytes == 2) + { + vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches; + vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip; + } + else if (p->numHashBytes == 3) + { + vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches; + vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip; + } + else /* if (p->numHashBytes == 4) */ + { + vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; + vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; + } + /* + else + { + vTable->GetMatches = (Mf_GetMatches_Func)Bt5_MatchFinder_GetMatches; + vTable->Skip = (Mf_Skip_Func)Bt5_MatchFinder_Skip; + } + */ +} diff --git a/src/lzma/Lzma2Dec.c b/src/lzma/Lzma2Dec.c index b6884571c2..d44d25e432 100644 --- a/src/lzma/Lzma2Dec.c +++ b/src/lzma/Lzma2Dec.c @@ -1,378 +1,378 @@ -/* Lzma2Dec.c -- LZMA2 Decoder -2015-11-09 : Igor Pavlov : Public domain */ - -/* #define SHOW_DEBUG_INFO */ - -#include "Precomp.h" - -#ifdef SHOW_DEBUG_INFO -#include <stdio.h> -#endif - -#include <string.h> - -#include "Lzma2Dec.h" - -/* -00000000 - EOS -00000001 U U - Uncompressed Reset Dic -00000010 U U - Uncompressed No Reset -100uuuuu U U P P - LZMA no reset -101uuuuu U U P P - LZMA reset state -110uuuuu U U P P S - LZMA reset state + new prop -111uuuuu U U P P S - LZMA reset state + new prop + reset dic - - u, U - Unpack Size - P - Pack Size - S - Props -*/ - -#define LZMA2_CONTROL_LZMA (1 << 7) -#define LZMA2_CONTROL_COPY_NO_RESET 2 -#define LZMA2_CONTROL_COPY_RESET_DIC 1 -#define LZMA2_CONTROL_EOF 0 - -#define LZMA2_IS_UNCOMPRESSED_STATE(p) (((p)->control & LZMA2_CONTROL_LZMA) == 0) - -#define LZMA2_GET_LZMA_MODE(p) (((p)->control >> 5) & 3) -#define LZMA2_IS_THERE_PROP(mode) ((mode) >= 2) - -#define LZMA2_LCLP_MAX 4 -#define LZMA2_DIC_SIZE_FROM_PROP(p) (((UInt32)2 | ((p) & 1)) << ((p) / 2 + 11)) - -#ifdef SHOW_DEBUG_INFO -#define PRF(x) x -#else -#define PRF(x) -#endif - -typedef enum -{ - LZMA2_STATE_CONTROL, - LZMA2_STATE_UNPACK0, - LZMA2_STATE_UNPACK1, - LZMA2_STATE_PACK0, - LZMA2_STATE_PACK1, - LZMA2_STATE_PROP, - LZMA2_STATE_DATA, - LZMA2_STATE_DATA_CONT, - LZMA2_STATE_FINISHED, - LZMA2_STATE_ERROR -} ELzma2State; - -static SRes Lzma2Dec_GetOldProps(Byte prop, Byte *props) -{ - UInt32 dicSize; - if (prop > 40) - return SZ_ERROR_UNSUPPORTED; - dicSize = (prop == 40) ? 0xFFFFFFFF : LZMA2_DIC_SIZE_FROM_PROP(prop); - props[0] = (Byte)LZMA2_LCLP_MAX; - props[1] = (Byte)(dicSize); - props[2] = (Byte)(dicSize >> 8); - props[3] = (Byte)(dicSize >> 16); - props[4] = (Byte)(dicSize >> 24); - return SZ_OK; -} - -SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAlloc *alloc) -{ - Byte props[LZMA_PROPS_SIZE]; - RINOK(Lzma2Dec_GetOldProps(prop, props)); - return LzmaDec_AllocateProbs(&p->decoder, props, LZMA_PROPS_SIZE, alloc); -} - -SRes Lzma2Dec_Allocate(CLzma2Dec *p, Byte prop, ISzAlloc *alloc) -{ - Byte props[LZMA_PROPS_SIZE]; - RINOK(Lzma2Dec_GetOldProps(prop, props)); - return LzmaDec_Allocate(&p->decoder, props, LZMA_PROPS_SIZE, alloc); -} - -void Lzma2Dec_Init(CLzma2Dec *p) -{ - p->state = LZMA2_STATE_CONTROL; - p->needInitDic = True; - p->needInitState = True; - p->needInitProp = True; - LzmaDec_Init(&p->decoder); -} - -static ELzma2State Lzma2Dec_UpdateState(CLzma2Dec *p, Byte b) -{ - switch (p->state) - { - case LZMA2_STATE_CONTROL: - p->control = b; - PRF(printf("\n %4X ", (unsigned)p->decoder.dicPos)); - PRF(printf(" %2X", (unsigned)b)); - if (p->control == 0) - return LZMA2_STATE_FINISHED; - if (LZMA2_IS_UNCOMPRESSED_STATE(p)) - { - if ((p->control & 0x7F) > 2) - return LZMA2_STATE_ERROR; - p->unpackSize = 0; - } - else - p->unpackSize = (UInt32)(p->control & 0x1F) << 16; - return LZMA2_STATE_UNPACK0; - - case LZMA2_STATE_UNPACK0: - p->unpackSize |= (UInt32)b << 8; - return LZMA2_STATE_UNPACK1; - - case LZMA2_STATE_UNPACK1: - p->unpackSize |= (UInt32)b; - p->unpackSize++; - PRF(printf(" %8u", (unsigned)p->unpackSize)); - return (LZMA2_IS_UNCOMPRESSED_STATE(p)) ? LZMA2_STATE_DATA : LZMA2_STATE_PACK0; - - case LZMA2_STATE_PACK0: - p->packSize = (UInt32)b << 8; - return LZMA2_STATE_PACK1; - - case LZMA2_STATE_PACK1: - p->packSize |= (UInt32)b; - p->packSize++; - PRF(printf(" %8u", (unsigned)p->packSize)); - return LZMA2_IS_THERE_PROP(LZMA2_GET_LZMA_MODE(p)) ? LZMA2_STATE_PROP: - (p->needInitProp ? LZMA2_STATE_ERROR : LZMA2_STATE_DATA); - - case LZMA2_STATE_PROP: - { - unsigned lc, lp; - if (b >= (9 * 5 * 5)) - return LZMA2_STATE_ERROR; - lc = b % 9; - b /= 9; - p->decoder.prop.pb = b / 5; - lp = b % 5; - if (lc + lp > LZMA2_LCLP_MAX) - return LZMA2_STATE_ERROR; - p->decoder.prop.lc = lc; - p->decoder.prop.lp = lp; - p->needInitProp = False; - return LZMA2_STATE_DATA; - } - } - return LZMA2_STATE_ERROR; -} - -static void LzmaDec_UpdateWithUncompressed(CLzmaDec *p, const Byte *src, SizeT size) -{ - memcpy(p->dic + p->dicPos, src, size); - p->dicPos += size; - if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= size) - p->checkDicSize = p->prop.dicSize; - p->processedPos += (UInt32)size; -} - -void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState); - -SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit, - const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) -{ - SizeT inSize = *srcLen; - *srcLen = 0; - *status = LZMA_STATUS_NOT_SPECIFIED; - - while (p->state != LZMA2_STATE_FINISHED) - { - SizeT dicPos = p->decoder.dicPos; - - if (p->state == LZMA2_STATE_ERROR) - return SZ_ERROR_DATA; - - if (dicPos == dicLimit && finishMode == LZMA_FINISH_ANY) - { - *status = LZMA_STATUS_NOT_FINISHED; - return SZ_OK; - } - - if (p->state != LZMA2_STATE_DATA && p->state != LZMA2_STATE_DATA_CONT) - { - if (*srcLen == inSize) - { - *status = LZMA_STATUS_NEEDS_MORE_INPUT; - return SZ_OK; - } - (*srcLen)++; - p->state = Lzma2Dec_UpdateState(p, *src++); - - if (dicPos == dicLimit && p->state != LZMA2_STATE_FINISHED) - { - p->state = LZMA2_STATE_ERROR; - return SZ_ERROR_DATA; - } - continue; - } - - { - SizeT destSizeCur = dicLimit - dicPos; - SizeT srcSizeCur = inSize - *srcLen; - ELzmaFinishMode curFinishMode = LZMA_FINISH_ANY; - - if (p->unpackSize <= destSizeCur) - { - destSizeCur = (SizeT)p->unpackSize; - curFinishMode = LZMA_FINISH_END; - } - - if (LZMA2_IS_UNCOMPRESSED_STATE(p)) - { - if (*srcLen == inSize) - { - *status = LZMA_STATUS_NEEDS_MORE_INPUT; - return SZ_OK; - } - - if (p->state == LZMA2_STATE_DATA) - { - Bool initDic = (p->control == LZMA2_CONTROL_COPY_RESET_DIC); - if (initDic) - p->needInitProp = p->needInitState = True; - else if (p->needInitDic) - { - p->state = LZMA2_STATE_ERROR; - return SZ_ERROR_DATA; - } - p->needInitDic = False; - LzmaDec_InitDicAndState(&p->decoder, initDic, False); - } - - if (srcSizeCur > destSizeCur) - srcSizeCur = destSizeCur; - - if (srcSizeCur == 0) - { - p->state = LZMA2_STATE_ERROR; - return SZ_ERROR_DATA; - } - - LzmaDec_UpdateWithUncompressed(&p->decoder, src, srcSizeCur); - - src += srcSizeCur; - *srcLen += srcSizeCur; - p->unpackSize -= (UInt32)srcSizeCur; - p->state = (p->unpackSize == 0) ? LZMA2_STATE_CONTROL : LZMA2_STATE_DATA_CONT; - } - else - { - SizeT outSizeProcessed; - SRes res; - - if (p->state == LZMA2_STATE_DATA) - { - unsigned mode = LZMA2_GET_LZMA_MODE(p); - Bool initDic = (mode == 3); - Bool initState = (mode != 0); - if ((!initDic && p->needInitDic) || (!initState && p->needInitState)) - { - p->state = LZMA2_STATE_ERROR; - return SZ_ERROR_DATA; - } - - LzmaDec_InitDicAndState(&p->decoder, initDic, initState); - p->needInitDic = False; - p->needInitState = False; - p->state = LZMA2_STATE_DATA_CONT; - } - - if (srcSizeCur > p->packSize) - srcSizeCur = (SizeT)p->packSize; - - res = LzmaDec_DecodeToDic(&p->decoder, dicPos + destSizeCur, src, &srcSizeCur, curFinishMode, status); - - src += srcSizeCur; - *srcLen += srcSizeCur; - p->packSize -= (UInt32)srcSizeCur; - - outSizeProcessed = p->decoder.dicPos - dicPos; - p->unpackSize -= (UInt32)outSizeProcessed; - - RINOK(res); - if (*status == LZMA_STATUS_NEEDS_MORE_INPUT) - return res; - - if (srcSizeCur == 0 && outSizeProcessed == 0) - { - if (*status != LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK - || p->unpackSize != 0 - || p->packSize != 0) - { - p->state = LZMA2_STATE_ERROR; - return SZ_ERROR_DATA; - } - p->state = LZMA2_STATE_CONTROL; - } - - if (*status == LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK) - *status = LZMA_STATUS_NOT_FINISHED; - } - } - } - - *status = LZMA_STATUS_FINISHED_WITH_MARK; - return SZ_OK; -} - -SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) -{ - SizeT outSize = *destLen, inSize = *srcLen; - *srcLen = *destLen = 0; - for (;;) - { - SizeT srcSizeCur = inSize, outSizeCur, dicPos; - ELzmaFinishMode curFinishMode; - SRes res; - if (p->decoder.dicPos == p->decoder.dicBufSize) - p->decoder.dicPos = 0; - dicPos = p->decoder.dicPos; - if (outSize > p->decoder.dicBufSize - dicPos) - { - outSizeCur = p->decoder.dicBufSize; - curFinishMode = LZMA_FINISH_ANY; - } - else - { - outSizeCur = dicPos + outSize; - curFinishMode = finishMode; - } - - res = Lzma2Dec_DecodeToDic(p, outSizeCur, src, &srcSizeCur, curFinishMode, status); - src += srcSizeCur; - inSize -= srcSizeCur; - *srcLen += srcSizeCur; - outSizeCur = p->decoder.dicPos - dicPos; - memcpy(dest, p->decoder.dic + dicPos, outSizeCur); - dest += outSizeCur; - outSize -= outSizeCur; - *destLen += outSizeCur; - if (res != 0) - return res; - if (outSizeCur == 0 || outSize == 0) - return SZ_OK; - } -} - -SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, - Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc) -{ - CLzma2Dec p; - SRes res; - SizeT outSize = *destLen, inSize = *srcLen; - *destLen = *srcLen = 0; - *status = LZMA_STATUS_NOT_SPECIFIED; - Lzma2Dec_Construct(&p); - RINOK(Lzma2Dec_AllocateProbs(&p, prop, alloc)); - p.decoder.dic = dest; - p.decoder.dicBufSize = outSize; - Lzma2Dec_Init(&p); - *srcLen = inSize; - res = Lzma2Dec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); - *destLen = p.decoder.dicPos; - if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) - res = SZ_ERROR_INPUT_EOF; - Lzma2Dec_FreeProbs(&p, alloc); - return res; -} +/* Lzma2Dec.c -- LZMA2 Decoder +2015-11-09 : Igor Pavlov : Public domain */ + +/* #define SHOW_DEBUG_INFO */ + +#include "Precomp.h" + +#ifdef SHOW_DEBUG_INFO +#include <stdio.h> +#endif + +#include <string.h> + +#include "Lzma2Dec.h" + +/* +00000000 - EOS +00000001 U U - Uncompressed Reset Dic +00000010 U U - Uncompressed No Reset +100uuuuu U U P P - LZMA no reset +101uuuuu U U P P - LZMA reset state +110uuuuu U U P P S - LZMA reset state + new prop +111uuuuu U U P P S - LZMA reset state + new prop + reset dic + + u, U - Unpack Size + P - Pack Size + S - Props +*/ + +#define LZMA2_CONTROL_LZMA (1 << 7) +#define LZMA2_CONTROL_COPY_NO_RESET 2 +#define LZMA2_CONTROL_COPY_RESET_DIC 1 +#define LZMA2_CONTROL_EOF 0 + +#define LZMA2_IS_UNCOMPRESSED_STATE(p) (((p)->control & LZMA2_CONTROL_LZMA) == 0) + +#define LZMA2_GET_LZMA_MODE(p) (((p)->control >> 5) & 3) +#define LZMA2_IS_THERE_PROP(mode) ((mode) >= 2) + +#define LZMA2_LCLP_MAX 4 +#define LZMA2_DIC_SIZE_FROM_PROP(p) (((UInt32)2 | ((p) & 1)) << ((p) / 2 + 11)) + +#ifdef SHOW_DEBUG_INFO +#define PRF(x) x +#else +#define PRF(x) +#endif + +typedef enum +{ + LZMA2_STATE_CONTROL, + LZMA2_STATE_UNPACK0, + LZMA2_STATE_UNPACK1, + LZMA2_STATE_PACK0, + LZMA2_STATE_PACK1, + LZMA2_STATE_PROP, + LZMA2_STATE_DATA, + LZMA2_STATE_DATA_CONT, + LZMA2_STATE_FINISHED, + LZMA2_STATE_ERROR +} ELzma2State; + +static SRes Lzma2Dec_GetOldProps(Byte prop, Byte *props) +{ + UInt32 dicSize; + if (prop > 40) + return SZ_ERROR_UNSUPPORTED; + dicSize = (prop == 40) ? 0xFFFFFFFF : LZMA2_DIC_SIZE_FROM_PROP(prop); + props[0] = (Byte)LZMA2_LCLP_MAX; + props[1] = (Byte)(dicSize); + props[2] = (Byte)(dicSize >> 8); + props[3] = (Byte)(dicSize >> 16); + props[4] = (Byte)(dicSize >> 24); + return SZ_OK; +} + +SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAlloc *alloc) +{ + Byte props[LZMA_PROPS_SIZE]; + RINOK(Lzma2Dec_GetOldProps(prop, props)); + return LzmaDec_AllocateProbs(&p->decoder, props, LZMA_PROPS_SIZE, alloc); +} + +SRes Lzma2Dec_Allocate(CLzma2Dec *p, Byte prop, ISzAlloc *alloc) +{ + Byte props[LZMA_PROPS_SIZE]; + RINOK(Lzma2Dec_GetOldProps(prop, props)); + return LzmaDec_Allocate(&p->decoder, props, LZMA_PROPS_SIZE, alloc); +} + +void Lzma2Dec_Init(CLzma2Dec *p) +{ + p->state = LZMA2_STATE_CONTROL; + p->needInitDic = True; + p->needInitState = True; + p->needInitProp = True; + LzmaDec_Init(&p->decoder); +} + +static ELzma2State Lzma2Dec_UpdateState(CLzma2Dec *p, Byte b) +{ + switch (p->state) + { + case LZMA2_STATE_CONTROL: + p->control = b; + PRF(printf("\n %4X ", (unsigned)p->decoder.dicPos)); + PRF(printf(" %2X", (unsigned)b)); + if (p->control == 0) + return LZMA2_STATE_FINISHED; + if (LZMA2_IS_UNCOMPRESSED_STATE(p)) + { + if ((p->control & 0x7F) > 2) + return LZMA2_STATE_ERROR; + p->unpackSize = 0; + } + else + p->unpackSize = (UInt32)(p->control & 0x1F) << 16; + return LZMA2_STATE_UNPACK0; + + case LZMA2_STATE_UNPACK0: + p->unpackSize |= (UInt32)b << 8; + return LZMA2_STATE_UNPACK1; + + case LZMA2_STATE_UNPACK1: + p->unpackSize |= (UInt32)b; + p->unpackSize++; + PRF(printf(" %8u", (unsigned)p->unpackSize)); + return (LZMA2_IS_UNCOMPRESSED_STATE(p)) ? LZMA2_STATE_DATA : LZMA2_STATE_PACK0; + + case LZMA2_STATE_PACK0: + p->packSize = (UInt32)b << 8; + return LZMA2_STATE_PACK1; + + case LZMA2_STATE_PACK1: + p->packSize |= (UInt32)b; + p->packSize++; + PRF(printf(" %8u", (unsigned)p->packSize)); + return LZMA2_IS_THERE_PROP(LZMA2_GET_LZMA_MODE(p)) ? LZMA2_STATE_PROP: + (p->needInitProp ? LZMA2_STATE_ERROR : LZMA2_STATE_DATA); + + case LZMA2_STATE_PROP: + { + unsigned lc, lp; + if (b >= (9 * 5 * 5)) + return LZMA2_STATE_ERROR; + lc = b % 9; + b /= 9; + p->decoder.prop.pb = b / 5; + lp = b % 5; + if (lc + lp > LZMA2_LCLP_MAX) + return LZMA2_STATE_ERROR; + p->decoder.prop.lc = lc; + p->decoder.prop.lp = lp; + p->needInitProp = False; + return LZMA2_STATE_DATA; + } + } + return LZMA2_STATE_ERROR; +} + +static void LzmaDec_UpdateWithUncompressed(CLzmaDec *p, const Byte *src, SizeT size) +{ + memcpy(p->dic + p->dicPos, src, size); + p->dicPos += size; + if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= size) + p->checkDicSize = p->prop.dicSize; + p->processedPos += (UInt32)size; +} + +void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState); + +SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit, + const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) +{ + SizeT inSize = *srcLen; + *srcLen = 0; + *status = LZMA_STATUS_NOT_SPECIFIED; + + while (p->state != LZMA2_STATE_FINISHED) + { + SizeT dicPos = p->decoder.dicPos; + + if (p->state == LZMA2_STATE_ERROR) + return SZ_ERROR_DATA; + + if (dicPos == dicLimit && finishMode == LZMA_FINISH_ANY) + { + *status = LZMA_STATUS_NOT_FINISHED; + return SZ_OK; + } + + if (p->state != LZMA2_STATE_DATA && p->state != LZMA2_STATE_DATA_CONT) + { + if (*srcLen == inSize) + { + *status = LZMA_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + (*srcLen)++; + p->state = Lzma2Dec_UpdateState(p, *src++); + + if (dicPos == dicLimit && p->state != LZMA2_STATE_FINISHED) + { + p->state = LZMA2_STATE_ERROR; + return SZ_ERROR_DATA; + } + continue; + } + + { + SizeT destSizeCur = dicLimit - dicPos; + SizeT srcSizeCur = inSize - *srcLen; + ELzmaFinishMode curFinishMode = LZMA_FINISH_ANY; + + if (p->unpackSize <= destSizeCur) + { + destSizeCur = (SizeT)p->unpackSize; + curFinishMode = LZMA_FINISH_END; + } + + if (LZMA2_IS_UNCOMPRESSED_STATE(p)) + { + if (*srcLen == inSize) + { + *status = LZMA_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + + if (p->state == LZMA2_STATE_DATA) + { + Bool initDic = (p->control == LZMA2_CONTROL_COPY_RESET_DIC); + if (initDic) + p->needInitProp = p->needInitState = True; + else if (p->needInitDic) + { + p->state = LZMA2_STATE_ERROR; + return SZ_ERROR_DATA; + } + p->needInitDic = False; + LzmaDec_InitDicAndState(&p->decoder, initDic, False); + } + + if (srcSizeCur > destSizeCur) + srcSizeCur = destSizeCur; + + if (srcSizeCur == 0) + { + p->state = LZMA2_STATE_ERROR; + return SZ_ERROR_DATA; + } + + LzmaDec_UpdateWithUncompressed(&p->decoder, src, srcSizeCur); + + src += srcSizeCur; + *srcLen += srcSizeCur; + p->unpackSize -= (UInt32)srcSizeCur; + p->state = (p->unpackSize == 0) ? LZMA2_STATE_CONTROL : LZMA2_STATE_DATA_CONT; + } + else + { + SizeT outSizeProcessed; + SRes res; + + if (p->state == LZMA2_STATE_DATA) + { + unsigned mode = LZMA2_GET_LZMA_MODE(p); + Bool initDic = (mode == 3); + Bool initState = (mode != 0); + if ((!initDic && p->needInitDic) || (!initState && p->needInitState)) + { + p->state = LZMA2_STATE_ERROR; + return SZ_ERROR_DATA; + } + + LzmaDec_InitDicAndState(&p->decoder, initDic, initState); + p->needInitDic = False; + p->needInitState = False; + p->state = LZMA2_STATE_DATA_CONT; + } + + if (srcSizeCur > p->packSize) + srcSizeCur = (SizeT)p->packSize; + + res = LzmaDec_DecodeToDic(&p->decoder, dicPos + destSizeCur, src, &srcSizeCur, curFinishMode, status); + + src += srcSizeCur; + *srcLen += srcSizeCur; + p->packSize -= (UInt32)srcSizeCur; + + outSizeProcessed = p->decoder.dicPos - dicPos; + p->unpackSize -= (UInt32)outSizeProcessed; + + RINOK(res); + if (*status == LZMA_STATUS_NEEDS_MORE_INPUT) + return res; + + if (srcSizeCur == 0 && outSizeProcessed == 0) + { + if (*status != LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK + || p->unpackSize != 0 + || p->packSize != 0) + { + p->state = LZMA2_STATE_ERROR; + return SZ_ERROR_DATA; + } + p->state = LZMA2_STATE_CONTROL; + } + + if (*status == LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK) + *status = LZMA_STATUS_NOT_FINISHED; + } + } + } + + *status = LZMA_STATUS_FINISHED_WITH_MARK; + return SZ_OK; +} + +SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) +{ + SizeT outSize = *destLen, inSize = *srcLen; + *srcLen = *destLen = 0; + for (;;) + { + SizeT srcSizeCur = inSize, outSizeCur, dicPos; + ELzmaFinishMode curFinishMode; + SRes res; + if (p->decoder.dicPos == p->decoder.dicBufSize) + p->decoder.dicPos = 0; + dicPos = p->decoder.dicPos; + if (outSize > p->decoder.dicBufSize - dicPos) + { + outSizeCur = p->decoder.dicBufSize; + curFinishMode = LZMA_FINISH_ANY; + } + else + { + outSizeCur = dicPos + outSize; + curFinishMode = finishMode; + } + + res = Lzma2Dec_DecodeToDic(p, outSizeCur, src, &srcSizeCur, curFinishMode, status); + src += srcSizeCur; + inSize -= srcSizeCur; + *srcLen += srcSizeCur; + outSizeCur = p->decoder.dicPos - dicPos; + memcpy(dest, p->decoder.dic + dicPos, outSizeCur); + dest += outSizeCur; + outSize -= outSizeCur; + *destLen += outSizeCur; + if (res != 0) + return res; + if (outSizeCur == 0 || outSize == 0) + return SZ_OK; + } +} + +SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc) +{ + CLzma2Dec p; + SRes res; + SizeT outSize = *destLen, inSize = *srcLen; + *destLen = *srcLen = 0; + *status = LZMA_STATUS_NOT_SPECIFIED; + Lzma2Dec_Construct(&p); + RINOK(Lzma2Dec_AllocateProbs(&p, prop, alloc)); + p.decoder.dic = dest; + p.decoder.dicBufSize = outSize; + Lzma2Dec_Init(&p); + *srcLen = inSize; + res = Lzma2Dec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); + *destLen = p.decoder.dicPos; + if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) + res = SZ_ERROR_INPUT_EOF; + Lzma2Dec_FreeProbs(&p, alloc); + return res; +} diff --git a/src/lzma/Lzma2Enc.c b/src/lzma/Lzma2Enc.c index cba013497a..a776ab7be7 100644 --- a/src/lzma/Lzma2Enc.c +++ b/src/lzma/Lzma2Enc.c @@ -1,520 +1,520 @@ -/* Lzma2Enc.c -- LZMA2 Encoder -2015-10-04 : Igor Pavlov : Public domain */ - -#include "Precomp.h" - -/* #include <stdio.h> */ -#include <string.h> - -/* #define _7ZIP_ST */ - -#include "Lzma2Enc.h" - -#ifndef _7ZIP_ST -#include "MtCoder.h" -#else -#define NUM_MT_CODER_THREADS_MAX 1 -#endif - -#define LZMA2_CONTROL_LZMA (1 << 7) -#define LZMA2_CONTROL_COPY_NO_RESET 2 -#define LZMA2_CONTROL_COPY_RESET_DIC 1 -#define LZMA2_CONTROL_EOF 0 - -#define LZMA2_LCLP_MAX 4 - -#define LZMA2_DIC_SIZE_FROM_PROP(p) (((UInt32)2 | ((p) & 1)) << ((p) / 2 + 11)) - -#define LZMA2_PACK_SIZE_MAX (1 << 16) -#define LZMA2_COPY_CHUNK_SIZE LZMA2_PACK_SIZE_MAX -#define LZMA2_UNPACK_SIZE_MAX (1 << 21) -#define LZMA2_KEEP_WINDOW_SIZE LZMA2_UNPACK_SIZE_MAX - -#define LZMA2_CHUNK_SIZE_COMPRESSED_MAX ((1 << 16) + 16) - - -#define PRF(x) /* x */ - -/* ---------- CLzma2EncInt ---------- */ - -typedef struct -{ - CLzmaEncHandle enc; - UInt64 srcPos; - Byte props; - Bool needInitState; - Bool needInitProp; -} CLzma2EncInt; - -static SRes Lzma2EncInt_Init(CLzma2EncInt *p, const CLzma2EncProps *props) -{ - Byte propsEncoded[LZMA_PROPS_SIZE]; - SizeT propsSize = LZMA_PROPS_SIZE; - RINOK(LzmaEnc_SetProps(p->enc, &props->lzmaProps)); - RINOK(LzmaEnc_WriteProperties(p->enc, propsEncoded, &propsSize)); - p->srcPos = 0; - p->props = propsEncoded[0]; - p->needInitState = True; - p->needInitProp = True; - return SZ_OK; -} - -SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, ISeqInStream *inStream, UInt32 keepWindowSize, - ISzAlloc *alloc, ISzAlloc *allocBig); -SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, - UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig); -SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, - Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize); -const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp); -void LzmaEnc_Finish(CLzmaEncHandle pp); -void LzmaEnc_SaveState(CLzmaEncHandle pp); -void LzmaEnc_RestoreState(CLzmaEncHandle pp); - - -static SRes Lzma2EncInt_EncodeSubblock(CLzma2EncInt *p, Byte *outBuf, - size_t *packSizeRes, ISeqOutStream *outStream) -{ - size_t packSizeLimit = *packSizeRes; - size_t packSize = packSizeLimit; - UInt32 unpackSize = LZMA2_UNPACK_SIZE_MAX; - unsigned lzHeaderSize = 5 + (p->needInitProp ? 1 : 0); - Bool useCopyBlock; - SRes res; - - *packSizeRes = 0; - if (packSize < lzHeaderSize) - return SZ_ERROR_OUTPUT_EOF; - packSize -= lzHeaderSize; - - LzmaEnc_SaveState(p->enc); - res = LzmaEnc_CodeOneMemBlock(p->enc, p->needInitState, - outBuf + lzHeaderSize, &packSize, LZMA2_PACK_SIZE_MAX, &unpackSize); - - PRF(printf("\npackSize = %7d unpackSize = %7d ", packSize, unpackSize)); - - if (unpackSize == 0) - return res; - - if (res == SZ_OK) - useCopyBlock = (packSize + 2 >= unpackSize || packSize > (1 << 16)); - else - { - if (res != SZ_ERROR_OUTPUT_EOF) - return res; - res = SZ_OK; - useCopyBlock = True; - } - - if (useCopyBlock) - { - size_t destPos = 0; - PRF(printf("################# COPY ")); - - while (unpackSize > 0) - { - UInt32 u = (unpackSize < LZMA2_COPY_CHUNK_SIZE) ? unpackSize : LZMA2_COPY_CHUNK_SIZE; - if (packSizeLimit - destPos < u + 3) - return SZ_ERROR_OUTPUT_EOF; - outBuf[destPos++] = (Byte)(p->srcPos == 0 ? LZMA2_CONTROL_COPY_RESET_DIC : LZMA2_CONTROL_COPY_NO_RESET); - outBuf[destPos++] = (Byte)((u - 1) >> 8); - outBuf[destPos++] = (Byte)(u - 1); - memcpy(outBuf + destPos, LzmaEnc_GetCurBuf(p->enc) - unpackSize, u); - unpackSize -= u; - destPos += u; - p->srcPos += u; - - if (outStream) - { - *packSizeRes += destPos; - if (outStream->Write(outStream, outBuf, destPos) != destPos) - return SZ_ERROR_WRITE; - destPos = 0; - } - else - *packSizeRes = destPos; - /* needInitState = True; */ - } - - LzmaEnc_RestoreState(p->enc); - return SZ_OK; - } - - { - size_t destPos = 0; - UInt32 u = unpackSize - 1; - UInt32 pm = (UInt32)(packSize - 1); - unsigned mode = (p->srcPos == 0) ? 3 : (p->needInitState ? (p->needInitProp ? 2 : 1) : 0); - - PRF(printf(" ")); - - outBuf[destPos++] = (Byte)(LZMA2_CONTROL_LZMA | (mode << 5) | ((u >> 16) & 0x1F)); - outBuf[destPos++] = (Byte)(u >> 8); - outBuf[destPos++] = (Byte)u; - outBuf[destPos++] = (Byte)(pm >> 8); - outBuf[destPos++] = (Byte)pm; - - if (p->needInitProp) - outBuf[destPos++] = p->props; - - p->needInitProp = False; - p->needInitState = False; - destPos += packSize; - p->srcPos += unpackSize; - - if (outStream) - if (outStream->Write(outStream, outBuf, destPos) != destPos) - return SZ_ERROR_WRITE; - - *packSizeRes = destPos; - return SZ_OK; - } -} - - -/* ---------- Lzma2 Props ---------- */ - -void Lzma2EncProps_Init(CLzma2EncProps *p) -{ - LzmaEncProps_Init(&p->lzmaProps); - p->numTotalThreads = -1; - p->numBlockThreads = -1; - p->blockSize = 0; -} - -void Lzma2EncProps_Normalize(CLzma2EncProps *p) -{ - int t1, t1n, t2, t3; - { - CLzmaEncProps lzmaProps = p->lzmaProps; - LzmaEncProps_Normalize(&lzmaProps); - t1n = lzmaProps.numThreads; - } - - t1 = p->lzmaProps.numThreads; - t2 = p->numBlockThreads; - t3 = p->numTotalThreads; - - if (t2 > NUM_MT_CODER_THREADS_MAX) - t2 = NUM_MT_CODER_THREADS_MAX; - - if (t3 <= 0) - { - if (t2 <= 0) - t2 = 1; - t3 = t1n * t2; - } - else if (t2 <= 0) - { - t2 = t3 / t1n; - if (t2 == 0) - { - t1 = 1; - t2 = t3; - } - if (t2 > NUM_MT_CODER_THREADS_MAX) - t2 = NUM_MT_CODER_THREADS_MAX; - } - else if (t1 <= 0) - { - t1 = t3 / t2; - if (t1 == 0) - t1 = 1; - } - else - t3 = t1n * t2; - - p->lzmaProps.numThreads = t1; - - LzmaEncProps_Normalize(&p->lzmaProps); - - t1 = p->lzmaProps.numThreads; - - if (p->blockSize == 0) - { - UInt32 dictSize = p->lzmaProps.dictSize; - UInt64 blockSize = (UInt64)dictSize << 2; - const UInt32 kMinSize = (UInt32)1 << 20; - const UInt32 kMaxSize = (UInt32)1 << 28; - if (blockSize < kMinSize) blockSize = kMinSize; - if (blockSize > kMaxSize) blockSize = kMaxSize; - if (blockSize < dictSize) blockSize = dictSize; - p->blockSize = (size_t)blockSize; - } - - if (t2 > 1 && p->lzmaProps.reduceSize != (UInt64)(Int64)-1) - { - UInt64 temp = p->lzmaProps.reduceSize + p->blockSize - 1; - if (temp > p->lzmaProps.reduceSize) - { - UInt64 numBlocks = temp / p->blockSize; - if (numBlocks < (unsigned)t2) - { - t2 = (unsigned)numBlocks; - if (t2 == 0) - t2 = 1; - t3 = t1 * t2; - } - } - } - - p->numBlockThreads = t2; - p->numTotalThreads = t3; -} - - -static SRes Progress(ICompressProgress *p, UInt64 inSize, UInt64 outSize) -{ - return (p && p->Progress(p, inSize, outSize) != SZ_OK) ? SZ_ERROR_PROGRESS : SZ_OK; -} - - -/* ---------- Lzma2 ---------- */ - -typedef struct -{ - Byte propEncoded; - CLzma2EncProps props; - - Byte *outBuf; - - ISzAlloc *alloc; - ISzAlloc *allocBig; - - CLzma2EncInt coders[NUM_MT_CODER_THREADS_MAX]; - - #ifndef _7ZIP_ST - CMtCoder mtCoder; - #endif - -} CLzma2Enc; - - -/* ---------- Lzma2EncThread ---------- */ - -static SRes Lzma2Enc_EncodeMt1(CLzma2EncInt *p, CLzma2Enc *mainEncoder, - ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress) -{ - UInt64 packTotal = 0; - SRes res = SZ_OK; - - if (!mainEncoder->outBuf) - { - mainEncoder->outBuf = (Byte *)IAlloc_Alloc(mainEncoder->alloc, LZMA2_CHUNK_SIZE_COMPRESSED_MAX); - if (!mainEncoder->outBuf) - return SZ_ERROR_MEM; - } - - RINOK(Lzma2EncInt_Init(p, &mainEncoder->props)); - RINOK(LzmaEnc_PrepareForLzma2(p->enc, inStream, LZMA2_KEEP_WINDOW_SIZE, - mainEncoder->alloc, mainEncoder->allocBig)); - - for (;;) - { - size_t packSize = LZMA2_CHUNK_SIZE_COMPRESSED_MAX; - res = Lzma2EncInt_EncodeSubblock(p, mainEncoder->outBuf, &packSize, outStream); - if (res != SZ_OK) - break; - packTotal += packSize; - res = Progress(progress, p->srcPos, packTotal); - if (res != SZ_OK) - break; - if (packSize == 0) - break; - } - - LzmaEnc_Finish(p->enc); - - if (res == SZ_OK) - { - Byte b = 0; - if (outStream->Write(outStream, &b, 1) != 1) - return SZ_ERROR_WRITE; - } - - return res; -} - - -#ifndef _7ZIP_ST - -typedef struct -{ - IMtCoderCallback funcTable; - CLzma2Enc *lzma2Enc; -} CMtCallbackImp; - -static SRes MtCallbackImp_Code(void *pp, unsigned index, Byte *dest, size_t *destSize, - const Byte *src, size_t srcSize, int finished) -{ - CMtCallbackImp *imp = (CMtCallbackImp *)pp; - CLzma2Enc *mainEncoder = imp->lzma2Enc; - CLzma2EncInt *p = &mainEncoder->coders[index]; - - SRes res = SZ_OK; - { - size_t destLim = *destSize; - *destSize = 0; - - if (srcSize != 0) - { - RINOK(Lzma2EncInt_Init(p, &mainEncoder->props)); - - RINOK(LzmaEnc_MemPrepare(p->enc, src, srcSize, LZMA2_KEEP_WINDOW_SIZE, - mainEncoder->alloc, mainEncoder->allocBig)); - - while (p->srcPos < srcSize) - { - size_t packSize = destLim - *destSize; - res = Lzma2EncInt_EncodeSubblock(p, dest + *destSize, &packSize, NULL); - if (res != SZ_OK) - break; - *destSize += packSize; - - if (packSize == 0) - { - res = SZ_ERROR_FAIL; - break; - } - - if (MtProgress_Set(&mainEncoder->mtCoder.mtProgress, index, p->srcPos, *destSize) != SZ_OK) - { - res = SZ_ERROR_PROGRESS; - break; - } - } - - LzmaEnc_Finish(p->enc); - if (res != SZ_OK) - return res; - } - - if (finished) - { - if (*destSize == destLim) - return SZ_ERROR_OUTPUT_EOF; - dest[(*destSize)++] = 0; - } - } - return res; -} - -#endif - - -/* ---------- Lzma2Enc ---------- */ - -CLzma2EncHandle Lzma2Enc_Create(ISzAlloc *alloc, ISzAlloc *allocBig) -{ - CLzma2Enc *p = (CLzma2Enc *)alloc->Alloc(alloc, sizeof(CLzma2Enc)); - if (!p) - return NULL; - Lzma2EncProps_Init(&p->props); - Lzma2EncProps_Normalize(&p->props); - p->outBuf = 0; - p->alloc = alloc; - p->allocBig = allocBig; - { - unsigned i; - for (i = 0; i < NUM_MT_CODER_THREADS_MAX; i++) - p->coders[i].enc = 0; - } - - #ifndef _7ZIP_ST - MtCoder_Construct(&p->mtCoder); - #endif - - return p; -} - -void Lzma2Enc_Destroy(CLzma2EncHandle pp) -{ - CLzma2Enc *p = (CLzma2Enc *)pp; - unsigned i; - for (i = 0; i < NUM_MT_CODER_THREADS_MAX; i++) - { - CLzma2EncInt *t = &p->coders[i]; - if (t->enc) - { - LzmaEnc_Destroy(t->enc, p->alloc, p->allocBig); - t->enc = 0; - } - } - - #ifndef _7ZIP_ST - MtCoder_Destruct(&p->mtCoder); - #endif - - IAlloc_Free(p->alloc, p->outBuf); - IAlloc_Free(p->alloc, pp); -} - -SRes Lzma2Enc_SetProps(CLzma2EncHandle pp, const CLzma2EncProps *props) -{ - CLzma2Enc *p = (CLzma2Enc *)pp; - CLzmaEncProps lzmaProps = props->lzmaProps; - LzmaEncProps_Normalize(&lzmaProps); - if (lzmaProps.lc + lzmaProps.lp > LZMA2_LCLP_MAX) - return SZ_ERROR_PARAM; - p->props = *props; - Lzma2EncProps_Normalize(&p->props); - return SZ_OK; -} - -Byte Lzma2Enc_WriteProperties(CLzma2EncHandle pp) -{ - CLzma2Enc *p = (CLzma2Enc *)pp; - unsigned i; - UInt32 dicSize = LzmaEncProps_GetDictSize(&p->props.lzmaProps); - for (i = 0; i < 40; i++) - if (dicSize <= LZMA2_DIC_SIZE_FROM_PROP(i)) - break; - return (Byte)i; -} - -SRes Lzma2Enc_Encode(CLzma2EncHandle pp, - ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress) -{ - CLzma2Enc *p = (CLzma2Enc *)pp; - int i; - - for (i = 0; i < p->props.numBlockThreads; i++) - { - CLzma2EncInt *t = &p->coders[(unsigned)i]; - if (!t->enc) - { - t->enc = LzmaEnc_Create(p->alloc); - if (!t->enc) - return SZ_ERROR_MEM; - } - } - - #ifndef _7ZIP_ST - if (p->props.numBlockThreads > 1) - { - CMtCallbackImp mtCallback; - - mtCallback.funcTable.Code = MtCallbackImp_Code; - mtCallback.lzma2Enc = p; - - p->mtCoder.progress = progress; - p->mtCoder.inStream = inStream; - p->mtCoder.outStream = outStream; - p->mtCoder.alloc = p->alloc; - p->mtCoder.mtCallback = &mtCallback.funcTable; - - p->mtCoder.blockSize = p->props.blockSize; - p->mtCoder.destBlockSize = p->props.blockSize + (p->props.blockSize >> 10) + 16; - if (p->mtCoder.destBlockSize < p->props.blockSize) - { - p->mtCoder.destBlockSize = (size_t)0 - 1; - if (p->mtCoder.destBlockSize < p->props.blockSize) - return SZ_ERROR_FAIL; - } - p->mtCoder.numThreads = p->props.numBlockThreads; - - return MtCoder_Code(&p->mtCoder); - } - #endif - - return Lzma2Enc_EncodeMt1(&p->coders[0], p, outStream, inStream, progress); -} +/* Lzma2Enc.c -- LZMA2 Encoder +2015-10-04 : Igor Pavlov : Public domain */ + +#include "Precomp.h" + +/* #include <stdio.h> */ +#include <string.h> + +/* #define _7ZIP_ST */ + +#include "Lzma2Enc.h" + +#ifndef _7ZIP_ST +#include "MtCoder.h" +#else +#define NUM_MT_CODER_THREADS_MAX 1 +#endif + +#define LZMA2_CONTROL_LZMA (1 << 7) +#define LZMA2_CONTROL_COPY_NO_RESET 2 +#define LZMA2_CONTROL_COPY_RESET_DIC 1 +#define LZMA2_CONTROL_EOF 0 + +#define LZMA2_LCLP_MAX 4 + +#define LZMA2_DIC_SIZE_FROM_PROP(p) (((UInt32)2 | ((p) & 1)) << ((p) / 2 + 11)) + +#define LZMA2_PACK_SIZE_MAX (1 << 16) +#define LZMA2_COPY_CHUNK_SIZE LZMA2_PACK_SIZE_MAX +#define LZMA2_UNPACK_SIZE_MAX (1 << 21) +#define LZMA2_KEEP_WINDOW_SIZE LZMA2_UNPACK_SIZE_MAX + +#define LZMA2_CHUNK_SIZE_COMPRESSED_MAX ((1 << 16) + 16) + + +#define PRF(x) /* x */ + +/* ---------- CLzma2EncInt ---------- */ + +typedef struct +{ + CLzmaEncHandle enc; + UInt64 srcPos; + Byte props; + Bool needInitState; + Bool needInitProp; +} CLzma2EncInt; + +static SRes Lzma2EncInt_Init(CLzma2EncInt *p, const CLzma2EncProps *props) +{ + Byte propsEncoded[LZMA_PROPS_SIZE]; + SizeT propsSize = LZMA_PROPS_SIZE; + RINOK(LzmaEnc_SetProps(p->enc, &props->lzmaProps)); + RINOK(LzmaEnc_WriteProperties(p->enc, propsEncoded, &propsSize)); + p->srcPos = 0; + p->props = propsEncoded[0]; + p->needInitState = True; + p->needInitProp = True; + return SZ_OK; +} + +SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, ISeqInStream *inStream, UInt32 keepWindowSize, + ISzAlloc *alloc, ISzAlloc *allocBig); +SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, + UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig); +SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, + Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize); +const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp); +void LzmaEnc_Finish(CLzmaEncHandle pp); +void LzmaEnc_SaveState(CLzmaEncHandle pp); +void LzmaEnc_RestoreState(CLzmaEncHandle pp); + + +static SRes Lzma2EncInt_EncodeSubblock(CLzma2EncInt *p, Byte *outBuf, + size_t *packSizeRes, ISeqOutStream *outStream) +{ + size_t packSizeLimit = *packSizeRes; + size_t packSize = packSizeLimit; + UInt32 unpackSize = LZMA2_UNPACK_SIZE_MAX; + unsigned lzHeaderSize = 5 + (p->needInitProp ? 1 : 0); + Bool useCopyBlock; + SRes res; + + *packSizeRes = 0; + if (packSize < lzHeaderSize) + return SZ_ERROR_OUTPUT_EOF; + packSize -= lzHeaderSize; + + LzmaEnc_SaveState(p->enc); + res = LzmaEnc_CodeOneMemBlock(p->enc, p->needInitState, + outBuf + lzHeaderSize, &packSize, LZMA2_PACK_SIZE_MAX, &unpackSize); + + PRF(printf("\npackSize = %7d unpackSize = %7d ", packSize, unpackSize)); + + if (unpackSize == 0) + return res; + + if (res == SZ_OK) + useCopyBlock = (packSize + 2 >= unpackSize || packSize > (1 << 16)); + else + { + if (res != SZ_ERROR_OUTPUT_EOF) + return res; + res = SZ_OK; + useCopyBlock = True; + } + + if (useCopyBlock) + { + size_t destPos = 0; + PRF(printf("################# COPY ")); + + while (unpackSize > 0) + { + UInt32 u = (unpackSize < LZMA2_COPY_CHUNK_SIZE) ? unpackSize : LZMA2_COPY_CHUNK_SIZE; + if (packSizeLimit - destPos < u + 3) + return SZ_ERROR_OUTPUT_EOF; + outBuf[destPos++] = (Byte)(p->srcPos == 0 ? LZMA2_CONTROL_COPY_RESET_DIC : LZMA2_CONTROL_COPY_NO_RESET); + outBuf[destPos++] = (Byte)((u - 1) >> 8); + outBuf[destPos++] = (Byte)(u - 1); + memcpy(outBuf + destPos, LzmaEnc_GetCurBuf(p->enc) - unpackSize, u); + unpackSize -= u; + destPos += u; + p->srcPos += u; + + if (outStream) + { + *packSizeRes += destPos; + if (outStream->Write(outStream, outBuf, destPos) != destPos) + return SZ_ERROR_WRITE; + destPos = 0; + } + else + *packSizeRes = destPos; + /* needInitState = True; */ + } + + LzmaEnc_RestoreState(p->enc); + return SZ_OK; + } + + { + size_t destPos = 0; + UInt32 u = unpackSize - 1; + UInt32 pm = (UInt32)(packSize - 1); + unsigned mode = (p->srcPos == 0) ? 3 : (p->needInitState ? (p->needInitProp ? 2 : 1) : 0); + + PRF(printf(" ")); + + outBuf[destPos++] = (Byte)(LZMA2_CONTROL_LZMA | (mode << 5) | ((u >> 16) & 0x1F)); + outBuf[destPos++] = (Byte)(u >> 8); + outBuf[destPos++] = (Byte)u; + outBuf[destPos++] = (Byte)(pm >> 8); + outBuf[destPos++] = (Byte)pm; + + if (p->needInitProp) + outBuf[destPos++] = p->props; + + p->needInitProp = False; + p->needInitState = False; + destPos += packSize; + p->srcPos += unpackSize; + + if (outStream) + if (outStream->Write(outStream, outBuf, destPos) != destPos) + return SZ_ERROR_WRITE; + + *packSizeRes = destPos; + return SZ_OK; + } +} + + +/* ---------- Lzma2 Props ---------- */ + +void Lzma2EncProps_Init(CLzma2EncProps *p) +{ + LzmaEncProps_Init(&p->lzmaProps); + p->numTotalThreads = -1; + p->numBlockThreads = -1; + p->blockSize = 0; +} + +void Lzma2EncProps_Normalize(CLzma2EncProps *p) +{ + int t1, t1n, t2, t3; + { + CLzmaEncProps lzmaProps = p->lzmaProps; + LzmaEncProps_Normalize(&lzmaProps); + t1n = lzmaProps.numThreads; + } + + t1 = p->lzmaProps.numThreads; + t2 = p->numBlockThreads; + t3 = p->numTotalThreads; + + if (t2 > NUM_MT_CODER_THREADS_MAX) + t2 = NUM_MT_CODER_THREADS_MAX; + + if (t3 <= 0) + { + if (t2 <= 0) + t2 = 1; + t3 = t1n * t2; + } + else if (t2 <= 0) + { + t2 = t3 / t1n; + if (t2 == 0) + { + t1 = 1; + t2 = t3; + } + if (t2 > NUM_MT_CODER_THREADS_MAX) + t2 = NUM_MT_CODER_THREADS_MAX; + } + else if (t1 <= 0) + { + t1 = t3 / t2; + if (t1 == 0) + t1 = 1; + } + else + t3 = t1n * t2; + + p->lzmaProps.numThreads = t1; + + LzmaEncProps_Normalize(&p->lzmaProps); + + t1 = p->lzmaProps.numThreads; + + if (p->blockSize == 0) + { + UInt32 dictSize = p->lzmaProps.dictSize; + UInt64 blockSize = (UInt64)dictSize << 2; + const UInt32 kMinSize = (UInt32)1 << 20; + const UInt32 kMaxSize = (UInt32)1 << 28; + if (blockSize < kMinSize) blockSize = kMinSize; + if (blockSize > kMaxSize) blockSize = kMaxSize; + if (blockSize < dictSize) blockSize = dictSize; + p->blockSize = (size_t)blockSize; + } + + if (t2 > 1 && p->lzmaProps.reduceSize != (UInt64)(Int64)-1) + { + UInt64 temp = p->lzmaProps.reduceSize + p->blockSize - 1; + if (temp > p->lzmaProps.reduceSize) + { + UInt64 numBlocks = temp / p->blockSize; + if (numBlocks < (unsigned)t2) + { + t2 = (unsigned)numBlocks; + if (t2 == 0) + t2 = 1; + t3 = t1 * t2; + } + } + } + + p->numBlockThreads = t2; + p->numTotalThreads = t3; +} + + +static SRes Progress(ICompressProgress *p, UInt64 inSize, UInt64 outSize) +{ + return (p && p->Progress(p, inSize, outSize) != SZ_OK) ? SZ_ERROR_PROGRESS : SZ_OK; +} + + +/* ---------- Lzma2 ---------- */ + +typedef struct +{ + Byte propEncoded; + CLzma2EncProps props; + + Byte *outBuf; + + ISzAlloc *alloc; + ISzAlloc *allocBig; + + CLzma2EncInt coders[NUM_MT_CODER_THREADS_MAX]; + + #ifndef _7ZIP_ST + CMtCoder mtCoder; + #endif + +} CLzma2Enc; + + +/* ---------- Lzma2EncThread ---------- */ + +static SRes Lzma2Enc_EncodeMt1(CLzma2EncInt *p, CLzma2Enc *mainEncoder, + ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress) +{ + UInt64 packTotal = 0; + SRes res = SZ_OK; + + if (!mainEncoder->outBuf) + { + mainEncoder->outBuf = (Byte *)IAlloc_Alloc(mainEncoder->alloc, LZMA2_CHUNK_SIZE_COMPRESSED_MAX); + if (!mainEncoder->outBuf) + return SZ_ERROR_MEM; + } + + RINOK(Lzma2EncInt_Init(p, &mainEncoder->props)); + RINOK(LzmaEnc_PrepareForLzma2(p->enc, inStream, LZMA2_KEEP_WINDOW_SIZE, + mainEncoder->alloc, mainEncoder->allocBig)); + + for (;;) + { + size_t packSize = LZMA2_CHUNK_SIZE_COMPRESSED_MAX; + res = Lzma2EncInt_EncodeSubblock(p, mainEncoder->outBuf, &packSize, outStream); + if (res != SZ_OK) + break; + packTotal += packSize; + res = Progress(progress, p->srcPos, packTotal); + if (res != SZ_OK) + break; + if (packSize == 0) + break; + } + + LzmaEnc_Finish(p->enc); + + if (res == SZ_OK) + { + Byte b = 0; + if (outStream->Write(outStream, &b, 1) != 1) + return SZ_ERROR_WRITE; + } + + return res; +} + + +#ifndef _7ZIP_ST + +typedef struct +{ + IMtCoderCallback funcTable; + CLzma2Enc *lzma2Enc; +} CMtCallbackImp; + +static SRes MtCallbackImp_Code(void *pp, unsigned index, Byte *dest, size_t *destSize, + const Byte *src, size_t srcSize, int finished) +{ + CMtCallbackImp *imp = (CMtCallbackImp *)pp; + CLzma2Enc *mainEncoder = imp->lzma2Enc; + CLzma2EncInt *p = &mainEncoder->coders[index]; + + SRes res = SZ_OK; + { + size_t destLim = *destSize; + *destSize = 0; + + if (srcSize != 0) + { + RINOK(Lzma2EncInt_Init(p, &mainEncoder->props)); + + RINOK(LzmaEnc_MemPrepare(p->enc, src, srcSize, LZMA2_KEEP_WINDOW_SIZE, + mainEncoder->alloc, mainEncoder->allocBig)); + + while (p->srcPos < srcSize) + { + size_t packSize = destLim - *destSize; + res = Lzma2EncInt_EncodeSubblock(p, dest + *destSize, &packSize, NULL); + if (res != SZ_OK) + break; + *destSize += packSize; + + if (packSize == 0) + { + res = SZ_ERROR_FAIL; + break; + } + + if (MtProgress_Set(&mainEncoder->mtCoder.mtProgress, index, p->srcPos, *destSize) != SZ_OK) + { + res = SZ_ERROR_PROGRESS; + break; + } + } + + LzmaEnc_Finish(p->enc); + if (res != SZ_OK) + return res; + } + + if (finished) + { + if (*destSize == destLim) + return SZ_ERROR_OUTPUT_EOF; + dest[(*destSize)++] = 0; + } + } + return res; +} + +#endif + + +/* ---------- Lzma2Enc ---------- */ + +CLzma2EncHandle Lzma2Enc_Create(ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzma2Enc *p = (CLzma2Enc *)alloc->Alloc(alloc, sizeof(CLzma2Enc)); + if (!p) + return NULL; + Lzma2EncProps_Init(&p->props); + Lzma2EncProps_Normalize(&p->props); + p->outBuf = 0; + p->alloc = alloc; + p->allocBig = allocBig; + { + unsigned i; + for (i = 0; i < NUM_MT_CODER_THREADS_MAX; i++) + p->coders[i].enc = 0; + } + + #ifndef _7ZIP_ST + MtCoder_Construct(&p->mtCoder); + #endif + + return p; +} + +void Lzma2Enc_Destroy(CLzma2EncHandle pp) +{ + CLzma2Enc *p = (CLzma2Enc *)pp; + unsigned i; + for (i = 0; i < NUM_MT_CODER_THREADS_MAX; i++) + { + CLzma2EncInt *t = &p->coders[i]; + if (t->enc) + { + LzmaEnc_Destroy(t->enc, p->alloc, p->allocBig); + t->enc = 0; + } + } + + #ifndef _7ZIP_ST + MtCoder_Destruct(&p->mtCoder); + #endif + + IAlloc_Free(p->alloc, p->outBuf); + IAlloc_Free(p->alloc, pp); +} + +SRes Lzma2Enc_SetProps(CLzma2EncHandle pp, const CLzma2EncProps *props) +{ + CLzma2Enc *p = (CLzma2Enc *)pp; + CLzmaEncProps lzmaProps = props->lzmaProps; + LzmaEncProps_Normalize(&lzmaProps); + if (lzmaProps.lc + lzmaProps.lp > LZMA2_LCLP_MAX) + return SZ_ERROR_PARAM; + p->props = *props; + Lzma2EncProps_Normalize(&p->props); + return SZ_OK; +} + +Byte Lzma2Enc_WriteProperties(CLzma2EncHandle pp) +{ + CLzma2Enc *p = (CLzma2Enc *)pp; + unsigned i; + UInt32 dicSize = LzmaEncProps_GetDictSize(&p->props.lzmaProps); + for (i = 0; i < 40; i++) + if (dicSize <= LZMA2_DIC_SIZE_FROM_PROP(i)) + break; + return (Byte)i; +} + +SRes Lzma2Enc_Encode(CLzma2EncHandle pp, + ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress) +{ + CLzma2Enc *p = (CLzma2Enc *)pp; + int i; + + for (i = 0; i < p->props.numBlockThreads; i++) + { + CLzma2EncInt *t = &p->coders[(unsigned)i]; + if (!t->enc) + { + t->enc = LzmaEnc_Create(p->alloc); + if (!t->enc) + return SZ_ERROR_MEM; + } + } + + #ifndef _7ZIP_ST + if (p->props.numBlockThreads > 1) + { + CMtCallbackImp mtCallback; + + mtCallback.funcTable.Code = MtCallbackImp_Code; + mtCallback.lzma2Enc = p; + + p->mtCoder.progress = progress; + p->mtCoder.inStream = inStream; + p->mtCoder.outStream = outStream; + p->mtCoder.alloc = p->alloc; + p->mtCoder.mtCallback = &mtCallback.funcTable; + + p->mtCoder.blockSize = p->props.blockSize; + p->mtCoder.destBlockSize = p->props.blockSize + (p->props.blockSize >> 10) + 16; + if (p->mtCoder.destBlockSize < p->props.blockSize) + { + p->mtCoder.destBlockSize = (size_t)0 - 1; + if (p->mtCoder.destBlockSize < p->props.blockSize) + return SZ_ERROR_FAIL; + } + p->mtCoder.numThreads = p->props.numBlockThreads; + + return MtCoder_Code(&p->mtCoder); + } + #endif + + return Lzma2Enc_EncodeMt1(&p->coders[0], p, outStream, inStream, progress); +} diff --git a/src/lzma/LzmaDec.c b/src/lzma/LzmaDec.c index 64f1164f3d..5b8089256e 100644 --- a/src/lzma/LzmaDec.c +++ b/src/lzma/LzmaDec.c @@ -1,1100 +1,1100 @@ -/* LzmaDec.c -- LZMA Decoder -2016-05-16 : Igor Pavlov : Public domain */ - -#include "Precomp.h" - -#include "LzmaDec.h" - -#include <string.h> - -#define kNumTopBits 24 -#define kTopValue ((UInt32)1 << kNumTopBits) - -#define kNumBitModelTotalBits 11 -#define kBitModelTotal (1 << kNumBitModelTotalBits) -#define kNumMoveBits 5 - -#define RC_INIT_SIZE 5 - -#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); } - -#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) -#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); -#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); -#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \ - { UPDATE_0(p); i = (i + i); A0; } else \ - { UPDATE_1(p); i = (i + i) + 1; A1; } -#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;) - -#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); } -#define TREE_DECODE(probs, limit, i) \ - { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; } - -/* #define _LZMA_SIZE_OPT */ - -#ifdef _LZMA_SIZE_OPT -#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i) -#else -#define TREE_6_DECODE(probs, i) \ - { i = 1; \ - TREE_GET_BIT(probs, i); \ - TREE_GET_BIT(probs, i); \ - TREE_GET_BIT(probs, i); \ - TREE_GET_BIT(probs, i); \ - TREE_GET_BIT(probs, i); \ - TREE_GET_BIT(probs, i); \ - i -= 0x40; } -#endif - -#define NORMAL_LITER_DEC GET_BIT(prob + symbol, symbol) -#define MATCHED_LITER_DEC \ - matchByte <<= 1; \ - bit = (matchByte & offs); \ - probLit = prob + offs + bit + symbol; \ - GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit) - -#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); } - -#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) -#define UPDATE_0_CHECK range = bound; -#define UPDATE_1_CHECK range -= bound; code -= bound; -#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \ - { UPDATE_0_CHECK; i = (i + i); A0; } else \ - { UPDATE_1_CHECK; i = (i + i) + 1; A1; } -#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;) -#define TREE_DECODE_CHECK(probs, limit, i) \ - { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; } - - -#define kNumPosBitsMax 4 -#define kNumPosStatesMax (1 << kNumPosBitsMax) - -#define kLenNumLowBits 3 -#define kLenNumLowSymbols (1 << kLenNumLowBits) -#define kLenNumMidBits 3 -#define kLenNumMidSymbols (1 << kLenNumMidBits) -#define kLenNumHighBits 8 -#define kLenNumHighSymbols (1 << kLenNumHighBits) - -#define LenChoice 0 -#define LenChoice2 (LenChoice + 1) -#define LenLow (LenChoice2 + 1) -#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) -#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) -#define kNumLenProbs (LenHigh + kLenNumHighSymbols) - - -#define kNumStates 12 -#define kNumLitStates 7 - -#define kStartPosModelIndex 4 -#define kEndPosModelIndex 14 -#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) - -#define kNumPosSlotBits 6 -#define kNumLenToPosStates 4 - -#define kNumAlignBits 4 -#define kAlignTableSize (1 << kNumAlignBits) - -#define kMatchMinLen 2 -#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) - -#define IsMatch 0 -#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) -#define IsRepG0 (IsRep + kNumStates) -#define IsRepG1 (IsRepG0 + kNumStates) -#define IsRepG2 (IsRepG1 + kNumStates) -#define IsRep0Long (IsRepG2 + kNumStates) -#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) -#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) -#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) -#define LenCoder (Align + kAlignTableSize) -#define RepLenCoder (LenCoder + kNumLenProbs) -#define Literal (RepLenCoder + kNumLenProbs) - -#define LZMA_BASE_SIZE 1846 -#define LZMA_LIT_SIZE 0x300 - -#if Literal != LZMA_BASE_SIZE -StopCompilingDueBUG -#endif - -#define LzmaProps_GetNumProbs(p) (Literal + ((UInt32)LZMA_LIT_SIZE << ((p)->lc + (p)->lp))) - -#define LZMA_DIC_MIN (1 << 12) - -/* First LZMA-symbol is always decoded. -And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization -Out: - Result: - SZ_OK - OK - SZ_ERROR_DATA - Error - p->remainLen: - < kMatchSpecLenStart : normal remain - = kMatchSpecLenStart : finished - = kMatchSpecLenStart + 1 : Flush marker (unused now) - = kMatchSpecLenStart + 2 : State Init Marker (unused now) -*/ - -static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit) -{ - CLzmaProb *probs = p->probs; - - unsigned state = p->state; - UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3]; - unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1; - unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1; - unsigned lc = p->prop.lc; - - Byte *dic = p->dic; - SizeT dicBufSize = p->dicBufSize; - SizeT dicPos = p->dicPos; - - UInt32 processedPos = p->processedPos; - UInt32 checkDicSize = p->checkDicSize; - unsigned len = 0; - - const Byte *buf = p->buf; - UInt32 range = p->range; - UInt32 code = p->code; - - do - { - CLzmaProb *prob; - UInt32 bound; - unsigned ttt; - unsigned posState = processedPos & pbMask; - - prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; - IF_BIT_0(prob) - { - unsigned symbol; - UPDATE_0(prob); - prob = probs + Literal; - if (processedPos != 0 || checkDicSize != 0) - prob += ((UInt32)LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) + - (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc)))); - processedPos++; - - if (state < kNumLitStates) - { - state -= (state < 4) ? state : 3; - symbol = 1; - #ifdef _LZMA_SIZE_OPT - do { NORMAL_LITER_DEC } while (symbol < 0x100); - #else - NORMAL_LITER_DEC - NORMAL_LITER_DEC - NORMAL_LITER_DEC - NORMAL_LITER_DEC - NORMAL_LITER_DEC - NORMAL_LITER_DEC - NORMAL_LITER_DEC - NORMAL_LITER_DEC - #endif - } - else - { - unsigned matchByte = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)]; - unsigned offs = 0x100; - state -= (state < 10) ? 3 : 6; - symbol = 1; - #ifdef _LZMA_SIZE_OPT - do - { - unsigned bit; - CLzmaProb *probLit; - MATCHED_LITER_DEC - } - while (symbol < 0x100); - #else - { - unsigned bit; - CLzmaProb *probLit; - MATCHED_LITER_DEC - MATCHED_LITER_DEC - MATCHED_LITER_DEC - MATCHED_LITER_DEC - MATCHED_LITER_DEC - MATCHED_LITER_DEC - MATCHED_LITER_DEC - MATCHED_LITER_DEC - } - #endif - } - - dic[dicPos++] = (Byte)symbol; - continue; - } - - { - UPDATE_1(prob); - prob = probs + IsRep + state; - IF_BIT_0(prob) - { - UPDATE_0(prob); - state += kNumStates; - prob = probs + LenCoder; - } - else - { - UPDATE_1(prob); - if (checkDicSize == 0 && processedPos == 0) - return SZ_ERROR_DATA; - prob = probs + IsRepG0 + state; - IF_BIT_0(prob) - { - UPDATE_0(prob); - prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; - IF_BIT_0(prob) - { - UPDATE_0(prob); - dic[dicPos] = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)]; - dicPos++; - processedPos++; - state = state < kNumLitStates ? 9 : 11; - continue; - } - UPDATE_1(prob); - } - else - { - UInt32 distance; - UPDATE_1(prob); - prob = probs + IsRepG1 + state; - IF_BIT_0(prob) - { - UPDATE_0(prob); - distance = rep1; - } - else - { - UPDATE_1(prob); - prob = probs + IsRepG2 + state; - IF_BIT_0(prob) - { - UPDATE_0(prob); - distance = rep2; - } - else - { - UPDATE_1(prob); - distance = rep3; - rep3 = rep2; - } - rep2 = rep1; - } - rep1 = rep0; - rep0 = distance; - } - state = state < kNumLitStates ? 8 : 11; - prob = probs + RepLenCoder; - } - - #ifdef _LZMA_SIZE_OPT - { - unsigned lim, offset; - CLzmaProb *probLen = prob + LenChoice; - IF_BIT_0(probLen) - { - UPDATE_0(probLen); - probLen = prob + LenLow + (posState << kLenNumLowBits); - offset = 0; - lim = (1 << kLenNumLowBits); - } - else - { - UPDATE_1(probLen); - probLen = prob + LenChoice2; - IF_BIT_0(probLen) - { - UPDATE_0(probLen); - probLen = prob + LenMid + (posState << kLenNumMidBits); - offset = kLenNumLowSymbols; - lim = (1 << kLenNumMidBits); - } - else - { - UPDATE_1(probLen); - probLen = prob + LenHigh; - offset = kLenNumLowSymbols + kLenNumMidSymbols; - lim = (1 << kLenNumHighBits); - } - } - TREE_DECODE(probLen, lim, len); - len += offset; - } - #else - { - CLzmaProb *probLen = prob + LenChoice; - IF_BIT_0(probLen) - { - UPDATE_0(probLen); - probLen = prob + LenLow + (posState << kLenNumLowBits); - len = 1; - TREE_GET_BIT(probLen, len); - TREE_GET_BIT(probLen, len); - TREE_GET_BIT(probLen, len); - len -= 8; - } - else - { - UPDATE_1(probLen); - probLen = prob + LenChoice2; - IF_BIT_0(probLen) - { - UPDATE_0(probLen); - probLen = prob + LenMid + (posState << kLenNumMidBits); - len = 1; - TREE_GET_BIT(probLen, len); - TREE_GET_BIT(probLen, len); - TREE_GET_BIT(probLen, len); - } - else - { - UPDATE_1(probLen); - probLen = prob + LenHigh; - TREE_DECODE(probLen, (1 << kLenNumHighBits), len); - len += kLenNumLowSymbols + kLenNumMidSymbols; - } - } - } - #endif - - if (state >= kNumStates) - { - UInt32 distance; - prob = probs + PosSlot + - ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); - TREE_6_DECODE(prob, distance); - if (distance >= kStartPosModelIndex) - { - unsigned posSlot = (unsigned)distance; - unsigned numDirectBits = (unsigned)(((distance >> 1) - 1)); - distance = (2 | (distance & 1)); - if (posSlot < kEndPosModelIndex) - { - distance <<= numDirectBits; - prob = probs + SpecPos + distance - posSlot - 1; - { - UInt32 mask = 1; - unsigned i = 1; - do - { - GET_BIT2(prob + i, i, ; , distance |= mask); - mask <<= 1; - } - while (--numDirectBits != 0); - } - } - else - { - numDirectBits -= kNumAlignBits; - do - { - NORMALIZE - range >>= 1; - - { - UInt32 t; - code -= range; - t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */ - distance = (distance << 1) + (t + 1); - code += range & t; - } - /* - distance <<= 1; - if (code >= range) - { - code -= range; - distance |= 1; - } - */ - } - while (--numDirectBits != 0); - prob = probs + Align; - distance <<= kNumAlignBits; - { - unsigned i = 1; - GET_BIT2(prob + i, i, ; , distance |= 1); - GET_BIT2(prob + i, i, ; , distance |= 2); - GET_BIT2(prob + i, i, ; , distance |= 4); - GET_BIT2(prob + i, i, ; , distance |= 8); - } - if (distance == (UInt32)0xFFFFFFFF) - { - len += kMatchSpecLenStart; - state -= kNumStates; - break; - } - } - } - - rep3 = rep2; - rep2 = rep1; - rep1 = rep0; - rep0 = distance + 1; - if (checkDicSize == 0) - { - if (distance >= processedPos) - { - p->dicPos = dicPos; - return SZ_ERROR_DATA; - } - } - else if (distance >= checkDicSize) - { - p->dicPos = dicPos; - return SZ_ERROR_DATA; - } - state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3; - } - - len += kMatchMinLen; - - { - SizeT rem; - unsigned curLen; - SizeT pos; - - if ((rem = limit - dicPos) == 0) - { - p->dicPos = dicPos; - return SZ_ERROR_DATA; - } - - curLen = ((rem < len) ? (unsigned)rem : len); - pos = dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0); - - processedPos += curLen; - - len -= curLen; - if (curLen <= dicBufSize - pos) - { - Byte *dest = dic + dicPos; - ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos; - const Byte *lim = dest + curLen; - dicPos += curLen; - do - *(dest) = (Byte)*(dest + src); - while (++dest != lim); - } - else - { - do - { - dic[dicPos++] = dic[pos]; - if (++pos == dicBufSize) - pos = 0; - } - while (--curLen != 0); - } - } - } - } - while (dicPos < limit && buf < bufLimit); - - NORMALIZE; - - p->buf = buf; - p->range = range; - p->code = code; - p->remainLen = len; - p->dicPos = dicPos; - p->processedPos = processedPos; - p->reps[0] = rep0; - p->reps[1] = rep1; - p->reps[2] = rep2; - p->reps[3] = rep3; - p->state = state; - - return SZ_OK; -} - -static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit) -{ - if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart) - { - Byte *dic = p->dic; - SizeT dicPos = p->dicPos; - SizeT dicBufSize = p->dicBufSize; - unsigned len = p->remainLen; - SizeT rep0 = p->reps[0]; /* we use SizeT to avoid the BUG of VC14 for AMD64 */ - SizeT rem = limit - dicPos; - if (rem < len) - len = (unsigned)(rem); - - if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len) - p->checkDicSize = p->prop.dicSize; - - p->processedPos += len; - p->remainLen -= len; - while (len != 0) - { - len--; - dic[dicPos] = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)]; - dicPos++; - } - p->dicPos = dicPos; - } -} - -static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit) -{ - do - { - SizeT limit2 = limit; - if (p->checkDicSize == 0) - { - UInt32 rem = p->prop.dicSize - p->processedPos; - if (limit - p->dicPos > rem) - limit2 = p->dicPos + rem; - } - - RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit)); - - if (p->checkDicSize == 0 && p->processedPos >= p->prop.dicSize) - p->checkDicSize = p->prop.dicSize; - - LzmaDec_WriteRem(p, limit); - } - while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart); - - if (p->remainLen > kMatchSpecLenStart) - p->remainLen = kMatchSpecLenStart; - - return 0; -} - -typedef enum -{ - DUMMY_ERROR, /* unexpected end of input stream */ - DUMMY_LIT, - DUMMY_MATCH, - DUMMY_REP -} ELzmaDummy; - -static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize) -{ - UInt32 range = p->range; - UInt32 code = p->code; - const Byte *bufLimit = buf + inSize; - const CLzmaProb *probs = p->probs; - unsigned state = p->state; - ELzmaDummy res; - - { - const CLzmaProb *prob; - UInt32 bound; - unsigned ttt; - unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1); - - prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; - IF_BIT_0_CHECK(prob) - { - UPDATE_0_CHECK - - /* if (bufLimit - buf >= 7) return DUMMY_LIT; */ - - prob = probs + Literal; - if (p->checkDicSize != 0 || p->processedPos != 0) - prob += ((UInt32)LZMA_LIT_SIZE * - ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) + - (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc)))); - - if (state < kNumLitStates) - { - unsigned symbol = 1; - do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100); - } - else - { - unsigned matchByte = p->dic[p->dicPos - p->reps[0] + - (p->dicPos < p->reps[0] ? p->dicBufSize : 0)]; - unsigned offs = 0x100; - unsigned symbol = 1; - do - { - unsigned bit; - const CLzmaProb *probLit; - matchByte <<= 1; - bit = (matchByte & offs); - probLit = prob + offs + bit + symbol; - GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit) - } - while (symbol < 0x100); - } - res = DUMMY_LIT; - } - else - { - unsigned len; - UPDATE_1_CHECK; - - prob = probs + IsRep + state; - IF_BIT_0_CHECK(prob) - { - UPDATE_0_CHECK; - state = 0; - prob = probs + LenCoder; - res = DUMMY_MATCH; - } - else - { - UPDATE_1_CHECK; - res = DUMMY_REP; - prob = probs + IsRepG0 + state; - IF_BIT_0_CHECK(prob) - { - UPDATE_0_CHECK; - prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; - IF_BIT_0_CHECK(prob) - { - UPDATE_0_CHECK; - NORMALIZE_CHECK; - return DUMMY_REP; - } - else - { - UPDATE_1_CHECK; - } - } - else - { - UPDATE_1_CHECK; - prob = probs + IsRepG1 + state; - IF_BIT_0_CHECK(prob) - { - UPDATE_0_CHECK; - } - else - { - UPDATE_1_CHECK; - prob = probs + IsRepG2 + state; - IF_BIT_0_CHECK(prob) - { - UPDATE_0_CHECK; - } - else - { - UPDATE_1_CHECK; - } - } - } - state = kNumStates; - prob = probs + RepLenCoder; - } - { - unsigned limit, offset; - const CLzmaProb *probLen = prob + LenChoice; - IF_BIT_0_CHECK(probLen) - { - UPDATE_0_CHECK; - probLen = prob + LenLow + (posState << kLenNumLowBits); - offset = 0; - limit = 1 << kLenNumLowBits; - } - else - { - UPDATE_1_CHECK; - probLen = prob + LenChoice2; - IF_BIT_0_CHECK(probLen) - { - UPDATE_0_CHECK; - probLen = prob + LenMid + (posState << kLenNumMidBits); - offset = kLenNumLowSymbols; - limit = 1 << kLenNumMidBits; - } - else - { - UPDATE_1_CHECK; - probLen = prob + LenHigh; - offset = kLenNumLowSymbols + kLenNumMidSymbols; - limit = 1 << kLenNumHighBits; - } - } - TREE_DECODE_CHECK(probLen, limit, len); - len += offset; - } - - if (state < 4) - { - unsigned posSlot; - prob = probs + PosSlot + - ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << - kNumPosSlotBits); - TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot); - if (posSlot >= kStartPosModelIndex) - { - unsigned numDirectBits = ((posSlot >> 1) - 1); - - /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */ - - if (posSlot < kEndPosModelIndex) - { - prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1; - } - else - { - numDirectBits -= kNumAlignBits; - do - { - NORMALIZE_CHECK - range >>= 1; - code -= range & (((code - range) >> 31) - 1); - /* if (code >= range) code -= range; */ - } - while (--numDirectBits != 0); - prob = probs + Align; - numDirectBits = kNumAlignBits; - } - { - unsigned i = 1; - do - { - GET_BIT_CHECK(prob + i, i); - } - while (--numDirectBits != 0); - } - } - } - } - } - NORMALIZE_CHECK; - return res; -} - - -void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) -{ - p->needFlush = 1; - p->remainLen = 0; - p->tempBufSize = 0; - - if (initDic) - { - p->processedPos = 0; - p->checkDicSize = 0; - p->needInitState = 1; - } - if (initState) - p->needInitState = 1; -} - -void LzmaDec_Init(CLzmaDec *p) -{ - p->dicPos = 0; - LzmaDec_InitDicAndState(p, True, True); -} - -static void LzmaDec_InitStateReal(CLzmaDec *p) -{ - SizeT numProbs = LzmaProps_GetNumProbs(&p->prop); - SizeT i; - CLzmaProb *probs = p->probs; - for (i = 0; i < numProbs; i++) - probs[i] = kBitModelTotal >> 1; - p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1; - p->state = 0; - p->needInitState = 0; -} - -SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, - ELzmaFinishMode finishMode, ELzmaStatus *status) -{ - SizeT inSize = *srcLen; - (*srcLen) = 0; - LzmaDec_WriteRem(p, dicLimit); - - *status = LZMA_STATUS_NOT_SPECIFIED; - - while (p->remainLen != kMatchSpecLenStart) - { - int checkEndMarkNow; - - if (p->needFlush) - { - for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--) - p->tempBuf[p->tempBufSize++] = *src++; - if (p->tempBufSize < RC_INIT_SIZE) - { - *status = LZMA_STATUS_NEEDS_MORE_INPUT; - return SZ_OK; - } - if (p->tempBuf[0] != 0) - return SZ_ERROR_DATA; - p->code = - ((UInt32)p->tempBuf[1] << 24) - | ((UInt32)p->tempBuf[2] << 16) - | ((UInt32)p->tempBuf[3] << 8) - | ((UInt32)p->tempBuf[4]); - p->range = 0xFFFFFFFF; - p->needFlush = 0; - p->tempBufSize = 0; - } - - checkEndMarkNow = 0; - if (p->dicPos >= dicLimit) - { - if (p->remainLen == 0 && p->code == 0) - { - *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK; - return SZ_OK; - } - if (finishMode == LZMA_FINISH_ANY) - { - *status = LZMA_STATUS_NOT_FINISHED; - return SZ_OK; - } - if (p->remainLen != 0) - { - *status = LZMA_STATUS_NOT_FINISHED; - return SZ_ERROR_DATA; - } - checkEndMarkNow = 1; - } - - if (p->needInitState) - LzmaDec_InitStateReal(p); - - if (p->tempBufSize == 0) - { - SizeT processed; - const Byte *bufLimit; - if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) - { - int dummyRes = LzmaDec_TryDummy(p, src, inSize); - if (dummyRes == DUMMY_ERROR) - { - memcpy(p->tempBuf, src, inSize); - p->tempBufSize = (unsigned)inSize; - (*srcLen) += inSize; - *status = LZMA_STATUS_NEEDS_MORE_INPUT; - return SZ_OK; - } - if (checkEndMarkNow && dummyRes != DUMMY_MATCH) - { - *status = LZMA_STATUS_NOT_FINISHED; - return SZ_ERROR_DATA; - } - bufLimit = src; - } - else - bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX; - p->buf = src; - if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0) - return SZ_ERROR_DATA; - processed = (SizeT)(p->buf - src); - (*srcLen) += processed; - src += processed; - inSize -= processed; - } - else - { - unsigned rem = p->tempBufSize, lookAhead = 0; - while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize) - p->tempBuf[rem++] = src[lookAhead++]; - p->tempBufSize = rem; - if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) - { - int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem); - if (dummyRes == DUMMY_ERROR) - { - (*srcLen) += lookAhead; - *status = LZMA_STATUS_NEEDS_MORE_INPUT; - return SZ_OK; - } - if (checkEndMarkNow && dummyRes != DUMMY_MATCH) - { - *status = LZMA_STATUS_NOT_FINISHED; - return SZ_ERROR_DATA; - } - } - p->buf = p->tempBuf; - if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0) - return SZ_ERROR_DATA; - - { - unsigned kkk = (unsigned)(p->buf - p->tempBuf); - if (rem < kkk) - return SZ_ERROR_FAIL; /* some internal error */ - rem -= kkk; - if (lookAhead < rem) - return SZ_ERROR_FAIL; /* some internal error */ - lookAhead -= rem; - } - (*srcLen) += lookAhead; - src += lookAhead; - inSize -= lookAhead; - p->tempBufSize = 0; - } - } - if (p->code == 0) - *status = LZMA_STATUS_FINISHED_WITH_MARK; - return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; -} - -SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) -{ - SizeT outSize = *destLen; - SizeT inSize = *srcLen; - *srcLen = *destLen = 0; - for (;;) - { - SizeT inSizeCur = inSize, outSizeCur, dicPos; - ELzmaFinishMode curFinishMode; - SRes res; - if (p->dicPos == p->dicBufSize) - p->dicPos = 0; - dicPos = p->dicPos; - if (outSize > p->dicBufSize - dicPos) - { - outSizeCur = p->dicBufSize; - curFinishMode = LZMA_FINISH_ANY; - } - else - { - outSizeCur = dicPos + outSize; - curFinishMode = finishMode; - } - - res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); - src += inSizeCur; - inSize -= inSizeCur; - *srcLen += inSizeCur; - outSizeCur = p->dicPos - dicPos; - memcpy(dest, p->dic + dicPos, outSizeCur); - dest += outSizeCur; - outSize -= outSizeCur; - *destLen += outSizeCur; - if (res != 0) - return res; - if (outSizeCur == 0 || outSize == 0) - return SZ_OK; - } -} - -void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) -{ - alloc->Free(alloc, p->probs); - p->probs = NULL; -} - -static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) -{ - alloc->Free(alloc, p->dic); - p->dic = NULL; -} - -void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc) -{ - LzmaDec_FreeProbs(p, alloc); - LzmaDec_FreeDict(p, alloc); -} - -SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) -{ - UInt32 dicSize; - Byte d; - - if (size < LZMA_PROPS_SIZE) - return SZ_ERROR_UNSUPPORTED; - else - dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24); - - if (dicSize < LZMA_DIC_MIN) - dicSize = LZMA_DIC_MIN; - p->dicSize = dicSize; - - d = data[0]; - if (d >= (9 * 5 * 5)) - return SZ_ERROR_UNSUPPORTED; - - p->lc = d % 9; - d /= 9; - p->pb = d / 5; - p->lp = d % 5; - - return SZ_OK; -} - -static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc) -{ - UInt32 numProbs = LzmaProps_GetNumProbs(propNew); - if (!p->probs || numProbs != p->numProbs) - { - LzmaDec_FreeProbs(p, alloc); - p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb)); - p->numProbs = numProbs; - if (!p->probs) - return SZ_ERROR_MEM; - } - return SZ_OK; -} - -SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -{ - CLzmaProps propNew; - RINOK(LzmaProps_Decode(&propNew, props, propsSize)); - RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); - p->prop = propNew; - return SZ_OK; -} - -SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -{ - CLzmaProps propNew; - SizeT dicBufSize; - RINOK(LzmaProps_Decode(&propNew, props, propsSize)); - RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); - - { - UInt32 dictSize = propNew.dicSize; - SizeT mask = ((UInt32)1 << 12) - 1; - if (dictSize >= ((UInt32)1 << 30)) mask = ((UInt32)1 << 22) - 1; - else if (dictSize >= ((UInt32)1 << 22)) mask = ((UInt32)1 << 20) - 1;; - dicBufSize = ((SizeT)dictSize + mask) & ~mask; - if (dicBufSize < dictSize) - dicBufSize = dictSize; - } - - if (!p->dic || dicBufSize != p->dicBufSize) - { - LzmaDec_FreeDict(p, alloc); - p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); - if (!p->dic) - { - LzmaDec_FreeProbs(p, alloc); - return SZ_ERROR_MEM; - } - } - p->dicBufSize = dicBufSize; - p->prop = propNew; - return SZ_OK; -} - -SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, - const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, - ELzmaStatus *status, ISzAlloc *alloc) -{ - CLzmaDec p; - SRes res; - SizeT outSize = *destLen, inSize = *srcLen; - *destLen = *srcLen = 0; - *status = LZMA_STATUS_NOT_SPECIFIED; - if (inSize < RC_INIT_SIZE) - return SZ_ERROR_INPUT_EOF; - LzmaDec_Construct(&p); - RINOK(LzmaDec_AllocateProbs(&p, propData, propSize, alloc)); - p.dic = dest; - p.dicBufSize = outSize; - LzmaDec_Init(&p); - *srcLen = inSize; - res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); - *destLen = p.dicPos; - if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) - res = SZ_ERROR_INPUT_EOF; - LzmaDec_FreeProbs(&p, alloc); - return res; -} +/* LzmaDec.c -- LZMA Decoder +2016-05-16 : Igor Pavlov : Public domain */ + +#include "Precomp.h" + +#include "LzmaDec.h" + +#include <string.h> + +#define kNumTopBits 24 +#define kTopValue ((UInt32)1 << kNumTopBits) + +#define kNumBitModelTotalBits 11 +#define kBitModelTotal (1 << kNumBitModelTotalBits) +#define kNumMoveBits 5 + +#define RC_INIT_SIZE 5 + +#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); } + +#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) +#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); +#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); +#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \ + { UPDATE_0(p); i = (i + i); A0; } else \ + { UPDATE_1(p); i = (i + i) + 1; A1; } +#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;) + +#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); } +#define TREE_DECODE(probs, limit, i) \ + { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; } + +/* #define _LZMA_SIZE_OPT */ + +#ifdef _LZMA_SIZE_OPT +#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i) +#else +#define TREE_6_DECODE(probs, i) \ + { i = 1; \ + TREE_GET_BIT(probs, i); \ + TREE_GET_BIT(probs, i); \ + TREE_GET_BIT(probs, i); \ + TREE_GET_BIT(probs, i); \ + TREE_GET_BIT(probs, i); \ + TREE_GET_BIT(probs, i); \ + i -= 0x40; } +#endif + +#define NORMAL_LITER_DEC GET_BIT(prob + symbol, symbol) +#define MATCHED_LITER_DEC \ + matchByte <<= 1; \ + bit = (matchByte & offs); \ + probLit = prob + offs + bit + symbol; \ + GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit) + +#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); } + +#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) +#define UPDATE_0_CHECK range = bound; +#define UPDATE_1_CHECK range -= bound; code -= bound; +#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \ + { UPDATE_0_CHECK; i = (i + i); A0; } else \ + { UPDATE_1_CHECK; i = (i + i) + 1; A1; } +#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;) +#define TREE_DECODE_CHECK(probs, limit, i) \ + { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; } + + +#define kNumPosBitsMax 4 +#define kNumPosStatesMax (1 << kNumPosBitsMax) + +#define kLenNumLowBits 3 +#define kLenNumLowSymbols (1 << kLenNumLowBits) +#define kLenNumMidBits 3 +#define kLenNumMidSymbols (1 << kLenNumMidBits) +#define kLenNumHighBits 8 +#define kLenNumHighSymbols (1 << kLenNumHighBits) + +#define LenChoice 0 +#define LenChoice2 (LenChoice + 1) +#define LenLow (LenChoice2 + 1) +#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) +#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) +#define kNumLenProbs (LenHigh + kLenNumHighSymbols) + + +#define kNumStates 12 +#define kNumLitStates 7 + +#define kStartPosModelIndex 4 +#define kEndPosModelIndex 14 +#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) + +#define kNumPosSlotBits 6 +#define kNumLenToPosStates 4 + +#define kNumAlignBits 4 +#define kAlignTableSize (1 << kNumAlignBits) + +#define kMatchMinLen 2 +#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) + +#define IsMatch 0 +#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) +#define IsRepG0 (IsRep + kNumStates) +#define IsRepG1 (IsRepG0 + kNumStates) +#define IsRepG2 (IsRepG1 + kNumStates) +#define IsRep0Long (IsRepG2 + kNumStates) +#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) +#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) +#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) +#define LenCoder (Align + kAlignTableSize) +#define RepLenCoder (LenCoder + kNumLenProbs) +#define Literal (RepLenCoder + kNumLenProbs) + +#define LZMA_BASE_SIZE 1846 +#define LZMA_LIT_SIZE 0x300 + +#if Literal != LZMA_BASE_SIZE +StopCompilingDueBUG +#endif + +#define LzmaProps_GetNumProbs(p) (Literal + ((UInt32)LZMA_LIT_SIZE << ((p)->lc + (p)->lp))) + +#define LZMA_DIC_MIN (1 << 12) + +/* First LZMA-symbol is always decoded. +And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization +Out: + Result: + SZ_OK - OK + SZ_ERROR_DATA - Error + p->remainLen: + < kMatchSpecLenStart : normal remain + = kMatchSpecLenStart : finished + = kMatchSpecLenStart + 1 : Flush marker (unused now) + = kMatchSpecLenStart + 2 : State Init Marker (unused now) +*/ + +static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit) +{ + CLzmaProb *probs = p->probs; + + unsigned state = p->state; + UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3]; + unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1; + unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1; + unsigned lc = p->prop.lc; + + Byte *dic = p->dic; + SizeT dicBufSize = p->dicBufSize; + SizeT dicPos = p->dicPos; + + UInt32 processedPos = p->processedPos; + UInt32 checkDicSize = p->checkDicSize; + unsigned len = 0; + + const Byte *buf = p->buf; + UInt32 range = p->range; + UInt32 code = p->code; + + do + { + CLzmaProb *prob; + UInt32 bound; + unsigned ttt; + unsigned posState = processedPos & pbMask; + + prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; + IF_BIT_0(prob) + { + unsigned symbol; + UPDATE_0(prob); + prob = probs + Literal; + if (processedPos != 0 || checkDicSize != 0) + prob += ((UInt32)LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) + + (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc)))); + processedPos++; + + if (state < kNumLitStates) + { + state -= (state < 4) ? state : 3; + symbol = 1; + #ifdef _LZMA_SIZE_OPT + do { NORMAL_LITER_DEC } while (symbol < 0x100); + #else + NORMAL_LITER_DEC + NORMAL_LITER_DEC + NORMAL_LITER_DEC + NORMAL_LITER_DEC + NORMAL_LITER_DEC + NORMAL_LITER_DEC + NORMAL_LITER_DEC + NORMAL_LITER_DEC + #endif + } + else + { + unsigned matchByte = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)]; + unsigned offs = 0x100; + state -= (state < 10) ? 3 : 6; + symbol = 1; + #ifdef _LZMA_SIZE_OPT + do + { + unsigned bit; + CLzmaProb *probLit; + MATCHED_LITER_DEC + } + while (symbol < 0x100); + #else + { + unsigned bit; + CLzmaProb *probLit; + MATCHED_LITER_DEC + MATCHED_LITER_DEC + MATCHED_LITER_DEC + MATCHED_LITER_DEC + MATCHED_LITER_DEC + MATCHED_LITER_DEC + MATCHED_LITER_DEC + MATCHED_LITER_DEC + } + #endif + } + + dic[dicPos++] = (Byte)symbol; + continue; + } + + { + UPDATE_1(prob); + prob = probs + IsRep + state; + IF_BIT_0(prob) + { + UPDATE_0(prob); + state += kNumStates; + prob = probs + LenCoder; + } + else + { + UPDATE_1(prob); + if (checkDicSize == 0 && processedPos == 0) + return SZ_ERROR_DATA; + prob = probs + IsRepG0 + state; + IF_BIT_0(prob) + { + UPDATE_0(prob); + prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; + IF_BIT_0(prob) + { + UPDATE_0(prob); + dic[dicPos] = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)]; + dicPos++; + processedPos++; + state = state < kNumLitStates ? 9 : 11; + continue; + } + UPDATE_1(prob); + } + else + { + UInt32 distance; + UPDATE_1(prob); + prob = probs + IsRepG1 + state; + IF_BIT_0(prob) + { + UPDATE_0(prob); + distance = rep1; + } + else + { + UPDATE_1(prob); + prob = probs + IsRepG2 + state; + IF_BIT_0(prob) + { + UPDATE_0(prob); + distance = rep2; + } + else + { + UPDATE_1(prob); + distance = rep3; + rep3 = rep2; + } + rep2 = rep1; + } + rep1 = rep0; + rep0 = distance; + } + state = state < kNumLitStates ? 8 : 11; + prob = probs + RepLenCoder; + } + + #ifdef _LZMA_SIZE_OPT + { + unsigned lim, offset; + CLzmaProb *probLen = prob + LenChoice; + IF_BIT_0(probLen) + { + UPDATE_0(probLen); + probLen = prob + LenLow + (posState << kLenNumLowBits); + offset = 0; + lim = (1 << kLenNumLowBits); + } + else + { + UPDATE_1(probLen); + probLen = prob + LenChoice2; + IF_BIT_0(probLen) + { + UPDATE_0(probLen); + probLen = prob + LenMid + (posState << kLenNumMidBits); + offset = kLenNumLowSymbols; + lim = (1 << kLenNumMidBits); + } + else + { + UPDATE_1(probLen); + probLen = prob + LenHigh; + offset = kLenNumLowSymbols + kLenNumMidSymbols; + lim = (1 << kLenNumHighBits); + } + } + TREE_DECODE(probLen, lim, len); + len += offset; + } + #else + { + CLzmaProb *probLen = prob + LenChoice; + IF_BIT_0(probLen) + { + UPDATE_0(probLen); + probLen = prob + LenLow + (posState << kLenNumLowBits); + len = 1; + TREE_GET_BIT(probLen, len); + TREE_GET_BIT(probLen, len); + TREE_GET_BIT(probLen, len); + len -= 8; + } + else + { + UPDATE_1(probLen); + probLen = prob + LenChoice2; + IF_BIT_0(probLen) + { + UPDATE_0(probLen); + probLen = prob + LenMid + (posState << kLenNumMidBits); + len = 1; + TREE_GET_BIT(probLen, len); + TREE_GET_BIT(probLen, len); + TREE_GET_BIT(probLen, len); + } + else + { + UPDATE_1(probLen); + probLen = prob + LenHigh; + TREE_DECODE(probLen, (1 << kLenNumHighBits), len); + len += kLenNumLowSymbols + kLenNumMidSymbols; + } + } + } + #endif + + if (state >= kNumStates) + { + UInt32 distance; + prob = probs + PosSlot + + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); + TREE_6_DECODE(prob, distance); + if (distance >= kStartPosModelIndex) + { + unsigned posSlot = (unsigned)distance; + unsigned numDirectBits = (unsigned)(((distance >> 1) - 1)); + distance = (2 | (distance & 1)); + if (posSlot < kEndPosModelIndex) + { + distance <<= numDirectBits; + prob = probs + SpecPos + distance - posSlot - 1; + { + UInt32 mask = 1; + unsigned i = 1; + do + { + GET_BIT2(prob + i, i, ; , distance |= mask); + mask <<= 1; + } + while (--numDirectBits != 0); + } + } + else + { + numDirectBits -= kNumAlignBits; + do + { + NORMALIZE + range >>= 1; + + { + UInt32 t; + code -= range; + t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */ + distance = (distance << 1) + (t + 1); + code += range & t; + } + /* + distance <<= 1; + if (code >= range) + { + code -= range; + distance |= 1; + } + */ + } + while (--numDirectBits != 0); + prob = probs + Align; + distance <<= kNumAlignBits; + { + unsigned i = 1; + GET_BIT2(prob + i, i, ; , distance |= 1); + GET_BIT2(prob + i, i, ; , distance |= 2); + GET_BIT2(prob + i, i, ; , distance |= 4); + GET_BIT2(prob + i, i, ; , distance |= 8); + } + if (distance == (UInt32)0xFFFFFFFF) + { + len += kMatchSpecLenStart; + state -= kNumStates; + break; + } + } + } + + rep3 = rep2; + rep2 = rep1; + rep1 = rep0; + rep0 = distance + 1; + if (checkDicSize == 0) + { + if (distance >= processedPos) + { + p->dicPos = dicPos; + return SZ_ERROR_DATA; + } + } + else if (distance >= checkDicSize) + { + p->dicPos = dicPos; + return SZ_ERROR_DATA; + } + state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3; + } + + len += kMatchMinLen; + + { + SizeT rem; + unsigned curLen; + SizeT pos; + + if ((rem = limit - dicPos) == 0) + { + p->dicPos = dicPos; + return SZ_ERROR_DATA; + } + + curLen = ((rem < len) ? (unsigned)rem : len); + pos = dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0); + + processedPos += curLen; + + len -= curLen; + if (curLen <= dicBufSize - pos) + { + Byte *dest = dic + dicPos; + ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos; + const Byte *lim = dest + curLen; + dicPos += curLen; + do + *(dest) = (Byte)*(dest + src); + while (++dest != lim); + } + else + { + do + { + dic[dicPos++] = dic[pos]; + if (++pos == dicBufSize) + pos = 0; + } + while (--curLen != 0); + } + } + } + } + while (dicPos < limit && buf < bufLimit); + + NORMALIZE; + + p->buf = buf; + p->range = range; + p->code = code; + p->remainLen = len; + p->dicPos = dicPos; + p->processedPos = processedPos; + p->reps[0] = rep0; + p->reps[1] = rep1; + p->reps[2] = rep2; + p->reps[3] = rep3; + p->state = state; + + return SZ_OK; +} + +static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit) +{ + if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart) + { + Byte *dic = p->dic; + SizeT dicPos = p->dicPos; + SizeT dicBufSize = p->dicBufSize; + unsigned len = p->remainLen; + SizeT rep0 = p->reps[0]; /* we use SizeT to avoid the BUG of VC14 for AMD64 */ + SizeT rem = limit - dicPos; + if (rem < len) + len = (unsigned)(rem); + + if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len) + p->checkDicSize = p->prop.dicSize; + + p->processedPos += len; + p->remainLen -= len; + while (len != 0) + { + len--; + dic[dicPos] = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)]; + dicPos++; + } + p->dicPos = dicPos; + } +} + +static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit) +{ + do + { + SizeT limit2 = limit; + if (p->checkDicSize == 0) + { + UInt32 rem = p->prop.dicSize - p->processedPos; + if (limit - p->dicPos > rem) + limit2 = p->dicPos + rem; + } + + RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit)); + + if (p->checkDicSize == 0 && p->processedPos >= p->prop.dicSize) + p->checkDicSize = p->prop.dicSize; + + LzmaDec_WriteRem(p, limit); + } + while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart); + + if (p->remainLen > kMatchSpecLenStart) + p->remainLen = kMatchSpecLenStart; + + return 0; +} + +typedef enum +{ + DUMMY_ERROR, /* unexpected end of input stream */ + DUMMY_LIT, + DUMMY_MATCH, + DUMMY_REP +} ELzmaDummy; + +static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize) +{ + UInt32 range = p->range; + UInt32 code = p->code; + const Byte *bufLimit = buf + inSize; + const CLzmaProb *probs = p->probs; + unsigned state = p->state; + ELzmaDummy res; + + { + const CLzmaProb *prob; + UInt32 bound; + unsigned ttt; + unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1); + + prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK + + /* if (bufLimit - buf >= 7) return DUMMY_LIT; */ + + prob = probs + Literal; + if (p->checkDicSize != 0 || p->processedPos != 0) + prob += ((UInt32)LZMA_LIT_SIZE * + ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) + + (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc)))); + + if (state < kNumLitStates) + { + unsigned symbol = 1; + do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100); + } + else + { + unsigned matchByte = p->dic[p->dicPos - p->reps[0] + + (p->dicPos < p->reps[0] ? p->dicBufSize : 0)]; + unsigned offs = 0x100; + unsigned symbol = 1; + do + { + unsigned bit; + const CLzmaProb *probLit; + matchByte <<= 1; + bit = (matchByte & offs); + probLit = prob + offs + bit + symbol; + GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit) + } + while (symbol < 0x100); + } + res = DUMMY_LIT; + } + else + { + unsigned len; + UPDATE_1_CHECK; + + prob = probs + IsRep + state; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK; + state = 0; + prob = probs + LenCoder; + res = DUMMY_MATCH; + } + else + { + UPDATE_1_CHECK; + res = DUMMY_REP; + prob = probs + IsRepG0 + state; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK; + prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK; + NORMALIZE_CHECK; + return DUMMY_REP; + } + else + { + UPDATE_1_CHECK; + } + } + else + { + UPDATE_1_CHECK; + prob = probs + IsRepG1 + state; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK; + } + else + { + UPDATE_1_CHECK; + prob = probs + IsRepG2 + state; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK; + } + else + { + UPDATE_1_CHECK; + } + } + } + state = kNumStates; + prob = probs + RepLenCoder; + } + { + unsigned limit, offset; + const CLzmaProb *probLen = prob + LenChoice; + IF_BIT_0_CHECK(probLen) + { + UPDATE_0_CHECK; + probLen = prob + LenLow + (posState << kLenNumLowBits); + offset = 0; + limit = 1 << kLenNumLowBits; + } + else + { + UPDATE_1_CHECK; + probLen = prob + LenChoice2; + IF_BIT_0_CHECK(probLen) + { + UPDATE_0_CHECK; + probLen = prob + LenMid + (posState << kLenNumMidBits); + offset = kLenNumLowSymbols; + limit = 1 << kLenNumMidBits; + } + else + { + UPDATE_1_CHECK; + probLen = prob + LenHigh; + offset = kLenNumLowSymbols + kLenNumMidSymbols; + limit = 1 << kLenNumHighBits; + } + } + TREE_DECODE_CHECK(probLen, limit, len); + len += offset; + } + + if (state < 4) + { + unsigned posSlot; + prob = probs + PosSlot + + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << + kNumPosSlotBits); + TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot); + if (posSlot >= kStartPosModelIndex) + { + unsigned numDirectBits = ((posSlot >> 1) - 1); + + /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */ + + if (posSlot < kEndPosModelIndex) + { + prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1; + } + else + { + numDirectBits -= kNumAlignBits; + do + { + NORMALIZE_CHECK + range >>= 1; + code -= range & (((code - range) >> 31) - 1); + /* if (code >= range) code -= range; */ + } + while (--numDirectBits != 0); + prob = probs + Align; + numDirectBits = kNumAlignBits; + } + { + unsigned i = 1; + do + { + GET_BIT_CHECK(prob + i, i); + } + while (--numDirectBits != 0); + } + } + } + } + } + NORMALIZE_CHECK; + return res; +} + + +void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) +{ + p->needFlush = 1; + p->remainLen = 0; + p->tempBufSize = 0; + + if (initDic) + { + p->processedPos = 0; + p->checkDicSize = 0; + p->needInitState = 1; + } + if (initState) + p->needInitState = 1; +} + +void LzmaDec_Init(CLzmaDec *p) +{ + p->dicPos = 0; + LzmaDec_InitDicAndState(p, True, True); +} + +static void LzmaDec_InitStateReal(CLzmaDec *p) +{ + SizeT numProbs = LzmaProps_GetNumProbs(&p->prop); + SizeT i; + CLzmaProb *probs = p->probs; + for (i = 0; i < numProbs; i++) + probs[i] = kBitModelTotal >> 1; + p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1; + p->state = 0; + p->needInitState = 0; +} + +SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, + ELzmaFinishMode finishMode, ELzmaStatus *status) +{ + SizeT inSize = *srcLen; + (*srcLen) = 0; + LzmaDec_WriteRem(p, dicLimit); + + *status = LZMA_STATUS_NOT_SPECIFIED; + + while (p->remainLen != kMatchSpecLenStart) + { + int checkEndMarkNow; + + if (p->needFlush) + { + for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--) + p->tempBuf[p->tempBufSize++] = *src++; + if (p->tempBufSize < RC_INIT_SIZE) + { + *status = LZMA_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + if (p->tempBuf[0] != 0) + return SZ_ERROR_DATA; + p->code = + ((UInt32)p->tempBuf[1] << 24) + | ((UInt32)p->tempBuf[2] << 16) + | ((UInt32)p->tempBuf[3] << 8) + | ((UInt32)p->tempBuf[4]); + p->range = 0xFFFFFFFF; + p->needFlush = 0; + p->tempBufSize = 0; + } + + checkEndMarkNow = 0; + if (p->dicPos >= dicLimit) + { + if (p->remainLen == 0 && p->code == 0) + { + *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK; + return SZ_OK; + } + if (finishMode == LZMA_FINISH_ANY) + { + *status = LZMA_STATUS_NOT_FINISHED; + return SZ_OK; + } + if (p->remainLen != 0) + { + *status = LZMA_STATUS_NOT_FINISHED; + return SZ_ERROR_DATA; + } + checkEndMarkNow = 1; + } + + if (p->needInitState) + LzmaDec_InitStateReal(p); + + if (p->tempBufSize == 0) + { + SizeT processed; + const Byte *bufLimit; + if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) + { + int dummyRes = LzmaDec_TryDummy(p, src, inSize); + if (dummyRes == DUMMY_ERROR) + { + memcpy(p->tempBuf, src, inSize); + p->tempBufSize = (unsigned)inSize; + (*srcLen) += inSize; + *status = LZMA_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + if (checkEndMarkNow && dummyRes != DUMMY_MATCH) + { + *status = LZMA_STATUS_NOT_FINISHED; + return SZ_ERROR_DATA; + } + bufLimit = src; + } + else + bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX; + p->buf = src; + if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0) + return SZ_ERROR_DATA; + processed = (SizeT)(p->buf - src); + (*srcLen) += processed; + src += processed; + inSize -= processed; + } + else + { + unsigned rem = p->tempBufSize, lookAhead = 0; + while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize) + p->tempBuf[rem++] = src[lookAhead++]; + p->tempBufSize = rem; + if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) + { + int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem); + if (dummyRes == DUMMY_ERROR) + { + (*srcLen) += lookAhead; + *status = LZMA_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + if (checkEndMarkNow && dummyRes != DUMMY_MATCH) + { + *status = LZMA_STATUS_NOT_FINISHED; + return SZ_ERROR_DATA; + } + } + p->buf = p->tempBuf; + if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0) + return SZ_ERROR_DATA; + + { + unsigned kkk = (unsigned)(p->buf - p->tempBuf); + if (rem < kkk) + return SZ_ERROR_FAIL; /* some internal error */ + rem -= kkk; + if (lookAhead < rem) + return SZ_ERROR_FAIL; /* some internal error */ + lookAhead -= rem; + } + (*srcLen) += lookAhead; + src += lookAhead; + inSize -= lookAhead; + p->tempBufSize = 0; + } + } + if (p->code == 0) + *status = LZMA_STATUS_FINISHED_WITH_MARK; + return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; +} + +SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) +{ + SizeT outSize = *destLen; + SizeT inSize = *srcLen; + *srcLen = *destLen = 0; + for (;;) + { + SizeT inSizeCur = inSize, outSizeCur, dicPos; + ELzmaFinishMode curFinishMode; + SRes res; + if (p->dicPos == p->dicBufSize) + p->dicPos = 0; + dicPos = p->dicPos; + if (outSize > p->dicBufSize - dicPos) + { + outSizeCur = p->dicBufSize; + curFinishMode = LZMA_FINISH_ANY; + } + else + { + outSizeCur = dicPos + outSize; + curFinishMode = finishMode; + } + + res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); + src += inSizeCur; + inSize -= inSizeCur; + *srcLen += inSizeCur; + outSizeCur = p->dicPos - dicPos; + memcpy(dest, p->dic + dicPos, outSizeCur); + dest += outSizeCur; + outSize -= outSizeCur; + *destLen += outSizeCur; + if (res != 0) + return res; + if (outSizeCur == 0 || outSize == 0) + return SZ_OK; + } +} + +void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->probs); + p->probs = NULL; +} + +static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->dic); + p->dic = NULL; +} + +void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc) +{ + LzmaDec_FreeProbs(p, alloc); + LzmaDec_FreeDict(p, alloc); +} + +SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) +{ + UInt32 dicSize; + Byte d; + + if (size < LZMA_PROPS_SIZE) + return SZ_ERROR_UNSUPPORTED; + else + dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24); + + if (dicSize < LZMA_DIC_MIN) + dicSize = LZMA_DIC_MIN; + p->dicSize = dicSize; + + d = data[0]; + if (d >= (9 * 5 * 5)) + return SZ_ERROR_UNSUPPORTED; + + p->lc = d % 9; + d /= 9; + p->pb = d / 5; + p->lp = d % 5; + + return SZ_OK; +} + +static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc) +{ + UInt32 numProbs = LzmaProps_GetNumProbs(propNew); + if (!p->probs || numProbs != p->numProbs) + { + LzmaDec_FreeProbs(p, alloc); + p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb)); + p->numProbs = numProbs; + if (!p->probs) + return SZ_ERROR_MEM; + } + return SZ_OK; +} + +SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) +{ + CLzmaProps propNew; + RINOK(LzmaProps_Decode(&propNew, props, propsSize)); + RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); + p->prop = propNew; + return SZ_OK; +} + +SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) +{ + CLzmaProps propNew; + SizeT dicBufSize; + RINOK(LzmaProps_Decode(&propNew, props, propsSize)); + RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); + + { + UInt32 dictSize = propNew.dicSize; + SizeT mask = ((UInt32)1 << 12) - 1; + if (dictSize >= ((UInt32)1 << 30)) mask = ((UInt32)1 << 22) - 1; + else if (dictSize >= ((UInt32)1 << 22)) mask = ((UInt32)1 << 20) - 1;; + dicBufSize = ((SizeT)dictSize + mask) & ~mask; + if (dicBufSize < dictSize) + dicBufSize = dictSize; + } + + if (!p->dic || dicBufSize != p->dicBufSize) + { + LzmaDec_FreeDict(p, alloc); + p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); + if (!p->dic) + { + LzmaDec_FreeProbs(p, alloc); + return SZ_ERROR_MEM; + } + } + p->dicBufSize = dicBufSize; + p->prop = propNew; + return SZ_OK; +} + +SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, + ELzmaStatus *status, ISzAlloc *alloc) +{ + CLzmaDec p; + SRes res; + SizeT outSize = *destLen, inSize = *srcLen; + *destLen = *srcLen = 0; + *status = LZMA_STATUS_NOT_SPECIFIED; + if (inSize < RC_INIT_SIZE) + return SZ_ERROR_INPUT_EOF; + LzmaDec_Construct(&p); + RINOK(LzmaDec_AllocateProbs(&p, propData, propSize, alloc)); + p.dic = dest; + p.dicBufSize = outSize; + LzmaDec_Init(&p); + *srcLen = inSize; + res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); + *destLen = p.dicPos; + if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) + res = SZ_ERROR_INPUT_EOF; + LzmaDec_FreeProbs(&p, alloc); + return res; +} diff --git a/src/lzma/LzmaEnc.c b/src/lzma/LzmaEnc.c index 462ca67565..f4eb6a5e67 100644 --- a/src/lzma/LzmaEnc.c +++ b/src/lzma/LzmaEnc.c @@ -1,2351 +1,2351 @@ -/* LzmaEnc.c -- LZMA Encoder -2016-05-16 : Igor Pavlov : Public domain */ - -#include "Precomp.h" - -#include <string.h> - -/* #define SHOW_STAT */ -/* #define SHOW_STAT2 */ - -#if defined(SHOW_STAT) || defined(SHOW_STAT2) -#include <stdio.h> -#endif - -#include "LzmaEnc.h" - -#include "LzFind.h" -#ifndef _7ZIP_ST -#include "LzFindMt.h" -#endif - -#ifdef SHOW_STAT -static unsigned g_STAT_OFFSET = 0; -#endif - -#define kMaxHistorySize ((UInt32)3 << 29) -/* #define kMaxHistorySize ((UInt32)7 << 29) */ - -#define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1) - -#define kBlockSize (9 << 10) -#define kUnpackBlockSize (1 << 18) -#define kMatchArraySize (1 << 21) -#define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX) - -#define kNumMaxDirectBits (31) - -#define kNumTopBits 24 -#define kTopValue ((UInt32)1 << kNumTopBits) - -#define kNumBitModelTotalBits 11 -#define kBitModelTotal (1 << kNumBitModelTotalBits) -#define kNumMoveBits 5 -#define kProbInitValue (kBitModelTotal >> 1) - -#define kNumMoveReducingBits 4 -#define kNumBitPriceShiftBits 4 -#define kBitPrice (1 << kNumBitPriceShiftBits) - -void LzmaEncProps_Init(CLzmaEncProps *p) -{ - p->level = 5; - p->dictSize = p->mc = 0; - p->reduceSize = (UInt64)(Int64)-1; - p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1; - p->writeEndMark = 0; -} - -void LzmaEncProps_Normalize(CLzmaEncProps *p) -{ - int level = p->level; - if (level < 0) level = 5; - p->level = level; - - if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26))); - if (p->dictSize > p->reduceSize) - { - unsigned i; - for (i = 11; i <= 30; i++) - { - if ((UInt32)p->reduceSize <= ((UInt32)2 << i)) { p->dictSize = ((UInt32)2 << i); break; } - if ((UInt32)p->reduceSize <= ((UInt32)3 << i)) { p->dictSize = ((UInt32)3 << i); break; } - } - } - - if (p->lc < 0) p->lc = 3; - if (p->lp < 0) p->lp = 0; - if (p->pb < 0) p->pb = 2; - - if (p->algo < 0) p->algo = (level < 5 ? 0 : 1); - if (p->fb < 0) p->fb = (level < 7 ? 32 : 64); - if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1); - if (p->numHashBytes < 0) p->numHashBytes = 4; - if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1); - - if (p->numThreads < 0) - p->numThreads = - #ifndef _7ZIP_ST - ((p->btMode && p->algo) ? 2 : 1); - #else - 1; - #endif -} - -UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) -{ - CLzmaEncProps props = *props2; - LzmaEncProps_Normalize(&props); - return props.dictSize; -} - -#if (_MSC_VER >= 1400) -/* BSR code is fast for some new CPUs */ -/* #define LZMA_LOG_BSR */ -#endif - -#ifdef LZMA_LOG_BSR - -#define kDicLogSizeMaxCompress 32 - -#define BSR2_RET(pos, res) { unsigned long zz; _BitScanReverse(&zz, (pos)); res = (zz + zz) + ((pos >> (zz - 1)) & 1); } - -static UInt32 GetPosSlot1(UInt32 pos) -{ - UInt32 res; - BSR2_RET(pos, res); - return res; -} -#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } -#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); } - -#else - -#define kNumLogBits (9 + sizeof(size_t) / 2) -/* #define kNumLogBits (11 + sizeof(size_t) / 8 * 3) */ - -#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) - -static void LzmaEnc_FastPosInit(Byte *g_FastPos) -{ - unsigned slot; - g_FastPos[0] = 0; - g_FastPos[1] = 1; - g_FastPos += 2; - - for (slot = 2; slot < kNumLogBits * 2; slot++) - { - size_t k = ((size_t)1 << ((slot >> 1) - 1)); - size_t j; - for (j = 0; j < k; j++) - g_FastPos[j] = (Byte)slot; - g_FastPos += k; - } -} - -/* we can use ((limit - pos) >> 31) only if (pos < ((UInt32)1 << 31)) */ -/* -#define BSR2_RET(pos, res) { UInt32 zz = 6 + ((kNumLogBits - 1) & \ - (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \ - res = p->g_FastPos[pos >> zz] + (zz * 2); } -*/ - -/* -#define BSR2_RET(pos, res) { UInt32 zz = 6 + ((kNumLogBits - 1) & \ - (0 - (((((UInt32)1 << (kNumLogBits)) - 1) - (pos >> 6)) >> 31))); \ - res = p->g_FastPos[pos >> zz] + (zz * 2); } -*/ - -#define BSR2_RET(pos, res) { UInt32 zz = (pos < (1 << (kNumLogBits + 6))) ? 6 : 6 + kNumLogBits - 1; \ - res = p->g_FastPos[pos >> zz] + (zz * 2); } - -/* -#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \ - p->g_FastPos[pos >> 6] + 12 : \ - p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; } -*/ - -#define GetPosSlot1(pos) p->g_FastPos[pos] -#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } -#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); } - -#endif - - -#define LZMA_NUM_REPS 4 - -typedef unsigned CState; - -typedef struct -{ - UInt32 price; - - CState state; - int prev1IsChar; - int prev2; - - UInt32 posPrev2; - UInt32 backPrev2; - - UInt32 posPrev; - UInt32 backPrev; - UInt32 backs[LZMA_NUM_REPS]; -} COptimal; - -#define kNumOpts (1 << 12) - -#define kNumLenToPosStates 4 -#define kNumPosSlotBits 6 -#define kDicLogSizeMin 0 -#define kDicLogSizeMax 32 -#define kDistTableSizeMax (kDicLogSizeMax * 2) - - -#define kNumAlignBits 4 -#define kAlignTableSize (1 << kNumAlignBits) -#define kAlignMask (kAlignTableSize - 1) - -#define kStartPosModelIndex 4 -#define kEndPosModelIndex 14 -#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex) - -#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) - -#ifdef _LZMA_PROB32 -#define CLzmaProb UInt32 -#else -#define CLzmaProb UInt16 -#endif - -#define LZMA_PB_MAX 4 -#define LZMA_LC_MAX 8 -#define LZMA_LP_MAX 4 - -#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX) - - -#define kLenNumLowBits 3 -#define kLenNumLowSymbols (1 << kLenNumLowBits) -#define kLenNumMidBits 3 -#define kLenNumMidSymbols (1 << kLenNumMidBits) -#define kLenNumHighBits 8 -#define kLenNumHighSymbols (1 << kLenNumHighBits) - -#define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) - -#define LZMA_MATCH_LEN_MIN 2 -#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1) - -#define kNumStates 12 - - -typedef struct -{ - CLzmaProb choice; - CLzmaProb choice2; - CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits]; - CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits]; - CLzmaProb high[kLenNumHighSymbols]; -} CLenEnc; - - -typedef struct -{ - CLenEnc p; - UInt32 tableSize; - UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal]; - UInt32 counters[LZMA_NUM_PB_STATES_MAX]; -} CLenPriceEnc; - - -typedef struct -{ - UInt32 range; - Byte cache; - UInt64 low; - UInt64 cacheSize; - Byte *buf; - Byte *bufLim; - Byte *bufBase; - ISeqOutStream *outStream; - UInt64 processed; - SRes res; -} CRangeEnc; - - -typedef struct -{ - CLzmaProb *litProbs; - - UInt32 state; - UInt32 reps[LZMA_NUM_REPS]; - - CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; - CLzmaProb isRep[kNumStates]; - CLzmaProb isRepG0[kNumStates]; - CLzmaProb isRepG1[kNumStates]; - CLzmaProb isRepG2[kNumStates]; - CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; - - CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; - CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; - CLzmaProb posAlignEncoder[1 << kNumAlignBits]; - - CLenPriceEnc lenEnc; - CLenPriceEnc repLenEnc; -} CSaveState; - - -typedef struct -{ - void *matchFinderObj; - IMatchFinder matchFinder; - - UInt32 optimumEndIndex; - UInt32 optimumCurrentIndex; - - UInt32 longestMatchLength; - UInt32 numPairs; - UInt32 numAvail; - - UInt32 numFastBytes; - UInt32 additionalOffset; - UInt32 reps[LZMA_NUM_REPS]; - UInt32 state; - - unsigned lc, lp, pb; - unsigned lpMask, pbMask; - unsigned lclp; - - CLzmaProb *litProbs; - - Bool fastMode; - Bool writeEndMark; - Bool finished; - Bool multiThread; - Bool needInit; - - UInt64 nowPos64; - - UInt32 matchPriceCount; - UInt32 alignPriceCount; - - UInt32 distTableSize; - - UInt32 dictSize; - SRes result; - - CRangeEnc rc; - - #ifndef _7ZIP_ST - Bool mtMode; - CMatchFinderMt matchFinderMt; - #endif - - CMatchFinder matchFinderBase; - - #ifndef _7ZIP_ST - Byte pad[128]; - #endif - - COptimal opt[kNumOpts]; - - #ifndef LZMA_LOG_BSR - Byte g_FastPos[1 << kNumLogBits]; - #endif - - UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits]; - UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1]; - - UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax]; - UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances]; - UInt32 alignPrices[kAlignTableSize]; - - CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; - CLzmaProb isRep[kNumStates]; - CLzmaProb isRepG0[kNumStates]; - CLzmaProb isRepG1[kNumStates]; - CLzmaProb isRepG2[kNumStates]; - CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; - - CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; - CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; - CLzmaProb posAlignEncoder[1 << kNumAlignBits]; - - CLenPriceEnc lenEnc; - CLenPriceEnc repLenEnc; - - CSaveState saveState; - - #ifndef _7ZIP_ST - Byte pad2[128]; - #endif -} CLzmaEnc; - - -void LzmaEnc_SaveState(CLzmaEncHandle pp) -{ - CLzmaEnc *p = (CLzmaEnc *)pp; - CSaveState *dest = &p->saveState; - int i; - dest->lenEnc = p->lenEnc; - dest->repLenEnc = p->repLenEnc; - dest->state = p->state; - - for (i = 0; i < kNumStates; i++) - { - memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); - memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); - } - for (i = 0; i < kNumLenToPosStates; i++) - memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); - memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); - memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); - memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); - memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); - memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); - memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); - memcpy(dest->reps, p->reps, sizeof(p->reps)); - memcpy(dest->litProbs, p->litProbs, ((UInt32)0x300 << p->lclp) * sizeof(CLzmaProb)); -} - -void LzmaEnc_RestoreState(CLzmaEncHandle pp) -{ - CLzmaEnc *dest = (CLzmaEnc *)pp; - const CSaveState *p = &dest->saveState; - int i; - dest->lenEnc = p->lenEnc; - dest->repLenEnc = p->repLenEnc; - dest->state = p->state; - - for (i = 0; i < kNumStates; i++) - { - memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); - memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); - } - for (i = 0; i < kNumLenToPosStates; i++) - memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); - memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); - memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); - memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); - memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); - memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); - memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); - memcpy(dest->reps, p->reps, sizeof(p->reps)); - memcpy(dest->litProbs, p->litProbs, ((UInt32)0x300 << dest->lclp) * sizeof(CLzmaProb)); -} - -SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) -{ - CLzmaEnc *p = (CLzmaEnc *)pp; - CLzmaEncProps props = *props2; - LzmaEncProps_Normalize(&props); - - if (props.lc > LZMA_LC_MAX - || props.lp > LZMA_LP_MAX - || props.pb > LZMA_PB_MAX - || props.dictSize > ((UInt64)1 << kDicLogSizeMaxCompress) - || props.dictSize > kMaxHistorySize) - return SZ_ERROR_PARAM; - - p->dictSize = props.dictSize; - { - unsigned fb = props.fb; - if (fb < 5) - fb = 5; - if (fb > LZMA_MATCH_LEN_MAX) - fb = LZMA_MATCH_LEN_MAX; - p->numFastBytes = fb; - } - p->lc = props.lc; - p->lp = props.lp; - p->pb = props.pb; - p->fastMode = (props.algo == 0); - p->matchFinderBase.btMode = (Byte)(props.btMode ? 1 : 0); - { - UInt32 numHashBytes = 4; - if (props.btMode) - { - if (props.numHashBytes < 2) - numHashBytes = 2; - else if (props.numHashBytes < 4) - numHashBytes = props.numHashBytes; - } - p->matchFinderBase.numHashBytes = numHashBytes; - } - - p->matchFinderBase.cutValue = props.mc; - - p->writeEndMark = props.writeEndMark; - - #ifndef _7ZIP_ST - /* - if (newMultiThread != _multiThread) - { - ReleaseMatchFinder(); - _multiThread = newMultiThread; - } - */ - p->multiThread = (props.numThreads > 1); - #endif - - return SZ_OK; -} - -static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5}; -static const int kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10}; -static const int kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11}; -static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11}; - -#define IsCharState(s) ((s) < 7) - -#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1) - -#define kInfinityPrice (1 << 30) - -static void RangeEnc_Construct(CRangeEnc *p) -{ - p->outStream = NULL; - p->bufBase = NULL; -} - -#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize) - -#define RC_BUF_SIZE (1 << 16) -static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc) -{ - if (!p->bufBase) - { - p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE); - if (!p->bufBase) - return 0; - p->bufLim = p->bufBase + RC_BUF_SIZE; - } - return 1; -} - -static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc) -{ - alloc->Free(alloc, p->bufBase); - p->bufBase = 0; -} - -static void RangeEnc_Init(CRangeEnc *p) -{ - /* Stream.Init(); */ - p->low = 0; - p->range = 0xFFFFFFFF; - p->cacheSize = 1; - p->cache = 0; - - p->buf = p->bufBase; - - p->processed = 0; - p->res = SZ_OK; -} - -static void RangeEnc_FlushStream(CRangeEnc *p) -{ - size_t num; - if (p->res != SZ_OK) - return; - num = p->buf - p->bufBase; - if (num != p->outStream->Write(p->outStream, p->bufBase, num)) - p->res = SZ_ERROR_WRITE; - p->processed += num; - p->buf = p->bufBase; -} - -static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p) -{ - if ((UInt32)p->low < (UInt32)0xFF000000 || (unsigned)(p->low >> 32) != 0) - { - Byte temp = p->cache; - do - { - Byte *buf = p->buf; - *buf++ = (Byte)(temp + (Byte)(p->low >> 32)); - p->buf = buf; - if (buf == p->bufLim) - RangeEnc_FlushStream(p); - temp = 0xFF; - } - while (--p->cacheSize != 0); - p->cache = (Byte)((UInt32)p->low >> 24); - } - p->cacheSize++; - p->low = (UInt32)p->low << 8; -} - -static void RangeEnc_FlushData(CRangeEnc *p) -{ - int i; - for (i = 0; i < 5; i++) - RangeEnc_ShiftLow(p); -} - -static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, unsigned numBits) -{ - do - { - p->range >>= 1; - p->low += p->range & (0 - ((value >> --numBits) & 1)); - if (p->range < kTopValue) - { - p->range <<= 8; - RangeEnc_ShiftLow(p); - } - } - while (numBits != 0); -} - -static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol) -{ - UInt32 ttt = *prob; - UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt; - if (symbol == 0) - { - p->range = newBound; - ttt += (kBitModelTotal - ttt) >> kNumMoveBits; - } - else - { - p->low += newBound; - p->range -= newBound; - ttt -= ttt >> kNumMoveBits; - } - *prob = (CLzmaProb)ttt; - if (p->range < kTopValue) - { - p->range <<= 8; - RangeEnc_ShiftLow(p); - } -} - -static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol) -{ - symbol |= 0x100; - do - { - RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1); - symbol <<= 1; - } - while (symbol < 0x10000); -} - -static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte) -{ - UInt32 offs = 0x100; - symbol |= 0x100; - do - { - matchByte <<= 1; - RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1); - symbol <<= 1; - offs &= ~(matchByte ^ symbol); - } - while (symbol < 0x10000); -} - -static void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) -{ - UInt32 i; - for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) - { - const int kCyclesBits = kNumBitPriceShiftBits; - UInt32 w = i; - UInt32 bitCount = 0; - int j; - for (j = 0; j < kCyclesBits; j++) - { - w = w * w; - bitCount <<= 1; - while (w >= ((UInt32)1 << 16)) - { - w >>= 1; - bitCount++; - } - } - ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount); - } -} - - -#define GET_PRICE(prob, symbol) \ - p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; - -#define GET_PRICEa(prob, symbol) \ - ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; - -#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits] -#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] - -#define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits] -#define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] - -static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, const UInt32 *ProbPrices) -{ - UInt32 price = 0; - symbol |= 0x100; - do - { - price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1); - symbol <<= 1; - } - while (symbol < 0x10000); - return price; -} - -static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, const UInt32 *ProbPrices) -{ - UInt32 price = 0; - UInt32 offs = 0x100; - symbol |= 0x100; - do - { - matchByte <<= 1; - price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1); - symbol <<= 1; - offs &= ~(matchByte ^ symbol); - } - while (symbol < 0x10000); - return price; -} - - -static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) -{ - UInt32 m = 1; - int i; - for (i = numBitLevels; i != 0;) - { - UInt32 bit; - i--; - bit = (symbol >> i) & 1; - RangeEnc_EncodeBit(rc, probs + m, bit); - m = (m << 1) | bit; - } -} - -static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) -{ - UInt32 m = 1; - int i; - for (i = 0; i < numBitLevels; i++) - { - UInt32 bit = symbol & 1; - RangeEnc_EncodeBit(rc, probs + m, bit); - m = (m << 1) | bit; - symbol >>= 1; - } -} - -static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, const UInt32 *ProbPrices) -{ - UInt32 price = 0; - symbol |= (1 << numBitLevels); - while (symbol != 1) - { - price += GET_PRICEa(probs[symbol >> 1], symbol & 1); - symbol >>= 1; - } - return price; -} - -static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, const UInt32 *ProbPrices) -{ - UInt32 price = 0; - UInt32 m = 1; - int i; - for (i = numBitLevels; i != 0; i--) - { - UInt32 bit = symbol & 1; - symbol >>= 1; - price += GET_PRICEa(probs[m], bit); - m = (m << 1) | bit; - } - return price; -} - - -static void LenEnc_Init(CLenEnc *p) -{ - unsigned i; - p->choice = p->choice2 = kProbInitValue; - for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++) - p->low[i] = kProbInitValue; - for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++) - p->mid[i] = kProbInitValue; - for (i = 0; i < kLenNumHighSymbols; i++) - p->high[i] = kProbInitValue; -} - -static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState) -{ - if (symbol < kLenNumLowSymbols) - { - RangeEnc_EncodeBit(rc, &p->choice, 0); - RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol); - } - else - { - RangeEnc_EncodeBit(rc, &p->choice, 1); - if (symbol < kLenNumLowSymbols + kLenNumMidSymbols) - { - RangeEnc_EncodeBit(rc, &p->choice2, 0); - RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols); - } - else - { - RangeEnc_EncodeBit(rc, &p->choice2, 1); - RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols); - } - } -} - -static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, const UInt32 *ProbPrices) -{ - UInt32 a0 = GET_PRICE_0a(p->choice); - UInt32 a1 = GET_PRICE_1a(p->choice); - UInt32 b0 = a1 + GET_PRICE_0a(p->choice2); - UInt32 b1 = a1 + GET_PRICE_1a(p->choice2); - UInt32 i = 0; - for (i = 0; i < kLenNumLowSymbols; i++) - { - if (i >= numSymbols) - return; - prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices); - } - for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++) - { - if (i >= numSymbols) - return; - prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices); - } - for (; i < numSymbols; i++) - prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices); -} - -static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, const UInt32 *ProbPrices) -{ - LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices); - p->counters[posState] = p->tableSize; -} - -static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, const UInt32 *ProbPrices) -{ - UInt32 posState; - for (posState = 0; posState < numPosStates; posState++) - LenPriceEnc_UpdateTable(p, posState, ProbPrices); -} - -static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, const UInt32 *ProbPrices) -{ - LenEnc_Encode(&p->p, rc, symbol, posState); - if (updatePrice) - if (--p->counters[posState] == 0) - LenPriceEnc_UpdateTable(p, posState, ProbPrices); -} - - - - -static void MovePos(CLzmaEnc *p, UInt32 num) -{ - #ifdef SHOW_STAT - g_STAT_OFFSET += num; - printf("\n MovePos %u", num); - #endif - - if (num != 0) - { - p->additionalOffset += num; - p->matchFinder.Skip(p->matchFinderObj, num); - } -} - -static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes) -{ - UInt32 lenRes = 0, numPairs; - p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); - numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches); - - #ifdef SHOW_STAT - printf("\n i = %u numPairs = %u ", g_STAT_OFFSET, numPairs / 2); - g_STAT_OFFSET++; - { - UInt32 i; - for (i = 0; i < numPairs; i += 2) - printf("%2u %6u | ", p->matches[i], p->matches[i + 1]); - } - #endif - - if (numPairs > 0) - { - lenRes = p->matches[numPairs - 2]; - if (lenRes == p->numFastBytes) - { - UInt32 numAvail = p->numAvail; - if (numAvail > LZMA_MATCH_LEN_MAX) - numAvail = LZMA_MATCH_LEN_MAX; - { - const Byte *pbyCur = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; - const Byte *pby = pbyCur + lenRes; - ptrdiff_t dif = (ptrdiff_t)-1 - p->matches[numPairs - 1]; - const Byte *pbyLim = pbyCur + numAvail; - for (; pby != pbyLim && *pby == pby[dif]; pby++); - lenRes = (UInt32)(pby - pbyCur); - } - } - } - p->additionalOffset++; - *numDistancePairsRes = numPairs; - return lenRes; -} - - -#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False; -#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False; -#define IsShortRep(p) ((p)->backPrev == 0) - -static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState) -{ - return - GET_PRICE_0(p->isRepG0[state]) + - GET_PRICE_0(p->isRep0Long[state][posState]); -} - -static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState) -{ - UInt32 price; - if (repIndex == 0) - { - price = GET_PRICE_0(p->isRepG0[state]); - price += GET_PRICE_1(p->isRep0Long[state][posState]); - } - else - { - price = GET_PRICE_1(p->isRepG0[state]); - if (repIndex == 1) - price += GET_PRICE_0(p->isRepG1[state]); - else - { - price += GET_PRICE_1(p->isRepG1[state]); - price += GET_PRICE(p->isRepG2[state], repIndex - 2); - } - } - return price; -} - -static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState) -{ - return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] + - GetPureRepPrice(p, repIndex, state, posState); -} - -static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur) -{ - UInt32 posMem = p->opt[cur].posPrev; - UInt32 backMem = p->opt[cur].backPrev; - p->optimumEndIndex = cur; - do - { - if (p->opt[cur].prev1IsChar) - { - MakeAsChar(&p->opt[posMem]) - p->opt[posMem].posPrev = posMem - 1; - if (p->opt[cur].prev2) - { - p->opt[posMem - 1].prev1IsChar = False; - p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2; - p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2; - } - } - { - UInt32 posPrev = posMem; - UInt32 backCur = backMem; - - backMem = p->opt[posPrev].backPrev; - posMem = p->opt[posPrev].posPrev; - - p->opt[posPrev].backPrev = backCur; - p->opt[posPrev].posPrev = cur; - cur = posPrev; - } - } - while (cur != 0); - *backRes = p->opt[0].backPrev; - p->optimumCurrentIndex = p->opt[0].posPrev; - return p->optimumCurrentIndex; -} - -#define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * (UInt32)0x300) - -static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) -{ - UInt32 lenEnd, cur; - UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS]; - UInt32 *matches; - - { - - UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, len; - UInt32 matchPrice, repMatchPrice, normalMatchPrice; - const Byte *data; - Byte curByte, matchByte; - - if (p->optimumEndIndex != p->optimumCurrentIndex) - { - const COptimal *opt = &p->opt[p->optimumCurrentIndex]; - UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex; - *backRes = opt->backPrev; - p->optimumCurrentIndex = opt->posPrev; - return lenRes; - } - p->optimumCurrentIndex = p->optimumEndIndex = 0; - - if (p->additionalOffset == 0) - mainLen = ReadMatchDistances(p, &numPairs); - else - { - mainLen = p->longestMatchLength; - numPairs = p->numPairs; - } - - numAvail = p->numAvail; - if (numAvail < 2) - { - *backRes = (UInt32)(-1); - return 1; - } - if (numAvail > LZMA_MATCH_LEN_MAX) - numAvail = LZMA_MATCH_LEN_MAX; - - data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; - repMaxIndex = 0; - for (i = 0; i < LZMA_NUM_REPS; i++) - { - UInt32 lenTest; - const Byte *data2; - reps[i] = p->reps[i]; - data2 = data - reps[i] - 1; - if (data[0] != data2[0] || data[1] != data2[1]) - { - repLens[i] = 0; - continue; - } - for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); - repLens[i] = lenTest; - if (lenTest > repLens[repMaxIndex]) - repMaxIndex = i; - } - if (repLens[repMaxIndex] >= p->numFastBytes) - { - UInt32 lenRes; - *backRes = repMaxIndex; - lenRes = repLens[repMaxIndex]; - MovePos(p, lenRes - 1); - return lenRes; - } - - matches = p->matches; - if (mainLen >= p->numFastBytes) - { - *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; - MovePos(p, mainLen - 1); - return mainLen; - } - curByte = *data; - matchByte = *(data - (reps[0] + 1)); - - if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2) - { - *backRes = (UInt32)-1; - return 1; - } - - p->opt[0].state = (CState)p->state; - - posState = (position & p->pbMask); - - { - const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); - p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) + - (!IsCharState(p->state) ? - LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : - LitEnc_GetPrice(probs, curByte, p->ProbPrices)); - } - - MakeAsChar(&p->opt[1]); - - matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]); - repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]); - - if (matchByte == curByte) - { - UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState); - if (shortRepPrice < p->opt[1].price) - { - p->opt[1].price = shortRepPrice; - MakeAsShortRep(&p->opt[1]); - } - } - lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]); - - if (lenEnd < 2) - { - *backRes = p->opt[1].backPrev; - return 1; - } - - p->opt[1].posPrev = 0; - for (i = 0; i < LZMA_NUM_REPS; i++) - p->opt[0].backs[i] = reps[i]; - - len = lenEnd; - do - p->opt[len--].price = kInfinityPrice; - while (len >= 2); - - for (i = 0; i < LZMA_NUM_REPS; i++) - { - UInt32 repLen = repLens[i]; - UInt32 price; - if (repLen < 2) - continue; - price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState); - do - { - UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2]; - COptimal *opt = &p->opt[repLen]; - if (curAndLenPrice < opt->price) - { - opt->price = curAndLenPrice; - opt->posPrev = 0; - opt->backPrev = i; - opt->prev1IsChar = False; - } - } - while (--repLen >= 2); - } - - normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]); - - len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2); - if (len <= mainLen) - { - UInt32 offs = 0; - while (len > matches[offs]) - offs += 2; - for (; ; len++) - { - COptimal *opt; - UInt32 distance = matches[offs + 1]; - - UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN]; - UInt32 lenToPosState = GetLenToPosState(len); - if (distance < kNumFullDistances) - curAndLenPrice += p->distancesPrices[lenToPosState][distance]; - else - { - UInt32 slot; - GetPosSlot2(distance, slot); - curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot]; - } - opt = &p->opt[len]; - if (curAndLenPrice < opt->price) - { - opt->price = curAndLenPrice; - opt->posPrev = 0; - opt->backPrev = distance + LZMA_NUM_REPS; - opt->prev1IsChar = False; - } - if (len == matches[offs]) - { - offs += 2; - if (offs == numPairs) - break; - } - } - } - - cur = 0; - - #ifdef SHOW_STAT2 - /* if (position >= 0) */ - { - unsigned i; - printf("\n pos = %4X", position); - for (i = cur; i <= lenEnd; i++) - printf("\nprice[%4X] = %u", position - cur + i, p->opt[i].price); - } - #endif - - } - - for (;;) - { - UInt32 numAvail; - UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen; - UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice; - Bool nextIsChar; - Byte curByte, matchByte; - const Byte *data; - COptimal *curOpt; - COptimal *nextOpt; - - cur++; - if (cur == lenEnd) - return Backward(p, backRes, cur); - - newLen = ReadMatchDistances(p, &numPairs); - if (newLen >= p->numFastBytes) - { - p->numPairs = numPairs; - p->longestMatchLength = newLen; - return Backward(p, backRes, cur); - } - position++; - curOpt = &p->opt[cur]; - posPrev = curOpt->posPrev; - if (curOpt->prev1IsChar) - { - posPrev--; - if (curOpt->prev2) - { - state = p->opt[curOpt->posPrev2].state; - if (curOpt->backPrev2 < LZMA_NUM_REPS) - state = kRepNextStates[state]; - else - state = kMatchNextStates[state]; - } - else - state = p->opt[posPrev].state; - state = kLiteralNextStates[state]; - } - else - state = p->opt[posPrev].state; - if (posPrev == cur - 1) - { - if (IsShortRep(curOpt)) - state = kShortRepNextStates[state]; - else - state = kLiteralNextStates[state]; - } - else - { - UInt32 pos; - const COptimal *prevOpt; - if (curOpt->prev1IsChar && curOpt->prev2) - { - posPrev = curOpt->posPrev2; - pos = curOpt->backPrev2; - state = kRepNextStates[state]; - } - else - { - pos = curOpt->backPrev; - if (pos < LZMA_NUM_REPS) - state = kRepNextStates[state]; - else - state = kMatchNextStates[state]; - } - prevOpt = &p->opt[posPrev]; - if (pos < LZMA_NUM_REPS) - { - UInt32 i; - reps[0] = prevOpt->backs[pos]; - for (i = 1; i <= pos; i++) - reps[i] = prevOpt->backs[i - 1]; - for (; i < LZMA_NUM_REPS; i++) - reps[i] = prevOpt->backs[i]; - } - else - { - UInt32 i; - reps[0] = (pos - LZMA_NUM_REPS); - for (i = 1; i < LZMA_NUM_REPS; i++) - reps[i] = prevOpt->backs[i - 1]; - } - } - curOpt->state = (CState)state; - - curOpt->backs[0] = reps[0]; - curOpt->backs[1] = reps[1]; - curOpt->backs[2] = reps[2]; - curOpt->backs[3] = reps[3]; - - curPrice = curOpt->price; - nextIsChar = False; - data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; - curByte = *data; - matchByte = *(data - (reps[0] + 1)); - - posState = (position & p->pbMask); - - curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]); - { - const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); - curAnd1Price += - (!IsCharState(state) ? - LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : - LitEnc_GetPrice(probs, curByte, p->ProbPrices)); - } - - nextOpt = &p->opt[cur + 1]; - - if (curAnd1Price < nextOpt->price) - { - nextOpt->price = curAnd1Price; - nextOpt->posPrev = cur; - MakeAsChar(nextOpt); - nextIsChar = True; - } - - matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]); - repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]); - - if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0)) - { - UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState); - if (shortRepPrice <= nextOpt->price) - { - nextOpt->price = shortRepPrice; - nextOpt->posPrev = cur; - MakeAsShortRep(nextOpt); - nextIsChar = True; - } - } - numAvailFull = p->numAvail; - { - UInt32 temp = kNumOpts - 1 - cur; - if (temp < numAvailFull) - numAvailFull = temp; - } - - if (numAvailFull < 2) - continue; - numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes); - - if (!nextIsChar && matchByte != curByte) /* speed optimization */ - { - /* try Literal + rep0 */ - UInt32 temp; - UInt32 lenTest2; - const Byte *data2 = data - reps[0] - 1; - UInt32 limit = p->numFastBytes + 1; - if (limit > numAvailFull) - limit = numAvailFull; - - for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++); - lenTest2 = temp - 1; - if (lenTest2 >= 2) - { - UInt32 state2 = kLiteralNextStates[state]; - UInt32 posStateNext = (position + 1) & p->pbMask; - UInt32 nextRepMatchPrice = curAnd1Price + - GET_PRICE_1(p->isMatch[state2][posStateNext]) + - GET_PRICE_1(p->isRep[state2]); - /* for (; lenTest2 >= 2; lenTest2--) */ - { - UInt32 curAndLenPrice; - COptimal *opt; - UInt32 offset = cur + 1 + lenTest2; - while (lenEnd < offset) - p->opt[++lenEnd].price = kInfinityPrice; - curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); - opt = &p->opt[offset]; - if (curAndLenPrice < opt->price) - { - opt->price = curAndLenPrice; - opt->posPrev = cur + 1; - opt->backPrev = 0; - opt->prev1IsChar = True; - opt->prev2 = False; - } - } - } - } - - startLen = 2; /* speed optimization */ - { - UInt32 repIndex; - for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++) - { - UInt32 lenTest; - UInt32 lenTestTemp; - UInt32 price; - const Byte *data2 = data - reps[repIndex] - 1; - if (data[0] != data2[0] || data[1] != data2[1]) - continue; - for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); - while (lenEnd < cur + lenTest) - p->opt[++lenEnd].price = kInfinityPrice; - lenTestTemp = lenTest; - price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState); - do - { - UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2]; - COptimal *opt = &p->opt[cur + lenTest]; - if (curAndLenPrice < opt->price) - { - opt->price = curAndLenPrice; - opt->posPrev = cur; - opt->backPrev = repIndex; - opt->prev1IsChar = False; - } - } - while (--lenTest >= 2); - lenTest = lenTestTemp; - - if (repIndex == 0) - startLen = lenTest + 1; - - /* if (_maxMode) */ - { - UInt32 lenTest2 = lenTest + 1; - UInt32 limit = lenTest2 + p->numFastBytes; - if (limit > numAvailFull) - limit = numAvailFull; - for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); - lenTest2 -= lenTest + 1; - if (lenTest2 >= 2) - { - UInt32 nextRepMatchPrice; - UInt32 state2 = kRepNextStates[state]; - UInt32 posStateNext = (position + lenTest) & p->pbMask; - UInt32 curAndLenCharPrice = - price + p->repLenEnc.prices[posState][lenTest - 2] + - GET_PRICE_0(p->isMatch[state2][posStateNext]) + - LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), - data[lenTest], data2[lenTest], p->ProbPrices); - state2 = kLiteralNextStates[state2]; - posStateNext = (position + lenTest + 1) & p->pbMask; - nextRepMatchPrice = curAndLenCharPrice + - GET_PRICE_1(p->isMatch[state2][posStateNext]) + - GET_PRICE_1(p->isRep[state2]); - - /* for (; lenTest2 >= 2; lenTest2--) */ - { - UInt32 curAndLenPrice; - COptimal *opt; - UInt32 offset = cur + lenTest + 1 + lenTest2; - while (lenEnd < offset) - p->opt[++lenEnd].price = kInfinityPrice; - curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); - opt = &p->opt[offset]; - if (curAndLenPrice < opt->price) - { - opt->price = curAndLenPrice; - opt->posPrev = cur + lenTest + 1; - opt->backPrev = 0; - opt->prev1IsChar = True; - opt->prev2 = True; - opt->posPrev2 = cur; - opt->backPrev2 = repIndex; - } - } - } - } - } - } - /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */ - if (newLen > numAvail) - { - newLen = numAvail; - for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2); - matches[numPairs] = newLen; - numPairs += 2; - } - if (newLen >= startLen) - { - UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]); - UInt32 offs, curBack, posSlot; - UInt32 lenTest; - while (lenEnd < cur + newLen) - p->opt[++lenEnd].price = kInfinityPrice; - - offs = 0; - while (startLen > matches[offs]) - offs += 2; - curBack = matches[offs + 1]; - GetPosSlot2(curBack, posSlot); - for (lenTest = /*2*/ startLen; ; lenTest++) - { - UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN]; - { - UInt32 lenToPosState = GetLenToPosState(lenTest); - COptimal *opt; - if (curBack < kNumFullDistances) - curAndLenPrice += p->distancesPrices[lenToPosState][curBack]; - else - curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask]; - - opt = &p->opt[cur + lenTest]; - if (curAndLenPrice < opt->price) - { - opt->price = curAndLenPrice; - opt->posPrev = cur; - opt->backPrev = curBack + LZMA_NUM_REPS; - opt->prev1IsChar = False; - } - } - - if (/*_maxMode && */lenTest == matches[offs]) - { - /* Try Match + Literal + Rep0 */ - const Byte *data2 = data - curBack - 1; - UInt32 lenTest2 = lenTest + 1; - UInt32 limit = lenTest2 + p->numFastBytes; - if (limit > numAvailFull) - limit = numAvailFull; - for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); - lenTest2 -= lenTest + 1; - if (lenTest2 >= 2) - { - UInt32 nextRepMatchPrice; - UInt32 state2 = kMatchNextStates[state]; - UInt32 posStateNext = (position + lenTest) & p->pbMask; - UInt32 curAndLenCharPrice = curAndLenPrice + - GET_PRICE_0(p->isMatch[state2][posStateNext]) + - LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), - data[lenTest], data2[lenTest], p->ProbPrices); - state2 = kLiteralNextStates[state2]; - posStateNext = (posStateNext + 1) & p->pbMask; - nextRepMatchPrice = curAndLenCharPrice + - GET_PRICE_1(p->isMatch[state2][posStateNext]) + - GET_PRICE_1(p->isRep[state2]); - - /* for (; lenTest2 >= 2; lenTest2--) */ - { - UInt32 offset = cur + lenTest + 1 + lenTest2; - UInt32 curAndLenPrice2; - COptimal *opt; - while (lenEnd < offset) - p->opt[++lenEnd].price = kInfinityPrice; - curAndLenPrice2 = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); - opt = &p->opt[offset]; - if (curAndLenPrice2 < opt->price) - { - opt->price = curAndLenPrice2; - opt->posPrev = cur + lenTest + 1; - opt->backPrev = 0; - opt->prev1IsChar = True; - opt->prev2 = True; - opt->posPrev2 = cur; - opt->backPrev2 = curBack + LZMA_NUM_REPS; - } - } - } - offs += 2; - if (offs == numPairs) - break; - curBack = matches[offs + 1]; - if (curBack >= kNumFullDistances) - GetPosSlot2(curBack, posSlot); - } - } - } - } -} - -#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist)) - -static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes) -{ - UInt32 numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i; - const Byte *data; - const UInt32 *matches; - - if (p->additionalOffset == 0) - mainLen = ReadMatchDistances(p, &numPairs); - else - { - mainLen = p->longestMatchLength; - numPairs = p->numPairs; - } - - numAvail = p->numAvail; - *backRes = (UInt32)-1; - if (numAvail < 2) - return 1; - if (numAvail > LZMA_MATCH_LEN_MAX) - numAvail = LZMA_MATCH_LEN_MAX; - data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; - - repLen = repIndex = 0; - for (i = 0; i < LZMA_NUM_REPS; i++) - { - UInt32 len; - const Byte *data2 = data - p->reps[i] - 1; - if (data[0] != data2[0] || data[1] != data2[1]) - continue; - for (len = 2; len < numAvail && data[len] == data2[len]; len++); - if (len >= p->numFastBytes) - { - *backRes = i; - MovePos(p, len - 1); - return len; - } - if (len > repLen) - { - repIndex = i; - repLen = len; - } - } - - matches = p->matches; - if (mainLen >= p->numFastBytes) - { - *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; - MovePos(p, mainLen - 1); - return mainLen; - } - - mainDist = 0; /* for GCC */ - if (mainLen >= 2) - { - mainDist = matches[numPairs - 1]; - while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1) - { - if (!ChangePair(matches[numPairs - 3], mainDist)) - break; - numPairs -= 2; - mainLen = matches[numPairs - 2]; - mainDist = matches[numPairs - 1]; - } - if (mainLen == 2 && mainDist >= 0x80) - mainLen = 1; - } - - if (repLen >= 2 && ( - (repLen + 1 >= mainLen) || - (repLen + 2 >= mainLen && mainDist >= (1 << 9)) || - (repLen + 3 >= mainLen && mainDist >= (1 << 15)))) - { - *backRes = repIndex; - MovePos(p, repLen - 1); - return repLen; - } - - if (mainLen < 2 || numAvail <= 2) - return 1; - - p->longestMatchLength = ReadMatchDistances(p, &p->numPairs); - if (p->longestMatchLength >= 2) - { - UInt32 newDistance = matches[p->numPairs - 1]; - if ((p->longestMatchLength >= mainLen && newDistance < mainDist) || - (p->longestMatchLength == mainLen + 1 && !ChangePair(mainDist, newDistance)) || - (p->longestMatchLength > mainLen + 1) || - (p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist))) - return 1; - } - - data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; - for (i = 0; i < LZMA_NUM_REPS; i++) - { - UInt32 len, limit; - const Byte *data2 = data - p->reps[i] - 1; - if (data[0] != data2[0] || data[1] != data2[1]) - continue; - limit = mainLen - 1; - for (len = 2; len < limit && data[len] == data2[len]; len++); - if (len >= limit) - return 1; - } - *backRes = mainDist + LZMA_NUM_REPS; - MovePos(p, mainLen - 2); - return mainLen; -} - -static void WriteEndMarker(CLzmaEnc *p, UInt32 posState) -{ - UInt32 len; - RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); - RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); - p->state = kMatchNextStates[p->state]; - len = LZMA_MATCH_LEN_MIN; - LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); - RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1); - RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits); - RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask); -} - -static SRes CheckErrors(CLzmaEnc *p) -{ - if (p->result != SZ_OK) - return p->result; - if (p->rc.res != SZ_OK) - p->result = SZ_ERROR_WRITE; - if (p->matchFinderBase.result != SZ_OK) - p->result = SZ_ERROR_READ; - if (p->result != SZ_OK) - p->finished = True; - return p->result; -} - -static SRes Flush(CLzmaEnc *p, UInt32 nowPos) -{ - /* ReleaseMFStream(); */ - p->finished = True; - if (p->writeEndMark) - WriteEndMarker(p, nowPos & p->pbMask); - RangeEnc_FlushData(&p->rc); - RangeEnc_FlushStream(&p->rc); - return CheckErrors(p); -} - -static void FillAlignPrices(CLzmaEnc *p) -{ - UInt32 i; - for (i = 0; i < kAlignTableSize; i++) - p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices); - p->alignPriceCount = 0; -} - -static void FillDistancesPrices(CLzmaEnc *p) -{ - UInt32 tempPrices[kNumFullDistances]; - UInt32 i, lenToPosState; - for (i = kStartPosModelIndex; i < kNumFullDistances; i++) - { - UInt32 posSlot = GetPosSlot1(i); - UInt32 footerBits = ((posSlot >> 1) - 1); - UInt32 base = ((2 | (posSlot & 1)) << footerBits); - tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices); - } - - for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++) - { - UInt32 posSlot; - const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState]; - UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState]; - for (posSlot = 0; posSlot < p->distTableSize; posSlot++) - posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices); - for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++) - posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits); - - { - UInt32 *distancesPrices = p->distancesPrices[lenToPosState]; - for (i = 0; i < kStartPosModelIndex; i++) - distancesPrices[i] = posSlotPrices[i]; - for (; i < kNumFullDistances; i++) - distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i]; - } - } - p->matchPriceCount = 0; -} - -void LzmaEnc_Construct(CLzmaEnc *p) -{ - RangeEnc_Construct(&p->rc); - MatchFinder_Construct(&p->matchFinderBase); - - #ifndef _7ZIP_ST - MatchFinderMt_Construct(&p->matchFinderMt); - p->matchFinderMt.MatchFinder = &p->matchFinderBase; - #endif - - { - CLzmaEncProps props; - LzmaEncProps_Init(&props); - LzmaEnc_SetProps(p, &props); - } - - #ifndef LZMA_LOG_BSR - LzmaEnc_FastPosInit(p->g_FastPos); - #endif - - LzmaEnc_InitPriceTables(p->ProbPrices); - p->litProbs = NULL; - p->saveState.litProbs = NULL; -} - -CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc) -{ - void *p; - p = alloc->Alloc(alloc, sizeof(CLzmaEnc)); - if (p) - LzmaEnc_Construct((CLzmaEnc *)p); - return p; -} - -void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) -{ - alloc->Free(alloc, p->litProbs); - alloc->Free(alloc, p->saveState.litProbs); - p->litProbs = NULL; - p->saveState.litProbs = NULL; -} - -void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) -{ - #ifndef _7ZIP_ST - MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); - #endif - - MatchFinder_Free(&p->matchFinderBase, allocBig); - LzmaEnc_FreeLits(p, alloc); - RangeEnc_Free(&p->rc, alloc); -} - -void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig) -{ - LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig); - alloc->Free(alloc, p); -} - -static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize) -{ - UInt32 nowPos32, startPos32; - if (p->needInit) - { - p->matchFinder.Init(p->matchFinderObj); - p->needInit = 0; - } - - if (p->finished) - return p->result; - RINOK(CheckErrors(p)); - - nowPos32 = (UInt32)p->nowPos64; - startPos32 = nowPos32; - - if (p->nowPos64 == 0) - { - UInt32 numPairs; - Byte curByte; - if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) - return Flush(p, nowPos32); - ReadMatchDistances(p, &numPairs); - RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0); - p->state = kLiteralNextStates[p->state]; - curByte = *(p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset); - LitEnc_Encode(&p->rc, p->litProbs, curByte); - p->additionalOffset--; - nowPos32++; - } - - if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0) - for (;;) - { - UInt32 pos, len, posState; - - if (p->fastMode) - len = GetOptimumFast(p, &pos); - else - len = GetOptimum(p, nowPos32, &pos); - - #ifdef SHOW_STAT2 - printf("\n pos = %4X, len = %u pos = %u", nowPos32, len, pos); - #endif - - posState = nowPos32 & p->pbMask; - if (len == 1 && pos == (UInt32)-1) - { - Byte curByte; - CLzmaProb *probs; - const Byte *data; - - RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0); - data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; - curByte = *data; - probs = LIT_PROBS(nowPos32, *(data - 1)); - if (IsCharState(p->state)) - LitEnc_Encode(&p->rc, probs, curByte); - else - LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1)); - p->state = kLiteralNextStates[p->state]; - } - else - { - RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); - if (pos < LZMA_NUM_REPS) - { - RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1); - if (pos == 0) - { - RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0); - RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1)); - } - else - { - UInt32 distance = p->reps[pos]; - RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1); - if (pos == 1) - RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0); - else - { - RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1); - RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2); - if (pos == 3) - p->reps[3] = p->reps[2]; - p->reps[2] = p->reps[1]; - } - p->reps[1] = p->reps[0]; - p->reps[0] = distance; - } - if (len == 1) - p->state = kShortRepNextStates[p->state]; - else - { - LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); - p->state = kRepNextStates[p->state]; - } - } - else - { - UInt32 posSlot; - RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); - p->state = kMatchNextStates[p->state]; - LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); - pos -= LZMA_NUM_REPS; - GetPosSlot(pos, posSlot); - RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot); - - if (posSlot >= kStartPosModelIndex) - { - UInt32 footerBits = ((posSlot >> 1) - 1); - UInt32 base = ((2 | (posSlot & 1)) << footerBits); - UInt32 posReduced = pos - base; - - if (posSlot < kEndPosModelIndex) - RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced); - else - { - RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits); - RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask); - p->alignPriceCount++; - } - } - p->reps[3] = p->reps[2]; - p->reps[2] = p->reps[1]; - p->reps[1] = p->reps[0]; - p->reps[0] = pos; - p->matchPriceCount++; - } - } - p->additionalOffset -= len; - nowPos32 += len; - if (p->additionalOffset == 0) - { - UInt32 processed; - if (!p->fastMode) - { - if (p->matchPriceCount >= (1 << 7)) - FillDistancesPrices(p); - if (p->alignPriceCount >= kAlignTableSize) - FillAlignPrices(p); - } - if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) - break; - processed = nowPos32 - startPos32; - if (useLimits) - { - if (processed + kNumOpts + 300 >= maxUnpackSize || - RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize) - break; - } - else if (processed >= (1 << 17)) - { - p->nowPos64 += nowPos32 - startPos32; - return CheckErrors(p); - } - } - } - p->nowPos64 += nowPos32 - startPos32; - return Flush(p, nowPos32); -} - -#define kBigHashDicLimit ((UInt32)1 << 24) - -static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -{ - UInt32 beforeSize = kNumOpts; - if (!RangeEnc_Alloc(&p->rc, alloc)) - return SZ_ERROR_MEM; - - #ifndef _7ZIP_ST - p->mtMode = (p->multiThread && !p->fastMode && (p->matchFinderBase.btMode != 0)); - #endif - - { - unsigned lclp = p->lc + p->lp; - if (!p->litProbs || !p->saveState.litProbs || p->lclp != lclp) - { - LzmaEnc_FreeLits(p, alloc); - p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, ((UInt32)0x300 << lclp) * sizeof(CLzmaProb)); - p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, ((UInt32)0x300 << lclp) * sizeof(CLzmaProb)); - if (!p->litProbs || !p->saveState.litProbs) - { - LzmaEnc_FreeLits(p, alloc); - return SZ_ERROR_MEM; - } - p->lclp = lclp; - } - } - - p->matchFinderBase.bigHash = (Byte)(p->dictSize > kBigHashDicLimit ? 1 : 0); - - if (beforeSize + p->dictSize < keepWindowSize) - beforeSize = keepWindowSize - p->dictSize; - - #ifndef _7ZIP_ST - if (p->mtMode) - { - RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)); - p->matchFinderObj = &p->matchFinderMt; - MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder); - } - else - #endif - { - if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)) - return SZ_ERROR_MEM; - p->matchFinderObj = &p->matchFinderBase; - MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder); - } - - return SZ_OK; -} - -void LzmaEnc_Init(CLzmaEnc *p) -{ - UInt32 i; - p->state = 0; - for (i = 0 ; i < LZMA_NUM_REPS; i++) - p->reps[i] = 0; - - RangeEnc_Init(&p->rc); - - - for (i = 0; i < kNumStates; i++) - { - UInt32 j; - for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++) - { - p->isMatch[i][j] = kProbInitValue; - p->isRep0Long[i][j] = kProbInitValue; - } - p->isRep[i] = kProbInitValue; - p->isRepG0[i] = kProbInitValue; - p->isRepG1[i] = kProbInitValue; - p->isRepG2[i] = kProbInitValue; - } - - { - UInt32 num = (UInt32)0x300 << (p->lp + p->lc); - CLzmaProb *probs = p->litProbs; - for (i = 0; i < num; i++) - probs[i] = kProbInitValue; - } - - { - for (i = 0; i < kNumLenToPosStates; i++) - { - CLzmaProb *probs = p->posSlotEncoder[i]; - UInt32 j; - for (j = 0; j < (1 << kNumPosSlotBits); j++) - probs[j] = kProbInitValue; - } - } - { - for (i = 0; i < kNumFullDistances - kEndPosModelIndex; i++) - p->posEncoders[i] = kProbInitValue; - } - - LenEnc_Init(&p->lenEnc.p); - LenEnc_Init(&p->repLenEnc.p); - - for (i = 0; i < (1 << kNumAlignBits); i++) - p->posAlignEncoder[i] = kProbInitValue; - - p->optimumEndIndex = 0; - p->optimumCurrentIndex = 0; - p->additionalOffset = 0; - - p->pbMask = (1 << p->pb) - 1; - p->lpMask = (1 << p->lp) - 1; -} - -void LzmaEnc_InitPrices(CLzmaEnc *p) -{ - if (!p->fastMode) - { - FillDistancesPrices(p); - FillAlignPrices(p); - } - - p->lenEnc.tableSize = - p->repLenEnc.tableSize = - p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN; - LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices); - LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices); -} - -static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -{ - UInt32 i; - for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++) - if (p->dictSize <= ((UInt32)1 << i)) - break; - p->distTableSize = i * 2; - - p->finished = False; - p->result = SZ_OK; - RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig)); - LzmaEnc_Init(p); - LzmaEnc_InitPrices(p); - p->nowPos64 = 0; - return SZ_OK; -} - -static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, - ISzAlloc *alloc, ISzAlloc *allocBig) -{ - CLzmaEnc *p = (CLzmaEnc *)pp; - p->matchFinderBase.stream = inStream; - p->needInit = 1; - p->rc.outStream = outStream; - return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); -} - -SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, - ISeqInStream *inStream, UInt32 keepWindowSize, - ISzAlloc *alloc, ISzAlloc *allocBig) -{ - CLzmaEnc *p = (CLzmaEnc *)pp; - p->matchFinderBase.stream = inStream; - p->needInit = 1; - return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); -} - -static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) -{ - p->matchFinderBase.directInput = 1; - p->matchFinderBase.bufferBase = (Byte *)src; - p->matchFinderBase.directInputRem = srcLen; -} - -SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, - UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -{ - CLzmaEnc *p = (CLzmaEnc *)pp; - LzmaEnc_SetInputBuf(p, src, srcLen); - p->needInit = 1; - - return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); -} - -void LzmaEnc_Finish(CLzmaEncHandle pp) -{ - #ifndef _7ZIP_ST - CLzmaEnc *p = (CLzmaEnc *)pp; - if (p->mtMode) - MatchFinderMt_ReleaseStream(&p->matchFinderMt); - #else - UNUSED_VAR(pp); - #endif -} - - -typedef struct -{ - ISeqOutStream funcTable; - Byte *data; - SizeT rem; - Bool overflow; -} CSeqOutStreamBuf; - -static size_t MyWrite(void *pp, const void *data, size_t size) -{ - CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp; - if (p->rem < size) - { - size = p->rem; - p->overflow = True; - } - memcpy(p->data, data, size); - p->rem -= size; - p->data += size; - return size; -} - - -UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) -{ - const CLzmaEnc *p = (CLzmaEnc *)pp; - return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); -} - - -const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) -{ - const CLzmaEnc *p = (CLzmaEnc *)pp; - return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; -} - - -SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, - Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) -{ - CLzmaEnc *p = (CLzmaEnc *)pp; - UInt64 nowPos64; - SRes res; - CSeqOutStreamBuf outStream; - - outStream.funcTable.Write = MyWrite; - outStream.data = dest; - outStream.rem = *destLen; - outStream.overflow = False; - - p->writeEndMark = False; - p->finished = False; - p->result = SZ_OK; - - if (reInit) - LzmaEnc_Init(p); - LzmaEnc_InitPrices(p); - nowPos64 = p->nowPos64; - RangeEnc_Init(&p->rc); - p->rc.outStream = &outStream.funcTable; - - res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); - - *unpackSize = (UInt32)(p->nowPos64 - nowPos64); - *destLen -= outStream.rem; - if (outStream.overflow) - return SZ_ERROR_OUTPUT_EOF; - - return res; -} - - -static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) -{ - SRes res = SZ_OK; - - #ifndef _7ZIP_ST - Byte allocaDummy[0x300]; - allocaDummy[0] = 0; - allocaDummy[1] = allocaDummy[0]; - #endif - - for (;;) - { - res = LzmaEnc_CodeOneBlock(p, False, 0, 0); - if (res != SZ_OK || p->finished) - break; - if (progress) - { - res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc)); - if (res != SZ_OK) - { - res = SZ_ERROR_PROGRESS; - break; - } - } - } - - LzmaEnc_Finish(p); - - /* - if (res == S_OK && !Inline_MatchFinder_IsFinishedOK(&p->matchFinderBase)) - res = SZ_ERROR_FAIL; - } - */ - - return res; -} - - -SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, - ISzAlloc *alloc, ISzAlloc *allocBig) -{ - RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); - return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); -} - - -SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) -{ - CLzmaEnc *p = (CLzmaEnc *)pp; - unsigned i; - UInt32 dictSize = p->dictSize; - if (*size < LZMA_PROPS_SIZE) - return SZ_ERROR_PARAM; - *size = LZMA_PROPS_SIZE; - props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc); - - if (dictSize >= ((UInt32)1 << 22)) - { - UInt32 kDictMask = ((UInt32)1 << 20) - 1; - if (dictSize < (UInt32)0xFFFFFFFF - kDictMask) - dictSize = (dictSize + kDictMask) & ~kDictMask; - } - else for (i = 11; i <= 30; i++) - { - if (dictSize <= ((UInt32)2 << i)) { dictSize = (2 << i); break; } - if (dictSize <= ((UInt32)3 << i)) { dictSize = (3 << i); break; } - } - - for (i = 0; i < 4; i++) - props[1 + i] = (Byte)(dictSize >> (8 * i)); - return SZ_OK; -} - - -SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, - int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) -{ - SRes res; - CLzmaEnc *p = (CLzmaEnc *)pp; - - CSeqOutStreamBuf outStream; - - outStream.funcTable.Write = MyWrite; - outStream.data = dest; - outStream.rem = *destLen; - outStream.overflow = False; - - p->writeEndMark = writeEndMark; - p->rc.outStream = &outStream.funcTable; - - res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig); - - if (res == SZ_OK) - { - res = LzmaEnc_Encode2(p, progress); - if (res == SZ_OK && p->nowPos64 != srcLen) - res = SZ_ERROR_FAIL; - } - - *destLen -= outStream.rem; - if (outStream.overflow) - return SZ_ERROR_OUTPUT_EOF; - return res; -} - - -SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, - const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, - ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) -{ - CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); - SRes res; - if (!p) - return SZ_ERROR_MEM; - - res = LzmaEnc_SetProps(p, props); - if (res == SZ_OK) - { - res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize); - if (res == SZ_OK) - res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen, - writeEndMark, progress, alloc, allocBig); - } - - LzmaEnc_Destroy(p, alloc, allocBig); - return res; -} +/* LzmaEnc.c -- LZMA Encoder +2016-05-16 : Igor Pavlov : Public domain */ + +#include "Precomp.h" + +#include <string.h> + +/* #define SHOW_STAT */ +/* #define SHOW_STAT2 */ + +#if defined(SHOW_STAT) || defined(SHOW_STAT2) +#include <stdio.h> +#endif + +#include "LzmaEnc.h" + +#include "LzFind.h" +#ifndef _7ZIP_ST +#include "LzFindMt.h" +#endif + +#ifdef SHOW_STAT +static unsigned g_STAT_OFFSET = 0; +#endif + +#define kMaxHistorySize ((UInt32)3 << 29) +/* #define kMaxHistorySize ((UInt32)7 << 29) */ + +#define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1) + +#define kBlockSize (9 << 10) +#define kUnpackBlockSize (1 << 18) +#define kMatchArraySize (1 << 21) +#define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX) + +#define kNumMaxDirectBits (31) + +#define kNumTopBits 24 +#define kTopValue ((UInt32)1 << kNumTopBits) + +#define kNumBitModelTotalBits 11 +#define kBitModelTotal (1 << kNumBitModelTotalBits) +#define kNumMoveBits 5 +#define kProbInitValue (kBitModelTotal >> 1) + +#define kNumMoveReducingBits 4 +#define kNumBitPriceShiftBits 4 +#define kBitPrice (1 << kNumBitPriceShiftBits) + +void LzmaEncProps_Init(CLzmaEncProps *p) +{ + p->level = 5; + p->dictSize = p->mc = 0; + p->reduceSize = (UInt64)(Int64)-1; + p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1; + p->writeEndMark = 0; +} + +void LzmaEncProps_Normalize(CLzmaEncProps *p) +{ + int level = p->level; + if (level < 0) level = 5; + p->level = level; + + if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26))); + if (p->dictSize > p->reduceSize) + { + unsigned i; + for (i = 11; i <= 30; i++) + { + if ((UInt32)p->reduceSize <= ((UInt32)2 << i)) { p->dictSize = ((UInt32)2 << i); break; } + if ((UInt32)p->reduceSize <= ((UInt32)3 << i)) { p->dictSize = ((UInt32)3 << i); break; } + } + } + + if (p->lc < 0) p->lc = 3; + if (p->lp < 0) p->lp = 0; + if (p->pb < 0) p->pb = 2; + + if (p->algo < 0) p->algo = (level < 5 ? 0 : 1); + if (p->fb < 0) p->fb = (level < 7 ? 32 : 64); + if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1); + if (p->numHashBytes < 0) p->numHashBytes = 4; + if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1); + + if (p->numThreads < 0) + p->numThreads = + #ifndef _7ZIP_ST + ((p->btMode && p->algo) ? 2 : 1); + #else + 1; + #endif +} + +UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) +{ + CLzmaEncProps props = *props2; + LzmaEncProps_Normalize(&props); + return props.dictSize; +} + +#if (_MSC_VER >= 1400) +/* BSR code is fast for some new CPUs */ +/* #define LZMA_LOG_BSR */ +#endif + +#ifdef LZMA_LOG_BSR + +#define kDicLogSizeMaxCompress 32 + +#define BSR2_RET(pos, res) { unsigned long zz; _BitScanReverse(&zz, (pos)); res = (zz + zz) + ((pos >> (zz - 1)) & 1); } + +static UInt32 GetPosSlot1(UInt32 pos) +{ + UInt32 res; + BSR2_RET(pos, res); + return res; +} +#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } +#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); } + +#else + +#define kNumLogBits (9 + sizeof(size_t) / 2) +/* #define kNumLogBits (11 + sizeof(size_t) / 8 * 3) */ + +#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) + +static void LzmaEnc_FastPosInit(Byte *g_FastPos) +{ + unsigned slot; + g_FastPos[0] = 0; + g_FastPos[1] = 1; + g_FastPos += 2; + + for (slot = 2; slot < kNumLogBits * 2; slot++) + { + size_t k = ((size_t)1 << ((slot >> 1) - 1)); + size_t j; + for (j = 0; j < k; j++) + g_FastPos[j] = (Byte)slot; + g_FastPos += k; + } +} + +/* we can use ((limit - pos) >> 31) only if (pos < ((UInt32)1 << 31)) */ +/* +#define BSR2_RET(pos, res) { UInt32 zz = 6 + ((kNumLogBits - 1) & \ + (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \ + res = p->g_FastPos[pos >> zz] + (zz * 2); } +*/ + +/* +#define BSR2_RET(pos, res) { UInt32 zz = 6 + ((kNumLogBits - 1) & \ + (0 - (((((UInt32)1 << (kNumLogBits)) - 1) - (pos >> 6)) >> 31))); \ + res = p->g_FastPos[pos >> zz] + (zz * 2); } +*/ + +#define BSR2_RET(pos, res) { UInt32 zz = (pos < (1 << (kNumLogBits + 6))) ? 6 : 6 + kNumLogBits - 1; \ + res = p->g_FastPos[pos >> zz] + (zz * 2); } + +/* +#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \ + p->g_FastPos[pos >> 6] + 12 : \ + p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; } +*/ + +#define GetPosSlot1(pos) p->g_FastPos[pos] +#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } +#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); } + +#endif + + +#define LZMA_NUM_REPS 4 + +typedef unsigned CState; + +typedef struct +{ + UInt32 price; + + CState state; + int prev1IsChar; + int prev2; + + UInt32 posPrev2; + UInt32 backPrev2; + + UInt32 posPrev; + UInt32 backPrev; + UInt32 backs[LZMA_NUM_REPS]; +} COptimal; + +#define kNumOpts (1 << 12) + +#define kNumLenToPosStates 4 +#define kNumPosSlotBits 6 +#define kDicLogSizeMin 0 +#define kDicLogSizeMax 32 +#define kDistTableSizeMax (kDicLogSizeMax * 2) + + +#define kNumAlignBits 4 +#define kAlignTableSize (1 << kNumAlignBits) +#define kAlignMask (kAlignTableSize - 1) + +#define kStartPosModelIndex 4 +#define kEndPosModelIndex 14 +#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex) + +#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) + +#ifdef _LZMA_PROB32 +#define CLzmaProb UInt32 +#else +#define CLzmaProb UInt16 +#endif + +#define LZMA_PB_MAX 4 +#define LZMA_LC_MAX 8 +#define LZMA_LP_MAX 4 + +#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX) + + +#define kLenNumLowBits 3 +#define kLenNumLowSymbols (1 << kLenNumLowBits) +#define kLenNumMidBits 3 +#define kLenNumMidSymbols (1 << kLenNumMidBits) +#define kLenNumHighBits 8 +#define kLenNumHighSymbols (1 << kLenNumHighBits) + +#define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) + +#define LZMA_MATCH_LEN_MIN 2 +#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1) + +#define kNumStates 12 + + +typedef struct +{ + CLzmaProb choice; + CLzmaProb choice2; + CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits]; + CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits]; + CLzmaProb high[kLenNumHighSymbols]; +} CLenEnc; + + +typedef struct +{ + CLenEnc p; + UInt32 tableSize; + UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal]; + UInt32 counters[LZMA_NUM_PB_STATES_MAX]; +} CLenPriceEnc; + + +typedef struct +{ + UInt32 range; + Byte cache; + UInt64 low; + UInt64 cacheSize; + Byte *buf; + Byte *bufLim; + Byte *bufBase; + ISeqOutStream *outStream; + UInt64 processed; + SRes res; +} CRangeEnc; + + +typedef struct +{ + CLzmaProb *litProbs; + + UInt32 state; + UInt32 reps[LZMA_NUM_REPS]; + + CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; + CLzmaProb isRep[kNumStates]; + CLzmaProb isRepG0[kNumStates]; + CLzmaProb isRepG1[kNumStates]; + CLzmaProb isRepG2[kNumStates]; + CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; + + CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; + CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; + CLzmaProb posAlignEncoder[1 << kNumAlignBits]; + + CLenPriceEnc lenEnc; + CLenPriceEnc repLenEnc; +} CSaveState; + + +typedef struct +{ + void *matchFinderObj; + IMatchFinder matchFinder; + + UInt32 optimumEndIndex; + UInt32 optimumCurrentIndex; + + UInt32 longestMatchLength; + UInt32 numPairs; + UInt32 numAvail; + + UInt32 numFastBytes; + UInt32 additionalOffset; + UInt32 reps[LZMA_NUM_REPS]; + UInt32 state; + + unsigned lc, lp, pb; + unsigned lpMask, pbMask; + unsigned lclp; + + CLzmaProb *litProbs; + + Bool fastMode; + Bool writeEndMark; + Bool finished; + Bool multiThread; + Bool needInit; + + UInt64 nowPos64; + + UInt32 matchPriceCount; + UInt32 alignPriceCount; + + UInt32 distTableSize; + + UInt32 dictSize; + SRes result; + + CRangeEnc rc; + + #ifndef _7ZIP_ST + Bool mtMode; + CMatchFinderMt matchFinderMt; + #endif + + CMatchFinder matchFinderBase; + + #ifndef _7ZIP_ST + Byte pad[128]; + #endif + + COptimal opt[kNumOpts]; + + #ifndef LZMA_LOG_BSR + Byte g_FastPos[1 << kNumLogBits]; + #endif + + UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits]; + UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1]; + + UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax]; + UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances]; + UInt32 alignPrices[kAlignTableSize]; + + CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; + CLzmaProb isRep[kNumStates]; + CLzmaProb isRepG0[kNumStates]; + CLzmaProb isRepG1[kNumStates]; + CLzmaProb isRepG2[kNumStates]; + CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; + + CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; + CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; + CLzmaProb posAlignEncoder[1 << kNumAlignBits]; + + CLenPriceEnc lenEnc; + CLenPriceEnc repLenEnc; + + CSaveState saveState; + + #ifndef _7ZIP_ST + Byte pad2[128]; + #endif +} CLzmaEnc; + + +void LzmaEnc_SaveState(CLzmaEncHandle pp) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + CSaveState *dest = &p->saveState; + int i; + dest->lenEnc = p->lenEnc; + dest->repLenEnc = p->repLenEnc; + dest->state = p->state; + + for (i = 0; i < kNumStates; i++) + { + memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); + memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); + } + for (i = 0; i < kNumLenToPosStates; i++) + memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); + memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); + memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); + memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); + memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); + memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); + memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); + memcpy(dest->reps, p->reps, sizeof(p->reps)); + memcpy(dest->litProbs, p->litProbs, ((UInt32)0x300 << p->lclp) * sizeof(CLzmaProb)); +} + +void LzmaEnc_RestoreState(CLzmaEncHandle pp) +{ + CLzmaEnc *dest = (CLzmaEnc *)pp; + const CSaveState *p = &dest->saveState; + int i; + dest->lenEnc = p->lenEnc; + dest->repLenEnc = p->repLenEnc; + dest->state = p->state; + + for (i = 0; i < kNumStates; i++) + { + memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); + memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); + } + for (i = 0; i < kNumLenToPosStates; i++) + memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); + memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); + memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); + memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); + memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); + memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); + memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); + memcpy(dest->reps, p->reps, sizeof(p->reps)); + memcpy(dest->litProbs, p->litProbs, ((UInt32)0x300 << dest->lclp) * sizeof(CLzmaProb)); +} + +SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + CLzmaEncProps props = *props2; + LzmaEncProps_Normalize(&props); + + if (props.lc > LZMA_LC_MAX + || props.lp > LZMA_LP_MAX + || props.pb > LZMA_PB_MAX + || props.dictSize > ((UInt64)1 << kDicLogSizeMaxCompress) + || props.dictSize > kMaxHistorySize) + return SZ_ERROR_PARAM; + + p->dictSize = props.dictSize; + { + unsigned fb = props.fb; + if (fb < 5) + fb = 5; + if (fb > LZMA_MATCH_LEN_MAX) + fb = LZMA_MATCH_LEN_MAX; + p->numFastBytes = fb; + } + p->lc = props.lc; + p->lp = props.lp; + p->pb = props.pb; + p->fastMode = (props.algo == 0); + p->matchFinderBase.btMode = (Byte)(props.btMode ? 1 : 0); + { + UInt32 numHashBytes = 4; + if (props.btMode) + { + if (props.numHashBytes < 2) + numHashBytes = 2; + else if (props.numHashBytes < 4) + numHashBytes = props.numHashBytes; + } + p->matchFinderBase.numHashBytes = numHashBytes; + } + + p->matchFinderBase.cutValue = props.mc; + + p->writeEndMark = props.writeEndMark; + + #ifndef _7ZIP_ST + /* + if (newMultiThread != _multiThread) + { + ReleaseMatchFinder(); + _multiThread = newMultiThread; + } + */ + p->multiThread = (props.numThreads > 1); + #endif + + return SZ_OK; +} + +static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5}; +static const int kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10}; +static const int kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11}; +static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11}; + +#define IsCharState(s) ((s) < 7) + +#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1) + +#define kInfinityPrice (1 << 30) + +static void RangeEnc_Construct(CRangeEnc *p) +{ + p->outStream = NULL; + p->bufBase = NULL; +} + +#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize) + +#define RC_BUF_SIZE (1 << 16) +static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc) +{ + if (!p->bufBase) + { + p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE); + if (!p->bufBase) + return 0; + p->bufLim = p->bufBase + RC_BUF_SIZE; + } + return 1; +} + +static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->bufBase); + p->bufBase = 0; +} + +static void RangeEnc_Init(CRangeEnc *p) +{ + /* Stream.Init(); */ + p->low = 0; + p->range = 0xFFFFFFFF; + p->cacheSize = 1; + p->cache = 0; + + p->buf = p->bufBase; + + p->processed = 0; + p->res = SZ_OK; +} + +static void RangeEnc_FlushStream(CRangeEnc *p) +{ + size_t num; + if (p->res != SZ_OK) + return; + num = p->buf - p->bufBase; + if (num != p->outStream->Write(p->outStream, p->bufBase, num)) + p->res = SZ_ERROR_WRITE; + p->processed += num; + p->buf = p->bufBase; +} + +static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p) +{ + if ((UInt32)p->low < (UInt32)0xFF000000 || (unsigned)(p->low >> 32) != 0) + { + Byte temp = p->cache; + do + { + Byte *buf = p->buf; + *buf++ = (Byte)(temp + (Byte)(p->low >> 32)); + p->buf = buf; + if (buf == p->bufLim) + RangeEnc_FlushStream(p); + temp = 0xFF; + } + while (--p->cacheSize != 0); + p->cache = (Byte)((UInt32)p->low >> 24); + } + p->cacheSize++; + p->low = (UInt32)p->low << 8; +} + +static void RangeEnc_FlushData(CRangeEnc *p) +{ + int i; + for (i = 0; i < 5; i++) + RangeEnc_ShiftLow(p); +} + +static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, unsigned numBits) +{ + do + { + p->range >>= 1; + p->low += p->range & (0 - ((value >> --numBits) & 1)); + if (p->range < kTopValue) + { + p->range <<= 8; + RangeEnc_ShiftLow(p); + } + } + while (numBits != 0); +} + +static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol) +{ + UInt32 ttt = *prob; + UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt; + if (symbol == 0) + { + p->range = newBound; + ttt += (kBitModelTotal - ttt) >> kNumMoveBits; + } + else + { + p->low += newBound; + p->range -= newBound; + ttt -= ttt >> kNumMoveBits; + } + *prob = (CLzmaProb)ttt; + if (p->range < kTopValue) + { + p->range <<= 8; + RangeEnc_ShiftLow(p); + } +} + +static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol) +{ + symbol |= 0x100; + do + { + RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1); + symbol <<= 1; + } + while (symbol < 0x10000); +} + +static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte) +{ + UInt32 offs = 0x100; + symbol |= 0x100; + do + { + matchByte <<= 1; + RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1); + symbol <<= 1; + offs &= ~(matchByte ^ symbol); + } + while (symbol < 0x10000); +} + +static void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) +{ + UInt32 i; + for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) + { + const int kCyclesBits = kNumBitPriceShiftBits; + UInt32 w = i; + UInt32 bitCount = 0; + int j; + for (j = 0; j < kCyclesBits; j++) + { + w = w * w; + bitCount <<= 1; + while (w >= ((UInt32)1 << 16)) + { + w >>= 1; + bitCount++; + } + } + ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount); + } +} + + +#define GET_PRICE(prob, symbol) \ + p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; + +#define GET_PRICEa(prob, symbol) \ + ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; + +#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits] +#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] + +#define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits] +#define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] + +static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, const UInt32 *ProbPrices) +{ + UInt32 price = 0; + symbol |= 0x100; + do + { + price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1); + symbol <<= 1; + } + while (symbol < 0x10000); + return price; +} + +static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, const UInt32 *ProbPrices) +{ + UInt32 price = 0; + UInt32 offs = 0x100; + symbol |= 0x100; + do + { + matchByte <<= 1; + price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1); + symbol <<= 1; + offs &= ~(matchByte ^ symbol); + } + while (symbol < 0x10000); + return price; +} + + +static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) +{ + UInt32 m = 1; + int i; + for (i = numBitLevels; i != 0;) + { + UInt32 bit; + i--; + bit = (symbol >> i) & 1; + RangeEnc_EncodeBit(rc, probs + m, bit); + m = (m << 1) | bit; + } +} + +static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) +{ + UInt32 m = 1; + int i; + for (i = 0; i < numBitLevels; i++) + { + UInt32 bit = symbol & 1; + RangeEnc_EncodeBit(rc, probs + m, bit); + m = (m << 1) | bit; + symbol >>= 1; + } +} + +static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, const UInt32 *ProbPrices) +{ + UInt32 price = 0; + symbol |= (1 << numBitLevels); + while (symbol != 1) + { + price += GET_PRICEa(probs[symbol >> 1], symbol & 1); + symbol >>= 1; + } + return price; +} + +static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, const UInt32 *ProbPrices) +{ + UInt32 price = 0; + UInt32 m = 1; + int i; + for (i = numBitLevels; i != 0; i--) + { + UInt32 bit = symbol & 1; + symbol >>= 1; + price += GET_PRICEa(probs[m], bit); + m = (m << 1) | bit; + } + return price; +} + + +static void LenEnc_Init(CLenEnc *p) +{ + unsigned i; + p->choice = p->choice2 = kProbInitValue; + for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++) + p->low[i] = kProbInitValue; + for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++) + p->mid[i] = kProbInitValue; + for (i = 0; i < kLenNumHighSymbols; i++) + p->high[i] = kProbInitValue; +} + +static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState) +{ + if (symbol < kLenNumLowSymbols) + { + RangeEnc_EncodeBit(rc, &p->choice, 0); + RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol); + } + else + { + RangeEnc_EncodeBit(rc, &p->choice, 1); + if (symbol < kLenNumLowSymbols + kLenNumMidSymbols) + { + RangeEnc_EncodeBit(rc, &p->choice2, 0); + RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols); + } + else + { + RangeEnc_EncodeBit(rc, &p->choice2, 1); + RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols); + } + } +} + +static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, const UInt32 *ProbPrices) +{ + UInt32 a0 = GET_PRICE_0a(p->choice); + UInt32 a1 = GET_PRICE_1a(p->choice); + UInt32 b0 = a1 + GET_PRICE_0a(p->choice2); + UInt32 b1 = a1 + GET_PRICE_1a(p->choice2); + UInt32 i = 0; + for (i = 0; i < kLenNumLowSymbols; i++) + { + if (i >= numSymbols) + return; + prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices); + } + for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++) + { + if (i >= numSymbols) + return; + prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices); + } + for (; i < numSymbols; i++) + prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices); +} + +static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, const UInt32 *ProbPrices) +{ + LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices); + p->counters[posState] = p->tableSize; +} + +static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, const UInt32 *ProbPrices) +{ + UInt32 posState; + for (posState = 0; posState < numPosStates; posState++) + LenPriceEnc_UpdateTable(p, posState, ProbPrices); +} + +static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, const UInt32 *ProbPrices) +{ + LenEnc_Encode(&p->p, rc, symbol, posState); + if (updatePrice) + if (--p->counters[posState] == 0) + LenPriceEnc_UpdateTable(p, posState, ProbPrices); +} + + + + +static void MovePos(CLzmaEnc *p, UInt32 num) +{ + #ifdef SHOW_STAT + g_STAT_OFFSET += num; + printf("\n MovePos %u", num); + #endif + + if (num != 0) + { + p->additionalOffset += num; + p->matchFinder.Skip(p->matchFinderObj, num); + } +} + +static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes) +{ + UInt32 lenRes = 0, numPairs; + p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); + numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches); + + #ifdef SHOW_STAT + printf("\n i = %u numPairs = %u ", g_STAT_OFFSET, numPairs / 2); + g_STAT_OFFSET++; + { + UInt32 i; + for (i = 0; i < numPairs; i += 2) + printf("%2u %6u | ", p->matches[i], p->matches[i + 1]); + } + #endif + + if (numPairs > 0) + { + lenRes = p->matches[numPairs - 2]; + if (lenRes == p->numFastBytes) + { + UInt32 numAvail = p->numAvail; + if (numAvail > LZMA_MATCH_LEN_MAX) + numAvail = LZMA_MATCH_LEN_MAX; + { + const Byte *pbyCur = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; + const Byte *pby = pbyCur + lenRes; + ptrdiff_t dif = (ptrdiff_t)-1 - p->matches[numPairs - 1]; + const Byte *pbyLim = pbyCur + numAvail; + for (; pby != pbyLim && *pby == pby[dif]; pby++); + lenRes = (UInt32)(pby - pbyCur); + } + } + } + p->additionalOffset++; + *numDistancePairsRes = numPairs; + return lenRes; +} + + +#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False; +#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False; +#define IsShortRep(p) ((p)->backPrev == 0) + +static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState) +{ + return + GET_PRICE_0(p->isRepG0[state]) + + GET_PRICE_0(p->isRep0Long[state][posState]); +} + +static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState) +{ + UInt32 price; + if (repIndex == 0) + { + price = GET_PRICE_0(p->isRepG0[state]); + price += GET_PRICE_1(p->isRep0Long[state][posState]); + } + else + { + price = GET_PRICE_1(p->isRepG0[state]); + if (repIndex == 1) + price += GET_PRICE_0(p->isRepG1[state]); + else + { + price += GET_PRICE_1(p->isRepG1[state]); + price += GET_PRICE(p->isRepG2[state], repIndex - 2); + } + } + return price; +} + +static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState) +{ + return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] + + GetPureRepPrice(p, repIndex, state, posState); +} + +static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur) +{ + UInt32 posMem = p->opt[cur].posPrev; + UInt32 backMem = p->opt[cur].backPrev; + p->optimumEndIndex = cur; + do + { + if (p->opt[cur].prev1IsChar) + { + MakeAsChar(&p->opt[posMem]) + p->opt[posMem].posPrev = posMem - 1; + if (p->opt[cur].prev2) + { + p->opt[posMem - 1].prev1IsChar = False; + p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2; + p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2; + } + } + { + UInt32 posPrev = posMem; + UInt32 backCur = backMem; + + backMem = p->opt[posPrev].backPrev; + posMem = p->opt[posPrev].posPrev; + + p->opt[posPrev].backPrev = backCur; + p->opt[posPrev].posPrev = cur; + cur = posPrev; + } + } + while (cur != 0); + *backRes = p->opt[0].backPrev; + p->optimumCurrentIndex = p->opt[0].posPrev; + return p->optimumCurrentIndex; +} + +#define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * (UInt32)0x300) + +static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) +{ + UInt32 lenEnd, cur; + UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS]; + UInt32 *matches; + + { + + UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, len; + UInt32 matchPrice, repMatchPrice, normalMatchPrice; + const Byte *data; + Byte curByte, matchByte; + + if (p->optimumEndIndex != p->optimumCurrentIndex) + { + const COptimal *opt = &p->opt[p->optimumCurrentIndex]; + UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex; + *backRes = opt->backPrev; + p->optimumCurrentIndex = opt->posPrev; + return lenRes; + } + p->optimumCurrentIndex = p->optimumEndIndex = 0; + + if (p->additionalOffset == 0) + mainLen = ReadMatchDistances(p, &numPairs); + else + { + mainLen = p->longestMatchLength; + numPairs = p->numPairs; + } + + numAvail = p->numAvail; + if (numAvail < 2) + { + *backRes = (UInt32)(-1); + return 1; + } + if (numAvail > LZMA_MATCH_LEN_MAX) + numAvail = LZMA_MATCH_LEN_MAX; + + data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; + repMaxIndex = 0; + for (i = 0; i < LZMA_NUM_REPS; i++) + { + UInt32 lenTest; + const Byte *data2; + reps[i] = p->reps[i]; + data2 = data - reps[i] - 1; + if (data[0] != data2[0] || data[1] != data2[1]) + { + repLens[i] = 0; + continue; + } + for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); + repLens[i] = lenTest; + if (lenTest > repLens[repMaxIndex]) + repMaxIndex = i; + } + if (repLens[repMaxIndex] >= p->numFastBytes) + { + UInt32 lenRes; + *backRes = repMaxIndex; + lenRes = repLens[repMaxIndex]; + MovePos(p, lenRes - 1); + return lenRes; + } + + matches = p->matches; + if (mainLen >= p->numFastBytes) + { + *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; + MovePos(p, mainLen - 1); + return mainLen; + } + curByte = *data; + matchByte = *(data - (reps[0] + 1)); + + if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2) + { + *backRes = (UInt32)-1; + return 1; + } + + p->opt[0].state = (CState)p->state; + + posState = (position & p->pbMask); + + { + const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); + p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) + + (!IsCharState(p->state) ? + LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : + LitEnc_GetPrice(probs, curByte, p->ProbPrices)); + } + + MakeAsChar(&p->opt[1]); + + matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]); + repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]); + + if (matchByte == curByte) + { + UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState); + if (shortRepPrice < p->opt[1].price) + { + p->opt[1].price = shortRepPrice; + MakeAsShortRep(&p->opt[1]); + } + } + lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]); + + if (lenEnd < 2) + { + *backRes = p->opt[1].backPrev; + return 1; + } + + p->opt[1].posPrev = 0; + for (i = 0; i < LZMA_NUM_REPS; i++) + p->opt[0].backs[i] = reps[i]; + + len = lenEnd; + do + p->opt[len--].price = kInfinityPrice; + while (len >= 2); + + for (i = 0; i < LZMA_NUM_REPS; i++) + { + UInt32 repLen = repLens[i]; + UInt32 price; + if (repLen < 2) + continue; + price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState); + do + { + UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2]; + COptimal *opt = &p->opt[repLen]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = 0; + opt->backPrev = i; + opt->prev1IsChar = False; + } + } + while (--repLen >= 2); + } + + normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]); + + len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2); + if (len <= mainLen) + { + UInt32 offs = 0; + while (len > matches[offs]) + offs += 2; + for (; ; len++) + { + COptimal *opt; + UInt32 distance = matches[offs + 1]; + + UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN]; + UInt32 lenToPosState = GetLenToPosState(len); + if (distance < kNumFullDistances) + curAndLenPrice += p->distancesPrices[lenToPosState][distance]; + else + { + UInt32 slot; + GetPosSlot2(distance, slot); + curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot]; + } + opt = &p->opt[len]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = 0; + opt->backPrev = distance + LZMA_NUM_REPS; + opt->prev1IsChar = False; + } + if (len == matches[offs]) + { + offs += 2; + if (offs == numPairs) + break; + } + } + } + + cur = 0; + + #ifdef SHOW_STAT2 + /* if (position >= 0) */ + { + unsigned i; + printf("\n pos = %4X", position); + for (i = cur; i <= lenEnd; i++) + printf("\nprice[%4X] = %u", position - cur + i, p->opt[i].price); + } + #endif + + } + + for (;;) + { + UInt32 numAvail; + UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen; + UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice; + Bool nextIsChar; + Byte curByte, matchByte; + const Byte *data; + COptimal *curOpt; + COptimal *nextOpt; + + cur++; + if (cur == lenEnd) + return Backward(p, backRes, cur); + + newLen = ReadMatchDistances(p, &numPairs); + if (newLen >= p->numFastBytes) + { + p->numPairs = numPairs; + p->longestMatchLength = newLen; + return Backward(p, backRes, cur); + } + position++; + curOpt = &p->opt[cur]; + posPrev = curOpt->posPrev; + if (curOpt->prev1IsChar) + { + posPrev--; + if (curOpt->prev2) + { + state = p->opt[curOpt->posPrev2].state; + if (curOpt->backPrev2 < LZMA_NUM_REPS) + state = kRepNextStates[state]; + else + state = kMatchNextStates[state]; + } + else + state = p->opt[posPrev].state; + state = kLiteralNextStates[state]; + } + else + state = p->opt[posPrev].state; + if (posPrev == cur - 1) + { + if (IsShortRep(curOpt)) + state = kShortRepNextStates[state]; + else + state = kLiteralNextStates[state]; + } + else + { + UInt32 pos; + const COptimal *prevOpt; + if (curOpt->prev1IsChar && curOpt->prev2) + { + posPrev = curOpt->posPrev2; + pos = curOpt->backPrev2; + state = kRepNextStates[state]; + } + else + { + pos = curOpt->backPrev; + if (pos < LZMA_NUM_REPS) + state = kRepNextStates[state]; + else + state = kMatchNextStates[state]; + } + prevOpt = &p->opt[posPrev]; + if (pos < LZMA_NUM_REPS) + { + UInt32 i; + reps[0] = prevOpt->backs[pos]; + for (i = 1; i <= pos; i++) + reps[i] = prevOpt->backs[i - 1]; + for (; i < LZMA_NUM_REPS; i++) + reps[i] = prevOpt->backs[i]; + } + else + { + UInt32 i; + reps[0] = (pos - LZMA_NUM_REPS); + for (i = 1; i < LZMA_NUM_REPS; i++) + reps[i] = prevOpt->backs[i - 1]; + } + } + curOpt->state = (CState)state; + + curOpt->backs[0] = reps[0]; + curOpt->backs[1] = reps[1]; + curOpt->backs[2] = reps[2]; + curOpt->backs[3] = reps[3]; + + curPrice = curOpt->price; + nextIsChar = False; + data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; + curByte = *data; + matchByte = *(data - (reps[0] + 1)); + + posState = (position & p->pbMask); + + curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]); + { + const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); + curAnd1Price += + (!IsCharState(state) ? + LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : + LitEnc_GetPrice(probs, curByte, p->ProbPrices)); + } + + nextOpt = &p->opt[cur + 1]; + + if (curAnd1Price < nextOpt->price) + { + nextOpt->price = curAnd1Price; + nextOpt->posPrev = cur; + MakeAsChar(nextOpt); + nextIsChar = True; + } + + matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]); + repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]); + + if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0)) + { + UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState); + if (shortRepPrice <= nextOpt->price) + { + nextOpt->price = shortRepPrice; + nextOpt->posPrev = cur; + MakeAsShortRep(nextOpt); + nextIsChar = True; + } + } + numAvailFull = p->numAvail; + { + UInt32 temp = kNumOpts - 1 - cur; + if (temp < numAvailFull) + numAvailFull = temp; + } + + if (numAvailFull < 2) + continue; + numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes); + + if (!nextIsChar && matchByte != curByte) /* speed optimization */ + { + /* try Literal + rep0 */ + UInt32 temp; + UInt32 lenTest2; + const Byte *data2 = data - reps[0] - 1; + UInt32 limit = p->numFastBytes + 1; + if (limit > numAvailFull) + limit = numAvailFull; + + for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++); + lenTest2 = temp - 1; + if (lenTest2 >= 2) + { + UInt32 state2 = kLiteralNextStates[state]; + UInt32 posStateNext = (position + 1) & p->pbMask; + UInt32 nextRepMatchPrice = curAnd1Price + + GET_PRICE_1(p->isMatch[state2][posStateNext]) + + GET_PRICE_1(p->isRep[state2]); + /* for (; lenTest2 >= 2; lenTest2--) */ + { + UInt32 curAndLenPrice; + COptimal *opt; + UInt32 offset = cur + 1 + lenTest2; + while (lenEnd < offset) + p->opt[++lenEnd].price = kInfinityPrice; + curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); + opt = &p->opt[offset]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = cur + 1; + opt->backPrev = 0; + opt->prev1IsChar = True; + opt->prev2 = False; + } + } + } + } + + startLen = 2; /* speed optimization */ + { + UInt32 repIndex; + for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++) + { + UInt32 lenTest; + UInt32 lenTestTemp; + UInt32 price; + const Byte *data2 = data - reps[repIndex] - 1; + if (data[0] != data2[0] || data[1] != data2[1]) + continue; + for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); + while (lenEnd < cur + lenTest) + p->opt[++lenEnd].price = kInfinityPrice; + lenTestTemp = lenTest; + price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState); + do + { + UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2]; + COptimal *opt = &p->opt[cur + lenTest]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = cur; + opt->backPrev = repIndex; + opt->prev1IsChar = False; + } + } + while (--lenTest >= 2); + lenTest = lenTestTemp; + + if (repIndex == 0) + startLen = lenTest + 1; + + /* if (_maxMode) */ + { + UInt32 lenTest2 = lenTest + 1; + UInt32 limit = lenTest2 + p->numFastBytes; + if (limit > numAvailFull) + limit = numAvailFull; + for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); + lenTest2 -= lenTest + 1; + if (lenTest2 >= 2) + { + UInt32 nextRepMatchPrice; + UInt32 state2 = kRepNextStates[state]; + UInt32 posStateNext = (position + lenTest) & p->pbMask; + UInt32 curAndLenCharPrice = + price + p->repLenEnc.prices[posState][lenTest - 2] + + GET_PRICE_0(p->isMatch[state2][posStateNext]) + + LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), + data[lenTest], data2[lenTest], p->ProbPrices); + state2 = kLiteralNextStates[state2]; + posStateNext = (position + lenTest + 1) & p->pbMask; + nextRepMatchPrice = curAndLenCharPrice + + GET_PRICE_1(p->isMatch[state2][posStateNext]) + + GET_PRICE_1(p->isRep[state2]); + + /* for (; lenTest2 >= 2; lenTest2--) */ + { + UInt32 curAndLenPrice; + COptimal *opt; + UInt32 offset = cur + lenTest + 1 + lenTest2; + while (lenEnd < offset) + p->opt[++lenEnd].price = kInfinityPrice; + curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); + opt = &p->opt[offset]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = cur + lenTest + 1; + opt->backPrev = 0; + opt->prev1IsChar = True; + opt->prev2 = True; + opt->posPrev2 = cur; + opt->backPrev2 = repIndex; + } + } + } + } + } + } + /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */ + if (newLen > numAvail) + { + newLen = numAvail; + for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2); + matches[numPairs] = newLen; + numPairs += 2; + } + if (newLen >= startLen) + { + UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]); + UInt32 offs, curBack, posSlot; + UInt32 lenTest; + while (lenEnd < cur + newLen) + p->opt[++lenEnd].price = kInfinityPrice; + + offs = 0; + while (startLen > matches[offs]) + offs += 2; + curBack = matches[offs + 1]; + GetPosSlot2(curBack, posSlot); + for (lenTest = /*2*/ startLen; ; lenTest++) + { + UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN]; + { + UInt32 lenToPosState = GetLenToPosState(lenTest); + COptimal *opt; + if (curBack < kNumFullDistances) + curAndLenPrice += p->distancesPrices[lenToPosState][curBack]; + else + curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask]; + + opt = &p->opt[cur + lenTest]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = cur; + opt->backPrev = curBack + LZMA_NUM_REPS; + opt->prev1IsChar = False; + } + } + + if (/*_maxMode && */lenTest == matches[offs]) + { + /* Try Match + Literal + Rep0 */ + const Byte *data2 = data - curBack - 1; + UInt32 lenTest2 = lenTest + 1; + UInt32 limit = lenTest2 + p->numFastBytes; + if (limit > numAvailFull) + limit = numAvailFull; + for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); + lenTest2 -= lenTest + 1; + if (lenTest2 >= 2) + { + UInt32 nextRepMatchPrice; + UInt32 state2 = kMatchNextStates[state]; + UInt32 posStateNext = (position + lenTest) & p->pbMask; + UInt32 curAndLenCharPrice = curAndLenPrice + + GET_PRICE_0(p->isMatch[state2][posStateNext]) + + LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), + data[lenTest], data2[lenTest], p->ProbPrices); + state2 = kLiteralNextStates[state2]; + posStateNext = (posStateNext + 1) & p->pbMask; + nextRepMatchPrice = curAndLenCharPrice + + GET_PRICE_1(p->isMatch[state2][posStateNext]) + + GET_PRICE_1(p->isRep[state2]); + + /* for (; lenTest2 >= 2; lenTest2--) */ + { + UInt32 offset = cur + lenTest + 1 + lenTest2; + UInt32 curAndLenPrice2; + COptimal *opt; + while (lenEnd < offset) + p->opt[++lenEnd].price = kInfinityPrice; + curAndLenPrice2 = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); + opt = &p->opt[offset]; + if (curAndLenPrice2 < opt->price) + { + opt->price = curAndLenPrice2; + opt->posPrev = cur + lenTest + 1; + opt->backPrev = 0; + opt->prev1IsChar = True; + opt->prev2 = True; + opt->posPrev2 = cur; + opt->backPrev2 = curBack + LZMA_NUM_REPS; + } + } + } + offs += 2; + if (offs == numPairs) + break; + curBack = matches[offs + 1]; + if (curBack >= kNumFullDistances) + GetPosSlot2(curBack, posSlot); + } + } + } + } +} + +#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist)) + +static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes) +{ + UInt32 numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i; + const Byte *data; + const UInt32 *matches; + + if (p->additionalOffset == 0) + mainLen = ReadMatchDistances(p, &numPairs); + else + { + mainLen = p->longestMatchLength; + numPairs = p->numPairs; + } + + numAvail = p->numAvail; + *backRes = (UInt32)-1; + if (numAvail < 2) + return 1; + if (numAvail > LZMA_MATCH_LEN_MAX) + numAvail = LZMA_MATCH_LEN_MAX; + data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; + + repLen = repIndex = 0; + for (i = 0; i < LZMA_NUM_REPS; i++) + { + UInt32 len; + const Byte *data2 = data - p->reps[i] - 1; + if (data[0] != data2[0] || data[1] != data2[1]) + continue; + for (len = 2; len < numAvail && data[len] == data2[len]; len++); + if (len >= p->numFastBytes) + { + *backRes = i; + MovePos(p, len - 1); + return len; + } + if (len > repLen) + { + repIndex = i; + repLen = len; + } + } + + matches = p->matches; + if (mainLen >= p->numFastBytes) + { + *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; + MovePos(p, mainLen - 1); + return mainLen; + } + + mainDist = 0; /* for GCC */ + if (mainLen >= 2) + { + mainDist = matches[numPairs - 1]; + while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1) + { + if (!ChangePair(matches[numPairs - 3], mainDist)) + break; + numPairs -= 2; + mainLen = matches[numPairs - 2]; + mainDist = matches[numPairs - 1]; + } + if (mainLen == 2 && mainDist >= 0x80) + mainLen = 1; + } + + if (repLen >= 2 && ( + (repLen + 1 >= mainLen) || + (repLen + 2 >= mainLen && mainDist >= (1 << 9)) || + (repLen + 3 >= mainLen && mainDist >= (1 << 15)))) + { + *backRes = repIndex; + MovePos(p, repLen - 1); + return repLen; + } + + if (mainLen < 2 || numAvail <= 2) + return 1; + + p->longestMatchLength = ReadMatchDistances(p, &p->numPairs); + if (p->longestMatchLength >= 2) + { + UInt32 newDistance = matches[p->numPairs - 1]; + if ((p->longestMatchLength >= mainLen && newDistance < mainDist) || + (p->longestMatchLength == mainLen + 1 && !ChangePair(mainDist, newDistance)) || + (p->longestMatchLength > mainLen + 1) || + (p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist))) + return 1; + } + + data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; + for (i = 0; i < LZMA_NUM_REPS; i++) + { + UInt32 len, limit; + const Byte *data2 = data - p->reps[i] - 1; + if (data[0] != data2[0] || data[1] != data2[1]) + continue; + limit = mainLen - 1; + for (len = 2; len < limit && data[len] == data2[len]; len++); + if (len >= limit) + return 1; + } + *backRes = mainDist + LZMA_NUM_REPS; + MovePos(p, mainLen - 2); + return mainLen; +} + +static void WriteEndMarker(CLzmaEnc *p, UInt32 posState) +{ + UInt32 len; + RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); + RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); + p->state = kMatchNextStates[p->state]; + len = LZMA_MATCH_LEN_MIN; + LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); + RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1); + RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits); + RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask); +} + +static SRes CheckErrors(CLzmaEnc *p) +{ + if (p->result != SZ_OK) + return p->result; + if (p->rc.res != SZ_OK) + p->result = SZ_ERROR_WRITE; + if (p->matchFinderBase.result != SZ_OK) + p->result = SZ_ERROR_READ; + if (p->result != SZ_OK) + p->finished = True; + return p->result; +} + +static SRes Flush(CLzmaEnc *p, UInt32 nowPos) +{ + /* ReleaseMFStream(); */ + p->finished = True; + if (p->writeEndMark) + WriteEndMarker(p, nowPos & p->pbMask); + RangeEnc_FlushData(&p->rc); + RangeEnc_FlushStream(&p->rc); + return CheckErrors(p); +} + +static void FillAlignPrices(CLzmaEnc *p) +{ + UInt32 i; + for (i = 0; i < kAlignTableSize; i++) + p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices); + p->alignPriceCount = 0; +} + +static void FillDistancesPrices(CLzmaEnc *p) +{ + UInt32 tempPrices[kNumFullDistances]; + UInt32 i, lenToPosState; + for (i = kStartPosModelIndex; i < kNumFullDistances; i++) + { + UInt32 posSlot = GetPosSlot1(i); + UInt32 footerBits = ((posSlot >> 1) - 1); + UInt32 base = ((2 | (posSlot & 1)) << footerBits); + tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices); + } + + for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++) + { + UInt32 posSlot; + const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState]; + UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState]; + for (posSlot = 0; posSlot < p->distTableSize; posSlot++) + posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices); + for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++) + posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits); + + { + UInt32 *distancesPrices = p->distancesPrices[lenToPosState]; + for (i = 0; i < kStartPosModelIndex; i++) + distancesPrices[i] = posSlotPrices[i]; + for (; i < kNumFullDistances; i++) + distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i]; + } + } + p->matchPriceCount = 0; +} + +void LzmaEnc_Construct(CLzmaEnc *p) +{ + RangeEnc_Construct(&p->rc); + MatchFinder_Construct(&p->matchFinderBase); + + #ifndef _7ZIP_ST + MatchFinderMt_Construct(&p->matchFinderMt); + p->matchFinderMt.MatchFinder = &p->matchFinderBase; + #endif + + { + CLzmaEncProps props; + LzmaEncProps_Init(&props); + LzmaEnc_SetProps(p, &props); + } + + #ifndef LZMA_LOG_BSR + LzmaEnc_FastPosInit(p->g_FastPos); + #endif + + LzmaEnc_InitPriceTables(p->ProbPrices); + p->litProbs = NULL; + p->saveState.litProbs = NULL; +} + +CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc) +{ + void *p; + p = alloc->Alloc(alloc, sizeof(CLzmaEnc)); + if (p) + LzmaEnc_Construct((CLzmaEnc *)p); + return p; +} + +void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->litProbs); + alloc->Free(alloc, p->saveState.litProbs); + p->litProbs = NULL; + p->saveState.litProbs = NULL; +} + +void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + #ifndef _7ZIP_ST + MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); + #endif + + MatchFinder_Free(&p->matchFinderBase, allocBig); + LzmaEnc_FreeLits(p, alloc); + RangeEnc_Free(&p->rc, alloc); +} + +void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig); + alloc->Free(alloc, p); +} + +static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize) +{ + UInt32 nowPos32, startPos32; + if (p->needInit) + { + p->matchFinder.Init(p->matchFinderObj); + p->needInit = 0; + } + + if (p->finished) + return p->result; + RINOK(CheckErrors(p)); + + nowPos32 = (UInt32)p->nowPos64; + startPos32 = nowPos32; + + if (p->nowPos64 == 0) + { + UInt32 numPairs; + Byte curByte; + if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) + return Flush(p, nowPos32); + ReadMatchDistances(p, &numPairs); + RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0); + p->state = kLiteralNextStates[p->state]; + curByte = *(p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset); + LitEnc_Encode(&p->rc, p->litProbs, curByte); + p->additionalOffset--; + nowPos32++; + } + + if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0) + for (;;) + { + UInt32 pos, len, posState; + + if (p->fastMode) + len = GetOptimumFast(p, &pos); + else + len = GetOptimum(p, nowPos32, &pos); + + #ifdef SHOW_STAT2 + printf("\n pos = %4X, len = %u pos = %u", nowPos32, len, pos); + #endif + + posState = nowPos32 & p->pbMask; + if (len == 1 && pos == (UInt32)-1) + { + Byte curByte; + CLzmaProb *probs; + const Byte *data; + + RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0); + data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; + curByte = *data; + probs = LIT_PROBS(nowPos32, *(data - 1)); + if (IsCharState(p->state)) + LitEnc_Encode(&p->rc, probs, curByte); + else + LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1)); + p->state = kLiteralNextStates[p->state]; + } + else + { + RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); + if (pos < LZMA_NUM_REPS) + { + RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1); + if (pos == 0) + { + RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0); + RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1)); + } + else + { + UInt32 distance = p->reps[pos]; + RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1); + if (pos == 1) + RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0); + else + { + RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1); + RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2); + if (pos == 3) + p->reps[3] = p->reps[2]; + p->reps[2] = p->reps[1]; + } + p->reps[1] = p->reps[0]; + p->reps[0] = distance; + } + if (len == 1) + p->state = kShortRepNextStates[p->state]; + else + { + LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); + p->state = kRepNextStates[p->state]; + } + } + else + { + UInt32 posSlot; + RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); + p->state = kMatchNextStates[p->state]; + LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); + pos -= LZMA_NUM_REPS; + GetPosSlot(pos, posSlot); + RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot); + + if (posSlot >= kStartPosModelIndex) + { + UInt32 footerBits = ((posSlot >> 1) - 1); + UInt32 base = ((2 | (posSlot & 1)) << footerBits); + UInt32 posReduced = pos - base; + + if (posSlot < kEndPosModelIndex) + RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced); + else + { + RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits); + RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask); + p->alignPriceCount++; + } + } + p->reps[3] = p->reps[2]; + p->reps[2] = p->reps[1]; + p->reps[1] = p->reps[0]; + p->reps[0] = pos; + p->matchPriceCount++; + } + } + p->additionalOffset -= len; + nowPos32 += len; + if (p->additionalOffset == 0) + { + UInt32 processed; + if (!p->fastMode) + { + if (p->matchPriceCount >= (1 << 7)) + FillDistancesPrices(p); + if (p->alignPriceCount >= kAlignTableSize) + FillAlignPrices(p); + } + if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) + break; + processed = nowPos32 - startPos32; + if (useLimits) + { + if (processed + kNumOpts + 300 >= maxUnpackSize || + RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize) + break; + } + else if (processed >= (1 << 17)) + { + p->nowPos64 += nowPos32 - startPos32; + return CheckErrors(p); + } + } + } + p->nowPos64 += nowPos32 - startPos32; + return Flush(p, nowPos32); +} + +#define kBigHashDicLimit ((UInt32)1 << 24) + +static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + UInt32 beforeSize = kNumOpts; + if (!RangeEnc_Alloc(&p->rc, alloc)) + return SZ_ERROR_MEM; + + #ifndef _7ZIP_ST + p->mtMode = (p->multiThread && !p->fastMode && (p->matchFinderBase.btMode != 0)); + #endif + + { + unsigned lclp = p->lc + p->lp; + if (!p->litProbs || !p->saveState.litProbs || p->lclp != lclp) + { + LzmaEnc_FreeLits(p, alloc); + p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, ((UInt32)0x300 << lclp) * sizeof(CLzmaProb)); + p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, ((UInt32)0x300 << lclp) * sizeof(CLzmaProb)); + if (!p->litProbs || !p->saveState.litProbs) + { + LzmaEnc_FreeLits(p, alloc); + return SZ_ERROR_MEM; + } + p->lclp = lclp; + } + } + + p->matchFinderBase.bigHash = (Byte)(p->dictSize > kBigHashDicLimit ? 1 : 0); + + if (beforeSize + p->dictSize < keepWindowSize) + beforeSize = keepWindowSize - p->dictSize; + + #ifndef _7ZIP_ST + if (p->mtMode) + { + RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)); + p->matchFinderObj = &p->matchFinderMt; + MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder); + } + else + #endif + { + if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)) + return SZ_ERROR_MEM; + p->matchFinderObj = &p->matchFinderBase; + MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder); + } + + return SZ_OK; +} + +void LzmaEnc_Init(CLzmaEnc *p) +{ + UInt32 i; + p->state = 0; + for (i = 0 ; i < LZMA_NUM_REPS; i++) + p->reps[i] = 0; + + RangeEnc_Init(&p->rc); + + + for (i = 0; i < kNumStates; i++) + { + UInt32 j; + for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++) + { + p->isMatch[i][j] = kProbInitValue; + p->isRep0Long[i][j] = kProbInitValue; + } + p->isRep[i] = kProbInitValue; + p->isRepG0[i] = kProbInitValue; + p->isRepG1[i] = kProbInitValue; + p->isRepG2[i] = kProbInitValue; + } + + { + UInt32 num = (UInt32)0x300 << (p->lp + p->lc); + CLzmaProb *probs = p->litProbs; + for (i = 0; i < num; i++) + probs[i] = kProbInitValue; + } + + { + for (i = 0; i < kNumLenToPosStates; i++) + { + CLzmaProb *probs = p->posSlotEncoder[i]; + UInt32 j; + for (j = 0; j < (1 << kNumPosSlotBits); j++) + probs[j] = kProbInitValue; + } + } + { + for (i = 0; i < kNumFullDistances - kEndPosModelIndex; i++) + p->posEncoders[i] = kProbInitValue; + } + + LenEnc_Init(&p->lenEnc.p); + LenEnc_Init(&p->repLenEnc.p); + + for (i = 0; i < (1 << kNumAlignBits); i++) + p->posAlignEncoder[i] = kProbInitValue; + + p->optimumEndIndex = 0; + p->optimumCurrentIndex = 0; + p->additionalOffset = 0; + + p->pbMask = (1 << p->pb) - 1; + p->lpMask = (1 << p->lp) - 1; +} + +void LzmaEnc_InitPrices(CLzmaEnc *p) +{ + if (!p->fastMode) + { + FillDistancesPrices(p); + FillAlignPrices(p); + } + + p->lenEnc.tableSize = + p->repLenEnc.tableSize = + p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN; + LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices); + LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices); +} + +static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + UInt32 i; + for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++) + if (p->dictSize <= ((UInt32)1 << i)) + break; + p->distTableSize = i * 2; + + p->finished = False; + p->result = SZ_OK; + RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig)); + LzmaEnc_Init(p); + LzmaEnc_InitPrices(p); + p->nowPos64 = 0; + return SZ_OK; +} + +static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, + ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + p->matchFinderBase.stream = inStream; + p->needInit = 1; + p->rc.outStream = outStream; + return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); +} + +SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, + ISeqInStream *inStream, UInt32 keepWindowSize, + ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + p->matchFinderBase.stream = inStream; + p->needInit = 1; + return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); +} + +static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) +{ + p->matchFinderBase.directInput = 1; + p->matchFinderBase.bufferBase = (Byte *)src; + p->matchFinderBase.directInputRem = srcLen; +} + +SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, + UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + LzmaEnc_SetInputBuf(p, src, srcLen); + p->needInit = 1; + + return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); +} + +void LzmaEnc_Finish(CLzmaEncHandle pp) +{ + #ifndef _7ZIP_ST + CLzmaEnc *p = (CLzmaEnc *)pp; + if (p->mtMode) + MatchFinderMt_ReleaseStream(&p->matchFinderMt); + #else + UNUSED_VAR(pp); + #endif +} + + +typedef struct +{ + ISeqOutStream funcTable; + Byte *data; + SizeT rem; + Bool overflow; +} CSeqOutStreamBuf; + +static size_t MyWrite(void *pp, const void *data, size_t size) +{ + CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp; + if (p->rem < size) + { + size = p->rem; + p->overflow = True; + } + memcpy(p->data, data, size); + p->rem -= size; + p->data += size; + return size; +} + + +UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) +{ + const CLzmaEnc *p = (CLzmaEnc *)pp; + return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); +} + + +const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) +{ + const CLzmaEnc *p = (CLzmaEnc *)pp; + return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; +} + + +SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, + Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + UInt64 nowPos64; + SRes res; + CSeqOutStreamBuf outStream; + + outStream.funcTable.Write = MyWrite; + outStream.data = dest; + outStream.rem = *destLen; + outStream.overflow = False; + + p->writeEndMark = False; + p->finished = False; + p->result = SZ_OK; + + if (reInit) + LzmaEnc_Init(p); + LzmaEnc_InitPrices(p); + nowPos64 = p->nowPos64; + RangeEnc_Init(&p->rc); + p->rc.outStream = &outStream.funcTable; + + res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); + + *unpackSize = (UInt32)(p->nowPos64 - nowPos64); + *destLen -= outStream.rem; + if (outStream.overflow) + return SZ_ERROR_OUTPUT_EOF; + + return res; +} + + +static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) +{ + SRes res = SZ_OK; + + #ifndef _7ZIP_ST + Byte allocaDummy[0x300]; + allocaDummy[0] = 0; + allocaDummy[1] = allocaDummy[0]; + #endif + + for (;;) + { + res = LzmaEnc_CodeOneBlock(p, False, 0, 0); + if (res != SZ_OK || p->finished) + break; + if (progress) + { + res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc)); + if (res != SZ_OK) + { + res = SZ_ERROR_PROGRESS; + break; + } + } + } + + LzmaEnc_Finish(p); + + /* + if (res == S_OK && !Inline_MatchFinder_IsFinishedOK(&p->matchFinderBase)) + res = SZ_ERROR_FAIL; + } + */ + + return res; +} + + +SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, + ISzAlloc *alloc, ISzAlloc *allocBig) +{ + RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); + return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); +} + + +SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + unsigned i; + UInt32 dictSize = p->dictSize; + if (*size < LZMA_PROPS_SIZE) + return SZ_ERROR_PARAM; + *size = LZMA_PROPS_SIZE; + props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc); + + if (dictSize >= ((UInt32)1 << 22)) + { + UInt32 kDictMask = ((UInt32)1 << 20) - 1; + if (dictSize < (UInt32)0xFFFFFFFF - kDictMask) + dictSize = (dictSize + kDictMask) & ~kDictMask; + } + else for (i = 11; i <= 30; i++) + { + if (dictSize <= ((UInt32)2 << i)) { dictSize = (2 << i); break; } + if (dictSize <= ((UInt32)3 << i)) { dictSize = (3 << i); break; } + } + + for (i = 0; i < 4; i++) + props[1 + i] = (Byte)(dictSize >> (8 * i)); + return SZ_OK; +} + + +SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, + int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + SRes res; + CLzmaEnc *p = (CLzmaEnc *)pp; + + CSeqOutStreamBuf outStream; + + outStream.funcTable.Write = MyWrite; + outStream.data = dest; + outStream.rem = *destLen; + outStream.overflow = False; + + p->writeEndMark = writeEndMark; + p->rc.outStream = &outStream.funcTable; + + res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig); + + if (res == SZ_OK) + { + res = LzmaEnc_Encode2(p, progress); + if (res == SZ_OK && p->nowPos64 != srcLen) + res = SZ_ERROR_FAIL; + } + + *destLen -= outStream.rem; + if (outStream.overflow) + return SZ_ERROR_OUTPUT_EOF; + return res; +} + + +SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, + const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, + ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); + SRes res; + if (!p) + return SZ_ERROR_MEM; + + res = LzmaEnc_SetProps(p, props); + if (res == SZ_OK) + { + res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize); + if (res == SZ_OK) + res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen, + writeEndMark, progress, alloc, allocBig); + } + + LzmaEnc_Destroy(p, alloc, allocBig); + return res; +} diff --git a/src/lzma/lzma_binding.c b/src/lzma/lzma_binding.c index c01fdd0e77..24dd28e60a 100644 --- a/src/lzma/lzma_binding.c +++ b/src/lzma/lzma_binding.c @@ -102,7 +102,7 @@ delta_decode(PyObject *self, PyObject *args) { datalen = PyBytes_GET_SIZE(array); for (i = 0; i < datalen; i++) { - data[i] += history[(unsigned char)(pos + distance)]; + data[i] += history[(unsigned char)(pos + distance)]; history[pos--] = data[i]; } return Py_BuildValue("B", pos); @@ -122,7 +122,7 @@ decompress2(PyObject *self, PyObject *args) { ELzmaStatus status = LZMA_STATUS_NOT_FINISHED; if (!PyArg_ParseTuple(args, "OOOBk", &read, &seek, &write, &props, &bufsize)) return NULL; - + Lzma2Dec_Construct(&state); res = Lzma2Dec_Allocate(&state, (Byte)props, &allocator); if (res == SZ_ERROR_MEM) { PyErr_NoMemory(); return NULL; } @@ -158,7 +158,7 @@ decompress2(PyObject *self, PyObject *args) { if (inbuf_len == 0) { PyErr_SetString(LZMAError, "LZMA2 block was truncated"); goto exit; } memcpy(inbuf, PyBytes_AS_STRING(rres), inbuf_len); Py_DECREF(rres); rres = NULL; - } + } } leftover = inbuf_len - inbuf_pos; if (leftover > 0) { @@ -232,7 +232,7 @@ decompress(PyObject *self, PyObject *args) { if (inbuf_len == 0) { PyErr_SetString(LZMAError, "LZMA block was truncated"); goto exit; } memcpy(inbuf, PyBytes_AS_STRING(rres), inbuf_len); Py_DECREF(rres); rres = NULL; - } + } } leftover = inbuf_len - inbuf_pos; if (leftover > 0) { @@ -386,7 +386,7 @@ exit: } // }}} - + static PyMethodDef lzma_binding_methods[] = { {"decompress2", decompress2, METH_VARARGS, "Decompress an LZMA2 encoded block, of unknown compressed size (reads till LZMA2 EOS marker)" From 7fd2cb4893a9a226b9e818cfb45a927a0e8f0f7f Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Wed, 27 Feb 2019 08:55:21 +0530 Subject: [PATCH 0253/2613] Misc py3 porting work --- .../devices/mtp/windows/device_enumeration.cpp | 6 +++++- src/calibre/utils/podofo/utils.cpp | 16 +++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/calibre/devices/mtp/windows/device_enumeration.cpp b/src/calibre/devices/mtp/windows/device_enumeration.cpp index c06c33d403..f0030d0576 100644 --- a/src/calibre/devices/mtp/windows/device_enumeration.cpp +++ b/src/calibre/devices/mtp/windows/device_enumeration.cpp @@ -220,7 +220,7 @@ PyObject* get_device_information(IPortableDevice *device, IPortableDevicePropert LPWSTR temp; ULONG ti; PyObject *t, *ans = NULL, *storage = NULL; - char *type; + const char *type = NULL; Py_BEGIN_ALLOW_THREADS; hr = CoCreateInstance(CLSID_PortableDeviceKeyCollection, NULL, @@ -302,7 +302,11 @@ PyObject* get_device_information(IPortableDevice *device, IPortableDevicePropert default: type = "unknown"; } +#if PY_MAJOR_VERSION >= 3 + t = PyUnicode_FromString(type); +#else t = PyString_FromString(type); +#endif if (t != NULL) { PyDict_SetItemString(ans, "type", t); Py_DECREF(t); } diff --git a/src/calibre/utils/podofo/utils.cpp b/src/calibre/utils/podofo/utils.cpp index 668ae83e3d..dd934b7f3d 100644 --- a/src/calibre/utils/podofo/utils.cpp +++ b/src/calibre/utils/podofo/utils.cpp @@ -18,15 +18,14 @@ void pdf::podofo_set_exception(const PdfError &err) { PyObject * pdf::podofo_convert_pdfstring(const PdfString &s) { std::string raw = s.GetStringUtf8(); - return PyString_FromStringAndSize(raw.c_str(), raw.length()); + return PyBytes_FromStringAndSize(raw.c_str(), raw.length()); } PdfString * pdf::podofo_convert_pystring(PyObject *py) { - Py_UNICODE* u = PyUnicode_AS_UNICODE(py); - PyObject *u8 = PyUnicode_EncodeUTF8(u, PyUnicode_GET_SIZE(py), "replace"); - if (u8 == NULL) { PyErr_NoMemory(); return NULL; } - pdf_utf8 *s8 = reinterpret_cast<pdf_utf8 *>(PyString_AS_STRING(u8)); + PyObject *u8 = PyUnicode_AsEncodedString(py, "UTF-8", "replace"); + if (u8 == NULL) { return NULL; } + pdf_utf8 *s8 = reinterpret_cast<pdf_utf8 *>(PyBytes_AS_STRING(u8)); PdfString *ans = new PdfString(s8); Py_DECREF(u8); if (ans == NULL) PyErr_NoMemory(); @@ -35,10 +34,9 @@ pdf::podofo_convert_pystring(PyObject *py) { PdfString * pdf::podofo_convert_pystring_single_byte(PyObject *py) { - Py_UNICODE* u = PyUnicode_AS_UNICODE(py); - PyObject *s = PyUnicode_Encode(u, PyUnicode_GET_SIZE(py), "cp1252", "replace"); - if (s == NULL) { PyErr_NoMemory(); return NULL; } - PdfString *ans = new PdfString(PyString_AS_STRING(s)); + PyObject *s = PyUnicode_AsEncodedString(py, "cp1252", "replace"); + if (s == NULL) { return NULL; } + PdfString *ans = new PdfString(PyBytes_AS_STRING(s)); Py_DECREF(s); if (ans == NULL) PyErr_NoMemory(); return ans; From 494140ecc1ff43825d65f559a2e142d9cbe2688d Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Wed, 27 Feb 2019 11:25:56 +0530 Subject: [PATCH 0254/2613] Fix #1817828 [Economist Magazine download not working](https://bugs.launchpad.net/calibre/+bug/1817828) --- recipes/economist.recipe | 12 ++++++------ recipes/economist_free.recipe | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/recipes/economist.recipe b/recipes/economist.recipe index 0d347f5fcf..53cd62d2b0 100644 --- a/recipes/economist.recipe +++ b/recipes/economist.recipe @@ -167,12 +167,12 @@ class Economist(BasicNewsRecipe): # with open('/t/raw.html', 'wb') as f: # f.write(raw) soup = self.index_to_soup(raw) - nav = soup.find(attrs={'class':'navigation__wrapper'}) - if nav is not None: - a = nav.find('a', href=lambda x: x and '/printedition/' in x) - if a is not None: - self.log('Following nav link to current edition', a['href']) - soup = self.index_to_soup(process_url(a['href'])) + # nav = soup.find(attrs={'class':'navigation__wrapper'}) + # if nav is not None: + # a = nav.find('a', href=lambda x: x and '/printedition/' in x) + # if a is not None: + # self.log('Following nav link to current edition', a['href']) + # soup = self.index_to_soup(process_url(a['href'])) ans = self.economist_parse_index(soup) if not ans: raise NoArticles( diff --git a/recipes/economist_free.recipe b/recipes/economist_free.recipe index 0d347f5fcf..53cd62d2b0 100644 --- a/recipes/economist_free.recipe +++ b/recipes/economist_free.recipe @@ -167,12 +167,12 @@ class Economist(BasicNewsRecipe): # with open('/t/raw.html', 'wb') as f: # f.write(raw) soup = self.index_to_soup(raw) - nav = soup.find(attrs={'class':'navigation__wrapper'}) - if nav is not None: - a = nav.find('a', href=lambda x: x and '/printedition/' in x) - if a is not None: - self.log('Following nav link to current edition', a['href']) - soup = self.index_to_soup(process_url(a['href'])) + # nav = soup.find(attrs={'class':'navigation__wrapper'}) + # if nav is not None: + # a = nav.find('a', href=lambda x: x and '/printedition/' in x) + # if a is not None: + # self.log('Following nav link to current edition', a['href']) + # soup = self.index_to_soup(process_url(a['href'])) ans = self.economist_parse_index(soup) if not ans: raise NoArticles( From b38a476b5eab8322a77bebbd98587b34400d4960 Mon Sep 17 00:00:00 2001 From: Charles Haley <cbhaley@i.wont.say.com> Date: Thu, 28 Feb 2019 14:26:24 +0000 Subject: [PATCH 0255/2613] Correct fix for bug #1812560: 'iso' format not working. The pattern HH doesn't appear to work in the current Qt, and one place where 'iso' needed to be matched was missed. --- src/calibre/gui2/custom_column_widgets.py | 6 +++--- src/calibre/gui2/dialogs/metadata_bulk.py | 6 +++--- src/calibre/gui2/library/delegates.py | 11 +++++++---- src/calibre/gui2/metadata/basic_widgets.py | 4 ++-- src/calibre/utils/date.py | 2 ++ 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/calibre/gui2/custom_column_widgets.py b/src/calibre/gui2/custom_column_widgets.py index b955c7ee4a..e6bbdbb666 100644 --- a/src/calibre/gui2/custom_column_widgets.py +++ b/src/calibre/gui2/custom_column_widgets.py @@ -13,7 +13,7 @@ from PyQt5.Qt import (QComboBox, QLabel, QSpinBox, QDoubleSpinBox, QDateTimeEdit QSpacerItem, QIcon, QCheckBox, QWidget, QHBoxLayout, QLineEdit, QPushButton, QMessageBox, QToolButton, Qt, QPlainTextEdit) -from calibre.utils.date import qt_to_dt, now, as_local_time, as_utc +from calibre.utils.date import qt_to_dt, now, as_local_time, as_utc, internal_iso_format_string from calibre.gui2.complete2 import EditWithComplete from calibre.gui2.comments_editor import Editor as CommentsEditor from calibre.gui2 import UNDEFINED_QDATETIME, error_dialog @@ -309,7 +309,7 @@ class DateTime(Base): if not format_: format_ = 'dd MMM yyyy hh:mm' elif format_ == 'iso': - format_ = 'yyyy-MM-ddTHH:mm:ss' + format_ = internal_iso_format_string() w.setDisplayFormat(format_) w.setCalendarPopup(True) w.setMinimumDateTime(UNDEFINED_QDATETIME) @@ -1030,7 +1030,7 @@ class BulkDateTime(BulkBase): if not format_: format_ = 'dd MMM yyyy' elif format_ == 'iso': - format_ = 'yyyy-MM-ddTHH:mm:ss' + format_ = internal_iso_format_string() w.setDisplayFormat(format_) w.setCalendarPopup(True) w.setMinimumDateTime(UNDEFINED_QDATETIME) diff --git a/src/calibre/gui2/dialogs/metadata_bulk.py b/src/calibre/gui2/dialogs/metadata_bulk.py index 581f34be75..76f0d3cf68 100644 --- a/src/calibre/gui2/dialogs/metadata_bulk.py +++ b/src/calibre/gui2/dialogs/metadata_bulk.py @@ -28,7 +28,7 @@ from calibre.gui2.dialogs.tag_editor import TagEditor from calibre.gui2.dialogs.template_line_editor import TemplateLineEditor from calibre.gui2.metadata.basic_widgets import CalendarWidget from calibre.utils.config import JSONConfig, dynamic, prefs, tweaks -from calibre.utils.date import qt_to_dt +from calibre.utils.date import qt_to_dt, internal_iso_format_string from calibre.utils.icu import capitalize, sort_key from calibre.utils.titlecase import titlecase from calibre.gui2.widgets import LineEditECM @@ -504,7 +504,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): self.pubdate.setCalendarWidget(self.pubdate_cw) pubdate_format = tweaks['gui_pubdate_display_format'] if pubdate_format == 'iso': - pubdate_format = 'yyyy-MM-ddTHH:mm:ss' + pubdate_format = internal_iso_format_string() if pubdate_format is not None: self.pubdate.setDisplayFormat(pubdate_format) self.pubdate.setSpecialValueText(_('Undefined')) @@ -516,7 +516,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): self.adddate.setCalendarWidget(self.adddate_cw) adddate_format = tweaks['gui_timestamp_display_format'] if adddate_format == 'iso': - adddate_format = 'yyyy-MM-ddTHH:mm:ss' + adddate_format = internal_iso_format_string() if adddate_format is not None: self.adddate.setDisplayFormat(adddate_format) self.adddate.setSpecialValueText(_('Undefined')) diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index 46eaf29add..91d774b04b 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -18,7 +18,8 @@ from calibre.constants import iswindows from calibre.gui2.widgets import EnLineEdit from calibre.gui2.widgets2 import populate_standard_spinbox_context_menu, RatingEditor from calibre.gui2.complete2 import EditWithComplete -from calibre.utils.date import now, format_date, qt_to_dt, is_date_undefined +from calibre.utils.date import now, format_date, qt_to_dt, is_date_undefined, internal_iso_format_string + from calibre.utils.config import tweaks from calibre.utils.icu import sort_key from calibre.gui2.dialogs.comments_dialog import CommentsDialog, PlainTextDialog @@ -118,7 +119,7 @@ class DateTimeEdit(QDateTimeEdit): # {{{ self.setSpecialValueText(_('Undefined')) self.setCalendarPopup(True) if format_ == 'iso': - format_ = 'yyyy-MM-ddTHH:mm:ss' + format_ = internal_iso_format_string() self.setDisplayFormat(format_) def contextMenuEvent(self, ev): @@ -431,9 +432,11 @@ class CcDateDelegate(QStyledItemDelegate, UpdateEditorGeometry): # {{{ QStyledItemDelegate.__init__(self, parent) self.table_widget = parent - def set_format(self, format): - if not format: + def set_format(self, _format): + if not _format: self.format = 'dd MMM yyyy' + elif _format == 'iso': + self.format = internal_iso_format_string() else: self.format = format diff --git a/src/calibre/gui2/metadata/basic_widgets.py b/src/calibre/gui2/metadata/basic_widgets.py index 80720c1468..2b41ac384e 100644 --- a/src/calibre/gui2/metadata/basic_widgets.py +++ b/src/calibre/gui2/metadata/basic_widgets.py @@ -29,7 +29,7 @@ from calibre.gui2 import (file_icon_provider, UNDEFINED_QDATETIME, from calibre.gui2.complete2 import EditWithComplete from calibre.utils.date import ( local_tz, qt_to_dt, as_local_time, UNDEFINED_DATE, is_date_undefined, - utcfromtimestamp, parse_only_date) + utcfromtimestamp, parse_only_date, internal_iso_format_string) from calibre import strftime from calibre.ebooks import BOOK_EXTENSIONS from calibre.customize.ui import run_plugins_on_import @@ -1839,7 +1839,7 @@ class DateEdit(make_undoable(QDateTimeEdit), ToMetadataMixin): if fmt is None: fmt = self.FMT elif fmt == 'iso': - fmt = 'yyyy-MM-ddTHH:mm:ss' + fmt = internal_iso_format_string() self.setDisplayFormat(fmt) self.setCalendarPopup(True) self.cw = CalendarWidget(self) diff --git a/src/calibre/utils/date.py b/src/calibre/utils/date.py index 3af089f0ef..f3814042d5 100644 --- a/src/calibre/utils/date.py +++ b/src/calibre/utils/date.py @@ -194,6 +194,8 @@ def isoformat(date_time, assume_utc=False, as_utc=True, sep='T'): # str(sep) because isoformat barfs with unicode sep on python 2.x return unicode(date_time.isoformat(str(sep))) +def internal_iso_format_string(): + return 'yyyy-MM-ddThh:mm:ss' def w3cdtf(date_time, assume_utc=False): if hasattr(date_time, 'tzinfo'): From a2b16ded4155e9dd83e43aae3ae50885f7108053 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Fri, 1 Mar 2019 06:55:40 +0530 Subject: [PATCH 0256/2613] Use pipe2 if available --- src/calibre/gui2/__init__.py | 59 +++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 5eda4391a3..16be05ece7 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -1,27 +1,40 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>' """ The GUI """ -import os, sys, Queue, threading, glob, signal +import glob +import os +import Queue +import signal +import sys +import threading from contextlib import contextmanager -from threading import RLock, Lock -from PyQt5.QtWidgets import QStyle # Gives a nicer error message than import from Qt -from PyQt5.Qt import ( - QFileInfo, QObject, QBuffer, Qt, QByteArray, QTranslator, QSocketNotifier, - QCoreApplication, QThread, QEvent, QTimer, pyqtSignal, QDateTime, QFontMetrics, - QDesktopServices, QFileDialog, QFileIconProvider, QSettings, QIcon, QStringListModel, - QApplication, QDialog, QUrl, QFont, QFontDatabase, QLocale, QFontInfo, QT_VERSION) +from threading import Lock, RLock -from calibre import prints, as_unicode -from calibre.constants import (islinux, iswindows, isbsd, isfrozen, isosx, is_running_from_develop, - plugins, config_dir, filesystem_encoding, isxp, DEBUG, __version__, __appname__ as APP_UID) -from calibre.ptempfile import base_dir -from calibre.gui2.linux_file_dialogs import check_for_linux_native_dialogs, linux_native_dialog -from calibre.gui2.qt_file_dialogs import FileDialog -from calibre.utils.config import Config, ConfigProxy, dynamic, JSONConfig +from PyQt5.Qt import ( + QT_VERSION, QApplication, QBuffer, QByteArray, QCoreApplication, QDateTime, + QDesktopServices, QDialog, QEvent, QFileDialog, QFileIconProvider, QFileInfo, + QFont, QFontDatabase, QFontInfo, QFontMetrics, QIcon, QLocale, QObject, + QSettings, QSocketNotifier, QStringListModel, Qt, QThread, QTimer, QTranslator, + QUrl, pyqtSignal +) +from PyQt5.QtWidgets import QStyle # Gives a nicer error message than import from Qt + +from calibre import as_unicode, prints +from calibre.constants import ( + DEBUG, __appname__ as APP_UID, __version__, config_dir, filesystem_encoding, + is_running_from_develop, isbsd, isfrozen, islinux, isosx, iswindows, isxp, + plugins +) from calibre.ebooks.metadata import MetaInformation +from calibre.gui2.linux_file_dialogs import ( + check_for_linux_native_dialogs, linux_native_dialog +) +from calibre.gui2.qt_file_dialogs import FileDialog +from calibre.ptempfile import base_dir +from calibre.utils.config import Config, ConfigProxy, JSONConfig, dynamic from calibre.utils.date import UNDEFINED_DATE -from calibre.utils.localization import get_lang from calibre.utils.file_type_icons import EXT_MAP +from calibre.utils.localization import get_lang try: NO_URL_FORMATTING = QUrl.None_ @@ -1036,11 +1049,15 @@ class Application(QApplication): def setup_unix_signals(self): import fcntl - read_fd, write_fd = os.pipe() - cloexec_flag = getattr(fcntl, 'FD_CLOEXEC', 1) - for fd in (read_fd, write_fd): - flags = fcntl.fcntl(fd, fcntl.F_GETFD) - fcntl.fcntl(fd, fcntl.F_SETFD, flags | cloexec_flag | os.O_NONBLOCK) + if hasattr(os, 'pipe2'): + read_fd, write_fd = os.pipe2(os.O_CLOEXEC | os.O_NONBLOCK) + else: + read_fd, write_fd = os.pipe() + cloexec_flag = getattr(fcntl, 'FD_CLOEXEC', 1) + for fd in (read_fd, write_fd): + flags = fcntl.fcntl(fd, fcntl.F_GETFD) + fcntl.fcntl(fd, fcntl.F_SETFD, flags | cloexec_flag | os.O_NONBLOCK) + for sig in (signal.SIGINT, signal.SIGTERM): signal.signal(sig, lambda x, y: None) signal.siginterrupt(sig, False) From 09d40007b23321605f5457e738bbd79416c3df55 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Fri, 1 Mar 2019 09:05:29 +0530 Subject: [PATCH 0257/2613] Update Scientific American --- recipes/scientific_american.recipe | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes/scientific_american.recipe b/recipes/scientific_american.recipe index 544f24ea3c..7a92dd0d5a 100644 --- a/recipes/scientific_american.recipe +++ b/recipes/scientific_american.recipe @@ -55,8 +55,9 @@ class ScientificAmerican(BasicNewsRecipe): root = self.index_to_soup( 'http://www.scientificamerican.com/sciammag/', as_tree=True) select = Select(root) - url = [x.get('content', '') for x in select('html > head meta') if x.get('property',None) == "og:url"][0] - self.cover_url = [x.get('src', '') for x in select('main .product-detail__image picture img')][0] + url = [x.get('href', '') for x in select('main .store-listing__img a')][0] + url = absurl(url) + self.cover_url = [x.get('src', '') for x in select('main .store-listing__img img')][0] # Now parse the actual issue to get the list of articles select = Select(self.index_to_soup(url, as_tree=True)) From bf40fb88f772ababa414827d0e2101fe6012f2fd Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Fri, 1 Mar 2019 21:05:49 +0530 Subject: [PATCH 0258/2613] Quanta Magazine by lui1 --- recipes/quanta_magazine.recipe | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 recipes/quanta_magazine.recipe diff --git a/recipes/quanta_magazine.recipe b/recipes/quanta_magazine.recipe new file mode 100644 index 0000000000..a7405e3c30 --- /dev/null +++ b/recipes/quanta_magazine.recipe @@ -0,0 +1,17 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +from __future__ import unicode_literals, division, absolute_import, print_function +from calibre.web.feeds.news import BasicNewsRecipe + + +class Quanta(BasicNewsRecipe): + title = 'Quanta Magazine' + oldest_article = 7 + max_articles_per_feed = 100 + language = 'en' + __author__ = 'lui1' + encoding = 'UTF-8' + + feeds = [ + ('Articles', 'https://api.quantamagazine.org/feed/'), + ] From 1f3c8a6ee4584eac9681b73749c28597c2af1ca4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Mon, 4 Mar 2019 07:20:07 +0530 Subject: [PATCH 0259/2613] Linux: Use setDesktopFileName when compiled against new enough Qt Apparently Plasma with Wayland backend needs it. Fixes #1818436 [Calibre icon is incorrect on KDE Plasma Wayland session](https://bugs.launchpad.net/calibre/+bug/1818436) --- src/calibre/gui2/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 16be05ece7..feb75a9770 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -830,6 +830,8 @@ class Application(QApplication): QApplication.setOrganizationDomain(QApplication.organizationName()) QApplication.setApplicationVersion(__version__) QApplication.setApplicationName(APP_UID) + if override_program_name and hasattr(QApplication, 'setDesktopFileName'): + QApplication.setDesktopFileName(override_program_name) QApplication.__init__(self, qargs) self.setAttribute(Qt.AA_UseHighDpiPixmaps) self.setAttribute(Qt.AA_SynthesizeTouchForUnhandledMouseEvents, False) From 20ba5d597f169ab5b1d3d57b5affbb5c7f516e21 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Tue, 5 Mar 2019 09:58:44 +0530 Subject: [PATCH 0260/2613] Fix #1816391 [black-curtain-redirect not work](https://bugs.launchpad.net/calibre/+bug/1816391) --- src/calibre/ebooks/metadata/sources/amazon.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/metadata/sources/amazon.py b/src/calibre/ebooks/metadata/sources/amazon.py index a8341ccc38..f1f3444827 100644 --- a/src/calibre/ebooks/metadata/sources/amazon.py +++ b/src/calibre/ebooks/metadata/sources/amazon.py @@ -83,9 +83,12 @@ def parse_details_page(url, log, timeout, browser, domain): if domain == 'jp': for a in root.xpath('//a[@href]'): if 'black-curtain-redirect.html' in a.get('href'): - url = 'https://amazon.co.jp' + a.get('href') - log('Black curtain redirect found, following') - return parse_details_page(url, log, timeout, browser, domain) + url = a.get('href') + if url: + if url.startswith('/'): + url = 'https://amazon.co.jp' + a.get('href') + log('Black curtain redirect found, following') + return parse_details_page(url, log, timeout, browser, domain) errmsg = root.xpath('//*[@id="errorMessage"]') if errmsg: @@ -839,7 +842,7 @@ class Worker(Thread): # Get details {{{ class Amazon(Source): name = 'Amazon.com' - version = (1, 2, 4) + version = (1, 2, 5) minimum_calibre_version = (2, 82, 0) description = _('Downloads metadata and covers from Amazon') From 30e25ecf21f23489fba72fb64a3a751a1918d8de Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Tue, 5 Mar 2019 10:07:48 +0530 Subject: [PATCH 0261/2613] Edit book: Fix pasting of image from clipboard using (Ctrl-V) not working --- src/calibre/gui2/tweak_book/editor/text.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tweak_book/editor/text.py b/src/calibre/gui2/tweak_book/editor/text.py index e4b6deb9bd..fa44587907 100644 --- a/src/calibre/gui2/tweak_book/editor/text.py +++ b/src/calibre/gui2/tweak_book/editor/text.py @@ -191,9 +191,9 @@ class TextEdit(PlainTextEdit): return if md.hasImage(): img = md.imageData() - if img is not None and img.isValid(): + if img is not None and not img.isNull(): data = image_to_data(img, fmt='PNG') - name = add_file(get_name('dropped_image.png', data)) + name = add_file(get_name('dropped_image.png'), data) self.insert_image(get_href(name)) self.ensureCursorVisible() return From 24a9ebd3af317d427a5c8b688039e858ef09f5b5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Wed, 6 Mar 2019 20:36:19 +0530 Subject: [PATCH 0262/2613] Content server: Allow specifying custom URLs for the "Search the internet" feature via Preferences->Sharing over the net->Search the internet. Fixes #1810923 [[Enhancement]: Search the internet on Content Server](https://bugs.launchpad.net/calibre/+bug/1810923) --- src/calibre/gui2/preferences/server.py | 218 +++++++++++++++++++++++-- src/calibre/srv/code.py | 1 + src/calibre/srv/embedded.py | 14 +- src/calibre/srv/standalone.py | 13 +- src/pyj/book_list/book_details.pyj | 35 ++-- src/pyj/session.pyj | 1 + 6 files changed, 257 insertions(+), 25 deletions(-) diff --git a/src/calibre/gui2/preferences/server.py b/src/calibre/gui2/preferences/server.py index 7dcfa07960..338a2b0d4d 100644 --- a/src/calibre/gui2/preferences/server.py +++ b/src/calibre/gui2/preferences/server.py @@ -24,7 +24,7 @@ from calibre.gui2 import ( ) from calibre.gui2.preferences import AbortCommit, ConfigWidgetBase, test_widget from calibre.srv.code import custom_list_template as default_custom_list_template -from calibre.srv.embedded import custom_list_template +from calibre.srv.embedded import custom_list_template, search_the_net_urls from calibre.srv.library_broker import load_gui_libraries from calibre.srv.opts import change_settings, options, server_config from calibre.srv.users import ( @@ -364,7 +364,9 @@ class MainTab(QWidget): # {{{ self.ip_info = QLabel(self) self.update_ip_info() from calibre.gui2.ui import get_gui - get_gui().iactions['Connect Share'].share_conn_menu.server_state_changed_signal.connect(self.update_ip_info) + gui = get_gui() + if gui is not None: + gui.iactions['Connect Share'].share_conn_menu.server_state_changed_signal.connect(self.update_ip_info) l.addSpacing(10) l.addWidget(self.ip_info) if set_run_at_startup is not None: @@ -394,9 +396,11 @@ class MainTab(QWidget): # {{{ def update_ip_info(self): from calibre.gui2.ui import get_gui - t = get_gui().iactions['Connect Share'].share_conn_menu.ip_text - t = t.strip().strip('[]') - self.ip_info.setText(_('Content server listening at: %s') % t) + gui = get_gui() + if gui is not None: + t = get_gui().iactions['Connect Share'].share_conn_menu.ip_text + t = t.strip().strip('[]') + self.ip_info.setText(_('Content server listening at: %s') % t) def genesis(self): opts = server_config() @@ -428,12 +432,13 @@ class MainTab(QWidget): # {{{ def update_button_state(self): from calibre.gui2.ui import get_gui gui = get_gui() - is_running = gui.content_server is not None and gui.content_server.is_running - self.ip_info.setVisible(is_running) - self.update_ip_info() - self.start_server_button.setEnabled(not is_running) - self.stop_server_button.setEnabled(is_running) - self.test_server_button.setEnabled(is_running) + if gui is not None: + is_running = gui.content_server is not None and gui.content_server.is_running + self.ip_info.setVisible(is_running) + self.update_ip_info() + self.start_server_button.setEnabled(not is_running) + self.stop_server_button.setEnabled(is_running) + self.test_server_button.setEnabled(is_running) @property def settings(self): @@ -1019,6 +1024,191 @@ class CustomList(QWidget): # {{{ # }}} +# Search the internet {{{ + +class URLItem(QWidget): + + changed_signal = pyqtSignal() + + def __init__(self, as_dict, parent=None): + QWidget.__init__(self, parent) + self.changed_signal.connect(parent.changed_signal) + self.l = l = QFormLayout(self) + self.type_widget = t = QComboBox(self) + l.setFieldGrowthPolicy(l.ExpandingFieldsGrow) + t.addItems([_('Book'), _('Author')]) + l.addRow(_('URL type:'), t) + self.name_widget = n = QLineEdit(self) + n.setClearButtonEnabled(True) + l.addRow(_('Name:'), n) + self.url_widget = w = QLineEdit(self) + w.setClearButtonEnabled(True) + l.addRow(_('URL:'), w) + if as_dict: + self.name = as_dict['name'] + self.url = as_dict['url'] + self.url_type = as_dict['type'] + self.type_widget.currentIndexChanged.connect(self.changed_signal) + self.name_widget.textChanged.connect(self.changed_signal) + self.url_widget.textChanged.connect(self.changed_signal) + + @property + def is_empty(self): + return not self.name or not self.url + + @property + def url_type(self): + return 'book' if self.type_widget.currentIndex() == 0 else 'author' + + @url_type.setter + def url_type(self, val): + self.type_widget.setCurrentIndex(1 if val == 'author' else 0) + + @property + def name(self): + return self.name_widget.text().strip() + + @name.setter + def name(self, val): + self.name_widget.setText((val or '').strip()) + + @property + def url(self): + return self.url_widget.text().strip() + + @url.setter + def url(self, val): + self.url_widget.setText((val or '').strip()) + + @property + def as_dict(self): + return {'name': self.name, 'url': self.url, 'type': self.url_type} + + def validate(self): + if self.is_empty: + return True + if '{author}' not in self.url: + error_dialog(self.parent(), _('Missing author placeholder'), _( + 'The URL {0} does not contain the {1} placeholder').format(self.url, '{author}'), show=True) + return False + if self.url_type == 'book' and '{title}' not in self.url: + error_dialog(self.parent(), _('Missing title placeholder'), _( + 'The URL {0} does not contain the {1} placeholder').format(self.url, '{title}'), show=True) + return False + return True + + +class SearchTheInternet(QWidget): + + changed_signal = pyqtSignal() + + def __init__(self, parent): + QWidget.__init__(self, parent) + self.sa = QScrollArea(self) + self.lw = QWidget(self) + self.l = QVBoxLayout(self.lw) + self.sa.setWidget(self.lw), self.sa.setWidgetResizable(True) + self.gl = gl = QVBoxLayout(self) + self.la = QLabel(_( + 'Add new locations to search for books or authors using the "Search the internet" feature' + ' of the Content server. The URLs should contain {author} which will be' + ' replaced by the author name and, for book URLs, {title} which will' + ' be replaced by the book title.')) + self.la.setWordWrap(True) + gl.addWidget(self.la) + + self.h = QHBoxLayout() + gl.addLayout(self.h) + self.add_url_button = b = QPushButton(QIcon(I('plus.png')), _('&Add URL')) + b.clicked.connect(self.add_url) + self.h.addWidget(b) + self.export_button = b = QPushButton(_('Export URLs')) + b.clicked.connect(self.export_urls) + self.h.addWidget(b) + self.import_button = b = QPushButton(_('Import URLs')) + b.clicked.connect(self.import_urls) + self.h.addWidget(b) + self.clear_button = b = QPushButton(_('Clear')) + b.clicked.connect(self.clear) + self.h.addWidget(b) + + self.h.addStretch(10) + gl.addWidget(self.sa, stretch=10) + self.items = [] + + def genesis(self): + self.current_urls = search_the_net_urls() or [] + + @property + def current_urls(self): + return [item.as_dict for item in self.items if not item.is_empty] + + def append_item(self, item_as_dict): + self.items.append(URLItem(item_as_dict, self)) + self.l.addWidget(self.items[-1]) + + def clear(self): + [(self.l.removeWidget(w), w.setParent(None), w.deleteLater()) for w in self.items] + self.items = [] + self.changed_signal.emit() + + @current_urls.setter + def current_urls(self, val): + self.clear() + for entry in val: + self.append_item(entry) + + def add_url(self): + self.items.append(URLItem(None, self)) + self.l.addWidget(self.items[-1]) + QTimer.singleShot(100, self.scroll_to_bottom) + + def scroll_to_bottom(self): + sb = self.sa.verticalScrollBar() + if sb: + sb.setValue(sb.maximum()) + self.items[-1].name_widget.setFocus(Qt.OtherFocusReason) + + @property + def serialized_urls(self): + return json.dumps(self.current_urls, indent=2) + + def commit(self): + for item in self.items: + if not item.validate(): + return False + cu = self.current_urls + if cu: + with lopen(search_the_net_urls.path, 'wb') as f: + f.write(self.serialized_urls) + else: + try: + os.remove(search_the_net_urls.path) + except EnvironmentError as err: + if err.errno != errno.ENOENT: + raise + return True + + def export_urls(self): + path = choose_save_file( + self, 'search-net-urls', _('Choose URLs file'), + filters=[(_('URL files'), ['json'])], initial_filename='search-urls.json') + if path: + with lopen(path, 'wb') as f: + f.write(self.serialized_urls) + + def import_urls(self): + paths = choose_files(self, 'search-net-urls', _('Choose URLs file'), + filters=[(_('URL files'), ['json'])], all_files=False, select_only_single_file=True) + if paths: + with lopen(paths[0], 'rb') as f: + items = json.loads(f.read()) + [self.append_item(x) for x in items] + self.changed_signal.emit() + +# }}} + + class ConfigWidget(ConfigWidgetBase): def __init__(self, *args, **kw): @@ -1044,6 +1234,9 @@ class ConfigWidget(ConfigWidgetBase): sa = QScrollArea(self) sa.setWidget(clt), sa.setWidgetResizable(True) t.addTab(sa, _('Book &list template')) + self.search_net_tab = SearchTheInternet(self) + t.addTab(self.search_net_tab, _('&Search the internet')) + for tab in self.tabs: if hasattr(tab, 'changed_signal'): tab.changed_signal.connect(self.changed_signal.emit) @@ -1201,6 +1394,8 @@ class ConfigWidget(ConfigWidgetBase): return False if not self.custom_list_tab.commit(): return False + if not self.search_net_tab.commit(): + return False ConfigWidgetBase.commit(self) change_settings(**settings) UserManager().user_data = users @@ -1222,6 +1417,7 @@ class ConfigWidget(ConfigWidgetBase): if self.server: self.server.user_manager.refresh() self.server.ctx.custom_list_template = custom_list_template() + self.server.ctx.search_the_net_urls = search_the_net_urls() if __name__ == '__main__': diff --git a/src/calibre/srv/code.py b/src/calibre/srv/code.py index 7c10db898a..d7cfe47219 100644 --- a/src/calibre/srv/code.py +++ b/src/calibre/srv/code.py @@ -148,6 +148,7 @@ def basic_interface_data(ctx, rd): 'icon_map': icon_map(), 'icon_path': ctx.url_for('/icon', which=''), 'custom_list_template': getattr(ctx, 'custom_list_template', None) or custom_list_template(), + 'search_the_net_urls': getattr(ctx, 'search_the_net_urls', None) or [], 'num_per_page': rd.opts.num_per_page, } ans['library_map'], ans['default_library_id'] = ctx.library_info(rd) diff --git a/src/calibre/srv/embedded.py b/src/calibre/srv/embedded.py index 2c75b9008c..b76e07ce5e 100644 --- a/src/calibre/srv/embedded.py +++ b/src/calibre/srv/embedded.py @@ -24,9 +24,9 @@ def log_paths(): ) -def custom_list_template(): +def read_json(path): try: - with lopen(custom_list_template.path, 'rb') as f: + with lopen(path, 'rb') as f: raw = f.read() except EnvironmentError as err: if err.errno != errno.ENOENT: @@ -35,7 +35,16 @@ def custom_list_template(): return json.loads(raw) +def custom_list_template(): + return read_json(custom_list_template.path) + + +def search_the_net_urls(): + return read_json(search_the_net_urls.path) + + custom_list_template.path = os.path.join(config_dir, 'server-custom-list-template.json') +search_the_net_urls.path = os.path.join(config_dir, 'server-search-the-net.json') class Server(object): @@ -62,6 +71,7 @@ class Server(object): self.log, self.access_log = log, access_log self.handler.set_log(self.log) self.handler.router.ctx.custom_list_template = custom_list_template() + self.handler.router.ctx.search_the_net_urls = search_the_net_urls() @property def ctx(self): diff --git a/src/calibre/srv/standalone.py b/src/calibre/srv/standalone.py index 87b67fca5f..9f585510cc 100644 --- a/src/calibre/srv/standalone.py +++ b/src/calibre/srv/standalone.py @@ -67,8 +67,11 @@ class Server(object): access_log = RotatingLog(opts.access_log, max_size=log_size) self.handler = Handler(libraries, opts) if opts.custom_list_template: - with lopen(opts.custom_list_template, 'rb') as f: + with lopen(os.path.expanduser(opts.custom_list_template), 'rb') as f: self.handler.router.ctx.custom_list_template = json.load(f) + if opts.search_the_net_urls: + with lopen(os.path.expanduser(opts.search_the_net_urls), 'rb') as f: + self.handler.router.ctx.search_the_net_urls = json.load(f) plugins = [] if opts.use_bonjour: plugins.append(BonJour()) @@ -117,6 +120,14 @@ libraries that the main calibre program knows about will be used. ' Sharing over the net-> Book list template in calibre, create the' ' template and export it.' )) + parser.add_option( + '--search-the-net-urls', help=_( + 'Path to a JSON file containing URLs for the "Search the internet" feature.' + ' The easiest way to create such a file is to go to Preferences->' + ' Sharing over the net->Search the internet in calibre, create the' + ' URLs and export them.' + )) + if not iswindows and not isosx: # Does not work on macOS because if we fork() we cannot connect to Core # Serives which is needed by the QApplication() constructor, which in diff --git a/src/pyj/book_list/book_details.pyj b/src/pyj/book_list/book_details.pyj index 72348a8c9f..ec63f7e455 100644 --- a/src/pyj/book_list/book_details.pyj +++ b/src/pyj/book_list/book_details.pyj @@ -665,25 +665,38 @@ def search_internet(container_id): create_top_bar(container, title=_('Search the internet'), action=back, icon='close') mi = book_metadata(render_book.book_id) data = {'title':mi.title, 'author':mi.authors[0] if mi.authors else _('Unknown')} + interface_data = get_interface_data() def link_for(name, template): return E.a(name, class_='simple-link', href=url_for(template, data), target="_blank") + author_links = E.ul() + book_links = E.ul() + + if interface_data.search_the_net_urls: + for entry in interface_data.search_the_net_urls: + links = book_links if entry.type is 'book' else author_links + links.appendChild(E.li(link_for(entry.name, entry.url))) + for name, url in [ + (_('Goodreads'), 'https://www.goodreads.com/book/author/{author}'), + (_('Wikipedia'), 'https://en.wikipedia.org/w/index.php?search={author}'), + (_('Google books'), 'https://www.google.com/search?tbm=bks&q=inauthor:%22{author}%22'), + ]: + author_links.appendChild(E.li(link_for(name, url))) + + for name, url in [ + (_('Goodreads'), 'https://www.goodreads.com/search?q={author}+{title}&search%5Bsource%5D=goodreads&search_type=books&tab=books'), + (_('Google books'), 'https://www.google.com/search?tbm=bks&q=inauthor:%22{author}%22+intitle:%22{title}%22'), + (_('Amazon'), 'https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Dstripbooks&field-keywords={author}+{title}'), + ]: + book_links.appendChild(E.li(link_for(name, url))) + container.appendChild(E.div(class_=SEARCH_INTERNET_CLASS, safe_set_inner_html(E.h2(), _('Search for the author <i>{}</i> at:').format(data.author)), - E.ul( - E.li(link_for(_('Goodreads'), 'https://www.goodreads.com/book/author/{author}')), - E.li(link_for(_('Wikipedia'), 'https://en.wikipedia.org/w/index.php?search={author}')), - E.li(link_for(_('Google books'), 'https://www.google.com/search?tbm=bks&q=inauthor:%22{author}%22')), - ), + author_links, E.hr(), safe_set_inner_html(E.h2(), _('Search for the book <i>{}</i> at:').format(data.title)), - E.ul( - E.li(link_for(_('Goodreads'), 'https://www.goodreads.com/search?q={author}+{title}&search%5Bsource%5D=goodreads&search_type=books&tab=books')), - E.li(link_for(_('Google books'), 'https://www.google.com/search?tbm=bks&q=inauthor:%22{author}%22+intitle:%22{title}%22')), - E.li(link_for(_('Amazon'), 'https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Dstripbooks&field-keywords={author}+{title}')), - ), - + book_links, )) diff --git a/src/pyj/session.pyj b/src/pyj/session.pyj index 5870d87cae..cc8c8cbd68 100644 --- a/src/pyj/session.pyj +++ b/src/pyj/session.pyj @@ -169,6 +169,7 @@ default_interface_data = { 'use_roman_numerals_for_series_number': True, 'default_library_id': None, 'library_map': None, + 'search_the_net_urls': [], 'icon_map': {}, 'icon_path': '', 'custom_list_template': None, From a4e79a2a59b61b2e544878d2570afd38d2da0959 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Wed, 6 Mar 2019 20:53:44 +0530 Subject: [PATCH 0263/2613] EPUB/MOBI Catalogs: Fix presets not saving title and format information. Fixes #1818838 [Catalog Json file don't store Title and Format](https://bugs.launchpad.net/calibre/+bug/1818838) --- src/calibre/gui2/catalog/catalog_epub_mobi.py | 37 +++++++------------ src/calibre/gui2/dialogs/catalog.py | 3 +- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/src/calibre/gui2/catalog/catalog_epub_mobi.py b/src/calibre/gui2/catalog/catalog_epub_mobi.py index d067647ab7..d2b80a416f 100644 --- a/src/calibre/gui2/catalog/catalog_epub_mobi.py +++ b/src/calibre/gui2/catalog/catalog_epub_mobi.py @@ -45,6 +45,7 @@ class PluginWidget(QWidget,Ui_Form): self.setupUi(self) self._initControlArrays() self.blocking_all_signals = None + self.parent_ref = lambda: None def _initControlArrays(self): # Default values for controls @@ -283,17 +284,10 @@ class PluginWidget(QWidget,Ui_Form): def get_format_and_title(self): current_format = None current_title = None - self.parentWidget().blockSignals(True) - for peer in self.parentWidget().children(): - if peer == self: - continue - elif peer.children(): - for child in peer.children(): - if child.objectName() == 'format': - current_format = child.currentText().strip() - elif child.objectName() == 'title': - current_title = unicode(child.text()).strip() - self.parentWidget().blockSignals(False) + parent = self.parent_ref() + if parent is not None: + current_title = parent.title.text().strip() + current_format = parent.format.currentText().strip() return current_format, current_title def header_note_source_field_changed(self,new_index): @@ -795,18 +789,15 @@ class PluginWidget(QWidget,Ui_Form): self.preset_field.setCurrentIndex(self.preset_field.findText(name)) def set_format_and_title(self, format, title): - for peer in self.parentWidget().children(): - if peer == self: - continue - elif peer.children(): - for child in peer.children(): - if child.objectName() == 'format': - index = child.findText(format) - child.blockSignals(True) - child.setCurrentIndex(index) - child.blockSignals(False) - elif child.objectName() == 'title': - child.setText(title) + parent = self.parent_ref() + if parent is not None: + if format: + index = parent.format.findText(format) + parent.format.blockSignals(True) + parent.format.setCurrentIndex(index) + parent.format.blockSignals(False) + if title: + parent.title.setText(title) def settings_changed(self, source): ''' diff --git a/src/calibre/gui2/dialogs/catalog.py b/src/calibre/gui2/dialogs/catalog.py index 99a7d32a28..05b3fce85a 100644 --- a/src/calibre/gui2/dialogs/catalog.py +++ b/src/calibre/gui2/dialogs/catalog.py @@ -6,7 +6,7 @@ __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>' __docformat__ = 'restructuredtext en' -import os, sys, importlib +import os, sys, importlib, weakref from PyQt5.Qt import QDialog, QCoreApplication, QSize, QScrollArea @@ -47,6 +47,7 @@ class Catalog(QDialog, Ui_Dialog): try: catalog_widget = importlib.import_module('calibre.gui2.catalog.'+name) pw = catalog_widget.PluginWidget() + pw.parent_ref = weakref.ref(self) pw.initialize(name, db) pw.ICON = I('forward.png') self.widgets.append(pw) From 6c0be97ad5b4f5d85156ebce2d59a438cba9b525 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Thu, 7 Mar 2019 10:18:35 +0530 Subject: [PATCH 0264/2613] Fix incorrect use of ngettext --- src/calibre/gui2/actions/copy_to_library.py | 6 ++++-- src/calibre/gui2/dialogs/select_formats.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/actions/copy_to_library.py b/src/calibre/gui2/actions/copy_to_library.py index f9a1e269e4..b9ef0d644f 100644 --- a/src/calibre/gui2/actions/copy_to_library.py +++ b/src/calibre/gui2/actions/copy_to_library.py @@ -483,9 +483,11 @@ class CopyToLibraryAction(InterfaceAction): return if delete_after: - donemsg = ngettext('Moved the book to {loc}', 'Moved {num} books to {loc}', len(self.worker.processed)) + donemsg = _('Moved the book to {loc}') if len(self.worker.processed) == 1 else _( + 'Moved {num} books to {loc}') else: - donemsg = ngettext('Copied the book to {loc}', 'Copied {num} books to {loc}', len(self.worker.processed)) + donemsg = _('Copied the book to {loc}') if len(self.worker.processed) == 1 else _( + 'Copied {num} books to {loc}') self.gui.status_bar.show_message(donemsg.format(num=len(self.worker.processed), loc=loc), 2000) if self.worker.auto_merged_ids: diff --git a/src/calibre/gui2/dialogs/select_formats.py b/src/calibre/gui2/dialogs/select_formats.py index 62ace67c3e..eb2d776923 100644 --- a/src/calibre/gui2/dialogs/select_formats.py +++ b/src/calibre/gui2/dialogs/select_formats.py @@ -36,8 +36,8 @@ class Formats(QAbstractListModel): if role == Qt.ToolTipRole: fmt = self.fmts[row] count = self.counts[fmt] - return ngettext('There is one book with the {fmt} format', - 'There are {count} books with the {fmt} format', count).format( + return _('There is one book with the {} format').format(fmt.upper()) if count == 1 else _( + 'There are {count} books with the {fmt} format', count).format( count=count, fmt=fmt.upper()) return None From addf9af51a00819f9e819b6477156564ee70818b Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Thu, 7 Mar 2019 10:22:39 +0530 Subject: [PATCH 0265/2613] Fix generation of trnaslation template for website --- setup/translations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/translations.py b/setup/translations.py index fa3507b699..5549bffd7f 100644 --- a/setup/translations.py +++ b/setup/translations.py @@ -138,7 +138,7 @@ class POT(Command): # {{{ def get_website_strings(self): self.info('Generating translation template for website') self.wn_path = os.path.expanduser('~/work/srv/main/static/generate.py') - data = subprocess.check_output([self.wn_path, '--pot']) + data = subprocess.check_output([self.wn_path, '--pot', '/tmp/wn']) bdir = os.path.join(self.TRANSLATIONS, 'website') if not os.path.exists(bdir): os.makedirs(bdir) From 0adddea81b938eeb068dc9be14cd0cef8a16bec2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Thu, 7 Mar 2019 10:36:39 +0530 Subject: [PATCH 0266/2613] Book details panel: Allow editing the identifiers for the book by right clicking on the existing Ids. Fixes #1815005 [[Enhancement] Allow adding Identifiers on Books Detail Panel](https://bugs.launchpad.net/calibre/+bug/1815005) --- src/calibre/gui2/book_details.py | 13 ++++++++++--- src/calibre/gui2/init.py | 12 ++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index fc828b8f2a..e3943e933c 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -289,9 +289,11 @@ def details_context_menu_event(view, ev, book_info): # {{{ except Exception: field = value = book_id = None if field: - if author is None and ( - field in ('tags', 'series', 'publisher') or is_category(field)): - menu.addAction(init_manage_action(book_info.manage_action, field, value)) + if author is None: + if field in ('tags', 'series', 'publisher') or is_category(field): + menu.addAction(init_manage_action(book_info.manage_action, field, value)) + elif field == 'identifiers': + menu.addAction(book_info.edit_identifiers_action) ac = book_info.remove_item_action ac.data = (field, value, book_id) ac.setText(_('Remove %s from this book') % value) @@ -547,6 +549,7 @@ class BookInfo(QWebView): manage_category = pyqtSignal(object, object) open_fmt_with = pyqtSignal(int, object, object) edit_book = pyqtSignal(int, object) + edit_identifiers = pyqtSignal() def __init__(self, vertical, parent=None): QWebView.__init__(self, parent) @@ -575,6 +578,8 @@ class BookInfo(QWebView): self.manage_action = QAction(self) self.manage_action.current_fmt = self.manage_action.current_url = None self.manage_action.triggered.connect(self.manage_action_triggered) + self.edit_identifiers_action = QAction(QIcon(I('identifiers.png')), _('Edit identifiers for this book'), self) + self.edit_identifiers_action.triggered.connect(self.edit_identifiers) self.remove_item_action = ac = QAction(QIcon(I('minus.png')), '...', self) ac.data = (None, None, None) ac.triggered.connect(self.remove_item_triggered) @@ -768,6 +773,7 @@ class BookDetails(QWidget): # {{{ cover_removed = pyqtSignal(object) view_device_book = pyqtSignal(object) manage_category = pyqtSignal(object, object) + edit_identifiers = pyqtSignal() open_fmt_with = pyqtSignal(int, object, object) edit_book = pyqtSignal(int, object) @@ -846,6 +852,7 @@ class BookDetails(QWidget): # {{{ self.book_info.compare_format.connect(self.compare_specific_format) self.book_info.copy_link.connect(self.copy_link) self.book_info.manage_category.connect(self.manage_category) + self.book_info.edit_identifiers.connect(self.edit_identifiers) self.setCursor(Qt.PointingHandCursor) def search_internet(self, data): diff --git a/src/calibre/gui2/init.py b/src/calibre/gui2/init.py index cc7bf94829..8cae6075de 100644 --- a/src/calibre/gui2/init.py +++ b/src/calibre/gui2/init.py @@ -684,6 +684,7 @@ class LayoutMixin(object): # {{{ self.book_details.view_device_book.connect( self.iactions['View'].view_device_book) self.book_details.manage_category.connect(self.manage_category_triggerred) + self.book_details.edit_identifiers.connect(self.edit_identifiers_triggerred) self.book_details.compare_specific_format.connect(self.compare_format) m = self.library_view.model() @@ -693,6 +694,17 @@ class LayoutMixin(object): # {{{ self.library_view.currentIndex()) self.library_view.setFocus(Qt.OtherFocusReason) + def edit_identifiers_triggerred(self): + book_id = self.library_view.current_book + db = self.current_db.new_api + identifiers = db.field_for('identifiers', book_id, default_value={}) + from calibre.gui2.metadata.basic_widgets import Identifiers + d = Identifiers(identifiers, self) + if d.exec_() == d.Accepted: + identifiers = d.get_identifiers() + db.set_field('identifiers', {book_id: identifiers}) + self.iactions['Edit Metadata'].refresh_books_after_metadata_edit({book_id}) + def manage_category_triggerred(self, field, value): if field and value: if field == 'authors': From 0161d6ce08a6792da8b0cfae806ca12d9a70e65b Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Thu, 7 Mar 2019 10:59:36 +0530 Subject: [PATCH 0267/2613] Some more incorrect uses of ngettext --- src/calibre/gui2/auto_add.py | 2 +- src/calibre/gui2/tools.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/auto_add.py b/src/calibre/gui2/auto_add.py index 124ee60faa..635e6833f7 100644 --- a/src/calibre/gui2/auto_add.py +++ b/src/calibre/gui2/auto_add.py @@ -316,7 +316,7 @@ class AutoAdder(QObject): if count > 0: m.books_added(count) gui.status_bar.show_message( - ngettext('Added a book automatically from {src}', 'Added {num} books automatically from {src}', count).format( + (_('Added a book automatically from {src}') if count == 1 else _('Added {num} books automatically from {src}')).format( num=count, src=self.worker.path), 2000) gui.refresh_cover_browser() diff --git a/src/calibre/gui2/tools.py b/src/calibre/gui2/tools.py index a2844eb162..ee13557ac6 100644 --- a/src/calibre/gui2/tools.py +++ b/src/calibre/gui2/tools.py @@ -118,10 +118,11 @@ def convert_single_ebook(parent, db, book_ids, auto_conversion=False, # {{{ msg = '%s' % '\n'.join(res) warning_dialog(parent, _('Could not convert some books'), - ngettext( - 'Could not convert the book because no supported source format was found', - 'Could not convert {num} of {tot} books, because no supported source formats were found.', - len(res)).format(num=len(res), tot=total), + ( + _('Could not convert the book because no supported source format was found') + if len(res) == 1 else + _('Could not convert {num} of {tot} books, because no supported source formats were found.'), + ).format(num=len(res), tot=total), msg).exec_() return jobs, changed, bad From b523de9813d7744a6c695be80765aca8cc436630 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Thu, 7 Mar 2019 11:26:15 +0530 Subject: [PATCH 0268/2613] Content server: Fix {id} not working in the custom list template Fixes #1818308 [{id} shows as blank in content server template](https://bugs.launchpad.net/calibre/+bug/1818308) --- src/pyj/book_list/custom_list.pyj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pyj/book_list/custom_list.pyj b/src/pyj/book_list/custom_list.pyj index def4c22260..1b44260911 100644 --- a/src/pyj/book_list/custom_list.pyj +++ b/src/pyj/book_list/custom_list.pyj @@ -58,6 +58,8 @@ def default_template(): def render_field(field, mi, book_id): # {{{ + if field is 'id': + return book_id + '' field_metadata = library_data.field_metadata fm = field_metadata[field] if not fm: From 59ec0ad2a7df7063095dbbd9864f36a4be72b8d4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Thu, 7 Mar 2019 14:17:10 +0530 Subject: [PATCH 0269/2613] Allow adding files to selected book records from the clipboard. To use copy a file from windows explorer, right click the Add books button and choose: Add files to selected books from clipboard See #1815419 ([Enhancement] New option for calibre command) --- src/calibre/gui2/actions/add.py | 75 ++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 15 deletions(-) diff --git a/src/calibre/gui2/actions/add.py b/src/calibre/gui2/actions/add.py index 78ac0589f6..94fae7d247 100644 --- a/src/calibre/gui2/actions/add.py +++ b/src/calibre/gui2/actions/add.py @@ -9,9 +9,9 @@ import os from functools import partial from collections import defaultdict -from PyQt5.Qt import QPixmap, QTimer +from PyQt5.Qt import QPixmap, QTimer, QApplication -from calibre import as_unicode +from calibre import as_unicode, guess_type from calibre.gui2 import (error_dialog, choose_files, choose_dir, warning_dialog, info_dialog, gprefs) from calibre.gui2.dialogs.add_empty_book import AddEmptyBookDialog @@ -78,6 +78,8 @@ class AddAction(InterfaceAction): self.add_menu.addSeparator() ma('add-formats', _('Add files to selected book records'), triggered=self.add_formats, shortcut='Shift+A') + ma('add-formats-clipboard', _('Add files to selected book records from clipboard'), + triggered=self.add_formats_from_clipboard, shortcut='Shift+Alt+A') arm = self.add_archive_menu = self.add_menu.addMenu(_('Add an empty file to selected book records')) from calibre.ebooks.oeb.polish.create import valid_empty_formats for fmt in sorted(valid_empty_formats): @@ -100,16 +102,64 @@ class AddAction(InterfaceAction): initial_plugin=('Import/Export', 'Adding'), close_after_initial=True) - def add_formats(self, *args): - if self.gui.stack.currentIndex() != 0: - return + def _check_add_formats_ok(self): + if self.gui.current_view() is not self.gui.library_view: + return [] view = self.gui.library_view rows = view.selectionModel().selectedRows() if not rows: - return error_dialog(self.gui, _('No books selected'), + error_dialog(self.gui, _('No books selected'), _('Cannot add files as no books are selected'), show=True) ids = [view.model().id(r) for r in rows] + return ids + def add_formats_from_clipboard(self): + ids = self._check_add_formats_ok() + if not ids: + return + md = QApplication.instance().clipboard().mimeData() + files_to_add = [] + images = [] + if md.hasUrls(): + for url in md.urls(): + if url.isLocalFile(): + path = url.toLocalFile() + if os.access(path, os.R_OK): + mt = guess_type(path)[0] + if mt.startswith('image/'): + images.append(path) + else: + files_to_add.append(path) + if not files_to_add and not images: + return error_dialog(self.gui, _('No files in clipboard'), + _('No files have been copied to the clipboard'), show=True) + if files_to_add: + self._add_formats(files_to_add, ids) + if images: + if len(ids) > 1 and not question_dialog( + self.gui, + _('Are you sure?'), + _('Are you sure you want to set the same' + ' cover for all %d books?')%len(ids)): + return + with lopen(images[0], 'rb') as f: + cdata = f.read() + self.gui.current_db.new_api.set_cover({book_id: cdata for book_id in ids}) + self.gui.refresh_cover_browser() + m = self.gui.library_view.model() + current = self.gui.library_view.currentIndex() + m.current_changed(current, current) + + def add_formats(self, *args): + ids = self._check_add_formats_ok() + if not ids: + return + books = choose_files(self.gui, 'add formats dialog dir', + _('Select book files'), filters=get_filters()) + if books: + self._add_formats(books, ids) + + def _add_formats(self, paths, ids): if len(ids) > 1 and not question_dialog( self.gui, _('Are you sure?'), @@ -118,17 +168,12 @@ class AddAction(InterfaceAction): ' already exists for a book, it will be replaced.')%len(ids)): return - books = choose_files(self.gui, 'add formats dialog dir', - _('Select book files'), filters=get_filters()) - if not books: - return - - db = view.model().db + db = self.gui.current_db if len(ids) == 1: formats = db.formats(ids[0], index_is_id=True) if formats: formats = {x.upper() for x in formats.split(',')} - nformats = {f.rpartition('.')[-1].upper() for f in books} + nformats = {f.rpartition('.')[-1].upper() for f in paths} override = formats.intersection(nformats) if override: title = db.title(ids[0], index_is_id=True) @@ -139,7 +184,7 @@ class AddAction(InterfaceAction): if not confirm(msg, 'confirm_format_override_on_add', title=_('Are you sure?'), parent=self.gui): return - fmt_map = {os.path.splitext(fpath)[1][1:].upper():fpath for fpath in books} + fmt_map = {os.path.splitext(fpath)[1][1:].upper():fpath for fpath in paths} for id_ in ids: for fmt, fpath in fmt_map.iteritems(): @@ -148,7 +193,7 @@ class AddAction(InterfaceAction): notify=True) current_idx = self.gui.library_view.currentIndex() if current_idx.isValid(): - view.model().current_changed(current_idx, current_idx) + self.gui.library_view.model().current_changed(current_idx, current_idx) def add_empty_format(self, format_): if self.gui.stack.currentIndex() != 0: From 0dc35d543d79d9d3bc334fdf28f40e7d9cacded2 Mon Sep 17 00:00:00 2001 From: Juanjo Benages <juanjo@benages.eu> Date: Thu, 7 Mar 2019 12:52:25 +0100 Subject: [PATCH 0270/2613] Add recipe for elperiodicomediterraneo.com --- recipes/mediterraneo.recipe | 102 ++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 recipes/mediterraneo.recipe diff --git a/recipes/mediterraneo.recipe b/recipes/mediterraneo.recipe new file mode 100644 index 0000000000..5cbf642797 --- /dev/null +++ b/recipes/mediterraneo.recipe @@ -0,0 +1,102 @@ +#!/usr/bin/env python2 +# -*- coding: utf-8 -*- + +__license__ = 'GPL v3' +__copyright__ = 'benages, based on elperidicodearagon.com by desUBIKado' +__author__ = 'benages' +__description__ = 'Daily newspaper from Castellón' +__version__ = 'v0.10' +__date__ = '07, March 2019' +''' +elperiodicomediterraneo.com +''' +from calibre.web.feeds.news import BasicNewsRecipe + + +class elperiodicomediterraneo(BasicNewsRecipe): + title = u'El Periódico Mediterráneo' + __author__ = u'benages' + description = u'Noticias desde Castellón' + publisher = u'elperiodicomediterraneo.com' + category = u'news, politics, Spain, Castellón' + oldest_article = 1 + delay = 1 + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + language = 'es' + masthead_url = 'http://pdf.elperiodicomediterraneo.com/img/logotipo.gif' + encoding = 'iso-8859-1' + remove_empty_feeds = True + remove_javascript = True + + # The index of feeds is in https://www.elperiodicomediterraneo.com/info/rss.php + feeds = [ + (u'Portada', u'https://est.zetaestaticos.com/mediterraneo/rss/portada_es.xml'), + (u'Ultima hora', u'https://est.zetaestaticos.com/mediterraneo/rss/ultimahora_es.xml'), + (u'Castell\xf3n', u'https://est.zetaestaticos.com/mediterraneo/rss/2_es.xml'), + (u'Vila-Real', u'https://est.zetaestaticos.com/mediterraneo/rss/102_es.xml'), + (u'Comarcas', u'https://est.zetaestaticos.com/mediterraneo/rss/10_es.xml'), + (u'Comunitat', u'https://est.zetaestaticos.com/mediterraneo/rss/230_es.xml'), + (u'Espa\xf1a', u'https://est.zetaestaticos.com/mediterraneo/rss/3_es.xml'), + (u'Opini\xf3n', u'https://est.zetaestaticos.com/mediterraneo/rss/103_es.xml'), + (u'Internacional', u'https://est.zetaestaticos.com/mediterraneo/rss/4_es.xml'), + (u'Econom\xeda', u'https://est.zetaestaticos.com/mediterraneo/rss/5_es.xml'), + (u'Deportes', u'https://est.zetaestaticos.com/mediterraneo/rss/7_es.xml'), + (u'Villarreal', u'https://est.zetaestaticos.com/mediterraneo/rss/288_es.xml'), + (u'Castell\xf3n CF', u'https://est.zetaestaticos.com/mediterraneo/rss/319_es.xml'), + (u'Sucesos', u'https://est.zetaestaticos.com/mediterraneo/rss/105_es.xml'), + (u'Sociedad', u'https://est.zetaestaticos.com/mediterraneo/rss/106_es.xml'), + (u'Espectaculos', u'https://est.zetaestaticos.com/mediterraneo/rss/107_es.xml'), + (u'Televisi\xf3n', u'https://est.zetaestaticos.com/mediterraneo/rss/324_es.xml'), + ] + + remove_tags_before = dict(name='div', attrs={'class': 'Pagina'}) + remove_tags_after = dict(name='div', attrs={'class': 'ComentariosNew'}) + + keep_only_tags = [dict(name='div', attrs={'class': 'Pagina'})] + + remove_tags = [ + dict( + name='nav', + attrs={'class': ['Compartir', 'HerramientasConversacion Herramientas']} + ), + dict(name='h5', attrs={'class': ['CintilloBox']}), + dict( + name='div', + attrs={ + 'class': [ + 'BoxMenu BoxMenuConFoto', 'BxGalerias', 'ConStick', + 'HerramientasComentarioNew Herramientas', 'NumeroComentarioNew' + ] + } + ), + dict( + name='div', + attrs={ + 'class': [ + 'BoxPestanas', 'Box', 'ColumnaDerecha', + 'NoticiasRelacionadasDeNoticia', + 'CintilloNoticiasRelacionadasDeNoticia' + ] + } + ), + dict(name='a', attrs={'class': ['IrA BotonLink']}) + ] + + # Recuperamos la portada de papel (la imagen format=1 tiene mayor resolucion) + + def get_cover_url(self): + index = 'http://pdf.elperiodicomediterraneo.com/edicion.php' + soup = self.index_to_soup(index) + for image in soup.findAll('img', src=True): + if image['src'].startswith('/funciones/img-public.php?key='): + return 'http://pdf.elperiodicomediterraneo.com' + image['src'] + return None + + extra_css = ''' + h1 {font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:28px;} + h2 {font-family:Arial,Helvetica,sans-serif; font-style:italic;font-size:14px;color:#4D4D4D;} + h3 {font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:18px;} + ''' + From 293571cb8a47b7b2b3825ce9977b5c6b50ffc84e Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Fri, 8 Mar 2019 05:17:22 +0530 Subject: [PATCH 0271/2613] Update Amazon metadata download plugin for changes to amazon results page markup --- src/calibre/ebooks/metadata/sources/amazon.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/metadata/sources/amazon.py b/src/calibre/ebooks/metadata/sources/amazon.py index f1f3444827..70f70b1052 100644 --- a/src/calibre/ebooks/metadata/sources/amazon.py +++ b/src/calibre/ebooks/metadata/sources/amazon.py @@ -842,7 +842,7 @@ class Worker(Thread): # Get details {{{ class Amazon(Source): name = 'Amazon.com' - version = (1, 2, 5) + version = (1, 2, 6) minimum_calibre_version = (2, 82, 0) description = _('Downloads metadata and covers from Amazon') @@ -1157,7 +1157,10 @@ class Amazon(Source): return False return True - for a in root.xpath(r'//li[starts-with(@id, "result_")]//a[@href and contains(@class, "s-access-detail-page")]'): + result_links = root.xpath('//div[contains(@class, "s-result-list")]//div[@data-index]//h5//a[@href]') + if not result_links: + result_links = root.xpath(r'//li[starts-with(@id, "result_")]//a[@href and contains(@class, "s-access-detail-page")]') + for a in result_links: title = tostring(a, method='text', encoding=unicode) if title_ok(title): url = a.get('href') From 7667b177d86cde5f9244dd51641c35db359f7967 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Fri, 8 Mar 2019 08:37:09 +0530 Subject: [PATCH 0272/2613] Fix a regression in the previous release that broke Copy to library and delete after when copying a duplicated book. Fixes #1816224 [Bug when copying an existing book from one library to another](https://bugs.launchpad.net/calibre/+bug/1816224) --- src/calibre/gui2/actions/copy_to_library.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/actions/copy_to_library.py b/src/calibre/gui2/actions/copy_to_library.py index b9ef0d644f..32da577640 100644 --- a/src/calibre/gui2/actions/copy_to_library.py +++ b/src/calibre/gui2/actions/copy_to_library.py @@ -499,17 +499,16 @@ class CopyToLibraryAction(InterfaceAction): 'controlled by the Auto-merge option in ' 'Preferences->Import/export->Adding books.'), det_msg=books, show=True) - if delete_after and self.worker.processed: + done_ids = frozenset(self.worker.processed) - frozenset(self.worker.duplicate_ids) + if delete_after and done_ids: v = self.gui.library_view ci = v.currentIndex() row = None if ci.isValid(): row = ci.row() - v.model().delete_books_by_id(self.worker.processed, - permanent=True) - self.gui.iactions['Remove Books'].library_ids_deleted( - self.worker.processed, row) + v.model().delete_books_by_id(done_ids, permanent=True) + self.gui.iactions['Remove Books'].library_ids_deleted(done_ids, row) if self.worker.failed_books: def fmt_err(book_id): From d205255cb7503e3f9b0419bb7f07232a05488c02 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Fri, 8 Mar 2019 08:40:30 +0530 Subject: [PATCH 0273/2613] Update amazon Get books plugin for markup change --- .../gui2/store/stores/amazon_plugin.py | 100 ++++-------------- 1 file changed, 18 insertions(+), 82 deletions(-) diff --git a/src/calibre/gui2/store/stores/amazon_plugin.py b/src/calibre/gui2/store/stores/amazon_plugin.py index b7ce325df4..06cef29478 100644 --- a/src/calibre/gui2/store/stores/amazon_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_plugin.py @@ -4,12 +4,12 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) -store_version = 14 # Needed for dynamic plugin loading +store_version = 16 # Needed for dynamic plugin loading from contextlib import closing import urllib -from lxml import html +from lxml import html, etree from PyQt5.Qt import QUrl @@ -19,7 +19,7 @@ from calibre.gui2.store import StorePlugin from calibre.gui2.store.search_result import SearchResult SEARCH_BASE_URL = 'https://www.amazon.com/s/' -SEARCH_BASE_QUERY = {'url': 'search-alias=digital-text'} +SEARCH_BASE_QUERY = {'i': 'digital-text'} DETAILS_URL = 'https://amazon.com/dp/' STORE_LINK = 'https://www.amazon.com/Kindle-eBooks' DRM_SEARCH_TEXT = 'Simultaneous Device Usage' @@ -34,7 +34,7 @@ def search_amazon(query, max_results=10, timeout=60, write_html_to=None, base_url=SEARCH_BASE_URL, base_query=SEARCH_BASE_QUERY, - field_keywords='field-keywords' + field_keywords='k' ): uquery = base_query.copy() uquery[field_keywords] = query @@ -54,89 +54,25 @@ def search_amazon(query, max_results=10, timeout=60, with open(write_html_to, 'wb') as f: f.write(raw) doc = html.fromstring(raw) - try: - results = doc.xpath('//div[@id="atfResults" and @class]')[0] - except IndexError: - return - - if 's-result-list-parent-container' in results.get('class', ''): - data_xpath = "descendant-or-self::li[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-result-item ')]" - format_xpath = './/a[contains(text(), "Kindle Edition")]//text()' - asin_xpath = '@data-asin' - cover_xpath = "descendant-or-self::img[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-image ')]/@src" - title_xpath = "descendant-or-self::h2[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-title ')]//text()" - author_xpath = './/span[starts-with(text(), "by ")]/following-sibling::span//text()' - price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label' - elif 'grid' in results.get('class', ''): - data_xpath = '//div[contains(@class, "prod")]' - format_xpath = ( - './/ul[contains(@class, "rsltGridList")]' - '//span[contains(@class, "lrg") and not(contains(@class, "bld"))]/text()') - asin_xpath = '@name' - cover_xpath = './/img[contains(@class, "productImage")]/@src' - title_xpath = './/h3[@class="newaps"]/a//text()' - author_xpath = './/h3[@class="newaps"]//span[contains(@class, "reg")]//text()' - price_xpath = ( - './/ul[contains(@class, "rsltGridList")]' - '//span[contains(@class, "lrg") and contains(@class, "bld")]/text()') - elif 'ilresults' in results.get('class', ''): - data_xpath = '//li[(@class="ilo")]' - format_xpath = ( - './/ul[contains(@class, "rsltGridList")]' - '//span[contains(@class, "lrg") and not(contains(@class, "bld"))]/text()') - asin_xpath = '@name' - cover_xpath = './div[@class = "ilf"]/a/img[contains(@class, "ilo")]/@src' - title_xpath = './/h3[@class="newaps"]/a//text()' - author_xpath = './/h3[@class="newaps"]//span[contains(@class, "reg")]//text()' - # Results can be in a grid (table) or a column - price_xpath = ( - './/ul[contains(@class, "rsltL") or contains(@class, "rsltGridList")]' - '//span[contains(@class, "lrg") and contains(@class, "bld")]/text()') - elif 'list' in results.get('class', ''): - data_xpath = '//div[contains(@class, "prod")]' - format_xpath = ( - './/ul[contains(@class, "rsltL")]' - '//span[contains(@class, "lrg") and not(contains(@class, "bld"))]/text()') - asin_xpath = '@name' - cover_xpath = './/img[contains(@class, "productImage")]/@src' - title_xpath = './/h3[@class="newaps"]/a//text()' - author_xpath = './/h3[@class="newaps"]//span[contains(@class, "reg")]//text()' - price_xpath = ( - './/ul[contains(@class, "rsltL")]' - '//span[contains(@class, "lrg") and contains(@class, "bld")]/text()') - else: - return - - for data in doc.xpath(data_xpath): - if counter <= 0: - break - + for result in doc.xpath('//div[contains(@class, "s-result-list")]//div[@data-index and @data-asin]'): + kformat = ''.join(result.xpath('.//a[contains(text(), "Kindle Edition")]//text()')) # Even though we are searching digital-text only Amazon will still # put in results for non Kindle books (author pages). Se we need # to explicitly check if the item is a Kindle book and ignore it # if it isn't. - format = ''.join(data.xpath(format_xpath)) - if 'kindle' not in format.lower(): + if 'kindle' not in kformat.lower(): + continue + asin = result.get('data-asin') + if not asin: continue - # We must have an asin otherwise we can't easily reference the - # book later. - asin = data.xpath(asin_xpath) - if asin: - asin = asin[0] - else: - continue - - cover_url = ''.join(data.xpath(cover_xpath)) - - title = ''.join(data.xpath(title_xpath)) - author = ''.join(data.xpath(author_xpath)) - try: - author = author.split('by ', 1)[1].split(" (")[0] - except: - pass - - price = ''.join(data.xpath(price_xpath)) + cover_url = ''.join(result.xpath('.//img/@src')) + title = etree.tostring(result.xpath('.//h5')[0], method='text', encoding='unicode') + adiv = result.xpath('.//div[contains(@class, "a-color-secondary")]')[0] + aparts = etree.tostring(adiv, method='text', encoding='unicode').split() + idx = aparts.index('|') + author = ' '.join(aparts[1:idx]) + price = ''.join(result.xpath('.//span[contains(@class, "a-price")]/span[contains(@class, "a-offscreen")]/text()')) counter -= 1 @@ -144,8 +80,8 @@ def search_amazon(query, max_results=10, timeout=60, s.cover_url = cover_url.strip() s.title = title.strip() s.author = author.strip() - s.price = price.strip() s.detail_item = asin.strip() + s.price = price.strip() s.formats = 'Kindle' yield s From 893c8a970c6bb0d0f50473a711529709a803a8a0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Fri, 8 Mar 2019 08:58:47 +0530 Subject: [PATCH 0274/2613] pep8 --- src/calibre/utils/date.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/utils/date.py b/src/calibre/utils/date.py index f3814042d5..90057cd451 100644 --- a/src/calibre/utils/date.py +++ b/src/calibre/utils/date.py @@ -194,9 +194,11 @@ def isoformat(date_time, assume_utc=False, as_utc=True, sep='T'): # str(sep) because isoformat barfs with unicode sep on python 2.x return unicode(date_time.isoformat(str(sep))) + def internal_iso_format_string(): return 'yyyy-MM-ddThh:mm:ss' + def w3cdtf(date_time, assume_utc=False): if hasattr(date_time, 'tzinfo'): if date_time.tzinfo is None: From 36136bcdb224e890769edb07ed6e2eda201e1fc6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Fri, 8 Mar 2019 08:59:19 +0530 Subject: [PATCH 0275/2613] version 3.40.0 --- Changelog.yaml | 76 ++++++++++++++++++++++++++++++++++++++++ src/calibre/constants.py | 2 +- 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/Changelog.yaml b/Changelog.yaml index 9ef98f162a..773de17092 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -20,6 +20,82 @@ # new recipes: # - title: +- version: 3.40.0 + date: 2019-03-08 + + new features: + - title: "TXT Input: Use markdown 3.0 with support for new extensions such as code highlighting and smarten punctuation." + + - title: "Book details panel: Allow editing the identifiers for the book by right clicking on the existing Ids." + tickets: [1815005] + + - title: "Content server: Allow specifying custom URLs for the 'Search the internet' feature via Preferences->Sharing over the net->Search the internet." + tickets: [1810923] + + - title: "Tag browser: Category editor: Add a checkbox to restrict the entries shown to only those present in the current Virtual library" + + - title: "Allow adding files to selected book records from the clipboard. To use copy a file from windows explorer, right click the Add books button and choose: Add files to selected books from clipboard" + tickets: [1815419] + + - title: "Tag browser: When right clicking on a saved search add a menu option to search using the raw search expression." + tickets: [1816274] + + - title: "Tag browser: Have pressing the Enter key find the next match." + tickets: [1816276] + + - title: "Windows: Add a button to Preferences->Sharing over the net to set calibre to run when the computer starts" + + bug fixes: + - title: "Fix a regression in the previous release that broke Copy to library and delete after when copying a duplicated book." + tickets: [1816224] + + - title: "Edit book: Fix pasting of image from clipboard using (Ctrl-V) not working" + + - title: "Content server: Fix {id} not working in the custom list template" + tickets: [1818308] + + - title: "EPUB/MOBI Catalogs: Fix presets not saving title and format information." + tickets: [1818838] + + - title: "macOS: Respect the system setting for text insertion cursor blink time" + + - title: "FB2 Output: Fix comments from the input document not present in the output." + tickets: [1815357] + + - title: "calibredb: Fix adding books with an OPF file to a remote server not picking up the cover specified in the OPF file" + + - title: "TXT Input: Fix option to remove indents at the start of lines breaking conversion of markdown documents." + tickets: [1814989] + + - title: "EPUB/MOBI Catalog generation: Allow matching empty fields in exclusion rules." + tickets: [1814458] + + - title: "EPUB/MOBI Catalogs: Fix multiple books with the same title but different authors in a genre not being listed." + tickets: [1415990] + + - title: "Update the Get Books and metadata Amazon.com plugins to handle changes to the markup on the Amazon results page" + + improved recipes: + - Scientific American + - Taipei Times + - Harpers Magazine + - General Knowledge Today + - Granma + - South China Morning Post + - New York Times (Web) + - China Daily + - "1843" + - Pro Physik + - Caravan Magazine + - Spektrum der Wissenchaft + + new recipes: + - title: Quanta Magazine + author: lui1 + + - title: El Periodico Mediterraneo + author: benages + - version: 3.39.1 date: 2019-02-01 diff --git a/src/calibre/constants.py b/src/calibre/constants.py index e44683c1ff..04ebcd82a6 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -6,7 +6,7 @@ from polyglot.builtins import map import sys, locale, codecs, os, importlib, collections __appname__ = u'calibre' -numeric_version = (3, 39, 1) +numeric_version = (3, 40, 0) __version__ = u'.'.join(map(unicode, numeric_version)) __author__ = u"Kovid Goyal <kovid@kovidgoyal.net>" From 99e8bdd227f2680f4532a19a260d2a61d36cf347 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Fri, 8 Mar 2019 09:12:38 +0530 Subject: [PATCH 0276/2613] Update derStandard --- recipes/der_standard.recipe | 55 ++++++++----------------------------- 1 file changed, 12 insertions(+), 43 deletions(-) diff --git a/recipes/der_standard.recipe b/recipes/der_standard.recipe index e5e4c8dc65..4292deeda9 100644 --- a/recipes/der_standard.recipe +++ b/recipes/der_standard.recipe @@ -7,11 +7,15 @@ __copyright__ = '2009, Gerhard Aigner <gerhard.aigner at gmail.com>' ''' http://www.derstandard.at - Austrian Newspaper ''' -import re -import random from calibre.web.feeds.news import BasicNewsRecipe +def classes(classes): + q = frozenset(classes.split(' ')) + return dict(attrs={ + 'class': lambda x: x and frozenset(x.split()).intersection(q)}) + + class DerStandardRecipe(BasicNewsRecipe): title = u'derStandard' __author__ = 'Gerhard Aigner and Sujata Raman and Marcel Jira and Peter Reschenhofer' @@ -32,8 +36,8 @@ class DerStandardRecipe(BasicNewsRecipe): feeds = [ (u'Newsroom', u'http://derStandard.at/?page=rss&ressort=Seite1'), - (u'Inland', u'http://derstandard.at/?page=rss&ressort=InnenPolitik'), - (u'International', u'http://derstandard.at/?page=rss&ressort=InternationalPolitik'), + (u'International', u'http://derstandard.at/?page=rss&ressort=International'), + (u'Inland', u'http://derstandard.at/?page=rss&ressort=Inland'), (u'Wirtschaft', u'http://derStandard.at/?page=rss&ressort=Wirtschaft'), (u'Web', u'http://derStandard.at/?page=rss&ressort=Web'), (u'Sport', u'http://derStandard.at/?page=rss&ressort=Sport'), @@ -47,16 +51,16 @@ class DerStandardRecipe(BasicNewsRecipe): (u'Lifestyle', u'http://derStandard.at/?page=rss&ressort=Lifestyle'), (u'Reisen', u'http://derStandard.at/?page=rss&ressort=Reisen'), (u'Familie', u'http://derstandard.at/?page=rss&ressort=Familie'), - (u'Greenlife', u'http://derStandard.at/?page=rss&ressort=Greenlife'), + (u'Meinung', u'http://derStandard.at/?page=rss&ressort=Meinung'), + (u'User', u'http://derStandard.at/?page=rss&ressort=User'), (u'Karriere', u'http://derStandard.at/?page=rss&ressort=Karriere'), (u'Immobilien', u'http://derstandard.at/?page=rss&ressort=Immobilien'), (u'Automobil', u'http://derstandard.at/?page=rss&ressort=Automobil'), - (u'dieStandard', u'http://dieStandard.at/?page=rss&ressort=diestandard'), - (u'daStandard', u'http://daStandard.at/?page=rss&ressort=dastandard') + (u'dieStandard', u'http://derStandard.at/?page=rss&ressort=diestandard'), ] keep_only_tags = [ - dict(name='div', attrs={'class': re.compile('^artikel')}) + classes('article-header article-body'), ] remove_tags = [ @@ -70,38 +74,3 @@ class DerStandardRecipe(BasicNewsRecipe): ] remove_attributes = ['width', 'height'] - - preprocess_regexps = [ - (re.compile(r'\[[\d]*\]', re.DOTALL | - re.IGNORECASE), lambda match: ''), - (re.compile(r'bgcolor="#\w{3,6}"', - re.DOTALL | re.IGNORECASE), lambda match: '') - ] - - filter_regexps = [r'/r[1-9]*'] - - def get_article_url(self, article): - matchObj = re.search(re.compile( - r'/r' + '[1-9]*', flags=0), article.link, flags=0) - - if matchObj: - return None - - return article.link - - def preprocess_html(self, soup): - if soup.find('div', {'class': re.compile('^artikel')}) is None: - self.abort_article() - for t in soup.findAll(['ul', 'li']): - t.name = 'div' - return soup - - def get_cover_url(self): - base_url = 'https://epaper.derstandard.at/' - url = base_url + 'shelf.act?s=' + str(random.random() * 10000) - soup = self.index_to_soup(url) - img = soup.find( - 'img', {'class': re.compile('^thumbnailBig'), 'src': True}) - if img and img['src']: - cover_url = base_url + img['src'] - return cover_url From 7d9f51cd9e2e173a2d7d8ebcf96f7ed15a14272a Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Fri, 8 Mar 2019 10:15:56 +0530 Subject: [PATCH 0277/2613] Content server: Allow clicking on book cover in details page to read the book. Fixes #1819058 [[Feature] Clicking on cover in book details to read it](https://bugs.launchpad.net/calibre/+bug/1819058) --- src/pyj/book_list/book_details.pyj | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pyj/book_list/book_details.pyj b/src/pyj/book_list/book_details.pyj index ec63f7e455..1b51da18c1 100644 --- a/src/pyj/book_list/book_details.pyj +++ b/src/pyj/book_list/book_details.pyj @@ -436,11 +436,12 @@ def render_book(container_id, book_id): render_book.title = metadata.title set_title(c, metadata.title) authors = metadata.authors.join(' & ') if metadata.authors else _('Unknown') - alt = _('{} by {}').format(metadata.title, authors) + alt = _('{} by {}\nClick to read').format(metadata.title, authors) imgdiv = E.div( E.img( alt=alt, title=alt, data_title=metadata.title, data_authors=authors, - style='border-radius: 20px; max-width: calc(100vw - 2em); max-height: calc(100vh - 4ex - {}); display: block; width:auto; height:auto; border-radius: 20px'.format(get_font_size('title') + onclick=read_book.bind(None, book_id), + style='cursor: pointer; border-radius: 20px; max-width: calc(100vw - 2em); max-height: calc(100vh - 4ex - {}); display: block; width:auto; height:auto; border-radius: 20px'.format(get_font_size('title') )) ) imgdiv.firstChild.onerror = on_img_err From 94fc460f8c0094b439468688225ef2167c205951 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Fri, 8 Mar 2019 10:18:12 +0530 Subject: [PATCH 0278/2613] Content server: Book details page: Fix close button not going back to book list after using Next/previous buttons. Fixes #1819060 [Clicking X (close) in the book details on the server should get you back to the covers view (library)](https://bugs.launchpad.net/calibre/+bug/1819060) --- src/pyj/book_list/book_details.pyj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyj/book_list/book_details.pyj b/src/pyj/book_list/book_details.pyj index 1b51da18c1..25b5b48078 100644 --- a/src/pyj/book_list/book_details.pyj +++ b/src/pyj/book_list/book_details.pyj @@ -472,7 +472,7 @@ def render_book(container_id, book_id): if next_book_id: q = parse_url_params() q.book_id = next_book_id + '' - show_panel('book_details', query=q) + show_panel('book_details', query=q, replace=True) md.appendChild(E.div( style='margin-top: 1.5ex', From 409aac87dd88f0551eaa62902ac39e0db5a3264a Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Fri, 8 Mar 2019 10:32:08 +0530 Subject: [PATCH 0279/2613] Donate buttons should link to localized donate pages Fixes #1819064 [Clicking on the heart (donate) button will not get you to the donate page in your language](https://bugs.launchpad.net/calibre/+bug/1819064) --- src/calibre/gui2/tweak_book/ui.py | 4 ++-- src/calibre/gui2/ui.py | 3 ++- src/calibre/srv/code.py | 3 ++- src/pyj/book_list/top_bar.pyj | 4 +++- src/pyj/session.pyj | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/tweak_book/ui.py b/src/calibre/gui2/tweak_book/ui.py index 0d1ad714f8..403b530f81 100644 --- a/src/calibre/gui2/tweak_book/ui.py +++ b/src/calibre/gui2/tweak_book/ui.py @@ -47,11 +47,11 @@ from calibre.gui2.tweak_book.editor.widget import register_text_editor_actions from calibre.gui2.tweak_book.editor.insert_resource import InsertImage from calibre.utils.icu import sort_key, ord_string from calibre.utils.unicode_names import character_name_from_code -from calibre.utils.localization import localize_user_manual_link +from calibre.utils.localization import localize_user_manual_link, localize_website_link def open_donate(): - open_url(QUrl('https://calibre-ebook.com/donate')) + open_url(QUrl(localize_website_link('https://calibre-ebook.com/donate'))) class Central(QStackedWidget): # {{{ diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index dd43eef419..6336a2411f 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -922,7 +922,8 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ QApplication.instance().quit() def donate(self, *args): - open_url(QUrl('https://calibre-ebook.com/donate')) + from calibre.utils.localization import localize_website_link + open_url(QUrl(localize_website_link('https://calibre-ebook.com/donate'))) def confirm_quit(self): if self.job_manager.has_jobs(): diff --git a/src/calibre/srv/code.py b/src/calibre/srv/code.py index d7cfe47219..cc61d72e6e 100644 --- a/src/calibre/srv/code.py +++ b/src/calibre/srv/code.py @@ -27,7 +27,7 @@ from calibre.srv.routes import endpoint, json from calibre.srv.utils import get_library_data, get_use_roman from calibre.utils.config import prefs, tweaks from calibre.utils.icu import sort_key, numeric_sort_key -from calibre.utils.localization import get_lang, lang_map_for_ui +from calibre.utils.localization import get_lang, lang_map_for_ui, localize_website_link from calibre.utils.search_query_parser import ParseException POSTABLE = frozenset({'GET', 'POST', 'HEAD'}) @@ -150,6 +150,7 @@ def basic_interface_data(ctx, rd): 'custom_list_template': getattr(ctx, 'custom_list_template', None) or custom_list_template(), 'search_the_net_urls': getattr(ctx, 'search_the_net_urls', None) or [], 'num_per_page': rd.opts.num_per_page, + 'donate_link': localize_website_link('https://calibre-ebook.com/donate') } ans['library_map'], ans['default_library_id'] = ctx.library_info(rd) return ans diff --git a/src/pyj/book_list/top_bar.pyj b/src/pyj/book_list/top_bar.pyj index 7424ba64ba..07fe5dd8bb 100644 --- a/src/pyj/book_list/top_bar.pyj +++ b/src/pyj/book_list/top_bar.pyj @@ -6,6 +6,7 @@ from book_list.theme import get_color, get_font_size from dom import set_css, clear, create_keyframes, build_rule, svgicon, add_extra_css from elementmaker import E from gettext import gettext as _ +from session import get_interface_data bar_counter = 0 CLASS_NAME = 'main-top-bar' @@ -50,6 +51,7 @@ def set_left_data(container, title='calibre', icon='heart', action=None, tooltip if icon is 'heart': if not tooltip: tooltip = _('Donate to support calibre development') + interface_data = get_interface_data() for i, bar in enumerate(bars): left = bar.firstChild @@ -66,7 +68,7 @@ def set_left_data(container, title='calibre', icon='heart', action=None, tooltip animation_iteration_count='5', animation_play_state='running' if run_animation else 'paused' ) set_css(a.firstChild, color=get_color('heart')) - a.setAttribute('href', 'https://calibre-ebook.com/donate') + a.setAttribute('href', interface_data.donate_link) a.setAttribute('target', 'donate-to-calibre') if action is not None: a.addEventListener('click', def(event): event.preventDefault(), action();) diff --git a/src/pyj/session.pyj b/src/pyj/session.pyj index cc8c8cbd68..d8c25a781c 100644 --- a/src/pyj/session.pyj +++ b/src/pyj/session.pyj @@ -170,6 +170,7 @@ default_interface_data = { 'default_library_id': None, 'library_map': None, 'search_the_net_urls': [], + 'donate_link': 'https://calibre-ebook.com/donate', 'icon_map': {}, 'icon_path': '', 'custom_list_template': None, From e3c295f2526c1c52c59757faf0f59abb58302c18 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Fri, 8 Mar 2019 11:36:11 +0530 Subject: [PATCH 0280/2613] Fix regression that broke calibre starting when using a custom date column --- src/calibre/gui2/library/delegates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index 91d774b04b..430793aab7 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -438,7 +438,7 @@ class CcDateDelegate(QStyledItemDelegate, UpdateEditorGeometry): # {{{ elif _format == 'iso': self.format = internal_iso_format_string() else: - self.format = format + self.format = _format def displayText(self, val, locale): d = qt_to_dt(val) From f4a5b3edb05a02ceaa91fd8c3ee70b60afaabd9f Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Fri, 8 Mar 2019 11:39:34 +0530 Subject: [PATCH 0281/2613] version 3.40.1 --- Changelog.yaml | 4 +++- src/calibre/constants.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Changelog.yaml b/Changelog.yaml index 773de17092..cd917f9314 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -20,7 +20,7 @@ # new recipes: # - title: -- version: 3.40.0 +- version: 3.40.1 date: 2019-03-08 new features: @@ -75,6 +75,8 @@ - title: "Update the Get Books and metadata Amazon.com plugins to handle changes to the markup on the Amazon results page" + - title: "Version 3.40.1 fixes a bug in 3.40 that could prevent calibre starting when using a custom date column" + improved recipes: - Scientific American - Taipei Times diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 04ebcd82a6..1317ea6873 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -6,7 +6,7 @@ from polyglot.builtins import map import sys, locale, codecs, os, importlib, collections __appname__ = u'calibre' -numeric_version = (3, 40, 0) +numeric_version = (3, 40, 1) __version__ = u'.'.join(map(unicode, numeric_version)) __author__ = u"Kovid Goyal <kovid@kovidgoyal.net>" From 76447ba379d4b1f38e5bb5446db54f4e77908820 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Sat, 9 Mar 2019 22:26:32 +0530 Subject: [PATCH 0282/2613] The New Criterion by Darko Miletic Fixes #1819276 [New recipe - The New Criterion magazine](https://bugs.launchpad.net/calibre/+bug/1819276) --- recipes/icons/thenewcriterion.png | Bin 0 -> 48054 bytes recipes/thenewcriterion.recipe | 112 ++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 recipes/icons/thenewcriterion.png create mode 100644 recipes/thenewcriterion.recipe diff --git a/recipes/icons/thenewcriterion.png b/recipes/icons/thenewcriterion.png new file mode 100644 index 0000000000000000000000000000000000000000..7fef5dfd9776fa070ad2e1f30e5a26bbeb3546b5 GIT binary patch literal 48054 zcmb^21#BD9*C_ZTZKz>r7#dC*YM7x7Gcz+Yqr==VGh@TpFf%iA;xIGVFa7UZt#;qr zl|Fqt^4xpJo}+ulGm@?O%?X#66+`-h_XPq10!cz#Sn;Dr{kOuwe6+;3V1tkDv(qmL zWw?*U8_qcFV;j;*QS28))g;03zY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?eS`BXC zn}qbfzI<xznnvkJA3~~y^a$62NV0f75=H1SB$&x%$XIMP!s9X7GlF?Mb`Zj0u{kJ< z`tTU+8T?=#pYtU$@X*6OsgXc0SMU==(F4m---Pt#B&p-0sL^O-8o5kDuSD6Qp`ore z91epb7={d-l$sd0VQPPqH+@8yL8e#fNELx2uD;S`L^>&?(_IS<J_F~{>IN6W4Fm2d zi>OJeL)lCgI@p;i6i`n1QF=^D5_$<iXu|tX9<9=2MnbPPAW?}tWV%=?Q{g0GSRNoi z-z^y0!B8(uBqgzM%1|(a70O_TNH|<RhsS5JzJ9B|A9|-;OvqJ=jDIQTvWCjvf(FV3 zs7uOQlKS3&>wNFb|Cc<uY|x!9U9ahTMRFO6X)rB@lLpEk`=9>gGQNV)Yo%nkN-I@j zs18>O(4ooq?yrB>R79wBqJ!~#v-QE(`auRm-aknD{-$sdAh}Q%)CFV!2!`o`x_}G- z!7yD=7mxuU7^VyA0x|#u!*oGiKn8$dm@cRb$N&%w(*<<_832M|x}Yu~13)lL7t{r0 z00@TZg1UeV0KqU_P#2H^AQ+|#>H;zV1jBSeT|fqaV3;nb3&;Qv4ATX50T}>-VY;9$ zAOk=!Oc&GzWB>?;>4Lg|3;@9}T~HU00U-Fj>GB-9@PXmfEe|7goui{7tBJY{5*8zh zkc7m`dYtyB*&{t^zD3g}jJCLKaXOuQr;i?YFs@2uc3ZNmJz(<)g(7<7SI=3SE-rAN d&Rdt`MmvRji*NMSPIlcXiJ2WIDvw;6`!~l6r1Jm( literal 0 HcmV?d00001 diff --git a/recipes/thenewcriterion.recipe b/recipes/thenewcriterion.recipe new file mode 100644 index 0000000000..9bb281aa4f --- /dev/null +++ b/recipes/thenewcriterion.recipe @@ -0,0 +1,112 @@ +# -*- mode: python -*- +# -*- coding: utf-8 -*- +# vi: set fenc=utf-8 ft=python : +# kate: encoding utf-8; syntax python; + +__license__ = 'GPL v3' +__copyright__ = '2019, Darko Miletic <darko.miletic at gmail.com>' +''' +www.newcriterion.com +''' + +import urllib +import urllib2 +import re +from calibre import strftime +from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ptempfile import PersistentTemporaryFile + + +class TheNewCriterion(BasicNewsRecipe): + title = 'The New Criterion' + __author__ = 'Darko Miletic' + description = 'On the front lines of the battle for culture' + publisher = 'The Foundation for Cultural Review' + category = 'art, politics, USA, world' + oldest_article = 40 + no_stylesheets = True + encoding = 'utf8' + use_embedded_content = False + language = 'en' + remove_empty_feeds = True + publication_type = 'magazine' + needs_subscription = 'optional' + delay = 1 + simultaneous_downloads = 1 + timeout = 8 + ignore_duplicate_articles = {'url'} + articles_are_obfuscated = True + temp_files = [] + fetch_retries = 10 + auto_cleanup = True + masthead_url = 'https://www.newcriterion.com/themes/thenewcriterion/assets/img/horizontal-logo.svg' + extra_css = """ + body{font-family: Galliard, serif} + """ + + conversion_options = { + 'comment': description, 'tags': category, 'publisher': publisher, 'language': language + } + + def get_browser(self): + br = BasicNewsRecipe.get_browser(self) + br.open('https://www.newcriterion.com/') + if self.username is not None and self.password is not None: + data = urllib.urlencode({'login': self.username, 'password': self.password}) + header = { + 'X-OCTOBER-REQUEST-HANDLER': 'onSignin', + 'X-Requested-With': 'XMLHttpRequest', + 'DNT':'1', + 'X-OCTOBER-REQUEST-PARTIALS':'', + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + } + request = urllib2.Request('https://www.newcriterion.com/', data, header) + br.open(request) + return br + + def parse_index(self): + part = strftime('/issues/%Y/') + str(int(strftime('%m'))) + partf = part + '/' + currentIssue_url = 'https://www.newcriterion.com' + part + soup1 = self.index_to_soup(currentIssue_url) + self.log(currentIssue_url) + rsr = re.compile('^' + partf + '.+$') + date = strftime(' %B %Y') + articles = [] + subset = soup1.find('div', id='main') + for item in subset.findAll('a', href=True): + relurl = str(item['href']) + if rsr.search(relurl): + title = '' + description = '' + if item.find('div'): + title = self.tag_to_string(item.div.h1).strip() + description = self.tag_to_string(item.div.p) + else: + title = self.tag_to_string(item.h1).strip() + description = self.tag_to_string(item.p) + articles.append({ + 'title': title, + 'date': date, + 'url': 'https://www.newcriterion.com' + relurl, + 'description': description + }) + return [(self.title, articles)] + + def get_obfuscated_article(self, url): + result = None + count = 0 + while (count < self.fetch_retries): + try: + response = self.browser.open(url, timeout=self.timeout) + html = response.read() + count = self.fetch_retries + tfile = PersistentTemporaryFile('_fa.html') + tfile.write(html) + tfile.close() + self.temp_files.append(tfile) + result = tfile.name + except: + print("Retrying download...") + count += 1 + return result From a14454a8572722be44064494317e940e91365f26 Mon Sep 17 00:00:00 2001 From: Eli Schwartz <eschwartz@archlinux.org> Date: Mon, 25 Feb 2019 02:47:11 -0500 Subject: [PATCH 0283/2613] py3: fix PyInt types for python2/python3 --- src/calibre/utils/podofo/doc.cpp | 4 ++++ src/calibre/utils/podofo/output.cpp | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/calibre/utils/podofo/doc.cpp b/src/calibre/utils/podofo/doc.cpp index 6e73e729bd..8c54782205 100644 --- a/src/calibre/utils/podofo/doc.cpp +++ b/src/calibre/utils/podofo/doc.cpp @@ -343,7 +343,11 @@ error: static PyObject * PDFDoc_pages_getter(PDFDoc *self, void *closure) { int pages = self->doc->GetPageCount(); +#if PY_MAJOR_VERSION >= 3 + PyObject *ans = PyLong_FromLong(static_cast<long>(pages)); +#else PyObject *ans = PyInt_FromLong(static_cast<long>(pages)); +#endif if (ans != NULL) Py_INCREF(ans); return ans; } diff --git a/src/calibre/utils/podofo/output.cpp b/src/calibre/utils/podofo/output.cpp index a03cc0b188..106b4ae763 100644 --- a/src/calibre/utils/podofo/output.cpp +++ b/src/calibre/utils/podofo/output.cpp @@ -97,7 +97,11 @@ class OutputDevice : public PdfOutputDevice { char *buf = NULL; Py_ssize_t len = 0; +#if PY_MAJOR_VERSION >= 3 + if ((temp = PyLong_FromSize_t(lLen)) == NULL) throw pyerr(); +#else if ((temp = PyInt_FromSize_t(lLen)) == NULL) throw pyerr(); +#endif ret = PyObject_CallFunctionObjArgs(read_func, temp, NULL); NUKE(temp); if (ret != NULL) { @@ -118,7 +122,11 @@ class OutputDevice : public PdfOutputDevice { void Seek(size_t offset) { PyObject *ret, *temp; +#if PY_MAJOR_VERSION >= 3 + if ((temp = PyLong_FromSize_t(offset)) == NULL) throw pyerr(); +#else if ((temp = PyInt_FromSize_t(offset)) == NULL) throw pyerr(); +#endif ret = PyObject_CallFunctionObjArgs(seek_func, temp, NULL); NUKE(temp); if (ret == NULL) { @@ -144,7 +152,11 @@ class OutputDevice : public PdfOutputDevice { PyErr_SetString(PyExc_Exception, "tell() method did not return a number"); throw pyerr(); } +#if PY_MAJOR_VERSION >= 3 + ans = PyLong_AsUnsignedLongMask(ret); +#else ans = PyInt_AsUnsignedLongMask(ret); +#endif Py_DECREF(ret); if (PyErr_Occurred() != NULL) throw pyerr(); @@ -191,4 +203,3 @@ PyObject* pdf::write_doc(PdfMemDocument *doc, PyObject *f) { Py_RETURN_NONE; } - From c0754900fe15406873f41a9cb64c12b07d98bb49 Mon Sep 17 00:00:00 2001 From: Eli Schwartz <eschwartz@archlinux.org> Date: Sun, 10 Mar 2019 00:10:14 -0500 Subject: [PATCH 0284/2613] C extensions: format strings with the right type of values on python2/python3 --- src/calibre/devices/mtp/unix/libmtp.c | 4 ++++ .../mtp/windows/content_enumeration.cpp | 4 ++++ src/calibre/ebooks/compression/palmdoc.c | 17 +++++++++++----- src/calibre/utils/fonts/winfonts.cpp | 5 ++++- src/calibre/utils/lzx/compressor.c | 4 ++++ src/calibre/utils/lzx/lzxmodule.c | 4 ++++ src/calibre/utils/podofo/doc.cpp | 14 +++++++++---- src/lzma/lzma_binding.c | 20 ++++++++++++------- 8 files changed, 55 insertions(+), 17 deletions(-) diff --git a/src/calibre/devices/mtp/unix/libmtp.c b/src/calibre/devices/mtp/unix/libmtp.c index 8d8481d551..eb99375136 100644 --- a/src/calibre/devices/mtp/unix/libmtp.c +++ b/src/calibre/devices/mtp/unix/libmtp.c @@ -86,7 +86,11 @@ static uint16_t data_to_python(void *params, void *priv, uint32_t sendlen, unsig cb = (ProgressCallback *)priv; *putlen = sendlen; PyEval_RestoreThread(cb->state); +#if PY_MAJOR_VERSION >= 3 + res = PyObject_CallMethod(cb->extra, "write", "y#", data, (Py_ssize_t)sendlen); +#else res = PyObject_CallMethod(cb->extra, "write", "s#", data, (Py_ssize_t)sendlen); +#endif if (res == NULL) { ret = LIBMTP_HANDLER_RETURN_ERROR; *putlen = 0; diff --git a/src/calibre/devices/mtp/windows/content_enumeration.cpp b/src/calibre/devices/mtp/windows/content_enumeration.cpp index 67fe2b7914..9afff2461d 100644 --- a/src/calibre/devices/mtp/windows/content_enumeration.cpp +++ b/src/calibre/devices/mtp/windows/content_enumeration.cpp @@ -554,7 +554,11 @@ PyObject* wpd::get_file(IPortableDevice *device, const wchar_t *object_id, PyObj PyErr_SetString(PyExc_IOError, "Read access is denied to this object"); break; } else if (SUCCEEDED(hr)) { if (bytes_read > 0) { +#if PY_MAJOR_VERSION >= 3 + res = PyObject_CallMethod(dest, "write", "y#", buf, bytes_read); +#else res = PyObject_CallMethod(dest, "write", "s#", buf, bytes_read); +#endif if (res == NULL) break; Py_DECREF(res); res = NULL; if (callback != NULL) Py_XDECREF(PyObject_CallFunction(callback, "kK", total_read, filesize)); diff --git a/src/calibre/ebooks/compression/palmdoc.c b/src/calibre/ebooks/compression/palmdoc.c index 61d00ab04f..623bb10f67 100644 --- a/src/calibre/ebooks/compression/palmdoc.c +++ b/src/calibre/ebooks/compression/palmdoc.c @@ -42,12 +42,20 @@ typedef struct { #define CHAR(x) (( (x) > 127 ) ? (x)-256 : (x)) +#if PY_MAJOR_VERSION >= 3 + #define BUFFER_FMT "y*" + #define BYTES_FMT "y#" +#else + #define BUFFER_FMT "t#" + #define BYTES_FMT "s#" +#endif + static PyObject * cpalmdoc_decompress(PyObject *self, PyObject *args) { const char *_input = NULL; Py_ssize_t input_len = 0; Byte *input; char *output; Byte c; PyObject *ans; Py_ssize_t i = 0, o = 0, j = 0, di, n; - if (!PyArg_ParseTuple(args, "t#", &_input, &input_len)) + if (!PyArg_ParseTuple(args, BUFFER_FMT, &_input, &input_len)) return NULL; input = (Byte *) PyMem_Malloc(sizeof(Byte)*input_len); if (input == NULL) return PyErr_NoMemory(); @@ -76,7 +84,7 @@ cpalmdoc_decompress(PyObject *self, PyObject *args) { output[o] = output[o - di]; } } - ans = Py_BuildValue("s#", output, o); + ans = Py_BuildValue(BYTES_FMT, output, o); if (output != NULL) PyMem_Free(output); if (input != NULL) PyMem_Free(input); return ans; @@ -162,7 +170,7 @@ cpalmdoc_compress(PyObject *self, PyObject *args) { char *output; PyObject *ans; Py_ssize_t j = 0; buffer b; - if (!PyArg_ParseTuple(args, "t#", &_input, &input_len)) + if (!PyArg_ParseTuple(args, BUFFER_FMT, &_input, &input_len)) return NULL; b.data = (Byte *)PyMem_Malloc(sizeof(Byte)*input_len); if (b.data == NULL) return PyErr_NoMemory(); @@ -176,7 +184,7 @@ cpalmdoc_compress(PyObject *self, PyObject *args) { if (output == NULL) return PyErr_NoMemory(); j = cpalmdoc_do_compress(&b, output); if ( j == 0) return PyErr_NoMemory(); - ans = Py_BuildValue("s#", output, j); + ans = Py_BuildValue(BYTES_FMT, output, j); PyMem_Free(output); PyMem_Free(b.data); return ans; @@ -203,4 +211,3 @@ initcPalmdoc(void) { ); if (m == NULL) return; } - diff --git a/src/calibre/utils/fonts/winfonts.cpp b/src/calibre/utils/fonts/winfonts.cpp index 428f31d529..bafc8b5728 100644 --- a/src/calibre/utils/fonts/winfonts.cpp +++ b/src/calibre/utils/fonts/winfonts.cpp @@ -165,7 +165,11 @@ static PyObject* add_font(PyObject *self, PyObject *args) { Py_ssize_t sz; DWORD num = 0; +#if PY_MAJOR_VERSION >= 3 + if (!PyArg_ParseTuple(args, "y#", &data, &sz)) return NULL; +#else if (!PyArg_ParseTuple(args, "s#", &data, &sz)) return NULL; +#endif AddFontMemResourceEx(data, (DWORD)sz, NULL, &num); @@ -260,4 +264,3 @@ initwinfonts(void) { PyModule_AddIntMacro(m, FW_HEAVY); PyModule_AddIntMacro(m, FW_BLACK); } - diff --git a/src/calibre/utils/lzx/compressor.c b/src/calibre/utils/lzx/compressor.c index b63ee3ee95..605ca515f5 100644 --- a/src/calibre/utils/lzx/compressor.c +++ b/src/calibre/utils/lzx/compressor.c @@ -310,7 +310,11 @@ Compressor_compress(Compressor *self, PyObject *args, PyObject *kwds) int flush = 0; if (!PyArg_ParseTupleAndKeywords( +#if PYTHON_MAJOR_VERSION >= 3 + args, kwds, "y#|b", kwlist, &data, &inlen, &flush)) { +#else args, kwds, "s#|b", kwlist, &data, &inlen, &flush)) { +#endif return NULL; } diff --git a/src/calibre/utils/lzx/lzxmodule.c b/src/calibre/utils/lzx/lzxmodule.c index 6c9a4f15d8..3cb5d36919 100644 --- a/src/calibre/utils/lzx/lzxmodule.c +++ b/src/calibre/utils/lzx/lzxmodule.c @@ -157,7 +157,11 @@ decompress(PyObject *self, PyObject *args) memory_file dest; PyObject *retval = NULL; +#if PY_MAJOR_VERSION >= 3 + if (!PyArg_ParseTuple(args, "y#I", &inbuf, &inlen, &outlen)) { +#else if (!PyArg_ParseTuple(args, "s#I", &inbuf, &inlen, &outlen)) { +#endif return NULL; } diff --git a/src/calibre/utils/podofo/doc.cpp b/src/calibre/utils/podofo/doc.cpp index 8c54782205..650ed3d149 100644 --- a/src/calibre/utils/podofo/doc.cpp +++ b/src/calibre/utils/podofo/doc.cpp @@ -32,12 +32,18 @@ PDFDoc_new(PyTypeObject *type, PyObject *args, PyObject *kwds) } // }}} +#if PY_MAJOR_VERSION >= 3 + #define BYTES_FMT "y#" +#else + #define BYTES_FMT "s#" +#endif + // Loading/Opening of PDF files {{{ static PyObject * PDFDoc_load(PDFDoc *self, PyObject *args) { char *buffer; Py_ssize_t size; - if (PyArg_ParseTuple(args, "s#", &buffer, &size)) { + if (PyArg_ParseTuple(args, BYTES_FMT, &buffer, &size)) { try { #if PODOFO_VERSION <= 0x000905 self->doc->Load(buffer, (long)size); @@ -77,7 +83,7 @@ static PyObject * PDFDoc_save(PDFDoc *self, PyObject *args) { char *buffer; - if (PyArg_ParseTuple(args, "s", &buffer)) { + if (PyArg_ParseTuple(args, BYTES_FMT, &buffer)) { try { self->doc->Write(buffer); } catch(const PdfError & err) { @@ -284,7 +290,7 @@ PDFDoc_get_xmp_metadata(PDFDoc *self, PyObject *args) { if ((str = metadata->GetStream()) != NULL) { str->GetFilteredCopy(&buf, &len); if (buf != NULL) { - ans = Py_BuildValue("s#", buf, len); + ans = Py_BuildValue(BYTES_FMT, buf, len); free(buf); buf = NULL; if (ans == NULL) goto error; } @@ -312,7 +318,7 @@ PDFDoc_set_xmp_metadata(PDFDoc *self, PyObject *args) { TVecFilters compressed(1); compressed[0] = ePdfFilter_FlateDecode; - if (!PyArg_ParseTuple(args, "s#", &raw, &len)) return NULL; + if (!PyArg_ParseTuple(args, BYTES_FMT, &raw, &len)) return NULL; try { if ((metadata = self->doc->GetMetadata()) != NULL) { if ((str = metadata->GetStream()) == NULL) { PyErr_NoMemory(); goto error; } diff --git a/src/lzma/lzma_binding.c b/src/lzma/lzma_binding.c index 24dd28e60a..d02f14c523 100644 --- a/src/lzma/lzma_binding.c +++ b/src/lzma/lzma_binding.c @@ -58,6 +58,12 @@ static PyObject *LZMAError = NULL; // Utils {{{ static UInt64 crc64_table[256]; +#if PY_MAJOR_VERSION >= 3 + #define BYTES_FMT "y#" +#else + #define BYTES_FMT "s#" +#endif + static void init_crc_table() { static const UInt64 poly64 = (UInt64)(0xC96C5795D7870F42); size_t i, j; @@ -79,7 +85,7 @@ crc64(PyObject *self, PyObject *args) { Py_ssize_t size = 0; UInt64 crc = 0; size_t i; - if (!PyArg_ParseTuple(args, "s#|K", &data, &size, &crc)) return NULL; + if (!PyArg_ParseTuple(args, BYTES_FMT "|K", &data, &size, &crc)) return NULL; crc = ~crc; for (i = 0; i < (size_t)size; ++i) crc = crc64_table[data[i] ^ (crc & 0xFF)] ^ (crc >> 8); @@ -142,7 +148,7 @@ decompress2(PyObject *self, PyObject *args) { } else { res = SZ_OK; bytes_written = 0; status = LZMA_STATUS_NEEDS_MORE_INPUT; } if (res != SZ_OK) { SET_ERROR(res); goto exit; } if (bytes_written > 0) { - if(!PyObject_CallFunction(write, "s#", outbuf, bytes_written)) goto exit; + if(!PyObject_CallFunction(write, BYTES_FMT, outbuf, bytes_written)) goto exit; } if (inbuf_len > inbuf_pos && !bytes_read && !bytes_written && status != LZMA_STATUS_NEEDS_MORE_INPUT && status != LZMA_STATUS_FINISHED_WITH_MARK) { SET_ERROR(SZ_ERROR_DATA); goto exit; @@ -188,7 +194,7 @@ decompress(PyObject *self, PyObject *args) { ELzmaStatus status = LZMA_STATUS_NOT_FINISHED; ELzmaFinishMode finish_mode = LZMA_FINISH_ANY; - if(!PyArg_ParseTuple(args, "OOOKs#k", &read, &seek, &write, &decompressed_size, &header, &header_size, &bufsize)) return NULL; + if(!PyArg_ParseTuple(args, "OOOK" BYTES_FMT "k", &read, &seek, &write, &decompressed_size, &header, &header_size, &bufsize)) return NULL; size_known = (decompressed_size != (UInt64)(Int64)-1); if (header_size != 13) { PyErr_SetString(LZMAError, "Header must be exactly 13 bytes long"); return NULL; } if (!decompressed_size) { PyErr_SetString(LZMAError, "Cannot decompress empty file"); return NULL; } @@ -214,7 +220,7 @@ decompress(PyObject *self, PyObject *args) { } else { res = SZ_OK; bytes_written = 0; status = LZMA_STATUS_NEEDS_MORE_INPUT; } if (res != SZ_OK) { SET_ERROR(res); goto exit; } if (bytes_written > 0) { - if(!PyObject_CallFunction(write, "s#", outbuf, bytes_written)) goto exit; + if(!PyObject_CallFunction(write, BYTES_FMT, outbuf, bytes_written)) goto exit; total_written += bytes_written; } if (inbuf_len > inbuf_pos && !bytes_read && !bytes_written && status != LZMA_STATUS_NEEDS_MORE_INPUT && status != LZMA_STATUS_FINISHED_WITH_MARK) { @@ -296,7 +302,7 @@ static size_t owrite(void *p, const void *buf, size_t size) { PyObject *res = NULL; if (!size) return 0; ACQUIRE_GIL - res = PyObject_CallFunction(self->write, "s#", (char*)buf, size); + res = PyObject_CallFunction(self->write, BYTES_FMT, (char*)buf, size); if (res == NULL) return 0; Py_DECREF(res); RELEASE_GIL @@ -332,7 +338,7 @@ get_lzma2_properties(int preset) { exit: if (lzma2) Lzma2Enc_Destroy(lzma2); if (PyErr_Occurred()) return NULL; - return Py_BuildValue("s#", &props_out, 1); + return Py_BuildValue(BYTES_FMT, &props_out, 1); } @@ -382,7 +388,7 @@ compress(PyObject *self, PyObject *args) { exit: if (lzma2) Lzma2Enc_Destroy(lzma2); if (PyErr_Occurred()) return NULL; - return Py_BuildValue("s#", &props_out, 1); + return Py_BuildValue(BYTES_FMT, &props_out, 1); } // }}} From 6aa1592052552515e02f257559022745f862ab6f Mon Sep 17 00:00:00 2001 From: Eli Schwartz <eschwartz@archlinux.org> Date: Tue, 26 Feb 2019 22:29:39 -0500 Subject: [PATCH 0285/2613] Port libmtp plugin to build on python2/python3 --- src/calibre/devices/mtp/unix/libmtp.c | 121 ++++++++++++++++---------- 1 file changed, 74 insertions(+), 47 deletions(-) diff --git a/src/calibre/devices/mtp/unix/libmtp.c b/src/calibre/devices/mtp/unix/libmtp.c index eb99375136..6456ec4afd 100644 --- a/src/calibre/devices/mtp/unix/libmtp.c +++ b/src/calibre/devices/mtp/unix/libmtp.c @@ -612,45 +612,44 @@ static PyGetSetDef Device_getsetters[] = { }; static PyTypeObject DeviceType = { // {{{ - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "libmtp.Device", /*tp_name*/ - sizeof(Device), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)Device_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - "Device", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - Device_methods, /* tp_methods */ - 0, /* tp_members */ - Device_getsetters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Device_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "libmtp.Device", + /* tp_basicsize */ sizeof(Device), + /* tp_itemsize */ 0, + /* tp_dealloc */ (destructor)Device_dealloc, + /* tp_print */ 0, + /* tp_getattr */ 0, + /* tp_setattr */ 0, + /* tp_compare */ 0, + /* tp_repr */ 0, + /* tp_as_number */ 0, + /* tp_as_sequence */ 0, + /* tp_as_mapping */ 0, + /* tp_hash */ 0, + /* tp_call */ 0, + /* tp_str */ 0, + /* tp_getattro */ 0, + /* tp_setattro */ 0, + /* tp_as_buffer */ 0, + /* tp_flags */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, + /* tp_doc */ "Device", + /* tp_traverse */ 0, + /* tp_clear */ 0, + /* tp_richcompare */ 0, + /* tp_weaklistoffset */ 0, + /* tp_iter */ 0, + /* tp_iternext */ 0, + /* tp_methods */ Device_methods, + /* tp_members */ 0, + /* tp_getset */ Device_getsetters, + /* tp_base */ 0, + /* tp_dict */ 0, + /* tp_descr_get */ 0, + /* tp_descr_set */ 0, + /* tp_dictoffset */ 0, + /* tp_init */ (initproc)Device_init, + /* tp_alloc */ 0, + /* tp_new */ 0, }; // }}} // }}} End Device object definition @@ -699,6 +698,8 @@ known_devices(PyObject *self, PyObject *args) { return ans; } +static char libmtp_doc[] = "Interface to libmtp."; + static PyMethodDef libmtp_methods[] = { {"set_debug_level", set_debug_level, METH_VARARGS, "set_debug_level(level)\n\nSet the debug level bit mask, see LIBMTP_DEBUG_* constants." @@ -716,19 +717,41 @@ static PyMethodDef libmtp_methods[] = { }; -CALIBRE_MODINIT_FUNC -initlibmtp(void) { - PyObject *m; +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&libmtp_module) +static struct PyModuleDef libmtp_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "libmtp", + /* m_doc */ libmtp_doc, + /* m_size */ -1, + /* m_methods */ libmtp_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; +CALIBRE_MODINIT_FUNC PyInit_libmtp(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("libmtp", libmtp_methods, libmtp_doc); +CALIBRE_MODINIT_FUNC initlibmtp(void) { +#endif DeviceType.tp_new = PyType_GenericNew; - if (PyType_Ready(&DeviceType) < 0) - return; + if (PyType_Ready(&DeviceType) < 0) { + INITERROR; + } - m = Py_InitModule3("libmtp", libmtp_methods, "Interface to libmtp."); - if (m == NULL) return; + PyObject *m = INITMODULE; + if (m == NULL) { + INITERROR; + } MTPError = PyErr_NewException("libmtp.MTPError", NULL, NULL); - if (MTPError == NULL) return; + if (MTPError == NULL) { + INITERROR; + } PyModule_AddObject(m, "MTPError", MTPError); // Redirect stdout to get rid of the annoying message about mtpz. Really, @@ -758,4 +781,8 @@ initlibmtp(void) { PyModule_AddIntMacro(m, LIBMTP_DEBUG_USB); PyModule_AddIntMacro(m, LIBMTP_DEBUG_DATA); PyModule_AddIntMacro(m, LIBMTP_DEBUG_ALL); + +#if PY_MAJOR_VERSION >= 3 + return m; +#endif } From 9ad1ebf487f6b68f583b122b53a2e4a117f4be78 Mon Sep 17 00:00:00 2001 From: Eli Schwartz <eschwartz@archlinux.org> Date: Tue, 26 Feb 2019 22:55:04 -0500 Subject: [PATCH 0286/2613] libmtp: make update script run on python3 Also make it not clone tons of useless history. --- src/calibre/devices/mtp/unix/upstream/update.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) mode change 100644 => 100755 src/calibre/devices/mtp/unix/upstream/update.py diff --git a/src/calibre/devices/mtp/unix/upstream/update.py b/src/calibre/devices/mtp/unix/upstream/update.py old mode 100644 new mode 100755 index 0fc6a2b41c..98edf95812 --- a/src/calibre/devices/mtp/unix/upstream/update.py +++ b/src/calibre/devices/mtp/unix/upstream/update.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai from __future__ import (unicode_literals, division, absolute_import, print_function) @@ -14,9 +14,7 @@ base = os.path.dirname(os.path.abspath(__file__)) os.chdir('/tmp') if os.path.exists('libmtp'): shutil.rmtree('libmtp') -subprocess.check_call(['git', 'clone', 'git://git.code.sf.net/p/libmtp/code', +subprocess.check_call(['git', 'clone', '--depth=1', 'git://git.code.sf.net/p/libmtp/code', 'libmtp']) for x in ('src/music-players.h', 'src/device-flags.h'): - with open(os.path.join(base, os.path.basename(x)), 'wb') as f: - shutil.copyfileobj(open('libmtp/'+x), f) - + shutil.copyfile('libmtp/'+x, os.path.join(base, os.path.basename(x))) From c53322db0d4a1d2840b330a4f34449189e8dc138 Mon Sep 17 00:00:00 2001 From: Eli Schwartz <eschwartz@archlinux.org> Date: Thu, 28 Feb 2019 16:35:29 -0500 Subject: [PATCH 0287/2613] Port podofo plugin to build on python2/python3 --- src/calibre/utils/podofo/doc.cpp | 78 ++++++++++++++-------------- src/calibre/utils/podofo/outline.cpp | 78 ++++++++++++++-------------- src/calibre/utils/podofo/podofo.cpp | 60 +++++++++++++++------ 3 files changed, 121 insertions(+), 95 deletions(-) diff --git a/src/calibre/utils/podofo/doc.cpp b/src/calibre/utils/podofo/doc.cpp index 650ed3d149..9f19b47446 100644 --- a/src/calibre/utils/podofo/doc.cpp +++ b/src/calibre/utils/podofo/doc.cpp @@ -605,45 +605,43 @@ static PyMethodDef PDFDoc_methods[] = { // Type definition {{{ PyTypeObject pdf::PDFDocType = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "podofo.PDFDoc", /*tp_name*/ - sizeof(PDFDoc), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)PDFDoc_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - "PDF Documents", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - PDFDoc_methods, /* tp_methods */ - 0, /* tp_members */ - PDFDoc_getsetters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PDFDoc_new, /* tp_new */ - + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "podofo.PDFDoc", + /* tp_basicsize */ sizeof(PDFDoc), + /* tp_itemsize */ 0, + /* tp_dealloc */ (destructor)PDFDoc_dealloc, + /* tp_print */ 0, + /* tp_getattr */ 0, + /* tp_setattr */ 0, + /* tp_compare */ 0, + /* tp_repr */ 0, + /* tp_as_number */ 0, + /* tp_as_sequence */ 0, + /* tp_as_mapping */ 0, + /* tp_hash */ 0, + /* tp_call */ 0, + /* tp_str */ 0, + /* tp_getattro */ 0, + /* tp_setattro */ 0, + /* tp_as_buffer */ 0, + /* tp_flags */ Py_TPFLAGS_DEFAULT, + /* tp_doc */ "PDF Documents", + /* tp_traverse */ 0, + /* tp_clear */ 0, + /* tp_richcompare */ 0, + /* tp_weaklistoffset */ 0, + /* tp_iter */ 0, + /* tp_iternext */ 0, + /* tp_methods */ PDFDoc_methods, + /* tp_members */ 0, + /* tp_getset */ PDFDoc_getsetters, + /* tp_base */ 0, + /* tp_dict */ 0, + /* tp_descr_get */ 0, + /* tp_descr_set */ 0, + /* tp_dictoffset */ 0, + /* tp_init */ 0, + /* tp_alloc */ 0, + /* tp_new */ PDFDoc_new, }; // }}} diff --git a/src/calibre/utils/podofo/outline.cpp b/src/calibre/utils/podofo/outline.cpp index b7be4aeae8..01a3b186d9 100644 --- a/src/calibre/utils/podofo/outline.cpp +++ b/src/calibre/utils/podofo/outline.cpp @@ -96,45 +96,43 @@ static PyMethodDef methods[] = { // Type definition {{{ PyTypeObject pdf::PDFOutlineItemType = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "podofo.PDFOutlineItem", /*tp_name*/ - sizeof(PDFOutlineItem), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - "PDF Outline items", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - new_item, /* tp_new */ - + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "podofo.PDFOutlineItem", + /* tp_basicsize */ sizeof(PDFOutlineItem), + /* tp_itemsize */ 0, + /* tp_dealloc */ (destructor)dealloc, + /* tp_print */ 0, + /* tp_getattr */ 0, + /* tp_setattr */ 0, + /* tp_compare */ 0, + /* tp_repr */ 0, + /* tp_as_number */ 0, + /* tp_as_sequence */ 0, + /* tp_as_mapping */ 0, + /* tp_hash */ 0, + /* tp_call */ 0, + /* tp_str */ 0, + /* tp_getattro */ 0, + /* tp_setattro */ 0, + /* tp_as_buffer */ 0, + /* tp_flags */ Py_TPFLAGS_DEFAULT, + /* tp_doc */ "PDF Outline items", + /* tp_traverse */ 0, + /* tp_clear */ 0, + /* tp_richcompare */ 0, + /* tp_weaklistoffset */ 0, + /* tp_iter */ 0, + /* tp_iternext */ 0, + /* tp_methods */ methods, + /* tp_members */ 0, + /* tp_getset */ 0, + /* tp_base */ 0, + /* tp_dict */ 0, + /* tp_descr_get */ 0, + /* tp_descr_set */ 0, + /* tp_dictoffset */ 0, + /* tp_init */ 0, + /* tp_alloc */ 0, + /* tp_new */ new_item, }; // }}} diff --git a/src/calibre/utils/podofo/podofo.cpp b/src/calibre/utils/podofo/podofo.cpp index 50f20de8cf..517f4cbf80 100644 --- a/src/calibre/utils/podofo/podofo.cpp +++ b/src/calibre/utils/podofo/podofo.cpp @@ -10,10 +10,6 @@ using namespace PoDoFo; PyObject *pdf::Error = NULL; -static PyMethodDef podofo_methods[] = { - {NULL} /* Sentinel */ -}; - class PyLogMessage : public PdfError::LogMessageCallback { public: @@ -38,29 +34,63 @@ class PyLogMessage : public PdfError::LogMessageCallback { PyLogMessage log_message; -CALIBRE_MODINIT_FUNC -initpodofo(void) -{ +static char podofo_doc[] = "Wrapper for the PoDoFo PDF library"; + +static PyMethodDef podofo_methods[] = { + {NULL} /* Sentinel */ +}; + +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&podofo_module) +static struct PyModuleDef podofo_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "podofo", + /* m_doc */ podofo_doc, + /* m_size */ -1, + /* m_methods */ podofo_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; +CALIBRE_MODINIT_FUNC PyInit_podofo(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("podofo", podofo_methods, podofo_doc) +CALIBRE_MODINIT_FUNC initpodofo(void) { +#endif + PyObject* m; - if (PyType_Ready(&pdf::PDFDocType) < 0) - return; + if (PyType_Ready(&pdf::PDFDocType) < 0) { + INITERROR; + } - if (PyType_Ready(&pdf::PDFOutlineItemType) < 0) - return; + if (PyType_Ready(&pdf::PDFOutlineItemType) < 0) { + INITERROR; + } pdf::Error = PyErr_NewException((char*)"podofo.Error", NULL, NULL); - if (pdf::Error == NULL) return; + if (pdf::Error == NULL) { + INITERROR; + } PdfError::SetLogMessageCallback((PdfError::LogMessageCallback*)&log_message); PdfError::EnableDebug(false); - m = Py_InitModule3("podofo", podofo_methods, - "Wrapper for the PoDoFo PDF library"); + + m = INITMODULE; + if (m == NULL) { + INITERROR; + } Py_INCREF(&pdf::PDFDocType); PyModule_AddObject(m, "PDFDoc", (PyObject *)&pdf::PDFDocType); PyModule_AddObject(m, "Error", pdf::Error); -} +#if PY_MAJOR_VERSION >= 3 + return m; +#endif +} From 28145e76b022942fc1d687dfccc2adb197bf97d9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Sun, 10 Mar 2019 17:30:38 +0530 Subject: [PATCH 0288/2613] A couple of fixes for the last py3 compat PR --- src/calibre/devices/mtp/unix/driver.py | 10 +++++++--- src/calibre/utils/podofo/doc.cpp | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/calibre/devices/mtp/unix/driver.py b/src/calibre/devices/mtp/unix/driver.py index e023ac00d2..17284dd259 100644 --- a/src/calibre/devices/mtp/unix/driver.py +++ b/src/calibre/devices/mtp/unix/driver.py @@ -12,8 +12,8 @@ from threading import RLock from collections import namedtuple from functools import partial -from calibre import prints, as_unicode -from calibre.constants import plugins, islinux, isosx +from calibre import prints, as_unicode, force_unicode +from calibre.constants import plugins, islinux, isosx, ispy3 from calibre.ptempfile import SpooledTemporaryFile from calibre.devices.errors import OpenFailed, DeviceError, BlacklistedDevice, OpenActionNeeded from calibre.devices.mtp.base import MTPDeviceBase, synchronous, debug @@ -166,8 +166,12 @@ class MTP_DEVICE(MTPDeviceBase): @synchronous def create_device(self, connected_device): d = connected_device + man, prod = d.manufacturer, d.prod + if ispy3: + man = force_unicode(man, 'utf-8') if isinstance(man, bytes) else man + prod = force_unicode(prod, 'utf-8') if isinstance(prod, bytes) else prod return self.libmtp.Device(d.busnum, d.devnum, d.vendor_id, - d.product_id, d.manufacturer, d.product, d.serial) + d.product_id, man, prod, d.serial) @synchronous def eject(self): diff --git a/src/calibre/utils/podofo/doc.cpp b/src/calibre/utils/podofo/doc.cpp index 9f19b47446..164bc17cb7 100644 --- a/src/calibre/utils/podofo/doc.cpp +++ b/src/calibre/utils/podofo/doc.cpp @@ -83,7 +83,7 @@ static PyObject * PDFDoc_save(PDFDoc *self, PyObject *args) { char *buffer; - if (PyArg_ParseTuple(args, BYTES_FMT, &buffer)) { + if (PyArg_ParseTuple(args, "s", &buffer)) { try { self->doc->Write(buffer); } catch(const PdfError & err) { From a59d6a02fadf4a057e7b2244443efd07390380a1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Sun, 10 Mar 2019 17:57:50 +0530 Subject: [PATCH 0289/2613] Fix #1819321 [news download for LA Times fails](https://bugs.launchpad.net/calibre/+bug/1819321) --- recipes/latimes.recipe | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/recipes/latimes.recipe b/recipes/latimes.recipe index 920252cc0f..0fd773ec22 100644 --- a/recipes/latimes.recipe +++ b/recipes/latimes.recipe @@ -4,7 +4,7 @@ import re from collections import defaultdict from pprint import pformat -from calibre.utils.date import strptime +from calibre.utils.date import strptime, utcnow from calibre.web.feeds.news import BasicNewsRecipe DT_EPOCH = strptime('1970-01-01', '%Y-%m-%d', assume_utc=True) @@ -196,8 +196,10 @@ class LATimes(BasicNewsRecipe): for article in articles: mdate = date_rx.match(article['url']) if mdate is not None: - article['timestamp'] = (strptime(mdate.group( - 'date'),'%Y%m%d') - DT_EPOCH).total_seconds() + try: + article['timestamp'] = (strptime(mdate.group('date'),'%Y%m%d') - DT_EPOCH).total_seconds() + except Exception: + article['timestamp'] = (utcnow() - DT_EPOCH).total_seconds() article['url'] = mdate.group(0) self.log('Found: ', len(articles), ' articles.\n') return articles From 3e73c9243df5dd702898542777905df7f7e7487a Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Sun, 10 Mar 2019 18:23:19 +0530 Subject: [PATCH 0290/2613] Edit book: Fix pasting images into a book with no Images folder not working correctly. Fixes #1817405 [[Enhancement] Inserting image with same name](https://bugs.launchpad.net/calibre/+bug/1817405) --- src/calibre/gui2/tweak_book/editor/text.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/editor/text.py b/src/calibre/gui2/tweak_book/editor/text.py index fa44587907..e1e9452a03 100644 --- a/src/calibre/gui2/tweak_book/editor/text.py +++ b/src/calibre/gui2/tweak_book/editor/text.py @@ -155,7 +155,10 @@ class TextEdit(PlainTextEdit): base = self.highlighter.doc_name or None def get_name(name): - return get_recommended_folders(current_container(), (name,))[name] + '/' + name + folder = get_recommended_folders(current_container(), (name,))[name] or '' + if folder: + folder += '/' + return folder + name def get_href(name): return current_container().name_to_href(name, base) From 77728a15ef8a0464942fbe11cc90658d6f2c535a Mon Sep 17 00:00:00 2001 From: Kovid Goyal <kovid@kovidgoyal.net> Date: Mon, 11 Mar 2019 08:29:13 +0530 Subject: [PATCH 0291/2613] Update derStandard --- recipes/der_standard.recipe | 60 +++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/recipes/der_standard.recipe b/recipes/der_standard.recipe index 4292deeda9..bb0d198ea6 100644 --- a/recipes/der_standard.recipe +++ b/recipes/der_standard.recipe @@ -35,32 +35,46 @@ class DerStandardRecipe(BasicNewsRecipe): masthead_url = 'http://images.derstandard.at/2012/06/19/derStandardat_1417x274.gif' feeds = [ - (u'Newsroom', u'http://derStandard.at/?page=rss&ressort=Seite1'), - (u'International', u'http://derstandard.at/?page=rss&ressort=International'), - (u'Inland', u'http://derstandard.at/?page=rss&ressort=Inland'), - (u'Wirtschaft', u'http://derStandard.at/?page=rss&ressort=Wirtschaft'), - (u'Web', u'http://derStandard.at/?page=rss&ressort=Web'), - (u'Sport', u'http://derStandard.at/?page=rss&ressort=Sport'), - (u'Panorama', u'http://derStandard.at/?page=rss&ressort=Panorama'), - (u'Etat', u'http://derStandard.at/?page=rss&ressort=Etat'), - (u'Kultur', u'http://derStandard.at/?page=rss&ressort=Kultur'), - (u'Wissenschaft', u'http://derStandard.at/?page=rss&ressort=Wissenschaft'), - (u'Gesundheit', u'http://derStandard.at/?page=rss&ressort=Gesundheit'), - (u'Bildung', u'http://derStandard.at/?page=rss&ressort=Bildung'), - (u'Meinung', u'http://derStandard.at/?page=rss&ressort=Meinung'), - (u'Lifestyle', u'http://derStandard.at/?page=rss&ressort=Lifestyle'), - (u'Reisen', u'http://derStandard.at/?page=rss&ressort=Reisen'), - (u'Familie', u'http://derstandard.at/?page=rss&ressort=Familie'), - (u'Meinung', u'http://derStandard.at/?page=rss&ressort=Meinung'), - (u'User', u'http://derStandard.at/?page=rss&ressort=User'), - (u'Karriere', u'http://derStandard.at/?page=rss&ressort=Karriere'), - (u'Immobilien', u'http://derstandard.at/?page=rss&ressort=Immobilien'), - (u'Automobil', u'http://derstandard.at/?page=rss&ressort=Automobil'), - (u'dieStandard', u'http://derStandard.at/?page=rss&ressort=diestandard'), + (u'Newsroom', u'https://derStandard.at/?page=rss&ressort=Seite1'), + (u'International', u'https://derstandard.at/?page=rss&ressort=International'), + (u'Inland', u'https://derstandard.at/?page=rss&ressort=Inland'), + (u'Wirtschaft', u'https://derStandard.at/?page=rss&ressort=Wirtschaft'), + (u'Web', u'https://derStandard.at/?page=rss&ressort=Web'), + (u'Sport', u'https://derStandard.at/?page=rss&ressort=Sport'), + (u'Panorama', u'https://derStandard.at/?page=rss&ressort=Panorama'), + (u'Etat', u'https://derStandard.at/?page=rss&ressort=Etat'), + (u'Kultur', u'https://derStandard.at/?page=rss&ressort=Kultur'), + (u'Wissenschaft', u'https://derStandard.at/?page=rss&ressort=Wissenschaft'), + (u'Gesundheit', u'https://derStandard.at/?page=rss&ressort=Gesundheit'), + (u'Bildung', u'https://derStandard.at/?page=rss&ressort=Bildung'), + (u'Meinung', u'https://derStandard.at/?page=rss&ressort=Meinung'), + (u'Lifestyle', u'https://derStandard.at/?page=rss&ressort=Lifestyle'), + (u'Reisen', u'https://derStandard.at/?page=rss&ressort=Reisen'), + (u'Familie', u'https://derstandard.at/?page=rss&ressort=Familie'), + (u'Meinung', u'https://derStandard.at/?page=rss&ressort=Meinung'), + (u'User', u'https://derStandard.at/?page=rss&ressort=User'), + (u'Karriere', u'https://derStandard.at/?page=rss&ressort=Karriere'), + (u'Immobilien', u'https://derstandard.at/?page=rss&ressort=Immobilien'), + (u'Automobil', u'https://derstandard.at/?page=rss&ressort=Automobil'), + (u'dieStandard', u'https://derStandard.at/?page=rss&ressort=diestandard'), ] + def get_browser(self): + br = BasicNewsRecipe.get_browser(self) + headers = { + 'X-Requested-With': 'XMLHttpRequest', + 'Content-Type': 'application/json; charset=UTF-8', + 'DNT': '1', + 'Pragma': 'no-cache', + 'Cache-Control': 'no-cache' + } + import mechanize + req = mechanize.Request(url='https://derstandard.at/privacyprotection/api/agree', data=None, headers=headers, method='POST') + br.open(req) + return br + keep_only_tags = [ - classes('article-header article-body'), + classes('artikel'), ] remove_tags = [ From cbc42bec2329cb04ac26a74aec0678d1c2e90c18 Mon Sep 17 00:00:00 2001 From: Eli Schwartz <eschwartz@archlinux.org> Date: Sun, 10 Mar 2019 13:49:54 -0400 Subject: [PATCH 0292/2613] python3: add unicode/unichr wrappers to polyglot --- setup/parallel_build.py | 3 +- setup/resources.py | 4 +- setup/translations.py | 4 +- src/calibre/__init__.py | 20 +-- src/calibre/constants.py | 6 +- src/calibre/customize/__init__.py | 3 +- src/calibre/customize/builtins.py | 9 +- src/calibre/customize/conversion.py | 5 +- src/calibre/customize/zipplugin.py | 6 +- src/calibre/db/adding.py | 6 +- src/calibre/db/backend.py | 28 ++-- src/calibre/db/cache.py | 10 +- src/calibre/db/categories.py | 8 +- src/calibre/db/cli/cmd_list_categories.py | 13 +- src/calibre/db/cli/cmd_set_metadata.py | 3 +- src/calibre/db/cli/cmd_show_metadata.py | 3 +- src/calibre/db/lazy.py | 3 +- src/calibre/db/schema_upgrades.py | 3 +- src/calibre/db/search.py | 9 +- src/calibre/db/utils.py | 4 +- src/calibre/db/view.py | 5 +- src/calibre/db/write.py | 19 ++- src/calibre/devices/jetbook/driver.py | 3 +- src/calibre/devices/kindle/driver.py | 9 +- src/calibre/devices/kobo/books.py | 3 +- src/calibre/devices/kobo/driver.py | 15 ++- src/calibre/devices/kobo/kobotouch_config.py | 9 +- src/calibre/devices/mtp/driver.py | 7 +- src/calibre/devices/mtp/filesystem_cache.py | 6 +- src/calibre/devices/mtp/unix/driver.py | 7 +- src/calibre/devices/mtp/windows/driver.py | 6 +- src/calibre/devices/prst1/driver.py | 3 +- .../devices/smart_device_app/driver.py | 11 +- src/calibre/devices/udisks.py | 5 +- src/calibre/devices/usbms/deviceconfig.py | 9 +- src/calibre/devices/usbms/driver.py | 5 +- src/calibre/devices/utils.py | 3 +- src/calibre/ebooks/__init__.py | 5 +- src/calibre/ebooks/chardet.py | 5 +- src/calibre/ebooks/chm/reader.py | 7 +- src/calibre/ebooks/comic/input.py | 6 +- src/calibre/ebooks/conversion/config.py | 3 +- .../ebooks/conversion/plugins/chm_input.py | 5 +- .../ebooks/conversion/plugins/epub_input.py | 3 +- .../ebooks/conversion/plugins/epub_output.py | 11 +- .../ebooks/conversion/plugins/fb2_input.py | 5 +- .../ebooks/conversion/plugins/html_input.py | 5 +- .../ebooks/conversion/plugins/html_output.py | 3 +- .../ebooks/conversion/plugins/htmlz_output.py | 7 +- .../ebooks/conversion/plugins/lrf_output.py | 11 +- .../ebooks/conversion/plugins/mobi_input.py | 3 +- .../ebooks/conversion/plugins/mobi_output.py | 5 +- .../ebooks/conversion/plugins/pdf_output.py | 5 +- .../ebooks/conversion/plugins/pml_output.py | 3 +- .../ebooks/conversion/plugins/recipe_input.py | 3 +- .../ebooks/conversion/plugins/snb_output.py | 11 +- src/calibre/ebooks/conversion/plumber.py | 5 +- src/calibre/ebooks/conversion/preprocess.py | 7 +- src/calibre/ebooks/conversion/utils.py | 125 +++++++++--------- src/calibre/ebooks/docx/container.py | 3 +- src/calibre/ebooks/docx/fonts.py | 3 +- src/calibre/ebooks/docx/index.py | 3 +- src/calibre/ebooks/docx/tables.py | 3 - src/calibre/ebooks/docx/toc.py | 3 +- src/calibre/ebooks/docx/writer/from_html.py | 5 +- src/calibre/ebooks/docx/writer/styles.py | 3 +- src/calibre/ebooks/epub/cfi/tests.py | 3 +- src/calibre/ebooks/epub/periodical.py | 14 +- src/calibre/ebooks/fb2/fb2ml.py | 13 +- src/calibre/ebooks/html/input.py | 6 +- src/calibre/ebooks/html/to_zip.py | 4 +- src/calibre/ebooks/htmlz/oeb2html.py | 3 +- src/calibre/ebooks/lit/reader.py | 10 +- src/calibre/ebooks/lit/writer.py | 23 ++-- src/calibre/ebooks/lrf/html/convert_from.py | 35 ++--- src/calibre/ebooks/lrf/html/table_as_image.py | 6 +- src/calibre/ebooks/lrf/lrfparser.py | 7 +- src/calibre/ebooks/lrf/meta.py | 5 +- src/calibre/ebooks/lrf/objects.py | 27 ++-- src/calibre/ebooks/lrf/pylrs/elements.py | 11 +- src/calibre/ebooks/lrf/tags.py | 3 +- src/calibre/ebooks/metadata/__init__.py | 10 +- src/calibre/ebooks/metadata/book/base.py | 49 +++---- src/calibre/ebooks/metadata/book/render.py | 3 +- src/calibre/ebooks/metadata/book/serialize.py | 3 +- src/calibre/ebooks/metadata/cli.py | 5 +- src/calibre/ebooks/metadata/fb2.py | 11 +- src/calibre/ebooks/metadata/imp.py | 3 +- src/calibre/ebooks/metadata/kdl.py | 8 +- src/calibre/ebooks/metadata/kfx.py | 3 +- src/calibre/ebooks/metadata/mobi.py | 3 +- src/calibre/ebooks/metadata/opf2.py | 43 +++--- src/calibre/ebooks/metadata/pdf.py | 5 +- src/calibre/ebooks/metadata/rb.py | 5 +- src/calibre/ebooks/metadata/rtf.py | 6 +- src/calibre/ebooks/metadata/toc.py | 7 +- src/calibre/ebooks/mobi/debug/mobi6.py | 5 +- src/calibre/ebooks/mobi/mobiml.py | 5 +- src/calibre/ebooks/mobi/reader/headers.py | 3 +- src/calibre/ebooks/mobi/reader/markup.py | 3 +- src/calibre/ebooks/mobi/reader/mobi6.py | 3 +- src/calibre/ebooks/mobi/utils.py | 5 +- src/calibre/ebooks/mobi/writer2/main.py | 9 +- src/calibre/ebooks/mobi/writer2/resources.py | 8 +- src/calibre/ebooks/mobi/writer2/serializer.py | 9 +- src/calibre/ebooks/mobi/writer8/exth.py | 15 ++- src/calibre/ebooks/mobi/writer8/index.py | 4 +- src/calibre/ebooks/mobi/writer8/main.py | 5 +- src/calibre/ebooks/mobi/writer8/mobi.py | 3 +- src/calibre/ebooks/mobi/writer8/skeleton.py | 3 +- src/calibre/ebooks/odt/input.py | 3 +- src/calibre/ebooks/oeb/base.py | 43 +++--- src/calibre/ebooks/oeb/iterator/bookmarks.py | 7 +- src/calibre/ebooks/oeb/iterator/spine.py | 6 +- src/calibre/ebooks/oeb/parse_utils.py | 9 +- .../ebooks/oeb/polish/check/parsing.py | 3 +- src/calibre/ebooks/oeb/polish/container.py | 4 +- src/calibre/ebooks/oeb/polish/css.py | 5 +- src/calibre/ebooks/oeb/polish/spell.py | 5 +- src/calibre/ebooks/oeb/polish/stats.py | 5 +- src/calibre/ebooks/oeb/polish/toc.py | 16 +-- src/calibre/ebooks/oeb/reader.py | 7 +- src/calibre/ebooks/oeb/stylizer.py | 11 +- src/calibre/ebooks/oeb/transforms/cover.py | 7 +- .../ebooks/oeb/transforms/embed_fonts.py | 5 +- src/calibre/ebooks/oeb/transforms/flatcss.py | 3 +- src/calibre/ebooks/oeb/transforms/jacket.py | 15 ++- src/calibre/ebooks/oeb/transforms/metadata.py | 3 +- .../ebooks/oeb/transforms/rasterize.py | 5 +- src/calibre/ebooks/oeb/transforms/split.py | 3 +- .../ebooks/oeb/transforms/structure.py | 3 +- src/calibre/ebooks/oeb/transforms/subset.py | 8 +- src/calibre/ebooks/pdb/ereader/reader132.py | 4 +- src/calibre/ebooks/pdb/ereader/reader202.py | 3 +- src/calibre/ebooks/pdb/ereader/writer.py | 4 +- src/calibre/ebooks/pdb/plucker/reader.py | 3 +- src/calibre/ebooks/pdf/reflow.py | 10 +- src/calibre/ebooks/pdf/render/common.py | 16 +-- src/calibre/ebooks/pdf/render/engine.py | 3 +- src/calibre/ebooks/pdf/render/from_html.py | 15 ++- src/calibre/ebooks/pml/pmlml.py | 7 +- src/calibre/ebooks/readability/htmls.py | 4 +- src/calibre/ebooks/readability/readability.py | 6 +- src/calibre/ebooks/rtf/rtfml.py | 5 +- src/calibre/ebooks/rtf2xml/tokenize.py | 3 +- src/calibre/ebooks/snb/snbfile.py | 5 +- src/calibre/ebooks/snb/snbml.py | 5 +- src/calibre/ebooks/txt/markdownml.py | 3 +- src/calibre/ebooks/txt/processor.py | 3 +- src/calibre/ebooks/txt/txtml.py | 3 +- src/calibre/ebooks/unihandecode/__init__.py | 7 +- .../ebooks/unihandecode/pykakasi/jisyo.py | 9 +- src/calibre/ebooks/unihandecode/unidecoder.py | 16 +-- src/calibre/gui2/__init__.py | 19 +-- src/calibre/gui2/actions/__init__.py | 9 +- src/calibre/gui2/actions/choose_library.py | 5 +- src/calibre/gui2/actions/copy_to_library.py | 7 +- src/calibre/gui2/actions/device.py | 3 +- src/calibre/gui2/actions/edit_metadata.py | 9 +- src/calibre/gui2/actions/mark_books.py | 3 +- src/calibre/gui2/actions/polish.py | 8 +- src/calibre/gui2/actions/toc_edit.py | 3 +- src/calibre/gui2/actions/unpack_book.py | 5 +- src/calibre/gui2/add.py | 4 +- src/calibre/gui2/add_filters.py | 6 +- src/calibre/gui2/author_mapper.py | 7 +- src/calibre/gui2/bars.py | 3 +- src/calibre/gui2/book_details.py | 15 ++- src/calibre/gui2/catalog/catalog_bibtex.py | 9 +- src/calibre/gui2/catalog/catalog_csv_xml.py | 7 +- src/calibre/gui2/catalog/catalog_epub_mobi.py | 67 +++++----- src/calibre/gui2/comments_editor.py | 27 ++-- src/calibre/gui2/complete2.py | 15 ++- src/calibre/gui2/convert/__init__.py | 13 +- src/calibre/gui2/convert/bulk.py | 3 +- src/calibre/gui2/convert/debug.py | 5 +- src/calibre/gui2/convert/font_key.py | 3 +- src/calibre/gui2/convert/heuristics.py | 5 +- src/calibre/gui2/convert/look_and_feel.py | 11 +- src/calibre/gui2/convert/metadata.py | 17 +-- src/calibre/gui2/convert/page_setup.py | 7 +- src/calibre/gui2/convert/regex_builder.py | 15 ++- .../gui2/convert/search_and_replace.py | 5 +- src/calibre/gui2/convert/single.py | 11 +- src/calibre/gui2/convert/txt_input.py | 3 +- src/calibre/gui2/convert/xpath_wizard.py | 9 +- src/calibre/gui2/css_transform_rules.py | 9 +- src/calibre/gui2/custom_column_widgets.py | 23 ++-- src/calibre/gui2/dbus_export/gtk.py | 6 +- src/calibre/gui2/dbus_export/menu2.py | 7 +- src/calibre/gui2/dbus_export/utils.py | 4 +- src/calibre/gui2/device.py | 17 +-- .../gui2/device_drivers/configwidget.py | 9 +- src/calibre/gui2/device_drivers/mtp_config.py | 17 +-- .../gui2/device_drivers/mtp_folder_browser.py | 5 +- .../device_drivers/tabbed_device_config.py | 7 +- src/calibre/gui2/dialogs/add_empty_book.py | 5 +- src/calibre/gui2/dialogs/add_from_isbn.py | 12 +- src/calibre/gui2/dialogs/authors_edit.py | 11 +- src/calibre/gui2/dialogs/book_info.py | 7 +- src/calibre/gui2/dialogs/catalog.py | 13 +- src/calibre/gui2/dialogs/check_library.py | 13 +- .../gui2/dialogs/choose_format_device.py | 4 +- src/calibre/gui2/dialogs/choose_library.py | 5 +- src/calibre/gui2/dialogs/comicconf.py | 5 +- src/calibre/gui2/dialogs/custom_recipes.py | 9 +- .../dialogs/delete_matching_from_device.py | 4 +- .../gui2/dialogs/device_category_editor.py | 5 +- src/calibre/gui2/dialogs/drm_error.py | 4 +- src/calibre/gui2/dialogs/duplicates.py | 5 +- .../gui2/dialogs/edit_authors_dialog.py | 33 ++--- src/calibre/gui2/dialogs/match_books.py | 4 +- src/calibre/gui2/dialogs/message_box.py | 13 +- src/calibre/gui2/dialogs/metadata_bulk.py | 79 +++++------ src/calibre/gui2/dialogs/opml.py | 3 +- src/calibre/gui2/dialogs/password.py | 10 +- src/calibre/gui2/dialogs/plugin_updater.py | 9 +- src/calibre/gui2/dialogs/progress.py | 5 +- src/calibre/gui2/dialogs/quickview.py | 11 +- src/calibre/gui2/dialogs/scheduler.py | 9 +- src/calibre/gui2/dialogs/search.py | 27 ++-- src/calibre/gui2/dialogs/smartdevice.py | 8 +- src/calibre/gui2/dialogs/tag_categories.py | 7 +- src/calibre/gui2/dialogs/tag_editor.py | 25 ++-- src/calibre/gui2/dialogs/tag_list_editor.py | 15 ++- src/calibre/gui2/dialogs/template_dialog.py | 21 +-- src/calibre/gui2/dnd.py | 9 +- src/calibre/gui2/email.py | 15 ++- src/calibre/gui2/font_family_chooser.py | 5 +- src/calibre/gui2/init.py | 17 +-- src/calibre/gui2/jobs.py | 7 +- src/calibre/gui2/keyboard.py | 19 +-- src/calibre/gui2/languages.py | 3 +- src/calibre/gui2/layout.py | 3 +- src/calibre/gui2/library/alternate_views.py | 5 +- src/calibre/gui2/library/delegates.py | 5 +- src/calibre/gui2/library/models.py | 17 +-- src/calibre/gui2/library/views.py | 18 +-- src/calibre/gui2/linux_file_dialogs.py | 4 +- src/calibre/gui2/lrf_renderer/main.py | 3 +- src/calibre/gui2/lrf_renderer/text.py | 9 +- src/calibre/gui2/main.py | 9 +- src/calibre/gui2/main_window.py | 3 +- src/calibre/gui2/metadata/basic_widgets.py | 33 ++--- src/calibre/gui2/metadata/config.py | 5 +- src/calibre/gui2/metadata/diff.py | 8 +- src/calibre/gui2/metadata/pdf_covers.py | 5 +- src/calibre/gui2/metadata/single_download.py | 11 +- src/calibre/gui2/notify.py | 5 +- src/calibre/gui2/preferences/__init__.py | 17 +-- src/calibre/gui2/preferences/adding.py | 5 +- src/calibre/gui2/preferences/behavior.py | 5 +- src/calibre/gui2/preferences/coloring.py | 25 ++-- src/calibre/gui2/preferences/columns.py | 9 +- .../gui2/preferences/create_custom_column.py | 29 ++-- src/calibre/gui2/preferences/emailp.py | 15 ++- src/calibre/gui2/preferences/history.py | 8 +- src/calibre/gui2/preferences/look_feel.py | 9 +- src/calibre/gui2/preferences/main.py | 5 +- src/calibre/gui2/preferences/plugboard.py | 11 +- src/calibre/gui2/preferences/plugins.py | 9 +- src/calibre/gui2/preferences/save_template.py | 3 +- src/calibre/gui2/preferences/search.py | 19 +-- .../gui2/preferences/template_functions.py | 11 +- .../gui2/preferences/texture_chooser.py | 9 +- src/calibre/gui2/preferences/toolbar.py | 3 +- src/calibre/gui2/preferences/tweaks.py | 11 +- src/calibre/gui2/proceed.py | 9 +- src/calibre/gui2/qt_file_dialogs.py | 9 +- src/calibre/gui2/save.py | 7 +- src/calibre/gui2/search_box.py | 33 ++--- src/calibre/gui2/search_restriction_mixin.py | 29 ++-- src/calibre/gui2/shortcuts.py | 13 +- src/calibre/gui2/store/basic_config.py | 3 +- .../config/chooser/adv_search_builder.py | 21 +-- .../store/config/chooser/chooser_widget.py | 3 +- .../gui2/store/config/chooser/models.py | 3 +- .../gui2/store/search/adv_search_builder.py | 15 ++- src/calibre/gui2/store/search/models.py | 3 +- src/calibre/gui2/store/search/search.py | 13 +- src/calibre/gui2/store/web_control.py | 13 +- src/calibre/gui2/tag_browser/model.py | 10 +- src/calibre/gui2/tag_browser/ui.py | 7 +- src/calibre/gui2/tag_browser/view.py | 7 +- src/calibre/gui2/tag_mapper.py | 7 +- src/calibre/gui2/toc/location.py | 21 +-- src/calibre/gui2/toc/main.py | 28 ++-- src/calibre/gui2/tools.py | 5 +- src/calibre/gui2/tweak_book/char_select.py | 3 +- src/calibre/gui2/tweak_book/check.py | 5 +- .../gui2/tweak_book/completion/basic.py | 5 +- .../gui2/tweak_book/completion/utils.py | 4 +- src/calibre/gui2/tweak_book/diff/main.py | 5 +- src/calibre/gui2/tweak_book/diff/view.py | 12 +- .../gui2/tweak_book/editor/insert_resource.py | 25 ++-- .../gui2/tweak_book/editor/smarts/html.py | 7 +- .../gui2/tweak_book/editor/snippets.py | 13 +- .../gui2/tweak_book/editor/syntax/base.py | 4 +- src/calibre/gui2/tweak_book/editor/text.py | 40 +++--- src/calibre/gui2/tweak_book/editor/themes.py | 13 +- src/calibre/gui2/tweak_book/editor/widget.py | 9 +- src/calibre/gui2/tweak_book/file_list.py | 76 +++++------ .../gui2/tweak_book/function_replace.py | 3 +- src/calibre/gui2/tweak_book/live_css.py | 3 +- src/calibre/gui2/tweak_book/manage_fonts.py | 3 +- src/calibre/gui2/tweak_book/plugin.py | 3 +- src/calibre/gui2/tweak_book/preferences.py | 22 +-- src/calibre/gui2/tweak_book/preview.py | 12 +- src/calibre/gui2/tweak_book/search.py | 15 ++- src/calibre/gui2/tweak_book/spell.py | 41 +++--- src/calibre/gui2/tweak_book/text_search.py | 3 +- src/calibre/gui2/tweak_book/toc.py | 5 +- src/calibre/gui2/tweak_book/ui.py | 10 +- src/calibre/gui2/tweak_book/widgets.py | 31 ++--- src/calibre/gui2/ui.py | 8 +- src/calibre/gui2/update.py | 8 +- src/calibre/gui2/viewer/bookmarkmanager.py | 3 +- src/calibre/gui2/viewer/config.py | 13 +- src/calibre/gui2/viewer/documentview.py | 26 ++-- src/calibre/gui2/viewer/footnote.py | 3 +- src/calibre/gui2/viewer/image_popup.py | 3 +- src/calibre/gui2/viewer/main.py | 13 +- src/calibre/gui2/viewer/ui.py | 7 +- src/calibre/gui2/widgets.py | 35 ++--- src/calibre/gui2/widgets2.py | 7 +- src/calibre/gui2/wizard/__init__.py | 21 +-- src/calibre/gui2/wizard/send_email.py | 13 +- src/calibre/library/add_to_library.py | 3 +- src/calibre/library/caches.py | 13 +- src/calibre/library/catalogs/csv_xml.py | 13 +- .../library/catalogs/epub_mobi_builder.py | 19 +-- src/calibre/library/comments.py | 5 +- src/calibre/library/custom_columns.py | 13 +- src/calibre/library/database.py | 3 +- src/calibre/library/database2.py | 35 ++--- src/calibre/library/prefs.py | 3 +- src/calibre/library/save_to_disk.py | 5 +- src/calibre/library/schema_upgrades.py | 8 +- src/calibre/library/sqlite.py | 8 +- src/calibre/spell/dictionary.py | 3 +- src/calibre/srv/ajax.py | 8 +- src/calibre/srv/opds.py | 7 +- src/calibre/srv/render_book.py | 4 +- src/calibre/srv/routes.py | 7 +- src/calibre/srv/utils.py | 4 +- src/calibre/startup.py | 8 +- src/calibre/test_build.py | 10 +- src/calibre/utils/apsw_shell.py | 12 +- src/calibre/utils/cleantext.py | 12 +- src/calibre/utils/complete.py | 8 +- src/calibre/utils/config_base.py | 5 +- src/calibre/utils/date.py | 7 +- src/calibre/utils/filenames.py | 3 +- src/calibre/utils/fonts/free_type.py | 6 +- src/calibre/utils/fonts/scanner.py | 3 +- src/calibre/utils/fonts/sfnt/subset.py | 7 +- src/calibre/utils/fonts/utils.py | 6 +- src/calibre/utils/formatter.py | 5 +- src/calibre/utils/formatter_functions.py | 17 +-- src/calibre/utils/html2text.py | 5 +- src/calibre/utils/icu.py | 5 +- src/calibre/utils/icu_test.py | 3 +- src/calibre/utils/ipc/launch.py | 12 +- src/calibre/utils/ipc/proxy.py | 5 +- src/calibre/utils/ipc/simple_worker.py | 3 +- src/calibre/utils/linux_trash.py | 4 +- src/calibre/utils/localization.py | 7 +- src/calibre/utils/logging.py | 3 +- src/calibre/utils/matcher.py | 8 +- src/calibre/utils/open_with/osx.py | 5 +- src/calibre/utils/podofo/__init__.py | 6 +- src/calibre/utils/search_query_parser.py | 15 ++- src/calibre/utils/serialize.py | 4 +- src/calibre/utils/smtplib.py | 4 +- src/calibre/utils/soupparser.py | 3 +- src/calibre/utils/titlecase.py | 3 +- src/calibre/utils/zipfile.py | 11 +- src/calibre/web/feeds/__init__.py | 17 +-- src/calibre/web/feeds/news.py | 19 +-- src/calibre/web/feeds/recipes/__init__.py | 4 +- src/calibre/web/feeds/recipes/collection.py | 9 +- src/calibre/web/feeds/recipes/model.py | 6 +- src/calibre/web/feeds/templates.py | 3 +- src/calibre/web/fetch/simple.py | 11 +- src/polyglot/builtins.py | 6 + src/templite/__init__.py | 4 +- 386 files changed, 2012 insertions(+), 1743 deletions(-) diff --git a/setup/parallel_build.py b/setup/parallel_build.py index 0dae90fc26..09c8d80cb2 100644 --- a/setup/parallel_build.py +++ b/setup/parallel_build.py @@ -12,6 +12,7 @@ from functools import partial from contextlib import closing from setup import iswindows +from polyglot.builtins import unicode_type if iswindows: from ctypes import windll, Structure, POINTER, c_size_t @@ -52,7 +53,7 @@ def run_worker(job, decorate=True): try: p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) except Exception as err: - return False, human_text, unicode(err) + return False, human_text, unicode_type(err) stdout, stderr = p.communicate() if stdout: stdout = stdout.decode('utf-8') diff --git a/setup/resources.py b/setup/resources.py index 1554b5551f..e12cd18223 100644 --- a/setup/resources.py +++ b/setup/resources.py @@ -12,7 +12,7 @@ from itertools import chain is_ci = os.environ.get('CI', '').lower() == 'true' from setup import Command, basenames, __appname__, download_securely -from polyglot.builtins import itervalues, iteritems +from polyglot.builtins import codepoint_to_chr, itervalues, iteritems def get_opts_from_parser(parser): @@ -173,7 +173,7 @@ class Kakasi(Command): # {{{ continue if re.match(r"^$",line): continue - pair = re.sub(r'\\u([0-9a-fA-F]{4})', lambda x:unichr(int(x.group(1),16)), line) + pair = re.sub(r'\\u([0-9a-fA-F]{4})', lambda x:codepoint_to_chr(int(x.group(1),16)), line) dic[pair[0]] = pair[1] from calibre.utils.serialize import msgpack_dumps with open(dst, 'wb') as f: diff --git a/setup/translations.py b/setup/translations.py index 5549bffd7f..ac8684d820 100644 --- a/setup/translations.py +++ b/setup/translations.py @@ -13,7 +13,7 @@ from functools import partial from setup import Command, __appname__, __version__, require_git_master, build_cache_dir, edit_file from setup.parallel_build import parallel_check_output -from polyglot.builtins import iteritems +from polyglot.builtins import codepoint_to_chr, iteritems is_ci = os.environ.get('CI', '').lower() == 'true' @@ -82,7 +82,7 @@ class POT(Command): # {{{ ans = [] for lineno, msg in msgs: ans.append('#: %s:%d'%(path, lineno)) - slash = unichr(92) + slash = codepoint_to_chr(92) msg = msg.replace(slash, slash*2).replace('"', r'\"').replace('\n', r'\n').replace('\r', r'\r').replace('\t', r'\t') ans.append('msgid "%s"'%msg) diff --git a/src/calibre/__init__.py b/src/calibre/__init__.py index 6665dd38db..879cdced87 100644 --- a/src/calibre/__init__.py +++ b/src/calibre/__init__.py @@ -4,7 +4,7 @@ __copyright__ = '2008, Kovid Goyal <kovid@kovidgoyal.net>' __docformat__ = 'restructuredtext en' import sys, os, re, time, random, warnings -from polyglot.builtins import builtins +from polyglot.builtins import builtins, codepoint_to_chr, unicode_type builtins.__dict__['dynamic_property'] = lambda func: func(None) from math import floor from functools import partial @@ -77,7 +77,7 @@ def get_types_map(): def to_unicode(raw, encoding='utf-8', errors='strict'): - if isinstance(raw, unicode): + if isinstance(raw, unicode_type): return raw return raw.decode(encoding, errors) @@ -113,7 +113,7 @@ def confirm_config_name(name): _filename_sanitize = re.compile(r'[\xae\0\\|\?\*<":>\+/]') _filename_sanitize_unicode = frozenset([u'\\', u'|', u'?', u'*', u'<', - u'"', u':', u'>', u'+', u'/'] + list(map(unichr, xrange(32)))) + u'"', u':', u'>', u'+', u'/'] + list(map(codepoint_to_chr, xrange(32)))) def sanitize_file_name(name, substitute='_', as_unicode=False): @@ -126,7 +126,7 @@ def sanitize_file_name(name, substitute='_', as_unicode=False): *NOTE:* This function always returns byte strings, not unicode objects. The byte strings are encoded in the filesystem encoding of the platform, or UTF-8. ''' - if isinstance(name, unicode): + if isinstance(name, unicode_type): name = name.encode(filesystem_encoding, 'ignore') one = _filename_sanitize.sub(substitute, name) one = re.sub(r'\s', ' ', one).strip() @@ -198,7 +198,7 @@ def prints(*args, **kwargs): safe_encode = kwargs.get('safe_encode', False) count = 0 for i, arg in enumerate(args): - if isinstance(arg, unicode): + if isinstance(arg, unicode_type): if iswindows: from calibre.utils.terminal import Detect cs = Detect(file) @@ -222,8 +222,8 @@ def prints(*args, **kwargs): try: arg = str(arg) except ValueError: - arg = unicode(arg) - if isinstance(arg, unicode): + arg = unicode_type(arg) + if isinstance(arg, unicode_type): try: arg = arg.encode(enc) except UnicodeEncodeError: @@ -288,7 +288,7 @@ def load_library(name, cdll): def filename_to_utf8(name): '''Return C{name} encoded in utf8. Unhandled characters are replaced. ''' - if isinstance(name, unicode): + if isinstance(name, unicode_type): return name.encode('utf8') codec = 'cp1252' if iswindows else 'utf8' return name.decode(codec, 'replace').encode('utf8') @@ -557,7 +557,7 @@ def strftime(fmt, t=None): else: ans = time.strftime(fmt, t).decode(preferred_encoding, 'replace') if early_year: - ans = ans.replace(u'_early year hack##', unicode(orig_year)) + ans = ans.replace(u'_early year hack##', unicode_type(orig_year)) return ans @@ -669,7 +669,7 @@ def force_unicode(obj, enc=preferred_encoding): def as_unicode(obj, enc=preferred_encoding): if not isbytestring(obj): try: - obj = unicode(obj) + obj = unicode_type(obj) except: try: obj = str(obj) diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 1317ea6873..cff793cd1c 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -2,12 +2,12 @@ # vim:fileencoding=utf-8 # License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net> from __future__ import print_function -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type import sys, locale, codecs, os, importlib, collections __appname__ = u'calibre' numeric_version = (3, 40, 1) -__version__ = u'.'.join(map(unicode, numeric_version)) +__version__ = u'.'.join(map(unicode_type, numeric_version)) __author__ = u"Kovid Goyal <kovid@kovidgoyal.net>" ''' @@ -300,7 +300,7 @@ def get_portable_base(): def get_unicode_windows_env_var(name): getenv = plugins['winutil'][0].getenv - return getenv(unicode(name)) + return getenv(unicode_type(name)) def get_windows_username(): diff --git a/src/calibre/customize/__init__.py b/src/calibre/customize/__init__.py index 2b9c42e49f..2a6135fae5 100644 --- a/src/calibre/customize/__init__.py +++ b/src/calibre/customize/__init__.py @@ -7,6 +7,7 @@ import os, sys, zipfile, importlib from calibre.constants import numeric_version, iswindows, isosx from calibre.ptempfile import PersistentTemporaryFile +from polyglot.builtins import unicode_type platform = 'linux' if iswindows: @@ -195,7 +196,7 @@ class Plugin(object): # {{{ config_dialog.exec_() if config_dialog.result() == QDialog.Accepted: - sc = unicode(sc.text()).strip() + sc = unicode_type(sc.text()).strip() customize_plugin(self, sc) geom = bytearray(config_dialog.saveGeometry()) diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index 871f4bf516..bba5b1e83b 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -10,6 +10,7 @@ from calibre.customize import (FileTypePlugin, MetadataReaderPlugin, from calibre.constants import numeric_version from calibre.ebooks.metadata.archive import ArchiveExtract, get_comic_metadata from calibre.ebooks.html.to_zip import HTML2ZIP +from polyglot.builtins import unicode_type plugins = [] @@ -64,23 +65,23 @@ class TXT2TXTZ(FileTypePlugin): images = [] # Textile - for m in re.finditer(unicode(r'(?mu)(?:[\[{])?\!(?:\. )?(?P<path>[^\s(!]+)\s?(?:\(([^\)]+)\))?\!(?::(\S+))?(?:[\]}]|(?=\s|$))'), txt): + for m in re.finditer(unicode_type(r'(?mu)(?:[\[{])?\!(?:\. )?(?P<path>[^\s(!]+)\s?(?:\(([^\)]+)\))?\!(?::(\S+))?(?:[\]}]|(?=\s|$))'), txt): path = m.group('path') if path and not os.path.isabs(path) and guess_type(path)[0] in OEB_IMAGES and os.path.exists(os.path.join(base_dir, path)): images.append(path) # Markdown inline - for m in re.finditer(unicode(r'(?mu)\!\[([^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*)\]\s*\((?P<path>[^\)]*)\)'), txt): # noqa + for m in re.finditer(unicode_type(r'(?mu)\!\[([^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*)\]\s*\((?P<path>[^\)]*)\)'), txt): # noqa path = m.group('path') if path and not os.path.isabs(path) and guess_type(path)[0] in OEB_IMAGES and os.path.exists(os.path.join(base_dir, path)): images.append(path) # Markdown reference refs = {} - for m in re.finditer(unicode(r'(?mu)^(\ ?\ ?\ ?)\[(?P<id>[^\]]*)\]:\s*(?P<path>[^\s]*)$'), txt): + for m in re.finditer(unicode_type(r'(?mu)^(\ ?\ ?\ ?)\[(?P<id>[^\]]*)\]:\s*(?P<path>[^\s]*)$'), txt): if m.group('id') and m.group('path'): refs[m.group('id')] = m.group('path') - for m in re.finditer(unicode(r'(?mu)\!\[([^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*)\]\s*\[(?P<id>[^\]]*)\]'), txt): # noqa + for m in re.finditer(unicode_type(r'(?mu)\!\[([^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*(\[[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*\])*[^\]\[]*)\]\s*\[(?P<id>[^\]]*)\]'), txt): # noqa path = refs.get(m.group('id'), None) if path and not os.path.isabs(path) and guess_type(path)[0] in OEB_IMAGES and os.path.exists(os.path.join(base_dir, path)): images.append(path) diff --git a/src/calibre/customize/conversion.py b/src/calibre/customize/conversion.py index 730f866dec..14fb114cfb 100644 --- a/src/calibre/customize/conversion.py +++ b/src/calibre/customize/conversion.py @@ -6,6 +6,7 @@ import re, os, shutil from calibre import CurrentDir from calibre.customize import Plugin +from polyglot.builtins import unicode_type class ConversionOption(object): @@ -79,7 +80,7 @@ class OptionRecommendation(object): self.option.choices: raise ValueError('OpRec: %s: Recommended value not in choices'% self.option.name) - if not (isinstance(self.recommended_value, (int, float, str, unicode)) or self.recommended_value is None): + if not (isinstance(self.recommended_value, (int, float, str, unicode_type)) or self.recommended_value is None): raise ValueError('OpRec: %s:'%self.option.name + repr( self.recommended_value) + ' is not a string or a number') @@ -340,7 +341,7 @@ class OutputFormatPlugin(Plugin): @property def is_periodical(self): return self.oeb.metadata.publication_type and \ - unicode(self.oeb.metadata.publication_type[0]).startswith('periodical:') + unicode_type(self.oeb.metadata.publication_type[0]).startswith('periodical:') def specialize_options(self, log, opts, input_fmt): ''' diff --git a/src/calibre/customize/zipplugin.py b/src/calibre/customize/zipplugin.py index 3c82c72640..821046b169 100644 --- a/src/calibre/customize/zipplugin.py +++ b/src/calibre/customize/zipplugin.py @@ -2,7 +2,7 @@ # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import (unicode_literals, division, absolute_import, print_function) -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>' @@ -216,7 +216,7 @@ class PluginLoader(object): if ans.minimum_calibre_version > numeric_version: raise InvalidPlugin( 'The plugin at %s needs a version of calibre >= %s' % - (as_unicode(path_to_zip_file), '.'.join(map(unicode, + (as_unicode(path_to_zip_file), '.'.join(map(unicode_type, ans.minimum_calibre_version)))) if platform not in ans.supported_platforms: @@ -231,7 +231,7 @@ class PluginLoader(object): raise def _locate_code(self, zf, path_to_zip_file): - names = [x if isinstance(x, unicode) else x.decode('utf-8') for x in + names = [x if isinstance(x, unicode_type) else x.decode('utf-8') for x in zf.namelist()] names = [x[1:] if x[0] == '/' else x for x in names] diff --git a/src/calibre/db/adding.py b/src/calibre/db/adding.py index 5d4ccfbd3a..44fa239ed5 100644 --- a/src/calibre/db/adding.py +++ b/src/calibre/db/adding.py @@ -8,7 +8,7 @@ __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' import os, time, re from collections import defaultdict -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from contextlib import contextmanager from functools import partial @@ -69,7 +69,7 @@ def metadata_extensions(): # but not actually added) global _metadata_extensions if _metadata_extensions is None: - _metadata_extensions = frozenset(map(unicode, BOOK_EXTENSIONS)) | {'opf'} + _metadata_extensions = frozenset(map(unicode_type, BOOK_EXTENSIONS)) | {'opf'} return _metadata_extensions @@ -143,7 +143,7 @@ def find_books_in_directory(dirpath, single_book_per_directory, compiled_rules=( for path in listdir_impl(dirpath, sort_by_mtime=True): key, ext = splitext(path) if allow_path(path, ext, compiled_rules): - books[icu_lower(key) if isinstance(key, unicode) else key.lower()][ext] = path + books[icu_lower(key) if isinstance(key, unicode_type) else key.lower()][ext] = path for formats in books.itervalues(): if formats_ok(formats): diff --git a/src/calibre/db/backend.py b/src/calibre/db/backend.py index aac1880619..c1d7e6b9b1 100644 --- a/src/calibre/db/backend.py +++ b/src/calibre/db/backend.py @@ -12,7 +12,7 @@ import os, shutil, uuid, json, glob, time, hashlib, errno, sys from functools import partial import apsw -from polyglot.builtins import reraise +from polyglot.builtins import unicode_type, reraise from calibre import isbytestring, force_unicode, prints, as_unicode from calibre.constants import (iswindows, filesystem_encoding, @@ -93,7 +93,7 @@ class DBPrefs(dict): # {{{ dict.__setitem__(self, key, val) def raw_to_object(self, raw): - if not isinstance(raw, unicode): + if not isinstance(raw, unicode_type): raw = raw.decode(preferred_encoding) return json.loads(raw, object_hook=from_json) @@ -561,10 +561,10 @@ class DB(object): prints('found user category case overlap', catmap[uc]) cat = catmap[uc][0] suffix = 1 - while icu_lower((cat + unicode(suffix))) in catmap: + while icu_lower((cat + unicode_type(suffix))) in catmap: suffix += 1 - prints('Renaming user category %s to %s'%(cat, cat+unicode(suffix))) - user_cats[cat + unicode(suffix)] = user_cats[cat] + prints('Renaming user category %s to %s'%(cat, cat+unicode_type(suffix))) + user_cats[cat + unicode_type(suffix)] = user_cats[cat] del user_cats[cat] cats_changed = True if cats_changed: @@ -670,23 +670,23 @@ class DB(object): if d['is_multiple']: if x is None: return [] - if isinstance(x, (str, unicode, bytes)): + if isinstance(x, (str, unicode_type, bytes)): x = x.split(d['multiple_seps']['ui_to_list']) x = [y.strip() for y in x if y.strip()] x = [y.decode(preferred_encoding, 'replace') if not isinstance(y, - unicode) else y for y in x] + unicode_type) else y for y in x] return [u' '.join(y.split()) for y in x] else: - return x if x is None or isinstance(x, unicode) else \ + return x if x is None or isinstance(x, unicode_type) else \ x.decode(preferred_encoding, 'replace') def adapt_datetime(x, d): - if isinstance(x, (str, unicode, bytes)): + if isinstance(x, (str, unicode_type, bytes)): x = parse_date(x, assume_utc=False, as_utc=False) return x def adapt_bool(x, d): - if isinstance(x, (str, unicode, bytes)): + if isinstance(x, (str, unicode_type, bytes)): x = x.lower() if x == 'true': x = True @@ -707,7 +707,7 @@ class DB(object): def adapt_number(x, d): if x is None: return None - if isinstance(x, (str, unicode, bytes)): + if isinstance(x, (str, unicode_type, bytes)): if x.lower() == 'none': return None if d['datatype'] == 'int': @@ -1239,7 +1239,7 @@ class DB(object): return self._library_id_ def fset(self, val): - self._library_id_ = unicode(val) + self._library_id_ = unicode_type(val) self.execute(''' DELETE FROM library_id; INSERT INTO library_id (uuid) VALUES (?); @@ -1715,7 +1715,7 @@ class DB(object): [(book_id, fmt.upper()) for book_id in book_ids]) def set_conversion_options(self, options, fmt): - options = [(book_id, fmt.upper(), buffer(pickle_binary_string(data.encode('utf-8') if isinstance(data, unicode) else data))) + options = [(book_id, fmt.upper(), buffer(pickle_binary_string(data.encode('utf-8') if isinstance(data, unicode_type) else data))) for book_id, data in options.iteritems()] self.executemany('INSERT OR REPLACE INTO conversion_options(book,format,data) VALUES (?,?,?)', options) @@ -1754,7 +1754,7 @@ class DB(object): copyfile_using_links(src, dest, dest_is_dir=False) old_files.add(src) x = path_map[x] - if not isinstance(x, unicode): + if not isinstance(x, unicode_type): x = x.decode(filesystem_encoding, 'replace') progress(x, i+1, total) diff --git a/src/calibre/db/cache.py b/src/calibre/db/cache.py index 50de272d47..b1cd08af24 100644 --- a/src/calibre/db/cache.py +++ b/src/calibre/db/cache.py @@ -11,7 +11,7 @@ import os, traceback, random, shutil, operator from io import BytesIO from collections import defaultdict, Set, MutableSet from functools import wraps, partial -from polyglot.builtins import zip +from polyglot.builtins import unicode_type, zip from time import time from calibre import isbytestring, as_unicode @@ -528,14 +528,14 @@ class Cache(object): @read_api def get_item_id(self, field, item_name): ' Return the item id for item_name (case-insensitive) ' - rmap = {icu_lower(v) if isinstance(v, unicode) else v:k for k, v in self.fields[field].table.id_map.iteritems()} - return rmap.get(icu_lower(item_name) if isinstance(item_name, unicode) else item_name, None) + rmap = {icu_lower(v) if isinstance(v, unicode_type) else v:k for k, v in self.fields[field].table.id_map.iteritems()} + return rmap.get(icu_lower(item_name) if isinstance(item_name, unicode_type) else item_name, None) @read_api def get_item_ids(self, field, item_names): ' Return the item id for item_name (case-insensitive) ' - rmap = {icu_lower(v) if isinstance(v, unicode) else v:k for k, v in self.fields[field].table.id_map.iteritems()} - return {name:rmap.get(icu_lower(name) if isinstance(name, unicode) else name, None) for name in item_names} + rmap = {icu_lower(v) if isinstance(v, unicode_type) else v:k for k, v in self.fields[field].table.id_map.iteritems()} + return {name:rmap.get(icu_lower(name) if isinstance(name, unicode_type) else name, None) for name in item_names} @read_api def author_data(self, author_ids=None): diff --git a/src/calibre/db/categories.py b/src/calibre/db/categories.py index 22bb84694e..377eab54ba 100644 --- a/src/calibre/db/categories.py +++ b/src/calibre/db/categories.py @@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en' import copy from functools import partial -from polyglot.builtins import map +from polyglot.builtins import unicode_type, map from calibre.ebooks.metadata import author_to_author_sort from calibre.utils.config_base import tweaks @@ -47,7 +47,7 @@ class Tag(object): return u'%s:%s:%s:%s:%s'%(self.name, self.count, self.id, self.state, self.category) def __str__(self): - return unicode(self).encode('utf-8') + return unicode_type(self).encode('utf-8') def __repr__(self): return str(self) @@ -101,8 +101,8 @@ def clean_user_categories(dbcache): if len(comps) == 0: i = 1 while True: - if unicode(i) not in user_cats: - new_cats[unicode(i)] = user_cats[k] + if unicode_type(i) not in user_cats: + new_cats[unicode_type(i)] = user_cats[k] break i += 1 else: diff --git a/src/calibre/db/cli/cmd_list_categories.py b/src/calibre/db/cli/cmd_list_categories.py index 5fc526de35..0280455f66 100644 --- a/src/calibre/db/cli/cmd_list_categories.py +++ b/src/calibre/db/cli/cmd_list_categories.py @@ -10,6 +10,7 @@ from textwrap import TextWrapper from io import BytesIO from calibre import prints +from polyglot.builtins import unicode_type readonly = True version = 0 # change this if you change signature of implementation() @@ -79,7 +80,7 @@ def do_list(fields, data, opts): widths = list(map(lambda x: 0, fields)) for i in data: for j, field in enumerate(fields): - widths[j] = max(widths[j], max(len(field), len(unicode(i[field])))) + widths[j] = max(widths[j], max(len(field), len(unicode_type(i[field])))) screen_width = geometry()[0] if not screen_width: @@ -110,7 +111,7 @@ def do_list(fields, data, opts): for record in data: text = [ - wrappers[i].wrap(unicode(record[field])) + wrappers[i].wrap(unicode_type(record[field])) for i, field in enumerate(fields) ] lines = max(map(len, text)) @@ -129,7 +130,7 @@ def do_csv(fields, data, opts): for d in data: row = [d[f] for f in fields] csv_print.writerow([ - x if isinstance(x, bytes) else unicode(x).encode('utf-8') for x in row + x if isinstance(x, bytes) else unicode_type(x).encode('utf-8') for x in row ]) print(buf.getvalue()) @@ -164,11 +165,11 @@ def main(opts, args, dbctx): is_rating = category_metadata(category)['datatype'] == 'rating' for tag in category_data[category]: if is_rating: - tag.name = unicode(len(tag.name)) + tag.name = unicode_type(len(tag.name)) data.append({ 'category': category, 'tag_name': tag.name, - 'count': unicode(tag.count), + 'count': unicode_type(tag.count), 'rating': fmtr(tag.avg_rating), }) else: @@ -176,7 +177,7 @@ def main(opts, args, dbctx): data.append({ 'category': category, 'tag_name': _('CATEGORY ITEMS'), - 'count': unicode(len(category_data[category])), + 'count': unicode_type(len(category_data[category])), 'rating': '' }) diff --git a/src/calibre/db/cli/cmd_set_metadata.py b/src/calibre/db/cli/cmd_set_metadata.py index 89a19a1ac0..18a09bafb9 100644 --- a/src/calibre/db/cli/cmd_set_metadata.py +++ b/src/calibre/db/cli/cmd_set_metadata.py @@ -11,6 +11,7 @@ from calibre.ebooks.metadata.book.base import field_from_string from calibre.ebooks.metadata.book.serialize import read_cover from calibre.ebooks.metadata.opf import get_metadata from calibre.srv.changes import metadata +from polyglot.builtins import unicode_type readonly = False version = 0 # change this if you change signature of implementation() @@ -181,5 +182,5 @@ def main(opts, args, dbctx): if not final_mi: raise SystemExit(_('No book with id: %s in the database') % book_id) - prints(unicode(final_mi)) + prints(unicode_type(final_mi)) return 0 diff --git a/src/calibre/db/cli/cmd_show_metadata.py b/src/calibre/db/cli/cmd_show_metadata.py index 8bba0688ba..a0a84f71d4 100644 --- a/src/calibre/db/cli/cmd_show_metadata.py +++ b/src/calibre/db/cli/cmd_show_metadata.py @@ -9,6 +9,7 @@ import sys from calibre import prints from calibre.ebooks.metadata.opf2 import OPFCreator +from polyglot.builtins import unicode_type readonly = True version = 0 # change this if you change signature of implementation() @@ -52,6 +53,6 @@ def main(opts, args, dbctx): mi = OPFCreator(os.getcwdu(), mi) mi.render(sys.stdout) else: - prints(unicode(mi)) + prints(unicode_type(mi)) return 0 diff --git a/src/calibre/db/lazy.py b/src/calibre/db/lazy.py index 25ea870ba8..79c552d8db 100644 --- a/src/calibre/db/lazy.py +++ b/src/calibre/db/lazy.py @@ -15,6 +15,7 @@ from copy import deepcopy from calibre.ebooks.metadata.book.base import Metadata, SIMPLE_GET, TOP_LEVEL_IDENTIFIERS, NULL_VALUES, ALL_METADATA_FIELDS from calibre.ebooks.metadata.book.formatter import SafeFormat from calibre.utils.date import utcnow +from polyglot.builtins import unicode_type # Lazy format metadata retrieval {{{ ''' @@ -46,7 +47,7 @@ class MutableBase(object): @resolved def __unicode__(self): - return unicode(self._values) + return unicode_type(self._values) @resolved def __len__(self): diff --git a/src/calibre/db/schema_upgrades.py b/src/calibre/db/schema_upgrades.py index decb6278bc..7ad9d2d7c9 100644 --- a/src/calibre/db/schema_upgrades.py +++ b/src/calibre/db/schema_upgrades.py @@ -11,6 +11,7 @@ import os from calibre import prints from calibre.utils.date import isoformat, DEFAULT_DATE +from polyglot.builtins import unicode_type class SchemaUpgrade(object): @@ -601,7 +602,7 @@ class SchemaUpgrade(object): id_ = str(id_) fname = custom_recipe_filename(id_, title) custom_recipes[id_] = (title, fname) - if isinstance(script, unicode): + if isinstance(script, unicode_type): script = script.encode('utf-8') with open(os.path.join(bdir, fname), 'wb') as f: f.write(script) diff --git a/src/calibre/db/search.py b/src/calibre/db/search.py index 947429d2de..175cd36d6e 100644 --- a/src/calibre/db/search.py +++ b/src/calibre/db/search.py @@ -19,6 +19,7 @@ from calibre.utils.date import parse_date, UNDEFINED_DATE, now, dt_as_local from calibre.utils.icu import primary_contains, sort_key from calibre.utils.localization import lang_map, canonicalize_lang from calibre.utils.search_query_parser import SearchQueryParser, ParseException +from polyglot.builtins import unicode_type CONTAINS_MATCH = 0 EQUALS_MATCH = 1 @@ -148,7 +149,7 @@ class DateSearch(object): # {{{ if query == 'false': for v, book_ids in field_iter(): - if isinstance(v, (str, unicode)): + if isinstance(v, (str, unicode_type)): v = parse_date(v) if v is None or v <= UNDEFINED_DATE: matches |= book_ids @@ -156,7 +157,7 @@ class DateSearch(object): # {{{ if query == 'true': for v, book_ids in field_iter(): - if isinstance(v, (str, unicode)): + if isinstance(v, (str, unicode_type)): v = parse_date(v) if v is not None and v > UNDEFINED_DATE: matches |= book_ids @@ -198,7 +199,7 @@ class DateSearch(object): # {{{ field_count = query.count('/') + 1 for v, book_ids in field_iter(): - if isinstance(v, (str, unicode)): + if isinstance(v, (str, unicode_type)): v = parse_date(v) if v is not None and relop(dt_as_local(v), qd, field_count): matches |= book_ids @@ -407,7 +408,7 @@ class SavedSearchQueries(object): # {{{ return self._db() def force_unicode(self, x): - if not isinstance(x, unicode): + if not isinstance(x, unicode_type): x = x.decode(preferred_encoding, 'replace') return x diff --git a/src/calibre/db/utils.py b/src/calibre/db/utils.py index b60d0e9420..99f281ad59 100644 --- a/src/calibre/db/utils.py +++ b/src/calibre/db/utils.py @@ -9,7 +9,7 @@ __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' import os, errno, cPickle, sys, re from locale import localeconv from collections import OrderedDict, namedtuple -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from threading import Lock from calibre import as_unicode, prints @@ -19,7 +19,7 @@ from calibre.utils.localization import canonicalize_lang def force_to_bool(val): - if isinstance(val, (str, unicode)): + if isinstance(val, (str, unicode_type)): try: val = icu_lower(val) if not val: diff --git a/src/calibre/db/view.py b/src/calibre/db/view.py index ebe04aaac7..585d84d6cd 100644 --- a/src/calibre/db/view.py +++ b/src/calibre/db/view.py @@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en' import weakref, operator from functools import partial from itertools import izip, imap -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from calibre.ebooks.metadata import title_sort from calibre.utils.config_base import tweaks, prefs @@ -374,7 +374,7 @@ class View(object): self.marked_ids = dict.fromkeys(id_dict, u'true') else: # Ensure that all the items in the dict are text - self.marked_ids = dict(izip(id_dict.iterkeys(), imap(unicode, + self.marked_ids = dict(izip(id_dict.iterkeys(), imap(unicode_type, id_dict.itervalues()))) # This invalidates all searches in the cache even though the cache may # be shared by multiple views. This is not ideal, but... @@ -432,4 +432,3 @@ class View(object): self._map_filtered = ids + self._map_filtered if prefs['mark_new_books']: self.toggle_marked_ids(ids) - diff --git a/src/calibre/db/write.py b/src/calibre/db/write.py index 3c7e09e24f..dc8caace86 100644 --- a/src/calibre/db/write.py +++ b/src/calibre/db/write.py @@ -10,18 +10,15 @@ __docformat__ = 'restructuredtext en' import re from functools import partial from datetime import datetime -from polyglot.builtins import zip +from polyglot.builtins import unicode_type, zip -from calibre.constants import preferred_encoding, ispy3 +from calibre.constants import preferred_encoding from calibre.ebooks.metadata import author_to_author_sort, title_sort from calibre.utils.date import ( parse_only_date, parse_date, UNDEFINED_DATE, isoformat, is_date_undefined) from calibre.utils.localization import canonicalize_lang from calibre.utils.icu import strcmp -if ispy3: - unicode = str - # Convert data into values suitable for the db {{{ @@ -32,7 +29,7 @@ def sqlite_datetime(x): def single_text(x): if x is None: return x - if not isinstance(x, unicode): + if not isinstance(x, unicode_type): x = x.decode(preferred_encoding, 'replace') x = x.strip() return x if x else None @@ -60,7 +57,7 @@ def multiple_text(sep, ui_sep, x): return () if isinstance(x, bytes): x = x.decode(preferred_encoding, 'replace') - if isinstance(x, unicode): + if isinstance(x, unicode_type): x = x.split(sep) else: x = (y.decode(preferred_encoding, 'replace') if isinstance(y, bytes) @@ -72,7 +69,7 @@ def multiple_text(sep, ui_sep, x): def adapt_datetime(x): - if isinstance(x, (unicode, bytes)): + if isinstance(x, (unicode_type, bytes)): x = parse_date(x, assume_utc=False, as_utc=False) if x and is_date_undefined(x): x = UNDEFINED_DATE @@ -80,7 +77,7 @@ def adapt_datetime(x): def adapt_date(x): - if isinstance(x, (unicode, bytes)): + if isinstance(x, (unicode_type, bytes)): x = parse_only_date(x) if x is None or is_date_undefined(x): x = UNDEFINED_DATE @@ -90,14 +87,14 @@ def adapt_date(x): def adapt_number(typ, x): if x is None: return None - if isinstance(x, (unicode, bytes)): + if isinstance(x, (unicode_type, bytes)): if not x or x.lower() == 'none': return None return typ(x) def adapt_bool(x): - if isinstance(x, (unicode, bytes)): + if isinstance(x, (unicode_type, bytes)): x = x.lower() if x == 'true': x = True diff --git a/src/calibre/devices/jetbook/driver.py b/src/calibre/devices/jetbook/driver.py index ffceb338e8..e6fedf3589 100644 --- a/src/calibre/devices/jetbook/driver.py +++ b/src/calibre/devices/jetbook/driver.py @@ -14,6 +14,7 @@ import sys from calibre.devices.usbms.driver import USBMS from calibre.ebooks.metadata import string_to_authors +from polyglot.builtins import unicode_type class JETBOOK(USBMS): @@ -64,7 +65,7 @@ class JETBOOK(USBMS): def check_unicode(txt): txt = txt.replace('_', ' ') - if not isinstance(txt, unicode): + if not isinstance(txt, unicode_type): return txt.decode(sys.getfilesystemencoding(), 'replace') return txt diff --git a/src/calibre/devices/kindle/driver.py b/src/calibre/devices/kindle/driver.py index 6358c96a09..2d713c1177 100644 --- a/src/calibre/devices/kindle/driver.py +++ b/src/calibre/devices/kindle/driver.py @@ -15,6 +15,7 @@ from calibre.constants import DEBUG from calibre.devices.kindle.bookmark import Bookmark from calibre.devices.usbms.driver import USBMS from calibre import strftime, fsync, prints +from polyglot.builtins import unicode_type ''' Notes on collections: @@ -113,7 +114,7 @@ class KINDLE(USBMS): match = cls.WIRELESS_FILE_NAME_PATTERN.match(os.path.basename(path)) if match is not None: mi.title = match.group('title') - if not isinstance(mi.title, unicode): + if not isinstance(mi.title, unicode_type): mi.title = mi.title.decode(sys.getfilesystemencoding(), 'replace') return mi @@ -291,9 +292,9 @@ class KINDLE(USBMS): hrTag['class'] = 'annotations_divider' user_notes_soup.insert(0, hrTag) - mi.comments += unicode(user_notes_soup.prettify()) + mi.comments += unicode_type(user_notes_soup.prettify()) else: - mi.comments = unicode(user_notes_soup.prettify()) + mi.comments = unicode_type(user_notes_soup.prettify()) # Update library comments db.set_comment(db_id, mi.comments) @@ -547,7 +548,7 @@ class KINDLE2(KINDLE): cust_col_name = opts.extra_customization[self.OPT_APNX_METHOD_COL] if cust_col_name: try: - temp = unicode(metadata.get(cust_col_name)).lower() + temp = unicode_type(metadata.get(cust_col_name)).lower() if temp in self.EXTRA_CUSTOMIZATION_CHOICES[self.OPT_APNX_METHOD]: method = temp else: diff --git a/src/calibre/devices/kobo/books.py b/src/calibre/devices/kobo/books.py index 3307e6b83d..91d50c115d 100644 --- a/src/calibre/devices/kobo/books.py +++ b/src/calibre/devices/kobo/books.py @@ -14,6 +14,7 @@ from calibre.devices.usbms.books import CollectionsBookList from calibre.utils.config_base import prefs from calibre.devices.usbms.driver import debug_print from calibre.ebooks.metadata import author_to_author_sort +from polyglot.builtins import unicode_type class Book(Book_): @@ -95,7 +96,7 @@ class Book(Book_): ans = [u"Kobo metadata:"] def fmt(x, y): - ans.append(u'%-20s: %s'%(unicode(x), unicode(y))) + ans.append(u'%-20s: %s'%(unicode_type(x), unicode_type(y))) if self.contentID: fmt('Content ID', self.contentID) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 57de76ec7c..7586f5c73a 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -32,6 +32,7 @@ from calibre import prints, fsync from calibre.ptempfile import PersistentTemporaryFile from calibre.constants import DEBUG from calibre.utils.config_base import prefs +from polyglot.builtins import unicode_type EPUB_EXT = '.epub' KEPUB_EXT = '.kepub' @@ -43,7 +44,7 @@ def qhash(inputstr): instr = b"" if isinstance(inputstr, bytes): instr = inputstr - elif isinstance(inputstr, unicode): + elif isinstance(inputstr, unicode_type): instr = inputstr.encode("utf8") else: return -1 @@ -1323,9 +1324,9 @@ class KOBO(USBMS): hrTag['class'] = 'annotations_divider' user_notes_soup.insert(0, hrTag) - mi.comments += unicode(user_notes_soup.prettify()) + mi.comments += unicode_type(user_notes_soup.prettify()) else: - mi.comments = unicode(user_notes_soup.prettify()) + mi.comments = unicode_type(user_notes_soup.prettify()) # Update library comments db.set_comment(db_id, mi.comments) @@ -1824,7 +1825,7 @@ class KOBOTOUCH(KOBO): bookshelves.append(row['ShelfName']) cursor.close() -# debug_print("KoboTouch:get_bookshelvesforbook - count bookshelves=" + unicode(count_bookshelves)) +# debug_print("KoboTouch:get_bookshelvesforbook - count bookshelves=" + unicode_type(count_bookshelves)) return bookshelves self.debug_index = 0 @@ -2394,7 +2395,7 @@ class KOBOTOUCH(KOBO): if self.manage_collections: if collections: - # debug_print("KoboTouch:update_device_database_collections - length collections=" + unicode(len(collections))) + # debug_print("KoboTouch:update_device_database_collections - length collections=" + unicode_type(len(collections))) # Need to reset the collections outside the particular loops # otherwise the last item will not be removed @@ -2834,7 +2835,7 @@ class KOBOTOUCH(KOBO): # count_bookshelves = i + 1 cursor.close() -# debug_print("KoboTouch:get_bookshelflist - count bookshelves=" + unicode(count_bookshelves)) +# debug_print("KoboTouch:get_bookshelflist - count bookshelves=" + unicode_type(count_bookshelves)) return bookshelves @@ -2918,7 +2919,7 @@ class KOBOTOUCH(KOBO): cursor.execute(addquery, add_values) elif result['_IsDeleted'] == 'true': debug_print("KoboTouch:check_for_bookshelf - Shelf '%s' is deleted - undeleting. result['_IsDeleted']='%s'" % ( - bookshelf_name, unicode(result['_IsDeleted']))) + bookshelf_name, unicode_type(result['_IsDeleted']))) cursor.execute(updatequery, test_values) cursor.close() diff --git a/src/calibre/devices/kobo/kobotouch_config.py b/src/calibre/devices/kobo/kobotouch_config.py index f9fdac53c6..ac7d9482c8 100644 --- a/src/calibre/devices/kobo/kobotouch_config.py +++ b/src/calibre/devices/kobo/kobotouch_config.py @@ -16,6 +16,7 @@ from calibre.gui2.device_drivers.tabbed_device_config import TabbedDeviceConfig, from calibre.devices.usbms.driver import debug_print from calibre.gui2 import error_dialog from calibre.gui2.dialogs.template_dialog import TemplateDialog +from polyglot.builtins import unicode_type def wrap_msg(msg): @@ -122,7 +123,7 @@ class KOBOTOUCHConfig(TabbedDeviceConfig): p['support_newer_firmware'] = self.support_newer_firmware p['debugging_title'] = self.debugging_title - p['driver_version'] = '.'.join([unicode(i) for i in self.device.version]) + p['driver_version'] = '.'.join([unicode_type(i) for i in self.device.version]) return p @@ -397,7 +398,7 @@ class AdvancedGroupBox(DeviceOptionsGroupBox): 'to perform full read-write functionality - Here be Dragons!! ' 'Enable only if you are comfortable with restoring your kobo ' 'to factory defaults and testing software. ' - 'This driver supports firmware V2.x.x and DBVersion up to ') + unicode( + 'This driver supports firmware V2.x.x and DBVersion up to ') + unicode_type( device.supported_dbversion), device.get_pref('support_newer_firmware') ) @@ -555,7 +556,7 @@ class TemplateConfig(QWidget): # {{{ @property def template(self): - return unicode(self.t.text()).strip() + return unicode_type(self.t.text()).strip() @template.setter def template(self, template): @@ -577,7 +578,7 @@ class TemplateConfig(QWidget): # {{{ except Exception as err: error_dialog(self, _('Invalid template'), '<p>'+_('The template "%s" is invalid:')%tmpl + - '<br>'+unicode(err), show=True) + '<br>'+unicode_type(err), show=True) return False # }}} diff --git a/src/calibre/devices/mtp/driver.py b/src/calibre/devices/mtp/driver.py index 272bca30e1..9f6383d546 100644 --- a/src/calibre/devices/mtp/driver.py +++ b/src/calibre/devices/mtp/driver.py @@ -18,6 +18,7 @@ from calibre.devices.mtp.base import debug from calibre.devices.mtp.defaults import DeviceDefaults from calibre.ptempfile import SpooledTemporaryFile, PersistentTemporaryDirectory from calibre.utils.filenames import shorten_components_to +from polyglot.builtins import unicode_type BASE = importlib.import_module('calibre.devices.mtp.%s.driver'%( 'windows' if iswindows else 'unix')).MTP_DEVICE @@ -75,7 +76,7 @@ class MTP_DEVICE(BASE): def is_folder_ignored(self, storage_or_storage_id, path, ignored_folders=None): - storage_id = unicode(getattr(storage_or_storage_id, 'object_id', + storage_id = unicode_type(getattr(storage_or_storage_id, 'object_id', storage_or_storage_id)) lpath = tuple(icu_lower(name) for name in path) if ignored_folders is None: @@ -166,14 +167,14 @@ class MTP_DEVICE(BASE): traceback.print_exc() dinfo = {} if dinfo.get('device_store_uuid', None) is None: - dinfo['device_store_uuid'] = unicode(uuid.uuid4()) + dinfo['device_store_uuid'] = unicode_type(uuid.uuid4()) if dinfo.get('device_name', None) is None: dinfo['device_name'] = self.current_friendly_name if name is not None: dinfo['device_name'] = name dinfo['location_code'] = location_code dinfo['last_library_uuid'] = getattr(self, 'current_library_uuid', None) - dinfo['calibre_version'] = '.'.join([unicode(i) for i in numeric_version]) + dinfo['calibre_version'] = '.'.join([unicode_type(i) for i in numeric_version]) dinfo['date_last_connected'] = isoformat(now()) dinfo['mtp_prefix'] = storage.storage_prefix raw = json.dumps(dinfo, default=to_json) diff --git a/src/calibre/devices/mtp/filesystem_cache.py b/src/calibre/devices/mtp/filesystem_cache.py index 4451540eea..f5a3ef690d 100644 --- a/src/calibre/devices/mtp/filesystem_cache.py +++ b/src/calibre/devices/mtp/filesystem_cache.py @@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en' import weakref, sys, json from collections import deque from operator import attrgetter -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from datetime import datetime from calibre import human_readable, prints, force_unicode @@ -74,7 +74,7 @@ class FileOrFolder(object): def __repr__(self): name = 'Folder' if self.is_folder else 'File' try: - path = unicode(self.full_path) + path = unicode_type(self.full_path) except: path = '' datum = 'size=%s'%(self.size) @@ -250,5 +250,3 @@ class FilesystemCache(object): return self.id_map[object_id] except KeyError: raise ValueError('No object found with MTP path: %s'%path) - - diff --git a/src/calibre/devices/mtp/unix/driver.py b/src/calibre/devices/mtp/unix/driver.py index 17284dd259..bff84a6320 100644 --- a/src/calibre/devices/mtp/unix/driver.py +++ b/src/calibre/devices/mtp/unix/driver.py @@ -17,6 +17,7 @@ from calibre.constants import plugins, islinux, isosx, ispy3 from calibre.ptempfile import SpooledTemporaryFile from calibre.devices.errors import OpenFailed, DeviceError, BlacklistedDevice, OpenActionNeeded from calibre.devices.mtp.base import MTPDeviceBase, synchronous, debug +from polyglot.builtins import unicode_type MTPDevice = namedtuple('MTPDevice', 'busnum devnum vendor_id product_id ' 'bcd serial manufacturer product') @@ -321,7 +322,7 @@ class MTP_DEVICE(MTPDeviceBase): storage.append({'id':sid, 'size':capacity, 'is_folder':True, 'name':name, 'can_delete':False, 'is_system':True}) - self._currently_getting_sid = unicode(sid) + self._currently_getting_sid = unicode_type(sid) items, errs = self.dev.get_filesystem(sid, partial(self._filesystem_callback, {})) all_items.extend(items), all_errs.extend(errs) @@ -373,7 +374,7 @@ class MTP_DEVICE(MTPDeviceBase): e = parent.folder_named(name) if e is not None: return e - ename = name.encode('utf-8') if isinstance(name, unicode) else name + ename = name.encode('utf-8') if isinstance(name, unicode_type) else name sid, pid = parent.storage_id, parent.object_id if pid == sid: pid = 0 @@ -396,7 +397,7 @@ class MTP_DEVICE(MTPDeviceBase): raise ValueError('Cannot upload file %s, it already exists'%( e.full_path,)) self.delete_file_or_folder(e) - ename = name.encode('utf-8') if isinstance(name, unicode) else name + ename = name.encode('utf-8') if isinstance(name, unicode_type) else name sid, pid = parent.storage_id, parent.object_id if pid == sid: pid = 0xFFFFFFFF diff --git a/src/calibre/devices/mtp/windows/driver.py b/src/calibre/devices/mtp/windows/driver.py index 859ff99ffa..23c445570b 100644 --- a/src/calibre/devices/mtp/windows/driver.py +++ b/src/calibre/devices/mtp/windows/driver.py @@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en' import time, threading, traceback from functools import wraps, partial -from polyglot.builtins import zip +from polyglot.builtins import unicode_type, zip from itertools import chain from calibre import as_unicode, prints, force_unicode @@ -264,7 +264,7 @@ class MTP_DEVICE(MTPDeviceBase): break storage = {'id':storage_id, 'size':capacity, 'name':name, 'is_folder':True, 'can_delete':False, 'is_system':True} - self._currently_getting_sid = unicode(storage_id) + self._currently_getting_sid = unicode_type(storage_id) id_map = self.dev.get_filesystem(storage_id, partial( self._filesystem_callback, {})) for x in id_map.itervalues(): @@ -441,5 +441,3 @@ class MTP_DEVICE(MTPDeviceBase): ans = self.dev.put_file(pid, name, stream, size, callback) ans['storage_id'] = sid return parent.add_child(ans) - - diff --git a/src/calibre/devices/prst1/driver.py b/src/calibre/devices/prst1/driver.py index 4d65f1ca6f..12120249d3 100644 --- a/src/calibre/devices/prst1/driver.py +++ b/src/calibre/devices/prst1/driver.py @@ -24,6 +24,7 @@ from calibre.devices.usbms.books import CollectionsBookList from calibre.devices.usbms.books import BookList from calibre.ebooks.metadata import authors_to_sort_string, authors_to_string from calibre.constants import islinux +from polyglot.builtins import unicode_type DBPATH = 'Sony_Reader/database/books.db' THUMBPATH = 'Sony_Reader/database/cache/books/%s/thumbnail/main_thumbnail.jpg' @@ -170,7 +171,7 @@ class PRST1(USBMS): with closing(sqlite.connect(dbpath)) as connection: # Replace undecodable characters in the db instead of erroring out - connection.text_factory = lambda x: unicode(x, "utf-8", "replace") + connection.text_factory = lambda x: unicode_type(x, "utf-8", "replace") cursor = connection.cursor() # Query collections diff --git a/src/calibre/devices/smart_device_app/driver.py b/src/calibre/devices/smart_device_app/driver.py index 83c38a0df2..9619a82f04 100644 --- a/src/calibre/devices/smart_device_app/driver.py +++ b/src/calibre/devices/smart_device_app/driver.py @@ -38,6 +38,7 @@ from calibre.utils.filenames import ascii_filename as sanitize, shorten_componen from calibre.utils.mdns import (publish as publish_zeroconf, unpublish as unpublish_zeroconf, get_all_ips) from calibre.utils.socket_inheritance import set_socket_inherit +from polyglot.builtins import unicode_type def synchronous(tlockname): @@ -397,7 +398,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): if isinstance(a, dict): printable = {} for k,v in a.iteritems(): - if isinstance(v, (str, unicode)) and len(v) > 50: + if isinstance(v, (str, unicode_type)) and len(v) > 50: printable[k] = 'too long' else: printable[k] = v @@ -418,14 +419,14 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): if not isinstance(dinfo, dict): dinfo = {} if dinfo.get('device_store_uuid', None) is None: - dinfo['device_store_uuid'] = unicode(uuid.uuid4()) + dinfo['device_store_uuid'] = unicode_type(uuid.uuid4()) if dinfo.get('device_name') is None: dinfo['device_name'] = self.get_gui_name() if name is not None: dinfo['device_name'] = name dinfo['location_code'] = location_code dinfo['last_library_uuid'] = getattr(self, 'current_library_uuid', None) - dinfo['calibre_version'] = '.'.join([unicode(i) for i in numeric_version]) + dinfo['calibre_version'] = '.'.join([unicode_type(i) for i in numeric_version]) dinfo['date_last_connected'] = isoformat(now()) dinfo['prefix'] = self.PREFIX return dinfo @@ -478,7 +479,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): from calibre.library.save_to_disk import get_components from calibre.library.save_to_disk import config opts = config().parse() - if not isinstance(template, unicode): + if not isinstance(template, unicode_type): template = template.decode('utf-8') app_id = str(getattr(mdata, 'application_id', '')) id_ = mdata.get('id', fname) @@ -726,7 +727,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): from calibre.utils.date import now, parse_date try: key = self._make_metadata_cache_key(uuid, ext_or_lpath) - if isinstance(lastmod, unicode): + if isinstance(lastmod, unicode_type): if lastmod == 'None': return None lastmod = parse_date(lastmod) diff --git a/src/calibre/devices/udisks.py b/src/calibre/devices/udisks.py index 70e924eac5..7240444f2a 100644 --- a/src/calibre/devices/udisks.py +++ b/src/calibre/devices/udisks.py @@ -8,6 +8,7 @@ __docformat__ = 'restructuredtext en' import os, re +from polyglot.builtins import unicode_type def node_mountpoint(node): @@ -48,7 +49,7 @@ class UDisks(object): def mount(self, device_node_path): d = self.device(device_node_path) try: - return unicode(d.FilesystemMount('', + return unicode_type(d.FilesystemMount('', ['auth_no_user_interaction', 'rw', 'noexec', 'nosuid', 'nodev', 'uid=%d'%os.geteuid(), 'gid=%d'%os.getegid()])) except: @@ -131,7 +132,7 @@ class UDisks2(object): mount_options = ['rw', 'noexec', 'nosuid', 'nodev', 'uid=%d'%os.geteuid(), 'gid=%d'%os.getegid()] try: - return unicode(d.Mount( + return unicode_type(d.Mount( { 'auth.no_user_interaction':True, 'options':','.join(mount_options) diff --git a/src/calibre/devices/usbms/deviceconfig.py b/src/calibre/devices/usbms/deviceconfig.py index e0208081eb..2f65ac09fb 100644 --- a/src/calibre/devices/usbms/deviceconfig.py +++ b/src/calibre/devices/usbms/deviceconfig.py @@ -5,6 +5,7 @@ __copyright__ = '2009, John Schember <john@nachtimwald.com>' __docformat__ = 'restructuredtext en' from calibre.utils.config_base import Config, ConfigProxy +from polyglot.builtins import unicode_type class DeviceConfig(object): @@ -107,15 +108,15 @@ class DeviceConfig(object): if hasattr(config_widget.opt_extra_customization[i], 'isChecked'): ec.append(config_widget.opt_extra_customization[i].isChecked()) elif hasattr(config_widget.opt_extra_customization[i], 'currentText'): - ec.append(unicode(config_widget.opt_extra_customization[i].currentText()).strip()) + ec.append(unicode_type(config_widget.opt_extra_customization[i].currentText()).strip()) else: - ec.append(unicode(config_widget.opt_extra_customization[i].text()).strip()) + ec.append(unicode_type(config_widget.opt_extra_customization[i].text()).strip()) else: - ec = unicode(config_widget.opt_extra_customization.text()).strip() + ec = unicode_type(config_widget.opt_extra_customization.text()).strip() if not ec: ec = None proxy['extra_customization'] = ec - st = unicode(config_widget.opt_save_template.text()) + st = unicode_type(config_widget.opt_save_template.text()) proxy['save_template'] = st @classmethod diff --git a/src/calibre/devices/usbms/driver.py b/src/calibre/devices/usbms/driver.py index abd9228f75..ee5ec6452e 100644 --- a/src/calibre/devices/usbms/driver.py +++ b/src/calibre/devices/usbms/driver.py @@ -20,6 +20,7 @@ from calibre.devices.usbms.cli import CLI from calibre.devices.usbms.device import Device from calibre.devices.usbms.books import BookList, Book from calibre.ebooks.metadata.book.json_codec import JsonCodec +from polyglot.builtins import unicode_type BASE_TIME = None @@ -105,14 +106,14 @@ class USBMS(CLI, Device): if not isinstance(dinfo, dict): dinfo = {} if dinfo.get('device_store_uuid', None) is None: - dinfo['device_store_uuid'] = unicode(uuid.uuid4()) + dinfo['device_store_uuid'] = unicode_type(uuid.uuid4()) if dinfo.get('device_name', None) is None: dinfo['device_name'] = self.get_gui_name() if name is not None: dinfo['device_name'] = name dinfo['location_code'] = location_code dinfo['last_library_uuid'] = getattr(self, 'current_library_uuid', None) - dinfo['calibre_version'] = '.'.join([unicode(i) for i in numeric_version]) + dinfo['calibre_version'] = '.'.join([unicode_type(i) for i in numeric_version]) dinfo['date_last_connected'] = isoformat(now()) dinfo['prefix'] = prefix.replace('\\', '/') return dinfo diff --git a/src/calibre/devices/utils.py b/src/calibre/devices/utils.py index 8cd540ca02..506527c668 100644 --- a/src/calibre/devices/utils.py +++ b/src/calibre/devices/utils.py @@ -11,6 +11,7 @@ import os, time, re from functools import partial from calibre.devices.errors import DeviceError, WrongDestinationError, FreeSpaceError +from polyglot.builtins import unicode_type def sanity_check(on_card, files, card_prefixes, free_space): @@ -97,7 +98,7 @@ def create_upload_path(mdata, fname, template, sanitize, ext = path_type.splitext(fname)[1] opts = config().parse() - if not isinstance(template, unicode): + if not isinstance(template, unicode_type): template = template.decode('utf-8') app_id = str(getattr(mdata, 'application_id', '')) id_ = mdata.get('id', fname) diff --git a/src/calibre/ebooks/__init__.py b/src/calibre/ebooks/__init__.py index 2240def4b7..874aa90bbd 100644 --- a/src/calibre/ebooks/__init__.py +++ b/src/calibre/ebooks/__init__.py @@ -9,6 +9,7 @@ from various formats. import traceback, os, re from calibre import CurrentDir, prints +from polyglot.builtins import unicode_type class ConversionError(Exception): @@ -113,7 +114,7 @@ def extract_calibre_cover(raw, base, log): if matches is None: body = soup.find('body') if body is not None: - text = u''.join(map(unicode, body.findAll(text=True))) + text = u''.join(map(unicode_type, body.findAll(text=True))) if text.strip(): # Body has text, abort return @@ -210,7 +211,7 @@ def check_ebook_format(stream, current_guess): def normalize(x): - if isinstance(x, unicode): + if isinstance(x, unicode_type): import unicodedata x = unicodedata.normalize('NFC', x) return x diff --git a/src/calibre/ebooks/chardet.py b/src/calibre/ebooks/chardet.py index fd919d3c01..2d0dd7efe2 100644 --- a/src/calibre/ebooks/chardet.py +++ b/src/calibre/ebooks/chardet.py @@ -8,6 +8,7 @@ __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>' __docformat__ = 'restructuredtext en' import re, codecs +from polyglot.builtins import unicode_type ENCODING_PATS = [ # XML declaration @@ -92,7 +93,7 @@ def force_encoding(raw, verbose, assume_utf8=False): def detect_xml_encoding(raw, verbose=False, assume_utf8=False): - if not raw or isinstance(raw, unicode): + if not raw or isinstance(raw, unicode_type): return raw, None for x in ('utf8', 'utf-16-le', 'utf-16-be'): bom = getattr(codecs, 'BOM_'+x.upper().replace('-16', '16').replace( @@ -135,7 +136,7 @@ def xml_to_unicode(raw, verbose=False, strip_encoding_pats=False, return '', None raw, encoding = detect_xml_encoding(raw, verbose=verbose, assume_utf8=assume_utf8) - if not isinstance(raw, unicode): + if not isinstance(raw, unicode_type): raw = raw.decode(encoding, 'replace') if strip_encoding_pats: diff --git a/src/calibre/ebooks/chm/reader.py b/src/calibre/ebooks/chm/reader.py index 5a82c3544d..fc65685273 100644 --- a/src/calibre/ebooks/chm/reader.py +++ b/src/calibre/ebooks/chm/reader.py @@ -14,6 +14,7 @@ from calibre.utils.chm.chm import CHMFile from calibre.constants import plugins from calibre.ebooks.metadata.toc import TOC from calibre.ebooks.chardet import xml_to_unicode +from polyglot.builtins import unicode_type chmlib, chmlib_err = plugins['chmlib'] @@ -48,7 +49,7 @@ class CHMReader(CHMFile): def __init__(self, input, log, input_encoding=None): CHMFile.__init__(self) - if isinstance(input, unicode): + if isinstance(input, unicode_type): input = input.encode(filesystem_encoding) if not self.LoadCHM(input): raise CHMError("Unable to open CHM file '%s'"%(input,)) @@ -113,7 +114,7 @@ class CHMReader(CHMFile): enc = 'cp1252' for path in self.Contents(): fpath = path - if not isinstance(path, unicode): + if not isinstance(path, unicode_type): fpath = path.decode(enc) lpath = os.path.join(output_dir, fpath) self._ensure_dir(lpath) @@ -146,7 +147,7 @@ class CHMReader(CHMFile): with open(lpath, 'r+b') as f: data = f.read() data = self._reformat(data, lpath) - if isinstance(data, unicode): + if isinstance(data, unicode_type): data = data.encode('utf-8') f.seek(0) f.truncate() diff --git a/src/calibre/ebooks/comic/input.py b/src/calibre/ebooks/comic/input.py index 49ccf2ccac..a636069fbb 100755 --- a/src/calibre/ebooks/comic/input.py +++ b/src/calibre/ebooks/comic/input.py @@ -16,6 +16,7 @@ from calibre.ptempfile import PersistentTemporaryDirectory from calibre.utils.icu import numeric_sort_key from calibre.utils.ipc.server import Server from calibre.utils.ipc.job import ParallelJob +from polyglot.builtins import unicode_type # If the specified screen has either dimension larger than this value, no image # rescaling is done (we assume that it is a tablet output profile) @@ -27,7 +28,7 @@ def extract_comic(path_to_comic_file): Un-archive the comic file. ''' tdir = PersistentTemporaryDirectory(suffix='_comic_extract') - if not isinstance(tdir, unicode): + if not isinstance(tdir, unicode_type): # Needed in case the zip file has wrongly encoded unicode file/dir # names tdir = tdir.decode(filesystem_encoding) @@ -273,6 +274,3 @@ def process_pages(pages, opts, update, tdir): ans += pages failures += failures_ return ans, failures - - - diff --git a/src/calibre/ebooks/conversion/config.py b/src/calibre/ebooks/conversion/config.py index cde5aecf59..2d9c708cbe 100644 --- a/src/calibre/ebooks/conversion/config.py +++ b/src/calibre/ebooks/conversion/config.py @@ -13,6 +13,7 @@ from calibre.utils.lock import ExclusiveFile from calibre import sanitize_file_name from calibre.customize.conversion import OptionRecommendation from calibre.customize.ui import available_output_formats +from polyglot.builtins import unicode_type config_dir = os.path.join(config_dir, 'conversion') @@ -85,7 +86,7 @@ class GuiRecommendations(dict): def serialize(self): ans = json.dumps(self, indent=2, ensure_ascii=False) - if isinstance(ans, unicode): + if isinstance(ans, unicode_type): ans = ans.encode('utf-8') return b'json:' + ans diff --git a/src/calibre/ebooks/conversion/plugins/chm_input.py b/src/calibre/ebooks/conversion/plugins/chm_input.py index 178a9ffb24..fc0af0552f 100644 --- a/src/calibre/ebooks/conversion/plugins/chm_input.py +++ b/src/calibre/ebooks/conversion/plugins/chm_input.py @@ -8,6 +8,7 @@ import os from calibre.customize.conversion import InputFormatPlugin from calibre.ptempfile import TemporaryDirectory from calibre.constants import filesystem_encoding +from polyglot.builtins import unicode_type class CHMInput(InputFormatPlugin): @@ -34,7 +35,7 @@ class CHMInput(InputFormatPlugin): log.debug('Processing CHM...') with TemporaryDirectory('_chm2oeb') as tdir: - if not isinstance(tdir, unicode): + if not isinstance(tdir, unicode_type): tdir = tdir.decode(filesystem_encoding) html_input = plugin_for_input_format('html') for opt in html_input.options: @@ -125,7 +126,7 @@ class CHMInput(InputFormatPlugin): base = os.path.dirname(os.path.abspath(htmlpath)) def unquote(x): - if isinstance(x, unicode): + if isinstance(x, unicode_type): x = x.encode('utf-8') return _unquote(x).decode('utf-8') diff --git a/src/calibre/ebooks/conversion/plugins/epub_input.py b/src/calibre/ebooks/conversion/plugins/epub_input.py index 54327864da..a0216ac9f3 100644 --- a/src/calibre/ebooks/conversion/plugins/epub_input.py +++ b/src/calibre/ebooks/conversion/plugins/epub_input.py @@ -7,6 +7,7 @@ import os, re, posixpath from itertools import cycle from calibre.customize.conversion import InputFormatPlugin, OptionRecommendation +from polyglot.builtins import unicode_type ADOBE_OBFUSCATION = 'http://ns.adobe.com/pdf/enc#RC' IDPF_OBFUSCATION = 'http://www.idpf.org/2008/embedding' @@ -367,7 +368,7 @@ class EPUBInput(InputFormatPlugin): def add_from_li(li, parent): href = text = None for x in li.iterchildren(XHTML('a'), XHTML('span')): - text = etree.tostring(x, method='text', encoding=unicode, with_tail=False).strip() or ' '.join(x.xpath('descendant-or-self::*/@title')).strip() + text = etree.tostring(x, method='text', encoding=unicode_type, with_tail=False).strip() or ' '.join(x.xpath('descendant-or-self::*/@title')).strip() href = x.get('href') if href: if href.startswith('#'): diff --git a/src/calibre/ebooks/conversion/plugins/epub_output.py b/src/calibre/ebooks/conversion/plugins/epub_output.py index 829227599e..a6967a8645 100644 --- a/src/calibre/ebooks/conversion/plugins/epub_output.py +++ b/src/calibre/ebooks/conversion/plugins/epub_output.py @@ -13,6 +13,7 @@ from calibre.customize.conversion import (OutputFormatPlugin, from calibre.ptempfile import TemporaryDirectory from calibre import CurrentDir from calibre.constants import filesystem_encoding +from polyglot.builtins import unicode_type block_level_tags = ( 'address', @@ -225,8 +226,8 @@ class EPUBOutput(OutputFormatPlugin): identifiers = oeb.metadata['identifier'] uuid = None for x in identifiers: - if x.get(OPF('scheme'), None).lower() == 'uuid' or unicode(x).startswith('urn:uuid:'): - uuid = unicode(x).split(':')[-1] + if x.get(OPF('scheme'), None).lower() == 'uuid' or unicode_type(x).startswith('urn:uuid:'): + uuid = unicode_type(x).split(':')[-1] break encrypted_fonts = getattr(input_plugin, 'encrypted_fonts', []) @@ -241,7 +242,7 @@ class EPUBOutput(OutputFormatPlugin): # for some absurd reason, or it will throw a hissy fit and refuse # to use the obfuscated fonts. for x in identifiers: - if unicode(x) == uuid: + if unicode_type(x) == uuid: x.content = 'urn:uuid:'+uuid with TemporaryDirectory(u'_epub_output') as tdir: @@ -325,7 +326,7 @@ class EPUBOutput(OutputFormatPlugin): fonts = [] for uri in list(uris.keys()): path = uris[uri] - if isinstance(path, unicode): + if isinstance(path, unicode_type): path = path.encode(filesystem_encoding) if not os.path.exists(path): uris.pop(uri) @@ -339,7 +340,7 @@ class EPUBOutput(OutputFormatPlugin): f.write(chr(ord(data[i]) ^ key[i%16])) else: self.log.warn('Font', path, 'is invalid, ignoring') - if not isinstance(uri, unicode): + if not isinstance(uri, unicode_type): uri = uri.decode('utf-8') fonts.append(u''' <enc:EncryptedData> diff --git a/src/calibre/ebooks/conversion/plugins/fb2_input.py b/src/calibre/ebooks/conversion/plugins/fb2_input.py index 53a05049af..879836aa85 100644 --- a/src/calibre/ebooks/conversion/plugins/fb2_input.py +++ b/src/calibre/ebooks/conversion/plugins/fb2_input.py @@ -8,6 +8,7 @@ import os, re from calibre.customize.conversion import InputFormatPlugin, OptionRecommendation from calibre import guess_type +from polyglot.builtins import unicode_type FB2NS = 'http://www.gribuser.ru/xml/fictionbook/2.0' FB21NS = 'http://www.gribuser.ru/xml/fictionbook/2.1' @@ -70,7 +71,7 @@ class FB2Input(InputFormatPlugin): stylesheets = doc.xpath('//*[local-name() = "stylesheet" and @type="text/css"]') css = '' for s in stylesheets: - css += etree.tostring(s, encoding=unicode, method='text', + css += etree.tostring(s, encoding=unicode_type, method='text', with_tail=False) + '\n\n' if css: import css_parser, logging @@ -82,7 +83,7 @@ class FB2Input(InputFormatPlugin): log.debug('Parsing stylesheet...') stylesheet = parser.parseString(text) stylesheet.namespaces['h'] = XHTML_NS - css = unicode(stylesheet.cssText).replace('h|style', 'h|span') + css = unicode_type(stylesheet.cssText).replace('h|style', 'h|span') css = re.sub(r'name\s*=\s*', 'class=', css) self.extract_embedded_content(doc) log.debug('Converting XML to HTML...') diff --git a/src/calibre/ebooks/conversion/plugins/html_input.py b/src/calibre/ebooks/conversion/plugins/html_input.py index 03903cbf01..fa5e211e4d 100644 --- a/src/calibre/ebooks/conversion/plugins/html_input.py +++ b/src/calibre/ebooks/conversion/plugins/html_input.py @@ -17,6 +17,7 @@ from calibre.customize.conversion import (InputFormatPlugin, from calibre.utils.localization import get_lang from calibre.utils.filenames import ascii_filename from calibre.utils.imghdr import what +from polyglot.builtins import unicode_type def sanitize_file_name(x): @@ -225,7 +226,7 @@ class HTMLInput(InputFormatPlugin): def link_to_local_path(self, link_, base=None): from calibre.ebooks.html.input import Link - if not isinstance(link_, unicode): + if not isinstance(link_, unicode_type): try: link_ = link_.decode('utf-8', 'error') except: @@ -289,7 +290,7 @@ class HTMLInput(InputFormatPlugin): # bhref refers to an already existing file. The read() method of # DirContainer will call unquote on it before trying to read the # file, therefore we quote it here. - if isinstance(bhref, unicode): + if isinstance(bhref, unicode_type): bhref = bhref.encode('utf-8') item.html_input_href = quote(bhref).decode('utf-8') if guessed in self.OEB_STYLES: diff --git a/src/calibre/ebooks/conversion/plugins/html_output.py b/src/calibre/ebooks/conversion/plugins/html_output.py index 4ea5f630e4..4c82974460 100644 --- a/src/calibre/ebooks/conversion/plugins/html_output.py +++ b/src/calibre/ebooks/conversion/plugins/html_output.py @@ -9,6 +9,7 @@ from os.path import dirname, abspath, relpath as _relpath, exists, basename from calibre.customize.conversion import OutputFormatPlugin, OptionRecommendation from calibre import CurrentDir from calibre.ptempfile import PersistentTemporaryDirectory +from polyglot.builtins import unicode_type def relpath(*args): @@ -135,7 +136,7 @@ class HTMLOutput(OutputFormatPlugin): toc=html_toc, meta=meta, nextLink=nextLink, tocUrl=tocUrl, cssLink=cssLink, firstContentPageLink=nextLink) - if isinstance(t, unicode): + if isinstance(t, unicode_type): t = t.encode('utf-8') f.write(t) diff --git a/src/calibre/ebooks/conversion/plugins/htmlz_output.py b/src/calibre/ebooks/conversion/plugins/htmlz_output.py index 48ec94ac86..cdb74077ae 100644 --- a/src/calibre/ebooks/conversion/plugins/htmlz_output.py +++ b/src/calibre/ebooks/conversion/plugins/htmlz_output.py @@ -13,6 +13,7 @@ from cStringIO import StringIO from calibre.customize.conversion import OutputFormatPlugin, \ OptionRecommendation from calibre.ptempfile import TemporaryDirectory +from polyglot.builtins import unicode_type class HTMLZOutput(OutputFormatPlugin): @@ -81,9 +82,9 @@ class HTMLZOutput(OutputFormatPlugin): fname = u'index' if opts.htmlz_title_filename: from calibre.utils.filenames import shorten_components_to - fname = shorten_components_to(100, (ascii_filename(unicode(oeb_book.metadata.title[0])),))[0] + fname = shorten_components_to(100, (ascii_filename(unicode_type(oeb_book.metadata.title[0])),))[0] with open(os.path.join(tdir, fname+u'.html'), 'wb') as tf: - if isinstance(html, unicode): + if isinstance(html, unicode_type): html = html.encode('utf-8') tf.write(html) @@ -100,7 +101,7 @@ class HTMLZOutput(OutputFormatPlugin): for item in oeb_book.manifest: if item.media_type in OEB_IMAGES and item.href in images: if item.media_type == SVG_MIME: - data = unicode(etree.tostring(item.data, encoding=unicode)) + data = unicode_type(etree.tostring(item.data, encoding=unicode_type)) else: data = item.data fname = os.path.join(tdir, u'images', images[item.href]) diff --git a/src/calibre/ebooks/conversion/plugins/lrf_output.py b/src/calibre/ebooks/conversion/plugins/lrf_output.py index 3e99766e66..d743a1de74 100644 --- a/src/calibre/ebooks/conversion/plugins/lrf_output.py +++ b/src/calibre/ebooks/conversion/plugins/lrf_output.py @@ -10,6 +10,7 @@ import sys, os from calibre.customize.conversion import OutputFormatPlugin from calibre.customize.conversion import OptionRecommendation +from polyglot.builtins import unicode_type class LRFOptions(object): @@ -17,7 +18,7 @@ class LRFOptions(object): def __init__(self, output, opts, oeb): def f2s(f): try: - return unicode(f[0]) + return unicode_type(f[0]) except: return '' m = oeb.metadata @@ -31,13 +32,13 @@ class LRFOptions(object): self.title_sort = self.author_sort = '' for x in m.creator: if x.role == 'aut': - self.author = unicode(x) - fa = unicode(getattr(x, 'file_as', '')) + self.author = unicode_type(x) + fa = unicode_type(getattr(x, 'file_as', '')) if fa: self.author_sort = fa for x in m.title: - if unicode(x.file_as): - self.title_sort = unicode(x.file_as) + if unicode_type(x.file_as): + self.title_sort = unicode_type(x.file_as) self.freetext = f2s(m.description) self.category = f2s(m.subject) self.cover = None diff --git a/src/calibre/ebooks/conversion/plugins/mobi_input.py b/src/calibre/ebooks/conversion/plugins/mobi_input.py index 4c5845d255..8c42e8345d 100644 --- a/src/calibre/ebooks/conversion/plugins/mobi_input.py +++ b/src/calibre/ebooks/conversion/plugins/mobi_input.py @@ -6,6 +6,7 @@ __docformat__ = 'restructuredtext en' import os from calibre.customize.conversion import InputFormatPlugin +from polyglot.builtins import unicode_type class MOBIInput(InputFormatPlugin): @@ -49,7 +50,7 @@ class MOBIInput(InputFormatPlugin): raw = parse_cache.pop('calibre_raw_mobi_markup', False) if raw: - if isinstance(raw, unicode): + if isinstance(raw, unicode_type): raw = raw.encode('utf-8') open(u'debug-raw.html', 'wb').write(raw) from calibre.ebooks.oeb.base import close_self_closing_tags diff --git a/src/calibre/ebooks/conversion/plugins/mobi_output.py b/src/calibre/ebooks/conversion/plugins/mobi_output.py index 83d8730760..ee939f26be 100644 --- a/src/calibre/ebooks/conversion/plugins/mobi_output.py +++ b/src/calibre/ebooks/conversion/plugins/mobi_output.py @@ -8,6 +8,7 @@ __docformat__ = 'restructuredtext en' from calibre.customize.conversion import (OutputFormatPlugin, OptionRecommendation) +from polyglot.builtins import unicode_type def remove_html_cover(oeb, log): @@ -121,7 +122,7 @@ class MOBIOutput(OutputFormatPlugin): if not found: from calibre.ebooks import generate_masthead self.oeb.log.debug('No masthead found in manifest, generating default mastheadImage...') - raw = generate_masthead(unicode(self.oeb.metadata['title'][0])) + raw = generate_masthead(unicode_type(self.oeb.metadata['title'][0])) id, href = self.oeb.manifest.generate('masthead', 'masthead') self.oeb.manifest.add(id, href, 'image/gif', data=raw) self.oeb.guide.add('masthead', 'Masthead Image', href) @@ -165,7 +166,7 @@ class MOBIOutput(OutputFormatPlugin): sec.nodes.remove(a) root = TOC(klass='periodical', href=self.oeb.spine[0].href, - title=unicode(self.oeb.metadata.title[0])) + title=unicode_type(self.oeb.metadata.title[0])) for s in sections: if articles[id(s)]: diff --git a/src/calibre/ebooks/conversion/plugins/pdf_output.py b/src/calibre/ebooks/conversion/plugins/pdf_output.py index dc344e6422..b0b4ad6bae 100644 --- a/src/calibre/ebooks/conversion/plugins/pdf_output.py +++ b/src/calibre/ebooks/conversion/plugins/pdf_output.py @@ -14,6 +14,7 @@ from calibre.constants import iswindows from calibre.customize.conversion import (OutputFormatPlugin, OptionRecommendation) from calibre.ptempfile import TemporaryDirectory +from polyglot.builtins import unicode_type UNITS = ['millimeter', 'centimeter', 'point', 'inch' , 'pica' , 'didot', 'cicero', 'devicepixel'] @@ -202,8 +203,8 @@ class PDFOutput(OutputFormatPlugin): def get_cover_data(self): oeb = self.oeb - if (oeb.metadata.cover and unicode(oeb.metadata.cover[0]) in oeb.manifest.ids): - cover_id = unicode(oeb.metadata.cover[0]) + if (oeb.metadata.cover and unicode_type(oeb.metadata.cover[0]) in oeb.manifest.ids): + cover_id = unicode_type(oeb.metadata.cover[0]) item = oeb.manifest.ids[cover_id] self.cover_data = item.data diff --git a/src/calibre/ebooks/conversion/plugins/pml_output.py b/src/calibre/ebooks/conversion/plugins/pml_output.py index 0604764c49..20bf1dc18d 100644 --- a/src/calibre/ebooks/conversion/plugins/pml_output.py +++ b/src/calibre/ebooks/conversion/plugins/pml_output.py @@ -9,6 +9,7 @@ import os, cStringIO from calibre.customize.conversion import (OutputFormatPlugin, OptionRecommendation) from calibre.ptempfile import TemporaryDirectory +from polyglot.builtins import unicode_type class PMLOutput(OutputFormatPlugin): @@ -40,7 +41,7 @@ class PMLOutput(OutputFormatPlugin): with TemporaryDirectory('_pmlz_output') as tdir: pmlmlizer = PMLMLizer(log) - pml = unicode(pmlmlizer.extract_content(oeb_book, opts)) + pml = unicode_type(pmlmlizer.extract_content(oeb_book, opts)) with open(os.path.join(tdir, 'index.pml'), 'wb') as out: out.write(pml.encode(opts.pml_output_encoding, 'replace')) diff --git a/src/calibre/ebooks/conversion/plugins/recipe_input.py b/src/calibre/ebooks/conversion/plugins/recipe_input.py index 477c4a434c..26577a5e60 100644 --- a/src/calibre/ebooks/conversion/plugins/recipe_input.py +++ b/src/calibre/ebooks/conversion/plugins/recipe_input.py @@ -11,6 +11,7 @@ import os from calibre.customize.conversion import InputFormatPlugin, OptionRecommendation from calibre.constants import numeric_version from calibre import walk +from polyglot.builtins import unicode_type class RecipeDisabled(Exception): @@ -161,6 +162,6 @@ class RecipeInput(InputFormatPlugin): def save_download(self, zf): raw = self.recipe_source - if isinstance(raw, unicode): + if isinstance(raw, unicode_type): raw = raw.encode('utf-8') zf.writestr('download.recipe', raw) diff --git a/src/calibre/ebooks/conversion/plugins/snb_output.py b/src/calibre/ebooks/conversion/plugins/snb_output.py index 4248822bb4..3861286a96 100644 --- a/src/calibre/ebooks/conversion/plugins/snb_output.py +++ b/src/calibre/ebooks/conversion/plugins/snb_output.py @@ -9,6 +9,7 @@ import os, string from calibre.customize.conversion import OutputFormatPlugin, OptionRecommendation from calibre.ptempfile import TemporaryDirectory from calibre.constants import __appname__, __version__ +from polyglot.builtins import unicode_type class SNBOutput(OutputFormatPlugin): @@ -73,20 +74,20 @@ class SNBOutput(OutputFormatPlugin): # Process Meta data meta = oeb_book.metadata if meta.title: - title = unicode(meta.title[0]) + title = unicode_type(meta.title[0]) else: title = '' - authors = [unicode(x) for x in meta.creator if x.role == 'aut'] + authors = [unicode_type(x) for x in meta.creator if x.role == 'aut'] if meta.publisher: - publishers = unicode(meta.publisher[0]) + publishers = unicode_type(meta.publisher[0]) else: publishers = '' if meta.language: - lang = unicode(meta.language[0]).upper() + lang = unicode_type(meta.language[0]).upper() else: lang = '' if meta.description: - abstract = unicode(meta.description[0]) + abstract = unicode_type(meta.description[0]) else: abstract = '' diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py index a81af21e0d..e3cf965787 100644 --- a/src/calibre/ebooks/conversion/plumber.py +++ b/src/calibre/ebooks/conversion/plumber.py @@ -18,6 +18,7 @@ from calibre.utils.zipfile import ZipFile from calibre import (extract, walk, isbytestring, filesystem_encoding, get_types_map) from calibre.constants import __version__ +from polyglot.builtins import unicode_type DEBUG_README=u''' This debug directory contains snapshots of the e-book as it passes through the @@ -794,7 +795,7 @@ OptionRecommendation(name='search_replace', def unarchive(self, path, tdir): extract(path, tdir) files = list(walk(tdir)) - files = [f if isinstance(f, unicode) else f.decode(filesystem_encoding) + files = [f if isinstance(f, unicode_type) else f.decode(filesystem_encoding) for f in files] from calibre.customize.ui import available_input_formats fmts = set(available_input_formats()) @@ -915,7 +916,7 @@ OptionRecommendation(name='search_replace', try: val = parse_date(val, assume_utc=x=='timestamp') except: - self.log.exception(_('Failed to parse date/time') + ' ' + unicode(val)) + self.log.exception(_('Failed to parse date/time') + ' ' + unicode_type(val)) continue setattr(mi, x, val) diff --git a/src/calibre/ebooks/conversion/preprocess.py b/src/calibre/ebooks/conversion/preprocess.py index d92cc2aa1f..f6230269fa 100644 --- a/src/calibre/ebooks/conversion/preprocess.py +++ b/src/calibre/ebooks/conversion/preprocess.py @@ -9,6 +9,7 @@ __docformat__ = 'restructuredtext en' import functools, re, json from calibre import entity_to_unicode, as_unicode +from polyglot.builtins import unicode_type XMLDECL_RE = re.compile(r'^\s*<[?]xml.*?[?]>') SVG_NS = 'http://www.w3.org/2000/svg' @@ -218,8 +219,8 @@ class Dehyphenator(object): wraptags = match.group('wraptags') except: wraptags = '' - hyphenated = unicode(firsthalf) + "-" + unicode(secondhalf) - dehyphenated = unicode(firsthalf) + unicode(secondhalf) + hyphenated = unicode_type(firsthalf) + "-" + unicode_type(secondhalf) + dehyphenated = unicode_type(firsthalf) + unicode_type(secondhalf) if self.suffixes.match(secondhalf) is None: lookupword = self.removesuffixes.sub('', dehyphenated) else: @@ -315,7 +316,7 @@ class CSSPreProcessor(object): # are commented lines before the first @import or @charset rule. Since # the conversion will remove all stylesheets anyway, we don't lose # anything - data = re.sub(unicode(r'/\*.*?\*/'), u'', data, flags=re.DOTALL) + data = re.sub(unicode_type(r'/\*.*?\*/'), u'', data, flags=re.DOTALL) ans, namespaced = [], False for line in data.splitlines(): diff --git a/src/calibre/ebooks/conversion/utils.py b/src/calibre/ebooks/conversion/utils.py index 886c9a97be..cdae26aed9 100644 --- a/src/calibre/ebooks/conversion/utils.py +++ b/src/calibre/ebooks/conversion/utils.py @@ -10,6 +10,7 @@ from math import ceil from calibre.ebooks.conversion.preprocess import DocAnalysis, Dehyphenator from calibre.utils.logging import default_log from calibre.utils.wordcount import get_wordcount_obj +from polyglot.builtins import unicode_type class HeuristicProcessor(object): @@ -50,8 +51,8 @@ class HeuristicProcessor(object): title = match.group('title') if not title: self.html_preprocess_sections = self.html_preprocess_sections + 1 - self.log.debug("marked " + unicode(self.html_preprocess_sections) + - " chapters. - " + unicode(chap)) + self.log.debug("marked " + unicode_type(self.html_preprocess_sections) + + " chapters. - " + unicode_type(chap)) return '<h2>'+chap+'</h2>\n' else: delete_whitespace = re.compile('^\\s*(?P<c>.*?)\\s*$') @@ -59,16 +60,16 @@ class HeuristicProcessor(object): txt_chap = delete_quotes.sub('', delete_whitespace.sub('\\g<c>', html2text(chap))) txt_title = delete_quotes.sub('', delete_whitespace.sub('\\g<c>', html2text(title))) self.html_preprocess_sections = self.html_preprocess_sections + 1 - self.log.debug("marked " + unicode(self.html_preprocess_sections) + - " chapters & titles. - " + unicode(chap) + ", " + unicode(title)) + self.log.debug("marked " + unicode_type(self.html_preprocess_sections) + + " chapters & titles. - " + unicode_type(chap) + ", " + unicode_type(title)) return '<h2 title="'+txt_chap+', '+txt_title+'">'+chap+'</h2>\n<h3 class="sigilNotInTOC">'+title+'</h3>\n' def chapter_break(self, match): chap = match.group('section') styles = match.group('styles') self.html_preprocess_sections = self.html_preprocess_sections + 1 - self.log.debug("marked " + unicode(self.html_preprocess_sections) + - " section markers based on punctuation. - " + unicode(chap)) + self.log.debug("marked " + unicode_type(self.html_preprocess_sections) + + " section markers based on punctuation. - " + unicode_type(chap)) return '<'+styles+' style="page-break-before:always">'+chap def analyze_title_matches(self, match): @@ -111,8 +112,8 @@ class HeuristicProcessor(object): line_end = line_end_ere.findall(raw) tot_htm_ends = len(htm_end) tot_ln_fds = len(line_end) - # self.log.debug("There are " + unicode(tot_ln_fds) + " total Line feeds, and " + - # unicode(tot_htm_ends) + " marked up endings") + # self.log.debug("There are " + unicode_type(tot_ln_fds) + " total Line feeds, and " + + # unicode_type(tot_htm_ends) + " marked up endings") if percent > 1: percent = 1 @@ -120,7 +121,7 @@ class HeuristicProcessor(object): percent = 0 min_lns = tot_ln_fds * percent - # self.log.debug("There must be fewer than " + unicode(min_lns) + " unmarked lines to add markup") + # self.log.debug("There must be fewer than " + unicode_type(min_lns) + " unmarked lines to add markup") return min_lns > tot_htm_ends def dump(self, raw, where): @@ -157,17 +158,17 @@ class HeuristicProcessor(object): ] ITALICIZE_STYLE_PATS = [ - unicode(r'(?msu)(?<=[\s>"“\'‘])_\*/(?P<words>[^\*_]+)/\*_'), - unicode(r'(?msu)(?<=[\s>"“\'‘])~~(?P<words>[^~]+)~~'), - unicode(r'(?msu)(?<=[\s>"“\'‘])_/(?P<words>[^/_]+)/_'), - unicode(r'(?msu)(?<=[\s>"“\'‘])_\*(?P<words>[^\*_]+)\*_'), - unicode(r'(?msu)(?<=[\s>"“\'‘])\*/(?P<words>[^/\*]+)/\*'), - unicode(r'(?msu)(?<=[\s>"“\'‘])/:(?P<words>[^:/]+):/'), - unicode(r'(?msu)(?<=[\s>"“\'‘])\|:(?P<words>[^:\|]+):\|'), - unicode(r'(?msu)(?<=[\s>"“\'‘])\*(?P<words>[^\*]+)\*'), - unicode(r'(?msu)(?<=[\s>"“\'‘])~(?P<words>[^~]+)~'), - unicode(r'(?msu)(?<=[\s>"“\'‘])/(?P<words>[^/\*><]+)/'), - unicode(r'(?msu)(?<=[\s>"“\'‘])_(?P<words>[^_]+)_'), + unicode_type(r'(?msu)(?<=[\s>"“\'‘])_\*/(?P<words>[^\*_]+)/\*_'), + unicode_type(r'(?msu)(?<=[\s>"“\'‘])~~(?P<words>[^~]+)~~'), + unicode_type(r'(?msu)(?<=[\s>"“\'‘])_/(?P<words>[^/_]+)/_'), + unicode_type(r'(?msu)(?<=[\s>"“\'‘])_\*(?P<words>[^\*_]+)\*_'), + unicode_type(r'(?msu)(?<=[\s>"“\'‘])\*/(?P<words>[^/\*]+)/\*'), + unicode_type(r'(?msu)(?<=[\s>"“\'‘])/:(?P<words>[^:/]+):/'), + unicode_type(r'(?msu)(?<=[\s>"“\'‘])\|:(?P<words>[^:\|]+):\|'), + unicode_type(r'(?msu)(?<=[\s>"“\'‘])\*(?P<words>[^\*]+)\*'), + unicode_type(r'(?msu)(?<=[\s>"“\'‘])~(?P<words>[^~]+)~'), + unicode_type(r'(?msu)(?<=[\s>"“\'‘])/(?P<words>[^/\*><]+)/'), + unicode_type(r'(?msu)(?<=[\s>"“\'‘])_(?P<words>[^_]+)_'), ] for word in ITALICIZE_WORDS: @@ -177,10 +178,10 @@ class HeuristicProcessor(object): search_text = re.sub(r'<[^>]*>', '', search_text) for pat in ITALICIZE_STYLE_PATS: for match in re.finditer(pat, search_text): - ital_string = unicode(match.group('words')) - # self.log.debug("italicising "+unicode(match.group(0))+" with <i>"+ital_string+"</i>") + ital_string = unicode_type(match.group('words')) + # self.log.debug("italicising "+unicode_type(match.group(0))+" with <i>"+ital_string+"</i>") try: - html = re.sub(re.escape(unicode(match.group(0))), '<i>%s</i>' % ital_string, html) + html = re.sub(re.escape(unicode_type(match.group(0))), '<i>%s</i>' % ital_string, html) except OverflowError: # match.group(0) was too large to be compiled into a regex continue @@ -205,10 +206,10 @@ class HeuristicProcessor(object): if wordcount > 200000: typical_chapters = 15000. self.min_chapters = int(ceil(wordcount / typical_chapters)) - self.log.debug("minimum chapters required are: "+unicode(self.min_chapters)) + self.log.debug("minimum chapters required are: "+unicode_type(self.min_chapters)) heading = re.compile('<h[1-3][^>]*>', re.IGNORECASE) self.html_preprocess_sections = len(heading.findall(html)) - self.log.debug("found " + unicode(self.html_preprocess_sections) + " pre-existing headings") + self.log.debug("found " + unicode_type(self.html_preprocess_sections) + " pre-existing headings") # Build the Regular Expressions in pieces init_lookahead = "(?=<(p|div))" @@ -295,7 +296,7 @@ class HeuristicProcessor(object): if n_lookahead_req: n_lookahead = re.sub("(ou|in|cha)", "lookahead_", full_chapter_line) if not analyze: - self.log.debug("Marked " + unicode(self.html_preprocess_sections) + " headings, " + log_message) + self.log.debug("Marked " + unicode_type(self.html_preprocess_sections) + " headings, " + log_message) chapter_marker = arg_ignorecase+init_lookahead+full_chapter_line+blank_lines+lp_n_lookahead_open+n_lookahead+lp_n_lookahead_close+ \ lp_opt_title_open+title_line_open+title_header_open+lp_title+title_header_close+title_line_close+lp_opt_title_close @@ -308,9 +309,9 @@ class HeuristicProcessor(object): if float(self.chapters_with_title) / float(hits) > .5: title_req = True strict_title = False - self.log.debug(unicode(type_name)+" had "+unicode(hits)+" hits - "+unicode(self.chapters_no_title)+" chapters with no title, "+ - unicode(self.chapters_with_title)+" chapters with titles, "+ - unicode(float(self.chapters_with_title) / float(hits))+" percent. ") + self.log.debug(unicode_type(type_name)+" had "+unicode_type(hits)+" hits - "+unicode_type(self.chapters_no_title)+" chapters with no title, "+ + unicode_type(self.chapters_with_title)+" chapters with titles, "+ + unicode_type(float(self.chapters_with_title) / float(hits))+" percent. ") if type_name == 'common': analysis_result.append([chapter_type, n_lookahead_req, strict_title, ignorecase, title_req, log_message, type_name]) elif self.min_chapters <= hits < max_chapters or self.min_chapters < 3 > hits: @@ -327,8 +328,8 @@ class HeuristicProcessor(object): words_per_chptr = wordcount if words_per_chptr > 0 and self.html_preprocess_sections > 0: words_per_chptr = wordcount / self.html_preprocess_sections - self.log.debug("Total wordcount is: "+ unicode(wordcount)+", Average words per section is: "+ - unicode(words_per_chptr)+", Marked up "+unicode(self.html_preprocess_sections)+" chapters") + self.log.debug("Total wordcount is: "+ unicode_type(wordcount)+", Average words per section is: "+ + unicode_type(words_per_chptr)+", Marked up "+unicode_type(self.html_preprocess_sections)+" chapters") return html def punctuation_unwrap(self, length, content, format): @@ -358,8 +359,8 @@ class HeuristicProcessor(object): # define the pieces of the regex # (?<!\&\w{4});) is a semicolon not part of an entity - lookahead = "(?<=.{"+unicode(length)+u"}([a-zა-ჰäëïöüàèìòùáćéíĺóŕńśúýâêîôûçąężıãõñæøþðßěľščťžňďřů,:)\\IA\u00DF]|(?<!\\&\\w{4});))" - em_en_lookahead = "(?<=.{"+unicode(length)+u"}[\u2013\u2014])" + lookahead = "(?<=.{"+unicode_type(length)+u"}([a-zა-ჰäëïöüàèìòùáćéíĺóŕńśúýâêîôûçąężıãõñæøþðßěľščťžňďřů,:)\\IA\u00DF]|(?<!\\&\\w{4});))" + em_en_lookahead = "(?<=.{"+unicode_type(length)+u"}[\u2013\u2014])" soft_hyphen = u"\xad" line_ending = "\\s*(?P<style_close></(span|[iub])>)?\\s*(</(p|div)>)?" blanklines = "\\s*(?P<up2threeblanks><(p|span|div)[^>]*>\\s*(<(p|span|div)[^>]*>\\s*</(span|p|div)>\\s*)</(span|p|div)>\\s*){0,3}\\s*" @@ -419,18 +420,18 @@ class HeuristicProcessor(object): return html def fix_nbsp_indents(self, html): - txtindent = re.compile(unicode(r'<(?P<tagtype>p|div)(?P<formatting>[^>]*)>\s*(?P<span>(<span[^>]*>\s*)+)?\s*(\u00a0){2,}'), re.IGNORECASE) + txtindent = re.compile(unicode_type(r'<(?P<tagtype>p|div)(?P<formatting>[^>]*)>\s*(?P<span>(<span[^>]*>\s*)+)?\s*(\u00a0){2,}'), re.IGNORECASE) html = txtindent.sub(self.insert_indent, html) if self.found_indents > 1: - self.log.debug("replaced "+unicode(self.found_indents)+ " nbsp indents with inline styles") + self.log.debug("replaced "+unicode_type(self.found_indents)+ " nbsp indents with inline styles") return html def cleanup_markup(self, html): # remove remaining non-breaking spaces - html = re.sub(unicode(r'\u00a0'), ' ', html) + html = re.sub(unicode_type(r'\u00a0'), ' ', html) # Get rid of various common microsoft specific tags which can cause issues later # Get rid of empty <o:p> tags to simplify other processing - html = re.sub(unicode(r'\s*<o:p>\s*</o:p>'), ' ', html) + html = re.sub(unicode_type(r'\s*<o:p>\s*</o:p>'), ' ', html) # Delete microsoft 'smart' tags html = re.sub('(?i)</?st1:\\w+>', '', html) # Re-open self closing paragraph tags @@ -470,8 +471,8 @@ class HeuristicProcessor(object): blanklines = self.blankreg.findall(html) lines = self.linereg.findall(html) if len(lines) > 1: - self.log.debug("There are " + unicode(len(blanklines)) + " blank lines. " + - unicode(float(len(blanklines)) / float(len(lines))) + " percent blank") + self.log.debug("There are " + unicode_type(len(blanklines)) + " blank lines. " + + unicode_type(float(len(blanklines)) / float(len(lines))) + " percent blank") if float(len(blanklines)) / float(len(lines)) > 0.40: return True @@ -493,11 +494,11 @@ class HeuristicProcessor(object): lines = float(len(self.single_blank.findall(to_merge))) - 1. em = base_em + (em_per_line * lines) if to_merge.find('whitespace'): - newline = self.any_multi_blank.sub('\n<p class="whitespace'+unicode(int(em * 10))+ - '" style="text-align:center; margin-top:'+unicode(em)+'em"> </p>', match.group(0)) + newline = self.any_multi_blank.sub('\n<p class="whitespace'+unicode_type(int(em * 10))+ + '" style="text-align:center; margin-top:'+unicode_type(em)+'em"> </p>', match.group(0)) else: - newline = self.any_multi_blank.sub('\n<p class="softbreak'+unicode(int(em * 10))+ - '" style="text-align:center; margin-top:'+unicode(em)+'em"> </p>', match.group(0)) + newline = self.any_multi_blank.sub('\n<p class="softbreak'+unicode_type(int(em * 10))+ + '" style="text-align:center; margin-top:'+unicode_type(em)+'em"> </p>', match.group(0)) return newline html = self.any_multi_blank.sub(merge_matches, html) @@ -518,9 +519,9 @@ class HeuristicProcessor(object): top_margin = '' bottom_margin = '' if initblanks is not None: - top_margin = 'margin-top:'+unicode(len(self.single_blank.findall(initblanks)))+'em;' + top_margin = 'margin-top:'+unicode_type(len(self.single_blank.findall(initblanks)))+'em;' if endblanks is not None: - bottom_margin = 'margin-bottom:'+unicode(len(self.single_blank.findall(endblanks)))+'em;' + bottom_margin = 'margin-bottom:'+unicode_type(len(self.single_blank.findall(endblanks)))+'em;' if initblanks is None and endblanks is None: return content @@ -597,7 +598,7 @@ class HeuristicProcessor(object): else: replacement_break = re.sub('(?i)(width=\\d+\\%?|width:\\s*\\d+(\\%|px|pt|em)?;?)', '', replacement_break) divpercent = (100 - width) / 2 - hr_open = re.sub('45', unicode(divpercent), hr_open) + hr_open = re.sub('45', unicode_type(divpercent), hr_open) scene_break = hr_open+replacement_break+'</div>' else: scene_break = hr_open+'<hr style="height: 3px; background:#505050" /></div>' @@ -657,12 +658,12 @@ class HeuristicProcessor(object): else: styles = match.group('styles').split(';') is_paragraph = self.check_paragraph(content) - # print "styles for this line are: "+unicode(styles) + # print "styles for this line are: "+unicode_type(styles) split_styles = [] for style in styles: - # print "style is: "+unicode(style) + # print "style is: "+unicode_type(style) newstyle = style.split(':') - # print "newstyle is: "+unicode(newstyle) + # print "newstyle is: "+unicode_type(newstyle) split_styles.append(newstyle) styles = split_styles for style, setting in styles: @@ -673,7 +674,7 @@ class HeuristicProcessor(object): if 9 < setting < 14: text_indent = indented_text else: - text_indent = style+':'+unicode(setting)+'pt;' + text_indent = style+':'+unicode_type(setting)+'pt;' if style == 'padding': setting = re.sub('pt', '', setting).split(' ') if int(setting[1]) < 16 and int(setting[3]) < 16: @@ -694,23 +695,23 @@ class HeuristicProcessor(object): blockquote_open_loop = blockquote_open if debugabby: self.log.debug('\n\n******\n') - self.log.debug('padding top is: '+unicode(setting[0])) - self.log.debug('padding right is:' +unicode(setting[1])) - self.log.debug('padding bottom is: ' + unicode(setting[2])) - self.log.debug('padding left is: ' +unicode(setting[3])) + self.log.debug('padding top is: '+unicode_type(setting[0])) + self.log.debug('padding right is:' +unicode_type(setting[1])) + self.log.debug('padding bottom is: ' + unicode_type(setting[2])) + self.log.debug('padding left is: ' +unicode_type(setting[3])) - # print "text-align is: "+unicode(text_align) - # print "\n***\nline is:\n "+unicode(match.group(0))+'\n' + # print "text-align is: "+unicode_type(text_align) + # print "\n***\nline is:\n "+unicode_type(match.group(0))+'\n' if debugabby: - # print "this line is a paragraph = "+unicode(is_paragraph)+", previous line was "+unicode(self.previous_was_paragraph) + # print "this line is a paragraph = "+unicode_type(is_paragraph)+", previous line was "+unicode_type(self.previous_was_paragraph) self.log.debug("styles for this line were:", styles) self.log.debug('newline is:') self.log.debug(blockquote_open_loop+blockquote_close_loop+ paragraph_before+'<p style="'+text_indent+text_align+ '">'+content+'</p>'+paragraph_after+'\n\n\n\n\n') - # print "is_paragraph is "+unicode(is_paragraph)+", previous_was_paragraph is "+unicode(self.previous_was_paragraph) + # print "is_paragraph is "+unicode_type(is_paragraph)+", previous_was_paragraph is "+unicode_type(self.previous_was_paragraph) self.previous_was_paragraph = is_paragraph - # print "previous_was_paragraph is now set to "+unicode(self.previous_was_paragraph)+"\n\n\n" + # print "previous_was_paragraph is now set to "+unicode_type(self.previous_was_paragraph)+"\n\n\n" return blockquote_open_loop+blockquote_close_loop+paragraph_before+'<p style="'+text_indent+text_align+'">'+content+'</p>'+paragraph_after html = abbyy_line.sub(convert_styles, html) @@ -793,12 +794,12 @@ class HeuristicProcessor(object): # more of the lines break in the same region of the document then unwrapping is required docanalysis = DocAnalysis(format, html) hardbreaks = docanalysis.line_histogram(.50) - self.log.debug("Hard line breaks check returned "+unicode(hardbreaks)) + self.log.debug("Hard line breaks check returned "+unicode_type(hardbreaks)) # Calculate Length unwrap_factor = getattr(self.extra_opts, 'html_unwrap_factor', 0.4) length = docanalysis.line_length(unwrap_factor) - self.log.debug("Median line length is " + unicode(length) + ", calculated with " + format + " format") + self.log.debug("Median line length is " + unicode_type(length) + ", calculated with " + format + " format") # ##### Unwrap lines ###### if getattr(self.extra_opts, 'unwrap_lines', False): @@ -820,7 +821,7 @@ class HeuristicProcessor(object): # If still no sections after unwrapping mark split points on lines with no punctuation if self.html_preprocess_sections < self.min_chapters and getattr(self.extra_opts, 'markup_chapter_headings', False): self.log.debug("Looking for more split points based on punctuation," - " currently have " + unicode(self.html_preprocess_sections)) + " currently have " + unicode_type(self.html_preprocess_sections)) chapdetect3 = re.compile( r'<(?P<styles>(p|div)[^>]*)>\s*(?P<section>(<span[^>]*>)?\s*(?!([\W]+\s*)+)(<[ibu][^>]*>){0,2}\s*(<span[^>]*>)?\s*(<[ibu][^>]*>){0,2}\s*(<span[^>]*>)?\s*.?(?=[a-z#\-*\s]+<)([a-z#-*]+\s*){1,5}\s*\s*(</span>)?(</[ibu]>){0,2}\s*(</span>)?\s*(</[ibu]>){0,2}\s*(</span>)?\s*</(p|div)>)', re.IGNORECASE) # noqa html = chapdetect3.sub(self.chapter_break, html) diff --git a/src/calibre/ebooks/docx/container.py b/src/calibre/ebooks/docx/container.py index 448ceb97c7..8ba8b2ff83 100644 --- a/src/calibre/ebooks/docx/container.py +++ b/src/calibre/ebooks/docx/container.py @@ -20,6 +20,7 @@ from calibre.utils.localization import canonicalize_lang from calibre.utils.logging import default_log from calibre.utils.zipfile import ZipFile from calibre.ebooks.oeb.parse_utils import RECOVER_PARSER +from polyglot.builtins import unicode_type def fromstring(raw, parser=RECOVER_PARSER): @@ -56,7 +57,7 @@ def read_doc_props(raw, mi, XPath): desc = XPath('//dc:description')(root) if desc: - raw = etree.tostring(desc[0], method='text', encoding=unicode) + raw = etree.tostring(desc[0], method='text', encoding=unicode_type) raw = raw.replace('_x000d_', '') # Word 2007 mangles newlines in the summary mi.comments = raw.strip() diff --git a/src/calibre/ebooks/docx/fonts.py b/src/calibre/ebooks/docx/fonts.py index f92519ddb7..c21c202045 100644 --- a/src/calibre/ebooks/docx/fonts.py +++ b/src/calibre/ebooks/docx/fonts.py @@ -14,6 +14,7 @@ from calibre.utils.filenames import ascii_filename from calibre.utils.fonts.scanner import font_scanner, NoFonts from calibre.utils.fonts.utils import panose_to_css_generic_family, is_truetype_font from calibre.utils.icu import ord_string +from polyglot.builtins import codepoint_to_chr Embed = namedtuple('Embed', 'name key subsetted') @@ -124,7 +125,7 @@ def do_map(m, points): if base < p < limit: yield m[p - base] else: - yield unichr(p) + yield codepoint_to_chr(p) def map_symbol_text(text, font): diff --git a/src/calibre/ebooks/docx/index.py b/src/calibre/ebooks/docx/index.py index b4bd00b792..a4e8e0ec60 100644 --- a/src/calibre/ebooks/docx/index.py +++ b/src/calibre/ebooks/docx/index.py @@ -11,6 +11,7 @@ from operator import itemgetter from lxml import etree from calibre.utils.icu import partition_by_first_letter, sort_key +from polyglot.builtins import unicode_type def get_applicable_xe_fields(index, xe_fields, XPath, expand): @@ -246,7 +247,7 @@ def polish_index_markup(index, blocks): a = block.xpath('descendant::a[1]') text = '' if a: - text = etree.tostring(a[0], method='text', with_tail=False, encoding=unicode).strip() + text = etree.tostring(a[0], method='text', with_tail=False, encoding=unicode_type).strip() if ':' in text: path_map[block] = parts = filter(None, (x.strip() for x in text.split(':'))) if len(parts) > 1: diff --git a/src/calibre/ebooks/docx/tables.py b/src/calibre/ebooks/docx/tables.py index cd73562630..b2cb4b2346 100644 --- a/src/calibre/ebooks/docx/tables.py +++ b/src/calibre/ebooks/docx/tables.py @@ -504,8 +504,6 @@ class Table(object): def resolve_cell_style(self, tc, overrides, row, col, rows, cols_in_row): cs = CellStyle(self.namespace) - # from lxml.etree import tostring - # txt = tostring(tc, method='text', encoding=unicode) for o in overrides: if o in self.overrides: ovr = self.overrides[o] @@ -699,4 +697,3 @@ class Tables(object): table = self.para_map.get(p, None) if table is not None: return table.style_map.get(p, (None, None))[1] - diff --git a/src/calibre/ebooks/docx/toc.py b/src/calibre/ebooks/docx/toc.py index ad262904f0..239efb9baa 100644 --- a/src/calibre/ebooks/docx/toc.py +++ b/src/calibre/ebooks/docx/toc.py @@ -13,6 +13,7 @@ from lxml.etree import tostring from calibre.ebooks.metadata.toc import TOC from calibre.ebooks.oeb.polish.toc import elem_to_toc_text +from polyglot.builtins import unicode_type def from_headings(body, log, namespace): @@ -93,7 +94,7 @@ def link_to_txt(a, styles, object_map): if rs.css.get('display', None) == 'none': a.remove(child) - return tostring(a, method='text', with_tail=False, encoding=unicode).strip() + return tostring(a, method='text', with_tail=False, encoding=unicode_type).strip() def from_toc(docx, link_map, styles, object_map, log, namespace): diff --git a/src/calibre/ebooks/docx/writer/from_html.py b/src/calibre/ebooks/docx/writer/from_html.py index 93743fda5a..fb2997b672 100644 --- a/src/calibre/ebooks/docx/writer/from_html.py +++ b/src/calibre/ebooks/docx/writer/from_html.py @@ -19,6 +19,7 @@ from calibre.ebooks.docx.writer.lists import ListsManager from calibre.ebooks.oeb.stylizer import Stylizer as Sz, Style as St from calibre.ebooks.oeb.base import XPath, barename from calibre.utils.localization import lang_as_iso639_1 +from polyglot.builtins import unicode_type def lang_for_tag(tag): @@ -439,8 +440,8 @@ class Convert(object): if self.add_toc: self.links_manager.process_toc_links(self.oeb) - if self.add_cover and self.oeb.metadata.cover and unicode(self.oeb.metadata.cover[0]) in self.oeb.manifest.ids: - cover_id = unicode(self.oeb.metadata.cover[0]) + if self.add_cover and self.oeb.metadata.cover and unicode_type(self.oeb.metadata.cover[0]) in self.oeb.manifest.ids: + cover_id = unicode_type(self.oeb.metadata.cover[0]) item = self.oeb.manifest.ids[cover_id] self.cover_img = self.images_manager.read_image(item.href) diff --git a/src/calibre/ebooks/docx/writer/styles.py b/src/calibre/ebooks/docx/writer/styles.py index 9c532cdb2f..e57b558a30 100644 --- a/src/calibre/ebooks/docx/writer/styles.py +++ b/src/calibre/ebooks/docx/writer/styles.py @@ -14,6 +14,7 @@ from lxml import etree from calibre.ebooks import parse_css_length from calibre.ebooks.docx.writer.utils import convert_color, int_or_zero from calibre.utils.localization import lang_as_iso639_1 +from polyglot.builtins import unicode_type from tinycss.css21 import CSS21Parser css_parser = CSS21Parser() @@ -45,7 +46,7 @@ def bmap(x): def is_dropcaps(html_tag, tag_style): - return len(html_tag) < 2 and len(etree.tostring(html_tag, method='text', encoding=unicode, with_tail=False)) < 5 and tag_style['float'] == 'left' + return len(html_tag) < 2 and len(etree.tostring(html_tag, method='text', encoding=unicode_type, with_tail=False)) < 5 and tag_style['float'] == 'left' class CombinedStyle(object): diff --git a/src/calibre/ebooks/epub/cfi/tests.py b/src/calibre/ebooks/epub/cfi/tests.py index 969e69536d..a47074b54d 100644 --- a/src/calibre/ebooks/epub/cfi/tests.py +++ b/src/calibre/ebooks/epub/cfi/tests.py @@ -10,6 +10,7 @@ import unittest from polyglot.builtins import map from calibre.ebooks.epub.cfi.parse import parser, cfi_sort_key, decode_cfi +from polyglot.builtins import unicode_type class Tests(unittest.TestCase): @@ -60,7 +61,7 @@ class Tests(unittest.TestCase): if after is not None: ta['after'] = after if params: - ta['params'] = {unicode(k):(v,) if isinstance(v, unicode) else v for k, v in params.iteritems()} + ta['params'] = {unicode_type(k):(v,) if isinstance(v, unicode_type) else v for k, v in params.iteritems()} if ta: step['text_assertion'] = ta return ans diff --git a/src/calibre/ebooks/epub/periodical.py b/src/calibre/ebooks/epub/periodical.py index 3422fd6e60..8b39cfe681 100644 --- a/src/calibre/ebooks/epub/periodical.py +++ b/src/calibre/ebooks/epub/periodical.py @@ -11,6 +11,7 @@ import time from calibre.constants import __appname__, __version__ from calibre import strftime, prepare_string_for_xml as xml from calibre.utils.date import parse_date +from polyglot.builtins import unicode_type SONY_METADATA = u'''\ <?xml version="1.0" encoding="utf-8"?> @@ -81,21 +82,21 @@ SONY_ATOM_ENTRY = u'''\ def sony_metadata(oeb): m = oeb.metadata - title = short_title = unicode(m.title[0]) + title = short_title = unicode_type(m.title[0]) publisher = __appname__ + ' ' + __version__ try: - pt = unicode(oeb.metadata.publication_type[0]) + pt = unicode_type(oeb.metadata.publication_type[0]) short_title = u':'.join(pt.split(':')[2:]) except: pass try: - date = parse_date(unicode(m.date[0]), + date = parse_date(unicode_type(m.date[0]), as_utc=False).strftime('%Y-%m-%d') except: date = strftime('%Y-%m-%d') try: - language = unicode(m.language[0]).replace('_', '-') + language = unicode_type(m.language[0]).replace('_', '-') except: language = 'en' short_title = xml(short_title, True) @@ -113,7 +114,7 @@ def sony_metadata(oeb): return True try: - base_id = unicode(list(filter(cal_id, m.identifier))[0]) + base_id = unicode_type(list(filter(cal_id, m.identifier))[0]) except: base_id = str(uuid4()) @@ -128,7 +129,7 @@ def sony_metadata(oeb): for x in toc: section.nodes.append(x) toc = TOC(klass='periodical', href=oeb.spine[2].href, - title=unicode(oeb.metadata.title[0])) + title=unicode_type(oeb.metadata.title[0])) toc.nodes.append(section) entries = [] @@ -188,4 +189,3 @@ def sony_metadata(oeb): id=xml(base_id)).encode('utf-8') return metadata, atom - diff --git a/src/calibre/ebooks/fb2/fb2ml.py b/src/calibre/ebooks/fb2/fb2ml.py index d01dd494d3..6fac9fdd84 100644 --- a/src/calibre/ebooks/fb2/fb2ml.py +++ b/src/calibre/ebooks/fb2/fb2ml.py @@ -19,6 +19,7 @@ from calibre.constants import __appname__, __version__ from calibre.utils.localization import lang_as_iso639_1 from calibre.utils.img import save_cover_data_to from calibre.ebooks.oeb.base import urlnormalize +from polyglot.builtins import unicode_type class FB2MLizer(object): @@ -64,7 +65,7 @@ class FB2MLizer(object): output = self.clean_text(u''.join(output)) if self.opts.pretty_print: - return u'<?xml version="1.0" encoding="UTF-8"?>\n%s' % etree.tostring(etree.fromstring(output), encoding=unicode, pretty_print=True) + return u'<?xml version="1.0" encoding="UTF-8"?>\n%s' % etree.tostring(etree.fromstring(output), encoding=unicode_type, pretty_print=True) else: return u'<?xml version="1.0" encoding="UTF-8"?>' + output @@ -140,7 +141,7 @@ class FB2MLizer(object): metadata['author'] = u'<author><first-name></first-name><last-name></last-name></author>' metadata['keywords'] = u'' - tags = list(map(unicode, self.oeb_book.metadata.subject)) + tags = list(map(unicode_type, self.oeb_book.metadata.subject)) if tags: tags = ', '.join(prepare_string_for_xml(x) for x in tags) metadata['keywords'] = '<keywords>%s</keywords>'%tags @@ -155,8 +156,8 @@ class FB2MLizer(object): year = publisher = isbn = u'' identifiers = self.oeb_book.metadata['identifier'] for x in identifiers: - if x.get(OPF('scheme'), None).lower() == 'uuid' or unicode(x).startswith('urn:uuid:'): - metadata['id'] = unicode(x).split(':')[-1] + if x.get(OPF('scheme'), None).lower() == 'uuid' or unicode_type(x).startswith('urn:uuid:'): + metadata['id'] = unicode_type(x).split(':')[-1] break if metadata['id'] is None: self.log.warn('No UUID identifier found') @@ -229,8 +230,8 @@ class FB2MLizer(object): cover_href = None # Get the raster cover if it's available. - if self.oeb_book.metadata.cover and unicode(self.oeb_book.metadata.cover[0]) in self.oeb_book.manifest.ids: - id = unicode(self.oeb_book.metadata.cover[0]) + if self.oeb_book.metadata.cover and unicode_type(self.oeb_book.metadata.cover[0]) in self.oeb_book.manifest.ids: + id = unicode_type(self.oeb_book.metadata.cover[0]) cover_item = self.oeb_book.manifest.ids[id] if cover_item.media_type in OEB_RASTER_IMAGES: cover_href = cover_item.href diff --git a/src/calibre/ebooks/html/input.py b/src/calibre/ebooks/html/input.py index 3ee912cf0e..723fcc3688 100644 --- a/src/calibre/ebooks/html/input.py +++ b/src/calibre/ebooks/html/input.py @@ -19,6 +19,7 @@ from calibre.ebooks.oeb.base import urlunquote from calibre.ebooks.chardet import detect_xml_encoding from calibre.constants import iswindows from calibre import unicode_path, as_unicode, replace_entities +from polyglot.builtins import unicode_type class Link(object): @@ -46,7 +47,7 @@ class Link(object): :param base: The base directory that relative URLs are with respect to. Must be a unicode string. ''' - assert isinstance(url, unicode) and isinstance(base, unicode) + assert isinstance(url, unicode_type) and isinstance(base, unicode_type) self.url = url self.parsed_url = urlparse(self.url) self.is_local = self.parsed_url.scheme in ('', 'file') @@ -248,6 +249,3 @@ def get_filelist(htmlfile, dir, opts, log): for f in filelist: log.debug('\t\t', f) return filelist - - - diff --git a/src/calibre/ebooks/html/to_zip.py b/src/calibre/ebooks/html/to_zip.py index f6d6d53aff..56263ca7aa 100644 --- a/src/calibre/ebooks/html/to_zip.py +++ b/src/calibre/ebooks/html/to_zip.py @@ -11,6 +11,7 @@ import textwrap, os, glob from calibre.customize import FileTypePlugin from calibre.constants import numeric_version +from polyglot.builtins import unicode_type class HTML2ZIP(FileTypePlugin): @@ -114,10 +115,9 @@ every time you add an HTML file to the library.\ config_dialog.exec_() if config_dialog.result() == QDialog.Accepted: - sc = unicode(sc.text()).strip() + sc = unicode_type(sc.text()).strip() if bf.isChecked(): sc += '|bf' customize_plugin(self, sc) return config_dialog.result() - diff --git a/src/calibre/ebooks/htmlz/oeb2html.py b/src/calibre/ebooks/htmlz/oeb2html.py index cacaa6cc07..5797d31ae4 100644 --- a/src/calibre/ebooks/htmlz/oeb2html.py +++ b/src/calibre/ebooks/htmlz/oeb2html.py @@ -22,6 +22,7 @@ from calibre.ebooks.oeb.base import ( XHTML, XHTML_NS, barename, namespace, OEB_IMAGES, XLINK, rewrite_links, urlnormalize) from calibre.ebooks.oeb.stylizer import Stylizer from calibre.utils.logging import default_log +from polyglot.builtins import unicode_type SELF_CLOSING_TAGS = {'area', 'base', 'basefont', 'br', 'hr', 'input', 'img', 'link', 'meta'} @@ -46,7 +47,7 @@ class OEB2HTML(object): self.log.info('Converting OEB book to HTML...') self.opts = opts try: - self.book_title = unicode(oeb_book.metadata.title[0]) + self.book_title = unicode_type(oeb_book.metadata.title[0]) except Exception: self.book_title = _('Unknown') self.links = {} diff --git a/src/calibre/ebooks/lit/reader.py b/src/calibre/ebooks/lit/reader.py index adb3c7de72..276b97c9ff 100644 --- a/src/calibre/ebooks/lit/reader.py +++ b/src/calibre/ebooks/lit/reader.py @@ -22,6 +22,7 @@ from calibre.ebooks.oeb.base import urlnormalize, xpath from calibre.ebooks.oeb.reader import OEBReader from calibre.ebooks import DRMError from calibre import plugins +from polyglot.builtins import codepoint_to_chr, unicode_type lzx, lxzerror = plugins['lzx'] msdes, msdeserror = plugins['msdes'] @@ -110,7 +111,7 @@ def read_utf8_char(bytes, pos): raise LitError( 'Invalid UTF8 character: %s' % repr(bytes[pos:pos+i])) c = (c << 6) | (b & 0x3F) - return unichr(c), pos+elsize + return codepoint_to_chr(c), pos+elsize def consume_sized_utf8_string(bytes, zpad=False): @@ -125,7 +126,7 @@ def consume_sized_utf8_string(bytes, zpad=False): def encode(string): - return unicode(string).encode('ascii', 'xmlcharrefreplace') + return unicode_type(string).encode('ascii', 'xmlcharrefreplace') class UnBinary(object): @@ -243,9 +244,9 @@ class UnBinary(object): else: dynamic_tag += 1 errors += 1 - tag_name = '?'+unichr(tag)+'?' + tag_name = '?'+codepoint_to_chr(tag)+'?' current_map = self.tag_to_attr_map[tag] - print('WARNING: tag %s unknown' % unichr(tag)) + print('WARNING: tag %s unknown' % codepoint_to_chr(tag)) buf.write(encode(tag_name)) elif flags & FLAG_CLOSING: if depth == 0: @@ -947,4 +948,3 @@ class LitReader(OEBReader): item.media_type = 'application/xhtml+xml' item.data = item._parse_xhtml(etree.tostring(item.data)) super(LitReader, self)._spine_from_opf(opf) - diff --git a/src/calibre/ebooks/lit/writer.py b/src/calibre/ebooks/lit/writer.py index 3200f02fbe..64db77db9f 100644 --- a/src/calibre/ebooks/lit/writer.py +++ b/src/calibre/ebooks/lit/writer.py @@ -31,6 +31,7 @@ import calibre from calibre import plugins msdes, msdeserror = plugins['msdes'] import calibre.ebooks.lit.mssha1 as mssha1 +from polyglot.builtins import codepoint_to_chr, unicode_type __all__ = ['LitWriter'] @@ -163,9 +164,9 @@ class ReBinary(object): for value in values: if isinstance(value, (int, long)): try: - value = unichr(value) + value = codepoint_to_chr(value) except OverflowError: - self.logger.warn('Unicode overflow for integer:', value) + self.logger.warn('unicode_type overflow for integer:', value) value = u'?' self.buf.write(value.encode('utf-8')) @@ -216,9 +217,9 @@ class ReBinary(object): path, frag = urldefrag(value) if self.item: path = self.item.abshref(path) - prefix = unichr(3) + prefix = codepoint_to_chr(3) if path in self.manifest.hrefs: - prefix = unichr(2) + prefix = codepoint_to_chr(2) value = self.manifest.hrefs[path].id if frag: value = '#'.join((value, frag)) @@ -281,9 +282,9 @@ class ReBinary(object): self.logger.warn("More than six anchors in file %r. " "Some links may not work properly." % self.item.href) data = StringIO() - data.write(unichr(len(self.anchors)).encode('utf-8')) + data.write(codepoint_to_chr(len(self.anchors)).encode('utf-8')) for anchor, offset in self.anchors: - data.write(unichr(len(anchor)).encode('utf-8')) + data.write(codepoint_to_chr(len(anchor)).encode('utf-8')) data.write(anchor) data.write(pack('<I', offset)) return data.getvalue() @@ -313,7 +314,7 @@ class LitWriter(object): oeb.metadata.add('calibre-version', calibre.__version__) cover = None if oeb.metadata.cover: - id = unicode(oeb.metadata.cover[0]) + id = unicode_type(oeb.metadata.cover[0]) cover = oeb.manifest.ids[id] for type, title in ALL_MS_COVER_TYPES: if type not in oeb.guide: @@ -485,7 +486,7 @@ class LitWriter(object): data = rebin.content name = name + '/content' secnum = 1 - elif isinstance(data, unicode): + elif isinstance(data, unicode_type): data = data.encode('utf-8') elif hasattr(data, 'cssText'): data = str(item) @@ -521,9 +522,9 @@ class LitWriter(object): item.offset = offset \ if state in ('linear', 'nonlinear') else 0 data.write(pack('<I', item.offset)) - entry = [unichr(len(id)), unicode(id), - unichr(len(href)), unicode(href), - unichr(len(media_type)), unicode(media_type)] + entry = [codepoint_to_chr(len(id)), unicode_type(id), + codepoint_to_chr(len(href)), unicode_type(href), + codepoint_to_chr(len(media_type)), unicode_type(media_type)] for value in entry: data.write(value.encode('utf-8')) data.write('\0') diff --git a/src/calibre/ebooks/lrf/html/convert_from.py b/src/calibre/ebooks/lrf/html/convert_from.py index 12f1765872..9ccfe8f2a5 100644 --- a/src/calibre/ebooks/lrf/html/convert_from.py +++ b/src/calibre/ebooks/lrf/html/convert_from.py @@ -36,6 +36,7 @@ from calibre.ptempfile import PersistentTemporaryFile from calibre.devices.interface import DevicePlugin as Device from calibre.ebooks.lrf.html.color_map import lrs_color from calibre.ebooks.chardet import xml_to_unicode +from polyglot.builtins import unicode_type def update_css(ncss, ocss): @@ -54,10 +55,10 @@ def munge_paths(basepath, url): if not path: path = basepath elif not os.path.isabs(path): - if isinstance(path, unicode): + if isinstance(path, unicode_type): path = path.encode(sys.getfilesystemencoding()) dn = os.path.dirname(basepath) - if isinstance(dn, unicode): + if isinstance(dn, unicode_type): dn = dn.encode(sys.getfilesystemencoding()) path = os.path.join(dn, path) return os.path.normpath(path), fragment @@ -272,7 +273,7 @@ class HTMLConverter(object): update_css(npcss, self.override_pcss) paths = [os.path.abspath(path) for path in paths] - paths = [path.decode(sys.getfilesystemencoding()) if not isinstance(path, unicode) else path for path in paths] + paths = [path.decode(sys.getfilesystemencoding()) if not isinstance(path, unicode_type) else path for path in paths] while len(paths) > 0 and self.link_level <= self.link_levels: for path in paths: @@ -336,7 +337,7 @@ class HTMLConverter(object): markupMassage=nmassage) except ConversionError as err: if 'Failed to coerce to unicode' in str(err): - raw = unicode(raw, 'utf8', 'replace') + raw = unicode_type(raw, 'utf8', 'replace') soup = BeautifulSoup(raw, convertEntities=BeautifulSoup.XHTML_ENTITIES, markupMassage=nmassage) @@ -359,7 +360,7 @@ class HTMLConverter(object): os.makedirs(tdir) try: dump = open(os.path.join(tdir, 'html2lrf-verbose.html'), 'wb') - dump.write(unicode(soup).encode('utf-8')) + dump.write(unicode_type(soup).encode('utf-8')) self.log.info(_('Written preprocessed HTML to ')+dump.name) dump.close() except: @@ -394,7 +395,7 @@ class HTMLConverter(object): self.log.info(_('\tConverting to BBeB...')) self.current_style = {} self.page_break_found = False - if not isinstance(path, unicode): + if not isinstance(path, unicode_type): path = path.decode(sys.getfilesystemencoding()) self.target_prefix = path self.previous_text = '\n' @@ -589,7 +590,7 @@ class HTMLConverter(object): if isinstance(c, HTMLConverter.IGNORED_TAGS): continue if isinstance(c, NavigableString): - text += unicode(c) + text += unicode_type(c) elif isinstance(c, Tag): if c.name.lower() == 'img' and c.has_key('alt'): # noqa alt_text += c['alt'] @@ -644,7 +645,7 @@ class HTMLConverter(object): para, text, path, fragment = link['para'], link['text'], link['path'], link['fragment'] ascii_text = text - if not isinstance(path, unicode): + if not isinstance(path, unicode_type): path = path.decode(sys.getfilesystemencoding()) if path in self.processed_files: if path+fragment in self.targets.keys(): @@ -1323,7 +1324,7 @@ class HTMLConverter(object): bl = str(self.current_block.blockStyle.attrs['blockwidth'])+'px' if 'em' in tag_css['text-indent']: bl = '10pt' - indent = self.unit_convert(unicode(tag_css['text-indent']), pts=True, base_length=bl) + indent = self.unit_convert(unicode_type(tag_css['text-indent']), pts=True, base_length=bl) if not indent: indent = 0 if indent > 0 and indent < 10 * self.minimum_indent: @@ -1482,7 +1483,7 @@ class HTMLConverter(object): enc = sys.getfilesystemencoding() if not enc: enc = 'utf8' - if isinstance(path, unicode): + if isinstance(path, unicode_type): path = path.encode(enc, 'replace') if os.access(path, os.R_OK) and os.path.isfile(path): if ext in ['png', 'jpg', 'bmp', 'jpeg']: @@ -1526,7 +1527,7 @@ class HTMLConverter(object): elif tagname in ['style', 'link']: ncss, npcss = {}, {} if tagname == 'style': - text = ''.join([unicode(i) for i in tag.findAll(text=True)]) + text = ''.join([unicode_type(i) for i in tag.findAll(text=True)]) css, pcss = self.parse_css(text) ncss.update(css) npcss.update(pcss) @@ -1559,7 +1560,7 @@ class HTMLConverter(object): if tag.contents: c = tag.contents[0] if isinstance(c, NavigableString): - c = unicode(c).replace('\r\n', '\n').replace('\r', '\n') + c = unicode_type(c).replace('\r\n', '\n').replace('\r', '\n') if c.startswith('\n'): c = c[1:] tag.contents[0] = NavigableString(c) @@ -1759,7 +1760,7 @@ class HTMLConverter(object): except Exception as err: self.log.warning(_('An error occurred while processing a table: %s. Ignoring table markup.')%repr(err)) self.log.exception('') - self.log.debug(_('Bad table:\n%s')%unicode(tag)[:300]) + self.log.debug(_('Bad table:\n%s')%unicode_type(tag)[:300]) self.in_table = False self.process_children(tag, tag_css, tag_pseudo_css) finally: @@ -1810,7 +1811,7 @@ class HTMLConverter(object): def process_file(path, options, logger): - if not isinstance(path, unicode): + if not isinstance(path, unicode_type): path = path.decode(sys.getfilesystemencoding()) path = os.path.abspath(path) default_title = filename_to_utf8(os.path.splitext(os.path.basename(path))[0]) @@ -1857,9 +1858,9 @@ def process_file(path, options, logger): for prop in ('author', 'author_sort', 'title', 'title_sort', 'publisher', 'freetext'): val = getattr(options, prop, None) - if val and not isinstance(val, unicode): + if val and not isinstance(val, unicode_type): soup = BeautifulSoup(val) - setattr(options, prop, unicode(soup)) + setattr(options, prop, unicode_type(soup)) title = (options.title, options.title_sort) author = (options.author, options.author_sort) @@ -1903,7 +1904,7 @@ def process_file(path, options, logger): options.force_page_break = fpb options.link_exclude = le options.page_break = pb - if not isinstance(options.chapter_regex, unicode): + if not isinstance(options.chapter_regex, unicode_type): options.chapter_regex = options.chapter_regex.decode(preferred_encoding) options.chapter_regex = re.compile(options.chapter_regex, re.IGNORECASE) fpba = options.force_page_break_attr.split(',') diff --git a/src/calibre/ebooks/lrf/html/table_as_image.py b/src/calibre/ebooks/lrf/html/table_as_image.py index d8dcd40fee..22aca5b0f8 100644 --- a/src/calibre/ebooks/lrf/html/table_as_image.py +++ b/src/calibre/ebooks/lrf/html/table_as_image.py @@ -11,6 +11,8 @@ from PyQt5.Qt import QUrl, QApplication, QSize, QEventLoop, \ QPainter, QImage, QObject, Qt from PyQt5.QtWebKitWidgets import QWebPage +from polyglot.builtins import unicode_type + class HTMLTableRenderer(QObject): @@ -67,7 +69,7 @@ class HTMLTableRenderer(QObject): def render_table(soup, table, css, base_dir, width, height, dpi, factor=1.0): head = '' for e in soup.findAll(['link', 'style']): - head += unicode(e)+'\n\n' + head += unicode_type(e)+'\n\n' style = '' for key, val in css.items(): style += key + ':%s;'%val @@ -83,7 +85,7 @@ def render_table(soup, table, css, base_dir, width, height, dpi, factor=1.0): %s </body> </html> - '''%(head, width-10, style, unicode(table)) + '''%(head, width-10, style, unicode_type(table)) images, tdir = do_render(html, base_dir, width, height, dpi, factor) atexit.register(shutil.rmtree, tdir) return images diff --git a/src/calibre/ebooks/lrf/lrfparser.py b/src/calibre/ebooks/lrf/lrfparser.py index 7315316eeb..1760de269a 100644 --- a/src/calibre/ebooks/lrf/lrfparser.py +++ b/src/calibre/ebooks/lrf/lrfparser.py @@ -10,6 +10,7 @@ from calibre.utils.filenames import ascii_filename from calibre.ebooks.lrf.meta import LRFMetaFile from calibre.ebooks.lrf.objects import get_object, PageTree, StyleObject, \ Font, Text, TOCObject, BookAttr, ruby_tags +from polyglot.builtins import unicode_type class LRFDocument(LRFMetaFile): @@ -112,7 +113,7 @@ class LRFDocument(LRFMetaFile): pages += u'<PageTree objid="%d">\n'%(page_tree.id,) close = u'</PageTree>\n' for page in page_tree: - pages += unicode(page) + pages += unicode_type(page) pages += close traversed_objects = [int(i) for i in re.findall(r'objid="(\w+)"', pages)] + [pt_id] @@ -125,9 +126,9 @@ class LRFDocument(LRFMetaFile): if isinstance(obj, (Font, Text, TOCObject)): continue if isinstance(obj, StyleObject): - styles += unicode(obj) + styles += unicode_type(obj) else: - objects += unicode(obj) + objects += unicode_type(obj) styles += '</Style>\n' objects += '</Objects>\n' if write_files: diff --git a/src/calibre/ebooks/lrf/meta.py b/src/calibre/ebooks/lrf/meta.py index 4f890c7c73..49e944a70d 100644 --- a/src/calibre/ebooks/lrf/meta.py +++ b/src/calibre/ebooks/lrf/meta.py @@ -20,6 +20,7 @@ import xml.dom.minidom as dom from functools import wraps from calibre.ebooks.metadata import MetaInformation, string_to_authors +from polyglot.builtins import unicode_type BYTE = "<B" #: Unsigned char little endian encoded in 1 byte WORD = "<H" #: Unsigned short little endian encoded in 2 bytes @@ -195,8 +196,8 @@ class xml_field(object): if not val: val = u'' - if type(val).__name__ != 'unicode': - val = unicode(val, 'utf-8') + if isinstance(val, unicode_type): + val = unicode_type(val, 'utf-8') elems = document.getElementsByTagName(self.tag_name) elem = None diff --git a/src/calibre/ebooks/lrf/objects.py b/src/calibre/ebooks/lrf/objects.py index 41086bdcaa..c23b1136ac 100644 --- a/src/calibre/ebooks/lrf/objects.py +++ b/src/calibre/ebooks/lrf/objects.py @@ -6,6 +6,7 @@ import struct, array, zlib, cStringIO, collections, re from calibre.ebooks.lrf import LRFParseError, PRS500_PROFILE from calibre import entity_to_unicode, prepare_string_for_xml from calibre.ebooks.lrf.tags import Tag +from polyglot.builtins import unicode_type ruby_tags = { 0xF575: ['rubyAlignAndAdjust', 'W'], @@ -88,10 +89,10 @@ class LRFObject(object): yield i def __unicode__(self): - return unicode(self.__class__.__name__) + return unicode_type(self.__class__.__name__) def __str__(self): - return unicode(self).encode('utf-8') + return unicode_type(self).encode('utf-8') class LRFContentObject(LRFObject): @@ -255,7 +256,7 @@ class Color(object): return u'0x%02x%02x%02x%02x'%(self.a, self.r, self.g, self.b) def __str__(self): - return unicode(self) + return unicode_type(self) def __len__(self): return 4 @@ -274,7 +275,7 @@ class EmptyPageElement(object): yield i def __str__(self): - return unicode(self) + return unicode_type(self) class PageDiv(EmptyPageElement): @@ -429,12 +430,12 @@ class Page(LRFStream): def __unicode__(self): s = u'\n<Page pagestyle="%d" objid="%d">\n'%(self.style_id, self.id) for i in self: - s += unicode(i) + s += unicode_type(i) s += '\n</Page>\n' return s def __str__(self): - return unicode(self) + return unicode_type(self) def to_html(self): s = u'' @@ -619,7 +620,7 @@ class Block(LRFStream, TextCSS): s += '%s="%s" '%(attr, self.attrs[attr]) if self.name != 'ImageBlock': s = s.rstrip()+'>\n' - s += unicode(self.content) + s += unicode_type(self.content) s += '</%s>\n'%(self.name,) return s return s.rstrip() + ' />\n' @@ -717,7 +718,7 @@ class Text(LRFStream): lineposition_map = {1:'before', 2:'after'} def add_text(self, text): - s = unicode(text, "utf-16-le") + s = unicode_type(text, "utf-16-le") if s: s = s.translate(self.text_map) self.content.append(self.entity_pattern.sub(entity_to_unicode, s)) @@ -888,7 +889,7 @@ class Text(LRFStream): p = open_containers.pop() s += u'</%s>'%(p.name,) else: - s += unicode(c) + s += unicode_type(c) if not c.self_closing: open_containers.append(c) @@ -1001,7 +1002,7 @@ class Canvas(LRFStream): s += '%s="%s" '%(attr, self.attrs[attr]) s = s.rstrip() + '>\n' for po in self: - s += unicode(po) + '\n' + s += unicode_type(po) + '\n' s += '</%s>\n'%(self.__class__.__name__,) return s @@ -1198,7 +1199,7 @@ class BookAttr(StyleObject, LRFObject): s += u'<BookSetting bindingdirection="%s" dpi="%s" screenwidth="%s" screenheight="%s" colordepth="%s" />\n'%\ (self.binding_map[doc.binding], doc.dpi, doc.width, doc.height, doc.color_depth) for font in self._document.font_map.values(): - s += unicode(font) + s += unicode_type(font) s += '</BookStyle>\n' return s @@ -1239,7 +1240,7 @@ class TOCObject(LRFStream): def __unicode__(self): s = u'<TOC>\n' for i in self: - s += unicode(i) + s += unicode_type(i) return s + '</TOC>\n' @@ -1288,5 +1289,3 @@ def get_object(document, stream, id, offset, size, scramble_key): return object_map[obj_type](document, stream, obj_id, scramble_key, offset+size-Tag.tags[0][0]) raise LRFParseError("Unknown object type: %02X!" % obj_type) - - diff --git a/src/calibre/ebooks/lrf/pylrs/elements.py b/src/calibre/ebooks/lrf/pylrs/elements.py index b727b9dd5b..08316eaa7d 100644 --- a/src/calibre/ebooks/lrf/pylrs/elements.py +++ b/src/calibre/ebooks/lrf/pylrs/elements.py @@ -1,5 +1,7 @@ """ elements.py -- replacements and helpers for ElementTree """ +from polyglot.builtins import unicode_type + class ElementWriter(object): @@ -21,9 +23,9 @@ class ElementWriter(object): return text def _writeAttribute(self, f, name, value): - f.write(u' %s="' % unicode(name)) + f.write(u' %s="' % unicode_type(name)) if not isinstance(value, basestring): - value = unicode(value) + value = unicode_type(value) value = self._encodeCdata(value) value = value.replace('"', '"') f.write(value) @@ -34,7 +36,7 @@ class ElementWriter(object): f.write(text) def _write(self, f, e): - f.write(u'<' + unicode(e.tag)) + f.write(u'<' + unicode_type(e.tag)) attributes = e.items() attributes.sort() @@ -72,6 +74,3 @@ class ElementWriter(object): f.write(u'<?xml version="1.0" encoding="%s"?>\n' % self.outputEncodingName) self._write(f, self.e) - - - diff --git a/src/calibre/ebooks/lrf/tags.py b/src/calibre/ebooks/lrf/tags.py index 1767f1888a..f557a8886d 100644 --- a/src/calibre/ebooks/lrf/tags.py +++ b/src/calibre/ebooks/lrf/tags.py @@ -5,6 +5,7 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>' import struct from calibre.ebooks.lrf import LRFParseError +from polyglot.builtins import unicode_type class Tag(object): @@ -246,7 +247,7 @@ class Tag(object): @classmethod def string_parser(self, stream): size = struct.unpack("<H", stream.read(2))[0] - return unicode(stream.read(size), "utf_16") + return unicode_type(stream.read(size), "utf_16") def type_one_parser(self, stream): cnt = struct.unpack("<H", stream.read(2))[0] diff --git a/src/calibre/ebooks/metadata/__init__.py b/src/calibre/ebooks/metadata/__init__.py index 844c80fd2a..e6d435b831 100644 --- a/src/calibre/ebooks/metadata/__init__.py +++ b/src/calibre/ebooks/metadata/__init__.py @@ -15,6 +15,8 @@ from calibre import relpath, guess_type, remove_bracketed_text, prints, force_un from calibre.utils.config_base import tweaks +from polyglot.builtins import codepoint_to_chr, unicode_type + try: _author_pat = re.compile(tweaks['authors_split_regex']) except: @@ -134,7 +136,7 @@ def get_title_sort_pat(lang=None): return ans -_ignore_starts = u'\'"'+u''.join(unichr(x) for x in +_ignore_starts = u'\'"'+u''.join(codepoint_to_chr(x) for x in range(0x2018, 0x201e)+[0x2032, 0x2033]) @@ -227,7 +229,7 @@ class Resource(object): self._href = href_or_path else: pc = url[2] - if isinstance(pc, unicode): + if isinstance(pc, unicode_type): pc = pc.encode('utf-8') pc = unquote(pc).decode('utf-8') self.path = os.path.abspath(os.path.join(basedir, pc.replace('/', os.sep))) @@ -249,7 +251,7 @@ class Resource(object): basedir = os.getcwdu() if self.path is None: return self._href - f = self.fragment.encode('utf-8') if isinstance(self.fragment, unicode) else self.fragment + f = self.fragment.encode('utf-8') if isinstance(self.fragment, unicode_type) else self.fragment frag = '#'+quote(f) if self.fragment else '' if self.path == basedir: return ''+frag @@ -257,7 +259,7 @@ class Resource(object): rpath = relpath(self.path, basedir) except OSError: # On windows path and basedir could be on different drives rpath = self.path - if isinstance(rpath, unicode): + if isinstance(rpath, unicode_type): rpath = rpath.encode('utf-8') return quote(rpath.replace(os.sep, '/'))+frag diff --git a/src/calibre/ebooks/metadata/book/base.py b/src/calibre/ebooks/metadata/book/base.py index 6983637e91..0175dbdb80 100644 --- a/src/calibre/ebooks/metadata/book/base.py +++ b/src/calibre/ebooks/metadata/book/base.py @@ -14,6 +14,7 @@ from calibre.ebooks.metadata.book import (SC_COPYABLE_FIELDS, TOP_LEVEL_IDENTIFIERS, ALL_METADATA_FIELDS) from calibre.library.field_metadata import FieldMetadata from calibre.utils.icu import sort_key +from polyglot.builtins import unicode_type # Special sets used to optimize the performance of getting and setting # attributes on Metadata objects @@ -606,14 +607,14 @@ class Metadata(object): return authors_to_string(self.authors) def format_tags(self): - return u', '.join([unicode(t) for t in sorted(self.tags, key=sort_key)]) + return u', '.join([unicode_type(t) for t in sorted(self.tags, key=sort_key)]) def format_rating(self, v=None, divide_by=1.0): if v is None: if self.rating is not None: - return unicode(self.rating/divide_by) + return unicode_type(self.rating/divide_by) return u'None' - return unicode(v/divide_by) + return unicode_type(v/divide_by) def format_field(self, key, series_with_index=True): ''' @@ -637,15 +638,15 @@ class Metadata(object): if cmeta and cmeta['datatype'] == 'series': if self.get(tkey): res = self.get_extra(tkey) - return (unicode(cmeta['name']+'_index'), + return (unicode_type(cmeta['name']+'_index'), self.format_series_index(res), res, cmeta) else: - return (unicode(cmeta['name']+'_index'), '', '', cmeta) + return (unicode_type(cmeta['name']+'_index'), '', '', cmeta) if key in self.custom_field_keys(): res = self.get(key, None) # get evaluates all necessary composites cmeta = self.get_user_metadata(key, make_copy=False) - name = unicode(cmeta['name']) + name = unicode_type(cmeta['name']) if res is None or res == '': # can't check "not res" because of numeric fields return (name, res, None, None) orig_res = res @@ -668,7 +669,7 @@ class Metadata(object): res = fmt.format(res) except: pass - return (name, unicode(res), orig_res, cmeta) + return (name, unicode_type(res), orig_res, cmeta) # convert top-level ids into their value if key in TOP_LEVEL_IDENTIFIERS: @@ -682,11 +683,11 @@ class Metadata(object): if fmkey in field_metadata and field_metadata[fmkey]['kind'] == 'field': res = self.get(key, None) fmeta = field_metadata[fmkey] - name = unicode(fmeta['name']) + name = unicode_type(fmeta['name']) if res is None or res == '': return (name, res, None, None) orig_res = res - name = unicode(fmeta['name']) + name = unicode_type(fmeta['name']) datatype = fmeta['datatype'] if key == 'authors': res = authors_to_string(res) @@ -704,7 +705,7 @@ class Metadata(object): res = u'%.2g'%(res/2.0) elif key == 'size': res = human_readable(res) - return (name, unicode(res), orig_res, fmeta) + return (name, unicode_type(res), orig_res, fmeta) return (None, None, None, None) @@ -718,7 +719,7 @@ class Metadata(object): ans = [] def fmt(x, y): - ans.append(u'%-20s: %s'%(unicode(x), unicode(y))) + ans.append(u'%-20s: %s'%(unicode_type(x), unicode_type(y))) fmt('Title', self.title) if self.title_sort: @@ -732,7 +733,7 @@ class Metadata(object): if getattr(self, 'book_producer', False): fmt('Book Producer', self.book_producer) if self.tags: - fmt('Tags', u', '.join([unicode(t) for t in self.tags])) + fmt('Tags', u', '.join([unicode_type(t) for t in self.tags])) if self.series: fmt('Series', self.series + ' #%s'%self.format_series_index()) if not self.is_null('languages'): @@ -745,7 +746,7 @@ class Metadata(object): if self.pubdate is not None: fmt('Published', isoformat(self.pubdate)) if self.rights is not None: - fmt('Rights', unicode(self.rights)) + fmt('Rights', unicode_type(self.rights)) if self.identifiers: fmt('Identifiers', u', '.join(['%s:%s'%(k, v) for k, v in self.identifiers.iteritems()])) @@ -756,7 +757,7 @@ class Metadata(object): val = self.get(key, None) if val: (name, val) = self.format_field(key) - fmt(name, unicode(val)) + fmt(name, unicode_type(val)) return u'\n'.join(ans) def to_html(self): @@ -765,22 +766,22 @@ class Metadata(object): ''' from calibre.ebooks.metadata import authors_to_string from calibre.utils.date import isoformat - ans = [(_('Title'), unicode(self.title))] + ans = [(_('Title'), unicode_type(self.title))] ans += [(_('Author(s)'), (authors_to_string(self.authors) if self.authors else _('Unknown')))] - ans += [(_('Publisher'), unicode(self.publisher))] - ans += [(_('Producer'), unicode(self.book_producer))] - ans += [(_('Comments'), unicode(self.comments))] - ans += [('ISBN', unicode(self.isbn))] - ans += [(_('Tags'), u', '.join([unicode(t) for t in self.tags]))] + ans += [(_('Publisher'), unicode_type(self.publisher))] + ans += [(_('Producer'), unicode_type(self.book_producer))] + ans += [(_('Comments'), unicode_type(self.comments))] + ans += [('ISBN', unicode_type(self.isbn))] + ans += [(_('Tags'), u', '.join([unicode_type(t) for t in self.tags]))] if self.series: - ans += [(_('Series'), unicode(self.series) + ' #%s'%self.format_series_index())] + ans += [(_('Series'), unicode_type(self.series) + ' #%s'%self.format_series_index())] ans += [(_('Languages'), u', '.join(self.languages))] if self.timestamp is not None: - ans += [(_('Timestamp'), unicode(isoformat(self.timestamp, as_utc=False, sep=' ')))] + ans += [(_('Timestamp'), unicode_type(isoformat(self.timestamp, as_utc=False, sep=' ')))] if self.pubdate is not None: - ans += [(_('Published'), unicode(isoformat(self.pubdate, as_utc=False, sep=' ')))] + ans += [(_('Published'), unicode_type(isoformat(self.pubdate, as_utc=False, sep=' ')))] if self.rights is not None: - ans += [(_('Rights'), unicode(self.rights))] + ans += [(_('Rights'), unicode_type(self.rights))] for key in self.custom_field_keys(): val = self.get(key, None) if val: diff --git a/src/calibre/ebooks/metadata/book/render.py b/src/calibre/ebooks/metadata/book/render.py index 060318d87b..6b4519e2aa 100644 --- a/src/calibre/ebooks/metadata/book/render.py +++ b/src/calibre/ebooks/metadata/book/render.py @@ -20,6 +20,7 @@ from calibre.utils.icu import sort_key from calibre.utils.formatter import EvalFormatter from calibre.utils.date import is_date_undefined from calibre.utils.localization import calibre_langcode_to_name +from polyglot.builtins import unicode_type default_sort = ('title', 'title_sort', 'authors', 'author_sort', 'series', 'rating', 'pubdate', 'tags', 'publisher', 'identifiers') @@ -163,7 +164,7 @@ def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers= path = force_unicode(mi.path, filesystem_encoding) scheme = u'devpath' if isdevice else u'path' url = prepare_string_for_xml(path if isdevice else - unicode(book_id), True) + unicode_type(book_id), True) pathstr = _('Click to open') extra = '' if isdevice: diff --git a/src/calibre/ebooks/metadata/book/serialize.py b/src/calibre/ebooks/metadata/book/serialize.py index fdca2d0610..e1a7189530 100644 --- a/src/calibre/ebooks/metadata/book/serialize.py +++ b/src/calibre/ebooks/metadata/book/serialize.py @@ -10,10 +10,11 @@ from calibre.constants import preferred_encoding from calibre.ebooks.metadata.book import SERIALIZABLE_FIELDS from calibre.ebooks.metadata.book.base import Metadata from calibre.utils.imghdr import what +from polyglot.builtins import unicode_type def ensure_unicode(obj, enc=preferred_encoding): - if isinstance(obj, unicode): + if isinstance(obj, unicode_type): return obj if isinstance(obj, bytes): return obj.decode(enc, 'replace') diff --git a/src/calibre/ebooks/metadata/cli.py b/src/calibre/ebooks/metadata/cli.py index b3ab36901c..5a7643c946 100644 --- a/src/calibre/ebooks/metadata/cli.py +++ b/src/calibre/ebooks/metadata/cli.py @@ -16,6 +16,7 @@ from calibre.ebooks.metadata import string_to_authors, authors_to_sort_string, \ from calibre.ebooks.lrf.meta import LRFMetaFile from calibre import prints from calibre.utils.date import parse_date +from polyglot.builtins import unicode_type USAGE=_('%prog ebook_file [options]\n') + \ _(''' @@ -181,7 +182,7 @@ def main(args=sys.argv): mi = get_metadata(stream, stream_type, force_read_metadata=True) if trying_to_set: prints(_('Original metadata')+'::') - metadata = unicode(mi) + metadata = unicode_type(mi) if trying_to_set: metadata = '\t'+'\n\t'.join(metadata.split('\n')) prints(metadata, safe_encode=True) @@ -198,7 +199,7 @@ def main(args=sys.argv): lrf.book_id = opts.lrf_bookid mi = get_metadata(stream, stream_type, force_read_metadata=True) prints('\n' + _('Changed metadata') + '::') - metadata = unicode(mi) + metadata = unicode_type(mi) metadata = '\t'+'\n\t'.join(metadata.split('\n')) prints(metadata, safe_encode=True) if lrf is not None: diff --git a/src/calibre/ebooks/metadata/fb2.py b/src/calibre/ebooks/metadata/fb2.py index 3a1945a20e..949b76aae5 100644 --- a/src/calibre/ebooks/metadata/fb2.py +++ b/src/calibre/ebooks/metadata/fb2.py @@ -18,6 +18,7 @@ from calibre.utils.imghdr import identify from calibre import guess_type, guess_all_extensions, prints, force_unicode from calibre.ebooks.metadata import MetaInformation, check_isbn from calibre.ebooks.chardet import xml_to_unicode +from polyglot.builtins import unicode_type NAMESPACES = { @@ -26,7 +27,7 @@ NAMESPACES = { 'xlink' : 'http://www.w3.org/1999/xlink' } -tostring = partial(etree.tostring, method='text', encoding=unicode) +tostring = partial(etree.tostring, method='text', encoding=unicode_type) def XLINK(tag): @@ -112,9 +113,9 @@ def get_metadata(stream): # fallback for book_title if book_title: - book_title = unicode(book_title) + book_title = unicode_type(book_title) else: - book_title = force_unicode(os.path.splitext( + book_title = force_unicode_type(os.path.splitext( os.path.basename(getattr(stream, 'name', _('Unknown'))))[0]) mi = MetaInformation(book_title, authors) @@ -249,7 +250,7 @@ def _parse_tags(root, mi, ctx): # -- i18n Translations-- ? tags = ctx.XPath('//fb:%s/fb:genre/text()' % genre_sec)(root) if tags: - mi.tags = list(map(unicode, tags)) + mi.tags = list(map(unicode_type, tags)) break @@ -447,7 +448,7 @@ def ensure_namespace(doc): break if bare_tags: import re - raw = etree.tostring(doc, encoding=unicode) + raw = etree.tostring(doc, encoding=unicode_type) raw = re.sub(r'''<(description|body)\s+xmlns=['"]['"]>''', r'<\1>', raw) doc = etree.fromstring(raw) return doc diff --git a/src/calibre/ebooks/metadata/imp.py b/src/calibre/ebooks/metadata/imp.py index 4e8c87c93a..d8991c8ea0 100644 --- a/src/calibre/ebooks/metadata/imp.py +++ b/src/calibre/ebooks/metadata/imp.py @@ -6,6 +6,7 @@ __copyright__ = '2008, Ashish Kulkarni <kulkarni.ashish@gmail.com>' import sys from calibre.ebooks.metadata import MetaInformation, string_to_authors +from polyglot.builtins import unicode_type MAGIC = ['\x00\x01BOOKDOUG', '\x00\x02BOOKDOUG'] @@ -43,6 +44,6 @@ def get_metadata(stream): if category: mi.category = category except Exception as err: - msg = u'Couldn\'t read metadata from imp: %s with error %s'%(mi.title, unicode(err)) + msg = u'Couldn\'t read metadata from imp: %s with error %s'%(mi.title, unicode_type(err)) print(msg.encode('utf8'), file=sys.stderr) return mi diff --git a/src/calibre/ebooks/metadata/kdl.py b/src/calibre/ebooks/metadata/kdl.py index e5b5847b35..c84eae04fa 100644 --- a/src/calibre/ebooks/metadata/kdl.py +++ b/src/calibre/ebooks/metadata/kdl.py @@ -14,11 +14,12 @@ from calibre.ebooks.metadata.book.base import Metadata from calibre import browser from calibre.ebooks.BeautifulSoup import BeautifulSoup from calibre.ebooks.chardet import xml_to_unicode +from polyglot.builtins import codepoint_to_chr, unicode_type URL = \ "http://ww2.kdl.org/libcat/WhatsNext.asp?AuthorLastName={0}&AuthorFirstName=&SeriesName=&BookTitle={1}&CategoryID=0&cmdSearch=Search&Search=1&grouping=" -_ignore_starts = u'\'"'+u''.join(unichr(x) for x in range(0x2018, 0x201e)+[0x2032, 0x2033]) +_ignore_starts = u'\'"'+u''.join(codepoint_to_chr(x) for x in range(0x2018, 0x201e)+[0x2032, 0x2033]) def get_series(title, authors, timeout=60): @@ -28,7 +29,7 @@ def get_series(title, authors, timeout=60): title = re.sub(r'^(A|The|An)\s+', '', title).strip() if not title: return mi - if isinstance(title, unicode): + if isinstance(title, unicode_type): title = title.encode('utf-8') title = urllib.quote_plus(title) @@ -73,7 +74,7 @@ def get_series(title, authors, timeout=60): mi.series = series ns = ss.nextSibling if ns.contents: - raw = unicode(ns.contents[0]) + raw = unicode_type(ns.contents[0]) raw = raw.partition('.')[0].strip() try: mi.series_index = int(raw) @@ -85,4 +86,3 @@ def get_series(title, authors, timeout=60): if __name__ == '__main__': import sys print(get_series(sys.argv[-2], [sys.argv[-1]])) - diff --git a/src/calibre/ebooks/metadata/kfx.py b/src/calibre/ebooks/metadata/kfx.py index 72625eea0b..d427c0a111 100644 --- a/src/calibre/ebooks/metadata/kfx.py +++ b/src/calibre/ebooks/metadata/kfx.py @@ -18,6 +18,7 @@ from calibre.utils.config_base import tweaks from calibre.utils.date import parse_only_date from calibre.utils.localization import canonicalize_lang from calibre.utils.imghdr import identify +from polyglot.builtins import unicode_type class InvalidKFX(ValueError): @@ -356,4 +357,4 @@ if __name__ == '__main__': from calibre import prints with open(sys.argv[-1], 'rb') as f: mi = read_metadata_kfx(f) - prints(unicode(mi)) + prints(unicode_type(mi)) diff --git a/src/calibre/ebooks/metadata/mobi.py b/src/calibre/ebooks/metadata/mobi.py index 71e1b3bfc6..26dcbe4793 100644 --- a/src/calibre/ebooks/metadata/mobi.py +++ b/src/calibre/ebooks/metadata/mobi.py @@ -21,6 +21,7 @@ from calibre.ebooks.mobi.langcodes import iana2mobi from calibre.utils.date import now as nowf from calibre.utils.imghdr import what from calibre.utils.localization import canonicalize_lang, lang_as_iso639_1 +from polyglot.builtins import unicode_type def is_image(ss): @@ -223,7 +224,7 @@ class MetadataUpdater(object): def create_exth(self, new_title=None, exth=None): # Add an EXTH block to record 0, rewrite the stream - if isinstance(new_title, unicode): + if isinstance(new_title, unicode_type): new_title = new_title.encode(self.codec, 'replace') # Fetch the existing title diff --git a/src/calibre/ebooks/metadata/opf2.py b/src/calibre/ebooks/metadata/opf2.py index 4089c9a6a2..0af4a40724 100644 --- a/src/calibre/ebooks/metadata/opf2.py +++ b/src/calibre/ebooks/metadata/opf2.py @@ -25,6 +25,7 @@ from calibre.utils.localization import get_lang, canonicalize_lang from calibre import prints, guess_type from calibre.utils.cleantext import clean_ascii_chars, clean_xml_chars from calibre.utils.config import tweaks +from polyglot.builtins import unicode_type pretty_print_opf = False @@ -82,7 +83,7 @@ class Resource(object): # {{{ self._href = href_or_path else: pc = url[2] - if isinstance(pc, unicode): + if isinstance(pc, unicode_type): pc = pc.encode('utf-8') pc = pc.decode('utf-8') self.path = os.path.abspath(os.path.join(basedir, pc.replace('/', os.sep))) @@ -103,7 +104,7 @@ class Resource(object): # {{{ basedir = os.getcwdu() if self.path is None: return self._href - f = self.fragment.encode('utf-8') if isinstance(self.fragment, unicode) else self.fragment + f = self.fragment.encode('utf-8') if isinstance(self.fragment, unicode_type) else self.fragment frag = '#'+f if self.fragment else '' if self.path == basedir: return ''+frag @@ -111,7 +112,7 @@ class Resource(object): # {{{ rpath = os.path.relpath(self.path, basedir) except ValueError: # On windows path and basedir could be on different drives rpath = self.path - if isinstance(rpath, unicode): + if isinstance(rpath, unicode_type): rpath = rpath.encode('utf-8') return rpath.replace(os.sep, '/')+frag @@ -206,10 +207,10 @@ class ManifestItem(Resource): # {{{ return u'<item id="%s" href="%s" media-type="%s" />'%(self.id, self.href(), self.media_type) def __str__(self): - return unicode(self).encode('utf-8') + return unicode_type(self).encode('utf-8') def __repr__(self): - return unicode(self) + return unicode_type(self) def __getitem__(self, index): if index == 0: @@ -410,7 +411,7 @@ class Guide(ResourceCollection): # {{{ class MetadataField(object): def __init__(self, name, is_dc=True, formatter=None, none_is=None, - renderer=lambda x: unicode(x)): + renderer=lambda x: unicode_type(x)): self.name = name self.is_dc = is_dc self.formatter = formatter @@ -791,7 +792,7 @@ class OPF(object): # {{{ def unquote_urls(self): def get_href(item): raw = unquote(item.get('href', '')) - if not isinstance(raw, unicode): + if not isinstance(raw, unicode_type): raw = raw.decode('utf-8') return raw for item in self.itermanifest(): @@ -820,7 +821,7 @@ class OPF(object): # {{{ titles = () if val: title = titles[0] if titles else self.create_metadata_element('title') - title.text = re.sub(r'\s+', ' ', unicode(val)) + title.text = re.sub(r'\s+', ' ', unicode_type(val)) return property(fget=fget, fset=fset) @@ -869,7 +870,7 @@ class OPF(object): # {{{ for key in matches[0].attrib: if key.endswith('file-as'): matches[0].attrib.pop(key) - matches[0].set('{%s}file-as'%self.NAMESPACES['opf'], unicode(val)) + matches[0].set('{%s}file-as'%self.NAMESPACES['opf'], unicode_type(val)) return property(fget=fget, fset=fset) @@ -889,7 +890,7 @@ class OPF(object): # {{{ tag.getparent().remove(tag) for tag in val: elem = self.create_metadata_element('subject') - self.set_text(elem, unicode(tag)) + self.set_text(elem, unicode_type(tag)) return property(fget=fget, fset=fset) @@ -900,7 +901,7 @@ class OPF(object): # {{{ ans = None for match in self.pubdate_path(self.metadata): try: - val = parse_date(etree.tostring(match, encoding=unicode, + val = parse_date(etree.tostring(match, encoding=unicode_type, method='text', with_tail=False).strip()) except: continue @@ -912,7 +913,7 @@ class OPF(object): # {{{ least_val = least_elem = None for match in self.pubdate_path(self.metadata): try: - cval = parse_date(etree.tostring(match, encoding=unicode, + cval = parse_date(etree.tostring(match, encoding=unicode_type, method='text', with_tail=False).strip()) except: match.getparent().remove(match) @@ -962,7 +963,7 @@ class OPF(object): # {{{ attrib = {'{%s}scheme'%self.NAMESPACES['opf']: 'ISBN'} matches = [self.create_metadata_element('identifier', attrib=attrib)] - self.set_text(matches[0], unicode(val)) + self.set_text(matches[0], unicode_type(val)) return property(fget=fget, fset=fset) @@ -975,7 +976,7 @@ class OPF(object): # {{{ for attr, val in x.attrib.iteritems(): if attr.endswith('scheme'): typ = icu_lower(val) - val = etree.tostring(x, with_tail=False, encoding=unicode, + val = etree.tostring(x, with_tail=False, encoding=unicode_type, method='text').strip() if val and typ not in ('calibre', 'uuid'): if typ == 'isbn' and val.lower().startswith('urn:isbn:'): @@ -984,7 +985,7 @@ class OPF(object): # {{{ found_scheme = True break if not found_scheme: - val = etree.tostring(x, with_tail=False, encoding=unicode, + val = etree.tostring(x, with_tail=False, encoding=unicode_type, method='text').strip() if val.lower().startswith('urn:isbn:'): val = check_isbn(val.split(':')[-1]) @@ -1017,7 +1018,7 @@ class OPF(object): # {{{ for typ, val in identifiers.iteritems(): attrib = {'{%s}scheme'%self.NAMESPACES['opf']: typ.upper()} self.set_text(self.create_metadata_element( - 'identifier', attrib=attrib), unicode(val)) + 'identifier', attrib=attrib), unicode_type(val)) @dynamic_property def application_id(self): @@ -1041,7 +1042,7 @@ class OPF(object): # {{{ if uuid_id and uuid_id in removed_ids: attrib['id'] = uuid_id self.set_text(self.create_metadata_element( - 'identifier', attrib=attrib), unicode(val)) + 'identifier', attrib=attrib), unicode_type(val)) return property(fget=fget, fset=fset) @@ -1058,7 +1059,7 @@ class OPF(object): # {{{ attrib = {'{%s}scheme'%self.NAMESPACES['opf']: 'uuid'} matches = [self.create_metadata_element('identifier', attrib=attrib)] - self.set_text(matches[0], unicode(val)) + self.set_text(matches[0], unicode_type(val)) return property(fget=fget, fset=fset) @@ -1095,7 +1096,7 @@ class OPF(object): # {{{ for lang in val: l = self.create_metadata_element('language') - self.set_text(l, unicode(lang)) + self.set_text(l, unicode_type(lang)) return property(fget=fget, fset=fset) @@ -1118,7 +1119,7 @@ class OPF(object): # {{{ if not matches: matches = [self.create_metadata_element('contributor')] matches[0].set('{%s}role'%self.NAMESPACES['opf'], 'bkp') - self.set_text(matches[0], unicode(val)) + self.set_text(matches[0], unicode_type(val)) return property(fget=fget, fset=fset) def identifier_iter(self): @@ -1701,7 +1702,7 @@ def metadata_to_opf(mi, as_string=True, default_lang=None): metadata[-1].tail = '\n' +(' '*4) if mi.cover: - if not isinstance(mi.cover, unicode): + if not isinstance(mi.cover, unicode_type): mi.cover = mi.cover.decode(filesystem_encoding) guide.text = '\n'+(' '*8) r = guide.makeelement(OPF('reference'), diff --git a/src/calibre/ebooks/metadata/pdf.py b/src/calibre/ebooks/metadata/pdf.py index 47df33c415..01a524afcd 100644 --- a/src/calibre/ebooks/metadata/pdf.py +++ b/src/calibre/ebooks/metadata/pdf.py @@ -12,6 +12,7 @@ from calibre.ptempfile import TemporaryDirectory from calibre.ebooks.metadata import ( MetaInformation, string_to_authors, check_isbn, check_doi) from calibre.utils.ipc.simple_worker import fork_job, WorkerError +from polyglot.builtins import unicode_type def get_tools(): @@ -88,8 +89,8 @@ def page_images(pdfpath, outputdir, first=1, last=1): import win32process as w args['creationflags'] = w.HIGH_PRIORITY_CLASS | w.CREATE_NO_WINDOW try: - subprocess.check_call([pdftoppm, '-cropbox', '-jpeg', '-f', unicode(first), - '-l', unicode(last), pdfpath, + subprocess.check_call([pdftoppm, '-cropbox', '-jpeg', '-f', unicode_type(first), + '-l', unicode_type(last), pdfpath, os.path.join(outputdir, 'page-images')], **args) except subprocess.CalledProcessError as e: raise ValueError('Failed to render PDF, pdftoppm errorcode: %s'%e.returncode) diff --git a/src/calibre/ebooks/metadata/rb.py b/src/calibre/ebooks/metadata/rb.py index f16bad1de9..a193ae44d9 100644 --- a/src/calibre/ebooks/metadata/rb.py +++ b/src/calibre/ebooks/metadata/rb.py @@ -6,6 +6,7 @@ __copyright__ = '2008, Ashish Kulkarni <kulkarni.ashish@gmail.com>' import sys, struct from calibre.ebooks.metadata import MetaInformation, string_to_authors +from polyglot.builtins import unicode_type MAGIC = '\xb0\x0c\xb0\x0c\x02\x00NUVO\x00\x00\x00\x00' @@ -47,9 +48,7 @@ def get_metadata(stream): mi.author = value mi.authors = string_to_authors(value) except Exception as err: - msg = u'Couldn\'t read metadata from rb: %s with error %s'%(mi.title, unicode(err)) + msg = u'Couldn\'t read metadata from rb: %s with error %s'%(mi.title, unicode_type(err)) print(msg.encode('utf8'), file=sys.stderr) raise return mi - - diff --git a/src/calibre/ebooks/metadata/rtf.py b/src/calibre/ebooks/metadata/rtf.py index ff89681782..31b36ac850 100644 --- a/src/calibre/ebooks/metadata/rtf.py +++ b/src/calibre/ebooks/metadata/rtf.py @@ -8,6 +8,7 @@ import re, cStringIO, codecs from calibre import force_unicode from calibre.ebooks.metadata import MetaInformation, string_to_authors +from polyglot.builtins import codepoint_to_chr, unicode_type title_pat = re.compile(r'\{\\info.*?\{\\title(.*?)(?<!\\)\}', re.DOTALL) author_pat = re.compile(r'\{\\info.*?\{\\author(.*?)(?<!\\)\}', re.DOTALL) @@ -75,7 +76,7 @@ def detect_codepage(stream): def encode(unistr): - if not isinstance(unistr, unicode): + if not isinstance(unistr, unicode_type): unistr = force_unicode(unistr) return ''.join([str(c) if ord(c) < 128 else '\\u' + str(ord(c)) + '?' for c in unistr]) @@ -88,7 +89,7 @@ def decode(raw, codec): raw = raw.decode(codec) def uni(match): - return unichr(int(match.group(1))) + return codepoint_to_chr(int(match.group(1))) raw = re.sub(r'\\u([0-9]{3,4}).', uni, raw) return raw @@ -232,4 +233,3 @@ def set_metadata(stream, options): stream.truncate() stream.write(src) stream.write(after) - diff --git a/src/calibre/ebooks/metadata/toc.py b/src/calibre/ebooks/metadata/toc.py index ecdf1a8354..0894ab6202 100644 --- a/src/calibre/ebooks/metadata/toc.py +++ b/src/calibre/ebooks/metadata/toc.py @@ -15,6 +15,7 @@ from calibre.constants import __appname__, __version__ from calibre.ebooks.BeautifulSoup import BeautifulSoup from calibre.ebooks.chardet import xml_to_unicode from calibre.utils.cleantext import clean_xml_chars +from polyglot.builtins import unicode_type NCX_NS = "http://www.daisy.org/z3986/2005/ncx/" CALIBRE_NS = "http://calibre.kovidgoyal.net/2009/metadata" @@ -194,7 +195,7 @@ class TOC(list): text = u'' for txt in txt_path(nl): text += etree.tostring(txt, method='text', - encoding=unicode, with_tail=False) + encoding=unicode_type, with_tail=False) content = content_path(np) if content and text: content = content[0] @@ -229,7 +230,7 @@ class TOC(list): fragment = fragment.strip() href = href.strip() - txt = ''.join([unicode(s).strip() for s in a.findAll(text=True)]) + txt = ''.join([unicode_type(s).strip() for s in a.findAll(text=True)]) add = True for i in self.flat(): if i.href == href and i.fragment == fragment: @@ -264,7 +265,7 @@ class TOC(list): text = clean_xml_chars(text) elem = E.navPoint( E.navLabel(E.text(re.sub(r'\s+', ' ', text))), - E.content(src=unicode(np.href)+(('#' + unicode(np.fragment)) + E.content(src=unicode_type(np.href)+(('#' + unicode_type(np.fragment)) if np.fragment else '')), id=item_id, playOrder=str(np.play_order) diff --git a/src/calibre/ebooks/mobi/debug/mobi6.py b/src/calibre/ebooks/mobi/debug/mobi6.py index 8eb76f198d..d67244b705 100644 --- a/src/calibre/ebooks/mobi/debug/mobi6.py +++ b/src/calibre/ebooks/mobi/debug/mobi6.py @@ -20,6 +20,7 @@ from calibre.ebooks.mobi.utils import (decode_hex_number, decint, from calibre.utils.imghdr import what from calibre.ebooks.mobi.debug import format_bytes from calibre.ebooks.mobi.debug.headers import TextRecord +from polyglot.builtins import unicode_type class TagX(object): # {{{ @@ -564,7 +565,7 @@ class TBSIndexing(object): # {{{ def get_index(self, idx): for i in self.indices: - if i.index in {idx, unicode(idx)}: + if i.index in {idx, unicode_type(idx)}: return i raise IndexError('Index %d not found'%idx) @@ -844,5 +845,3 @@ def inspect_mobi(mobi_file, ddir): # }}} - - diff --git a/src/calibre/ebooks/mobi/mobiml.py b/src/calibre/ebooks/mobi/mobiml.py index 120a1ea804..16e3926084 100644 --- a/src/calibre/ebooks/mobi/mobiml.py +++ b/src/calibre/ebooks/mobi/mobiml.py @@ -16,6 +16,7 @@ from calibre.ebooks.oeb.stylizer import Stylizer from calibre.ebooks.oeb.transforms.flatcss import KeyMapper from calibre.ebooks.mobi.utils import convert_color_for_font_tag from calibre.utils.imghdr import identify +from polyglot.builtins import unicode_type MBP_NS = 'http://mobipocket.com/ns/mbp' @@ -151,7 +152,7 @@ class MobiMLizer(object): return "%dem" % int(round(ptsize / embase)) def preize_text(self, text, pre_wrap=False): - text = unicode(text) + text = unicode_type(text) if pre_wrap: # Replace n consecutive spaces with n-1 NBSP + space text = re.sub(r' {2,}', lambda m:(u'\xa0'*(len(m.group())-1) + u' '), text) @@ -228,7 +229,7 @@ class MobiMLizer(object): while vspace > 0: wrapper.addprevious(etree.Element(XHTML('br'))) vspace -= 1 - if istate.halign != 'auto' and isinstance(istate.halign, (str, unicode)): + if istate.halign != 'auto' and isinstance(istate.halign, (str, unicode_type)): para.attrib['align'] = istate.halign istate.rendered = True pstate = bstate.istate diff --git a/src/calibre/ebooks/mobi/reader/headers.py b/src/calibre/ebooks/mobi/reader/headers.py index 433e80fbad..20cd94540d 100644 --- a/src/calibre/ebooks/mobi/reader/headers.py +++ b/src/calibre/ebooks/mobi/reader/headers.py @@ -16,6 +16,7 @@ from calibre.ebooks.mobi.langcodes import main_language, sub_language, mobi2iana from calibre.utils.cleantext import clean_ascii_chars, clean_xml_chars from calibre.utils.localization import canonicalize_lang from calibre.utils.config_base import tweaks +from polyglot.builtins import unicode_type NULL_INDEX = 0xffffffff @@ -239,7 +240,7 @@ class BookHeader(object): self.exth_flag, = struct.unpack('>L', raw[0x80:0x84]) self.exth = None - if not isinstance(self.title, unicode): + if not isinstance(self.title, unicode_type): self.title = self.title.decode(self.codec, 'replace') if self.exth_flag & 0x40: try: diff --git a/src/calibre/ebooks/mobi/reader/markup.py b/src/calibre/ebooks/mobi/reader/markup.py index 99cfb9cd53..a40b27838f 100644 --- a/src/calibre/ebooks/mobi/reader/markup.py +++ b/src/calibre/ebooks/mobi/reader/markup.py @@ -10,6 +10,7 @@ __docformat__ = 'restructuredtext en' import re, os from calibre.ebooks.chardet import strip_encoding_declarations +from polyglot.builtins import unicode_type def update_internal_links(mobi8_reader, log): @@ -130,7 +131,7 @@ def update_flow_links(mobi8_reader, resource_map, log): flows.append(flow) continue - if not isinstance(flow, unicode): + if not isinstance(flow, unicode_type): try: flow = flow.decode(mr.header.codec) except UnicodeDecodeError: diff --git a/src/calibre/ebooks/mobi/reader/mobi6.py b/src/calibre/ebooks/mobi/reader/mobi6.py index 8d0f2ce1ee..16b8a938b6 100644 --- a/src/calibre/ebooks/mobi/reader/mobi6.py +++ b/src/calibre/ebooks/mobi/reader/mobi6.py @@ -23,6 +23,7 @@ from calibre.ebooks.metadata.toc import TOC from calibre.ebooks.mobi.reader.headers import BookHeader from calibre.utils.img import save_cover_data_to from calibre.utils.imghdr import what +from polyglot.builtins import unicode_type class TopazError(ValueError): @@ -297,7 +298,7 @@ class MobiReader(object): with open('styles.css', 'wb') as s: s.write(self.base_css_rules + '\n\n') for cls, rule in self.tag_css_rules.items(): - if isinstance(rule, unicode): + if isinstance(rule, unicode_type): rule = rule.encode('utf-8') s.write('.%s { %s }\n\n' % (cls, rule)) diff --git a/src/calibre/ebooks/mobi/utils.py b/src/calibre/ebooks/mobi/utils.py index 899dffe942..69ef8f0b9f 100644 --- a/src/calibre/ebooks/mobi/utils.py +++ b/src/calibre/ebooks/mobi/utils.py @@ -14,6 +14,7 @@ from io import BytesIO from calibre.utils.img import save_cover_data_to, scale_image, image_to_data, image_from_data, resize_image from calibre.utils.imghdr import what from calibre.ebooks import normalize +from polyglot.builtins import unicode_type from tinycss.color3 import parse_color_string IMAGE_MAX_SIZE = 10 * 1024 * 1024 @@ -317,7 +318,7 @@ def utf8_text(text): ''' if text and text.strip(): text = text.strip() - if not isinstance(text, unicode): + if not isinstance(text, unicode_type): text = text.decode('utf-8', 'replace') text = normalize(text).encode('utf-8') else: @@ -625,7 +626,7 @@ def is_guide_ref_start(ref): def convert_color_for_font_tag(val): - rgba = parse_color_string(unicode(val or '')) + rgba = parse_color_string(unicode_type(val or '')) if rgba is None or rgba == 'currentColor': return val clamp = lambda x: min(x, max(0, x), 1) diff --git a/src/calibre/ebooks/mobi/writer2/main.py b/src/calibre/ebooks/mobi/writer2/main.py index 7d9acebb82..9de6427d68 100644 --- a/src/calibre/ebooks/mobi/writer2/main.py +++ b/src/calibre/ebooks/mobi/writer2/main.py @@ -20,6 +20,7 @@ from calibre.ebooks.mobi.writer2 import (PALMDOC, UNCOMPRESSED) from calibre.ebooks.mobi.utils import (encint, encode_trailing_data, align_block, detect_periodical, RECORD_SIZE, create_text_record) from calibre.ebooks.mobi.writer2.indexer import Indexer +from polyglot.builtins import unicode_type # Disabled as I dont care about uncrossable breaks WRITE_UNCROSSABLE_BREAKS = False @@ -52,7 +53,7 @@ class MobiWriter(object): self.log = oeb.log pt = None if oeb.metadata.publication_type: - x = unicode(oeb.metadata.publication_type[0]).split(':') + x = unicode_type(oeb.metadata.publication_type[0]).split(':') if len(x) > 1: pt = x[1].lower() self.publication_type = pt @@ -239,7 +240,7 @@ class MobiWriter(object): 0 # Unused )) # 0 - 15 (0x0 - 0xf) uid = random.randint(0, 0xffffffff) - title = normalize(unicode(metadata.title[0])).encode('utf-8') + title = normalize(unicode_type(metadata.title[0])).encode('utf-8') # 0x0 - 0x3 record0.write(b'MOBI') @@ -459,7 +460,7 @@ class MobiWriter(object): ''' Write the PalmDB header ''' - title = ascii_filename(unicode(self.oeb.metadata.title[0])).replace( + title = ascii_filename(unicode_type(self.oeb.metadata.title[0])).replace( ' ', '_')[:31] title = title + (b'\0' * (32 - len(title))) now = int(time.time()) @@ -476,5 +477,3 @@ class MobiWriter(object): def write_content(self): for record in self.records: self.write(record) - - diff --git a/src/calibre/ebooks/mobi/writer2/resources.py b/src/calibre/ebooks/mobi/writer2/resources.py index 661ffc1f48..ebb0d45c68 100644 --- a/src/calibre/ebooks/mobi/writer2/resources.py +++ b/src/calibre/ebooks/mobi/writer2/resources.py @@ -16,6 +16,7 @@ from calibre.ebooks import generate_masthead from calibre.ebooks.oeb.base import OEB_RASTER_IMAGES from calibre.ptempfile import PersistentTemporaryFile from calibre.utils.imghdr import what +from polyglot.builtins import unicode_type PLACEHOLDER_GIF = b'GIF89a\x01\x00\x01\x00\xf0\x00\x00\x00\x00\x00\xff\xff\xff!\xf9\x04\x01\x00\x00\x00\x00!\xfe calibre-placeholder-gif-for-azw3\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;' # noqa @@ -72,7 +73,7 @@ class Resources(object): self.image_indices.add(0) elif self.is_periodical: # Generate a default masthead - data = generate_masthead(unicode(self.oeb.metadata['title'][0])) + data = generate_masthead(unicode_type(self.oeb.metadata['title'][0])) self.records.append(data) self.used_image_indices.add(0) self.image_indices.add(0) @@ -80,8 +81,8 @@ class Resources(object): cover_href = self.cover_offset = self.thumbnail_offset = None if (oeb.metadata.cover and - unicode(oeb.metadata.cover[0]) in oeb.manifest.ids): - cover_id = unicode(oeb.metadata.cover[0]) + unicode_type(oeb.metadata.cover[0]) in oeb.manifest.ids): + cover_id = unicode_type(oeb.metadata.cover[0]) item = oeb.manifest.ids[cover_id] cover_href = item.href @@ -156,4 +157,3 @@ class Resources(object): def __bool__(self): return bool(self.records) __nonzero__ = __bool__ - diff --git a/src/calibre/ebooks/mobi/writer2/serializer.py b/src/calibre/ebooks/mobi/writer2/serializer.py index 5628cb37de..ab6551d522 100644 --- a/src/calibre/ebooks/mobi/writer2/serializer.py +++ b/src/calibre/ebooks/mobi/writer2/serializer.py @@ -13,6 +13,7 @@ from calibre.ebooks.oeb.base import (OEB_DOCS, XHTML, XHTML_NS, XML_NS, namespace, prefixname, urlnormalize) from calibre.ebooks.mobi.mobiml import MBP_NS from calibre.ebooks.mobi.utils import is_guide_ref_start +from polyglot.builtins import unicode_type from collections import defaultdict from urlparse import urldefrag @@ -220,7 +221,7 @@ class Serializer(object): buf.write('<div> <div height="1em"></div>') else: t = tocref.title - if isinstance(t, unicode): + if isinstance(t, unicode_type): t = t.encode('utf-8') buf.write('<div></div> <div> <h2 height="1em"><font size="+2"><b>' + t + '</b></font></h2> <div height="1em"></div>') @@ -240,7 +241,7 @@ class Serializer(object): buf.write('0000000000') buf.write(' ><font size="+1"><b><u>') t = tocitem.title - if isinstance(t, unicode): + if isinstance(t, unicode_type): t = t.encode('utf-8') buf.write(t) buf.write('</u></b></font></a></li>') @@ -358,7 +359,7 @@ class Serializer(object): text = text.replace(u'\u00AD', '') # Soft-hyphen if quot: text = text.replace('"', '"') - if isinstance(text, unicode): + if isinstance(text, unicode_type): text = unicodedata.normalize('NFC', text) self.buf.write(text.encode('utf-8')) @@ -384,5 +385,3 @@ class Serializer(object): for hoff in hoffs: buf.seek(hoff) buf.write(b'%010d' % ioff) - - diff --git a/src/calibre/ebooks/mobi/writer8/exth.py b/src/calibre/ebooks/mobi/writer8/exth.py index 6a068aec33..300ccf302d 100644 --- a/src/calibre/ebooks/mobi/writer8/exth.py +++ b/src/calibre/ebooks/mobi/writer8/exth.py @@ -15,6 +15,7 @@ from calibre.constants import iswindows, isosx from calibre.ebooks.mobi.utils import (utf8_text, to_base) from calibre.utils.localization import lang_as_iso639_1 from calibre.ebooks.metadata import authors_to_sort_string +from polyglot.builtins import unicode_type EXTH_CODES = { 'creator': 100, @@ -62,14 +63,14 @@ def build_exth(metadata, prefer_author_sort=False, is_periodical=False, items = metadata[term] if term == 'creator': if prefer_author_sort: - creators = [authors_to_sort_string([unicode(c)]) for c in + creators = [authors_to_sort_string([unicode_type(c)]) for c in items] else: - creators = [unicode(c) for c in items] + creators = [unicode_type(c) for c in items] items = creators elif term == 'rights': try: - rights = utf8_text(unicode(metadata.rights[0])) + rights = utf8_text(unicode_type(metadata.rights[0])) except: rights = b'Unknown' exth.write(pack(b'>II', EXTH_CODES['rights'], len(rights) + 8)) @@ -78,7 +79,7 @@ def build_exth(metadata, prefer_author_sort=False, is_periodical=False, continue for item in items: - data = unicode(item) + data = unicode_type(item) if term != 'description': data = COLLAPSE_RE.sub(' ', data) if term == 'identifier': @@ -102,14 +103,14 @@ def build_exth(metadata, prefer_author_sort=False, is_periodical=False, from calibre.ebooks.oeb.base import OPF for x in metadata['identifier']: if (x.get(OPF('scheme'), None).lower() == 'uuid' or - unicode(x).startswith('urn:uuid:')): - uuid = unicode(x).split(':')[-1] + unicode_type(x).startswith('urn:uuid:')): + uuid = unicode_type(x).split(':')[-1] break if uuid is None: from uuid import uuid4 uuid = str(uuid4()) - if isinstance(uuid, unicode): + if isinstance(uuid, unicode_type): uuid = uuid.encode('utf-8') if not share_not_sync: exth.write(pack(b'>II', 113, len(uuid) + 8)) diff --git a/src/calibre/ebooks/mobi/writer8/index.py b/src/calibre/ebooks/mobi/writer8/index.py index 12905d5858..b97f0051b4 100644 --- a/src/calibre/ebooks/mobi/writer8/index.py +++ b/src/calibre/ebooks/mobi/writer8/index.py @@ -11,7 +11,7 @@ __docformat__ = 'restructuredtext en' from collections import namedtuple from struct import pack from io import BytesIO -from polyglot.builtins import zip +from polyglot.builtins import unicode_type, zip from calibre.ebooks.mobi.utils import CNCX, encint, align_block from calibre.ebooks.mobi.writer8.header import Header @@ -146,7 +146,7 @@ class Index(object): # {{{ for i, (index_num, tags) in enumerate(self.entries): control_bytes = self.control_bytes[i] buf.seek(0), buf.truncate(0) - index_num = (index_num.encode('utf-8') if isinstance(index_num, unicode) else index_num) + index_num = (index_num.encode('utf-8') if isinstance(index_num, unicode_type) else index_num) raw = bytearray(index_num) raw.insert(0, len(index_num)) buf.write(bytes(raw)) diff --git a/src/calibre/ebooks/mobi/writer8/main.py b/src/calibre/ebooks/mobi/writer8/main.py index 9749c49a0d..d66ec8b318 100644 --- a/src/calibre/ebooks/mobi/writer8/main.py +++ b/src/calibre/ebooks/mobi/writer8/main.py @@ -31,6 +31,7 @@ from calibre.ebooks.mobi.writer8.index import (NCXIndex, SkelIndex, from calibre.ebooks.mobi.writer8.mobi import KF8Book from calibre.ebooks.mobi.writer8.tbs import apply_trailing_byte_sequences from calibre.ebooks.mobi.writer8.toc import TOCAdder +from polyglot.builtins import unicode_type XML_DOCS = OEB_DOCS | {SVG_MIME} @@ -235,7 +236,7 @@ class KF8Writer(object): root = self.data(item) for svg in XPath('//svg:svg')(root): - raw = etree.tostring(svg, encoding=unicode, with_tail=False) + raw = etree.tostring(svg, encoding=unicode_type, with_tail=False) idx = len(self.flows) self.flows.append(raw) p = svg.getparent() @@ -333,7 +334,7 @@ class KF8Writer(object): self.flows[0] = chunker.text def create_text_records(self): - self.flows = [x.encode('utf-8') if isinstance(x, unicode) else x for x + self.flows = [x.encode('utf-8') if isinstance(x, unicode_type) else x for x in self.flows] text = b''.join(self.flows) self.text_length = len(text) diff --git a/src/calibre/ebooks/mobi/writer8/mobi.py b/src/calibre/ebooks/mobi/writer8/mobi.py index 3aa535424a..c88523b5fc 100644 --- a/src/calibre/ebooks/mobi/writer8/mobi.py +++ b/src/calibre/ebooks/mobi/writer8/mobi.py @@ -16,6 +16,7 @@ from calibre.ebooks.mobi.writer2 import (PALMDOC, UNCOMPRESSED) from calibre.ebooks.mobi.langcodes import iana2mobi from calibre.ebooks.mobi.writer8.exth import build_exth from calibre.utils.filenames import ascii_filename +from polyglot.builtins import unicode_type NULL_INDEX = 0xffffffff FLIS = b'FLIS\0\0\0\x08\0\x41\0\0\0\0\0\0\xff\xff\xff\xff\0\x01\0\x03\0\0\0\x03\0\0\0\x01'+ b'\xff'*4 @@ -282,7 +283,7 @@ class KF8Book(object): # Miscellaneous header fields self.compression = writer.compress self.book_type = 0x101 if writer.opts.mobi_periodical else 2 - self.full_title = utf8_text(unicode(metadata.title[0])) + self.full_title = utf8_text(unicode_type(metadata.title[0])) self.title_length = len(self.full_title) self.extra_data_flags = 0b1 if writer.has_tbs: diff --git a/src/calibre/ebooks/mobi/writer8/skeleton.py b/src/calibre/ebooks/mobi/writer8/skeleton.py index 064a39d522..fd5f943e29 100644 --- a/src/calibre/ebooks/mobi/writer8/skeleton.py +++ b/src/calibre/ebooks/mobi/writer8/skeleton.py @@ -17,6 +17,7 @@ from lxml import etree from calibre.ebooks.oeb.base import XHTML_NS, extract from calibre.constants import ispy3 from calibre.ebooks.mobi.utils import to_base +from polyglot.builtins import unicode_type CHUNK_SIZE = 8192 @@ -72,7 +73,7 @@ def tostring(raw, **kwargs): xml_declaration = kwargs.pop('xml_declaration', False) encoding = kwargs.pop('encoding', 'UTF-8') - kwargs['encoding'] = unicode + kwargs['encoding'] = unicode_type kwargs['xml_declaration'] = False ans = etree.tostring(raw, **kwargs) if xml_declaration: diff --git a/src/calibre/ebooks/odt/input.py b/src/calibre/ebooks/odt/input.py index f2ae22839e..7f02d187b6 100644 --- a/src/calibre/ebooks/odt/input.py +++ b/src/calibre/ebooks/odt/input.py @@ -19,6 +19,7 @@ from odf.namespaces import TEXTNS as odTEXTNS from calibre import CurrentDir, walk from calibre.ebooks.oeb.base import _css_logger +from polyglot.builtins import unicode_type class Extract(ODF2XHTML): @@ -172,7 +173,7 @@ class Extract(ODF2XHTML): css = style.text if css: css, sel_map = self.do_filter_css(css) - if not isinstance(css, unicode): + if not isinstance(css, unicode_type): css = css.decode('utf-8', 'ignore') style.text = css for x in root.xpath('//*[@class]'): diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 1bd58de4d5..d6a7013f57 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -22,6 +22,7 @@ from calibre.ebooks.oeb.parse_utils import (barename, XHTML_NS, RECOVER_PARSER, namespace, XHTML, parse_html, NotHTML) from calibre.utils.cleantext import clean_xml_chars from calibre.utils.short_uuid import uuid4 +from polyglot.builtins import unicode_type XML_NS = 'http://www.w3.org/XML/1998/namespace' OEB_DOC_NS = 'http://openebook.org/namespaces/oeb-document/1.0/' @@ -376,7 +377,7 @@ def xml2unicode(root, pretty_print=False): def xml2text(elem): - return etree.tostring(elem, method='text', encoding=unicode, with_tail=False) + return etree.tostring(elem, method='text', encoding=unicode_type, with_tail=False) def escape_cdata(root): @@ -398,11 +399,11 @@ def serialize(data, media_type, pretty_print=False): # incorrectly by some browser based renderers ans = close_self_closing_tags(ans) return ans - if isinstance(data, unicode): + if isinstance(data, unicode_type): return data.encode('utf-8') if hasattr(data, 'cssText'): data = data.cssText - if isinstance(data, unicode): + if isinstance(data, unicode_type): data = data.encode('utf-8') return data + b'\n' return bytes(data) @@ -421,7 +422,7 @@ def urlquote(href): That is, this function returns valid IRIs not valid URIs. In particular, IRIs can contain non-ascii characters. """ result = [] - unsafe = 0 if isinstance(href, unicode) else 1 + unsafe = 0 if isinstance(href, unicode_type) else 1 unsafe = URL_UNSAFE[unsafe] for char in href: if char in unsafe: @@ -435,7 +436,7 @@ def urlunquote(href, error_handling='strict'): # If it runs on a unicode object, it returns a double encoded unicode # string: unquote(u'%C3%A4') != unquote(b'%C3%A4').decode('utf-8') # and the latter is correct - want_unicode = isinstance(href, unicode) + want_unicode = isinstance(href, unicode_type) if want_unicode: href = href.encode('utf-8') href = unquote(href) @@ -555,7 +556,7 @@ class DirContainer(object): # If it runs on a unicode object, it returns a double encoded unicode # string: unquote(u'%C3%A4') != unquote(b'%C3%A4').decode('utf-8') # and the latter is correct - if isinstance(path, unicode): + if isinstance(path, unicode_type): path = path.encode('utf-8') return urlunquote(path).decode('utf-8') @@ -593,13 +594,13 @@ class DirContainer(object): def namelist(self): names = [] base = self.rootdir - if isinstance(base, unicode): + if isinstance(base, unicode_type): base = base.encode(filesystem_encoding) for root, dirs, files in os.walk(base): for fname in files: fname = os.path.join(root, fname) fname = fname.replace('\\', '/') - if not isinstance(fname, unicode): + if not isinstance(fname, unicode_type): try: fname = fname.decode(filesystem_encoding) except: @@ -745,7 +746,7 @@ class Metadata(object): % (barename(self.term), self.value, self.attrib) def __str__(self): - return unicode(self.value).encode('ascii', 'xmlcharrefreplace') + return unicode_type(self.value).encode('ascii', 'xmlcharrefreplace') def __unicode__(self): return as_unicode(self.value) @@ -914,7 +915,7 @@ class Manifest(object): def __init__(self, oeb, id, href, media_type, fallback=None, loader=str, data=None): if href: - href = unicode(href) + href = unicode_type(href) self.oeb = oeb self.id = id self.href = self.path = urlnormalize(href) @@ -964,7 +965,7 @@ class Manifest(object): title = self.oeb.metadata.title if title: - title = unicode(title[0]) + title = unicode_type(title[0]) else: title = _('Unknown') @@ -997,7 +998,7 @@ class Manifest(object): self.oeb.logger.warn('CSS import of non-CSS file %r' % path) return (None, None) data = item.data.cssText - enc = None if isinstance(data, unicode) else 'utf-8' + enc = None if isinstance(data, unicode_type) else 'utf-8' return (enc, data) # }}} @@ -1081,11 +1082,11 @@ class Manifest(object): data = self.data if isinstance(data, etree._Element): return xml2unicode(data, pretty_print=self.oeb.pretty_print) - if isinstance(data, unicode): + if isinstance(data, unicode_type): return data if hasattr(data, 'cssText'): return data.cssText - return unicode(data) + return unicode_type(data) def __eq__(self, other): return id(self) == id(other) @@ -1203,7 +1204,7 @@ class Manifest(object): while href.lower() in lhrefs: href = base + str(index) + ext index += 1 - return id, unicode(href) + return id, unicode_type(href) def __iter__(self): for item in self.items: @@ -1436,7 +1437,7 @@ class Guide(object): def add(self, type, title, href): """Add a new reference to the `Guide`.""" if href: - href = unicode(href) + href = unicode_type(href) ref = self.Reference(self.oeb, type, title, href) self.refs[type] = ref return ref @@ -1707,7 +1708,7 @@ class PageList(object): TYPES = {'front', 'normal', 'special'} def __init__(self, name, href, type='normal', klass=None, id=None): - self.name = unicode(name) + self.name = unicode_type(name) self.href = urlnormalize(href) self.type = type if type in self.TYPES else 'normal' self.id = id @@ -1845,7 +1846,7 @@ class OEBBook(object): """Automatically decode :param:`data` into a `unicode` object.""" def fix_data(d): return d.replace('\r\n', '\n').replace('\r', '\n') - if isinstance(data, unicode): + if isinstance(data, unicode_type): return fix_data(data) bom_enc = None if data[:4] in ('\0\0\xfe\xff', '\xff\xfe\0\0'): @@ -1923,14 +1924,14 @@ class OEBBook(object): return def _to_ncx(self): - lang = unicode(self.metadata.language[0]) + lang = unicode_type(self.metadata.language[0]) lang = lang.replace('_', '-') ncx = etree.Element(NCX('ncx'), attrib={'version': '2005-1', XML('lang'): lang}, nsmap={None: NCX_NS}) head = etree.SubElement(ncx, NCX('head')) etree.SubElement(head, NCX('meta'), - name='dtb:uid', content=unicode(self.uid)) + name='dtb:uid', content=unicode_type(self.uid)) etree.SubElement(head, NCX('meta'), name='dtb:depth', content=str(self.toc.depth())) generator = ''.join(['calibre (', __version__, ')']) @@ -1942,7 +1943,7 @@ class OEBBook(object): name='dtb:maxPageNumber', content='0') title = etree.SubElement(ncx, NCX('docTitle')) text = etree.SubElement(title, NCX('text')) - text.text = unicode(self.metadata.title[0]) + text.text = unicode_type(self.metadata.title[0]) navmap = etree.SubElement(ncx, NCX('navMap')) self.toc.to_ncx(navmap) if len(self.pages) > 0: diff --git a/src/calibre/ebooks/oeb/iterator/bookmarks.py b/src/calibre/ebooks/oeb/iterator/bookmarks.py index 9141b7cb46..841d409ccb 100644 --- a/src/calibre/ebooks/oeb/iterator/bookmarks.py +++ b/src/calibre/ebooks/oeb/iterator/bookmarks.py @@ -11,6 +11,7 @@ import os from io import BytesIO from calibre.utils.zipfile import safe_replace +from polyglot.builtins import unicode_type BM_FIELD_SEP = u'*|!|?|*' BM_LEGACY_ESC = u'esc-text-%&*#%(){}ads19-end-esc' @@ -59,10 +60,10 @@ class BookmarksMixin(object): else: pos = bm['pos'] if isinstance(pos, (int, float)): - pos = unicode(pos) + pos = unicode_type(pos) else: pos = pos.replace(u'^', BM_LEGACY_ESC) - rec = BM_FIELD_SEP.join([bm['title'], unicode(bm['spine']), pos]) + rec = BM_FIELD_SEP.join([bm['title'], unicode_type(bm['spine']), pos]) dat.append(rec) return (u'\n'.join(dat) +u'\n') @@ -102,5 +103,3 @@ class BookmarksMixin(object): def set_bookmarks(self, bookmarks): self.bookmarks = bookmarks - - diff --git a/src/calibre/ebooks/oeb/iterator/spine.py b/src/calibre/ebooks/oeb/iterator/spine.py index c102b281bf..f81a2244d0 100644 --- a/src/calibre/ebooks/oeb/iterator/spine.py +++ b/src/calibre/ebooks/oeb/iterator/spine.py @@ -2,7 +2,7 @@ # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import (unicode_literals, division, absolute_import, print_function) -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>' @@ -45,7 +45,7 @@ def all_links(html): return ans -class SpineItem(unicode): +class SpineItem(unicode_type): def __new__(cls, path, mime_type=None, read_anchor_map=True, run_char_count=True, from_epub=False, read_links=True): @@ -149,5 +149,3 @@ def create_indexing_data(spine, toc): start = i.anchor if i.spine_pos == spine_pos else None end = i.end_anchor if i.spine_pos == spine_pos else None spine_item.index_entries.append(ie(i, start, end)) - - diff --git a/src/calibre/ebooks/oeb/parse_utils.py b/src/calibre/ebooks/oeb/parse_utils.py index 8d97b88a7b..94b369471e 100644 --- a/src/calibre/ebooks/oeb/parse_utils.py +++ b/src/calibre/ebooks/oeb/parse_utils.py @@ -14,6 +14,7 @@ from lxml import etree, html from calibre import xml_replace_entities, force_unicode from calibre.constants import filesystem_encoding from calibre.ebooks.chardet import xml_to_unicode, strip_encoding_declarations +from polyglot.builtins import unicode_type RECOVER_PARSER = etree.XMLParser(recover=True, no_network=True) XHTML_NS = 'http://www.w3.org/1999/xhtml' @@ -116,7 +117,7 @@ def _html4_parse(data, prefer_soup=False): for elem in data.iter(tag=etree.Comment): if elem.text: elem.text = elem.text.strip('-') - data = etree.tostring(data, encoding=unicode) + data = etree.tostring(data, encoding=unicode_type) # Setting huge_tree=True causes crashes in windows with large files parser = etree.XMLParser(no_network=True) @@ -173,7 +174,7 @@ def parse_html(data, log=None, decoder=None, preprocessor=None, filename = force_unicode(filename, enc=filesystem_encoding) - if not isinstance(data, unicode): + if not isinstance(data, unicode_type): if decoder is not None: data = decoder(data) else: @@ -258,7 +259,7 @@ def parse_html(data, log=None, decoder=None, preprocessor=None, nroot = etree.fromstring('<html></html>') has_body = False for child in list(data): - if isinstance(child.tag, (unicode, str)) and barename(child.tag) == 'body': + if isinstance(child.tag, (unicode_type, str)) and barename(child.tag) == 'body': has_body = True break parent = nroot @@ -277,7 +278,7 @@ def parse_html(data, log=None, decoder=None, preprocessor=None, if not namespace(data.tag): log.warn('Forcing', filename, 'into XHTML namespace') data.attrib['xmlns'] = XHTML_NS - data = etree.tostring(data, encoding=unicode) + data = etree.tostring(data, encoding=unicode_type) try: data = etree.fromstring(data, parser=parser) diff --git a/src/calibre/ebooks/oeb/polish/check/parsing.py b/src/calibre/ebooks/oeb/polish/check/parsing.py index eb3c95b7ad..1ffcfd68da 100644 --- a/src/calibre/ebooks/oeb/polish/check/parsing.py +++ b/src/calibre/ebooks/oeb/polish/check/parsing.py @@ -18,6 +18,7 @@ from calibre.ebooks.oeb.polish.pretty import pretty_script_or_style as fix_style from calibre.ebooks.oeb.polish.utils import PositionFinder, guess_type from calibre.ebooks.oeb.polish.check.base import BaseError, WARN, ERROR, INFO from calibre.ebooks.oeb.base import OEB_DOCS, XHTML_NS, urlquote, URL_SAFE, XHTML +from polyglot.builtins import unicode_type HTML_ENTITTIES = frozenset(html5_entities) XML_ENTITIES = {'lt', 'gt', 'amp', 'apos', 'quot'} @@ -444,7 +445,7 @@ class ErrorHandler(object): info = debug = setLevel = getEffectiveLevel = addHandler = removeHandler = __noop def __handle(self, level, *args): - msg = ' '.join(map(unicode, args)) + msg = ' '.join(map(unicode_type, args)) line = col = None for pat in pos_pats: m = pat.search(msg) diff --git a/src/calibre/ebooks/oeb/polish/container.py b/src/calibre/ebooks/oeb/polish/container.py index ece50b23c5..0216a74f27 100644 --- a/src/calibre/ebooks/oeb/polish/container.py +++ b/src/calibre/ebooks/oeb/polish/container.py @@ -14,7 +14,7 @@ import time import unicodedata import uuid from collections import defaultdict -from polyglot.builtins import zip +from polyglot.builtins import unicode_type, zip from io import BytesIO from itertools import count from urlparse import urlparse @@ -167,7 +167,7 @@ class ContainerBase(object): # {{{ """ def fix_data(d): return d.replace('\r\n', '\n').replace('\r', '\n') - if isinstance(data, unicode): + if isinstance(data, unicode_type): return fix_data(data) bom_enc = None if data[:4] in {b'\0\0\xfe\xff', b'\xff\xfe\0\0'}: diff --git a/src/calibre/ebooks/oeb/polish/css.py b/src/calibre/ebooks/oeb/polish/css.py index 5b07a13a6d..ba92f610b1 100644 --- a/src/calibre/ebooks/oeb/polish/css.py +++ b/src/calibre/ebooks/oeb/polish/css.py @@ -18,6 +18,7 @@ from calibre.ebooks.oeb.normalize_css import normalize_filter_css, normalizers from calibre.ebooks.oeb.polish.pretty import pretty_script_or_style, pretty_xml_tree, serialize from calibre.utils.icu import numeric_sort_key from css_selectors import Select, SelectorError +from polyglot.builtins import unicode_type def filter_used_rules(rules, log, select): @@ -343,10 +344,10 @@ def sort_sheet(container, sheet_or_text): ''' Sort the rules in a stylesheet. Note that in the general case this can change the effective styles, but for most common sheets, it should be safe. ''' - sheet = container.parse_css(sheet_or_text) if isinstance(sheet_or_text, unicode) else sheet_or_text + sheet = container.parse_css(sheet_or_text) if isinstance(sheet_or_text, unicode_type) else sheet_or_text def text_sort_key(x): - return numeric_sort_key(unicode(x or '')) + return numeric_sort_key(unicode_type(x or '')) def selector_sort_key(x): return (x.specificity, text_sort_key(x.selectorText)) diff --git a/src/calibre/ebooks/oeb/polish/spell.py b/src/calibre/ebooks/oeb/polish/spell.py index 271c2474fe..4c9864fb2f 100644 --- a/src/calibre/ebooks/oeb/polish/spell.py +++ b/src/calibre/ebooks/oeb/polish/spell.py @@ -17,6 +17,7 @@ from calibre.ebooks.oeb.polish.container import OPF_NAMESPACES, get_container from calibre.ebooks.oeb.polish.parsing import parse from calibre.ebooks.oeb.polish.toc import find_existing_ncx_toc, find_existing_nav_toc from calibre.utils.icu import ord_string +from polyglot.builtins import unicode_type _patterns = None @@ -82,7 +83,7 @@ def filter_words(word): def get_words(text, lang): try: - ans = split_into_words(unicode(text), lang) + ans = split_into_words(unicode_type(text), lang) except (TypeError, ValueError): return () return filter(filter_words, ans) @@ -314,7 +315,7 @@ def merge_locations(locs1, locs2): def replace(text, original_word, new_word, lang): indices = [] - original_word, new_word, text = unicode(original_word), unicode(new_word), unicode(text) + original_word, new_word, text = unicode_type(original_word), unicode_type(new_word), unicode_type(text) q = text offset = 0 while True: diff --git a/src/calibre/ebooks/oeb/polish/stats.py b/src/calibre/ebooks/oeb/polish/stats.py index e6bb98b396..4177835eda 100644 --- a/src/calibre/ebooks/oeb/polish/stats.py +++ b/src/calibre/ebooks/oeb/polish/stats.py @@ -16,6 +16,7 @@ import regex from calibre.ebooks.oeb.base import XHTML from calibre.ebooks.oeb.polish.cascade import iterrules, resolve_styles, iterdeclaration from calibre.utils.icu import ord_string, safe_chr +from polyglot.builtins import unicode_type from tinycss.fonts3 import parse_font_family @@ -23,7 +24,7 @@ def normalize_font_properties(font): w = font.get('font-weight', None) if not w and w != 0: w = 'normal' - w = unicode(w) + w = unicode_type(w) w = {'normal':'400', 'bold':'700'}.get(w, w) if w not in {'100', '200', '300', '400', '500', '600', '700', '800', '900'}: @@ -119,7 +120,7 @@ def get_element_text(elem, resolve_property, resolve_pseudo_property, capitalize if before: ans.append(before) if for_pseudo is not None: - ans.append(tostring(elem, method='text', encoding=unicode, with_tail=False)) + ans.append(tostring(elem, method='text', encoding=unicode_type, with_tail=False)) else: if elem.text: ans.append(elem.text) diff --git a/src/calibre/ebooks/oeb/polish/toc.py b/src/calibre/ebooks/oeb/polish/toc.py index 51aa365b37..b2c39702f0 100644 --- a/src/calibre/ebooks/oeb/polish/toc.py +++ b/src/calibre/ebooks/oeb/polish/toc.py @@ -11,7 +11,7 @@ import re from urlparse import urlparse from collections import Counter, OrderedDict from functools import partial -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from operator import itemgetter from lxml import etree @@ -143,7 +143,7 @@ def add_from_navpoint(container, navpoint, parent, ncx_name): text = '' for txt in child_xpath(nl, 'text'): text += etree.tostring(txt, method='text', - encoding=unicode, with_tail=False) + encoding=unicode_type, with_tail=False) content = child_xpath(navpoint, 'content') if content: content = content[0] @@ -170,11 +170,11 @@ def parse_ncx(container, ncx_name): toc_root.lang = toc_root.uid = None for attr, val in root.attrib.iteritems(): if attr.endswith('lang'): - toc_root.lang = unicode(val) + toc_root.lang = unicode_type(val) break for uid in root.xpath('//*[calibre:lower-case(local-name()) = "meta" and @name="dtb:uid"]/@content'): if uid: - toc_root.uid = unicode(uid) + toc_root.uid = unicode_type(uid) break for pl in root.xpath('//*[calibre:lower-case(local-name()) = "pagelist"]'): for pt in pl.xpath('descendant::*[calibre:lower-case(local-name()) = "pagetarget"]'): @@ -191,7 +191,7 @@ def parse_ncx(container, ncx_name): def add_from_li(container, li, parent, nav_name): dest = frag = text = None for x in li.iterchildren(XHTML('a'), XHTML('span')): - text = etree.tostring(x, method='text', encoding=unicode, with_tail=False).strip() or ' '.join(x.xpath('descendant-or-self::*/@title')).strip() + text = etree.tostring(x, method='text', encoding=unicode_type, with_tail=False).strip() or ' '.join(x.xpath('descendant-or-self::*/@title')).strip() href = x.get('href') if href: dest = nav_name if href.startswith('#') else container.href_to_name(href, base=nav_name) @@ -226,7 +226,7 @@ def parse_nav(container, nav_name): if ol is not None: process_nav_node(container, ol, toc_root, nav_name) for h in nav.iterchildren(*map(XHTML, 'h1 h2 h3 h4 h5 h6'.split())): - text = etree.tostring(h, method='text', encoding=unicode, with_tail=False) or h.get('title') + text = etree.tostring(h, method='text', encoding=unicode_type, with_tail=False) or h.get('title') if text: toc_root.toc_title = text break @@ -324,7 +324,7 @@ def get_nav_landmarks(container): for a in li.iterdescendants(XHTML('a')): href, rtype = a.get('href'), a.get(et) if href: - title = etree.tostring(a, method='text', encoding=unicode, with_tail=False).strip() + title = etree.tostring(a, method='text', encoding=unicode_type, with_tail=False).strip() href, frag = href.partition('#')[::2] name = container.href_to_name(href, nav) if container.has_name(name): @@ -579,7 +579,7 @@ def create_ncx(toc, to_href, btitle, lang, uid): nsmap={None: NCX_NS}) head = etree.SubElement(ncx, NCX('head')) etree.SubElement(head, NCX('meta'), - name='dtb:uid', content=unicode(uid)) + name='dtb:uid', content=unicode_type(uid)) etree.SubElement(head, NCX('meta'), name='dtb:depth', content=str(toc.depth)) generator = ''.join(['calibre (', __version__, ')']) diff --git a/src/calibre/ebooks/oeb/reader.py b/src/calibre/ebooks/oeb/reader.py index 0536834888..1d0f0a444e 100644 --- a/src/calibre/ebooks/oeb/reader.py +++ b/src/calibre/ebooks/oeb/reader.py @@ -30,6 +30,7 @@ from calibre.utils.localization import get_lang from calibre.ptempfile import TemporaryDirectory from calibre.constants import __appname__, __version__ from calibre import guess_type, xml_replace_entities +from polyglot.builtins import unicode_type __all__ = ['OEBReader'] @@ -429,7 +430,7 @@ class OEBReader(object): 'descendant::calibre:meta[@name = "description"]') if descriptionElement: description = etree.tostring(descriptionElement[0], - method='text', encoding=unicode).strip() + method='text', encoding=unicode_type).strip() if not description: description = None else: @@ -454,7 +455,7 @@ class OEBReader(object): ncx = item.data title = ''.join(xpath(ncx, 'ncx:docTitle/ncx:text/text()')) title = COLLAPSE_RE.sub(' ', title.strip()) - title = title or unicode(self.oeb.metadata.title[0]) + title = title or unicode_type(self.oeb.metadata.title[0]) toc = self.oeb.toc toc.title = title navmaps = xpath(ncx, 'ncx:navMap') @@ -641,7 +642,7 @@ class OEBReader(object): def _locate_cover_image(self): if self.oeb.metadata.cover: - id = unicode(self.oeb.metadata.cover[0]) + id = unicode_type(self.oeb.metadata.cover[0]) item = self.oeb.manifest.ids.get(id, None) if item is not None and item.media_type in OEB_IMAGES: return item diff --git a/src/calibre/ebooks/oeb/stylizer.py b/src/calibre/ebooks/oeb/stylizer.py index 0a66340cd9..1e7aaf6343 100644 --- a/src/calibre/ebooks/oeb/stylizer.py +++ b/src/calibre/ebooks/oeb/stylizer.py @@ -20,6 +20,7 @@ from calibre.ebooks import unit_convert from calibre.ebooks.oeb.base import XHTML, XHTML_NS, CSS_MIME, OEB_STYLES, xpath, urlnormalize from calibre.ebooks.oeb.normalize_css import DEFAULTS, normalizers from css_selectors import Select, SelectorError, INAPPROPRIATE_PSEUDO_CLASSES +from polyglot.builtins import unicode_type from tinycss.media3 import CSSMedia3Parser css_parser_log.setLevel(logging.WARN) @@ -237,7 +238,7 @@ class Stylizer(object): for x in elem.iter('*'): if x.text: punctuation_chars = [] - text = unicode(x.text) + text = unicode_type(x.text) while text: category = unicodedata.category(text[0]) if category[0] not in {'P', 'Z'}: @@ -606,12 +607,12 @@ class Style(object): result = base else: result = self._unit_convert(width, base=base) - if isinstance(result, (unicode, str, bytes)): + if isinstance(result, (unicode_type, str, bytes)): result = self._profile.width self._width = result if 'max-width' in self._style: result = self._unit_convert(self._style['max-width'], base=base) - if isinstance(result, (unicode, str, bytes)): + if isinstance(result, (unicode_type, str, bytes)): result = self._width if result < self._width: self._width = result @@ -643,12 +644,12 @@ class Style(object): result = base else: result = self._unit_convert(height, base=base) - if isinstance(result, (unicode, str, bytes)): + if isinstance(result, (unicode_type, str, bytes)): result = self._profile.height self._height = result if 'max-height' in self._style: result = self._unit_convert(self._style['max-height'], base=base) - if isinstance(result, (unicode, str, bytes)): + if isinstance(result, (unicode_type, str, bytes)): result = self._height if result < self._height: self._height = result diff --git a/src/calibre/ebooks/oeb/transforms/cover.py b/src/calibre/ebooks/oeb/transforms/cover.py index 65e96f1491..3165a4ecd3 100644 --- a/src/calibre/ebooks/oeb/transforms/cover.py +++ b/src/calibre/ebooks/oeb/transforms/cover.py @@ -11,6 +11,7 @@ from urllib import unquote from lxml import etree from calibre import guess_type from calibre.utils.imghdr import identify +from polyglot.builtins import unicode_type class CoverManager(object): @@ -90,14 +91,14 @@ class CoverManager(object): return None self.log('Generating default cover') m = self.oeb.metadata - title = unicode(m.title[0]) - authors = [unicode(x) for x in m.creator if x.role == 'aut'] + title = unicode_type(m.title[0]) + authors = [unicode_type(x) for x in m.creator if x.role == 'aut'] try: from calibre.ebooks.covers import create_cover series = series_index = None if m.series: try: - series, series_index = unicode(m.series[0]), m.series_index[0] + series, series_index = unicode_type(m.series[0]), m.series_index[0] except IndexError: pass img_data = create_cover(title, authors, series, series_index) diff --git a/src/calibre/ebooks/oeb/transforms/embed_fonts.py b/src/calibre/ebooks/oeb/transforms/embed_fonts.py index 0810d39de7..9e669bc113 100644 --- a/src/calibre/ebooks/oeb/transforms/embed_fonts.py +++ b/src/calibre/ebooks/oeb/transforms/embed_fonts.py @@ -18,10 +18,11 @@ from calibre.ebooks.oeb.transforms.subset import get_font_properties, find_font_ from calibre.utils.filenames import ascii_filename from calibre.utils.fonts.scanner import font_scanner, NoFonts from calibre.ebooks.oeb.polish.embed import font_key +from polyglot.builtins import unicode_type def font_families_from_style(style): - return [unicode(f) for f in style.get('font-family', []) if unicode(f).lower() not in { + return [unicode_type(f) for f in style.get('font-family', []) if unicode_type(f).lower() not in { 'serif', 'sansserif', 'sans-serif', 'fantasy', 'cursive', 'monospace'}] @@ -39,7 +40,7 @@ def used_font(style, embedded_fonts): ff = font_families_from_style(style) if not ff: return False, None - lnames = {unicode(x).lower() for x in ff} + lnames = {unicode_type(x).lower() for x in ff} matching_set = [] diff --git a/src/calibre/ebooks/oeb/transforms/flatcss.py b/src/calibre/ebooks/oeb/transforms/flatcss.py index d144971af4..6af6fd2559 100644 --- a/src/calibre/ebooks/oeb/transforms/flatcss.py +++ b/src/calibre/ebooks/oeb/transforms/flatcss.py @@ -21,6 +21,7 @@ from calibre.ebooks.oeb.base import (XHTML, XHTML_NS, CSS_MIME, OEB_STYLES, from calibre.ebooks.oeb.stylizer import Stylizer from calibre.utils.filenames import ascii_filename, ascii_text from calibre.utils.icu import numeric_sort_key +from polyglot.builtins import unicode_type COLLAPSE = re.compile(r'[ \t\r\n\v]+') STRIPNUM = re.compile(r'[-0-9]+$') @@ -265,7 +266,7 @@ class CSSFlattener(object): cfont = { u'font-family':u'"%s"'%font['font-family'], - u'panose-1': u' '.join(map(unicode, font['panose'])), + u'panose-1': u' '.join(map(unicode_type, font['panose'])), u'src': u'url(%s)'%item.href, } diff --git a/src/calibre/ebooks/oeb/transforms/jacket.py b/src/calibre/ebooks/oeb/transforms/jacket.py index 53f450ddf2..1859df0e29 100644 --- a/src/calibre/ebooks/oeb/transforms/jacket.py +++ b/src/calibre/ebooks/oeb/transforms/jacket.py @@ -22,6 +22,7 @@ from calibre.utils.date import is_date_undefined, as_local_time from calibre.utils.icu import sort_key from calibre.ebooks.chardet import strip_encoding_declarations from calibre.ebooks.metadata import fmt_sidx, rating_to_stars +from polyglot.builtins import unicode_type JACKET_XPATH = '//h:meta[@name="calibre-content" and @content="jacket"]' @@ -104,17 +105,17 @@ class Jacket(Base): self.log('Inserting metadata into book...') try: - tags = map(unicode, self.oeb.metadata.subject) + tags = map(unicode_type, self.oeb.metadata.subject) except: tags = [] try: - comments = unicode(self.oeb.metadata.description[0]) + comments = unicode_type(self.oeb.metadata.description[0]) except: comments = '' try: - title = unicode(self.oeb.metadata.title[0]) + title = unicode_type(self.oeb.metadata.title[0]) except: title = _('Unknown') @@ -171,7 +172,7 @@ def get_rating(rating, rchar, e_rchar): return ans -class Series(unicode): +class Series(unicode_type): def __new__(self, series, series_index): if series and series_index is not None: @@ -181,7 +182,7 @@ class Series(unicode): escape(series), escape(fmt_sidx(series_index, use_roman=False))) else: combined = roman = escape(series or u'') - s = unicode.__new__(self, combined) + s = unicode_type.__new__(self, combined) s.roman = roman s.name = escape(series or u'') s.number = escape(fmt_sidx(series_index or 1.0, use_roman=False)) @@ -189,11 +190,11 @@ class Series(unicode): return s -class Tags(unicode): +class Tags(unicode_type): def __new__(self, tags, output_profile): tags = [escape(x) for x in tags or ()] - t = unicode.__new__(self, ', '.join(tags)) + t = unicode_type.__new__(self, ', '.join(tags)) t.alphabetical = ', '.join(sorted(tags, key=sort_key)) t.tags_list = tags return t diff --git a/src/calibre/ebooks/oeb/transforms/metadata.py b/src/calibre/ebooks/oeb/transforms/metadata.py index 640da6685e..a405bd8991 100644 --- a/src/calibre/ebooks/oeb/transforms/metadata.py +++ b/src/calibre/ebooks/oeb/transforms/metadata.py @@ -9,6 +9,7 @@ __docformat__ = 'restructuredtext en' import os, re from calibre.utils.date import isoformat, now from calibre import guess_type +from polyglot.builtins import unicode_type def meta_info_to_oeb_metadata(mi, m, log, override_input_metadata=False): @@ -204,7 +205,7 @@ class MergeMetadata(object): for item in affected_items: body = XPath('//h:body')(item.data) if body: - text = etree.tostring(body[0], method='text', encoding=unicode) + text = etree.tostring(body[0], method='text', encoding=unicode_type) else: text = '' text = re.sub(r'\s+', '', text) diff --git a/src/calibre/ebooks/oeb/transforms/rasterize.py b/src/calibre/ebooks/oeb/transforms/rasterize.py index ed5c456105..7b88e77172 100644 --- a/src/calibre/ebooks/oeb/transforms/rasterize.py +++ b/src/calibre/ebooks/oeb/transforms/rasterize.py @@ -18,6 +18,7 @@ from calibre.ebooks.oeb.base import urlnormalize from calibre.ebooks.oeb.stylizer import Stylizer from calibre.ptempfile import PersistentTemporaryFile from calibre.utils.imghdr import what +from polyglot.builtins import unicode_type IMAGE_TAGS = {XHTML('img'), XHTML('object')} KEEP_ATTRS = {'class', 'style', 'width', 'height', 'align'} @@ -222,11 +223,11 @@ class SVGRasterizer(object): covers = self.oeb.metadata.cover if not covers: return - if unicode(covers[0]) not in self.oeb.manifest.ids: + if unicode_type(covers[0]) not in self.oeb.manifest.ids: self.oeb.logger.warn('Cover not in manifest, skipping.') self.oeb.metadata.clear('cover') return - cover = self.oeb.manifest.ids[unicode(covers[0])] + cover = self.oeb.manifest.ids[unicode_type(covers[0])] if not cover.media_type == SVG_MIME: return width = (self.profile.width / 72) * self.profile.dpi diff --git a/src/calibre/ebooks/oeb/transforms/split.py b/src/calibre/ebooks/oeb/transforms/split.py index 19debfd0b5..d58337035c 100644 --- a/src/calibre/ebooks/oeb/transforms/split.py +++ b/src/calibre/ebooks/oeb/transforms/split.py @@ -20,6 +20,7 @@ from calibre.ebooks.epub import rules from calibre.ebooks.oeb.base import (OEB_STYLES, XPNSMAP as NAMESPACES, urldefrag, rewrite_links, urlunquote, XHTML, urlnormalize) from calibre.ebooks.oeb.polish.split import do_split +from polyglot.builtins import unicode_type from css_selectors import Select, SelectorError XPath = functools.partial(_XPath, namespaces=NAMESPACES) @@ -294,7 +295,7 @@ class FlowSplitter(object): if body is None: return False txt = re.sub(u'\\s+|\\xa0', '', - etree.tostring(body, method='text', encoding=unicode)) + etree.tostring(body, method='text', encoding=unicode_type)) if len(txt) > 1: return False for img in root.xpath('//h:img', namespaces=NAMESPACES): diff --git a/src/calibre/ebooks/oeb/transforms/structure.py b/src/calibre/ebooks/oeb/transforms/structure.py index fab67146ee..bf5079b8d0 100644 --- a/src/calibre/ebooks/oeb/transforms/structure.py +++ b/src/calibre/ebooks/oeb/transforms/structure.py @@ -14,6 +14,7 @@ from collections import OrderedDict, Counter from calibre.ebooks.oeb.base import XPNSMAP, TOC, XHTML, xml2text, barename from calibre.ebooks import ConversionError +from polyglot.builtins import unicode_type def XPath(x): @@ -123,7 +124,7 @@ class DetectStructure(object): elem = matches[0] eid = elem.get('id', None) if not eid: - eid = u'start_reading_at_'+unicode(uuid.uuid4()).replace(u'-', u'') + eid = u'start_reading_at_'+unicode_type(uuid.uuid4()).replace(u'-', u'') elem.set('id', eid) if u'text' in self.oeb.guide: self.oeb.guide.remove(u'text') diff --git a/src/calibre/ebooks/oeb/transforms/subset.py b/src/calibre/ebooks/oeb/transforms/subset.py index 030fe4aba0..5e580ed93d 100644 --- a/src/calibre/ebooks/oeb/transforms/subset.py +++ b/src/calibre/ebooks/oeb/transforms/subset.py @@ -11,6 +11,7 @@ from collections import defaultdict from calibre.ebooks.oeb.base import urlnormalize from calibre.utils.fonts.sfnt.subset import subset, NoGlyphs, UnsupportedFont +from polyglot.builtins import unicode_type from tinycss.fonts3 import parse_font_family @@ -35,7 +36,7 @@ def get_font_properties(rule, default=None): except (IndexError, KeyError, AttributeError, TypeError, ValueError): val = None if q in {'src', 'font-family'} else default if q in {'font-weight', 'font-stretch', 'font-style'}: - val = unicode(val).lower() if (val or val == 0) else val + val = unicode_type(val).lower() if (val or val == 0) else val if val == 'inherit': val = default if q == 'font-weight': @@ -236,7 +237,7 @@ class SubsetFonts(object): no match is found (can happen if no family matches). ''' ff = style.get('font-family', []) - lnames = {unicode(x).lower() for x in ff} + lnames = {unicode_type(x).lower() for x in ff} matching_set = [] # Filter on font-family @@ -314,6 +315,3 @@ class SubsetFonts(object): chars = self.find_chars(elem) if chars: font['chars'] |= chars - - - diff --git a/src/calibre/ebooks/pdb/ereader/reader132.py b/src/calibre/ebooks/pdb/ereader/reader132.py index 29a2414360..12dfd896be 100644 --- a/src/calibre/ebooks/pdb/ereader/reader132.py +++ b/src/calibre/ebooks/pdb/ereader/reader132.py @@ -18,6 +18,7 @@ from calibre.ebooks import DRMError from calibre.ebooks.metadata.opf2 import OPFCreator from calibre.ebooks.pdb.ereader import EreaderError from calibre.ebooks.pdb.formatreader import FormatReader +from polyglot.builtins import unicode_type class HeaderRecord(object): @@ -113,7 +114,7 @@ class Reader132(FormatReader): os.makedirs(output_dir) title = self.mi.title - if not isinstance(title, unicode): + if not isinstance(title, unicode_type): title = title.decode('utf-8', 'replace') html = u'<html><head><title>%s' % title @@ -217,4 +218,3 @@ class Reader132(FormatReader): name, img = self.get_image(self.header_record.image_data_offset + i) with open(name, 'wb') as imgf: imgf.write(img) - diff --git a/src/calibre/ebooks/pdb/ereader/reader202.py b/src/calibre/ebooks/pdb/ereader/reader202.py index 5d4aa91e1f..9d98a6d640 100644 --- a/src/calibre/ebooks/pdb/ereader/reader202.py +++ b/src/calibre/ebooks/pdb/ereader/reader202.py @@ -14,6 +14,7 @@ from calibre import CurrentDir from calibre.ebooks.metadata.opf2 import OPFCreator from calibre.ebooks.pdb.formatreader import FormatReader from calibre.ebooks.pdb.ereader import EreaderError +from polyglot.builtins import unicode_type class HeaderRecord(object): @@ -94,7 +95,7 @@ class Reader202(FormatReader): pml += self.get_text_page(i) title = self.mi.title - if not isinstance(title, unicode): + if not isinstance(title, unicode_type): title = title.decode('utf-8', 'replace') html = u'%s%s' % \ diff --git a/src/calibre/ebooks/pdb/ereader/writer.py b/src/calibre/ebooks/pdb/ereader/writer.py index 296fef69e7..77c6a0c80a 100644 --- a/src/calibre/ebooks/pdb/ereader/writer.py +++ b/src/calibre/ebooks/pdb/ereader/writer.py @@ -23,6 +23,7 @@ import cStringIO from calibre.ebooks.pdb.formatwriter import FormatWriter from calibre.ebooks.pdb.header import PdbHeaderBuilder from calibre.ebooks.pml.pmlml import PMLMLizer +from polyglot.builtins import unicode_type IDENTITY = 'PNRdPPrs' @@ -39,7 +40,7 @@ class Writer(FormatWriter): def write_content(self, oeb_book, out_stream, metadata=None): pmlmlizer = PMLMLizer(self.log) - pml = unicode(pmlmlizer.extract_content(oeb_book, self.opts)).encode('cp1252', 'replace') + pml = unicode_type(pmlmlizer.extract_content(oeb_book, self.opts)).encode('cp1252', 'replace') text, text_sizes = self._text(pml) chapter_index = self._index_item(r'(?s)\\C(?P[0-4])="(?P.+?)"', pml) @@ -249,4 +250,3 @@ class Writer(FormatWriter): record += struct.pack('>H', 0) # [54:132] return record - diff --git a/src/calibre/ebooks/pdb/plucker/reader.py b/src/calibre/ebooks/pdb/plucker/reader.py index acdce617eb..9a0d3a0180 100644 --- a/src/calibre/ebooks/pdb/plucker/reader.py +++ b/src/calibre/ebooks/pdb/plucker/reader.py @@ -17,6 +17,7 @@ from calibre.ebooks.pdb.formatreader import FormatReader from calibre.ebooks.compression.palmdoc import decompress_doc from calibre.utils.imghdr import identify from calibre.utils.img import save_cover_data_to, Canvas, image_from_data +from polyglot.builtins import codepoint_to_chr DATATYPE_PHTML = 0 DATATYPE_PHTML_COMPRESSED = 1 @@ -716,7 +717,7 @@ class Reader(FormatReader): elif c == 0xa0: html += ' ' else: - html += unichr(c) + html += codepoint_to_chr(c) offset += 1 if offset in paragraph_offsets: need_set_p_id = True diff --git a/src/calibre/ebooks/pdf/reflow.py b/src/calibre/ebooks/pdf/reflow.py index e2f4541220..ceb4e67dea 100644 --- a/src/calibre/ebooks/pdf/reflow.py +++ b/src/calibre/ebooks/pdf/reflow.py @@ -10,6 +10,8 @@ import sys, os from lxml import etree +from polyglot.builtins import unicode_type + class Font(object): @@ -73,10 +75,10 @@ class Text(Element): text.tail = '' self.text_as_string = etree.tostring(text, method='text', - encoding=unicode) + encoding=unicode_type) self.raw = text.text if text.text else u'' for x in text.iterchildren(): - self.raw += etree.tostring(x, method='xml', encoding=unicode) + self.raw += etree.tostring(x, method='xml', encoding=unicode_type) self.average_character_width = self.width/len(self.text_as_string) def coalesce(self, other, page_number): @@ -695,7 +697,3 @@ class PDFDocument(object): raw = (u'\n'.join(html)).replace('', '') with open('index.html', 'wb') as f: f.write(raw.encode('utf-8')) - - - - diff --git a/src/calibre/ebooks/pdf/render/common.py b/src/calibre/ebooks/pdf/render/common.py index 70f242542f..6b8200fa68 100644 --- a/src/calibre/ebooks/pdf/render/common.py +++ b/src/calibre/ebooks/pdf/render/common.py @@ -14,6 +14,7 @@ from binascii import hexlify from calibre.constants import plugins, ispy3 from calibre.utils.logging import default_log +from polyglot.builtins import unicode_type pdf_float = plugins['speedup'][0].pdf_float @@ -55,16 +56,11 @@ PAPER_SIZES = {k:globals()[k.upper()] for k in ('a0 a1 a2 a3 a4 a5 a6 b0 b1 b2' # }}} -# Basic PDF datatypes {{{ - -ic = str if ispy3 else unicode -icb = (lambda x: str(x).encode('ascii')) if ispy3 else bytes - def fmtnum(o): if isinstance(o, float): return pdf_float(o) - return ic(o) + return unicode_type(o) def serialize(o, stream): @@ -74,7 +70,7 @@ def serialize(o, stream): # Must check bool before int as bools are subclasses of int stream.write_raw(b'true' if o else b'false') elif isinstance(o, (int, long)): - stream.write_raw(icb(o)) + stream.write_raw(str(o).encode('ascii') if ispy3 else bytes(o)) elif hasattr(o, 'pdf_serialize'): o.pdf_serialize(stream) elif o is None: @@ -88,7 +84,7 @@ def serialize(o, stream): raise ValueError('Unknown object: %r'%o) -class Name(unicode): +class Name(unicode_type): def pdf_serialize(self, stream): raw = self.encode('ascii') @@ -122,7 +118,7 @@ def escape_pdf_string(bytestring): return bytes(ba) -class String(unicode): +class String(unicode_type): def pdf_serialize(self, stream): try: @@ -134,7 +130,7 @@ class String(unicode): stream.write(b'('+escape_pdf_string(raw)+b')') -class UTF16String(unicode): +class UTF16String(unicode_type): def pdf_serialize(self, stream): raw = codecs.BOM_UTF16_BE + self.encode('utf-16-be') diff --git a/src/calibre/ebooks/pdf/render/engine.py b/src/calibre/ebooks/pdf/render/engine.py index 9c3faef867..ac823c2328 100644 --- a/src/calibre/ebooks/pdf/render/engine.py +++ b/src/calibre/ebooks/pdf/render/engine.py @@ -20,6 +20,7 @@ from calibre.ebooks.pdf.render.common import inch, A4, fmtnum from calibre.ebooks.pdf.render.graphics import convert_path, Graphics from calibre.utils.fonts.sfnt.container import Sfnt, UnsupportedFont from calibre.utils.fonts.sfnt.metrics import FontMetrics +from polyglot.builtins import codepoint_to_chr Point = namedtuple('Point', 'x y') ColorState = namedtuple('ColorState', 'color opacity do') @@ -258,7 +259,7 @@ class PdfEngine(QPaintEngine): ans.ignore_glyphs = set() for uc, glyph_id in enumerate(glyph_map): if glyph_id not in gm: - gm[glyph_id] = unichr(uc) + gm[glyph_id] = codepoint_to_chr(uc) if uc in (0xad, 0x200b): ans.ignore_glyphs.add(glyph_id) ans.full_glyph_map = gm diff --git a/src/calibre/ebooks/pdf/render/from_html.py b/src/calibre/ebooks/pdf/render/from_html.py index b3e81f0a12..1365c22d72 100644 --- a/src/calibre/ebooks/pdf/render/from_html.py +++ b/src/calibre/ebooks/pdf/render/from_html.py @@ -25,6 +25,7 @@ from calibre.ebooks.pdf.render.common import (inch, cm, mm, pica, cicero, from calibre.ebooks.pdf.render.engine import PdfDevice from calibre.ptempfile import PersistentTemporaryFile from calibre.utils.resources import load_hyphenator_dicts +from polyglot.builtins import unicode_type def get_page_size(opts, for_comic=False): # {{{ @@ -91,10 +92,10 @@ class Page(QWebPage): # {{{ self.longjs_counter = 0 def javaScriptConsoleMessage(self, msg, lineno, msgid): - self.log.debug(u'JS:', unicode(msg)) + self.log.debug(u'JS:', unicode_type(msg)) def javaScriptAlert(self, frame, msg): - self.log(unicode(msg)) + self.log(unicode_type(msg)) @pyqtSlot(result=bool) def shouldInterruptJavaScript(self): @@ -128,19 +129,19 @@ def draw_image_page(page_rect, painter, p, preserve_aspect_ratio=True): class PDFWriter(QObject): - @pyqtSlot(result=unicode) + @pyqtSlot(result=unicode_type) def title(self): return self.doc_title - @pyqtSlot(result=unicode) + @pyqtSlot(result=unicode_type) def author(self): return self.doc_author - @pyqtSlot(result=unicode) + @pyqtSlot(result=unicode_type) def section(self): return self.current_section - @pyqtSlot(result=unicode) + @pyqtSlot(result=unicode_type) def tl_section(self): return self.current_tl_section @@ -280,7 +281,7 @@ class PDFWriter(QObject): self.loop.exit(1) def render_next(self): - item = unicode(self.render_queue.pop(0)) + item = unicode_type(self.render_queue.pop(0)) self.logger.debug('Processing %s...' % item) self.current_item = item diff --git a/src/calibre/ebooks/pml/pmlml.py b/src/calibre/ebooks/pml/pmlml.py index 7a121cb4de..d024ca7581 100644 --- a/src/calibre/ebooks/pml/pmlml.py +++ b/src/calibre/ebooks/pml/pmlml.py @@ -14,6 +14,7 @@ from lxml import etree from calibre.ebooks.pdb.ereader import image_name from calibre.ebooks.pml import unipmlcode +from polyglot.builtins import unicode_type TAG_MAP = { 'b' : 'B', @@ -134,7 +135,7 @@ class PMLMLizer(object): text = [u''] for item in self.oeb_book.spine: self.log.debug('Converting %s to PML markup...' % item.href) - content = unicode(etree.tostring(item.data, encoding=unicode)) + content = unicode_type(etree.tostring(item.data, encoding=unicode_type)) content = self.prepare_text(content) content = etree.fromstring(content) stylizer = Stylizer(content, item.href, self.oeb_book, self.opts, self.opts.output_profile) @@ -174,7 +175,7 @@ class PMLMLizer(object): def prepare_text(self, text): # Replace empty paragraphs with \c pml codes used to denote emtpy lines. - text = re.sub(unicode(r'(?<=

)\s*]*>[\xc2\xa0\s]*

'), '\\c\n\\c', text) + text = re.sub(unicode_type(r'(?<=

)\s*]*>[\xc2\xa0\s]*

'), '\\c\n\\c', text) return text def clean_text(self, text): @@ -188,7 +189,7 @@ class PMLMLizer(object): text = text.replace('\\Q="%s"' % unused, '') # Remove \Cn tags that are within \x and \Xn tags - text = re.sub(unicode(r'(?msu)(?P\\(x|X[0-4]))(?P
.*?)(?P\\C[0-4]\s*=\s*"[^"]*")(?P.*?)(?P=t)'), '\\g\\g\\g\\g', text) + text = re.sub(unicode_type(r'(?msu)(?P\\(x|X[0-4]))(?P.*?)(?P\\C[0-4]\s*=\s*"[^"]*")(?P.*?)(?P=t)'), '\\g\\g\\g\\g', text) # Replace bad characters. text = text.replace(u'\xc2', '') diff --git a/src/calibre/ebooks/readability/htmls.py b/src/calibre/ebooks/readability/htmls.py index 6815df06aa..66a858326d 100644 --- a/src/calibre/ebooks/readability/htmls.py +++ b/src/calibre/ebooks/readability/htmls.py @@ -5,6 +5,7 @@ import lxml.html from calibre.ebooks.readability.cleaners import normalize_spaces, clean_attributes from calibre.ebooks.chardet import xml_to_unicode +from polyglot.builtins import unicode_type def build_doc(page): @@ -119,6 +120,5 @@ def shorten_title(doc): def get_body(doc): [elem.drop_tree() for elem in doc.xpath('.//script | .//link | .//style')] - raw_html = unicode(tostring(doc.body or doc)) + raw_html = unicode_type(tostring(doc.body or doc)) return clean_attributes(raw_html) - diff --git a/src/calibre/ebooks/readability/readability.py b/src/calibre/ebooks/readability/readability.py index 58953a2d80..46ccbc8a14 100644 --- a/src/calibre/ebooks/readability/readability.py +++ b/src/calibre/ebooks/readability/readability.py @@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, import re, sys from collections import defaultdict -from polyglot.builtins import reraise +from polyglot.builtins import reraise, unicode_type from lxml.etree import tostring from lxml.html import (fragment_fromstring, document_fromstring, @@ -17,7 +17,7 @@ from calibre.ebooks.readability.cleaners import html_cleaner, clean_attributes def tounicode(tree_or_node, **kwargs): - kwargs['encoding'] = unicode + kwargs['encoding'] = unicode_type return htostring(tree_or_node, **kwargs) @@ -315,7 +315,7 @@ class Document: def transform_misused_divs_into_paragraphs(self): for elem in self.tags(self.html, 'div'): # transform
s that do not contain other block elements into

s - if not REGEXES['divToPElementsRe'].search(unicode(''.join(map(tostring, list(elem))))): + if not REGEXES['divToPElementsRe'].search(unicode_type(''.join(map(tostring, list(elem))))): # self.debug("Altering %s to p" % (describe(elem))) elem.tag = "p" # print "Fixed element "+describe(elem) diff --git a/src/calibre/ebooks/rtf/rtfml.py b/src/calibre/ebooks/rtf/rtfml.py index bb602aa4d8..8cb1422dc3 100644 --- a/src/calibre/ebooks/rtf/rtfml.py +++ b/src/calibre/ebooks/rtf/rtfml.py @@ -17,6 +17,7 @@ from lxml import etree from calibre.ebooks.metadata import authors_to_string from calibre.utils.img import save_cover_data_to from calibre.utils.imghdr import identify +from polyglot.builtins import unicode_type TAGS = { 'b': '\\b', @@ -75,7 +76,7 @@ def txt2rtf(text): text = text.replace('}', r'\'7d') text = text.replace('\\', r'\'5c') - if not isinstance(text, unicode): + if not isinstance(text, unicode_type): return text buf = cStringIO.StringIO() @@ -119,7 +120,7 @@ class RTFMLizer(object): self.log.debug('Converting %s to RTF markup...' % item.href) # Removing comments is needed as comments with -- inside them can # cause fromstring() to fail - content = re.sub(u'', u'', etree.tostring(item.data, encoding=unicode), flags=re.DOTALL) + content = re.sub(u'', u'', etree.tostring(item.data, encoding=unicode_type), flags=re.DOTALL) content = self.remove_newlines(content) content = self.remove_tabs(content) content = etree.fromstring(content) diff --git a/src/calibre/ebooks/rtf2xml/tokenize.py b/src/calibre/ebooks/rtf2xml/tokenize.py index e2933fbeb9..6b71f88b77 100755 --- a/src/calibre/ebooks/rtf2xml/tokenize.py +++ b/src/calibre/ebooks/rtf2xml/tokenize.py @@ -15,6 +15,7 @@ import os, re from calibre.ebooks.rtf2xml import copy from calibre.utils.mreplace import MReplace from calibre.ptempfile import better_mktemp +from polyglot.builtins import codepoint_to_chr class Tokenize: @@ -93,7 +94,7 @@ class Tokenize: uni_len = len(match_obj.group(0)) if uni_char < 0: uni_char += 65536 - uni_char = unichr(uni_char).encode('ascii', 'xmlcharrefreplace') + uni_char = codepoint_to_chr(uni_char).encode('ascii', 'xmlcharrefreplace') self.__uc_char = self.__uc_value[-1] # there is only an unicode char if len(token)<= uni_len: diff --git a/src/calibre/ebooks/snb/snbfile.py b/src/calibre/ebooks/snb/snbfile.py index a50eb0a710..6dfe66bc8a 100644 --- a/src/calibre/ebooks/snb/snbfile.py +++ b/src/calibre/ebooks/snb/snbfile.py @@ -8,6 +8,7 @@ __docformat__ = 'restructuredtext en' import sys, struct, zlib, bz2, os from calibre import guess_type +from polyglot.builtins import unicode_type class FileStream: @@ -163,7 +164,7 @@ class SNBFile: f.fileSize = os.path.getsize(os.path.join(tdir,fileName)) f.fileBody = open(os.path.join(tdir,fileName), 'rb').read() f.fileName = fileName.replace(os.sep, '/') - if isinstance(f.fileName, unicode): + if isinstance(f.fileName, unicode_type): f.fileName = f.fileName.encode("ascii", "ignore") self.files.append(f) @@ -173,7 +174,7 @@ class SNBFile: f.fileSize = os.path.getsize(os.path.join(tdir,fileName)) f.fileBody = open(os.path.join(tdir,fileName), 'rb').read() f.fileName = fileName.replace(os.sep, '/') - if isinstance(f.fileName, unicode): + if isinstance(f.fileName, unicode_type): f.fileName = f.fileName.encode("ascii", "ignore") self.files.append(f) diff --git a/src/calibre/ebooks/snb/snbml.py b/src/calibre/ebooks/snb/snbml.py index 89e112ac70..29fdf4210a 100644 --- a/src/calibre/ebooks/snb/snbml.py +++ b/src/calibre/ebooks/snb/snbml.py @@ -12,6 +12,7 @@ import os import re from lxml import etree +from polyglot.builtins import unicode_type def ProcessFileName(fileName): @@ -84,7 +85,7 @@ class SNBMLizer(object): from calibre.ebooks.oeb.stylizer import Stylizer output = [u''] stylizer = Stylizer(self.item.data, self.item.href, self.oeb_book, self.opts, self.opts.output_profile) - content = unicode(etree.tostring(self.item.data.find(XHTML('body')), encoding=unicode)) + content = unicode_type(etree.tostring(self.item.data.find(XHTML('body')), encoding=unicode_type)) # content = self.remove_newlines(content) trees = {} for subitem, subtitle in self.subitems: @@ -127,7 +128,7 @@ class SNBMLizer(object): else: prefix = u'' etree.SubElement(bodyTree, "text").text = \ - etree.CDATA(unicode(prefix + line)) + etree.CDATA(unicode_type(prefix + line)) if self.opts and self.opts.snb_insert_empty_line: etree.SubElement(bodyTree, "text").text = \ etree.CDATA(u'') diff --git a/src/calibre/ebooks/txt/markdownml.py b/src/calibre/ebooks/txt/markdownml.py index 3c35564e8c..7cef2b734b 100644 --- a/src/calibre/ebooks/txt/markdownml.py +++ b/src/calibre/ebooks/txt/markdownml.py @@ -15,6 +15,7 @@ from functools import partial from calibre.ebooks.htmlz.oeb2html import OEB2HTML from calibre.ebooks.oeb.base import XHTML, XHTML_NS, barename, namespace, rewrite_links from calibre.ebooks.oeb.stylizer import Stylizer +from polyglot.builtins import unicode_type class MarkdownMLizer(OEB2HTML): @@ -225,7 +226,7 @@ class MarkdownMLizer(OEB2HTML): text.append('+ ') elif li['name'] == 'ol': li['num'] += 1 - text.append(unicode(li['num']) + '. ') + text.append(unicode_type(li['num']) + '. ') # Process tags that contain text. if hasattr(elem, 'text') and elem.text: diff --git a/src/calibre/ebooks/txt/processor.py b/src/calibre/ebooks/txt/processor.py index 7a729f859e..b21d342aab 100644 --- a/src/calibre/ebooks/txt/processor.py +++ b/src/calibre/ebooks/txt/processor.py @@ -15,6 +15,7 @@ from calibre.ebooks.metadata.opf2 import OPFCreator from calibre.ebooks.conversion.preprocess import DocAnalysis from calibre.utils.cleantext import clean_ascii_chars +from polyglot.builtins import unicode_type HTML_TEMPLATE = u'%s \n%s\n' @@ -59,7 +60,7 @@ def split_txt(txt, epub_split_size_kb=0): ''' # Takes care if there is no point to split if epub_split_size_kb > 0: - if isinstance(txt, unicode): + if isinstance(txt, unicode_type): txt = txt.encode('utf-8') length_byte = len(txt) # Calculating the average chunk value for easy splitting as EPUB (+2 as a safe margin) diff --git a/src/calibre/ebooks/txt/txtml.py b/src/calibre/ebooks/txt/txtml.py index 26da604093..fd653f8b7b 100644 --- a/src/calibre/ebooks/txt/txtml.py +++ b/src/calibre/ebooks/txt/txtml.py @@ -11,6 +11,7 @@ Transform OEB content into plain text import re from lxml import etree +from polyglot.builtins import unicode_type BLOCK_TAGS = [ @@ -72,7 +73,7 @@ class TXTMLizer(object): for x in item.data.iterdescendants(etree.Comment): if x.text and '--' in x.text: x.text = x.text.replace('--', '__') - content = unicode(etree.tostring(item.data, encoding=unicode)) + content = unicode_type(etree.tostring(item.data, encoding=unicode_type)) content = self.remove_newlines(content) content = etree.fromstring(content) stylizer = Stylizer(content, item.href, self.oeb_book, self.opts, self.opts.output_profile) diff --git a/src/calibre/ebooks/unihandecode/__init__.py b/src/calibre/ebooks/unihandecode/__init__.py index dc7b0dad63..1ce7d8e5d2 100644 --- a/src/calibre/ebooks/unihandecode/__init__.py +++ b/src/calibre/ebooks/unihandecode/__init__.py @@ -19,6 +19,8 @@ Tranliterate the string from unicode characters to ASCII in Chinese and others. ''' import unicodedata +from calibre.constants import ispy3 + class Unihandecoder(object): preferred_encoding = None @@ -41,8 +43,7 @@ class Unihandecoder(object): self.decoder = Unidecoder() def decode(self, text): - try: - unicode # python2 + if not ispy3: if not isinstance(text, unicode): try: text = unicode(text) @@ -51,8 +52,6 @@ class Unihandecoder(object): text = text.decode(self.preferred_encoding) except: text = text.decode('utf-8', 'replace') - except: # python3, str is unicode - pass # at first unicode normalize it. (see Unicode standards) ntext = unicodedata.normalize('NFKC', text) return self.decoder.decode(ntext) diff --git a/src/calibre/ebooks/unihandecode/pykakasi/jisyo.py b/src/calibre/ebooks/unihandecode/pykakasi/jisyo.py index 1496eea111..6101817a7b 100644 --- a/src/calibre/ebooks/unihandecode/pykakasi/jisyo.py +++ b/src/calibre/ebooks/unihandecode/pykakasi/jisyo.py @@ -4,6 +4,8 @@ # Copyright 2011 Hiroshi Miura from zlib import decompress +from calibre.constants import ispy3 + class jisyo (object): kanwadict = None @@ -32,10 +34,9 @@ class jisyo (object): P('localization/pykakasi/kanadict2.calibre_msgpack', data=True)) def load_jisyo(self, char): - try: # python2 - key = "%04x"%ord(unicode(char)) - except: # python3 - key = "%04x"%ord(char) + if not ispy3: + char = unicode(char) + key = "%04x"%ord(char) try: # already exist? table = self.jisyo_table[key] diff --git a/src/calibre/ebooks/unihandecode/unidecoder.py b/src/calibre/ebooks/unihandecode/unidecoder.py index e8a4bab22a..74b1229ede 100644 --- a/src/calibre/ebooks/unihandecode/unidecoder.py +++ b/src/calibre/ebooks/unihandecode/unidecoder.py @@ -60,6 +60,7 @@ it under the same terms as Perl itself. ''' import re +from calibre.constants import ispy3 from calibre.ebooks.unihandecode.unicodepoints import CODEPOINTS from calibre.ebooks.unihandecode.zhcodepoints import CODEPOINTS as HANCODES @@ -94,18 +95,15 @@ class Unidecoder(object): Find what group character is a part of. ''' # Code groups withing CODEPOINTS take the form 'xAB' - try: # python2 - return 'x%02x' % (ord(unicode(character)) >> 8) - except: - return 'x%02x' % (ord(character) >> 8) + if not ispy3: + character = unicode(character) + return 'x%02x' % (ord(character) >> 8) def grouped_point(self, character): ''' Return the location the replacement character is in the list for a the group character is a part of. ''' - try: # python2 - return ord(unicode(character)) & 255 - except: - return ord(character) & 255 - + if not ispy3: + character = unicode(character) + return ord(character) & 255 diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index feb75a9770..dc8e3993ae 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -35,6 +35,7 @@ from calibre.utils.config import Config, ConfigProxy, JSONConfig, dynamic from calibre.utils.date import UNDEFINED_DATE from calibre.utils.file_type_icons import EXT_MAP from calibre.utils.localization import get_lang +from polyglot.builtins import unicode_type try: NO_URL_FORMATTING = QUrl.None_ @@ -612,7 +613,7 @@ class FileIconProvider(QFileIconProvider): if fileinfo.isDir(): key = 'dir' else: - ext = unicode(fileinfo.completeSuffix()).lower() + ext = unicode_type(fileinfo.completeSuffix()).lower() key = self.key_from_ext(ext) return self.cached_icon(key) @@ -732,7 +733,7 @@ class Translator(QTranslator): def translate(self, *args, **kwargs): try: - src = unicode(args[1]) + src = unicode_type(args[1]) except: return u'' t = _ @@ -763,7 +764,7 @@ def load_builtin_fonts(): fid = QFontDatabase.addApplicationFontFromData(s.read()) if fid > -1: fam = QFontDatabase.applicationFontFamilies(fid) - fam = set(map(unicode, fam)) + fam = set(map(unicode_type, fam)) if u'calibre Symbols' in fam: _rating_font = u'calibre Symbols' @@ -821,7 +822,7 @@ class Application(QApplication): args = sys.argv[:1] args.extend(['-platformpluginpath', sys.extensions_location, '-platform', 'headless']) self.headless = headless - qargs = [i.encode('utf-8') if isinstance(i, unicode) else i for i in args] + qargs = [i.encode('utf-8') if isinstance(i, unicode_type) else i for i in args] self.pi = plugins['progress_indicator'][0] if not isosx and not headless: # On OS X high dpi scaling is turned on automatically by the OS, so we dont need to set it explicitly @@ -871,7 +872,7 @@ class Application(QApplication): self.line_height = max(12, QFontMetrics(self.font()).lineSpacing()) dl = QLocale(get_lang()) - if unicode(dl.bcp47Name()) != u'C': + if unicode_type(dl.bcp47Name()) != u'C': QLocale.setDefault(dl) global gui_thread, qt_app gui_thread = QThread.currentThread() @@ -1009,7 +1010,7 @@ class Application(QApplication): def event(self, e): if callable(self.file_event_hook) and e.type() == QEvent.FileOpen: - path = unicode(e.file()) + path = unicode_type(e.file()) if os.access(path, os.R_OK): with self._file_open_lock: self._file_open_paths.append(path) @@ -1241,7 +1242,7 @@ def elided_text(text, font=None, width=300, pos='middle'): chomp = {'middle':remove_middle, 'left':lambda x:(ellipsis + x[delta:]), 'right':lambda x:(x[:-delta] + ellipsis)}[pos] while len(text) > delta and fm.width(text) > width: text = chomp(text) - return unicode(text) + return unicode_type(text) def find_forms(srcdir): @@ -1366,7 +1367,7 @@ def set_app_uid(val): AppUserModelID.argtypes = [wintypes.LPCWSTR] AppUserModelID.restype = wintypes.HRESULT try: - AppUserModelID(unicode(val)) + AppUserModelID(unicode_type(val)) except Exception as err: prints(u'Failed to set app uid with error:', as_unicode(err)) return False @@ -1375,7 +1376,7 @@ def set_app_uid(val): def add_to_recent_docs(path): from win32com.shell import shell, shellcon - path = unicode(path) + path = unicode_type(path) app_id = get_app_uid() if app_id is None: shell.SHAddToRecentDocs(shellcon.SHARD_PATHW, path) diff --git a/src/calibre/gui2/actions/__init__.py b/src/calibre/gui2/actions/__init__.py index 1f1068ef1e..d60a26e42d 100644 --- a/src/calibre/gui2/actions/__init__.py +++ b/src/calibre/gui2/actions/__init__.py @@ -15,6 +15,7 @@ from calibre import prints from calibre.constants import isosx from calibre.gui2 import Dispatcher from calibre.gui2.keyboard import NameConflict +from polyglot.builtins import unicode_type def menu_action_unique_name(plugin, unique_name): @@ -162,7 +163,7 @@ class InterfaceAction(QObject): action = QAction(text, self.gui) if attr == 'qaction': mt = (action.text() if self.action_menu_clone_qaction is True else - unicode(self.action_menu_clone_qaction)) + unicode_type(self.action_menu_clone_qaction)) self.menuless_qaction = ma = QAction(action.icon(), mt, self.gui) ma.triggered.connect(action.trigger) for a in ((action, ma) if attr == 'qaction' else (action,)): @@ -179,7 +180,7 @@ class InterfaceAction(QObject): keys = ((shortcut,) if isinstance(shortcut, basestring) else tuple(shortcut)) if shortcut_name is None and spec[0]: - shortcut_name = unicode(spec[0]) + shortcut_name = unicode_type(spec[0]) if shortcut_name and self.action_spec[0] and not ( attr == 'qaction' and self.popup_type == QToolButton.InstantPopup): @@ -190,7 +191,7 @@ class InterfaceAction(QObject): group=self.action_spec[0]) except NameConflict as e: try: - prints(unicode(e)) + prints(unicode_type(e)) except: pass shortcut_action.setShortcuts([QKeySequence(key, @@ -240,7 +241,7 @@ class InterfaceAction(QObject): ''' if shortcut_name is None: - shortcut_name = unicode(text) + shortcut_name = unicode_type(text) ac = menu.addAction(text) if icon is not None: if not isinstance(icon, QIcon): diff --git a/src/calibre/gui2/actions/choose_library.py b/src/calibre/gui2/actions/choose_library.py index 3a85bb44dc..67581a1077 100644 --- a/src/calibre/gui2/actions/choose_library.py +++ b/src/calibre/gui2/actions/choose_library.py @@ -20,6 +20,7 @@ from calibre.utils.icu import sort_key from calibre.gui2 import (gprefs, warning_dialog, Dispatcher, error_dialog, question_dialog, info_dialog, open_local_file, choose_dir) from calibre.gui2.actions import InterfaceAction +from polyglot.builtins import unicode_type def db_class(): @@ -144,7 +145,7 @@ class MovedDialog(QDialog): # {{{ self.stats.remove(self.location) def accept(self): - newloc = unicode(self.loc.text()) + newloc = unicode_type(self.loc.text()) if not db_class().exists_at(newloc): error_dialog(self, _('No library found'), _('No existing calibre library found at %s')%newloc, @@ -416,7 +417,7 @@ class ChooseLibraryAction(InterfaceAction): 'Choose a new name for the library %s. ')%name + '

'+_( 'Note that the actual library folder will be renamed.'), text=old_name) - newname = sanitize_file_name_unicode(unicode(newname)) + newname = sanitize_file_name_unicode(unicode_type(newname)) if not ok or not newname or newname == old_name: return newloc = os.path.join(base, newname) diff --git a/src/calibre/gui2/actions/copy_to_library.py b/src/calibre/gui2/actions/copy_to_library.py index 32da577640..d9cb155ca1 100644 --- a/src/calibre/gui2/actions/copy_to_library.py +++ b/src/calibre/gui2/actions/copy_to_library.py @@ -26,6 +26,7 @@ from calibre.gui2.widgets2 import Dialog from calibre.utils.config import prefs from calibre.utils.icu import sort_key, numeric_sort_key from calibre.db.copy_to_library import copy_one_book +from polyglot.builtins import unicode_type def ask_about_cc_mismatch(gui, db, newdb, missing_cols, incompatible_cols): # {{{ @@ -132,7 +133,7 @@ class Worker(Thread): # {{{ except Exception as err: import traceback try: - err = unicode(err) + err = unicode_type(err) except: err = repr(err) self.error = (err, traceback.format_exc()) @@ -260,7 +261,7 @@ class ChooseLibrary(Dialog): # {{{ @property def args(self): - return (unicode(self.le.text()), self.delete_after_copy) + return (unicode_type(self.le.text()), self.delete_after_copy) # }}} @@ -298,7 +299,7 @@ class DuplicatesQuestion(QDialog): # {{{ self.resize(600, 400) def copy_to_clipboard(self): - items = [('✓' if item.checkState() == Qt.Checked else '✗') + ' ' + unicode(item.text()) + items = [('✓' if item.checkState() == Qt.Checked else '✗') + ' ' + unicode_type(item.text()) for item in self.items] QApplication.clipboard().setText('\n'.join(items)) diff --git a/src/calibre/gui2/actions/device.py b/src/calibre/gui2/actions/device.py index 61b967d22b..ee8c4fb402 100644 --- a/src/calibre/gui2/actions/device.py +++ b/src/calibre/gui2/actions/device.py @@ -12,6 +12,7 @@ from calibre.gui2.actions import InterfaceAction from calibre.gui2.dialogs.smartdevice import SmartdeviceDialog from calibre.utils.icu import primary_sort_key from calibre.utils.smtp import config as email_config +from polyglot.builtins import unicode_type class ShareConnMenu(QMenu): # {{{ @@ -54,7 +55,7 @@ class ShareConnMenu(QMenu): # {{{ gr = ConnectShareAction.action_spec[0] for attr in ('folder', ): ac = getattr(self, 'connect_to_%s_action'%attr) - r(prefix + attr, unicode(ac.text()), action=ac, + r(prefix + attr, unicode_type(ac.text()), action=ac, group=gr) r(prefix+' content server', _('Start/stop Content server'), action=self.toggle_server_action, group=gr) diff --git a/src/calibre/gui2/actions/edit_metadata.py b/src/calibre/gui2/actions/edit_metadata.py index de9282c550..2d8ef8e9a1 100644 --- a/src/calibre/gui2/actions/edit_metadata.py +++ b/src/calibre/gui2/actions/edit_metadata.py @@ -26,6 +26,7 @@ from calibre.db.errors import NoSuchFormat from calibre.library.comments import merge_comments from calibre.ebooks.metadata.sources.prefs import msprefs from calibre.gui2.actions.show_quickview import get_quickview_action_plugin +from polyglot.builtins import unicode_type class EditMetadataAction(InterfaceAction): @@ -118,7 +119,7 @@ class EditMetadataAction(InterfaceAction): book_id = db.id(rows[0].row()) mi = db.new_api.get_metadata(book_id) md = QMimeData() - md.setText(unicode(mi)) + md.setText(unicode_type(mi)) md.setData('application/calibre-book-metadata', bytearray(metadata_to_opf(mi, default_lang='und'))) img = db.new_api.cover(book_id, as_image=True) if img: @@ -647,7 +648,7 @@ class EditMetadataAction(InterfaceAction): if not dest_mi.comments: dest_mi.comments = src_mi.comments else: - dest_mi.comments = unicode(dest_mi.comments) + u'\n\n' + unicode(src_mi.comments) + dest_mi.comments = unicode_type(dest_mi.comments) + u'\n\n' + unicode_type(src_mi.comments) if src_mi.title and (not dest_mi.title or dest_mi.title == _('Unknown')): dest_mi.title = src_mi.title if (src_mi.authors and src_mi.authors[0] != _('Unknown')) and (not dest_mi.authors or dest_mi.authors[0] == _('Unknown')): @@ -700,7 +701,7 @@ class EditMetadataAction(InterfaceAction): if not dest_value: db.set_custom(dest_id, src_value, num=colnum) else: - dest_value = unicode(dest_value) + u'\n\n' + unicode(src_value) + dest_value = unicode_type(dest_value) + u'\n\n' + unicode_type(src_value) db.set_custom(dest_id, dest_value, num=colnum) if (dt in {'bool', 'int', 'float', 'rating', 'datetime'} and dest_value is None): db.set_custom(dest_id, src_value, num=colnum) @@ -726,7 +727,7 @@ class EditMetadataAction(InterfaceAction): to_rename = d.to_rename # dict of new text to old ids to_delete = d.to_delete # list of ids for old_id, new_name in to_rename.iteritems(): - model.rename_collection(old_id, new_name=unicode(new_name)) + model.rename_collection(old_id, new_name=unicode_type(new_name)) for item in to_delete: model.delete_collection_using_id(item) self.gui.upload_collections(model.db, view=view, oncard=oncard) diff --git a/src/calibre/gui2/actions/mark_books.py b/src/calibre/gui2/actions/mark_books.py index 40f1fed756..eda6020b5f 100644 --- a/src/calibre/gui2/actions/mark_books.py +++ b/src/calibre/gui2/actions/mark_books.py @@ -12,6 +12,7 @@ from PyQt5.Qt import QTimer, QApplication, Qt from calibre.gui2 import error_dialog from calibre.gui2.actions import InterfaceAction +from polyglot.builtins import unicode_type class MarkBooksAction(InterfaceAction): @@ -120,7 +121,7 @@ class MarkBooksAction(InterfaceAction): def clear_all_marked(self): self.gui.current_db.data.set_marked_ids(()) - if unicode(self.gui.search.text()).startswith('marked:'): + if unicode_type(self.gui.search.text()).startswith('marked:'): self.gui.search.set_search_string('') def mark_field(self, field, add): diff --git a/src/calibre/gui2/actions/polish.py b/src/calibre/gui2/actions/polish.py index fc089bae4d..292dcf33d1 100644 --- a/src/calibre/gui2/actions/polish.py +++ b/src/calibre/gui2/actions/polish.py @@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en' import os, weakref, shutil, textwrap from collections import OrderedDict from functools import partial -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from PyQt5.Qt import (QDialog, QGridLayout, QIcon, QCheckBox, QLabel, QFrame, QApplication, QDialogButtonBox, Qt, QSize, QSpacerItem, @@ -156,7 +156,7 @@ class Polish(QDialog): # {{{ name, ok = QInputDialog.getText(self, _('Choose name'), _('Choose a name for these settings')) if ok: - name = unicode(name).strip() + name = unicode_type(name).strip() if name: settings = {ac:getattr(self, 'opt_'+ac).isChecked() for ac in self.all_actions} @@ -195,7 +195,7 @@ class Polish(QDialog): # {{{ self.help_label.setText(self.help_text[name]) def help_link_activated(self, link): - link = unicode(link)[1:] + link = unicode_type(link)[1:] self.help_label.setText(self.help_text[link]) @property @@ -269,7 +269,7 @@ class Polish(QDialog): # {{{ QTimer.singleShot(0, self.do_one) def do_book(self, num, book_id, formats): - base = os.path.join(self.tdir, unicode(book_id)) + base = os.path.join(self.tdir, unicode_type(book_id)) os.mkdir(base) db = self.db() opf = os.path.join(base, 'metadata.opf') diff --git a/src/calibre/gui2/actions/toc_edit.py b/src/calibre/gui2/actions/toc_edit.py index 4134068d0c..518e98007a 100644 --- a/src/calibre/gui2/actions/toc_edit.py +++ b/src/calibre/gui2/actions/toc_edit.py @@ -14,6 +14,7 @@ from PyQt5.Qt import (QTimer, QDialog, QGridLayout, QCheckBox, QLabel, from calibre.gui2 import error_dialog, gprefs from calibre.gui2.actions import InterfaceAction +from polyglot.builtins import unicode_type SUPPORTED = {'EPUB', 'AZW3'} @@ -55,7 +56,7 @@ class ChooseFormat(QDialog): # {{{ def fget(self): for b in self.buttons: if b.isChecked(): - yield unicode(b.text())[1:] + yield unicode_type(b.text())[1:] def fset(self, formats): formats = {x.upper() for x in formats} diff --git a/src/calibre/gui2/actions/unpack_book.py b/src/calibre/gui2/actions/unpack_book.py index 5f4476636e..e92627ea57 100644 --- a/src/calibre/gui2/actions/unpack_book.py +++ b/src/calibre/gui2/actions/unpack_book.py @@ -17,6 +17,7 @@ from calibre.gui2.actions import InterfaceAction from calibre.ptempfile import (PersistentTemporaryDirectory, PersistentTemporaryFile) from calibre.utils.config import prefs, tweaks +from polyglot.builtins import unicode_type class UnpackBook(QDialog): @@ -34,7 +35,7 @@ class UnpackBook(QDialog): index_is_id=True)) button = self.fmt_choice_buttons[0] - button_map = {unicode(x.text()):x for x in self.fmt_choice_buttons} + button_map = {unicode_type(x.text()):x for x in self.fmt_choice_buttons} of = prefs['output_format'].upper() df = tweaks.get('default_tweak_format', None) lf = gprefs.get('last_tweak_format', None) @@ -281,7 +282,7 @@ class UnpackBook(QDialog): def current_format(self): for b in self.fmt_choice_buttons: if b.isChecked(): - return unicode(b.text()) + return unicode_type(b.text()) class UnpackBookAction(InterfaceAction): diff --git a/src/calibre/gui2/add.py b/src/calibre/gui2/add.py index aa11c9bd0f..c9bb3fbc41 100644 --- a/src/calibre/gui2/add.py +++ b/src/calibre/gui2/add.py @@ -11,7 +11,7 @@ from threading import Thread from collections import OrderedDict from Queue import Empty from io import BytesIO -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from PyQt5.Qt import QObject, Qt, pyqtSignal @@ -271,7 +271,7 @@ class Adder(QObject): except Failure as err: error_dialog(self.pd, _('Cannot add books'), _( 'Failed to add some books, click "Show details" for more information.'), - det_msg=unicode(err.failure_message) + '\n' + unicode(err.details), show=True) + det_msg=unicode_type(err.failure_message) + '\n' + unicode_type(err.details), show=True) self.pd.canceled = True else: # All tasks completed diff --git a/src/calibre/gui2/add_filters.py b/src/calibre/gui2/add_filters.py index 1ef66523ef..b6995b63b8 100644 --- a/src/calibre/gui2/add_filters.py +++ b/src/calibre/gui2/add_filters.py @@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) from collections import OrderedDict -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from calibre.db.adding import compile_glob, filter_filename, compile_rule from calibre.gui2 import elided_text, Application, error_dialog @@ -66,12 +66,12 @@ class RuleEdit(RuleEditBase): def rule(self, rule): def sc(name): c = getattr(self, name) - idx = c.findData(unicode(rule.get(name, ''))) + idx = c.findData(unicode_type(rule.get(name, ''))) if idx < 0: idx = 0 c.setCurrentIndex(idx) sc('action'), sc('match_type') - self.query.setText(unicode(rule.get('query', '')).strip()) + self.query.setText(unicode_type(rule.get('query', '')).strip()) def validate(self): ans = super(RuleEdit, self).validate() diff --git a/src/calibre/gui2/author_mapper.py b/src/calibre/gui2/author_mapper.py index c38ae4bb80..a5f52678d1 100644 --- a/src/calibre/gui2/author_mapper.py +++ b/src/calibre/gui2/author_mapper.py @@ -15,6 +15,7 @@ from calibre.gui2.tag_mapper import ( Tester as TesterBase ) from calibre.utils.config import JSONConfig +from polyglot.builtins import unicode_type author_maps = JSONConfig('author-mapping-rules') @@ -66,13 +67,13 @@ class RuleEdit(RuleEditBase): def rule(self, rule): def sc(name): c = getattr(self, name) - idx = c.findData(unicode(rule.get(name, ''))) + idx = c.findData(unicode_type(rule.get(name, ''))) if idx < 0: idx = 0 c.setCurrentIndex(idx) sc('match_type'), sc('action') - self.query.setText(unicode(rule.get('query', '')).strip()) - self.replace.setText(unicode(rule.get('replace', '')).strip()) + self.query.setText(unicode_type(rule.get('query', '')).strip()) + self.replace.setText(unicode_type(rule.get('replace', '')).strip()) class RuleEditDialog(RuleEditDialogBase): diff --git a/src/calibre/gui2/bars.py b/src/calibre/gui2/bars.py index cb1b039278..f861c71525 100644 --- a/src/calibre/gui2/bars.py +++ b/src/calibre/gui2/bars.py @@ -19,6 +19,7 @@ except ImportError: from calibre.constants import isosx from calibre.gui2 import gprefs, native_menubar_defaults, config from calibre.gui2.throbber import ThrobbingButton +from polyglot.builtins import unicode_type class RevealBar(QWidget): # {{{ @@ -303,7 +304,7 @@ class ToolBar(QToolBar): # {{{ mime = 'application/calibre+from_device' if data.hasFormat(mime): - paths = [unicode(u.toLocalFile()) for u in data.urls()] + paths = [unicode_type(u.toLocalFile()) for u in data.urls()] if paths: self.gui.iactions['Add Books'].add_books_from_device( self.gui.current_view(), paths=paths) diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index e3943e933c..af32669c1a 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -34,6 +34,7 @@ from calibre.gui2.dnd import ( from calibre.utils.config import tweaks from calibre.utils.img import blend_image, image_from_x from calibre.utils.localization import is_rtl +from polyglot.builtins import unicode_type _css = None InternetSearch = namedtuple('InternetSearch', 'author where') @@ -57,7 +58,7 @@ def css(): val = P('templates/book_details.css', data=True).decode('utf-8') col = QApplication.instance().palette().color(QPalette.Link).name() val = val.replace('LINK_COLOR', col) - _css = re.sub(unicode(r'/\*.*?\*/'), u'', val, flags=re.DOTALL) + _css = re.sub(unicode_type(r'/\*.*?\*/'), u'', val, flags=re.DOTALL) return _css @@ -114,12 +115,12 @@ def render_html(mi, css, vertical, widget, all_fields=False, render_data_func=No if col.isValid(): col = col.toRgb() if col.isValid(): - ans = unicode(col.name()) + ans = unicode_type(col.name()) return ans fi = QFontInfo(QApplication.font(widget)) f = fi.pixelSize() + 1 + int(tweaks['change_book_details_font_size_by']) - fam = unicode(fi.family()).strip().replace('"', '') + fam = unicode_type(fi.family()).strip().replace('"', '') if not fam: fam = 'sans-serif' @@ -195,7 +196,7 @@ def details_context_menu_event(view, ev, book_info): # {{{ p = view.page() mf = p.mainFrame() r = mf.hitTestContent(ev.pos()) - url = unicode(r.linkUrl().toString(NO_URL_FORMATTING)).strip() + url = unicode_type(r.linkUrl().toString(NO_URL_FORMATTING)).strip() menu = p.createStandardContextMenu() ca = view.pageAction(p.Copy) for action in list(menu.actions()): @@ -264,7 +265,7 @@ def details_context_menu_event(view, ev, book_info): # {{{ else: el = r.linkElement() data = el.attribute('data-item') - author = el.toPlainText() if unicode(el.attribute('calibre-data')) == u'authors' else None + author = el.toPlainText() if unicode_type(el.attribute('calibre-data')) == u'authors' else None if url and not url.startswith('search:'): for a, t in [('copy', _('&Copy link')), ]: @@ -623,9 +624,9 @@ class BookInfo(QWebView): def link_activated(self, link): self._link_clicked = True - if unicode(link.scheme()) in ('http', 'https'): + if unicode_type(link.scheme()) in ('http', 'https'): return open_url(link) - link = unicode(link.toString(NO_URL_FORMATTING)) + link = unicode_type(link.toString(NO_URL_FORMATTING)) self.link_clicked.emit(link) def turnoff_scrollbar(self, *args): diff --git a/src/calibre/gui2/catalog/catalog_bibtex.py b/src/calibre/gui2/catalog/catalog_bibtex.py index 1464bc8124..e98f9a3a09 100644 --- a/src/calibre/gui2/catalog/catalog_bibtex.py +++ b/src/calibre/gui2/catalog/catalog_bibtex.py @@ -9,6 +9,7 @@ __docformat__ = 'restructuredtext en' from calibre.gui2 import gprefs from calibre.gui2.catalog.catalog_bibtex_ui import Ui_Form +from polyglot.builtins import unicode_type from PyQt5.Qt import QWidget, QListWidgetItem @@ -49,7 +50,7 @@ class PluginWidget(QWidget, Ui_Form): # Restore the activated db_fields from last use for x in xrange(self.db_fields.count()): item = self.db_fields.item(x) - item.setSelected(unicode(item.text()) in fields) + item.setSelected(unicode_type(item.text()) in fields) self.bibfile_enc.clear() self.bibfile_enc.addItems(['utf-8', 'cp1252', 'ascii/LaTeX']) self.bibfile_enctag.clear() @@ -74,12 +75,12 @@ class PluginWidget(QWidget, Ui_Form): for x in xrange(self.db_fields.count()): item = self.db_fields.item(x) if item.isSelected(): - fields.append(unicode(item.text())) + fields.append(unicode_type(item.text())) gprefs.set(self.name+'_db_fields', fields) # Dictionary currently activated fields if len(self.db_fields.selectedItems()): - opts_dict = {'fields':[unicode(i.text()) for i in self.db_fields.selectedItems()]} + opts_dict = {'fields':[unicode_type(i.text()) for i in self.db_fields.selectedItems()]} else: opts_dict = {'fields':['all']} @@ -92,7 +93,7 @@ class PluginWidget(QWidget, Ui_Form): elif opt[0] in ['impcit', 'addfiles'] : opt_value = getattr(self, opt[0]).isChecked() else : - opt_value = unicode(getattr(self, opt[0]).text()) + opt_value = unicode_type(getattr(self, opt[0]).text()) gprefs.set(self.name + '_' + opt[0], opt_value) opts_dict[opt[0]] = opt_value diff --git a/src/calibre/gui2/catalog/catalog_csv_xml.py b/src/calibre/gui2/catalog/catalog_csv_xml.py index ec3480a215..6280b606b7 100644 --- a/src/calibre/gui2/catalog/catalog_csv_xml.py +++ b/src/calibre/gui2/catalog/catalog_csv_xml.py @@ -8,6 +8,7 @@ __docformat__ = 'restructuredtext en' from calibre.gui2 import gprefs from calibre.gui2.ui import get_gui +from polyglot.builtins import unicode_type from PyQt5.Qt import QWidget, QListWidgetItem, Qt, QVBoxLayout, QLabel, QListWidget @@ -84,16 +85,16 @@ class PluginWidget(QWidget): # Restore the activated fields from last use for x in range(self.db_fields.count()): item = self.db_fields.item(x) - item.setCheckState(Qt.Checked if unicode(item.data(Qt.UserRole)) in fields else Qt.Unchecked) + item.setCheckState(Qt.Checked if unicode_type(item.data(Qt.UserRole)) in fields else Qt.Unchecked) def options(self): # Save the currently activated fields fields, all_fields = [], [] for x in xrange(self.db_fields.count()): item = self.db_fields.item(x) - all_fields.append(unicode(item.data(Qt.UserRole))) + all_fields.append(unicode_type(item.data(Qt.UserRole))) if item.checkState() == Qt.Checked: - fields.append(unicode(item.data(Qt.UserRole))) + fields.append(unicode_type(item.data(Qt.UserRole))) set_saved_field_data(self.name, fields, {x:i for i, x in enumerate(all_fields)}) # Return a dictionary with current options for this widget diff --git a/src/calibre/gui2/catalog/catalog_epub_mobi.py b/src/calibre/gui2/catalog/catalog_epub_mobi.py index d2b80a416f..3ea94eb7f6 100644 --- a/src/calibre/gui2/catalog/catalog_epub_mobi.py +++ b/src/calibre/gui2/catalog/catalog_epub_mobi.py @@ -16,6 +16,7 @@ from calibre.gui2 import gprefs, open_url, question_dialog, error_dialog from calibre.utils.config import JSONConfig from calibre.utils.icu import sort_key from calibre.utils.localization import localize_user_manual_link +from polyglot.builtins import unicode_type from catalog_epub_mobi_ui import Ui_Form from PyQt5.Qt import (Qt, QAbstractItemView, QCheckBox, QComboBox, @@ -202,7 +203,7 @@ class PluginWidget(QWidget,Ui_Form): results = _('No genres will be excluded') - regex = unicode(getattr(self, 'exclude_genre').text()).strip() + regex = unicode_type(getattr(self, 'exclude_genre').text()).strip() if not regex: self.exclude_genre_results.clear() self.exclude_genre_results.setText(results) @@ -277,7 +278,7 @@ class PluginWidget(QWidget,Ui_Form): new_source = self.genre_source_field.currentText() self.genre_source_field_name = new_source if new_source != _('Tags'): - genre_source_spec = self.genre_source_fields[unicode(new_source)] + genre_source_spec = self.genre_source_fields[unicode_type(new_source)] self.genre_source_field_name = genre_source_spec['field'] self.exclude_genre_changed() @@ -297,7 +298,7 @@ class PluginWidget(QWidget,Ui_Form): new_source = self.header_note_source_field.currentText() self.header_note_source_field_name = new_source if new_source > '': - header_note_source_spec = self.header_note_source_fields[unicode(new_source)] + header_note_source_spec = self.header_note_source_fields[unicode_type(new_source)] self.header_note_source_field_name = header_note_source_spec['field'] def initialize(self, name, db): @@ -338,7 +339,7 @@ class PluginWidget(QWidget,Ui_Form): c_name, c_def, c_type = opt opt_value = gprefs.get(self.name + '_' + c_name, c_def) if c_type in ['check_box']: - getattr(self, c_name).setChecked(eval(unicode(opt_value))) + getattr(self, c_name).setChecked(eval(unicode_type(opt_value))) getattr(self, c_name).clicked.connect(partial(self.settings_changed, c_name)) elif c_type in ['combo_box']: if opt_value is None: @@ -385,21 +386,21 @@ class PluginWidget(QWidget,Ui_Form): # Init self.merge_source_field_name self.merge_source_field_name = '' - cs = unicode(self.merge_source_field.currentText()) + cs = unicode_type(self.merge_source_field.currentText()) if cs > '': merge_source_spec = self.merge_source_fields[cs] self.merge_source_field_name = merge_source_spec['field'] # Init self.header_note_source_field_name self.header_note_source_field_name = '' - cs = unicode(self.header_note_source_field.currentText()) + cs = unicode_type(self.header_note_source_field.currentText()) if cs > '': header_note_source_spec = self.header_note_source_fields[cs] self.header_note_source_field_name = header_note_source_spec['field'] # Init self.genre_source_field_name self.genre_source_field_name = _('Tags') - cs = unicode(self.genre_source_field.currentText()) + cs = unicode_type(self.genre_source_field.currentText()) if cs != _('Tags'): genre_source_spec = self.genre_source_fields[cs] self.genre_source_field_name = genre_source_spec['field'] @@ -433,7 +434,7 @@ class PluginWidget(QWidget,Ui_Form): new_source = self.merge_source_field.currentText() self.merge_source_field_name = new_source if new_source > '': - merge_source_spec = self.merge_source_fields[unicode(new_source)] + merge_source_spec = self.merge_source_fields[unicode_type(new_source)] self.merge_source_field_name = merge_source_spec['field'] if not self.merge_before.isChecked() and not self.merge_after.isChecked(): self.merge_after.setChecked(True) @@ -468,11 +469,11 @@ class PluginWidget(QWidget,Ui_Form): if c_type in ['check_box', 'radio_button']: opt_value = getattr(self, c_name).isChecked() elif c_type in ['combo_box']: - opt_value = unicode(getattr(self,c_name).currentText()).strip() + opt_value = unicode_type(getattr(self,c_name).currentText()).strip() elif c_type in ['line_edit']: - opt_value = unicode(getattr(self, c_name).text()).strip() + opt_value = unicode_type(getattr(self, c_name).text()).strip() elif c_type in ['spin_box']: - opt_value = unicode(getattr(self, c_name).value()) + opt_value = unicode_type(getattr(self, c_name).value()) elif c_type in ['table_widget']: if c_name == 'prefix_rules_tw': opt_value = self.prefix_rules_table.get_data() @@ -619,9 +620,9 @@ class PluginWidget(QWidget,Ui_Form): else: continue if c_type in ['check_box']: - getattr(self, c_name).setChecked(eval(unicode(opt_value))) + getattr(self, c_name).setChecked(eval(unicode_type(opt_value))) if c_name == 'generate_genres': - self.genre_source_field.setEnabled(eval(unicode(opt_value))) + self.genre_source_field.setEnabled(eval(unicode_type(opt_value))) elif c_type in ['combo_box']: if opt_value is None: index = 0 @@ -682,7 +683,7 @@ class PluginWidget(QWidget,Ui_Form): return item_id = self.preset_field.currentIndex() - item_name = unicode(self.preset_field.currentText()) + item_name = unicode_type(self.preset_field.currentText()) self.preset_field.blockSignals(True) self.preset_field.removeItem(item_id) @@ -710,7 +711,7 @@ class PluginWidget(QWidget,Ui_Form): error_dialog(self, _("Save catalog preset"), _("You must provide a name."), show=True) new = True - name = unicode(name) + name = unicode_type(name) if name in self.presets.keys(): if not question_dialog(self, _("Save catalog preset"), _("That saved preset already exists and will be overwritten. " @@ -734,11 +735,11 @@ class PluginWidget(QWidget,Ui_Form): elif c_type in ['combo_box']: if c_name == 'preset_field': continue - opt_value = unicode(getattr(self,c_name).currentText()).strip() + opt_value = unicode_type(getattr(self,c_name).currentText()).strip() elif c_type in ['line_edit']: - opt_value = unicode(getattr(self, c_name).text()).strip() + opt_value = unicode_type(getattr(self, c_name).text()).strip() elif c_type in ['spin_box']: - opt_value = unicode(getattr(self, c_name).value()) + opt_value = unicode_type(getattr(self, c_name).value()) elif c_type in ['table_widget']: if c_name == 'prefix_rules_tw': opt_value = self.prefix_rules_table.get_data() @@ -767,8 +768,8 @@ class PluginWidget(QWidget,Ui_Form): preset['merge_comments_rule'] = "%s:%s:%s" % \ (self.merge_source_field_name, checked, include_hr) - preset['header_note_source_field'] = unicode(self.header_note_source_field.currentText()) - preset['genre_source_field'] = unicode(self.genre_source_field.currentText()) + preset['header_note_source_field'] = unicode_type(self.header_note_source_field.currentText()) + preset['genre_source_field'] = unicode_type(self.genre_source_field.currentText()) # Append the current output profile try: @@ -979,7 +980,7 @@ class GenericRulesTable(QTableWidget): first = rows[0].row() + 1 last = rows[-1].row() + 1 - first_rule_name = unicode(self.cellWidget(first-1,self.COLUMNS['NAME']['ordinal']).text()).strip() + first_rule_name = unicode_type(self.cellWidget(first-1,self.COLUMNS['NAME']['ordinal']).text()).strip() message = _("Are you sure you want to delete '%s'?") % (first_rule_name) if len(rows) > 1: message = _('Are you sure you want to delete rules #%(first)d-%(last)d?') % dict(first=first, last=last) @@ -1134,15 +1135,15 @@ class GenericRulesTable(QTableWidget): elif source_field == _('Tags'): values = sorted(self.db.all_tags(), key=sort_key) else: - if self.eligible_custom_fields[unicode(source_field)]['datatype'] in ['enumeration', 'text']: + if self.eligible_custom_fields[unicode_type(source_field)]['datatype'] in ['enumeration', 'text']: values = self.db.all_custom(self.db.field_metadata.key_to_label( - self.eligible_custom_fields[unicode(source_field)]['field'])) + self.eligible_custom_fields[unicode_type(source_field)]['field'])) values = sorted(values, key=sort_key) - elif self.eligible_custom_fields[unicode(source_field)]['datatype'] in ['bool']: + elif self.eligible_custom_fields[unicode_type(source_field)]['datatype'] in ['bool']: values = [_('True'),_('False'),_('unspecified')] - elif self.eligible_custom_fields[unicode(source_field)]['datatype'] in ['composite']: + elif self.eligible_custom_fields[unicode_type(source_field)]['datatype'] in ['composite']: values = [_('any value'),_('unspecified')] - elif self.eligible_custom_fields[unicode(source_field)]['datatype'] in ['datetime']: + elif self.eligible_custom_fields[unicode_type(source_field)]['datatype'] in ['datetime']: values = [_('any date'),_('unspecified')] values_combo = ComboBox(self, values, pattern) @@ -1196,9 +1197,9 @@ class ExclusionRules(GenericRulesTable): data = self.create_blank_row_data() data['ordinal'] = row data['enabled'] = self.item(row,self.COLUMNS['ENABLED']['ordinal']).checkState() == Qt.Checked - data['name'] = unicode(self.cellWidget(row,self.COLUMNS['NAME']['ordinal']).text()).strip() - data['field'] = unicode(self.cellWidget(row,self.COLUMNS['FIELD']['ordinal']).currentText()).strip() - data['pattern'] = unicode(self.cellWidget(row,self.COLUMNS['PATTERN']['ordinal']).currentText()).strip() + data['name'] = unicode_type(self.cellWidget(row,self.COLUMNS['NAME']['ordinal']).text()).strip() + data['field'] = unicode_type(self.cellWidget(row,self.COLUMNS['FIELD']['ordinal']).currentText()).strip() + data['pattern'] = unicode_type(self.cellWidget(row,self.COLUMNS['PATTERN']['ordinal']).currentText()).strip() return data def create_blank_row_data(self): @@ -1290,10 +1291,10 @@ class PrefixRules(GenericRulesTable): data = self.create_blank_row_data() data['ordinal'] = row data['enabled'] = self.item(row,self.COLUMNS['ENABLED']['ordinal']).checkState() == Qt.Checked - data['name'] = unicode(self.cellWidget(row,self.COLUMNS['NAME']['ordinal']).text()).strip() - data['prefix'] = unicode(self.cellWidget(row,self.COLUMNS['PREFIX']['ordinal']).currentText()).strip() - data['field'] = unicode(self.cellWidget(row,self.COLUMNS['FIELD']['ordinal']).currentText()).strip() - data['pattern'] = unicode(self.cellWidget(row,self.COLUMNS['PATTERN']['ordinal']).currentText()).strip() + data['name'] = unicode_type(self.cellWidget(row,self.COLUMNS['NAME']['ordinal']).text()).strip() + data['prefix'] = unicode_type(self.cellWidget(row,self.COLUMNS['PREFIX']['ordinal']).currentText()).strip() + data['field'] = unicode_type(self.cellWidget(row,self.COLUMNS['FIELD']['ordinal']).currentText()).strip() + data['pattern'] = unicode_type(self.cellWidget(row,self.COLUMNS['PATTERN']['ordinal']).currentText()).strip() return data def create_blank_row_data(self): diff --git a/src/calibre/gui2/comments_editor.py b/src/calibre/gui2/comments_editor.py index 576d2591d1..300f024669 100644 --- a/src/calibre/gui2/comments_editor.py +++ b/src/calibre/gui2/comments_editor.py @@ -27,6 +27,7 @@ from calibre.gui2.widgets import LineEditECM from calibre.utils.soupparser import fromstring from calibre.utils.config import tweaks from calibre.utils.imghdr import what +from polyglot.builtins import unicode_type class PageAction(QAction): # {{{ @@ -214,13 +215,13 @@ class EditorWidget(QWebView, LineEditECM): # {{{ col = QColorDialog.getColor(Qt.black, self, _('Choose foreground color'), QColorDialog.ShowAlphaChannel) if col.isValid(): - self.exec_command('foreColor', unicode(col.name())) + self.exec_command('foreColor', unicode_type(col.name())) def background_color(self): col = QColorDialog.getColor(Qt.white, self, _('Choose background color'), QColorDialog.ShowAlphaChannel) if col.isValid(): - self.exec_command('hiliteColor', unicode(col.name())) + self.exec_command('hiliteColor', unicode_type(col.name())) def insert_hr(self, *args): self.exec_command('insertHTML', '


') @@ -231,7 +232,7 @@ class EditorWidget(QWebView, LineEditECM): # {{{ return url = self.parse_link(link) if url.isValid(): - url = unicode(url.toString(NO_URL_FORMATTING)) + url = unicode_type(url.toString(NO_URL_FORMATTING)) self.setFocus(Qt.OtherFocusReason) if is_image: self.exec_command('insertHTML', @@ -293,7 +294,7 @@ class EditorWidget(QWebView, LineEditECM): # {{{ d.resize(d.sizeHint()) link, name, is_image = None, None, False if d.exec_() == d.Accepted: - link, name = unicode(d.url.text()).strip(), unicode(d.name.text()).strip() + link, name = unicode_type(d.url.text()).strip(), unicode_type(d.name.text()).strip() is_image = d.treat_as_image.isChecked() return link, name, is_image @@ -327,7 +328,7 @@ class EditorWidget(QWebView, LineEditECM): # {{{ frame = self.page().mainFrame() if arg is not None: js = 'document.execCommand("%s", false, %s);' % (cmd, - json.dumps(unicode(arg))) + json.dumps(unicode_type(arg))) else: js = 'document.execCommand("%s", false, null);' % cmd frame.evaluateJavaScript(js) @@ -343,10 +344,10 @@ class EditorWidget(QWebView, LineEditECM): # {{{ try: if not self.page().mainFrame().documentElement().findFirst('meta[name="calibre-dont-sanitize"]').isNull(): # Bypass cleanup if special meta tag exists - return unicode(self.page().mainFrame().toHtml()) - check = unicode(self.page().mainFrame().toPlainText()).strip() - raw = unicode(self.page().mainFrame().toHtml()) - raw = xml_to_unicode(raw, strip_encoding_pats=True, + return unicode_type(self.page().mainFrame().toHtml()) + check = unicode_type(self.page().mainFrame().toPlainText()).strip() + raw = unicode_type(self.page().mainFrame().toHtml()) + raw = xml_to_unicode_type(raw, strip_encoding_pats=True, resolve_entities=True)[0] raw = self.comments_pat.sub('', raw) if not check and ' 1: @@ -395,13 +396,13 @@ class EditorWidget(QWebView, LineEditECM): # {{{ return mf = self.page().mainFrame() mf.evaluateJavaScript('document.execCommand("selectAll", false, null)') - mf.evaluateJavaScript('document.execCommand("insertHTML", false, %s)' % json.dumps(unicode(val))) + mf.evaluateJavaScript('document.execCommand("insertHTML", false, %s)' % json.dumps(unicode_type(val))) self.set_font_style() def set_font_style(self): fi = QFontInfo(QApplication.font(self)) f = fi.pixelSize() + 1 + int(tweaks['change_book_details_font_size_by']) - fam = unicode(fi.family()).strip().replace('"', '') + fam = unicode_type(fi.family()).strip().replace('"', '') if not fam: fam = 'sans-serif' style = 'font-size: %fpx; font-family:"%s",sans-serif;' % (f, fam) @@ -781,7 +782,7 @@ class Editor(QWidget): # {{{ self.wyswyg_dirty = False elif index == 0: # changing to wyswyg if self.source_dirty: - self.editor.html = unicode(self.code_edit.toPlainText()) + self.editor.html = unicode_type(self.code_edit.toPlainText()) self.source_dirty = False @dynamic_property diff --git a/src/calibre/gui2/complete2.py b/src/calibre/gui2/complete2.py index 18d5a79883..d1f801cf84 100644 --- a/src/calibre/gui2/complete2.py +++ b/src/calibre/gui2/complete2.py @@ -22,6 +22,7 @@ from calibre.constants import isosx, get_osx_version from calibre.utils.icu import sort_key, primary_startswith, primary_contains from calibre.gui2.widgets import EnComboBox, LineEditECM from calibre.utils.config import tweaks +from polyglot.builtins import unicode_type def containsq(x, prefix): @@ -37,7 +38,7 @@ class CompleteModel(QAbstractListModel): # {{{ self.current_prefix = '' def set_items(self, items): - items = [unicode(x.strip()) for x in items] + items = [unicode_type(x.strip()) for x in items] items = [x for x in items if x] items = tuple(sorted(items, key=self.sort_func)) self.beginResetModel() @@ -111,7 +112,7 @@ class Completer(QListView): # {{{ return self.hide() text = self.model().data(index, Qt.DisplayRole) - self.item_selected.emit(unicode(text)) + self.item_selected.emit(unicode_type(text)) def set_items(self, items): self.model().set_items(items) @@ -389,7 +390,7 @@ class LineEdit(QLineEdit, LineEditECM): def update_completions(self): ' Update the list of completions ' self.original_cursor_pos = cpos = self.cursorPosition() - text = unicode(self.text()) + text = unicode_type(self.text()) prefix = text[:cpos] complete_prefix = prefix.lstrip() if self.sep: @@ -406,7 +407,7 @@ class LineEdit(QLineEdit, LineEditECM): cursor_pos = self.cursorPosition() self.original_cursor_pos = None # Split text - curtext = unicode(self.text()) + curtext = unicode_type(self.text()) before_text = curtext[:cursor_pos] after_text = curtext[cursor_pos:].rstrip() # Remove the completion prefix from the before text @@ -426,7 +427,7 @@ class LineEdit(QLineEdit, LineEditECM): return before_text + completed_text, after_text def completion_selected(self, text): - before_text, after_text = self.get_completed_text(unicode(text)) + before_text, after_text = self.get_completed_text(unicode_type(text)) self.setText(before_text + after_text) self.setCursorPosition(len(before_text)) self.item_selected.emit(text) @@ -466,7 +467,7 @@ class EditWithComplete(EnComboBox): self.lineEdit().set_add_separator(what) def show_initial_value(self, what): - what = unicode(what) if what else u'' + what = unicode_type(what) if what else u'' self.setText(what) self.lineEdit().selectAll() @@ -490,7 +491,7 @@ class EditWithComplete(EnComboBox): # }}} def text(self): - return unicode(self.lineEdit().text()) + return unicode_type(self.lineEdit().text()) def selectAll(self): self.lineEdit().selectAll() diff --git a/src/calibre/gui2/convert/__init__.py b/src/calibre/gui2/convert/__init__.py index e7f5aec12e..b347e648bd 100644 --- a/src/calibre/gui2/convert/__init__.py +++ b/src/calibre/gui2/convert/__init__.py @@ -19,6 +19,7 @@ from calibre.ebooks.conversion.config import ( from calibre import prepare_string_for_xml from calibre.customize.ui import plugin_for_input_format from calibre.gui2.font_family_chooser import FontFamilyChooser +from polyglot.builtins import unicode_type def config_widget_for_input_plugin(plugin): @@ -100,7 +101,7 @@ class Widget(QWidget): buddy = g.buddy() if buddy is not None and hasattr(buddy, '_help'): g._help = buddy._help - htext = unicode(buddy.toolTip()).strip() + htext = unicode_type(buddy.toolTip()).strip() g.setToolTip(htext) g.setWhatsThis(htext) g.__class__.enterEvent = lambda obj, event: self.set_help(getattr(obj, '_help', obj.toolTip())) @@ -149,18 +150,18 @@ class Widget(QWidget): return g.value() elif isinstance(g, (QLineEdit, QTextEdit, QPlainTextEdit)): func = getattr(g, 'toPlainText', getattr(g, 'text', None))() - ans = unicode(func) + ans = unicode_type(func) if self.STRIP_TEXT_FIELDS: ans = ans.strip() if not ans: ans = None return ans elif isinstance(g, QFontComboBox): - return unicode(QFontInfo(g.currentFont()).family()) + return unicode_type(QFontInfo(g.currentFont()).family()) elif isinstance(g, FontFamilyChooser): return g.font_family elif isinstance(g, EncodingComboBox): - ans = unicode(g.currentText()).strip() + ans = unicode_type(g.currentText()).strip() try: codecs.lookup(ans) except: @@ -169,7 +170,7 @@ class Widget(QWidget): ans = None return ans elif isinstance(g, QComboBox): - return unicode(g.currentText()) + return unicode_type(g.currentText()) elif isinstance(g, QCheckBox): return bool(g.isChecked()) elif isinstance(g, XPathEdit): @@ -245,7 +246,7 @@ class Widget(QWidget): g.edit.setText(val if val else '') else: raise Exception('Can\'t set value %s in %s'%(repr(val), - unicode(g.objectName()))) + unicode_type(g.objectName()))) self.post_set_value(g, val) def set_help(self, msg): diff --git a/src/calibre/gui2/convert/bulk.py b/src/calibre/gui2/convert/bulk.py index 5ec8e2f8d4..57fe421a17 100644 --- a/src/calibre/gui2/convert/bulk.py +++ b/src/calibre/gui2/convert/bulk.py @@ -20,6 +20,7 @@ from calibre.ebooks.conversion.plumber import Plumber from calibre.ebooks.conversion.config import sort_formats_by_preference, get_output_formats from calibre.utils.config import prefs from calibre.utils.logging import Log +from polyglot.builtins import unicode_type class BulkConfig(Config): @@ -124,7 +125,7 @@ class BulkConfig(Config): preferred_output_format and preferred_output_format \ in output_formats else sort_formats_by_preference(output_formats, [prefs['output_format']])[0] - self.output_formats.addItems(list(map(unicode, [x.upper() for x in + self.output_formats.addItems(list(map(unicode_type, [x.upper() for x in output_formats]))) self.output_formats.setCurrentIndex(output_formats.index(preferred_output_format)) diff --git a/src/calibre/gui2/convert/debug.py b/src/calibre/gui2/convert/debug.py index ab1eae308c..16d4db42c9 100644 --- a/src/calibre/gui2/convert/debug.py +++ b/src/calibre/gui2/convert/debug.py @@ -12,6 +12,7 @@ from calibre.gui2.convert.debug_ui import Ui_Form from calibre.gui2.convert import Widget from calibre.gui2 import error_dialog, choose_dir from calibre.ebooks.conversion.config import OPTIONS +from polyglot.builtins import unicode_type class DebugWidget(Widget, Ui_Form): @@ -38,7 +39,7 @@ class DebugWidget(Widget, Ui_Form): def pre_commit_check(self): try: - x = unicode(self.opt_debug_pipeline.text()).strip() + x = unicode_type(self.opt_debug_pipeline.text()).strip() if not x: return True x = os.path.abspath(x) @@ -52,7 +53,7 @@ class DebugWidget(Widget, Ui_Form): import traceback det_msg = traceback.format_exc() error_dialog(self, _('Invalid debug directory'), - _('Failed to create debug directory')+': '+ unicode(self.opt_debug_pipeline.text()), + _('Failed to create debug directory')+': '+ unicode_type(self.opt_debug_pipeline.text()), det_msg=det_msg, show=True) return False return True diff --git a/src/calibre/gui2/convert/font_key.py b/src/calibre/gui2/convert/font_key.py index c061310dfb..e7a237d4df 100644 --- a/src/calibre/gui2/convert/font_key.py +++ b/src/calibre/gui2/convert/font_key.py @@ -10,6 +10,7 @@ from PyQt5.Qt import QDialog from calibre.gui2.convert.font_key_ui import Ui_Dialog from calibre.utils.localization import localize_user_manual_link +from polyglot.builtins import unicode_type class FontKeyChooser(QDialog, Ui_Dialog): @@ -66,7 +67,7 @@ class FontKeyChooser(QDialog, Ui_Dialog): @property def fsizes(self): - key = unicode(self.font_size_key.text()).strip() + key = unicode_type(self.font_size_key.text()).strip() return [float(x.strip()) for x in key.split(',' if ',' in key else ' ') if x.strip()] @property diff --git a/src/calibre/gui2/convert/heuristics.py b/src/calibre/gui2/convert/heuristics.py index 9cab0fb452..0ff2da151d 100644 --- a/src/calibre/gui2/convert/heuristics.py +++ b/src/calibre/gui2/convert/heuristics.py @@ -11,6 +11,7 @@ from calibre.gui2.convert.heuristics_ui import Ui_Form from calibre.gui2.convert import Widget from calibre.utils.localization import localize_user_manual_link from calibre.ebooks.conversion.config import OPTIONS +from polyglot.builtins import unicode_type class HeuristicsWidget(Widget, Ui_Form): @@ -73,7 +74,7 @@ class HeuristicsWidget(Widget, Ui_Form): return True def load_histories(self): - val = unicode(self.opt_replace_scene_breaks.currentText()) + val = unicode_type(self.opt_replace_scene_breaks.currentText()) self.opt_replace_scene_breaks.clear() self.opt_replace_scene_breaks.lineEdit().setText('') @@ -90,7 +91,7 @@ class HeuristicsWidget(Widget, Ui_Form): def save_histories(self): rssb_history = [] - history_pats = [unicode(self.opt_replace_scene_breaks.lineEdit().text())] + [unicode(self.opt_replace_scene_breaks.itemText(i)) + history_pats = [unicode_type(self.opt_replace_scene_breaks.lineEdit().text())] + [unicode_type(self.opt_replace_scene_breaks.itemText(i)) for i in xrange(self.opt_replace_scene_breaks.count())] for p in history_pats[:10]: # Ensure we don't have duplicate items. diff --git a/src/calibre/gui2/convert/look_and_feel.py b/src/calibre/gui2/convert/look_and_feel.py index 6aed2d8c5a..3ab986b828 100644 --- a/src/calibre/gui2/convert/look_and_feel.py +++ b/src/calibre/gui2/convert/look_and_feel.py @@ -13,6 +13,7 @@ from PyQt5.Qt import Qt from calibre.gui2.convert.look_and_feel_ui import Ui_Form from calibre.gui2.convert import Widget from calibre.ebooks.conversion.config import OPTIONS +from polyglot.builtins import unicode_type class LookAndFeelWidget(Widget, Ui_Form): @@ -54,7 +55,7 @@ class LookAndFeelWidget(Widget, Ui_Form): def get_value_handler(self, g): if g is self.opt_change_justification: - ans = unicode(g.itemData(g.currentIndex()) or '') + ans = unicode_type(g.itemData(g.currentIndex()) or '') return ans if g is self.opt_filter_css: ans = set() @@ -63,10 +64,10 @@ class LookAndFeelWidget(Widget, Ui_Form): if w.isChecked(): ans = ans.union(item) ans = ans.union({x.strip().lower() for x in - unicode(self.filter_css_others.text()).split(',')}) + unicode_type(self.filter_css_others.text()).split(',')}) return ','.join(ans) if ans else None if g is self.opt_font_size_mapping: - val = unicode(g.text()).strip() + val = unicode_type(g.text()).strip() val = [x.strip() for x in val.split(',' if ',' in val else ' ') if x.strip()] return ', '.join(val) or None if g is self.opt_transform_css_rules: @@ -76,7 +77,7 @@ class LookAndFeelWidget(Widget, Ui_Form): def set_value_handler(self, g, val): if g is self.opt_change_justification: for i in range(g.count()): - c = unicode(g.itemData(i) or '') + c = unicode_type(g.itemData(i) or '') if val == c: g.setCurrentIndex(i) break @@ -113,7 +114,7 @@ class LookAndFeelWidget(Widget, Ui_Form): def font_key_wizard(self): from calibre.gui2.convert.font_key import FontKeyChooser d = FontKeyChooser(self, self.opt_base_font_size.value(), - unicode(self.opt_font_size_mapping.text()).strip()) + unicode_type(self.opt_font_size_mapping.text()).strip()) if d.exec_() == d.Accepted: self.opt_font_size_mapping.setText(', '.join(['%.1f'%x for x in d.fsizes])) diff --git a/src/calibre/gui2/convert/metadata.py b/src/calibre/gui2/convert/metadata.py index 106ee86aff..2ca3d72a01 100644 --- a/src/calibre/gui2/convert/metadata.py +++ b/src/calibre/gui2/convert/metadata.py @@ -21,6 +21,7 @@ from calibre.utils.icu import sort_key from calibre.library.comments import comments_to_html from calibre.utils.config import tweaks from calibre.ebooks.conversion.config import OPTIONS +from polyglot.builtins import unicode_type def create_opf_file(db, book_id, opf_file=None): @@ -73,7 +74,7 @@ class MetadataWidget(Widget, Ui_Form): self.cover_data = data def deduce_author_sort(self, *args): - au = unicode(self.author.currentText()) + au = unicode_type(self.author.currentText()) au = re.sub(r'\s+et al\.$', '', au) authors = string_to_authors(au) self.author_sort.setText(self.db.author_sort_from_authors(authors)) @@ -155,30 +156,30 @@ class MetadataWidget(Widget, Ui_Form): self.publisher.update_items_cache([x[1] for x in all_publishers]) def get_title_and_authors(self): - title = unicode(self.title.text()).strip() + title = unicode_type(self.title.text()).strip() if not title: title = _('Unknown') - authors = unicode(self.author.text()).strip() + authors = unicode_type(self.author.text()).strip() authors = string_to_authors(authors) if authors else [_('Unknown')] return title, authors def get_metadata(self): title, authors = self.get_title_and_authors() mi = MetaInformation(title, authors) - publisher = unicode(self.publisher.text()).strip() + publisher = unicode_type(self.publisher.text()).strip() if publisher: mi.publisher = publisher - author_sort = unicode(self.author_sort.text()).strip() + author_sort = unicode_type(self.author_sort.text()).strip() if author_sort: mi.author_sort = author_sort comments = self.comment.html if comments: mi.comments = comments mi.series_index = float(self.series_index.value()) - series = unicode(self.series.currentText()).strip() + series = unicode_type(self.series.currentText()).strip() if series: mi.series = series - tags = [t.strip() for t in unicode(self.tags.text()).strip().split(',')] + tags = [t.strip() for t in unicode_type(self.tags.text()).strip().split(',')] if tags: mi.tags = tags @@ -186,7 +187,7 @@ class MetadataWidget(Widget, Ui_Form): def select_cover(self): files = choose_images(self, 'change cover dialog', - _('Choose cover for ') + unicode(self.title.text())) + _('Choose cover for ') + unicode_type(self.title.text())) if not files: return _file = files[0] diff --git a/src/calibre/gui2/convert/page_setup.py b/src/calibre/gui2/convert/page_setup.py index 4a1dd1df08..093cda0496 100644 --- a/src/calibre/gui2/convert/page_setup.py +++ b/src/calibre/gui2/convert/page_setup.py @@ -12,6 +12,7 @@ from calibre.gui2.convert.page_setup_ui import Ui_Form from calibre.gui2.convert import Widget from calibre.customize.ui import input_profiles, output_profiles from calibre.ebooks.conversion.config import OPTIONS +from polyglot.builtins import unicode_type class ProfileModel(QAbstractListModel): @@ -60,13 +61,13 @@ class PageSetupWidget(Widget, Ui_Form): x.setMouseTracking(True) x.entered[(QModelIndex)].connect(self.show_desc) self.initialize_options(get_option, get_help, db, book_id) - it = unicode(self.opt_input_profile.toolTip()) + it = unicode_type(self.opt_input_profile.toolTip()) self.opt_input_profile.setToolTip('

'+it.replace('t.','t.\n
')) - it = unicode(self.opt_output_profile.toolTip()) + it = unicode_type(self.opt_output_profile.toolTip()) self.opt_output_profile.setToolTip('

'+it.replace('t.','ce.\n
')) def show_desc(self, index): - desc = unicode(index.model().data(index, Qt.StatusTipRole) or '') + desc = unicode_type(index.model().data(index, Qt.StatusTipRole) or '') self.profile_description.setText(desc) def connect_gui_obj_handler(self, g, slot): diff --git a/src/calibre/gui2/convert/regex_builder.py b/src/calibre/gui2/convert/regex_builder.py index 0ef3a2fa2a..ca60871df1 100644 --- a/src/calibre/gui2/convert/regex_builder.py +++ b/src/calibre/gui2/convert/regex_builder.py @@ -17,6 +17,7 @@ from calibre.constants import iswindows from calibre.utils.ipc.simple_worker import fork_job, WorkerError from calibre.ebooks.conversion.search_replace import compile_regular_expression from calibre.ptempfile import TemporaryFile +from polyglot.builtins import unicode_type class RegexBuilder(QDialog, Ui_RegexBuilder): @@ -58,7 +59,7 @@ class RegexBuilder(QDialog, Ui_RegexBuilder): gprefs['regex_builder_geometry'] = geom def regex_valid(self): - regex = unicode(self.regex.text()) + regex = unicode_type(self.regex.text()) if regex: try: compile_regular_expression(regex) @@ -81,8 +82,8 @@ class RegexBuilder(QDialog, Ui_RegexBuilder): selections = [] self.match_locs = [] if self.regex_valid(): - text = unicode(self.preview.toPlainText()) - regex = unicode(self.regex.text()) + text = unicode_type(self.preview.toPlainText()) + regex = unicode_type(self.regex.text()) cursor = QTextCursor(self.preview.document()) extsel = QTextEdit.ExtraSelection() extsel.cursor = cursor @@ -196,12 +197,12 @@ class RegexBuilder(QDialog, Ui_RegexBuilder): self.open_book(files[0]) def doc(self): - return unicode(self.preview.toPlainText()) + return unicode_type(self.preview.toPlainText()) class RegexEdit(QWidget, Ui_Edit): - doc_update = pyqtSignal(unicode) + doc_update = pyqtSignal(unicode_type) def __init__(self, parent=None): QWidget.__init__(self, parent) @@ -233,7 +234,7 @@ class RegexEdit(QWidget, Ui_Edit): def setObjectName(self, *args): QWidget.setObjectName(self, *args) if hasattr(self, 'edit'): - self.edit.initialize('regex_edit_'+unicode(self.objectName())) + self.edit.initialize('regex_edit_'+unicode_type(self.objectName())) def set_msg(self, msg): self.msg.setText(msg) @@ -255,7 +256,7 @@ class RegexEdit(QWidget, Ui_Edit): @property def text(self): - return unicode(self.edit.text()) + return unicode_type(self.edit.text()) @property def regex(self): diff --git a/src/calibre/gui2/convert/search_and_replace.py b/src/calibre/gui2/convert/search_and_replace.py index 5ef34d1224..71e9379317 100644 --- a/src/calibre/gui2/convert/search_and_replace.py +++ b/src/calibre/gui2/convert/search_and_replace.py @@ -16,6 +16,7 @@ from calibre import as_unicode from calibre.utils.localization import localize_user_manual_link from calibre.ebooks.conversion.search_replace import compile_regular_expression from calibre.ebooks.conversion.config import OPTIONS +from polyglot.builtins import unicode_type class SearchAndReplaceWidget(Widget, Ui_Form): @@ -189,7 +190,7 @@ class SearchAndReplaceWidget(Widget, Ui_Form): edit_search = self.sr_search.regex if edit_search: - edit_replace = unicode(self.sr_replace.text()) + edit_replace = unicode_type(self.sr_replace.text()) found = False for search, replace in definitions: if search == edit_search and replace == edit_replace: @@ -230,7 +231,7 @@ class SearchAndReplaceWidget(Widget, Ui_Form): for row in xrange(0, self.search_replace.rowCount()): colItems = [] for col in xrange(0, self.search_replace.columnCount()): - colItems.append(unicode(self.search_replace.item(row, col).text())) + colItems.append(unicode_type(self.search_replace.item(row, col).text())) ans.append(colItems) return ans diff --git a/src/calibre/gui2/convert/single.py b/src/calibre/gui2/convert/single.py index e00a18df34..e8f1ca11b3 100644 --- a/src/calibre/gui2/convert/single.py +++ b/src/calibre/gui2/convert/single.py @@ -28,6 +28,7 @@ from calibre.ebooks.conversion.plumber import create_dummy_plumber from calibre.ebooks.conversion.config import delete_specifics from calibre.customize.conversion import OptionRecommendation from calibre.utils.config import prefs +from polyglot.builtins import unicode_type class GroupModel(QAbstractListModel): @@ -107,11 +108,11 @@ class Config(QDialog, Ui_Dialog): @property def input_format(self): - return unicode(self.input_formats.currentText()).lower() + return unicode_type(self.input_formats.currentText()).lower() @property def output_format(self): - return unicode(self.output_formats.currentText()).lower() + return unicode_type(self.output_formats.currentText()).lower() @property def manually_fine_tune_toc(self): @@ -131,7 +132,7 @@ class Config(QDialog, Ui_Dialog): self.plumber.get_option_help, self.db, self.book_id) self.mw = widget_factory(MetadataWidget) - self.setWindowTitle(_('Convert')+ ' ' + unicode(self.mw.title.text())) + self.setWindowTitle(_('Convert')+ ' ' + unicode_type(self.mw.title.text())) lf = widget_factory(LookAndFeelWidget) hw = widget_factory(HeuristicsWidget) sr = widget_factory(SearchAndReplaceWidget) @@ -186,9 +187,9 @@ class Config(QDialog, Ui_Dialog): preferred_output_format in output_formats else \ sort_formats_by_preference(output_formats, [prefs['output_format']])[0] - self.input_formats.addItems(list(map(unicode, [x.upper() for x in + self.input_formats.addItems(list(map(unicode_type, [x.upper() for x in input_formats]))) - self.output_formats.addItems(list(map(unicode, [x.upper() for x in + self.output_formats.addItems(list(map(unicode_type, [x.upper() for x in output_formats]))) self.input_formats.setCurrentIndex(input_formats.index(input_format)) self.output_formats.setCurrentIndex(output_formats.index(preferred_output_format)) diff --git a/src/calibre/gui2/convert/txt_input.py b/src/calibre/gui2/convert/txt_input.py index c7b79b8191..fff09f18fe 100644 --- a/src/calibre/gui2/convert/txt_input.py +++ b/src/calibre/gui2/convert/txt_input.py @@ -10,6 +10,7 @@ from calibre.gui2.convert.txt_input_ui import Ui_Form from calibre.gui2.convert import Widget from calibre.ebooks.conversion.plugins.txt_input import MD_EXTENSIONS from calibre.ebooks.conversion.config import OPTIONS +from polyglot.builtins import unicode_type class PluginWidget(Widget, Ui_Form): @@ -48,7 +49,7 @@ class PluginWidget(Widget, Ui_Form): def get_value_handler(self, g): if g is not self.opt_markdown_extensions: return Widget.get_value_handler(self, g) - return ', '.join(unicode(i.data(Qt.UserRole) or '') for i in self.md_map.itervalues() if i.checkState()) + return ', '.join(unicode_type(i.data(Qt.UserRole) or '') for i in self.md_map.itervalues() if i.checkState()) def connect_gui_obj_handler(self, g, f): if g is not self.opt_markdown_extensions: diff --git a/src/calibre/gui2/convert/xpath_wizard.py b/src/calibre/gui2/convert/xpath_wizard.py index 6014f80cf8..97f80e1c81 100644 --- a/src/calibre/gui2/convert/xpath_wizard.py +++ b/src/calibre/gui2/convert/xpath_wizard.py @@ -12,6 +12,7 @@ from PyQt5.Qt import QDialog, QWidget, Qt, QDialogButtonBox, QVBoxLayout from calibre.gui2.convert.xpath_wizard_ui import Ui_Form from calibre.gui2.convert.xexp_edit_ui import Ui_Form as Ui_Edit from calibre.utils.localization import localize_user_manual_link +from polyglot.builtins import unicode_type class WizardWidget(QWidget, Ui_Form): @@ -27,10 +28,10 @@ class WizardWidget(QWidget, Ui_Form): @property def xpath(self): - tag = unicode(self.tag.currentText()).strip() + tag = unicode_type(self.tag.currentText()).strip() if tag != '*': tag = 'h:'+tag - attr, val = map(unicode, (self.attribute.text(), self.value.text())) + attr, val = map(unicode_type, (self.attribute.text(), self.value.text())) attr, val = attr.strip(), val.strip() q = '' if attr: @@ -81,14 +82,14 @@ class XPathEdit(QWidget, Ui_Edit): def setObjectName(self, *args): QWidget.setObjectName(self, *args) if hasattr(self, 'edit'): - self.edit.initialize('xpath_edit_'+unicode(self.objectName())) + self.edit.initialize('xpath_edit_'+unicode_type(self.objectName())) def set_msg(self, msg): self.msg.setText(msg) @property def text(self): - return unicode(self.edit.text()) + return unicode_type(self.edit.text()) @property def xpath(self): diff --git a/src/calibre/gui2/css_transform_rules.py b/src/calibre/gui2/css_transform_rules.py index e352bce09a..361552e1e5 100644 --- a/src/calibre/gui2/css_transform_rules.py +++ b/src/calibre/gui2/css_transform_rules.py @@ -19,6 +19,7 @@ from calibre.gui2.tag_mapper import ( from calibre.gui2.widgets2 import Dialog from calibre.utils.config import JSONConfig from calibre.utils.localization import localize_user_manual_link +from polyglot.builtins import unicode_type class RuleEdit(QWidget): # {{{ @@ -133,14 +134,14 @@ class RuleEdit(QWidget): # {{{ def rule(self, rule): def sc(name): c = getattr(self, name) - idx = c.findData(unicode(rule.get(name, ''))) + idx = c.findData(unicode_type(rule.get(name, ''))) if idx < 0: idx = 0 c.setCurrentIndex(idx) sc('action'), sc('match_type') - self.property.setText(unicode(rule.get('property', '')).strip()) - self.query.setText(unicode(rule.get('query', '')).strip()) - self.action_data.setText(unicode(rule.get('action_data', '')).strip()) + self.property.setText(unicode_type(rule.get('property', '')).strip()) + self.query.setText(unicode_type(rule.get('query', '')).strip()) + self.action_data.setText(unicode_type(rule.get('action_data', '')).strip()) self.update_state() def validate(self): diff --git a/src/calibre/gui2/custom_column_widgets.py b/src/calibre/gui2/custom_column_widgets.py index e6bbdbb666..1c73867eae 100644 --- a/src/calibre/gui2/custom_column_widgets.py +++ b/src/calibre/gui2/custom_column_widgets.py @@ -23,6 +23,7 @@ from calibre.utils.icu import sort_key from calibre.library.comments import comments_to_html from calibre.gui2.library.delegates import ClearingDoubleSpinBox, ClearingSpinBox from calibre.gui2.widgets2 import RatingEditor +from polyglot.builtins import unicode_type def safe_disconnect(signal): @@ -371,7 +372,7 @@ class Comments(Base): self._tb.wyswyg_dirtied() def getter(self): - val = unicode(self._tb.html).strip() + val = unicode_type(self._tb.html).strip() if not val: val = None return val @@ -497,12 +498,12 @@ class Text(Base): def getter(self): if self.col_metadata['is_multiple']: - val = unicode(self.widgets[1].text()).strip() + val = unicode_type(self.widgets[1].text()).strip() ans = [x.strip() for x in val.split(self.sep['ui_to_list']) if x.strip()] if not ans: ans = None return ans - val = unicode(self.widgets[1].currentText()).strip() + val = unicode_type(self.widgets[1].currentText()).strip() if not val: val = None return val @@ -571,7 +572,7 @@ class Series(Base): self.initial_val, self.initial_index = self.current_val def getter(self): - n = unicode(self.name_widget.currentText()).strip() + n = unicode_type(self.name_widget.currentText()).strip() i = self.idx_widget.value() return n, i @@ -643,7 +644,7 @@ class Enumeration(Base): self.widgets[1].setCurrentIndex(self.widgets[1].findText(val)) def getter(self): - return unicode(self.widgets[1].currentText()) + return unicode_type(self.widgets[1].currentText()) def normalize_db_val(self, val): if val is None: @@ -1164,7 +1165,7 @@ class BulkSeries(BulkBase): self.a_c_checkbox.setChecked(False) def getter(self): - n = unicode(self.main_widget.currentText()).strip() + n = unicode_type(self.main_widget.currentText()).strip() autonumber = self.idx_widget.checkState() force = self.force_number.checkState() start = self.series_start_number.value() @@ -1234,7 +1235,7 @@ class BulkEnumeration(BulkBase, Enumeration): self.main_widget.blockSignals(False) def getter(self): - return unicode(self.main_widget.currentText()) + return unicode_type(self.main_widget.currentText()) def setter(self, val): if val is None: @@ -1355,10 +1356,10 @@ class BulkText(BulkBase): if self.col_metadata['is_multiple']: if not self.col_metadata['display'].get('is_names', False): return self.removing_widget.checkbox.isChecked(), \ - unicode(self.adding_widget.text()), \ - unicode(self.removing_widget.tags_box.text()) - return unicode(self.adding_widget.text()) - val = unicode(self.main_widget.currentText()).strip() + unicode_type(self.adding_widget.text()), \ + unicode_type(self.removing_widget.tags_box.text()) + return unicode_type(self.adding_widget.text()) + val = unicode_type(self.main_widget.currentText()).strip() if not val: val = None return val diff --git a/src/calibre/gui2/dbus_export/gtk.py b/src/calibre/gui2/dbus_export/gtk.py index c1bf4bb758..2bb1af75b6 100644 --- a/src/calibre/gui2/dbus_export/gtk.py +++ b/src/calibre/gui2/dbus_export/gtk.py @@ -15,6 +15,8 @@ from pprint import pformat from gi.repository import Gtk, Gdk, GdkX11 # noqa +from polyglot.builtins import unicode_type + UI_INFO = """ @@ -200,7 +202,7 @@ class MenuExampleWindow(Gtk.ApplicationWindow): def convert(v): if isinstance(v, basestring): - return unicode(v) + return unicode_type(v) if isinstance(v, dbus.Struct): return tuple(convert(val) for val in v) if isinstance(v, list): @@ -275,7 +277,7 @@ class MyApplication(Gtk.Application): print ('Subscription group:', item[0]) print ('Menu number:', item[1]) for menu_item in item[2]: - menu_item = {unicode(k):convert(v) for k, v in menu_item.iteritems()} + menu_item = {unicode_type(k):convert(v) for k, v in menu_item.iteritems()} if ':submenu' in menu_item: groups.add(menu_item[':submenu'][0]) if ':section' in menu_item: diff --git a/src/calibre/gui2/dbus_export/menu2.py b/src/calibre/gui2/dbus_export/menu2.py index a3df7ab9dc..08ee421557 100644 --- a/src/calibre/gui2/dbus_export/menu2.py +++ b/src/calibre/gui2/dbus_export/menu2.py @@ -18,11 +18,12 @@ from PyQt5.Qt import QObject, pyqtSignal, QTimer, Qt from calibre.utils.dbus_service import Object, method as dbus_method, signal as dbus_signal from calibre.gui2.dbus_export.utils import set_X_window_properties +from polyglot.builtins import unicode_type def add_window_properties_for_menu(widget, object_path, bus): - op = unicode(object_path) - set_X_window_properties(widget.effectiveWinId(), _UNITY_OBJECT_PATH=op, _GTK_UNIQUE_BUS_NAME=unicode(bus.get_unique_name()), _GTK_MENUBAR_OBJECT_PATH=op) + op = unicode_type(object_path) + set_X_window_properties(widget.effectiveWinId(), _UNITY_OBJECT_PATH=op, _GTK_UNIQUE_BUS_NAME=unicode_type(bus.get_unique_name()), _GTK_MENUBAR_OBJECT_PATH=op) class DBusMenu(QObject): @@ -61,5 +62,3 @@ class DBusMenuAPI(Object): self.revision = 0 dbus_method, dbus_signal - - diff --git a/src/calibre/gui2/dbus_export/utils.py b/src/calibre/gui2/dbus_export/utils.py index 625b870eeb..3a47eda50f 100644 --- a/src/calibre/gui2/dbus_export/utils.py +++ b/src/calibre/gui2/dbus_export/utils.py @@ -12,6 +12,8 @@ import dbus from PyQt5.Qt import QSize, QImage, Qt, QKeySequence, QBuffer, QByteArray +from polyglot.builtins import unicode_type + def log(*args, **kw): kw['file'] = sys.stderr @@ -145,7 +147,7 @@ def set_X_window_properties(win_id, **properties): for name, val in properties.iteritems(): atom = atoms[name].reply().atom type_atom = xcb.xproto.Atom.STRING - if isinstance(val, unicode): + if isinstance(val, unicode_type): if utf8_string_atom is None: utf8_string_atom = conn.core.InternAtom(True, len(b'UTF8_STRING'), b'UTF8_STRING').reply().atom type_atom = utf8_string_atom diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index e3417bb778..f4b54a08ba 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -34,6 +34,7 @@ from calibre.utils.config import tweaks, device_prefs from calibre.utils.img import scale_image from calibre.library.save_to_disk import find_plugboard from calibre.ptempfile import PersistentTemporaryFile, force_unicode as filename_to_unicode +from polyglot.builtins import unicode_type # }}} @@ -105,7 +106,7 @@ class DeviceJob(BaseJob): # {{{ call_job_done = True self._aborted = True self.failed = True - self._details = unicode(err) + self._details = unicode_type(err) self.exception = err if call_job_done: self.job_done() @@ -561,7 +562,7 @@ class DeviceManager(Thread): # {{{ self.connected_device.set_plugboards(plugboards, find_plugboard) if metadata and files and len(metadata) == len(files): for f, mi in zip(files, metadata): - if isinstance(f, unicode): + if isinstance(f, unicode_type): ext = f.rpartition('.')[-1].lower() cpb = find_plugboard( device_name_for_plugboards(self.connected_device), @@ -928,7 +929,7 @@ class DeviceMixin(object): # {{{ d.show() def auto_convert_question(self, msg, autos): - autos = u'\n'.join(map(unicode, map(force_unicode, autos))) + autos = u'\n'.join(map(unicode_type, map(force_unicode, autos))) return self.ask_a_yes_no_question( _('No suitable formats'), msg, ans_when_user_unavailable=True, @@ -1026,7 +1027,7 @@ class DeviceMixin(object): # {{{ try: if 'Could not read 32 bytes on the control bus.' in \ - unicode(job.details): + unicode_type(job.details): error_dialog(self, _('Error talking to device'), _('There was a temporary error talking to the ' 'device. Please unplug and reconnect the device ' @@ -1347,7 +1348,7 @@ class DeviceMixin(object): # {{{ names = [] for mi in metadata: prefix = ascii_filename(mi.title) - if not isinstance(prefix, unicode): + if not isinstance(prefix, unicode_type): prefix = prefix.decode(preferred_encoding, 'replace') prefix = ascii_filename(prefix) names.append('%s_%d%s'%(prefix, id, @@ -1428,7 +1429,7 @@ class DeviceMixin(object): # {{{ names = [] for mi in metadata: prefix = ascii_filename(mi.title) - if not isinstance(prefix, unicode): + if not isinstance(prefix, unicode_type): prefix = prefix.decode(preferred_encoding, 'replace') prefix = ascii_filename(prefix) names.append('%s_%d%s'%(prefix, id, @@ -1507,7 +1508,7 @@ class DeviceMixin(object): # {{{ if not a: a = _('Unknown') prefix = ascii_filename(t+' - '+a) - if not isinstance(prefix, unicode): + if not isinstance(prefix, unicode_type): prefix = prefix.decode(preferred_encoding, 'replace') prefix = ascii_filename(prefix) names.append('%s_%d%s'%(prefix, id, os.path.splitext(f)[1])) @@ -1639,7 +1640,7 @@ class DeviceMixin(object): # {{{ d.exec_() elif isinstance(job.exception, WrongDestinationError): error_dialog(self, _('Incorrect destination'), - unicode(job.exception), show=True) + unicode_type(job.exception), show=True) else: self.device_job_exception(job) return diff --git a/src/calibre/gui2/device_drivers/configwidget.py b/src/calibre/gui2/device_drivers/configwidget.py index 6db50ccfb3..38c2b55e1e 100644 --- a/src/calibre/gui2/device_drivers/configwidget.py +++ b/src/calibre/gui2/device_drivers/configwidget.py @@ -13,6 +13,7 @@ from calibre.gui2 import error_dialog, question_dialog from calibre.gui2.device_drivers.configwidget_ui import Ui_ConfigWidget from calibre.utils.formatter import validation_formatter from calibre.ebooks import BOOK_EXTENSIONS +from polyglot.builtins import unicode_type class ConfigWidget(QWidget, Ui_ConfigWidget): @@ -135,7 +136,7 @@ class ConfigWidget(QWidget, Ui_ConfigWidget): self.columns.setCurrentRow(idx+1) def format_map(self): - formats = [unicode(self.columns.item(i).data(Qt.UserRole) or '') for i in range(self.columns.count()) if self.columns.item(i).checkState()==Qt.Checked] + formats = [unicode_type(self.columns.item(i).data(Qt.UserRole) or '') for i in range(self.columns.count()) if self.columns.item(i).checkState()==Qt.Checked] return formats def use_subdirs(self): @@ -160,15 +161,13 @@ class ConfigWidget(QWidget, Ui_ConfigWidget): (', '.join(fmts)), self.device_name)): return False - tmpl = unicode(self.opt_save_template.text()) + tmpl = unicode_type(self.opt_save_template.text()) try: validation_formatter.validate(tmpl) return True except Exception as err: error_dialog(self, _('Invalid template'), '

'+_('The template %s is invalid:')%tmpl + - '
'+unicode(err), show=True) + '
'+unicode_type(err), show=True) return False - - diff --git a/src/calibre/gui2/device_drivers/mtp_config.py b/src/calibre/gui2/device_drivers/mtp_config.py index ef0522b252..6aa1bf38e2 100644 --- a/src/calibre/gui2/device_drivers/mtp_config.py +++ b/src/calibre/gui2/device_drivers/mtp_config.py @@ -20,6 +20,7 @@ from calibre.gui2 import error_dialog from calibre.gui2.dialogs.template_dialog import TemplateDialog from calibre.utils.date import parse_date from calibre.gui2.device_drivers.mtp_folder_browser import Browser, IgnoredFolders +from polyglot.builtins import unicode_type class FormatsConfig(QWidget): # {{{ @@ -50,7 +51,7 @@ class FormatsConfig(QWidget): # {{{ @property def format_map(self): - return [unicode(self.f.item(i).data(Qt.UserRole) or '') for i in + return [unicode_type(self.f.item(i).data(Qt.UserRole) or '') for i in xrange(self.f.count()) if self.f.item(i).checkState()==Qt.Checked] def validate(self): @@ -97,7 +98,7 @@ class TemplateConfig(QWidget): # {{{ @property def template(self): - return unicode(self.t.text()).strip() + return unicode_type(self.t.text()).strip() def edit_template(self): t = TemplateDialog(self, self.template) @@ -114,7 +115,7 @@ class TemplateConfig(QWidget): # {{{ except Exception as err: error_dialog(self, _('Invalid template'), '

'+_('The template %s is invalid:')%tmpl + - '
'+unicode(err), show=True) + '
'+unicode_type(err), show=True) return False # }}} @@ -155,7 +156,7 @@ class SendToConfig(QWidget): # {{{ @property def value(self): - ans = [x.strip() for x in unicode(self.t.text()).strip().split(',')] + ans = [x.strip() for x in unicode_type(self.t.text()).strip().split(',')] return [x for x in ans if x] # }}} @@ -187,13 +188,13 @@ class IgnoredDevices(QWidget): # {{{ @property def blacklist(self): - return [unicode(self.f.item(i).data(Qt.UserRole) or '') for i in + return [unicode_type(self.f.item(i).data(Qt.UserRole) or '') for i in xrange(self.f.count()) if self.f.item(i).checkState()==Qt.Checked] def ignore_device(self, snum): for i in xrange(self.f.count()): i = self.f.item(i) - c = unicode(i.data(Qt.UserRole) or '') + c = unicode_type(i.data(Qt.UserRole) or '') if c == snum: i.setCheckState(Qt.Checked) break @@ -264,10 +265,10 @@ class Rule(QWidget): @property def rule(self): - folder = unicode(self.folder.text()).strip() + folder = unicode_type(self.folder.text()).strip() if folder: return ( - unicode(self.fmt.itemData(self.fmt.currentIndex()) or ''), + unicode_type(self.fmt.itemData(self.fmt.currentIndex()) or ''), folder ) return None diff --git a/src/calibre/gui2/device_drivers/mtp_folder_browser.py b/src/calibre/gui2/device_drivers/mtp_folder_browser.py index b054977e82..eeb42e5111 100644 --- a/src/calibre/gui2/device_drivers/mtp_folder_browser.py +++ b/src/calibre/gui2/device_drivers/mtp_folder_browser.py @@ -13,6 +13,7 @@ from PyQt5.Qt import (QTabWidget, QTreeWidget, QTreeWidgetItem, Qt, QDialog, QDialogButtonBox, QVBoxLayout, QSize, pyqtSignal, QIcon, QLabel) from calibre.gui2 import file_icon_provider +from polyglot.builtins import unicode_type def browser_item(f, parent): @@ -200,11 +201,11 @@ class IgnoredFolders(QDialog): for node in self.iterchildren(w.invisibleRootItem()): if node.checkState(0) == Qt.Checked: continue - path = unicode(node.data(0, Qt.UserRole) or '') + path = unicode_type(node.data(0, Qt.UserRole) or '') parent = path.rpartition('/')[0] if '/' not in path or icu_lower(parent) not in folders: folders.add(icu_lower(path)) - ans[unicode(w.storage.storage_id)] = list(folders) + ans[unicode_type(w.storage.storage_id)] = list(folders) return ans diff --git a/src/calibre/gui2/device_drivers/tabbed_device_config.py b/src/calibre/gui2/device_drivers/tabbed_device_config.py index ac6fc65ceb..be741441f2 100644 --- a/src/calibre/gui2/device_drivers/tabbed_device_config.py +++ b/src/calibre/gui2/device_drivers/tabbed_device_config.py @@ -17,6 +17,7 @@ from PyQt5.Qt import ( from calibre.ebooks import BOOK_EXTENSIONS from calibre.gui2.device_drivers.mtp_config import (FormatsConfig, TemplateConfig) from calibre.devices.usbms.driver import debug_print +from polyglot.builtins import unicode_type def wrap_msg(msg): @@ -340,11 +341,11 @@ class ExtraCustomization(DeviceConfigTab): # {{{ if hasattr(self.opt_extra_customization[i], 'isChecked'): ec.append(self.opt_extra_customization[i].isChecked()) elif hasattr(self.opt_extra_customization[i], 'currentText'): - ec.append(unicode(self.opt_extra_customization[i].currentText()).strip()) + ec.append(unicode_type(self.opt_extra_customization[i].currentText()).strip()) else: - ec.append(unicode(self.opt_extra_customization[i].text()).strip()) + ec.append(unicode_type(self.opt_extra_customization[i].text()).strip()) else: - ec = unicode(self.opt_extra_customization.text()).strip() + ec = unicode_type(self.opt_extra_customization.text()).strip() if not ec: ec = None diff --git a/src/calibre/gui2/dialogs/add_empty_book.py b/src/calibre/gui2/dialogs/add_empty_book.py index dbf66191e1..66fa354f0f 100644 --- a/src/calibre/gui2/dialogs/add_empty_book.py +++ b/src/calibre/gui2/dialogs/add_empty_book.py @@ -11,6 +11,7 @@ from calibre.ebooks.metadata import string_to_authors from calibre.gui2.complete2 import EditWithComplete from calibre.utils.config import tweaks from calibre.gui2 import gprefs +from polyglot.builtins import unicode_type class AddEmptyBookDialog(QDialog): @@ -161,11 +162,11 @@ class AddEmptyBookDialog(QDialog): @property def selected_authors(self): - return string_to_authors(unicode(self.authors_combo.text())) + return string_to_authors(unicode_type(self.authors_combo.text())) @property def selected_series(self): - return unicode(self.series_combo.text()) + return unicode_type(self.series_combo.text()) @property def selected_title(self): diff --git a/src/calibre/gui2/dialogs/add_from_isbn.py b/src/calibre/gui2/dialogs/add_from_isbn.py index d65ca7754c..f8712dc49c 100644 --- a/src/calibre/gui2/dialogs/add_from_isbn.py +++ b/src/calibre/gui2/dialogs/add_from_isbn.py @@ -15,6 +15,7 @@ from PyQt5.Qt import ( from calibre.ebooks.metadata import check_isbn from calibre.constants import iswindows from calibre.gui2 import gprefs, question_dialog, error_dialog +from polyglot.builtins import unicode_type class AddFromISBN(QDialog): @@ -25,7 +26,7 @@ class AddFromISBN(QDialog): path = r'C:\Users\kovid\e-books\some_book.epub' if iswindows else \ '/Users/kovid/e-books/some_book.epub' - self.label.setText(unicode(self.label.text())%path) + self.label.setText(unicode_type(self.label.text())%path) self.isbns = [] self.books = [] @@ -70,19 +71,19 @@ class AddFromISBN(QDialog): def paste(self, *args): app = QApplication.instance() c = app.clipboard() - txt = unicode(c.text()).strip() + txt = unicode_type(c.text()).strip() if txt: - old = unicode(self.isbn_box.toPlainText()).strip() + old = unicode_type(self.isbn_box.toPlainText()).strip() new = old + '\n' + txt self.isbn_box.setPlainText(new) def accept(self, *args): - tags = unicode(self.add_tags.text()).strip().split(',') + tags = unicode_type(self.add_tags.text()).strip().split(',') tags = list(filter(None, [x.strip() for x in tags])) gprefs['add from ISBN tags'] = tags self.set_tags = tags bad = set() - for line in unicode(self.isbn_box.toPlainText()).strip().splitlines(): + for line in unicode_type(self.isbn_box.toPlainText()).strip().splitlines(): line = line.strip() if not line: continue @@ -117,4 +118,3 @@ class AddFromISBN(QDialog): _('All the ISBNs you entered were invalid. No books' ' can be added.'), show=True) QDialog.accept(self, *args) - diff --git a/src/calibre/gui2/dialogs/authors_edit.py b/src/calibre/gui2/dialogs/authors_edit.py index 34ce34722c..e020d071af 100644 --- a/src/calibre/gui2/dialogs/authors_edit.py +++ b/src/calibre/gui2/dialogs/authors_edit.py @@ -16,6 +16,7 @@ from calibre.utils.config_base import tweaks from calibre.gui2 import gprefs from calibre.gui2.complete2 import EditWithComplete from calibre.ebooks.metadata import string_to_authors +from polyglot.builtins import unicode_type class ItemDelegate(QStyledItemDelegate): @@ -30,12 +31,12 @@ class ItemDelegate(QStyledItemDelegate): return QStyledItemDelegate.sizeHint(self, *args) + QSize(0, 15) def setEditorData(self, editor, index): - name = unicode(index.data(Qt.DisplayRole) or '') + name = unicode_type(index.data(Qt.DisplayRole) or '') editor.setText(name) editor.lineEdit().selectAll() def setModelData(self, editor, model, index): - authors = string_to_authors(unicode(editor.text())) + authors = string_to_authors(unicode_type(editor.text())) model.setData(index, authors[0]) self.edited.emit(index.row()) @@ -89,10 +90,10 @@ class List(QListWidget): def edited(self, i): item = self.item(i) - q = unicode(item.text()) + q = unicode_type(item.text()) remove = [] for j in xrange(self.count()): - if i != j and unicode(self.item(j).text()) == q: + if i != j and unicode_type(self.item(j).text()) == q: remove.append(j) for x in sorted(remove, reverse=True): self.takeItem(x) @@ -177,7 +178,7 @@ class AuthorsEdit(QDialog): def authors(self): ans = [] for i in xrange(self.al.count()): - ans.append(unicode(self.al.item(i).text())) + ans.append(unicode_type(self.al.item(i).text())) return ans or [_('Unknown')] def add_author(self): diff --git a/src/calibre/gui2/dialogs/book_info.py b/src/calibre/gui2/dialogs/book_info.py index 2871c85615..aec75c3133 100644 --- a/src/calibre/gui2/dialogs/book_info.py +++ b/src/calibre/gui2/dialogs/book_info.py @@ -16,6 +16,7 @@ from calibre.gui2.book_details import css, details_context_menu_event, render_ht from calibre.gui2.ui import get_gui from calibre.gui2.widgets import CoverView from calibre.gui2.widgets2 import Dialog +from polyglot.builtins import unicode_type class Configure(Dialog): @@ -154,9 +155,9 @@ class BookInfo(QDialog): self.ps = QShortcut(QKeySequence('Alt+Left'), self) self.ps.activated.connect(self.previous) self.next_button.setToolTip(_('Next [%s]')% - unicode(self.ns.key().toString(QKeySequence.NativeText))) + unicode_type(self.ns.key().toString(QKeySequence.NativeText))) self.previous_button.setToolTip(_('Previous [%s]')% - unicode(self.ps.key().toString(QKeySequence.NativeText))) + unicode_type(self.ps.key().toString(QKeySequence.NativeText))) geom = QCoreApplication.instance().desktop().availableGeometry(self) screen_height = geom.height() - 100 @@ -179,7 +180,7 @@ class BookInfo(QDialog): self.refresh(self.current_row, mi=mi) def link_clicked(self, qurl): - link = unicode(qurl.toString(NO_URL_FORMATTING)) + link = unicode_type(qurl.toString(NO_URL_FORMATTING)) self.link_delegate(link) def done(self, r): diff --git a/src/calibre/gui2/dialogs/catalog.py b/src/calibre/gui2/dialogs/catalog.py index 05b3fce85a..0537b35473 100644 --- a/src/calibre/gui2/dialogs/catalog.py +++ b/src/calibre/gui2/dialogs/catalog.py @@ -14,6 +14,7 @@ from calibre.customize.ui import config from calibre.gui2.dialogs.catalog_ui import Ui_Dialog from calibre.gui2 import dynamic, info_dialog from calibre.customize.ui import catalog_plugins +from polyglot.builtins import unicode_type class Catalog(QDialog, Ui_Dialog): @@ -30,7 +31,7 @@ class Catalog(QDialog, Ui_Dialog): self.dbspec, self.ids = dbspec, ids # Display the number of books we've been passed - self.count.setText(unicode(self.count.text()).format(len(ids))) + self.count.setText(unicode_type(self.count.text()).format(len(ids))) # Display the last-used title self.title.setText(dynamic.get('catalog_last_used_title', @@ -150,7 +151,7 @@ class Catalog(QDialog, Ui_Dialog): return ans def show_plugin_tab(self, idx): - cf = unicode(self.format.currentText()).lower() + cf = unicode_type(self.format.currentText()).lower() while self.tabs.count() > 1: self.tabs.removeTab(1) for pw in self.widgets: @@ -168,7 +169,7 @@ class Catalog(QDialog, Ui_Dialog): self.buttonBox.button(self.buttonBox.Help).setVisible(False) def format_changed(self, idx): - cf = unicode(self.format.currentText()) + cf = unicode_type(self.format.currentText()) if cf in self.sync_enabled_formats: self.sync.setEnabled(True) else: @@ -179,7 +180,7 @@ class Catalog(QDialog, Ui_Dialog): ''' When title/format change, invalidate Preset in E-book options tab ''' - cf = unicode(self.format.currentText()).lower() + cf = unicode_type(self.format.currentText()).lower() if cf in ['azw3', 'epub', 'mobi'] and hasattr(self.options_widget, 'settings_changed'): self.options_widget.settings_changed("title/format") @@ -192,9 +193,9 @@ class Catalog(QDialog, Ui_Dialog): return ans def save_catalog_settings(self): - self.catalog_format = unicode(self.format.currentText()) + self.catalog_format = unicode_type(self.format.currentText()) dynamic.set('catalog_preferred_format', self.catalog_format) - self.catalog_title = unicode(self.title.text()) + self.catalog_title = unicode_type(self.title.text()) dynamic.set('catalog_last_used_title', self.catalog_title) self.catalog_sync = bool(self.sync.isChecked()) dynamic.set('catalog_sync_to_device', self.catalog_sync) diff --git a/src/calibre/gui2/dialogs/check_library.py b/src/calibre/gui2/dialogs/check_library.py index 9f032bed33..52108e16c4 100644 --- a/src/calibre/gui2/dialogs/check_library.py +++ b/src/calibre/gui2/dialogs/check_library.py @@ -15,6 +15,7 @@ from calibre.gui2.dialogs.confirm_delete import confirm from calibre.library.check_library import CheckLibrary, CHECKS from calibre.utils.recycle_bin import delete_file, delete_tree from calibre import prints, as_unicode +from polyglot.builtins import unicode_type class DBCheck(QDialog): # {{{ @@ -232,8 +233,8 @@ class CheckLibraryDialog(QDialog): return True def accept(self): - self.db.new_api.set_pref('check_library_ignore_extensions', unicode(self.ext_ignores.text())) - self.db.new_api.set_pref('check_library_ignore_names', unicode(self.name_ignores.text())) + self.db.new_api.set_pref('check_library_ignore_extensions', unicode_type(self.ext_ignores.text())) + self.db.new_api.set_pref('check_library_ignore_names', unicode_type(self.name_ignores.text())) QDialog.accept(self) def box_to_list(self, txt): @@ -241,8 +242,8 @@ class CheckLibraryDialog(QDialog): def run_the_check(self): checker = CheckLibrary(self.db.library_path, self.db) - checker.scan_library(self.box_to_list(unicode(self.name_ignores.text())), - self.box_to_list(unicode(self.ext_ignores.text()))) + checker.scan_library(self.box_to_list(unicode_type(self.name_ignores.text())), + self.box_to_list(unicode_type(self.ext_ignores.text()))) plaintext = [] @@ -335,7 +336,7 @@ class CheckLibraryDialog(QDialog): for it in items: if it.checkState(1): try: - p = os.path.join(self.db.library_path ,unicode(it.text(1))) + p = os.path.join(self.db.library_path, unicode_type(it.text(1))) if os.path.isdir(p): delete_tree(p) else: @@ -343,7 +344,7 @@ class CheckLibraryDialog(QDialog): except: prints('failed to delete', os.path.join(self.db.library_path, - unicode(it.text(1)))) + unicode_type(it.text(1)))) self.run_the_check() def fix_missing_formats(self): diff --git a/src/calibre/gui2/dialogs/choose_format_device.py b/src/calibre/gui2/dialogs/choose_format_device.py index 775af1dad5..63af23d726 100644 --- a/src/calibre/gui2/dialogs/choose_format_device.py +++ b/src/calibre/gui2/dialogs/choose_format_device.py @@ -5,6 +5,7 @@ from PyQt5.Qt import QDialog, QTreeWidgetItem, QIcon, QModelIndex from calibre.gui2 import file_icon_provider from calibre.gui2.dialogs.choose_format_device_ui import Ui_ChooseFormatDeviceDialog +from polyglot.builtins import unicode_type class ChooseFormatDeviceDialog(QDialog, Ui_ChooseFormatDeviceDialog): @@ -48,6 +49,5 @@ class ChooseFormatDeviceDialog(QDialog, Ui_ChooseFormatDeviceDialog): return self._format def accept(self): - self._format = unicode(self.formats.currentItem().text(0)) + self._format = unicode_type(self.formats.currentItem().text(0)) return QDialog.accept(self) - diff --git a/src/calibre/gui2/dialogs/choose_library.py b/src/calibre/gui2/dialogs/choose_library.py index 535c729419..419ed96da7 100644 --- a/src/calibre/gui2/dialogs/choose_library.py +++ b/src/calibre/gui2/dialogs/choose_library.py @@ -17,6 +17,7 @@ from calibre.gui2 import error_dialog, choose_dir from calibre.constants import (filesystem_encoding, iswindows, get_portable_base) from calibre import isbytestring, patheq, force_unicode +from polyglot.builtins import unicode_type class ProgressDialog(PD): @@ -54,7 +55,7 @@ class ChooseLibrary(QDialog, Ui_Dialog): lp = db.library_path if isbytestring(lp): lp = lp.decode(filesystem_encoding) - loc = unicode(self.old_location.text()).format(lp) + loc = unicode_type(self.old_location.text()).format(lp) self.old_location.setText(loc) self.browse_button.clicked.connect(self.choose_loc) self.empty_library.toggled.connect(self.empty_library_toggled) @@ -168,7 +169,7 @@ class ChooseLibrary(QDialog, Ui_Dialog): action = 'existing' elif self.empty_library.isChecked(): action = 'new' - text = unicode(self.location.text()).strip() + text = unicode_type(self.location.text()).strip() if not text: return error_dialog(self, _('No location'), _('No location selected'), show=True) diff --git a/src/calibre/gui2/dialogs/comicconf.py b/src/calibre/gui2/dialogs/comicconf.py index 07931322aa..2bffd4a4c7 100644 --- a/src/calibre/gui2/dialogs/comicconf.py +++ b/src/calibre/gui2/dialogs/comicconf.py @@ -7,6 +7,7 @@ __docformat__ = 'restructuredtext en' from PyQt5.Qt import QDialog from calibre.gui2.dialogs.comicconf_ui import Ui_Dialog from calibre.ebooks.lrf.comic.convert_from import config, PROFILES +from polyglot.builtins import unicode_type def set_conversion_defaults(window): @@ -81,9 +82,9 @@ class ComicConf(QDialog, Ui_Dialog): elif hasattr(g, 'value'): val = g.value() elif hasattr(g, 'itemText'): - val = unicode(g.itemText(g.currentIndex())) + val = unicode_type(g.itemText(g.currentIndex())) elif hasattr(g, 'text'): - val = unicode(g.text()) + val = unicode_type(g.text()) else: raise Exception('Bad coding') self.config.set(opt.name, val) diff --git a/src/calibre/gui2/dialogs/custom_recipes.py b/src/calibre/gui2/dialogs/custom_recipes.py index 3ba3baef7d..4562361c5e 100644 --- a/src/calibre/gui2/dialogs/custom_recipes.py +++ b/src/calibre/gui2/dialogs/custom_recipes.py @@ -21,6 +21,7 @@ from calibre.gui2.tweak_book.editor.text import TextEdit from calibre.utils.icu import sort_key from calibre.web.feeds.recipes.collection import get_builtin_recipe_collection, get_builtin_recipe_by_id from calibre.utils.localization import localize_user_manual_link +from polyglot.builtins import unicode_type def is_basic_recipe(src): @@ -118,14 +119,14 @@ def py3_repr(x): ans = repr(x) if isinstance(x, bytes) and not ans.startswith('b'): ans = 'b' + ans - if isinstance(x, unicode) and ans.startswith('u'): + if isinstance(x, unicode_type) and ans.startswith('u'): ans = ans[1:] return ans def options_to_recipe_source(title, oldest_article, max_articles_per_feed, feeds): classname = 'BasicUserRecipe%d' % int(time.time()) - title = unicode(title).strip() or classname + title = unicode_type(title).strip() or classname indent = ' ' * 8 if feeds: if len(feeds[0]) == 1: @@ -593,8 +594,8 @@ class CustomRecipes(Dialog): if not items: return item = items[-1] - id_ = unicode(item.data(Qt.UserRole) or '') - title = unicode(item.data(Qt.DisplayRole) or '').rpartition(' [')[0] + id_ = unicode_type(item.data(Qt.UserRole) or '') + title = unicode_type(item.data(Qt.DisplayRole) or '').rpartition(' [')[0] src = get_builtin_recipe_by_id(id_, download_recipe=True) if src is None: raise Exception('Something weird happened') diff --git a/src/calibre/gui2/dialogs/delete_matching_from_device.py b/src/calibre/gui2/dialogs/delete_matching_from_device.py index 09f7707449..646233dbae 100644 --- a/src/calibre/gui2/dialogs/delete_matching_from_device.py +++ b/src/calibre/gui2/dialogs/delete_matching_from_device.py @@ -11,6 +11,7 @@ from calibre.ebooks.metadata import authors_to_string, authors_to_sort_string, \ from calibre.gui2.dialogs.delete_matching_from_device_ui import \ Ui_DeleteMatchingFromDeviceDialog from calibre.utils.date import UNDEFINED_DATE +from polyglot.builtins import unicode_type class tableItem(QTableWidgetItem): @@ -116,7 +117,6 @@ class DeleteMatchingFromDeviceDialog(QDialog, Ui_DeleteMatchingFromDeviceDialog) if self.table.item(row, 0).checkState() == Qt.Unchecked: continue (model, id, path) = self.table.item(row, 0).data(Qt.UserRole) - path = unicode(path) + path = unicode_type(path) self.result.append((model, id, path)) return - diff --git a/src/calibre/gui2/dialogs/device_category_editor.py b/src/calibre/gui2/dialogs/device_category_editor.py index 3923c3dd93..9cb9cd1230 100644 --- a/src/calibre/gui2/dialogs/device_category_editor.py +++ b/src/calibre/gui2/dialogs/device_category_editor.py @@ -5,6 +5,7 @@ from PyQt5.Qt import Qt, QDialog, QListWidgetItem from calibre.gui2.dialogs.device_category_editor_ui import Ui_DeviceCategoryEditor from calibre.gui2 import question_dialog, error_dialog +from polyglot.builtins import unicode_type class ListWidgetItem(QListWidgetItem): @@ -90,7 +91,7 @@ class DeviceCategoryEditor(QDialog, Ui_DeviceCategoryEditor): return if item.text() != item.initial_text(): id_ = int(item.data(Qt.UserRole)) - self.to_rename[id_] = unicode(item.text()) + self.to_rename[id_] = unicode_type(item.text()) def rename_tag(self): item = self.available_tags.currentItem() @@ -109,7 +110,7 @@ class DeviceCategoryEditor(QDialog, Ui_DeviceCategoryEditor): error_dialog(self, _('No items selected'), _('You must select at least one item from the list.')).exec_() return - ct = ', '.join([unicode(item.text()) for item in deletes]) + ct = ', '.join([unicode_type(item.text()) for item in deletes]) if not question_dialog(self, _('Are you sure?'), '

'+_('Are you sure you want to delete the following items?')+'
'+ct): return diff --git a/src/calibre/gui2/dialogs/drm_error.py b/src/calibre/gui2/dialogs/drm_error.py index 1a70ad0458..44a6252358 100644 --- a/src/calibre/gui2/dialogs/drm_error.py +++ b/src/calibre/gui2/dialogs/drm_error.py @@ -8,6 +8,7 @@ __docformat__ = 'restructuredtext en' from PyQt5.Qt import QDialog from calibre.gui2.dialogs.drm_error_ui import Ui_Dialog +from polyglot.builtins import unicode_type class DRMErrorMessage(QDialog, Ui_Dialog): @@ -16,7 +17,6 @@ class DRMErrorMessage(QDialog, Ui_Dialog): QDialog.__init__(self, parent) self.setupUi(self) if title is not None: - t = unicode(self.msg.text()) + t = unicode_type(self.msg.text()) self.msg.setText('

%s

%s'%(title, t)) self.resize(self.sizeHint()) - diff --git a/src/calibre/gui2/dialogs/duplicates.py b/src/calibre/gui2/dialogs/duplicates.py index 5154058095..0c0b3d32c7 100644 --- a/src/calibre/gui2/dialogs/duplicates.py +++ b/src/calibre/gui2/dialogs/duplicates.py @@ -15,6 +15,7 @@ from PyQt5.Qt import ( from calibre.gui2 import gprefs from calibre.ebooks.metadata import authors_to_string +from polyglot.builtins import unicode_type class DuplicatesQuestion(QDialog): @@ -144,10 +145,10 @@ class DuplicatesQuestion(QDialog): for i in xrange(self.dup_list.topLevelItemCount()): x = self.dup_list.topLevelItem(i) check = '✓' if x.checkState(0) == Qt.Checked else '✗' - title = '%s %s' % (check, unicode(x.text(0))) + title = '%s %s' % (check, unicode_type(x.text(0))) dups = [] for child in (x.child(j) for j in xrange(x.childCount())): - dups.append('\t' + unicode(child.text(0))) + dups.append('\t' + unicode_type(child.text(0))) entries.append(title + '\n' + '\n'.join(dups)) return '\n\n'.join(entries) diff --git a/src/calibre/gui2/dialogs/edit_authors_dialog.py b/src/calibre/gui2/dialogs/edit_authors_dialog.py index 8072b221c5..dc218bebd9 100644 --- a/src/calibre/gui2/dialogs/edit_authors_dialog.py +++ b/src/calibre/gui2/dialogs/edit_authors_dialog.py @@ -11,15 +11,16 @@ from calibre.ebooks.metadata import author_to_author_sort, string_to_authors from calibre.gui2 import error_dialog, gprefs from calibre.gui2.dialogs.edit_authors_dialog_ui import Ui_EditAuthorsDialog from calibre.utils.icu import sort_key +from polyglot.builtins import unicode_type class tableItem(QTableWidgetItem): def __ge__(self, other): - return sort_key(unicode(self.text())) >= sort_key(unicode(other.text())) + return sort_key(unicode_type(self.text())) >= sort_key(unicode_type(other.text())) def __lt__(self, other): - return sort_key(unicode(self.text())) < sort_key(unicode(other.text())) + return sort_key(unicode_type(self.text())) < sort_key(unicode_type(other.text())) class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog): @@ -195,28 +196,28 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog): def copy_to_clipboard(self): cb = QApplication.clipboard() - cb.setText(unicode(self.context_item.text())) + cb.setText(unicode_type(self.context_item.text())) def paste_from_clipboard(self): cb = QApplication.clipboard() self.context_item.setText(cb.text()) def upper_case(self): - self.context_item.setText(icu_upper(unicode(self.context_item.text()))) + self.context_item.setText(icu_upper(unicode_type(self.context_item.text()))) def lower_case(self): - self.context_item.setText(icu_lower(unicode(self.context_item.text()))) + self.context_item.setText(icu_lower(unicode_type(self.context_item.text()))) def swap_case(self): - self.context_item.setText(unicode(self.context_item.text()).swapcase()) + self.context_item.setText(unicode_type(self.context_item.text()).swapcase()) def title_case(self): from calibre.utils.titlecase import titlecase - self.context_item.setText(titlecase(unicode(self.context_item.text()))) + self.context_item.setText(titlecase(unicode_type(self.context_item.text()))) def capitalize(self): from calibre.utils.icu import capitalize - self.context_item.setText(capitalize(unicode(self.context_item.text()))) + self.context_item.setText(capitalize(unicode_type(self.context_item.text()))) def copy_aus_to_au(self): row = self.context_item.row() @@ -242,14 +243,14 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog): self.buttonBox.button(QDialogButtonBox.Ok).setAutoDefault(False) self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(False) self.buttonBox.button(QDialogButtonBox.Cancel).setAutoDefault(False) - st = icu_lower(unicode(self.find_box.currentText())) + st = icu_lower(unicode_type(self.find_box.currentText())) for i in range(0, self.table.rowCount()*2): self.start_find_pos = (self.start_find_pos + 1) % (self.table.rowCount()*2) r = (self.start_find_pos/2)%self.table.rowCount() c = self.start_find_pos % 2 item = self.table.item(r, c) - text = icu_lower(unicode(item.text())) + text = icu_lower(unicode_type(item.text())) if st in text: self.table.setCurrentItem(item) self.table.setFocus(True) @@ -281,9 +282,9 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog): self.result = [] for row in range(0,self.table.rowCount()): id = int(self.table.item(row, 0).data(Qt.UserRole)) - aut = unicode(self.table.item(row, 0).text()).strip() - sort = unicode(self.table.item(row, 1).text()).strip() - link = unicode(self.table.item(row, 2).text()).strip() + aut = unicode_type(self.table.item(row, 0).text()).strip() + sort = unicode_type(self.table.item(row, 1).text()).strip() + link = unicode_type(self.table.item(row, 2).text()).strip() orig_aut,orig_sort,orig_link = self.authors[id] if orig_aut != aut or orig_sort != sort or orig_link != link: self.result.append((id, orig_aut, aut, sort, link)) @@ -292,7 +293,7 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog): self.table.cellChanged.disconnect() for row in range(0,self.table.rowCount()): item = self.table.item(row, 0) - aut = unicode(item.text()).strip() + aut = unicode_type(item.text()).strip() c = self.table.item(row, 1) # Sometimes trailing commas are left by changing between copy algs c.setText(author_to_author_sort(aut).rstrip(',')) @@ -303,7 +304,7 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog): self.table.cellChanged.disconnect() for row in range(0,self.table.rowCount()): item = self.table.item(row, 1) - aus = unicode(item.text()).strip() + aus = unicode_type(item.text()).strip() c = self.table.item(row, 0) # Sometimes trailing commas are left by changing between copy algs c.setText(aus) @@ -313,7 +314,7 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog): def cell_changed(self, row, col): if col == 0: item = self.table.item(row, 0) - aut = unicode(item.text()).strip() + aut = unicode_type(item.text()).strip() aut_list = string_to_authors(aut) if len(aut_list) != 1: error_dialog(self.parent(), _('Invalid author name'), diff --git a/src/calibre/gui2/dialogs/match_books.py b/src/calibre/gui2/dialogs/match_books.py index 35a440be25..f258f78d88 100644 --- a/src/calibre/gui2/dialogs/match_books.py +++ b/src/calibre/gui2/dialogs/match_books.py @@ -14,6 +14,7 @@ from PyQt5.Qt import (Qt, QDialog, QAbstractItemView, QTableWidgetItem, from calibre.gui2 import gprefs, error_dialog from calibre.gui2.dialogs.match_books_ui import Ui_MatchBooks from calibre.utils.icu import sort_key +from polyglot.builtins import unicode_type class TableItem(QTableWidgetItem): @@ -125,7 +126,7 @@ class MatchBooks(QDialog, Ui_MatchBooks): QDialog.keyPressEvent(self, e) def do_search(self): - query = unicode(self.search_text.text()) + query = unicode_type(self.search_text.text()) if not query: d = error_dialog(self.gui, _('Match books'), _('You must enter a search expression into the search box')) @@ -217,4 +218,3 @@ class MatchBooks(QDialog, Ui_MatchBooks): def reject(self): self.close() QDialog.reject(self) - diff --git a/src/calibre/gui2/dialogs/message_box.py b/src/calibre/gui2/dialogs/message_box.py index d02a063e5f..b7e2618ba3 100644 --- a/src/calibre/gui2/dialogs/message_box.py +++ b/src/calibre/gui2/dialogs/message_box.py @@ -16,6 +16,7 @@ from PyQt5.Qt import ( from calibre.constants import __version__, isfrozen from calibre.gui2 import gprefs +from polyglot.builtins import unicode_type class Icon(QWidget): @@ -162,9 +163,9 @@ class MessageBox(QDialog): # {{{ def copy_to_clipboard(self, *args): QApplication.clipboard().setText( 'calibre, version %s\n%s: %s\n\n%s' % - (__version__, unicode(self.windowTitle()), - unicode(self.msg.text()), - unicode(self.det_msg.toPlainText()))) + (__version__, unicode_type(self.windowTitle()), + unicode_type(self.msg.text()), + unicode_type(self.det_msg.toPlainText()))) if hasattr(self, 'ctc_button'): self.ctc_button.setText(_('Copied')) @@ -418,13 +419,13 @@ class JobError(QDialog): # {{{ QApplication.clipboard().setText( u'calibre, version %s (%s, embedded-python: %s)\n%s: %s\n\n%s' % (__version__, sys.platform, isfrozen, - unicode(self.windowTitle()), unicode(d.toPlainText()), - unicode(self.det_msg.toPlainText()))) + unicode_type(self.windowTitle()), unicode_type(d.toPlainText()), + unicode_type(self.det_msg.toPlainText()))) if hasattr(self, 'ctc_button'): self.ctc_button.setText(_('Copied')) def toggle_det_msg(self, *args): - vis = unicode(self.det_msg_toggle.text()) == self.hide_det_msg + vis = unicode_type(self.det_msg_toggle.text()) == self.hide_det_msg self.det_msg_toggle.setText(self.show_det_msg if vis else self.hide_det_msg) self.det_msg.setVisible(not vis) diff --git a/src/calibre/gui2/dialogs/metadata_bulk.py b/src/calibre/gui2/dialogs/metadata_bulk.py index 76f0d3cf68..0c87c31b11 100644 --- a/src/calibre/gui2/dialogs/metadata_bulk.py +++ b/src/calibre/gui2/dialogs/metadata_bulk.py @@ -32,6 +32,7 @@ from calibre.utils.date import qt_to_dt, internal_iso_format_string from calibre.utils.icu import capitalize, sort_key from calibre.utils.titlecase import titlecase from calibre.gui2.widgets import LineEditECM +from polyglot.builtins import unicode_type Settings = namedtuple('Settings', 'remove_all remove add au aus do_aus rating pub do_series do_autonumber ' @@ -170,7 +171,7 @@ class MyBlockingBusy(QDialog): # {{{ except Exception as err: import traceback try: - err = unicode(err) + err = unicode_type(err) except: err = repr(err) self.error = (err, traceback.format_exc()) @@ -478,7 +479,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): self.refresh_book_list.toggled.connect(self.save_refresh_booklist) self.ids = [self.db.id(r) for r in rows] self.first_title = self.db.title(self.ids[0], index_is_id=True) - self.cover_clone.setToolTip(unicode(self.cover_clone.toolTip()) + ' (%s)' % self.first_title) + self.cover_clone.setToolTip(unicode_type(self.cover_clone.toolTip()) + ' (%s)' % self.first_title) self.box_title.setText('

' + _('Editing meta information for %d books') % len(rows)) @@ -581,8 +582,8 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): self.comments = d.textbox.html b = self.comments_button b.setStyleSheet('QPushButton { font-weight: bold }') - if unicode(b.text())[-1] != '*': - b.setText(unicode(b.text()) + ' *') + if unicode_type(b.text())[-1] != '*': + b.setText(unicode_type(b.text()) + ' *') def save_refresh_booklist(self, *args): gprefs['refresh_book_list_on_bulk_edit'] = bool(self.refresh_book_list.isChecked()) @@ -752,18 +753,18 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): def s_r_sf_itemdata(self, idx): if idx is None: idx = self.search_field.currentIndex() - return unicode(self.search_field.itemData(idx) or '') + return unicode_type(self.search_field.itemData(idx) or '') def s_r_df_itemdata(self, idx): if idx is None: idx = self.destination_field.currentIndex() - return unicode(self.destination_field.itemData(idx) or '') + return unicode_type(self.destination_field.itemData(idx) or '') def s_r_get_field(self, mi, field): if field: if field == '{template}': v = SafeFormat().safe_format( - unicode(self.s_r_template.text()), mi, _('S/R TEMPLATE ERROR'), mi) + unicode_type(self.s_r_template.text()), mi, _('S/R TEMPLATE ERROR'), mi) return [v] fm = self.db.metadata_for_field(field) if field == 'sort': @@ -776,7 +777,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): val = str(val) elif fm['is_csp']: # convert the csp dict into a list - id_type = unicode(self.s_r_src_ident.currentText()) + id_type = unicode_type(self.s_r_src_ident.currentText()) if id_type: val = [val.get(id_type, '')] else: @@ -825,7 +826,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): if len(t) > 1: t = t[self.starting_from.value()-1: self.starting_from.value()-1 + self.results_count.value()] - w.setText(unicode(self.multiple_separator.text()).join(t)) + w.setText(unicode_type(self.multiple_separator.text()).join(t)) if self.search_mode.currentIndex() == 0: self.destination_field.setCurrentIndex(idx) @@ -893,8 +894,8 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): getattr(self, 'book_%d_result'%(i+1)).setText('') def s_r_func(self, match): - rfunc = self.s_r_functions[unicode(self.replace_func.currentText())] - rtext = unicode(self.replace_with.text()) + rfunc = self.s_r_functions[unicode_type(self.replace_func.currentText())] + rtext = unicode_type(self.replace_with.text()) rtext = match.expand(rtext) return rfunc(rtext) @@ -902,7 +903,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): src_field = self.s_r_sf_itemdata(None) src = self.s_r_get_field(mi, src_field) result = [] - rfunc = self.s_r_functions[unicode(self.replace_func.currentText())] + rfunc = self.s_r_functions[unicode_type(self.replace_func.currentText())] for s in src: t = self.s_r_obj.sub(self.s_r_func, s) if self.search_mode.currentIndex() == 0: @@ -936,7 +937,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): dest_mode = self.replace_mode.currentIndex() if self.destination_field_fm['is_csp']: - dest_ident = unicode(self.s_r_dst_ident.text()) + dest_ident = unicode_type(self.s_r_dst_ident.text()) if not dest_ident or (src == 'identifiers' and dest_ident == '*'): raise Exception(_('You must specify a destination identifier type')) @@ -953,7 +954,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): if dest_mode != 0: dest_val = mi.get(dest, '') if self.db.metadata_for_field(dest)['is_csp']: - dst_id_type = unicode(self.s_r_dst_ident.text()) + dst_id_type = unicode_type(self.s_r_dst_ident.text()) if dst_id_type: dest_val = [dest_val.get(dst_id_type, '')] else: @@ -989,7 +990,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): flags |= re.UNICODE try: - stext = unicode(self.search_for.text()) + stext = unicode_type(self.search_for.text()) if not stext: raise Exception(_('You must specify a search expression in the "Search for" field')) if self.search_mode.currentIndex() == 0: @@ -1004,7 +1005,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): try: self.test_result.setText(self.s_r_obj.sub(self.s_r_func, - unicode(self.test_text.text()))) + unicode_type(self.test_text.text()))) except Exception as e: self.s_r_error = e self.s_r_set_colors() @@ -1019,7 +1020,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): if len(t) > 1 and self.destination_field_fm['is_multiple']: t = t[self.starting_from.value()-1: self.starting_from.value()-1 + self.results_count.value()] - t = unicode(self.multiple_separator.text()).join(t) + t = unicode_type(self.multiple_separator.text()).join(t) else: t = self.s_r_replace_mode_separator().join(t) wr.setText(t) @@ -1043,7 +1044,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): if dfm['is_csp']: # convert the colon-separated pair strings back into a dict, # which is what set_identifiers wants - dst_id_type = unicode(self.s_r_dst_ident.text()) + dst_id_type = unicode_type(self.s_r_dst_ident.text()) if dst_id_type and dst_id_type != '*': v = ''.join(val) ids = mi.get(dest) @@ -1166,19 +1167,19 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): remove_all = self.remove_all_tags.isChecked() remove = [] if not remove_all: - remove = unicode(self.remove_tags.text()).strip().split(',') - add = unicode(self.tags.text()).strip().split(',') - au = unicode(self.authors.text()) - aus = unicode(self.author_sort.text()) + remove = unicode_type(self.remove_tags.text()).strip().split(',') + add = unicode_type(self.tags.text()).strip().split(',') + au = unicode_type(self.authors.text()) + aus = unicode_type(self.author_sort.text()) do_aus = self.author_sort.isEnabled() rating = self.rating.rating_value if not self.apply_rating.isChecked(): rating = -1 - pub = unicode(self.publisher.text()) + pub = unicode_type(self.publisher.text()) do_series = self.write_series clear_series = self.clear_series.isChecked() clear_pub = self.clear_pub.isChecked() - series = unicode(self.series.currentText()).strip() + series = unicode_type(self.series.currentText()).strip() do_autonumber = self.autonumber_series.isChecked() do_series_restart = self.series_numbering_restarts.isChecked() series_start_value = self.series_start_number.value() @@ -1248,7 +1249,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): return QDialog.accept(self) def series_changed(self, *args): - self.write_series = bool(unicode(self.series.currentText()).strip()) + self.write_series = bool(unicode_type(self.series.currentText()).strip()) self.autonumber_series.setEnabled(True) def s_r_remove_query(self, *args): @@ -1261,7 +1262,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): return item_id = self.query_field.currentIndex() - item_name = unicode(self.query_field.currentText()) + item_name = unicode_type(self.query_field.currentText()) self.query_field.blockSignals(True) self.query_field.removeItem(item_id) @@ -1289,7 +1290,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): error_dialog(self, _("Save search/replace"), _("You must provide a name."), show=True) new = True - name = unicode(name) + name = unicode_type(name) if name in self.queries.keys(): if not question_dialog(self, _("Save search/replace"), _("That saved search/replace already exists and will be overwritten. " @@ -1299,21 +1300,21 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): query = {} query['name'] = name - query['search_field'] = unicode(self.search_field.currentText()) - query['search_mode'] = unicode(self.search_mode.currentText()) - query['s_r_template'] = unicode(self.s_r_template.text()) - query['s_r_src_ident'] = unicode(self.s_r_src_ident.currentText()) - query['search_for'] = unicode(self.search_for.text()) + query['search_field'] = unicode_type(self.search_field.currentText()) + query['search_mode'] = unicode_type(self.search_mode.currentText()) + query['s_r_template'] = unicode_type(self.s_r_template.text()) + query['s_r_src_ident'] = unicode_type(self.s_r_src_ident.currentText()) + query['search_for'] = unicode_type(self.search_for.text()) query['case_sensitive'] = self.case_sensitive.isChecked() - query['replace_with'] = unicode(self.replace_with.text()) - query['replace_func'] = unicode(self.replace_func.currentText()) - query['destination_field'] = unicode(self.destination_field.currentText()) - query['s_r_dst_ident'] = unicode(self.s_r_dst_ident.text()) - query['replace_mode'] = unicode(self.replace_mode.currentText()) + query['replace_with'] = unicode_type(self.replace_with.text()) + query['replace_func'] = unicode_type(self.replace_func.currentText()) + query['destination_field'] = unicode_type(self.destination_field.currentText()) + query['s_r_dst_ident'] = unicode_type(self.s_r_dst_ident.text()) + query['replace_mode'] = unicode_type(self.replace_mode.currentText()) query['comma_separated'] = self.comma_separated.isChecked() query['results_count'] = self.results_count.value() query['starting_from'] = self.starting_from.value() - query['multiple_separator'] = unicode(self.multiple_separator.text()) + query['multiple_separator'] = unicode_type(self.multiple_separator.text()) self.queries[name] = query self.queries.commit() @@ -1332,7 +1333,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): self.s_r_reset_query_fields() self.saved_search_name = '' return - item = self.queries.get(unicode(item_name), None) + item = self.queries.get(unicode_type(item_name), None) if item is None: self.s_r_reset_query_fields() return diff --git a/src/calibre/gui2/dialogs/opml.py b/src/calibre/gui2/dialogs/opml.py index 9235eea48d..0f35b81b3d 100644 --- a/src/calibre/gui2/dialogs/opml.py +++ b/src/calibre/gui2/dialogs/opml.py @@ -17,6 +17,7 @@ from lxml import etree from calibre.gui2 import choose_files, error_dialog from calibre.utils.icu import sort_key +from polyglot.builtins import unicode_type Group = namedtuple('Group', 'title feeds') @@ -125,7 +126,7 @@ class ImportOPML(QDialog): self.path.setText(opml_files[0]) def accept(self): - path = unicode(self.path.text()) + path = unicode_type(self.path.text()) if not path: return error_dialog(self, _('Path not specified'), _( 'You must specify the path to the OPML file to import'), show=True) diff --git a/src/calibre/gui2/dialogs/password.py b/src/calibre/gui2/dialogs/password.py index 08a7ca6251..708cc9d1ba 100644 --- a/src/calibre/gui2/dialogs/password.py +++ b/src/calibre/gui2/dialogs/password.py @@ -5,6 +5,7 @@ from PyQt5.Qt import QDialog, QLineEdit, Qt from calibre.gui2.dialogs.password_ui import Ui_Dialog from calibre.gui2 import dynamic +from polyglot.builtins import unicode_type class PasswordDialog(QDialog, Ui_Dialog): @@ -34,13 +35,12 @@ class PasswordDialog(QDialog, Ui_Dialog): self.gui_password.setEchoMode(QLineEdit.Normal) def username(self): - return unicode(self.gui_username.text()) + return unicode_type(self.gui_username.text()) def password(self): - return unicode(self.gui_password.text()) + return unicode_type(self.gui_password.text()) def accept(self): - dynamic.set(self.cfg_key+'__un', unicode(self.gui_username.text())) - dynamic.set(self.cfg_key+'__pw', unicode(self.gui_password.text())) + dynamic.set(self.cfg_key+'__un', unicode_type(self.gui_username.text())) + dynamic.set(self.cfg_key+'__pw', unicode_type(self.gui_password.text())) QDialog.accept(self) - diff --git a/src/calibre/gui2/dialogs/plugin_updater.py b/src/calibre/gui2/dialogs/plugin_updater.py index 917b9d4cb4..18355b16b4 100644 --- a/src/calibre/gui2/dialogs/plugin_updater.py +++ b/src/calibre/gui2/dialogs/plugin_updater.py @@ -24,6 +24,7 @@ from calibre.gui2 import error_dialog, question_dialog, info_dialog, open_url, g from calibre.gui2.preferences.plugins import ConfigWidget from calibre.utils.date import UNDEFINED_DATE, format_date from calibre.utils.https import get_https_resource_securely +from polyglot.builtins import unicode_type SERVER = 'https://code.calibre-ebook.com/plugins/' INDEX_URL = '%splugins.json.bz2' % SERVER @@ -267,7 +268,7 @@ class DisplayPluginSortFilterModel(QSortFilterProxyModel): self.invalidateFilter() def set_filter_text(self, filter_text_value): - self.filter_text = icu_lower(unicode(filter_text_value)) + self.filter_text = icu_lower(unicode_type(filter_text_value)) self.invalidateFilter() @@ -276,7 +277,7 @@ class DisplayPluginModel(QAbstractTableModel): def __init__(self, display_plugins): QAbstractTableModel.__init__(self) self.display_plugins = display_plugins - self.headers = map(unicode, [_('Plugin name'), _('Donate'), _('Status'), _('Installed'), + self.headers = map(unicode_type, [_('Plugin name'), _('Donate'), _('Status'), _('Installed'), _('Available'), _('Released'), _('calibre'), _('Author')]) def rowCount(self, *args): @@ -726,7 +727,7 @@ class PluginUpdaterDialog(SizePersistedDialog): plugin = add_plugin(zip_path) except NameConflict as e: return error_dialog(self.gui, _('Already exists'), - unicode(e), show=True) + unicode_type(e), show=True) # Check for any toolbars to add to. widget = ConfigWidget(self.gui) widget.gui = self.gui @@ -841,7 +842,7 @@ class PluginUpdaterDialog(SizePersistedDialog): continue if heading_node.text_content().lower().find('version history') != -1: div_node = spoiler_node.xpath('div')[0] - text = html.tostring(div_node, method='html', encoding=unicode) + text = html.tostring(div_node, method='html', encoding=unicode_type) return re.sub('', '

', text) except: if DEBUG: diff --git a/src/calibre/gui2/dialogs/progress.py b/src/calibre/gui2/dialogs/progress.py index e36bcaf5bb..bc50921431 100644 --- a/src/calibre/gui2/dialogs/progress.py +++ b/src/calibre/gui2/dialogs/progress.py @@ -9,6 +9,7 @@ from PyQt5.Qt import ( from calibre.gui2 import elided_text from calibre.gui2.progress_indicator import ProgressIndicator +from polyglot.builtins import unicode_type class ProgressDialog(QDialog): @@ -102,7 +103,7 @@ class ProgressDialog(QDialog): return self.title_label.text() def fset(self, val): - self.title_label.setText(unicode(val or '')) + self.title_label.setText(unicode_type(val or '')) return property(fget=fget, fset=fset) @dynamic_property @@ -111,7 +112,7 @@ class ProgressDialog(QDialog): return self.message.text() def fset(self, val): - val = unicode(val or '') + val = unicode_type(val or '') self.message.setText(elided_text(val, self.font(), self.message.minimumWidth()-10)) return property(fget=fget, fset=fset) diff --git a/src/calibre/gui2/dialogs/quickview.py b/src/calibre/gui2/dialogs/quickview.py index 433abb00f3..8514408eeb 100644 --- a/src/calibre/gui2/dialogs/quickview.py +++ b/src/calibre/gui2/dialogs/quickview.py @@ -17,6 +17,7 @@ from calibre.gui2.dialogs.quickview_ui import Ui_Quickview from calibre.utils.date import timestampfromdt from calibre.utils.icu import sort_key from calibre.utils.iso8601 import UNDEFINED_DATE +from polyglot.builtins import unicode_type class TableItem(QTableWidgetItem): @@ -42,7 +43,7 @@ class TableItem(QTableWidgetItem): # self is not None and other is None therefore self >= other return True - if isinstance(self.sort, (str, unicode)): + if isinstance(self.sort, (str, unicode_type)): l = sort_key(self.sort) r = sort_key(other.sort) else: @@ -65,7 +66,7 @@ class TableItem(QTableWidgetItem): # self is not None therefore self > other return False - if isinstance(self.sort, (str, unicode)): + if isinstance(self.sort, (str, unicode_type)): l = sort_key(self.sort) r = sort_key(other.sort) else: @@ -406,7 +407,7 @@ class Quickview(QDialog, Ui_Quickview): def item_selected(self, txt): if self.no_valid_items: return - self.fill_in_books_box(unicode(txt)) + self.fill_in_books_box(unicode_type(txt)) self.set_search_text(self.current_key + ':"=' + txt.replace('"', '\\"') + '"') def refresh(self, idx): @@ -455,9 +456,9 @@ class Quickview(QDialog, Ui_Quickview): self.no_valid_items = False if self.fm[key]['datatype'] == 'rating': if self.fm[key]['display'].get('allow_half_stars', False): - vals = unicode(vals/2.0) + vals = unicode_type(vals/2.0) else: - vals = unicode(vals/2) + vals = unicode_type(vals/2) if not isinstance(vals, list): vals = [vals] vals.sort(key=sort_key) diff --git a/src/calibre/gui2/dialogs/scheduler.py b/src/calibre/gui2/dialogs/scheduler.py index e3f3eee073..9180f8057f 100644 --- a/src/calibre/gui2/dialogs/scheduler.py +++ b/src/calibre/gui2/dialogs/scheduler.py @@ -26,6 +26,7 @@ from calibre.utils.date import utcnow from calibre.utils.network import internet_connected from calibre import force_unicode from calibre.utils.localization import get_lang, canonicalize_lang +from polyglot.builtins import unicode_type def convert_day_time_schedule(val): @@ -151,7 +152,7 @@ class DaysOfMonth(Base): @property def schedule(self): - parts = [x.strip() for x in unicode(self.days.text()).split(',') if + parts = [x.strip() for x in unicode_type(self.days.text()).split(',') if x.strip()] try: days_of_month = tuple(map(int, parts)) @@ -455,7 +456,7 @@ class SchedulerDialog(QDialog): return True if self.account.isVisible(): - un, pw = map(unicode, (self.username.text(), self.password.text())) + un, pw = map(unicode_type, (self.username.text(), self.password.text())) un, pw = un.strip(), pw.strip() if not un and not pw and self.schedule.isChecked(): if not getattr(self, 'subscription_optional', False): @@ -478,8 +479,8 @@ class SchedulerDialog(QDialog): add_title_tag = self.add_title_tag.isChecked() keep_issues = u'0' if self.keep_issues.isEnabled(): - keep_issues = unicode(self.keep_issues.value()) - custom_tags = unicode(self.custom_tags.text()).strip() + keep_issues = unicode_type(self.keep_issues.value()) + custom_tags = unicode_type(self.custom_tags.text()).strip() custom_tags = [x.strip() for x in custom_tags.split(',')] self.recipe_model.customize_recipe(urn, add_title_tag, custom_tags, keep_issues) return True diff --git a/src/calibre/gui2/dialogs/search.py b/src/calibre/gui2/dialogs/search.py index d929ebf6b4..92f76f110e 100644 --- a/src/calibre/gui2/dialogs/search.py +++ b/src/calibre/gui2/dialogs/search.py @@ -19,6 +19,7 @@ from calibre.utils.icu import sort_key from calibre.utils.config import tweaks from calibre.utils.date import now from calibre.utils.localization import localize_user_manual_link +from polyglot.builtins import unicode_type box_values = {} last_matchkind = CONTAINS_MATCH @@ -37,7 +38,7 @@ def init_dateop(cb): def current_dateop(cb): - return unicode(cb.itemData(cb.currentIndex()) or '') + return unicode_type(cb.itemData(cb.currentIndex()) or '') def create_msg_label(self): @@ -296,7 +297,7 @@ class SearchDialog(QDialog): return (self.adv_search_string, self.box_search_string, self.date_search_string)[i]() def date_search_string(self): - field = unicode(self.date_field.itemData(self.date_field.currentIndex()) or '') + field = unicode_type(self.date_field.itemData(self.date_field.currentIndex()) or '') op = current_dateop(self.dateop_date) prefix = '%s:%s' % (field, op) if self.sel_date.isChecked(): @@ -312,7 +313,7 @@ class SearchDialog(QDialog): val = self.date_daysago.value() val *= {0:1, 1:7, 2:30, 3:365}[self.date_ago_type.currentIndex()] return '%s%sdaysago' % (prefix, val) - return '%s%s' % (prefix, unicode(self.date_human.itemData(self.date_human.currentIndex()) or '')) + return '%s%s' % (prefix, unicode_type(self.date_human.itemData(self.date_human.currentIndex()) or '')) def adv_search_string(self): mk = self.matchkind.currentIndex() @@ -322,7 +323,7 @@ class SearchDialog(QDialog): self.mc = '=' else: self.mc = '~' - all, any, phrase, none = map(lambda x: unicode(x.text()), + all, any, phrase, none = map(lambda x: unicode_type(x.text()), (self.all, self.any, self.phrase, self.none)) all, any, none = map(self.tokens, (all, any, none)) phrase = phrase.strip() @@ -344,11 +345,11 @@ class SearchDialog(QDialog): return ans def token(self): - txt = unicode(self.text.text()).strip() + txt = unicode_type(self.text.text()).strip() if txt: if self.negate.isChecked(): txt = '!'+txt - tok = self.FIELDS[unicode(self.field.currentText())]+txt + tok = self.FIELDS[unicode_type(self.field.currentText())]+txt if re.search(r'\s', tok): tok = '"%s"'%tok return tok @@ -364,35 +365,35 @@ class SearchDialog(QDialog): ans = [] self.box_last_values = {} - title = unicode(self.title_box.text()).strip() + title = unicode_type(self.title_box.text()).strip() self.box_last_values['title_box'] = title if title: ans.append('title:"' + self.mc + title + '"') - author = unicode(self.authors_box.text()).strip() + author = unicode_type(self.authors_box.text()).strip() self.box_last_values['authors_box'] = author if author: ans.append('author:"' + self.mc + author + '"') - series = unicode(self.series_box.text()).strip() + series = unicode_type(self.series_box.text()).strip() self.box_last_values['series_box'] = series if series: ans.append('series:"' + self.mc + series + '"') - tags = unicode(self.tags_box.text()) + tags = unicode_type(self.tags_box.text()) self.box_last_values['tags_box'] = tags tags = [t.strip() for t in tags.split(',') if t.strip()] if tags: tags = ['tags:"' + self.mc + t + '"' for t in tags] ans.append('(' + ' or '.join(tags) + ')') - general = unicode(self.general_box.text()) + general = unicode_type(self.general_box.text()) self.box_last_values['general_box'] = general - general_index = unicode(self.general_combo.currentText()) + general_index = unicode_type(self.general_combo.currentText()) self.box_last_values['general_index'] = general_index global box_values global last_matchkind box_values = copy.deepcopy(self.box_last_values) last_matchkind = mk if general: - ans.append(unicode(self.general_combo.currentText()) + ':"' + + ans.append(unicode_type(self.general_combo.currentText()) + ':"' + self.mc + general + '"') if ans: return ' and '.join(ans) diff --git a/src/calibre/gui2/dialogs/smartdevice.py b/src/calibre/gui2/dialogs/smartdevice.py index 00323c5ef4..57b5ad55c3 100644 --- a/src/calibre/gui2/dialogs/smartdevice.py +++ b/src/calibre/gui2/dialogs/smartdevice.py @@ -10,6 +10,7 @@ from PyQt5.Qt import (QDialog, QLineEdit, Qt) from calibre.gui2 import error_dialog from calibre.gui2.dialogs.smartdevice_ui import Ui_Dialog from calibre.utils.mdns import get_all_ips +from polyglot.builtins import unicode_type def _cmp_ipaddr(l, r): @@ -115,7 +116,7 @@ class SmartdeviceDialog(QDialog, Ui_Dialog): Qt.Unchecked else QLineEdit.Normal) def accept(self): - port = unicode(self.fixed_port.text()) + port = unicode_type(self.fixed_port.text()) if not port: error_dialog(self, _('Invalid port number'), _('You must provide a port number.'), show=True) @@ -133,13 +134,13 @@ class SmartdeviceDialog(QDialog, Ui_Dialog): return self.device_manager.set_option('smartdevice', 'password', - unicode(self.password_box.text())) + unicode_type(self.password_box.text())) self.device_manager.set_option('smartdevice', 'autostart', self.autostart_box.isChecked()) self.device_manager.set_option('smartdevice', 'use_fixed_port', self.use_fixed_port.isChecked()) self.device_manager.set_option('smartdevice', 'port_number', - unicode(self.fixed_port.text())) + unicode_type(self.fixed_port.text())) message = self.device_manager.start_plugin('smartdevice') @@ -153,4 +154,3 @@ class SmartdeviceDialog(QDialog, Ui_Dialog): self.orig_port_number) else: QDialog.accept(self) - diff --git a/src/calibre/gui2/dialogs/tag_categories.py b/src/calibre/gui2/dialogs/tag_categories.py index d48ae9117f..783a513bec 100644 --- a/src/calibre/gui2/dialogs/tag_categories.py +++ b/src/calibre/gui2/dialogs/tag_categories.py @@ -10,6 +10,7 @@ from calibre.gui2.dialogs.confirm_delete import confirm from calibre.gui2 import error_dialog from calibre.constants import islinux from calibre.utils.icu import sort_key, strcmp +from polyglot.builtins import unicode_type class Item(object): @@ -197,7 +198,7 @@ class TagCategories(QDialog, Ui_TagCategories): def add_category(self): self.save_category() - cat_name = unicode(self.input_box.text()).strip() + cat_name = unicode_type(self.input_box.text()).strip() if cat_name == '': return False comps = [c.strip() for c in cat_name.split('.') if c.strip()] @@ -226,7 +227,7 @@ class TagCategories(QDialog, Ui_TagCategories): def rename_category(self): self.save_category() - cat_name = unicode(self.input_box.text()).strip() + cat_name = unicode_type(self.input_box.text()).strip() if cat_name == '': return False if not self.current_cat_name: @@ -267,7 +268,7 @@ class TagCategories(QDialog, Ui_TagCategories): self.save_category() s = self.category_box.itemText(idx) if s: - self.current_cat_name = unicode(s) + self.current_cat_name = unicode_type(s) else: self.current_cat_name = None self.fill_applied_items() diff --git a/src/calibre/gui2/dialogs/tag_editor.py b/src/calibre/gui2/dialogs/tag_editor.py index 822f898e24..38b6e921d7 100644 --- a/src/calibre/gui2/dialogs/tag_editor.py +++ b/src/calibre/gui2/dialogs/tag_editor.py @@ -8,6 +8,7 @@ from calibre.gui2.dialogs.tag_editor_ui import Ui_TagEditor from calibre.gui2 import question_dialog, error_dialog, gprefs from calibre.constants import islinux from calibre.utils.icu import sort_key, primary_contains +from polyglot.builtins import unicode_type class TagEditor(QDialog, Ui_TagEditor): @@ -103,15 +104,15 @@ class TagEditor(QDialog, Ui_TagEditor): return pos = self.available_tags.verticalScrollBar().value() for item in items: - used = self.db.is_tag_used(unicode(item.text())) \ + used = self.db.is_tag_used(unicode_type(item.text())) \ if self.key is None else \ - self.db.is_item_used_in_multiple(unicode(item.text()), label=self.key) + self.db.is_item_used_in_multiple(unicode_type(item.text()), label=self.key) if used: confirms.append(item) else: deletes.append(item) if confirms: - ct = ', '.join([unicode(item.text()) for item in confirms]) + ct = ', '.join([unicode_type(item.text()) for item in confirms]) if question_dialog(self, _('Are your sure?'), '

'+_('The following tags are used by one or more books. ' 'Are you certain you want to delete them?')+'
'+ct): @@ -119,9 +120,9 @@ class TagEditor(QDialog, Ui_TagEditor): for item in deletes: if self.key is None: - self.db.delete_tag(unicode(item.text())) + self.db.delete_tag(unicode_type(item.text())) else: - bks = self.db.delete_item_from_multiple(unicode(item.text()), + bks = self.db.delete_item_from_multiple(unicode_type(item.text()), label=self.key) self.db.refresh_ids(bks) self.available_tags.takeItem(self.available_tags.row(item)) @@ -135,7 +136,7 @@ class TagEditor(QDialog, Ui_TagEditor): row = max(rows) tags = self._get_applied_tags_box_contents() for item in items: - tag = unicode(item.text()) + tag = unicode_type(item.text()) tags.append(tag) self.available_tags.takeItem(self.available_tags.row(item)) @@ -158,14 +159,14 @@ class TagEditor(QDialog, Ui_TagEditor): def _get_applied_tags_box_contents(self): tags = [] for i in range(0, self.applied_tags.count()): - tags.append(unicode(self.applied_tags.item(i).text())) + tags.append(unicode_type(self.applied_tags.item(i).text())) return tags def unapply_tags(self, item=None): tags = self._get_applied_tags_box_contents() items = self.applied_tags.selectedItems() if item is None else [item] for item in items: - tag = unicode(item.text()) + tag = unicode_type(item.text()) tags.remove(tag) self.available_tags.addItem(tag) @@ -175,7 +176,7 @@ class TagEditor(QDialog, Ui_TagEditor): for tag in tags: self.applied_tags.addItem(tag) - items = [unicode(self.available_tags.item(x).text()) for x in + items = [unicode_type(self.available_tags.item(x).text()) for x in range(self.available_tags.count())] items.sort(key=sort_key) self.available_tags.clear() @@ -187,7 +188,7 @@ class TagEditor(QDialog, Ui_TagEditor): self.filter_tags(self.available_filter_input.text()) def add_tag(self): - tags = unicode(self.add_tag_input.text()).split(self.sep) + tags = unicode_type(self.add_tag_input.text()).split(self.sep) tags_in_box = self._get_applied_tags_box_contents() for tag in tags: tag = tag.strip() @@ -211,10 +212,10 @@ class TagEditor(QDialog, Ui_TagEditor): # filter tags def filter_tags(self, filter_value, which='available_tags'): collection = getattr(self, which) - q = icu_lower(unicode(filter_value)) + q = icu_lower(unicode_type(filter_value)) for i in xrange(collection.count()): # on every available tag item = collection.item(i) - item.setHidden(bool(q and not primary_contains(q, unicode(item.text())))) + item.setHidden(bool(q and not primary_contains(q, unicode_type(item.text())))) def accept(self): self.tags = self._get_applied_tags_box_contents() diff --git a/src/calibre/gui2/dialogs/tag_list_editor.py b/src/calibre/gui2/dialogs/tag_list_editor.py index 1a58316a27..b5fa904af4 100644 --- a/src/calibre/gui2/dialogs/tag_list_editor.py +++ b/src/calibre/gui2/dialogs/tag_list_editor.py @@ -8,6 +8,7 @@ from calibre.gui2.dialogs.tag_list_editor_ui import Ui_TagListEditor from calibre.gui2.dialogs.confirm_delete import confirm from calibre.gui2 import question_dialog, error_dialog, gprefs from calibre.utils.icu import sort_key +from polyglot.builtins import unicode_type class NameTableWidgetItem(QTableWidgetItem): @@ -55,10 +56,10 @@ class NameTableWidgetItem(QTableWidgetItem): QTableWidgetItem.setText(self, txt) def __ge__(self, other): - return sort_key(unicode(self.text())) >= sort_key(unicode(other.text())) + return sort_key(unicode_type(self.text())) >= sort_key(unicode_type(other.text())) def __lt__(self, other): - return sort_key(unicode(self.text())) < sort_key(unicode(other.text())) + return sort_key(unicode_type(self.text())) < sort_key(unicode_type(other.text())) class CountTableWidgetItem(QTableWidgetItem): @@ -230,12 +231,12 @@ class TagListEditor(QDialog, Ui_TagListEditor): tag = item.initial_text() self.all_tags[tag]['cur_name'] = item.text() self.all_tags[tag]['is_deleted'] = item.is_deleted - search_for = icu_lower(unicode(self.search_box.text())) + search_for = icu_lower(unicode_type(self.search_box.text())) if len(search_for) == 0: self.fill_in_table(None, None) result = [] for k in self.ordered_tags: - if search_for in icu_lower(unicode(self.all_tags[k]['cur_name'])): + if search_for in icu_lower(unicode_type(self.all_tags[k]['cur_name'])): result.append(k) self.fill_in_table(result, None) @@ -270,7 +271,7 @@ class TagListEditor(QDialog, Ui_TagListEditor): return if item.text() != item.initial_text(): id_ = int(item.data(Qt.UserRole)) - self.to_rename[id_] = unicode(item.text()) + self.to_rename[id_] = unicode_type(item.text()) orig = self.table.item(item.row(), 2) self.table.blockSignals(True) orig.setData(Qt.DisplayRole, item.initial_text()) @@ -336,13 +337,13 @@ class TagListEditor(QDialog, Ui_TagListEditor): else: to_del.append(item) if to_del: - ct = ', '.join([unicode(item.text()) for item in to_del]) + ct = ', '.join([unicode_type(item.text()) for item in to_del]) if not confirm( '

'+_('Are you sure you want to delete the following items?')+'
'+ct, 'tag_list_editor_delete'): return if to_undel: - ct = ', '.join([unicode(item.text()) for item in to_undel]) + ct = ', '.join([unicode_type(item.text()) for item in to_undel]) if not confirm( '

'+_('Are you sure you want to undelete the following items?')+'
'+ct, 'tag_list_editor_undelete'): diff --git a/src/calibre/gui2/dialogs/template_dialog.py b/src/calibre/gui2/dialogs/template_dialog.py index 8f1dc4a539..0383f047b8 100644 --- a/src/calibre/gui2/dialogs/template_dialog.py +++ b/src/calibre/gui2/dialogs/template_dialog.py @@ -20,6 +20,7 @@ from calibre.ebooks.metadata.book.formatter import SafeFormat from calibre.library.coloring import (displayable_columns, color_row_key) from calibre.gui2 import error_dialog, choose_files, pixmap_to_data from calibre.utils.localization import localize_user_manual_link +from polyglot.builtins import unicode_type class ParenPosition: @@ -134,7 +135,7 @@ class TemplateHighlighter(QSyntaxHighlighter): i = regex.indexIn(text, i + length) if self.generate_paren_positions: - t = unicode(text) + t = unicode_type(text) i = 0 foundQuote = False while i < len(t): @@ -392,15 +393,15 @@ class TemplateDialog(QDialog, Ui_TemplateDialog): def color_to_clipboard(self): app = QApplication.instance() c = app.clipboard() - c.setText(unicode(self.color_name.color)) + c.setText(unicode_type(self.color_name.color)) def icon_to_clipboard(self): app = QApplication.instance() c = app.clipboard() - c.setText(unicode(self.icon_files.currentText())) + c.setText(unicode_type(self.icon_files.currentText())) def textbox_changed(self): - cur_text = unicode(self.textbox.toPlainText()) + cur_text = unicode_type(self.textbox.toPlainText()) if self.last_text != cur_text: self.last_text = cur_text self.highlighter.regenerate_paren_positions() @@ -412,7 +413,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog): def text_cursor_changed(self): cursor = self.textbox.textCursor() position = cursor.position() - t = unicode(self.textbox.toPlainText()) + t = unicode_type(self.textbox.toPlainText()) if position > 0 and position <= len(t): block_number = cursor.blockNumber() pos_in_block = cursor.positionInBlock() - 1 @@ -420,7 +421,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog): pos_in_block) def function_changed(self, toWhat): - name = unicode(toWhat) + name = unicode_type(toWhat) self.source_code.clear() self.documentation.clear() if name in self.funcs: @@ -431,7 +432,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog): self.source_code.setPlainText(self.funcs[name].program_text) def accept(self): - txt = unicode(self.textbox.toPlainText()).rstrip() + txt = unicode_type(self.textbox.toPlainText()).rstrip() if self.coloring: if self.colored_field.currentIndex() == -1: error_dialog(self, _('No column chosen'), @@ -442,12 +443,12 @@ class TemplateDialog(QDialog, Ui_TemplateDialog): _('The template box cannot be empty'), show=True) return - self.rule = (unicode(self.colored_field.itemData( + self.rule = (unicode_type(self.colored_field.itemData( self.colored_field.currentIndex()) or ''), txt) elif self.iconing: - rt = unicode(self.icon_kind.itemData(self.icon_kind.currentIndex()) or '') + rt = unicode_type(self.icon_kind.itemData(self.icon_kind.currentIndex()) or '') self.rule = (rt, - unicode(self.icon_field.itemData( + unicode_type(self.icon_field.itemData( self.icon_field.currentIndex()) or ''), txt) elif self.embleming: diff --git a/src/calibre/gui2/dnd.py b/src/calibre/gui2/dnd.py index a46190351a..2ff0668146 100644 --- a/src/calibre/gui2/dnd.py +++ b/src/calibre/gui2/dnd.py @@ -20,6 +20,7 @@ from calibre.ptempfile import PersistentTemporaryFile from calibre import browser, as_unicode, prints from calibre.gui2 import error_dialog from calibre.utils.imghdr import what +from polyglot.builtins import unicode_type def image_extensions(): @@ -177,7 +178,7 @@ def dnd_has_extension(md, extensions, allow_all_extensions=False): if DEBUG: prints('\nDebugging DND event') for f in md.formats(): - f = unicode(f) + f = unicode_type(f) raw = data_as_string(f, md) prints(f, len(raw), repr(raw[:300]), '\n') print () @@ -207,7 +208,7 @@ def dnd_get_image(md, image_exts=None): ''' if md.hasImage(): for x in md.formats(): - x = unicode(x) + x = unicode_type(x) if x.startswith('image/'): cdata = bytes(md.data(x)) pmap = QPixmap() @@ -319,7 +320,7 @@ def _get_firefox_pair(md, exts, url, fname): def get_firefox_rurl(md, exts): - formats = frozenset([unicode(x) for x in md.formats()]) + formats = frozenset([unicode_type(x) for x in md.formats()]) url = fname = None if 'application/x-moz-file-promise-url' in formats and \ 'application/x-moz-file-promise-dest-filename' in formats: @@ -362,5 +363,3 @@ def get_firefox_rurl(md, exts): def has_firefox_ext(md, exts): return bool(get_firefox_rurl(md, exts)[0]) - - diff --git a/src/calibre/gui2/email.py b/src/calibre/gui2/email.py index 6e54bd8814..f24f131923 100644 --- a/src/calibre/gui2/email.py +++ b/src/calibre/gui2/email.py @@ -28,6 +28,7 @@ from calibre.library.save_to_disk import get_components from calibre.utils.config import tweaks, prefs from calibre.utils.icu import primary_sort_key from calibre.gui2.threaded_jobs import ThreadedJob +from polyglot.builtins import unicode_type class Worker(Thread): @@ -210,7 +211,7 @@ class SelectRecipients(QDialog): # {{{ for i, name in enumerate(('address', 'alias', 'formats', 'subject')): c = i % 2 row = l.rowCount() - c - self.labels[i].setText(unicode(self.labels[i].text()) + ':') + self.labels[i].setText(unicode_type(self.labels[i].text()) + ':') l.addWidget(self.labels[i], row, (2*c)) le = QLineEdit(self) le.setToolTip(tooltips[i]) @@ -232,11 +233,11 @@ class SelectRecipients(QDialog): # {{{ self.init_list() def add_recipient(self): - to = unicode(self.address.text()).strip() + to = unicode_type(self.address.text()).strip() if not to: return error_dialog( self, _('Need address'), _('You must specify an address'), show=True) - formats = ','.join([x.strip().upper() for x in unicode(self.formats.text()).strip().split(',') if x.strip()]) + formats = ','.join([x.strip().upper() for x in unicode_type(self.formats.text()).strip().split(',') if x.strip()]) if not formats: return error_dialog( self, _('Need formats'), _('You must specify at least one format to send'), show=True) @@ -248,11 +249,11 @@ class SelectRecipients(QDialog): # {{{ acc[to] = [formats, False, False] c = email_config() c.set('accounts', acc) - alias = unicode(self.alias.text()).strip() + alias = unicode_type(self.alias.text()).strip() if alias: opts.aliases[to] = alias c.set('aliases', opts.aliases) - subject = unicode(self.subject.text()).strip() + subject = unicode_type(self.subject.text()).strip() if subject: opts.subjects[to] = subject c.set('subjects', opts.subjects) @@ -287,7 +288,7 @@ class SelectRecipients(QDialog): # {{{ ans = [] for i in self.items: if i.checkState() == Qt.Checked: - to = unicode(i.data(Qt.UserRole) or '') + to = unicode_type(i.data(Qt.UserRole) or '') fmts = tuple(x.strip().upper() for x in (opts.accounts[to][0] or '').split(',')) subject = opts.subjects.get(to, '') ans.append((to, fmts, subject)) @@ -408,7 +409,7 @@ class EmailMixin(object): # {{{ from calibre.utils.html2text import html2text texts[-1] += '\n\n' + _('About this book:') + '\n\n' + textwrap.fill(html2text(mi.comments)) prefix = ascii_filename(t+' - '+a) - if not isinstance(prefix, unicode): + if not isinstance(prefix, unicode_type): prefix = prefix.decode(preferred_encoding, 'replace') attachment_names.append(prefix + os.path.splitext(f)[1]) remove = remove_ids if delete_from_library else [] diff --git a/src/calibre/gui2/font_family_chooser.py b/src/calibre/gui2/font_family_chooser.py index 7fb0197866..f30fddc384 100644 --- a/src/calibre/gui2/font_family_chooser.py +++ b/src/calibre/gui2/font_family_chooser.py @@ -17,6 +17,7 @@ from PyQt5.Qt import (QFontInfo, QFontMetrics, Qt, QFont, QFontDatabase, QPen, from calibre.constants import config_dir from calibre.gui2 import choose_files, error_dialog, info_dialog, empty_index +from polyglot.builtins import unicode_type def add_fonts(parent): @@ -112,7 +113,7 @@ class FontFamilyDelegate(QStyledItemDelegate): painter.restore() def do_paint(self, painter, option, index): - text = unicode(index.data(Qt.DisplayRole) or '') + text = unicode_type(index.data(Qt.DisplayRole) or '') font = QFont(option.font) font.setPointSize(QFontInfo(font).pointSize() * 1.5) font2 = QFont(font) @@ -264,7 +265,7 @@ class FontFamilyDialog(QDialog): i = self.view.currentIndex().row() if i < 0: i = 0 - q = icu_lower(unicode(self.search.text())).strip() + q = icu_lower(unicode_type(self.search.text())).strip() if not q: return r = (xrange(i-1, -1, -1) if backwards else xrange(i+1, diff --git a/src/calibre/gui2/init.py b/src/calibre/gui2/init.py index 8cae6075de..03faa4c4f0 100644 --- a/src/calibre/gui2/init.py +++ b/src/calibre/gui2/init.py @@ -25,6 +25,7 @@ from calibre.gui2.notify import get_notifier from calibre.gui2.layout_menu import LayoutMenu from calibre.customize.ui import find_plugin from calibre.utils.localization import localize_website_link +from polyglot.builtins import unicode_type _keep_refs = [] @@ -322,7 +323,7 @@ class StatusBar(QStatusBar): # {{{ def show_message(self, msg, timeout=0, show_notification=True): self.showMessage(msg, timeout) if self.notifier is not None and not config['disable_tray_notification'] and show_notification: - if isosx and isinstance(msg, unicode): + if isosx and isinstance(msg, unicode_type): try: msg = msg.encode(preferred_encoding) except UnicodeEncodeError: @@ -343,7 +344,7 @@ class GridViewButton(LayoutButton): # {{{ self.set_state_to_show() self.action_toggle = QAction(self.icon(), _('Toggle') + ' ' + self.label, self) gui.addAction(self.action_toggle) - gui.keyboard.register_shortcut('grid view toggle' + self.label, unicode(self.action_toggle.text()), + gui.keyboard.register_shortcut('grid view toggle' + self.label, unicode_type(self.action_toggle.text()), default_keys=(sc,), action=self.action_toggle) self.action_toggle.triggered.connect(self.toggle) self.action_toggle.changed.connect(self.update_shortcut) @@ -373,7 +374,7 @@ class SearchBarButton(LayoutButton): # {{{ self.set_state_to_hide() self.action_toggle = QAction(self.icon(), _('Toggle') + ' ' + self.label, self) gui.addAction(self.action_toggle) - gui.keyboard.register_shortcut('search bar toggle' + self.label, unicode(self.action_toggle.text()), + gui.keyboard.register_shortcut('search bar toggle' + self.label, unicode_type(self.action_toggle.text()), default_keys=(sc,), action=self.action_toggle) self.action_toggle.triggered.connect(self.toggle) self.action_toggle.changed.connect(self.update_shortcut) @@ -457,14 +458,14 @@ class VLTabs(QTabBar): # {{{ def tab_changed(self, idx): if self.ignore_tab_changed: return - vl = unicode(self.tabData(idx) or '').strip() or None + vl = unicode_type(self.tabData(idx) or '').strip() or None self.gui.apply_virtual_library(vl, update_tabs=False) def tab_moved(self, from_, to): - self.current_db.new_api.set_pref('virt_libs_order', [unicode(self.tabData(i) or '') for i in range(self.count())]) + self.current_db.new_api.set_pref('virt_libs_order', [unicode_type(self.tabData(i) or '') for i in range(self.count())]) def tab_close(self, index): - vl = unicode(self.tabData(index) or '') + vl = unicode_type(self.tabData(index) or '') if vl: # Dont allow closing the All Books tab self.current_db.new_api.set_pref('virt_libs_hidden', list( self.current_db.prefs['virt_libs_hidden']) + [vl]) @@ -540,7 +541,7 @@ class VLTabs(QTabBar): # {{{ m.addAction(_('Unlock virtual library tabs'), self.unlock_tab) i = self.tabAt(ev.pos()) if i > -1: - vl = unicode(self.tabData(i) or '') + vl = unicode_type(self.tabData(i) or '') if vl: m.addSeparator() m.addAction(_('Edit "%s"') % vl, partial(self.gui.do_create_edit, name=vl)) @@ -604,7 +605,7 @@ class LayoutMixin(object): # {{{ self.qv = self.qv.actual_plugin_ self.status_bar = StatusBar(self) - stylename = unicode(self.style().objectName()) + stylename = unicode_type(self.style().objectName()) self.grid_view_button = GridViewButton(self) self.search_bar_button = SearchBarButton(self) self.grid_view_button.toggled.connect(self.toggle_grid_view) diff --git a/src/calibre/gui2/jobs.py b/src/calibre/gui2/jobs.py index 9b45d0be86..9e9d1f4c3f 100644 --- a/src/calibre/gui2/jobs.py +++ b/src/calibre/gui2/jobs.py @@ -30,6 +30,7 @@ from calibre.gui2.threaded_jobs import ThreadedJobServer, ThreadedJob from calibre.gui2.widgets2 import Dialog from calibre.utils.search_query_parser import SearchQueryParser, ParseException from calibre.utils.icu import lower +from polyglot.builtins import unicode_type class AdaptSQP(SearchQueryParser): @@ -557,7 +558,7 @@ class JobsButton(QWidget): # {{{ self.pi.stopAnimation() def jobs(self): - src = unicode(self._jobs.text()) + src = unicode_type(self._jobs.text()) return int(re.search(r'\d+', src).group()) def tray_tooltip(self, num=0): @@ -573,7 +574,7 @@ class JobsButton(QWidget): # {{{ def job_added(self, nnum): jobs = self._jobs - src = unicode(jobs.text()) + src = unicode_type(jobs.text()) num = self.jobs() text = src.replace(str(num), str(nnum)) jobs.setText(text) @@ -582,7 +583,7 @@ class JobsButton(QWidget): # {{{ def job_done(self, nnum): jobs = self._jobs - src = unicode(jobs.text()) + src = unicode_type(jobs.text()) num = self.jobs() text = src.replace(str(num), str(nnum)) jobs.setText(text) diff --git a/src/calibre/gui2/keyboard.py b/src/calibre/gui2/keyboard.py index 5079cdb8ee..ebf8404a87 100644 --- a/src/calibre/gui2/keyboard.py +++ b/src/calibre/gui2/keyboard.py @@ -26,6 +26,7 @@ from calibre.utils.icu import sort_key, lower from calibre.gui2 import error_dialog, info_dialog from calibre.utils.search_query_parser import SearchQueryParser, ParseException from calibre.gui2.search_box import SearchBox2 +from polyglot.builtins import unicode_type ROOT = QModelIndex() @@ -70,7 +71,7 @@ def finalize(shortcuts, custom_keys_map={}): # {{{ keys = [] for x in candidates: ks = QKeySequence(x, QKeySequence.PortableText) - x = unicode(ks.toString(QKeySequence.PortableText)) + x = unicode_type(ks.toString(QKeySequence.PortableText)) if x in seen: if DEBUG: prints('Key %r for shortcut %s is already used by' @@ -282,7 +283,7 @@ class ConfigModel(SearchQueryParser, QAbstractItemModel): sc = node.data if sc['set_to_default']: continue - keys = [unicode(k.toString(k.PortableText)) for k in sc['keys']] + keys = [unicode_type(k.toString(k.PortableText)) for k in sc['keys']] kmap[sc['unique_name']] = keys self.keyboard.config['map'] = kmap @@ -428,11 +429,11 @@ class Editor(QFrame): # {{{ self.default_keys = [QKeySequence(k, QKeySequence.PortableText) for k in shortcut['default_keys']] self.current_keys = list(shortcut['keys']) - default = ', '.join([unicode(k.toString(k.NativeText)) for k in + default = ', '.join([unicode_type(k.toString(k.NativeText)) for k in self.default_keys]) if not default: default = _('None') - current = ', '.join([unicode(k.toString(k.NativeText)) for k in + current = ', '.join([unicode_type(k.toString(k.NativeText)) for k in self.current_keys]) if not current: current = _('None') @@ -490,7 +491,7 @@ class Editor(QFrame): # {{{ dup_desc = self.dup_check(sequence) if dup_desc is not None: error_dialog(self, _('Already assigned'), - unicode(sequence.toString(QKeySequence.NativeText)) + ' ' + _( + unicode_type(sequence.toString(QKeySequence.NativeText)) + ' ' + _( 'already assigned to') + ' ' + dup_desc, show=True) self.clear_clicked(which=which) @@ -509,7 +510,7 @@ class Editor(QFrame): # {{{ ans = [] for which in (1, 2): button = getattr(self, 'button%d'%which) - t = unicode(button.text()) + t = unicode_type(button.text()) if t == _('None'): continue ks = QKeySequence(t, QKeySequence.NativeText) @@ -536,7 +537,7 @@ class Delegate(QStyledItemDelegate): # {{{ elif data.is_shortcut: shortcut = data.data # Shortcut - keys = [unicode(k.toString(k.NativeText)) for k in shortcut['keys']] + keys = [unicode_type(k.toString(k.NativeText)) for k in shortcut['keys']] if not keys: keys = _('None') else: @@ -707,7 +708,7 @@ class ShortcutConfig(QWidget): # {{{ if not idx.isValid(): idx = self._model.index(0, 0) idx = self._model.find_next(idx, - unicode(self.search.currentText())) + unicode_type(self.search.currentText())) self.highlight_index(idx) def find_previous(self, *args): @@ -715,7 +716,7 @@ class ShortcutConfig(QWidget): # {{{ if not idx.isValid(): idx = self._model.index(0, 0) idx = self._model.find_next(idx, - unicode(self.search.currentText()), backwards=True) + unicode_type(self.search.currentText()), backwards=True) self.highlight_index(idx) def highlight_group(self, group_name): diff --git a/src/calibre/gui2/languages.py b/src/calibre/gui2/languages.py index 377cdfd00d..1f7ce4f0fd 100644 --- a/src/calibre/gui2/languages.py +++ b/src/calibre/gui2/languages.py @@ -11,6 +11,7 @@ from calibre.gui2 import gui_prefs from calibre.gui2.complete2 import EditWithComplete from calibre.utils.localization import lang_map_for_ui from calibre.utils.icu import sort_key, lower +from polyglot.builtins import unicode_type class LanguagesEdit(EditWithComplete): @@ -53,7 +54,7 @@ class LanguagesEdit(EditWithComplete): @property def vals(self): - raw = unicode(self.lineEdit().text()) + raw = unicode_type(self.lineEdit().text()) for k, v in self.comma_map.iteritems(): raw = raw.replace(k, v) parts = [x.strip() for x in raw.split(',')] diff --git a/src/calibre/gui2/layout.py b/src/calibre/gui2/layout.py index 095118904a..6c902fb9c8 100644 --- a/src/calibre/gui2/layout.py +++ b/src/calibre/gui2/layout.py @@ -18,6 +18,7 @@ from calibre.gui2.bars import BarsManager from calibre.gui2.widgets2 import RightClickButton from calibre.utils.config_base import tweaks from calibre import human_readable +from polyglot.builtins import unicode_type class LocationManager(QObject): # {{{ @@ -128,7 +129,7 @@ class LocationManager(QObject): # {{{ had_device = self.has_device if cp is None: cp = (None, None) - if isinstance(cp, (str, unicode)): + if isinstance(cp, (str, unicode_type)): cp = (cp, None) if len(fs) < 3: fs = list(fs) + [0] diff --git a/src/calibre/gui2/library/alternate_views.py b/src/calibre/gui2/library/alternate_views.py index 5b8c8bd1c8..fe7246068f 100644 --- a/src/calibre/gui2/library/alternate_views.py +++ b/src/calibre/gui2/library/alternate_views.py @@ -30,6 +30,7 @@ from calibre.gui2 import gprefs, config, rating_font, empty_index from calibre.gui2.gestures import GestureManager from calibre.gui2.library.caches import CoverCache, ThumbnailCache from calibre.utils.config import prefs, tweaks +from polyglot.builtins import unicode_type CM_TO_INCH = 0.393701 CACHE_FORMAT = 'PPM' @@ -242,7 +243,7 @@ def paths_from_event(self, event): md = event.mimeData() if md.hasFormat('text/uri-list') and not \ md.hasFormat('application/calibre+from_library'): - urls = [unicode(u.toLocalFile()) for u in md.urls()] + urls = [unicode_type(u.toLocalFile()) for u in md.urls()] return [u for u in urls if os.path.splitext(u)[1] and os.path.exists(u)] @@ -463,7 +464,7 @@ class CoverDelegate(QStyledItemDelegate): if fm and fm['datatype'] == 'rating': ans = rating_to_stars(val, fm['display'].get('allow_half_stars', False)) is_stars = True - return ('' if ans is None else unicode(ans)), is_stars + return ('' if ans is None else unicode_type(ans)), is_stars except Exception: if DEBUG: import traceback diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index 430793aab7..7c91eaec3b 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -26,6 +26,7 @@ from calibre.gui2.dialogs.comments_dialog import CommentsDialog, PlainTextDialog from calibre.gui2.dialogs.template_dialog import TemplateDialog from calibre.gui2.dialogs.tag_editor import TagEditor from calibre.gui2.languages import LanguagesEdit +from polyglot.builtins import unicode_type class UpdateEditorGeometry(object): @@ -193,7 +194,7 @@ def get_val_for_textlike_columns(index_): ct = '' else: ct = index_.data(Qt.DisplayRole) or '' - return unicode(ct) + return unicode_type(ct) # }}} @@ -611,7 +612,7 @@ class CcEnumDelegate(QStyledItemDelegate, UpdateEditorGeometry): # {{{ return editor def setModelData(self, editor, model, index): - val = unicode(editor.currentText()) + val = unicode_type(editor.currentText()) if not val: val = None model.setData(index, (val), Qt.EditRole) diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 6154e6ca31..e5d3f028ec 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -30,6 +30,7 @@ from calibre.constants import filesystem_encoding, DEBUG, config_dir from calibre.gui2.library import DEFAULT_SORT from calibre.utils.localization import calibre_langcode_to_name from calibre.library.coloring import color_row_key +from polyglot.builtins import unicode_type Counts = namedtuple('Counts', 'library_total total current') @@ -942,7 +943,7 @@ class BooksModel(QAbstractTableModel): # {{{ cc = self.custom_columns[self.column_map[col]]['display'] colors = cc.get('enum_colors', []) values = cc.get('enum_values', []) - txt = unicode(index.data(Qt.DisplayRole) or '') + txt = unicode_type(index.data(Qt.DisplayRole) or '') if len(colors) > 0 and txt in values: try: color = QColor(colors[values.index(txt)]) @@ -1055,10 +1056,10 @@ class BooksModel(QAbstractTableModel): # {{{ label=self.db.field_metadata.key_to_label(colhead) s_index = None if typ in ('text', 'comments'): - val = unicode(value or '').strip() + val = unicode_type(value or '').strip() val = val if val else None elif typ == 'enumeration': - val = unicode(value or '').strip() + val = unicode_type(value or '').strip() if not val: val = None elif typ == 'bool': @@ -1069,7 +1070,7 @@ class BooksModel(QAbstractTableModel): # {{{ if value == 0: val = '0' else: - val = unicode(value or '').strip() + val = unicode_type(value or '').strip() if not val: val = None elif typ == 'datetime': @@ -1081,7 +1082,7 @@ class BooksModel(QAbstractTableModel): # {{{ return False val = qt_to_dt(val, as_utc=False) elif typ == 'series': - val = unicode(value or '').strip() + val = unicode_type(value or '').strip() if val: pat = re.compile(r'\[([.0-9]+)\]') match = pat.search(val) @@ -1095,7 +1096,7 @@ class BooksModel(QAbstractTableModel): # {{{ s_index = self.db.get_next_cc_series_num_for(val, label=label, num=None) elif typ == 'composite': - tmpl = unicode(value or '').strip() + tmpl = unicode_type(value or '').strip() disp = cc['display'] disp['composite_template'] = tmpl self.db.set_custom_column_metadata(cc['colnum'], display=disp, @@ -1151,7 +1152,7 @@ class BooksModel(QAbstractTableModel): # {{{ return False val = (int(value) if column == 'rating' else value if column in ('timestamp', 'pubdate') - else re.sub(u'\\s', u' ', unicode(value or '').strip())) + else re.sub(u'\\s', u' ', unicode_type(value or '').strip())) id = self.db.id(row) books_to_refresh = {id} if column == 'rating': @@ -1714,7 +1715,7 @@ class DeviceBooksModel(BooksModel): # {{{ cname = self.column_map[col] if cname in ('size', 'timestamp', 'inlibrary'): return False - val = unicode(value or '').strip() + val = unicode_type(value or '').strip() idx = self.map[row] if cname == 'collections': tags = [i.strip() for i in val.split(',')] diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index d247ef3617..dca3c9e050 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en' import itertools, operator from functools import partial -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from collections import OrderedDict from PyQt5.Qt import ( @@ -73,7 +73,7 @@ class HeaderView(QHeaderView): # {{{ opt.orientation = self.orientation() opt.fontMetrics = self.fm model = self.parent().model() - opt.text = unicode(model.headerData(logical_index, opt.orientation, Qt.DisplayRole) or '') + opt.text = unicode_type(model.headerData(logical_index, opt.orientation, Qt.DisplayRole) or '') if opt.orientation == Qt.Vertical: try: val = model.headerData(logical_index, opt.orientation, Qt.DecorationRole) @@ -100,7 +100,7 @@ class HeaderView(QHeaderView): # {{{ if self.isSortIndicatorShown() and self.sortIndicatorSection() == logical_index: opt.sortIndicator = QStyleOptionHeader.SortDown if self.sortIndicatorOrder() == Qt.AscendingOrder else QStyleOptionHeader.SortUp margin += style.pixelMetric(style.PM_HeaderMarkSize, None, self) - opt.text = unicode(model.headerData(logical_index, opt.orientation, Qt.DisplayRole) or '') + opt.text = unicode_type(model.headerData(logical_index, opt.orientation, Qt.DisplayRole) or '') if self.textElideMode() != Qt.ElideNone: opt.text = opt.fontMetrics.elidedText(opt.text, Qt.ElideRight, rect.width() - margin) if self.isEnabled(): @@ -465,7 +465,7 @@ class BooksView(QTableView): # {{{ ans.addSeparator() if hidden_cols: m = ans.addMenu(_('Show column')) - hcols = [(hcol, unicode(self.model().headerData(hidx, Qt.Horizontal, Qt.DisplayRole) or '')) for hcol, hidx in hidden_cols.iteritems()] + hcols = [(hcol, unicode_type(self.model().headerData(hidx, Qt.Horizontal, Qt.DisplayRole) or '')) for hcol, hidx in hidden_cols.iteritems()] hcols.sort(key=lambda x: primary_sort_key(x[1])) for hcol, hname in hcols: m.addAction(hname, partial(handler, action='show', column=hcol)) @@ -484,7 +484,7 @@ class BooksView(QTableView): # {{{ col = None if idx > -1 and idx < len(self.column_map): col = self.column_map[idx] - name = unicode(self.model().headerData(idx, Qt.Horizontal, Qt.DisplayRole) or '') + name = unicode_type(self.model().headerData(idx, Qt.Horizontal, Qt.DisplayRole) or '') view.column_header_context_menu = self.create_context_menu(col, name, view) has_context_menu = hasattr(view, 'column_header_context_menu') if self.is_library_view and has_context_menu: @@ -625,7 +625,7 @@ class BooksView(QTableView): # {{{ def write_state(self, state): db = getattr(self.model(), 'db', None) - name = unicode(self.objectName()) + name = unicode_type(self.objectName()) if name and db is not None: db.new_api.set_pref(name + ' books view state', state) @@ -740,7 +740,7 @@ class BooksView(QTableView): # {{{ def get_old_state(self): ans = None - name = unicode(self.objectName()) + name = unicode_type(self.objectName()) if name: name += ' books view state' db = getattr(self.model(), 'db', None) @@ -1308,14 +1308,14 @@ class DeviceBooksView(BooksView): # {{{ def get_old_state(self): ans = None - name = unicode(self.objectName()) + name = unicode_type(self.objectName()) if name: name += ' books view state' ans = gprefs.get(name, None) return ans def write_state(self, state): - name = unicode(self.objectName()) + name = unicode_type(self.objectName()) if name: gprefs.set(name + ' books view state', state) diff --git a/src/calibre/gui2/linux_file_dialogs.py b/src/calibre/gui2/linux_file_dialogs.py index b834e079fc..a012ae25c4 100644 --- a/src/calibre/gui2/linux_file_dialogs.py +++ b/src/calibre/gui2/linux_file_dialogs.py @@ -11,7 +11,7 @@ import sys import time from threading import Thread -from polyglot.builtins import reraise +from polyglot.builtins import reraise, unicode_type from PyQt5.Qt import QEventLoop from calibre import force_unicode @@ -84,7 +84,7 @@ def save_initial_dir(name, title, ans, no_save_dir, is_file=False): def encode_arg(title): - if isinstance(title, unicode): + if isinstance(title, unicode_type): try: title = title.encode(preferred_encoding) except UnicodeEncodeError: diff --git a/src/calibre/gui2/lrf_renderer/main.py b/src/calibre/gui2/lrf_renderer/main.py index f1c62bc417..985babf440 100644 --- a/src/calibre/gui2/lrf_renderer/main.py +++ b/src/calibre/gui2/lrf_renderer/main.py @@ -17,6 +17,7 @@ from calibre.gui2.lrf_renderer.config_ui import Ui_ViewerConfig from calibre.gui2.main_window import MainWindow from calibre.gui2.lrf_renderer.document import Document from calibre.gui2.search_box import SearchBox2 +from polyglot.builtins import unicode_type class RenderWorker(QThread): @@ -200,7 +201,7 @@ class Main(MainWindow, Ui_MainWindow): print('Error rendering document', file=sys.stderr) print(exception, file=sys.stderr) print(self.renderer.formatted_traceback, file=sys.stderr) - msg = u'

%s: '%(exception.__class__.__name__,) + unicode(str(exception), 'utf8', 'replace') + u'

' + msg = u'

%s: '%(exception.__class__.__name__,) + unicode_type(str(exception), 'utf8', 'replace') + u'

' msg += u'

Failed to render document

' msg += u'

Detailed traceback:

'
             msg += self.renderer.formatted_traceback + '
' diff --git a/src/calibre/gui2/lrf_renderer/text.py b/src/calibre/gui2/lrf_renderer/text.py index 3bcbe21b1e..8e30c0162c 100644 --- a/src/calibre/gui2/lrf_renderer/text.py +++ b/src/calibre/gui2/lrf_renderer/text.py @@ -10,6 +10,7 @@ from PyQt5.Qt import ( from calibre.ebooks.lrf.fonts import LIBERATION_FONT_MAP from calibre.ebooks.BeautifulSoup import Tag from calibre.ebooks.hyphenate import hyphenate_word +from polyglot.builtins import unicode_type WEIGHT_MAP = lambda wt : int((wt/10.)-1) NULL = lambda a, b: a @@ -533,12 +534,12 @@ class Line(QGraphicsItem): while True: word = words.next() word.highlight = False - if tokens[0] in unicode(word.string).lower(): + if tokens[0] in unicode_type(word.string).lower(): matches.append(word) for c in range(1, len(tokens)): word = words.next() print(tokens[c], word.string) - if tokens[c] not in unicode(word.string): + if tokens[c] not in unicode_type(word.string): return None matches.append(word) for w in matches: @@ -561,11 +562,11 @@ class Line(QGraphicsItem): if isinstance(tok, (int, float)): s += ' ' elif isinstance(tok, Word): - s += unicode(tok.string) + s += unicode_type(tok.string) return s def __str__(self): - return unicode(self).encode('utf-8') + return unicode_type(self).encode('utf-8') class Word(object): diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 9f15f8de68..99bcc5c4b4 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -28,6 +28,7 @@ from calibre.utils.config import dynamic, prefs from calibre.utils.ipc import RC, gui_socket_address from calibre.utils.lock import singleinstance from calibre.utils.monotonic import monotonic +from polyglot.builtins import unicode_type if iswindows: winutil = plugins['winutil'][0] @@ -129,7 +130,7 @@ def get_default_library_path(): fname = _('Calibre Library') if iswindows: fname = 'Calibre Library' - if isinstance(fname, unicode): + if isinstance(fname, unicode_type): try: fname = fname.encode(filesystem_encoding) except: @@ -149,7 +150,7 @@ def get_library_path(gui_runner): base = os.path.expanduser('~') if not base or not os.path.exists(base): from PyQt5.Qt import QDir - base = unicode(QDir.homePath()).replace('/', os.sep) + base = unicode_type(QDir.homePath()).replace('/', os.sep) candidate = gui_runner.choose_dir(base) if not candidate: candidate = os.path.join(base, 'Calibre Library') @@ -583,6 +584,6 @@ if __name__ == '__main__': log = open(logfile).read().decode('utf-8', 'ignore') d = QErrorMessage() d.showMessage(('Error:%s
Traceback:
' - '%sLog:
%s')%(unicode(err), - unicode(tb).replace('\n', '
'), + '%sLog:
%s')%(unicode_type(err), + unicode_type(tb).replace('\n', '
'), log.replace('\n', '
'))) diff --git a/src/calibre/gui2/main_window.py b/src/calibre/gui2/main_window.py index c0cc2c80b1..be4c90c7a8 100644 --- a/src/calibre/gui2/main_window.py +++ b/src/calibre/gui2/main_window.py @@ -12,6 +12,7 @@ from PyQt5.Qt import (QMainWindow, QTimer, QAction, QMenu, QMenuBar, QIcon, from calibre.utils.config import OptionParser from calibre.gui2 import error_dialog from calibre import prints +from polyglot.builtins import unicode_type def option_parser(usage='''\ @@ -144,7 +145,7 @@ class MainWindow(QMainWindow): prints(value.locking_debug_msg, file=sio) fe = sio.getvalue() prints(fe, file=sys.stderr) - msg = '%s:'%type.__name__ + unicode(str(value), 'utf8', 'replace') + msg = '%s:'%type.__name__ + unicode_type(str(value), 'utf8', 'replace') error_dialog(self, _('Unhandled exception'), msg, det_msg=fe, show=True) except BaseException: diff --git a/src/calibre/gui2/metadata/basic_widgets.py b/src/calibre/gui2/metadata/basic_widgets.py index 2b41ac384e..0cacf6f85a 100644 --- a/src/calibre/gui2/metadata/basic_widgets.py +++ b/src/calibre/gui2/metadata/basic_widgets.py @@ -41,6 +41,7 @@ from calibre.ptempfile import PersistentTemporaryFile, SpooledTemporaryFile from calibre.gui2.languages import LanguagesEdit as LE from calibre.db import SPOOL_SIZE from calibre.ebooks.oeb.polish.main import SUPPORTED as EDIT_SUPPORTED +from polyglot.builtins import unicode_type OK_COLOR = 'rgba(0, 255, 0, 12%)' ERR_COLOR = 'rgba(255, 0, 0, 12%)' @@ -228,7 +229,7 @@ class TitleEdit(EnLineEdit, ToMetadataMixin): def current_val(self): def fget(self): - title = clean_text(unicode(self.text())) + title = clean_text(unicode_type(self.text())) if not title: title = self.get_default() return title.strip() @@ -419,7 +420,7 @@ class AuthorsEdit(EditWithComplete, ToMetadataMixin): def current_val(self): def fget(self): - au = clean_text(unicode(self.text())) + au = clean_text(unicode_type(self.text())) if not au: au = self.get_default() return string_to_authors(au) @@ -488,7 +489,7 @@ class AuthorSortEdit(EnLineEdit, ToMetadataMixin): def current_val(self): def fget(self): - return clean_text(unicode(self.text())) + return clean_text(unicode_type(self.text())) def fset(self, val): if not val: @@ -510,7 +511,7 @@ class AuthorSortEdit(EnLineEdit, ToMetadataMixin): return self.db.new_api.author_sort_from_authors(authors, key_func=lambda x: x) def update_state(self, *args): - au = unicode(self.authors_edit.text()) + au = unicode_type(self.authors_edit.text()) au = re.sub(r'\s+et al\.$', '', au) au = self.author_sort_from_authors(string_to_authors(au)) @@ -537,13 +538,13 @@ class AuthorSortEdit(EnLineEdit, ToMetadataMixin): self.authors_edit.current_val = ans def auto_generate(self, *args): - au = unicode(self.authors_edit.text()) + au = unicode_type(self.authors_edit.text()) au = re.sub(r'\s+et al\.$', '', au).strip() authors = string_to_authors(au) self.current_val = self.author_sort_from_authors(authors) def author_to_sort(self, *args): - au = unicode(self.authors_edit.text()) + au = unicode_type(self.authors_edit.text()) au = re.sub(r'\s+et al\.$', '', au).strip() if au: self.current_val = au @@ -616,7 +617,7 @@ class SeriesEdit(EditWithComplete, ToMetadataMixin): def current_val(self): def fget(self): - return clean_text(unicode(self.currentText())) + return clean_text(unicode_type(self.currentText())) def fset(self, val): if not val: @@ -1392,7 +1393,7 @@ class TagsEdit(EditWithComplete, ToMetadataMixin): # {{{ @dynamic_property def current_val(self): def fget(self): - return [clean_text(x) for x in unicode(self.text()).split(',')] + return [clean_text(x) for x in unicode_type(self.text()).split(',')] def fset(self, val): if not val: @@ -1564,7 +1565,7 @@ class IdentifiersEdit(QLineEdit, ToMetadataMixin): @dynamic_property def current_val(self): def fget(self): - raw = unicode(self.text()).strip() + raw = unicode_type(self.text()).strip() parts = [clean_text(x) for x in raw.split(',')] ans = {} for x in parts: @@ -1638,14 +1639,14 @@ class IdentifiersEdit(QLineEdit, ToMetadataMixin): if prefix == 'isbn': self.paste_isbn() else: - text = unicode(QApplication.clipboard().text()).strip() + text = unicode_type(QApplication.clipboard().text()).strip() if text: vals = self.current_val vals[prefix] = text self.current_val = vals def paste_isbn(self): - text = unicode(QApplication.clipboard().text()).strip() + text = unicode_type(QApplication.clipboard().text()).strip() if not text or not check_isbn(text): d = ISBNDialog(self, text) if not d.exec_(): @@ -1665,7 +1666,7 @@ class IdentifiersEdit(QLineEdit, ToMetadataMixin): def parse_clipboard_for_identifier(self): from calibre.ebooks.metadata.sources.prefs import msprefs from calibre.utils.formatter import EvalFormatter - text = unicode(QApplication.clipboard().text()).strip() + text = unicode_type(QApplication.clipboard().text()).strip() if not text: return False @@ -1733,7 +1734,7 @@ class ISBNDialog(QDialog): # {{{ self.resize(sz) def accept(self): - isbn = unicode(self.line_edit.text()) + isbn = unicode_type(self.line_edit.text()) if not check_isbn(isbn): return error_dialog(self, _('Invalid ISBN'), _('The ISBN you entered is not valid. Try again.'), @@ -1741,7 +1742,7 @@ class ISBNDialog(QDialog): # {{{ QDialog.accept(self) def checkText(self, txt): - isbn = unicode(txt) + isbn = unicode_type(txt) if not isbn: col = 'none' extra = '' @@ -1755,7 +1756,7 @@ class ISBNDialog(QDialog): # {{{ self.line_edit.setStyleSheet(INDICATOR_SHEET % col) def text(self): - return check_isbn(unicode(self.line_edit.text())) + return check_isbn(unicode_type(self.line_edit.text())) # }}} @@ -1781,7 +1782,7 @@ class PublisherEdit(EditWithComplete, ToMetadataMixin): # {{{ def current_val(self): def fget(self): - return clean_text(unicode(self.currentText())) + return clean_text(unicode_type(self.currentText())) def fset(self, val): if not val: diff --git a/src/calibre/gui2/metadata/config.py b/src/calibre/gui2/metadata/config.py index c4a68e4d04..2667d4a966 100644 --- a/src/calibre/gui2/metadata/config.py +++ b/src/calibre/gui2/metadata/config.py @@ -14,6 +14,7 @@ from PyQt5.Qt import (QWidget, QGridLayout, QGroupBox, QListView, Qt, QSpinBox, from calibre.gui2.preferences.metadata_sources import FieldsModel as FM from calibre.utils.icu import sort_key +from polyglot.builtins import unicode_type class FieldsModel(FM): # {{{ @@ -126,10 +127,10 @@ class ConfigWidget(QWidget): if isinstance(w, (QSpinBox, QDoubleSpinBox)): val = w.value() elif isinstance(w, QLineEdit): - val = unicode(w.text()) + val = unicode_type(w.text()) elif isinstance(w, QCheckBox): val = w.isChecked() elif isinstance(w, QComboBox): idx = w.currentIndex() - val = unicode(w.itemData(idx) or '') + val = unicode_type(w.itemData(idx) or '') self.plugin.prefs[w.opt.name] = val diff --git a/src/calibre/gui2/metadata/diff.py b/src/calibre/gui2/metadata/diff.py index db442d1936..01606711ce 100644 --- a/src/calibre/gui2/metadata/diff.py +++ b/src/calibre/gui2/metadata/diff.py @@ -9,7 +9,7 @@ __copyright__ = '2013, Kovid Goyal ' import os, weakref from collections import OrderedDict, namedtuple from functools import partial -from polyglot.builtins import zip +from polyglot.builtins import zip, unicode_type from PyQt5.Qt import ( QDialog, QWidget, QGridLayout, QLabel, QToolButton, QIcon, @@ -52,7 +52,7 @@ class LineEdit(EditWithComplete): @dynamic_property def value(self): def fget(self): - val = unicode(self.text()).strip() + val = unicode_type(self.text()).strip() ism = self.metadata['is_multiple'] if ism: if not val: @@ -88,7 +88,7 @@ class LineEdit(EditWithComplete): @dynamic_property def current_val(self): def fget(self): - return unicode(self.text()) + return unicode_type(self.text()) def fset(self, val): self.setText(val) @@ -212,7 +212,7 @@ class SeriesEdit(LineEdit): self.setCursorPosition(0) def to_mi(self, mi): - val = unicode(self.text()).strip() + val = unicode_type(self.text()).strip() try: series_index = float(val.rpartition('[')[-1].rstrip(']').strip()) except: diff --git a/src/calibre/gui2/metadata/pdf_covers.py b/src/calibre/gui2/metadata/pdf_covers.py index 920628259c..5b9ce0129b 100644 --- a/src/calibre/gui2/metadata/pdf_covers.py +++ b/src/calibre/gui2/metadata/pdf_covers.py @@ -25,6 +25,7 @@ from calibre.ebooks.metadata.pdf import page_images from calibre.gui2 import error_dialog, file_icon_provider from calibre.ptempfile import PersistentTemporaryDirectory from calibre.gui2.progress_indicator import WaitLayout +from polyglot.builtins import unicode_type class CoverDelegate(QStyledItemDelegate): @@ -88,9 +89,9 @@ class PDFCovers(QDialog): @property def cover_path(self): for item in self.covers.selectedItems(): - return unicode(item.data(Qt.UserRole) or '') + return unicode_type(item.data(Qt.UserRole) or '') if self.covers.count() > 0: - return unicode(self.covers.item(0).data(Qt.UserRole) or '') + return unicode_type(self.covers.item(0).data(Qt.UserRole) or '') def cleanup(self): try: diff --git a/src/calibre/gui2/metadata/single_download.py b/src/calibre/gui2/metadata/single_download.py index 1b3a188517..ed3ed1cd04 100644 --- a/src/calibre/gui2/metadata/single_download.py +++ b/src/calibre/gui2/metadata/single_download.py @@ -40,6 +40,7 @@ from calibre import force_unicode from calibre.utils.config import tweaks from calibre.utils.ipc.simple_worker import fork_job, WorkerError from calibre.ptempfile import TemporaryDirectory +from polyglot.builtins import unicode_type # }}} @@ -153,7 +154,7 @@ class ResultsModel(QAbstractTableModel): # {{{ def data_as_text(self, book, col): if col == 0: - return unicode(book.gui_rank+1) + return unicode_type(book.gui_rank+1) if col == 1: t = book.title if book.title else _('Unknown') a = authors_to_string(book.authors) if book.authors else '' @@ -343,12 +344,12 @@ class Comments(QWebView): # {{{ if col.isValid(): col = col.toRgb() if col.isValid(): - ans = unicode(col.name()) + ans = unicode_type(col.name()) return ans fi = QFontInfo(QApplication.font(self.parent())) f = fi.pixelSize()+1+int(tweaks['change_book_details_font_size_by']) - fam = unicode(fi.family()).strip().replace('"', '') + fam = unicode_type(fi.family()).strip().replace('"', '') if not fam: fam = 'sans-serif' @@ -513,7 +514,7 @@ class IdentifyWidget(QWidget): # {{{ if 'isbn' in identifiers: simple_desc += 'ISBN: %s' % identifiers['isbn'] self.query.setText(simple_desc) - self.log(unicode(self.query.text())) + self.log(unicode_type(self.query.text())) self.worker = IdentifyWorker(self.log, self.abort, title, authors, identifiers, self.caches) @@ -842,7 +843,7 @@ class CoversView(QListView): # {{{ pmap = self.model().cc if pmap is not None: from calibre.gui2.viewer.image_popup import ImageView - d = ImageView(self, pmap, unicode(idx.data(Qt.DisplayRole) or ''), geom_name='metadata_download_cover_popup_geom') + d = ImageView(self, pmap, unicode_type(idx.data(Qt.DisplayRole) or ''), geom_name='metadata_download_cover_popup_geom') d(use_exec=True) def copy_cover(self): diff --git a/src/calibre/gui2/notify.py b/src/calibre/gui2/notify.py index ae06954641..779ada9a62 100644 --- a/src/calibre/gui2/notify.py +++ b/src/calibre/gui2/notify.py @@ -10,6 +10,7 @@ __docformat__ = 'restructuredtext en' import time from calibre import prints from calibre.constants import islinux, isosx, get_osx_version, DEBUG +from polyglot.builtins import unicode_type class Notifier(object): @@ -106,7 +107,7 @@ class QtNotifier(Notifier): try: hide = False try: - if not isinstance(body, unicode): + if not isinstance(body, unicode_type): body = body.decode('utf-8') if isosx and not self.systray.isVisible(): self.systray.show() @@ -144,7 +145,7 @@ class AppleNotifier(Notifier): def notify(self, body, summary): def encode(x): - if isinstance(x, unicode): + if isinstance(x, unicode_type): x = x.encode('utf-8') return x diff --git a/src/calibre/gui2/preferences/__init__.py b/src/calibre/gui2/preferences/__init__.py index 833d2dff80..4b87413192 100644 --- a/src/calibre/gui2/preferences/__init__.py +++ b/src/calibre/gui2/preferences/__init__.py @@ -14,6 +14,7 @@ from PyQt5.Qt import (QWidget, pyqtSignal, QCheckBox, QAbstractSpinBox, from calibre.customize.ui import preferences_plugins from calibre.utils.config import ConfigProxy from calibre.gui2.complete2 import EditWithComplete +from polyglot.builtins import unicode_type class AbortCommit(Exception): @@ -118,15 +119,15 @@ class Setting(object): raise ValueError('Unknown data type %s' % self.gui_obj.__class__) if isinstance(self.config_obj, ConfigProxy) and \ - not unicode(self.gui_obj.toolTip()): + not unicode_type(self.gui_obj.toolTip()): h = self.config_obj.help(self.name) if h: self.gui_obj.setToolTip(h) - tt = unicode(self.gui_obj.toolTip()) + tt = unicode_type(self.gui_obj.toolTip()) if tt: - if not unicode(self.gui_obj.whatsThis()): + if not unicode_type(self.gui_obj.whatsThis()): self.gui_obj.setWhatsThis(tt) - if not unicode(self.gui_obj.statusTip()): + if not unicode_type(self.gui_obj.statusTip()): self.gui_obj.setStatusTip(tt) tt = '\n'.join(textwrap.wrap(tt, 70)) self.gui_obj.setToolTip(tt) @@ -194,17 +195,17 @@ class Setting(object): elif self.datatype == 'number': val = self.gui_obj.value() elif self.datatype == 'string': - val = unicode(self.gui_obj.text()).strip() + val = unicode_type(self.gui_obj.text()).strip() if self.empty_string_is_None and not val: val = None elif self.datatype == 'choice': if isinstance(self.gui_obj, EditWithComplete): - val = unicode(self.gui_obj.text()) + val = unicode_type(self.gui_obj.text()) else: idx = self.gui_obj.currentIndex() if idx < 0: idx = 0 - val = unicode(self.gui_obj.itemData(idx) or '') + val = unicode_type(self.gui_obj.itemData(idx) or '') return val @@ -217,7 +218,7 @@ class CommaSeparatedList(Setting): self.gui_obj.setText(x) def get_gui_val(self): - val = unicode(self.gui_obj.text()).strip() + val = unicode_type(self.gui_obj.text()).strip() ans = [] if val: ans = [x.strip() for x in val.split(',')] diff --git a/src/calibre/gui2/preferences/adding.py b/src/calibre/gui2/preferences/adding.py index 2bdc2c1b5d..d2ae8f547f 100644 --- a/src/calibre/gui2/preferences/adding.py +++ b/src/calibre/gui2/preferences/adding.py @@ -16,6 +16,7 @@ from calibre.utils.config import prefs from calibre.gui2.widgets import FilenamePattern from calibre.gui2.auto_add import AUTO_ADDED from calibre.gui2 import gprefs, choose_dir, error_dialog, question_dialog +from polyglot.builtins import unicode_type class ConfigWidget(ConfigWidgetBase, Ui_Form): @@ -131,7 +132,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): viewer = self.opt_blocked_auto_formats for i in range(viewer.count()): if viewer.item(i).checkState() == Qt.Checked: - fmts.append(unicode(viewer.item(i).text())) + fmts.append(unicode_type(viewer.item(i).text())) return fmts # }}} @@ -144,7 +145,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.add_filter_rules = [] def commit(self): - path = unicode(self.opt_auto_add_path.text()).strip() + path = unicode_type(self.opt_auto_add_path.text()).strip() if path != gprefs['auto_add_path']: if path: path = os.path.abspath(path) diff --git a/src/calibre/gui2/preferences/behavior.py b/src/calibre/gui2/preferences/behavior.py index 6f7e56596a..b9a1fcfd47 100644 --- a/src/calibre/gui2/preferences/behavior.py +++ b/src/calibre/gui2/preferences/behavior.py @@ -18,6 +18,7 @@ from calibre.ebooks import BOOK_EXTENSIONS from calibre.ebooks.oeb.iterator import is_supported from calibre.constants import iswindows from calibre.utils.icu import sort_key +from polyglot.builtins import unicode_type class OutputFormatSetting(Setting): @@ -83,7 +84,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): def commit(self): input_map = prefs['input_format_order'] - input_cols = [unicode(self.opt_input_order.item(i).data(Qt.UserRole) or '') for + input_cols = [unicode_type(self.opt_input_order.item(i).data(Qt.UserRole) or '') for i in range(self.opt_input_order.count())] if input_map != input_cols: prefs['input_format_order'] = input_cols @@ -128,7 +129,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): viewer = self.opt_internally_viewed_formats for i in range(viewer.count()): if viewer.item(i).checkState() == Qt.Checked: - fmts.append(unicode(viewer.item(i).text())) + fmts.append(unicode_type(viewer.item(i).text())) return fmts # }}} diff --git a/src/calibre/gui2/preferences/coloring.py b/src/calibre/gui2/preferences/coloring.py index 5efb4a08d5..ee14634c1b 100644 --- a/src/calibre/gui2/preferences/coloring.py +++ b/src/calibre/gui2/preferences/coloring.py @@ -26,6 +26,7 @@ from calibre.library.coloring import (Rule, conditionable_columns, displayable_columns, rule_from_template, color_row_key) from calibre.utils.localization import lang_map from calibre.utils.icu import lower +from polyglot.builtins import unicode_type all_columns_string = _('All columns') @@ -141,11 +142,11 @@ class ConditionEditor(QWidget): # {{{ def current_col(self): def fget(self): idx = self.column_box.currentIndex() - return unicode(self.column_box.itemData(idx) or '') + return unicode_type(self.column_box.itemData(idx) or '') def fset(self, val): for idx in range(self.column_box.count()): - c = unicode(self.column_box.itemData(idx) or '') + c = unicode_type(self.column_box.itemData(idx) or '') if c == val: self.column_box.setCurrentIndex(idx) return @@ -156,11 +157,11 @@ class ConditionEditor(QWidget): # {{{ def current_action(self): def fget(self): idx = self.action_box.currentIndex() - return unicode(self.action_box.itemData(idx) or '') + return unicode_type(self.action_box.itemData(idx) or '') def fset(self, val): for idx in range(self.action_box.count()): - c = unicode(self.action_box.itemData(idx) or '') + c = unicode_type(self.action_box.itemData(idx) or '') if c == val: self.action_box.setCurrentIndex(idx) return @@ -169,7 +170,7 @@ class ConditionEditor(QWidget): # {{{ @property def current_val(self): - ans = unicode(self.value_box.text()).strip() + ans = unicode_type(self.value_box.text()).strip() if self.current_col == 'languages': rmap = {lower(v):k for k, v in lang_map().iteritems()} ans = rmap.get(lower(ans), ans) @@ -491,8 +492,8 @@ class RuleEditor(QDialog): # {{{ def update_color_label(self): pal = QApplication.palette() - bg1 = unicode(pal.color(pal.Base).name()) - bg2 = unicode(pal.color(pal.AlternateBase).name()) + bg1 = unicode_type(pal.color(pal.Base).name()) + bg2 = unicode_type(pal.color(pal.AlternateBase).name()) c = self.color_box.color self.color_label.setText('''  {st}  @@ -548,10 +549,10 @@ class RuleEditor(QDialog): # {{{ for i in range(1, model.rowCount()): item = model.item(i, 0) if item.checkState() == Qt.Checked: - fnames.append(lower(unicode(item.text()))) + fnames.append(lower(unicode_type(item.text()))) fname = ' : '.join(fnames) else: - fname = lower(unicode(self.filename_box.currentText())) + fname = lower(unicode_type(self.filename_box.currentText())) return fname def update_icon_filenames_in_box(self): @@ -610,7 +611,7 @@ class RuleEditor(QDialog): # {{{ self.update_icon_filenames_in_box() for i in range(self.column_box.count()): - c = unicode(self.column_box.itemData(i) or '') + c = unicode_type(self.column_box.itemData(i) or '') if col == c: self.column_box.setCurrentIndex(i) break @@ -664,13 +665,13 @@ class RuleEditor(QDialog): # {{{ else: r.color = self.color_box.color idx = self.column_box.currentIndex() - col = unicode(self.column_box.itemData(idx) or '') + col = unicode_type(self.column_box.itemData(idx) or '') for c in self.conditions: condition = c.condition if condition is not None: r.add_condition(*condition) if self.rule_kind == 'icon': - kind = unicode(self.kind_box.itemData( + kind = unicode_type(self.kind_box.itemData( self.kind_box.currentIndex()) or '') else: kind = self.rule_kind diff --git a/src/calibre/gui2/preferences/columns.py b/src/calibre/gui2/preferences/columns.py index f504641c8d..0cd0fe5bea 100644 --- a/src/calibre/gui2/preferences/columns.py +++ b/src/calibre/gui2/preferences/columns.py @@ -14,6 +14,7 @@ from calibre.gui2.preferences import ConfigWidgetBase, test_widget from calibre.gui2.preferences.columns_ui import Ui_Form from calibre.gui2.preferences.create_custom_column import CreateCustomColumn from calibre.gui2 import error_dialog, question_dialog, ALL_COLUMNS +from polyglot.builtins import unicode_type class ConfigWidget(ConfigWidgetBase, Ui_Form): @@ -192,7 +193,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): if idx < 0: return error_dialog(self, '', _('You must select a column to delete it'), show=True) - col = unicode(self.opt_columns.item(idx, 0).data(Qt.UserRole) or '') + col = unicode_type(self.opt_columns.item(idx, 0).data(Qt.UserRole) or '') if col not in self.custcols: return error_dialog(self, '', _('The selected column is not a custom column'), show=True) @@ -221,7 +222,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): model = self.gui.library_view.model() row = self.opt_columns.currentRow() try: - key = unicode(self.opt_columns.item(row, 0).data(Qt.UserRole)) + key = unicode_type(self.opt_columns.item(row, 0).data(Qt.UserRole)) except: key = '' CreateCustomColumn(self, row, key, model.orig_headers, ALL_COLUMNS) @@ -234,12 +235,12 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): def apply_custom_column_changes(self): model = self.gui.library_view.model() db = model.db - config_cols = [unicode(self.opt_columns.item(i, 0).data(Qt.UserRole) or '') + config_cols = [unicode_type(self.opt_columns.item(i, 0).data(Qt.UserRole) or '') for i in range(self.opt_columns.rowCount())] if not config_cols: config_cols = ['title'] removed_cols = set(model.column_map) - set(config_cols) - hidden_cols = {unicode(self.opt_columns.item(i, 0).data(Qt.UserRole) or '') + hidden_cols = {unicode_type(self.opt_columns.item(i, 0).data(Qt.UserRole) or '') for i in range(self.opt_columns.rowCount()) if self.opt_columns.item(i, 0).checkState()==Qt.Unchecked} hidden_cols = hidden_cols.union(removed_cols) # Hide removed cols diff --git a/src/calibre/gui2/preferences/create_custom_column.py b/src/calibre/gui2/preferences/create_custom_column.py index e315f47ff3..a67fe945e7 100644 --- a/src/calibre/gui2/preferences/create_custom_column.py +++ b/src/calibre/gui2/preferences/create_custom_column.py @@ -16,6 +16,7 @@ from PyQt5.Qt import ( ) from calibre.gui2 import error_dialog +from polyglot.builtins import unicode_type class CreateCustomColumn(QDialog): @@ -112,7 +113,7 @@ class CreateCustomColumn(QDialog): self.column_type_box.addItem(self.column_types[t]['text']) self.column_type_box.currentIndexChanged.connect(self.datatype_changed) - all_colors = [unicode(s) for s in list(QColor.colorNames())] + all_colors = [unicode_type(s) for s in list(QColor.colorNames())] self.enum_colors_label.setToolTip('

' + ', '.join(all_colors) + '

') if not self.editing_col: @@ -185,7 +186,7 @@ class CreateCustomColumn(QDialog): self.exec_() def shortcut_activated(self, url): # {{{ - which = unicode(url).split(':')[-1] + which = unicode_type(url).split(':')[-1] self.column_type_box.setCurrentIndex({ 'yesno': self.column_types_map['bool'], 'tags' : self.column_types_map['*text'], @@ -464,7 +465,7 @@ class CreateCustomColumn(QDialog): self.allow_half_stars.setVisible(col_type == 'rating') def accept(self): - col = unicode(self.column_name_box.text()).strip() + col = unicode_type(self.column_name_box.text()).strip() if not col: return self.simple_error('', _('No lookup name was provided')) if col.startswith('#'): @@ -475,7 +476,7 @@ class CreateCustomColumn(QDialog): if col.endswith('_index'): return self.simple_error('', _('Lookup names cannot end with _index, ' 'because these names are reserved for the index of a series column.')) - col_heading = unicode(self.column_heading_box.text()).strip() + col_heading = unicode_type(self.column_heading_box.text()).strip() coldef = self.column_types[self.column_type_box.currentIndex()] col_type = coldef['datatype'] if col_type[0] == '*': @@ -511,33 +512,33 @@ class CreateCustomColumn(QDialog): display_dict = {} if col_type == 'datetime': - if unicode(self.format_box.text()).strip(): - display_dict = {'date_format':unicode(self.format_box.text()).strip()} + if unicode_type(self.format_box.text()).strip(): + display_dict = {'date_format':unicode_type(self.format_box.text()).strip()} else: display_dict = {'date_format': None} elif col_type == 'composite': - if not unicode(self.composite_box.text()).strip(): + if not unicode_type(self.composite_box.text()).strip(): return self.simple_error('', _('You must enter a template for' ' composite columns')) - display_dict = {'composite_template':unicode(self.composite_box.text()).strip(), + display_dict = {'composite_template':unicode_type(self.composite_box.text()).strip(), 'composite_sort': ['text', 'number', 'date', 'bool'] [self.composite_sort_by.currentIndex()], 'make_category': self.composite_make_category.isChecked(), 'contains_html': self.composite_contains_html.isChecked(), } elif col_type == 'enumeration': - if not unicode(self.enum_box.text()).strip(): + if not unicode_type(self.enum_box.text()).strip(): return self.simple_error('', _('You must enter at least one' ' value for enumeration columns')) - l = [v.strip() for v in unicode(self.enum_box.text()).split(',') if v.strip()] + l = [v.strip() for v in unicode_type(self.enum_box.text()).split(',') if v.strip()] l_lower = [v.lower() for v in l] for i,v in enumerate(l_lower): if v in l_lower[i+1:]: return self.simple_error('', _('The value "{0}" is in the ' 'list more than once, perhaps with different case').format(l[i])) - c = unicode(self.enum_colors.text()) + c = unicode_type(self.enum_colors.text()) if c: - c = [v.strip() for v in unicode(self.enum_colors.text()).split(',')] + c = [v.strip() for v in unicode_type(self.enum_colors.text()).split(',')] else: c = [] if len(c) != 0 and len(c) != len(l): @@ -552,8 +553,8 @@ class CreateCustomColumn(QDialog): elif col_type == 'text' and is_multiple: display_dict = {'is_names': self.is_names.isChecked()} elif col_type in ['int', 'float']: - if unicode(self.format_box.text()).strip(): - display_dict = {'number_format':unicode(self.format_box.text()).strip()} + if unicode_type(self.format_box.text()).strip(): + display_dict = {'number_format':unicode_type(self.format_box.text()).strip()} else: display_dict = {'number_format': None} elif col_type == 'comments': diff --git a/src/calibre/gui2/preferences/emailp.py b/src/calibre/gui2/preferences/emailp.py index 09ec17c46b..bbe8bed228 100644 --- a/src/calibre/gui2/preferences/emailp.py +++ b/src/calibre/gui2/preferences/emailp.py @@ -17,6 +17,7 @@ from calibre.utils.config import ConfigProxy from calibre.utils.icu import numeric_sort_key from calibre.gui2 import gprefs from calibre.utils.smtp import config as smtp_prefs +from polyglot.builtins import unicode_type class EmailAccounts(QAbstractTableModel): # {{{ @@ -30,12 +31,12 @@ class EmailAccounts(QAbstractTableModel): # {{{ self.sorted_on = (0, True) self.account_order = self.accounts.keys() self.do_sort() - self.headers = map(unicode, [_('Email'), _('Formats'), _('Subject'), + self.headers = map(unicode_type, [_('Email'), _('Formats'), _('Subject'), _('Auto send'), _('Alias'), _('Auto send only tags')]) self.default_font = QFont() self.default_font.setBold(True) self.default_font = (self.default_font) - self.tooltips =[None] + list(map(unicode, map(textwrap.fill, + self.tooltips =[None] + list(map(unicode_type, map(textwrap.fill, [_('Formats to email. The first matching format will be sent.'), _('Subject of the email to use when sending. When left blank ' 'the title will be used for the subject. Also, the same ' @@ -136,21 +137,21 @@ class EmailAccounts(QAbstractTableModel): # {{{ if col == 3: self.accounts[account][1] ^= True elif col == 2: - self.subjects[account] = unicode(value or '') + self.subjects[account] = unicode_type(value or '') elif col == 4: self.aliases.pop(account, None) - aval = unicode(value or '').strip() + aval = unicode_type(value or '').strip() if aval: self.aliases[account] = aval elif col == 5: self.tags.pop(account, None) - aval = unicode(value or '').strip() + aval = unicode_type(value or '').strip() if aval: self.tags[account] = aval elif col == 1: - self.accounts[account][0] = re.sub(',+', ',', re.sub(r'\s+', ',', unicode(value or '').upper())) + self.accounts[account][0] = re.sub(',+', ',', re.sub(r'\s+', ',', unicode_type(value or '').upper())) elif col == 0: - na = unicode(value or '') + na = unicode_type(value or '') from email.utils import parseaddr addr = parseaddr(na)[-1] if not addr: diff --git a/src/calibre/gui2/preferences/history.py b/src/calibre/gui2/preferences/history.py index 96a9519b6d..dc1ab07f50 100644 --- a/src/calibre/gui2/preferences/history.py +++ b/src/calibre/gui2/preferences/history.py @@ -11,6 +11,7 @@ import textwrap from PyQt5.Qt import QComboBox, Qt from calibre.gui2 import config as gui_conf +from polyglot.builtins import unicode_type class HistoryBox(QComboBox): @@ -37,14 +38,11 @@ class HistoryBox(QComboBox): self.setCurrentIndex(self.findText(val, Qt.MatchFixedString)) def save_history(self, opt_name): - history = [unicode(self.itemText(i)) for i in range(self.count())] + history = [unicode_type(self.itemText(i)) for i in range(self.count())] ct = self.text() if ct not in history: history = [ct] + history gui_conf[opt_name] = history[:10] def text(self): - return unicode(self.currentText()).strip() - - - + return unicode_type(self.currentText()).strip() diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py index 7a771b3202..0ba64accf0 100644 --- a/src/calibre/gui2/preferences/look_feel.py +++ b/src/calibre/gui2/preferences/look_feel.py @@ -36,6 +36,7 @@ from calibre.gui2.preferences.coloring import EditRules from calibre.gui2.library.alternate_views import auto_height, CM_TO_INCH from calibre.gui2.widgets2 import Dialog from calibre.gui2.actions.show_quickview import get_quickview_action_plugin +from polyglot.builtins import unicode_type class BusyCursor(object): @@ -541,8 +542,8 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.tabWidget.setCurrentIndex(0) keys = [QKeySequence('F11', QKeySequence.PortableText), QKeySequence( 'Ctrl+Shift+F', QKeySequence.PortableText)] - keys = [unicode(x.toString(QKeySequence.NativeText)) for x in keys] - self.fs_help_msg.setText(unicode(self.fs_help_msg.text())%( + keys = [unicode_type(x.toString(QKeySequence.NativeText)) for x in keys] + self.fs_help_msg.setText(unicode_type(self.fs_help_msg.text())%( _(' or ').join(keys))) self.size_calculated.connect(self.update_cg_cache_size, type=Qt.QueuedConnection) self.tabWidget.currentChanged.connect(self.tab_changed) @@ -727,7 +728,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): def update_font_display(self): font = self.build_font_obj() fi = QFontInfo(font) - name = unicode(fi.family()) + name = unicode_type(fi.family()) self.font_display.setFont(font) self.font_display.setText(name + ' [%dpt]'%fi.pointSize()) @@ -737,7 +738,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): if fd.exec_() == fd.Accepted: font = fd.selectedFont() fi = QFontInfo(font) - self.current_font = [unicode(fi.family()), fi.pointSize(), + self.current_font = [unicode_type(fi.family()), fi.pointSize(), fi.weight(), fi.italic(), font.stretch()] self.update_font_display() self.changed_signal.emit() diff --git a/src/calibre/gui2/preferences/main.py b/src/calibre/gui2/preferences/main.py index 78aa064ca8..3b8cc99c45 100644 --- a/src/calibre/gui2/preferences/main.py +++ b/src/calibre/gui2/preferences/main.py @@ -21,6 +21,7 @@ from calibre.gui2 import (gprefs, min_available_height, available_width, from calibre.gui2.dialogs.message_box import Icon from calibre.gui2.preferences import init_gui, AbortCommit, get_plugin from calibre.customize.ui import preferences_plugins +from polyglot.builtins import unicode_type ICON_SIZE = 32 @@ -293,8 +294,8 @@ class Preferences(QDialog): if isinstance(g, QLabel): buddy = g.buddy() if buddy is not None and hasattr(buddy, 'toolTip'): - htext = unicode(buddy.toolTip()).strip() - etext = unicode(g.toolTip()).strip() + htext = unicode_type(buddy.toolTip()).strip() + etext = unicode_type(g.toolTip()).strip() if htext and not etext: g.setToolTip(htext) g.setWhatsThis(htext) diff --git a/src/calibre/gui2/preferences/plugboard.py b/src/calibre/gui2/preferences/plugboard.py index 40f7457437..5005e87735 100644 --- a/src/calibre/gui2/preferences/plugboard.py +++ b/src/calibre/gui2/preferences/plugboard.py @@ -24,6 +24,7 @@ from calibre.library.save_to_disk import plugboard_any_format_value, \ from calibre.srv.content import plugboard_content_server_value, plugboard_content_server_formats from calibre.gui2.email import plugboard_email_value, plugboard_email_formats from calibre.utils.formatter import validation_formatter +from polyglot.builtins import unicode_type class ConfigWidget(ConfigWidgetBase, Ui_Form): @@ -153,7 +154,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.clear_fields(new_boxes=False) return self.clear_fields(new_boxes=True) - self.current_device = unicode(txt) + self.current_device = unicode_type(txt) fpb = self.current_plugboards.get(self.current_format, None) if fpb is None: print('edit_device_changed: none format!') @@ -176,7 +177,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.clear_fields(new_boxes=False) return self.clear_fields(new_boxes=True) - txt = unicode(txt) + txt = unicode_type(txt) fpb = self.current_plugboards.get(txt, None) if fpb is None: print('edit_format_changed: none editable format!') @@ -208,7 +209,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.clear_fields(edit_boxes=False) return self.clear_fields(edit_boxes=True) - self.current_device = unicode(txt) + self.current_device = unicode_type(txt) if self.current_format in self.current_plugboards and \ self.current_device in self.current_plugboards[self.current_format]: @@ -292,7 +293,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.new_device.setCurrentIndex(0) if txt: self.clear_fields(edit_boxes=True) - self.current_format = unicode(txt) + self.current_format = unicode_type(txt) self.check_if_writer_disabled(self.current_format) else: self.clear_fields(edit_boxes=False) @@ -301,7 +302,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): pb = [] comments_in_dests = False for i in range(0, len(self.source_widgets)): - s = unicode(self.source_widgets[i].text()) + s = unicode_type(self.source_widgets[i].text()) if s: d = self.dest_widgets[i].currentIndex() if d != 0: diff --git a/src/calibre/gui2/preferences/plugins.py b/src/calibre/gui2/preferences/plugins.py index 24be3fcd5e..704cbc39c6 100644 --- a/src/calibre/gui2/preferences/plugins.py +++ b/src/calibre/gui2/preferences/plugins.py @@ -22,6 +22,7 @@ from calibre.gui2.dialogs.confirm_delete import confirm from calibre.utils.search_query_parser import SearchQueryParser from calibre.utils.icu import lower from calibre.constants import iswindows +from polyglot.builtins import unicode_type class AdaptSQP(SearchQueryParser): @@ -271,7 +272,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): if not idx.isValid(): idx = self._plugin_model.index(0, 0) idx = self._plugin_model.find_next(idx, - unicode(self.search.currentText())) + unicode_type(self.search.currentText())) self.highlight_index(idx) def find_previous(self, *args): @@ -279,7 +280,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): if not idx.isValid(): idx = self._plugin_model.index(0, 0) idx = self._plugin_model.find_next(idx, - unicode(self.search.currentText()), backwards=True) + unicode_type(self.search.currentText()), backwards=True) self.highlight_index(idx) def toggle_plugin(self, *args): @@ -317,7 +318,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): plugin = add_plugin(path) except NameConflict as e: return error_dialog(self, _('Already exists'), - unicode(e), show=True) + unicode_type(e), show=True) self._plugin_model.beginResetModel() self._plugin_model.populate() self._plugin_model.endResetModel() @@ -339,7 +340,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): index = self.plugin_view.currentIndex() if index.isValid(): if not index.parent().isValid(): - name = unicode(index.data() or '') + name = unicode_type(index.data() or '') return error_dialog(self, _('Error'), '

'+ _('Select an actual plugin under %s to customize')%name, show=True, show_copy_button=False) diff --git a/src/calibre/gui2/preferences/save_template.py b/src/calibre/gui2/preferences/save_template.py index 237dc25045..374d089214 100644 --- a/src/calibre/gui2/preferences/save_template.py +++ b/src/calibre/gui2/preferences/save_template.py @@ -13,6 +13,7 @@ from calibre.gui2.preferences.save_template_ui import Ui_Form from calibre.library.save_to_disk import FORMAT_ARG_DESCS, preprocess_template from calibre.utils.formatter import validation_formatter from calibre.gui2.dialogs.template_dialog import TemplateDialog +from polyglot.builtins import unicode_type class SaveTemplate(QWidget, Ui_Form): @@ -82,6 +83,6 @@ class SaveTemplate(QWidget, Ui_Form): self.opt_template.set_value(val) def save_settings(self, config, name): - val = unicode(self.opt_template.text()) + val = unicode_type(self.opt_template.text()) config.set(name, val) self.opt_template.save_history(self.option_name+'_template_history') diff --git a/src/calibre/gui2/preferences/search.py b/src/calibre/gui2/preferences/search.py index 03741ac0be..7384075e02 100644 --- a/src/calibre/gui2/preferences/search.py +++ b/src/calibre/gui2/preferences/search.py @@ -14,6 +14,7 @@ from calibre.gui2 import config, error_dialog, gprefs from calibre.utils.config import prefs from calibre.utils.icu import sort_key from calibre.library.caches import set_use_primary_find_in_search +from polyglot.builtins import unicode_type class ConfigWidget(ConfigWidgetBase, Ui_Form): @@ -143,13 +144,13 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): def gst_save_clicked(self): idx = self.gst_names.currentIndex() - name = icu_lower(unicode(self.gst_names.currentText())) + name = icu_lower(unicode_type(self.gst_names.currentText())) if not name: return error_dialog(self.gui, _('Grouped search terms'), _('The search term cannot be blank'), show=True) if idx != 0: - orig_name = unicode(self.gst_names.itemData(idx) or '') + orig_name = unicode_type(self.gst_names.itemData(idx) or '') else: orig_name = '' if name != orig_name: @@ -163,7 +164,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): _('That name is already used for User category'), show=True) - val = [v.strip() for v in unicode(self.gst_value.text()).split(',') if v.strip()] + val = [v.strip() for v in unicode_type(self.gst_value.text()).split(',') if v.strip()] if not val: return error_dialog(self.gui, _('Grouped search terms'), _('The value box cannot be empty'), show=True) @@ -180,7 +181,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): if self.gst_names.currentIndex() == 0: return error_dialog(self.gui, _('Grouped search terms'), _('The empty grouped search term cannot be deleted'), show=True) - name = unicode(self.gst_names.currentText()) + name = unicode_type(self.gst_names.currentText()) if name in self.gst: del self.gst[name] self.fill_gst_box(select='') @@ -215,7 +216,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): if idx == 0: self.gst_value.setText('') else: - name = unicode(self.gst_names.itemData(idx) or '') + name = unicode_type(self.gst_names.itemData(idx) or '') self.gst_value.setText(','.join(self.gst[name])) self.gst_value.blockSignals(False) @@ -229,13 +230,13 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.db.new_api.set_pref('grouped_search_terms', self.gst) self.db.field_metadata.add_grouped_search_terms(self.gst) self.db.new_api.set_pref('similar_authors_search_key', - unicode(self.similar_authors_search_key.currentText())) + unicode_type(self.similar_authors_search_key.currentText())) self.db.new_api.set_pref('similar_tags_search_key', - unicode(self.similar_tags_search_key.currentText())) + unicode_type(self.similar_tags_search_key.currentText())) self.db.new_api.set_pref('similar_series_search_key', - unicode(self.similar_series_search_key.currentText())) + unicode_type(self.similar_series_search_key.currentText())) self.db.new_api.set_pref('similar_publisher_search_key', - unicode(self.similar_publisher_search_key.currentText())) + unicode_type(self.similar_publisher_search_key.currentText())) return ConfigWidgetBase.commit(self) def refresh_gui(self, gui): diff --git a/src/calibre/gui2/preferences/template_functions.py b/src/calibre/gui2/preferences/template_functions.py index f33c6627d1..e89afe0066 100644 --- a/src/calibre/gui2/preferences/template_functions.py +++ b/src/calibre/gui2/preferences/template_functions.py @@ -16,6 +16,7 @@ from calibre.gui2.widgets import PythonHighlighter from calibre.utils.formatter_functions import (formatter_functions, compile_user_function, compile_user_template_functions, load_user_template_functions) +from polyglot.builtins import unicode_type class ConfigWidget(ConfigWidgetBase, Ui_Form): @@ -133,7 +134,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.delete_button.setEnabled(True) def delete_button_clicked(self): - name = unicode(self.function_name.currentText()) + name = unicode_type(self.function_name.currentText()) if name in self.builtins: error_dialog(self.gui, _('Template functions'), _('You cannot delete a built-in function'), show=True) @@ -150,7 +151,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): def create_button_clicked(self): self.changed_signal.emit() - name = unicode(self.function_name.currentText()) + name = unicode_type(self.function_name.currentText()) if name in self.funcs: error_dialog(self.gui, _('Template functions'), _('Name %s already used')%(name,), show=True) @@ -166,8 +167,8 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): if not box.exec_(): return try: - prog = unicode(self.program.toPlainText()) - cls = compile_user_function(name, unicode(self.documentation.toPlainText()), + prog = unicode_type(self.program.toPlainText()) + cls = compile_user_function(name, unicode_type(self.documentation.toPlainText()), self.argument_count.value(), prog) self.funcs[name] = cls self.build_function_names_box(scroll_to=name) @@ -184,7 +185,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.program.setReadOnly(False) def function_index_changed(self, txt): - txt = unicode(txt) + txt = unicode_type(txt) self.create_button.setEnabled(False) if not txt: self.argument_count.clear() diff --git a/src/calibre/gui2/preferences/texture_chooser.py b/src/calibre/gui2/preferences/texture_chooser.py index bf50e95ac6..fa45a7b94c 100644 --- a/src/calibre/gui2/preferences/texture_chooser.py +++ b/src/calibre/gui2/preferences/texture_chooser.py @@ -15,6 +15,7 @@ from PyQt5.Qt import ( from calibre.constants import config_dir from calibre.gui2 import choose_files, error_dialog from calibre.utils.icu import sort_key +from polyglot.builtins import unicode_type def texture_dir(): @@ -84,7 +85,7 @@ class TextureChooser(QDialog): self.update_remove_state() if initial: - existing = {unicode(i.data(Qt.UserRole) or ''):i for i in (self.images.item(c) for c in xrange(self.images.count()))} + existing = {unicode_type(i.data(Qt.UserRole) or ''):i for i in (self.images.item(c) for c in xrange(self.images.count()))} item = existing.get(initial, None) if item is not None: item.setSelected(True) @@ -115,7 +116,7 @@ class TextureChooser(QDialog): path = path[0] fname = os.path.basename(path) name = fname.rpartition('.')[0] - existing = {unicode(i.data(Qt.UserRole) or ''):i for i in (self.images.item(c) for c in xrange(self.images.count()))} + existing = {unicode_type(i.data(Qt.UserRole) or ''):i for i in (self.images.item(c) for c in xrange(self.images.count()))} dest = os.path.join(self.tdir, fname) with open(path, 'rb') as s, open(dest, 'wb') as f: shutil.copyfileobj(s, f) @@ -134,7 +135,7 @@ class TextureChooser(QDialog): @property def selected_fname(self): try: - return unicode(self.selected_item.data(Qt.UserRole) or '') + return unicode_type(self.selected_item.data(Qt.UserRole) or '') except (AttributeError, TypeError): pass @@ -144,7 +145,7 @@ class TextureChooser(QDialog): if self.selected_fname.startswith(':'): return error_dialog(self, _('Cannot remove'), _('Cannot remove builtin textures'), show=True) - os.remove(unicode(self.selected_item.data(Qt.UserRole+1) or '')) + os.remove(unicode_type(self.selected_item.data(Qt.UserRole+1) or '')) self.images.takeItem(self.images.row(self.selected_item)) diff --git a/src/calibre/gui2/preferences/toolbar.py b/src/calibre/gui2/preferences/toolbar.py index e528c814f3..43d3a62492 100644 --- a/src/calibre/gui2/preferences/toolbar.py +++ b/src/calibre/gui2/preferences/toolbar.py @@ -12,6 +12,7 @@ from calibre.gui2.preferences.toolbar_ui import Ui_Form from calibre.gui2 import gprefs, warning_dialog, error_dialog from calibre.gui2.preferences import ConfigWidgetBase, test_widget, AbortCommit from calibre.utils.icu import primary_sort_key +from polyglot.builtins import unicode_type class FakeAction(object): @@ -277,7 +278,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.help_text.setText(tt) def what_changed(self, idx): - key = unicode(self.what.itemData(idx) or '') + key = unicode_type(self.what.itemData(idx) or '') if key == 'blank': self.actions_widget.setVisible(False) self.spacer_widget.setVisible(True) diff --git a/src/calibre/gui2/preferences/tweaks.py b/src/calibre/gui2/preferences/tweaks.py index d89e3171be..61e1a2d7b4 100644 --- a/src/calibre/gui2/preferences/tweaks.py +++ b/src/calibre/gui2/preferences/tweaks.py @@ -19,6 +19,7 @@ from calibre import isbytestring from calibre.utils.icu import lower from calibre.utils.search_query_parser import (ParseException, SearchQueryParser) +from polyglot.builtins import unicode_type from PyQt5.Qt import ( QAbstractListModel, Qt, QStyledItemDelegate, QStyle, QStyleOptionViewItem, @@ -99,7 +100,7 @@ class Tweak(object): # {{{ val = self.custom_values.get(key, val) ans.append('%s = %r'%(key, val)) ans = '\n'.join(ans) - if isinstance(ans, unicode): + if isinstance(ans, unicode_type): ans = ans.encode('utf-8') return ans @@ -489,7 +490,7 @@ class ConfigWidget(ConfigWidgetBase): if d.exec_() == d.Accepted: g, l = {}, {} try: - exec(unicode(d.edit.toPlainText()), g, l) + exec(unicode_type(d.edit.toPlainText()), g, l) except: import traceback return error_dialog(self, _('Failed'), @@ -530,7 +531,7 @@ class ConfigWidget(ConfigWidgetBase): if idx.isValid(): l, g = {}, {} try: - exec(unicode(self.edit_tweak.toPlainText()), g, l) + exec(unicode_type(self.edit_tweak.toPlainText()), g, l) except: import traceback error_dialog(self.gui, _('Failed'), @@ -586,7 +587,7 @@ class ConfigWidget(ConfigWidgetBase): if not idx.isValid(): idx = self._model.index(0) idx = self._model.find_next(idx, - unicode(self.search.currentText())) + unicode_type(self.search.currentText())) self.highlight_index(idx) def find_previous(self, *args): @@ -594,7 +595,7 @@ class ConfigWidget(ConfigWidgetBase): if not idx.isValid(): idx = self._model.index(0) idx = self._model.find_next(idx, - unicode(self.search.currentText()), backwards=True) + unicode_type(self.search.currentText()), backwards=True) self.highlight_index(idx) diff --git a/src/calibre/gui2/proceed.py b/src/calibre/gui2/proceed.py index a8cd4647b7..d06211c6a0 100644 --- a/src/calibre/gui2/proceed.py +++ b/src/calibre/gui2/proceed.py @@ -16,6 +16,7 @@ from PyQt5.Qt import ( from calibre.constants import __version__ from calibre.gui2.dialogs.message_box import ViewLog +from polyglot.builtins import unicode_type Question = namedtuple('Question', 'payload callback cancel_callback ' 'title msg html_log log_viewer_title log_is_file det_msg ' @@ -170,9 +171,9 @@ class ProceedQuestion(QWidget): def copy_to_clipboard(self, *args): QApplication.clipboard().setText( 'calibre, version %s\n%s: %s\n\n%s' % - (__version__, unicode(self.windowTitle()), - unicode(self.msg_label.text()), - unicode(self.det_msg.toPlainText()))) + (__version__, unicode_type(self.windowTitle()), + unicode_type(self.msg_label.text()), + unicode_type(self.det_msg.toPlainText()))) self.copy_button.setText(_('Copied')) def action_clicked(self): @@ -210,7 +211,7 @@ class ProceedQuestion(QWidget): self.show_question() def toggle_det_msg(self, *args): - vis = unicode(self.det_msg_toggle.text()) == self.hide_det_msg + vis = unicode_type(self.det_msg_toggle.text()) == self.hide_det_msg self.det_msg_toggle.setText(self.show_det_msg if vis else self.hide_det_msg) self.det_msg.setVisible(not vis) diff --git a/src/calibre/gui2/qt_file_dialogs.py b/src/calibre/gui2/qt_file_dialogs.py index 2b0ed66e5d..632e243789 100644 --- a/src/calibre/gui2/qt_file_dialogs.py +++ b/src/calibre/gui2/qt_file_dialogs.py @@ -11,6 +11,7 @@ from PyQt5.Qt import QFileDialog, QObject from calibre.gui2.linux_file_dialogs import dialog_name, image_extensions from calibre.utils.filenames import expanduser +from polyglot.builtins import unicode_type def select_initial_dir(q): @@ -96,7 +97,7 @@ class FileDialog(QObject): ftext, "", opts) if fs and fs[0]: for f in fs[0]: - f = unicode(f) + f = unicode_type(f) if not f: continue if not os.path.exists(f): @@ -108,11 +109,11 @@ class FileDialog(QObject): else: if mode == QFileDialog.Directory: opts |= QFileDialog.ShowDirsOnly - f = unicode(QFileDialog.getExistingDirectory(parent, title, initial_dir, opts)) + f = unicode_type(QFileDialog.getExistingDirectory(parent, title, initial_dir, opts)) if os.path.exists(f): self.selected_files.append(f) if self.selected_files: - self.selected_files = [unicode(q) for q in self.selected_files] + self.selected_files = [unicode_type(q) for q in self.selected_files] saved_loc = self.selected_files[0] if os.path.isfile(saved_loc): saved_loc = os.path.dirname(saved_loc) @@ -122,7 +123,7 @@ class FileDialog(QObject): def get_files(self): if self.selected_files is None: - return tuple(os.path.abspath(unicode(i)) for i in self.fd.selectedFiles()) + return tuple(os.path.abspath(unicode_type(i)) for i in self.fd.selectedFiles()) return tuple(self.selected_files) diff --git a/src/calibre/gui2/save.py b/src/calibre/gui2/save.py index bc0b9a0e7a..1c268c7fe7 100644 --- a/src/calibre/gui2/save.py +++ b/src/calibre/gui2/save.py @@ -25,6 +25,7 @@ from calibre.gui2.dialogs.progress import ProgressDialog from calibre.utils.formatter_functions import load_user_template_functions from calibre.utils.ipc.pool import Pool, Failure from calibre.library.save_to_disk import sanitize_args, get_path_components, find_plugboard, plugboard_save_to_disk_value +from polyglot.builtins import unicode_type BookId = namedtuple('BookId', 'title authors') @@ -158,7 +159,7 @@ class Saver(QObject): except Failure as err: error_dialog(self.pd, _('Critical failure'), _( 'Could not save books to disk, click "Show details" for more information'), - det_msg=unicode(err.failure_message) + '\n' + unicode(err.details), show=True) + det_msg=unicode_type(err.failure_message) + '\n' + unicode_type(err.details), show=True) self.pd.canceled = True self.do_one_signal.emit() @@ -272,7 +273,7 @@ class Saver(QObject): except Failure as err: error_dialog(self.pd, _('Critical failure'), _( 'Could not save books to disk, click "Show details" for more information'), - det_msg=unicode(err.failure_message) + '\n' + unicode(err.details), show=True) + det_msg=unicode_type(err.failure_message) + '\n' + unicode_type(err.details), show=True) self.pd.canceled = True else: self.pd.value += 1 @@ -306,7 +307,7 @@ class Saver(QObject): except Failure as err: error_dialog(self.pd, _('Critical failure'), _( 'Could not save books to disk, click "Show details" for more information'), - det_msg=unicode(err.failure_message) + '\n' + unicode(err.details), show=True) + det_msg=unicode_type(err.failure_message) + '\n' + unicode_type(err.details), show=True) self.pd.canceled = True except RuntimeError: pass # tasks not completed diff --git a/src/calibre/gui2/search_box.py b/src/calibre/gui2/search_box.py index c95a8d5d32..c8c011b7d5 100644 --- a/src/calibre/gui2/search_box.py +++ b/src/calibre/gui2/search_box.py @@ -20,14 +20,15 @@ from calibre.gui2.dialogs.confirm_delete import confirm from calibre.gui2.dialogs.saved_search_editor import SavedSearchEditor from calibre.gui2.dialogs.search import SearchDialog from calibre.utils.icu import primary_sort_key +from polyglot.builtins import unicode_type QT_HIDDEN_CLEAR_ACTION = '_q_qlineeditclearaction' -class AsYouType(unicode): +class AsYouType(unicode_type): def __new__(cls, text): - self = unicode.__new__(cls, text) + self = unicode_type.__new__(cls, text) self.as_you_type = True return self @@ -185,7 +186,7 @@ class SearchBox2(QComboBox): # {{{ if isinstance(ok, basestring): self.setToolTip(ok) ok = False - if not unicode(self.currentText()).strip(): + if not unicode_type(self.currentText()).strip(): self.clear(emit_search=False) return self._in_a_search = ok @@ -208,7 +209,7 @@ class SearchBox2(QComboBox): # {{{ if event.key() in (Qt.Key_Return, Qt.Key_Enter): self.do_search() self.focus_to_library.emit() - elif self.as_you_type and unicode(event.text()): + elif self.as_you_type and unicode_type(event.text()): self.timer.start(1500) # Comes from the combobox itself @@ -240,7 +241,7 @@ class SearchBox2(QComboBox): # {{{ def _do_search(self, store_in_history=True, as_you_type=False): self.hide_completer_popup() - text = unicode(self.currentText()).strip() + text = unicode_type(self.currentText()).strip() if not text: return self.clear() if as_you_type: @@ -258,7 +259,7 @@ class SearchBox2(QComboBox): # {{{ self.insertItem(0, t) self.setCurrentIndex(0) self.block_signals(False) - history = [unicode(self.itemText(i)) for i in + history = [unicode_type(self.itemText(i)) for i in range(self.count())] config[self.opt_name] = history @@ -301,7 +302,7 @@ class SearchBox2(QComboBox): # {{{ @property def current_text(self): - return unicode(self.lineEdit().text()) + return unicode_type(self.lineEdit().text()) # }}} @@ -365,7 +366,7 @@ class SavedSearchBox(QComboBox): # {{{ def saved_search_selected(self, qname): from calibre.gui2.ui import get_gui db = get_gui().current_db - qname = unicode(qname) + qname = unicode_type(qname) if qname is None or not qname.strip(): self.search_box.clear() return @@ -392,9 +393,9 @@ class SavedSearchBox(QComboBox): # {{{ def save_search_button_clicked(self): from calibre.gui2.ui import get_gui db = get_gui().current_db - name = unicode(self.currentText()) + name = unicode_type(self.currentText()) if not name.strip(): - name = unicode(self.search_box.text()).replace('"', '') + name = unicode_type(self.search_box.text()).replace('"', '') name = name.replace('\\', '') if not name: error_dialog(self, _('Create saved search'), @@ -406,7 +407,7 @@ class SavedSearchBox(QComboBox): # {{{ _('There is no search to save'), show=True) return db.saved_search_delete(name) - db.saved_search_add(name, unicode(self.search_box.text())) + db.saved_search_add(name, unicode_type(self.search_box.text())) # now go through an initialization cycle to ensure that the combobox has # the new search in it, that it is selected, and that the search box # references the new search instead of the text in the search. @@ -427,10 +428,10 @@ class SavedSearchBox(QComboBox): # {{{ 'permanently deleted. Are you sure?') + '

', 'saved_search_delete', self): return - ss = db.saved_search_lookup(unicode(self.currentText())) + ss = db.saved_search_lookup(unicode_type(self.currentText())) if ss is None: return - db.saved_search_delete(unicode(self.currentText())) + db.saved_search_delete(unicode_type(self.currentText())) self.clear() self.search_box.clear() self.changed.emit() @@ -442,7 +443,7 @@ class SavedSearchBox(QComboBox): # {{{ idx = self.currentIndex() if idx < 0: return - self.search_box.set_search_string(db.saved_search_lookup(unicode(self.currentText()))) + self.search_box.set_search_string(db.saved_search_lookup(unicode_type(self.currentText()))) # }}} @@ -466,7 +467,7 @@ class SearchBoxMixin(object): # {{{ self.search.setMaximumWidth(self.width()-150) self.action_focus_search = QAction(self) shortcuts = list( - map(lambda x:unicode(x.toString(QKeySequence.PortableText)), + map(lambda x:unicode_type(x.toString(QKeySequence.PortableText)), QKeySequence.keyBindings(QKeySequence.Find))) shortcuts += ['/', 'Alt+S'] self.keyboard.register_shortcut('start search', _('Start search'), @@ -474,7 +475,7 @@ class SearchBoxMixin(object): # {{{ self.action_focus_search.triggered.connect(self.focus_search_box) self.addAction(self.action_focus_search) self.search.setStatusTip(re.sub(r'<\w+>', ' ', - unicode(self.search.toolTip()))) + unicode_type(self.search.toolTip()))) self.set_highlight_only_button_icon() self.highlight_only_button.clicked.connect(self.highlight_only_clicked) tt = _('Enable or disable search highlighting.') + '

' diff --git a/src/calibre/gui2/search_restriction_mixin.py b/src/calibre/gui2/search_restriction_mixin.py index ba7f512e30..b6c4bd5c7d 100644 --- a/src/calibre/gui2/search_restriction_mixin.py +++ b/src/calibre/gui2/search_restriction_mixin.py @@ -18,6 +18,7 @@ from calibre.gui2.widgets import ComboBoxWithHelp from calibre.utils.icu import sort_key from calibre.utils.search_query_parser import ParseException from calibre.utils.localization import localize_user_manual_link +from polyglot.builtins import unicode_type class SelectNames(QDialog): # {{{ @@ -51,7 +52,7 @@ class SelectNames(QDialog): # {{{ @property def names(self): for item in self._names.selectedItems(): - yield unicode(item.data(Qt.DisplayRole) or '') + yield unicode_type(item.data(Qt.DisplayRole) or '') @property def match_type(self): @@ -185,7 +186,7 @@ class CreateVirtualLibrary(QDialog): # {{{ def search_text_changed(self, txt): db = self.gui.current_db searches = [_('Saved searches recognized in the expression:')] - txt = unicode(txt) + txt = unicode_type(txt) while txt: p = txt.partition('search:') if p[1]: # found 'search:' @@ -219,7 +220,7 @@ class CreateVirtualLibrary(QDialog): # {{{ self.saved_searches_label.setPlainText('') def name_text_edited(self, new_name): - self.new_name = unicode(new_name) + self.new_name = unicode_type(new_name) def name_index_changed(self, dex): if self.editing and (self.vl_text.text() != self.original_search or @@ -235,12 +236,12 @@ class CreateVirtualLibrary(QDialog): # {{{ return self.new_name = self.editing = self.vl_name.currentText() self.original_index = dex - self.original_search = unicode(self.vl_name.itemData(dex) or '') + self.original_search = unicode_type(self.vl_name.itemData(dex) or '') self.vl_text.setText(self.original_search) def link_activated(self, url): db = self.gui.current_db - f, txt = unicode(url).partition('.')[0::2] + f, txt = unicode_type(url).partition('.')[0::2] if f == 'search': names = db.saved_search_names() else: @@ -260,7 +261,7 @@ class CreateVirtualLibrary(QDialog): # {{{ self.vl_text.setCursorPosition(0) def accept(self): - n = unicode(self.vl_name.currentText()).strip() + n = unicode_type(self.vl_name.currentText()).strip() if not n: error_dialog(self.gui, _('No name'), _('You must provide a name for the new virtual library'), @@ -280,7 +281,7 @@ class CreateVirtualLibrary(QDialog): # {{{ default_yes=False): return - v = unicode(self.vl_text.text()).strip() + v = unicode_type(self.vl_text.text()).strip() if not v: error_dialog(self.gui, _('No search string'), _('You must provide a search to define the new virtual library'), @@ -513,7 +514,7 @@ class SearchRestrictionMixin(object): current_restriction_text = None if self.search_restriction.count() > 1: - txt = unicode(self.search_restriction.itemText(2)) + txt = unicode_type(self.search_restriction.itemText(2)) if txt.startswith('*'): current_restriction_text = txt self.search_restriction.clear() @@ -561,14 +562,14 @@ class SearchRestrictionMixin(object): def apply_text_search_restriction(self, search): if not self.search_restriction_list_built: self.build_search_restriction_list() - search = unicode(search) + search = unicode_type(search) if not search: self.search_restriction.setCurrentIndex(0) self._apply_search_restriction('', '') else: s = '*' + search if self.search_restriction.count() > 1: - txt = unicode(self.search_restriction.itemText(2)) + txt = unicode_type(self.search_restriction.itemText(2)) if txt.startswith('*'): self.search_restriction.setItemText(2, s) else: @@ -582,12 +583,12 @@ class SearchRestrictionMixin(object): if not self.search_restriction_list_built: self.build_search_restriction_list() if i == 1: - self.apply_text_search_restriction(unicode(self.search.currentText())) - elif i == 2 and unicode(self.search_restriction.currentText()).startswith('*'): + self.apply_text_search_restriction(unicode_type(self.search.currentText())) + elif i == 2 and unicode_type(self.search_restriction.currentText()).startswith('*'): self.apply_text_search_restriction( - unicode(self.search_restriction.currentText())[1:]) + unicode_type(self.search_restriction.currentText())[1:]) else: - r = unicode(self.search_restriction.currentText()) + r = unicode_type(self.search_restriction.currentText()) if r is not None and r != '': restriction = 'search:"%s"'%(r) else: diff --git a/src/calibre/gui2/shortcuts.py b/src/calibre/gui2/shortcuts.py index 279d3dd124..77944aada5 100644 --- a/src/calibre/gui2/shortcuts.py +++ b/src/calibre/gui2/shortcuts.py @@ -17,6 +17,7 @@ from PyQt5.Qt import ( from calibre.gui2 import error_dialog from calibre.utils.config import XMLConfig from calibre.utils.icu import sort_key +from polyglot.builtins import unicode_type DEFAULTS = Qt.UserRole DESCRIPTION = Qt.UserRole + 1 @@ -118,7 +119,7 @@ class Customize(QFrame): dup_desc = self.dup_check(sequence, self.key) if dup_desc is not None: error_dialog(self, _('Already assigned'), - unicode(sequence.toString(QKeySequence.NativeText)) + ' ' + + unicode_type(sequence.toString(QKeySequence.NativeText)) + ' ' + _('already assigned to') + ' ' + dup_desc, show=True) self.clear_clicked(which=which) @@ -169,12 +170,12 @@ class Delegate(QStyledItemDelegate): def setEditorData(self, editor, index): defs = index.data(DEFAULTS) - defs = _(' or ').join([unicode(x.toString(x.NativeText)) for x in defs]) - editor.key = unicode(index.data(KEY)) + defs = _(' or ').join([unicode_type(x.toString(x.NativeText)) for x in defs]) + editor.key = unicode_type(index.data(KEY)) editor.default_shortcuts.setText(_('&Default') + ': %s' % defs) editor.default_shortcuts.setChecked(True) editor.header.setText('%s: %s'%(_('Customize shortcuts for'), - unicode(index.data(DESCRIPTION)))) + unicode_type(index.data(DESCRIPTION)))) custom = index.data(CUSTOM) if custom: editor.custom.setChecked(True) @@ -250,7 +251,7 @@ class Shortcuts(QAbstractListModel): return self.descriptions[key] def get_shortcuts(self, key): - return [unicode(x.toString(x.NativeText)) for x in + return [unicode_type(x.toString(x.NativeText)) for x in self.get_sequences(key)] def data(self, index, role): @@ -279,7 +280,7 @@ class Shortcuts(QAbstractListModel): def set_data(self, index, custom): key = self.order[index.row()] if custom: - self.custom[key] = [unicode(x.toString(QKeySequence.PortableText)) for x in custom] + self.custom[key] = [unicode_type(x.toString(QKeySequence.PortableText)) for x in custom] elif key in self.custom: del self.custom[key] diff --git a/src/calibre/gui2/store/basic_config.py b/src/calibre/gui2/store/basic_config.py index f7f1652d68..c888b7fdcf 100644 --- a/src/calibre/gui2/store/basic_config.py +++ b/src/calibre/gui2/store/basic_config.py @@ -9,6 +9,7 @@ __docformat__ = 'restructuredtext en' from PyQt5.Qt import QWidget from calibre.gui2.store.basic_config_widget_ui import Ui_Form +from polyglot.builtins import unicode_type class BasicStoreConfigWidget(QWidget, Ui_Form): @@ -38,5 +39,5 @@ class BasicStoreConfig(object): def save_settings(self, config_widget): self.config['open_external'] = config_widget.open_external.isChecked() - tags = unicode(config_widget.tags.text()) + tags = unicode_type(config_widget.tags.text()) self.config['tags'] = tags diff --git a/src/calibre/gui2/store/config/chooser/adv_search_builder.py b/src/calibre/gui2/store/config/chooser/adv_search_builder.py index 50964236d9..e9ffea2316 100644 --- a/src/calibre/gui2/store/config/chooser/adv_search_builder.py +++ b/src/calibre/gui2/store/config/chooser/adv_search_builder.py @@ -13,6 +13,7 @@ from PyQt5.Qt import (QDialog, QDialogButtonBox) from calibre.gui2.store.config.chooser.adv_search_builder_ui import Ui_Dialog from calibre.library.caches import CONTAINS_MATCH, EQUALS_MATCH from calibre.utils.localization import localize_user_manual_link +from polyglot.builtins import unicode_type class AdvSearchBuilderDialog(QDialog, Ui_Dialog): @@ -77,7 +78,7 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog): self.mc = '=' else: self.mc = '~' - all, any, phrase, none = map(lambda x: unicode(x.text()), + all, any, phrase, none = map(lambda x: unicode_type(x.text()), (self.all, self.any, self.phrase, self.none)) all, any, none = map(self.tokens, (all, any, none)) phrase = phrase.strip() @@ -96,11 +97,11 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog): return ans def token(self): - txt = unicode(self.text.text()).strip() + txt = unicode_type(self.text.text()).strip() if txt: if self.negate.isChecked(): txt = '!'+txt - tok = self.FIELDS[unicode(self.field.currentText())]+txt + tok = self.FIELDS[unicode_type(self.field.currentText())]+txt if re.search(r'\s', tok): tok = '"%s"'%tok return tok @@ -116,25 +117,25 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog): ans = [] self.box_last_values = {} - name = unicode(self.name_box.text()).strip() + name = unicode_type(self.name_box.text()).strip() if name: ans.append('name:"' + self.mc + name + '"') - description = unicode(self.description_box.text()).strip() + description = unicode_type(self.description_box.text()).strip() if description: ans.append('description:"' + self.mc + description + '"') - headquarters = unicode(self.headquarters_box.text()).strip() + headquarters = unicode_type(self.headquarters_box.text()).strip() if headquarters: ans.append('headquarters:"' + self.mc + headquarters + '"') - format = unicode(self.format_box.text()).strip() + format = unicode_type(self.format_box.text()).strip() if format: ans.append('format:"' + self.mc + format + '"') - enabled = unicode(self.enabled_combo.currentText()).strip() + enabled = unicode_type(self.enabled_combo.currentText()).strip() if enabled: ans.append('enabled:' + enabled) - drm = unicode(self.drm_combo.currentText()).strip() + drm = unicode_type(self.drm_combo.currentText()).strip() if drm: ans.append('drm:' + drm) - affiliate = unicode(self.affiliate_combo.currentText()).strip() + affiliate = unicode_type(self.affiliate_combo.currentText()).strip() if affiliate: ans.append('affiliate:' + affiliate) if ans: diff --git a/src/calibre/gui2/store/config/chooser/chooser_widget.py b/src/calibre/gui2/store/config/chooser/chooser_widget.py index 0c12b78fe7..51cf23f321 100644 --- a/src/calibre/gui2/store/config/chooser/chooser_widget.py +++ b/src/calibre/gui2/store/config/chooser/chooser_widget.py @@ -10,6 +10,7 @@ from PyQt5.Qt import QWidget, QIcon, QDialog, QComboBox, QLineEdit from calibre.gui2.store.config.chooser.adv_search_builder import AdvSearchBuilderDialog from calibre.gui2.store.config.chooser.chooser_widget_ui import Ui_Form +from polyglot.builtins import unicode_type class StoreChooserWidget(QWidget, Ui_Form): @@ -31,7 +32,7 @@ class StoreChooserWidget(QWidget, Ui_Form): self.results_view.activated.connect(self.results_view.model().toggle_plugin) def do_search(self): - self.results_view.model().search(unicode(self.query.text())) + self.results_view.model().search(unicode_type(self.query.text())) def build_adv_search(self): adv = AdvSearchBuilderDialog(self) diff --git a/src/calibre/gui2/store/config/chooser/models.py b/src/calibre/gui2/store/config/chooser/models.py index ad314581cc..42a3094c5f 100644 --- a/src/calibre/gui2/store/config/chooser/models.py +++ b/src/calibre/gui2/store/config/chooser/models.py @@ -13,6 +13,7 @@ from calibre.db.search import _match, CONTAINS_MATCH, EQUALS_MATCH, REGEXP_MATCH from calibre.utils.config_base import prefs from calibre.utils.icu import sort_key from calibre.utils.search_query_parser import SearchQueryParser +from polyglot.builtins import unicode_type class Matches(QAbstractItemModel): @@ -182,7 +183,7 @@ class Matches(QAbstractItemModel): return descending = order == Qt.DescendingOrder self.matches.sort(None, - lambda x: sort_key(unicode(self.data_as_text(x, col))), + lambda x: sort_key(unicode_type(self.data_as_text(x, col))), descending) if reset: self.beginResetModel(), self.endResetModel() diff --git a/src/calibre/gui2/store/search/adv_search_builder.py b/src/calibre/gui2/store/search/adv_search_builder.py index b992712b1b..770ba2f53e 100644 --- a/src/calibre/gui2/store/search/adv_search_builder.py +++ b/src/calibre/gui2/store/search/adv_search_builder.py @@ -13,6 +13,7 @@ from PyQt5.Qt import (QDialog, QDialogButtonBox) from calibre.gui2.store.search.adv_search_builder_ui import Ui_Dialog from calibre.library.caches import CONTAINS_MATCH, EQUALS_MATCH from calibre.utils.localization import localize_user_manual_link +from polyglot.builtins import unicode_type class AdvSearchBuilderDialog(QDialog, Ui_Dialog): @@ -77,7 +78,7 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog): self.mc = '=' else: self.mc = '~' - all, any, phrase, none = map(lambda x: unicode(x.text()), + all, any, phrase, none = map(lambda x: unicode_type(x.text()), (self.all, self.any, self.phrase, self.none)) all, any, none = map(self.tokens, (all, any, none)) phrase = phrase.strip() @@ -96,11 +97,11 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog): return ans def token(self): - txt = unicode(self.text.text()).strip() + txt = unicode_type(self.text.text()).strip() if txt: if self.negate.isChecked(): txt = '!'+txt - tok = self.FIELDS[unicode(self.field.currentText())]+txt + tok = self.FIELDS[unicode_type(self.field.currentText())]+txt if re.search(r'\s', tok): tok = '"%s"'%tok return tok @@ -116,16 +117,16 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog): ans = [] self.box_last_values = {} - title = unicode(self.title_box.text()).strip() + title = unicode_type(self.title_box.text()).strip() if title: ans.append('title:"' + self.mc + title + '"') - author = unicode(self.author_box.text()).strip() + author = unicode_type(self.author_box.text()).strip() if author: ans.append('author:"' + self.mc + author + '"') - price = unicode(self.price_box.text()).strip() + price = unicode_type(self.price_box.text()).strip() if price: ans.append('price:"' + self.mc + price + '"') - format = unicode(self.format_box.text()).strip() + format = unicode_type(self.format_box.text()).strip() if format: ans.append('format:"' + self.mc + format + '"') drm = '' if self.drm_combo.currentIndex() == 0 else 'true' if self.drm_combo.currentIndex() == 1 else 'false' diff --git a/src/calibre/gui2/store/search/models.py b/src/calibre/gui2/store/search/models.py index b7ac6e11b6..7f21d130b6 100644 --- a/src/calibre/gui2/store/search/models.py +++ b/src/calibre/gui2/store/search/models.py @@ -19,6 +19,7 @@ from calibre.gui2.store.search.download_thread import DetailsThreadPool, \ CoverThreadPool from calibre.utils.icu import sort_key from calibre.utils.search_query_parser import SearchQueryParser +from polyglot.builtins import unicode_type def comparable_price(text): @@ -291,7 +292,7 @@ class Matches(QAbstractItemModel): return descending = order == Qt.DescendingOrder self.all_matches.sort(None, - lambda x: sort_key(unicode(self.data_as_text(x, col))), + lambda x: sort_key(unicode_type(self.data_as_text(x, col))), descending) self.reorder_matches() if reset: diff --git a/src/calibre/gui2/store/search/search.py b/src/calibre/gui2/store/search/search.py index e7d9698a54..a552bad3e0 100644 --- a/src/calibre/gui2/store/search/search.py +++ b/src/calibre/gui2/store/search/search.py @@ -23,6 +23,7 @@ from calibre.gui2.store.search.download_thread import SearchThreadPool, \ CacheUpdateThreadPool from calibre.gui2.store.search.search_ui import Ui_Dialog from calibre.utils.filenames import ascii_filename +from polyglot.builtins import unicode_type class SearchDialog(QDialog, Ui_Dialog): @@ -66,7 +67,7 @@ class SearchDialog(QDialog, Ui_Dialog): self.setup_store_checks() # Set the search query - if isinstance(query, (str, unicode)): + if isinstance(query, (str, unicode_type)): self.search_edit.setText(query) elif isinstance(query, dict): if 'author' in query: @@ -184,11 +185,11 @@ class SearchDialog(QDialog, Ui_Dialog): # Don't start a search if there is nothing to search for. query = [] if self.search_title.text(): - query.append(u'title2:"~%s"' % unicode(self.search_title.text()).replace('"', ' ')) + query.append(u'title2:"~%s"' % unicode_type(self.search_title.text()).replace('"', ' ')) if self.search_author.text(): - query.append(u'author2:"%s"' % unicode(self.search_author.text()).replace('"', ' ')) + query.append(u'author2:"%s"' % unicode_type(self.search_author.text()).replace('"', ' ')) if self.search_edit.text(): - query.append(unicode(self.search_edit.text())) + query.append(unicode_type(self.search_edit.text())) query = " ".join(query) if not query.strip(): error_dialog(self, _('No query'), @@ -410,7 +411,7 @@ class SearchDialog(QDialog, Ui_Dialog): self.searching = False else: self.searching = True - if unicode(self.search.text()) != self.STOP_TEXT: + if unicode_type(self.search.text()) != self.STOP_TEXT: self.search.setText(self.STOP_TEXT) if not self.pi.isAnimated(): self.pi.startAnimation() @@ -434,7 +435,7 @@ class SearchDialog(QDialog, Ui_Dialog): self.save_state() def exec_(self): - if unicode(self.search_edit.text()).strip() or unicode(self.search_title.text()).strip() or unicode(self.search_author.text()).strip(): + if unicode_type(self.search_edit.text()).strip() or unicode_type(self.search_title.text()).strip() or unicode_type(self.search_author.text()).strip(): self.do_search() return QDialog.exec_(self) diff --git a/src/calibre/gui2/store/web_control.py b/src/calibre/gui2/store/web_control.py index e3d3d464d3..802e55e232 100644 --- a/src/calibre/gui2/store/web_control.py +++ b/src/calibre/gui2/store/web_control.py @@ -19,6 +19,7 @@ from calibre.gui2.ebook_download import show_download_info from calibre.ptempfile import PersistentTemporaryFile from calibre.utils.filenames import ascii_filename from calibre.web import get_download_filename +from polyglot.builtins import unicode_type class NPWebView(QWebView): @@ -70,7 +71,7 @@ class NPWebView(QWebView): if not self.gui: return - url = unicode(request.url().toString(NO_URL_FORMATTING)) + url = unicode_type(request.url().toString(NO_URL_FORMATTING)) cf = self.get_cookies() filename = get_download_filename(url, cf) @@ -112,15 +113,15 @@ class NPWebView(QWebView): for c in self.page().networkAccessManager().cookieJar().allCookies(): cookie = [] - domain = unicode(c.domain()) + domain = unicode_type(c.domain()) cookie.append(domain) cookie.append('TRUE' if domain.startswith('.') else 'FALSE') - cookie.append(unicode(c.path())) + cookie.append(unicode_type(c.path())) cookie.append('TRUE' if c.isSecure() else 'FALSE') - cookie.append(unicode(c.expirationDate().toTime_t())) - cookie.append(unicode(c.name())) - cookie.append(unicode(c.value())) + cookie.append(unicode_type(c.expirationDate().toTime_t())) + cookie.append(unicode_type(c.name())) + cookie.append(unicode_type(c.value())) cf.write('\t'.join(cookie)) cf.write('\n') diff --git a/src/calibre/gui2/tag_browser/model.py b/src/calibre/gui2/tag_browser/model.py index c517228ffb..a50dcfbed0 100644 --- a/src/calibre/gui2/tag_browser/model.py +++ b/src/calibre/gui2/tag_browser/model.py @@ -2,7 +2,7 @@ # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import (unicode_literals, division, absolute_import, print_function) -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' @@ -191,7 +191,7 @@ class TagTreeItem(object): # {{{ else: name = tag.name if role == Qt.DisplayRole: - return unicode(name) + return unicode_type(name) if role == Qt.EditRole: return (tag.original_name) if role == Qt.DecorationRole: @@ -745,7 +745,7 @@ class TagsModel(QAbstractItemModel): # {{{ return ans def dropMimeData(self, md, action, row, column, parent): - fmts = {unicode(x) for x in md.formats()} + fmts = {unicode_type(x) for x in md.formats()} if not fmts.intersection(set(self.mimeTypes())): return False if "application/calibre+from_library" in fmts: @@ -1071,7 +1071,7 @@ class TagsModel(QAbstractItemModel): # {{{ # set up to reposition at the same item. We can do this except if # working with the last item and that item is deleted, in which case # we position at the parent label - val = unicode(value or '').strip() + val = unicode_type(value or '').strip() if not val: error_dialog(self.gui_parent, _('Item is blank'), _('An item cannot be set to nothing. Delete it instead.')).exec_() @@ -1138,7 +1138,7 @@ class TagsModel(QAbstractItemModel): # {{{ _('The saved search name %s is already used.')%val).exec_() return False self.use_position_based_index_on_next_recount = True - self.db.saved_search_rename(unicode(item.data(role) or ''), val) + self.db.saved_search_rename(unicode_type(item.data(role) or ''), val) item.tag.name = val self.search_item_renamed.emit() # Does a refresh else: diff --git a/src/calibre/gui2/tag_browser/ui.py b/src/calibre/gui2/tag_browser/ui.py index d3de5410b3..5e3378fa52 100644 --- a/src/calibre/gui2/tag_browser/ui.py +++ b/src/calibre/gui2/tag_browser/ui.py @@ -23,6 +23,7 @@ from calibre.ebooks.metadata import title_sort from calibre.gui2.dialogs.tag_categories import TagCategories from calibre.gui2.dialogs.tag_list_editor import TagListEditor from calibre.gui2.dialogs.edit_authors_dialog import EditAuthorsDialog +from polyglot.builtins import unicode_type class TagBrowserMixin(object): # {{{ @@ -121,7 +122,7 @@ class TagBrowserMixin(object): # {{{ if new_cat not in user_cats: break i += 1 - n = new_name + unicode(i) + n = new_name + unicode_type(i) # Add the new category user_cats[new_cat] = [] db.new_api.set_pref('user_categories', user_cats) @@ -267,7 +268,7 @@ class TagBrowserMixin(object): # {{{ m.delete_item_from_all_user_categories(orig_name[item], category) for old_id in to_rename: m.rename_item_in_all_user_categories(orig_name[old_id], - category, unicode(to_rename[old_id])) + category, unicode_type(to_rename[old_id])) db.new_api.remove_items(category, to_delete) db.new_api.rename_items(category, to_rename, change_index=False) @@ -591,7 +592,7 @@ class TagBrowserWidget(QFrame): # {{{ @property def find_text(self): - return unicode(self.item_search.currentText()).strip() + return unicode_type(self.item_search.currentText()).strip() def find(self): model = self.tags_view.model() diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index 3445db6215..9e74fc44d4 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -24,6 +24,7 @@ from calibre.gui2.tag_browser.model import (TagTreeItem, TAG_SEARCH_STATES, TagsModel, DRAG_IMAGE_ROLE, COUNT_ROLE) from calibre.gui2 import config, gprefs, choose_files, pixmap_to_data, rating_font, empty_index from calibre.utils.icu import sort_key +from polyglot.builtins import unicode_type class TagDelegate(QStyledItemDelegate): # {{{ @@ -63,7 +64,7 @@ class TagDelegate(QStyledItemDelegate): # {{{ text = index.data(Qt.DisplayRole) hover = option.state & style.State_MouseOver if hover or gprefs['tag_browser_show_counts']: - count = unicode(index.data(COUNT_ROLE)) + count = unicode_type(index.data(COUNT_ROLE)) width = painter.fontMetrics().boundingRect(count).width() r = QRect(tr) r.setRight(r.right() - 1), r.setLeft(r.right() - width - 4) @@ -377,7 +378,7 @@ class TagsView(QTreeView): # {{{ with open(os.path.join(d, 'icon_' + sanitize_file_name_unicode(key)+'.png'), 'wb') as f: f.write(pixmap_to_data(p, format='PNG')) path = os.path.basename(f.name) - self._model.set_custom_category_icon(key, unicode(path)) + self._model.set_custom_category_icon(key, unicode_type(path)) self.recount() except: import traceback @@ -504,7 +505,7 @@ class TagsView(QTreeView): # {{{ if not item.category_key.startswith('@'): while item.parent != self._model.root_item: item = item.parent - category = unicode(item.name or '') + category = unicode_type(item.name or '') key = item.category_key # Verify that we are working with a field that we know something about if key not in self.db.field_metadata: diff --git a/src/calibre/gui2/tag_mapper.py b/src/calibre/gui2/tag_mapper.py index f03e0bd524..cb2baad4fa 100644 --- a/src/calibre/gui2/tag_mapper.py +++ b/src/calibre/gui2/tag_mapper.py @@ -20,6 +20,7 @@ from calibre.gui2.ui import get_gui from calibre.gui2.widgets2 import Dialog from calibre.utils.config import JSONConfig from calibre.utils.localization import localize_user_manual_link +from polyglot.builtins import unicode_type tag_maps = JSONConfig('tag-map-rules') @@ -171,14 +172,14 @@ class RuleEdit(QWidget): def rule(self, rule): def sc(name): c = getattr(self, name) - idx = c.findData(unicode(rule.get(name, ''))) + idx = c.findData(unicode_type(rule.get(name, ''))) if idx < 0: idx = 0 c.setCurrentIndex(idx) sc('action'), sc('match_type') ac = self.action.currentData() - self.query.setText(intelligent_strip(ac, unicode(rule.get('query', '')))) - self.replace.setText(intelligent_strip(ac, unicode(rule.get('replace', '')))) + self.query.setText(intelligent_strip(ac, unicode_type(rule.get('query', '')))) + self.replace.setText(intelligent_strip(ac, unicode_type(rule.get('replace', '')))) def validate(self): rule = self.rule diff --git a/src/calibre/gui2/toc/location.py b/src/calibre/gui2/toc/location.py index 4602c87613..af90566fb6 100644 --- a/src/calibre/gui2/toc/location.py +++ b/src/calibre/gui2/toc/location.py @@ -19,6 +19,7 @@ from PyQt5.QtWebKit import QWebElement from calibre.ebooks.oeb.display.webview import load_html from calibre.gui2 import error_dialog, question_dialog, gprefs, secure_web_page from calibre.utils.logging import default_log +from polyglot.builtins import unicode_type class Page(QWebPage): # {{{ @@ -36,10 +37,10 @@ class Page(QWebPage): # {{{ self.setLinkDelegationPolicy(self.DelegateAllLinks) def javaScriptConsoleMessage(self, msg, lineno, msgid): - self.log(u'JS:', unicode(msg)) + self.log(u'JS:', unicode_type(msg)) def javaScriptAlert(self, frame, msg): - self.log(unicode(msg)) + self.log(unicode_type(msg)) @pyqtSlot(result=bool) def shouldInterruptJavaScript(self): @@ -47,8 +48,8 @@ class Page(QWebPage): # {{{ @pyqtSlot(QWebElement, str, str, float) def onclick(self, elem, loc, totals, frac): - elem_id = unicode(elem.attribute('id')) or None - tag = unicode(elem.tagName()).lower() + elem_id = unicode_type(elem.attribute('id')) or None + tag = unicode_type(elem.tagName()).lower() self.elem_clicked.emit(tag, frac, elem_id, json.loads(str(loc)), json.loads(str(totals))) def load_js(self): @@ -184,7 +185,7 @@ class ItemEdit(QWidget): return super(ItemEdit, self).keyPressEvent(ev) def find(self, forwards=True): - text = unicode(self.search_text.text()).strip() + text = unicode_type(self.search_text.text()).strip() flags = QWebPage.FindFlags(0) if forwards else QWebPage.FindBackward d = self.dest_list if d.count() == 1: @@ -195,9 +196,9 @@ class ItemEdit(QWidget): _('No match found for: %s')%text, show=True) delta = 1 if forwards else -1 - current = unicode(d.currentItem().data(Qt.DisplayRole) or '') + current = unicode_type(d.currentItem().data(Qt.DisplayRole) or '') next_index = (d.currentRow() + delta)%d.count() - next = unicode(d.item(next_index).data(Qt.DisplayRole) or '') + next = unicode_type(d.item(next_index).data(Qt.DisplayRole) or '') msg = '

'+_('No matches for %(text)s found in the current file [%(current)s].' ' Do you want to search in the %(which)s file [%(next)s]?') msg = msg%dict(text=text, current=current, next=next, @@ -220,7 +221,7 @@ class ItemEdit(QWidget): self.dest_list.addItems(spine_names) def current_changed(self, item): - name = self.current_name = unicode(item.data(Qt.DisplayRole) or '') + name = self.current_name = unicode_type(item.data(Qt.DisplayRole) or '') self.current_frag = None path = self.container.name_to_abspath(name) # Ensure encoding map is populated @@ -260,7 +261,7 @@ class ItemEdit(QWidget): if toc.dest: for i in xrange(self.dest_list.count()): litem = self.dest_list.item(i) - if unicode(litem.data(Qt.DisplayRole) or '') == toc.dest: + if unicode_type(litem.data(Qt.DisplayRole) or '') == toc.dest: dest_index = i frag = toc.frag break @@ -308,4 +309,4 @@ class ItemEdit(QWidget): @property def result(self): return (self.current_item, self.current_where, self.current_name, - self.current_frag, unicode(self.name.text())) + self.current_frag, unicode_type(self.name.text())) diff --git a/src/calibre/gui2/toc/main.py b/src/calibre/gui2/toc/main.py index fd986c8137..986543c682 100644 --- a/src/calibre/gui2/toc/main.py +++ b/src/calibre/gui2/toc/main.py @@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en' import sys, os, textwrap from threading import Thread from functools import partial -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from PyQt5.Qt import (QPushButton, QFrame, QMenu, QInputDialog, QCheckBox, QDialog, QVBoxLayout, QDialogButtonBox, QSize, QStackedWidget, QWidget, @@ -77,7 +77,7 @@ class XPathDialog(QDialog): # {{{ name, ok = QInputDialog.getText(self, _('Choose name'), _('Choose a name for these settings')) if ok: - name = unicode(name).strip() + name = unicode_type(name).strip() if name: saved = self.prefs.get('xpath_toc_settings', {}) # in JSON all keys have to be strings @@ -340,7 +340,7 @@ class ItemView(QFrame): # {{{ def populate_item_pane(self): item = self.current_item - name = unicode(item.data(0, Qt.DisplayRole) or '') + name = unicode_type(item.data(0, Qt.DisplayRole) or '') self.item_pane.heading.setText('

%s

'%name) self.icon_label.setPixmap(item.data(0, Qt.DecorationRole ).pixmap(32, 32)) @@ -584,33 +584,33 @@ class TreeWidget(QTreeWidget): # {{{ self.push_history() from calibre.utils.titlecase import titlecase for item in self.selectedItems(): - t = unicode(item.data(0, Qt.DisplayRole) or '') + t = unicode_type(item.data(0, Qt.DisplayRole) or '') item.setData(0, Qt.DisplayRole, titlecase(t)) def upper_case(self): self.push_history() for item in self.selectedItems(): - t = unicode(item.data(0, Qt.DisplayRole) or '') + t = unicode_type(item.data(0, Qt.DisplayRole) or '') item.setData(0, Qt.DisplayRole, icu_upper(t)) def lower_case(self): self.push_history() for item in self.selectedItems(): - t = unicode(item.data(0, Qt.DisplayRole) or '') + t = unicode_type(item.data(0, Qt.DisplayRole) or '') item.setData(0, Qt.DisplayRole, icu_lower(t)) def swap_case(self): self.push_history() from calibre.utils.icu import swapcase for item in self.selectedItems(): - t = unicode(item.data(0, Qt.DisplayRole) or '') + t = unicode_type(item.data(0, Qt.DisplayRole) or '') item.setData(0, Qt.DisplayRole, swapcase(t)) def capitalize(self): self.push_history() from calibre.utils.icu import capitalize for item in self.selectedItems(): - t = unicode(item.data(0, Qt.DisplayRole) or '') + t = unicode_type(item.data(0, Qt.DisplayRole) or '') item.setData(0, Qt.DisplayRole, capitalize(t)) def bulk_rename(self): @@ -648,7 +648,7 @@ class TreeWidget(QTreeWidget): # {{{ item = self.currentItem() def key(k): - sc = unicode(QKeySequence(k | Qt.CTRL).toString(QKeySequence.NativeText)) + sc = unicode_type(QKeySequence(k | Qt.CTRL).toString(QKeySequence.NativeText)) return ' [%s]'%sc if item is not None: @@ -657,7 +657,7 @@ class TreeWidget(QTreeWidget): # {{{ m.addAction(QIcon(I('modified.png')), _('Bulk rename all selected items'), self.bulk_rename) m.addAction(QIcon(I('trash.png')), _('Remove all selected items'), self.del_items) m.addSeparator() - ci = unicode(item.data(0, Qt.DisplayRole) or '') + ci = unicode_type(item.data(0, Qt.DisplayRole) or '') p = item.parent() or self.invisibleRootItem() idx = p.indexOfChild(item) if idx > 0: @@ -758,12 +758,12 @@ class TOCView(QWidget): # {{{ def event(self, e): if e.type() == e.StatusTip: - txt = unicode(e.tip()) or self.default_msg + txt = unicode_type(e.tip()) or self.default_msg self.hl.setText(txt) return super(TOCView, self).event(e) def item_title(self, item): - return unicode(item.data(0, Qt.DisplayRole) or '') + return unicode_type(item.data(0, Qt.DisplayRole) or '') def del_items(self): self.tocw.del_items() @@ -818,7 +818,7 @@ class TOCView(QWidget): # {{{ def data_changed(self, top_left, bottom_right): for r in xrange(top_left.row(), bottom_right.row()+1): idx = self.tocw.model().index(r, 0, top_left.parent()) - new_title = unicode(idx.data(Qt.DisplayRole) or '').strip() + new_title = unicode_type(idx.data(Qt.DisplayRole) or '').strip() toc = idx.data(Qt.UserRole) if toc is not None: toc.title = new_title or _('(Untitled)') @@ -910,7 +910,7 @@ class TOCView(QWidget): # {{{ def process_node(parent, toc_parent): for i in xrange(parent.childCount()): item = parent.child(i) - title = unicode(item.data(0, Qt.DisplayRole) or '').strip() + title = unicode_type(item.data(0, Qt.DisplayRole) or '').strip() toc = item.data(0, Qt.UserRole) dest, frag = toc.dest, toc.frag toc = toc_parent.add(title, dest, frag) diff --git a/src/calibre/gui2/tools.py b/src/calibre/gui2/tools.py index ee13557ac6..fb5112124e 100644 --- a/src/calibre/gui2/tools.py +++ b/src/calibre/gui2/tools.py @@ -22,6 +22,7 @@ from calibre.ebooks.conversion.config import ( GuiRecommendations, load_defaults, load_specifics, save_specifics, get_input_format_for_book, NoSupportedInputFormats) from calibre.gui2.convert import bulk_defaults_for_input_format +from polyglot.builtins import unicode_type def convert_single_ebook(parent, db, book_ids, auto_conversion=False, # {{{ @@ -64,7 +65,7 @@ def convert_single_ebook(parent, db, book_ids, auto_conversion=False, # {{{ temp_files = [in_file] try: - dtitle = unicode(mi.title) + dtitle = unicode_type(mi.title) except: dtitle = repr(mi.title) desc = _('Convert book %(num)d of %(total)d (%(title)s)') % \ @@ -225,7 +226,7 @@ class QueueBulk(QProgressDialog): if x[0] == 'debug_pipeline': lrecs.remove(x) try: - dtitle = unicode(mi.title) + dtitle = unicode_type(mi.title) except: dtitle = repr(mi.title) if len(dtitle) > 50: diff --git a/src/calibre/gui2/tweak_book/char_select.py b/src/calibre/gui2/tweak_book/char_select.py index 3fdd6ae5e2..d44b985da2 100644 --- a/src/calibre/gui2/tweak_book/char_select.py +++ b/src/calibre/gui2/tweak_book/char_select.py @@ -22,6 +22,7 @@ from calibre.gui2.tweak_book import tprefs from calibre.gui2.tweak_book.widgets import Dialog, BusyCursor from calibre.utils.icu import safe_chr as chr from calibre.utils.unicode_names import character_name_from_code, points_for_word +from polyglot.builtins import unicode_type ROOT = QModelIndex() @@ -766,7 +767,7 @@ class CharSelect(Dialog): self.char_view.setFocus(Qt.OtherFocusReason) def do_search(self): - text = unicode(self.search.text()).strip() + text = unicode_type(self.search.text()).strip() if not text: return self.clear_search() with BusyCursor(): diff --git a/src/calibre/gui2/tweak_book/check.py b/src/calibre/gui2/tweak_book/check.py index 6e87c2eaf7..fa299ca6d2 100644 --- a/src/calibre/gui2/tweak_book/check.py +++ b/src/calibre/gui2/tweak_book/check.py @@ -17,6 +17,7 @@ from calibre.ebooks.oeb.polish.check.main import run_checks, fix_errors from calibre.gui2 import NO_URL_FORMATTING from calibre.gui2.tweak_book import tprefs from calibre.gui2.tweak_book.widgets import BusyCursor +from polyglot.builtins import unicode_type def icon_for_level(level): @@ -100,7 +101,7 @@ class Check(QSplitter): def copy_to_clipboard(self): items = [] for item in (self.items.item(i) for i in xrange(self.items.count())): - msg = unicode(item.text()) + msg = unicode_type(item.text()) msg = prefix_for_level(item.data(Qt.UserRole).level) + msg items.append(msg) if items: @@ -116,7 +117,7 @@ class Check(QSplitter): msg, _('Click to run a check on the book'), _('Run check'))) def link_clicked(self, url): - url = unicode(url.toString(NO_URL_FORMATTING)) + url = unicode_type(url.toString(NO_URL_FORMATTING)) if url == 'activate:item': self.current_item_activated() elif url == 'run:check': diff --git a/src/calibre/gui2/tweak_book/completion/basic.py b/src/calibre/gui2/tweak_book/completion/basic.py index d8a0329160..4a46dd9774 100644 --- a/src/calibre/gui2/tweak_book/completion/basic.py +++ b/src/calibre/gui2/tweak_book/completion/basic.py @@ -21,6 +21,7 @@ from calibre.gui2.tweak_book.completion.utils import control, data, DataError from calibre.utils.ipc import eintr_retry_call from calibre.utils.matcher import Matcher from calibre.utils.icu import numeric_sort_key +from polyglot.builtins import unicode_type Request = namedtuple('Request', 'id type data query') @@ -66,10 +67,10 @@ def get_data(data_conn, data_type, data=None): return result -class Name(unicode): +class Name(unicode_type): def __new__(self, name, mime_type, spine_names): - ans = unicode.__new__(self, name) + ans = unicode_type.__new__(self, name) ans.mime_type = mime_type ans.in_spine = name in spine_names return ans diff --git a/src/calibre/gui2/tweak_book/completion/utils.py b/src/calibre/gui2/tweak_book/completion/utils.py index 67f7a588e5..b8d4a2ae0e 100644 --- a/src/calibre/gui2/tweak_book/completion/utils.py +++ b/src/calibre/gui2/tweak_book/completion/utils.py @@ -3,6 +3,8 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) +from polyglot.builtins import unicode_type + __license__ = 'GPL v3' __copyright__ = '2014, Kovid Goyal ' @@ -24,4 +26,4 @@ class DataError(Exception): self.tb = tb def traceback(self): - return unicode(self) + '\n' + self.tb + return unicode_type(self) + '\n' + self.tb diff --git a/src/calibre/gui2/tweak_book/diff/main.py b/src/calibre/gui2/tweak_book/diff/main.py index 6b872327c0..6b01d12d90 100644 --- a/src/calibre/gui2/tweak_book/diff/main.py +++ b/src/calibre/gui2/tweak_book/diff/main.py @@ -24,6 +24,7 @@ from calibre.gui2.tweak_book.widgets import Dialog from calibre.gui2.widgets2 import HistoryLineEdit2 from calibre.utils.filenames import samefile from calibre.utils.icu import numeric_sort_key +from polyglot.builtins import unicode_type class BusyWidget(QWidget): # {{{ @@ -129,7 +130,7 @@ def get_decoded_raw(name): def string_diff(left, right, left_syntax=None, right_syntax=None, left_name='left', right_name='right'): - left, right = unicode(left), unicode(right) + left, right = unicode_type(left), unicode_type(right) cache = Cache() cache.set_left(left_name, left), cache.set_right(right_name, right) changed_names = {} if left == right else {left_name:right_name} @@ -316,7 +317,7 @@ class Diff(Dialog): pass def do_search(self, reverse): - text = unicode(self.search.text()) + text = unicode_type(self.search.text()) if not text.strip(): return v = self.view.view.left if self.lb.isChecked() else self.view.view.right diff --git a/src/calibre/gui2/tweak_book/diff/view.py b/src/calibre/gui2/tweak_book/diff/view.py index 8726efee39..1484fae7f6 100644 --- a/src/calibre/gui2/tweak_book/diff/view.py +++ b/src/calibre/gui2/tweak_book/diff/view.py @@ -12,7 +12,7 @@ from math import ceil from functools import partial from collections import namedtuple, OrderedDict from difflib import SequenceMatcher -from polyglot.builtins import zip +from polyglot.builtins import unicode_type, zip import regex from PyQt5.Qt import ( @@ -66,7 +66,7 @@ def beautify_text(raw, syntax): else: root = parse(raw, line_numbers=False) pretty_html_tree(None, root) - return etree.tostring(root, encoding=unicode) + return etree.tostring(root, encoding=unicode_type) class LineNumberMap(dict): # {{{ @@ -79,7 +79,7 @@ class LineNumberMap(dict): # {{{ return self def __setitem__(self, k, v): - v = unicode(v) + v = unicode_type(v) dict.__setitem__(self, k, v) self.max_width = max(self.max_width, len(v)) @@ -166,7 +166,7 @@ class TextBrowser(PlainTextEdit): # {{{ def show_context_menu(self, pos): m = QMenu(self) a = m.addAction - i = unicode(self.textCursor().selectedText()).rstrip('\0') + i = unicode_type(self.textCursor().selectedText()).rstrip('\0') if i: a(QIcon(I('edit-copy.png')), _('Copy to clipboard'), self.copy).setShortcut(QKeySequence.Copy) @@ -215,7 +215,7 @@ class TextBrowser(PlainTextEdit): # {{{ headers = dict(self.headers) if lnum in headers: cpos = self.search_header_pos - lines = unicode(self.toPlainText()).splitlines() + lines = unicode_type(self.toPlainText()).splitlines() for hn, text in self.headers: lines[hn] = text prefix, postfix = lines[lnum][:cpos], lines[lnum][cpos:] @@ -306,7 +306,7 @@ class TextBrowser(PlainTextEdit): # {{{ while block.isValid() and top <= ev.rect().bottom(): r = ev.rect() if block.isVisible() and bottom >= r.top(): - text = unicode(self.line_number_map.get(num, '')) + text = unicode_type(self.line_number_map.get(num, '')) is_start = text != '-' and num in change_starts if is_start: painter.save() diff --git a/src/calibre/gui2/tweak_book/editor/insert_resource.py b/src/calibre/gui2/tweak_book/editor/insert_resource.py index e477f1fc60..196deba219 100644 --- a/src/calibre/gui2/tweak_book/editor/insert_resource.py +++ b/src/calibre/gui2/tweak_book/editor/insert_resource.py @@ -28,6 +28,7 @@ from calibre.gui2.tweak_book.file_list import name_is_ok from calibre.ptempfile import PersistentTemporaryFile from calibre.utils.localization import get_lang, canonicalize_lang from calibre.utils.icu import numeric_sort_key +from polyglot.builtins import unicode_type class ChooseName(Dialog): # {{{ @@ -59,13 +60,13 @@ class ChooseName(Dialog): # {{{ return False def verify(self): - return name_is_ok(unicode(self.name_edit.text()), self.show_error) + return name_is_ok(unicode_type(self.name_edit.text()), self.show_error) def accept(self): if not self.verify(): return error_dialog(self, _('No name specified'), _( 'You must specify a file name for the new file, with an extension.'), show=True) - n = unicode(self.name_edit.text()).replace('\\', '/') + n = unicode_type(self.name_edit.text()).replace('\\', '/') name, ext = n.rpartition('.')[0::2] self.filename = name + '.' + ext.lower() super(ChooseName, self).accept() @@ -111,7 +112,7 @@ class ImageDelegate(QStyledItemDelegate): def paint(self, painter, option, index): QStyledItemDelegate.paint(self, painter, option, empty_index) # draw the hover and selection highlights - name = unicode(index.data(Qt.DisplayRole) or '') + name = unicode_type(index.data(Qt.DisplayRole) or '') cover = self.cover_cache.get(name, None) if cover is None: cover = self.cover_cache[name] = QPixmap() @@ -340,16 +341,16 @@ class InsertImage(Dialog): def activated(self, index): if self.for_browsing: - return self.image_activated.emit(unicode(index.data() or '')) + return self.image_activated.emit(unicode_type(index.data() or '')) self.chosen_image_is_external = False self.accept() def accept(self): - self.chosen_image = unicode(self.view.currentIndex().data() or '') + self.chosen_image = unicode_type(self.view.currentIndex().data() or '') super(InsertImage, self).accept() def filter_changed(self, *args): - f = unicode(self.filter.text()) + f = unicode_type(self.filter.text()) self.fm.setFilterFixedString(f) # }}} @@ -418,8 +419,8 @@ class ChooseFolder(Dialog): # {{{ def create_folder(self, item): text, ok = QInputDialog.getText(self, _('Folder name'), _('Enter a name for the new folder')) - if ok and unicode(text): - c = QTreeWidgetItem(item, (unicode(text),)) + if ok and unicode_type(text): + c = QTreeWidgetItem(item, (unicode_type(text),)) c.setIcon(0, QIcon(I('mimetypes/dir.png'))) for item in self.folders.selectedItems(): item.setSelected(False) @@ -429,7 +430,7 @@ class ChooseFolder(Dialog): # {{{ def folder_path(self, item): ans = [] while item is not self.root: - ans.append(unicode(item.text(0))) + ans.append(unicode_type(item.text(0))) item = item.parent() return tuple(reversed(ans)) @@ -478,15 +479,15 @@ class NewBook(Dialog): # {{{ def accept(self): with tprefs: - tprefs.set('previous_new_book_authors', unicode(self.authors.text())) + tprefs.set('previous_new_book_authors', unicode_type(self.authors.text())) tprefs.set('previous_new_book_lang', (self.languages.lang_codes or [get_lang()])[0]) self.languages.update_recently_used() super(NewBook, self).accept() @property def mi(self): - mi = Metadata(unicode(self.title.text()).strip() or _('Unknown')) - mi.authors = string_to_authors(unicode(self.authors.text()).strip()) or [_('Unknown')] + mi = Metadata(unicode_type(self.title.text()).strip() or _('Unknown')) + mi.authors = string_to_authors(unicode_type(self.authors.text()).strip()) or [_('Unknown')] mi.languages = self.languages.lang_codes or [get_lang()] return mi diff --git a/src/calibre/gui2/tweak_book/editor/smarts/html.py b/src/calibre/gui2/tweak_book/editor/smarts/html.py index e26e55d64e..c8eb521dc2 100644 --- a/src/calibre/gui2/tweak_book/editor/smarts/html.py +++ b/src/calibre/gui2/tweak_book/editor/smarts/html.py @@ -23,6 +23,7 @@ from calibre.gui2.tweak_book.editor.smarts.utils import ( no_modifiers, get_leading_whitespace_on_block, get_text_before_cursor, get_text_after_cursor, smart_home, smart_backspace, smart_tab, expand_tabs) from calibre.utils.icu import utf16_length +from polyglot.builtins import unicode_type get_offset = itemgetter(0) PARAGRAPH_SEPARATOR = '\u2029' @@ -213,7 +214,7 @@ def find_closing_tag(tag, max_tags=sys.maxint): def select_tag(cursor, tag): cursor.setPosition(tag.start_block.position() + tag.start_offset) cursor.setPosition(tag.end_block.position() + tag.end_offset + 1, cursor.KeepAnchor) - return unicode(cursor.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0') + return unicode_type(cursor.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0') def rename_tag(cursor, opening_tag, closing_tag, new_name, insert=False): @@ -321,10 +322,10 @@ class Smarts(NullSmarts): a = QTextEdit.ExtraSelection() a.cursor, a.format = editor.textCursor(), editor.match_paren_format a.cursor.setPosition(tag.start_block.position()), a.cursor.movePosition(a.cursor.EndOfBlock, a.cursor.KeepAnchor) - text = unicode(a.cursor.selectedText()) + text = unicode_type(a.cursor.selectedText()) start_pos = utf16_length(text[:tag.start_offset]) a.cursor.setPosition(tag.end_block.position()), a.cursor.movePosition(a.cursor.EndOfBlock, a.cursor.KeepAnchor) - text = unicode(a.cursor.selectedText()) + text = unicode_type(a.cursor.selectedText()) end_pos = utf16_length(text[:tag.end_offset + 1]) a.cursor.setPosition(tag.start_block.position() + start_pos) a.cursor.setPosition(tag.end_block.position() + end_pos, a.cursor.KeepAnchor) diff --git a/src/calibre/gui2/tweak_book/editor/snippets.py b/src/calibre/gui2/tweak_book/editor/snippets.py index 0d0f710f40..e8648c767f 100644 --- a/src/calibre/gui2/tweak_book/editor/snippets.py +++ b/src/calibre/gui2/tweak_book/editor/snippets.py @@ -24,8 +24,9 @@ from calibre.gui2.tweak_book.widgets import Dialog, PlainTextEdit from calibre.utils.config import JSONConfig from calibre.utils.icu import string_length as strlen from calibre.utils.localization import localize_user_manual_link +from polyglot.builtins import codepoint_to_chr, unicode_type -string_length = lambda x: strlen(unicode(x)) # Needed on narrow python builds, as subclasses of unicode dont work +string_length = lambda x: strlen(unicode_type(x)) # Needed on narrow python builds, as subclasses of unicode dont work KEY = Qt.Key_J MODIFIER = Qt.META if isosx else Qt.CTRL @@ -94,7 +95,7 @@ escape = unescape = None def escape_funcs(): global escape, unescape if escape is None: - escapem = {('\\' + x):unichr(i+1) for i, x in enumerate('\\${}')} + escapem = {('\\' + x):codepoint_to_chr(i+1) for i, x in enumerate('\\${}')} escape_pat = re.compile('|'.join(map(re.escape, escapem))) escape = lambda x: escape_pat.sub(lambda m: escapem[m.group()], x.replace(r'\\', '\x01')) unescapem = {v:k[1] for k, v in escapem.iteritems()} @@ -103,7 +104,7 @@ def escape_funcs(): return escape, unescape -class TabStop(unicode): +class TabStop(unicode_type): def __new__(self, raw, start_offset, tab_stops, is_toplevel=True): if raw.endswith('}'): @@ -114,7 +115,7 @@ class TabStop(unicode): for c in child_stops: c.parent = self tab_stops.extend(child_stops) - self = unicode.__new__(self, uraw) + self = unicode_type.__new__(self, uraw) if num.endswith('*'): self.takes_selection = True num = num[:-1] @@ -122,7 +123,7 @@ class TabStop(unicode): self.takes_selection = False self.num = int(num) else: - self = unicode.__new__(self, '') + self = unicode_type.__new__(self, '') self.num = int(raw[1:]) self.takes_selection = False self.start = start_offset @@ -134,7 +135,7 @@ class TabStop(unicode): def __repr__(self): return 'TabStop(text=%s num=%d start=%d is_mirror=%s takes_selection=%s is_toplevel=%s)' % ( - unicode.__repr__(self), self.num, self.start, self.is_mirror, self.takes_selection, self.is_toplevel) + unicode_type.__repr__(self), self.num, self.start, self.is_mirror, self.takes_selection, self.is_toplevel) def parse_template(template, start_offset=0, is_toplevel=True, grouped=True): diff --git a/src/calibre/gui2/tweak_book/editor/syntax/base.py b/src/calibre/gui2/tweak_book/editor/syntax/base.py index dc6a12171e..6618805549 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/base.py +++ b/src/calibre/gui2/tweak_book/editor/syntax/base.py @@ -14,6 +14,7 @@ from PyQt5.Qt import QTextCursor, QTextBlockUserData, QTextLayout, QTimer from ..themes import highlight_to_char_format from calibre.gui2.tweak_book.widgets import BusyCursor from calibre.utils.icu import utf16_length +from polyglot.builtins import unicode_type is_wide_build = sys.maxunicode >= 0x10ffff @@ -215,7 +216,7 @@ class SyntaxHighlighter(object): start_state = self.user_data_factory().state ud.clear(state=start_state, doc_name=self.doc_name) # Ensure no stale user data lingers formats = [] - for i, num, fmt in run_loop(ud, self.state_map, self.formats, unicode(block.text())): + for i, num, fmt in run_loop(ud, self.state_map, self.formats, unicode_type(block.text())): if fmt is not None: r = QTextLayout.FormatRange() r.start, r.length, r.format = i, num, fmt @@ -239,4 +240,3 @@ class SyntaxHighlighter(object): elif r.start + r.length >= preedit_start: r.length += preedit_length layout.setAdditionalFormats(formats) - diff --git a/src/calibre/gui2/tweak_book/editor/text.py b/src/calibre/gui2/tweak_book/editor/text.py index e1e9452a03..d28ae4e5d4 100644 --- a/src/calibre/gui2/tweak_book/editor/text.py +++ b/src/calibre/gui2/tweak_book/editor/text.py @@ -8,7 +8,7 @@ import os import re import textwrap import unicodedata -from polyglot.builtins import map +from polyglot.builtins import unicode_type, map from PyQt5.Qt import ( QColor, QColorDialog, QFont, QFontDatabase, QKeySequence, QPainter, QPalette, @@ -68,7 +68,7 @@ _dff = None def default_font_family(): global _dff if _dff is None: - families = set(map(unicode, QFontDatabase().families())) + families = set(map(unicode_type, QFontDatabase().families())) for x in ('Ubuntu Mono', 'Consolas', 'Liberation Mono'): if x in families: _dff = x @@ -280,7 +280,7 @@ class TextEdit(PlainTextEdit): if self.smarts.override_tab_stop_width is not None: self.tw = self.smarts.override_tab_stop_width self.setTabStopWidth(self.tw * self.space_width) - self.setPlainText(unicodedata.normalize('NFC', unicode(text))) + self.setPlainText(unicodedata.normalize('NFC', unicode_type(text))) if process_template and QPlainTextEdit.find(self, '%CURSOR%'): c = self.textCursor() c.insertText('') @@ -314,7 +314,7 @@ class TextEdit(PlainTextEdit): c.movePosition(c.NextBlock, n=lnum - 1) c.movePosition(c.StartOfLine) c.movePosition(c.EndOfLine, c.KeepAnchor) - text = unicode(c.selectedText()).rstrip('\0') + text = unicode_type(c.selectedText()).rstrip('\0') if col is None: c.movePosition(c.StartOfLine) lt = text.lstrip() @@ -373,7 +373,7 @@ class TextEdit(PlainTextEdit): if wrap: pos = m_end if reverse else m_start c.setPosition(pos, c.KeepAnchor) - raw = unicode(c.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0') + raw = unicode_type(c.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0') m = pat.search(raw) if m is None: return False @@ -406,7 +406,7 @@ class TextEdit(PlainTextEdit): if self.current_search_mark is None: return 0 c = self.current_search_mark.cursor - raw = unicode(c.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0') + raw = unicode_type(c.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0') if template is None: count = len(pat.findall(raw)) else: @@ -420,7 +420,7 @@ class TextEdit(PlainTextEdit): if getattr(template.func, 'append_final_output_to_marked', False): retval = template.end() if retval: - raw += unicode(retval) + raw += unicode_type(retval) else: template.end() show_function_debug_output(template) @@ -443,7 +443,7 @@ class TextEdit(PlainTextEdit): c = self.textCursor() c.beginEditBlock() c.movePosition(c.Start), c.movePosition(c.End, c.KeepAnchor) - text = unicode(c.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0') + text = unicode_type(c.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0') from calibre.ebooks.oeb.polish.css import sort_sheet text = sort_sheet(current_container(), text).cssText c.insertText(text) @@ -464,7 +464,7 @@ class TextEdit(PlainTextEdit): if wrap and not complete: pos = c.End if reverse else c.Start c.movePosition(pos, c.KeepAnchor) - raw = unicode(c.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0') + raw = unicode_type(c.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0') m = pat.search(raw) if m is None: return False @@ -509,7 +509,7 @@ class TextEdit(PlainTextEdit): if not found: return False else: - raw = unicode(c.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0') + raw = unicode_type(c.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0') m = pat.search(raw) if m is None: return False @@ -542,7 +542,7 @@ class TextEdit(PlainTextEdit): return match_pos, match_word while True: - text = unicode(c.selectedText()).rstrip('\0') + text = unicode_type(c.selectedText()).rstrip('\0') idx, word = find_first_word(text) if idx == -1: return False @@ -579,7 +579,7 @@ class TextEdit(PlainTextEdit): def replace(self, pat, template, saved_match='gui'): c = self.textCursor() - raw = unicode(c.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0') + raw = unicode_type(c.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0') m = pat.fullmatch(raw) if m is None: # This can happen if either the user changed the selected text or @@ -606,7 +606,7 @@ class TextEdit(PlainTextEdit): self.setTextCursor(c) return True base = r'''%%s\s*=\s*['"]{0,1}%s''' % regex.escape(anchor) - raw = unicode(self.toPlainText()) + raw = unicode_type(self.toPlainText()) m = regex.search(base % 'id', raw) if m is None: m = regex.search(base % 'name', raw) @@ -713,7 +713,7 @@ class TextEdit(PlainTextEdit): c = self.textCursor() c.setPosition(block.position() + r.start) c.setPosition(c.position() + r.length, c.KeepAnchor) - return unicode(c.selectedText()) + return unicode_type(c.selectedText()) def spellcheck_locale_for_cursor(self, c): with store_locale: @@ -750,7 +750,7 @@ class TextEdit(PlainTextEdit): c = self.cursorForPosition(ev.pos()) fmt = self.syntax_format_for_cursor(c) if fmt is not None: - tt = unicode(fmt.toolTip()) + tt = unicode_type(fmt.toolTip()) if tt: QToolTip.setFont(self.tooltip_font) QToolTip.setPalette(self.tooltip_palette) @@ -785,7 +785,7 @@ class TextEdit(PlainTextEdit): right = max(c.anchor(), c.position()) # For speed we use QPlainTextEdit's toPlainText as we dont care about # spaces in this context - raw = unicode(QPlainTextEdit.toPlainText(self)) + raw = unicode_type(QPlainTextEdit.toPlainText(self)) # Make sure the left edge is not within a <> gtpos = raw.find('>', left) ltpos = raw.find('<', left) @@ -829,7 +829,7 @@ class TextEdit(PlainTextEdit): c = self.textCursor() c.setPosition(left) c.setPosition(right, c.KeepAnchor) - prev_text = unicode(c.selectedText()).rstrip('\0') + prev_text = unicode_type(c.selectedText()).rstrip('\0') c.insertText(prefix + prev_text + suffix) if prev_text: right = c.position() @@ -932,10 +932,10 @@ version="1.1" width="100%%" height="100%%" viewBox="0 0 {w} {h}" preserveAspectR c = self.textCursor() has_selection = c.hasSelection() if has_selection: - text = unicode(c.selectedText()).rstrip('\0') + text = unicode_type(c.selectedText()).rstrip('\0') else: c.setPosition(c.position() - min(c.positionInBlock(), 6), c.KeepAnchor) - text = unicode(c.selectedText()).rstrip('\0') + text = unicode_type(c.selectedText()).rstrip('\0') m = re.search(r'[a-fA-F0-9]{2,6}$', text) if m is None: return False @@ -977,7 +977,7 @@ version="1.1" width="100%%" height="100%%" viewBox="0 0 {w} {h}" preserveAspectR from calibre.gui2.tweak_book.editor.smarts.css import find_rule block = None if self.syntax == 'css': - raw = unicode(self.toPlainText()) + raw = unicode_type(self.toPlainText()) line, col = find_rule(raw, rule_address) if line is not None: block = self.document().findBlockByNumber(line - 1) diff --git a/src/calibre/gui2/tweak_book/editor/themes.py b/src/calibre/gui2/tweak_book/editor/themes.py index 25a11f5f1a..d4ced42f75 100644 --- a/src/calibre/gui2/tweak_book/editor/themes.py +++ b/src/calibre/gui2/tweak_book/editor/themes.py @@ -18,6 +18,7 @@ from calibre.gui2 import error_dialog from calibre.gui2.tweak_book import tprefs from calibre.gui2.tweak_book.editor import syntax_text_char_format from calibre.gui2.tweak_book.widgets import Dialog +from polyglot.builtins import unicode_type underline_styles = {'single', 'dash', 'dot', 'dash_dot', 'dash_dot_dot', 'wave', 'spell'} @@ -345,7 +346,7 @@ class CreateNewTheme(Dialog): @property def theme_name(self): - return unicode(self._name.text()).strip() + return unicode_type(self._name.text()).strip() def accept(self): if not self.theme_name: @@ -474,7 +475,7 @@ class Property(QWidget): l.addStretch(1) def us_changed(self): - self.data['underline'] = unicode(self.underline.currentText()) or None + self.data['underline'] = unicode_type(self.underline.currentText()) or None self.changed.emit() # Help text {{{ @@ -618,7 +619,7 @@ class ThemeEditor(Dialog): data[k] = dict(THEMES[default_theme()][k]._asdict()) for nk, nv in data[k].iteritems(): if isinstance(nv, QBrush): - data[k][nk] = unicode(nv.color().name()) + data[k][nk] = unicode_type(nv.color().name()) if extra or missing: tprefs['custom_themes'][name] = data return data @@ -632,7 +633,7 @@ class ThemeEditor(Dialog): c.setParent(None) c.deleteLater() self.properties = [] - name = unicode(self.theme.currentText()) + name = unicode_type(self.theme.currentText()) if not name: return data = self.update_theme(name) @@ -649,7 +650,7 @@ class ThemeEditor(Dialog): @property def theme_name(self): - return unicode(self.theme.currentText()) + return unicode_type(self.theme.currentText()) def changed(self): name = self.theme_name @@ -660,7 +661,7 @@ class ThemeEditor(Dialog): d = CreateNewTheme(self) if d.exec_() == d.Accepted: name = '*' + d.theme_name - base = unicode(d.base.currentText()) + base = unicode_type(d.base.currentText()) theme = {} for key, val in THEMES[base].iteritems(): theme[key] = {k:col_to_string(v.color()) if isinstance(v, QBrush) else v for k, v in val._asdict().iteritems()} diff --git a/src/calibre/gui2/tweak_book/editor/widget.py b/src/calibre/gui2/tweak_book/editor/widget.py index 4f5827b632..4f9132f994 100644 --- a/src/calibre/gui2/tweak_book/editor/widget.py +++ b/src/calibre/gui2/tweak_book/editor/widget.py @@ -24,6 +24,7 @@ from calibre.gui2.tweak_book.editor import SPELL_PROPERTY, LINK_PROPERTY, TAG_NA from calibre.gui2.tweak_book.editor.help import help_url from calibre.gui2.tweak_book.editor.text import TextEdit from calibre.utils.icu import utf16_length +from polyglot.builtins import unicode_type def create_icon(text, palette=None, sz=None, divider=2, fill='white'): @@ -211,7 +212,7 @@ class Editor(QMainWindow): def get_raw_data(self): # The EPUB spec requires NFC normalization, see section 1.3.6 of # http://www.idpf.org/epub/20/spec/OPS_2.0.1_draft.htm - return unicodedata.normalize('NFC', unicode(self.editor.toPlainText()).rstrip('\0')) + return unicodedata.normalize('NFC', unicode_type(self.editor.toPlainText()).rstrip('\0')) def replace_data(self, raw, only_if_different=True): if isinstance(raw, bytes): @@ -462,7 +463,7 @@ class Editor(QMainWindow): if not c.atStart(): c.clearSelection() c.movePosition(c.PreviousCharacter, c.KeepAnchor) - char = unicode(c.selectedText()).rstrip('\0') + char = unicode_type(c.selectedText()).rstrip('\0') return (c.blockNumber() + 1, col, char) def cut(self): @@ -486,7 +487,7 @@ class Editor(QMainWindow): def fix_html(self): if self.syntax == 'html': from calibre.ebooks.oeb.polish.pretty import fix_html - self.editor.replace_text(fix_html(current_container(), unicode(self.editor.toPlainText())).decode('utf-8')) + self.editor.replace_text(fix_html(current_container(), unicode_type(self.editor.toPlainText())).decode('utf-8')) return True return False @@ -494,7 +495,7 @@ class Editor(QMainWindow): from calibre.ebooks.oeb.polish.pretty import pretty_html, pretty_css, pretty_xml if self.syntax in {'css', 'html', 'xml'}: func = {'css':pretty_css, 'xml':pretty_xml}.get(self.syntax, pretty_html) - original_text = unicode(self.editor.toPlainText()) + original_text = unicode_type(self.editor.toPlainText()) prettied_text = func(current_container(), name, original_text).decode('utf-8') if original_text != prettied_text: self.editor.replace_text(prettied_text) diff --git a/src/calibre/gui2/tweak_book/file_list.py b/src/calibre/gui2/tweak_book/file_list.py index 7b714520f2..21f278381f 100644 --- a/src/calibre/gui2/tweak_book/file_list.py +++ b/src/calibre/gui2/tweak_book/file_list.py @@ -39,7 +39,7 @@ from calibre.gui2.tweak_book import ( from calibre.gui2.tweak_book.editor import syntax_from_mime from calibre.gui2.tweak_book.templates import template_for from calibre.utils.icu import numeric_sort_key -from polyglot.builtins import iteritems +from polyglot.builtins import iteritems, unicode_type try: from PyQt5 import sip @@ -111,7 +111,7 @@ def get_bulk_rename_settings(parent, number, msg=None, sanitize=sanitize_file_na ans = {'prefix': None, 'start': None} if d.exec_() == d.Accepted: - prefix = sanitize(unicode(d.prefix.text())) + prefix = sanitize(unicode_type(d.prefix.text())) previous[category] = prefix tprefs.set('file-list-bulk-rename-prefix', previous) num = d.num.value() @@ -132,7 +132,7 @@ class ItemDelegate(QStyledItemDelegate): # {{{ rename_requested = pyqtSignal(object, object) def setEditorData(self, editor, index): - name = unicode(index.data(NAME_ROLE) or '') + name = unicode_type(index.data(NAME_ROLE) or '') # We do this because Qt calls selectAll() unconditionally on the # editor, and we want only a part of the file name to be selected QTimer.singleShot(0, partial(self.set_editor_data, name, editor)) @@ -151,8 +151,8 @@ class ItemDelegate(QStyledItemDelegate): # {{{ editor.selectAll() def setModelData(self, editor, model, index): - newname = unicode(editor.text()) - oldname = unicode(index.data(NAME_ROLE) or '') + newname = unicode_type(editor.text()) + oldname = unicode_type(index.data(NAME_ROLE) or '') if newname != oldname: self.rename_requested.emit(oldname, newname) @@ -170,7 +170,7 @@ class ItemDelegate(QStyledItemDelegate): # {{{ suffix = '%s(%d)' % (NBSP, index.model().rowCount(index)) else: try: - suffix = NBSP + human_readable(current_container().filesize(unicode(index.data(NAME_ROLE) or ''))) + suffix = NBSP + human_readable(current_container().filesize(unicode_type(index.data(NAME_ROLE) or ''))) except EnvironmentError: suffix = NBSP + human_readable(0) br = painter.boundingRect(option.rect, Qt.AlignRight|Qt.AlignVCenter, suffix) @@ -259,13 +259,13 @@ class FileList(QTreeWidget): def current_name(self): ci = self.currentItem() if ci is not None: - return unicode(ci.data(0, NAME_ROLE) or '') + return unicode_type(ci.data(0, NAME_ROLE) or '') return '' def get_state(self): s = {'pos':self.verticalScrollBar().value()} s['expanded'] = {c for c, item in self.categories.iteritems() if item.isExpanded()} - s['selected'] = {unicode(i.data(0, NAME_ROLE) or '') for i in self.selectedItems()} + s['selected'] = {unicode_type(i.data(0, NAME_ROLE) or '') for i in self.selectedItems()} return s def set_state(self, state): @@ -274,21 +274,21 @@ class FileList(QTreeWidget): self.verticalScrollBar().setValue(state['pos']) for parent in self.categories.itervalues(): for c in (parent.child(i) for i in xrange(parent.childCount())): - name = unicode(c.data(0, NAME_ROLE) or '') + name = unicode_type(c.data(0, NAME_ROLE) or '') if name in state['selected']: c.setSelected(True) def item_from_name(self, name): for parent in self.categories.itervalues(): for c in (parent.child(i) for i in xrange(parent.childCount())): - q = unicode(c.data(0, NAME_ROLE) or '') + q = unicode_type(c.data(0, NAME_ROLE) or '') if q == name: return c def select_name(self, name, set_as_current_index=False): for parent in self.categories.itervalues(): for c in (parent.child(i) for i in xrange(parent.childCount())): - q = unicode(c.data(0, NAME_ROLE) or '') + q = unicode_type(c.data(0, NAME_ROLE) or '') c.setSelected(q == name) if q == name: self.scrollToItem(c) @@ -298,7 +298,7 @@ class FileList(QTreeWidget): def select_names(self, names, current_name=None): for parent in self.categories.itervalues(): for c in (parent.child(i) for i in xrange(parent.childCount())): - q = unicode(c.data(0, NAME_ROLE) or '') + q = unicode_type(c.data(0, NAME_ROLE) or '') c.setSelected(q in names) if q == current_name: self.scrollToItem(c) @@ -504,9 +504,9 @@ class FileList(QTreeWidget): container = current_container() ci = self.currentItem() if ci is not None: - cn = unicode(ci.data(0, NAME_ROLE) or '') - mt = unicode(ci.data(0, MIME_ROLE) or '') - cat = unicode(ci.data(0, CATEGORY_ROLE) or '') + cn = unicode_type(ci.data(0, NAME_ROLE) or '') + mt = unicode_type(ci.data(0, MIME_ROLE) or '') + cat = unicode_type(ci.data(0, CATEGORY_ROLE) or '') n = elided_text(cn.rpartition('/')[-1]) m.addAction(QIcon(I('save.png')), _('Export %s') % n, partial(self.export, cn)) if cn not in container.names_that_must_not_be_changed and cn not in container.names_that_must_not_be_removed and mt not in OEB_FONTS: @@ -540,7 +540,7 @@ class FileList(QTreeWidget): selected_map = defaultdict(list) for item in sel: - selected_map[unicode(item.data(0, CATEGORY_ROLE) or '')].append(unicode(item.data(0, NAME_ROLE) or '')) + selected_map[unicode_type(item.data(0, CATEGORY_ROLE) or '')].append(unicode_type(item.data(0, NAME_ROLE) or '')) for items in selected_map.itervalues(): items.sort(key=self.index_of_name) @@ -560,7 +560,7 @@ class FileList(QTreeWidget): for category, parent in self.categories.iteritems(): for i in xrange(parent.childCount()): item = parent.child(i) - if unicode(item.data(0, NAME_ROLE) or '') == name: + if unicode_type(item.data(0, NAME_ROLE) or '') == name: return (category, i) return (None, -1) @@ -583,7 +583,7 @@ class FileList(QTreeWidget): self.mark_requested.emit(name, 'cover') def mark_as_titlepage(self, name): - first = unicode(self.categories['text'].child(0).data(0, NAME_ROLE) or '') == name + first = unicode_type(self.categories['text'].child(0).data(0, NAME_ROLE) or '') == name move_to_start = False if not first: move_to_start = question_dialog(self, _('Not first item'), _( @@ -606,7 +606,7 @@ class FileList(QTreeWidget): ' internally. The filenames you see are automatically generated from the' ' internal structures of the original file.') % current_container().book_type.upper(), show=True) return - names = {unicode(item.data(0, NAME_ROLE) or '') for item in self.selectedItems()} + names = {unicode_type(item.data(0, NAME_ROLE) or '') for item in self.selectedItems()} bad = names & current_container().names_that_must_not_be_changed if bad: error_dialog(self, _('Cannot rename'), @@ -618,7 +618,7 @@ class FileList(QTreeWidget): def request_bulk_rename(self): names = self.request_rename_common() if names is not None: - categories = Counter(unicode(item.data(0, CATEGORY_ROLE) or '') for item in self.selectedItems()) + categories = Counter(unicode_type(item.data(0, CATEGORY_ROLE) or '') for item in self.selectedItems()) settings = get_bulk_rename_settings(self, len(names), category=categories.most_common(1)[0][0], allow_spine_order=True) fmt, num = settings['prefix'], settings['start'] if fmt is not None: @@ -653,7 +653,7 @@ class FileList(QTreeWidget): @property def selected_names(self): - ans = {unicode(item.data(0, NAME_ROLE) or '') for item in self.selectedItems()} + ans = {unicode_type(item.data(0, NAME_ROLE) or '') for item in self.selectedItems()} ans.discard('') return ans @@ -672,9 +672,9 @@ class FileList(QTreeWidget): text = self.categories['text'] children = (text.child(i) for i in xrange(text.childCount())) - spine_removals = [(unicode(item.data(0, NAME_ROLE) or ''), item.isSelected()) for item in children] - other_removals = {unicode(item.data(0, NAME_ROLE) or '') for item in self.selectedItems() - if unicode(item.data(0, CATEGORY_ROLE) or '') != 'text'} + spine_removals = [(unicode_type(item.data(0, NAME_ROLE) or ''), item.isSelected()) for item in children] + other_removals = {unicode_type(item.data(0, NAME_ROLE) or '') for item in self.selectedItems() + if unicode_type(item.data(0, CATEGORY_ROLE) or '') != 'text'} self.delete_requested.emit(spine_removals, other_removals) def delete_done(self, spine_removals, other_removals): @@ -686,7 +686,7 @@ class FileList(QTreeWidget): if category != 'text': for i in xrange(parent.childCount()): child = parent.child(i) - if unicode(child.data(0, NAME_ROLE) or '') in other_removals: + if unicode_type(child.data(0, NAME_ROLE) or '') in other_removals: removals.append(child) # The sorting by index is necessary otherwise Qt crashes with recursive @@ -723,7 +723,7 @@ class FileList(QTreeWidget): if current_order != pre_drop_order: order = [] for child in (text.child(i) for i in xrange(text.childCount())): - name = unicode(child.data(0, NAME_ROLE) or '') + name = unicode_type(child.data(0, NAME_ROLE) or '') linear = bool(child.data(0, LINEAR_ROLE)) order.append([name, linear]) # Ensure that all non-linear items are at the end, any non-linear @@ -734,14 +734,14 @@ class FileList(QTreeWidget): self.reorder_spine.emit(order) def item_double_clicked(self, item, column): - category = unicode(item.data(0, CATEGORY_ROLE) or '') + category = unicode_type(item.data(0, CATEGORY_ROLE) or '') if category: self._request_edit(item) def _request_edit(self, item): - category = unicode(item.data(0, CATEGORY_ROLE) or '') - mime = unicode(item.data(0, MIME_ROLE) or '') - name = unicode(item.data(0, NAME_ROLE) or '') + category = unicode_type(item.data(0, CATEGORY_ROLE) or '') + mime = unicode_type(item.data(0, MIME_ROLE) or '') + name = unicode_type(item.data(0, NAME_ROLE) or '') syntax = {'text':'html', 'styles':'css'}.get(category, None) self.edit_file.emit(name, syntax, mime) @@ -760,7 +760,7 @@ class FileList(QTreeWidget): if backwards: items = reversed(tuple(items)) for item in items: - name = unicode(item.data(0, NAME_ROLE) or '') + name = unicode_type(item.data(0, NAME_ROLE) or '') if seen_current: self._request_edit(item) return True @@ -776,9 +776,9 @@ class FileList(QTreeWidget): def searchable_names(self): ans = {'text':OrderedDict(), 'styles':OrderedDict(), 'selected':OrderedDict(), 'open':OrderedDict()} for item in self.all_files: - category = unicode(item.data(0, CATEGORY_ROLE) or '') - mime = unicode(item.data(0, MIME_ROLE) or '') - name = unicode(item.data(0, NAME_ROLE) or '') + category = unicode_type(item.data(0, CATEGORY_ROLE) or '') + mime = unicode_type(item.data(0, MIME_ROLE) or '') + name = unicode_type(item.data(0, NAME_ROLE) or '') ok = category in {'text', 'styles'} if ok: ans[category][name] = syntax_from_mime(name, mime) @@ -838,7 +838,7 @@ class FileList(QTreeWidget): def link_stylesheets(self, names): s = self.categories['styles'] - sheets = [unicode(s.child(i).data(0, NAME_ROLE) or '') for i in xrange(s.childCount())] + sheets = [unicode_type(s.child(i).data(0, NAME_ROLE) or '') for i in xrange(s.childCount())] if not sheets: return error_dialog(self, _('No stylesheets'), _( 'This book currently has no stylesheets. You must first create a stylesheet' @@ -871,7 +871,7 @@ class FileList(QTreeWidget): l.addWidget(bb) if d.exec_() == d.Accepted: tprefs['remove_existing_links_when_linking_sheets'] = r.isChecked() - sheets = [unicode(s.item(il).text()) for il in xrange(s.count()) if s.item(il).checkState() == Qt.Checked] + sheets = [unicode_type(s.item(il).text()) for il in xrange(s.count()) if s.item(il).checkState() == Qt.Checked] if sheets: self.link_stylesheets_requested.emit(names, sheets, r.isChecked()) @@ -937,7 +937,7 @@ class NewFileDialog(QDialog): # {{{ @property def name_is_ok(self): - return name_is_ok(unicode(self.name.text()), self.show_error) + return name_is_ok(unicode_type(self.name.text()), self.show_error) def update_ok(self, *args): self.ok_button.setEnabled(self.name_is_ok) @@ -947,7 +947,7 @@ class NewFileDialog(QDialog): # {{{ return error_dialog(self, _('No name specified'), _( 'You must specify a name for the new file, with an extension, for example, chapter1.html'), show=True) tprefs['auto_link_stylesheets'] = self.link_css.isChecked() - name = unicode(self.name.text()) + name = unicode_type(self.name.text()) name, ext = name.rpartition('.')[0::2] name = (name + '.' + ext.lower()).replace('\\', '/') mt = guess_type(name) diff --git a/src/calibre/gui2/tweak_book/function_replace.py b/src/calibre/gui2/tweak_book/function_replace.py index 0aad311d26..20f6f1d1cd 100644 --- a/src/calibre/gui2/tweak_book/function_replace.py +++ b/src/calibre/gui2/tweak_book/function_replace.py @@ -23,12 +23,13 @@ from calibre.utils.config import JSONConfig from calibre.utils.icu import capitalize, upper, lower, swapcase from calibre.utils.titlecase import titlecase from calibre.utils.localization import localize_user_manual_link +from polyglot.builtins import unicode_type user_functions = JSONConfig('editor-search-replace-functions') def compile_code(src, name=''): - if not isinstance(src, unicode): + if not isinstance(src, unicode_type): match = re.search(r'coding[:=]\s*([-\w.]+)', src[:200]) enc = match.group(1) if match else 'utf-8' src = src.decode(enc) diff --git a/src/calibre/gui2/tweak_book/live_css.py b/src/calibre/gui2/tweak_book/live_css.py index 487585900a..fa32e84c7e 100644 --- a/src/calibre/gui2/tweak_book/live_css.py +++ b/src/calibre/gui2/tweak_book/live_css.py @@ -18,6 +18,7 @@ from calibre.gui2.tweak_book import editors, actions, tprefs from calibre.gui2.tweak_book.editor.themes import get_theme, theme_color from calibre.gui2.tweak_book.editor.text import default_font_family from css_selectors import parse, SelectorError +from polyglot.builtins import unicode_type class Heading(QWidget): # {{{ @@ -474,7 +475,7 @@ class LiveCSS(QWidget): def read_data(self, sourceline, tags): mf = self.preview.view.page().mainFrame() tags = [x.lower() for x in tags] - result = unicode(mf.evaluateJavaScript( + result = unicode_type(mf.evaluateJavaScript( 'window.calibre_preview_integration.live_css(%s, %s)' % ( json.dumps(sourceline), json.dumps(tags))) or '') try: diff --git a/src/calibre/gui2/tweak_book/manage_fonts.py b/src/calibre/gui2/tweak_book/manage_fonts.py index f43eac865e..3be05b2f4c 100644 --- a/src/calibre/gui2/tweak_book/manage_fonts.py +++ b/src/calibre/gui2/tweak_book/manage_fonts.py @@ -22,6 +22,7 @@ from calibre.gui2.tweak_book.widgets import Dialog, BusyCursor from calibre.utils.icu import primary_sort_key as sort_key from calibre.utils.fonts.scanner import font_scanner, NoFonts from calibre.utils.fonts.metadata import FontMetadata, UnsupportedFont +from polyglot.builtins import unicode_type def show_font_face_rule_for_font_file(file_data, added_name, parent=None): @@ -179,7 +180,7 @@ class ChangeFontFamily(Dialog): @property def family(self): - return unicode(self._family.text()) + return unicode_type(self._family.text()) @property def normalized_family(self): diff --git a/src/calibre/gui2/tweak_book/plugin.py b/src/calibre/gui2/tweak_book/plugin.py index ecd2a50656..e06f862625 100644 --- a/src/calibre/gui2/tweak_book/plugin.py +++ b/src/calibre/gui2/tweak_book/plugin.py @@ -14,6 +14,7 @@ from calibre import prints from calibre.customize.ui import all_edit_book_tool_plugins from calibre.gui2.tweak_book import tprefs, current_container from calibre.gui2.tweak_book.boss import get_boss +from polyglot.builtins import unicode_type class Tool(object): @@ -82,7 +83,7 @@ class Tool(object): :param description: An optional longer description of this action, it will be used in the preferences entry for this shortcut. ''' - short_text = short_text or unicode(qaction.text()).replace('&&', '\0').replace('&', '').replace('\0', '&') + short_text = short_text or unicode_type(qaction.text()).replace('&&', '\0').replace('&', '').replace('\0', '&') self.gui.keyboard.register_shortcut( self.name + '_' + unique_name, short_text, default_keys=default_keys, action=qaction, description=description or '', group=_('Plugins')) diff --git a/src/calibre/gui2/tweak_book/preferences.py b/src/calibre/gui2/tweak_book/preferences.py index ea66fe41ec..6c1b9f720f 100644 --- a/src/calibre/gui2/tweak_book/preferences.py +++ b/src/calibre/gui2/tweak_book/preferences.py @@ -8,7 +8,7 @@ __copyright__ = '2013, Kovid Goyal ' from operator import attrgetter, methodcaller from collections import namedtuple -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from itertools import product from copy import copy, deepcopy @@ -75,7 +75,7 @@ class BasicSettings(QWidget): # {{{ widget.addItem(human or key, key) def getter(w): - ans = unicode(w.itemData(w.currentIndex()) or '') + ans = unicode_type(w.itemData(w.currentIndex()) or '') return {none_val:None}.get(ans, ans) def setter(w, val): @@ -102,7 +102,7 @@ class BasicSettings(QWidget): # {{{ widget.defaults = prefs.defaults[name] def getter(w): - return list(map(unicode, (w.item(i).text() for i in xrange(w.count())))) + return list(map(unicode_type, (w.item(i).text() for i in xrange(w.count())))) def setter(w, val): order_map = {x:i for i, x in enumerate(val)} @@ -342,7 +342,7 @@ class PreviewSettings(BasicSettings): self.setLayout(l) def family_getter(w): - return unicode(w.currentFont().family()) + return unicode_type(w.currentFont().family()) def family_setter(w, val): w.setCurrentFont(QFont(val)) @@ -453,13 +453,13 @@ class ToolbarSettings(QWidget): prefs = prefs or tprefs val = self.original_settings = {} for i in xrange(1, self.bars.count()): - name = unicode(self.bars.itemData(i) or '') + name = unicode_type(self.bars.itemData(i) or '') val[name] = copy(prefs[name]) self.current_settings = deepcopy(val) @property def current_name(self): - return unicode(self.bars.itemData(self.bars.currentIndex()) or '') + return unicode_type(self.bars.itemData(self.bars.currentIndex()) or '') def build_lists(self): from calibre.gui2.tweak_book.plugin import plugin_toolbar_actions @@ -483,12 +483,12 @@ class ToolbarSettings(QWidget): ic = ac.icon() if not ic or ic.isNull(): ic = blank - ans = QListWidgetItem(ic, unicode(ac.text()).replace('&', ''), parent) + ans = QListWidgetItem(ic, unicode_type(ac.text()).replace('&', ''), parent) ans.setData(Qt.UserRole, key) ans.setToolTip(ac.toolTip()) return ans - for key, ac in sorted(all_items.iteritems(), key=lambda k_ac: unicode(k_ac[1].text())): + for key, ac in sorted(all_items.iteritems(), key=lambda k_ac: unicode_type(k_ac[1].text())): if key not in applied: to_item(key, ac, self.available) if name == 'global_book_toolbar' and 'donate' not in applied: @@ -539,7 +539,7 @@ class ToolbarSettings(QWidget): s = self.current_settings[self.current_name] except KeyError: return - names = [unicode(i.data(Qt.UserRole) or '') for i in self.available.selectedItems()] + names = [unicode_type(i.data(Qt.UserRole) or '') for i in self.available.selectedItems()] if not names: return for n in names: @@ -627,7 +627,7 @@ class TemplatesDialog(Dialog): # {{{ @property def current_syntax(self): - return unicode(self.syntaxes.currentText()) + return unicode_type(self.syntaxes.currentText()) def show_template(self): from calibre.gui2.tweak_book.templates import raw_template_for @@ -645,7 +645,7 @@ class TemplatesDialog(Dialog): # {{{ def _save_syntax(self): custom = tprefs['templates'] - custom[self.current_syntax] = unicode(self.editor.toPlainText()) + custom[self.current_syntax] = unicode_type(self.editor.toPlainText()) tprefs['templates'] = custom def restore_defaults(self): diff --git a/src/calibre/gui2/tweak_book/preview.py b/src/calibre/gui2/tweak_book/preview.py index 90b2e383bf..2eec8f531e 100644 --- a/src/calibre/gui2/tweak_book/preview.py +++ b/src/calibre/gui2/tweak_book/preview.py @@ -9,7 +9,7 @@ __copyright__ = '2013, Kovid Goyal ' import time, textwrap, json from bisect import bisect_right from base64 import b64encode -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from threading import Thread from Queue import Queue, Empty from functools import partial @@ -278,7 +278,7 @@ class WebPage(QWebPage): self.init_javascript() def javaScriptConsoleMessage(self, msg, lineno, source_id): - prints('preview js:%s:%s:'%(unicode(source_id), lineno), unicode(msg)) + prints('preview js:%s:%s:'%(unicode_type(source_id), lineno), unicode_type(msg)) def init_javascript(self): if not hasattr(self, 'js'): @@ -294,7 +294,7 @@ class WebPage(QWebPage): @pyqtSlot(str, str, str) def request_sync(self, tag_name, href, sourceline_address): try: - self.sync_requested.emit(unicode(tag_name), unicode(href), json.loads(unicode(sourceline_address))) + self.sync_requested.emit(unicode_type(tag_name), unicode_type(href), json.loads(unicode_type(sourceline_address))) except (TypeError, ValueError, OverflowError, AttributeError): pass @@ -305,7 +305,7 @@ class WebPage(QWebPage): @pyqtSlot(str, str) def request_split(self, loc, totals): actions['split-in-preview'].setChecked(False) - loc, totals = json.loads(unicode(loc)), json.loads(unicode(totals)) + loc, totals = json.loads(unicode_type(loc)), json.loads(unicode_type(totals)) if not loc or not totals: return error_dialog(self.view(), _('Invalid location'), _('Cannot split on the body tag'), show=True) @@ -400,7 +400,7 @@ class WebView(QWebView): p = self.page() mf = p.mainFrame() r = mf.hitTestContent(ev.pos()) - url = unicode(r.linkUrl().toString(NO_URL_FORMATTING)).strip() + url = unicode_type(r.linkUrl().toString(NO_URL_FORMATTING)).strip() ca = self.pageAction(QWebPage.Copy) if ca.isEnabled(): menu.addAction(ca) @@ -483,7 +483,7 @@ class Preview(QWidget): self.bar.addAction(ac) def find(self, direction): - text = unicode(self.search.text()) + text = unicode_type(self.search.text()) self.view.findText(text, QWebPage.FindWrapsAroundDocument | ( QWebPage.FindBackward if direction == 'prev' else QWebPage.FindFlags(0))) diff --git a/src/calibre/gui2/tweak_book/search.py b/src/calibre/gui2/tweak_book/search.py index baa22e4c80..b45f566b2c 100644 --- a/src/calibre/gui2/tweak_book/search.py +++ b/src/calibre/gui2/tweak_book/search.py @@ -34,6 +34,7 @@ from calibre.gui2.tweak_book.widgets import BusyCursor from calibre.gui2.widgets2 import FlowLayout, HistoryComboBox from calibre.utils.icu import primary_contains from calibre.ebooks.conversion.search_replace import REGEX_FLAGS, compile_regular_expression +src/calibre/gui2/tweak_book/preferences.py # The search panel {{{ @@ -365,7 +366,7 @@ class SearchWidget(QWidget): @dynamic_property def find(self): def fget(self): - return unicode(self.find_text.text()) + return unicode_type(self.find_text.text()) def fset(self, val): self.find_text.setText(val) @@ -376,7 +377,7 @@ class SearchWidget(QWidget): def fget(self): if self.mode == 'function': return self.functions.text() - return unicode(self.replace_text.text()) + return unicode_type(self.replace_text.text()) def fset(self, val): self.replace_text.setText(val) @@ -614,7 +615,7 @@ class SearchesModel(QAbstractListModel): return None def do_filter(self, text): - text = unicode(text) + text = unicode_type(text) self.beginResetModel() self.filtered_searches = [] for i, search in enumerate(self.searches): @@ -797,7 +798,7 @@ class EditSearch(QFrame): # {{{ @property def current_search(self): search = self.search.copy() - f = unicode(self.find.toPlainText()) + f = unicode_type(self.find.toPlainText()) search['find'] = f search['dot_all'] = bool(self.dot_all.isChecked()) search['case_sensitive'] = bool(self.case_sensitive.isChecked()) @@ -805,7 +806,7 @@ class EditSearch(QFrame): # {{{ if search['mode'] == 'function': r = self.function.text() else: - r = unicode(self.replace.toPlainText()) + r = unicode_type(self.replace.toPlainText()) search['replace'] = r return search @@ -824,7 +825,7 @@ class EditSearch(QFrame): # {{{ search = self.search search['name'] = n - f = unicode(self.find.toPlainText()) + f = unicode_type(self.find.toPlainText()) if not f: error_dialog(self, _('Must specify find'), _( 'You must specify a find expression'), show=True) @@ -839,7 +840,7 @@ class EditSearch(QFrame): # {{{ 'You must specify a function name in Function-Regex mode'), show=True) return False else: - r = unicode(self.replace.toPlainText()) + r = unicode_type(self.replace.toPlainText()) search['replace'] = r search['dot_all'] = bool(self.dot_all.isChecked()) diff --git a/src/calibre/gui2/tweak_book/spell.py b/src/calibre/gui2/tweak_book/spell.py index 9a2e12a757..d592e98466 100644 --- a/src/calibre/gui2/tweak_book/spell.py +++ b/src/calibre/gui2/tweak_book/spell.py @@ -37,6 +37,7 @@ from calibre.spell.import_from import import_from_oxt from calibre.spell.break_iterator import split_into_words from calibre.utils.localization import calibre_langcode_to_name, get_language, get_lang, canonicalize_lang from calibre.utils.icu import sort_key, primary_sort_key, primary_contains, contains +from polyglot.builtins import unicode_type LANG = 0 COUNTRY = 1 @@ -107,7 +108,7 @@ class AddDictionary(QDialog): # {{{ @property def nickname(self): - return unicode(self.nick.text()).strip() + return unicode_type(self.nick.text()).strip() def accept(self): nick = self.nickname @@ -117,7 +118,7 @@ class AddDictionary(QDialog): # {{{ if nick in {d.name for d in custom_dictionaries()}: return error_dialog(self, _('Nickname already used'), _( 'A dictionary with the nick name "%s" already exists.') % nick, show=True) - oxt = unicode(self.path.text()) + oxt = unicode_type(self.path.text()) try: num = import_from_oxt(oxt, nick) except: @@ -243,7 +244,7 @@ class ManageUserDictionaries(Dialog): name, ok = QInputDialog.getText(self, _('New dictionary'), _( 'Name of the new dictionary')) if ok: - name = unicode(name) + name = unicode_type(name) if name in {d.name for d in dictionaries.all_user_dictionaries}: return error_dialog(self, _('Already used'), _( 'A dictionary with the name %s already exists') % name, show=True) @@ -268,7 +269,7 @@ class ManageUserDictionaries(Dialog): name, ok = QInputDialog.getText(self, _('New name'), _( 'New name for the dictionary')) if ok: - name = unicode(name) + name = unicode_type(name) if name == d.name: return if name in {d.name for d in dictionaries.all_user_dictionaries}: @@ -324,7 +325,7 @@ class ManageUserDictionaries(Dialog): if d.exec_() != d.Accepted: return d.loc.update_recently_used() - word = unicode(w.text()) + word = unicode_type(w.text()) lang = (loc.lang_codes or [canonicalize_lang(get_lang())])[0] if not word: return @@ -365,7 +366,7 @@ class ManageUserDictionaries(Dialog): if not lc: return error_dialog(self, _('Must specify language'), _( 'You must specify a language to import words'), show=True) - words = set(filter(None, [x.strip() for x in unicode(w.toPlainText()).splitlines()])) + words = set(filter(None, [x.strip() for x in unicode_type(w.toPlainText()).splitlines()])) lang = lc[0] words = {(w, lang) for w in words} - self.current_dictionary.words if dictionaries.add_to_user_dictionary(self.current_dictionary.name, words, DictionaryLocale(lang, None)): @@ -465,8 +466,8 @@ class ManageDictionaries(Dialog): # {{{ def data_changed(self, item, column): if column == 0 and item.type() == DICTIONARY: d = item.data(0, Qt.UserRole) - if not d.builtin and unicode(item.text(0)) != d.name: - rename_dictionary(d, unicode(item.text(0))) + if not d.builtin and unicode_type(item.text(0)) != d.name: + rename_dictionary(d, unicode_type(item.text(0))) def build_dictionaries(self, reread=False): all_dictionaries = builtin_dictionaries() | custom_dictionaries(reread=reread) @@ -549,7 +550,7 @@ class ManageDictionaries(Dialog): # {{{ pc.setText((_( 'This is already the preferred variant for the {1} language') if preferred else _( 'Use this as the preferred variant for the {1} language')).format( - unicode(item.text(0)), unicode(item.parent().text(0)))) + unicode_type(item.text(0)), unicode_type(item.parent().text(0)))) pc.setEnabled(not preferred) def set_preferred_country(self): @@ -558,9 +559,9 @@ class ManageDictionaries(Dialog): # {{{ bf.setBold(True) for x in (item.parent().child(i) for i in xrange(item.parent().childCount())): x.setData(0, Qt.FontRole, bf if x is item else None) - lc = unicode(item.parent().data(0, Qt.UserRole)) + lc = unicode_type(item.parent().data(0, Qt.UserRole)) pl = dprefs['preferred_locales'] - pl[lc] = '%s-%s' % (lc, unicode(item.data(0, Qt.UserRole))) + pl[lc] = '%s-%s' % (lc, unicode_type(item.data(0, Qt.UserRole))) dprefs['preferred_locales'] = pl def init_dictionary(self, item): @@ -579,8 +580,8 @@ class ManageDictionaries(Dialog): # {{{ bf.setItalic(True) for x in (item.parent().child(i) for i in xrange(item.parent().childCount())): x.setData(0, Qt.FontRole, bf if x is item else None) - cc = unicode(item.parent().data(0, Qt.UserRole)) - lc = unicode(item.parent().parent().data(0, Qt.UserRole)) + cc = unicode_type(item.parent().data(0, Qt.UserRole)) + lc = unicode_type(item.parent().parent().data(0, Qt.UserRole)) d = item.data(0, Qt.UserRole) locale = '%s-%s' % (lc, cc) pl = dprefs['preferred_dictionaries'] @@ -985,7 +986,7 @@ class SpellCheck(Dialog): m.show_only_misspelt = hh.isSectionHidden(3) self.ignore_button = b = QPushButton(_('&Ignore')) - b.ign_text, b.unign_text = unicode(b.text()), _('Un&ignore') + b.ign_text, b.unign_text = unicode_type(b.text()), _('Un&ignore') b.ign_tt = _('Ignore the current word for the rest of this session') b.unign_tt = _('Stop ignoring the current word') b.clicked.connect(self.toggle_ignore) @@ -994,7 +995,7 @@ class SpellCheck(Dialog): h.setStretch(0, 1) l.addWidget(b), l.addSpacing(20) self.add_button = b = QPushButton(_('Add word to &dictionary:')) - b.add_text, b.remove_text = unicode(b.text()), _('Remove from &dictionaries') + b.add_text, b.remove_text = unicode_type(b.text()), _('Remove from &dictionaries') b.add_tt = _('Add the current word to the specified user dictionary') b.remove_tt = _('Remove the current word from all active user dictionaries') b.clicked.connect(self.add_remove) @@ -1059,7 +1060,7 @@ class SpellCheck(Dialog): def search_type_changed(self): tprefs['spell_check_case_sensitive_search'] = bool(self.case_sensitive_search.isChecked()) - if unicode(self.filter_text.text()).strip(): + if unicode_type(self.filter_text.text()).strip(): self.do_filter() def show_next_occurrence(self): @@ -1072,7 +1073,7 @@ class SpellCheck(Dialog): self.find_word.emit(w, self.words_model.words[w]) def initialize_user_dictionaries(self): - ct = unicode(self.user_dictionaries.currentText()) + ct = unicode_type(self.user_dictionaries.currentText()) self.user_dictionaries.clear() self.user_dictionaries.addItems([d.name for d in dictionaries.active_user_dictionaries]) if ct: @@ -1147,7 +1148,7 @@ class SpellCheck(Dialog): w = self.words_model.word_for_row(row) if w is None: return - new_word = unicode(self.suggested_word.text()) + new_word = unicode_type(self.suggested_word.text()) self.change_requested.emit(w, new_word) def change_word_after_update(self, w, new_word): @@ -1203,7 +1204,7 @@ class SpellCheck(Dialog): current = self.words_view.currentIndex() if current.isValid(): if self.user_dictionaries.isVisible(): # add - udname = unicode(self.user_dictionaries.currentText()) + udname = unicode_type(self.user_dictionaries.currentText()) self.words_model.add_word(current.row(), udname) else: self.words_model.remove_word(current.row()) @@ -1225,7 +1226,7 @@ class SpellCheck(Dialog): self.__current_word = None def do_filter(self): - text = unicode(self.filter_text.text()).strip() + text = unicode_type(self.filter_text.text()).strip() with self: self.words_model.filter(text) diff --git a/src/calibre/gui2/tweak_book/text_search.py b/src/calibre/gui2/tweak_book/text_search.py index 33f453aabe..48ad66aea2 100644 --- a/src/calibre/gui2/tweak_book/text_search.py +++ b/src/calibre/gui2/tweak_book/text_search.py @@ -17,6 +17,7 @@ from calibre.gui2.tweak_book import tprefs, editors, current_container from calibre.gui2.tweak_book.search import get_search_regex, InvalidRegex, initialize_search_request from calibre.gui2.tweak_book.widgets import BusyCursor from calibre.gui2.widgets2 import HistoryComboBox +from polyglot.builtins import unicode_type # UI {{{ @@ -182,7 +183,7 @@ def run_text_search(search, current_editor, current_editor_name, searchable_name else: root = current_container().parsed(fname) if hasattr(root, 'xpath'): - raw = tostring(root, method='text', encoding=unicode, with_tail=True) + raw = tostring(root, method='text', encoding=unicode_type, with_tail=True) else: raw = current_container().raw_data(fname) if pat.search(raw) is not None: diff --git a/src/calibre/gui2/tweak_book/toc.py b/src/calibre/gui2/tweak_book/toc.py index 722d0e7361..d2c0de0061 100644 --- a/src/calibre/gui2/tweak_book/toc.py +++ b/src/calibre/gui2/tweak_book/toc.py @@ -16,6 +16,7 @@ from calibre.ebooks.oeb.polish.toc import commit_toc, get_toc from calibre.gui2 import error_dialog from calibre.gui2.toc.main import TOCView, ItemEdit from calibre.gui2.tweak_book import current_container, TOP, actions, tprefs +from polyglot.builtins import unicode_type class TOCEditor(QDialog): @@ -192,8 +193,8 @@ class TOCViewer(QWidget): def emit_navigate(self, *args): item = self.view.currentItem() if item is not None: - dest = unicode(item.data(0, DEST_ROLE) or '') - frag = unicode(item.data(0, FRAG_ROLE) or '') + dest = unicode_type(item.data(0, DEST_ROLE) or '') + frag = unicode_type(item.data(0, FRAG_ROLE) or '') if not frag: frag = TOP self.navigate_requested.emit(dest, frag) diff --git a/src/calibre/gui2/tweak_book/ui.py b/src/calibre/gui2/tweak_book/ui.py index 403b530f81..8e27f78496 100644 --- a/src/calibre/gui2/tweak_book/ui.py +++ b/src/calibre/gui2/tweak_book/ui.py @@ -9,7 +9,7 @@ __copyright__ = '2013, Kovid Goyal ' import os from functools import partial from itertools import product -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from PyQt5.Qt import ( QDockWidget, Qt, QLabel, QIcon, QAction, QApplication, QWidget, QEvent, @@ -273,7 +273,7 @@ class Main(MainWindow): self.cursor_position_widget = CursorPositionWidget(self) self.status_bar.addPermanentWidget(self.cursor_position_widget) self.status_bar_default_msg = la = QLabel(' ' + _('{0} {1} created by {2}').format(__appname__, get_version(), 'Kovid Goyal')) - la.base_template = unicode(la.text()) + la.base_template = unicode_type(la.text()) self.status_bar.addWidget(la) f = self.status_bar.font() f.setBold(True) @@ -324,7 +324,7 @@ class Main(MainWindow): if isinstance(keys, type('')): keys = (keys,) self.keyboard.register_shortcut( - sid, unicode(ac.text()).replace('&', ''), default_keys=keys, description=description, action=ac, group=group) + sid, unicode_type(ac.text()).replace('&', ''), default_keys=keys, description=description, action=ac, group=group) self.addAction(ac) return ac @@ -622,7 +622,7 @@ class Main(MainWindow): if self.plugin_menu_actions: e = b.addMenu(_('&Plugins')) - for ac in sorted(self.plugin_menu_actions, key=lambda x:sort_key(unicode(x.text()))): + for ac in sorted(self.plugin_menu_actions, key=lambda x:sort_key(unicode_type(x.text()))): e.addAction(ac) e = b.addMenu(_('&Help')) @@ -674,7 +674,7 @@ class Main(MainWindow): bar.addAction(actions[ac]) except KeyError: if DEBUG: - prints('Unknown action for toolbar %r: %r' % (unicode(bar.objectName()), ac)) + prints('Unknown action for toolbar %r: %r' % (unicode_type(bar.objectName()), ac)) for x in tprefs['global_book_toolbar']: add(self.global_bar, x) diff --git a/src/calibre/gui2/tweak_book/widgets.py b/src/calibre/gui2/tweak_book/widgets.py index 05ba48c23c..fe70f3033d 100644 --- a/src/calibre/gui2/tweak_book/widgets.py +++ b/src/calibre/gui2/tweak_book/widgets.py @@ -28,6 +28,7 @@ from calibre.gui2.widgets2 import Dialog as BaseDialog, HistoryComboBox from calibre.utils.icu import primary_sort_key, sort_key, primary_contains, numeric_sort_key from calibre.utils.matcher import get_char, Matcher from calibre.gui2.complete2 import EditWithComplete +from polyglot.builtins import unicode_type ROOT = QModelIndex() PARAGRAPH_SEPARATOR = '\u2029' @@ -71,7 +72,7 @@ class InsertTag(Dialog): # {{{ @property def tag(self): - return unicode(self.tag_input.text()).strip() + return unicode_type(self.tag_input.text()).strip() @classmethod def test(cls): @@ -132,7 +133,7 @@ class RationalizeFolders(Dialog): # {{{ def folder_map(self): ans = {} for typ, x in self.TYPE_MAP: - val = unicode(getattr(self, '%s_folder' % typ).text()).strip().strip('/') + val = unicode_type(getattr(self, '%s_folder' % typ).text()).strip().strip('/') ans[typ] = val return ans @@ -244,15 +245,15 @@ class ImportForeign(Dialog): # {{{ self.dest.setText(path) def accept(self): - if not unicode(self.src.text()): + if not unicode_type(self.src.text()): return error_dialog(self, _('Need document'), _( 'You must specify the source file that will be imported.'), show=True) Dialog.accept(self) @property def data(self): - src = unicode(self.src.text()).strip() - dest = unicode(self.dest.text()).strip() + src = unicode_type(self.src.text()).strip() + dest = unicode_type(self.dest.text()).strip() if not dest: dest = src.rpartition('.')[0] + '.epub' return src, dest @@ -450,7 +451,7 @@ class QuickOpen(Dialog): l.addWidget(self.bb, alignment=Qt.AlignBottom) def update_matches(self, text): - text = unicode(text).strip() + text = unicode_type(text).strip() self.help_label.setVisible(False) self.results.setVisible(True) matches = self.matcher(text, limit=100) @@ -546,7 +547,7 @@ class NamesModel(QAbstractListModel): return '\xa0' * 20 def filter(self, query): - query = unicode(query or '') + query = unicode_type(query or '') self.beginResetModel() if not query: self.items = tuple((text, None) for text in self.names) @@ -611,7 +612,7 @@ class AnchorsModel(QAbstractListModel): self.filter('') def filter(self, query): - query = unicode(query or '') + query = unicode_type(query or '') self.beginResetModel() self.items = [x for x in self.names if primary_contains(query, x[0]) or primary_contains(query, x[1])] self.endResetModel() @@ -739,11 +740,11 @@ class InsertLink(Dialog): @property def href(self): - return unicode(self.target.text()).strip() + return unicode_type(self.target.text()).strip() @property def text(self): - return unicode(self.text_edit.text()).strip() + return unicode_type(self.text_edit.text()).strip() @property def template(self): @@ -883,7 +884,7 @@ class InsertSemantics(Dialog): d.exec_() def semantic_type_changed(self): - item_type = unicode(self.semantic_type.itemData(self.semantic_type.currentIndex()) or '') + item_type = unicode_type(self.semantic_type.itemData(self.semantic_type.currentIndex()) or '') name, frag = self.final_type_map.get(item_type, (None, None)) self.show_type(name, frag) @@ -908,8 +909,8 @@ class InsertSemantics(Dialog): self.target.blockSignals(False) def target_text_changed(self): - name, frag = unicode(self.target.text()).partition('#')[::2] - item_type = unicode(self.semantic_type.itemData(self.semantic_type.currentIndex()) or '') + name, frag = unicode_type(self.target.text()).partition('#')[::2] + item_type = unicode_type(self.semantic_type.itemData(self.semantic_type.currentIndex()) or '') self.final_type_map[item_type] = (name, frag or None) def selected_file_changed(self, *args): @@ -1027,7 +1028,7 @@ class FilterCSS(Dialog): # {{{ a('float'), a('clear') if self.opt_colors.isChecked(): a('color'), a('background-color') - for x in unicode(self.others.text()).split(','): + for x in unicode_type(self.others.text()).split(','): x = x.strip() if x: a(x) @@ -1213,7 +1214,7 @@ class PlainTextEdit(QPlainTextEdit): # {{{ return ans.rstrip('\0') def selected_text_from_cursor(self, cursor): - return unicodedata.normalize('NFC', unicode(cursor.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0')) + return unicodedata.normalize('NFC', unicode_type(cursor.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0')) @property def selected_text(self): diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 6336a2411f..5642ba1a24 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -1,7 +1,6 @@ #!/usr/bin/env python2 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai -from __future__ import with_statement -from __future__ import print_function +from __future__ import print_function, with_statement __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' @@ -54,6 +53,7 @@ from calibre.gui2.dbus_export.widgets import factory from calibre.gui2.open_with import register_keyboard_shortcuts from calibre.library import current_library_name from calibre.srv.library_broker import GuiLibraryBroker +from polyglot.builtins import unicode_type class Listener(Thread): # {{{ @@ -600,7 +600,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ if self.content_server is not None and \ self.content_server.exception is not None: error_dialog(self, _('Failed to start Content server'), - unicode(self.content_server.exception)).exec_() + unicode_type(self.content_server.exception)).exec_() @property def current_db(self): @@ -888,7 +888,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ pass if not minz: self.job_error_dialog.show_error(dialog_title, - _('Failed')+': '+unicode(job.description), + _('Failed')+': '+unicode_type(job.description), det_msg=job.details, retry_func=retry_func) def read_settings(self): diff --git a/src/calibre/gui2/update.py b/src/calibre/gui2/update.py index a688129e15..394e5cc674 100644 --- a/src/calibre/gui2/update.py +++ b/src/calibre/gui2/update.py @@ -2,7 +2,7 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' import re, binascii, cPickle, ssl, json -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from threading import Thread, Event from PyQt5.Qt import (QObject, pyqtSignal, Qt, QUrl, QDialog, QGridLayout, @@ -56,7 +56,7 @@ def get_newest_version(): except UnicodeDecodeError: version = u'' ans = NO_CALIBRE_UPDATE - m = re.match(unicode(r'(\d+)\.(\d+).(\d+)$'), version) + m = re.match(unicode_type(r'(\d+)\.(\d+).(\d+)$'), version) if m is not None: ans = tuple(map(int, (m.group(1), m.group(2), m.group(3)))) return ans @@ -195,7 +195,7 @@ class UpdateMixin(object): has_plugin_updates = number_of_plugin_updates > 0 self.plugin_update_found(number_of_plugin_updates) version_url = binascii.hexlify(cPickle.dumps((calibre_version, number_of_plugin_updates), -1)) - calibre_version = u'.'.join(map(unicode, calibre_version)) + calibre_version = u'.'.join(map(unicode_type, calibre_version)) if not has_calibre_update and not has_plugin_updates: self.status_bar.update_label.setVisible(False) @@ -246,7 +246,7 @@ class UpdateMixin(object): plugin.qaction.setToolTip(_('Install and configure user plugins')) def update_link_clicked(self, url): - url = unicode(url) + url = unicode_type(url) if url.startswith('update:'): calibre_version, number_of_plugin_updates = cPickle.loads(binascii.unhexlify(url[len('update:'):])) self.update_found(calibre_version, number_of_plugin_updates, force=True) diff --git a/src/calibre/gui2/viewer/bookmarkmanager.py b/src/calibre/gui2/viewer/bookmarkmanager.py index 708976d619..31bb7d57be 100644 --- a/src/calibre/gui2/viewer/bookmarkmanager.py +++ b/src/calibre/gui2/viewer/bookmarkmanager.py @@ -14,6 +14,7 @@ from PyQt5.Qt import ( from calibre.gui2 import choose_save_file, choose_files from calibre.utils.icu import sort_key +from polyglot.builtins import unicode_type class BookmarksList(QListWidget): @@ -146,7 +147,7 @@ class BookmarkManager(QWidget): def item_changed(self, item): self.bookmarks_list.blockSignals(True) - title = unicode(item.data(Qt.DisplayRole)) + title = unicode_type(item.data(Qt.DisplayRole)) if not title: title = _('Unknown') item.setData(Qt.DisplayRole, title) diff --git a/src/calibre/gui2/viewer/config.py b/src/calibre/gui2/viewer/config.py index 78fe6aceae..cc5e71c188 100644 --- a/src/calibre/gui2/viewer/config.py +++ b/src/calibre/gui2/viewer/config.py @@ -22,6 +22,7 @@ from calibre.gui2 import min_available_height, error_dialog from calibre.gui2.languages import LanguagesEdit from calibre.gui2.shortcuts import ShortcutConfig from calibre.gui2.viewer.config_ui import Ui_Dialog +from polyglot.builtins import unicode_type def config(defaults=None): @@ -197,7 +198,7 @@ class ConfigDialog(QDialog, Ui_Dialog): _('Choose a name for this theme')) if not ok: return - themename = unicode(themename).strip() + themename = unicode_type(themename).strip() if not themename: return c = config('') @@ -380,7 +381,7 @@ class ConfigDialog(QDialog, Ui_Dialog): col = QColorDialog.getColor(initial, self, title, QColorDialog.ShowAlphaChannel) if col.isValid(): - name = unicode(col.name()) + name = unicode_type(col.name()) setattr(self, 'current_%s_color'%which, name) self.update_sample_colors() @@ -405,15 +406,15 @@ class ConfigDialog(QDialog, Ui_Dialog): return QDialog.accept(self, *args) def save_options(self, c): - c.set('serif_family', unicode(self.serif_family.currentFont().family())) - c.set('sans_family', unicode(self.sans_family.currentFont().family())) - c.set('mono_family', unicode(self.mono_family.currentFont().family())) + c.set('serif_family', unicode_type(self.serif_family.currentFont().family())) + c.set('sans_family', unicode_type(self.sans_family.currentFont().family())) + c.set('mono_family', unicode_type(self.mono_family.currentFont().family())) c.set('default_font_size', self.default_font_size.value()) c.set('minimum_font_size', self.minimum_font_size.value()) c.set('mono_font_size', self.mono_font_size.value()) c.set('standard_font', {0:'serif', 1:'sans', 2:'mono'}[ self.standard_font.currentIndex()]) - c.set('user_css', unicode(self.css.toPlainText())) + c.set('user_css', unicode_type(self.css.toPlainText())) c.set('remember_window_size', self.opt_remember_window_size.isChecked()) c.set('fit_images', self.opt_fit_images.isChecked()) c.set('max_fs_width', int(self.max_fs_width.value())) diff --git a/src/calibre/gui2/viewer/documentview.py b/src/calibre/gui2/viewer/documentview.py index 37be8b36ee..430b3d940b 100644 --- a/src/calibre/gui2/viewer/documentview.py +++ b/src/calibre/gui2/viewer/documentview.py @@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en' import math, json from base64 import b64encode from functools import partial -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from PyQt5.Qt import ( QSize, QSizePolicy, QUrl, Qt, QPainter, QPalette, QBrush, @@ -149,7 +149,7 @@ class Document(QWebPage): # {{{ def findText(self, q, flags): if self.hyphenatable: - q = unicode(q) + q = unicode_type(q) hyphenated_q = self.javascript( 'hyphenate_text(%s, "%s")' % (json.dumps(q, ensure_ascii=False), self.loaded_lang), typ='string') if hyphenated_q and QWebPage.findText(self, hyphenated_q, flags): @@ -320,7 +320,7 @@ class Document(QWebPage): # {{{ @pyqtSlot(str) def debug(self, msg): - prints(unicode(msg)) + prints(unicode_type(msg)) @pyqtSlot(int) def jump_to_cfi_finished(self, job_id): @@ -393,7 +393,7 @@ class Document(QWebPage): # {{{ return ans def elem_outer_xml(self, elem): - return unicode(elem.toOuterXml()) + return unicode_type(elem.toOuterXml()) def bookmark(self): pos = self.page_position.current_pos @@ -512,7 +512,7 @@ class Document(QWebPage): # {{{ self.setPreferredContentsSize(s) def extract_node(self): - return unicode(self.mainFrame().evaluateJavaScript( + return unicode_type(self.mainFrame().evaluateJavaScript( 'window.calibre_extract.extract()')) # }}} @@ -670,7 +670,7 @@ class DocumentView(QWebView): # {{{ self.manager.selection_changed(self.selected_text, self.selected_html) def _selectedText(self): - t = unicode(self.selectedText()).strip() + t = unicode_type(self.selectedText()).strip() if not t: return u'' if len(t) > 40: @@ -699,7 +699,7 @@ class DocumentView(QWebView): # {{{ table = None parent = elem while not parent.isNull(): - if (unicode(parent.tagName()) == u'table' or unicode(parent.localName()) == u'table'): + if (unicode_type(parent.tagName()) == u'table' or unicode_type(parent.localName()) == u'table'): table = parent break parent = parent.parent() @@ -727,10 +727,10 @@ class DocumentView(QWebView): # {{{ self.search_online_action.setText(text) for x, sc in (('search_online', 'Search online'), ('dictionary', 'Lookup word'), ('search', 'Next occurrence')): ac = getattr(self, '%s_action' % x) - menu.addAction(ac.icon(), '%s [%s]' % (unicode(ac.text()), ','.join(self.shortcuts.get_shortcuts(sc))), ac.trigger) + menu.addAction(ac.icon(), '%s [%s]' % (unicode_type(ac.text()), ','.join(self.shortcuts.get_shortcuts(sc))), ac.trigger) if from_touch and self.manager is not None: - word = unicode(mf.evaluateJavaScript('window.calibre_utils.word_at_point(%f, %f)' % (ev.pos().x(), ev.pos().y())) or '') + word = unicode_type(mf.evaluateJavaScript('window.calibre_utils.word_at_point(%f, %f)' % (ev.pos().x(), ev.pos().y())) or '') if word: menu.addAction(self.dictionary_action.icon(), _('Lookup %s in the dictionary') % word, partial(self.manager.lookup, word)) menu.addAction(self.search_online_action.icon(), _('Search for %s online') % word, partial(self.do_search_online, word)) @@ -790,18 +790,18 @@ class DocumentView(QWebView): # {{{ def lookup(self, *args): if self.manager is not None: - t = unicode(self.selectedText()).strip() + t = unicode_type(self.selectedText()).strip() if t: self.manager.lookup(t.split()[0]) def search_next(self): if self.manager is not None: - t = unicode(self.selectedText()).strip() + t = unicode_type(self.selectedText()).strip() if t: self.manager.search.set_search_string(t) def search_online(self): - t = unicode(self.selectedText()).strip() + t = unicode_type(self.selectedText()).strip() if t: self.do_search_online(t) @@ -839,7 +839,7 @@ class DocumentView(QWebView): # {{{ return (l, d.ypos, r, d.ypos + d.window_height) def link_hovered(self, link, text, context): - link, text = unicode(link), unicode(text) + link, text = unicode_type(link), unicode_type(text) if link: self.setCursor(Qt.PointingHandCursor) else: diff --git a/src/calibre/gui2/viewer/footnote.py b/src/calibre/gui2/viewer/footnote.py index 9f57c2b9ea..51ee28268d 100644 --- a/src/calibre/gui2/viewer/footnote.py +++ b/src/calibre/gui2/viewer/footnote.py @@ -18,6 +18,7 @@ from PyQt5.QtWebKit import QWebSettings from calibre import prints from calibre.constants import DEBUG, FAKE_PROTOCOL, FAKE_HOST from calibre.ebooks.oeb.display.webview import load_html +from polyglot.builtins import unicode_type class FootnotesPage(QWebPage): @@ -60,7 +61,7 @@ class FootnotesPage(QWebPage): def javaScriptConsoleMessage(self, msg, lineno, source_id): if DEBUG: - prints('FootnoteView:%s:%s:'%(unicode(source_id), lineno), unicode(msg)) + prints('FootnoteView:%s:%s:'%(unicode_type(source_id), lineno), unicode_type(msg)) class FootnotesView(QWidget): diff --git a/src/calibre/gui2/viewer/image_popup.py b/src/calibre/gui2/viewer/image_popup.py index 19ecbed6ff..74e7a1a009 100644 --- a/src/calibre/gui2/viewer/image_popup.py +++ b/src/calibre/gui2/viewer/image_popup.py @@ -12,6 +12,7 @@ from PyQt5.Qt import (QDialog, QPixmap, QUrl, QScrollArea, QLabel, QSizePolicy, Qt, QTransform, QSvgRenderer, QImage, QPainter) from calibre.gui2 import choose_save_file, gprefs, NO_URL_FORMATTING, max_available_height +from polyglot.builtins import unicode_type def render_svg(widget, path): @@ -122,7 +123,7 @@ class ImageView(QDialog): if geom is not None: self.restoreGeometry(geom) try: - self.current_image_name = unicode(self.current_url.toString(NO_URL_FORMATTING)).rpartition('/')[-1] + self.current_image_name = unicode_type(self.current_url.toString(NO_URL_FORMATTING)).rpartition('/')[-1] except AttributeError: self.current_image_name = self.current_url title = _('View image: %s')%self.current_image_name diff --git a/src/calibre/gui2/viewer/main.py b/src/calibre/gui2/viewer/main.py index 2bdf3630b0..4d788093fe 100644 --- a/src/calibre/gui2/viewer/main.py +++ b/src/calibre/gui2/viewer/main.py @@ -33,6 +33,7 @@ from calibre.utils.config import Config, JSONConfig, StringConfig from calibre.utils.ipc import RC, viewer_socket_address from calibre.utils.localization import canonicalize_lang, get_lang, lang_as_iso639_1 from calibre.utils.zipfile import BadZipfile +from polyglot.builtins import unicode_type try: from calibre.utils.monotonic import monotonic @@ -672,11 +673,11 @@ class EbookViewer(MainWindow): tt = '%(action)s [%(sc)s]\n'+_('Current magnification: %(mag).1f') sc = _(' or ').join(self.view.shortcuts.get_shortcuts('Font larger')) self.action_font_size_larger.setToolTip( - tt %dict(action=unicode(self.action_font_size_larger.text()), + tt %dict(action=unicode_type(self.action_font_size_larger.text()), mag=val, sc=sc)) sc = _(' or ').join(self.view.shortcuts.get_shortcuts('Font smaller')) self.action_font_size_smaller.setToolTip( - tt %dict(action=unicode(self.action_font_size_smaller.text()), + tt %dict(action=unicode_type(self.action_font_size_smaller.text()), mag=val, sc=sc)) self.action_font_size_larger.setEnabled(self.view.multiplier < 3) self.action_font_size_smaller.setEnabled(self.view.multiplier > 0.2) @@ -703,10 +704,10 @@ class EbookViewer(MainWindow): self.load_path(self.iterator.spine[index]) def find_next(self): - self.find(unicode(self.search.text()), repeat=True) + self.find(unicode_type(self.search.text()), repeat=True) def find_previous(self): - self.find(unicode(self.search.text()), repeat=True, backwards=True) + self.find(unicode_type(self.search.text()), repeat=True, backwards=True) def do_search(self, text, backwards): self.pending_search = None @@ -725,7 +726,7 @@ class EbookViewer(MainWindow): self.history.add(self.pos.value()) path = self.iterator.spine[self.iterator.spine.index(path)] if url.hasFragment(): - frag = unicode(url.fragment()) + frag = unicode_type(url.fragment()) if path != self.current_page: self.pending_anchor = frag self.load_path(path) @@ -931,7 +932,7 @@ class EbookViewer(MainWindow): num += 1 title, ok = QInputDialog.getText(self, _('Add bookmark'), _('Enter title for bookmark:'), text=bm) - title = unicode(title).strip() + title = unicode_type(title).strip() if ok and title: bm = self.view.bookmark() bm['spine'] = self.current_index diff --git a/src/calibre/gui2/viewer/ui.py b/src/calibre/gui2/viewer/ui.py index aa5f1d4301..f5ddabe73c 100644 --- a/src/calibre/gui2/viewer/ui.py +++ b/src/calibre/gui2/viewer/ui.py @@ -22,6 +22,7 @@ from calibre.gui2.viewer.bookmarkmanager import BookmarkManager from calibre.gui2.viewer.toc import TOCView, TOCSearch from calibre.gui2.viewer.footnote import FootnotesView from calibre.utils.localization import is_rtl +from polyglot.builtins import unicode_type class DoubleSpinBox(QDoubleSpinBox): # {{{ @@ -61,7 +62,7 @@ class Reference(QLineEdit): # {{{ self.editingFinished.connect(self.editing_finished) def editing_finished(self): - text = unicode(self.text()) + text = unicode_type(self.text()) self.setText('') self.goto.emit(text) # }}} @@ -215,7 +216,7 @@ class Main(MainWindow): def __init__(self, debug_javascript): MainWindow.__init__(self, None) self.setWindowTitle(_('E-book viewer')) - self.base_window_title = unicode(self.windowTitle()) + self.base_window_title = unicode_type(self.windowTitle()) self.setObjectName('EbookViewer') self.setWindowIcon(QIcon(I('viewer.png'))) self.setDockOptions(self.AnimatedDocks | self.AllowTabbedDocks) @@ -383,7 +384,7 @@ class Main(MainWindow): ac.setObjectName(name) (tb or self.tool_bar).addAction(ac) if sc_name: - ac.setToolTip(unicode(ac.text()) + (' [%s]' % _(' or ').join(self.view.shortcuts.get_shortcuts(sc_name)))) + ac.setToolTip(unicode_type(ac.text()) + (' [%s]' % _(' or ').join(self.view.shortcuts.get_shortcuts(sc_name)))) if menu_name is not None: menu_name += '_menu' m = QMenu() diff --git a/src/calibre/gui2/widgets.py b/src/calibre/gui2/widgets.py index e99cd3e99b..492e167307 100644 --- a/src/calibre/gui2/widgets.py +++ b/src/calibre/gui2/widgets.py @@ -23,6 +23,7 @@ from calibre.gui2.progress_indicator import ProgressIndicator as _ProgressIndica from calibre.gui2.dnd import (dnd_has_image, dnd_get_image, dnd_get_files, image_extensions, dnd_has_extension, DownloadDialog) from calibre.utils.localization import localize_user_manual_link +from polyglot.builtins import unicode_type history = XMLConfig('history') @@ -83,7 +84,7 @@ class FilenamePattern(QWidget, Ui_Form): # {{{ # Get all items in the combobox. If we are reseting # to defaults we don't want to lose what the user # has added. - val_hist = [unicode(self.re.lineEdit().text())] + [unicode(self.re.itemText(i)) for i in xrange(self.re.count())] + val_hist = [unicode_type(self.re.lineEdit().text())] + [unicode_type(self.re.itemText(i)) for i in xrange(self.re.count())] self.re.clear() if defaults: @@ -106,7 +107,7 @@ class FilenamePattern(QWidget, Ui_Form): # {{{ def do_test(self): from calibre.ebooks.metadata import authors_to_string from calibre.ebooks.metadata.meta import metadata_from_filename - fname = unicode(self.filename.text()) + fname = unicode_type(self.filename.text()) ext = os.path.splitext(fname)[1][1:].lower() if ext not in BOOK_EXTENSIONS: return warning_dialog(self, _('Test file name invalid'), @@ -154,7 +155,7 @@ class FilenamePattern(QWidget, Ui_Form): # {{{ self.comments.setText(mi.comments if mi.comments else _('No match')) def pattern(self): - pat = unicode(self.re.lineEdit().text()) + pat = unicode_type(self.re.lineEdit().text()) return re.compile(pat) def commit(self): @@ -162,7 +163,7 @@ class FilenamePattern(QWidget, Ui_Form): # {{{ prefs['filename_pattern'] = pat history = [] - history_pats = [unicode(self.re.lineEdit().text())] + [unicode(self.re.itemText(i)) for i in xrange(self.re.count())] + history_pats = [unicode_type(self.re.lineEdit().text())] + [unicode_type(self.re.itemText(i)) for i in xrange(self.re.count())] for p in history_pats[:24]: # Ensure we don't have duplicate items. if p and p not in history: @@ -485,23 +486,23 @@ class LineEditECM(object): # {{{ def upper_case(self): from calibre.utils.icu import upper - self.setText(upper(unicode(self.text()))) + self.setText(upper(unicode_type(self.text()))) def lower_case(self): from calibre.utils.icu import lower - self.setText(lower(unicode(self.text()))) + self.setText(lower(unicode_type(self.text()))) def swap_case(self): from calibre.utils.icu import swapcase - self.setText(swapcase(unicode(self.text()))) + self.setText(swapcase(unicode_type(self.text()))) def title_case(self): from calibre.utils.titlecase import titlecase - self.setText(titlecase(unicode(self.text()))) + self.setText(titlecase(unicode_type(self.text()))) def capitalize(self): from calibre.utils.icu import capitalize - self.setText(capitalize(unicode(self.text()))) + self.setText(capitalize(unicode_type(self.text()))) # }}} @@ -583,13 +584,13 @@ class CompleteLineEdit(EnLineEdit): # {{{ self.space_before_sep = space_before def text_changed(self, text): - all_text = unicode(text) + all_text = unicode_type(text) text = all_text[:self.cursorPosition()] prefix = text.split(self.separator)[-1].strip() text_items = [] for t in all_text.split(self.separator): - t1 = unicode(t).strip() + t1 = unicode_type(t).strip() if t1 != '': text_items.append(t) text_items = list(set(text_items)) @@ -597,8 +598,8 @@ class CompleteLineEdit(EnLineEdit): # {{{ def complete_text(self, text): cursor_pos = self.cursorPosition() - before_text = unicode(self.text())[:cursor_pos] - after_text = unicode(self.text())[cursor_pos:] + before_text = unicode_type(self.text())[:cursor_pos] + after_text = unicode_type(self.text())[cursor_pos:] prefix_len = len(before_text.split(self.separator)[-1].lstrip()) if self.space_before_sep: complete_text_pat = '%s%s %s %s' @@ -627,7 +628,7 @@ class EnComboBox(QComboBox): # {{{ self.setMinimumContentsLength(20) def text(self): - return unicode(self.currentText()) + return unicode_type(self.currentText()) def setText(self, text): idx = self.findText(text, Qt.MatchFixedString|Qt.MatchCaseSensitive) @@ -683,11 +684,11 @@ class HistoryLineEdit(QComboBox): # {{{ def save_history(self): items = [] - ct = unicode(self.currentText()) + ct = unicode_type(self.currentText()) if ct: items.append(ct) for i in range(self.count()): - item = unicode(self.itemText(i)) + item = unicode_type(self.itemText(i)) if item not in items: items.append(item) self.blockSignals(True) @@ -1081,7 +1082,7 @@ class Splitter(QSplitter): parent.addAction(self.action_toggle) if hasattr(parent, 'keyboard'): parent.keyboard.register_shortcut('splitter %s %s'%(name, - label), unicode(self.action_toggle.text()), + label), unicode_type(self.action_toggle.text()), default_keys=(shortcut,), action=self.action_toggle) else: self.action_toggle.setShortcut(shortcut) diff --git a/src/calibre/gui2/widgets2.py b/src/calibre/gui2/widgets2.py index 492bf08a4c..c941a0d39e 100644 --- a/src/calibre/gui2/widgets2.py +++ b/src/calibre/gui2/widgets2.py @@ -19,6 +19,7 @@ from calibre.ebooks.metadata import rating_to_stars from calibre.gui2 import gprefs, rating_font from calibre.gui2.complete2 import LineEdit, EditWithComplete from calibre.gui2.widgets import history +from polyglot.builtins import unicode_type class HistoryMixin(object): @@ -44,7 +45,7 @@ class HistoryMixin(object): self.lineEdit().editingFinished.connect(self.save_history) def save_history(self): - ct = unicode(self.text()) + ct = unicode_type(self.text()) if len(ct) > 2: try: self.history.remove(ct) @@ -91,7 +92,7 @@ class ColorButton(QPushButton): return self._color def fset(self, val): - val = unicode(val or '') + val = unicode_type(val or '') col = QColor(val) orig = self._color if col.isValid(): @@ -111,7 +112,7 @@ class ColorButton(QPushButton): def choose_color(self): col = QColorDialog.getColor(QColor(self._color or Qt.white), self, _('Choose a color')) if col.isValid(): - self.color = unicode(col.name()) + self.color = unicode_type(col.name()) def access_key(k): diff --git a/src/calibre/gui2/wizard/__init__.py b/src/calibre/gui2/wizard/__init__.py index 39b9aaa119..93b0d9ba1b 100644 --- a/src/calibre/gui2/wizard/__init__.py +++ b/src/calibre/gui2/wizard/__init__.py @@ -25,6 +25,7 @@ from calibre.utils.localization import localize_user_manual_link from calibre.utils.config import dynamic, prefs from calibre.gui2 import choose_dir, error_dialog +from polyglot.builtins import unicode_type if iswindows: winutil = plugins['winutil'][0] @@ -503,14 +504,14 @@ class KindlePage(QWizardPage, KindleUI): self.to_address.setText(accs[0][0]) def x(): - t = unicode(self.to_address.text()) + t = unicode_type(self.to_address.text()) if t.strip(): return t.strip() self.send_email_widget.initialize(x) def commit(self): - x = unicode(self.to_address.text()).strip() + x = unicode_type(self.to_address.text()).strip() parts = x.split('@') if (len(parts) >= 2 and parts[0] and self.send_email_widget.set_email_settings(True)): @@ -571,7 +572,7 @@ class StanzaPage(QWizardPage, StanzaUI): for p in range(8080, 8100): try: s.bind(('0.0.0.0', p)) - t = unicode(self.instructions.text()) + t = unicode_type(self.instructions.text()) t = re.sub(r':\d+', ':'+str(p), t) self.instructions.setText(t) return p @@ -720,7 +721,7 @@ class LibraryPage(QWizardPage, LibraryUI): return False def validatePage(self): - newloc = unicode(self.location.text()) + newloc = unicode_type(self.location.text()) if not self.is_library_dir_suitable(newloc): self.show_library_dir_error(newloc) return False @@ -750,11 +751,11 @@ class LibraryPage(QWizardPage, LibraryUI): self.show_library_dir_error(x) def show_library_dir_error(self, x): - if not isinstance(x, unicode): + if not isinstance(x, unicode_type): try: x = x.decode(filesystem_encoding) except: - x = unicode(repr(x)) + x = unicode_type(repr(x)) error_dialog(self, _('Bad location'), _('You must choose an empty folder for ' 'the calibre library. %s is not empty.')%x, show=True) @@ -788,7 +789,7 @@ class LibraryPage(QWizardPage, LibraryUI): def isComplete(self): try: - lp = unicode(self.location.text()) + lp = unicode_type(self.location.text()) ans = bool(lp) and os.path.exists(lp) and os.path.isdir(lp) and os.access(lp, os.W_OK) except: @@ -796,7 +797,7 @@ class LibraryPage(QWizardPage, LibraryUI): return ans def commit(self): - newloc = unicode(self.location.text()) + newloc = unicode_type(self.location.text()) try: dln = self.default_library_name if (dln and os.path.exists(dln) and not os.listdir(dln) and newloc != dln): @@ -887,8 +888,8 @@ class Wizard(QWizard): QWizard.accept(self) def set_finish_text(self, *args): - bt = unicode("" + self.buttonText(self.FinishButton) + "").replace('&', '') - t = unicode(self.finish_page.finish_text.text()) + bt = unicode_type("" + self.buttonText(self.FinishButton) + "").replace('&', '') + t = unicode_type(self.finish_page.finish_text.text()) if '%s' in t: self.finish_page.finish_text.setText(t%bt) diff --git a/src/calibre/gui2/wizard/send_email.py b/src/calibre/gui2/wizard/send_email.py index e6331f6970..b77cb68c70 100644 --- a/src/calibre/gui2/wizard/send_email.py +++ b/src/calibre/gui2/wizard/send_email.py @@ -20,6 +20,7 @@ from calibre import prints from calibre.gui2.wizard.send_email_ui import Ui_Form from calibre.utils.smtp import config as smtp_prefs from calibre.gui2 import error_dialog, question_dialog +from polyglot.builtins import unicode_type class TestEmail(QDialog): @@ -68,7 +69,7 @@ class TestEmail(QDialog): def run_test(self): try: - tb = self.test_func(unicode(self.to.text())) or _('Email successfully sent') + tb = self.test_func(unicode_type(self.to.text())) or _('Email successfully sent') except Exception: import traceback tb = traceback.format_exc() @@ -130,7 +131,7 @@ class RelaySetup(QDialog): self.service = service def accept(self): - un = unicode(self.username.text()) + un = unicode_type(self.username.text()) if self.service.get('at_in_username', False) and '@' not in un: return error_dialog(self, _('Incorrect username'), _('%s needs the full email address as your username') % @@ -263,14 +264,14 @@ class SendEmail(QWidget, Ui_Form): self.relay_tls.setChecked(True) def set_email_settings(self, to_set): - from_ = unicode(self.email_from.text()).strip() + from_ = unicode_type(self.email_from.text()).strip() if to_set and not from_: error_dialog(self, _('Bad configuration'), _('You must set the From email address')).exec_() return False - username = unicode(self.relay_username.text()).strip() - password = unicode(self.relay_password.text()).strip() - host = unicode(self.relay_host.text()).strip() + username = unicode_type(self.relay_username.text()).strip() + password = unicode_type(self.relay_password.text()).strip() + host = unicode_type(self.relay_host.text()).strip() enc_method = ('TLS' if self.relay_tls.isChecked() else 'SSL' if self.relay_ssl.isChecked() else 'NONE') if host: diff --git a/src/calibre/library/add_to_library.py b/src/calibre/library/add_to_library.py index 3ec82673f1..fc3e6dcaad 100644 --- a/src/calibre/library/add_to_library.py +++ b/src/calibre/library/add_to_library.py @@ -9,6 +9,7 @@ import os from hashlib import sha1 from calibre.ebooks import BOOK_EXTENSIONS +from polyglot.builtins import unicode_type def find_folders_under(root, db, add_root=True, # {{{ @@ -105,7 +106,7 @@ class FormatCollection(object): # {{{ def books_in_folder(folder, one_per_folder, # {{{ cancel_callback=lambda : False): - assert not isinstance(folder, unicode) + assert not isinstance(folder, unicode_type) dirpath = os.path.abspath(folder) if one_per_folder: diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py index 9ac22bd6a9..238fddac59 100644 --- a/src/calibre/library/caches.py +++ b/src/calibre/library/caches.py @@ -20,6 +20,7 @@ from calibre.db.search import CONTAINS_MATCH, EQUALS_MATCH, REGEXP_MATCH, _match from calibre.ebooks.metadata import title_sort, author_to_author_sort from calibre.ebooks.metadata.opf2 import metadata_to_opf from calibre import prints +from polyglot.builtins import unicode_type class MetadataBackup(Thread): # {{{ @@ -136,7 +137,7 @@ del y, c, n, u def force_to_bool(val): - if isinstance(val, (str, unicode)): + if isinstance(val, (str, unicode_type)): try: val = icu_lower(val) if not val: @@ -347,7 +348,7 @@ class ResultCache(SearchQueryParser): # {{{ if item is None: continue v = item[loc] - if isinstance(v, (str, unicode)): + if isinstance(v, (str, unicode_type)): v = parse_date(v) if v is None or v <= UNDEFINED_DATE: matches.add(item[0]) @@ -358,7 +359,7 @@ class ResultCache(SearchQueryParser): # {{{ if item is None: continue v = item[loc] - if isinstance(v, (str, unicode)): + if isinstance(v, (str, unicode_type)): v = parse_date(v) if v is not None and v > UNDEFINED_DATE: matches.add(item[0]) @@ -402,7 +403,7 @@ class ResultCache(SearchQueryParser): # {{{ if item is None or item[loc] is None: continue v = item[loc] - if isinstance(v, (str, unicode)): + if isinstance(v, (str, unicode_type)): v = parse_date(v) if relop(v, qd, field_count): matches.add(item[0]) @@ -729,7 +730,7 @@ class ResultCache(SearchQueryParser): # {{{ # everything else, or 'all' matches matchkind, query = self._matchkind(query) - if not isinstance(query, unicode): + if not isinstance(query, unicode_type): query = query.decode('utf-8') db_col = {} @@ -914,7 +915,7 @@ class ResultCache(SearchQueryParser): # {{{ self.marked_ids_dict = dict.fromkeys(id_dict, u'true') else: # Ensure that all the items in the dict are text - self.marked_ids_dict = dict(izip(id_dict.iterkeys(), imap(unicode, + self.marked_ids_dict = dict(izip(id_dict.iterkeys(), imap(unicode_type, id_dict.itervalues()))) # Set the values in the cache diff --git a/src/calibre/library/catalogs/csv_xml.py b/src/calibre/library/catalogs/csv_xml.py index f4d8719bd3..5364a9f9be 100644 --- a/src/calibre/library/catalogs/csv_xml.py +++ b/src/calibre/library/catalogs/csv_xml.py @@ -11,6 +11,7 @@ from collections import namedtuple from calibre.customize import CatalogPlugin from calibre.library.catalogs import FIELDS from calibre.customize.conversion import DummyReporter +from polyglot.builtins import unicode_type class CSV_XML(CatalogPlugin): @@ -153,14 +154,14 @@ class CSV_XML(CatalogPlugin): item = u'%.2g' % (item / 2.0) # Convert HTML to markdown text - if type(item) is unicode: + if type(item) is unicode_type: opening_tag = re.search('<(\\w+)(\x20|>)', item) if opening_tag: closing_tag = re.search('<\\/%s>$' % opening_tag.group(1), item) if closing_tag: item = html2text(item) - outstr.append(u'"%s"' % unicode(item).replace('"', '""')) + outstr.append(u'"%s"' % unicode_type(item).replace('"', '""')) outfile.write(u','.join(outstr) + u'\n') outfile.close() @@ -176,8 +177,8 @@ class CSV_XML(CatalogPlugin): for field in fields: if field.startswith('#'): val = db.get_field(r['id'], field, index_is_id=True) - if not isinstance(val, (str, unicode)): - val = unicode(val) + if not isinstance(val, (str, unicode_type)): + val = unicode_type(val) item = getattr(E, field.replace('#', '_'))(val) record.append(item) @@ -187,11 +188,11 @@ class CSV_XML(CatalogPlugin): val = r[field] if not val: continue - if not isinstance(val, (str, unicode)): + if not isinstance(val, (str, unicode_type)): if (fm.get(field, {}).get('datatype', None) == 'rating' and val): val = u'%.2g' % (val / 2.0) - val = unicode(val) + val = unicode_type(val) item = getattr(E, field)(val) record.append(item) diff --git a/src/calibre/library/catalogs/epub_mobi_builder.py b/src/calibre/library/catalogs/epub_mobi_builder.py index 7826d5b898..44bbc7f166 100644 --- a/src/calibre/library/catalogs/epub_mobi_builder.py +++ b/src/calibre/library/catalogs/epub_mobi_builder.py @@ -26,6 +26,7 @@ from calibre.utils.icu import capitalize, collation_order, sort_key from calibre.utils.img import scale_image from calibre.utils.zipfile import ZipFile from calibre.utils.localization import get_lang, lang_as_iso639_1 +from polyglot.builtins import unicode_type class Formatter(TemplateFormatter): @@ -583,7 +584,7 @@ class CatalogBuilder(object): for rule in self.prefix_rules: # Literal comparison for Tags field if rule['field'].lower() == 'tags' or rule['field'] == _('Tags'): - if rule['pattern'].lower() in map(unicode.lower, record['tags']): + if rule['pattern'].lower() in map(unicode_type.lower, record['tags']): if self.DEBUG and self.opts.verbose: self.opts.log.info(" %s '%s' by %s (%s: Tags includes '%s')" % (rule['prefix'], record['title'], @@ -613,7 +614,7 @@ class CatalogBuilder(object): # locale version field_contents = _(repr(field_contents)) try: - if re.search(rule['pattern'], unicode(field_contents), + if re.search(rule['pattern'], unicode_type(field_contents), re.IGNORECASE) is not None: if self.DEBUG: _log_prefix_rule_match_info(rule, record, field_contents) @@ -685,14 +686,14 @@ class CatalogBuilder(object): if icu_upper(c[0]) != last_c: last_c = icu_upper(c[0]) if last_c in exceptions.keys(): - last_c = exceptions[unicode(last_c)] + last_c = exceptions[unicode_type(last_c)] last_ordnum = ordnum cl_list[idx] = last_c else: if last_ordnum != ordnum: last_c = icu_upper(c[0:ordlen]) if last_c in exceptions.keys(): - last_c = exceptions[unicode(last_c)] + last_c = exceptions[unicode_type(last_c)] last_ordnum = ordnum else: last_c = cl_list[idx-1] @@ -702,7 +703,7 @@ class CatalogBuilder(object): if last_ordnum != ordnum: last_c = icu_upper(c[0:ordlen]) if last_c in exceptions.keys(): - last_c = exceptions[unicode(last_c)] + last_c = exceptions[unicode_type(last_c)] last_ordnum = ordnum else: last_c = cl_list[idx-1] @@ -1325,7 +1326,7 @@ class CatalogBuilder(object): """ # Kindle TOC descriptions won't render certain characters # Fix up - massaged = unicode(BeautifulStoneSoup(description, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)) + massaged = unicode_type(BeautifulStoneSoup(description, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)) # Replace '&' with '&' massaged = re.sub("&", "&", massaged) @@ -4473,7 +4474,7 @@ class CatalogBuilder(object): Return: (str): legal XHTML anchor string of unicode character name """ - fullname = u''.join(unicodedata.name(unicode(cc)) for cc in c) + fullname = u''.join(unicodedata.name(unicode_type(cc)) for cc in c) terms = fullname.split() return "_".join(terms) @@ -4648,7 +4649,7 @@ class CatalogBuilder(object): lost_cr.group(2), lost_cr.group(3))) # Extract pre-built elements - annotations, etc. - if not isinstance(comments, unicode): + if not isinstance(comments, unicode_type): comments = comments.decode('utf-8', 'replace') soup = BeautifulSoup(comments) elems = soup.findAll('div') @@ -4822,7 +4823,7 @@ class CatalogBuilder(object): # locale version field_contents = _(repr(field_contents)) - matched = re.search(pat, unicode(field_contents), + matched = re.search(pat, unicode_type(field_contents), re.IGNORECASE) if matched is not None: if self.opts.verbose: diff --git a/src/calibre/library/comments.py b/src/calibre/library/comments.py index dc458268b9..e194584d16 100644 --- a/src/calibre/library/comments.py +++ b/src/calibre/library/comments.py @@ -13,6 +13,7 @@ from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag, NavigableString, \ CData, Comment, Declaration, ProcessingInstruction from calibre import prepare_string_for_xml from calibre.utils.html2text import html2text +from polyglot.builtins import unicode_type # Hackish - ignoring sentences ending or beginning in numbers to avoid # confusion with decimal points. @@ -49,7 +50,7 @@ def comments_to_html(comments): ''' if not comments: return u'

' - if not isinstance(comments, unicode): + if not isinstance(comments, unicode_type): comments = comments.decode(preferred_encoding, 'replace') if comments.lstrip().startswith('<'): @@ -128,7 +129,7 @@ def comments_to_html(comments): p['class'] = 'description' for t in result.findAll(text=True): - t.replaceWith(prepare_string_for_xml(unicode(t))) + t.replaceWith(prepare_string_for_xml(unicode_type(t))) return result.renderContents(encoding=None) diff --git a/src/calibre/library/custom_columns.py b/src/calibre/library/custom_columns.py index b3fc46013c..3a29ea73ef 100644 --- a/src/calibre/library/custom_columns.py +++ b/src/calibre/library/custom_columns.py @@ -14,6 +14,7 @@ from calibre.constants import preferred_encoding from calibre.library.field_metadata import FieldMetadata from calibre.utils.date import parse_date from calibre.utils.config import tweaks +from polyglot.builtins import unicode_type class CustomColumns(object): @@ -130,23 +131,23 @@ class CustomColumns(object): if d['is_multiple']: if x is None: return [] - if isinstance(x, (str, unicode, bytes)): + if isinstance(x, (str, unicode_type, bytes)): x = x.split(d['multiple_seps']['ui_to_list']) x = [y.strip() for y in x if y.strip()] x = [y.decode(preferred_encoding, 'replace') if not isinstance(y, - unicode) else y for y in x] + unicode_type) else y for y in x] return [u' '.join(y.split()) for y in x] else: - return x if x is None or isinstance(x, unicode) else \ + return x if x is None or isinstance(x, unicode_type) else \ x.decode(preferred_encoding, 'replace') def adapt_datetime(x, d): - if isinstance(x, (str, unicode, bytes)): + if isinstance(x, (str, unicode_type, bytes)): x = parse_date(x, assume_utc=False, as_utc=False) return x def adapt_bool(x, d): - if isinstance(x, (str, unicode, bytes)): + if isinstance(x, (str, unicode_type, bytes)): x = x.lower() if x == 'true': x = True @@ -167,7 +168,7 @@ class CustomColumns(object): def adapt_number(x, d): if x is None: return None - if isinstance(x, (str, unicode, bytes)): + if isinstance(x, (str, unicode_type, bytes)): if x.lower() == 'none': return None if d['datatype'] == 'int': diff --git a/src/calibre/library/database.py b/src/calibre/library/database.py index 0a4e1349ef..dcebaae4e8 100644 --- a/src/calibre/library/database.py +++ b/src/calibre/library/database.py @@ -11,6 +11,7 @@ from zlib import compress, decompress from calibre.ebooks.metadata import MetaInformation from calibre.ebooks.metadata import string_to_authors from calibre import isbytestring +from polyglot.builtins import unicode_type class Concatenate(object): @@ -45,7 +46,7 @@ class Connection(sqlite.Connection): def _connect(path): - if isinstance(path, unicode): + if isinstance(path, unicode_type): path = path.encode('utf-8') conn = sqlite.connect(path, factory=Connection, detect_types=sqlite.PARSE_DECLTYPES|sqlite.PARSE_COLNAMES) conn.row_factory = lambda cursor, row : list(row) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index cc22304db5..88a26e28a7 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -48,6 +48,7 @@ from calibre.db.lazy import FormatMetadata, FormatsList from calibre.db.categories import Tag, CATEGORY_SORTS from calibre.utils.localization import (canonicalize_lang, calibre_langcode_to_name) +from polyglot.builtins import unicode_type copyfile = os.link if hasattr(os, 'link') else shutil.copyfile SPOOL_SIZE = 30*1024*1024 @@ -104,7 +105,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): return self._library_id_ def fset(self, val): - self._library_id_ = unicode(val) + self._library_id_ = unicode_type(val) self.conn.executescript(''' DELETE FROM library_id; INSERT INTO library_id (uuid) VALUES ("%s"); @@ -332,10 +333,10 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): prints('found user category case overlap', catmap[uc]) cat = catmap[uc][0] suffix = 1 - while icu_lower((cat + unicode(suffix))) in catmap: + while icu_lower((cat + unicode_type(suffix))) in catmap: suffix += 1 - prints('Renaming user category %s to %s'%(cat, cat+unicode(suffix))) - user_cats[cat + unicode(suffix)] = user_cats[cat] + prints('Renaming user category %s to %s'%(cat, cat+unicode_type(suffix))) + user_cats[cat + unicode_type(suffix)] = user_cats[cat] del user_cats[cat] cats_changed = True if cats_changed: @@ -1091,7 +1092,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): def has_book(self, mi): title = mi.title if title: - if not isinstance(title, unicode): + if not isinstance(title, unicode_type): title = title.decode(preferred_encoding, 'replace') return bool(self.conn.get('SELECT id FROM books where title=?', (title,), all=False)) return False @@ -1754,7 +1755,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): self.id = id def __str__(self): - return unicode(self) + return unicode_type(self) def __unicode__(self): return 'n=%s s=%s c=%d rt=%d rc=%d id=%s'%\ @@ -1768,8 +1769,8 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): if len(comps) == 0: i = 1 while True: - if unicode(i) not in user_cats: - new_cats[unicode(i)] = user_cats[k] + if unicode_type(i) not in user_cats: + new_cats[unicode_type(i)] = user_cats[k] break i += 1 else: @@ -1995,7 +1996,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): formatter = calibre_langcode_to_name items = [v for v in tcategories[category].values() if v.c > 0] else: - formatter = (lambda x:unicode(x)) + formatter = (lambda x:unicode_type(x)) items = [v for v in tcategories[category].values() if v.c > 0] # sort the list @@ -2466,7 +2467,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): if not a: continue a = a.strip().replace(',', '|') - if not isinstance(a, unicode): + if not isinstance(a, unicode_type): a = a.decode(preferred_encoding, 'replace') aus = self.conn.get('SELECT id, name, sort FROM authors WHERE name=?', (a,)) if aus: @@ -2625,7 +2626,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): def set_timestamp(self, id, dt, notify=True, commit=True): if dt: - if isinstance(dt, (unicode, bytes)): + if isinstance(dt, (unicode_type, bytes)): dt = parse_date(dt, as_utc=True, assume_utc=False) self.conn.execute('UPDATE books SET timestamp=? WHERE id=?', (dt, id)) self.data.set(id, self.FIELD_MAP['timestamp'], dt, row_is_id=True) @@ -2654,7 +2655,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): books_to_refresh = {id} if publisher: case_change = False - if not isinstance(publisher, unicode): + if not isinstance(publisher, unicode_type): publisher = publisher.decode(preferred_encoding, 'replace') pubx = self.conn.get('''SELECT id,name from publishers WHERE name=?''', (publisher,)) @@ -3099,7 +3100,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): tag = tag.strip() if not tag: continue - if not isinstance(tag, unicode): + if not isinstance(tag, unicode_type): tag = tag.decode(preferred_encoding, 'replace') existing_tags = self.all_tags() lt = [t.lower() for t in existing_tags] @@ -3180,7 +3181,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): books_to_refresh = {id} if series: case_change = False - if not isinstance(series, unicode): + if not isinstance(series, unicode_type): series = series.decode(preferred_encoding, 'replace') series = series.strip() series = u' '.join(series.split()) @@ -3552,7 +3553,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): aus = mi.author_sort if mi.author_sort else self.author_sort_from_authors(mi.authors) if isinstance(aus, str): aus = aus.decode(preferred_encoding, 'replace') - title = mi.title if isinstance(mi.title, unicode) else \ + title = mi.title if isinstance(mi.title, unicode_type) else \ mi.title.decode(preferred_encoding, 'replace') obj = self.conn.execute('INSERT INTO books(title, series_index, author_sort) VALUES (?, ?, ?)', (title, series_index, aus)) @@ -3622,7 +3623,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): os.remove(dest) shutil.copyfile(src, dest) x = path_map[x] - if not isinstance(x, unicode): + if not isinstance(x, unicode_type): x = x.decode(filesystem_encoding, 'replace') progress(x) @@ -3658,7 +3659,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): progress.setLabelText(header) QCoreApplication.processEvents() db.conn.row_factory = lambda cursor, row: tuple(row) - db.conn.text_factory = lambda x: unicode(x, 'utf-8', 'replace') + db.conn.text_factory = lambda x: unicode_type(x, 'utf-8', 'replace') books = db.conn.get('SELECT id, title, sort, timestamp, series_index, author_sort, isbn FROM books ORDER BY id ASC') progress.setAutoReset(False) progress.setRange(0, len(books)) diff --git a/src/calibre/library/prefs.py b/src/calibre/library/prefs.py index dd10702854..d5e7398ffa 100644 --- a/src/calibre/library/prefs.py +++ b/src/calibre/library/prefs.py @@ -10,6 +10,7 @@ import json, os from calibre.constants import preferred_encoding from calibre.utils.config import to_json, from_json from calibre import prints +from polyglot.builtins import unicode_type class DBPrefs(dict): @@ -28,7 +29,7 @@ class DBPrefs(dict): dict.__setitem__(self, key, val) def raw_to_object(self, raw): - if not isinstance(raw, unicode): + if not isinstance(raw, unicode_type): raw = raw.decode(preferred_encoding) return json.loads(raw, object_hook=from_json) diff --git a/src/calibre/library/save_to_disk.py b/src/calibre/library/save_to_disk.py index f1896a6e52..cfb774c186 100644 --- a/src/calibre/library/save_to_disk.py +++ b/src/calibre/library/save_to_disk.py @@ -19,6 +19,7 @@ from calibre.ebooks.metadata import title_sort from calibre.utils.date import as_local_time from calibre import strftime, prints, sanitize_file_name_unicode from calibre.db.lazy import FormatsList +from polyglot.builtins import unicode_type plugboard_any_device_value = 'any device' plugboard_any_format_value = 'any format' @@ -133,7 +134,7 @@ def preprocess_template(template): template = template.replace('//', '/') template = template.replace('{author}', '{authors}') template = template.replace('{tag}', '{tags}') - if not isinstance(template, unicode): + if not isinstance(template, unicode_type): template = template.decode(preferred_encoding, 'replace') return template @@ -235,7 +236,7 @@ def get_components(template, mi, id, timefmt='%b %Y', length=250, divide_by=2.0) elif cm['datatype'] in ['int', 'float']: if format_args[key] != 0: - format_args[key] = unicode(format_args[key]) + format_args[key] = unicode_type(format_args[key]) else: format_args[key] = '' if safe_format: diff --git a/src/calibre/library/schema_upgrades.py b/src/calibre/library/schema_upgrades.py index dca844273e..a0ff54c302 100644 --- a/src/calibre/library/schema_upgrades.py +++ b/src/calibre/library/schema_upgrades.py @@ -1,7 +1,6 @@ #!/usr/bin/env python2 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai -from __future__ import with_statement -from __future__ import print_function +from __future__ import print_function, with_statement __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal ' @@ -10,6 +9,7 @@ __docformat__ = 'restructuredtext en' import os from calibre.utils.date import isoformat, DEFAULT_DATE +from polyglot.builtins import unicode_type class SchemaUpgrade(object): @@ -596,7 +596,7 @@ class SchemaUpgrade(object): id_ = str(id_) fname = custom_recipe_filename(id_, title) custom_recipes[id_] = (title, fname) - if isinstance(script, unicode): + if isinstance(script, unicode_type): script = script.encode('utf-8') with open(os.path.join(bdir, fname), 'wb') as f: f.write(script) @@ -611,5 +611,3 @@ class SchemaUpgrade(object): ALTER TABLE authors ADD COLUMN link TEXT NOT NULL DEFAULT ""; ''' self.conn.executescript(script) - - diff --git a/src/calibre/library/sqlite.py b/src/calibre/library/sqlite.py index 6f5ac75d74..5fd140ce90 100644 --- a/src/calibre/library/sqlite.py +++ b/src/calibre/library/sqlite.py @@ -1,5 +1,4 @@ -from __future__ import with_statement -from __future__ import print_function +from __future__ import print_function, with_statement __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' __docformat__ = 'restructuredtext en' @@ -23,6 +22,7 @@ from calibre import isbytestring, force_unicode from calibre.constants import iswindows, DEBUG, plugins from calibre.utils.icu import sort_key from calibre import prints +from polyglot.builtins import unicode_type from dateutil.tz import tzoffset @@ -321,7 +321,7 @@ class DatabaseException(Exception): def __init__(self, err, tb): tb = '\n\t'.join(('\tRemote'+tb).splitlines()) try: - msg = unicode(err) +'\n' + tb + msg = unicode_type(err) +'\n' + tb except: msg = repr(err) + '\n' + tb Exception.__init__(self, msg) @@ -342,7 +342,7 @@ def proxy(fn): ok, res = self.proxy.results.get() if not ok: if isinstance(res[0], IntegrityError): - raise IntegrityError(unicode(res[0])) + raise IntegrityError(unicode_type(res[0])) raise DatabaseException(*res) return res return run diff --git a/src/calibre/spell/dictionary.py b/src/calibre/spell/dictionary.py index 15e459c9a8..6845a5cc3d 100644 --- a/src/calibre/spell/dictionary.py +++ b/src/calibre/spell/dictionary.py @@ -18,6 +18,7 @@ from calibre.spell import parse_lang_code from calibre.utils.config import JSONConfig from calibre.utils.icu import capitalize from calibre.utils.localization import get_lang, get_system_locale +from polyglot.builtins import unicode_type Dictionary = namedtuple('Dictionary', 'primary_locale locales dicpath affpath builtin name id') LoadedDictionary = namedtuple('Dictionary', 'primary_locale locales obj builtin name id') @@ -391,7 +392,7 @@ class Dictionaries(object): if d is not None: try: - ans = d.obj.suggest(unicode(word).replace('\u2010', '-')) + ans = d.obj.suggest(unicode_type(word).replace('\u2010', '-')) except ValueError: pass else: diff --git a/src/calibre/srv/ajax.py b/src/calibre/srv/ajax.py index a94ab24fb0..b1838387e4 100644 --- a/src/calibre/srv/ajax.py +++ b/src/calibre/srv/ajax.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2015, Kovid Goyal ' from functools import partial -from polyglot.builtins import zip +from polyglot.builtins import unicode_type, zip from itertools import cycle from calibre import force_unicode @@ -116,7 +116,7 @@ def book_to_json(ctx, rd, db, book_id, dbtags[category] = ctx.url_for( books_in, encoded_category=encode_name(tag.category if tag.category else key), - encoded_item=encode_name(tag.original_name if tag.id is None else unicode(tag.id)), + encoded_item=encode_name(tag.original_name if tag.id is None else unicode_type(tag.id)), library_id=db.server_library_id ) break @@ -446,7 +446,7 @@ def category(ctx, rd, encoded_name, library_id): 'average_rating': x.avg_rating, 'count': x.count, 'url': ctx.url_for(books_in, encoded_category=encode_name(x.category if x.category else toplevel), - encoded_item=encode_name(x.original_name if x.id is None else unicode(x.id)), + encoded_item=encode_name(x.original_name if x.id is None else unicode_type(x.id)), library_id=db.server_library_id ), 'has_children': x.original_name in children, @@ -550,7 +550,7 @@ def search_result(ctx, rd, db, query, num, offset, sort, sort_order, vl=''): 'vl': vl, } if parse_error is not None: - ans['bad_restriction'] = unicode(parse_error) + ans['bad_restriction'] = unicode_type(parse_error) return ans diff --git a/src/calibre/srv/opds.py b/src/calibre/srv/opds.py index be2fd0a4d3..f37127b21f 100644 --- a/src/calibre/srv/opds.py +++ b/src/calibre/srv/opds.py @@ -27,10 +27,11 @@ from calibre import force_unicode from calibre.srv.errors import HTTPNotFound, HTTPInternalServerError from calibre.srv.routes import endpoint from calibre.srv.utils import get_library_data, http_date, Offsets +from polyglot.builtins import unicode_type def hexlify(x): - if isinstance(x, unicode): + if isinstance(x, unicode_type): x = x.encode('utf-8') return binascii.hexlify(x) @@ -210,9 +211,9 @@ def ACQUISITION_ENTRY(book_id, updated, request_context): fm['is_multiple']['ui_to_list'], joinval=fm['is_multiple']['list_to_ui'])))) elif datatype == 'comments' or (fm['datatype'] == 'composite' and fm['display'].get('contains_html', False)): - extra.append('%s: %s
'%(xml(name), comments_to_html(unicode(val)))) + extra.append('%s: %s
'%(xml(name), comments_to_html(unicode_type(val)))) else: - extra.append('%s: %s
'%(xml(name), xml(unicode(val)))) + extra.append('%s: %s
'%(xml(name), xml(unicode_type(val)))) if mi.comments: comments = comments_to_html(mi.comments) extra.append(comments) diff --git a/src/calibre/srv/render_book.py b/src/calibre/srv/render_book.py index eca906937c..813d8c6947 100644 --- a/src/calibre/srv/render_book.py +++ b/src/calibre/srv/render_book.py @@ -9,7 +9,7 @@ from base64 import standard_b64encode, standard_b64decode from collections import defaultdict, OrderedDict from itertools import count from functools import partial -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from urlparse import urlparse from urllib import quote @@ -325,7 +325,7 @@ class Container(ContainerBase): frag = urlunquote(frag) url = resource_template.format(encode_url(name, frag)) else: - if isinstance(name, unicode): + if isinstance(name, unicode_type): name = name.encode('utf-8') url = 'missing:' + force_unicode(quote(name), 'utf-8') changed.add(base) diff --git a/src/calibre/srv/routes.py b/src/calibre/srv/routes.py index 75f2e434f5..8623c77489 100644 --- a/src/calibre/srv/routes.py +++ b/src/calibre/srv/routes.py @@ -14,6 +14,7 @@ from operator import attrgetter from calibre.srv.errors import HTTPSimpleResponse, HTTPNotFound, RouteError from calibre.srv.utils import http_date from calibre.utils.serialize import msgpack_dumps, json_dumps, MSGPACK_MIME +from polyglot.builtins import unicode_type default_methods = frozenset(('HEAD', 'GET')) @@ -201,9 +202,9 @@ class Route(object): raise RouteError('The variable(s) %s are not part of the route: %s' % (','.join(unknown), self.endpoint.route)) def quoted(x): - if not isinstance(x, unicode) and not isinstance(x, bytes): - x = unicode(x) - if isinstance(x, unicode): + if not isinstance(x, unicode_type) and not isinstance(x, bytes): + x = unicode_type(x) + if isinstance(x, unicode_type): x = x.encode('utf-8') return urlquote(x, '') args = {k:'' for k in self.defaults} diff --git a/src/calibre/srv/utils.py b/src/calibre/srv/utils.py index 859d4f4946..e02f96f559 100644 --- a/src/calibre/srv/utils.py +++ b/src/calibre/srv/utils.py @@ -13,7 +13,7 @@ from urlparse import parse_qs import repr as reprlib from email.utils import formatdate from operator import itemgetter -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from urllib import quote as urlquote from binascii import hexlify, unhexlify @@ -287,7 +287,7 @@ def encode_path(*components): def encode_name(name): 'Encode a name (arbitrary string) as URL safe characters. See decode_name() also.' - if isinstance(name, unicode): + if isinstance(name, unicode_type): name = name.encode('utf-8') return hexlify(name) diff --git a/src/calibre/startup.py b/src/calibre/startup.py index 481d8780ab..78a7cad5be 100644 --- a/src/calibre/startup.py +++ b/src/calibre/startup.py @@ -10,7 +10,7 @@ Perform various initialization tasks. import locale, sys # Default translation is NOOP -from polyglot.builtins import builtins +from polyglot.builtins import builtins, unicode_type builtins.__dict__['_'] = lambda s: s # For strings which belong in the translation tables, but which shouldn't be @@ -58,7 +58,7 @@ if not _run_once: winutil, winutilerror = plugins['winutil'] if not winutil: raise RuntimeError('Failed to load the winutil plugin: %s'%winutilerror) - if len(sys.argv) > 1 and not isinstance(sys.argv[1], unicode): + if len(sys.argv) > 1 and not isinstance(sys.argv[1], unicode_type): sys.argv[1:] = winutil.argv()[1-len(sys.argv):] # @@ -75,7 +75,7 @@ if not _run_once: if isosx: enc = 'utf-8' for i in range(1, len(sys.argv)): - if not isinstance(sys.argv[i], unicode): + if not isinstance(sys.argv[i], unicode_type): sys.argv[i] = sys.argv[i].decode(enc, 'replace') # @@ -202,7 +202,7 @@ if not _run_once: if name == 'Thread': name = self.name if name: - if isinstance(name, unicode): + if isinstance(name, unicode_type): name = name.encode('ascii', 'replace').decode('ascii') plugins['speedup'][0].set_thread_name(name[:15]) except Exception: diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index f450e91744..4d0761b893 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -2,7 +2,7 @@ # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import (unicode_literals, division, absolute_import, print_function) -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' @@ -128,7 +128,7 @@ class BuildTest(unittest.TestCase): winutil = plugins['winutil'][0] def au(x, name): - self.assertTrue(isinstance(x, unicode), name + '() did not return a unicode string') + self.assertTrue(isinstance(x, unicode_type), name + '() did not return a unicode string') for x in winutil.argv(): au(x, 'argv') for x in 'username temp_path locale_name'.split(): @@ -139,7 +139,7 @@ class BuildTest(unittest.TestCase): for k, v in d.iteritems(): au(v, k) for k in os.environ.keys(): - au(winutil.getenv(unicode(k)), 'getenv-' + k) + au(winutil.getenv(unicode_type(k)), 'getenv-' + k) os.environ['XXXTEST'] = 'YYY' self.assertEqual(winutil.getenv(u'XXXTEST'), u'YYY') del os.environ['XXXTEST'] @@ -149,7 +149,7 @@ class BuildTest(unittest.TestCase): for fmt in (fmt, fmt.encode('ascii')): x = strftime(fmt, t) au(x, 'strftime') - self.assertEqual(unicode(time.strftime(fmt.replace('%e', '%#d'), t)), x) + self.assertEqual(unicode_type(time.strftime(fmt.replace('%e', '%#d'), t)), x) def test_sqlite(self): import sqlite3 @@ -173,7 +173,7 @@ class BuildTest(unittest.TestCase): # it should just work because the hard-coded paths of the Qt # installation should work. If they do not, then it is a distro # problem. - fmts = set(map(unicode, QImageReader.supportedImageFormats())) + fmts = set(map(unicode_type, QImageReader.supportedImageFormats())) testf = {'jpg', 'png', 'svg', 'ico', 'gif'} self.assertEqual(testf.intersection(fmts), testf, "Qt doesn't seem to be able to load some of its image plugins. Available plugins: %s" % fmts) data = P('images/blank.png', allow_user_override=False, data=True) diff --git a/src/calibre/utils/apsw_shell.py b/src/calibre/utils/apsw_shell.py index ba2fb2bd91..43b2356737 100644 --- a/src/calibre/utils/apsw_shell.py +++ b/src/calibre/utils/apsw_shell.py @@ -13,6 +13,8 @@ import time import codecs import base64 +from polyglot.builtins import unicode_type + if sys.platform=="win32": _win_colour=False try: @@ -722,7 +724,7 @@ Enter SQL statements terminated with a ";" intro=intro.lstrip() if self.interactive and intro: if sys.version_info<(3,0): - intro=unicode(intro) + intro=unicode_type(intro) c=self.colour self.write(self.stdout, c.intro+intro+c.intro_) @@ -1639,7 +1641,7 @@ Enter SQL statements terminated with a ";" # Ensure all values are utf8 not unicode for k,v in dialect.items(): - if isinstance(v, unicode): + if isinstance(v, unicode_type): dialect[k]=v.encode("utf8") for line in csv.reader(thefile, **dialect): # back to unicode again @@ -2419,8 +2421,8 @@ Enter SQL statements terminated with a ";" def write(self, dest, text): """Writes text to dest. dest will typically be one of self.stdout or self.stderr.""" # ensure text is unicode to catch codeset issues here - if type(text)!=unicode: - text=unicode(text) + if type(text)!=unicode_type: + text=unicode_type(text) try: dest.write(text) except UnicodeEncodeError: @@ -2465,7 +2467,7 @@ Enter SQL statements terminated with a ";" line=self.stdin.readline() # includes newline unless last line of file doesn't have one self.input_line_number+=1 if sys.version_info<(3,0): - if type(line)!=unicode: + if type(line)!=unicode_type: enc=getattr(self.stdin, "encoding", self.encoding[0]) if not enc: enc=self.encoding[0] diff --git a/src/calibre/utils/cleantext.py b/src/calibre/utils/cleantext.py index 6c4392427c..3ef9962391 100644 --- a/src/calibre/utils/cleantext.py +++ b/src/calibre/utils/cleantext.py @@ -3,7 +3,7 @@ __copyright__ = '2010, sengian ' __docformat__ = 'restructuredtext en' import re, htmlentitydefs -from polyglot.builtins import map +from polyglot.builtins import codepoint_to_chr, map from calibre.constants import plugins, preferred_encoding try: @@ -32,12 +32,12 @@ def clean_ascii_chars(txt, charlist=None): chars.add(127) for x in (9, 10, 13): chars.remove(x) - _ascii_pat = re.compile(u'|'.join(map(unichr, chars))) + _ascii_pat = re.compile(u'|'.join(map(codepoint_to_chr, chars))) if charlist is None: pat = _ascii_pat else: - pat = re.compile(u'|'.join(map(unichr, charlist))) + pat = re.compile(u'|'.join(map(codepoint_to_chr, charlist))) return pat.sub('', txt) @@ -72,15 +72,15 @@ def unescape(text, rm=False, rchar=u''): # character reference try: if text[:3] == "&#x": - return unichr(int(text[3:-1], 16)) + return codepoint_to_chr(int(text[3:-1], 16)) else: - return unichr(int(text[2:-1])) + return codepoint_to_chr(int(text[2:-1])) except ValueError: pass else: # named entity try: - text = unichr(htmlentitydefs.name2codepoint[text[1:-1]]) + text = codepoint_to_chr(htmlentitydefs.name2codepoint[text[1:-1]]) except KeyError: pass if rm: diff --git a/src/calibre/utils/complete.py b/src/calibre/utils/complete.py index e2ae94e808..7a66bf7a51 100644 --- a/src/calibre/utils/complete.py +++ b/src/calibre/utils/complete.py @@ -14,6 +14,8 @@ completion. import sys, os, shlex, glob, re +from polyglot.builtins import unicode_type + def prints(*args, **kwargs): ''' @@ -28,7 +30,7 @@ def prints(*args, **kwargs): enc = 'utf-8' safe_encode = kwargs.get('safe_encode', False) for i, arg in enumerate(args): - if isinstance(arg, unicode): + if isinstance(arg, unicode_type): try: arg = arg.encode(enc) except UnicodeEncodeError: @@ -39,8 +41,8 @@ def prints(*args, **kwargs): try: arg = str(arg) except ValueError: - arg = unicode(arg) - if isinstance(arg, unicode): + arg = unicode_type(arg) + if isinstance(arg, unicode_type): try: arg = arg.encode(enc) except UnicodeEncodeError: diff --git a/src/calibre/utils/config_base.py b/src/calibre/utils/config_base.py index 9726e50b1c..0a0345df26 100644 --- a/src/calibre/utils/config_base.py +++ b/src/calibre/utils/config_base.py @@ -13,6 +13,7 @@ from copy import deepcopy from calibre.utils.lock import ExclusiveFile from calibre.constants import config_dir, CONFIG_DIR_MODE +from polyglot.builtins import unicode_type plugin_dir = os.path.join(config_dir, 'plugins') @@ -198,7 +199,7 @@ class OptionSet(object): options = {'cPickle':cPickle} if src is not None: try: - if not isinstance(src, unicode): + if not isinstance(src, unicode_type): src = src.decode('utf-8') src = src.replace(u'PyQt%d.QtCore' % 4, u'PyQt5.QtCore') exec(src, options) @@ -306,7 +307,7 @@ class Config(ConfigInterface): src = self.option_set.serialize(opts)+ '\n\n' + footer + '\n' f.seek(0) f.truncate() - if isinstance(src, unicode): + if isinstance(src, unicode_type): src = src.encode('utf-8') f.write(src) diff --git a/src/calibre/utils/date.py b/src/calibre/utils/date.py index 90057cd451..d518da9ee4 100644 --- a/src/calibre/utils/date.py +++ b/src/calibre/utils/date.py @@ -14,6 +14,7 @@ from calibre import strftime from calibre.constants import iswindows, isosx, plugins from calibre.utils.iso8601 import utc_tz, local_tz, UNDEFINED_DATE from calibre.utils.localization import lcdata +from polyglot.builtins import unicode_type _utc_tz = utc_tz _local_tz = local_tz @@ -186,13 +187,13 @@ def fromordinal(day, as_utc=True): def isoformat(date_time, assume_utc=False, as_utc=True, sep='T'): if not hasattr(date_time, 'tzinfo'): - return unicode(date_time.isoformat()) + return unicode_type(date_time.isoformat()) if date_time.tzinfo is None: date_time = date_time.replace(tzinfo=_utc_tz if assume_utc else _local_tz) date_time = date_time.astimezone(_utc_tz if as_utc else _local_tz) # str(sep) because isoformat barfs with unicode sep on python 2.x - return unicode(date_time.isoformat(str(sep))) + return unicode_type(date_time.isoformat(str(sep))) def internal_iso_format_string(): @@ -205,7 +206,7 @@ def w3cdtf(date_time, assume_utc=False): date_time = date_time.replace(tzinfo=_utc_tz if assume_utc else _local_tz) date_time = date_time.astimezone(_utc_tz if as_utc else _local_tz) - return unicode(date_time.strftime('%Y-%m-%dT%H:%M:%SZ')) + return unicode_type(date_time.strftime('%Y-%m-%dT%H:%M:%SZ')) def as_local_time(date_time, assume_utc=True): diff --git a/src/calibre/utils/filenames.py b/src/calibre/utils/filenames.py index 58460d52f7..98dc6ecb73 100644 --- a/src/calibre/utils/filenames.py +++ b/src/calibre/utils/filenames.py @@ -14,6 +14,7 @@ from calibre.constants import ( filesystem_encoding, iswindows, plugins, preferred_encoding, isosx ) from calibre.utils.localization import get_udc +from polyglot.builtins import unicode_type def ascii_text(orig): @@ -21,7 +22,7 @@ def ascii_text(orig): try: ascii = udc.decode(orig) except: - if isinstance(orig, unicode): + if isinstance(orig, unicode_type): orig = orig.encode('ascii', 'replace') ascii = orig.decode(preferred_encoding, 'replace').encode('ascii', 'replace') diff --git a/src/calibre/utils/fonts/free_type.py b/src/calibre/utils/fonts/free_type.py index fc7c27b598..5974fc7be7 100644 --- a/src/calibre/utils/fonts/free_type.py +++ b/src/calibre/utils/fonts/free_type.py @@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en' import threading from functools import wraps -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from calibre.constants import plugins @@ -52,7 +52,7 @@ class Face(object): ''' Returns True if all the characters in text have glyphs in this font. ''' - if not isinstance(text, unicode): + if not isinstance(text, unicode_type): raise TypeError('%r is not a unicode object'%text) if has_non_printable_chars: from calibre.utils.fonts.utils import get_printable_characters @@ -62,7 +62,7 @@ class Face(object): @same_thread def glyph_ids(self, text): - if not isinstance(text, unicode): + if not isinstance(text, unicode_type): raise TypeError('%r is not a unicode object'%text) for char in text: yield self.face.glyph_id(ord(char)) diff --git a/src/calibre/utils/fonts/scanner.py b/src/calibre/utils/fonts/scanner.py index 33e5c7d0dd..2b1130ae24 100644 --- a/src/calibre/utils/fonts/scanner.py +++ b/src/calibre/utils/fonts/scanner.py @@ -16,6 +16,7 @@ from calibre.constants import (config_dir, iswindows, isosx, plugins, DEBUG, isworker, filesystem_encoding) from calibre.utils.fonts.metadata import FontMetadata, UnsupportedFont from calibre.utils.icu import sort_key +from polyglot.builtins import unicode_type class NoFonts(ValueError): @@ -266,7 +267,7 @@ class FontScanner(Thread): ''' from calibre.utils.fonts.utils import (supports_text, panose_to_css_generic_family, get_printable_characters) - if not isinstance(text, unicode): + if not isinstance(text, unicode_type): raise TypeError(u'%r is not unicode'%text) text = get_printable_characters(text) found = {} diff --git a/src/calibre/utils/fonts/sfnt/subset.py b/src/calibre/utils/fonts/sfnt/subset.py index 8c7b5901a5..b1683af139 100644 --- a/src/calibre/utils/fonts/sfnt/subset.py +++ b/src/calibre/utils/fonts/sfnt/subset.py @@ -15,6 +15,7 @@ from functools import partial from calibre.utils.icu import safe_chr, ord_string from calibre.utils.fonts.sfnt.container import Sfnt from calibre.utils.fonts.sfnt.errors import UnsupportedFont, NoGlyphs +from polyglot.builtins import unicode_type # TrueType outlines {{{ @@ -106,7 +107,7 @@ def pdf_subset(sfnt, glyphs): def safe_ord(x): - return ord_string(unicode(x))[0] + return ord_string(unicode_type(x))[0] def subset(raw, individual_chars, ranges=(), warnings=None): @@ -343,12 +344,12 @@ def all(): print('No glyphs!') continue except UnsupportedFont as e: - unsupported.append((font['full_name'], font['path'], unicode(e))) + unsupported.append((font['full_name'], font['path'], unicode_type(e))) print ('Unsupported!') continue except Exception as e: print ('Failed!') - failed.append((font['full_name'], font['path'], unicode(e))) + failed.append((font['full_name'], font['path'], unicode_type(e))) else: averages.append(sum(new_stats.itervalues())/sum(old_stats.itervalues()) * 100) print ('Reduced to:', '%.1f'%averages[-1] , '%') diff --git a/src/calibre/utils/fonts/utils.py b/src/calibre/utils/fonts/utils.py index 553d8cb7e2..36bdc05f03 100644 --- a/src/calibre/utils/fonts/utils.py +++ b/src/calibre/utils/fonts/utils.py @@ -11,6 +11,8 @@ import struct from io import BytesIO from collections import defaultdict +from polyglot.builtins import unicode_type + class UnsupportedFont(ValueError): pass @@ -396,7 +398,7 @@ def get_bmp_glyph_ids(table, bmp, codes): def get_glyph_ids(raw, text, raw_is_table=False): - if not isinstance(text, unicode): + if not isinstance(text, unicode_type): raise TypeError('%r is not a unicode object'%text) if raw_is_table: table = raw @@ -422,7 +424,7 @@ def get_glyph_ids(raw, text, raw_is_table=False): def supports_text(raw, text, has_only_printable_chars=False): - if not isinstance(text, unicode): + if not isinstance(text, unicode_type): raise TypeError('%r is not a unicode object'%text) if not has_only_printable_chars: text = get_printable_characters(text) diff --git a/src/calibre/utils/formatter.py b/src/calibre/utils/formatter.py index 2a47fc5823..7644470377 100644 --- a/src/calibre/utils/formatter.py +++ b/src/calibre/utils/formatter.py @@ -13,6 +13,7 @@ import re, string, traceback from calibre import prints from calibre.constants import DEBUG from calibre.utils.formatter_functions import formatter_functions +from polyglot.builtins import unicode_type class _Parser(object): @@ -213,7 +214,7 @@ class TemplateFormatter(string.Formatter): except: raise ValueError( _('format: type {0} requires a decimal (float) value, got {1}').format(typ, val)) - return unicode(('{0:'+fmt+'}').format(val)) + return unicode_type(('{0:'+fmt+'}').format(val)) def _explode_format_string(self, fmt): try: @@ -272,7 +273,7 @@ class TemplateFormatter(string.Formatter): # ensure we are dealing with a string. if isinstance(val, (int, float)): if val: - val = unicode(val) + val = unicode_type(val) else: val = '' # Handle conditional text diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py index 22f62ff9d5..953840639a 100644 --- a/src/calibre/utils/formatter_functions.py +++ b/src/calibre/utils/formatter_functions.py @@ -23,6 +23,7 @@ from calibre.utils.titlecase import titlecase from calibre.utils.icu import capitalize, strcmp, sort_key from calibre.utils.date import parse_date, format_date, now, UNDEFINED_DATE from calibre.utils.localization import calibre_langcode_to_name, canonicalize_lang +from polyglot.builtins import unicode_type class FormatterFunctions(object): @@ -131,12 +132,12 @@ class FormatterFunction(object): def eval_(self, formatter, kwargs, mi, locals, *args): ret = self.evaluate(formatter, kwargs, mi, locals, *args) - if isinstance(ret, (str, unicode)): + if isinstance(ret, (str, unicode_type)): return ret if isinstance(ret, list): return ','.join(ret) if isinstance(ret, (int, float, bool)): - return unicode(ret) + return unicode_type(ret) class BuiltinFormatterFunction(FormatterFunction): @@ -246,7 +247,7 @@ class BuiltinAdd(BuiltinFormatterFunction): def evaluate(self, formatter, kwargs, mi, locals, x, y): x = float(x if x and x != 'None' else 0) y = float(y if y and y != 'None' else 0) - return unicode(x + y) + return unicode_type(x + y) class BuiltinSubtract(BuiltinFormatterFunction): @@ -258,7 +259,7 @@ class BuiltinSubtract(BuiltinFormatterFunction): def evaluate(self, formatter, kwargs, mi, locals, x, y): x = float(x if x and x != 'None' else 0) y = float(y if y and y != 'None' else 0) - return unicode(x - y) + return unicode_type(x - y) class BuiltinMultiply(BuiltinFormatterFunction): @@ -270,7 +271,7 @@ class BuiltinMultiply(BuiltinFormatterFunction): def evaluate(self, formatter, kwargs, mi, locals, x, y): x = float(x if x and x != 'None' else 0) y = float(y if y and y != 'None' else 0) - return unicode(x * y) + return unicode_type(x * y) class BuiltinDivide(BuiltinFormatterFunction): @@ -282,7 +283,7 @@ class BuiltinDivide(BuiltinFormatterFunction): def evaluate(self, formatter, kwargs, mi, locals, x, y): x = float(x if x and x != 'None' else 0) y = float(y if y and y != 'None' else 0) - return unicode(x / y) + return unicode_type(x / y) class BuiltinTemplate(BuiltinFormatterFunction): @@ -374,7 +375,7 @@ class BuiltinRawField(BuiltinFormatterFunction): if fm is None: return ', '.join(res) return fm['is_multiple']['list_to_ui'].join(res) - return unicode(res) + return unicode_type(res) class BuiltinRawList(BuiltinFormatterFunction): @@ -726,7 +727,7 @@ class BuiltinCount(BuiltinFormatterFunction): 'uses an ampersand. Examples: {tags:count(,)}, {authors:count(&)}') def evaluate(self, formatter, kwargs, mi, locals, val, sep): - return unicode(len([v for v in val.split(sep) if v])) + return unicode_type(len([v for v in val.split(sep) if v])) class BuiltinListitem(BuiltinFormatterFunction): diff --git a/src/calibre/utils/html2text.py b/src/calibre/utils/html2text.py index 49a7a9559d..6541e26f78 100644 --- a/src/calibre/utils/html2text.py +++ b/src/calibre/utils/html2text.py @@ -14,6 +14,7 @@ __contributors__ = ["Martin 'Joey' Schulze", "Ricardo Reyes", "Kevin Jay North"] # TODO: # Support decoded entities with unifiable. +from polyglot.builtins import codepoint_to_chr import re, sys, urllib, htmlentitydefs, codecs import sgmllib sgmllib.charref = re.compile('&#([xX]?[0-9a-fA-F]+)[^0-9a-fA-F]') @@ -75,7 +76,7 @@ def charref(name): if not UNICODE_SNOB and c in unifiable_n.keys(): return unifiable_n[c] else: - return unichr(c) + return codepoint_to_chr(c) def entityref(c): @@ -87,7 +88,7 @@ def entityref(c): except KeyError: return "&" + c else: - return unichr(name2cp(c)) + return codepoint_to_chr(name2cp(c)) def replaceEntities(s): diff --git a/src/calibre/utils/icu.py b/src/calibre/utils/icu.py index e17d345a68..1e26752fb0 100644 --- a/src/calibre/utils/icu.py +++ b/src/calibre/utils/icu.py @@ -16,6 +16,7 @@ import codecs from calibre.constants import plugins from calibre.utils.config_base import tweaks +from polyglot.builtins import unicode_type _locale = _collator = _primary_collator = _sort_collator = _numeric_collator = _case_sensitive_collator = None @@ -250,7 +251,7 @@ ord_string = _icu.ord_string def character_name(string): try: - return _icu.character_name(unicode(string)) or None + return _icu.character_name(unicode_type(string)) or None except (TypeError, ValueError, KeyError): pass @@ -267,7 +268,7 @@ def normalize(text, mode='NFC'): # that unless you have very good reasons not too. Also, it's speed # decreases on wide python builds, where conversion to/from ICU's string # representation is slower. - return _icu.normalize(_nmodes[mode], unicode(text)) + return _icu.normalize(_nmodes[mode], unicode_type(text)) def contractions(col=None): diff --git a/src/calibre/utils/icu_test.py b/src/calibre/utils/icu_test.py index 8ea028b0aa..f70b40f243 100644 --- a/src/calibre/utils/icu_test.py +++ b/src/calibre/utils/icu_test.py @@ -10,6 +10,7 @@ import unittest, sys from contextlib import contextmanager import calibre.utils.icu as icu +from polyglot.builtins import unicode_type @contextmanager @@ -164,7 +165,7 @@ class TestICU(unittest.TestCase): ' Test the break iterator ' from calibre.spell.break_iterator import split_into_words as split, index_of, split_into_words_and_positions for q in ('one two three', ' one two three', 'one\ntwo three ', ): - self.ae(split(unicode(q)), ['one', 'two', 'three'], 'Failed to split: %r' % q) + self.ae(split(unicode_type(q)), ['one', 'two', 'three'], 'Failed to split: %r' % q) self.ae(split(u'I I\'m'), ['I', "I'm"]) self.ae(split(u'out-of-the-box'), ['out-of-the-box']) self.ae(split(u'-one two-'), ['-one', 'two-']) diff --git a/src/calibre/utils/ipc/launch.py b/src/calibre/utils/ipc/launch.py index 5dfcf4f880..31c742c65b 100644 --- a/src/calibre/utils/ipc/launch.py +++ b/src/calibre/utils/ipc/launch.py @@ -12,6 +12,7 @@ from functools import partial from calibre.constants import iswindows, isosx, isfrozen, filesystem_encoding from calibre.utils.config import prefs from calibre.ptempfile import PersistentTemporaryFile, base_dir +from polyglot.builtins import unicode_type if iswindows: import win32process @@ -92,13 +93,13 @@ class Worker(object): for key in os.environ: try: val = os.environ[key] - if isinstance(val, unicode): + if isinstance(val, unicode_type): # On windows subprocess cannot handle unicode env vars try: val = val.encode(filesystem_encoding) except ValueError: val = val.encode('utf-8') - if isinstance(key, unicode): + if isinstance(key, unicode_type): key = key.encode('ascii') env[key] = val except: @@ -156,9 +157,9 @@ class Worker(object): # Windows cannot handle unicode env vars for k, v in env.iteritems(): try: - if isinstance(k, unicode): + if isinstance(k, unicode_type): k = k.encode('ascii') - if isinstance(v, unicode): + if isinstance(v, unicode_type): try: v = v.encode(filesystem_encoding) except: @@ -231,6 +232,3 @@ class Worker(object): self.log_path = ret return ret - - - diff --git a/src/calibre/utils/ipc/proxy.py b/src/calibre/utils/ipc/proxy.py index b58cda06e7..349267a240 100644 --- a/src/calibre/utils/ipc/proxy.py +++ b/src/calibre/utils/ipc/proxy.py @@ -16,6 +16,7 @@ from functools import partial from calibre import as_unicode, prints from calibre.constants import iswindows, DEBUG from calibre.utils.ipc import eintr_retry_call +from polyglot.builtins import unicode_type def _encode(msg): @@ -160,10 +161,8 @@ class Server(Thread): import traceback # Try to tell the client process what error happened try: - eintr_retry_call(conn.send_bytes, (_encode(('failed', (unicode(e), + eintr_retry_call(conn.send_bytes, (_encode(('failed', (unicode_type(e), as_unicode(traceback.format_exc())))))) except: pass raise - - diff --git a/src/calibre/utils/ipc/simple_worker.py b/src/calibre/utils/ipc/simple_worker.py index 07095637a0..bb721a5279 100644 --- a/src/calibre/utils/ipc/simple_worker.py +++ b/src/calibre/utils/ipc/simple_worker.py @@ -16,6 +16,7 @@ from contextlib import closing from calibre.constants import iswindows from calibre.utils.ipc import eintr_retry_call from calibre.utils.ipc.launch import Worker +from polyglot.builtins import unicode_type class WorkerError(Exception): @@ -251,7 +252,7 @@ def offload_worker(env={}, priority='normal', cwd=None): def compile_code(src): import re, io - if not isinstance(src, unicode): + if not isinstance(src, unicode_type): match = re.search(r'coding[:=]\s*([-\w.]+)', src[:200]) enc = match.group(1) if match else 'utf-8' src = src.decode(enc) diff --git a/src/calibre/utils/linux_trash.py b/src/calibre/utils/linux_trash.py index d8c189c4d1..bf01398f2f 100644 --- a/src/calibre/utils/linux_trash.py +++ b/src/calibre/utils/linux_trash.py @@ -24,6 +24,8 @@ import os.path as op from datetime import datetime from urllib import quote +from polyglot.builtins import unicode_type + FILES_DIR = 'files' INFO_DIR = 'info' INFO_SUFFIX = '.trashinfo' @@ -38,7 +40,7 @@ TOPDIR_FALLBACK = '.Trash-%s'%uid def uniquote(raw): - if isinstance(raw, unicode): + if isinstance(raw, unicode_type): raw = raw.encode('utf-8') return quote(raw).decode('utf-8') diff --git a/src/calibre/utils/localization.py b/src/calibre/utils/localization.py index d60ecdd0a0..9da64132e0 100644 --- a/src/calibre/utils/localization.py +++ b/src/calibre/utils/localization.py @@ -1,7 +1,6 @@ #!/usr/bin/env python2 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai -from __future__ import absolute_import -from __future__ import print_function +from __future__ import absolute_import, print_function __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' @@ -10,6 +9,8 @@ __docformat__ = 'restructuredtext en' import os, locale, re, cStringIO from gettext import GNUTranslations, NullTranslations +from polyglot.builtins import unicode_type + _available_translations = None @@ -392,7 +393,7 @@ def calibre_langcode_to_name(lc, localize=True): def canonicalize_lang(raw): if not raw: return None - if not isinstance(raw, unicode): + if not isinstance(raw, unicode_type): raw = raw.decode('utf-8', 'ignore') raw = raw.lower().strip() if not raw: diff --git a/src/calibre/utils/logging.py b/src/calibre/utils/logging.py index 6489b1d2f5..ccf8d21c42 100644 --- a/src/calibre/utils/logging.py +++ b/src/calibre/utils/logging.py @@ -15,6 +15,7 @@ from functools import partial from threading import Lock from calibre import isbytestring, force_unicode, as_unicode, prints +from polyglot.builtins import unicode_type class Stream(object): @@ -106,7 +107,7 @@ class UnicodeHTMLStream(HTMLStream): for arg in args: if isbytestring(arg): arg = force_unicode(arg) - elif not isinstance(arg, unicode): + elif not isinstance(arg, unicode_type): arg = as_unicode(arg) self.data.append(arg+sep) self.plain_text.append(arg+sep) diff --git a/src/calibre/utils/matcher.py b/src/calibre/utils/matcher.py index 12a1d5229f..c417a9b41e 100644 --- a/src/calibre/utils/matcher.py +++ b/src/calibre/utils/matcher.py @@ -15,7 +15,7 @@ from collections import OrderedDict from itertools import islice from itertools import izip -from polyglot.builtins import map +from polyglot.builtins import map, unicode_type from calibre import detect_ncpus as cpu_count, as_unicode from calibre.constants import plugins, filesystem_encoding @@ -97,7 +97,7 @@ class Matcher(object): w = [Worker(requests, results) for i in range(max(1, cpu_count()))] [x.start() for x in w] workers.extend(w) - items = map(lambda x: normalize('NFC', unicode(x)), filter(None, items)) + items = map(lambda x: normalize('NFC', unicode_type(x)), filter(None, items)) self.items = items = tuple(items) tasks = split(items, len(workers)) self.task_maps = [{j: i for j, (i, _) in enumerate(task)} for task in tasks] @@ -108,7 +108,7 @@ class Matcher(object): self.sort_keys = None def __call__(self, query, limit=None): - query = normalize('NFC', unicode(query)) + query = normalize('NFC', unicode_type(query)) with wlock: for i, scorer in enumerate(self.scorers): workers[0].requests.put((i, scorer, query)) @@ -265,7 +265,7 @@ class CScorer(object): self.m = speedup.Matcher( items, primary_collator().capsule, - unicode(level1), unicode(level2), unicode(level3) + unicode_type(level1), unicode_type(level2), unicode_type(level3) ) def __call__(self, query): diff --git a/src/calibre/utils/open_with/osx.py b/src/calibre/utils/open_with/osx.py index 92488feb65..6b02aef6d3 100644 --- a/src/calibre/utils/open_with/osx.py +++ b/src/calibre/utils/open_with/osx.py @@ -11,6 +11,7 @@ from collections import defaultdict from calibre.ptempfile import TemporaryDirectory from calibre.utils.icu import numeric_sort_key +from polyglot.builtins import unicode_type application_locations = ('/Applications', '~/Applications', '~/Desktop') @@ -29,8 +30,8 @@ def generate_public_uti_map(): for table in tables: for tr in table.xpath('descendant::tr')[1:]: td = tr.xpath('descendant::td') - identifier = etree.tostring(td[0], method='text', encoding=unicode).strip() - tags = etree.tostring(td[2], method='text', encoding=unicode).strip() + identifier = etree.tostring(td[0], method='text', encoding=unicode_type).strip() + tags = etree.tostring(td[2], method='text', encoding=unicode_type).strip() identifier = identifier.split()[0].replace('\u200b', '') exts = [x.strip()[1:].lower() for x in tags.split(',') if x.strip().startswith('.')] for ext in exts: diff --git a/src/calibre/utils/podofo/__init__.py b/src/calibre/utils/podofo/__init__.py index 209ad26db4..b362cdef2e 100644 --- a/src/calibre/utils/podofo/__init__.py +++ b/src/calibre/utils/podofo/__init__.py @@ -1,7 +1,6 @@ #!/usr/bin/env python2 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai -from __future__ import with_statement -from __future__ import print_function +from __future__ import print_function, with_statement __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' @@ -13,6 +12,7 @@ from calibre.constants import plugins, preferred_encoding from calibre.ebooks.metadata import authors_to_string from calibre.ptempfile import TemporaryDirectory from calibre.utils.ipc.simple_worker import fork_job, WorkerError +from polyglot.builtins import unicode_type def get_podofo(): @@ -25,7 +25,7 @@ def get_podofo(): def prep(val): if not val: return u'' - if not isinstance(val, unicode): + if not isinstance(val, unicode_type): val = val.decode(preferred_encoding, 'replace') return val.strip() diff --git a/src/calibre/utils/search_query_parser.py b/src/calibre/utils/search_query_parser.py index df3d3ed323..ea6608f64f 100644 --- a/src/calibre/utils/search_query_parser.py +++ b/src/calibre/utils/search_query_parser.py @@ -22,6 +22,7 @@ import weakref, re from calibre.constants import preferred_encoding from calibre.utils.icu import sort_key from calibre import prints +from polyglot.builtins import codepoint_to_chr, unicode_type ''' @@ -55,7 +56,7 @@ class SavedSearchQueries(object): db.set_pref(self.opt_name, self.queries) def force_unicode(self, x): - if not isinstance(x, unicode): + if not isinstance(x, unicode_type): x = x.decode(preferred_encoding, 'replace') return x @@ -143,15 +144,15 @@ class Parser(object): WORD = 2 QUOTED_WORD = 3 EOF = 4 - REPLACEMENTS = tuple((u'\\' + x, unichr(i + 1)) for i, x in enumerate(u'\\"()')) + REPLACEMENTS = tuple((u'\\' + x, codepoint_to_chr(i + 1)) for i, x in enumerate(u'\\"()')) # Had to translate named constants to numeric values lex_scanner = re.Scanner([ - (unicode(r'[()]'), lambda x,t: (Parser.OPCODE, t)), - (unicode(r'@.+?:[^")\s]+'), lambda x,t: (Parser.WORD, unicode(t))), - (unicode(r'[^"()\s]+'), lambda x,t: (Parser.WORD, unicode(t))), - (unicode(r'".*?((? 1 self.output_dir = os.path.abspath(os.getcwdu()) @@ -1387,7 +1388,7 @@ class BasicNewsRecipe(Recipe): ''' try: from calibre.ebooks.covers import create_cover - title = self.title if isinstance(self.title, unicode) else \ + title = self.title if isinstance(self.title, unicode_type) else \ self.title.decode(preferred_encoding, 'replace') date = strftime(self.timefmt).replace('[', '').replace(']', '') img_data = create_cover(title, [date]) @@ -1433,7 +1434,7 @@ class BasicNewsRecipe(Recipe): article_titles.append(force_unicode(a.title, 'utf-8')) desc = self.description - if not isinstance(desc, unicode): + if not isinstance(desc, unicode_type): desc = desc.decode('utf-8', 'replace') mi.comments = (_('Articles in this issue:' ) + '\n\n' + '\n\n'.join(article_titles)) + '\n\n' + desc @@ -1535,7 +1536,7 @@ class BasicNewsRecipe(Recipe): elem = BeautifulSoup(templ.render(doctype='xhtml').decode('utf-8')).find('div') body.insert(len(body.contents), elem) with open(last, 'wb') as fi: - fi.write(unicode(soup).encode('utf-8')) + fi.write(unicode_type(soup).encode('utf-8')) if len(feeds) == 0: raise Exception('All feeds are empty, aborting.') @@ -1662,7 +1663,7 @@ class BasicNewsRecipe(Recipe): return tag if callable(getattr(tag, 'xpath', None)) and not hasattr(tag, 'contents'): # a lxml tag from lxml.etree import tostring - ans = tostring(tag, method='text', encoding=unicode, with_tail=False) + ans = tostring(tag, method='text', encoding=unicode_type, with_tail=False) else: strings = [] for item in tag.contents: diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index 0b1eb7f22b..0b08171b6e 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -9,6 +9,7 @@ from calibre.web.feeds.news import (BasicNewsRecipe, CustomIndexRecipe, AutomaticNewsRecipe, CalibrePeriodical) from calibre.ebooks.BeautifulSoup import BeautifulSoup from calibre.utils.config import JSONConfig +from polyglot.builtins import unicode_type basic_recipes = (BasicNewsRecipe, AutomaticNewsRecipe, CustomIndexRecipe, CalibrePeriodical) @@ -30,7 +31,7 @@ def compile_recipe(src): :return: Recipe class or None, if no such class was found in src ''' - if not isinstance(src, unicode): + if not isinstance(src, unicode_type): match = re.search(r'coding[:=]\s*([-\w.]+)', src[:200]) enc = match.group(1) if match else 'utf-8' src = src.decode(enc) @@ -53,4 +54,3 @@ def compile_recipe(src): return x return None - diff --git a/src/calibre/web/feeds/recipes/collection.py b/src/calibre/web/feeds/recipes/collection.py index 426fd66ea8..3eea8b4ab1 100644 --- a/src/calibre/web/feeds/recipes/collection.py +++ b/src/calibre/web/feeds/recipes/collection.py @@ -18,6 +18,7 @@ from calibre.constants import numeric_version from calibre.utils.iso8601 import parse_iso8601 from calibre.utils.date import now as nowf, utcnow, local_tz, isoformat, EPOCH, UNDEFINED_DATE from calibre.utils.recycle_bin import delete_file +from polyglot.builtins import unicode_type NS = 'http://calibre-ebook.com/recipe_collection' E = ElementMaker(namespace=NS, nsmap={None:NS}) @@ -143,7 +144,7 @@ def update_custom_recipes(script_ids): fname = custom_recipe_filename(id_, title) else: fname = existing[1] - if isinstance(script, unicode): + if isinstance(script, unicode_type): script = script.encode('utf-8') custom_recipes[id_] = (title, fname) @@ -172,7 +173,7 @@ def add_custom_recipes(script_map): fid = str(id_) fname = custom_recipe_filename(fid, title) - if isinstance(script, unicode): + if isinstance(script, unicode_type): script = script.encode('utf-8') custom_recipes[fid] = (title, fname) @@ -548,8 +549,8 @@ class SchedulerConfig(object): username, password = c[k] except: username = password = '' - self.set_account_info(urn, unicode(username), - unicode(password)) + self.set_account_info(urn, unicode_type(username), + unicode_type(password)) except: continue del c diff --git a/src/calibre/web/feeds/recipes/model.py b/src/calibre/web/feeds/recipes/model.py index 06fa5f5606..d9a34b6b26 100644 --- a/src/calibre/web/feeds/recipes/model.py +++ b/src/calibre/web/feeds/recipes/model.py @@ -19,6 +19,7 @@ from calibre.web.feeds.recipes.collection import \ update_custom_recipes, add_custom_recipe, add_custom_recipes, \ remove_custom_recipe, get_custom_recipe, get_builtin_recipe from calibre.utils.search_query_parser import ParseException +from polyglot.builtins import unicode_type class NewsTreeItem(object): @@ -296,7 +297,7 @@ class RecipeModel(QAbstractItemModel, AdaptSQP): def search(self, query): results = [] try: - query = unicode(query).strip() + query = unicode_type(query).strip() if query: results = self.parse(query) if not results: @@ -413,6 +414,3 @@ class RecipeModel(QAbstractItemModel, AdaptSQP): for recipe in self.scheduler_config.iter_recipes(): ans.append(recipe.get('id')) return ans - - - diff --git a/src/calibre/web/feeds/templates.py b/src/calibre/web/feeds/templates.py index a3fe823333..385746bbd6 100644 --- a/src/calibre/web/feeds/templates.py +++ b/src/calibre/web/feeds/templates.py @@ -12,6 +12,7 @@ from lxml.html.builder import HTML, HEAD, TITLE, STYLE, DIV, BODY, \ TABLE, TD, TR from calibre import strftime, isbytestring +from polyglot.builtins import unicode_type def CLASS(*args, **kwargs): # class is a reserved word in Python @@ -73,7 +74,7 @@ class EmbeddedContent(Template): self.root = HTML(head, BODY(H2(article.title), DIV())) div = self.root.find('body').find('div') - if elements and isinstance(elements[0], unicode): + if elements and isinstance(elements[0], unicode_type): div.text = elements[0] elements = list(elements)[1:] for elem in elements: diff --git a/src/calibre/web/fetch/simple.py b/src/calibre/web/fetch/simple.py index 453220522d..a894691510 100644 --- a/src/calibre/web/fetch/simple.py +++ b/src/calibre/web/fetch/simple.py @@ -24,6 +24,7 @@ from calibre.utils.logging import Log from calibre.utils.img import image_from_data, image_to_data from calibre.utils.imghdr import what from calibre.web.fetch.utils import rescale_image +from polyglot.builtins import unicode_type class AbortArticle(Exception): @@ -90,7 +91,7 @@ def save_soup(soup, target): if path and os.path.isfile(path) and os.path.exists(path) and os.path.isabs(path): tag[key] = unicode_path(relpath(path, selfdir).replace(os.sep, '/')) - html = unicode(soup) + html = unicode_type(soup) with open(target, 'wb') as f: f.write(html.encode('utf-8')) @@ -120,7 +121,7 @@ class RecursiveFetcher(object): def __init__(self, options, log, image_map={}, css_map={}, job_info=None): bd = options.dir - if not isinstance(bd, unicode): + if not isinstance(bd, unicode_type): bd = bd.decode(filesystem_encoding) self.base_dir = os.path.abspath(os.path.expanduser(bd)) @@ -254,7 +255,7 @@ class RecursiveFetcher(object): delta = time.time() - self.last_fetch_at if delta < self.delay: time.sleep(self.delay - delta) - if isinstance(url, unicode): + if isinstance(url, unicode_type): url = url.encode('utf-8') # Not sure is this is really needed as I think mechanize # handles quoting automatically, but leaving it @@ -401,7 +402,7 @@ class RecursiveFetcher(object): continue c += 1 fname = ascii_filename('img'+str(c)) - if isinstance(fname, unicode): + if isinstance(fname, unicode_type): fname = fname.encode('ascii', 'replace') data = self.preprocess_image_ext(data, iurl) if self.preprocess_image_ext is not None else data if data is None: @@ -529,7 +530,7 @@ class RecursiveFetcher(object): self.process_stylesheets(soup, newbaseurl) _fname = basename(iurl) - if not isinstance(_fname, unicode): + if not isinstance(_fname, unicode_type): _fname.decode('latin1', 'replace') _fname = _fname.encode('ascii', 'replace').replace('%', '').replace(os.sep, '') _fname = ascii_filename(_fname) diff --git a/src/polyglot/builtins.py b/src/polyglot/builtins.py index 2872b24009..61a4bb3ccf 100644 --- a/src/polyglot/builtins.py +++ b/src/polyglot/builtins.py @@ -26,6 +26,9 @@ if is_py3: map = builtins.__dict__['map'] filter = builtins.__dict__['filter'] + codepoint_to_chr = chr + unicode_type = str + def iteritems(d): return iter(d.items()) @@ -46,6 +49,9 @@ else: from future_builtins import zip, map, filter # noqa import __builtin__ as builtins + codepoint_to_chr = unichr + unicode_type = unicode + def iteritems(d): return d.iteritems() diff --git a/src/templite/__init__.py b/src/templite/__init__.py index 30c2c8ad82..8e64cc4b82 100644 --- a/src/templite/__init__.py +++ b/src/templite/__init__.py @@ -27,6 +27,8 @@ import sys, re +from polyglot.builtins import unicode_type + class Templite(object): auto_emit = re.compile('(^[\'\"])|(^[a-zA-Z0-9_\[\]\'\"]+$)') @@ -84,4 +86,4 @@ class Templite(object): def write(self, *args): for a in args: - self.__output.append(unicode(a)) + self.__output.append(unicode_type(a)) From 56af613e10caaffabb856d297a87c474d34b138e Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 11 Mar 2019 12:30:26 -0400 Subject: [PATCH 0293/2613] py3: add polyglot imports for BeautifulSoup3 upstream bs4 has changed self.unicode to self.unicode_markup, but calibre does not use UnicodeDammit. Leave this in its historic, horribly confusing state, as it should not cause harm to have a class instance attribute with the same name as a python2 object type. --- src/calibre/ebooks/BeautifulSoup.py | 44 ++++++++++++++--------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/calibre/ebooks/BeautifulSoup.py b/src/calibre/ebooks/BeautifulSoup.py index 5ca831444c..dd2a6b80b3 100644 --- a/src/calibre/ebooks/BeautifulSoup.py +++ b/src/calibre/ebooks/BeautifulSoup.py @@ -76,8 +76,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE, DAMMIT. """ -from __future__ import generators -from __future__ import print_function +from __future__ import generators, print_function __author__ = "Leonard Richardson (leonardr@segfault.org)" __version__ = "3.0.5" @@ -90,6 +89,7 @@ import types import re import calibre.ebooks.sgmllib as sgmllib from htmlentitydefs import name2codepoint +from polyglot.builtins import codepoint_to_chr, unicode_type #This hack makes Beautiful Soup able to parse XML with namespaces sgmllib.tagfind = re.compile('[a-zA-Z][-_.:a-zA-Z0-9]*') @@ -178,7 +178,7 @@ class PageElement: def insert(self, position, newChild): if (isinstance(newChild, basestring) - or isinstance(newChild, unicode)) \ + or isinstance(newChild, unicode_type)) \ and not isinstance(newChild, NavigableString): newChild = NavigableString(newChild) @@ -383,19 +383,19 @@ class PageElement: def toEncoding(self, s, encoding=None): """Encodes an object to a string in some encoding, or to Unicode. .""" - if isinstance(s, unicode): + if isinstance(s, unicode_type): if encoding: s = s.encode(encoding) elif isinstance(s, str): if encoding: s = s.encode(encoding) else: - s = unicode(s) + s = unicode_type(s) else: if encoding: s = self.toEncoding(str(s), encoding) else: - s = unicode(s) + s = unicode_type(s) return s BARE_AMPERSAND_OR_BRACKET = re.compile("([<>]|" @@ -408,7 +408,7 @@ class PageElement: return "&" + self.XML_SPECIAL_CHARS_TO_ENTITIES[x.group(0)[0]] + ";" -class NavigableString(unicode, PageElement): +class NavigableString(unicode_type, PageElement): def __getnewargs__(self): return (NavigableString.__str__(self),) @@ -423,7 +423,7 @@ class NavigableString(unicode, PageElement): raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, attr)) def __unicode__(self): - return unicode(str(self), DEFAULT_OUTPUT_ENCODING) # Changed by Kovid + return unicode_type(str(self), DEFAULT_OUTPUT_ENCODING) # Changed by Kovid def __str__(self, encoding=DEFAULT_OUTPUT_ENCODING): # Substitute outgoing XML entities. @@ -479,7 +479,7 @@ class Tag(PageElement): escaped.""" x = match.group(1) if self.convertHTMLEntities and x in name2codepoint: - return unichr(name2codepoint[x]) + return codepoint_to_chr(name2codepoint[x]) elif x in self.XML_ENTITIES_TO_SPECIAL_CHARS: if self.convertXMLEntities: return self.XML_ENTITIES_TO_SPECIAL_CHARS[x] @@ -488,9 +488,9 @@ class Tag(PageElement): elif len(x) > 0 and x[0] == '#': # Handle numeric entities if len(x) > 1 and x[1] == 'x': - return unichr(int(x[2:], 16)) + return codepoint_to_chr(int(x[2:], 16)) else: - return unichr(int(x[1:])) + return codepoint_to_chr(int(x[1:])) elif self.escapeUnrecognizedEntities: return u'&%s;' % x @@ -899,7 +899,7 @@ class SoupStrainer: if isinstance(markup, Tag): markup = markup.name if markup and not isString(markup): - markup = unicode(markup) + markup = unicode_type(markup) #Now we know that chunk is either a string, or None. if hasattr(matchAgainst, 'match'): # It's a regexp object. @@ -909,8 +909,8 @@ class SoupStrainer: elif hasattr(matchAgainst, 'items'): result = markup.has_key(matchAgainst) elif matchAgainst and isString(markup): - if isinstance(markup, unicode): - matchAgainst = unicode(matchAgainst) + if isinstance(markup, unicode_type): + matchAgainst = unicode_type(matchAgainst) else: matchAgainst = str(matchAgainst) @@ -937,7 +937,7 @@ def isString(s): """Convenience method that works with all 2.x versions of Python to determine whether or not something is stringlike.""" try: - return isinstance(s, unicode) or isinstance(s, basestring) + return isinstance(s, unicode_type) or isinstance(s, basestring) except NameError: return isinstance(s, str) @@ -1088,7 +1088,7 @@ class BeautifulStoneSoup(Tag, SGMLParser): def _feed(self, inDocumentEncoding=None): # Convert the document to Unicode. markup = self.markup - if isinstance(markup, unicode): + if isinstance(markup, unicode_type): if not hasattr(self, 'originalEncoding'): self.originalEncoding = None else: @@ -1328,7 +1328,7 @@ class BeautifulStoneSoup(Tag, SGMLParser): if ref.lower().startswith('x'): # ref = int(ref[1:], 16) # Added by Kovid to handle hex numeric entities try: - data = unichr(int(ref)) + data = codepoint_to_chr(int(ref)) except ValueError: # Bad numerical entity. Added by Kovid data = u'' else: @@ -1342,7 +1342,7 @@ class BeautifulStoneSoup(Tag, SGMLParser): data = None if self.convertHTMLEntities: try: - data = unichr(name2codepoint[ref]) + data = codepoint_to_chr(name2codepoint[ref]) except KeyError: pass @@ -1689,9 +1689,9 @@ class UnicodeDammit: self.smartQuotesTo = smartQuotesTo self.triedEncodings = [] - if markup == '' or isinstance(markup, unicode): + if markup == '' or isinstance(markup, unicode_type): self.originalEncoding = None - self.unicode = unicode(markup) + self.unicode = unicode_type(markup) return u = None @@ -1704,7 +1704,7 @@ class UnicodeDammit: if u: break # If no luck and we have auto-detection library, try that: - if not u and chardet and not isinstance(self.markup, unicode): + if not u and chardet and not isinstance(self.markup, unicode_type): u = self._convertFrom(chardet.detect(self.markup)['encoding']) # As a last resort, try utf-8 and windows-1252: @@ -1777,7 +1777,7 @@ class UnicodeDammit: encoding = 'utf-32le' data = data[4:] - newdata = unicode(data, encoding) + newdata = unicode_type(data, encoding) return newdata From 5b7608983987f1fc782325f392de8a4338d8fe8c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Mar 2019 06:40:38 +0530 Subject: [PATCH 0294/2613] Various py3 related fixes exposed by the unicode patch --- src/calibre/db/backend.py | 18 +- src/calibre/db/categories.py | 15 +- src/calibre/db/search.py | 10 +- src/calibre/db/utils.py | 6 +- src/calibre/db/write.py | 4 + src/calibre/devices/prst1/driver.py | 4 +- .../devices/smart_device_app/driver.py | 6 +- .../ebooks/conversion/plugins/epub_output.py | 7 +- src/calibre/ebooks/lrf/html/convert_from.py | 11 - src/calibre/ebooks/lrf/meta.py | 4 +- src/calibre/ebooks/lrf/objects.py | 103 +- src/calibre/ebooks/metadata/book/base.py | 14 +- src/calibre/ebooks/metadata/fb2.py | 2 +- src/calibre/ebooks/metadata/opf2.py | 19 +- src/calibre/ebooks/mobi/mobiml.py | 26 +- src/calibre/ebooks/mobi/reader/mobi6.py | 67 +- src/calibre/ebooks/mobi/writer2/serializer.py | 51 +- src/calibre/ebooks/oeb/base.py | 74 +- src/calibre/ebooks/oeb/iterator/spine.py | 2 +- src/calibre/ebooks/oeb/parse_utils.py | 4 +- src/calibre/ebooks/oeb/stylizer.py | 8 +- src/calibre/ebooks/txt/processor.py | 28 +- src/calibre/ebooks/unihandecode/__init__.py | 16 +- .../ebooks/unihandecode/pykakasi/jisyo.py | 6 +- src/calibre/ebooks/unihandecode/unidecoder.py | 10 +- src/calibre/gui2/comments_editor.py | 2 +- src/calibre/gui2/dbus_export/gtk.py | 3 +- src/calibre/gui2/dialogs/quickview.py | 4 +- src/calibre/gui2/init.py | 7 +- src/calibre/gui2/layout.py | 2 +- src/calibre/gui2/lrf_renderer/main.py | 5 +- src/calibre/gui2/main.py | 2 +- src/calibre/gui2/main_window.py | 11 +- src/calibre/gui2/notify.py | 10 +- src/calibre/gui2/store/search/search.py | 4 +- .../gui2/tweak_book/function_replace.py | 4 +- src/calibre/library/add_to_library.py | 5 +- src/calibre/library/caches.py | 16 +- src/calibre/library/catalogs/csv_xml.py | 6 +- src/calibre/library/custom_columns.py | 14 +- src/calibre/library/database2.py | 14 +- src/calibre/srv/routes.py | 2 +- src/calibre/utils/apsw_shell.py | 2958 ----------------- src/calibre/utils/date.py | 4 +- src/calibre/utils/formatter_functions.py | 2 +- src/calibre/utils/ipc/simple_worker.py | 4 +- src/calibre/web/feeds/recipes/__init__.py | 4 +- src/polyglot/builtins.py | 2 + 48 files changed, 390 insertions(+), 3210 deletions(-) delete mode 100644 src/calibre/utils/apsw_shell.py diff --git a/src/calibre/db/backend.py b/src/calibre/db/backend.py index c1d7e6b9b1..146bb8eba4 100644 --- a/src/calibre/db/backend.py +++ b/src/calibre/db/backend.py @@ -670,7 +670,7 @@ class DB(object): if d['is_multiple']: if x is None: return [] - if isinstance(x, (str, unicode_type, bytes)): + if isinstance(x, (unicode_type, bytes)): x = x.split(d['multiple_seps']['ui_to_list']) x = [y.strip() for y in x if y.strip()] x = [y.decode(preferred_encoding, 'replace') if not isinstance(y, @@ -681,12 +681,16 @@ class DB(object): x.decode(preferred_encoding, 'replace') def adapt_datetime(x, d): - if isinstance(x, (str, unicode_type, bytes)): + if isinstance(x, (unicode_type, bytes)): + if isinstance(x, bytes): + x = x.decode(preferred_encoding, 'replace') x = parse_date(x, assume_utc=False, as_utc=False) return x def adapt_bool(x, d): - if isinstance(x, (str, unicode_type, bytes)): + if isinstance(x, (unicode_type, bytes)): + if isinstance(x, bytes): + x = x.decode(preferred_encoding, 'replace') x = x.lower() if x == 'true': x = True @@ -707,7 +711,9 @@ class DB(object): def adapt_number(x, d): if x is None: return None - if isinstance(x, (str, unicode_type, bytes)): + if isinstance(x, (unicode_type, bytes)): + if isinstance(x, bytes): + x = x.decode(preferred_encoding, 'replace') if x.lower() == 'none': return None if d['datatype'] == 'int': @@ -1083,7 +1089,7 @@ class DB(object): def dump_and_restore(self, callback=None, sql=None): import codecs - from calibre.utils.apsw_shell import Shell + from apsw import Shell from contextlib import closing if callback is None: callback = lambda x: x @@ -1096,7 +1102,7 @@ class DB(object): shell = Shell(db=self.conn, stdout=buf) shell.process_command('.dump') else: - with open(fname, 'wb') as buf: + with lopen(fname, 'wb') as buf: buf.write(sql if isinstance(sql, bytes) else sql.encode('utf-8')) with TemporaryFile(suffix='_tmpdb.db', dir=os.path.dirname(self.dbpath)) as tmpdb: diff --git a/src/calibre/db/categories.py b/src/calibre/db/categories.py index 377eab54ba..0ae1cee97f 100644 --- a/src/calibre/db/categories.py +++ b/src/calibre/db/categories.py @@ -11,6 +11,7 @@ import copy from functools import partial from polyglot.builtins import unicode_type, map +from calibre.constants import ispy3 from calibre.ebooks.metadata import author_to_author_sort from calibre.utils.config_base import tweaks from calibre.utils.icu import sort_key, collation_order @@ -43,11 +44,19 @@ class Tag(object): self.search_expression = search_expression self.original_categories = None - def __unicode__(self): + @property + def string_representation(self): return u'%s:%s:%s:%s:%s'%(self.name, self.count, self.id, self.state, self.category) - def __str__(self): - return unicode_type(self).encode('utf-8') + if ispy3: + def __str__(self): + return self.string_representation + else: + def __str__(self): + return self.string_representation.encode('utf-8') + + def __unicode__(self): + return self.string_representation def __repr__(self): return str(self) diff --git a/src/calibre/db/search.py b/src/calibre/db/search.py index 175cd36d6e..da021d0e36 100644 --- a/src/calibre/db/search.py +++ b/src/calibre/db/search.py @@ -80,7 +80,7 @@ def _match(query, value, matchkind, use_primary_find_in_search=True, case_sensit if primary_contains(query, t): return True elif query in t: - return True + return True except re.error: pass return False @@ -149,7 +149,9 @@ class DateSearch(object): # {{{ if query == 'false': for v, book_ids in field_iter(): - if isinstance(v, (str, unicode_type)): + if isinstance(v, (bytes, unicode_type)): + if isinstance(v, bytes): + v = v.decode(preferred_encoding, 'replace') v = parse_date(v) if v is None or v <= UNDEFINED_DATE: matches |= book_ids @@ -157,7 +159,9 @@ class DateSearch(object): # {{{ if query == 'true': for v, book_ids in field_iter(): - if isinstance(v, (str, unicode_type)): + if isinstance(v, (bytes, unicode_type)): + if isinstance(v, bytes): + v = v.decode(preferred_encoding, 'replace') v = parse_date(v) if v is not None and v > UNDEFINED_DATE: matches |= book_ids diff --git a/src/calibre/db/utils.py b/src/calibre/db/utils.py index 99f281ad59..65d3e678d2 100644 --- a/src/calibre/db/utils.py +++ b/src/calibre/db/utils.py @@ -13,13 +13,15 @@ from polyglot.builtins import map, unicode_type from threading import Lock from calibre import as_unicode, prints -from calibre.constants import cache_dir, get_windows_number_formats, iswindows +from calibre.constants import cache_dir, get_windows_number_formats, iswindows, preferred_encoding from calibre.utils.localization import canonicalize_lang def force_to_bool(val): - if isinstance(val, (str, unicode_type)): + if isinstance(val, (bytes, unicode_type)): + if isinstance(val, bytes): + val = val.decode(preferred_encoding, 'replace') try: val = icu_lower(val) if not val: diff --git a/src/calibre/db/write.py b/src/calibre/db/write.py index dc8caace86..5670fff3f5 100644 --- a/src/calibre/db/write.py +++ b/src/calibre/db/write.py @@ -88,6 +88,8 @@ def adapt_number(typ, x): if x is None: return None if isinstance(x, (unicode_type, bytes)): + if isinstance(x, bytes): + x = x.decode(preferred_encoding, 'replace') if not x or x.lower() == 'none': return None return typ(x) @@ -95,6 +97,8 @@ def adapt_number(typ, x): def adapt_bool(x): if isinstance(x, (unicode_type, bytes)): + if isinstance(x, bytes): + x = x.decode(preferred_encoding, 'replace') x = x.lower() if x == 'true': x = True diff --git a/src/calibre/devices/prst1/driver.py b/src/calibre/devices/prst1/driver.py index 12120249d3..3dbb353713 100644 --- a/src/calibre/devices/prst1/driver.py +++ b/src/calibre/devices/prst1/driver.py @@ -171,7 +171,7 @@ class PRST1(USBMS): with closing(sqlite.connect(dbpath)) as connection: # Replace undecodable characters in the db instead of erroring out - connection.text_factory = lambda x: unicode_type(x, "utf-8", "replace") + connection.text_factory = lambda x: x if isinstance(x, unicode_type) else x.decode('utf-8', 'replace') cursor = connection.cursor() # Query collections @@ -758,7 +758,7 @@ class PRST1(USBMS): thumbnail_path = THUMBPATH%book.bookId - prefix = self._main_prefix if source_id is 0 else self._card_a_prefix + prefix = self._main_prefix if source_id == 0 else self._card_a_prefix thumbnail_file_path = os.path.join(prefix, *thumbnail_path.split('/')) thumbnail_dir_path = os.path.dirname(thumbnail_file_path) if not os.path.exists(thumbnail_dir_path): diff --git a/src/calibre/devices/smart_device_app/driver.py b/src/calibre/devices/smart_device_app/driver.py index 9619a82f04..7d60bf2916 100644 --- a/src/calibre/devices/smart_device_app/driver.py +++ b/src/calibre/devices/smart_device_app/driver.py @@ -398,7 +398,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): if isinstance(a, dict): printable = {} for k,v in a.iteritems(): - if isinstance(v, (str, unicode_type)) and len(v) > 50: + if isinstance(v, (bytes, unicode_type)) and len(v) > 50: printable[k] = 'too long' else: printable[k] = v @@ -666,7 +666,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): if v: v = json.loads(v, object_hook=from_json) if print_debug_info and extra_debug: - self._debug('receive after decode') # , v) + self._debug('receive after decode') # , v) return (self.reverse_opcodes[v[0]], v[1]) self._debug('protocol error -- empty json string') except socket.timeout: @@ -1155,7 +1155,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): (self.DEFAULT_THUMBNAIL_HEIGHT/3) * 4) self._debug('cover width', self.THUMBNAIL_WIDTH) elif hasattr(self, 'THUMBNAIL_WIDTH'): - delattr(self, 'THUMBNAIL_WIDTH') + delattr(self, 'THUMBNAIL_WIDTH') self.is_read_sync_col = result.get('isReadSyncCol', None) self._debug('Device is_read sync col', self.is_read_sync_col) diff --git a/src/calibre/ebooks/conversion/plugins/epub_output.py b/src/calibre/ebooks/conversion/plugins/epub_output.py index a6967a8645..25f6c3b2aa 100644 --- a/src/calibre/ebooks/conversion/plugins/epub_output.py +++ b/src/calibre/ebooks/conversion/plugins/epub_output.py @@ -12,7 +12,6 @@ from calibre.customize.conversion import (OutputFormatPlugin, OptionRecommendation) from calibre.ptempfile import TemporaryDirectory from calibre import CurrentDir -from calibre.constants import filesystem_encoding from polyglot.builtins import unicode_type block_level_tags = ( @@ -41,7 +40,7 @@ block_level_tags = ( 'pre', 'table', 'ul', - ) +) class EPUBOutput(OutputFormatPlugin): @@ -326,13 +325,11 @@ class EPUBOutput(OutputFormatPlugin): fonts = [] for uri in list(uris.keys()): path = uris[uri] - if isinstance(path, unicode_type): - path = path.encode(filesystem_encoding) if not os.path.exists(path): uris.pop(uri) continue self.log.debug('Encrypting font:', uri) - with open(path, 'r+b') as f: + with lopen(path, 'r+b') as f: data = f.read(1024) if len(data) >= 1024: f.seek(0) diff --git a/src/calibre/ebooks/lrf/html/convert_from.py b/src/calibre/ebooks/lrf/html/convert_from.py index 9ccfe8f2a5..9244ebb686 100644 --- a/src/calibre/ebooks/lrf/html/convert_from.py +++ b/src/calibre/ebooks/lrf/html/convert_from.py @@ -55,11 +55,7 @@ def munge_paths(basepath, url): if not path: path = basepath elif not os.path.isabs(path): - if isinstance(path, unicode_type): - path = path.encode(sys.getfilesystemencoding()) dn = os.path.dirname(basepath) - if isinstance(dn, unicode_type): - dn = dn.encode(sys.getfilesystemencoding()) path = os.path.join(dn, path) return os.path.normpath(path), fragment @@ -1480,11 +1476,6 @@ class HTMLConverter(object): ext = os.path.splitext(path)[1] if ext: ext = ext[1:].lower() - enc = sys.getfilesystemencoding() - if not enc: - enc = 'utf8' - if isinstance(path, unicode_type): - path = path.encode(enc, 'replace') if os.access(path, os.R_OK) and os.path.isfile(path): if ext in ['png', 'jpg', 'bmp', 'jpeg']: self.process_image(path, tag_css) @@ -1811,8 +1802,6 @@ class HTMLConverter(object): def process_file(path, options, logger): - if not isinstance(path, unicode_type): - path = path.decode(sys.getfilesystemencoding()) path = os.path.abspath(path) default_title = filename_to_utf8(os.path.splitext(os.path.basename(path))[0]) dirpath = os.path.dirname(path) diff --git a/src/calibre/ebooks/lrf/meta.py b/src/calibre/ebooks/lrf/meta.py index 49e944a70d..882762a78c 100644 --- a/src/calibre/ebooks/lrf/meta.py +++ b/src/calibre/ebooks/lrf/meta.py @@ -196,8 +196,8 @@ class xml_field(object): if not val: val = u'' - if isinstance(val, unicode_type): - val = unicode_type(val, 'utf-8') + if not isinstance(val, unicode_type): + val = val.decode('utf-8') elems = document.getElementsByTagName(self.tag_name) elem = None diff --git a/src/calibre/ebooks/lrf/objects.py b/src/calibre/ebooks/lrf/objects.py index c23b1136ac..83895b8860 100644 --- a/src/calibre/ebooks/lrf/objects.py +++ b/src/calibre/ebooks/lrf/objects.py @@ -4,6 +4,7 @@ __copyright__ = '2008, Kovid Goyal ' import struct, array, zlib, cStringIO, collections, re from calibre.ebooks.lrf import LRFParseError, PRS500_PROFILE +from calibre.constants import ispy3 from calibre import entity_to_unicode, prepare_string_for_xml from calibre.ebooks.lrf.tags import Tag from polyglot.builtins import unicode_type @@ -88,11 +89,8 @@ class LRFObject(object): for i in range(0): yield i - def __unicode__(self): - return unicode_type(self.__class__.__name__) - def __str__(self): - return unicode_type(self).encode('utf-8') + return self.__class__.__name__ class LRFContentObject(LRFObject): @@ -204,12 +202,15 @@ class StyleObject(object): s += u'%s="%s" '%(attr, getattr(self, attr)) return s - def __unicode__(self): + def __str__(self): s = u'<%s objid="%s" stylelabel="%s" '%(self.__class__.__name__.replace('Attr', 'Style'), self.id, self.id) s += self._tags_to_xml() s += u'/>\n' return s + if not ispy3: + __unicode__ = __str__ + def as_dict(self): d = {} for h in self.tag_map.values(): @@ -252,11 +253,11 @@ class Color(object): def __init__(self, val): self.a, self.r, self.g, self.b = val & 0xFF, (val>>8)&0xFF, (val>>16)&0xFF, (val>>24)&0xFF - def __unicode__(self): + def __str__(self): return u'0x%02x%02x%02x%02x'%(self.a, self.r, self.g, self.b) - def __str__(self): - return unicode_type(self) + if not ispy3: + __unicode__ = __str__ def __len__(self): return 4 @@ -284,10 +285,13 @@ class PageDiv(EmptyPageElement): self.pain, self.spacesize, self.linewidth = pain, spacesize, linewidth self.linecolor = Color(linecolor) - def __unicode__(self): + def __str__(self): return u'\n\n'%\ (self.pain, self.spacesize, self.linewidth, self.color) + if not ispy3: + __unicode__ = __str__ + class RuledLine(EmptyPageElement): @@ -299,19 +303,25 @@ class RuledLine(EmptyPageElement): self.linecolor = Color(linecolor) self.id = -1 - def __unicode__(self): + def __str__(self): return u'\n\n'%\ (self.linelength, self.linetype, self.linewidth, self.linecolor) + if not ispy3: + __unicode__ = __str__ + class Wait(EmptyPageElement): def __init__(self, time): self.time = time - def __unicode__(self): + def __str__(self): return u'\n\n'%(self.time) + if not ispy3: + __unicode__ = __str__ + class Locate(EmptyPageElement): @@ -320,19 +330,25 @@ class Locate(EmptyPageElement): def __init__(self, pos): self.pos = self.pos_map[pos] - def __unicode__(self): + def __str__(self): return u'\n\n'%(self.pos) + if not ispy3: + __unicode__ = __str__ + class BlockSpace(EmptyPageElement): def __init__(self, xspace, yspace): self.xspace, self.yspace = xspace, yspace - def __unicode__(self): + def __str__(self): return u'\n\n'%\ (self.xspace, self.yspace) + if not ispy3: + __unicode__ = __str__ + class Page(LRFStream): tag_map = { @@ -427,15 +443,15 @@ class Page(LRFStream): for i in self.content: yield i - def __unicode__(self): + def __str__(self): s = u'\n\n'%(self.style_id, self.id) for i in self: s += unicode_type(i) s += '\n\n' return s - def __str__(self): - return unicode_type(self) + if not ispy3: + __unicode__ = __str__ def to_html(self): s = u'' @@ -612,7 +628,7 @@ class Block(LRFStream, TextCSS): if hasattr(self, attr): self.attrs[attr] = getattr(self, attr) - def __unicode__(self): + def __str__(self): s = u'\n<%s objid="%d" blockstyle="%d" '%(self.name, self.id, self.style_id) if hasattr(self, 'textstyle_id'): s += 'textstyle="%d" '%(self.textstyle_id,) @@ -625,6 +641,9 @@ class Block(LRFStream, TextCSS): return s return s.rstrip() + ' />\n' + if not ispy3: + __unicode__ = __str__ + def to_html(self): if self.name == 'TextBlock': return u'
%s
'%(self.style_id, self.textstyle_id, self.content.to_html()) @@ -697,12 +716,15 @@ class Text(LRFStream): self.attrs = attrs self.self_closing = self_closing - def __unicode__(self): + def __str__(self): s = u'<%s '%(self.name,) for name, val in self.attrs.items(): s += '%s="%s" '%(name, val) return s.rstrip() + (u' />' if self.self_closing else u'>') + if not ispy3: + __unicode__ = __str__ + def to_html(self): s = u'' return s @@ -878,7 +900,7 @@ class Text(LRFStream): self.close_containers() self.stream = None - def __unicode__(self): + def __str__(self): s = u'' open_containers = collections.deque() for c in self.content: @@ -900,6 +922,9 @@ class Text(LRFStream): raise LRFParseError('Malformed text stream %s'%([i.name for i in open_containers if isinstance(i, Text.TextTag)],)) return s + if not ispy3: + __unicode__ = __str__ + def to_html(self): s = u'' open_containers = collections.deque() @@ -944,10 +969,13 @@ class Image(LRFObject): encoding = property(fget=lambda self : self._document.objects[self.refstream].encoding) data = property(fget=lambda self : self._document.objects[self.refstream].stream) - def __unicode__(self): + def __str__(self): return u'\n'%\ (self.id, self.x0, self.y0, self.x1, self.y1, self.xsize, self.ysize, self.refstream) + if not ispy3: + __unicode__ = __str__ + class PutObj(EmptyPageElement): @@ -955,9 +983,12 @@ class PutObj(EmptyPageElement): self.x1, self.y1, self.refobj = x1, y1, refobj self.object = objects[refobj] - def __unicode__(self): + def __str__(self): return u''%(self.x1, self.y1, self.refobj) + if not ispy3: + __unicode__ = __str__ + class Canvas(LRFStream): tag_map = { @@ -996,7 +1027,7 @@ class Canvas(LRFStream): except struct.error: print('Canvas object has errors, skipping.') - def __unicode__(self): + def __str__(self): s = '\n<%s objid="%s" '%(self.__class__.__name__, self.id,) for attr in self.attrs: s += '%s="%s" '%(attr, self.attrs[attr]) @@ -1006,6 +1037,9 @@ class Canvas(LRFStream): s += '\n'%(self.__class__.__name__,) return s + if not ispy3: + __unicode__ = __str__ + def __iter__(self): for i in self._contents: yield i @@ -1039,10 +1073,13 @@ class ImageStream(LRFStream): if self._document is not None: self._document.image_map[self.id] = self - def __unicode__(self): + def __str__(self): return u'\n'%\ (self.id, self.encoding, self.file) + if not ispy3: + __unicode__ = __str__ + class Import(LRFStream): pass @@ -1118,7 +1155,7 @@ class Button(LRFObject): return i[1:][0] return (None, None) - def __unicode__(self): + def __str__(self): s = u'
'%x return u'
%s%s
%s
'%u'\n'.join(ans) - def __str__(self): - return self.__unicode__().encode('utf-8') + if ispy3: + __str__ = __unicode__representation__ + else: + __unicode__ = __unicode__representation__ + + def __str__(self): + return self.__unicode__().encode('utf-8') def __nonzero__(self): return bool(self.title or self.author or self.comments or self.tags) + __bool__ = __nonzero__ # }}} diff --git a/src/calibre/ebooks/metadata/fb2.py b/src/calibre/ebooks/metadata/fb2.py index 949b76aae5..8889333944 100644 --- a/src/calibre/ebooks/metadata/fb2.py +++ b/src/calibre/ebooks/metadata/fb2.py @@ -115,7 +115,7 @@ def get_metadata(stream): if book_title: book_title = unicode_type(book_title) else: - book_title = force_unicode_type(os.path.splitext( + book_title = force_unicode(os.path.splitext( os.path.basename(getattr(stream, 'name', _('Unknown'))))[0]) mi = MetaInformation(book_title, authors) diff --git a/src/calibre/ebooks/metadata/opf2.py b/src/calibre/ebooks/metadata/opf2.py index 0af4a40724..35c41533f3 100644 --- a/src/calibre/ebooks/metadata/opf2.py +++ b/src/calibre/ebooks/metadata/opf2.py @@ -15,7 +15,7 @@ from urlparse import urlparse from lxml import etree from calibre.ebooks import escape_xpath_attr -from calibre.constants import __appname__, __version__, filesystem_encoding +from calibre.constants import __appname__, __version__, filesystem_encoding, ispy3 from calibre.ebooks.metadata.toc import TOC from calibre.ebooks.metadata.utils import parse_opf, pretty_print_opf as _pretty_print from calibre.ebooks.metadata import string_to_authors, MetaInformation, check_isbn @@ -73,7 +73,7 @@ class Resource(object): # {{{ path = href_or_path if not os.path.isabs(path): path = os.path.abspath(os.path.join(basedir, path)) - if isinstance(path, str): + if isinstance(path, bytes): path = path.decode(sys.getfilesystemencoding()) self.path = path else: @@ -112,8 +112,8 @@ class Resource(object): # {{{ rpath = os.path.relpath(self.path, basedir) except ValueError: # On windows path and basedir could be on different drives rpath = self.path - if isinstance(rpath, unicode_type): - rpath = rpath.encode('utf-8') + if isinstance(rpath, bytes): + rpath = rpath.decode(filesystem_encoding) return rpath.replace(os.sep, '/')+frag def set_basedir(self, path): @@ -203,11 +203,16 @@ class ManifestItem(Resource): # {{{ self.mime_type = val return property(fget=fget, fset=fset) - def __unicode__(self): + def __unicode__representation__(self): return u''%(self.id, self.href(), self.media_type) - def __str__(self): - return unicode_type(self).encode('utf-8') + if ispy3: + __str__ = __unicode__representation__ + else: + __unicode__ = __unicode__representation__ + + def __str__(self): + return unicode_type(self).encode('utf-8') def __repr__(self): return unicode_type(self) diff --git a/src/calibre/ebooks/mobi/mobiml.py b/src/calibre/ebooks/mobi/mobiml.py index 16e3926084..4db55b204e 100644 --- a/src/calibre/ebooks/mobi/mobiml.py +++ b/src/calibre/ebooks/mobi/mobiml.py @@ -229,7 +229,9 @@ class MobiMLizer(object): while vspace > 0: wrapper.addprevious(etree.Element(XHTML('br'))) vspace -= 1 - if istate.halign != 'auto' and isinstance(istate.halign, (str, unicode_type)): + if istate.halign != 'auto' and isinstance(istate.halign, (bytes, unicode_type)): + if isinstance(istate.halign, bytes): + istate.halign = istate.halign.decode('utf-8') para.attrib['align'] = istate.halign istate.rendered = True pstate = bstate.istate @@ -568,17 +570,17 @@ class MobiMLizer(object): self.opts.mobi_ignore_margins = False if (text or tag in CONTENT_TAGS or tag in NESTABLE_TAGS or ( - # We have an id but no text and no children, the id should still - # be added. - istate.ids and tag in ('a', 'span', 'i', 'b', 'u') and - len(elem)==0)): - if tag == 'li' and len(istates) > 1 and 'value' in elem.attrib: - try: - value = int(elem.attrib['value']) - istates[-2].list_num = value - 1 - except: - pass - self.mobimlize_content(tag, text, bstate, istates) + # We have an id but no text and no children, the id should still + # be added. + istate.ids and tag in ('a', 'span', 'i', 'b', 'u') and + len(elem)==0)): + if tag == 'li' and len(istates) > 1 and 'value' in elem.attrib: + try: + value = int(elem.attrib['value']) + istates[-2].list_num = value - 1 + except: + pass + self.mobimlize_content(tag, text, bstate, istates) for child in elem: self.mobimlize_elem(child, stylizer, bstate, istates) tail = None diff --git a/src/calibre/ebooks/mobi/reader/mobi6.py b/src/calibre/ebooks/mobi/reader/mobi6.py index 16b8a938b6..5f309dd364 100644 --- a/src/calibre/ebooks/mobi/reader/mobi6.py +++ b/src/calibre/ebooks/mobi/reader/mobi6.py @@ -283,24 +283,29 @@ class MobiReader(object): ref.attrib['href'] = os.path.basename(htmlfile) + ref.attrib['href'] except AttributeError: pass + + def write_as_utf8(path, data): + if isinstance(data, unicode_type): + data = data.encode('utf-8') + with lopen(path, 'wb') as f: + f.write(data) + parse_cache[htmlfile] = root self.htmlfile = htmlfile ncx = cStringIO.StringIO() opf, ncx_manifest_entry = self.create_opf(htmlfile, guide, root) self.created_opf_path = os.path.splitext(htmlfile)[0] + '.opf' - opf.render(open(self.created_opf_path, 'wb'), ncx, + opf.render(lopen(self.created_opf_path, 'wb'), ncx, ncx_manifest_entry=ncx_manifest_entry) ncx = ncx.getvalue() if ncx: ncx_path = os.path.join(os.path.dirname(htmlfile), 'toc.ncx') - open(ncx_path, 'wb').write(ncx) + write_as_utf8(ncx_path, ncx) - with open('styles.css', 'wb') as s: - s.write(self.base_css_rules + '\n\n') - for cls, rule in self.tag_css_rules.items(): - if isinstance(rule, unicode_type): - rule = rule.encode('utf-8') - s.write('.%s { %s }\n\n' % (cls, rule)) + css = [self.base_css_rules, '\n\n'] + for cls, rule in self.tag_css_rules.items(): + css.append('.%s { %s }\n\n' % (cls, rule)) + write_as_utf8('styles.css', ''.join(css)) if self.book_header.exth is not None or self.embedded_mi is not None: self.log.debug('Creating OPF...') @@ -310,7 +315,7 @@ class MobiReader(object): ncx_manifest_entry) ncx = ncx.getvalue() if ncx: - open(os.path.splitext(htmlfile)[0] + '.ncx', 'wb').write(ncx) + write_as_utf8(os.path.splitext(htmlfile)[0] + '.ncx', ncx) def read_embedded_metadata(self, root, elem, guide): raw = '\n' + \ @@ -423,24 +428,25 @@ class MobiReader(object): styles.append(style) if 'height' in attrib: height = attrib.pop('height').strip() - if height and '<' not in height and '>' not in height and \ - re.search(r'\d+', height): - if tag.tag in ('table', 'td', 'tr'): - pass - elif tag.tag == 'img': - tag.set('height', height) + if ( + height and '<' not in height and '>' not in height and + re.search(r'\d+', height)): + if tag.tag in ('table', 'td', 'tr'): + pass + elif tag.tag == 'img': + tag.set('height', height) + else: + if tag.tag == 'div' and not tag.text and \ + (not tag.tail or not tag.tail.strip()) and \ + not len(list(tag.iterdescendants())): + # Paragraph spacer + # Insert nbsp so that the element is never + # discarded by a renderer + tag.text = u'\u00a0' # nbsp + styles.append('height: %s' % + self.ensure_unit(height)) else: - if tag.tag == 'div' and not tag.text and \ - (not tag.tail or not tag.tail.strip()) and \ - not len(list(tag.iterdescendants())): - # Paragraph spacer - # Insert nbsp so that the element is never - # discarded by a renderer - tag.text = u'\u00a0' # nbsp - styles.append('height: %s' % - self.ensure_unit(height)) - else: - styles.append('margin-top: %s' % self.ensure_unit(height)) + styles.append('margin-top: %s' % self.ensure_unit(height)) if 'width' in attrib: width = attrib.pop('width').strip() if width and re.search(r'\d+', width): @@ -837,11 +843,10 @@ class MobiReader(object): anchor = '' if r > -1 and (r < l or l == end or l == -1): p = self.mobi_html.rfind('<', 0, end + 1) - if pos < end and p > -1 and \ - not end_tag_re.match(self.mobi_html[p:r]) and \ - not self.mobi_html[p:r + 1].endswith('/>'): - anchor = ' filepos-id="filepos%d"' - end = r + if (pos < end and p > -1 and not end_tag_re.match(self.mobi_html[p:r]) and + not self.mobi_html[p:r + 1].endswith('/>')): + anchor = ' filepos-id="filepos%d"' + end = r else: end = r + 1 processed_html.write(self.mobi_html[pos:end] + (anchor % oend)) diff --git a/src/calibre/ebooks/mobi/writer2/serializer.py b/src/calibre/ebooks/mobi/writer2/serializer.py index ab6551d522..c86dfff2be 100644 --- a/src/calibre/ebooks/mobi/writer2/serializer.py +++ b/src/calibre/ebooks/mobi/writer2/serializer.py @@ -1,23 +1,32 @@ #!/usr/bin/env python2 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai -from __future__ import (unicode_literals, division, absolute_import, - print_function) +from __future__ import absolute_import, division, print_function, unicode_literals __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import re, unicodedata -from calibre.ebooks.oeb.base import (OEB_DOCS, XHTML, XHTML_NS, XML_NS, - namespace, prefixname, urlnormalize) +import re +import unicodedata +from collections import defaultdict +from io import BytesIO +from urlparse import urldefrag + from calibre.ebooks.mobi.mobiml import MBP_NS from calibre.ebooks.mobi.utils import is_guide_ref_start +from calibre.ebooks.oeb.base import ( + OEB_DOCS, XHTML, XHTML_NS, XML_NS, namespace, prefixname, urlnormalize +) from polyglot.builtins import unicode_type -from collections import defaultdict -from urlparse import urldefrag -from cStringIO import StringIO + +class Buf(BytesIO): + + def write(self, x): + if isinstance(x, unicode_type): + x = x.encode('utf-8') + BytesIO.write(self, x) class Serializer(object): @@ -116,7 +125,7 @@ class Serializer(object): ''' Return the document serialized as a single UTF-8 encoded bytestring. ''' - buf = self.buf = StringIO() + buf = self.buf = Buf() buf.write(b'') self.serialize_head() self.serialize_body() @@ -214,22 +223,22 @@ class Serializer(object): # if href is provided add a link ref to the toc level output (e.g. feed_0/index.html) if href is not None: # resolve the section url in id_offsets - buf.write('') + buf.write(b'') self.id_offsets[urlnormalize(href)] = buf.tell() if tocref.klass == "periodical": - buf.write('
') + buf.write(b'
') else: t = tocref.title if isinstance(t, unicode_type): t = t.encode('utf-8') - buf.write('

' + t + - '

') + buf.write(b'

' + t + + b'

') - buf.write('
') + buf.write(b'
') self.anchor_offset = buf.tell() buf.write(b'') @@ -350,7 +359,7 @@ class Serializer(object): if child.tail: self.anchor_offset = None self.serialize_text(child.tail) - buf.write(b'' % tag.encode('utf-8')) + buf.write(('' % tag).encode('utf-8')) def serialize_text(self, text, quot=False): text = text.replace('&', '&') @@ -384,4 +393,4 @@ class Serializer(object): self.start_offset = ioff for hoff in hoffs: buf.seek(hoff) - buf.write(b'%010d' % ioff) + buf.write(('%010d' % ioff).encode('utf-8')) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index d6a7013f57..9c16e54ee4 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -13,7 +13,7 @@ from urlparse import urldefrag, urlparse, urlunparse, urljoin from urllib import unquote from lxml import etree, html -from calibre.constants import filesystem_encoding, __version__ +from calibre.constants import filesystem_encoding, __version__, ispy3 from calibre.translations.dynamic import translate from calibre.ebooks.chardet import xml_to_unicode from calibre.ebooks.conversion.preprocess import CSSPreProcessor @@ -107,13 +107,35 @@ self_closing_bad_tags = {'a', 'abbr', 'address', 'article', 'aside', 'audio', 'b 'span', 'strong', 'sub', 'summary', 'sup', 'textarea', 'time', 'ul', 'var', 'video', 'title', 'script', 'style'} -_self_closing_pat = re.compile( - r'<(?P%s)(?=[\s/])(?P[^>]*)/>'%('|'.join(self_closing_bad_tags)), - re.IGNORECASE) + +def as_string_type(pat, for_unicode): + if for_unicode: + if isinstance(pat, bytes): + pat = pat.decode('utf-8') + else: + if isinstance(pat, unicode_type): + pat = pat.encode('utf-8') + return pat + + +def self_closing_pat(for_unicode): + attr = 'unicode_ans' if for_unicode else 'bytes_ans' + ans = getattr(self_closing_pat, attr, None) + if ans is None: + sub = '|'.join(self_closing_bad_tags) + template = r'<(?P%s)(?=[\s/])(?P[^>]*)/>' + pat = template % sub + pat = as_string_type(pat, for_unicode) + ans = re.compile(pat, flags=re.IGNORECASE) + setattr(self_closing_pat, attr, ans) + return ans def close_self_closing_tags(raw): - return _self_closing_pat.sub(r'<\g\g>>', raw) + for_unicode = isinstance(raw, unicode_type) + repl = as_string_type(r'<\g\g>>', for_unicode) + pat = self_closing_pat(for_unicode) + return pat.sub(repl, raw) def uuid_id(): @@ -745,11 +767,15 @@ class Metadata(object): return 'Item(term=%r, value=%r, attrib=%r)' \ % (barename(self.term), self.value, self.attrib) - def __str__(self): - return unicode_type(self.value).encode('ascii', 'xmlcharrefreplace') + if ispy3: + def __str__(self): + return as_unicode(self.value) + else: + def __str__(self): + return unicode_type(self.value).encode('ascii', 'xmlcharrefreplace') - def __unicode__(self): - return as_unicode(self.value) + def __unicode__(self): + return as_unicode(self.value) def to_opf1(self, dcmeta=None, xmeta=None, nsrmap={}): attrib = {} @@ -1075,19 +1101,27 @@ class Manifest(object): self._loader = loader2 self._data = None - def __str__(self): - return serialize(self.data, self.media_type, pretty_print=self.oeb.pretty_print) - - def __unicode__(self): + @property + def unicode_representation(self): data = self.data if isinstance(data, etree._Element): return xml2unicode(data, pretty_print=self.oeb.pretty_print) if isinstance(data, unicode_type): return data if hasattr(data, 'cssText'): - return data.cssText + return unicode_type(data.cssText, 'utf-8', 'replace') return unicode_type(data) + if ispy3: + def __str__(self): + return self.unicode_representation + else: + def __unicode__(self): + return self.unicode_representation + + def __str__(self): + return serialize(self.data, self.media_type, pretty_print=self.oeb.pretty_print) + def __eq__(self, other): return id(self) == id(other) @@ -1616,11 +1650,15 @@ class TOC(object): ans.extend(child.get_lines(lvl+1)) return ans - def __str__(self): - return b'\n'.join([x.encode('utf-8') for x in self.get_lines()]) + if ispy3: + def __str__(self): + return u'\n'.join(self.get_lines()) + else: + def __unicode__(self): + return u'\n'.join(self.get_lines()) - def __unicode__(self): - return u'\n'.join(self.get_lines()) + def __str__(self): + return b'\n'.join([x.encode('utf-8') for x in self.get_lines()]) def to_opf1(self, tour): for node in self.nodes: diff --git a/src/calibre/ebooks/oeb/iterator/spine.py b/src/calibre/ebooks/oeb/iterator/spine.py index f81a2244d0..0159970662 100644 --- a/src/calibre/ebooks/oeb/iterator/spine.py +++ b/src/calibre/ebooks/oeb/iterator/spine.py @@ -53,7 +53,7 @@ class SpineItem(unicode_type): if not os.path.exists(path) and os.path.exists(ppath): path = ppath obj = super(SpineItem, cls).__new__(cls, path) - with open(path, 'rb') as f: + with lopen(path, 'rb') as f: raw = f.read() if from_epub: # According to the spec, HTML in EPUB must be encoded in utf-8 or diff --git a/src/calibre/ebooks/oeb/parse_utils.py b/src/calibre/ebooks/oeb/parse_utils.py index 94b369471e..2dd153799d 100644 --- a/src/calibre/ebooks/oeb/parse_utils.py +++ b/src/calibre/ebooks/oeb/parse_utils.py @@ -99,7 +99,7 @@ def html5_parse(data, max_nesting_depth=100): # Check that the asinine HTML 5 algorithm did not result in a tree with # insane nesting depths for x in data.iterdescendants(): - if isinstance(x.tag, basestring) and len(x) is 0: # Leaf node + if isinstance(x.tag, basestring) and not len(x): # Leaf node depth = node_depth(x) if depth > max_nesting_depth: raise ValueError('HTML 5 parsing resulted in a tree with nesting' @@ -259,7 +259,7 @@ def parse_html(data, log=None, decoder=None, preprocessor=None, nroot = etree.fromstring('') has_body = False for child in list(data): - if isinstance(child.tag, (unicode_type, str)) and barename(child.tag) == 'body': + if isinstance(child.tag, (unicode_type, bytes)) and barename(child.tag) == 'body': has_body = True break parent = nroot diff --git a/src/calibre/ebooks/oeb/stylizer.py b/src/calibre/ebooks/oeb/stylizer.py index 1e7aaf6343..0b4b825657 100644 --- a/src/calibre/ebooks/oeb/stylizer.py +++ b/src/calibre/ebooks/oeb/stylizer.py @@ -607,12 +607,12 @@ class Style(object): result = base else: result = self._unit_convert(width, base=base) - if isinstance(result, (unicode_type, str, bytes)): + if isinstance(result, (unicode_type, bytes)): result = self._profile.width self._width = result if 'max-width' in self._style: result = self._unit_convert(self._style['max-width'], base=base) - if isinstance(result, (unicode_type, str, bytes)): + if isinstance(result, (unicode_type, bytes)): result = self._width if result < self._width: self._width = result @@ -644,12 +644,12 @@ class Style(object): result = base else: result = self._unit_convert(height, base=base) - if isinstance(result, (unicode_type, str, bytes)): + if isinstance(result, (unicode_type, bytes)): result = self._profile.height self._height = result if 'max-height' in self._style: result = self._unit_convert(self._style['max-height'], base=base) - if isinstance(result, (unicode_type, str, bytes)): + if isinstance(result, (unicode_type, bytes)): result = self._height if result < self._height: self._height = result diff --git a/src/calibre/ebooks/txt/processor.py b/src/calibre/ebooks/txt/processor.py index b21d342aab..e2b272c54b 100644 --- a/src/calibre/ebooks/txt/processor.py +++ b/src/calibre/ebooks/txt/processor.py @@ -15,7 +15,7 @@ from calibre.ebooks.metadata.opf2 import OPFCreator from calibre.ebooks.conversion.preprocess import DocAnalysis from calibre.utils.cleantext import clean_ascii_chars -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, map, range HTML_TEMPLATE = u'%s \n%s\n' @@ -55,7 +55,7 @@ def split_txt(txt, epub_split_size_kb=0): result in the entire document being one giant paragraph. In this case the EPUB parser will not be able to determine where to split the file - to accomidate the EPUB file size limitation + to accommodate the EPUB file size limitation and will fail. ''' # Takes care if there is no point to split @@ -66,9 +66,12 @@ def split_txt(txt, epub_split_size_kb=0): # Calculating the average chunk value for easy splitting as EPUB (+2 as a safe margin) chunk_size = long(length_byte / (int(length_byte / (epub_split_size_kb * 1024)) + 2)) # if there are chunks with a superior size then go and break - if (len(filter(lambda x: len(x) > chunk_size, txt.split('\n\n')))) : - txt = '\n\n'.join([split_string_separator(line, chunk_size) - for line in txt.split('\n\n')]) + parts = txt.split(b'\n\n') + lengths = tuple(map(len, parts)) + if lengths and max(lengths) > chunk_size: + txt = b'\n\n'.join([ + split_string_separator(line, chunk_size) for line in parts + ]) if isbytestring(txt): txt = txt.decode('utf-8') @@ -227,7 +230,7 @@ def opf_writer(path, opf_name, manifest, spine, mi): opf = OPFCreator(path, mi) opf.create_manifest(manifest) opf.create_spine(spine) - with open(os.path.join(path, opf_name), 'wb') as opffile: + with lopen(os.path.join(path, opf_name), 'wb') as opffile: opf.render(opffile) @@ -236,9 +239,16 @@ def split_string_separator(txt, size): Splits the text by putting \n\n at the point size. ''' if len(txt) > size: - txt = ''.join([re.sub(type(u'')(r'\.(?P[^.]*)$'), r'.\n\n\g', - txt[i:i+size], 1) for i in - xrange(0, len(txt), size)]) + size -= 2 + txt = [] + for part in (txt[i * size: (i + 1) * size] for i in range(0, len(txt), size)): + idx = part.rfind('.') + if idx == -1: + part += b'\n\n' + else: + part = part[:idx + 1] + b'\n\n' + part[idx:] + txt.append(part) + txt = b''.join(txt) return txt diff --git a/src/calibre/ebooks/unihandecode/__init__.py b/src/calibre/ebooks/unihandecode/__init__.py index 1ce7d8e5d2..153d8221fe 100644 --- a/src/calibre/ebooks/unihandecode/__init__.py +++ b/src/calibre/ebooks/unihandecode/__init__.py @@ -19,8 +19,6 @@ Tranliterate the string from unicode characters to ASCII in Chinese and others. ''' import unicodedata -from calibre.constants import ispy3 - class Unihandecoder(object): preferred_encoding = None @@ -43,15 +41,11 @@ class Unihandecoder(object): self.decoder = Unidecoder() def decode(self, text): - if not ispy3: - if not isinstance(text, unicode): - try: - text = unicode(text) - except: - try: - text = text.decode(self.preferred_encoding) - except: - text = text.decode('utf-8', 'replace') + if isinstance(text, bytes): + try: + text = text.decode(self.preferred_encoding) + except Exception: + text = text.decode('utf-8', 'replace') # at first unicode normalize it. (see Unicode standards) ntext = unicodedata.normalize('NFKC', text) return self.decoder.decode(ntext) diff --git a/src/calibre/ebooks/unihandecode/pykakasi/jisyo.py b/src/calibre/ebooks/unihandecode/pykakasi/jisyo.py index 6101817a7b..6ff55ad90d 100644 --- a/src/calibre/ebooks/unihandecode/pykakasi/jisyo.py +++ b/src/calibre/ebooks/unihandecode/pykakasi/jisyo.py @@ -4,7 +4,7 @@ # Copyright 2011 Hiroshi Miura from zlib import decompress -from calibre.constants import ispy3 +from polyglot.builtins import unicode_type class jisyo (object): @@ -34,8 +34,8 @@ class jisyo (object): P('localization/pykakasi/kanadict2.calibre_msgpack', data=True)) def load_jisyo(self, char): - if not ispy3: - char = unicode(char) + if not isinstance(char, unicode_type): + char = unicode_type(char, 'utf-8') key = "%04x"%ord(char) try: # already exist? diff --git a/src/calibre/ebooks/unihandecode/unidecoder.py b/src/calibre/ebooks/unihandecode/unidecoder.py index 74b1229ede..748fcb64f1 100644 --- a/src/calibre/ebooks/unihandecode/unidecoder.py +++ b/src/calibre/ebooks/unihandecode/unidecoder.py @@ -60,9 +60,9 @@ it under the same terms as Perl itself. ''' import re -from calibre.constants import ispy3 from calibre.ebooks.unihandecode.unicodepoints import CODEPOINTS from calibre.ebooks.unihandecode.zhcodepoints import CODEPOINTS as HANCODES +from polyglot.builtins import unicode_type class Unidecoder(object): @@ -95,8 +95,8 @@ class Unidecoder(object): Find what group character is a part of. ''' # Code groups withing CODEPOINTS take the form 'xAB' - if not ispy3: - character = unicode(character) + if not isinstance(character, unicode_type): + character = unicode_type(character, "utf-8") return 'x%02x' % (ord(character) >> 8) def grouped_point(self, character): @@ -104,6 +104,6 @@ class Unidecoder(object): Return the location the replacement character is in the list for a the group character is a part of. ''' - if not ispy3: - character = unicode(character) + if not isinstance(character, unicode_type): + character = unicode_type(character, "utf-8") return ord(character) & 255 diff --git a/src/calibre/gui2/comments_editor.py b/src/calibre/gui2/comments_editor.py index 300f024669..b5c9a73606 100644 --- a/src/calibre/gui2/comments_editor.py +++ b/src/calibre/gui2/comments_editor.py @@ -347,7 +347,7 @@ class EditorWidget(QWebView, LineEditECM): # {{{ return unicode_type(self.page().mainFrame().toHtml()) check = unicode_type(self.page().mainFrame().toPlainText()).strip() raw = unicode_type(self.page().mainFrame().toHtml()) - raw = xml_to_unicode_type(raw, strip_encoding_pats=True, + raw = xml_to_unicode(raw, strip_encoding_pats=True, resolve_entities=True)[0] raw = self.comments_pat.sub('', raw) if not check and '= other return True - if isinstance(self.sort, (str, unicode_type)): + if isinstance(self.sort, (bytes, unicode_type)): l = sort_key(self.sort) r = sort_key(other.sort) else: @@ -66,7 +66,7 @@ class TableItem(QTableWidgetItem): # self is not None therefore self > other return False - if isinstance(self.sort, (str, unicode_type)): + if isinstance(self.sort, (bytes, unicode_type)): l = sort_key(self.sort) r = sort_key(other.sort) else: diff --git a/src/calibre/gui2/init.py b/src/calibre/gui2/init.py index 03faa4c4f0..e03c35b7a2 100644 --- a/src/calibre/gui2/init.py +++ b/src/calibre/gui2/init.py @@ -13,7 +13,7 @@ from PyQt5.Qt import (Qt, QApplication, QStackedWidget, QMenu, QTimer, from calibre.utils.config import prefs from calibre.utils.icu import sort_key -from calibre.constants import (isosx, __appname__, preferred_encoding, +from calibre.constants import (__appname__, preferred_encoding, get_version) from calibre.gui2 import config, is_widescreen, gprefs, error_dialog, open_url from calibre.gui2.library.views import BooksView, DeviceBooksView @@ -323,11 +323,6 @@ class StatusBar(QStatusBar): # {{{ def show_message(self, msg, timeout=0, show_notification=True): self.showMessage(msg, timeout) if self.notifier is not None and not config['disable_tray_notification'] and show_notification: - if isosx and isinstance(msg, unicode_type): - try: - msg = msg.encode(preferred_encoding) - except UnicodeEncodeError: - msg = msg.encode('utf-8') self.notifier(msg) def clear_message(self): diff --git a/src/calibre/gui2/layout.py b/src/calibre/gui2/layout.py index 6c902fb9c8..f4a27c85af 100644 --- a/src/calibre/gui2/layout.py +++ b/src/calibre/gui2/layout.py @@ -129,7 +129,7 @@ class LocationManager(QObject): # {{{ had_device = self.has_device if cp is None: cp = (None, None) - if isinstance(cp, (str, unicode_type)): + if isinstance(cp, (bytes, unicode_type)): cp = (cp, None) if len(fs) < 3: fs = list(fs) + [0] diff --git a/src/calibre/gui2/lrf_renderer/main.py b/src/calibre/gui2/lrf_renderer/main.py index 985babf440..5aab2b3155 100644 --- a/src/calibre/gui2/lrf_renderer/main.py +++ b/src/calibre/gui2/lrf_renderer/main.py @@ -6,7 +6,7 @@ import sys, logging, os, traceback, time from PyQt5.Qt import ( QKeySequence, QPainter, QDialog, QSpinBox, QSlider, QIcon, Qt, QCoreApplication, QThread, QScrollBar) -from calibre import __appname__, setup_cli_handlers, islinux, isbsd +from calibre import __appname__, setup_cli_handlers, islinux, isbsd, as_unicode from calibre.ebooks.lrf.lrfparser import LRFDocument from calibre.gui2 import error_dialog, \ @@ -17,7 +17,6 @@ from calibre.gui2.lrf_renderer.config_ui import Ui_ViewerConfig from calibre.gui2.main_window import MainWindow from calibre.gui2.lrf_renderer.document import Document from calibre.gui2.search_box import SearchBox2 -from polyglot.builtins import unicode_type class RenderWorker(QThread): @@ -201,7 +200,7 @@ class Main(MainWindow, Ui_MainWindow): print('Error rendering document', file=sys.stderr) print(exception, file=sys.stderr) print(self.renderer.formatted_traceback, file=sys.stderr) - msg = u'

%s: '%(exception.__class__.__name__,) + unicode_type(str(exception), 'utf8', 'replace') + u'

' + msg = u'

%s: '%(exception.__class__.__name__,) + as_unicode(exception) + u'

' msg += u'

Failed to render document

' msg += u'

Detailed traceback:

'
             msg += self.renderer.formatted_traceback + '
' diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 99bcc5c4b4..24a1ec8326 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -132,7 +132,7 @@ def get_default_library_path(): fname = 'Calibre Library' if isinstance(fname, unicode_type): try: - fname = fname.encode(filesystem_encoding) + fname.encode(filesystem_encoding) except: fname = 'Calibre Library' x = os.path.expanduser('~'+os.sep+fname) diff --git a/src/calibre/gui2/main_window.py b/src/calibre/gui2/main_window.py index be4c90c7a8..80ee19e1d5 100644 --- a/src/calibre/gui2/main_window.py +++ b/src/calibre/gui2/main_window.py @@ -5,14 +5,14 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' -import StringIO, traceback, sys, gc, weakref +import traceback, sys, gc, weakref +from io import BytesIO from PyQt5.Qt import (QMainWindow, QTimer, QAction, QMenu, QMenuBar, QIcon, QObject) from calibre.utils.config import OptionParser from calibre.gui2 import error_dialog -from calibre import prints -from polyglot.builtins import unicode_type +from calibre import prints, force_unicode def option_parser(usage='''\ @@ -134,7 +134,7 @@ class MainWindow(QMainWindow): if type is KeyboardInterrupt: return try: - sio = StringIO.StringIO() + sio = BytesIO() try: from calibre.debug import print_basic_debug_info print_basic_debug_info(out=sio) @@ -145,7 +145,8 @@ class MainWindow(QMainWindow): prints(value.locking_debug_msg, file=sio) fe = sio.getvalue() prints(fe, file=sys.stderr) - msg = '%s:'%type.__name__ + unicode_type(str(value), 'utf8', 'replace') + fe = force_unicode(fe) + msg = '%s:'%type.__name__ + force_unicode(value) error_dialog(self, _('Unhandled exception'), msg, det_msg=fe, show=True) except BaseException: diff --git a/src/calibre/gui2/notify.py b/src/calibre/gui2/notify.py index 779ada9a62..171daa2370 100644 --- a/src/calibre/gui2/notify.py +++ b/src/calibre/gui2/notify.py @@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en' import time from calibre import prints -from calibre.constants import islinux, isosx, get_osx_version, DEBUG +from calibre.constants import islinux, isosx, get_osx_version, DEBUG, ispy3 from polyglot.builtins import unicode_type @@ -145,8 +145,12 @@ class AppleNotifier(Notifier): def notify(self, body, summary): def encode(x): - if isinstance(x, unicode_type): - x = x.encode('utf-8') + if ispy3: + if isinstance(x, bytes): + x = x.decode('utf-8') + else: + if isinstance(x, unicode_type): + x = x.encode('utf-8') return x cmd = [self.exe, '-activate', diff --git a/src/calibre/gui2/store/search/search.py b/src/calibre/gui2/store/search/search.py index a552bad3e0..24bde0cf62 100644 --- a/src/calibre/gui2/store/search/search.py +++ b/src/calibre/gui2/store/search/search.py @@ -67,7 +67,7 @@ class SearchDialog(QDialog, Ui_Dialog): self.setup_store_checks() # Set the search query - if isinstance(query, (str, unicode_type)): + if isinstance(query, (bytes, unicode_type)): self.search_edit.setText(query) elif isinstance(query, dict): if 'author' in query: @@ -233,7 +233,7 @@ class SearchDialog(QDialog, Ui_Dialog): query = query.replace('<', '') # Remove the prefix. for loc in ('all', 'author', 'author2', 'authors', 'title', 'title2'): - query = re.sub(r'%s:"(?P[^\s"]+)"' % loc, '\g', query) + query = re.sub(r'%s:"(?P[^\s"]+)"' % loc, r'\g', query) query = query.replace('%s:' % loc, '') # Remove the prefix and search text. for loc in ('cover', 'download', 'downloads', 'drm', 'format', 'formats', 'price', 'store'): diff --git a/src/calibre/gui2/tweak_book/function_replace.py b/src/calibre/gui2/tweak_book/function_replace.py index 20f6f1d1cd..c588f63a77 100644 --- a/src/calibre/gui2/tweak_book/function_replace.py +++ b/src/calibre/gui2/tweak_book/function_replace.py @@ -30,8 +30,8 @@ user_functions = JSONConfig('editor-search-replace-functions') def compile_code(src, name=''): if not isinstance(src, unicode_type): - match = re.search(r'coding[:=]\s*([-\w.]+)', src[:200]) - enc = match.group(1) if match else 'utf-8' + match = re.search(br'coding[:=]\s*([-\w.]+)', src[:200]) + enc = match.group(1).decode('utf-8') if match else 'utf-8' src = src.decode(enc) if not src or not src.strip(): src = EMPTY_FUNC diff --git a/src/calibre/library/add_to_library.py b/src/calibre/library/add_to_library.py index fc3e6dcaad..cb117e5f40 100644 --- a/src/calibre/library/add_to_library.py +++ b/src/calibre/library/add_to_library.py @@ -9,7 +9,6 @@ import os from hashlib import sha1 from calibre.ebooks import BOOK_EXTENSIONS -from polyglot.builtins import unicode_type def find_folders_under(root, db, add_root=True, # {{{ @@ -106,11 +105,9 @@ class FormatCollection(object): # {{{ def books_in_folder(folder, one_per_folder, # {{{ cancel_callback=lambda : False): - assert not isinstance(folder, unicode_type) - dirpath = os.path.abspath(folder) if one_per_folder: - formats = set([]) + formats = set() for path in os.listdir(dirpath): if cancel_callback(): return [] diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py index 238fddac59..daea1f0bb5 100644 --- a/src/calibre/library/caches.py +++ b/src/calibre/library/caches.py @@ -19,7 +19,7 @@ from calibre.utils.localization import (canonicalize_lang, lang_map, get_udc) from calibre.db.search import CONTAINS_MATCH, EQUALS_MATCH, REGEXP_MATCH, _match from calibre.ebooks.metadata import title_sort, author_to_author_sort from calibre.ebooks.metadata.opf2 import metadata_to_opf -from calibre import prints +from calibre import prints, force_unicode from polyglot.builtins import unicode_type @@ -137,7 +137,9 @@ del y, c, n, u def force_to_bool(val): - if isinstance(val, (str, unicode_type)): + if isinstance(val, (bytes, unicode_type)): + if isinstance(val, bytes): + val = force_unicode(val) try: val = icu_lower(val) if not val: @@ -348,7 +350,7 @@ class ResultCache(SearchQueryParser): # {{{ if item is None: continue v = item[loc] - if isinstance(v, (str, unicode_type)): + if isinstance(v, (bytes, unicode_type)): v = parse_date(v) if v is None or v <= UNDEFINED_DATE: matches.add(item[0]) @@ -359,7 +361,7 @@ class ResultCache(SearchQueryParser): # {{{ if item is None: continue v = item[loc] - if isinstance(v, (str, unicode_type)): + if isinstance(v, (bytes, unicode_type)): v = parse_date(v) if v is not None and v > UNDEFINED_DATE: matches.add(item[0]) @@ -371,7 +373,7 @@ class ResultCache(SearchQueryParser): # {{{ (p, relop) = self.date_search_relops[k] query = query[p:] if relop is None: - (p, relop) = self.date_search_relops['='] + (p, relop) = self.date_search_relops['='] if query in self.local_today: qd = now() @@ -403,7 +405,7 @@ class ResultCache(SearchQueryParser): # {{{ if item is None or item[loc] is None: continue v = item[loc] - if isinstance(v, (str, unicode_type)): + if isinstance(v, (bytes, unicode_type)): v = parse_date(v) if relop(v, qd, field_count): matches.add(item[0]) @@ -448,7 +450,7 @@ class ResultCache(SearchQueryParser): # {{{ (p, relop) = self.numeric_search_relops[k] query = query[p:] if relop is None: - (p, relop) = self.numeric_search_relops['='] + (p, relop) = self.numeric_search_relops['='] if dt == 'int': cast = lambda x: int(x) diff --git a/src/calibre/library/catalogs/csv_xml.py b/src/calibre/library/catalogs/csv_xml.py index 5364a9f9be..bed17ff771 100644 --- a/src/calibre/library/catalogs/csv_xml.py +++ b/src/calibre/library/catalogs/csv_xml.py @@ -154,7 +154,7 @@ class CSV_XML(CatalogPlugin): item = u'%.2g' % (item / 2.0) # Convert HTML to markdown text - if type(item) is unicode_type: + if isinstance(item, unicode_type): opening_tag = re.search('<(\\w+)(\x20|>)', item) if opening_tag: closing_tag = re.search('<\\/%s>$' % opening_tag.group(1), item) @@ -177,7 +177,7 @@ class CSV_XML(CatalogPlugin): for field in fields: if field.startswith('#'): val = db.get_field(r['id'], field, index_is_id=True) - if not isinstance(val, (str, unicode_type)): + if not isinstance(val, unicode_type): val = unicode_type(val) item = getattr(E, field.replace('#', '_'))(val) record.append(item) @@ -188,7 +188,7 @@ class CSV_XML(CatalogPlugin): val = r[field] if not val: continue - if not isinstance(val, (str, unicode_type)): + if not isinstance(val, (bytes, unicode_type)): if (fm.get(field, {}).get('datatype', None) == 'rating' and val): val = u'%.2g' % (val / 2.0) diff --git a/src/calibre/library/custom_columns.py b/src/calibre/library/custom_columns.py index 3a29ea73ef..ca14b24330 100644 --- a/src/calibre/library/custom_columns.py +++ b/src/calibre/library/custom_columns.py @@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en' import json, re from functools import partial -from calibre import prints +from calibre import prints, force_unicode from calibre.constants import preferred_encoding from calibre.library.field_metadata import FieldMetadata from calibre.utils.date import parse_date @@ -131,7 +131,7 @@ class CustomColumns(object): if d['is_multiple']: if x is None: return [] - if isinstance(x, (str, unicode_type, bytes)): + if isinstance(x, (unicode_type, bytes)): x = x.split(d['multiple_seps']['ui_to_list']) x = [y.strip() for y in x if y.strip()] x = [y.decode(preferred_encoding, 'replace') if not isinstance(y, @@ -142,12 +142,14 @@ class CustomColumns(object): x.decode(preferred_encoding, 'replace') def adapt_datetime(x, d): - if isinstance(x, (str, unicode_type, bytes)): + if isinstance(x, (unicode_type, bytes)): x = parse_date(x, assume_utc=False, as_utc=False) return x def adapt_bool(x, d): - if isinstance(x, (str, unicode_type, bytes)): + if isinstance(x, (unicode_type, bytes)): + if isinstance(x, bytes): + x = force_unicode(x) x = x.lower() if x == 'true': x = True @@ -168,7 +170,9 @@ class CustomColumns(object): def adapt_number(x, d): if x is None: return None - if isinstance(x, (str, unicode_type, bytes)): + if isinstance(x, (unicode_type, bytes)): + if isinstance(x, bytes): + x = force_unicode(x) if x.lower() == 'none': return None if d['datatype'] == 'int': diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 88a26e28a7..5ed44f5d89 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -24,7 +24,7 @@ from calibre.library.custom_columns import CustomColumns from calibre.library.sqlite import connect, IntegrityError from calibre.library.prefs import DBPrefs from calibre.ebooks.metadata.book.base import Metadata -from calibre.constants import preferred_encoding, iswindows, filesystem_encoding +from calibre.constants import preferred_encoding, iswindows, filesystem_encoding, ispy3 from calibre.ptempfile import (PersistentTemporaryFile, base_dir, SpooledTemporaryFile) from calibre.customize.ui import (run_plugins_on_import, @@ -1754,12 +1754,14 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): self.rc = rc self.id = id - def __str__(self): - return unicode_type(self) + def __unicode_representation__(self): + return u'n=%s s=%s c=%d rt=%d rc=%d id=%s' % ( + self.n, self.s, self.c, self.rt, self.rc, self.id) - def __unicode__(self): - return 'n=%s s=%s c=%d rt=%d rc=%d id=%s'%\ - (self.n, self.s, self.c, self.rt, self.rc, self.id) + if ispy3: + __str__ = __unicode_representation__ + else: + __str__ = __unicode__ = __unicode_representation__ def clean_user_categories(self): user_cats = self.prefs.get('user_categories', {}) diff --git a/src/calibre/srv/routes.py b/src/calibre/srv/routes.py index 8623c77489..6d96ee0891 100644 --- a/src/calibre/srv/routes.py +++ b/src/calibre/srv/routes.py @@ -202,7 +202,7 @@ class Route(object): raise RouteError('The variable(s) %s are not part of the route: %s' % (','.join(unknown), self.endpoint.route)) def quoted(x): - if not isinstance(x, unicode_type) and not isinstance(x, bytes): + if not isinstance(x, (unicode_type, bytes)): x = unicode_type(x) if isinstance(x, unicode_type): x = x.encode('utf-8') diff --git a/src/calibre/utils/apsw_shell.py b/src/calibre/utils/apsw_shell.py deleted file mode 100644 index 43b2356737..0000000000 --- a/src/calibre/utils/apsw_shell.py +++ /dev/null @@ -1,2958 +0,0 @@ -#!/usr/bin/env python2 -# This is a patched version of sheel.py to fix -# https://code.google.com/p/apsw/issues/detail?id=142 - -import sys -import apsw -import shlex -import os -import csv -import re -import textwrap -import time -import codecs -import base64 - -from polyglot.builtins import unicode_type - -if sys.platform=="win32": - _win_colour=False - try: - import colorama - colorama.init() - del colorama - _win_colour=True - except: # there are several failure reasons, ignore them all - pass - - -class Shell(object): - """Implements a SQLite shell - - :param stdin: Where to read input from (default sys.stdin) - :param stdout: Where to send output (default sys.stdout) - :param stderr: Where to send errors (default sys.stderr) - :param encoding: Default encoding for files opened/created by the - Shell. If you want stdin/out/err to use a particular encoding - then you need to provide them `already configured `__ that way. - :param args: This should be program arguments only (ie if - passing in sys.argv do not include sys.argv[0] which is the - program name. You can also pass in None and then call - :meth:`process_args` if you want to catch any errors - in handling the arguments yourself. - :param db: A existing :class:`Connection` you wish to use - - The commands and behaviour are modelled after the `interactive - shell `__ that is part of - SQLite. - - You can inherit from this class to embed in your own code and user - interface. Internally everything is handled as unicode. - Conversions only happen at the point of input or output which you - can override in your own code. - - This implementation fixes a number of bugs/quirks present in the - sqlite shell. Its control-C handling is also friendlier. Some - examples of issues not present in this implementation: - - * https://sqlite.org/src/info/c25aab7e7e - * https://sqlite.org/src/info/7b61b6c6ce - * https://sqlite.org/src/info/ee19e690ec - * https://sqlite.org/src/info/2466653295 - - Errors and diagnostics are only ever sent to error output - (self.stderr) and never to the regular output (self.stdout). This - means using shell output is always easy and consistent. - - Shell commands begin with a dot (eg .help). They are implemented - as a method named after the command (eg command_help). The method - is passed one parameter which is the list of arguments to the - command. - - Output modes are implemented by functions named after the mode (eg - output_column). - - When you request help the help information is automatically - generated from the docstrings for the command and output - functions. - - You should not use a Shell object concurrently from multiple - threads. It is one huge set of state information which would - become inconsistent if used simultaneously, and then give baffling - errors. It is safe to call methods one at a time from different - threads. ie it doesn't care what thread calls methods as long as - you don't call more than one concurrently. - """ - - class Error(Exception): - """Class raised on errors. The expectation is that the error - will be displayed by the shell as text so there are no - specific subclasses as the distinctions between different - types of errors doesn't matter.""" - pass - - def __init__(self, stdin=None, stdout=None, stderr=None, encoding="utf8", args=None, db=None): - """Create instance, set defaults and do argument processing.""" - super(Shell, self).__init__() - # The parameter doc has to be in main class doc as sphinx - # ignores any described here - self.exceptions=False - self.history_file="~/.sqlite_history" - self._db=None - self.dbfilename=None - if db: - self.db=db, db.filename - else: - self.db=None, None - self.prompt= "sqlite> " - self.moreprompt=" ..> " - self.separator="|" - self.bail=False - self.echo=False - self.timer=False - self.header=False - self.nullvalue="" - self.output=self.output_list - self._output_table=self._fmt_sql_identifier("table") - self.widths=[] - # do we truncate output in list mode? (explain doesn't, regular does) - self.truncate=True - # a stack of previous outputs. turning on explain saves previous, off restores - self._output_stack=[] - - # other stuff - self.set_encoding(encoding) - if stdin is None: - stdin=sys.stdin - if stdout is None: - stdout=sys.stdout - if stderr is None: - stderr=sys.stderr - self.stdin=stdin - self.stdout=stdout - self._original_stdout=stdout - self.stderr=stderr - # we don't become interactive until the command line args are - # successfully parsed and acted upon - self.interactive=None - # current colouring object - self.command_colour() # set to default - self._using_readline=False - self._input_stack=[] - self.input_line_number=0 - self.push_input() - self.push_output() - self._input_descriptions=[] - - if args: - try: - self.process_args(args) - except: - if len(self._input_descriptions): - self._input_descriptions.append("Processing command line arguments") - self.handle_exception() - raise - - if self.interactive is None: - self.interactive=getattr(self.stdin, "isatty", False) and self.stdin.isatty() and getattr(self.stdout, "isatty", False) and self.stdout.isatty() - - def _ensure_db(self): - "The database isn't opened until first use. This function ensures it is now open." - if not self._db: - if not self.dbfilename: - self.dbfilename=":memory:" - self._db=apsw.Connection(self.dbfilename, flags=apsw.SQLITE_OPEN_URI | apsw.SQLITE_OPEN_READWRITE | apsw.SQLITE_OPEN_CREATE) - return self._db - - def _set_db(self, newv): - "Sets the open database (or None) and filename" - (db, dbfilename)=newv - if self._db: - self._db.close() - self._db=None - self._db=db - self.dbfilename=dbfilename - - db=property(_ensure_db, _set_db, None, "The current :class:`Connection`") - - def process_args(self, args): - """Process command line options specified in args. It is safe to - call this multiple times. We try to be compatible with SQLite shell - argument parsing. - - :param args: A list of string options. Do not include the - program as args[0] - - :returns: A tuple of (databasefilename, initfiles, - sqlncommands). This is provided for informational purposes - only - they have already been acted upon. An example use - is that the SQLite shell does not enter the main interactive - loop if any sql/commands were provided. - - The first non-option is the database file name. Each - remaining non-option is treated as a complete input (ie it - isn't joined with others looking for a trailing semi-colon). - - The SQLite shell uses single dash in front of options. We - allow both single and double dashes. When an unrecognized - argument is encountered then - :meth:`process_unknown_args` is called. - """ - # we don't use optparse as we need to use single dashes for - # options - all hand parsed - if not args: - return None, [], [] - - # are options still valid? - options=True - # have we seen the database name? - havedbname=False - # List of init files to read - inits=[] - # List of sql/dot commands - sqls=[] - - while args: - if not options or not args[0].startswith("-"): - options=False - if not havedbname: - # grab new database - self.db=None, args[0] - havedbname=True - else: - sqls.append(args[0]) - args=args[1:] - continue - - # remove initial single or double dash - args[0]=args[0][1:] - if args[0].startswith("-"): - args[0]=args[0][1:] - - if args[0]=="init": - if len(args)<2: - raise self.Error("You need to specify a filename after -init") - inits.append(args[1]) - args=args[2:] - continue - - if args[0]=="header" or args[0]=="noheader": - self.header=args[0]=="header" - args=args[1:] - continue - - if args[0] in ("echo", "bail", "interactive"): - setattr(self, args[0], True) - args=args[1:] - continue - - if args[0]=="batch": - self.interactive=False - args=args[1:] - continue - - if args[0] in ("separator", "nullvalue", "encoding"): - if len(args)<2: - raise self.Error("You need to specify a value after -"+args[0]) - getattr(self, "command_"+args[0])([args[1]]) - args=args[2:] - continue - - if args[0]=="version": - self.write(self.stdout, apsw.sqlitelibversion()+"\n") - # A pretty gnarly thing to do - sys.exit(0) - - if args[0]=="help": - self.write(self.stderr, self.usage()) - sys.exit(0) - - if args[0] in ("no-colour", "no-color", "nocolour", "nocolor"): - self.colour_scheme="off" - self._out_colour() - args=args[1:] - continue - - # only remaining known args are output modes - if getattr(self, "output_"+args[0], None): - self.command_mode(args[:1]) - args=args[1:] - continue - - newargs=self.process_unknown_args(args) - if newargs is None: - raise self.Error("Unrecognized argument '"+args[0]+"'") - args=newargs - - for f in inits: - self.command_read([f]) - - for s in sqls: - self.process_complete_line(s) - - return self.dbfilename, inits, sqls - - def process_unknown_args(self, args): - """This is called when :meth:`process_args` encounters an - argument it doesn't understand. Override this method if you - want to be able to understand additional command line arguments. - - :param args: A list of the remaining arguments. The initial one will - have had the leading dashes removed (eg if it was --foo on the command - line then args[0] will be "foo" - :returns: None if you don't recognize the argument either. Otherwise - return the list of remaining arguments after you have processed - yours. - """ - return None - - def usage(self): - "Returns the usage message. Make sure it is newline terminated" - - msg=""" -Usage: program [OPTIONS] FILENAME [SQL|CMD] [SQL|CMD]... -FILENAME is the name of a SQLite database. A new database is -created if the file does not exist. -OPTIONS include: - -init filename read/process named file - -echo print commands before execution - -[no]header turn headers on or off - -bail stop after hitting an error - -interactive force interactive I/O - -batch force batch I/O - -column set output mode to 'column' - -csv set output mode to 'csv' - -html set output mode to 'html' - -line set output mode to 'line' - -list set output mode to 'list' - -python set output mode to 'python' - -separator 'x' set output field separator (|) - -nullvalue 'text' set text string for NULL values - -version show SQLite version - -encoding 'name' the encoding to use for files - opened via .import, .read & .output - -nocolour disables colour output to screen -""" - return msg.lstrip() - - ### - # Value formatting routines. They take a value and return a - # text formatting of them. Mostly used by the various output's - # but also by random other pieces of code. - ### - - _binary_type = eval(("buffer", "bytes")[sys.version_info>=(3,0)]) - _basestring = eval(("basestring", "str")[sys.version_info>=(3,0)]) - - # bytes that are ok in C strings - no need for quoting - _printable=[ord(x) for x in - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*()`_-+={}[]:;,.<>/?|" - ] - - def _fmt_c_string(self, v): - "Format as a C string including surrounding double quotes" - if isinstance(v, self._basestring): - op=['"'] - for c in v: - if c=="\\": - op.append("\\\\") - elif c=="\r": - op.append("\\r") - elif c=="\n": - op.append("\\n") - elif c=="\t": - op.append("\\t") - elif ord(c) not in self._printable: - op.append("\\"+c) - else: - op.append(c) - op.append('"') - return "".join(op) - elif v is None: - return '"'+self.nullvalue+'"' - elif isinstance(v, self._binary_type): - if sys.version_info<(3,0): - o=lambda x: ord(x) - fromc=lambda x: x - else: - o=lambda x: x - fromc=lambda x: chr(x) - res=['"'] - for c in v: - if o(c) in self._printable: - res.append(fromc(c)) - else: - res.append("\\x%02X" % (o(c),)) - res.append('"') - return "".join(res) - else: - # number of some kind - return '"%s"' % (v,) - - def _fmt_html_col(self, v): - "Format as HTML (mainly escaping &/" - return self._fmt_text_col(v).\ - replace("&", "&"). \ - replace(">", ">"). \ - replace("<", "<"). \ - replace("'", "'"). \ - replace('"', """) - - def _fmt_json_value(self, v): - "Format a value." - if isinstance(v, self._basestring): - # we assume utf8 so only some characters need to be escaed - op=['"'] - for c in v: - if c=="\\": - op.append("\\\\") - elif c=="\r": - op.append("\\r") - elif c=="\n": - op.append("\\n") - elif c=="\t": - op.append("\\t") - elif c=="/": # yes you have to escape forward slash for some reason - op.append("\\/") - elif c=='"': - op.append("\\"+c) - elif c=="\\b": - op.append("\\b") - elif c=="\\f": - op.append("\\f") - else: - # It isn't clear when \u sequences *must* be used. - # Assuming not needed due to utf8 output which - # corresponds to what rfc4627 implies. - op.append(c) - op.append('"') - return "".join(op) - elif v is None: - return 'null' - elif isinstance(v, self._binary_type): - if sys.version_info<(3,0): - o=base64.encodestring(v) - else: - o=base64.encodebytes(v).decode("ascii") - if o[-1]=="\n": - o=o[:-1] - return '"'+o+'"' - else: - # number of some kind - return '%s' % (v,) - - def _fmt_python(self, v): - "Format as python literal" - if v is None: - return "None" - elif isinstance(v, self._basestring): - return repr(v) - elif isinstance(v, self._binary_type): - if sys.version_info<(3,0): - res=["buffer(\""] - for i in v: - if ord(i) in self._printable: - res.append(i) - else: - res.append("\\x%02X" % (ord(i),)) - res.append("\")") - return "".join(res) - else: - res=['b"'] - for i in v: - if i in self._printable: - res.append(chr(i)) - else: - res.append("\\x%02X" % (i,)) - res.append('"') - return "".join(res) - else: - return "%s" % (v,) - - def _fmt_sql_identifier(self, v): - "Return the identifier quoted in SQL syntax if needed (eg table and column names)" - if not len(v): # yes sqlite does allow zero length identifiers - return '""' - nonalnum=re.sub("[A-Za-z_0-9]+", "", v) - if len(nonalnum)==0: - if v.upper() not in self._sqlite_reserved: - # Ok providing it doesn't start with a digit - if v[0] not in "0123456789": - return v - # double quote it unless there are any double quotes in it - if '"' in nonalnum: - return "[%s]" % (v,) - return '"%s"' % (v,) - - def _fmt_text_col(self, v): - "Regular text formatting" - if v is None: - return self.nullvalue - elif isinstance(v, self._basestring): - return v - elif isinstance(v, self._binary_type): - # sqlite gives back raw bytes! - return "" - else: - return "%s" % (v,) - - ### - # The various output routines. They are always called with the - # header irrespective of the setting allowing for some per query - # setup. (see output_column for example). The doc strings are - # used to generate help. - ### - - def output_column(self, header, line): - """ - Items left aligned in space padded columns. They are - truncated if they do not fit. If the width hasn't been - specified for a column then 10 is used unless the column name - (header) is longer in which case that width is used. Use the - .width command to change column sizes. - """ - # as an optimization we calculate self._actualwidths which is - # reset for each query - if header: - def gw(n): - if n"] - for l in line: - out.append(("","")[header]) - out.append(l) - out.append(("\n","\n")[header]) - out.append("\n") - self.write(self.stdout, "".join(out)) - - def output_insert(self, header, line): - """ - Lines as SQL insert statements. The table name is "table" - unless you specified a different one as the second parameter - to the .mode command. - """ - if header: - return - fmt=lambda x: self.colour.colour_value(x, apsw.format_sql_value(x)) - out="INSERT INTO "+self._output_table+" VALUES("+",".join([fmt(l) for l in line])+");\n" - self.write(self.stdout, out) - - def output_json(self, header, line): - """ - Each line as a JSON object with a trailing comma. Blobs are - output as base64 encoded strings. You should be using UTF8 - output encoding. - """ - if header: - self._output_json_cols=line - return - fmt=lambda x: self.colour.colour_value(x, self._fmt_json_value(x)) - out=["%s: %s" % (self._fmt_json_value(k), fmt(line[i])) for i,k in enumerate(self._output_json_cols)] - self.write(self.stdout, "{ "+", ".join(out)+"},\n") - - def output_line(self, header, line): - """ - One value per line in the form 'column = value' with a blank - line between rows. - """ - if header: - w=5 - for l in line: - if len(l)>w: - w=len(l) - self._line_info=(w, line) - return - fmt=lambda x: self.colour.colour_value(x, self._fmt_text_col(x)) - w=self._line_info[0] - for i in range(len(line)): - self.write(self.stdout, "%*s = %s\n" % (w, self._line_info[1][i], fmt(line[i]))) - self.write(self.stdout, "\n") - - def output_list(self, header, line): - "All items on one line with separator" - if header: - if not self.header: - return - c=self.colour - fmt=lambda x: c.header+x+c.header_ - else: - fmt=lambda x: self.colour.colour_value(x, self._fmt_text_col(x)) - self.write(self.stdout, self.separator.join([fmt(x) for x in line])+"\n") - - def output_python(self, header, line): - "Tuples in Python source form for each row" - if header: - if not self.header: - return - c=self.colour - fmt=lambda x: c.header+self._fmt_python(x)+c.header_ - else: - fmt=lambda x: self.colour.colour_value(x, self._fmt_python(x)) - self.write(self.stdout, '('+", ".join([fmt(l) for l in line])+"),\n") - - def output_tcl(self, header, line): - "Outputs TCL/C style strings using current separator" - # In theory you could paste the output into your source ... - if header: - if not self.header: - return - c=self.colour - fmt=lambda x: c.header+self._fmt_c_string(x)+c.header_ - else: - fmt=lambda x: self.colour.colour_value(x, self._fmt_c_string(x)) - self.write(self.stdout, self.separator.join([fmt(l) for l in line])+"\n") - - def _output_summary(self, summary): - # internal routine to output a summary line or two - self.write(self.stdout, self.colour.summary+summary+self.colour.summary_) - - ### - # Various routines - ### - - def cmdloop(self, intro=None): - """Runs the main interactive command loop. - - :param intro: Initial text banner to display instead of the - default. Make sure you newline terminate it. - """ - if intro is None: - intro=""" -SQLite version %s (APSW %s) -Enter ".help" for instructions -Enter SQL statements terminated with a ";" -""" % (apsw.sqlitelibversion(), apsw.apswversion()) - intro=intro.lstrip() - if self.interactive and intro: - if sys.version_info<(3,0): - intro=unicode_type(intro) - c=self.colour - self.write(self.stdout, c.intro+intro+c.intro_) - - using_readline=False - try: - if self.interactive and self.stdin is sys.stdin: - import readline - old_completer=readline.get_completer() - readline.set_completer(self.complete) - readline.parse_and_bind("tab: complete") - using_readline=True - try: - readline.read_history_file(os.path.expanduser(self.history_file)) - except: - # We only expect IOError here but if the history - # file does not exist and this code has been - # compiled into the module it is possible to get - # an IOError that doesn't match the IOError from - # Python parse time resulting in an IOError - # exception being raised. Consequently we just - # catch all exceptions. - pass - except ImportError: - pass - - try: - while True: - self._input_descriptions=[] - if using_readline: - # we drop completion cache because it contains - # table and column names which could have changed - # with last executed SQL - self._completion_cache=None - self._using_readline=True - try: - command=self.getcompleteline() - if command is None: # EOF - return - self.process_complete_line(command) - except: - self._append_input_description() - try: - self.handle_exception() - except UnicodeDecodeError: - self.handle_exception() - finally: - if using_readline: - readline.set_completer(old_completer) - readline.set_history_length(256) - readline.write_history_file(os.path.expanduser(self.history_file)) - - def handle_exception(self): - """Handles the current exception, printing a message to stderr as appropriate. - It will reraise the exception if necessary (eg if bail is true)""" - eclass,eval,etb=sys.exc_info() # py2&3 compatible way of doing this - if isinstance(eval, SystemExit): - eval._handle_exception_saw_this=True - raise - - self._out_colour() - self.write(self.stderr, self.colour.error) - - if isinstance(eval, KeyboardInterrupt): - self.handle_interrupt() - text="Interrupted" - else: - text=str(eval) - - if not text.endswith("\n"): - text=text+"\n" - - if len(self._input_descriptions): - for i in range(len(self._input_descriptions)): - if i==0: - pref="At " - else: - pref=" "*i+"From " - self.write(self.stderr, pref+self._input_descriptions[i]+"\n") - - self.write(self.stderr, text) - if self.exceptions: - stack=[] - while etb: - stack.append(etb.tb_frame) - etb = etb.tb_next - - for frame in stack: - self.write(self.stderr, "\nFrame %s in %s at line %d\n" % - (frame.f_code.co_name, frame.f_code.co_filename, - frame.f_lineno)) - vars=list(frame.f_locals.items()) - vars.sort() - for k,v in vars: - try: - v=repr(v)[:80] - except: - v="" - self.write(self.stderr, "%10s = %s\n" % (k,v)) - self.write(self.stderr, "\n%s: %s\n" % (eclass, repr(eval))) - - self.write(self.stderr, self.colour.error_) - - eval._handle_exception_saw_this=True - if self.bail: - raise - - def process_sql(self, sql, bindings=None, internal=False, summary=None): - """Processes SQL text consisting of one or more statements - - :param sql: SQL to execute - - :param bindings: bindings for the *sql* - - :param internal: If True then this is an internal execution - (eg the .tables or .database command). When executing - internal sql timings are not shown nor is the SQL echoed. - - :param summary: If not None then should be a tuple of two - items. If the ``sql`` returns any data then the first item - is printed before the first row, and the second item is - printed after the last row. An example usage is the .find - command which shows table names. - """ - cur=self.db.cursor() - # we need to know when each new statement is executed - state={'newsql': True, 'timing': None} - - def et(cur, sql, bindings): - state['newsql']=True - # if time reporting, do so now - if not internal and self.timer: - if state['timing']: - self.display_timing(state['timing'], self.get_resource_usage()) - # print statement if echo is on - if not internal and self.echo: - # ? should we strip leading and trailing whitespace? backslash quote stuff? - if bindings: - self.write(self.stderr, "%s [%s]\n" % (sql, bindings)) - else: - self.write(self.stderr, sql+"\n") - # save resource from begining of command (ie don't include echo time above) - if not internal and self.timer: - state['timing']=self.get_resource_usage() - return True - cur.setexectrace(et) - # processing loop - try: - for row in cur.execute(sql, bindings): - if state['newsql']: - # summary line? - if summary: - self._output_summary(summary[0]) - # output a header always - cols=[h for h,d in cur.getdescription()] - self.output(True, cols) - state['newsql']=False - self.output(False, row) - if not state['newsql'] and summary: - self._output_summary(summary[1]) - except: - # If echo is on and the sql to execute is a syntax error - # then the exec tracer won't have seen it so it won't be - # printed and the user will be wondering exactly what sql - # had the error. We look in the traceback and deduce if - # the error was happening in a prepare or not. Also we - # need to ignore the case where SQLITE_SCHEMA happened and - # a reprepare is being done since the exec tracer will - # have been called in that situation. - if not internal and self.echo: - tb=sys.exc_info()[2] - last=None - while tb: - last=tb.tb_frame - tb=tb.tb_next - - if last and last.f_code.co_name=="sqlite3_prepare" \ - and last.f_code.co_filename.endswith("statementcache.c") \ - and "sql" in last.f_locals: - self.write(self.stderr, last.f_locals["sql"]+"\n") - raise - - if not internal and self.timer: - self.display_timing(state['timing'], self.get_resource_usage()) - - def process_command(self, cmd): - """Processes a dot command. It is split into parts using the - `shlex.split - `__ - function which is roughly the same method used by Unix/POSIX - shells. - """ - if self.echo: - self.write(self.stderr, cmd+"\n") - # broken with unicode on Python 2!!! - if sys.version_info<(3,0): - cmd=cmd.encode("utf8") - cmd=[c.decode("utf8") for c in shlex.split(cmd)] - else: - cmd=shlex.split(cmd) - assert cmd[0][0]=="." - cmd[0]=cmd[0][1:] - fn=getattr(self, "command_"+cmd[0], None) - if not fn: - raise self.Error("Unknown command \"%s\". Enter \".help\" for help" % (cmd[0],)) - fn(cmd[1:]) - - ### - # Commands start here - ### - - def _boolean_command(self, name, cmd): - "Parse and verify boolean parameter" - if len(cmd)!=1 or cmd[0].lower() not in ("on", "off"): - raise self.Error(name+" expected ON or OFF") - return cmd[0].lower()=="on" - - # Note that doc text is used for generating help output. - - def command_backup(self, cmd): - """backup ?DB? FILE: Backup DB (default "main") to FILE - - Copies the contents of the current database to FILE - overwriting whatever was in FILE. If you have attached databases - then you can specify their name instead of the default of "main". - - The backup is done at the page level - SQLite copies the pages - as is. There is no round trip through SQL code. - """ - dbname="main" - if len(cmd)==1: - fname=cmd[0] - elif len(cmd)==2: - dbname=cmd[0] - fname=cmd[1] - else: - raise self.Error("Backup takes one or two parameters") - out=apsw.Connection(fname) - b=out.backup("main", self.db, dbname) - try: - while not b.done: - b.step() - finally: - b.finish() - out.close() - - def command_bail(self, cmd): - """bail ON|OFF: Stop after hitting an error (default OFF) - - If an error is encountered while processing commands or SQL - then exit. (Note this is different than SQLite shell which - only exits for errors in SQL.) - """ - self.bail=self._boolean_command("bail", cmd) - - def command_colour(self, cmd=[]): - """colour SCHEME: Selects a colour scheme - - Residents of both countries that have not adopted the metric - system may also spell this command without a 'u'. If using a - colour terminal in interactive mode then output is - automatically coloured to make it more readable. Use 'off' to - turn off colour, and no name or 'default' for the default. - """ - if len(cmd)>1: - raise self.Error("Too many colour schemes") - c=cmd and cmd[0] or "default" - if c not in self._colours: - raise self.Error("No such colour scheme: "+c) - self.colour_scheme=c - self._out_colour() - - command_color=command_colour - - def command_databases(self, cmd): - """databases: Lists names and files of attached databases - - """ - if len(cmd): - raise self.Error("databases command doesn't take any parameters") - self.push_output() - self.header=True - self.output=self.output_column - self.truncate=False - self.widths=[3,15,58] - try: - self.process_sql("pragma database_list", internal=True) - finally: - self.pop_output() - - def command_dump(self, cmd): - """dump ?TABLE? [TABLE...]: Dumps all or specified tables in SQL text format - - The table name is treated as like pattern so you can use % as - a wildcard. You can use dump to make a text based backup of - the database. It is also useful for comparing differences or - making the data available to other databases. Indices and - triggers for the table(s) are also dumped. Finally views - matching the table pattern name are dumped (it isn't possible - to work out which views access which table and views can - access multiple tables anyway). - - Note that if you are dumping virtual tables such as used by - the FTS3 module then they may use other tables to store - information. For example if you create a FTS3 table named - *recipes* then it also creates *recipes_content*, - *recipes_segdir* etc. Consequently to dump this example - correctly use:: - - .dump recipes recipes_% - - If the database is empty or no tables/views match then there - is no output. - """ - # Simple tables are easy to dump. More complicated is dealing - # with virtual tables, foreign keys etc. - - # Lock the database while doing the dump so nothing changes - # under our feet - self.process_sql("BEGIN IMMEDIATE", internal=True) - - try: - # first pass -see if virtual tables or foreign keys are in - # use. If they are we emit pragmas to deal with them, but - # prefer not to emit them - v={"virtuals": False, - "foreigns": False} - - def check(name, sql): - if name.lower().startswith("sqlite_"): - return False - sql=sql.lower() - if re.match(r"^\s*create\s+virtual\s+.*", sql): - v["virtuals"]=True - # pragma table_info doesn't tell us if foreign keys - # are involved so we guess if any the various strings are - # in the sql somewhere - if re.match(r".*\b(foreign\s*key|references)\b.*", sql): - v["foreigns"]=True - return True - - if len(cmd)==0: - cmd=["%"] - - tables=[] - for pattern in cmd: - for name,sql in self.db.cursor().execute("SELECT name,sql FROM sqlite_master " - "WHERE sql NOT NULL AND type IN ('table','view') " - "AND tbl_name LIKE ?1", (pattern,)): - if check(name, sql) and name not in tables: - tables.append(name) - - if not tables: - return - - # will we need to analyze anything later? - analyze_needed=[] - for stat in self.db.cursor().execute("select name from sqlite_master where sql not null and type='table' and tbl_name like 'sqlite_stat%'"): - for name in tables: - if len(self.db.cursor().execute("select * from "+self._fmt_sql_identifier(stat[0])+" WHERE tbl=?", (name,)).fetchall()): - if name not in analyze_needed: - analyze_needed.append(name) - analyze_needed.sort() - - def blank(): - self.write(self.stdout, "\n") - - def comment(s): - if isinstance(s, bytes): - s = s.decode('utf-8', 'replace') - self.write(self.stdout, textwrap.fill(s, 78, initial_indent="-- ", subsequent_indent="-- ")+"\n") - - pats=", ".join([(x,"(All)")[x=="%"] for x in cmd]) - comment("SQLite dump (by APSW %s)" % (apsw.apswversion(),)) - comment("SQLite version " + apsw.sqlitelibversion()) - comment("Date: " +time.ctime()) - comment("Tables like: "+pats) - comment("Database: "+self.db.filename) - try: - import getpass - import socket - comment("User: %s @ %s" % (getpass.getuser(), socket.gethostname())) - except ImportError: - pass - blank() - - comment("The values of various per-database settings") - comment("PRAGMA page_size="+str(self.db.cursor().execute("pragma page_size").fetchall()[0][0])+";\n") - comment("PRAGMA encoding='"+self.db.cursor().execute("pragma encoding").fetchall()[0][0]+"';\n") - vac={0: "NONE", 1: "FULL", 2: "INCREMENTAL"} - vacvalue=self.db.cursor().execute("pragma auto_vacuum").fetchall()[0][0] - comment("PRAGMA auto_vacuum="+vac.get(vacvalue, str(vacvalue))+";\n") - comment("PRAGMA max_page_count="+str(self.db.cursor().execute("pragma max_page_count").fetchall()[0][0])+";\n") - blank() - - # different python versions have different requirements - # about specifying cmp to sort routine so we use this - # portable workaround with a decorated list instead - dectables=[(x.lower(), x) for x in tables] - dectables.sort() - tables=[y for x,y in dectables] - - virtuals=v["virtuals"] - foreigns=v["foreigns"] - - if virtuals: - comment("This pragma is needed to restore virtual tables") - self.write(self.stdout, "PRAGMA writable_schema=ON;\n") - if foreigns: - comment("This pragma turns off checking of foreign keys " - "as tables would be inconsistent while restoring. It was introduced " - "in SQLite 3.6.19.") - self.write(self.stdout, "PRAGMA foreign_keys=OFF;\n") - - if virtuals or foreigns: - blank() - - self.write(self.stdout, "BEGIN TRANSACTION;\n") - blank() - - def sqldef(s): - # return formatted sql watching out for embedded - # comments at the end forcing trailing ; onto next - # line https://sqlite.org/src/info/c04a8b8a4f - if "--" in s.split("\n")[-1]: - nl="\n" - else: - nl="" - return s+nl+";\n" - - # do the table dumping loops - oldtable=self._output_table - try: - self.push_output() - self.output=self.output_insert - # Dump the table - for table in tables: - for sql in self.db.cursor().execute("SELECT sql FROM sqlite_master WHERE name=?1 AND type='table'", (table,)): - comment("Table "+table) - # Special treatment for virtual tables - they - # get called back on drops and creates and - # could thwart us so we have to manipulate - # sqlite_master directly - if sql[0].lower().split()[:3]==["create", "virtual", "table"]: - self.write(self.stdout, "DELETE FROM sqlite_master WHERE name="+apsw.format_sql_value(table)+" AND type='table';\n") - self.write(self.stdout, "INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql) VALUES('table',%s,%s,0,%s);\n" - % (apsw.format_sql_value(table), apsw.format_sql_value(table), apsw.format_sql_value(sql[0]))) - else: - self.write(self.stdout, "DROP TABLE IF EXISTS "+self._fmt_sql_identifier(table)+";\n") - self.write(self.stdout, sqldef(sql[0])) - self._output_table=self._fmt_sql_identifier(table) - self.process_sql("select * from "+self._fmt_sql_identifier(table), internal=True) - # Now any indices or triggers - first=True - for name,sql in self.db.cursor().execute("SELECT name,sql FROM sqlite_master " - "WHERE sql NOT NULL AND type IN ('index', 'trigger') " - "AND tbl_name=?1 AND name NOT LIKE 'sqlite_%' " - "ORDER BY lower(name)", (table,)): - if first: - comment("Triggers and indices on "+table) - first=False - self.write(self.stdout, sqldef(sql)) - blank() - # Views done last. They have to be done in the same order as they are in sqlite_master - # as they could refer to each other - first=True - for name,sql in self.db.cursor().execute("SELECT name,sql FROM sqlite_master " - "WHERE sql NOT NULL AND type='view' " - "AND name IN ( "+",".join([apsw.format_sql_value(i) for i in tables])+ - ") ORDER BY _ROWID_"): - if first: - comment("Views") - first=False - self.write(self.stdout, "DROP VIEW IF EXISTS %s;\n" % (self._fmt_sql_identifier(name),)) - self.write(self.stdout, sqldef(sql)) - if not first: - blank() - - # sqlite sequence - # does it exist - if len(self.db.cursor().execute("select * from sqlite_master where name='sqlite_sequence'").fetchall()): - first=True - for t in tables: - v=self.db.cursor().execute("select seq from main.sqlite_sequence where name=?1", (t,)).fetchall() - if len(v): - assert len(v)==1 - if first: - comment("For primary key autoincrements the next id " - "to use is stored in sqlite_sequence") - first=False - self.write(self.stdout, 'DELETE FROM main.sqlite_sequence WHERE name=%s;\n' % (apsw.format_sql_value(t),)) - self.write(self.stdout, 'INSERT INTO main.sqlite_sequence VALUES (%s, %s);\n' % (apsw.format_sql_value(t), v[0][0])) - if not first: - blank() - finally: - self.pop_output() - self._output_table=oldtable - - # analyze - if analyze_needed: - comment("You had used the analyze command on these tables before. Rerun for this new data.") - for n in analyze_needed: - self.write(self.stdout, "ANALYZE "+self._fmt_sql_identifier(n)+";\n") - blank() - - # user version pragma - uv=self.db.cursor().execute("pragma user_version").fetchall()[0][0] - if uv: - comment("Your database may need this. It is sometimes used to keep track of the schema version (eg Firefox does this).") - comment("pragma user_version=%d;" % (uv,)) - blank() - - # Save it all - self.write(self.stdout, "COMMIT TRANSACTION;\n") - - # cleanup pragmas - if foreigns: - blank() - comment("Restoring foreign key checking back on. Note that SQLite 3.6.19 is off by default") - self.write(self.stdout, "PRAGMA foreign_keys=ON;\n") - if virtuals: - blank() - comment("Restoring writable schema back to default") - self.write(self.stdout, "PRAGMA writable_schema=OFF;\n") - # schema reread - blank() - comment("We need to force SQLite to reread the schema because otherwise it doesn't know that " - "the virtual tables we inserted directly into sqlite_master exist. See " - "last comments of https://sqlite.org/cvstrac/tktview?tn=3425") - self.write(self.stdout, "BEGIN;\nCREATE TABLE no_such_table(x,y,z);\nROLLBACK;\n") - - finally: - self.process_sql("END", internal=True) - - def command_echo(self, cmd): - """echo ON|OFF: If ON then each SQL statement or command is printed before execution (default OFF) - - The SQL statement or command is sent to error output so that - it is not intermingled with regular output. - """ - self.echo=self._boolean_command("echo", cmd) - - def set_encoding(self, enc): - """Saves *enc* as the default encoding, after verifying that - it is valid. You can also include :error to specify error - handling - eg 'cp437:replace' - - Raises an exception on invalid encoding or error - """ - enc=enc.split(":", 1) - if len(enc)>1: - enc, errors=enc - else: - enc=enc[0] - errors=None - try: - codecs.lookup(enc) - except LookupError: - raise self.Error("No known encoding '%s'" % (enc,)) - try: - if errors is not None: - codecs.lookup_error(errors) - except LookupError: - raise self.Error("No known codec error handler '%s'" % (errors,)) - self.encoding=enc, errors - - def command_encoding(self, cmd): - """encoding ENCODING: Set the encoding used for new files opened via .output and imports - - SQLite and APSW work internally using Unicode and characters. - Files however are a sequence of bytes. An encoding describes - how to convert between bytes and characters. The default - encoding is utf8 and that is generally the best value to use - when other programs give you a choice. - - You can also specify an error handler. For example - 'cp437:replace' will use code page 437 and any Unicode - codepoints not present in cp437 will be replaced (typically - with something like a question mark). Other error handlers - include 'ignore', 'strict' (default) and 'xmlcharrefreplace'. - - For the default input/output/error streams on startup the - shell defers to Python's detection of encoding. For example - on Windows it asks what code page is in use and on Unix it - looks at the LC_CTYPE environment variable. You can set the - PYTHONIOENCODING environment variable to override this - detection. - - This command affects files opened after setting the encoding - as well as imports. - - See the online APSW documentation for more details. - """ - if len(cmd)!=1: - raise self.Error("Encoding takes one argument") - self.set_encoding(cmd[0]) - - def command_exceptions(self, cmd): - """exceptions ON|OFF: If ON then detailed tracebacks are shown on exceptions (default OFF) - - Normally when an exception occurs the error string only is - displayed. However it is sometimes useful to get a full - traceback. An example would be when you are developing - virtual tables and using the shell to exercise them. In - addition to displaying each stack frame, the local variables - within each frame are also displayed. - """ - self.exceptions=self._boolean_command("exceptions", cmd) - - def command_exit(self, cmd): - """exit:Exit this program""" - if len(cmd): - raise self.Error("Exit doesn't take any parameters") - sys.exit(0) - - def command_quit(self, cmd): - """quit:Exit this program""" - if len(cmd): - raise self.Error("Quit doesn't take any parameters") - sys.exit(0) - - def command_explain(self, cmd): - """explain ON|OFF: Set output mode suitable for explain (default OFF) - - Explain shows the underlying SQLite virtual machine code for a - statement. You need to prefix the SQL with explain. For example: - - explain select * from table; - - This output mode formats the explain output nicely. If you do - '.explain OFF' then the output mode and settings in place when - you did '.explain ON' are restored. - """ - if len(cmd)==0 or self._boolean_command("explain", cmd): - self.push_output() - self.header=True - self.widths=[4,13,4,4,4,13,2,13] - self.truncate=False - self.output=self.output_column - else: - self.pop_output() - - def command_find(self, cmd): - """find what ?TABLE?: Searches all columns of all tables for a value - - The find command helps you locate data across your database - for example to find a string or any references to an id. - - You can specify a like pattern to limit the search to a subset - of tables (eg specifying 'CUSTOMER%' for all tables beginning - with CUSTOMER). - - The what value will be treated as a string and/or integer if - possible. If what contains % or _ then it is also treated as - a like pattern. - - This command will take a long time to execute needing to read - all of the relevant tables. - """ - if len(cmd)<1 or len(cmd)>2: - raise self.Error("At least one argument required and at most two accepted") - tablefilter="%" - if len(cmd)==2: - tablefilter=cmd[1] - querytemplate=[] - queryparams=[] - - def qp(): # binding for current queryparams - return "?"+str(len(queryparams)) - s=cmd[0] - if '%' in s or '_' in s: - queryparams.append(s) - querytemplate.append("%s LIKE "+qp()) - queryparams.append(s) - querytemplate.append("%s = "+qp()) - try: - i=int(s) - queryparams.append(i) - querytemplate.append("%s = "+qp()) - except ValueError: - pass - querytemplate=" OR ".join(querytemplate) - for (table,) in self.db.cursor().execute("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE ?1", (tablefilter,)): - t=self._fmt_sql_identifier(table) - query="SELECT * from %s WHERE " % (t,) - colq=[] - for _,column,_,_,_,_ in self.db.cursor().execute("pragma table_info(%s)" % (t,)): - colq.append(querytemplate % ((self._fmt_sql_identifier(column),)*len(queryparams))) - query=query+" OR ".join(colq) - self.process_sql(query, queryparams, internal=True, summary=("Table "+table+"\n", "\n")) - - def command_header(self, cmd): - """header(s) ON|OFF: Display the column names in output (default OFF) - - """ - self.header=self._boolean_command("header", cmd) - - command_headers=command_header - - _help_info=None - - def command_help(self, cmd): - """help ?COMMAND?: Shows list of commands and their usage. If COMMAND - is specified then shows detail about that COMMAND. ('.help all' will - show detailed help about all commands.) - """ - if not self._help_info: - # buildup help database - self._help_info={} - for c in dir(self): - if not c.startswith("command_"): - continue - # help is 3 parts - # - the syntax string (eg backup ?dbname? filename) - # - the one liner description (eg saves database to filename) - # - the multi-liner detailed description - # We grab this from the doc string for the function in the form - # syntax: one liner\nmulti\nliner - d=getattr(self, c).__doc__ - assert d, c+" command must have documentation" - c=c[len("command_"):] - if c in ("headers", "color"): - continue - while d[0]=="\n": - d=d[1:] - parts=d.split("\n", 1) - firstline=parts[0].strip().split(":", 1) - assert len(firstline)==2, c+" command must have usage: description doc" - if len(parts)==1 or len(parts[1].strip())==0: # work around textwrap bug - multi="" - else: - multi=textwrap.dedent(parts[1]) - if c=="mode": - if not self._output_modes: - self._cache_output_modes() - firstline[1]=firstline[1]+" "+" ".join(self._output_modes) - multi=multi+"\n\n"+"\n\n".join(self._output_modes_detail) - if c=="colour": - colours=list(self._colours.keys()) - colours.sort() - firstline[1]=firstline[1]+" from "+", ".join(colours) - if len(multi.strip())==0: # All whitespace - multi=None - else: - multi=multi.strip("\n") - # we need to keep \n\n as a newline but turn all others into spaces - multi=multi.replace("\n\n", "\x00") - multi=multi.replace("\n", " ") - multi=multi.replace("\x00", "\n\n") - multi=multi.split("\n\n") - self._help_info[c]=('.'+firstline[0].strip(), firstline[1].strip(), multi) - - self.write(self.stderr, "\n") - - tw=self._terminal_width() - if tw<32: - tw=32 - if len(cmd)==0: - commands=list(self._help_info.keys()) - commands.sort() - w=0 - for command in commands: - if len(self._help_info[command][0])>w: - w=len(self._help_info[command][0]) - out=[] - for command in commands: - hi=self._help_info[command] - # usage string - out.append(hi[0]) - # space padding (including 2 for between columns) - out.append(" "*(2+w-len(hi[0]))) - # usage message wrapped if need be - out.append(("\n"+" "*(2+w)).join(textwrap.wrap(hi[1], tw-w-2))) - # newline - out.append("\n") - self.write(self.stderr, "".join(out)) - else: - if cmd[0]=="all": - cmd=list(self._help_info.keys()) - cmd.sort() - w=0 - for command in self._help_info: - if len(self._help_info[command][0])>w: - w=len(self._help_info[command][0]) - - for command in cmd: - if command=="headers": - command="header" - if command not in self._help_info: - raise self.Error("No such command \"%s\"" % (command,)) - out=[] - hi=self._help_info[command] - # usage string - out.append(hi[0]) - # space padding (2) - out.append(" "*(2+w-len(hi[0]))) - # usage message wrapped if need be - out.append(("\n"+" "*(2+w)).join(textwrap.wrap(hi[1], tw-w-2))+"\n") - if hi[2]: - # newlines - out.append("\n") - # detailed message - for i,para in enumerate(hi[2]): - out.append(textwrap.fill(para, tw)+"\n") - if i=(3,0): - thefile=codecs.open(filename, "r", self.encoding[0]) - for line in csv.reader(thefile, **dialect.copy()): - yield line - thefile.close() - return - - ### - # csv module is not good at unicode so we have to - # indirect unless utf8 is in use - ### - if self.encoding[0].lower()=="utf8": # no need for tempfile - thefile=open(filename, "rb") - else: - import tempfile - thefile=tempfile.TemporaryFile(prefix="apsw_import") - thefile.write(codecs.open(filename, "r", self.encoding[0]).read().encode("utf8")) - # move back to beginning - thefile.seek(0,0) - - # Ensure all values are utf8 not unicode - for k,v in dialect.items(): - if isinstance(v, unicode_type): - dialect[k]=v.encode("utf8") - for line in csv.reader(thefile, **dialect): - # back to unicode again - yield [x.decode("utf8") for x in line] - thefile.close() - - def command_autoimport(self, cmd): - """autoimport FILENAME ?TABLE?: Imports filename creating a table and automatically working out separators and data types (alternative to .import command) - - The import command requires that you precisely pre-setup the - table and schema, and set the data separators (eg commas or - tabs). In many cases this information can be automatically - deduced from the file contents which is what this command - does. There must be at least two columns and two rows. - - If the table is not specified then the basename of the file - will be used. - - Additionally the type of the contents of each column is also - deduced - for example if it is a number or date. Empty values - are turned into nulls. Dates are normalized into YYYY-MM-DD - format and DateTime are normalized into ISO8601 format to - allow easy sorting and searching. 4 digit years must be used - to detect dates. US (swapped day and month) versus rest of - the world is also detected providing there is at least one - value that resolves the ambiguity. - - Care is taken to ensure that columns looking like numbers are - only treated as numbers if they do not have unnecessary - leading zeroes or plus signs. This is to avoid treating phone - numbers and similar number like strings as integers. - - This command can take quite some time on large files as they - are effectively imported twice. The first time is to - determine the format and the types for each column while the - second pass actually imports the data. - """ - if len(cmd)<1 or len(cmd)>2: - raise self.Error("Expected one or two parameters") - if not os.path.exists(cmd[0]): - raise self.Error("File \"%s\" does not exist" % (cmd[0],)) - if len(cmd)==2: - tablename=cmd[1] - else: - tablename=None - try: - final=None - c=self.db.cursor() - c.execute("BEGIN IMMEDIATE") - final="ROLLBACK" - - if not tablename: - tablename=os.path.splitext(os.path.basename(cmd[0]))[0] - - if c.execute("pragma table_info(%s)" % (self._fmt_sql_identifier(tablename),)).fetchall(): - raise self.Error("Table \"%s\" already exists" % (tablename,)) - - # The types we support deducing - def DateUS(v): # US formatted date with wrong ordering of day and month - return DateWorld(v, switchdm=True) - - def DateWorld(v, switchdm=False): # Sensibly formatted date as used anywhere else in the world - y,m,d=self._getdate(v) - if switchdm: - m,d=d,m - if m<1 or m>12 or d<1 or d>31: - raise ValueError - return "%d-%02d-%02d" % (y,m,d) - - def DateTimeUS(v): # US date and time - return DateTimeWorld(v, switchdm=True) - - def DateTimeWorld(v, switchdm=False): # Sensible date and time - y,m,d,h,M,s=self._getdatetime(v) - if switchdm: - m,d=d,m - if m<1 or m>12 or d<1 or d>31 or h<0 or h>23 or M<0 or M>59 or s<0 or s>65: - raise ValueError - return "%d-%02d-%02dT%02d:%02d:%02d" % (y,m,d,h,M,s) - - def Number(v): # we really don't want phone numbers etc to match - # Python's float & int constructors allow whitespace which we don't - if re.search(r"\s", v): - raise ValueError - if v=="0": - return 0 - if v[0]=="+": # idd prefix - raise ValueError - if re.match("^[0-9]+$", v): - if v[0]=="0": - raise ValueError # also a phone number - return int(v) - if v[0]=="0" and not v.startswith("0."): # deceptive not a number - raise ValueError - return float(v) - - # Work out the file format - formats=[ - {"dialect": "excel"}, - {"dialect": "excel-tab"}] - seps=["|", ";", ":"] - if self.separator not in seps: - seps.append(self.separator) - for sep in seps: - formats.append( - {"quoting": csv.QUOTE_NONE, - "delimiter": sep, - "doublequote": False, - "quotechar": "\x00"} - ) - possibles=[] - errors=[] - encodingissue=False - # format is copy() on every use. This appears bizarre and - # unnecessary. However Python 2.3 and 2.4 somehow manage - # to empty it if not copied. - for format in formats: - ncols=-1 - lines=0 - try: - for line in self._csvin_wrapper(cmd[0], format.copy()): - if lines==0: - lines=1 - ncols=len(line) - # data type guess setup - datas=[] - for i in range(ncols): - datas.append([DateUS, DateWorld, DateTimeUS, DateTimeWorld, Number]) - allblanks=[True]*ncols - continue - if len(line)!=ncols: - raise ValueError("Expected %d columns - got %d" % (ncols, len(line))) - lines+=1 - for i in range(ncols): - if not line[i]: - continue - allblanks[i]=False - if not datas[i]: - continue - # remove datas that give ValueError - d=[] - for dd in datas[i]: - try: - dd(line[i]) - d.append(dd) - except ValueError: - pass - datas[i]=d - if ncols>1 and lines>1: - # if a particular column was allblank then clear datas for it - for i in range(ncols): - if allblanks[i]: - datas[i]=[] - possibles.append((format.copy(), ncols, lines, datas)) - except UnicodeDecodeError: - encodingissue=True - except: - s=str(sys.exc_info()[1]) - if s not in errors: - errors.append(s) - - if len(possibles)==0: - if encodingissue: - raise self.Error("The file is probably not in the current encoding \"%s\" and didn't match a known file format" % (self.encoding[0],)) - v="File doesn't appear to match a known type." - if len(errors): - v+=" Errors reported:\n"+"\n".join([" "+e for e in errors]) - raise self.Error(v) - if len(possibles)>1: - raise self.Error("File matches more than one type!") - format, ncols, lines, datas=possibles[0] - fmt=format.get("dialect", None) - if fmt is None: - fmt="(delimited by \"%s\")" % (format["delimiter"],) - self.write(self.stdout, "Detected Format %s Columns %d Rows %d\n" % (fmt, ncols, lines)) - # Header row - reader=self._csvin_wrapper(cmd[0], format) - for header in reader: - break - # Check schema - identity=lambda x:x - for i in range(ncols): - if len(datas[i])>1: - raise self.Error("Column #%d \"%s\" has ambiguous data format - %s" % (i+1, header[i], ", ".join([dl.__name__ for dl in datas[i]]))) - if datas[i]: - datas[i]=datas[i][0] - else: - datas[i]=identity - # Make the table - sql="CREATE TABLE %s(%s)" % (self._fmt_sql_identifier(tablename), ", ".join([self._fmt_sql_identifier(h) for h in header])) - c.execute(sql) - # prep work for each row - sql="INSERT INTO %s VALUES(%s)" % (self._fmt_sql_identifier(tablename), ",".join(["?"]*ncols)) - for line in reader: - vals=[] - for i in range(ncols): - l=line[i] - if not l: - vals.append(None) - else: - vals.append(datas[i](l)) - c.execute(sql, vals) - - c.execute("COMMIT") - self.write(self.stdout, "Auto-import into table \"%s\" complete\n" % (tablename,)) - except: - if final: - self.db.cursor().execute(final) - raise - - def _getdate(self, v): - # Returns a tuple of 3 items y,m,d from string v - m=re.match(r"^([0-9]+)[^0-9]([0-9]+)[^0-9]([0-9]+)$", v) - if not m: - raise ValueError - y,m,d=int(m.group(1)), int(m.group(2)), int(m.group(3)) - if d>1000: # swap order - y,m,d=d,m,y - if y<1000 or y>9999: - raise ValueError - return y,m,d - - def _getdatetime(self, v): - # must be at least HH:MM - m=re.match(r"^([0-9]+)[^0-9]([0-9]+)[^0-9]([0-9]+)[^0-9]+([0-9]+)[^0-9]([0-9]+)([^0-9]([0-9]+))?$", v) - if not m: - raise ValueError - items=list(m.group(1,2,3,4,5,7)) - for i in range(len(items)): - if items[i] is None: - items[i]=0 - items=[int(i) for i in items] - if items[2]>1000: - items=[items[2], items[1], items[0]]+items[3:] - if items[0]<1000 or items[0]>9999: - raise ValueError - return items - - def command_indices(self, cmd): - """indices TABLE: Lists all indices on table TABLE - - """ - if len(cmd)!=1: - raise self.Error("indices takes one table name") - self.push_output() - self.header=False - self.output=self.output_list - try: - self.process_sql("SELECT name FROM sqlite_master WHERE type='index' AND tbl_name LIKE ?1 " - "UNION ALL SELECT name FROM sqlite_temp_master WHERE type='index' AND tbl_name LIKE " - "?1 ORDER by name", cmd, internal=True) - finally: - self.pop_output() - - def command_load(self, cmd): - """load FILE ?ENTRY?: Loads a SQLite extension library - - Note: Extension loading may not be enabled in the SQLite - library version you are using. - - Extensions are an easy way to add new functions and - functionality. For a useful extension look at the bottom of - https://sqlite.org/contrib - - By default sqlite3_extension_init is called in the library but - you can specify an alternate entry point. - - If you get an error about the extension not being found you - may need to explicitly specify the directory. For example if - it is in the current directory then use: - - .load ./extension.so - """ - if len(cmd)<1 or len(cmd)>2: - raise self.Error("load takes one or two parameters") - try: - self.db.enableloadextension(True) - except: - raise self.Error("Extension loading is not supported") - - self.db.loadextension(*cmd) - - _output_modes=None - - def command_mode(self, cmd): - """mode MODE ?TABLE?: Sets output mode to one of""" - if len(cmd) in (1,2): - w=cmd[0] - if w=="tabs": - w="list" - m=getattr(self, "output_"+w, None) - if w!="insert": - if len(cmd)==2: - raise self.Error("Output mode %s doesn't take parameters" % (cmd[0])) - if m: - self.output=m - # set some defaults - self.truncate=True - if cmd[0]=="csv": - self.separator="," - elif cmd[0]=="tabs": - self.separator="\t" - else: - pass - # self.separator=self._output_stack[0]["separator"] - if w=="insert": - if len(cmd)==2: - self._output_table=cmd[1] - else: - self._output_table="table" - self._output_table=self._fmt_sql_identifier(self._output_table) - return - if not self._output_modes: - self._cache_output_modes() - raise self.Error("Expected a valid output mode: "+", ".join(self._output_modes)) - - # needed so command completion and help can use it - def _cache_output_modes(self): - modes=[m[len("output_"):] for m in dir(self) if m.startswith("output_")] - modes.append("tabs") - modes.sort() - self._output_modes=modes - - detail=[] - - for m in modes: - if m=='tabs': - continue - d=getattr(self, "output_"+m).__doc__ - assert d, "output mode "+m+" needs doc" - d=d.replace("\n", " ").strip() - while " " in d: - d=d.replace(" ", " ") - detail.append(m+": "+d) - self._output_modes_detail=detail - - def command_nullvalue(self, cmd): - """nullvalue STRING: Print STRING in place of null values - - This affects textual output modes like column and list and - sets how SQL null values are shown. The default is a zero - length string. Insert mode and dumps are not affected by this - setting. You can use double quotes to supply a zero length - string. For example: - - .nullvalue "" # the default - .nullvalue # rather obvious - .nullvalue " \\t " # A tab surrounded by spaces - """ - if len(cmd)!=1: - raise self.Error("nullvalue takes exactly one parameter") - self.nullvalue=self.fixup_backslashes(cmd[0]) - - def command_output(self, cmd): - """output FILENAME: Send output to FILENAME (or stdout) - - If the FILENAME is stdout then output is sent to standard - output from when the shell was started. The file is opened - using the current encoding (change with .encoding command). - """ - # Flush everything - self.stdout.flush() - self.stderr.flush() - if hasattr(self.stdin, "flush"): - try: - self.stdin.flush() - except IOError: # see issue 117 - pass - - # we will also close stdout but only do so once we have a - # replacement so that stdout is always valid - - if len(cmd)!=1: - raise self.Error("You must specify a filename") - - try: - fname=cmd[0] - if fname=="stdout": - old=None - if self.stdout!=self._original_stdout: - old=self.stdout - self.stdout=self._original_stdout - if old is not None: # done here in case close raises exception - old.close() - return - - newf=codecs.open(fname, "w", self.encoding[0], self.encoding[1]) - old=None - if self.stdout!=self._original_stdout: - old=self.stdout - self.stdout=newf - if old is not None: - old.close() - finally: - self._out_colour() - - def command_print(self, cmd): - """print STRING: print the literal STRING - - If more than one argument is supplied then they are printed - space separated. You can use backslash escapes such as \\n - and \\t. - """ - self.write(self.stdout, " ".join([self.fixup_backslashes(i) for i in cmd])+"\n") - - def command_prompt(self, cmd): - """prompt MAIN ?CONTINUE?: Changes the prompts for first line and continuation lines - - The default is to print 'sqlite> ' for the main prompt where - you can enter a dot command or a SQL statement. If the SQL - statement is complete (eg not ; terminated) then you are - prompted for more using the continuation prompt which defaults - to ' ..> '. Example: - - .prompt "Yes, Master> " "More, Master> " - - You can use backslash escapes such as \\n and \\t. - """ - if len(cmd)<1 or len(cmd)>2: - raise self.Error("prompt takes one or two arguments") - self.prompt=self.fixup_backslashes(cmd[0]) - if len(cmd)==2: - self.moreprompt=self.fixup_backslashes(cmd[1]) - - def command_read(self, cmd): - """read FILENAME: Processes SQL and commands in FILENAME (or Python if FILENAME ends with .py) - - Treats the specified file as input (a mixture or SQL and/or - dot commands). If the filename ends in .py then it is treated - as Python code instead. - - For Python code the symbol 'shell' refers to the instance of - the shell and 'apsw' is the apsw module. - """ - if len(cmd)!=1: - raise self.Error("read takes a single filename") - if cmd[0].lower().endswith(".py"): - g={} - g.update({'apsw': apsw, 'shell': self}) - if sys.version_info<(3,0): - execfile(cmd[0], g, g) - else: - # compile step is needed to associate name with code - exec(compile(open(cmd[0]).read(), cmd[0], 'exec'), g, g) - else: - f=codecs.open(cmd[0], "rU", self.encoding[0]) - try: - try: - self.push_input() - self.stdin=f - self.interactive=False - self.input_line_number=0 - while True: - line=self.getcompleteline() - if line is None: - break - self.process_complete_line(line) - except: - eval=sys.exc_info()[1] - if not isinstance(eval, SystemExit): - self._append_input_description() - raise - - finally: - self.pop_input() - f.close() - - def command_restore(self, cmd): - """restore ?DB? FILE: Restore database from FILE into DB (default "main") - - Copies the contents of FILE to the current database (default "main"). - The backup is done at the page level - SQLite copies the pages as - is. There is no round trip through SQL code. - """ - dbname="main" - if len(cmd)==1: - fname=cmd[0] - elif len(cmd)==2: - dbname=cmd[0] - fname=cmd[1] - else: - raise self.Error("Restore takes one or two parameters") - input=apsw.Connection(fname) - b=self.db.backup(dbname, input, "main") - try: - while not b.done: - b.step() - finally: - b.finish() - input.close() - - def command_schema(self, cmd): - """schema ?TABLE? [TABLE...]: Shows SQL for table - - If you give one or more tables then their schema is listed - (including indices). If you don't specify any then all - schemas are listed. TABLE is a like pattern so you can % for - wildcards. - """ - self.push_output() - self.output=self.output_list - self.header=False - try: - if len(cmd)==0: - cmd=['%'] - for n in cmd: - self.process_sql("SELECT sql||';' FROM " - "(SELECT sql sql, type type, tbl_name tbl_name, name name " - "FROM sqlite_master UNION ALL " - "SELECT sql, type, tbl_name, name FROM sqlite_temp_master) " - "WHERE tbl_name LIKE ?1 AND type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%' " - "ORDER BY substr(type,2,1), name", (n,), internal=True) - finally: - self.pop_output() - - def command_separator(self, cmd): - """separator STRING: Change separator for output mode and .import - - You can use quotes and backslashes. For example to set the - separator to space tab space you can use: - - .separator " \\t " - - The setting is automatically changed when you switch to csv or - tabs output mode. You should also set it before doing an - import (ie , for CSV and \\t for TSV). - """ - if len(cmd)!=1: - raise self.Error("separator takes exactly one parameter") - self.separator=self.fixup_backslashes(cmd[0]) - - _shows=("echo", "explain", "headers", "mode", "nullvalue", "output", "separator", "width", "exceptions", "encoding") - - def command_show(self, cmd): - """show: Show the current values for various settings.""" - if len(cmd)>1: - raise self.Error("show takes at most one parameter") - if len(cmd): - what=cmd[0] - if what not in self._shows: - raise self.Error("Unknown show: '%s'" % (what,)) - else: - what=None - - outs=[] - for i in self._shows: - k=i - if what and i!=what: - continue - # boolean settings - if i in ("echo", "headers", "exceptions"): - if i=="headers": - i="header" - v="off" - if getattr(self, i): - v="on" - elif i=="explain": - # we cheat by looking at truncate setting! - v="on" - if self.truncate: - v="off" - elif i in ("nullvalue", "separator"): - v=self._fmt_c_string(getattr(self, i)) - elif i=="mode": - if not self._output_modes: - self._cache_output_modes() - for v in self._output_modes: - if self.output==getattr(self, "output_"+v): - break - else: - assert False, "Bug: didn't find output mode" - elif i=="output": - if self.stdout is self._original_stdout: - v="stdout" - else: - v=getattr(self.stdout, "name", "") - elif i=="width": - v=" ".join(["%d"%(i,) for i in self.widths]) - elif i=="encoding": - v=self.encoding[0] - if self.encoding[1]: - v+=" (Errors "+self.encoding[1]+")" - else: - assert False, "Bug: unknown show handling" - outs.append((k,v)) - - # find width of k column - l=0 - for k,v in outs: - if len(k)>l: - l=len(k) - - for k,v in outs: - self.write(self.stderr, "%*.*s: %s\n" % (l,l, k, v)) - - def command_tables(self, cmd): - """tables ?PATTERN?: Lists names of tables matching LIKE pattern - - This also returns views. - """ - self.push_output() - self.output=self.output_list - self.header=False - try: - if len(cmd)==0: - cmd=['%'] - - # The SQLite shell code filters out sqlite_ prefixes if - # you specified an argument else leaves them in. It also - # has a hand coded output mode that does space separation - # plus wrapping at 80 columns. - for n in cmd: - self.process_sql("SELECT name FROM sqlite_master " - "WHERE type IN ('table', 'view') AND name NOT LIKE 'sqlite_%' " - "AND name like ?1 " - "UNION ALL " - "SELECT name FROM sqlite_temp_master " - "WHERE type IN ('table', 'view') AND name NOT LIKE 'sqlite_%' " - "ORDER BY 1", (n,), internal=True) - finally: - self.pop_output() - - def command_timeout(self, cmd): - """timeout MS: Try opening locked tables for MS milliseconds - - If a database is locked by another process SQLite will keep - retrying. This sets how many thousandths of a second it will - keep trying for. If you supply zero or a negative number then - all busy handlers are disabled. - """ - if len(cmd)!=1: - raise self.Error("timeout takes a number") - try: - t=int(cmd[0]) - except: - raise self.Error("%s is not a number" % (cmd[0],)) - self.db.setbusytimeout(t) - - def command_timer(self, cmd): - """timer ON|OFF: Control printing of time and resource usage after each query - - The values displayed are in seconds when shown as floating - point or an absolute count. Only items that have changed - since starting the query are shown. On non-Windows platforms - considerably more information can be shown. - """ - if self._boolean_command("timer", cmd): - try: - self.get_resource_usage() - except: - raise self.Error("Timing not supported by this Python version/platform") - self.timer=True - else: - self.timer=False - - def command_width(self, cmd): - """width NUM NUM ...: Set the column widths for "column" mode - - In "column" output mode, each column is a fixed width with values truncated to - fit. Specify new widths using this command. Use a negative number - to right justify and zero for default column width. - """ - if len(cmd)==0: - raise self.Error("You need to specify some widths!") - w=[] - for i in cmd: - try: - w.append(int(i)) - except: - raise self.Error("'%s' is not a valid number" % (i,)) - self.widths=w - - def _terminal_width(self): - """Works out the terminal width which is used for word wrapping - some output (eg .help)""" - try: - if sys.platform=="win32": - import ctypes, struct - h=ctypes.windll.kernel32.GetStdHandle(-12) # -12 is stderr - buf=ctypes.create_string_buffer(22) - if ctypes.windll.kernel32.GetConsoleScreenBufferInfo(h, buf): - _,_,_,_,_,left,top,right,bottom,_,_=struct.unpack("hhhhHhhhhhh", buf.raw) - return right-left - raise Exception() - else: - # posix - import struct, fcntl, termios - s=struct.pack('HHHH', 0,0,0,0) - x=fcntl.ioctl(2, termios.TIOCGWINSZ, s) - return struct.unpack('HHHH', x)[1] - except: - try: - v=int(os.getenv("COLUMNS")) - if v<10: - return 80 - return v - except: - return 80 - - def push_output(self): - """Saves the current output settings onto a stack. See - :meth:`pop_output` for more details as to why you would use - this.""" - o={} - for k in "separator", "header", "nullvalue", "output", "widths", "truncate": - o[k]=getattr(self, k) - self._output_stack.append(o) - - def pop_output(self): - """Restores most recently pushed output. There are many - output parameters such as nullvalue, mode - (list/tcl/html/insert etc), column widths, header etc. If you - temporarily need to change some settings then - :meth:`push_output`, change the settings and then pop the old - ones back. - - A simple example is implementing a command like .dump. Push - the current output, change the mode to insert so we get SQL - inserts printed and then pop to go back to what was there - before. - - """ - # first item should always be present - assert len(self._output_stack) - if len(self._output_stack)==1: - o=self._output_stack[0] - else: - o=self._output_stack.pop() - for k,v in o.items(): - setattr(self,k,v) - - def _append_input_description(self): - """When displaying an error in :meth:`handle_exception` we - want to give context such as when the commands being executed - came from a .read command (which in turn could execute another - .read). - """ - if self.interactive: - return - res=[] - res.append("Line %d" % (self.input_line_number,)) - res.append(": "+getattr(self.stdin, "name", "")) - self._input_descriptions.append(" ".join(res)) - - def fixup_backslashes(self, s): - """Implements the various backlash sequences in s such as - turning backslash t into a tab. - - This function is needed because shlex does not do it for us. - """ - if "\\" not in s: - return s - # See the resolve_backslashes function in SQLite shell source - res=[] - i=0 - while i=len(s): - raise self.Error("Backslash with nothing following") - c=s[i] - res.append({ - "\\": "\\", - "r": "\r", - "n": "\n", - "t": "\t" - }.get(c, None)) - i+=1 # advance again - if res[-1] is None: - raise self.Error("Unknown backslash sequence \\"+c) - return "".join(res) - - if sys.version_info<(3,0): - def write(self, dest, text): - """Writes text to dest. dest will typically be one of self.stdout or self.stderr.""" - # ensure text is unicode to catch codeset issues here - if type(text)!=unicode_type: - text=unicode_type(text) - try: - dest.write(text) - except UnicodeEncodeError: - ev=sys.exc_info()[1] - # See issue108 and try to work around it - if ev.args[0]=="ascii" and dest.encoding and ev.args[0]!=dest.encoding and hasattr(dest, "fileno") and \ - isinstance(dest.fileno(), int) and dest.fileno()>=0: - args=[dest.encoding,] - if dest.errors: - args.append(dest.errors) - dest.write(text.encode(*args)) - else: - raise - - _raw_input=raw_input - else: - def write(self, dest, text): - "Writes text to dest. dest will typically be one of self.stdout or self.stderr." - dest.write(text) - _raw_input=input - - def getline(self, prompt=""): - """Returns a single line of input (may be incomplete SQL) from self.stdin. - - If EOF is reached then return None. Do not include trailing - newline in return. - """ - self.stdout.flush() - self.stderr.flush() - try: - if self.interactive: - if self.stdin is sys.stdin: - c=self.colour.prompt, self.colour.prompt_ - if self._using_readline and sys.platform!="win32": - # these are needed so that readline knows they are non-printing characters - c="\x01"+c[0]+"\x02", "\x01"+c[1]+"\x02", - line=self._raw_input(c[0]+prompt+c[1])+"\n" # raw_input excludes newline - else: - self.write(self.stdout, prompt) - line=self.stdin.readline() # includes newline unless last line of file doesn't have one - else: - line=self.stdin.readline() # includes newline unless last line of file doesn't have one - self.input_line_number+=1 - if sys.version_info<(3,0): - if type(line)!=unicode_type: - enc=getattr(self.stdin, "encoding", self.encoding[0]) - if not enc: - enc=self.encoding[0] - line=line.decode(enc) - except EOFError: - return None - if len(line)==0: # always a \n on the end normally so this is EOF - return None - if line[-1]=="\n": - line=line[:-1] - return line - - def getcompleteline(self): - """Returns a complete input. - - For dot commands it will be one line. For SQL statements it - will be as many as is necessary to have a - :meth:`~apsw.complete` statement (ie semicolon terminated). - Returns None on end of file.""" - try: - self._completion_first=True - command=self.getline(self.prompt) - if command is None: - return None - if len(command.strip())==0: - return "" - if command[0]=="?": - command=".help "+command[1:] - # incomplete SQL? - while command[0]!="." and not apsw.complete(command): - self._completion_first=False - line=self.getline(self.moreprompt) - if line is None: # unexpected eof - raise self.Error("Incomplete SQL (line %d of %s): %s\n" % (self.input_line_number, getattr(self.stdin, "name", ""), command)) - if line in ("go", "/"): - break - command=command+"\n"+line - return command - except KeyboardInterrupt: - self.handle_interrupt() - return "" - - def handle_interrupt(self): - """Deal with keyboard interrupt (typically Control-C). It - will :meth:`~Connection.interrupt` the database and print"^C" if interactive.""" - self.db.interrupt() - if not self.bail and self.interactive: - self.write(self.stderr, "^C\n") - return - raise - - def process_complete_line(self, command): - """Given some text will call the appropriate method to process - it (eg :meth:`process_sql` or :meth:`process_command`)""" - try: - if len(command.strip())==0: - return - if command[0]==".": - self.process_command(command) - else: - self.process_sql(command) - except KeyboardInterrupt: - self.handle_interrupt() - - def push_input(self): - """Saves the current input paramaters to a stack. See :meth:`pop_input`.""" - d={} - for i in "interactive", "stdin", "input_line_number": - d[i]=getattr(self, i) - self._input_stack.append(d) - - def pop_input(self): - """Restore most recently pushed input parameters (interactive, - self.stdin, linenumber etc). Use this if implementing a - command like read. Push the current input, read the file and - then pop the input to go back to before. - """ - assert(len(self._input_stack))>1 - d=self._input_stack.pop() - for k,v in d.items(): - setattr(self, k, v) - - def complete(self, token, state): - """Return a possible completion for readline - - This function is called with state starting at zero to get the - first completion, then one/two/three etc until you return None. The best - implementation is to generate the list when state==0, save it, - and provide members on each increase. - - The default implementation extracts the current full input - from readline and then calls :meth:`complete_command` or - :meth:`complete_sql` as appropriate saving the results for - subsequent calls. - """ - if state==0: - import readline - # the whole line - line=readline.get_line_buffer() - # begining and end(+1) of the token in line - beg=readline.get_begidx() - end=readline.get_endidx() - # Are we matching a command? - try: - if self._completion_first and line.startswith("."): - self.completions=self.complete_command(line, token, beg, end) - else: - self.completions=self.complete_sql(line, token, beg, end) - except: - # Readline swallows any exceptions we raise. We - # shouldn't be raising any so this is to catch that - import traceback - traceback.print_exc() - raise - - if state>len(self.completions): - return None - return self.completions[state] - - # Taken from https://sqlite.org/lang_keywords.html - _sqlite_keywords="""ABORTADD AFTER ALL ALTER ANALYZE AND AS ASC ATTACH AUTOINCREMENT - BEFORE BEGIN BETWEEN BY CASCADE CASE CAST CHECK COLLATE COLUMN COMMIT - CONFLICT CONSTRAINT CREATE CROSS CURRENT_DATE CURRENT_TIME - CURRENT_TIMESTAMP DATABASE DEFAULT DEFERRABLE DEFERRED DELETE DESC - DETACH DISTINCT DROP EACH ELSE END ESCAPE EXCEPT EXCLUSIVE EXISTS - EXPLAIN FAIL FOR FOREIGN FROM FULL GLOB GROUP HAVING IF IGNORE - IMMEDIATE IN INDEX INDEXED INITIALLY INNER INSERT INSTEAD INTERSECT - INTO IS ISNULL JOIN KEY LEFT LIKE LIMIT MATCH NATURAL NOT NOTNULL NULL - OF OFFSET ON OR ORDER OUTER PLAN PRAGMA PRIMARY QUERY RAISE REFERENCES - REGEXP REINDEX RELEASE RENAME REPLACE RESTRICT RIGHT ROLLBACK ROW - SAVEPOINT SELECT SET TABLE TEMP TEMPORARY THEN TO TRANSACTION TRIGGER - UNION UNIQUE UPDATE USING VACUUM VALUES VIEW VIRTUAL WHEN WHERE""".split() - # reserved words need to be quoted. Only a subset of the above are reserved - # but what the heck - _sqlite_reserved=_sqlite_keywords - # add a space after each of them except functions which get parentheses - _sqlite_keywords=[x+(" ", "(")[x in ("VALUES", "CAST")] for x in _sqlite_keywords] - - _sqlite_special_names="""_ROWID_ OID ROWID SQLITE_MASTER - SQLITE_SEQUENCE""".split() - - _sqlite_functions="""abs( changes() char( coalesce( glob( ifnull( - hex( instr( last_insert_rowid() length( like( - load_extension( lower( ltrim( max( min( nullif( quote( - random() randomblob( replace( round( rtrim( soundex( - sqlite_compileoption_get( sqlite_compileoption_used( - sqlite_source_id() sqlite_version() substr( total_changes() - trim( typeof( unicode( upper( zeroblob( date( time( datetime( - julianday( strftime( avg( count( group_concat( sum( total(""".split() - - _pragmas_bool=("yes", "true", "on", "no", "false", "off") - _pragmas={"application_id": None, - "auto_vacuum=": ("NONE", "FULL", "INCREMENTAL"), - "automatic_index=": _pragmas_bool, - "cache_size=": None, - "case_sensitive_like=": _pragmas_bool, - "checkpoint_fullfsync=": _pragmas_bool, - "collation_list": None, - "compile_options": None, - "database_list": None, - "default_cache_size=": None, - "encoding=": None, - # ('"UTF-8"', '"UTF-16"', '"UTF-16le"', '"UTF16-16be"'), - # too hard to get " to be part of token just in this special case - "foreign_key_check": None, - "foreign_key_list(": None, - "foreign_keys": _pragmas_bool, - "freelist_count": None, - "fullfsync=": _pragmas_bool, - "ignore_check_constraints": _pragmas_bool, - "incremental_vacuum(": None, - "index_info(": None, - "index_list(": None, - "integrity_check": None, - "journal_mode=": ("DELETE", "TRUNCATE", "PERSIST", "MEMORY", "OFF", "WAL"), - "journal_size_limit=": None, - "legacy_file_format=": _pragmas_bool, - "locking_mode=": ("NORMAL", "EXCLUSIVE"), - "max_page_count=": None, - "page_count;": None, - "page_size=": None, - "quick_check": None, - "read_uncommitted=": _pragmas_bool, - "recursive_triggers=": _pragmas_bool, - "reverse_unordered_selects=": _pragmas_bool, - "schema_version": None, - "secure_delete=": _pragmas_bool, - "shrink_memory": None, - "synchronous=": ("OFF", "NORMAL", "FULL"), - "table_info(": None, - "temp_store=": ("DEFAULT", "FILE", "MEMORY"), - "temp_store_directory=": None, - "wal_autocheckpoint=": None, - "wal_checkpoint": None, - "writable_schema": _pragmas_bool, - } - - def _get_prev_tokens(self, line, end): - "Returns the tokens prior to pos end in the line" - return re.findall(r'"?\w+"?', line[:end]) - - def complete_sql(self, line, token, beg, end): - """Provide some completions for SQL - - :param line: The current complete input line - :param token: The word readline is looking for matches - :param beg: Integer offset of token in line - :param end: Integer end of token in line - :return: A list of completions, or an empty list if none - """ - if self._completion_cache is None: - cur=self.db.cursor() - collations=[row[1] for row in cur.execute("pragma collation_list")] - databases=[row[1] for row in cur.execute("pragma database_list")] - other=[] - for db in databases: - if db=="temp": - master="sqlite_temp_master" - else: - master="[%s].sqlite_master" % (db,) - for row in cur.execute("select * from "+master).fetchall(): - for col in (1,2): - if row[col] not in other and not row[col].startswith("sqlite_"): - other.append(row[col]) - if row[0]=="table": - try: - for table in cur.execute("pragma [%s].table_info([%s])" % (db, row[1],)).fetchall(): - if table[1] not in other: - other.append(table[1]) - for item in table[2].split(): - if item not in other: - other.append(item) - except apsw.SQLError: - # See https://code.google.com/p/apsw/issues/detail?id=86 - pass - - self._completion_cache=[self._sqlite_keywords, self._sqlite_functions, self._sqlite_special_names, collations, databases, other] - for i in range(len(self._completion_cache)): - self._completion_cache[i].sort() - - # be somewhat sensible about pragmas - if "pragma " in line.lower(): - t=self._get_prev_tokens(line.lower(), end) - - # pragma foo = bar - if len(t)>2 and t[-3]=="pragma": - # t[-2] should be a valid one - for p in self._pragmas: - if p.replace("=","")==t[-2]: - vals=self._pragmas[p] - if not vals: - return [] - return [x+";" for x in vals if x.startswith(token)] - # at equals? - if len(t)>1 and t[-2]=="pragma" and line[:end].replace(" ","").endswith("="): - for p in self._pragmas: - if p.replace("=","")==t[-1]: - vals=self._pragmas[p] - if not vals: - return [] - return vals - # pragma foo - if len(t)>1 and t[-2]=="pragma": - res=[x for x in self._pragmas.keys() if x.startswith(token)] - res.sort() - return res - - # pragma - if len(t) and t[-1]=="pragma": - res=list(self._pragmas.keys()) - res.sort() - return res - - # This is currently not context sensitive (eg it doesn't look - # to see if last token was 'FROM' and hence next should only - # be table names. That is a SMOP like pragmas above - res=[] - ut=token.upper() - for corpus in self._completion_cache: - for word in corpus: - if word.upper().startswith(ut): - # potential match - now match case - if word.startswith(token): # exact - if word not in res: - res.append(word) - elif word.lower().startswith(token): # lower - if word.lower() not in res: - res.append(word.lower()) - elif word.upper().startswith(token): # upper - if word.upper() not in res: - res.append(word.upper()) - else: - # match letter by letter otherwise readline mangles what was typed in - w=token+word[len(token):] - if w not in res: - res.append(w) - return res - - _builtin_commands=None - - def complete_command(self, line, token, beg, end): - """Provide some completions for dot commands - - :param line: The current complete input line - :param token: The word readline is looking for matches - :param beg: Integer offset of token in line - :param end: Integer end of token in line - :return: A list of completions, or an empty list if none - """ - if not self._builtin_commands: - self._builtin_commands=["."+x[len("command_"):] for x in dir(self) if x.startswith("command_") and x!="command_headers"] - if beg==0: - # some commands don't need a space because they take no - # params but who cares? - return [x+" " for x in self._builtin_commands if x.startswith(token)] - return None - - def get_resource_usage(self): - """Return a dict of various numbers (ints or floats). The - .timer command shows the difference between before and after - results of what this returns by calling :meth:`display_timing`""" - if sys.platform=="win32": - import ctypes, time, platform - ctypes.windll.kernel32.GetProcessTimes.argtypes=[ - platform.architecture()[0]=='64bit' and ctypes.c_int64 or ctypes.c_int32, - ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p] - - # All 4 out params have to be present. FILETIME is really - # just a 64 bit quantity in 100 nanosecond granularity - dummy=ctypes.c_ulonglong() - utime=ctypes.c_ulonglong() - stime=ctypes.c_ulonglong() - rc=ctypes.windll.kernel32.GetProcessTimes( - ctypes.windll.kernel32.GetCurrentProcess(), - ctypes.byref(dummy), # creation time - ctypes.byref(dummy), # exit time - ctypes.byref(stime), - ctypes.byref(utime)) - if rc: - return {'Wall clock': time.time(), - 'User time': float(utime.value)/10000000, - 'System time': float(stime.value)/10000000} - return {} - else: - import resource, time - r=resource.getrusage(resource.RUSAGE_SELF) - res={'Wall clock': time.time()} - for i,desc in (("utime", "User time"), - ("stime", "System time"), - ("maxrss", "Max rss"), - ("idrss", "Memory"), - ("isrss", "Stack"), - ("ixrss", "Shared Memory"), - ("minflt", "PF (no I/O)"), - ("majflt", "PF (I/O)"), - ("inblock", "Blocks in"), - ("oublock", "Blocks out"), - ("nsignals", "Signals"), - ("nvcsw", "Voluntary context switches"), - ("nivcsw", "Involunary context switches"), - ("msgrcv", "Messages received"), - ("msgsnd", "Messages sent"), - ("nswap", "Swaps"), - ): - f="ru_"+i - if hasattr(r, f): - res[desc]=getattr(r,f) - return res - - def display_timing(self, b4, after): - """Writes the difference between b4 and after to self.stderr. - The data is dictionaries returned from - :meth:`get_resource_usage`.""" - v=list(b4.keys()) - for i in after: - if i not in v: - v.append(i) - v.sort() - for k in v: - if k in b4 and k in after: - one=b4[k] - two=after[k] - val=two-one - if val: - if type(val)==float: - self.write(self.stderr, "+ %s: %.4f\n" % (k, val)) - else: - self.write(self.stderr, "+ %s: %d\n" % (k, val)) - - # Colour support - - def _out_colour(self): - # Sets up color for output. Input being interactive doesn't - # matter. This method needs to be called on all changes to - # output. - if getattr(self.stdout, "isatty", False) and self.stdout.isatty(): - self.colour=self._colours[self.colour_scheme] - else: - self.colour=self._colours["off"] - - # This class returns an empty string for all undefined attributes - # so that it doesn't matter if a colour scheme leaves something - # out. - class _colourscheme: - - def __init__(self, **kwargs): - for k,v in kwargs.items(): - setattr(self, k, v) - - def __nonzero__(self): - return True - - def __str__(self): - return "_colourscheme("+str(self.__dict__)+")" - - def __getattr__(self, k): - return "" - - def colour_value(self, val, formatted): - self.colour - if val is None: - return self.vnull+formatted+self.vnull_ - if isinstance(val, Shell._basestring): - return self.vstring+formatted+self.vstring_ - if isinstance(val, Shell._binary_type): - return self.vblob+formatted+self.vblob_ - # must be a number - we don't distinguish between float/int - return self.vnumber+formatted+self.vnumber_ - - # The colour definitions - the convention is the name to turn - # something on and the name with an underscore suffix to turn it - # off - d=_colourscheme(**dict([(v, "\x1b["+str(n)+"m") for n,v in {0: "reset", 1: "bold", 4: "underline", 22: "bold_", 24: "underline_", - 7: "inverse", 27: "inverse_", - 30: "fg_black", 31: "fg_red", 32: "fg_green", 33: "fg_yellow", 34: "fg_blue", 35: "fg_magenta", 36: "fg_cyan", 37: "fg_white", 39: "fg_", - 40: "bg_black", 41: "bg_red", 42: "bg_green", 43: "bg_yellow", 44: "bg_blue", 45: "bg_magenta", 46: "bg_cyan", 47: "bg_white", 49: "bg_"}.items()])) - - _colours={"off": _colourscheme(colour_value=lambda x,y: y)} - - _colours["default"]=_colourscheme(prompt=d.bold, prompt_=d.bold_, - error=d.fg_red+d.bold, error_=d.bold_+d.fg_, - intro=d.fg_blue+d.bold, intro_=d.bold_+d.fg_, - summary=d.fg_blue+d.bold, summary_=d.bold_+d.fg_, - header=sys.platform=="win32" and d.inverse or d.underline, - header_=sys.platform=="win32" and d.inverse_ or d.underline_, - vnull=d.fg_red, vnull_=d.fg_, - vstring=d.fg_yellow, vstring_=d.fg_, - vblob=d.fg_blue, vblob_=d.fg_, - vnumber=d.fg_magenta, vnumber_=d.fg_) - if sys.platform=="win32": - if not _win_colour: - for k in _colours: - _colours[k]=_colours["off"] - # unpollute namespace - del d - del _colourscheme - try: - del n - del x - del v - except: - pass - - -def main(): - # Docstring must start on second line so dedenting works correctly - """ - Call this to run the interactive shell. It automatically passes - in sys.argv[1:] and exits Python when done. - - """ - try: - s=Shell() - _,_,cmds=s.process_args(sys.argv[1:]) - if len(cmds)==0: - s.cmdloop() - except: - v=sys.exc_info()[1] - if getattr(v, "_handle_exception_saw_this", False): - pass - else: - # Where did this exception come from? - import traceback - traceback.print_exc() - sys.exit(1) - -if __name__=='__main__': - main() diff --git a/src/calibre/utils/date.py b/src/calibre/utils/date.py index d518da9ee4..396ed9e7b4 100644 --- a/src/calibre/utils/date.py +++ b/src/calibre/utils/date.py @@ -11,7 +11,7 @@ from datetime import datetime, time as dtime, timedelta, MINYEAR, MAXYEAR from functools import partial from calibre import strftime -from calibre.constants import iswindows, isosx, plugins +from calibre.constants import iswindows, isosx, plugins, preferred_encoding from calibre.utils.iso8601 import utc_tz, local_tz, UNDEFINED_DATE from calibre.utils.localization import lcdata from polyglot.builtins import unicode_type @@ -101,6 +101,8 @@ def parse_date(date_string, assume_utc=False, as_utc=True, default=None): from dateutil.parser import parse if not date_string: return UNDEFINED_DATE + if isinstance(date_string, bytes): + date_string = date_string.decode(preferred_encoding, 'replace') if default is None: func = datetime.utcnow if assume_utc else datetime.now default = func().replace(day=15, hour=0, minute=0, second=0, microsecond=0, diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py index 953840639a..e8a54c6f4f 100644 --- a/src/calibre/utils/formatter_functions.py +++ b/src/calibre/utils/formatter_functions.py @@ -132,7 +132,7 @@ class FormatterFunction(object): def eval_(self, formatter, kwargs, mi, locals, *args): ret = self.evaluate(formatter, kwargs, mi, locals, *args) - if isinstance(ret, (str, unicode_type)): + if isinstance(ret, (bytes, unicode_type)): return ret if isinstance(ret, list): return ','.join(ret) diff --git a/src/calibre/utils/ipc/simple_worker.py b/src/calibre/utils/ipc/simple_worker.py index bb721a5279..decaa9d554 100644 --- a/src/calibre/utils/ipc/simple_worker.py +++ b/src/calibre/utils/ipc/simple_worker.py @@ -253,8 +253,8 @@ def offload_worker(env={}, priority='normal', cwd=None): def compile_code(src): import re, io if not isinstance(src, unicode_type): - match = re.search(r'coding[:=]\s*([-\w.]+)', src[:200]) - enc = match.group(1) if match else 'utf-8' + match = re.search(br'coding[:=]\s*([-\w.]+)', src[:200]) + enc = match.group(1).decode('utf-8') if match else 'utf-8' src = src.decode(enc) # Python complains if there is a coding declaration in a unicode string src = re.sub(r'^#.*coding\s*[:=]\s*([-\w.]+)', '#', src, flags=re.MULTILINE) diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index 0b08171b6e..a55f4795bf 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -32,8 +32,8 @@ def compile_recipe(src): :return: Recipe class or None, if no such class was found in src ''' if not isinstance(src, unicode_type): - match = re.search(r'coding[:=]\s*([-\w.]+)', src[:200]) - enc = match.group(1) if match else 'utf-8' + match = re.search(br'coding[:=]\s*([-\w.]+)', src[:200]) + enc = match.group(1).decode('utf-8') if match else 'utf-8' src = src.decode(enc) # Python complains if there is a coding declaration in a unicode string src = re.sub(r'^#.*coding\s*[:=]\s*([-\w.]+)', '#', src.lstrip(u'\ufeff'), flags=re.MULTILINE) diff --git a/src/polyglot/builtins.py b/src/polyglot/builtins.py index 61a4bb3ccf..d4fbe45933 100644 --- a/src/polyglot/builtins.py +++ b/src/polyglot/builtins.py @@ -25,6 +25,7 @@ if is_py3: zip = builtins.__dict__['zip'] map = builtins.__dict__['map'] filter = builtins.__dict__['filter'] + range = builtins.__dict__['range'] codepoint_to_chr = chr unicode_type = str @@ -47,6 +48,7 @@ else: """) from future_builtins import zip, map, filter # noqa + range = xrange import __builtin__ as builtins codepoint_to_chr = unichr From 6ad22b392bfc7038d3e643194baaad32f1dce85f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Mar 2019 09:21:07 +0530 Subject: [PATCH 0295/2613] pep8 and misc fixes --- src/calibre/db/lazy.py | 3 ++ src/calibre/devices/udisks.py | 1 + src/calibre/devices/utils.py | 4 +-- src/calibre/ebooks/chardet.py | 1 + .../ebooks/conversion/plugins/epub_input.py | 4 ++- src/calibre/ebooks/conversion/utils.py | 8 +++-- src/calibre/ebooks/docx/container.py | 3 +- src/calibre/ebooks/docx/tables.py | 1 + src/calibre/ebooks/htmlz/oeb2html.py | 2 +- src/calibre/ebooks/lrf/lrfparser.py | 1 + src/calibre/ebooks/metadata/mobi.py | 4 +-- src/calibre/ebooks/metadata/rtf.py | 2 +- src/calibre/ebooks/pdb/ereader/reader132.py | 4 +-- src/calibre/ebooks/txt/markdownml.py | 4 +-- src/calibre/gui2/dbus_export/menu2.py | 5 +++- src/calibre/gui2/dbus_export/utils.py | 2 ++ .../gui2/device_drivers/configwidget.py | 6 +++- src/calibre/gui2/dialogs/authors_edit.py | 1 + .../gui2/dialogs/device_category_editor.py | 8 ++--- src/calibre/gui2/dialogs/opml.py | 7 +++-- src/calibre/gui2/dialogs/plugin_updater.py | 2 +- src/calibre/gui2/dialogs/progress.py | 1 + src/calibre/gui2/dnd.py | 3 +- src/calibre/gui2/init.py | 29 ++++++++++--------- src/calibre/gui2/library/models.py | 6 ++-- src/calibre/gui2/library/views.py | 8 ++--- src/calibre/gui2/proceed.py | 1 + src/calibre/gui2/search_restriction_mixin.py | 2 +- src/calibre/gui2/tweak_book/search.py | 2 +- src/calibre/gui2/wizard/send_email.py | 10 +++---- src/calibre/library/save_to_disk.py | 21 +++++++------- src/calibre/spell/dictionary.py | 2 +- src/calibre/utils/fonts/scanner.py | 2 ++ src/calibre/utils/html2text.py | 6 ++-- src/calibre/utils/open_with/osx.py | 2 +- src/calibre/utils/soupparser.py | 2 +- 36 files changed, 99 insertions(+), 71 deletions(-) diff --git a/src/calibre/db/lazy.py b/src/calibre/db/lazy.py index 79c552d8db..ffa71f8612 100644 --- a/src/calibre/db/lazy.py +++ b/src/calibre/db/lazy.py @@ -106,6 +106,7 @@ class FormatsList(MutableBase, MutableSequence): # }}} + # Lazy metadata getters {{{ ga = object.__getattribute__ sa = object.__setattr__ @@ -223,6 +224,7 @@ def has_cover_getter(dbref, book_id, cache): cache['has_cover'] = ret = _('Yes') if db.field_for('cover', book_id, default_value=False) else '' return ret + fmt_custom = lambda x:list(x) if isinstance(x, tuple) else x @@ -276,6 +278,7 @@ def user_categories_getter(proxy_metadata): ret = cache['user_categories'] = db.user_categories_for_books((book_id,), {book_id:proxy_metadata})[book_id] return ret + getters = { 'title':simple_getter('title', _('Unknown')), 'title_sort':simple_getter('sort', _('Unknown')), diff --git a/src/calibre/devices/udisks.py b/src/calibre/devices/udisks.py index 7240444f2a..1d90d0f779 100644 --- a/src/calibre/devices/udisks.py +++ b/src/calibre/devices/udisks.py @@ -10,6 +10,7 @@ import os, re from polyglot.builtins import unicode_type + def node_mountpoint(node): def de_mangle(raw): diff --git a/src/calibre/devices/utils.py b/src/calibre/devices/utils.py index 506527c668..2240874393 100644 --- a/src/calibre/devices/utils.py +++ b/src/calibre/devices/utils.py @@ -59,11 +59,11 @@ def build_template_regexp(template): try: template = template.rpartition('/')[2] - return re.compile(re.sub('{([^}]*)}', f, template) + '([_\d]*$)') + return re.compile(re.sub('{([^}]*)}', f, template) + r'([_\d]*$)') except: prints(u'Failed to parse template: %r'%template) template = u'{title} - {authors}' - return re.compile(re.sub('{([^}]*)}', f, template) + '([_\d]*$)') + return re.compile(re.sub('{([^}]*)}', f, template) + r'([_\d]*$)') def create_upload_path(mdata, fname, template, sanitize, diff --git a/src/calibre/ebooks/chardet.py b/src/calibre/ebooks/chardet.py index 2d0dd7efe2..6d08cb61fd 100644 --- a/src/calibre/ebooks/chardet.py +++ b/src/calibre/ebooks/chardet.py @@ -61,6 +61,7 @@ def substitute_entites(raw): from calibre import xml_entity_to_unicode return ENTITY_PATTERN.sub(xml_entity_to_unicode, raw) + _CHARSET_ALIASES = {"macintosh" : "mac-roman", "x-sjis" : "shift-jis"} diff --git a/src/calibre/ebooks/conversion/plugins/epub_input.py b/src/calibre/ebooks/conversion/plugins/epub_input.py index a0216ac9f3..a94e02150e 100644 --- a/src/calibre/ebooks/conversion/plugins/epub_input.py +++ b/src/calibre/ebooks/conversion/plugins/epub_input.py @@ -368,7 +368,9 @@ class EPUBInput(InputFormatPlugin): def add_from_li(li, parent): href = text = None for x in li.iterchildren(XHTML('a'), XHTML('span')): - text = etree.tostring(x, method='text', encoding=unicode_type, with_tail=False).strip() or ' '.join(x.xpath('descendant-or-self::*/@title')).strip() + text = etree.tostring( + x, method='text', encoding=unicode_type, with_tail=False).strip() or ' '.join( + x.xpath('descendant-or-self::*/@title')).strip() href = x.get('href') if href: if href.startswith('#'): diff --git a/src/calibre/ebooks/conversion/utils.py b/src/calibre/ebooks/conversion/utils.py index cdae26aed9..e7f3b99dbb 100644 --- a/src/calibre/ebooks/conversion/utils.py +++ b/src/calibre/ebooks/conversion/utils.py @@ -309,9 +309,11 @@ class HeuristicProcessor(object): if float(self.chapters_with_title) / float(hits) > .5: title_req = True strict_title = False - self.log.debug(unicode_type(type_name)+" had "+unicode_type(hits)+" hits - "+unicode_type(self.chapters_no_title)+" chapters with no title, "+ - unicode_type(self.chapters_with_title)+" chapters with titles, "+ - unicode_type(float(self.chapters_with_title) / float(hits))+" percent. ") + self.log.debug( + unicode_type(type_name)+" had "+unicode_type(hits)+ + " hits - "+unicode_type(self.chapters_no_title)+" chapters with no title, "+ + unicode_type(self.chapters_with_title)+" chapters with titles, "+ + unicode_type(float(self.chapters_with_title) / float(hits))+" percent. ") if type_name == 'common': analysis_result.append([chapter_type, n_lookahead_req, strict_title, ignorecase, title_req, log_message, type_name]) elif self.min_chapters <= hits < max_chapters or self.min_chapters < 3 > hits: diff --git a/src/calibre/ebooks/docx/container.py b/src/calibre/ebooks/docx/container.py index 8ba8b2ff83..06913667fc 100644 --- a/src/calibre/ebooks/docx/container.py +++ b/src/calibre/ebooks/docx/container.py @@ -264,6 +264,7 @@ class DOCX(object): except EnvironmentError: pass + if __name__ == '__main__': d = DOCX(sys.argv[-1], extract=False) - print (d.metadata) + print(d.metadata) diff --git a/src/calibre/ebooks/docx/tables.py b/src/calibre/ebooks/docx/tables.py index b2cb4b2346..056869aa6a 100644 --- a/src/calibre/ebooks/docx/tables.py +++ b/src/calibre/ebooks/docx/tables.py @@ -95,6 +95,7 @@ def read_indent(parent, dest, XPath, get): ans = _read_width(cs, get) setattr(dest, 'indent', ans) + border_edges = ('left', 'top', 'right', 'bottom', 'insideH', 'insideV') diff --git a/src/calibre/ebooks/htmlz/oeb2html.py b/src/calibre/ebooks/htmlz/oeb2html.py index 5797d31ae4..7a77f4c64e 100644 --- a/src/calibre/ebooks/htmlz/oeb2html.py +++ b/src/calibre/ebooks/htmlz/oeb2html.py @@ -272,7 +272,7 @@ class OEB2HTMLInlineCSSizer(OEB2HTML): # as a page break and remove all other page break types that might be set. style_a = 'page-break-before: always; %s' % re.sub('page-break-[^:]+:[^;]+;?', '', style_a) # Remove unnecessary spaces. - style_a = re.sub('\s{2,}', ' ', style_a).strip() + style_a = re.sub(r'\s{2,}', ' ', style_a).strip() tags.append(tag) # Remove attributes we won't want. diff --git a/src/calibre/ebooks/lrf/lrfparser.py b/src/calibre/ebooks/lrf/lrfparser.py index 1760de269a..4915bba235 100644 --- a/src/calibre/ebooks/lrf/lrfparser.py +++ b/src/calibre/ebooks/lrf/lrfparser.py @@ -168,5 +168,6 @@ def main(args=sys.argv, logger=None): logger.info(_('LRS written to ')+opts.out) return 0 + if __name__ == '__main__': sys.exit(main()) diff --git a/src/calibre/ebooks/metadata/mobi.py b/src/calibre/ebooks/metadata/mobi.py index 26dcbe4793..3c64bf07c4 100644 --- a/src/calibre/ebooks/metadata/mobi.py +++ b/src/calibre/ebooks/metadata/mobi.py @@ -335,8 +335,8 @@ class MetadataUpdater(object): self.original_exth_records.pop(rec[0]) if self.type != "BOOKMOBI": - raise MobiError("Setting metadata only supported for MOBI files of type 'BOOK'.\n" - "\tThis is a %r file of type %r" % (self.type[0:4], self.type[4:8])) + raise MobiError("Setting metadata only supported for MOBI files of type 'BOOK'.\n" + "\tThis is a %r file of type %r" % (self.type[0:4], self.type[4:8])) recs = [] added_501 = False diff --git a/src/calibre/ebooks/metadata/rtf.py b/src/calibre/ebooks/metadata/rtf.py index 31b36ac850..084f0d8ae9 100644 --- a/src/calibre/ebooks/metadata/rtf.py +++ b/src/calibre/ebooks/metadata/rtf.py @@ -19,7 +19,7 @@ publisher_pat = re.compile(r'\{\\info.*?\{\\manager(.*?)(? 0: html += '

%s

' % _('Footnotes') footnoteids = re.findall( - '\w+(?=\x00)', self.section_data(self.header_record.footnote_offset).decode('cp1252' if self.encoding is None else self.encoding)) + '\\w+(?=\x00)', self.section_data(self.header_record.footnote_offset).decode('cp1252' if self.encoding is None else self.encoding)) for fid, i in enumerate(range(self.header_record.footnote_offset + 1, self.header_record.footnote_offset + self.header_record.footnote_count)): self.log.debug('Extracting footnote page %i' % i) if fid < len(footnoteids): @@ -141,7 +141,7 @@ class Reader132(FormatReader): if self.header_record.sidebar_count > 0: html += '

%s

' % _('Sidebar') sidebarids = re.findall( - '\w+(?=\x00)', self.section_data(self.header_record.sidebar_offset).decode('cp1252' if self.encoding is None else self.encoding)) + '\\w+(?=\x00)', self.section_data(self.header_record.sidebar_offset).decode('cp1252' if self.encoding is None else self.encoding)) for sid, i in enumerate(range(self.header_record.sidebar_offset + 1, self.header_record.sidebar_offset + self.header_record.sidebar_count)): self.log.debug('Extracting sidebar page %i' % i) if sid < len(sidebarids): diff --git a/src/calibre/ebooks/txt/markdownml.py b/src/calibre/ebooks/txt/markdownml.py index 7cef2b734b..6f121de4c1 100644 --- a/src/calibre/ebooks/txt/markdownml.py +++ b/src/calibre/ebooks/txt/markdownml.py @@ -77,8 +77,8 @@ class MarkdownMLizer(OEB2HTML): text = re.sub('(?msu)\n{7,}', '\n' * 6, text) # Remove blank lines at beginning and end of document. - text = re.sub('^\s*', '', text) - text = re.sub('\s*$', '\n\n', text) + text = re.sub(r'^\s*', '', text) + text = re.sub(r'\s*$', '\n\n', text) return text diff --git a/src/calibre/gui2/dbus_export/menu2.py b/src/calibre/gui2/dbus_export/menu2.py index 08ee421557..a110f3b94b 100644 --- a/src/calibre/gui2/dbus_export/menu2.py +++ b/src/calibre/gui2/dbus_export/menu2.py @@ -23,7 +23,10 @@ from polyglot.builtins import unicode_type def add_window_properties_for_menu(widget, object_path, bus): op = unicode_type(object_path) - set_X_window_properties(widget.effectiveWinId(), _UNITY_OBJECT_PATH=op, _GTK_UNIQUE_BUS_NAME=unicode_type(bus.get_unique_name()), _GTK_MENUBAR_OBJECT_PATH=op) + set_X_window_properties( + widget.effectiveWinId(), _UNITY_OBJECT_PATH=op, + _GTK_UNIQUE_BUS_NAME=unicode_type(bus.get_unique_name()), + _GTK_MENUBAR_OBJECT_PATH=op) class DBusMenu(QObject): diff --git a/src/calibre/gui2/dbus_export/utils.py b/src/calibre/gui2/dbus_export/utils.py index 3a47eda50f..0c5bd16d65 100644 --- a/src/calibre/gui2/dbus_export/utils.py +++ b/src/calibre/gui2/dbus_export/utils.py @@ -20,6 +20,7 @@ def log(*args, **kw): print('DBusExport:', *args, **kw) kw['file'].flush() + from calibre.ptempfile import PersistentTemporaryDirectory @@ -60,6 +61,7 @@ class IconCache(object): # dir to decide whether it should look for new icons in the theme dir. os.utime(self.icon_theme_path, None) + _icon_cache = None diff --git a/src/calibre/gui2/device_drivers/configwidget.py b/src/calibre/gui2/device_drivers/configwidget.py index 38c2b55e1e..61458c0871 100644 --- a/src/calibre/gui2/device_drivers/configwidget.py +++ b/src/calibre/gui2/device_drivers/configwidget.py @@ -136,7 +136,11 @@ class ConfigWidget(QWidget, Ui_ConfigWidget): self.columns.setCurrentRow(idx+1) def format_map(self): - formats = [unicode_type(self.columns.item(i).data(Qt.UserRole) or '') for i in range(self.columns.count()) if self.columns.item(i).checkState()==Qt.Checked] + formats = [ + unicode_type(self.columns.item(i).data(Qt.UserRole) or '') + for i in range(self.columns.count()) + if self.columns.item(i).checkState()==Qt.Checked + ] return formats def use_subdirs(self): diff --git a/src/calibre/gui2/dialogs/authors_edit.py b/src/calibre/gui2/dialogs/authors_edit.py index e020d071af..5cc479b348 100644 --- a/src/calibre/gui2/dialogs/authors_edit.py +++ b/src/calibre/gui2/dialogs/authors_edit.py @@ -197,6 +197,7 @@ class AuthorsEdit(QDialog): authors[la] = author self.author.setText('') + if __name__ == '__main__': app = QApplication([]) d = AuthorsEdit(['kovid goyal', 'divok layog', 'other author'], ['kovid goyal', 'other author']) diff --git a/src/calibre/gui2/dialogs/device_category_editor.py b/src/calibre/gui2/dialogs/device_category_editor.py index 9cb9cd1230..38f17849ae 100644 --- a/src/calibre/gui2/dialogs/device_category_editor.py +++ b/src/calibre/gui2/dialogs/device_category_editor.py @@ -85,10 +85,10 @@ class DeviceCategoryEditor(QDialog, Ui_DeviceCategoryEditor): def finish_editing(self, item): if not item.text(): - error_dialog(self, _('Item is blank'), - _('An item cannot be set to nothing. Delete it instead.')).exec_() - item.setText(item.previous_text()) - return + error_dialog(self, _('Item is blank'), + _('An item cannot be set to nothing. Delete it instead.')).exec_() + item.setText(item.previous_text()) + return if item.text() != item.initial_text(): id_ = int(item.data(Qt.UserRole)) self.to_rename[id_] = unicode_type(item.text()) diff --git a/src/calibre/gui2/dialogs/opml.py b/src/calibre/gui2/dialogs/opml.py index 0f35b81b3d..7f7efc8a22 100644 --- a/src/calibre/gui2/dialogs/opml.py +++ b/src/calibre/gui2/dialogs/opml.py @@ -139,10 +139,11 @@ class ImportOPML(QDialog): QDialog.accept(self) + if __name__ == '__main__': import sys for group in import_opml(open(sys.argv[-1], 'rb').read()): - print (group.title) + print(group.title) for title, url in group.feeds: - print ('\t%s - %s' % (title, url)) - print () + print('\t%s - %s' % (title, url)) + print() diff --git a/src/calibre/gui2/dialogs/plugin_updater.py b/src/calibre/gui2/dialogs/plugin_updater.py index 18355b16b4..34616b56c8 100644 --- a/src/calibre/gui2/dialogs/plugin_updater.py +++ b/src/calibre/gui2/dialogs/plugin_updater.py @@ -843,7 +843,7 @@ class PluginUpdaterDialog(SizePersistedDialog): if heading_node.text_content().lower().find('version history') != -1: div_node = spoiler_node.xpath('div')[0] text = html.tostring(div_node, method='html', encoding=unicode_type) - return re.sub('', '
', text) + return re.sub(r'', '
', text) except: if DEBUG: prints('======= MobileRead Parse Error =======') diff --git a/src/calibre/gui2/dialogs/progress.py b/src/calibre/gui2/dialogs/progress.py index bc50921431..239f8d4c88 100644 --- a/src/calibre/gui2/dialogs/progress.py +++ b/src/calibre/gui2/dialogs/progress.py @@ -169,6 +169,7 @@ class BlockingBusy(QDialog): def reject(self): pass # Cannot cancel this dialog + if __name__ == '__main__': from PyQt5.Qt import QTimer app = QApplication([]) diff --git a/src/calibre/gui2/dnd.py b/src/calibre/gui2/dnd.py index 2ff0668146..59dd40f5e4 100644 --- a/src/calibre/gui2/dnd.py +++ b/src/calibre/gui2/dnd.py @@ -28,6 +28,7 @@ def image_extensions(): image_extensions.ans = [bytes(x).decode('utf-8') for x in QImageReader.supportedImageFormats()] return image_extensions.ans + # This is present for compatibility with old plugins, do not use IMAGE_EXTENSIONS = ['jpg', 'jpeg', 'gif', 'png', 'bmp'] @@ -181,7 +182,7 @@ def dnd_has_extension(md, extensions, allow_all_extensions=False): f = unicode_type(f) raw = data_as_string(f, md) prints(f, len(raw), repr(raw[:300]), '\n') - print () + print() if has_firefox_ext(md, extensions): return True urls = urls_from_md(md) diff --git a/src/calibre/gui2/init.py b/src/calibre/gui2/init.py index e03c35b7a2..769781fbcd 100644 --- a/src/calibre/gui2/init.py +++ b/src/calibre/gui2/init.py @@ -7,23 +7,24 @@ __docformat__ = 'restructuredtext en' import functools -from PyQt5.Qt import (Qt, QApplication, QStackedWidget, QMenu, QTimer, - QSizePolicy, QStatusBar, QLabel, QFont, QAction, QTabBar, QStyle, - QVBoxLayout, QWidget, QSplitter, QToolButton, QIcon, QPainter, QStyleOption) +from PyQt5.Qt import ( + QAction, QApplication, QFont, QIcon, QLabel, QMenu, QPainter, QSizePolicy, + QSplitter, QStackedWidget, QStatusBar, QStyle, QStyleOption, Qt, QTabBar, QTimer, + QToolButton, QVBoxLayout, QWidget +) +from calibre.constants import __appname__, get_version, isosx +from calibre.customize.ui import find_plugin +from calibre.gui2 import config, error_dialog, gprefs, is_widescreen, open_url +from calibre.gui2.book_details import BookDetails +from calibre.gui2.layout_menu import LayoutMenu +from calibre.gui2.library.alternate_views import GridView +from calibre.gui2.library.views import BooksView, DeviceBooksView +from calibre.gui2.notify import get_notifier +from calibre.gui2.tag_browser.ui import TagBrowserWidget +from calibre.gui2.widgets import LayoutButton, Splitter from calibre.utils.config import prefs from calibre.utils.icu import sort_key -from calibre.constants import (__appname__, preferred_encoding, - get_version) -from calibre.gui2 import config, is_widescreen, gprefs, error_dialog, open_url -from calibre.gui2.library.views import BooksView, DeviceBooksView -from calibre.gui2.library.alternate_views import GridView -from calibre.gui2.widgets import Splitter, LayoutButton -from calibre.gui2.tag_browser.ui import TagBrowserWidget -from calibre.gui2.book_details import BookDetails -from calibre.gui2.notify import get_notifier -from calibre.gui2.layout_menu import LayoutMenu -from calibre.customize.ui import find_plugin from calibre.utils.localization import localize_website_link from polyglot.builtins import unicode_type diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index e5d3f028ec..c11d8be97c 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -778,7 +778,7 @@ class BooksModel(QAbstractTableModel): # {{{ def func(idx): val = fffunc(field_obj, idfunc(idx), default_value=0) or 0 - if val is 0: + if val == 0: return None ans = u'%.1f' % (val * sz_mult) return (u'<0.1' if ans == u'0.0' else ans) @@ -1027,8 +1027,8 @@ class BooksModel(QAbstractTableModel): # {{{ return (self.headers[self.column_map[section]]) return None if DEBUG and role == Qt.ToolTipRole and orientation == Qt.Vertical: - col = self.db.field_metadata['uuid']['rec_index'] - return (_('This book\'s UUID is "{0}"').format(self.db.data[section][col])) + col = self.db.field_metadata['uuid']['rec_index'] + return (_('This book\'s UUID is "{0}"').format(self.db.data[section][col])) if role == Qt.DisplayRole: # orientation is vertical return (section+1) diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index dca3c9e050..484084094f 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -436,10 +436,10 @@ class BooksView(QTableView): # {{{ m = ans.addMenu(_('Change text alignment for %s') % name) al = self._model.alignment_map.get(col, 'left') for x, t in (('left', _('Left')), ('right', _('Right')), ('center', _('Center'))): - a = m.addAction(t, partial(handler, action='align_'+x)) - if al == x: - a.setCheckable(True) - a.setChecked(True) + a = m.addAction(t, partial(handler, action='align_'+x)) + if al == x: + a.setCheckable(True) + a.setChecked(True) if not isinstance(view, DeviceBooksView): col_font = self._model.styled_columns.get(col) m = ans.addMenu(_('Change font style for %s') % name) diff --git a/src/calibre/gui2/proceed.py b/src/calibre/gui2/proceed.py index d06211c6a0..c7d99846cc 100644 --- a/src/calibre/gui2/proceed.py +++ b/src/calibre/gui2/proceed.py @@ -418,5 +418,6 @@ def main(): QTimer.singleShot(10, doit) app.exec_() + if __name__ == '__main__': main() diff --git a/src/calibre/gui2/search_restriction_mixin.py b/src/calibre/gui2/search_restriction_mixin.py index b6c4bd5c7d..cfb6d57409 100644 --- a/src/calibre/gui2/search_restriction_mixin.py +++ b/src/calibre/gui2/search_restriction_mixin.py @@ -302,7 +302,7 @@ class CreateVirtualLibrary(QDialog): # {{{ _('The search found no books, so the virtual library ' 'will be empty. Do you really want to use that search?'), default_yes=False): - return + return self.library_name = n self.library_search = v diff --git a/src/calibre/gui2/tweak_book/search.py b/src/calibre/gui2/tweak_book/search.py index b45f566b2c..fb4cc483df 100644 --- a/src/calibre/gui2/tweak_book/search.py +++ b/src/calibre/gui2/tweak_book/search.py @@ -34,7 +34,7 @@ from calibre.gui2.tweak_book.widgets import BusyCursor from calibre.gui2.widgets2 import FlowLayout, HistoryComboBox from calibre.utils.icu import primary_contains from calibre.ebooks.conversion.search_replace import REGEX_FLAGS, compile_regular_expression -src/calibre/gui2/tweak_book/preferences.py +from polyglot.builtins import unicode_type # The search panel {{{ diff --git a/src/calibre/gui2/wizard/send_email.py b/src/calibre/gui2/wizard/send_email.py index b77cb68c70..e3e60a0fd4 100644 --- a/src/calibre/gui2/wizard/send_email.py +++ b/src/calibre/gui2/wizard/send_email.py @@ -281,11 +281,11 @@ class SendEmail(QWidget, Ui_Form): _('You must either set both the username and password for ' 'the mail server or no username and no password at all.')).exec_() return False - if not (username and password) and not question_dialog(self, - _('Are you sure?'), - _('No username and password set for mailserver. Most ' - ' mailservers need a username and password. Are you sure?')): - return False + if not (username and password) and not question_dialog( + self, _('Are you sure?'), + _('No username and password set for mailserver. Most ' + ' mailservers need a username and password. Are you sure?')): + return False conf = smtp_prefs() conf.set('from_', from_) conf.set('relay_host', host if host else None) diff --git a/src/calibre/library/save_to_disk.py b/src/calibre/library/save_to_disk.py index cfb774c186..930c275a17 100644 --- a/src/calibre/library/save_to_disk.py +++ b/src/calibre/library/save_to_disk.py @@ -437,18 +437,17 @@ def update_serialized_metadata(book, common_data=None): plugboard_cache = common_data from calibre.customize.ui import apply_null_metadata with apply_null_metadata: + fmts = [fp.rpartition(os.extsep)[-1] for fp in book['fmts']] + mi, cdata = read_serialized_metadata(book) - fmts = [fp.rpartition(os.extsep)[-1] for fp in book['fmts']] - mi, cdata = read_serialized_metadata(book) + def report_error(fmt, tb): + result.append((fmt, tb)) - def report_error(fmt, tb): - result.append((fmt, tb)) - - for fmt, fmtpath in zip(fmts, book['fmts']): - try: - with lopen(fmtpath, 'r+b') as stream: - update_metadata(mi, fmt, stream, (), cdata, error_report=report_error, plugboard_cache=plugboard_cache) - except Exception: - report_error(fmt, traceback.format_exc()) + for fmt, fmtpath in zip(fmts, book['fmts']): + try: + with lopen(fmtpath, 'r+b') as stream: + update_metadata(mi, fmt, stream, (), cdata, error_report=report_error, plugboard_cache=plugboard_cache) + except Exception: + report_error(fmt, traceback.format_exc()) return result diff --git a/src/calibre/spell/dictionary.py b/src/calibre/spell/dictionary.py index 6845a5cc3d..a49ee8a04c 100644 --- a/src/calibre/spell/dictionary.py +++ b/src/calibre/spell/dictionary.py @@ -177,7 +177,7 @@ class Dictionaries(object): def __init__(self): self.remove_hyphenation = re.compile('[\u2010-]+') - self.negative_pat = re.compile('-[.\d+]') + self.negative_pat = re.compile(r'-[.\d+]') self.fix_punctuation_pat = re.compile(r'''[:.]''') self.dictionaries = {} self.word_cache = {} diff --git a/src/calibre/utils/fonts/scanner.py b/src/calibre/utils/fonts/scanner.py index 2b1130ae24..16a3fa504e 100644 --- a/src/calibre/utils/fonts/scanner.py +++ b/src/calibre/utils/fonts/scanner.py @@ -398,6 +398,7 @@ class FontScanner(Thread): prints() prints() + font_scanner = FontScanner() font_scanner.start() @@ -407,5 +408,6 @@ def force_rescan(): font_scanner.force_rescan() font_scanner.run() + if __name__ == '__main__': font_scanner.dump_fonts() diff --git a/src/calibre/utils/html2text.py b/src/calibre/utils/html2text.py index 6541e26f78..c3d386fad9 100644 --- a/src/calibre/utils/html2text.py +++ b/src/calibre/utils/html2text.py @@ -121,8 +121,8 @@ def fixattrs(attrs): def onlywhite(line): """Return true if the line does only consist of whitespace characters.""" for c in line: - if c is not ' ' and c is not ' ': - return c is ' ' + if c != ' ' and c != ' ': + return c == ' ' return line @@ -136,7 +136,7 @@ def optwrap(text): newlines = 0 for para in text.split("\n"): if len(para) > 0: - if para[0] is not ' ' and para[0] is not '-' and para[0] is not '*': + if para[0] != ' ' and para[0] != '-' and para[0] != '*': for line in wrap(para, BODY_WIDTH): result += line + "\n" result += "\n" diff --git a/src/calibre/utils/open_with/osx.py b/src/calibre/utils/open_with/osx.py index 6b02aef6d3..68f5a66862 100644 --- a/src/calibre/utils/open_with/osx.py +++ b/src/calibre/utils/open_with/osx.py @@ -329,7 +329,7 @@ def get_icon(path, pixmap_to_data=None, as_data=False, size=64): from PyQt5.Qt import QImage, Qt names.sort(key=numeric_sort_key) for name in names: - m = re.search('(\d+)x\d+', name) + m = re.search(r'(\d+)x\d+', name) if m is not None and int(m.group(1)) >= size: ans = QImage(os.path.join(iconset, name)) if not ans.isNull(): diff --git a/src/calibre/utils/soupparser.py b/src/calibre/utils/soupparser.py index 6de014b0f5..8d798385a3 100644 --- a/src/calibre/utils/soupparser.py +++ b/src/calibre/utils/soupparser.py @@ -118,7 +118,7 @@ except ImportError: from htmlentitydefs import name2codepoint import re -handle_entities = re.compile("&(\w+);").sub +handle_entities = re.compile(r"&(\w+);").sub def unescape(string): From ccfe12e4f33ba29bd000f90799b359900604ae96 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 13 Mar 2019 00:36:42 -0400 Subject: [PATCH 0296/2613] Port winutil plugin to build on python2/python3 --- src/calibre/utils/windows/winutil.c | 38 +++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/src/calibre/utils/windows/winutil.c b/src/calibre/utils/windows/winutil.c index a68cf22307..ffb511fcb4 100644 --- a/src/calibre/utils/windows/winutil.c +++ b/src/calibre/utils/windows/winutil.c @@ -387,8 +387,9 @@ winutil_strftime(PyObject *self, PyObject *args) return NULL; } +static char winutil_doc[] = "Defines utility methods to interface with windows."; -static PyMethodDef WinutilMethods[] = { +static PyMethodDef winutil_methods[] = { {"special_folder_path", winutil_folder_path, METH_VARARGS, "special_folder_path(csidl_id) -> path\n\n" "Get paths to common system folders. " @@ -461,13 +462,33 @@ be a unicode string. Returns unicode strings." {NULL, NULL, 0, NULL} }; -CALIBRE_MODINIT_FUNC -initwinutil(void) { +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&winutil_module) +static struct PyModuleDef winutil_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "winutil", + /* m_doc */ winutil_doc, + /* m_size */ -1, + /* m_methods */ winutil_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; +CALIBRE_MODINIT_FUNC PyInit_winutil(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("winutil", winutil_methods, winutil_doc) +CALIBRE_MODINIT_FUNC initwinutil(void) { +#endif + PyObject *m; - m = Py_InitModule3("winutil", WinutilMethods, - "Defines utility methods to interface with windows." - ); - if (m == NULL) return; + m = INITMODULE; + + if (m == NULL) { + INITERROR; + } PyModule_AddIntConstant(m, "CSIDL_ADMINTOOLS", CSIDL_ADMINTOOLS); PyModule_AddIntConstant(m, "CSIDL_APPDATA", CSIDL_APPDATA); @@ -491,4 +512,7 @@ initwinutil(void) { PyModule_AddIntConstant(m, "CSIDL_STARTUP", CSIDL_STARTUP); PyModule_AddIntConstant(m, "CSIDL_COMMON_STARTUP", CSIDL_COMMON_STARTUP); +#if PY_MAJOR_VERSION >= 3 + return m; +#endif } From 3acac495d0576798d5698998919add06275e3364 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 13 Mar 2019 00:42:00 -0400 Subject: [PATCH 0297/2613] Port wpd plugin to build on python2/python3 --- src/calibre/devices/mtp/windows/device.cpp | 77 +++++++++++----------- src/calibre/devices/mtp/windows/wpd.cpp | 47 ++++++++++--- 2 files changed, 76 insertions(+), 48 deletions(-) diff --git a/src/calibre/devices/mtp/windows/device.cpp b/src/calibre/devices/mtp/windows/device.cpp index fa8606a8aa..a8d76959bc 100644 --- a/src/calibre/devices/mtp/windows/device.cpp +++ b/src/calibre/devices/mtp/windows/device.cpp @@ -204,43 +204,42 @@ static PyGetSetDef Device_getsetters[] = { PyTypeObject wpd::DeviceType = { // {{{ - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "wpd.Device", /*tp_name*/ - sizeof(Device), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - "Device", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - Device_methods, /* tp_methods */ - 0, /* tp_members */ - Device_getsetters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "wpd.Device", + /* tp_basicsize */ sizeof(Device), + /* tp_itemsize */ 0, + /* tp_dealloc */ (destructor)dealloc, + /* tp_print */ 0, + /* tp_getattr */ 0, + /* tp_setattr */ 0, + /* tp_compare */ 0, + /* tp_repr */ 0, + /* tp_as_number */ 0, + /* tp_as_sequence */ 0, + /* tp_as_mapping */ 0, + /* tp_hash */ 0, + /* tp_call */ 0, + /* tp_str */ 0, + /* tp_getattro */ 0, + /* tp_setattro */ 0, + /* tp_as_buffer */ 0, + /* tp_flags */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, + /* tp_doc */ "Device", + /* tp_traverse */ 0, + /* tp_clear */ 0, + /* tp_richcompare */ 0, + /* tp_weaklistoffset */ 0, + /* tp_iter */ 0, + /* tp_iternext */ 0, + /* tp_methods */ Device_methods, + /* tp_members */ 0, + /* tp_getset */ Device_getsetters, + /* tp_base */ 0, + /* tp_dict */ 0, + /* tp_descr_get */ 0, + /* tp_descr_set */ 0, + /* tp_dictoffset */ 0, + /* tp_init */ (initproc)init, + /* tp_alloc */ 0, + /* tp_new */ 0, }; // }}} diff --git a/src/calibre/devices/mtp/windows/wpd.cpp b/src/calibre/devices/mtp/windows/wpd.cpp index 57b5a99f20..67868e6472 100644 --- a/src/calibre/devices/mtp/windows/wpd.cpp +++ b/src/calibre/devices/mtp/windows/wpd.cpp @@ -161,6 +161,8 @@ wpd_device_info(PyObject *self, PyObject *args) { return ans; } // }}} +static char wpd_doc[] = "Interface to the WPD windows service."; + static PyMethodDef wpd_methods[] = { {"init", wpd_init, METH_VARARGS, "init(name, major_version, minor_version, revision)\n\n Initializes this module. Call this method *only* in the thread in which you intend to use this module. Also remember to call uninit before the thread exits." @@ -181,33 +183,60 @@ static PyMethodDef wpd_methods[] = { {NULL, NULL, 0, NULL} }; +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&wpd_module) +static struct PyModuleDef wpd_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "wpd", + /* m_doc */ wpd_doc, + /* m_size */ -1, + /* m_methods */ wpd_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; +CALIBRE_MODINIT_FUNC PyInit_wpd(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("wpd", wpd_methods, wpd_doc) +CALIBRE_MODINIT_FUNC initwpd(void) { +#endif -CALIBRE_MODINIT_FUNC -initwpd(void) { PyObject *m; wpd::DeviceType.tp_new = PyType_GenericNew; if (PyType_Ready(&wpd::DeviceType) < 0) return; - m = Py_InitModule3("wpd", wpd_methods, "Interface to the WPD windows service."); - if (m == NULL) return; + m = INITMODULE; + if (m == NULL) { + INITERROR; + } WPDError = PyErr_NewException("wpd.WPDError", NULL, NULL); - if (WPDError == NULL) return; + if (WPDError == NULL) { + INITERROR; + } PyModule_AddObject(m, "WPDError", WPDError); NoWPD = PyErr_NewException("wpd.NoWPD", NULL, NULL); - if (NoWPD == NULL) return; + if (NoWPD == NULL) { + INITERROR; + } PyModule_AddObject(m, "NoWPD", NoWPD); WPDFileBusy = PyErr_NewException("wpd.WPDFileBusy", NULL, NULL); - if (WPDFileBusy == NULL) return; + if (WPDFileBusy == NULL) { + INITERROR; + } PyModule_AddObject(m, "WPDFileBusy", WPDFileBusy); Py_INCREF(&DeviceType); PyModule_AddObject(m, "Device", (PyObject *)&DeviceType); +#if PY_MAJOR_VERSION >= 3 + return m; +#endif } - - From aa56c26f71cd7bbc2036c498bf2f9fdf6dc902e9 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 13 Mar 2019 00:42:43 -0400 Subject: [PATCH 0298/2613] Port winfonts plugin to build on python2/python3 --- src/calibre/utils/fonts/winfonts.cpp | 41 ++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/src/calibre/utils/fonts/winfonts.cpp b/src/calibre/utils/fonts/winfonts.cpp index bafc8b5728..f3abc68cef 100644 --- a/src/calibre/utils/fonts/winfonts.cpp +++ b/src/calibre/utils/fonts/winfonts.cpp @@ -208,8 +208,9 @@ static PyObject* remove_system_font(PyObject *self, PyObject *args) { return Py_BuildValue("O", ok); } -static -PyMethodDef winfonts_methods[] = { +static char winfonts_doc[] = "Windows font API"; + +static PyMethodDef winfonts_methods[] = { {"enum_font_families", enum_font_families, METH_VARARGS, "enum_font_families()\n\n" "Enumerate all regular (not italic/bold/etc. variants) font families on the system. Note there will be multiple entries for every family (corresponding to each charset of the font)." @@ -239,14 +240,32 @@ PyMethodDef winfonts_methods[] = { }; -CALIBRE_MODINIT_FUNC -initwinfonts(void) { +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&winfonts_module) +static struct PyModuleDef winfonts_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "winfonts", + /* m_doc */ winfonts_doc, + /* m_size */ -1, + /* m_methods */ winfonts_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; +CALIBRE_MODINIT_FUNC PyInit_winfonts(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("winfonts", winfonts_methods, winfonts_doc) +CALIBRE_MODINIT_FUNC initwinfonts(void) { +#endif + PyObject *m; - m = Py_InitModule3( - "winfonts", winfonts_methods, - "Windows font API" - ); - if (m == NULL) return; + m = INITMODULE; + if (m == NULL) { + INITERROR; + } PyModule_AddIntMacro(m, FW_DONTCARE); PyModule_AddIntMacro(m, FW_THIN); @@ -263,4 +282,8 @@ initwinfonts(void) { PyModule_AddIntMacro(m, FW_ULTRABOLD); PyModule_AddIntMacro(m, FW_HEAVY); PyModule_AddIntMacro(m, FW_BLACK); + +#if PY_MAJOR_VERSION >= 3 + return m; +#endif } From 190b8c73d8486580f9ea75d2df00443021428aca Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 13 Mar 2019 00:43:47 -0400 Subject: [PATCH 0299/2613] Port usbobserver plugin to build on python2/python3 --- src/calibre/devices/usbobserver/usbobserver.c | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/calibre/devices/usbobserver/usbobserver.c b/src/calibre/devices/usbobserver/usbobserver.c index 791559f637..801feb1804 100644 --- a/src/calibre/devices/usbobserver/usbobserver.c +++ b/src/calibre/devices/usbobserver/usbobserver.c @@ -457,6 +457,8 @@ end: return ans; } +static char usbobserver_doc[] = "USB interface glue for OSX."; + static PyMethodDef usbobserver_methods[] = { {"get_usb_devices", usbobserver_get_usb_devices, METH_VARARGS, "Get list of connected USB devices. Returns a list of tuples. Each tuple is of the form (vendor_id, product_id, bcd, manufacturer, product, serial number)." @@ -483,7 +485,31 @@ static PyMethodDef usbobserver_methods[] = { {NULL, NULL, 0, NULL} }; -CALIBRE_MODINIT_FUNC -initusbobserver(void) { - (void) Py_InitModule("usbobserver", usbobserver_methods); +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&usbobserver_module) +static struct PyModuleDef usbobserver_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "usbobserver", + /* m_doc */ usbobserver_doc, + /* m_size */ -1, + /* m_methods */ usbobserver_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; +CALIBRE_MODINIT_FUNC PyInit_usbobserver(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("usbobserver", usbobserver_methods, usbobserver_doc) +CALIBRE_MODINIT_FUNC initusbobserver(void) { +#endif + + PyObject *m = NULL; + m = INITMODULE; + +#if PY_MAJOR_VERSION >= 3 + return m; +#endif } From 1d5c89f69be41adaea2fee05440e88c4aea9602c Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 13 Mar 2019 00:45:08 -0400 Subject: [PATCH 0300/2613] Port libusb plugin to build on python2/python3 --- src/calibre/devices/libusb/libusb.c | 47 ++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/src/calibre/devices/libusb/libusb.c b/src/calibre/devices/libusb/libusb.c index a4611367b2..4ec6b3b1e6 100644 --- a/src/calibre/devices/libusb/libusb.c +++ b/src/calibre/devices/libusb/libusb.c @@ -115,6 +115,8 @@ static PyObject* get_devices(PyObject *self, PyObject *args) { return ans; } +static char libusb_doc[] = "Interface to libusb."; + static PyMethodDef libusb_methods[] = { {"get_devices", get_devices, METH_VARARGS, "get_devices()\n\nGet the list of USB devices on the system." @@ -123,26 +125,55 @@ static PyMethodDef libusb_methods[] = { {NULL, NULL, 0, NULL} }; -CALIBRE_MODINIT_FUNC -initlibusb(void) { +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&libusb_module) +static struct PyModuleDef libusb_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "libusb", + /* m_doc */ libusb_doc, + /* m_size */ -1, + /* m_methods */ libusb_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; +CALIBRE_MODINIT_FUNC PyInit_libusb(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("libusb", libusb_methods, libusb_doc) +CALIBRE_MODINIT_FUNC initlibusb(void) { +#endif + PyObject *m; // We deliberately use the default context. This is the context used by // libmtp and we want to ensure that the busnum/devnum numbers are the same // here and for libmtp. - if(libusb_init(NULL) != 0) return; + if(libusb_init(NULL) != 0) { + INITERROR; + } Error = PyErr_NewException("libusb.Error", NULL, NULL); - if (Error == NULL) return; + if (Error == NULL) { + INITERROR; + } cache = PyDict_New(); - if (cache == NULL) return; + if (cache == NULL) { + INITERROR; + } - m = Py_InitModule3("libusb", libusb_methods, "Interface to libusb."); - if (m == NULL) return; + m = INITMODULE; + if (m == NULL) { + INITERROR; + } PyModule_AddObject(m, "Error", Error); PyModule_AddObject(m, "cache", cache); +#if PY_MAJOR_VERSION >= 3 + return m; +#endif } - From 9139fccbf4f155a4b91164da39989c91e35e05f7 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 13 Mar 2019 00:46:18 -0400 Subject: [PATCH 0301/2613] Port cpalmdoc plugin to build on python2/python3 --- src/calibre/ebooks/compression/palmdoc.c | 39 +++++++++++++++++++----- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/src/calibre/ebooks/compression/palmdoc.c b/src/calibre/ebooks/compression/palmdoc.c index 623bb10f67..1f8296fe30 100644 --- a/src/calibre/ebooks/compression/palmdoc.c +++ b/src/calibre/ebooks/compression/palmdoc.c @@ -190,7 +190,9 @@ cpalmdoc_compress(PyObject *self, PyObject *args) { return ans; } -static PyMethodDef cPalmdocMethods[] = { +static char cPalmdoc_doc[] = "Compress and decompress palmdoc strings."; + +static PyMethodDef cPalmdoc_methods[] = { {"decompress", cpalmdoc_decompress, METH_VARARGS, "decompress(bytestring) -> decompressed bytestring\n\n" "Decompress a palmdoc compressed byte string. " @@ -203,11 +205,34 @@ static PyMethodDef cPalmdocMethods[] = { {NULL, NULL, 0, NULL} }; -CALIBRE_MODINIT_FUNC -initcPalmdoc(void) { +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&cPalmdoc_module) +static struct PyModuleDef cPalmdoc_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "cPalmdoc", + /* m_doc */ cPalmdoc_doc, + /* m_size */ -1, + /* m_methods */ cPalmdoc_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; +CALIBRE_MODINIT_FUNC PyInit_cPalmdoc(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("cPalmdoc", cPalmdoc_methods, cPalmdoc_doc) +CALIBRE_MODINIT_FUNC initcPalmdoc(void) { +#endif + PyObject *m; - m = Py_InitModule3("cPalmdoc", cPalmdocMethods, - "Compress and decompress palmdoc strings." - ); - if (m == NULL) return; + m = INITMODULE; + if (m == NULL) { + INITERROR; + } + +#if PY_MAJOR_VERSION >= 3 + return m; +#endif } From 1a687a3d57f6ed753cf6aa16bcd416b94ff16f37 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 13 Mar 2019 00:46:49 -0400 Subject: [PATCH 0302/2613] Port lzma_binding plugin to build on python2/python3 --- src/lzma/lzma_binding.c | 46 ++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/src/lzma/lzma_binding.c b/src/lzma/lzma_binding.c index d02f14c523..69b3612c43 100644 --- a/src/lzma/lzma_binding.c +++ b/src/lzma/lzma_binding.c @@ -393,6 +393,8 @@ exit: // }}} +static char lzma_binding_doc[] = "Bindings to the LZMA (de)compression C code"; + static PyMethodDef lzma_binding_methods[] = { {"decompress2", decompress2, METH_VARARGS, "Decompress an LZMA2 encoded block, of unknown compressed size (reads till LZMA2 EOS marker)" @@ -417,24 +419,54 @@ static PyMethodDef lzma_binding_methods[] = { {NULL, NULL, 0, NULL} }; +#if PY_MAJOR_VERSION >= 3 +#define INITERROR return NULL +#define INITMODULE PyModule_Create(&lzma_binding_module) +static struct PyModuleDef lzma_binding_module = { + /* m_base */ PyModuleDef_HEAD_INIT, + /* m_name */ "lzma_binding", + /* m_doc */ lzma_binding_doc, + /* m_size */ -1, + /* m_methods */ lzma_binding_methods, + /* m_slots */ 0, + /* m_traverse */ 0, + /* m_clear */ 0, + /* m_free */ 0, +}; +CALIBRE_MODINIT_FUNC PyInit_lzma_binding(void) { +#else +#define INITERROR return +#define INITMODULE Py_InitModule3("lzma_binding", lzma_binding_methods, lzma_binding_doc) +CALIBRE_MODINIT_FUNC initlzma_binding(void) { +#endif -CALIBRE_MODINIT_FUNC -initlzma_binding(void) { PyObject *m = NULL, *preset_map = NULL, *temp = NULL; int i = 0; init_crc_table(); LZMAError = PyErr_NewException("lzma_binding.error", NULL, NULL); - if (!LZMAError) return; - m = Py_InitModule3("lzma_binding", lzma_binding_methods, "Bindings to the LZMA (de)compression C code"); - if (m == NULL) return; + if (!LZMAError) { + INITERROR; + } + m = INITMODULE; + if (m == NULL) { + INITERROR; + } preset_map = PyTuple_New(10); - if (preset_map == NULL) return; + if (preset_map == NULL) { + INITERROR; + } for (i = 0; i < 10; i++) { temp = get_lzma2_properties(i); - if (temp == NULL) return; + if (temp == NULL) { + INITERROR; + } PyTuple_SET_ITEM(preset_map, i, temp); } PyModule_AddObject(m, "preset_map", preset_map); Py_INCREF(LZMAError); PyModule_AddObject(m, "error", LZMAError); + +#if PY_MAJOR_VERSION >= 3 + return m; +#endif } From 2d21a8efa2adeed8003fde02009a813e6d644a6d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Mar 2019 12:04:09 +0530 Subject: [PATCH 0303/2613] Some more fixes for the unicode type Now replaced in all dynamically loaded code. Recipes/metadata sources/etc. In the case of recipes, since they get compiled by calibre we simply make the unicode/unichr names available, no need for any changes to the actual recipes themselves. --- imgsrc/srv/generate.py | 2 +- manual/conf.py | 2 +- manual/custom.py | 2 +- .../plugin_examples/interface_demo/config.py | 4 +- setup/__init__.py | 6 +- src/calibre/ebooks/BeautifulSoup.py | 18 +++--- src/calibre/ebooks/metadata/sources/amazon.py | 28 +++++----- src/calibre/ebooks/metadata/sources/cli.py | 2 +- src/calibre/ebooks/metadata/sources/douban.py | 2 +- .../ebooks/metadata/sources/edelweiss.py | 8 +-- src/calibre/ebooks/metadata/sources/google.py | 2 +- .../ebooks/metadata/sources/identify.py | 2 +- .../ebooks/metadata/sources/overdrive.py | 4 +- src/calibre/ebooks/metadata/sources/ozon.py | 30 +++++----- .../ebooks/metadata/sources/search_engines.py | 2 +- src/calibre/ebooks/textile/functions.py | 6 +- .../gui2/store/stores/biblio_plugin.py | 4 +- .../gui2/store/stores/chitanka_plugin.py | 8 ++- .../store/stores/ebooksgratuits_plugin.py | 3 +- .../gui2/store/stores/eknigi_plugin.py | 2 +- src/calibre/gui2/store/stores/kobo_plugin.py | 6 +- .../gui2/store/stores/litres_plugin.py | 4 +- .../stores/mobileread/adv_search_builder.py | 12 ++-- .../stores/mobileread/cache_update_thread.py | 2 +- .../gui2/store/stores/mobileread/models.py | 2 +- .../store/stores/mobileread/store_dialog.py | 2 +- src/calibre/utils/unicode_getpass.py | 56 ++++++++++--------- src/calibre/web/feeds/recipes/__init__.py | 6 +- src/css_selectors/parser.py | 22 ++++---- src/odf/attrconverters.py | 13 ++--- src/odf/element.py | 18 +++--- src/odf/odf2xhtml.py | 23 ++++---- src/tinycss/tests/__init__.py | 9 +-- 33 files changed, 158 insertions(+), 154 deletions(-) diff --git a/imgsrc/srv/generate.py b/imgsrc/srv/generate.py index c2a8ae9f14..c21c37d643 100644 --- a/imgsrc/srv/generate.py +++ b/imgsrc/srv/generate.py @@ -36,7 +36,7 @@ def merge(): for child in svg.iterchildren('*'): clone_node(child, symbol) ans.append(symbol) - ans = etree.tostring(ans, encoding=unicode, pretty_print=True, with_tail=False) + ans = etree.tostring(ans, encoding='unicode', pretty_print=True, with_tail=False) ans = re.sub(']+>', '', ans, count=1) return ans diff --git a/manual/conf.py b/manual/conf.py index 5ffab2fbb9..0649b64c63 100644 --- a/manual/conf.py +++ b/manual/conf.py @@ -168,7 +168,7 @@ def sort_languages(x): lc, name = x if lc == language: return '' - return sort_key(unicode(name)) + return sort_key(type(u'')(name)) html_context['other_languages'].sort(key=sort_languages) diff --git a/manual/custom.py b/manual/custom.py index 2f6a402bd4..2c9b31d514 100644 --- a/manual/custom.py +++ b/manual/custom.py @@ -198,7 +198,7 @@ def generate_ebook_convert_help(preamble, app): def update_cli_doc(name, raw, app): - if isinstance(raw, unicode): + if isinstance(raw, type(u'')): raw = raw.encode('utf-8') path = 'generated/%s/%s.rst' % (app.config.language, name) old_raw = open(path, 'rb').read() if os.path.exists(path) else '' diff --git a/manual/plugin_examples/interface_demo/config.py b/manual/plugin_examples/interface_demo/config.py index 4f87eba98b..a8cd4ab786 100644 --- a/manual/plugin_examples/interface_demo/config.py +++ b/manual/plugin_examples/interface_demo/config.py @@ -21,6 +21,7 @@ prefs = JSONConfig('plugins/interface_demo') # Set defaults prefs.defaults['hello_world_msg'] = 'Hello, World!' + class ConfigWidget(QWidget): def __init__(self): @@ -37,5 +38,4 @@ class ConfigWidget(QWidget): self.label.setBuddy(self.msg) def save_settings(self): - prefs['hello_world_msg'] = unicode(self.msg.text()) - + prefs['hello_world_msg'] = self.msg.text() diff --git a/setup/__init__.py b/setup/__init__.py index 0f9b840120..a6e86df9db 100644 --- a/setup/__init__.py +++ b/setup/__init__.py @@ -139,7 +139,7 @@ else: enc = preferred_encoding safe_encode = kwargs.get('safe_encode', False) for i, arg in enumerate(args): - if isinstance(arg, unicode): + if isinstance(arg, type(u'')): try: arg = arg.encode(enc) except UnicodeEncodeError: @@ -150,8 +150,8 @@ else: try: arg = str(arg) except ValueError: - arg = unicode(arg) - if isinstance(arg, unicode): + arg = type(u'')(arg) + if isinstance(arg, type(u'')): try: arg = arg.encode(enc) except UnicodeEncodeError: diff --git a/src/calibre/ebooks/BeautifulSoup.py b/src/calibre/ebooks/BeautifulSoup.py index dd2a6b80b3..d78376fb48 100644 --- a/src/calibre/ebooks/BeautifulSoup.py +++ b/src/calibre/ebooks/BeautifulSoup.py @@ -1795,41 +1795,41 @@ class UnicodeDammit: elif xml_data[:4] == '\x00\x3c\x00\x3f': # UTF-16BE sniffed_xml_encoding = 'utf-16be' - #xml_data = unicode(xml_data, 'utf-16be').encode('utf-8') + #xml_data = type(u'')(xml_data, 'utf-16be').encode('utf-8') elif (len(xml_data) >= 4) and (xml_data[:2] == '\xfe\xff') \ and (xml_data[2:4] != '\x00\x00'): # UTF-16BE with BOM sniffed_xml_encoding = 'utf-16be' - #xml_data = unicode(xml_data[2:], 'utf-16be').encode('utf-8') + #xml_data = type(u'')(xml_data[2:], 'utf-16be').encode('utf-8') elif xml_data[:4] == '\x3c\x00\x3f\x00': # UTF-16LE sniffed_xml_encoding = 'utf-16le' - #xml_data = unicode(xml_data, 'utf-16le').encode('utf-8') + #xml_data = type(u'')(xml_data, 'utf-16le').encode('utf-8') elif (len(xml_data) >= 4) and (xml_data[:2] == '\xff\xfe') and \ (xml_data[2:4] != '\x00\x00'): # UTF-16LE with BOM sniffed_xml_encoding = 'utf-16le' - #xml_data = unicode(xml_data[2:], 'utf-16le').encode('utf-8') + #xml_data = type(u'')(xml_data[2:], 'utf-16le').encode('utf-8') elif xml_data[:4] == '\x00\x00\x00\x3c': # UTF-32BE sniffed_xml_encoding = 'utf-32be' - #xml_data = unicode(xml_data, 'utf-32be').encode('utf-8') + #xml_data = type(u'')(xml_data, 'utf-32be').encode('utf-8') elif xml_data[:4] == '\x3c\x00\x00\x00': # UTF-32LE sniffed_xml_encoding = 'utf-32le' - #xml_data = unicode(xml_data, 'utf-32le').encode('utf-8') + #xml_data = type(u'')(xml_data, 'utf-32le').encode('utf-8') elif xml_data[:4] == '\x00\x00\xfe\xff': # UTF-32BE with BOM sniffed_xml_encoding = 'utf-32be' - #xml_data = unicode(xml_data[4:], 'utf-32be').encode('utf-8') + #xml_data = type(u'')(xml_data[4:], 'utf-32be').encode('utf-8') elif xml_data[:4] == '\xff\xfe\x00\x00': # UTF-32LE with BOM sniffed_xml_encoding = 'utf-32le' - #xml_data = unicode(xml_data[4:], 'utf-32le').encode('utf-8') + #xml_data = type(u'')(xml_data[4:], 'utf-32le').encode('utf-8') elif xml_data[:3] == '\xef\xbb\xbf': # UTF-8 with BOM sniffed_xml_encoding = 'utf-8' - #xml_data = unicode(xml_data[3:], 'utf-8').encode('utf-8') + #xml_data = type(u'')(xml_data[3:], 'utf-8').encode('utf-8') else: sniffed_xml_encoding = 'ascii' pass diff --git a/src/calibre/ebooks/metadata/sources/amazon.py b/src/calibre/ebooks/metadata/sources/amazon.py index 70f70b1052..da64255ee5 100644 --- a/src/calibre/ebooks/metadata/sources/amazon.py +++ b/src/calibre/ebooks/metadata/sources/amazon.py @@ -93,7 +93,7 @@ def parse_details_page(url, log, timeout, browser, domain): errmsg = root.xpath('//*[@id="errorMessage"]') if errmsg: msg = 'Failed to parse amazon details page: %r' % url - msg += tostring(errmsg, method='text', encoding=unicode).strip() + msg += tostring(errmsg, method='text', encoding='unicode').strip() log.error(msg) return @@ -466,7 +466,7 @@ class Worker(Thread): # Get details {{{ self.result_queue.put(mi) def totext(self, elem): - return self.tostring(elem, encoding=unicode, method='text').strip() + return self.tostring(elem, encoding='unicode', method='text').strip() def parse_title(self, root): h1 = root.xpath('//h1[@id="title"]') @@ -478,10 +478,10 @@ class Worker(Thread): # Get details {{{ tdiv = root.xpath('//h1[contains(@class, "parseasinTitle")]')[0] actual_title = tdiv.xpath('descendant::*[@id="btAsinTitle"]') if actual_title: - title = self.tostring(actual_title[0], encoding=unicode, + title = self.tostring(actual_title[0], encoding='unicode', method='text').strip() else: - title = self.tostring(tdiv, encoding=unicode, + title = self.tostring(tdiv, encoding='unicode', method='text').strip() ans = re.sub(r'[(\[].*[)\]]', '', title).strip() if not ans: @@ -508,7 +508,7 @@ class Worker(Thread): # Get details {{{ ''') for x in aname: x.tail = '' - authors = [self.tostring(x, encoding=unicode, method='text').strip() for x + authors = [self.tostring(x, encoding='unicode', method='text').strip() for x in aname] authors = [a for a in authors if a] return authors @@ -559,7 +559,7 @@ class Worker(Thread): # Get details {{{ for a in desc.xpath('descendant::a[@href]'): del a.attrib['href'] a.tag = 'span' - desc = self.tostring(desc, method='html', encoding=unicode).strip() + desc = self.tostring(desc, method='html', encoding='unicode').strip() # Encoding bug in Amazon data U+fffd (replacement char) # in some examples it is present in place of ' @@ -626,14 +626,14 @@ class Worker(Thread): # Get details {{{ spans = series.xpath('./span') if spans: raw = self.tostring( - spans[0], encoding=unicode, method='text', with_tail=False).strip() + spans[0], encoding='unicode', method='text', with_tail=False).strip() m = re.search(r'\s+([0-9.]+)$', raw.strip()) if m is not None: series_index = float(m.group(1)) s = series.xpath('./a[@id="series-page-link"]') if s: series = self.tostring( - s[0], encoding=unicode, method='text', with_tail=False).strip() + s[0], encoding='unicode', method='text', with_tail=False).strip() if series: ans = (series, series_index) # This is found on Kindle edition pages on amazon.com @@ -646,7 +646,7 @@ class Worker(Thread): # Get details {{{ a = span.xpath('./a[@href]') if a: series = self.tostring( - a[0], encoding=unicode, method='text', with_tail=False).strip() + a[0], encoding='unicode', method='text', with_tail=False).strip() if series: ans = (series, series_index) # This is found on newer Kindle edition pages on amazon.com @@ -659,14 +659,14 @@ class Worker(Thread): # Get details {{{ a = b.getparent().xpath('./a[@href]') if a: series = self.tostring( - a[0], encoding=unicode, method='text', with_tail=False).partition('(')[0].strip() + a[0], encoding='unicode', method='text', with_tail=False).partition('(')[0].strip() if series: ans = series, series_index if ans == (None, None): desc = root.xpath('//div[@id="ps-content"]/div[@class="buying"]') if desc: - raw = self.tostring(desc[0], method='text', encoding=unicode) + raw = self.tostring(desc[0], method='text', encoding='unicode') raw = re.sub(r'\s+', ' ', raw) match = self.series_pat.search(raw) if match is not None: @@ -1161,7 +1161,7 @@ class Amazon(Source): if not result_links: result_links = root.xpath(r'//li[starts-with(@id, "result_")]//a[@href and contains(@class, "s-access-detail-page")]') for a in result_links: - title = tostring(a, method='text', encoding=unicode) + title = tostring(a, method='text', encoding='unicode') if title_ok(title): url = a.get('href') if url.startswith('/'): @@ -1177,7 +1177,7 @@ class Amazon(Source): # New amazon markup links = div.xpath('descendant::h3/a[@href]') for a in links: - title = tostring(a, method='text', encoding=unicode) + title = tostring(a, method='text', encoding='unicode') if title_ok(title): url = a.get('href') if url.startswith('/'): @@ -1192,7 +1192,7 @@ class Amazon(Source): for td in root.xpath( r'//div[@id="Results"]/descendant::td[starts-with(@id, "search:Td:")]'): for a in td.xpath(r'descendant::td[@class="dataColumn"]/descendant::a[@href]/span[@class="srTitle"]/..'): - title = tostring(a, method='text', encoding=unicode) + title = tostring(a, method='text', encoding='unicode') if title_ok(title): url = a.get('href') if url.startswith('/'): diff --git a/src/calibre/ebooks/metadata/sources/cli.py b/src/calibre/ebooks/metadata/sources/cli.py index 6424ab5041..d7d5153cf9 100644 --- a/src/calibre/ebooks/metadata/sources/cli.py +++ b/src/calibre/ebooks/metadata/sources/cli.py @@ -99,7 +99,7 @@ def main(args=sys.argv): log = buf.getvalue() result = (metadata_to_opf(result) if opts.opf else - unicode(result).encode('utf-8')) + type(u'')(result).encode('utf-8')) if opts.verbose: print (log, file=sys.stderr) diff --git a/src/calibre/ebooks/metadata/sources/douban.py b/src/calibre/ebooks/metadata/sources/douban.py index 77b8b392f3..5248565b47 100644 --- a/src/calibre/ebooks/metadata/sources/douban.py +++ b/src/calibre/ebooks/metadata/sources/douban.py @@ -203,7 +203,7 @@ class Douban(Source): build_term('author', author_tokens)) t = 'search' q = q.strip() - if isinstance(q, unicode): + if isinstance(q, type(u'')): q = q.encode('utf-8') if not q: return None diff --git a/src/calibre/ebooks/metadata/sources/edelweiss.py b/src/calibre/ebooks/metadata/sources/edelweiss.py index fd6425eeac..79867ddcb7 100644 --- a/src/calibre/ebooks/metadata/sources/edelweiss.py +++ b/src/calibre/ebooks/metadata/sources/edelweiss.py @@ -31,7 +31,7 @@ def parse_html(raw): def astext(node): from lxml import etree - return etree.tostring(node, method='text', encoding=unicode, + return etree.tostring(node, method='text', encoding='unicode', with_tail=False).strip() @@ -110,7 +110,7 @@ class Worker(Thread): # {{{ for a in desc.xpath('descendant::a[@href]'): del a.attrib['href'] a.tag = 'span' - desc = etree.tostring(desc, method='html', encoding=unicode).strip() + desc = etree.tostring(desc, method='html', encoding='unicode').strip() # remove all attributes from tags desc = re.sub(r'<([a-zA-Z0-9]+)\s[^>]+>', r'<\1>', desc) @@ -160,7 +160,7 @@ def get_basic_data(browser, log, *skus): tags = [] rating = 0 for bar in row.xpath('descendant::*[contains(@class, "bgdColorCommunity")]/@style'): - m = re.search('width: (\d+)px;.*max-width: (\d+)px', bar) + m = re.search(r'width: (\d+)px;.*max-width: (\d+)px', bar) if m is not None: rating = float(m.group(1)) / float(m.group(2)) break @@ -283,7 +283,7 @@ class Edelweiss(Source): except Exception as e: log.exception('Failed to make identify query: %r'%query) return as_unicode(e) - items = re.search('window[.]items\s*=\s*(.+?);', raw) + items = re.search(r'window[.]items\s*=\s*(.+?);', raw) if items is None: log.error('Failed to get list of matching items') log.debug('Response text:') diff --git a/src/calibre/ebooks/metadata/sources/google.py b/src/calibre/ebooks/metadata/sources/google.py index acc85e177e..609fe51d9c 100644 --- a/src/calibre/ebooks/metadata/sources/google.py +++ b/src/calibre/ebooks/metadata/sources/google.py @@ -214,7 +214,7 @@ class GoogleBooks(Source): if author_tokens: q += ('+' if q else '') + build_term('author', author_tokens) - if isinstance(q, unicode): + if isinstance(q, type(u'')): q = q.encode('utf-8') if not q: return None diff --git a/src/calibre/ebooks/metadata/sources/identify.py b/src/calibre/ebooks/metadata/sources/identify.py index 2861f8435a..5fc4a5bfb0 100644 --- a/src/calibre/ebooks/metadata/sources/identify.py +++ b/src/calibre/ebooks/metadata/sources/identify.py @@ -471,7 +471,7 @@ def identify(log, abort, # {{{ for r in presults: log('\n\n---') try: - log(unicode(r)) + log(type(u'')(r)) except TypeError: log(repr(r)) if plog: diff --git a/src/calibre/ebooks/metadata/sources/overdrive.py b/src/calibre/ebooks/metadata/sources/overdrive.py index 51ed5c8136..471f7a669a 100755 --- a/src/calibre/ebooks/metadata/sources/overdrive.py +++ b/src/calibre/ebooks/metadata/sources/overdrive.py @@ -233,7 +233,7 @@ class OverDrive(Source): xreq.add_header('Referer', q_init_search) xreq.add_header('Accept', 'application/json, text/javascript, */*') raw = br.open_novisit(xreq).read() - for m in re.finditer(unicode(r'"iTotalDisplayRecords":(?P\d+).*?"iTotalRecords":(?P\d+)'), raw): + for m in re.finditer(type(u'')(r'"iTotalDisplayRecords":(?P\d+).*?"iTotalRecords":(?P\d+)'), raw): if int(m.group('totalrecords')) == 0: return '' elif int(m.group('displayrecords')) >= 1: @@ -450,7 +450,7 @@ class OverDrive(Source): if desc: desc = desc[0] - desc = html.tostring(desc, method='html', encoding=unicode).strip() + desc = html.tostring(desc, method='html', encoding='unicode').strip() # remove all attributes from tags desc = re.sub(r'<([a-zA-Z0-9]+)\s[^>]+>', r'<\1>', desc) # Remove comments diff --git a/src/calibre/ebooks/metadata/sources/ozon.py b/src/calibre/ebooks/metadata/sources/ozon.py index b125c45f26..0c167d90ac 100644 --- a/src/calibre/ebooks/metadata/sources/ozon.py +++ b/src/calibre/ebooks/metadata/sources/ozon.py @@ -100,7 +100,7 @@ class Ozon(Source): qItems.discard('') searchText = u' '.join(qItems).strip() - if isinstance(searchText, unicode): + if isinstance(searchText, type(u'')): searchText = searchText.encode('utf-8') if not searchText: return None @@ -148,7 +148,7 @@ class Ozon(Source): else: # Redirect page: trying to extract ozon_id from javascript data h = HTMLParser() - entry_string = (h.unescape(etree.tostring(doc, pretty_print=True, encoding=unicode))) + entry_string = (h.unescape(etree.tostring(doc, pretty_print=True, encoding='unicode'))) json_pat = re.compile(r'dataLayer\s*=\s*(.+)?;') json_info = re.search(json_pat, entry_string) jsondata = json_info.group(1) if json_info else None @@ -198,16 +198,16 @@ class Ozon(Source): reRemoveFromTitle = re.compile(r'[?!:.,;+-/&%"\'=]') - title = unicode(title).upper() if title else '' + title = type(u'')(title).upper() if title else '' if reRemoveFromTitle: title = reRemoveFromTitle.sub('', title) authors = map(_normalizeAuthorNameWithInitials, - map(unicode.upper, map(unicode, authors))) if authors else None + map(type(u'').upper, map(type(u''), authors))) if authors else None ozon_id = identifiers.get('ozon', None) # log.debug(u'ozonid: ', ozon_id) - unk = unicode(_('Unknown')).upper() + unk = type(u'')(_('Unknown')).upper() if title == unk: title = None @@ -226,7 +226,7 @@ class Ozon(Source): def calc_source_relevance(mi): # {{{ relevance = 0 if title: - mititle = unicode(mi.title).upper() if mi.title else '' + mititle = type(u'')(mi.title).upper() if mi.title else '' if reRemoveFromTitle: mititle = reRemoveFromTitle.sub('', mititle) @@ -240,7 +240,7 @@ class Ozon(Source): relevance += 1 if authors: - miauthors = map(unicode.upper, map(unicode, mi.authors)) if mi.authors else [] + miauthors = map(type(u'').upper, map(type(u''), mi.authors)) if mi.authors else [] # log.debug('Authors %s vs miauthors %s'%(','.join(authors), ','.join(miauthors))) if (in_authors(authors, miauthors)): @@ -320,13 +320,13 @@ class Ozon(Source): # }}} def to_metadata(self, log, entry): # {{{ - title = unicode(entry.xpath(u'normalize-space(.//div[@itemprop="name"][1]/text())')) + title = type(u'')(entry.xpath(u'normalize-space(.//div[@itemprop="name"][1]/text())')) # log.debug(u'Title: -----> %s' % title) - author = unicode(entry.xpath(u'normalize-space(.//div[contains(@class, "mPerson")])')) + author = type(u'')(entry.xpath(u'normalize-space(.//div[contains(@class, "mPerson")])')) # log.debug(u'Author: -----> %s' % author) - norm_authors = map(_normalizeAuthorNameWithInitials, map(unicode.strip, unicode(author).split(u','))) + norm_authors = map(_normalizeAuthorNameWithInitials, map(type(u'').strip, type(u'')(author).split(u','))) mi = Metadata(title, norm_authors) ozon_id = entry.get('data-href').split('/')[-2] @@ -524,7 +524,7 @@ class Ozon(Source): # comments, from Javascript data beginning = fullString.find(u'FirstBlock') end = fullString.find(u'}', beginning) - comments = unicode(fullString[beginning + 75:end - 1]).decode("unicode-escape") + comments = type(u'')(fullString[beginning + 75:end - 1]).decode("unicode-escape") metadata.comments = replace_entities(comments, 'utf-8') # }}} @@ -603,7 +603,7 @@ def _format_isbn(log, isbn): # {{{ def _translageLanguageToCode(displayLang): # {{{ - displayLang = unicode(displayLang).strip() if displayLang else None + displayLang = type(u'')(displayLang).strip() if displayLang else None langTbl = {None: 'ru', u'Русский': 'ru', u'Немецкий': 'de', @@ -627,9 +627,9 @@ def _normalizeAuthorNameWithInitials(name): # {{{ if name: re1 = r'^(?P\S+)\s+(?P[^\d\W]\.)(?:\s*(?P[^\d\W]\.))?$' re2 = r'^(?P[^\d\W]\.)(?:\s*(?P[^\d\W]\.))?\s+(?P\S+)$' - matcher = re.match(re1, unicode(name), re.UNICODE) + matcher = re.match(re1, type(u'')(name), re.UNICODE) if not matcher: - matcher = re.match(re2, unicode(name), re.UNICODE) + matcher = re.match(re2, type(u'')(name), re.UNICODE) if matcher: d = matcher.groupdict() @@ -653,7 +653,7 @@ def toPubdate(log, yearAsString): # {{{ # }}} def _listToUnicodePrintStr(lst): # {{{ - return u'[' + u', '.join(unicode(x) for x in lst) + u']' + return u'[' + u', '.join(type(u'')(x) for x in lst) + u']' # }}} diff --git a/src/calibre/ebooks/metadata/sources/search_engines.py b/src/calibre/ebooks/metadata/sources/search_engines.py index c8214f3c7b..1bf6fea908 100644 --- a/src/calibre/ebooks/metadata/sources/search_engines.py +++ b/src/calibre/ebooks/metadata/sources/search_engines.py @@ -26,7 +26,7 @@ Result = namedtuple('Result', 'url title cached_url') def tostring(elem): - return etree.tostring(elem, encoding=unicode, method='text', with_tail=False) + return etree.tostring(elem, encoding='unicode', method='text', with_tail=False) def browser(): diff --git a/src/calibre/ebooks/textile/functions.py b/src/calibre/ebooks/textile/functions.py index d7c559f952..8c6d5d406e 100755 --- a/src/calibre/ebooks/textile/functions.py +++ b/src/calibre/ebooks/textile/functions.py @@ -128,11 +128,11 @@ class Textile(object): pnct = r'[-!"#$%&()*+,/:;<=>?@\'\[\\\]\.^_`{|}~]' # urlch = r'[\w"$\-_.+!*\'(),";/?:@=&%#{}|\\^~\[\]`]' - urlch = '[\w"$\-_.+*\'(),";\/?:@=&%#{}|\\^~\[\]`]' + urlch = r'[\w"$\-_.+*\'(),";\/?:@=&%#{}|\\^~\[\]`]' url_schemes = ('http', 'https', 'ftp', 'mailto') - btag = ('bq', 'bc', 'notextile', 'pre', 'h[1-6]', 'fn\d+', 'p') + btag = ('bq', 'bc', 'notextile', 'pre', 'h[1-6]', r'fn\d+', 'p') btag_lite = ('bq', 'bc', 'p') macro_defaults = [ @@ -292,7 +292,7 @@ class Textile(object): """ self.html_type = html_type - # text = unicode(text) + # text = type(u'')(text) text = _normalize_newlines(text) if self.restricted: diff --git a/src/calibre/gui2/store/stores/biblio_plugin.py b/src/calibre/gui2/store/stores/biblio_plugin.py index 03873283e2..d085097c86 100644 --- a/src/calibre/gui2/store/stores/biblio_plugin.py +++ b/src/calibre/gui2/store/stores/biblio_plugin.py @@ -21,7 +21,9 @@ class BiblioStore(BasicStoreConfig, OpenSearchOPDSStore): def search(self, query, max_results=10, timeout=60): # check for cyrillic symbols before performing search - uquery = unicode(query.strip(), 'utf-8') + if isinstance(query, bytes): + query = query.decode('utf-8') + uquery = query.strip() reObj = re.search(u'^[а-яА-Я\\d\\s]{3,}$', uquery) if not reObj: return diff --git a/src/calibre/gui2/store/stores/chitanka_plugin.py b/src/calibre/gui2/store/stores/chitanka_plugin.py index 32a4f5099a..052c6fb751 100644 --- a/src/calibre/gui2/store/stores/chitanka_plugin.py +++ b/src/calibre/gui2/store/stores/chitanka_plugin.py @@ -43,7 +43,9 @@ class ChitankaStore(BasicStoreConfig, StorePlugin): def search(self, query, max_results=10, timeout=60): # check for cyrillic symbols before performing search - uquery = unicode(query.strip(), 'utf-8') + if isinstance(query, bytes): + query = query.decode('utf-8') + uquery = query.strip() reObj = re.search(u'^[а-яА-Я\\d\\s]{3,}$', uquery) if not reObj: return @@ -56,7 +58,7 @@ class ChitankaStore(BasicStoreConfig, StorePlugin): br = browser() try: with closing(br.open(url, timeout=timeout)) as f: - f = unicode(f.read(), 'utf-8') + f = f.read().decode('utf-8') doc = html.fromstring(f) for data in doc.xpath('//ul[@class="superlist booklist"]/li'): @@ -98,7 +100,7 @@ class ChitankaStore(BasicStoreConfig, StorePlugin): with closing(br2.open(base_url + author_url, timeout=timeout)) as f: if counter <= 0: break - f = unicode(f.read(), 'utf-8') + f = f.read().decode('utf-8') doc2 = html.fromstring(f) # search for book title diff --git a/src/calibre/gui2/store/stores/ebooksgratuits_plugin.py b/src/calibre/gui2/store/stores/ebooksgratuits_plugin.py index 48b27badf2..b966d2c2ce 100644 --- a/src/calibre/gui2/store/stores/ebooksgratuits_plugin.py +++ b/src/calibre/gui2/store/stores/ebooksgratuits_plugin.py @@ -22,10 +22,9 @@ class EbooksGratuitsStore(BasicStoreConfig, OpenSearchOPDSStore): return ascii_text(s) def search(self, query, max_results=10, timeout=60): - query = self.strip_accents(unicode(query)) + query = self.strip_accents(type(u'')(query)) for s in OpenSearchOPDSStore.search(self, query, max_results, timeout): if s.downloads: s.drm = SearchResult.DRM_UNLOCKED s.price = '$0.00' yield s - diff --git a/src/calibre/gui2/store/stores/eknigi_plugin.py b/src/calibre/gui2/store/stores/eknigi_plugin.py index 1eaf83e7b0..f97dd41c5d 100644 --- a/src/calibre/gui2/store/stores/eknigi_plugin.py +++ b/src/calibre/gui2/store/stores/eknigi_plugin.py @@ -49,7 +49,7 @@ class eKnigiStore(BasicStoreConfig, StorePlugin): def search(self, query, max_results=10, timeout=60): # check for cyrillic symbols before performing search - uquery = unicode(query.strip(), 'utf-8') + uquery = type(u'')(query.strip(), 'utf-8') reObj = re.search(u'^[а-яА-Я\\d\\s]{2,}$', uquery) if not reObj: return diff --git a/src/calibre/gui2/store/stores/kobo_plugin.py b/src/calibre/gui2/store/stores/kobo_plugin.py index 74114ffc72..578803c081 100644 --- a/src/calibre/gui2/store/stores/kobo_plugin.py +++ b/src/calibre/gui2/store/stores/kobo_plugin.py @@ -46,7 +46,7 @@ def search_kobo(query, max_results=10, timeout=60, write_html_to=None): cover_url = None for p in select('p.title', item): - title = etree.tostring(p, method='text', encoding=unicode).strip() + title = etree.tostring(p, method='text', encoding='unicode').strip() for a in select('a[href]', p): url = a.get('href') break @@ -58,11 +58,11 @@ def search_kobo(query, max_results=10, timeout=60, write_html_to=None): authors = [] for a in select('p.contributor-list a.contributor-name', item): - authors.append(etree.tostring(a, method='text', encoding=unicode).strip()) + authors.append(etree.tostring(a, method='text', encoding='unicode').strip()) authors = authors_to_string(authors) for p in select('p.price', item): - price = etree.tostring(p, method='text', encoding=unicode).strip() + price = etree.tostring(p, method='text', encoding='unicode').strip() break else: price = None diff --git a/src/calibre/gui2/store/stores/litres_plugin.py b/src/calibre/gui2/store/stores/litres_plugin.py index 5e67eff854..13b342cb0a 100644 --- a/src/calibre/gui2/store/stores/litres_plugin.py +++ b/src/calibre/gui2/store/stores/litres_plugin.py @@ -88,7 +88,7 @@ class LitResStore(BasicStoreConfig, StorePlugin): authors = data.xpath('.//title-info/author/first-name/text()|' './/title-info/author/middle-name/text()|' './/title-info/author/last-name/text()') - sRes.author = u' '.join(map(unicode, authors)) + sRes.author = u' '.join(map(type(u''), authors)) sRes.price = data.xpath(xp_template.format('price')) # cover vs cover_preview sRes.cover_url = data.xpath(xp_template.format('cover_preview')) @@ -107,7 +107,7 @@ def format_price_in_RUR(price): @return: formatted price if possible otherwise original value @rtype: unicode ''' - if price and re.match("^\d*?\.\d*?$", price): + if price and re.match(r"^\d*?\.\d*?$", price): try: price = u'{:,.2F} руб.'.format(float(price)) price = price.replace(',', ' ').replace('.', ',', 1) diff --git a/src/calibre/gui2/store/stores/mobileread/adv_search_builder.py b/src/calibre/gui2/store/stores/mobileread/adv_search_builder.py index df90041ddc..42b4b5f3b7 100644 --- a/src/calibre/gui2/store/stores/mobileread/adv_search_builder.py +++ b/src/calibre/gui2/store/stores/mobileread/adv_search_builder.py @@ -67,7 +67,7 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog): self.mc = '=' else: self.mc = '~' - all, any, phrase, none = map(lambda x: unicode(x.text()), + all, any, phrase, none = map(lambda x: type(u'')(x.text()), (self.all, self.any, self.phrase, self.none)) all, any, none = map(self.tokens, (all, any, none)) phrase = phrase.strip() @@ -86,11 +86,11 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog): return ans def token(self): - txt = unicode(self.text.text()).strip() + txt = type(u'')(self.text.text()).strip() if txt: if self.negate.isChecked(): txt = '!'+txt - tok = self.FIELDS[unicode(self.field.currentText())]+txt + tok = self.FIELDS[type(u'')(self.field.currentText())]+txt if re.search(r'\s', tok): tok = '"%s"'%tok return tok @@ -106,13 +106,13 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog): ans = [] self.box_last_values = {} - title = unicode(self.title_box.text()).strip() + title = type(u'')(self.title_box.text()).strip() if title: ans.append('title:"' + self.mc + title + '"') - author = unicode(self.author_box.text()).strip() + author = type(u'')(self.author_box.text()).strip() if author: ans.append('author:"' + self.mc + author + '"') - format = unicode(self.format_box.text()).strip() + format = type(u'')(self.format_box.text()).strip() if format: ans.append('format:"' + self.mc + format + '"') if ans: diff --git a/src/calibre/gui2/store/stores/mobileread/cache_update_thread.py b/src/calibre/gui2/store/stores/mobileread/cache_update_thread.py index d7a8036ecd..5d604725b6 100644 --- a/src/calibre/gui2/store/stores/mobileread/cache_update_thread.py +++ b/src/calibre/gui2/store/stores/mobileread/cache_update_thread.py @@ -22,7 +22,7 @@ class CacheUpdateThread(Thread, QObject): total_changed = pyqtSignal(int) update_progress = pyqtSignal(int) - update_details = pyqtSignal(unicode) + update_details = pyqtSignal(type(u'')) def __init__(self, config, seralize_books_function, timeout): Thread.__init__(self) diff --git a/src/calibre/gui2/store/stores/mobileread/models.py b/src/calibre/gui2/store/stores/mobileread/models.py index fb3c250a16..54a5b9e0de 100644 --- a/src/calibre/gui2/store/stores/mobileread/models.py +++ b/src/calibre/gui2/store/stores/mobileread/models.py @@ -105,7 +105,7 @@ class BooksModel(QAbstractItemModel): return descending = order == Qt.DescendingOrder self.books.sort(None, - lambda x: sort_key(unicode(self.data_as_text(x, col))), + lambda x: sort_key(type(u'')(self.data_as_text(x, col))), descending) if reset: self.beginResetModel(), self.endResetModel() diff --git a/src/calibre/gui2/store/stores/mobileread/store_dialog.py b/src/calibre/gui2/store/stores/mobileread/store_dialog.py index ce8e806a58..a68dd32ebe 100644 --- a/src/calibre/gui2/store/stores/mobileread/store_dialog.py +++ b/src/calibre/gui2/store/stores/mobileread/store_dialog.py @@ -40,7 +40,7 @@ class MobileReadStoreDialog(QDialog, Ui_Dialog): self.restore_state() def do_search(self): - self.results_view.model().search(unicode(self.search_query.text())) + self.results_view.model().search(type(u'')(self.search_query.text())) def open_store(self, index): result = self.results_view.model().get_book(index) diff --git a/src/calibre/utils/unicode_getpass.py b/src/calibre/utils/unicode_getpass.py index 887938ad6e..fa027fa1ea 100644 --- a/src/calibre/utils/unicode_getpass.py +++ b/src/calibre/utils/unicode_getpass.py @@ -6,31 +6,35 @@ from __future__ import absolute_import, division, print_function, unicode_litera import sys -from calibre.constants import iswindows, preferred_encoding +from calibre.constants import iswindows, preferred_encoding, ispy3 -def getpass(prompt): - if iswindows: - # getpass is broken on windows with python 2.x and unicode, the - # below implementation is from the python 3 source code - import msvcrt - for c in prompt: - msvcrt.putwch(c) - pw = "" - while 1: - c = msvcrt.getwch() - if c == '\r' or c == '\n': - break - if c == '\003': - raise KeyboardInterrupt - if c == '\b': - pw = pw[:-1] - else: - pw = pw + c - msvcrt.putwch('\r') - msvcrt.putwch('\n') - return pw - else: - enc = getattr(sys.stdin, 'encoding', preferred_encoding) or preferred_encoding - from getpass import getpass - return getpass(prompt).decode(enc) +if ispy3: + from getpass import getpass + getpass +else: + def getpass(prompt): + if iswindows: + # getpass is broken on windows with python 2.x and unicode, the + # below implementation is from the python 3 source code + import msvcrt + for c in prompt: + msvcrt.putwch(c) + pw = "" + while 1: + c = msvcrt.getwch() + if c == '\r' or c == '\n': + break + if c == '\003': + raise KeyboardInterrupt + if c == '\b': + pw = pw[:-1] + else: + pw = pw + c + msvcrt.putwch('\r') + msvcrt.putwch('\n') + return pw + else: + enc = getattr(sys.stdin, 'encoding', preferred_encoding) or preferred_encoding + from getpass import getpass + return getpass(prompt).decode(enc) diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index a55f4795bf..c72454b827 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -9,7 +9,7 @@ from calibre.web.feeds.news import (BasicNewsRecipe, CustomIndexRecipe, AutomaticNewsRecipe, CalibrePeriodical) from calibre.ebooks.BeautifulSoup import BeautifulSoup from calibre.utils.config import JSONConfig -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, codepoint_to_chr basic_recipes = (BasicNewsRecipe, AutomaticNewsRecipe, CustomIndexRecipe, CalibrePeriodical) @@ -44,7 +44,9 @@ def compile_recipe(src): 'BasicNewsRecipe':BasicNewsRecipe, 'AutomaticNewsRecipe':AutomaticNewsRecipe, 'time':time, 're':re, - 'BeautifulSoup':BeautifulSoup + 'BeautifulSoup':BeautifulSoup, + 'unicode': unicode_type, + 'unichr': codepoint_to_chr, } exec(src, namespace) diff --git a/src/css_selectors/parser.py b/src/css_selectors/parser.py index 314cc73a88..189c29c0df 100644 --- a/src/css_selectors/parser.py +++ b/src/css_selectors/parser.py @@ -15,20 +15,17 @@ import operator import string from css_selectors.errors import SelectorSyntaxError, ExpressionError +from polyglot.builtins import unicode_type, codepoint_to_chr -if sys.version_info[0] < 3: - _unicode = unicode - _unichr = unichr -else: - _unicode = str - _unichr = chr tab = string.maketrans(string.ascii_uppercase, string.ascii_lowercase) utab = {c:c+32 for c in range(ord('A'), ord('Z')+1)} + def ascii_lower(string): """Lower-case, but only in the ASCII range.""" - return string.translate(utab if isinstance(string, _unicode) else tab) + return string.translate(utab if isinstance(string, unicode_type) else tab) + def urepr(x): if isinstance(x, list): @@ -38,6 +35,7 @@ def urepr(x): ans = ans[1:] return ans + # Parsed objects class Selector(object): @@ -385,6 +383,7 @@ def parse_selector_group(stream): else: break + def parse_selector(stream): result, pseudo_element = parse_simple_selector(stream) while 1: @@ -461,7 +460,7 @@ def parse_simple_selector(stream, inside_negation=False): 'before', 'after'): # Special case: CSS 2.1 pseudo-elements can have a single ':' # Any new pseudo-element must have two. - pseudo_element = _unicode(ident) + pseudo_element = unicode_type(ident) continue if stream.peek() != ('DELIM', '('): result = Pseudo(result, ident) @@ -626,11 +625,13 @@ class TokenMacros: nmchar = '[_a-z0-9-]|%s|%s' % (escape, nonascii) nmstart = '[_a-z]|%s|%s' % (escape, nonascii) + def _compile(pattern): return re.compile(pattern % vars(TokenMacros), re.IGNORECASE).match + _match_whitespace = _compile(r'[ \t\r\n\f]+') -_match_number = _compile('[+-]?(?:[0-9]*\.[0-9]+|[0-9]+)') +_match_number = _compile(r'[+-]?(?:[0-9]*\.[0-9]+|[0-9]+)') _match_hash = _compile('#(?:%(nmchar)s)+') _match_ident = _compile('-?(?:%(nmstart)s)(?:%(nmchar)s)*') _match_string_by_quote = { @@ -650,11 +651,12 @@ else: def _replace_simple(match): return match.group(1) + def _replace_unicode(match): codepoint = int(match.group(1), 16) if codepoint > sys.maxunicode: codepoint = 0xFFFD - return _unichr(codepoint) + return codepoint_to_chr(codepoint) def unescape_ident(value): diff --git a/src/odf/attrconverters.py b/src/odf/attrconverters.py index e09b0f5caf..1ebc173961 100644 --- a/src/odf/attrconverters.py +++ b/src/odf/attrconverters.py @@ -29,7 +29,7 @@ def make_NCName(arg): return arg def cnv_anyURI(attribute, arg, element): - return unicode(arg) + return type(u'')(arg) def cnv_boolean(attribute, arg, element): if arg.lower() in ("false","no"): @@ -85,13 +85,13 @@ def cnv_family(attribute, arg, element): def __save_prefix(attribute, arg, element): prefix = arg.split(':',1)[0] if prefix == arg: - return unicode(arg) + return type(u'')(arg) namespace = element.get_knownns(prefix) if namespace is None: #raise ValueError, "'%s' is an unknown prefix" % str(prefix) - return unicode(arg) + return type(u'')(arg) p = element.get_nsprefix(namespace) - return unicode(arg) + return type(u'')(arg) def cnv_formula(attribute, arg, element): """ A string containing a formula. Formulas do not have a predefined syntax, but the string should @@ -218,7 +218,7 @@ def cnv_positiveInteger(attribute, arg, element): return str(arg) def cnv_string(attribute, arg, element): - return unicode(arg) + return type(u'')(arg) def cnv_textnoteclass(attribute, arg, element): if str(arg) not in ("footnote", "endnote"): @@ -1480,5 +1480,4 @@ class AttrConverters: conversion = attrconverters.get((attribute, None), None) if conversion is not None: return conversion(attribute, value, element) - return unicode(value) - + return type(u'')(value) diff --git a/src/odf/element.py b/src/odf/element.py index 7b9310a2aa..b0a4b3d406 100644 --- a/src/odf/element.py +++ b/src/odf/element.py @@ -182,7 +182,7 @@ class Node(xml.dom.Node): def __unicode__(self): val = [] for c in self.childNodes: - val.append(unicode(c)) + val.append(type(u'')(c)) return u''.join(val) defproperty(Node, "firstChild", doc="First child node, or None.") @@ -253,8 +253,8 @@ class Text(Childless, Node): def toXml(self,level,f): """ Write XML in UTF-8 """ if self.data: - f.write(_escape(unicode(self.data).encode('utf-8'))) - + f.write(_escape(type(u'')(self.data).encode('utf-8'))) + class CDATASection(Childless, Text): nodeType = Node.CDATA_SECTION_NODE @@ -283,7 +283,7 @@ class Element(Node): Node.TEXT_NODE, Node.CDATA_SECTION_NODE, Node.ENTITY_REFERENCE_NODE) - + def __init__(self, attributes=None, text=None, cdata=None, qname=None, qattributes=None, check_grammar=True, **args): if qname is not None: self.qname = qname @@ -334,7 +334,7 @@ class Element(Node): for ns,p in nsdict.items(): if p == prefix: return ns return None - + def get_nsprefix(self, namespace): """ Odfpy maintains a list of known namespaces. In some cases we have a namespace URL, and needs to look up or assign the prefix for it. @@ -352,7 +352,7 @@ class Element(Node): element.ownerDocument = self.ownerDocument for child in element.childNodes: self._setOwnerDoc(child) - + def addElement(self, element, check_grammar=True): """ adds an element to an Element @@ -469,7 +469,7 @@ class Element(Node): f.write(' xmlns:' + prefix + '="'+ _escape(str(namespace))+'"') for qname in self.attributes.keys(): prefix = self.get_nsprefix(qname[0]) - f.write(' '+_escape(str(prefix+':'+qname[1]))+'='+_quoteattr(unicode(self.attributes[qname]).encode('utf-8'))) + f.write(' '+_escape(str(prefix+':'+qname[1]))+'='+_quoteattr(type(u'')(self.attributes[qname]).encode('utf-8'))) f.write('>') def write_close_tag(self, level, f): @@ -483,7 +483,7 @@ class Element(Node): f.write(' xmlns:' + prefix + '="'+ _escape(str(namespace))+'"') for qname in self.attributes.keys(): prefix = self.get_nsprefix(qname[0]) - f.write(' '+_escape(str(prefix+':'+qname[1]))+'='+_quoteattr(unicode(self.attributes[qname]).encode('utf-8'))) + f.write(' '+_escape(str(prefix+':'+qname[1]))+'='+_quoteattr(type(u'')(self.attributes[qname]).encode('utf-8'))) if self.childNodes: f.write('>') for element in self.childNodes: @@ -509,5 +509,3 @@ class Element(Node): """ This is a check to see if the object is an instance of a type """ obj = element(check_grammar=False) return self.qname == obj.qname - - diff --git a/src/odf/odf2xhtml.py b/src/odf/odf2xhtml.py index 99b3279207..9f1e763551 100644 --- a/src/odf/odf2xhtml.py +++ b/src/odf/odf2xhtml.py @@ -55,6 +55,7 @@ if False: # Added by Kovid # character etc. styles Since CSS2 has no scope we use a prefix. (Not elegant) # In ODF a style can have a parent, these parents can be chained. + class StyleToCSS: """ The purpose of the StyleToCSS class is to contain the rules to convert @@ -317,6 +318,7 @@ class TagStack: if attr in attrs: return attrs[attr] return None + def count_tags(self, tag): c = 0 for ttag, tattrs in self.stack: @@ -324,6 +326,7 @@ class TagStack: c = c + 1 return c + special_styles = { 'S-Emphasis':'em', 'S-Citation':'cite', @@ -352,6 +355,8 @@ special_styles = { # ODFCONTENTHANDLER # # ----------------------------------------------------------------------------- + + class ODF2XHTML(handler.ContentHandler): """ The ODF2XHTML parses an ODF file and produces XHTML""" @@ -625,9 +630,6 @@ class ODF2XHTML(handler.ContentHandler): self.anchors[name] = "anchor%d" % (len(self.anchors) + 1) return self.anchors.get(name) - -# -------------------------------------------------- - def purgedata(self): self.data = [] @@ -1457,7 +1459,7 @@ dl.notes dd:last-of-type { page-break-after: avoid } # self.writeout( escape(mark) ) # Since HTML only knows about endnotes, there is too much risk that the # marker is reused in the source. Therefore we force numeric markers - self.writeout(unicode(self.currentnote)) + self.writeout(type(u'')(self.currentnote)) self.closetag('a') self.closetag('sup') @@ -1566,12 +1568,11 @@ dl.notes dd:last-of-type { page-break-after: avoid } self.writedata() self.purgedata() - -# ----------------------------------------------------------------------------- -# -# Reading the file -# -# ----------------------------------------------------------------------------- + # ----------------------------------------------------------------------------- + # + # Reading the file + # + # ----------------------------------------------------------------------------- def load(self, odffile): """ Loads a document into the parser and parses it. @@ -1593,7 +1594,7 @@ dl.notes dd:last-of-type { page-break-after: avoid } self._walknode(c) self.endElementNS(node.qname, node.tagName) if node.nodeType == Node.TEXT_NODE or node.nodeType == Node.CDATA_SECTION_NODE: - self.characters(unicode(node)) + self.characters(type(u'')(node)) def odf2xhtml(self, odffile): """ Load a file and return the XHTML diff --git a/src/tinycss/tests/__init__.py b/src/tinycss/tests/__init__.py index bbdfb51d47..3cf59a1077 100644 --- a/src/tinycss/tests/__init__.py +++ b/src/tinycss/tests/__init__.py @@ -8,10 +8,6 @@ __copyright__ = '2014, Kovid Goyal ' import unittest -try: - unicode -except NameError: - unicode = str def jsonify(tokens): """Turn tokens into "JSON-compatible" data structures.""" @@ -24,6 +20,7 @@ def jsonify(tokens): else: yield token.type, token.value + class BaseTest(unittest.TestCase): longMessage = True @@ -34,10 +31,8 @@ class BaseTest(unittest.TestCase): """Test not complete error messages but only substrings.""" self.ae(len(errors), len(expected_errors)) for error, expected in zip(errors, expected_errors): - self.assertIn(expected, unicode(error)) + self.assertIn(expected, type(u'')(error)) def jsonify_declarations(self, rule): return [(decl.name, list(jsonify(decl.value))) for decl in rule.declarations] - - From 073e97121e25419fc20d18c38e3ddf5c1f96651a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Mar 2019 13:46:40 +0530 Subject: [PATCH 0304/2613] Micro-optimization --- src/calibre/devices/libusb/libusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/devices/libusb/libusb.c b/src/calibre/devices/libusb/libusb.c index 4ec6b3b1e6..b084842e20 100644 --- a/src/calibre/devices/libusb/libusb.c +++ b/src/calibre/devices/libusb/libusb.c @@ -118,7 +118,7 @@ static PyObject* get_devices(PyObject *self, PyObject *args) { static char libusb_doc[] = "Interface to libusb."; static PyMethodDef libusb_methods[] = { - {"get_devices", get_devices, METH_VARARGS, + {"get_devices", get_devices, METH_NOARGS, "get_devices()\n\nGet the list of USB devices on the system." }, From 55151a3cdd4e595be49f2392731b972439f51408 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Mar 2019 14:57:26 +0530 Subject: [PATCH 0305/2613] Get rid of basestring --- src/calibre/customize/zipplugin.py | 7 ++--- src/calibre/db/backend.py | 6 ++--- src/calibre/db/cache.py | 6 ++--- src/calibre/db/search.py | 4 +-- src/calibre/db/utils.py | 4 +-- src/calibre/devices/android/driver.py | 3 ++- src/calibre/devices/kobo/books.py | 4 +-- src/calibre/devices/kobo/driver.py | 8 +++--- src/calibre/devices/usbms/books.py | 3 ++- src/calibre/devices/usbms/device.py | 3 ++- src/calibre/devices/usbms/driver.py | 4 +-- src/calibre/ebooks/BeautifulSoup.py | 6 ++--- src/calibre/ebooks/conversion/plumber.py | 6 ++--- src/calibre/ebooks/covers.py | 4 +-- src/calibre/ebooks/docx/writer/from_html.py | 4 +-- src/calibre/ebooks/fb2/fb2ml.py | 6 ++--- src/calibre/ebooks/htmlz/oeb2html.py | 16 +++++------ src/calibre/ebooks/lit/reader.py | 4 +-- src/calibre/ebooks/lit/writer.py | 4 +-- src/calibre/ebooks/lrf/html/table.py | 7 ++--- src/calibre/ebooks/lrf/lrs/convert_from.py | 3 ++- src/calibre/ebooks/lrf/objects.py | 10 +++---- src/calibre/ebooks/lrf/pylrs/elements.py | 4 +-- src/calibre/ebooks/lrf/pylrs/pylrs.py | 27 ++++++++++--------- src/calibre/ebooks/lrf/tags.py | 4 +-- src/calibre/ebooks/metadata/odt.py | 4 +-- src/calibre/ebooks/metadata/rtf.py | 4 +-- src/calibre/ebooks/metadata/xmp.py | 8 +++--- src/calibre/ebooks/mobi/mobiml.py | 10 +++---- src/calibre/ebooks/mobi/writer2/serializer.py | 4 +-- src/calibre/ebooks/odt/input.py | 4 +-- src/calibre/ebooks/oeb/base.py | 6 ++--- src/calibre/ebooks/oeb/normalize_css.py | 6 ++--- src/calibre/ebooks/oeb/parse_utils.py | 6 ++--- src/calibre/ebooks/oeb/polish/embed.py | 7 ++--- src/calibre/ebooks/oeb/polish/split.py | 8 +++--- src/calibre/ebooks/oeb/transforms/flatcss.py | 4 +-- .../ebooks/oeb/transforms/manglecase.py | 3 ++- src/calibre/ebooks/pml/pmlml.py | 6 ++--- src/calibre/ebooks/rb/rbml.py | 5 ++-- src/calibre/ebooks/rtf/rtfml.py | 6 ++--- src/calibre/ebooks/snb/snbml.py | 6 ++--- src/calibre/ebooks/txt/markdownml.py | 6 ++--- src/calibre/ebooks/txt/textileml.py | 21 ++++++++------- src/calibre/ebooks/txt/txtml.py | 6 ++--- src/calibre/gui2/__init__.py | 4 +-- src/calibre/gui2/actions/__init__.py | 6 ++--- src/calibre/gui2/actions/add.py | 5 ++-- src/calibre/gui2/actions/similar_books.py | 3 ++- src/calibre/gui2/add.py | 6 ++--- src/calibre/gui2/device.py | 4 +-- src/calibre/gui2/ebook_download.py | 3 ++- src/calibre/gui2/library/models.py | 4 +-- src/calibre/gui2/linux_file_dialogs.py | 4 +-- src/calibre/gui2/lrf_renderer/text.py | 4 +-- src/calibre/gui2/open_with.py | 3 ++- src/calibre/gui2/preferences/__init__.py | 4 +-- src/calibre/gui2/qt_file_dialogs.py | 4 +-- src/calibre/gui2/search_box.py | 4 +-- src/calibre/gui2/tweak_book/boss.py | 4 +-- src/calibre/gui2/tweak_book/editor/widget.py | 4 +-- src/calibre/gui2/ui.py | 4 +-- src/calibre/gui2/viewer/documentview.py | 6 ++--- src/calibre/gui2/win_file_dialogs.py | 3 ++- src/calibre/library/caches.py | 4 +-- src/calibre/library/catalogs/bibtex.py | 7 ++--- src/calibre/library/database2.py | 12 ++++----- src/calibre/srv/ajax.py | 4 +-- src/calibre/srv/legacy.py | 16 ++++++----- src/calibre/utils/config_base.py | 2 +- src/calibre/utils/img.py | 3 ++- src/calibre/utils/imghdr.py | 3 ++- src/calibre/utils/ipc/launch.py | 4 +-- src/calibre/utils/ipc/server.py | 3 ++- src/calibre/utils/ipc/simple_worker.py | 4 +-- src/calibre/utils/open_with/linux.py | 4 ++- src/calibre/utils/open_with/osx.py | 8 +++--- src/calibre/utils/rss_gen.py | 7 ++--- src/calibre/utils/smtplib.py | 4 +-- src/calibre/utils/unrar.py | 3 ++- src/calibre/utils/zipfile.py | 4 +-- src/calibre/web/feeds/__init__.py | 4 +-- src/calibre/web/feeds/news.py | 6 ++--- src/odf/odf2xhtml.py | 2 +- src/odf/userfield.py | 5 ++-- src/polyglot/builtins.py | 2 ++ 86 files changed, 251 insertions(+), 226 deletions(-) diff --git a/src/calibre/customize/zipplugin.py b/src/calibre/customize/zipplugin.py index 821046b169..95c18da1b2 100644 --- a/src/calibre/customize/zipplugin.py +++ b/src/calibre/customize/zipplugin.py @@ -15,6 +15,7 @@ from functools import partial from calibre import as_unicode from calibre.customize import (Plugin, numeric_version, platform, InvalidPlugin, PluginNotFound) +from polyglot.builtins import string_or_bytes # PEP 302 based plugin loading mechanism, works around the bug in zipimport in # python 2.x that prevents importing from zip files in locations whose paths @@ -34,7 +35,7 @@ def get_resources(zfp, name_or_list_of_names): be just the bytes of the resource or None if it wasn't found. ''' names = name_or_list_of_names - if isinstance(names, basestring): + if isinstance(names, string_or_bytes): names = [names] ans = {} with zipfile.ZipFile(zfp) as zf: @@ -65,11 +66,11 @@ def get_icons(zfp, name_or_list_of_names): from PyQt5.Qt import QIcon, QPixmap names = name_or_list_of_names ans = get_resources(zfp, names) - if isinstance(names, basestring): + if isinstance(names, string_or_bytes): names = [names] if ans is None: ans = {} - if isinstance(ans, basestring): + if isinstance(ans, string_or_bytes): ans = dict([(names[0], ans)]) ians = {} diff --git a/src/calibre/db/backend.py b/src/calibre/db/backend.py index 146bb8eba4..e7b5b55ac4 100644 --- a/src/calibre/db/backend.py +++ b/src/calibre/db/backend.py @@ -12,7 +12,7 @@ import os, shutil, uuid, json, glob, time, hashlib, errno, sys from functools import partial import apsw -from polyglot.builtins import unicode_type, reraise +from polyglot.builtins import unicode_type, reraise, string_or_bytes from calibre import isbytestring, force_unicode, prints, as_unicode from calibre.constants import (iswindows, filesystem_encoding, @@ -1348,7 +1348,7 @@ class DB(object): def copy_cover_to(self, path, dest, windows_atomic_move=None, use_hardlink=False, report_file_size=None): path = os.path.abspath(os.path.join(self.library_path, path, 'cover.jpg')) if windows_atomic_move is not None: - if not isinstance(dest, basestring): + if not isinstance(dest, string_or_bytes): raise Exception("Error, you must pass the dest as a path when" " using windows_atomic_move") if os.access(path, os.R_OK) and dest and not samefile(dest, path): @@ -1438,7 +1438,7 @@ class DB(object): if path is None: return False if windows_atomic_move is not None: - if not isinstance(dest, basestring): + if not isinstance(dest, string_or_bytes): raise Exception("Error, you must pass the dest as a path when" " using windows_atomic_move") if dest: diff --git a/src/calibre/db/cache.py b/src/calibre/db/cache.py index b1cd08af24..e7f1f14aa6 100644 --- a/src/calibre/db/cache.py +++ b/src/calibre/db/cache.py @@ -11,7 +11,7 @@ import os, traceback, random, shutil, operator from io import BytesIO from collections import defaultdict, Set, MutableSet from functools import wraps, partial -from polyglot.builtins import unicode_type, zip +from polyglot.builtins import unicode_type, zip, string_or_bytes from time import time from calibre import isbytestring, as_unicode @@ -1076,7 +1076,7 @@ class Cache(object): bimap, simap = {}, {} sfield = self.fields[name + '_index'] for k, v in book_id_to_val_map.iteritems(): - if isinstance(v, basestring): + if isinstance(v, string_or_bytes): v, sid = get_series_values(v) else: v = sid = None @@ -1298,7 +1298,7 @@ class Cache(object): # force_changes has no effect on cover manipulation try: cdata = mi.cover_data[1] - if cdata is None and isinstance(mi.cover, basestring) and mi.cover and os.access(mi.cover, os.R_OK): + if cdata is None and isinstance(mi.cover, string_or_bytes) and mi.cover and os.access(mi.cover, os.R_OK): with lopen(mi.cover, 'rb') as f: cdata = f.read() or None if cdata is not None: diff --git a/src/calibre/db/search.py b/src/calibre/db/search.py index da021d0e36..cc70ec4a39 100644 --- a/src/calibre/db/search.py +++ b/src/calibre/db/search.py @@ -19,7 +19,7 @@ from calibre.utils.date import parse_date, UNDEFINED_DATE, now, dt_as_local from calibre.utils.icu import primary_contains, sort_key from calibre.utils.localization import lang_map, canonicalize_lang from calibre.utils.search_query_parser import SearchQueryParser, ParseException -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes CONTAINS_MATCH = 0 EQUALS_MATCH = 1 @@ -706,7 +706,7 @@ class Parser(SearchQueryParser): # {{{ if location in text_fields: for val, book_ids in self.field_iter(location, current_candidates): if val is not None: - if isinstance(val, basestring): + if isinstance(val, string_or_bytes): val = (val,) if _match(q, val, matchkind, use_primary_find_in_search=upf, case_sensitive=case_sensitive): matches |= book_ids diff --git a/src/calibre/db/utils.py b/src/calibre/db/utils.py index 65d3e678d2..62970d6fcf 100644 --- a/src/calibre/db/utils.py +++ b/src/calibre/db/utils.py @@ -9,7 +9,7 @@ __copyright__ = '2013, Kovid Goyal ' import os, errno, cPickle, sys, re from locale import localeconv from collections import OrderedDict, namedtuple -from polyglot.builtins import map, unicode_type +from polyglot.builtins import map, unicode_type, string_or_bytes from threading import Lock from calibre import as_unicode, prints @@ -45,7 +45,7 @@ def fuzzy_title_patterns(): if _fuzzy_title_patterns is None: from calibre.ebooks.metadata import get_title_sort_pat _fuzzy_title_patterns = tuple((re.compile(pat, re.IGNORECASE) if - isinstance(pat, basestring) else pat, repl) for pat, repl in + isinstance(pat, string_or_bytes) else pat, repl) for pat, repl in [ (r'[\[\](){}<>\'";,:#]', ''), (get_title_sort_pat(), ''), diff --git a/src/calibre/devices/android/driver.py b/src/calibre/devices/android/driver.py index cb2dc14cb8..fac9b100e0 100644 --- a/src/calibre/devices/android/driver.py +++ b/src/calibre/devices/android/driver.py @@ -10,6 +10,7 @@ import cStringIO from calibre import fsync from calibre.devices.usbms.driver import USBMS +from polyglot.builtins import string_or_bytes HTC_BCDS = [0x100, 0x0222, 0x0224, 0x0226, 0x227, 0x228, 0x229, 0x0231, 0x9999] @@ -286,7 +287,7 @@ class ANDROID(USBMS): opts = [self.EBOOK_DIR_MAIN, ''] def strtolist(x): - if isinstance(x, basestring): + if isinstance(x, string_or_bytes): x = [y.strip() for y in x.split(',')] return x or [] diff --git a/src/calibre/devices/kobo/books.py b/src/calibre/devices/kobo/books.py index 91d50c115d..47082a29ed 100644 --- a/src/calibre/devices/kobo/books.py +++ b/src/calibre/devices/kobo/books.py @@ -14,7 +14,7 @@ from calibre.devices.usbms.books import CollectionsBookList from calibre.utils.config_base import prefs from calibre.devices.usbms.driver import debug_print from calibre.ebooks.metadata import author_to_author_sort -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes class Book(Book_): @@ -297,7 +297,7 @@ class KTCollectionsBookList(CollectionsBookList): return 1 if y is None: return -1 - if isinstance(x, basestring) and isinstance(y, basestring): + if isinstance(x, string_or_bytes) and isinstance(y, string_or_bytes): x, y = sort_key(force_unicode(x)), sort_key(force_unicode(y)) c = cmp(x, y) if c != 0: diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 7586f5c73a..e570573f50 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -32,7 +32,7 @@ from calibre import prints, fsync from calibre.ptempfile import PersistentTemporaryFile from calibre.constants import DEBUG from calibre.utils.config_base import prefs -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes EPUB_EXT = '.epub' KEPUB_EXT = '.kepub' @@ -3543,14 +3543,14 @@ class KOBOTOUCH(KOBO): # a string, so looking for that. start_subclass_extra_options = OPT_MODIFY_CSS debugging_title = '' - if isinstance(settings.extra_customization[OPT_MODIFY_CSS], basestring): + if isinstance(settings.extra_customization[OPT_MODIFY_CSS], string_or_bytes): debug_print("KoboTouch::migrate_old_settings - Don't have update_series option") settings.update_series = config.get_option('update_series').default settings.modify_css = config.get_option('modify_css').default settings.support_newer_firmware = settings.extra_customization[OPT_UPDATE_SERIES_DETAILS] debugging_title = settings.extra_customization[OPT_MODIFY_CSS] start_subclass_extra_options = OPT_MODIFY_CSS + 1 - elif isinstance(settings.extra_customization[OPT_SUPPORT_NEWER_FIRMWARE], basestring): + elif isinstance(settings.extra_customization[OPT_SUPPORT_NEWER_FIRMWARE], string_or_bytes): debug_print("KoboTouch::migrate_old_settings - Don't have modify_css option") settings.update_series = settings.extra_customization[OPT_UPDATE_SERIES_DETAILS] settings.modify_css = config.get_option('modify_css').default @@ -3565,7 +3565,7 @@ class KOBOTOUCH(KOBO): debugging_title = settings.extra_customization[OPT_DEBUGGING_TITLE] start_subclass_extra_options = OPT_DEBUGGING_TITLE + 1 - settings.debugging_title = debugging_title if isinstance(debugging_title, basestring) else '' + settings.debugging_title = debugging_title if isinstance(debugging_title, string_or_bytes) else '' settings.update_device_metadata = settings.update_series settings.extra_customization = settings.extra_customization[start_subclass_extra_options:] diff --git a/src/calibre/devices/usbms/books.py b/src/calibre/devices/usbms/books.py index 63179faa62..6d65e13c9c 100644 --- a/src/calibre/devices/usbms/books.py +++ b/src/calibre/devices/usbms/books.py @@ -14,6 +14,7 @@ from calibre.constants import preferred_encoding from calibre import isbytestring, force_unicode from calibre.utils.config_base import tweaks from calibre.utils.icu import sort_key +from polyglot.builtins import string_or_bytes class Book(Metadata): @@ -291,7 +292,7 @@ class CollectionsBookList(BookList): return 1 if y is None: return -1 - if isinstance(x, basestring) and isinstance(y, basestring): + if isinstance(x, string_or_bytes) and isinstance(y, string_or_bytes): x, y = sort_key(force_unicode(x)), sort_key(force_unicode(y)) try: c = cmp(x, y) diff --git a/src/calibre/devices/usbms/device.py b/src/calibre/devices/usbms/device.py index b73138f4d2..401728928e 100644 --- a/src/calibre/devices/usbms/device.py +++ b/src/calibre/devices/usbms/device.py @@ -23,6 +23,7 @@ from calibre.devices.errors import DeviceError from calibre.devices.usbms.deviceconfig import DeviceConfig from calibre.constants import iswindows, islinux, isosx, isfreebsd, plugins from calibre.utils.filenames import ascii_filename as sanitize +from polyglot.builtins import string_or_bytes if isosx: usbobserver, usbobserver_err = plugins['usbobserver'] @@ -938,7 +939,7 @@ class Device(DeviceConfig, DevicePlugin): sanity_check(on_card, files, self.card_prefix(), self.free_space()) def get_dest_dir(prefix, candidates): - if isinstance(candidates, basestring): + if isinstance(candidates, string_or_bytes): candidates = [candidates] if not candidates: candidates = [''] diff --git a/src/calibre/devices/usbms/driver.py b/src/calibre/devices/usbms/driver.py index ee5ec6452e..1c8e657b7d 100644 --- a/src/calibre/devices/usbms/driver.py +++ b/src/calibre/devices/usbms/driver.py @@ -20,7 +20,7 @@ from calibre.devices.usbms.cli import CLI from calibre.devices.usbms.device import Device from calibre.devices.usbms.books import BookList, Book from calibre.ebooks.metadata.book.json_codec import JsonCodec -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes BASE_TIME = None @@ -243,7 +243,7 @@ class USBMS(CLI, Device): import traceback traceback.print_exc() return changed - if isinstance(ebook_dirs, basestring): + if isinstance(ebook_dirs, string_or_bytes): ebook_dirs = [ebook_dirs] for ebook_dir in ebook_dirs: ebook_dir = self.path_to_unicode(ebook_dir) diff --git a/src/calibre/ebooks/BeautifulSoup.py b/src/calibre/ebooks/BeautifulSoup.py index d78376fb48..a6a4e0220c 100644 --- a/src/calibre/ebooks/BeautifulSoup.py +++ b/src/calibre/ebooks/BeautifulSoup.py @@ -89,7 +89,7 @@ import types import re import calibre.ebooks.sgmllib as sgmllib from htmlentitydefs import name2codepoint -from polyglot.builtins import codepoint_to_chr, unicode_type +from polyglot.builtins import codepoint_to_chr, unicode_type, string_or_bytes #This hack makes Beautiful Soup able to parse XML with namespaces sgmllib.tagfind = re.compile('[a-zA-Z][-_.:a-zA-Z0-9]*') @@ -177,7 +177,7 @@ class PageElement: return lastChild def insert(self, position, newChild): - if (isinstance(newChild, basestring) + if (isinstance(newChild, string_or_bytes) or isinstance(newChild, unicode_type)) \ and not isinstance(newChild, NavigableString): newChild = NavigableString(newChild) @@ -937,7 +937,7 @@ def isString(s): """Convenience method that works with all 2.x versions of Python to determine whether or not something is stringlike.""" try: - return isinstance(s, unicode_type) or isinstance(s, basestring) + return isinstance(s, unicode_type) or isinstance(s, string_or_bytes) except NameError: return isinstance(s, str) diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py index e3cf965787..3bfe919ea7 100644 --- a/src/calibre/ebooks/conversion/plumber.py +++ b/src/calibre/ebooks/conversion/plumber.py @@ -18,7 +18,7 @@ from calibre.utils.zipfile import ZipFile from calibre import (extract, walk, isbytestring, filesystem_encoding, get_types_map) from calibre.constants import __version__ -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes DEBUG_README=u''' This debug directory contains snapshots of the e-book as it passes through the @@ -1022,7 +1022,7 @@ OptionRecommendation(name='search_replace', def dump_input(self, ret, output_dir): out_dir = os.path.join(self.opts.debug_pipeline, 'input') - if isinstance(ret, basestring): + if isinstance(ret, string_or_bytes): shutil.copytree(output_dir, out_dir) else: if not os.path.exists(out_dir): @@ -1214,7 +1214,7 @@ OptionRecommendation(name='search_replace', transform_css_rules = () if self.opts.transform_css_rules: transform_css_rules = self.opts.transform_css_rules - if isinstance(transform_css_rules, basestring): + if isinstance(transform_css_rules, string_or_bytes): transform_css_rules = json.loads(transform_css_rules) flattener = CSSFlattener(fbase=fbase, fkey=fkey, lineh=line_height, diff --git a/src/calibre/ebooks/covers.py b/src/calibre/ebooks/covers.py index c3619487d4..4362983afd 100644 --- a/src/calibre/ebooks/covers.py +++ b/src/calibre/ebooks/covers.py @@ -10,7 +10,7 @@ import re, random, unicodedata from collections import namedtuple from contextlib import contextmanager from math import ceil, sqrt, cos, sin, atan2 -from polyglot.builtins import map, zip +from polyglot.builtins import map, zip, string_or_bytes from itertools import chain from PyQt5.Qt import ( @@ -275,7 +275,7 @@ def format_fields(mi, prefs): @contextmanager def preserve_fields(obj, fields): - if isinstance(fields, basestring): + if isinstance(fields, string_or_bytes): fields = fields.split() null = object() mem = {f:getattr(obj, f, null) for f in fields} diff --git a/src/calibre/ebooks/docx/writer/from_html.py b/src/calibre/ebooks/docx/writer/from_html.py index fb2997b672..4fe74cc998 100644 --- a/src/calibre/ebooks/docx/writer/from_html.py +++ b/src/calibre/ebooks/docx/writer/from_html.py @@ -19,7 +19,7 @@ from calibre.ebooks.docx.writer.lists import ListsManager from calibre.ebooks.oeb.stylizer import Stylizer as Sz, Style as St from calibre.ebooks.oeb.base import XPath, barename from calibre.utils.localization import lang_as_iso639_1 -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes def lang_for_tag(tag): @@ -528,7 +528,7 @@ class Convert(object): self.add_block_tag(tagname, html_tag, tag_style, stylizer, float_spec=float_spec) for child in html_tag.iterchildren(): - if isinstance(getattr(child, 'tag', None), basestring): + if isinstance(getattr(child, 'tag', None), string_or_bytes): self.process_tag(child, stylizer, float_spec=float_spec) else: # Comment/PI/etc. tail = getattr(child, 'tail', None) diff --git a/src/calibre/ebooks/fb2/fb2ml.py b/src/calibre/ebooks/fb2/fb2ml.py index 6fac9fdd84..0f2225e665 100644 --- a/src/calibre/ebooks/fb2/fb2ml.py +++ b/src/calibre/ebooks/fb2/fb2ml.py @@ -19,7 +19,7 @@ from calibre.constants import __appname__, __version__ from calibre.utils.localization import lang_as_iso639_1 from calibre.utils.img import save_cover_data_to from calibre.ebooks.oeb.base import urlnormalize -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes class FB2MLizer(object): @@ -396,9 +396,9 @@ class FB2MLizer(object): elem = elem_tree # Ensure what we are converting is not a string and that the fist tag is part of the XHTML namespace. - if not isinstance(elem_tree.tag, basestring) or namespace(elem_tree.tag) != XHTML_NS: + if not isinstance(elem_tree.tag, string_or_bytes) or namespace(elem_tree.tag) != XHTML_NS: p = elem.getparent() - if p is not None and isinstance(p.tag, basestring) and namespace(p.tag) == XHTML_NS \ + if p is not None and isinstance(p.tag, string_or_bytes) and namespace(p.tag) == XHTML_NS \ and elem.tail: return [elem.tail] return [] diff --git a/src/calibre/ebooks/htmlz/oeb2html.py b/src/calibre/ebooks/htmlz/oeb2html.py index 7a77f4c64e..f27a7308d5 100644 --- a/src/calibre/ebooks/htmlz/oeb2html.py +++ b/src/calibre/ebooks/htmlz/oeb2html.py @@ -22,7 +22,7 @@ from calibre.ebooks.oeb.base import ( XHTML, XHTML_NS, barename, namespace, OEB_IMAGES, XLINK, rewrite_links, urlnormalize) from calibre.ebooks.oeb.stylizer import Stylizer from calibre.utils.logging import default_log -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes SELF_CLOSING_TAGS = {'area', 'base', 'basefont', 'br', 'hr', 'input', 'img', 'link', 'meta'} @@ -98,7 +98,7 @@ class OEB2HTML(object): for el in root.iter(): attribs = el.attrib try: - if not isinstance(el.tag, basestring): + if not isinstance(el.tag, string_or_bytes): continue except: continue @@ -159,10 +159,10 @@ class OEB2HTMLNoCSSizer(OEB2HTML): ''' # We can only processes tags. If there isn't a tag return any text. - if not isinstance(elem.tag, basestring) \ + if not isinstance(elem.tag, string_or_bytes) \ or namespace(elem.tag) != XHTML_NS: p = elem.getparent() - if p is not None and isinstance(p.tag, basestring) and namespace(p.tag) == XHTML_NS \ + if p is not None and isinstance(p.tag, string_or_bytes) and namespace(p.tag) == XHTML_NS \ and elem.tail: return [elem.tail] return [''] @@ -248,10 +248,10 @@ class OEB2HTMLInlineCSSizer(OEB2HTML): ''' # We can only processes tags. If there isn't a tag return any text. - if not isinstance(elem.tag, basestring) \ + if not isinstance(elem.tag, string_or_bytes) \ or namespace(elem.tag) != XHTML_NS: p = elem.getparent() - if p is not None and isinstance(p.tag, basestring) and namespace(p.tag) == XHTML_NS \ + if p is not None and isinstance(p.tag, string_or_bytes) and namespace(p.tag) == XHTML_NS \ and elem.tail: return [elem.tail] return [''] @@ -351,10 +351,10 @@ class OEB2HTMLClassCSSizer(OEB2HTML): ''' # We can only processes tags. If there isn't a tag return any text. - if not isinstance(elem.tag, basestring) \ + if not isinstance(elem.tag, string_or_bytes) \ or namespace(elem.tag) != XHTML_NS: p = elem.getparent() - if p is not None and isinstance(p.tag, basestring) and namespace(p.tag) == XHTML_NS \ + if p is not None and isinstance(p.tag, string_or_bytes) and namespace(p.tag) == XHTML_NS \ and elem.tail: return [elem.tail] return [''] diff --git a/src/calibre/ebooks/lit/reader.py b/src/calibre/ebooks/lit/reader.py index 276b97c9ff..e733581117 100644 --- a/src/calibre/ebooks/lit/reader.py +++ b/src/calibre/ebooks/lit/reader.py @@ -22,7 +22,7 @@ from calibre.ebooks.oeb.base import urlnormalize, xpath from calibre.ebooks.oeb.reader import OEBReader from calibre.ebooks import DRMError from calibre import plugins -from polyglot.builtins import codepoint_to_chr, unicode_type +from polyglot.builtins import codepoint_to_chr, unicode_type, string_or_bytes lzx, lxzerror = plugins['lzx'] msdes, msdeserror = plugins['msdes'] @@ -281,7 +281,7 @@ class UnBinary(object): attr = current_map[oc] elif oc in self.attr_map: attr = self.attr_map[oc] - if not attr or not isinstance(attr, basestring): + if not attr or not isinstance(attr, string_or_bytes): raise LitError( 'Unknown attribute %d in tag %s' % (oc, tag_name)) if attr.startswith('%'): diff --git a/src/calibre/ebooks/lit/writer.py b/src/calibre/ebooks/lit/writer.py index 64db77db9f..ce1c3acdcc 100644 --- a/src/calibre/ebooks/lit/writer.py +++ b/src/calibre/ebooks/lit/writer.py @@ -31,7 +31,7 @@ import calibre from calibre import plugins msdes, msdeserror = plugins['msdes'] import calibre.ebooks.lit.mssha1 as mssha1 -from polyglot.builtins import codepoint_to_chr, unicode_type +from polyglot.builtins import codepoint_to_chr, unicode_type, string_or_bytes __all__ = ['LitWriter'] @@ -175,7 +175,7 @@ class ReBinary(object): def tree_to_binary(self, elem, nsrmap=NSRMAP, parents=[], inhead=False, preserve=False): - if not isinstance(elem.tag, basestring): + if not isinstance(elem.tag, string_or_bytes): # Don't emit any comments or raw entities return nsrmap = copy.copy(nsrmap) diff --git a/src/calibre/ebooks/lrf/html/table.py b/src/calibre/ebooks/lrf/html/table.py index e2cb0d1b9f..6d0485d82f 100644 --- a/src/calibre/ebooks/lrf/html/table.py +++ b/src/calibre/ebooks/lrf/html/table.py @@ -7,6 +7,7 @@ from calibre.ebooks.lrf.fonts import get_font from calibre.ebooks.lrf.pylrs.pylrs import TextBlock, Text, CR, Span, \ CharButton, Plot, Paragraph, \ LrsTextTag +from polyglot.builtins import string_or_bytes def ceil(num): @@ -38,7 +39,7 @@ def tokens(tb): yield 2, None elif isinstance(x, Text): yield x.text, cattrs(attrs, {}) - elif isinstance(x, basestring): + elif isinstance(x, string_or_bytes): yield x, cattrs(attrs, {}) elif isinstance(x, (CharButton, LrsTextTag)): if x.contents: @@ -382,7 +383,3 @@ class Table(object): yield tb, xpos[c], sypos, delta, None sypos += tb.blockStyle.attrs['blockheight'] - - - - diff --git a/src/calibre/ebooks/lrf/lrs/convert_from.py b/src/calibre/ebooks/lrf/lrs/convert_from.py index 44e3425b56..ed0088f1e5 100644 --- a/src/calibre/ebooks/lrf/lrs/convert_from.py +++ b/src/calibre/ebooks/lrf/lrs/convert_from.py @@ -17,6 +17,7 @@ from calibre.ebooks.lrf.pylrs.pylrs import Book, PageStyle, TextStyle, \ Italic, Sup, Sub, Bold, EmpLine, JumpButton, CharButton, Plot, \ DropCaps, Footer, RuledLine from calibre.ebooks.chardet import xml_to_unicode +from polyglot.builtins import string_or_bytes class LrsParser(object): @@ -95,7 +96,7 @@ class LrsParser(object): if isinstance(contents[0], NavigableString): contents[0] = contents[0].string.lstrip() for item in contents: - if isinstance(item, basestring): + if isinstance(item, string_or_bytes): p.append(item) elif isinstance(item, NavigableString): p.append(item.string) diff --git a/src/calibre/ebooks/lrf/objects.py b/src/calibre/ebooks/lrf/objects.py index 83895b8860..883ea82ccd 100644 --- a/src/calibre/ebooks/lrf/objects.py +++ b/src/calibre/ebooks/lrf/objects.py @@ -7,7 +7,7 @@ from calibre.ebooks.lrf import LRFParseError, PRS500_PROFILE from calibre.constants import ispy3 from calibre import entity_to_unicode, prepare_string_for_xml from calibre.ebooks.lrf.tags import Tag -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes ruby_tags = { 0xF575: ['rubyAlignAndAdjust', 'W'], @@ -121,7 +121,7 @@ class LRFContentObject(LRFObject): def handle_tag(self, tag): if tag.id in self.tag_map: action = self.tag_map[tag.id] - if isinstance(action, basestring): + if isinstance(action, string_or_bytes): func, args = action, tuple([]) else: func, args = action[0], (action[1],) @@ -880,7 +880,7 @@ class Text(LRFStream): self.add_text(stream.read(tag.word)) elif tag.id in self.__class__.text_tags: # A Text tag action = self.__class__.text_tags[tag.id] - if isinstance(action, basestring): + if isinstance(action, string_or_bytes): getattr(self, action)(tag, stream) else: getattr(self, action[0])(tag, action[1]) @@ -904,7 +904,7 @@ class Text(LRFStream): s = u'' open_containers = collections.deque() for c in self.content: - if isinstance(c, basestring): + if isinstance(c, string_or_bytes): s += prepare_string_for_xml(c).replace('\0', '') elif c is None: if open_containers: @@ -930,7 +930,7 @@ class Text(LRFStream): open_containers = collections.deque() in_p = False for c in self.content: - if isinstance(c, basestring): + if isinstance(c, string_or_bytes): s += c elif c is None: if c.name == 'P': diff --git a/src/calibre/ebooks/lrf/pylrs/elements.py b/src/calibre/ebooks/lrf/pylrs/elements.py index 08316eaa7d..f61f79b15f 100644 --- a/src/calibre/ebooks/lrf/pylrs/elements.py +++ b/src/calibre/ebooks/lrf/pylrs/elements.py @@ -1,6 +1,6 @@ """ elements.py -- replacements and helpers for ElementTree """ -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes class ElementWriter(object): @@ -24,7 +24,7 @@ class ElementWriter(object): def _writeAttribute(self, f, name, value): f.write(u' %s="' % unicode_type(name)) - if not isinstance(value, basestring): + if not isinstance(value, string_or_bytes): value = unicode_type(value) value = self._encodeCdata(value) value = value.replace('"', '"') diff --git a/src/calibre/ebooks/lrf/pylrs/pylrs.py b/src/calibre/ebooks/lrf/pylrs/pylrs.py index a5399eb5d8..7b8e5c75f4 100644 --- a/src/calibre/ebooks/lrf/pylrs/pylrs.py +++ b/src/calibre/ebooks/lrf/pylrs/pylrs.py @@ -58,6 +58,7 @@ DEFAULT_GENREADING = "fs" # default is yes to both lrf and lrs from calibre import __appname__, __version__ from calibre import entity_to_unicode +from polyglot.builtins import string_or_bytes, unicode_type class LrsError(Exception): @@ -96,7 +97,7 @@ def ElementWithReading(tag, text, reading=False): if text is None: readingText = "" - elif isinstance(text, basestring): + elif isinstance(text, string_or_bytes): readingText = text else: # assumed to be a sequence of (name, sortas) @@ -155,7 +156,7 @@ class Delegator(object): """ for setting in d.getSettings(): - if isinstance(setting, basestring): + if isinstance(setting, string_or_bytes): setting = (d, setting) delegates = \ self.delegatedSettingsDict.setdefault(setting[1], []) @@ -293,7 +294,7 @@ class LrsContainer(object): (content.__class__.__name__, self.__class__.__name__)) - if convertText and isinstance(content, basestring): + if convertText and isinstance(content, string_or_bytes): content = Text(content) content.setParent(self) @@ -587,15 +588,15 @@ class Book(Delegator): ts.attrs['baselineskip'] = rescale(ts.attrs['baselineskip']) def renderLrs(self, lrsFile, encoding="UTF-8"): - if isinstance(lrsFile, basestring): + if isinstance(lrsFile, string_or_bytes): lrsFile = codecs.open(lrsFile, "wb", encoding=encoding) self.render(lrsFile, outputEncodingName=encoding) lrsFile.close() def renderLrf(self, lrfFile): self.appendReferencedObjects(self) - if isinstance(lrfFile, basestring): - lrfFile = file(lrfFile, "wb") + if isinstance(lrfFile, string_or_bytes): + lrfFile = open(lrfFile, "wb") lrfWriter = LrfWriter(self.sourceencoding) lrfWriter.optimizeTags = self.optimizeTags @@ -1493,9 +1494,9 @@ class Paragraph(LrsContainer): def __init__(self, text=None): LrsContainer.__init__(self, [Text, CR, DropCaps, CharButton, - LrsSimpleChar1, basestring]) + LrsSimpleChar1, bytes, unicode_type]) if text is not None: - if isinstance(text, basestring): + if isinstance(text, string_or_bytes): text = Text(text) self.append(text) @@ -1528,7 +1529,7 @@ class Paragraph(LrsContainer): class LrsTextTag(LrsContainer): def __init__(self, text, validContents): - LrsContainer.__init__(self, [Text, basestring] + validContents) + LrsContainer.__init__(self, [Text, bytes, unicode_type] + validContents) if text is not None: self.append(text) @@ -1792,7 +1793,7 @@ class Box(LrsSimpleChar1, LrsContainer): """ def __init__(self, linetype="solid"): - LrsContainer.__init__(self, [Text, basestring]) + LrsContainer.__init__(self, [Text, bytes, unicode_type]) if linetype not in LINE_TYPE_ENCODING: raise LrsError(linetype + " is not a valid line type") self.linetype = linetype @@ -1812,9 +1813,9 @@ class Box(LrsSimpleChar1, LrsContainer): class Span(LrsSimpleChar1, LrsContainer): def __init__(self, text=None, **attrs): - LrsContainer.__init__(self, [LrsSimpleChar1, Text, basestring]) + LrsContainer.__init__(self, [LrsSimpleChar1, Text, bytes, unicode_type]) if text is not None: - if isinstance(text, basestring): + if isinstance(text, string_or_bytes): text = Text(text) self.append(text) @@ -1956,7 +1957,7 @@ class CharButton(LrsSimpleChar1, LrsContainer): """ def __init__(self, button, text=None): - LrsContainer.__init__(self, [basestring, Text, LrsSimpleChar1]) + LrsContainer.__init__(self, [bytes, unicode_type, Text, LrsSimpleChar1]) self.button = None if button is not None: self.setButton(button) diff --git a/src/calibre/ebooks/lrf/tags.py b/src/calibre/ebooks/lrf/tags.py index f557a8886d..ae71a6dc97 100644 --- a/src/calibre/ebooks/lrf/tags.py +++ b/src/calibre/ebooks/lrf/tags.py @@ -5,7 +5,7 @@ __copyright__ = '2008, Kovid Goyal ' import struct from calibre.ebooks.lrf import LRFParseError -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes class Tag(object): @@ -196,7 +196,7 @@ class Tag(object): self.id = 0xF500 + tag_id[0] size, self.name = self.__class__.tags[tag_id[0]] - if isinstance(size, basestring): + if isinstance(size, string_or_bytes): parser = getattr(self, size + '_parser') self.contents = parser(stream) else: diff --git a/src/calibre/ebooks/metadata/odt.py b/src/calibre/ebooks/metadata/odt.py index d520573021..1e6aa1e7fc 100644 --- a/src/calibre/ebooks/metadata/odt.py +++ b/src/calibre/ebooks/metadata/odt.py @@ -33,6 +33,7 @@ from calibre.ebooks.metadata import MetaInformation, string_to_authors, check_is from calibre.utils.imghdr import identify from calibre.utils.date import parse_date from calibre.utils.localization import canonicalize_lang +from polyglot.builtins import string_or_bytes whitespace = re.compile(r'\s+') @@ -125,7 +126,7 @@ class odfmetaparser(xml.sax.saxutils.XMLGenerator): if name == (OFFICENS,u'meta'): for k,v in self.addfields.items(): if len(v) > 0: - if isinstance(k, basestring): + if isinstance(k, string_or_bytes): xml.sax.saxutils.XMLGenerator.startElementNS(self,(METANS,u'user-defined'),None,{(METANS,u'name'):k}) xml.sax.saxutils.XMLGenerator.characters(self, v) xml.sax.saxutils.XMLGenerator.endElementNS(self, (METANS,u'user-defined'),None) @@ -270,4 +271,3 @@ def read_cover(stream, zin, mi, opfmeta, extract_cover): else: cover_data = (fmt, raw) mi.cover_data = cover_data - diff --git a/src/calibre/ebooks/metadata/rtf.py b/src/calibre/ebooks/metadata/rtf.py index 084f0d8ae9..42563bf3d9 100644 --- a/src/calibre/ebooks/metadata/rtf.py +++ b/src/calibre/ebooks/metadata/rtf.py @@ -8,7 +8,7 @@ import re, cStringIO, codecs from calibre import force_unicode from calibre.ebooks.metadata import MetaInformation, string_to_authors -from polyglot.builtins import codepoint_to_chr, unicode_type +from polyglot.builtins import codepoint_to_chr, unicode_type, string_or_bytes title_pat = re.compile(r'\{\\info.*?\{\\title(.*?)(?]+encoding\s*=\s*[\'"](.*?)[\'"][^<>]*>', re.IGNORECASE) @@ -49,6 +50,7 @@ def expand(name): prefix, name = name.partition(':')[::2] return '{%s}%s' % (NS_MAP[prefix], name) + xpath_cache = {} @@ -478,7 +480,7 @@ def metadata_to_xmp_packet(mi): 'authors':('dc:creator', True), 'tags':('dc:subject', False), 'publisher':('dc:publisher', False), }.iteritems(): val = mi.get(prop) or () - if isinstance(val, basestring): + if isinstance(val, string_or_bytes): val = [val] create_sequence_property(dc, tag, val, ordered) if not mi.is_null('pubdate'): @@ -636,10 +638,10 @@ def merge_xmp_packet(old, new): return serialize_xmp_packet(root) + if __name__ == '__main__': from calibre.utils.podofo import get_xmp_metadata xmp_packet = get_xmp_metadata(sys.argv[-1]) mi = metadata_from_xmp_packet(xmp_packet) np = metadata_to_xmp_packet(mi) - print (merge_xmp_packet(xmp_packet, np)) - + print(merge_xmp_packet(xmp_packet, np)) diff --git a/src/calibre/ebooks/mobi/mobiml.py b/src/calibre/ebooks/mobi/mobiml.py index 4db55b204e..effa29c7a0 100644 --- a/src/calibre/ebooks/mobi/mobiml.py +++ b/src/calibre/ebooks/mobi/mobiml.py @@ -16,7 +16,7 @@ from calibre.ebooks.oeb.stylizer import Stylizer from calibre.ebooks.oeb.transforms.flatcss import KeyMapper from calibre.ebooks.mobi.utils import convert_color_for_font_tag from calibre.utils.imghdr import identify -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes MBP_NS = 'http://mobipocket.com/ns/mbp' @@ -144,7 +144,7 @@ class MobiMLizer(object): return self.fnums[self.fmap[ptsize]] def mobimlize_measure(self, ptsize): - if isinstance(ptsize, basestring): + if isinstance(ptsize, string_or_bytes): return ptsize embase = self.profile.fbase if round(ptsize) < embase: @@ -187,7 +187,7 @@ class MobiMLizer(object): parent = bstate.nested[-1] if bstate.nested else bstate.body indent = istate.indent left = istate.left - if isinstance(indent, basestring): + if isinstance(indent, string_or_bytes): indent = 0 if indent < 0 and abs(indent) < left: left += indent @@ -308,7 +308,7 @@ class MobiMLizer(object): inline = bstate.inline content = self.preize_text(text, pre_wrap=istate.pre_wrap) if istate.preserve or istate.pre_wrap else [text] for item in content: - if isinstance(item, basestring): + if isinstance(item, string_or_bytes): if len(inline) == 0: inline.text = (inline.text or '') + item else: @@ -319,7 +319,7 @@ class MobiMLizer(object): def mobimlize_elem(self, elem, stylizer, bstate, istates, ignore_valign=False): - if not isinstance(elem.tag, basestring) \ + if not isinstance(elem.tag, string_or_bytes) \ or namespace(elem.tag) != XHTML_NS: return style = stylizer.style(elem) diff --git a/src/calibre/ebooks/mobi/writer2/serializer.py b/src/calibre/ebooks/mobi/writer2/serializer.py index c86dfff2be..65343c3a6d 100644 --- a/src/calibre/ebooks/mobi/writer2/serializer.py +++ b/src/calibre/ebooks/mobi/writer2/serializer.py @@ -18,7 +18,7 @@ from calibre.ebooks.mobi.utils import is_guide_ref_start from calibre.ebooks.oeb.base import ( OEB_DOCS, XHTML, XHTML_NS, XML_NS, namespace, prefixname, urlnormalize ) -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes class Buf(BytesIO): @@ -310,7 +310,7 @@ class Serializer(object): def serialize_elem(self, elem, item, nsrmap=NSRMAP): buf = self.buf - if not isinstance(elem.tag, basestring) \ + if not isinstance(elem.tag, string_or_bytes) \ or namespace(elem.tag) not in nsrmap: return tag = prefixname(elem.tag, nsrmap) diff --git a/src/calibre/ebooks/odt/input.py b/src/calibre/ebooks/odt/input.py index 7f02d187b6..abb2f18daf 100644 --- a/src/calibre/ebooks/odt/input.py +++ b/src/calibre/ebooks/odt/input.py @@ -19,7 +19,7 @@ from odf.namespaces import TEXTNS as odTEXTNS from calibre import CurrentDir, walk from calibre.ebooks.oeb.base import _css_logger -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes class Extract(ODF2XHTML): @@ -249,7 +249,7 @@ class Extract(ODF2XHTML): # first load the odf structure self.lines = [] self._wfunc = self._wlines - if isinstance(odffile, basestring) \ + if isinstance(odffile, string_or_bytes) \ or hasattr(odffile, 'read'): # Added by Kovid self.document = odLoad(odffile) else: diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 9c16e54ee4..d312faf993 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -22,7 +22,7 @@ from calibre.ebooks.oeb.parse_utils import (barename, XHTML_NS, RECOVER_PARSER, namespace, XHTML, parse_html, NotHTML) from calibre.utils.cleantext import clean_xml_chars from calibre.utils.short_uuid import uuid4 -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes XML_NS = 'http://www.w3.org/XML/1998/namespace' OEB_DOC_NS = 'http://openebook.org/namespaces/oeb-document/1.0/' @@ -1055,7 +1055,7 @@ class Manifest(object): mt = self.media_type.lower() except Exception: mt = 'application/octet-stream' - if not isinstance(data, basestring): + if not isinstance(data, string_or_bytes): pass # already parsed elif mt in OEB_DOCS: data = self._parse_xhtml(data) @@ -1318,7 +1318,7 @@ class Spine(object): self.page_progression_direction = None def _linear(self, linear): - if isinstance(linear, basestring): + if isinstance(linear, string_or_bytes): linear = linear.lower() if linear is None or linear in ('yes', 'true'): linear = True diff --git a/src/calibre/ebooks/oeb/normalize_css.py b/src/calibre/ebooks/oeb/normalize_css.py index 117b90520d..a3bb7a0ad3 100644 --- a/src/calibre/ebooks/oeb/normalize_css.py +++ b/src/calibre/ebooks/oeb/normalize_css.py @@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' -from polyglot.builtins import zip +from polyglot.builtins import zip, string_or_bytes from functools import wraps from css_parser.css import PropertyValue @@ -127,10 +127,10 @@ def normalize_font(cssvalue, font_family_as_list=False): ans = {k:DEFAULTS[k] for k in composition} ans.update(parse_font(val)) if font_family_as_list: - if isinstance(ans['font-family'], basestring): + if isinstance(ans['font-family'], string_or_bytes): ans['font-family'] = [x.strip() for x in ans['font-family'].split(',')] else: - if not isinstance(ans['font-family'], basestring): + if not isinstance(ans['font-family'], string_or_bytes): ans['font-family'] = serialize_font_family(ans['font-family']) return ans diff --git a/src/calibre/ebooks/oeb/parse_utils.py b/src/calibre/ebooks/oeb/parse_utils.py index 2dd153799d..ed80b7d083 100644 --- a/src/calibre/ebooks/oeb/parse_utils.py +++ b/src/calibre/ebooks/oeb/parse_utils.py @@ -14,7 +14,7 @@ from lxml import etree, html from calibre import xml_replace_entities, force_unicode from calibre.constants import filesystem_encoding from calibre.ebooks.chardet import xml_to_unicode, strip_encoding_declarations -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes RECOVER_PARSER = etree.XMLParser(recover=True, no_network=True) XHTML_NS = 'http://www.w3.org/1999/xhtml' @@ -99,7 +99,7 @@ def html5_parse(data, max_nesting_depth=100): # Check that the asinine HTML 5 algorithm did not result in a tree with # insane nesting depths for x in data.iterdescendants(): - if isinstance(x.tag, basestring) and not len(x): # Leaf node + if isinstance(x.tag, string_or_bytes) and not len(x): # Leaf node depth = node_depth(x) if depth > max_nesting_depth: raise ValueError('HTML 5 parsing resulted in a tree with nesting' @@ -310,7 +310,7 @@ def parse_html(data, log=None, decoder=None, preprocessor=None, nroot = etree.Element(XHTML('html'), nsmap={None: XHTML_NS}, attrib=attrib) for elem in data.iterdescendants(): - if isinstance(elem.tag, basestring) and \ + if isinstance(elem.tag, string_or_bytes) and \ namespace(elem.tag) == ns: elem.tag = XHTML(barename(elem.tag)) for elem in data: diff --git a/src/calibre/ebooks/oeb/polish/embed.py b/src/calibre/ebooks/oeb/polish/embed.py index 18ca638ab9..ad57d3f6ed 100644 --- a/src/calibre/ebooks/oeb/polish/embed.py +++ b/src/calibre/ebooks/oeb/polish/embed.py @@ -15,13 +15,14 @@ from lxml import etree from calibre import prints from calibre.ebooks.oeb.base import XHTML from calibre.utils.filenames import ascii_filename +from polyglot.builtins import string_or_bytes props = {'font-family':None, 'font-weight':'normal', 'font-style':'normal', 'font-stretch':'normal'} def matching_rule(font, rules): ff = font['font-family'] - if not isinstance(ff, basestring): + if not isinstance(ff, string_or_bytes): ff = tuple(ff)[0] family = icu_lower(ff) wt = font['font-weight'] @@ -31,7 +32,7 @@ def matching_rule(font, rules): for rule in rules: if rule['font-style'] == style and rule['font-stretch'] == stretch and rule['font-weight'] == wt: ff = rule['font-family'] - if not isinstance(ff, basestring): + if not isinstance(ff, string_or_bytes): ff = tuple(ff)[0] if icu_lower(ff) == family: return rule @@ -162,7 +163,7 @@ def do_embed(container, font, report): def embed_font(container, font, all_font_rules, report, warned): rule = matching_rule(font, all_font_rules) ff = font['font-family'] - if not isinstance(ff, basestring): + if not isinstance(ff, string_or_bytes): ff = ff[0] if rule is None: from calibre.utils.fonts.scanner import font_scanner, NoFonts diff --git a/src/calibre/ebooks/oeb/polish/split.py b/src/calibre/ebooks/oeb/polish/split.py index ad925d529f..fc9f92c600 100644 --- a/src/calibre/ebooks/oeb/polish/split.py +++ b/src/calibre/ebooks/oeb/polish/split.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' import copy, os, re -from polyglot.builtins import map +from polyglot.builtins import map, string_or_bytes from urlparse import urlparse from calibre.ebooks.oeb.base import barename, XPNSMAP, XPath, OPF, XHTML, OEB_DOCS @@ -395,9 +395,9 @@ def merge_html(container, names, master): first_child = '' for first_child in children: - if not isinstance(first_child, basestring): + if not isinstance(first_child, string_or_bytes): break - if isinstance(first_child, basestring): + if isinstance(first_child, string_or_bytes): # body contained only text, no tags first_child = body.makeelement(XHTML('p')) first_child.text, children[0] = children[0], first_child @@ -429,7 +429,7 @@ def merge_html(container, names, master): a.set('href', '#' + amap[q]) for child in children: - if isinstance(child, basestring): + if isinstance(child, string_or_bytes): add_text(master_body, child) else: master_body.append(copy.deepcopy(child)) diff --git a/src/calibre/ebooks/oeb/transforms/flatcss.py b/src/calibre/ebooks/oeb/transforms/flatcss.py index 6af6fd2559..dd64a3a2ef 100644 --- a/src/calibre/ebooks/oeb/transforms/flatcss.py +++ b/src/calibre/ebooks/oeb/transforms/flatcss.py @@ -21,7 +21,7 @@ from calibre.ebooks.oeb.base import (XHTML, XHTML_NS, CSS_MIME, OEB_STYLES, from calibre.ebooks.oeb.stylizer import Stylizer from calibre.utils.filenames import ascii_filename, ascii_text from calibre.utils.icu import numeric_sort_key -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes COLLAPSE = re.compile(r'[ \t\r\n\v]+') STRIPNUM = re.compile(r'[-0-9]+$') @@ -367,7 +367,7 @@ class CSSFlattener(object): cssdict[property] = "%0.5fem" % (value / fsize) def flatten_node(self, node, stylizer, names, styles, pseudo_styles, psize, item_id): - if not isinstance(node.tag, basestring) \ + if not isinstance(node.tag, string_or_bytes) \ or namespace(node.tag) != XHTML_NS: return tag = barename(node.tag) diff --git a/src/calibre/ebooks/oeb/transforms/manglecase.py b/src/calibre/ebooks/oeb/transforms/manglecase.py index 47f5a2a855..9269a90084 100644 --- a/src/calibre/ebooks/oeb/transforms/manglecase.py +++ b/src/calibre/ebooks/oeb/transforms/manglecase.py @@ -11,6 +11,7 @@ from calibre.ebooks.oeb.base import XHTML, XHTML_NS from calibre.ebooks.oeb.base import CSS_MIME from calibre.ebooks.oeb.base import namespace from calibre.ebooks.oeb.stylizer import Stylizer +from polyglot.builtins import string_or_bytes CASE_MANGLER_CSS = """ .calibre_lowercase { @@ -95,7 +96,7 @@ class CaseMangler(object): last = child def mangle_elem(self, elem, stylizer): - if not isinstance(elem.tag, basestring) or \ + if not isinstance(elem.tag, string_or_bytes) or \ namespace(elem.tag) != XHTML_NS: return children = list(elem) diff --git a/src/calibre/ebooks/pml/pmlml.py b/src/calibre/ebooks/pml/pmlml.py index d024ca7581..f6f737275e 100644 --- a/src/calibre/ebooks/pml/pmlml.py +++ b/src/calibre/ebooks/pml/pmlml.py @@ -14,7 +14,7 @@ from lxml import etree from calibre.ebooks.pdb.ereader import image_name from calibre.ebooks.pml import unipmlcode -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes TAG_MAP = { 'b' : 'B', @@ -224,9 +224,9 @@ class PMLMLizer(object): def dump_text(self, elem, stylizer, page, tag_stack=[]): from calibre.ebooks.oeb.base import XHTML_NS, barename, namespace - if not isinstance(elem.tag, basestring) or namespace(elem.tag) != XHTML_NS: + if not isinstance(elem.tag, string_or_bytes) or namespace(elem.tag) != XHTML_NS: p = elem.getparent() - if p is not None and isinstance(p.tag, basestring) and namespace(p.tag) == XHTML_NS \ + if p is not None and isinstance(p.tag, string_or_bytes) and namespace(p.tag) == XHTML_NS \ and elem.tail: return [elem.tail] return [] diff --git a/src/calibre/ebooks/rb/rbml.py b/src/calibre/ebooks/rb/rbml.py index fd181bb17a..a337086388 100644 --- a/src/calibre/ebooks/rb/rbml.py +++ b/src/calibre/ebooks/rb/rbml.py @@ -12,6 +12,7 @@ import re from calibre import prepare_string_for_xml from calibre.ebooks.rb import unique_name +from polyglot.builtins import string_or_bytes TAGS = [ 'b', @@ -142,9 +143,9 @@ class RBMLizer(object): def dump_text(self, elem, stylizer, page, tag_stack=[]): from calibre.ebooks.oeb.base import XHTML_NS, barename, namespace - if not isinstance(elem.tag, basestring) or namespace(elem.tag) != XHTML_NS: + if not isinstance(elem.tag, string_or_bytes) or namespace(elem.tag) != XHTML_NS: p = elem.getparent() - if p is not None and isinstance(p.tag, basestring) and namespace(p.tag) == XHTML_NS \ + if p is not None and isinstance(p.tag, string_or_bytes) and namespace(p.tag) == XHTML_NS \ and elem.tail: return [elem.tail] return [u''] diff --git a/src/calibre/ebooks/rtf/rtfml.py b/src/calibre/ebooks/rtf/rtfml.py index 8cb1422dc3..92de7f0c2e 100644 --- a/src/calibre/ebooks/rtf/rtfml.py +++ b/src/calibre/ebooks/rtf/rtfml.py @@ -17,7 +17,7 @@ from lxml import etree from calibre.ebooks.metadata import authors_to_string from calibre.utils.img import save_cover_data_to from calibre.utils.imghdr import identify -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes TAGS = { 'b': '\\b', @@ -224,10 +224,10 @@ class RTFMLizer(object): from calibre.ebooks.oeb.base import (XHTML_NS, namespace, barename, urlnormalize) - if not isinstance(elem.tag, basestring) \ + if not isinstance(elem.tag, string_or_bytes) \ or namespace(elem.tag) != XHTML_NS: p = elem.getparent() - if p is not None and isinstance(p.tag, basestring) and namespace(p.tag) == XHTML_NS \ + if p is not None and isinstance(p.tag, string_or_bytes) and namespace(p.tag) == XHTML_NS \ and elem.tail: return elem.tail return u'' diff --git a/src/calibre/ebooks/snb/snbml.py b/src/calibre/ebooks/snb/snbml.py index 29fdf4210a..d04c590ab9 100644 --- a/src/calibre/ebooks/snb/snbml.py +++ b/src/calibre/ebooks/snb/snbml.py @@ -12,7 +12,7 @@ import os import re from lxml import etree -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes def ProcessFileName(fileName): @@ -212,10 +212,10 @@ class SNBMLizer(object): def dump_text(self, subitems, elem, stylizer, end='', pre=False, li=''): from calibre.ebooks.oeb.base import XHTML_NS, barename, namespace - if not isinstance(elem.tag, basestring) \ + if not isinstance(elem.tag, string_or_bytes) \ or namespace(elem.tag) != XHTML_NS: p = elem.getparent() - if p is not None and isinstance(p.tag, basestring) and namespace(p.tag) == XHTML_NS \ + if p is not None and isinstance(p.tag, string_or_bytes) and namespace(p.tag) == XHTML_NS \ and elem.tail: return [elem.tail] return [''] diff --git a/src/calibre/ebooks/txt/markdownml.py b/src/calibre/ebooks/txt/markdownml.py index 6f121de4c1..70346df569 100644 --- a/src/calibre/ebooks/txt/markdownml.py +++ b/src/calibre/ebooks/txt/markdownml.py @@ -15,7 +15,7 @@ from functools import partial from calibre.ebooks.htmlz.oeb2html import OEB2HTML from calibre.ebooks.oeb.base import XHTML, XHTML_NS, barename, namespace, rewrite_links from calibre.ebooks.oeb.stylizer import Stylizer -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes class MarkdownMLizer(OEB2HTML): @@ -111,10 +111,10 @@ class MarkdownMLizer(OEB2HTML): ''' # We can only processes tags. If there isn't a tag return any text. - if not isinstance(elem.tag, basestring) \ + if not isinstance(elem.tag, string_or_bytes) \ or namespace(elem.tag) != XHTML_NS: p = elem.getparent() - if p is not None and isinstance(p.tag, basestring) and namespace(p.tag) == XHTML_NS \ + if p is not None and isinstance(p.tag, string_or_bytes) and namespace(p.tag) == XHTML_NS \ and elem.tail: return [elem.tail] return [''] diff --git a/src/calibre/ebooks/txt/textileml.py b/src/calibre/ebooks/txt/textileml.py index 1786c0a4ff..b4f12e2e74 100644 --- a/src/calibre/ebooks/txt/textileml.py +++ b/src/calibre/ebooks/txt/textileml.py @@ -16,6 +16,7 @@ from calibre.ebooks.oeb.base import XHTML, XHTML_NS, barename, namespace, rewrit from calibre.ebooks.oeb.stylizer import Stylizer from calibre.ebooks import unit_convert from calibre.ebooks.textile.unsmarten import unsmarten +from polyglot.builtins import string_or_bytes class TextileMLizer(OEB2HTML): @@ -72,9 +73,9 @@ class TextileMLizer(OEB2HTML): # I'm not checking for duplicated spans '%' as any that follow each other were being incorrectly merged txt = '%s' % t if txt != '%': - text = re.sub(r'([^'+t+'|^\n])'+t+'\]\['+t+'([^'+t+'])', r'\1\2', text) + text = re.sub(r'([^'+t+'|^\n])'+t+r'\]\['+t+'([^'+t+'])', r'\1\2', text) text = re.sub(r'([^'+t+'|^\n])'+t+t+'([^'+t+'])', r'\1\2', text) - text = re.sub(r'(\s|[*_\'"])\[('+t+'[a-zA-Z0-9 \'",.*_]+'+t+')\](\s|[*_\'"?!,.])', r'\1\2\3', text) + text = re.sub(r'(\s|[*_\'"])\[('+t+'[a-zA-Z0-9 \'",.*_]+'+t+r')\](\s|[*_\'"?!,.])', r'\1\2\3', text) return text # Now tidyup links and ids - remove ones that don't have a correponding opposite @@ -82,13 +83,13 @@ class TextileMLizer(OEB2HTML): for i in self.our_links: if i[0] == '#': if i not in self.our_ids: - text = re.sub(r'"(.+)":'+i+'(\s)', r'\1\2', text) + text = re.sub(r'"(.+)":'+i+r'(\s)', r'\1\2', text) for i in self.our_ids: if i not in self.our_links: - text = re.sub(r'%?\('+i+'\)\xa0?%?', r'', text) + text = re.sub(r'%?\('+i+'\\)\xa0?%?', r'', text) # Remove obvious non-needed escaping, add sub/sup-script ones - text = check_escaping(text, ['\*', '_', '\*']) + text = check_escaping(text, [r'\*', '_', r'\*']) # escape the super/sub-scripts if needed text = re.sub(r'(\w)([~^]\w+[~^])', r'\1[\2]', text) # escape the super/sub-scripts if needed @@ -111,16 +112,16 @@ class TextileMLizer(OEB2HTML): # reduce blank lines text = re.sub(r'\n{3}', r'\n\np. \n\n', text) - text = re.sub(u'%\n(p[<>=]{1,2}\.|p\.)', r'%\n\n\1', text) + text = re.sub(u'%\n(p[<>=]{1,2}\\.|p\\.)', r'%\n\n\1', text) # Check span following blank para text = re.sub(r'\n+ +%', r' %', text) - text = re.sub(u'p[<>=]{1,2}\.\n\n?', r'', text) + text = re.sub(u'p[<>=]{1,2}\\.\n\n?', r'', text) # blank paragraph text = re.sub(r'\n(p.*\.)\n', r'\n\1 \n\n', text) # blank paragraph text = re.sub(u'\n\xa0', r'\np. ', text) # blank paragraph - text = re.sub(u'\np[<>=]{1,2}?\. \xa0', r'\np. ', text) + text = re.sub(u'\np[<>=]{1,2}?\\. \xa0', r'\np. ', text) text = re.sub(r'(^|\n)(p.*\. ?\n)(p.*\.)', r'\1\3', text) text = re.sub(r'\n(p\. \n)(p.*\.|h.*\.)', r'\n\2', text) # sort out spaces in tables @@ -225,10 +226,10 @@ class TextileMLizer(OEB2HTML): ''' # We can only processes tags. If there isn't a tag return any text. - if not isinstance(elem.tag, basestring) \ + if not isinstance(elem.tag, string_or_bytes) \ or namespace(elem.tag) != XHTML_NS: p = elem.getparent() - if p is not None and isinstance(p.tag, basestring) and namespace(p.tag) == XHTML_NS \ + if p is not None and isinstance(p.tag, string_or_bytes) and namespace(p.tag) == XHTML_NS \ and elem.tail: return [elem.tail] return [''] diff --git a/src/calibre/ebooks/txt/txtml.py b/src/calibre/ebooks/txt/txtml.py index fd653f8b7b..2ef99d4884 100644 --- a/src/calibre/ebooks/txt/txtml.py +++ b/src/calibre/ebooks/txt/txtml.py @@ -11,7 +11,7 @@ Transform OEB content into plain text import re from lxml import etree -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes BLOCK_TAGS = [ @@ -192,10 +192,10 @@ class TXTMLizer(object): ''' from calibre.ebooks.oeb.base import XHTML_NS, barename, namespace - if not isinstance(elem.tag, basestring) \ + if not isinstance(elem.tag, string_or_bytes) \ or namespace(elem.tag) != XHTML_NS: p = elem.getparent() - if p is not None and isinstance(p.tag, basestring) and namespace(p.tag) == XHTML_NS \ + if p is not None and isinstance(p.tag, string_or_bytes) and namespace(p.tag) == XHTML_NS \ and elem.tail: return [elem.tail] return [''] diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index dc8e3993ae..8275e0b7ba 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -35,7 +35,7 @@ from calibre.utils.config import Config, ConfigProxy, JSONConfig, dynamic from calibre.utils.date import UNDEFINED_DATE from calibre.utils.file_type_icons import EXT_MAP from calibre.utils.localization import get_lang -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes try: NO_URL_FORMATTING = QUrl.None_ @@ -1125,7 +1125,7 @@ def open_url(qurl): # Qt 5 requires QApplication to be constructed before trying to use # QDesktopServices::openUrl() ensure_app() - if isinstance(qurl, basestring): + if isinstance(qurl, string_or_bytes): qurl = QUrl(qurl) with sanitize_env_vars(): QDesktopServices.openUrl(qurl) diff --git a/src/calibre/gui2/actions/__init__.py b/src/calibre/gui2/actions/__init__.py index d60a26e42d..30f85adef6 100644 --- a/src/calibre/gui2/actions/__init__.py +++ b/src/calibre/gui2/actions/__init__.py @@ -15,7 +15,7 @@ from calibre import prints from calibre.constants import isosx from calibre.gui2 import Dispatcher from calibre.gui2.keyboard import NameConflict -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes def menu_action_unique_name(plugin, unique_name): @@ -177,7 +177,7 @@ class InterfaceAction(QObject): if attr == 'qaction': shortcut_action = ma if shortcut is not None: - keys = ((shortcut,) if isinstance(shortcut, basestring) else + keys = ((shortcut,) if isinstance(shortcut, string_or_bytes) else tuple(shortcut)) if shortcut_name is None and spec[0]: shortcut_name = unicode_type(spec[0]) @@ -249,7 +249,7 @@ class InterfaceAction(QObject): ac.setIcon(icon) keys = () if shortcut is not None and shortcut is not False: - keys = ((shortcut,) if isinstance(shortcut, basestring) else + keys = ((shortcut,) if isinstance(shortcut, string_or_bytes) else tuple(shortcut)) unique_name = menu_action_unique_name(self, unique_name) if description is not None: diff --git a/src/calibre/gui2/actions/add.py b/src/calibre/gui2/actions/add.py index 94fae7d247..28f45282f0 100644 --- a/src/calibre/gui2/actions/add.py +++ b/src/calibre/gui2/actions/add.py @@ -25,6 +25,7 @@ from calibre.gui2.actions import InterfaceAction from calibre.gui2 import question_dialog from calibre.ebooks.metadata import MetaInformation from calibre.ptempfile import PersistentTemporaryFile +from polyglot.builtins import string_or_bytes def get_filters(): @@ -436,7 +437,7 @@ class AddAction(InterfaceAction): self.gui.refresh_cover_browser() def __add_filesystem_book(self, paths, allow_device=True): - if isinstance(paths, basestring): + if isinstance(paths, string_or_bytes): paths = [paths] books = [path for path in map(os.path.abspath, paths) if os.access(path, os.R_OK)] @@ -591,7 +592,7 @@ class AddAction(InterfaceAction): self.gui.device_job_exception(job) return paths = job.result - ok_paths = [x for x in paths if isinstance(x, basestring)] + ok_paths = [x for x in paths if isinstance(x, string_or_bytes)] failed_paths = [x for x in paths if isinstance(x, tuple)] if failed_paths: if not ok_paths: diff --git a/src/calibre/gui2/actions/similar_books.py b/src/calibre/gui2/actions/similar_books.py index fe2d0e4e0a..5febe5f51f 100644 --- a/src/calibre/gui2/actions/similar_books.py +++ b/src/calibre/gui2/actions/similar_books.py @@ -9,6 +9,7 @@ __docformat__ = 'restructuredtext en' from PyQt5.Qt import QToolButton from calibre.gui2.actions import InterfaceAction +from polyglot.builtins import string_or_bytes class SimilarBooksAction(InterfaceAction): @@ -74,7 +75,7 @@ class SimilarBooksAction(InterfaceAction): if not val: return - if isinstance(val, basestring): + if isinstance(val, string_or_bytes): val = [val] search = [col + ':"='+t.replace('"', '\\"')+'"' for t in val] if search: diff --git a/src/calibre/gui2/add.py b/src/calibre/gui2/add.py index c9bb3fbc41..482b735745 100644 --- a/src/calibre/gui2/add.py +++ b/src/calibre/gui2/add.py @@ -11,7 +11,7 @@ from threading import Thread from collections import OrderedDict from Queue import Empty from io import BytesIO -from polyglot.builtins import map, unicode_type +from polyglot.builtins import map, unicode_type, string_or_bytes from PyQt5.Qt import QObject, Qt, pyqtSignal @@ -33,7 +33,7 @@ from calibre.utils.ipc.pool import Pool, Failure def validate_source(source, parent=None): # {{{ - if isinstance(source, basestring): + if isinstance(source, string_or_bytes): if not os.path.exists(source): error_dialog(parent, _('Cannot add books'), _( 'The path %s does not exist') % source, show=True) @@ -173,7 +173,7 @@ class Adder(QObject): return tdir try: - if isinstance(self.source, basestring): + if isinstance(self.source, string_or_bytes): find_files(self.source) self.ignore_opf = True else: diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index f4b54a08ba..7d5beb3359 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -34,7 +34,7 @@ from calibre.utils.config import tweaks, device_prefs from calibre.utils.img import scale_image from calibre.library.save_to_disk import find_plugboard from calibre.ptempfile import PersistentTemporaryFile, force_unicode as filename_to_unicode -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes # }}} @@ -471,7 +471,7 @@ class DeviceManager(Thread): # {{{ info = self.device.get_device_information(end_session=False) if len(info) < 5: info = tuple(list(info) + [{}]) - info = [i.replace('\x00', '').replace('\x01', '') if isinstance(i, basestring) else i + info = [i.replace('\x00', '').replace('\x01', '') if isinstance(i, string_or_bytes) else i for i in info] cp = self.device.card_prefix(end_session=False) fs = self.device.free_space() diff --git a/src/calibre/gui2/ebook_download.py b/src/calibre/gui2/ebook_download.py index 50739ce13d..76d4a2e8bb 100644 --- a/src/calibre/gui2/ebook_download.py +++ b/src/calibre/gui2/ebook_download.py @@ -19,6 +19,7 @@ from calibre.gui2.threaded_jobs import ThreadedJob from calibre.ptempfile import PersistentTemporaryDirectory from calibre.utils.filenames import ascii_filename from calibre.web import get_download_filename_from_response +from polyglot.builtins import string_or_bytes class DownloadInfo(MessageBox): @@ -141,7 +142,7 @@ class EbookDownloadMixin(object): def download_ebook(self, url='', cookie_file=None, filename='', save_loc='', add_to_lib=True, tags=[], create_browser=None): if tags: - if isinstance(tags, basestring): + if isinstance(tags, string_or_bytes): tags = tags.split(',') start_ebook_download(Dispatcher(self.downloaded_ebook), self.job_manager, self, cookie_file, url, filename, save_loc, add_to_lib, tags, create_browser) self.status_bar.show_message(_('Downloading') + ' ' + filename.decode('utf-8', 'ignore') if filename else url.decode('utf-8', 'ignore'), 3000) diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index c11d8be97c..49c6df478e 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -30,7 +30,7 @@ from calibre.constants import filesystem_encoding, DEBUG, config_dir from calibre.gui2.library import DEFAULT_SORT from calibre.utils.localization import calibre_langcode_to_name from calibre.library.coloring import color_row_key -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes Counts = namedtuple('Counts', 'library_total total current') @@ -1282,7 +1282,7 @@ class OnDeviceSearch(SearchQueryParser): # {{{ vals = accessor(row) if vals is None: vals = '' - if isinstance(vals, basestring): + if isinstance(vals, string_or_bytes): vals = vals.split(',') if locvalue == 'collections' else [vals] if _match(query, vals, m, use_primary_find_in_search=upf): matches.add(index) diff --git a/src/calibre/gui2/linux_file_dialogs.py b/src/calibre/gui2/linux_file_dialogs.py index a012ae25c4..b324265ff8 100644 --- a/src/calibre/gui2/linux_file_dialogs.py +++ b/src/calibre/gui2/linux_file_dialogs.py @@ -11,7 +11,7 @@ import sys import time from threading import Thread -from polyglot.builtins import reraise, unicode_type +from polyglot.builtins import reraise, unicode_type, string_or_bytes from PyQt5.Qt import QEventLoop from calibre import force_unicode @@ -68,7 +68,7 @@ def get_initial_dir(name, title, default_dir, no_save_dir): return ensure_dir(process_path(default_dir)) key = dialog_name(name, title) saved = dynamic.get(key) - if not isinstance(saved, basestring): + if not isinstance(saved, string_or_bytes): saved = None if saved and os.path.isdir(saved): return ensure_dir(process_path(saved)) diff --git a/src/calibre/gui2/lrf_renderer/text.py b/src/calibre/gui2/lrf_renderer/text.py index 8e30c0162c..3467a09e68 100644 --- a/src/calibre/gui2/lrf_renderer/text.py +++ b/src/calibre/gui2/lrf_renderer/text.py @@ -10,7 +10,7 @@ from PyQt5.Qt import ( from calibre.ebooks.lrf.fonts import LIBERATION_FONT_MAP from calibre.ebooks.BeautifulSoup import Tag from calibre.ebooks.hyphenate import hyphenate_word -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes WEIGHT_MAP = lambda wt : int((wt/10.)-1) NULL = lambda a, b: a @@ -223,7 +223,7 @@ class TextBlock(object): open_containers = collections.deque() self.in_para = False for i in tb.content: - if isinstance(i, basestring): + if isinstance(i, string_or_bytes): self.process_text(i) elif i is None: if len(open_containers) > 0: diff --git a/src/calibre/gui2/open_with.py b/src/calibre/gui2/open_with.py index 565dcfdc50..4000649201 100644 --- a/src/calibre/gui2/open_with.py +++ b/src/calibre/gui2/open_with.py @@ -22,6 +22,7 @@ from calibre.gui2.widgets2 import Dialog from calibre.gui2.progress_indicator import ProgressIndicator from calibre.utils.config import JSONConfig from calibre.utils.icu import numeric_sort_key as sort_key +from polyglot.builtins import string_or_bytes ENTRY_ROLE = Qt.UserRole @@ -197,7 +198,7 @@ else: def entry_to_item(entry, parent): icon_path = entry.get('Icon') or I('blank.png') - if not isinstance(icon_path, basestring): + if not isinstance(icon_path, string_or_bytes): icon_path = I('blank.png') ans = QListWidgetItem(QIcon(icon_path), entry.get('Name') or _('Unknown'), parent) ans.setData(ENTRY_ROLE, entry) diff --git a/src/calibre/gui2/preferences/__init__.py b/src/calibre/gui2/preferences/__init__.py index 4b87413192..304043d4ef 100644 --- a/src/calibre/gui2/preferences/__init__.py +++ b/src/calibre/gui2/preferences/__init__.py @@ -14,7 +14,7 @@ from PyQt5.Qt import (QWidget, pyqtSignal, QCheckBox, QAbstractSpinBox, from calibre.customize.ui import preferences_plugins from calibre.utils.config import ConfigProxy from calibre.gui2.complete2 import EditWithComplete -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes class AbortCommit(Exception): @@ -144,7 +144,7 @@ class Setting(object): else: self.gui_obj.clear() for x in choices: - if isinstance(x, basestring): + if isinstance(x, string_or_bytes): x = (x, x) self.gui_obj.addItem(x[0], (x[1])) self.set_gui_val(self.get_config_val(default=False)) diff --git a/src/calibre/gui2/qt_file_dialogs.py b/src/calibre/gui2/qt_file_dialogs.py index 632e243789..11223c12e3 100644 --- a/src/calibre/gui2/qt_file_dialogs.py +++ b/src/calibre/gui2/qt_file_dialogs.py @@ -11,7 +11,7 @@ from PyQt5.Qt import QFileDialog, QObject from calibre.gui2.linux_file_dialogs import dialog_name, image_extensions from calibre.utils.filenames import expanduser -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes def select_initial_dir(q): @@ -71,7 +71,7 @@ class FileDialog(QObject): else: initial_dir = dynamic.get(self.dialog_name, expanduser(default_dir)) - if not isinstance(initial_dir, basestring): + if not isinstance(initial_dir, string_or_bytes): initial_dir = expanduser(default_dir) if not initial_dir or (not os.path.exists(initial_dir) and not ( mode == QFileDialog.AnyFile and (no_save_dir or combine_file_and_saved_dir))): diff --git a/src/calibre/gui2/search_box.py b/src/calibre/gui2/search_box.py index c8c011b7d5..a92ef4a1a1 100644 --- a/src/calibre/gui2/search_box.py +++ b/src/calibre/gui2/search_box.py @@ -20,7 +20,7 @@ from calibre.gui2.dialogs.confirm_delete import confirm from calibre.gui2.dialogs.saved_search_editor import SavedSearchEditor from calibre.gui2.dialogs.search import SearchDialog from calibre.utils.icu import primary_sort_key -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes QT_HIDDEN_CLEAR_ACTION = '_q_qlineeditclearaction' @@ -183,7 +183,7 @@ class SearchBox2(QComboBox): # {{{ self.setFocus(Qt.OtherFocusReason) def search_done(self, ok): - if isinstance(ok, basestring): + if isinstance(ok, string_or_bytes): self.setToolTip(ok) ok = False if not unicode_type(self.currentText()).strip(): diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index 080aa81613..db170f37fd 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -70,7 +70,7 @@ from calibre.utils.config import JSONConfig from calibre.utils.icu import numeric_sort_key from calibre.utils.imghdr import identify from calibre.utils.tdir_in_cache import tdir_in_cache -from polyglot.builtins import iteritems +from polyglot.builtins import iteritems, string_or_bytes _diff_dialogs = [] last_used_transform_rules = [] @@ -1337,7 +1337,7 @@ class Boss(QObject): @in_thread_job def export_requested(self, name_or_names, path): - if isinstance(name_or_names, basestring): + if isinstance(name_or_names, string_or_bytes): return self.export_file(name_or_names, path) for name in name_or_names: dest = os.path.abspath(os.path.join(path, name)) diff --git a/src/calibre/gui2/tweak_book/editor/widget.py b/src/calibre/gui2/tweak_book/editor/widget.py index 4f9132f994..b1aa5cb5c7 100644 --- a/src/calibre/gui2/tweak_book/editor/widget.py +++ b/src/calibre/gui2/tweak_book/editor/widget.py @@ -24,11 +24,11 @@ from calibre.gui2.tweak_book.editor import SPELL_PROPERTY, LINK_PROPERTY, TAG_NA from calibre.gui2.tweak_book.editor.help import help_url from calibre.gui2.tweak_book.editor.text import TextEdit from calibre.utils.icu import utf16_length -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes def create_icon(text, palette=None, sz=None, divider=2, fill='white'): - if isinstance(fill, basestring): + if isinstance(fill, string_or_bytes): fill = QColor(fill) sz = sz or int(math.ceil(tprefs['toolbar_icon_size'] * QApplication.instance().devicePixelRatio())) if palette is None: diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 5642ba1a24..4bdbecded6 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -53,7 +53,7 @@ from calibre.gui2.dbus_export.widgets import factory from calibre.gui2.open_with import register_keyboard_shortcuts from calibre.library import current_library_name from calibre.srv.library_broker import GuiLibraryBroker -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes class Listener(Thread): # {{{ @@ -615,7 +615,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ self.tags_view.recount() def handle_cli_args(self, args): - if isinstance(args, basestring): + if isinstance(args, string_or_bytes): args = [args] files = [os.path.abspath(p) for p in args if not os.path.isdir(p) and os.access(p, os.R_OK)] if files: diff --git a/src/calibre/gui2/viewer/documentview.py b/src/calibre/gui2/viewer/documentview.py index 430b3d940b..857e1be147 100644 --- a/src/calibre/gui2/viewer/documentview.py +++ b/src/calibre/gui2/viewer/documentview.py @@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en' import math, json from base64 import b64encode from functools import partial -from polyglot.builtins import map, unicode_type +from polyglot.builtins import map, unicode_type, string_or_bytes from PyQt5.Qt import ( QSize, QSizePolicy, QUrl, Qt, QPainter, QPalette, QBrush, @@ -1169,12 +1169,12 @@ class DocumentView(QWebView): # {{{ old_pos = (self.document.xpos if self.document.in_paged_mode else self.document.ypos) if self.document.in_paged_mode: - if isinstance(pos, basestring): + if isinstance(pos, string_or_bytes): self.document.jump_to_anchor(pos) else: self.document.scroll_fraction = pos else: - if isinstance(pos, basestring): + if isinstance(pos, string_or_bytes): self.document.jump_to_anchor(pos) else: if pos >= 1: diff --git a/src/calibre/gui2/win_file_dialogs.py b/src/calibre/gui2/win_file_dialogs.py index 206b43cabf..fffb39638a 100644 --- a/src/calibre/gui2/win_file_dialogs.py +++ b/src/calibre/gui2/win_file_dialogs.py @@ -9,6 +9,7 @@ from threading import Thread from uuid import uuid4 from PyQt5.Qt import pyqtSignal, QEventLoop, Qt +from polyglot.builtins import string_or_bytes is64bit = sys.maxsize > (1 << 32) base = sys.extensions_location if hasattr(sys, 'new_app_layout') else os.path.dirname(sys.executable) @@ -76,7 +77,7 @@ def serialize_file_types(file_types): buf.append(struct.pack(b'=H%ds' % len(x), len(x), x)) for name, extensions in file_types: add(name or _('Files')) - if isinstance(extensions, basestring): + if isinstance(extensions, string_or_bytes): extensions = extensions.split() add('; '.join('*.' + ext.lower() for ext in extensions)) return b''.join(buf) diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py index daea1f0bb5..05eba9972b 100644 --- a/src/calibre/library/caches.py +++ b/src/calibre/library/caches.py @@ -20,7 +20,7 @@ from calibre.db.search import CONTAINS_MATCH, EQUALS_MATCH, REGEXP_MATCH, _match from calibre.ebooks.metadata import title_sort, author_to_author_sort from calibre.ebooks.metadata.opf2 import metadata_to_opf from calibre import prints, force_unicode -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes class MetadataBackup(Thread): # {{{ @@ -793,7 +793,7 @@ class ResultCache(SearchQueryParser): # {{{ continue if q == 'true' and matchkind == CONTAINS_MATCH: - if isinstance(item[loc], basestring): + if isinstance(item[loc], string_or_bytes): if item[loc].strip() == '': continue matches.add(item[0]) diff --git a/src/calibre/library/catalogs/bibtex.py b/src/calibre/library/catalogs/bibtex.py index 66efa81571..f22bcc8d5a 100644 --- a/src/calibre/library/catalogs/bibtex.py +++ b/src/calibre/library/catalogs/bibtex.py @@ -15,6 +15,7 @@ from calibre.library.catalogs import FIELDS, TEMPLATE_ALLOWED_FIELDS from calibre.customize.conversion import DummyReporter from calibre.constants import preferred_encoding from calibre.ebooks.metadata import format_isbn +from polyglot.builtins import string_or_bytes class BIBTEX(CatalogPlugin): @@ -212,13 +213,13 @@ class BIBTEX(CatalogPlugin): bibtex_entry.append(u'year = "%s"' % item.year) bibtex_entry.append(u'month = "%s"' % bibtexdict.utf8ToBibtex(strftime("%b", item))) - elif field.startswith('#') and isinstance(item, basestring): + elif field.startswith('#') and isinstance(item, string_or_bytes): bibtex_entry.append(u'custom_%s = "%s"' % (field[1:], bibtexdict.utf8ToBibtex(item))) - elif isinstance(item, basestring): + elif isinstance(item, string_or_bytes): # elif field in ['title', 'publisher', 'cover', 'uuid', 'ondevice', - # 'author_sort', 'series', 'title_sort'] : + # 'author_sort', 'series', 'title_sort'] : bibtex_entry.append(u'%s = "%s"' % (field, bibtexdict.utf8ToBibtex(item))) bibtex_entry = u',\n '.join(bibtex_entry) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 5ed44f5d89..59bf0e746c 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -48,7 +48,7 @@ from calibre.db.lazy import FormatMetadata, FormatsList from calibre.db.categories import Tag, CATEGORY_SORTS from calibre.utils.localization import (canonicalize_lang, calibre_langcode_to_name) -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes copyfile = os.link if hasattr(os, 'link') else shutil.copyfile SPOOL_SIZE = 30*1024*1024 @@ -1115,7 +1115,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): def find_identical_books(self, mi): fuzzy_title_patterns = [(re.compile(pat, re.IGNORECASE) if - isinstance(pat, basestring) else pat, repl) for pat, repl in + isinstance(pat, string_or_bytes) else pat, repl) for pat, repl in [ (r'[\[\](){}<>\'";,:#]', ''), (get_title_sort_pat(), ''), @@ -1398,7 +1398,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): id_ = index if index_is_id else self.id(index) raise NoSuchFormat('Record %d has no %s file'%(id_, fmt)) if windows_atomic_move is not None: - if not isinstance(dest, basestring): + if not isinstance(dest, string_or_bytes): raise Exception("Error, you must pass the dest as a path when" " using windows_atomic_move") if dest: @@ -1454,7 +1454,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): id = index if index_is_id else self.id(index) path = os.path.join(self.library_path, self.path(id, index_is_id=True), 'cover.jpg') if windows_atomic_move is not None: - if not isinstance(dest, basestring): + if not isinstance(dest, string_or_bytes): raise Exception("Error, you must pass the dest as a path when" " using windows_atomic_move") if os.access(path, os.R_OK) and dest and not samefile(dest, path): @@ -2334,7 +2334,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): # force_changes has no effect on cover manipulation if mi.cover_data[1] is not None: doit(self.set_cover, id, mi.cover_data[1], commit=False) - elif isinstance(mi.cover, basestring) and mi.cover: + elif isinstance(mi.cover, string_or_bytes) and mi.cover: if os.access(mi.cover, os.R_OK): with lopen(mi.cover, 'rb') as f: raw = f.read() @@ -2641,7 +2641,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): def set_pubdate(self, id, dt, notify=True, commit=True): if not dt: dt = UNDEFINED_DATE - if isinstance(dt, basestring): + if isinstance(dt, string_or_bytes): dt = parse_only_date(dt) self.conn.execute('UPDATE books SET pubdate=? WHERE id=?', (dt, id)) self.data.set(id, self.FIELD_MAP['pubdate'], dt, row_is_id=True) diff --git a/src/calibre/srv/ajax.py b/src/calibre/srv/ajax.py index b1838387e4..ccd8319eaf 100644 --- a/src/calibre/srv/ajax.py +++ b/src/calibre/srv/ajax.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2015, Kovid Goyal ' from functools import partial -from polyglot.builtins import unicode_type, zip +from polyglot.builtins import unicode_type, zip, string_or_bytes from itertools import cycle from calibre import force_unicode @@ -107,7 +107,7 @@ def book_to_json(ctx, rd, db, book_id, if (fm and fm['is_category'] and not fm['is_csp'] and key != 'formats' and fm['datatype'] != 'rating'): categories = mi.get(key) or [] - if isinstance(categories, basestring): + if isinstance(categories, string_or_bytes): categories = [categories] category_urls[key] = dbtags = {} for category in categories: diff --git a/src/calibre/srv/legacy.py b/src/calibre/srv/legacy.py index 5872740123..51e7ebf19f 100644 --- a/src/calibre/srv/legacy.py +++ b/src/calibre/srv/legacy.py @@ -2,29 +2,31 @@ # vim:fileencoding=utf-8 # License: GPLv3 Copyright: 2016, Kovid Goyal -from __future__ import (unicode_literals, division, absolute_import, - print_function) +from __future__ import absolute_import, division, print_function, unicode_literals + from functools import partial +from urllib import urlencode + from lxml.html import tostring from lxml.html.builder import E as E_ -from urllib import urlencode from calibre import strftime from calibre.constants import __appname__ from calibre.db.view import sanitize_sort_field_name from calibre.ebooks.metadata import authors_to_string -from calibre.srv.content import get, book_filename -from calibre.srv.errors import HTTPRedirect, HTTPBadRequest +from calibre.srv.content import book_filename, get +from calibre.srv.errors import HTTPBadRequest, HTTPRedirect from calibre.srv.routes import endpoint from calibre.srv.utils import get_library_data, http_date from calibre.utils.cleantext import clean_xml_chars -from calibre.utils.date import timestampfromdt, dt_as_local, is_date_undefined +from calibre.utils.date import dt_as_local, is_date_undefined, timestampfromdt +from polyglot.builtins import string_or_bytes # /mobile {{{ def clean(x): - if isinstance(x, basestring): + if isinstance(x, string_or_bytes): x = clean_xml_chars(x) return x diff --git a/src/calibre/utils/config_base.py b/src/calibre/utils/config_base.py index 0a0345df26..5ef1ef5f98 100644 --- a/src/calibre/utils/config_base.py +++ b/src/calibre/utils/config_base.py @@ -234,7 +234,7 @@ class OptionSet(object): def serialize_opt(self, val): if val is val is True or val is False or val is None or \ - isinstance(val, (int, float, long, basestring)): + isinstance(val, (int, float, long, bytes, unicode_type)): return repr(val) pickle = cPickle.dumps(val, -1) return 'cPickle.loads(%s)'%repr(pickle) diff --git a/src/calibre/utils/img.py b/src/calibre/utils/img.py index 8d7dead317..8c8083cabb 100644 --- a/src/calibre/utils/img.py +++ b/src/calibre/utils/img.py @@ -23,6 +23,7 @@ from calibre.ptempfile import TemporaryDirectory from calibre.utils.config_base import tweaks from calibre.utils.filenames import atomic_rename from calibre.utils.imghdr import what +from polyglot.builtins import string_or_bytes # Utilities {{{ imageops, imageops_err = plugins['imageops'] @@ -436,7 +437,7 @@ def quantize_image(img, max_colors=256, dither=True, palette=''): img = image_from_data(img) if img.hasAlphaChannel(): img = blend_image(img) - if palette and isinstance(palette, basestring): + if palette and isinstance(palette, string_or_bytes): palette = palette.split() return imageops.quantize(img, max_colors, dither, [QColor(x).rgb() for x in palette]) diff --git a/src/calibre/utils/imghdr.py b/src/calibre/utils/imghdr.py index c03cd01e8b..ce2903f0e5 100644 --- a/src/calibre/utils/imghdr.py +++ b/src/calibre/utils/imghdr.py @@ -7,6 +7,7 @@ from __future__ import (unicode_literals, division, absolute_import, from struct import unpack, error import os from calibre.utils.speedups import ReadOnlyFileBuffer +from polyglot.builtins import string_or_bytes """ Recognize image file formats and sizes based on their first few bytes.""" @@ -16,7 +17,7 @@ HSIZE = 120 def what(file, h=None): ' Recognize image headers ' if h is None: - if isinstance(file, basestring): + if isinstance(file, string_or_bytes): with lopen(file, 'rb') as f: h = f.read(HSIZE) else: diff --git a/src/calibre/utils/ipc/launch.py b/src/calibre/utils/ipc/launch.py index 31c742c65b..b0c777518d 100644 --- a/src/calibre/utils/ipc/launch.py +++ b/src/calibre/utils/ipc/launch.py @@ -12,7 +12,7 @@ from functools import partial from calibre.constants import iswindows, isosx, isfrozen, filesystem_encoding from calibre.utils.config import prefs from calibre.ptempfile import PersistentTemporaryFile, base_dir -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes if iswindows: import win32process @@ -186,7 +186,7 @@ class Worker(object): _cwd = cwd if priority is None: priority = prefs['worker_process_priority'] - cmd = [exe] if isinstance(exe, basestring) else exe + cmd = [exe] if isinstance(exe, string_or_bytes) else exe args = { 'env' : env, 'cwd' : _cwd, diff --git a/src/calibre/utils/ipc/server.py b/src/calibre/utils/ipc/server.py index 810fde9761..4452d9809c 100644 --- a/src/calibre/utils/ipc/server.py +++ b/src/calibre/utils/ipc/server.py @@ -21,6 +21,7 @@ from calibre.utils.ipc.worker import PARALLEL_FUNCS from calibre import detect_ncpus as cpu_count from calibre.constants import iswindows, DEBUG, islinux from calibre.ptempfile import base_dir +from polyglot.builtins import string_or_bytes _counter = 0 @@ -216,7 +217,7 @@ class Server(Thread): 'CALIBRE_WORKER_RESULT' : hexlify(rfile.encode('utf-8')), } cw = self.do_launch(env, gui, redirect_output, rfile, job_name=job_name) - if isinstance(cw, basestring): + if isinstance(cw, string_or_bytes): raise CriticalError('Failed to launch worker process:\n'+cw) if DEBUG: print('Worker Launch took:', time.time() - start) diff --git a/src/calibre/utils/ipc/simple_worker.py b/src/calibre/utils/ipc/simple_worker.py index decaa9d554..78c280ce60 100644 --- a/src/calibre/utils/ipc/simple_worker.py +++ b/src/calibre/utils/ipc/simple_worker.py @@ -16,7 +16,7 @@ from contextlib import closing from calibre.constants import iswindows from calibre.utils.ipc import eintr_retry_call from calibre.utils.ipc.launch import Worker -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes class WorkerError(Exception): @@ -164,7 +164,7 @@ def start_pipe_worker(command, env=None, priority='normal', **process_args): args['close_fds'] = True exe = w.executable - cmd = [exe] if isinstance(exe, basestring) else exe + cmd = [exe] if isinstance(exe, string_or_bytes) else exe p = subprocess.Popen(cmd + ['--pipe-worker', command], **args) return p diff --git a/src/calibre/utils/open_with/linux.py b/src/calibre/utils/open_with/linux.py index 05038da9c8..39b314bce7 100644 --- a/src/calibre/utils/open_with/linux.py +++ b/src/calibre/utils/open_with/linux.py @@ -13,6 +13,7 @@ from calibre import walk, guess_type, prints, force_unicode from calibre.constants import filesystem_encoding, cache_dir from calibre.utils.icu import numeric_sort_key as sort_key from calibre.utils.localization import canonicalize_lang, get_lang +from polyglot.builtins import string_or_bytes def parse_localized_key(key): @@ -73,6 +74,7 @@ def parse_desktop_file(path): if 'Exec' in ans and 'MimeType' in ans and 'Name' in ans: return ans + icon_data = None @@ -197,7 +199,7 @@ def find_programs(extensions): data['Icon'] = icon else: data.pop('Icon') - if not isinstance(data.get('Icon'), basestring): + if not isinstance(data.get('Icon'), string_or_bytes): data.pop('Icon', None) for k in ('Name', 'GenericName', 'Comment'): val = data.get(k) diff --git a/src/calibre/utils/open_with/osx.py b/src/calibre/utils/open_with/osx.py index 68f5a66862..760a29a265 100644 --- a/src/calibre/utils/open_with/osx.py +++ b/src/calibre/utils/open_with/osx.py @@ -11,7 +11,7 @@ from collections import defaultdict from calibre.ptempfile import TemporaryDirectory from calibre.utils.icu import numeric_sort_key -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes application_locations = ('/Applications', '~/Applications', '~/Desktop') @@ -240,7 +240,7 @@ def get_extensions_from_utis(utis, plist): for decl in plist.get(key, ()): if isinstance(decl, dict): uti = decl.get('UTTypeIdentifier') - if isinstance(uti, basestring): + if isinstance(uti, string_or_bytes): spec = decl.get('UTTypeTagSpecification') if isinstance(spec, dict): ext = spec.get('public.filename-extension') @@ -287,10 +287,10 @@ def get_bundle_data(path): extensions |= get_extensions_from_utis(utis, plist) else: for ext in dtype.get('CFBundleTypeExtensions', ()): - if isinstance(ext, basestring): + if isinstance(ext, string_or_bytes): extensions.add(ext.lower()) for mt in dtype.get('CFBundleTypeMIMETypes', ()): - if isinstance(mt, basestring): + if isinstance(mt, string_or_bytes): for ext in mimetypes.guess_all_extensions(mt, strict=False): extensions.add(ext.lower()) return ans diff --git a/src/calibre/utils/rss_gen.py b/src/calibre/utils/rss_gen.py index d270f3dbf4..f4419234f7 100644 --- a/src/calibre/utils/rss_gen.py +++ b/src/calibre/utils/rss_gen.py @@ -7,6 +7,7 @@ __author__ = "Andrew Dalke " _generator_name = __name__ + "-" + ".".join(map(str, __version__)) import datetime +from polyglot.builtins import string_or_bytes # Could make this the base class; will need to add 'publish' @@ -32,7 +33,7 @@ class WriteXmlMixin: def _element(handler, name, obj, d={}): - if isinstance(obj, basestring) or obj is None: + if isinstance(obj, string_or_bytes) or obj is None: # special-case handling to make the API easier # to use for the common case. handler.startElement(name, d) @@ -373,7 +374,7 @@ class RSS2(WriteXmlMixin): _opt_element(handler, "lastBuildDate", lastBuildDate) for category in self.categories: - if isinstance(category, basestring): + if isinstance(category, string_or_bytes): category = Category(category) category.publish(handler) @@ -454,7 +455,7 @@ class RSSItem(WriteXmlMixin): _opt_element(handler, "author", self.author) for category in self.categories: - if isinstance(category, basestring): + if isinstance(category, string_or_bytes): category = Category(category) category.publish(handler) diff --git a/src/calibre/utils/smtplib.py b/src/calibre/utils/smtplib.py index 3db4b978af..b15bc6988c 100755 --- a/src/calibre/utils/smtplib.py +++ b/src/calibre/utils/smtplib.py @@ -52,7 +52,7 @@ from email.base64mime import encode as encode_base64 from sys import stderr from functools import partial -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes __all__ = ["SMTPException", "SMTPServerDisconnected", "SMTPResponseException", "SMTPSenderRefused", "SMTPRecipientsRefused", "SMTPDataError", @@ -766,7 +766,7 @@ class SMTP: self.rset() raise SMTPSenderRefused(code, resp, from_addr) senderrs = {} - if isinstance(to_addrs, basestring): + if isinstance(to_addrs, string_or_bytes): to_addrs = [to_addrs] for each in to_addrs: (code, resp) = self.rcpt(each, rcpt_options) diff --git a/src/calibre/utils/unrar.py b/src/calibre/utils/unrar.py index 2fd0af3886..882a636ba6 100644 --- a/src/calibre/utils/unrar.py +++ b/src/calibre/utils/unrar.py @@ -13,6 +13,7 @@ from io import BytesIO from calibre.constants import filesystem_encoding, iswindows from calibre.ptempfile import PersistentTemporaryFile, TemporaryDirectory +from polyglot.builtins import string_or_bytes def as_unicode(x): @@ -28,7 +29,7 @@ class StreamAsPath(object): def __enter__(self): self.temppath = None - if isinstance(self.stream, basestring): + if isinstance(self.stream, string_or_bytes): return as_unicode(self.stream) name = getattr(self.stream, 'name', None) if name and os.access(name, os.R_OK): diff --git a/src/calibre/utils/zipfile.py b/src/calibre/utils/zipfile.py index 068438e358..9699543d9b 100644 --- a/src/calibre/utils/zipfile.py +++ b/src/calibre/utils/zipfile.py @@ -11,7 +11,7 @@ from tempfile import SpooledTemporaryFile from calibre import sanitize_file_name2 from calibre.constants import filesystem_encoding from calibre.ebooks.chardet import detect -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes try: import zlib # We may need its compression method @@ -747,7 +747,7 @@ class ZipFile: self.comment = '' # Check if we were passed a file-like object - if isinstance(file, basestring): + if isinstance(file, string_or_bytes): self._filePassed = 0 self.filename = file modeDict = {'r' : 'rb', 'w': 'wb', 'a' : 'r+b'} diff --git a/src/calibre/web/feeds/__init__.py b/src/calibre/web/feeds/__init__.py index cceac992f3..c0303e3e1c 100644 --- a/src/calibre/web/feeds/__init__.py +++ b/src/calibre/web/feeds/__init__.py @@ -12,7 +12,7 @@ from calibre.utils.logging import default_log from calibre import entity_to_unicode, strftime, force_unicode from calibre.utils.date import dt_factory, utcnow, local_tz from calibre.utils.cleantext import clean_ascii_chars, clean_xml_chars -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes class Article(object): @@ -21,7 +21,7 @@ class Article(object): from lxml import html self.downloaded = False self.id = id - if not title or not isinstance(title, basestring): + if not title or not isinstance(title, string_or_bytes): title = _('Unknown') title = force_unicode(title, 'utf-8') self._title = clean_xml_chars(title).strip() diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index d93cd3e815..9a2e616867 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -31,7 +31,7 @@ from calibre.utils.icu import numeric_sort_key from calibre.utils.img import save_cover_data_to, add_borders_to_image, image_to_data from calibre.utils.localization import canonicalize_lang from calibre.utils.logging import ThreadSafeWrapper -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, string_or_bytes class LoginFailed(ValueError): @@ -1612,7 +1612,7 @@ class BasicNewsRecipe(Recipe): feeds = self.get_feeds() parsed_feeds = [] for obj in feeds: - if isinstance(obj, basestring): + if isinstance(obj, string_or_bytes): title, url = None, obj else: title, url = obj @@ -1659,7 +1659,7 @@ class BasicNewsRecipe(Recipe): ''' if tag is None: return '' - if isinstance(tag, basestring): + if isinstance(tag, string_or_bytes): return tag if callable(getattr(tag, 'xpath', None)) and not hasattr(tag, 'contents'): # a lxml tag from lxml.etree import tostring diff --git a/src/odf/odf2xhtml.py b/src/odf/odf2xhtml.py index 9f1e763551..89d75a1961 100644 --- a/src/odf/odf2xhtml.py +++ b/src/odf/odf2xhtml.py @@ -1580,7 +1580,7 @@ dl.notes dd:last-of-type { page-break-after: avoid } """ self.lines = [] self._wfunc = self._wlines - if isinstance(odffile, basestring) \ + if isinstance(odffile, (bytes, type(u'')) \ or hasattr(odffile, 'read'): # Added by Kovid self.document = load(odffile) else: diff --git a/src/odf/userfield.py b/src/odf/userfield.py index a0f6b1641d..5dc2f0818d 100644 --- a/src/odf/userfield.py +++ b/src/odf/userfield.py @@ -62,7 +62,7 @@ class UserFields(object): self.document = None def loaddoc(self): - if isinstance(self.src_file, basestring): + if isinstance(self.src_file, (bytes, type(u'')): # src_file is a filename, check if it is a zip-file if not zipfile.is_zipfile(self.src_file): raise TypeError("%s is no odt file." % self.src_file) @@ -164,6 +164,5 @@ class UserFields(object): if value_type == 'string': f.setAttribute('stringvalue', value) else: - f.setAttribute('value', value) + f.setAttribute('value', value) self.savedoc() - diff --git a/src/polyglot/builtins.py b/src/polyglot/builtins.py index d4fbe45933..806807f43c 100644 --- a/src/polyglot/builtins.py +++ b/src/polyglot/builtins.py @@ -29,6 +29,7 @@ if is_py3: codepoint_to_chr = chr unicode_type = str + string_or_bytes = str, bytes def iteritems(d): return iter(d.items()) @@ -53,6 +54,7 @@ else: codepoint_to_chr = unichr unicode_type = unicode + string_or_bytes = unicode, bytes def iteritems(d): return d.iteritems() From d1e30dfcac00db22134fad8cc6420770c8e95cbb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Mar 2019 15:21:06 +0530 Subject: [PATCH 0306/2613] Get rid of some xrange --- manual/build.py | 4 ++-- recipes/el_diplo.recipe | 2 +- setup/translations.py | 4 ++-- src/calibre/__init__.py | 4 ++-- src/calibre/db/__init__.py | 8 +++++--- src/calibre/db/tables.py | 5 +++-- src/calibre/db/tests/locking.py | 5 +++-- src/calibre/db/view.py | 6 +++--- src/calibre/devices/scanner.py | 15 ++++++++------- src/calibre/gui2/__init__.py | 6 +++--- src/calibre/gui2/font_family_chooser.py | 4 ++-- src/calibre/gui2/icon_theme.py | 6 +++--- src/calibre/gui2/job_indicator.py | 4 ++-- src/calibre/gui2/jobs.py | 6 +++--- src/calibre/gui2/keyboard.py | 4 ++-- src/calibre/gui2/main.py | 4 ++-- src/calibre/gui2/open_with.py | 4 ++-- src/calibre/gui2/pin_columns.py | 3 ++- src/calibre/gui2/tag_mapper.py | 4 ++-- src/calibre/gui2/widgets.py | 6 +++--- src/calibre/library/__init__.py | 17 +++++++++-------- src/calibre/rpdb.py | 4 +++- src/calibre/srv/loop.py | 3 ++- src/calibre/srv/metadata.py | 3 ++- src/calibre/srv/pool.py | 3 ++- src/calibre/srv/routes.py | 6 +++--- src/calibre/srv/utils.py | 4 ++-- src/calibre/utils/cleantext.py | 4 ++-- src/calibre/utils/filenames.py | 4 ++-- src/calibre/utils/matcher.py | 8 ++++---- src/calibre/utils/rapydscript.py | 6 +++--- src/calibre/utils/speedups.py | 3 ++- src/calibre/utils/terminal.py | 7 ++++--- src/calibre/web/feeds/recipes/__init__.py | 3 ++- src/odf/odf2xhtml.py | 5 ++--- 35 files changed, 99 insertions(+), 85 deletions(-) diff --git a/manual/build.py b/manual/build.py index 1a2a57791e..3d0b9ad5e9 100755 --- a/manual/build.py +++ b/manual/build.py @@ -54,10 +54,10 @@ def build_manual(language, base): return p.wait() try: if not skip_pdf: - for i in xrange(3): + for i in range(3): run_cmd(['pdflatex', '-interaction=nonstopmode', 'calibre.tex']) run_cmd(['makeindex', '-s', 'python.ist', 'calibre.idx']) - for i in xrange(2): + for i in range(2): run_cmd(['pdflatex', '-interaction=nonstopmode', 'calibre.tex']) if not os.path.exists('calibre.pdf'): print('Failed to build pdf file, see calibre.log in the latex directory', file=sys.stderr) diff --git a/recipes/el_diplo.recipe b/recipes/el_diplo.recipe index b0b87afc86..119e010eb9 100644 --- a/recipes/el_diplo.recipe +++ b/recipes/el_diplo.recipe @@ -76,7 +76,7 @@ class ElDiplo_Recipe(BasicNewsRecipe): summaryurl = re.sub(r'\?.*', '', a['href']) summaryurl = 'http://www.eldiplo.org' + summaryurl - for pagenum in xrange(1, 10): + for pagenum in range(1, 10): soup = self.index_to_soup( '{0}/?cms1_paging_p_b32={1}'.format(summaryurl, pagenum)) thedivs = soup.findAll(True, attrs={'class': ['interna']}) diff --git a/setup/translations.py b/setup/translations.py index ac8684d820..d1e580c66b 100644 --- a/setup/translations.py +++ b/setup/translations.py @@ -13,7 +13,7 @@ from functools import partial from setup import Command, __appname__, __version__, require_git_master, build_cache_dir, edit_file from setup.parallel_build import parallel_check_output -from polyglot.builtins import codepoint_to_chr, iteritems +from polyglot.builtins import codepoint_to_chr, iteritems, range is_ci = os.environ.get('CI', '').lower() == 'true' @@ -121,7 +121,7 @@ class POT(Command): # {{{ self.tx(['set', '-r', 'calibre.' + slug, '--source', '-l', 'en', '-t', 'PO', dest]) with open(self.j(self.d(tbase), '.tx/config'), 'r+b') as f: lines = f.read().splitlines() - for i in xrange(len(lines)): + for i in range(len(lines)): line = lines[i] if line == '[calibre.%s]' % slug: lines.insert(i+1, 'file_filter = manual//%s.po' % bname) diff --git a/src/calibre/__init__.py b/src/calibre/__init__.py index 879cdced87..f5d4a2e628 100644 --- a/src/calibre/__init__.py +++ b/src/calibre/__init__.py @@ -4,7 +4,7 @@ __copyright__ = '2008, Kovid Goyal ' __docformat__ = 'restructuredtext en' import sys, os, re, time, random, warnings -from polyglot.builtins import builtins, codepoint_to_chr, unicode_type +from polyglot.builtins import builtins, codepoint_to_chr, unicode_type, range builtins.__dict__['dynamic_property'] = lambda func: func(None) from math import floor from functools import partial @@ -113,7 +113,7 @@ def confirm_config_name(name): _filename_sanitize = re.compile(r'[\xae\0\\|\?\*<":>\+/]') _filename_sanitize_unicode = frozenset([u'\\', u'|', u'?', u'*', u'<', - u'"', u':', u'>', u'+', u'/'] + list(map(codepoint_to_chr, xrange(32)))) + u'"', u':', u'>', u'+', u'/'] + list(map(codepoint_to_chr, range(32)))) def sanitize_file_name(name, substitute='_', as_unicode=False): diff --git a/src/calibre/db/__init__.py b/src/calibre/db/__init__.py index 33565388b3..277ffbdd76 100644 --- a/src/calibre/db/__init__.py +++ b/src/calibre/db/__init__.py @@ -9,6 +9,8 @@ __docformat__ = 'restructuredtext en' SPOOL_SIZE = 30*1024*1024 +from polyglot.builtins import range + def _get_next_series_num_for_list(series_indices, unwrap=True): from calibre.utils.config_base import tweaks @@ -22,17 +24,17 @@ def _get_next_series_num_for_list(series_indices, unwrap=True): if tweaks['series_index_auto_increment'] == 'next': return floor(series_indices[-1]) + 1 if tweaks['series_index_auto_increment'] == 'first_free': - for i in xrange(1, 10000): + for i in range(1, 10000): if i not in series_indices: return i # really shouldn't get here. if tweaks['series_index_auto_increment'] == 'next_free': - for i in xrange(int(ceil(series_indices[0])), 10000): + for i in range(int(ceil(series_indices[0])), 10000): if i not in series_indices: return i # really shouldn't get here. if tweaks['series_index_auto_increment'] == 'last_free': - for i in xrange(int(ceil(series_indices[-1])), 0, -1): + for i in range(int(ceil(series_indices[-1])), 0, -1): if i not in series_indices: return i return series_indices[-1] + 1 diff --git a/src/calibre/db/tables.py b/src/calibre/db/tables.py index 169b97f52d..c165edc961 100644 --- a/src/calibre/db/tables.py +++ b/src/calibre/db/tables.py @@ -13,6 +13,7 @@ from collections import defaultdict from calibre.constants import plugins from calibre.utils.date import parse_date, UNDEFINED_DATE, utc_tz from calibre.ebooks.metadata import author_to_author_sort +from polyglot.builtins import range _c_speedup = plugins['speedup'][0].parse_date @@ -32,7 +33,7 @@ def c_parse(val): else: try: ans = datetime(year, month, day, hour, minutes, seconds, tzinfo=utc_tz) - if tzsecs is not 0: + if tzsecs != 0: ans -= timedelta(seconds=tzsecs) except OverflowError: ans = UNDEFINED_DATE @@ -43,7 +44,7 @@ def c_parse(val): return UNDEFINED_DATE -ONE_ONE, MANY_ONE, MANY_MANY = xrange(3) +ONE_ONE, MANY_ONE, MANY_MANY = range(3) null = object() diff --git a/src/calibre/db/tests/locking.py b/src/calibre/db/tests/locking.py index d01162b12c..efeccb0ed7 100644 --- a/src/calibre/db/tests/locking.py +++ b/src/calibre/db/tests/locking.py @@ -10,6 +10,7 @@ import time, random from threading import Thread from calibre.db.tests.base import BaseTest from calibre.db.locking import SHLock, RWLockWrapper, LockingError +from polyglot.builtins import range class TestLock(BaseTest): @@ -155,7 +156,7 @@ class TestLock(BaseTest): done = [] def lots_of_acquires(): - for _ in xrange(1000): + for _ in range(1000): shared = random.choice([True,False]) lock.acquire(shared=shared) lock.acquire(shared=shared) @@ -167,7 +168,7 @@ class TestLock(BaseTest): lock.release() lock.release() done.append(True) - threads = [Thread(target=lots_of_acquires) for _ in xrange(10)] + threads = [Thread(target=lots_of_acquires) for _ in range(10)] for t in threads: t.daemon = True t.start() diff --git a/src/calibre/db/view.py b/src/calibre/db/view.py index 585d84d6cd..87663a980d 100644 --- a/src/calibre/db/view.py +++ b/src/calibre/db/view.py @@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en' import weakref, operator from functools import partial from itertools import izip, imap -from polyglot.builtins import map, unicode_type +from polyglot.builtins import map, unicode_type, range from calibre.ebooks.metadata import title_sort from calibre.utils.config_base import tweaks, prefs @@ -49,7 +49,7 @@ class TableRow(object): view = self.view() if isinstance(obj, slice): return [view._field_getters[c](self.book_id) - for c in xrange(*obj.indices(len(view._field_getters)))] + for c in range(*obj.indices(len(view._field_getters)))] else: return view._field_getters[obj](self.book_id) @@ -57,7 +57,7 @@ class TableRow(object): return self.column_count def __iter__(self): - for i in xrange(self.column_count): + for i in range(self.column_count): yield self[i] diff --git a/src/calibre/devices/scanner.py b/src/calibre/devices/scanner.py index 7ac97b3f84..ca3014cda9 100644 --- a/src/calibre/devices/scanner.py +++ b/src/calibre/devices/scanner.py @@ -13,6 +13,7 @@ from threading import Lock from calibre import prints, as_unicode from calibre.constants import (iswindows, isosx, plugins, islinux, isfreebsd, isnetbsd) +from polyglot.builtins import range osx_scanner = linux_scanner = freebsd_scanner = netbsd_scanner = None @@ -22,7 +23,7 @@ if iswindows: def drive_is_ok(letter, max_tries=10, debug=False): import win32file with drive_ok_lock: - for i in xrange(max_tries): + for i in range(max_tries): try: win32file.GetDiskFreeSpaceEx(letter+':\\') return True @@ -87,9 +88,9 @@ class LibUSBScanner(object): memory() for num in (1, 10, 100): start = memory() - for i in xrange(num): + for i in range(num): self() - for i in xrange(3): + for i in range(3): gc.collect() print('Mem consumption increased by:', memory() - start, 'MB', end=' ') print('after', num, 'repeats') @@ -219,17 +220,17 @@ def test_for_mem_leak(): scanner = DeviceScanner() scanner.scan() memory() # load the psutil library - for i in xrange(3): + for i in range(3): gc.collect() for reps in (1, 10, 100, 1000): - for i in xrange(3): + for i in range(3): gc.collect() h1 = gc_histogram() startmem = memory() - for i in xrange(reps): + for i in range(reps): scanner.scan() - for i in xrange(3): + for i in range(3): gc.collect() usedmem = memory(startmem) prints('Memory used in %d repetitions of scan(): %.5f KB'%(reps, diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 8275e0b7ba..a6ea48b34d 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -35,7 +35,7 @@ from calibre.utils.config import Config, ConfigProxy, JSONConfig, dynamic from calibre.utils.date import UNDEFINED_DATE from calibre.utils.file_type_icons import EXT_MAP from calibre.utils.localization import get_lang -from polyglot.builtins import unicode_type, string_or_bytes +from polyglot.builtins import unicode_type, string_or_bytes, range try: NO_URL_FORMATTING = QUrl.None_ @@ -1025,11 +1025,11 @@ class Application(QApplication): def fget(self): return [col.getRgb() for col in - (QColorDialog.customColor(i) for i in xrange(QColorDialog.customCount()))] + (QColorDialog.customColor(i) for i in range(QColorDialog.customCount()))] def fset(self, colors): num = min(len(colors), QColorDialog.customCount()) - for i in xrange(num): + for i in range(num): QColorDialog.setCustomColor(i, QColor(*colors[i])) return property(fget=fget, fset=fset) diff --git a/src/calibre/gui2/font_family_chooser.py b/src/calibre/gui2/font_family_chooser.py index f30fddc384..f68cbbcb04 100644 --- a/src/calibre/gui2/font_family_chooser.py +++ b/src/calibre/gui2/font_family_chooser.py @@ -17,7 +17,7 @@ from PyQt5.Qt import (QFontInfo, QFontMetrics, Qt, QFont, QFontDatabase, QPen, from calibre.constants import config_dir from calibre.gui2 import choose_files, error_dialog, info_dialog, empty_index -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range def add_fonts(parent): @@ -268,7 +268,7 @@ class FontFamilyDialog(QDialog): q = icu_lower(unicode_type(self.search.text())).strip() if not q: return - r = (xrange(i-1, -1, -1) if backwards else xrange(i+1, + r = (range(i-1, -1, -1) if backwards else range(i+1, len(self.families))) for j in r: f = self.families[j] diff --git a/src/calibre/gui2/icon_theme.py b/src/calibre/gui2/icon_theme.py index 8891020e85..95fc1dcaca 100644 --- a/src/calibre/gui2/icon_theme.py +++ b/src/calibre/gui2/icon_theme.py @@ -14,7 +14,7 @@ from Queue import Queue, Empty from threading import Thread, Event from multiprocessing.pool import ThreadPool -from polyglot.builtins import reraise +from polyglot.builtins import reraise, range from PyQt5.Qt import ( QImageReader, QFormLayout, QVBoxLayout, QSplitter, QGroupBox, QListWidget, @@ -496,7 +496,7 @@ def get_covers(themes, callback, num_of_workers=8): else: callback(metadata, cdata) - for w in xrange(num_of_workers): + for w in range(num_of_workers): t = Thread(name='IconThemeCover', target=run) t.daemon = True t.start() @@ -703,7 +703,7 @@ class ChooseTheme(Dialog): get_covers(self.themes, self.cover_downloaded.emit) def __iter__(self): - for i in xrange(self.theme_list.count()): + for i in range(self.theme_list.count()): yield self.theme_list.item(i) def item_from_name(self, name): diff --git a/src/calibre/gui2/job_indicator.py b/src/calibre/gui2/job_indicator.py index 24ccff629b..6589d1f52f 100644 --- a/src/calibre/gui2/job_indicator.py +++ b/src/calibre/gui2/job_indicator.py @@ -12,6 +12,7 @@ from PyQt5.Qt import (QPainter, Qt, QWidget, QPropertyAnimation, QRect, QPoint, QPalette) from calibre.gui2 import config +from polyglot.builtins import range class Pointer(QWidget): @@ -79,7 +80,7 @@ class Pointer(QWidget): self.animation.setEndValue(self.rect_at(1.0)) self.animation.setDirection(self.animation.Backward) num_keys = 100 - for i in xrange(1, num_keys): + for i in range(1, num_keys): i /= num_keys self.animation.setKeyValueAt(i, self.rect_at(i)) self.animation.start() @@ -91,4 +92,3 @@ class Pointer(QWidget): p.setPen(Qt.NoPen) p.drawPath(self.arrow_path) p.end() - diff --git a/src/calibre/gui2/jobs.py b/src/calibre/gui2/jobs.py index 9e9d1f4c3f..59b6e74be1 100644 --- a/src/calibre/gui2/jobs.py +++ b/src/calibre/gui2/jobs.py @@ -30,7 +30,7 @@ from calibre.gui2.threaded_jobs import ThreadedJobServer, ThreadedJob from calibre.gui2.widgets2 import Dialog from calibre.utils.search_query_parser import SearchQueryParser, ParseException from calibre.utils.icu import lower -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class AdaptSQP(SearchQueryParser): @@ -301,7 +301,7 @@ class JobManager(QAbstractTableModel, AdaptSQP): # {{{ def show_hidden_jobs(self): for j in self.jobs: j.hidden_in_gui = False - for r in xrange(len(self.jobs)): + for r in range(len(self.jobs)): self.dataChanged.emit(self.index(r, 0), self.index(r, 0)) def kill_job(self, job, view): @@ -710,7 +710,7 @@ class JobsDialog(QDialog, Ui_JobsDialog): self.proxy_model.beginResetModel(), self.proxy_model.endResetModel() def hide_all(self, *args): - self.model.hide_jobs(list(xrange(0, + self.model.hide_jobs(list(range(0, self.model.rowCount(QModelIndex())))) self.proxy_model.beginResetModel(), self.proxy_model.endResetModel() diff --git a/src/calibre/gui2/keyboard.py b/src/calibre/gui2/keyboard.py index ebf8404a87..5d1254bc0e 100644 --- a/src/calibre/gui2/keyboard.py +++ b/src/calibre/gui2/keyboard.py @@ -26,7 +26,7 @@ from calibre.utils.icu import sort_key, lower from calibre.gui2 import error_dialog, info_dialog from calibre.utils.search_query_parser import SearchQueryParser, ParseException from calibre.gui2.search_box import SearchBox2 -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range ROOT = QModelIndex() @@ -270,7 +270,7 @@ class ConfigModel(SearchQueryParser, QAbstractItemModel): for node in self.all_shortcuts: s = node.data s['keys'] = tuple(keys_map[s['unique_name']]) - for r in xrange(self.rowCount()): + for r in range(self.rowCount()): group = self.index(r, 0) num = self.rowCount(group) if num > 0: diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 24a1ec8326..5c397c09c8 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -28,7 +28,7 @@ from calibre.utils.config import dynamic, prefs from calibre.utils.ipc import RC, gui_socket_address from calibre.utils.lock import singleinstance from calibre.utils.monotonic import monotonic -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range if iswindows: winutil = plugins['winutil'][0] @@ -478,7 +478,7 @@ def shutdown_other(rc=None): return # No running instance found rc.conn.send('shutdown:') prints(_('Shutdown command sent, waiting for shutdown...')) - for i in xrange(50): + for i in range(50): if singleinstance(singleinstance_name): return time.sleep(0.1) diff --git a/src/calibre/gui2/open_with.py b/src/calibre/gui2/open_with.py index 4000649201..725b7af0c6 100644 --- a/src/calibre/gui2/open_with.py +++ b/src/calibre/gui2/open_with.py @@ -22,7 +22,7 @@ from calibre.gui2.widgets2 import Dialog from calibre.gui2.progress_indicator import ProgressIndicator from calibre.utils.config import JSONConfig from calibre.utils.icu import numeric_sort_key as sort_key -from polyglot.builtins import string_or_bytes +from polyglot.builtins import string_or_bytes, range ENTRY_ROLE = Qt.UserRole @@ -411,7 +411,7 @@ class EditPrograms(Dialog): # {{{ register_keyboard_shortcuts(finalize=True) def update_stored_config(self): - entries = [self.plist.item(i).data(ENTRY_ROLE) for i in xrange(self.plist.count())] + entries = [self.plist.item(i).data(ENTRY_ROLE) for i in range(self.plist.count())] oprefs['entries'][self.file_type] = entries oprefs['entries'] = oprefs['entries'] diff --git a/src/calibre/gui2/pin_columns.py b/src/calibre/gui2/pin_columns.py index 51437370a2..0c205784c3 100644 --- a/src/calibre/gui2/pin_columns.py +++ b/src/calibre/gui2/pin_columns.py @@ -8,6 +8,7 @@ from PyQt5.Qt import QSplitter, QTableView from calibre.gui2.library import DEFAULT_SORT from calibre.gui2 import gprefs +from polyglot.builtins import range class PinTableView(QTableView): @@ -74,7 +75,7 @@ class PinTableView(QTableView): # Because of a bug in Qt 5 we have to ensure that the header is actually # relaid out by changing this value, without this sometimes ghost # columns remain visible when changing libraries - for i in xrange(h.count()): + for i in range(h.count()): val = h.isSectionHidden(i) h.setSectionHidden(i, not val) h.setSectionHidden(i, val) diff --git a/src/calibre/gui2/tag_mapper.py b/src/calibre/gui2/tag_mapper.py index cb2baad4fa..45af4b1211 100644 --- a/src/calibre/gui2/tag_mapper.py +++ b/src/calibre/gui2/tag_mapper.py @@ -20,7 +20,7 @@ from calibre.gui2.ui import get_gui from calibre.gui2.widgets2 import Dialog from calibre.utils.config import JSONConfig from calibre.utils.localization import localize_user_manual_link -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range tag_maps = JSONConfig('tag-map-rules') @@ -368,7 +368,7 @@ class Rules(QWidget): @property def rules(self): ans = [] - for r in xrange(self.rule_list.count()): + for r in range(self.rule_list.count()): ans.append(self.rule_list.item(r).data(DATA_ROLE)) return ans diff --git a/src/calibre/gui2/widgets.py b/src/calibre/gui2/widgets.py index 492e167307..ff02851f8b 100644 --- a/src/calibre/gui2/widgets.py +++ b/src/calibre/gui2/widgets.py @@ -23,7 +23,7 @@ from calibre.gui2.progress_indicator import ProgressIndicator as _ProgressIndica from calibre.gui2.dnd import (dnd_has_image, dnd_get_image, dnd_get_files, image_extensions, dnd_has_extension, DownloadDialog) from calibre.utils.localization import localize_user_manual_link -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range history = XMLConfig('history') @@ -84,7 +84,7 @@ class FilenamePattern(QWidget, Ui_Form): # {{{ # Get all items in the combobox. If we are reseting # to defaults we don't want to lose what the user # has added. - val_hist = [unicode_type(self.re.lineEdit().text())] + [unicode_type(self.re.itemText(i)) for i in xrange(self.re.count())] + val_hist = [unicode_type(self.re.lineEdit().text())] + [unicode_type(self.re.itemText(i)) for i in range(self.re.count())] self.re.clear() if defaults: @@ -163,7 +163,7 @@ class FilenamePattern(QWidget, Ui_Form): # {{{ prefs['filename_pattern'] = pat history = [] - history_pats = [unicode_type(self.re.lineEdit().text())] + [unicode_type(self.re.itemText(i)) for i in xrange(self.re.count())] + history_pats = [unicode_type(self.re.lineEdit().text())] + [unicode_type(self.re.itemText(i)) for i in range(self.re.count())] for p in history_pats[:24]: # Ensure we don't have duplicate items. if p and p not in history: diff --git a/src/calibre/library/__init__.py b/src/calibre/library/__init__.py index 58f07ca924..4e05cc537f 100644 --- a/src/calibre/library/__init__.py +++ b/src/calibre/library/__init__.py @@ -4,6 +4,9 @@ __copyright__ = '2008, Kovid Goyal ' ''' Code to manage ebook library''' +from polyglot.builtins import range + + def db(path=None, read_only=False): from calibre.db.legacy import LibraryDatabase from calibre.utils.config import prefs @@ -32,13 +35,13 @@ def generate_test_db(library_path, # {{{ def randstr(length): return ''.join(random.choice(letters) for i in - xrange(length)) + range(length)) - all_tags = [randstr(tag_length) for j in xrange(num_of_tags)] + all_tags = [randstr(tag_length) for j in range(num_of_tags)] print('Generated', num_of_tags, 'tags') - all_authors = [randstr(author_length) for j in xrange(num_of_authors)] + all_authors = [randstr(author_length) for j in range(num_of_authors)] print('Generated', num_of_authors, 'authors') - all_titles = [randstr(title_length) for j in xrange(num_of_records)] + all_titles = [randstr(title_length) for j in range(num_of_records)] print('Generated', num_of_records, 'titles') testdb = db(library_path) @@ -51,9 +54,9 @@ def generate_test_db(library_path, # {{{ print(i+1, end=' ') sys.stdout.flush() authors = random.randint(1, max_authors) - authors = [random.choice(all_authors) for i in xrange(authors)] + authors = [random.choice(all_authors) for i in range(authors)] tags = random.randint(0, max_tags) - tags = [random.choice(all_tags) for i in xrange(tags)] + tags = [random.choice(all_tags) for i in range(tags)] from calibre.ebooks.metadata.book.base import Metadata mi = Metadata(title, authors) mi.tags = tags @@ -80,5 +83,3 @@ def current_library_name(): path = current_library_path() if path: return posixpath.basename(path) - - diff --git a/src/calibre/rpdb.py b/src/calibre/rpdb.py index 4835e8e1f2..9b8b8bb1a6 100644 --- a/src/calibre/rpdb.py +++ b/src/calibre/rpdb.py @@ -11,6 +11,7 @@ import pdb, socket, inspect, sys, select, os, atexit, time from calibre import prints from calibre.utils.ipc import eintr_retry_call from calibre.constants import cache_dir +from polyglot.builtins import range PROMPT = b'(debug) ' QUESTION = b'\x00\x01\x02' @@ -96,7 +97,7 @@ def set_trace(port=4444, skip=None): def cli(port=4444): prints('Connecting to remote debugger on port %d...' % port) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - for i in xrange(20): + for i in range(20): try: sock.connect(('127.0.0.1', port)) break @@ -147,5 +148,6 @@ def cli(port=4444): except KeyboardInterrupt: pass + if __name__ == '__main__': cli() diff --git a/src/calibre/srv/loop.py b/src/calibre/srv/loop.py index 1a60c1adc3..3dd74ccb00 100644 --- a/src/calibre/srv/loop.py +++ b/src/calibre/srv/loop.py @@ -25,9 +25,10 @@ from calibre.utils.socket_inheritance import set_socket_inherit from calibre.utils.logging import ThreadSafeLog from calibre.utils.monotonic import monotonic from calibre.utils.mdns import get_external_ip +from polyglot.builtins import range READ, WRITE, RDWR, WAIT = 'READ', 'WRITE', 'RDWR', 'WAIT' -WAKEUP, JOB_DONE = bytes(bytearray(xrange(2))) +WAKEUP, JOB_DONE = bytes(bytearray(range(2))) IPPROTO_IPV6 = getattr(socket, "IPPROTO_IPV6", 41) diff --git a/src/calibre/srv/metadata.py b/src/calibre/srv/metadata.py index 526a2e4a08..9db376d257 100644 --- a/src/calibre/srv/metadata.py +++ b/src/calibre/srv/metadata.py @@ -23,6 +23,7 @@ from calibre.utils.icu import collation_order from calibre.utils.localization import calibre_langcode_to_name from calibre.library.comments import comments_to_html, markdown from calibre.library.field_metadata import category_icon_map +from polyglot.builtins import range IGNORED_FIELDS = frozenset('cover ondevice path marked au_map size'.split()) @@ -573,7 +574,7 @@ def dump_tags_model(m): def dump_node(index, level=-1): if level > -1: ans.append(indent*level + index.data(Qt.UserRole).dump_data()) - for i in xrange(m.rowCount(index)): + for i in range(m.rowCount(index)): dump_node(m.index(i, 0, index), level + 1) if level == 0: ans.append('') diff --git a/src/calibre/srv/pool.py b/src/calibre/srv/pool.py index dd0fa8978e..507aef42e5 100644 --- a/src/calibre/srv/pool.py +++ b/src/calibre/srv/pool.py @@ -11,6 +11,7 @@ from Queue import Queue, Full from threading import Thread from calibre.utils.monotonic import monotonic +from polyglot.builtins import range class Worker(Thread): @@ -52,7 +53,7 @@ class ThreadPool(object): def __init__(self, log, notify_server, count=10, queue_size=1000): self.request_queue, self.result_queue = Queue(queue_size), Queue(queue_size) - self.workers = [Worker(log, notify_server, i, self.request_queue, self.result_queue) for i in xrange(count)] + self.workers = [Worker(log, notify_server, i, self.request_queue, self.result_queue) for i in range(count)] def start(self): for w in self.workers: diff --git a/src/calibre/srv/routes.py b/src/calibre/srv/routes.py index 6d96ee0891..ab81b054bb 100644 --- a/src/calibre/srv/routes.py +++ b/src/calibre/srv/routes.py @@ -14,7 +14,7 @@ from operator import attrgetter from calibre.srv.errors import HTTPSimpleResponse, HTTPNotFound, RouteError from calibre.srv.utils import http_date from calibre.utils.serialize import msgpack_dumps, json_dumps, MSGPACK_MIME -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range default_methods = frozenset(('HEAD', 'GET')) @@ -259,8 +259,8 @@ class Router(object): lsz = max(len(r.matchers) for r in self) except ValueError: lsz = 0 - self.min_size_map = {sz:frozenset(r for r in self if r.min_size <= sz) for sz in xrange(lsz + 1)} - self.max_size_map = {sz:frozenset(r for r in self if r.max_size >= sz) for sz in xrange(lsz + 1)} + self.min_size_map = {sz:frozenset(r for r in self if r.min_size <= sz) for sz in range(lsz + 1)} + self.max_size_map = {sz:frozenset(r for r in self if r.max_size >= sz) for sz in range(lsz + 1)} self.soak_routes = sorted(frozenset(r for r in self if r.soak_up_extra), key=attrgetter('min_size'), reverse=True) def find_route(self, path): diff --git a/src/calibre/srv/utils.py b/src/calibre/srv/utils.py index e02f96f559..91efd16b12 100644 --- a/src/calibre/srv/utils.py +++ b/src/calibre/srv/utils.py @@ -13,7 +13,7 @@ from urlparse import parse_qs import repr as reprlib from email.utils import formatdate from operator import itemgetter -from polyglot.builtins import map, unicode_type +from polyglot.builtins import map, unicode_type, range from urllib import quote as urlquote from binascii import hexlify, unhexlify @@ -370,7 +370,7 @@ class RotatingStream(object): if not self.max_size or self.current_pos <= self.max_size or self.filename in ('/dev/stdout', '/dev/stderr'): return self.stream.close() - for i in xrange(self.history - 1, 0, -1): + for i in range(self.history - 1, 0, -1): src, dest = '%s.%d' % (self.filename, i), '%s.%d' % (self.filename, i+1) self.rename(src, dest) self.rename(self.filename, '%s.%d' % (self.filename, 1)) diff --git a/src/calibre/utils/cleantext.py b/src/calibre/utils/cleantext.py index 3ef9962391..9e04d5d4d6 100644 --- a/src/calibre/utils/cleantext.py +++ b/src/calibre/utils/cleantext.py @@ -3,7 +3,7 @@ __copyright__ = '2010, sengian ' __docformat__ = 'restructuredtext en' import re, htmlentitydefs -from polyglot.builtins import codepoint_to_chr, map +from polyglot.builtins import codepoint_to_chr, map, range from calibre.constants import plugins, preferred_encoding try: @@ -28,7 +28,7 @@ def clean_ascii_chars(txt, charlist=None): return '' global _ascii_pat if _ascii_pat is None: - chars = set(xrange(32)) + chars = set(range(32)) chars.add(127) for x in (9, 10, 13): chars.remove(x) diff --git a/src/calibre/utils/filenames.py b/src/calibre/utils/filenames.py index 98dc6ecb73..3459c852dd 100644 --- a/src/calibre/utils/filenames.py +++ b/src/calibre/utils/filenames.py @@ -14,7 +14,7 @@ from calibre.constants import ( filesystem_encoding, iswindows, plugins, preferred_encoding, isosx ) from calibre.utils.localization import get_udc -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range def ascii_text(orig): @@ -501,7 +501,7 @@ def atomic_rename(oldpath, newpath): are on different volumes. If succeeds, guaranteed to be atomic. newpath may or may not exist. If it exists, it is replaced. ''' if iswindows: - for i in xrange(10): + for i in range(10): try: rename_file(oldpath, newpath) break diff --git a/src/calibre/utils/matcher.py b/src/calibre/utils/matcher.py index c417a9b41e..7da1be1742 100644 --- a/src/calibre/utils/matcher.py +++ b/src/calibre/utils/matcher.py @@ -15,7 +15,7 @@ from collections import OrderedDict from itertools import islice from itertools import izip -from polyglot.builtins import map, unicode_type +from polyglot.builtins import map, unicode_type, range from calibre import detect_ncpus as cpu_count, as_unicode from calibre.constants import plugins, filesystem_encoding @@ -194,7 +194,7 @@ def process_item(ctx, haystack, needle): key = (hidx, nidx, last_idx) mem = ctx.memory.get(key, None) if mem is None: - for i in xrange(nidx, len(needle)): + for i in range(nidx, len(needle)): n = needle[i] if (len(haystack) - hidx < len(needle) - i): score = 0 @@ -295,12 +295,12 @@ def test(return_tests=False): m('one') start = memory() - for i in xrange(10): + for i in range(10): doit(str(i)) gc.collect() used10 = memory() - start start = memory() - for i in xrange(100): + for i in range(100): doit(str(i)) gc.collect() used100 = memory() - start diff --git a/src/calibre/utils/rapydscript.py b/src/calibre/utils/rapydscript.py index 946be0f5a4..ee0cf8aa07 100644 --- a/src/calibre/utils/rapydscript.py +++ b/src/calibre/utils/rapydscript.py @@ -23,7 +23,7 @@ from calibre.utils.filenames import atomic_rename from calibre.utils.terminal import ANSIStream from duktape import Context, JSError, to_python from lzma.xz import compress, decompress - +from polyglot.builtins import range COMPILER_PATH = 'rapydscript/compiler.js.xz' @@ -372,12 +372,12 @@ class Repl(Thread): self.from_repl.put(val[0]) except Exception as e: if isinstance(e, JSError): - print (e.stack or e.message, file=sys.stderr) + print(e.stack or e.message, file=sys.stderr) else: import traceback traceback.print_exc() - for i in xrange(100): + for i in range(100): # Do this many times to ensure we dont deadlock self.from_repl.put(None) diff --git a/src/calibre/utils/speedups.py b/src/calibre/utils/speedups.py index 7dcec14dd4..bb31aaa6ca 100644 --- a/src/calibre/utils/speedups.py +++ b/src/calibre/utils/speedups.py @@ -6,6 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) import os +from polyglot.builtins import range class ReadOnlyFileBuffer(object): @@ -90,7 +91,7 @@ def svg_path_to_painter_path(d): return float(b''.join(chars)) def parse_floats(num, x_offset=0, y_offset=0): - for i in xrange(num): + for i in range(num): val = parse_float() yield val + (x_offset if i % 2 == 0 else y_offset) diff --git a/src/calibre/utils/terminal.py b/src/calibre/utils/terminal.py index dcfac66126..b4a28420d2 100644 --- a/src/calibre/utils/terminal.py +++ b/src/calibre/utils/terminal.py @@ -11,6 +11,7 @@ import os, sys, re from itertools import izip from calibre.constants import iswindows +from polyglot.builtins import range if iswindows: import ctypes.wintypes @@ -30,7 +31,7 @@ def fmt(code): RATTRIBUTES = dict( - izip(xrange(1, 9), ( + izip(range(1, 9), ( 'bold', 'dark', '', @@ -45,7 +46,7 @@ ATTRIBUTES = {v:fmt(k) for k, v in RATTRIBUTES.iteritems()} del ATTRIBUTES[''] RBACKGROUNDS = dict( - izip(xrange(41, 48), ( + izip(range(41, 48), ( 'red', 'green', 'yellow', @@ -58,7 +59,7 @@ RBACKGROUNDS = dict( BACKGROUNDS = {v:fmt(k) for k, v in RBACKGROUNDS.iteritems()} RCOLORS = dict( - izip(xrange(31, 38), ( + izip(range(31, 38), ( 'red', 'green', 'yellow', diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index c72454b827..4be58c8e10 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -9,7 +9,7 @@ from calibre.web.feeds.news import (BasicNewsRecipe, CustomIndexRecipe, AutomaticNewsRecipe, CalibrePeriodical) from calibre.ebooks.BeautifulSoup import BeautifulSoup from calibre.utils.config import JSONConfig -from polyglot.builtins import unicode_type, codepoint_to_chr +from polyglot.builtins import unicode_type, codepoint_to_chr, range basic_recipes = (BasicNewsRecipe, AutomaticNewsRecipe, CustomIndexRecipe, CalibrePeriodical) @@ -47,6 +47,7 @@ def compile_recipe(src): 'BeautifulSoup':BeautifulSoup, 'unicode': unicode_type, 'unichr': codepoint_to_chr, + 'xrange': range, } exec(src, namespace) diff --git a/src/odf/odf2xhtml.py b/src/odf/odf2xhtml.py index 89d75a1961..00c038d278 100644 --- a/src/odf/odf2xhtml.py +++ b/src/odf/odf2xhtml.py @@ -1194,7 +1194,7 @@ dl.notes dd:last-of-type { page-break-after: avoid } htmlattrs = {} if c: htmlattrs['class'] = "TC-%s" % c.replace(".","_") - for x in xrange(repeated): + for x in range(repeated): self.emptytag('col', htmlattrs) self.purgedata() @@ -1580,8 +1580,7 @@ dl.notes dd:last-of-type { page-break-after: avoid } """ self.lines = [] self._wfunc = self._wlines - if isinstance(odffile, (bytes, type(u'')) \ - or hasattr(odffile, 'read'): # Added by Kovid + if isinstance(odffile, (bytes, type(u''))) or hasattr(odffile, 'read'): # Added by Kovid self.document = load(odffile) else: self.document = odffile From 6b5c3bd7c9289a3ac055d43d46033e87a1b2b478 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Mar 2019 15:44:45 +0530 Subject: [PATCH 0307/2613] Get rid of more xrange --- src/calibre/db/tests/legacy.py | 5 +++-- src/calibre/db/tests/reading.py | 15 +++++++------- src/calibre/devices/cybook/t4b.py | 4 ++-- src/calibre/devices/kindle/apnx.py | 3 ++- src/calibre/devices/mtp/test.py | 7 ++++--- src/calibre/ebooks/compression/palmdoc.py | 4 ++-- src/calibre/ebooks/compression/tcr.py | 7 ++++--- src/calibre/ebooks/djvu/djvubzzdec.py | 5 ++++- src/calibre/ebooks/docx/cleanup.py | 3 ++- src/calibre/ebooks/docx/fonts.py | 8 ++++---- src/calibre/ebooks/docx/tables.py | 3 ++- src/calibre/ebooks/docx/toc.py | 8 ++++---- src/calibre/ebooks/lit/reader.py | 24 +++++++++++------------ src/calibre/ebooks/metadata/mobi.py | 8 ++++---- src/calibre/ebooks/metadata/opf2.py | 4 ++-- src/calibre/ebooks/pdf/reflow.py | 4 ++-- src/calibre/ebooks/rb/reader.py | 3 ++- src/calibre/ebooks/rtf2xml/tokenize.py | 4 ++-- src/calibre/srv/tests/http.py | 9 +++++---- src/calibre/srv/tests/loop.py | 3 ++- src/calibre/srv/tests/web_sockets.py | 3 ++- 21 files changed, 74 insertions(+), 60 deletions(-) diff --git a/src/calibre/db/tests/legacy.py b/src/calibre/db/tests/legacy.py index 7d820d7c46..7282b7fc47 100644 --- a/src/calibre/db/tests/legacy.py +++ b/src/calibre/db/tests/legacy.py @@ -14,6 +14,7 @@ from operator import itemgetter from calibre.library.field_metadata import fm_as_dict from calibre.db.tests.base import BaseTest +from polyglot.builtins import range # Utils {{{ @@ -162,11 +163,11 @@ class LegacyTest(BaseTest): 'comment', 'publisher', 'rating', 'series_index', 'tags', 'timestamp', 'uuid', 'pubdate', 'ondevice', 'metadata_last_modified', 'languages') - oldvals = {g:tuple(getattr(old, g)(x) for x in xrange(3)) + tuple(getattr(old, g)(x, True) for x in (1,2,3)) for g in getters} + oldvals = {g:tuple(getattr(old, g)(x) for x in range(3)) + tuple(getattr(old, g)(x, True) for x in (1,2,3)) for g in getters} old_rows = {tuple(r)[:5] for r in old} old.close() db = self.init_legacy() - newvals = {g:tuple(getattr(db, g)(x) for x in xrange(3)) + tuple(getattr(db, g)(x, True) for x in (1,2,3)) for g in getters} + newvals = {g:tuple(getattr(db, g)(x) for x in range(3)) + tuple(getattr(db, g)(x, True) for x in (1,2,3)) for g in getters} new_rows = {tuple(r)[:5] for r in db} for x in (oldvals, newvals): x['tags'] = tuple(set(y.split(',')) if y else y for y in x['tags']) diff --git a/src/calibre/db/tests/reading.py b/src/calibre/db/tests/reading.py index 1ef4441c70..4c95644e1a 100644 --- a/src/calibre/db/tests/reading.py +++ b/src/calibre/db/tests/reading.py @@ -13,6 +13,7 @@ from time import time from calibre.utils.date import utc_tz from calibre.db.tests.base import BaseTest +from polyglot.builtins import range class ReadingTest(BaseTest): @@ -198,18 +199,18 @@ class ReadingTest(BaseTest): ae([3, 2, 1], cache.multisort([('identifiers', True), ('title', True)]), 'Subsort failed') from calibre.ebooks.metadata.book.base import Metadata - for i in xrange(7): + for i in range(7): cache.create_book_entry(Metadata('title%d' % i), apply_import_tags=False) cache.create_custom_column('one', 'CC1', 'int', False) cache.create_custom_column('two', 'CC2', 'int', False) cache.create_custom_column('three', 'CC3', 'int', False) cache.close() cache = self.init_cache() - cache.set_field('#one', {(i+(5*m)):m for m in (0, 1) for i in xrange(1, 6)}) + cache.set_field('#one', {(i+(5*m)):m for m in (0, 1) for i in range(1, 6)}) cache.set_field('#two', {i+(m*3):m for m in (0, 1, 2) for i in (1, 2, 3)}) cache.set_field('#two', {10:2}) - cache.set_field('#three', {i:i for i in xrange(1, 11)}) - ae(list(xrange(1, 11)), cache.multisort([('#one', True), ('#two', True)], ids_to_sort=sorted(cache.all_book_ids()))) + cache.set_field('#three', {i:i for i in range(1, 11)}) + ae(list(range(1, 11)), cache.multisort([('#one', True), ('#two', True)], ids_to_sort=sorted(cache.all_book_ids()))) ae([4, 5, 1, 2, 3, 7,8, 9, 10, 6], cache.multisort([('#one', True), ('#two', False)], ids_to_sort=sorted(cache.all_book_ids()))) ae([5, 4, 3, 2, 1, 10, 9, 8, 7, 6], cache.multisort([('#one', True), ('#two', False), ('#three', False)], ids_to_sort=sorted(cache.all_book_ids()))) # }}} @@ -220,7 +221,7 @@ class ReadingTest(BaseTest): old = LibraryDatabase2(self.library_path) old_metadata = {i:old.get_metadata( i, index_is_id=True, get_cover=True, cover_as_data=True) for i in - xrange(1, 4)} + range(1, 4)} for mi in old_metadata.itervalues(): mi.format_metadata = dict(mi.format_metadata) if mi.formats: @@ -231,7 +232,7 @@ class ReadingTest(BaseTest): cache = self.init_cache(self.library_path) new_metadata = {i:cache.get_metadata( - i, get_cover=True, cover_as_data=True) for i in xrange(1, 4)} + i, get_cover=True, cover_as_data=True) for i in range(1, 4)} cache = None for mi2, mi1 in zip(new_metadata.values(), old_metadata.values()): self.compare_metadata(mi1, mi2) @@ -245,7 +246,7 @@ class ReadingTest(BaseTest): for d, l in ((json_dumps, json_loads), (msgpack_dumps, msgpack_loads)): fm2 = l(d(fm)) self.assertEqual(fm_as_dict(fm), fm_as_dict(fm2)) - for i in xrange(1, 4): + for i in range(1, 4): mi = cache.get_metadata(i, get_cover=True, cover_as_data=True) rmi = msgpack_loads(msgpack_dumps(mi)) self.compare_metadata(mi, rmi, exclude='format_metadata has_cover formats id'.split()) diff --git a/src/calibre/devices/cybook/t4b.py b/src/calibre/devices/cybook/t4b.py index c87d7a69b6..4940f6216a 100644 --- a/src/calibre/devices/cybook/t4b.py +++ b/src/calibre/devices/cybook/t4b.py @@ -8,6 +8,7 @@ Write a t4b file to disk. ''' from io import BytesIO +from polyglot.builtins import range DEFAULT_T4B_DATA = b'\x74\x34\x62\x70\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc4\x00\x16\xdf\xff\xff\xf7\x6d\xff\xff\xfd\x7a\xff\xff\xff\xe7\x77\x76\xff\xf6\x77\x77\x8d\xff\xff\xe7\x77\x78\xbf\xff\xff\xf7\x77\x77\x77\x7d\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xe4\x03\x78\x61\x07\xff\xff\x90\x04\xff\xff\xfc\x05\xff\xff\xff\xd5\x30\x35\xff\xf0\x13\x32\x00\x5f\xff\xd0\x03\x32\x01\xbf\xff\xe0\x00\x00\x00\x0b\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x50\x8f\xff\xff\x75\xff\xff\x40\x30\xef\xff\xfc\x06\xff\xff\xff\xff\xa0\x9f\xff\xf0\x6f\xff\xf5\x0d\xff\xd0\x4f\xff\xd0\x0f\xff\xe0\x3f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfd\x05\xff\xff\xff\xfe\xff\xfe\x03\xa0\x8f\xff\xfc\x06\xff\xff\xff\xff\xa0\x9f\xff\xf0\x6f\xff\xfb\x0b\xff\xd0\x4f\xff\xf7\x0d\xff\xe0\x3f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf6\x0e\xff\xff\xff\xff\xff\xfa\x0b\xe0\x3f\xff\xfc\x06\xff\xff\xff\xff\xa0\x9f\xff\xf0\x6f\xff\xf5\x0e\xff\xd0\x4f\xff\xf8\x0e\xff\xe0\x3f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf1\x1f\xff\xff\xff\xff\xff\xf2\x0f\xf3\x0d\xff\xfc\x06\xff\xff\xff\xff\xa0\x9f\xff\xf0\x39\x88\x30\xaf\xff\xd0\x4f\xff\xf2\x1f\xff\xe0\x18\x88\x88\x8d\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf0\x3f\xff\xff\xff\xff\xff\xd0\x6f\xfc\x09\xff\xfc\x06\xff\xff\xff\xff\xa0\x9f\xff\xf0\x01\x11\x00\x2c\xff\xd0\x3a\xa8\x20\xcf\xff\xe0\x00\x00\x00\x0b\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf0\x2f\xff\xff\xff\xff\xff\x60\xaf\xff\x11\xff\xfc\x06\xff\xff\xff\xff\xa0\x9f\xff\xf0\x6f\xff\xfd\x10\xef\xd0\x00\x00\x1e\xff\xff\xe0\x3f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf2\x0f\xff\xff\xff\xff\xfe\x20\x12\x22\x00\xcf\xfc\x06\xff\xff\xff\xff\xa0\x9f\xff\xf0\x6f\xff\xff\x90\x9f\xd0\x3d\xd8\x09\xff\xff\xe0\x3f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf8\x0b\xff\xff\xff\xff\xfc\x03\x88\x88\x60\x4f\xfc\x06\xff\xff\xff\xff\xa0\x9f\xff\xf0\x6f\xff\xff\xa0\x8f\xd0\x4f\xff\x40\xcf\xff\xe0\x3f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\xef\xff\xff\xfb\xf7\x0d\xff\xff\xf1\x1e\xfc\x06\xff\xff\xff\xff\xa0\x9f\xff\xf0\x6f\xff\xff\x60\xcf\xd0\x4f\xff\xf3\x0d\xff\xe0\x3f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x2c\xff\xfa\x05\xf0\x2f\xff\xff\xf6\x0b\xfc\x03\x88\x88\x88\xff\xb0\xaf\xff\xf0\x5d\xcc\xa3\x05\xff\xd0\x4f\xff\xfe\x11\xef\xe0\x18\x88\x88\x8d\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf8\x10\x01\x00\x3b\xb0\x9f\xff\xff\xfd\x06\xfc\x00\x00\x00\x00\xd0\x00\x00\xff\xf0\x00\x00\x02\x7f\xff\xe1\x5f\xff\xff\xc0\x5f\xe1\x00\x00\x00\x0b\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xed\xa9\xbd\xff\xed\xff\xff\xff\xff\xde\xff\xdd\xdd\xdd\xdd\xfd\xdd\xdd\xff\xfd\xdd\xdd\xee\xff\xff\xfd\xef\xff\xff\xfe\xdf\xfd\xdd\xdd\xdd\xdf\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xed\xdb\x86\x8e\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xb7\x42\x00\x00\x0b\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfd\x00\x00\x00\x00\x09\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfd\x00\x00\x01\x11\x17\xef\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xee\xee\xee\xee\xee\xee\xee\xee\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\x22\x45\x78\x9b\x95\xef\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xb8\x77\x78\x88\x88\x88\x87\x87\x89\xdf\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\x57\x9a\xaa\xaa\x94\xdf\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\x00\x00\x11\x11\x22\x12\x11\x11\x10\x7e\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x76\xaa\xaa\xab\xa4\xcf\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x12\x23\x33\x33\x33\x33\x32\x21\x6e\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xa5\xaa\xa9\x99\xa5\xaf\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x33\x44\x44\x44\x33\x21\x6d\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xb4\xaa\xa9\xa9\xb6\x8f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x23\x34\x44\x54\x55\x44\x44\x31\x6d\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc5\x9a\x99\x9a\xb8\x7e\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x23\x34\x44\x44\x55\x45\x44\x31\x6d\xff\xff\xff\xff\xff\xff\xff\xff\xee\xdd\xdd\xee\xee\xc5\x9a\x88\x8a\xa9\x6e\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x44\x44\x44\x44\x44\x31\x6d\xff\xff\xff\xff\xff\xff\xff\xfe\xdc\xbb\xab\xcc\xca\x84\x8a\xa9\x99\xaa\x5d\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x44\x44\x44\x44\x44\x31\x6d\xff\xff\xff\xff\xff\xff\xff\xed\xa9\x99\x78\x87\x78\x84\x7a\xaa\x89\x9a\x6c\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x23\x34\x44\x45\x55\x55\x44\x31\x6d\xff\xff\xff\xff\xff\xff\xff\xec\x98\x88\x76\x98\x88\x74\x7a\xaa\xa7\x9a\x6b\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x23\x33\x34\x44\x54\x44\x44\x31\x6d\xff\xff\xff\xff\xff\xff\xff\xdb\x98\x88\x76\x98\x88\x74\x5a\xaa\x89\x9b\x7a\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x44\x45\x55\x54\x43\x31\x6d\xff\xff\xff\xff\xff\xff\xfe\xdb\x98\x88\x76\x98\x88\x84\x4a\xaa\x97\xbb\x79\xef\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x34\x44\x44\x44\x44\x31\x5b\xcc\xcc\xcc\xcc\xcc\xcc\xcb\xba\x98\x88\x76\x88\x88\x85\x39\xa9\x8a\xab\x97\xef\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x33\x34\x44\x44\x43\x31\x34\x44\x44\x55\x55\x55\x55\x44\x46\x98\x88\x76\x78\x88\x85\x28\xa8\x9a\xab\xa5\xef\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf9\x00\x11\x11\x11\x12\x22\x22\x11\x10\x00\x01\x22\x23\x33\x33\x33\x31\x11\x88\x88\x76\x68\x88\x85\x27\xa9\xa9\xab\xa5\xdf\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x12\x23\x33\x33\x44\x43\x33\x21\x00\x12\x33\x44\x55\x55\x65\x42\x11\x78\x88\x76\x68\x88\x85\x36\xaa\xaa\xab\xb5\xcf\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x34\x44\x54\x44\x44\x21\x01\x23\x44\x55\x66\x66\x66\x53\x21\x78\x88\x86\x68\x88\x85\x45\xaa\xaa\xbb\xb6\xaf\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x34\x44\x44\x44\x33\x21\x01\x23\x45\x56\x67\x77\x77\x54\x21\x78\x88\x86\x68\x88\x85\x54\xaa\xab\xbb\xb7\x8f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x44\x44\x44\x44\x43\x21\x01\x23\x57\x8a\xaa\xaa\x99\x74\x21\x79\x88\x86\x68\x88\x75\x44\x9a\xab\xbb\xb9\x6e\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x34\x44\x44\x55\x43\x21\x01\x24\x56\x78\x89\x99\x88\x74\x21\x69\x88\x87\x68\x88\x75\x53\x9a\xab\xbb\xba\x5e\xff\xff\xff\xff\xff\xed\xa7\x9e\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x44\x34\x44\x54\x44\x21\x01\x23\x45\x56\x67\x77\x77\x64\x21\x69\x88\x87\x68\x88\x65\x53\x8a\xaa\xaa\xba\x5d\xff\xff\xff\xed\xb9\x75\x54\x5b\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x84\x66\x48\x54\x43\x21\x01\x23\x45\x56\x67\x77\x76\x64\x21\x6a\x88\x87\x68\x88\x66\x54\x7a\xaa\x9a\xbb\x6b\xff\xee\xb9\x66\x66\x78\x75\x69\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x64\x54\x47\x54\x43\x21\x01\x23\x45\x66\x77\x67\x67\x64\x21\x6a\x88\x87\x68\x88\x76\x54\x6a\xbb\xba\xbb\x79\xca\x75\x56\x77\x88\x88\x85\x68\xef\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x23\x33\xba\xba\xac\x44\x43\x21\x01\x23\x45\x56\x66\x66\x76\x64\x21\x6a\x88\x87\x67\x88\x66\x54\x5a\xbb\xa9\xbb\x83\x45\x67\x78\x64\x78\x88\x86\x66\xdf\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x87\x77\x79\x54\x43\x21\x01\x23\x45\x56\x66\x67\x77\x54\x21\x6a\x88\x87\x67\x88\x66\x54\x4a\xbb\xab\xbb\x93\x47\x88\x88\x66\x38\x88\x98\x66\xbf\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x44\x44\x44\x54\x44\x21\x01\x23\x45\x56\x66\x67\x77\x64\x21\x6a\x88\x88\x66\x98\x66\x55\x3a\xab\xba\xab\xa4\x47\x88\x87\x68\x43\x89\x99\x57\x8f\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x32\x34\x3a\x44\x43\x21\x01\x23\x45\x56\x66\x67\x66\x64\x31\x69\x88\x88\x65\x98\x66\x55\x39\xbb\xba\xbc\xa4\x47\x88\x87\x77\x85\x37\xaa\x78\x7e\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\xad\x76\xc5\x44\x33\x21\x01\x23\x44\x56\x66\x77\x76\x54\x21\x69\x98\x88\x65\x98\x66\x65\x38\xbb\xb9\xbb\xb5\x46\x77\x86\x68\x87\x78\x9a\x87\x7c\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x84\x7b\x44\x44\x33\x21\x01\x23\x44\x56\x67\x76\x76\x63\x21\x79\x98\x88\x76\x87\x66\x65\x46\xaa\x99\xab\xb5\x45\x88\x76\x67\x77\x78\x9a\x96\x8a\xff\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x63\x54\x46\x54\x43\x21\x01\x23\x44\x55\x66\x67\x76\x64\x21\x79\x98\x88\x76\x77\x66\x65\x44\xab\xbb\xaa\xb7\x35\x88\x87\x77\x89\x99\x9a\x96\x89\xef\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\xbb\xba\xbc\x44\x43\x21\x01\x23\x44\x56\x67\x66\x76\x63\x21\x79\x98\x88\x76\x68\x66\x65\x53\xab\xba\xaa\xb8\x35\x78\x88\x89\x99\x99\x9a\xa7\x88\xef\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x54\x44\x45\x44\x34\x21\x01\x23\x44\x56\x66\x86\x66\x54\x21\x79\x98\x88\x76\x68\x66\x65\x63\x9a\xba\xab\xb9\x35\x68\x88\x99\x99\x9a\x9a\xa8\x77\xcf\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x33\x43\x43\x44\x43\x21\x01\x23\x44\x55\x66\x76\x66\x54\x21\x7a\x98\x88\x76\x68\x66\x65\x63\x8a\xab\xa9\xba\x35\x58\x88\x99\x99\x99\x9a\xa9\x67\xaf\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x12\x23\x69\x2a\xd9\x34\x33\x21\x01\x23\x44\x55\x67\x67\x66\x53\x21\x7a\x98\x88\x76\x67\x66\x66\x54\x7a\xa9\x9a\xbb\x44\x48\x99\x99\x89\x99\xaa\xaa\x68\x8e\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x97\x98\x47\x44\x34\x21\x01\x23\x44\x56\x66\x76\x66\x53\x21\x7a\x98\x88\x76\x67\x66\x66\x55\x6a\xbb\x9a\xbb\x54\x57\x99\x98\x79\x9a\xaa\xaa\x87\x7d\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x53\x44\x36\x54\x44\x21\x00\x23\x44\x55\x66\x66\x66\x53\x21\x7a\x98\x87\x76\x67\x66\x66\x55\x5a\xaa\xaa\xbb\x73\x66\x99\x66\x59\x77\xaa\xaa\x97\x8b\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\xcc\xcc\xcd\x44\x33\x21\x01\x23\x34\x55\x66\x66\x66\x53\x21\x7b\x98\x88\x76\x66\x66\x66\x65\x4a\xaa\xab\xab\x83\x66\x88\x55\x48\x84\x5a\xaa\xa6\x89\xff\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x44\x34\x45\x44\x33\x21\x01\x23\x44\x55\x56\x66\x66\x53\x21\x7b\x98\x88\x76\x66\x66\x66\x56\x49\x9a\xaa\x9b\x94\x55\x88\x66\x78\x86\x98\xaa\xa7\x88\xef\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x33\x33\x44\x44\x33\x21\x00\x22\x34\x55\x66\x66\x66\x53\x21\x8b\xa7\x88\x86\x66\x66\x66\x56\x38\xa7\x99\xaa\x95\x56\x79\x99\x97\x76\x96\xaa\xa8\x88\xdf\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x33\x76\x77\x78\x44\x33\x21\x01\x22\x34\x45\x54\x66\x66\x53\x21\x8b\xa7\x78\x86\x56\x66\x66\x55\x48\xaa\xaa\xaa\xa5\x56\x69\x99\x99\x85\x79\x7a\xa9\x68\xbf\xff\xff\xff\xff\xff\xff\xfa\x11\x12\x33\xaa\xaa\xab\x34\x33\x21\x00\x23\x34\x45\x6b\x66\x66\x53\x21\x8b\xa8\x78\x76\x56\x76\x66\x65\x47\xaa\xa9\x9a\xa6\x66\x59\x99\x99\xa6\x6a\x6a\xaa\x68\x9f\xff\xff\xff\xff\xff\xff\xfa\x11\x12\x23\x43\x33\x33\x34\x33\x21\x00\x22\x34\x45\x68\x86\x66\x53\x21\x8c\xa8\x77\x76\x56\x76\x66\x66\x45\xaa\xa9\xab\xb6\x85\x58\x99\x99\x99\x6a\x69\xaa\x67\x7e\xff\xff\xff\xff\xff\xff\xfa\x11\x12\x23\x33\x34\x49\x75\x33\x21\x00\x22\x34\x45\x66\x66\x65\x53\x21\x8c\xa8\x77\x66\x55\x76\x66\x66\x54\xa9\x99\x9b\xa7\x76\x66\x99\x99\xa6\x69\x88\xaa\x87\x6c\xff\xff\xff\xff\xff\xff\xfa\x11\x12\x23\x33\x33\x37\x34\x33\x21\x00\x12\x34\x45\x59\x86\x66\x53\x21\x8c\xb9\x77\x66\x55\x76\x66\x65\x63\x9a\xaa\xba\xb8\x67\x66\x99\x99\x97\x68\x96\xaa\xa6\x7a\xff\xff\xff\xff\xff\xff\xfa\x11\x22\x23\x54\x44\x46\x44\x43\x21\x00\x22\x34\x58\x59\xa5\x65\x53\x21\x8c\xb9\x77\x76\x56\x76\x66\x65\x63\x8a\xaa\xaa\xb9\x58\x65\x89\x99\x99\x86\xa3\xaa\xa6\x88\xef\xff\xff\xff\xff\xff\xfa\x11\x12\x23\xab\xbb\xbc\x33\x33\x21\x00\x12\x34\x46\x66\x66\x55\x43\x21\x8c\xb9\x77\x76\x56\x76\x66\x65\x64\x7a\xaa\x9a\xba\x49\x66\x89\x99\x99\x95\xa4\x5a\xa7\x87\xdf\xff\xff\xff\xff\xff\xfa\x11\x12\x22\x42\x33\x35\x44\x33\x21\x00\x12\x34\x48\x86\x85\x55\x43\x21\x8c\xb9\x67\x77\x56\x67\x66\x66\x65\x6a\xaa\x9a\xba\x4a\x67\x79\x99\x86\x76\x86\x27\xa8\x67\xcf\xff\xff\xff\xff\xff\xfa\x11\x12\x23\x33\x33\x35\x33\x33\x21\x00\x12\x33\x54\x88\x56\x65\x43\x21\x8d\xba\x66\x77\x56\x57\x66\x66\x65\x5a\xab\xaa\xbb\x59\x76\x59\x99\x99\x97\x98\x24\xa9\x67\xaf\xff\xff\xff\xff\xff\xfa\x11\x12\x22\x21\x36\x9b\x33\x33\x21\x00\x12\x34\x45\x56\x76\x55\x43\x21\x8d\xca\x76\x77\x66\x57\x66\x65\x65\x5a\xaa\x9a\xbb\x78\x96\x58\x99\x99\x88\x9a\x44\xa9\x67\x8e\xff\xff\xff\xff\xff\xfa\x11\x12\x23\x6a\xb7\x44\x43\x33\x21\x00\x12\x34\x44\x55\x85\x55\x43\x21\x8d\xca\x77\x67\x66\x67\x66\x66\x66\x49\xaa\xaa\xab\x87\xc5\x57\x98\x98\x87\x68\x85\x99\x76\x6d\xff\xff\xff\xff\xff\xfa\x11\x12\x23\x96\x33\x43\x33\x33\x21\x00\x12\x33\x44\x65\x55\x55\x43\x21\x8d\xca\x87\x76\x66\x67\x66\x66\x56\x59\xa9\x99\xab\x96\xc6\x65\x98\x89\x99\x68\x98\x99\x86\x6b\xff\xff\xff\xff\xff\xfa\x11\x12\x22\x44\x75\x23\x33\x33\x21\x00\x12\x33\x44\x6a\x65\x55\x43\x21\x8d\xca\x87\x76\x66\x67\x66\x66\x66\x58\xa8\x9a\x9b\xa5\xc9\x65\x88\x89\x99\x77\x98\x99\x95\x68\xff\xff\xff\xff\xff\xfa\x11\x12\x22\x22\x24\x79\x33\x33\x21\x00\x12\x34\x44\x56\x75\x55\x43\x21\x8d\xda\x87\x77\x66\x67\x66\x66\x66\x47\xa9\x9a\xbb\xa6\xcb\x65\x78\x88\x88\x85\x68\x99\x96\x66\xef\xff\xff\xff\xff\xfa\x11\x12\x23\x11\x33\x34\x33\x32\x21\x00\x12\x33\x44\x57\x65\x55\x43\x21\x8d\xda\x87\x77\x65\x76\x76\x66\x67\x56\xaa\xbb\xaa\xa6\xbc\x66\x68\x88\x88\x85\x88\x89\x97\x66\xcf\xff\xff\xff\xff\xfa\x11\x12\x23\x95\x23\x36\x33\x33\x21\x00\x12\x33\x44\x58\x65\x55\x43\x21\x8d\xda\x96\x77\x65\x77\x66\x66\x57\x55\xaa\xaa\xaa\xb6\xad\x66\x58\x88\x88\x85\x78\x88\x98\x66\xaf\xff\xff\xff\xff\xfa\x11\x12\x22\x52\x33\x35\x33\x33\x21\x00\x12\x33\x44\x55\x65\x55\x42\x21\x8e\xdb\x97\x67\x75\x77\x66\x66\x56\x64\xaa\xbb\xaa\xa7\x8e\x85\x58\x87\x88\x87\x88\x88\x88\x56\x8f\xff\xff\xff\xff\xfa\x11\x12\x22\x42\x23\x35\x43\x32\x21\x00\x12\x33\x44\x48\x85\x55\x43\x21\x8e\xdb\x97\x67\x75\x77\x66\x66\x66\x73\x9b\xaa\xaa\xb8\x6e\xb4\x57\x87\x87\x77\x78\x88\x88\x56\x7e\xff\xff\xff\xff\xfa\x11\x12\x22\x42\x33\x28\x33\x32\x21\x00\x12\x33\x44\x55\x55\x55\x43\x21\x8e\xdb\x97\x76\x76\x67\x76\x66\x66\x74\x8a\xba\xaa\xb9\x5d\xd5\x55\x77\x77\x77\x47\x88\x88\x65\x5d\xff\xff\xff\xff\xfa\x10\x12\x22\x63\x11\x78\x33\x32\x20\x00\x12\x33\x34\x47\x84\x55\x42\x21\x8e\xec\x97\x77\x66\x67\x87\x76\x66\x74\x7a\xaa\xaa\xba\x4d\xe7\x54\x77\x77\x77\x56\x87\x88\x74\x5a\xff\xff\xff\xff\xfa\x11\x12\x22\x28\x9a\x83\x33\x32\x20\x00\x12\x33\x44\x55\x55\x55\x42\x21\x9e\xec\x97\x77\x66\x67\x76\x66\x66\x76\x6a\xaa\x99\xba\x4b\xfa\x54\x67\x77\x77\x65\x77\x77\x84\x57\xef\xff\xff\xff\xfa\x11\x12\x22\x22\x33\x33\x33\x22\x10\x00\x12\x33\x33\x56\x45\x54\x42\x11\x9e\xec\x97\x77\x75\x67\x76\x66\x65\x67\x5a\xaa\x99\xba\x59\xfc\x54\x57\x77\x76\x65\x77\x77\x75\x55\xdf\xff\xff\xff\xfa\x11\x12\x22\x22\x33\x33\x33\x22\x20\x00\x12\x33\x35\x45\x65\x54\x42\x21\x9e\xec\xa7\x77\x76\x67\x86\x66\x65\x68\x4a\xa9\x8a\xbb\x77\xfd\x65\x56\x76\x76\x64\x67\x77\x76\x55\xbf\xff\xff\xff\xfa\x11\x12\x22\x22\x32\x33\x23\x22\x20\x00\x12\x23\x45\x55\x54\x44\x42\x11\x9e\xec\xa7\x67\x76\x68\x77\x66\x66\x68\x4a\xb9\x88\xaa\x96\xef\x75\x46\x66\x66\x65\x45\x77\x77\x45\x9f\xff\xff\xff\xfa\x10\x12\x22\x22\x22\x33\x32\x22\x20\x00\x12\x23\x33\x44\x54\x54\x42\x21\x8e\xed\xa8\x76\x76\x58\x77\x66\x66\x67\x59\xba\xa8\xa9\xa5\xef\x94\x46\x66\x66\x66\x46\x67\x77\x45\x7e\xff\xff\xff\xfa\x11\x12\x22\x22\x33\x33\x23\x32\x21\x00\x12\x23\x34\x54\x44\x44\x42\x11\x8e\xfd\xb8\x76\x67\x67\x68\x77\x66\x67\x68\xaa\xa9\x7b\xa5\xcf\xc3\x45\x66\x66\x66\x67\x66\x67\x55\x5d\xff\xff\xff\xf9\x00\x00\x11\x11\x11\x11\x11\x11\x10\x00\x12\x23\x34\x34\x44\x44\x42\x11\x8e\xfd\xb8\x77\x66\x67\x77\x66\x66\x67\x77\xaa\xa8\xa9\xb6\xbf\xe5\x44\x66\x66\x66\x66\x66\x67\x54\x4b\xff\xff\xff\xf9\x00\x01\x11\x11\x11\x11\x11\x11\x10\x00\x12\x23\x33\x44\x44\x44\x32\x11\x8e\xfd\xb8\x77\x76\x67\x77\x66\x66\x57\x76\xba\xa8\x7a\xb6\xaf\xf8\x43\x66\x66\x66\x66\x66\x66\x63\x48\xff\xff\xff\xfa\x10\x11\x22\x22\x22\x22\x32\x22\x10\x00\x12\x23\x34\x44\x44\x44\x32\x11\x8e\xfd\xb9\x77\x76\x57\x87\x66\x66\x66\x85\xbb\xa8\x8b\xa7\x9f\xfb\x43\x56\x66\x66\x66\x66\x66\x64\x45\xef\xff\xff\xfa\x10\x12\x22\x22\x22\x32\x22\x22\x10\x00\x12\x23\x33\x44\x44\x44\x32\x11\x8e\xfe\xb9\x67\x77\x57\x87\x76\x66\x66\x84\xab\x89\xaa\xb8\x8e\xfd\x54\x46\x66\x55\x55\x55\x66\x65\x43\xdf\xff\xff\xfa\x10\x12\x22\x22\x22\x32\x22\x22\x20\x00\x12\x23\x33\x44\x44\x44\x32\x11\x8e\xfe\xca\x66\x77\x57\x87\x77\x66\x67\x84\xab\x9a\xa9\xb9\x6e\xfe\x64\x35\x66\x55\x66\x65\x56\x66\x34\x9f\xff\xff\xfa\x10\x11\x12\x22\x22\x33\x22\x22\x10\x00\x11\x23\x34\x44\x55\x44\x32\x11\x8e\xfe\xca\x76\x77\x66\x87\x76\x66\x57\x84\x9b\x9a\x9a\xaa\x5d\xff\x84\x35\x66\x56\x66\x55\x45\x66\x44\x7f\xff\xff\xfa\x00\x11\x22\x22\x22\x22\x32\x22\x10\x00\x12\x34\x67\x78\x88\x76\x53\x11\x8e\xfe\xca\x76\x67\x66\x88\x66\x66\x56\x85\x7b\xaa\xba\xaa\x4c\xff\xb4\x45\x66\x55\x55\x45\x45\x66\x44\x5d\xff\xff\xfa\x10\x11\x22\x22\x33\x33\x23\x32\x10\x00\x12\x23\x34\x44\x44\x44\x42\x11\x8e\xfe\xca\x77\x66\x66\x88\x66\x66\x66\x87\x6b\xba\xab\xbb\x4b\xff\xd4\x44\x65\x54\x44\x44\x45\x55\x43\x4c\xff\xff\xfa\x00\x11\x22\x22\x22\x22\x22\x22\x10\x00\x11\x22\x33\x34\x44\x44\x32\x11\x8d\xed\xb9\x87\x76\x66\x78\x76\x66\x66\x78\x4b\xba\x98\x65\x18\xff\xe6\x33\x55\x54\x44\x55\x55\x54\x42\x5d\xff\xff\xea\x00\x11\x11\x22\x22\x22\x22\x21\x10\x00\x11\x12\x22\x22\x33\x32\x21\x10\x6a\xba\x98\x87\x77\x66\x66\x77\x76\x66\x77\x23\x11\x11\x11\x05\xcd\xd8\x33\x55\x55\x55\x54\x44\x34\x7b\xdf\xee\xee\xd8\x00\x01\x11\x11\x11\x11\x11\x11\x00\x00\x00\x11\x11\x12\x22\x12\x11\x00\x59\x99\x87\x87\x77\x66\x66\x76\x76\x66\x77\x10\x11\x11\x11\x02\xaa\xa9\x33\x45\x55\x44\x44\x58\xbd\xee\xff\xdd\xcc\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11\x11\x11\x10\x00\x69\x99\x87\x97\x77\x76\x76\x76\x65\x55\x67\x20\x10\x00\x00\x05\x99\x98\x43\x24\x33\x46\x89\xbc\xcd\xde\xee\xdc\xcc\xba\x42\x22\x22\x22\x22\x22\x22\x22\x22\x42\x11\x22\x22\x22\x22\x22\x21\x24\x79\x99\x88\x97\x66\x77\x77\x86\x67\x77\x88\x50\x00\x23\x46\x88\x99\x99\x63\x25\x78\x9a\xab\xbc\xcd\xde\xee\xee\xed\xdc\xbb\xaa\xa9\x99\x99\x99\x88\x88\x88\x88\x77\x77\x77\x77\x77\x77\x77\x78\x99\x99\x98\x88\x88\x88\x88\x88\x88\x88\x99\x87\x78\x99\x99\xaa\xaa\xaa\xa9\xaa\xbb\xcc\xcd\xdd\xee\xef\xff\xff\xff\xff\xee\xee\xed\xdd\xdd\xdc\xcc\xcc\xcc\xbb\xbb\xbb\xbb\xbb\xbb\xba\xaa\xaa\xab\xba\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb\xcc\xcc\xcc\xcd\xdd\xdd\xde\xee\xee\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xee\xee\xee\xee\xee\xee\xee\xee\xee\xee\xee\xed\xdd\xdd\xdd\xee\xee\xee\xee\xee\xee\xee\xee\xee\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' # noqa @@ -34,8 +35,7 @@ def write_t4b(t4bfile, coverdata=None): pxs = t4bcover.getdata() t4bfile.write(b't4bp') data = (16 * reduce_color(pxs[i]) + reduce_color(pxs[i+1]) - for i in xrange(0, len(pxs), 2)) + for i in range(0, len(pxs), 2)) t4bfile.write(bytes(bytearray(data))) else: t4bfile.write(DEFAULT_T4B_DATA) - diff --git a/src/calibre/devices/kindle/apnx.py b/src/calibre/devices/kindle/apnx.py index d66d5feea8..d225c91b90 100644 --- a/src/calibre/devices/kindle/apnx.py +++ b/src/calibre/devices/kindle/apnx.py @@ -17,6 +17,7 @@ from calibre.ebooks.mobi.reader.headers import MetadataHeader from calibre.utils.logging import default_log from calibre import prints, fsync from calibre.constants import DEBUG +from polyglot.builtins import range class APNXBuilder(object): @@ -267,7 +268,7 @@ class APNXBuilder(object): p_char_count = 0 # Every 30 lines is a new page - for i in xrange(0, len(lines), 32): + for i in range(0, len(lines), 32): pages.append(lines[i]) return pages diff --git a/src/calibre/devices/mtp/test.py b/src/calibre/devices/mtp/test.py index a37d6318b0..2c2251c6eb 100644 --- a/src/calibre/devices/mtp/test.py +++ b/src/calibre/devices/mtp/test.py @@ -13,6 +13,7 @@ from calibre.constants import iswindows, islinux from calibre.utils.icu import lower from calibre.devices.mtp.driver import MTP_DEVICE from calibre.devices.scanner import DeviceScanner +from polyglot.builtins import range class ProgressCallback(object): @@ -172,9 +173,9 @@ class TestDeviceInteraction(unittest.TestCase): gc.disable() try: start_mem = memory() - for i in xrange(repetitions): + for i in range(repetitions): func(*args, **kwargs) - for i in xrange(3): + for i in range(3): gc.collect() end_mem = memory() finally: @@ -262,6 +263,6 @@ def tests(): def run(): unittest.TextTestRunner(verbosity=2).run(tests()) + if __name__ == '__main__': run() - diff --git a/src/calibre/ebooks/compression/palmdoc.py b/src/calibre/ebooks/compression/palmdoc.py index 07788c4229..ebd0642c6f 100644 --- a/src/calibre/ebooks/compression/palmdoc.py +++ b/src/calibre/ebooks/compression/palmdoc.py @@ -9,6 +9,7 @@ from cStringIO import StringIO from struct import pack from calibre.constants import plugins +from polyglot.builtins import range cPalmdoc = plugins['cPalmdoc'][0] if not cPalmdoc: raise RuntimeError(('Failed to load required cPalmdoc module: ' @@ -56,7 +57,7 @@ def py_compress_doc(data): if i > 10 and (ldata - i) > 10: chunk = '' match = -1 - for j in xrange(10, 2, -1): + for j in range(10, 2, -1): chunk = data[i:i+j] try: match = data.rindex(chunk, 0, i) @@ -97,4 +98,3 @@ def py_compress_doc(data): out.write(''.join(binseq)) i += len(binseq) - 1 return out.getvalue() - diff --git a/src/calibre/ebooks/compression/tcr.py b/src/calibre/ebooks/compression/tcr.py index 643f0bc311..35b47aaff1 100644 --- a/src/calibre/ebooks/compression/tcr.py +++ b/src/calibre/ebooks/compression/tcr.py @@ -5,6 +5,7 @@ __copyright__ = '2009, John Schember ' __docformat__ = 'restructuredtext en' import re +from polyglot.builtins import range class TCRCompressor(object): @@ -48,7 +49,7 @@ class TCRCompressor(object): Look for codes that do no not appear in the coded text and add them to the list of free codes. ''' - for i in xrange(256): + for i in range(256): if i not in self.unused_codes: if chr(i) not in self.coded_txt: self.unused_codes.add(i) @@ -104,7 +105,7 @@ class TCRCompressor(object): # Generate the code dictionary. code_dict = [] - for i in xrange(0, 256): + for i in range(0, 256): if i in self.unused_codes: code_dict.append(chr(0)) else: @@ -122,7 +123,7 @@ def decompress(stream): # Codes that the file contents are broken down into. entries = [] - for i in xrange(256): + for i in range(256): entry_len = ord(stream.read(1)) entries.append(stream.read(entry_len)) diff --git a/src/calibre/ebooks/djvu/djvubzzdec.py b/src/calibre/ebooks/djvu/djvubzzdec.py index 407794520c..33538a30ad 100644 --- a/src/calibre/ebooks/djvu/djvubzzdec.py +++ b/src/calibre/ebooks/djvu/djvubzzdec.py @@ -3,6 +3,8 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) +from polyglot.builtins import range + __license__ = 'GPL v3' __copyright__ = '2011, Anthon van der Neut ' @@ -505,7 +507,7 @@ class BZZDecoder(): markerpos = -1 zc = lambda i: self.zpcodec_decode(self.ctx, i) dc = lambda i, bits: self.decode_binary(self.ctx, i, bits) - for i in xrange(self.xsize): + for i in range(self.xsize): ctxid = CTXIDS - 1 if ctxid > mtfno: ctxid = mtfno @@ -737,5 +739,6 @@ def main(): d = plugins['bzzdec'][0] print (d.decompress(raw)) + if __name__ == "__main__": main() diff --git a/src/calibre/ebooks/docx/cleanup.py b/src/calibre/ebooks/docx/cleanup.py index 3111a6cd93..30fd9d25d9 100644 --- a/src/calibre/ebooks/docx/cleanup.py +++ b/src/calibre/ebooks/docx/cleanup.py @@ -7,6 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' import os +from polyglot.builtins import range NBSP = '\xa0' @@ -134,7 +135,7 @@ def cleanup_markup(log, root, styles, dest_dir, detect_cover, XPath): # Process dir attributes class_map = dict(styles.classes.itervalues()) - parents = ('p', 'div') + tuple('h%d' % i for i in xrange(1, 7)) + parents = ('p', 'div') + tuple('h%d' % i for i in range(1, 7)) for parent in root.xpath('//*[(%s)]' % ' or '.join('name()="%s"' % t for t in parents)): # Ensure that children of rtl parents that are not rtl have an # explicit dir set. Also, remove dir from children if it is the same as diff --git a/src/calibre/ebooks/docx/fonts.py b/src/calibre/ebooks/docx/fonts.py index c21c202045..0aed536cab 100644 --- a/src/calibre/ebooks/docx/fonts.py +++ b/src/calibre/ebooks/docx/fonts.py @@ -14,7 +14,7 @@ from calibre.utils.filenames import ascii_filename from calibre.utils.fonts.scanner import font_scanner, NoFonts from calibre.utils.fonts.utils import panose_to_css_generic_family, is_truetype_font from calibre.utils.icu import ord_string -from polyglot.builtins import codepoint_to_chr +from polyglot.builtins import codepoint_to_chr, range Embed = namedtuple('Embed', 'name key subsetted') @@ -84,7 +84,7 @@ class Family(object): for x in XPath('./w:panose1[@w:val]')(elem): try: v = get(x, 'w:val') - v = tuple(int(v[i:i+2], 16) for i in xrange(0, len(v), 2)) + v = tuple(int(v[i:i+2], 16) for i in range(0, len(v), 2)) except (TypeError, ValueError, IndexError): pass else: @@ -184,9 +184,9 @@ class Fonts(object): prefix = raw[:32] if ef.key: key = re.sub(r'[^A-Fa-f0-9]', '', ef.key) - key = bytearray(reversed(tuple(int(key[i:i+2], 16) for i in xrange(0, len(key), 2)))) + key = bytearray(reversed(tuple(int(key[i:i+2], 16) for i in range(0, len(key), 2)))) prefix = bytearray(prefix) - prefix = bytes(bytearray(prefix[i]^key[i % len(key)] for i in xrange(len(prefix)))) + prefix = bytes(bytearray(prefix[i]^key[i % len(key)] for i in range(len(prefix)))) if not is_truetype_font(prefix): return None ext = 'otf' if prefix.startswith(b'OTTO') else 'ttf' diff --git a/src/calibre/ebooks/docx/tables.py b/src/calibre/ebooks/docx/tables.py index 056869aa6a..b21d723ce4 100644 --- a/src/calibre/ebooks/docx/tables.py +++ b/src/calibre/ebooks/docx/tables.py @@ -10,6 +10,7 @@ from lxml.html.builder import TABLE, TR, TD from calibre.ebooks.docx.block_styles import inherit, read_shd as rs, read_border, binary_property, border_props, ParagraphStyle, border_to_css from calibre.ebooks.docx.char_styles import RunStyle +from polyglot.builtins import range # Read from XML {{{ read_shd = rs @@ -570,7 +571,7 @@ class Table(object): return # Handle vMerge max_col_num = max(len(r) for r in self.cell_map) - for c in xrange(max_col_num): + for c in range(max_col_num): cells = [row[c] if c < len(row) else None for row in self.cell_map] runs = [[]] for cell in cells: diff --git a/src/calibre/ebooks/docx/toc.py b/src/calibre/ebooks/docx/toc.py index 239efb9baa..53caff03e9 100644 --- a/src/calibre/ebooks/docx/toc.py +++ b/src/calibre/ebooks/docx/toc.py @@ -13,7 +13,7 @@ from lxml.etree import tostring from calibre.ebooks.metadata.toc import TOC from calibre.ebooks.oeb.polish.toc import elem_to_toc_text -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range def from_headings(body, log, namespace): @@ -22,7 +22,7 @@ def from_headings(body, log, namespace): headings = ('h1', 'h2', 'h3') tocroot = TOC() xpaths = [XPath('//%s' % x) for x in headings] - level_prev = {i+1:None for i in xrange(len(xpaths))} + level_prev = {i+1:None for i in range(len(xpaths))} level_prev[0] = tocroot level_item_map = {i+1:frozenset(xp(body)) for i, xp in enumerate(xpaths)} item_level_map = {e:i for i, elems in level_item_map.iteritems() for e in elems} @@ -49,7 +49,7 @@ def from_headings(body, log, namespace): text = elem_to_toc_text(item) toc = parent.add_item('index.html', elem_id, text) level_prev[lvl] = toc - for i in xrange(lvl+1, len(xpaths)+1): + for i in range(lvl+1, len(xpaths)+1): level_prev[i] = None if len(tuple(tocroot.flat())) > 1: @@ -79,7 +79,7 @@ def structure_toc(entries): parent = find_parent(level) last_found[level] = parent.add_item('index.html', item.anchor, item.text) - for i in xrange(level+1, len(last_found)): + for i in range(level+1, len(last_found)): last_found[i] = None return newtoc diff --git a/src/calibre/ebooks/lit/reader.py b/src/calibre/ebooks/lit/reader.py index e733581117..86ff680e62 100644 --- a/src/calibre/ebooks/lit/reader.py +++ b/src/calibre/ebooks/lit/reader.py @@ -22,7 +22,7 @@ from calibre.ebooks.oeb.base import urlnormalize, xpath from calibre.ebooks.oeb.reader import OEBReader from calibre.ebooks import DRMError from calibre import plugins -from polyglot.builtins import codepoint_to_chr, unicode_type, string_or_bytes +from polyglot.builtins import codepoint_to_chr, unicode_type, string_or_bytes, range lzx, lxzerror = plugins['lzx'] msdes, msdeserror = plugins['msdes'] @@ -105,7 +105,7 @@ def read_utf8_char(bytes, pos): if elsize + pos > len(bytes): raise LitError('Invalid UTF8 character: %s' % repr(bytes[pos])) c &= (mask - 1) - for i in xrange(1, elsize): + for i in range(1, elsize): b = ord(bytes[pos+i]) if (b & 0xC0) != 0x80: raise LitError( @@ -117,7 +117,7 @@ def read_utf8_char(bytes, pos): def consume_sized_utf8_string(bytes, zpad=False): result = [] slen, pos = read_utf8_char(bytes, 0) - for i in xrange(ord(slen)): + for i in range(ord(slen)): char, pos = read_utf8_char(bytes, pos) result.append(char) if zpad and bytes[pos] == '\000': @@ -166,7 +166,7 @@ class UnBinary(object): return target target = target.split('/') base = self.dir.split('/') - for index in xrange(min(len(base), len(target))): + for index in range(min(len(base), len(target))): if base[index] != target[index]: break else: @@ -567,7 +567,7 @@ class LitFile(object): def read_header_pieces(self): src = self.header[self.hdr_len:] - for i in xrange(self.num_pieces): + for i in range(self.num_pieces): piece = src[i * self.PIECE_SIZE:(i + 1) * self.PIECE_SIZE] if u32(piece[4:]) != 0 or u32(piece[12:]) != 0: raise LitError('Piece %s has 64bit value' % repr(piece)) @@ -597,7 +597,7 @@ class LitFile(object): if (32 + (num_chunks * chunk_size)) != len(piece): raise LitError('IFCM header has incorrect length') self.entries = {} - for i in xrange(num_chunks): + for i in range(num_chunks): offset = 32 + (i * chunk_size) chunk = piece[offset:offset + chunk_size] tag, chunk = chunk[:4], chunk[4:] @@ -612,7 +612,7 @@ class LitFile(object): # Hopefully will work even without a correct entries count entries = (2 ** 16) - 1 chunk = chunk[40:] - for j in xrange(entries): + for j in range(entries): if remaining <= 0: break namelen, chunk, remaining = encint(chunk, remaining) @@ -642,7 +642,7 @@ class LitFile(object): num_sections = u16(raw[2:pos]) self.section_names = [""] * num_sections self.section_data = [None] * num_sections - for section in xrange(num_sections): + for section in range(num_sections): size = u16(raw[pos:pos+2]) pos += 2 size = size*2 + 2 @@ -669,7 +669,7 @@ class LitFile(object): num_files, raw = int32(raw), raw[4:] if num_files == 0: continue - for i in xrange(num_files): + for i in range(num_files): if len(raw) < 5: raise LitError('Truncated manifest') offset, raw = u32(raw), raw[4:] @@ -740,7 +740,7 @@ class LitFile(object): hash.update(data) digest = hash.digest() key = [0] * 8 - for i in xrange(0, len(digest)): + for i in range(0, len(digest)): key[i % 8] ^= ord(digest[i]) return ''.join(chr(x) for x in key) @@ -856,7 +856,7 @@ class LitFile(object): data = self.get_file(name) nentries, data = u32(data), data[4:] tags = {} - for i in xrange(1, nentries + 1): + for i in range(1, nentries + 1): if len(data) <= 1: break size, data = ord(data[0]), data[1:] @@ -869,7 +869,7 @@ class LitFile(object): return (tags, {}) attrs = {} nentries, data = u32(data), data[4:] - for i in xrange(1, nentries + 1): + for i in range(1, nentries + 1): if len(data) <= 4: break size, data = u32(data), data[4:] diff --git a/src/calibre/ebooks/metadata/mobi.py b/src/calibre/ebooks/metadata/mobi.py index 3c64bf07c4..b4ddb8da48 100644 --- a/src/calibre/ebooks/metadata/mobi.py +++ b/src/calibre/ebooks/metadata/mobi.py @@ -21,7 +21,7 @@ from calibre.ebooks.mobi.langcodes import iana2mobi from calibre.utils.date import now as nowf from calibre.utils.imghdr import what from calibre.utils.localization import canonicalize_lang, lang_as_iso639_1 -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range def is_image(ss): @@ -163,7 +163,7 @@ class MetadataUpdater(object): nitems, = unpack('>I', exth[8:12]) pos = 12 # Store any EXTH fields not specifiable in GUI - for i in xrange(nitems): + for i in range(nitems): id, size = unpack('>II', exth[pos:pos + 8]) content = exth[pos + 8: pos + size] pos += size @@ -295,7 +295,7 @@ class MetadataUpdater(object): def get_pdbrecords(self): pdbrecords = [] - for i in xrange(self.nrecs): + for i in range(self.nrecs): offset, a1,a2,a3,a4 = unpack('>LBBBB', self.data[78+i*8:78+i*8+8]) flags, val = a1, a2<<16|a3<<8|a4 pdbrecords.append([offset, flags, val]) @@ -312,7 +312,7 @@ class MetadataUpdater(object): # Diagnostic print("MetadataUpdater.dump_pdbrecords()") print("%10s %10s %10s" % ("offset","flags","val")) - for i in xrange(len(self.pdbrecords)): + for i in range(len(self.pdbrecords)): pdbrecord = self.pdbrecords[i] print("%10X %10X %10X" % (pdbrecord[0], pdbrecord[1], pdbrecord[2])) diff --git a/src/calibre/ebooks/metadata/opf2.py b/src/calibre/ebooks/metadata/opf2.py index 35c41533f3..b1b6688819 100644 --- a/src/calibre/ebooks/metadata/opf2.py +++ b/src/calibre/ebooks/metadata/opf2.py @@ -25,7 +25,7 @@ from calibre.utils.localization import get_lang, canonicalize_lang from calibre import prints, guess_type from calibre.utils.cleantext import clean_ascii_chars, clean_xml_chars from calibre.utils.config import tweaks -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range pretty_print_opf = False @@ -715,7 +715,7 @@ class OPF(object): # {{{ def create_manifest_item(self, href, media_type, append=False): ids = [i.get('id', None) for i in self.itermanifest()] id = None - for c in xrange(1, sys.maxint): + for c in range(1, sys.maxint): id = 'id%d'%c if id not in ids: break diff --git a/src/calibre/ebooks/pdf/reflow.py b/src/calibre/ebooks/pdf/reflow.py index ceb4e67dea..e3f47e4eef 100644 --- a/src/calibre/ebooks/pdf/reflow.py +++ b/src/calibre/ebooks/pdf/reflow.py @@ -10,7 +10,7 @@ import sys, os from lxml import etree -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class Font(object): @@ -623,7 +623,7 @@ class PDFDocument(object): self.opts, self.log = opts, log parser = etree.XMLParser(recover=True) self.root = etree.fromstring(xml, parser=parser) - idc = iter(xrange(sys.maxint)) + idc = iter(range(sys.maxint)) self.fonts = [] self.font_map = {} diff --git a/src/calibre/ebooks/rb/reader.py b/src/calibre/ebooks/rb/reader.py index 7463b88b00..61d6db81f9 100644 --- a/src/calibre/ebooks/rb/reader.py +++ b/src/calibre/ebooks/rb/reader.py @@ -14,6 +14,7 @@ from calibre.ebooks.rb import HEADER from calibre.ebooks.rb import RocketBookError from calibre.ebooks.metadata.rb import get_metadata from calibre.ebooks.metadata.opf2 import OPFCreator +from polyglot.builtins import range class RBToc(list): @@ -80,7 +81,7 @@ class Reader(object): count = self.read_i32() self.read_i32() # Uncompressed size. chunck_sizes = [] - for i in xrange(count): + for i in range(count): chunck_sizes.append(self.read_i32()) for size in chunck_sizes: diff --git a/src/calibre/ebooks/rtf2xml/tokenize.py b/src/calibre/ebooks/rtf2xml/tokenize.py index 6b71f88b77..1cb0608009 100755 --- a/src/calibre/ebooks/rtf2xml/tokenize.py +++ b/src/calibre/ebooks/rtf2xml/tokenize.py @@ -15,7 +15,7 @@ import os, re from calibre.ebooks.rtf2xml import copy from calibre.utils.mreplace import MReplace from calibre.ptempfile import better_mktemp -from polyglot.builtins import codepoint_to_chr +from polyglot.builtins import codepoint_to_chr, range class Tokenize: @@ -44,7 +44,7 @@ class Tokenize: self.__uc_bin = False def __remove_uc_chars(self, startchar, token): - for i in xrange(startchar, len(token)): + for i in range(startchar, len(token)): if self.__uc_char: self.__uc_char -= 1 else: diff --git a/src/calibre/srv/tests/http.py b/src/calibre/srv/tests/http.py index 4d1360af17..808c843d02 100644 --- a/src/calibre/srv/tests/http.py +++ b/src/calibre/srv/tests/http.py @@ -14,6 +14,7 @@ from calibre import guess_type from calibre.srv.tests.base import BaseTest, TestServer from calibre.srv.utils import eintr_retry_call from calibre.utils.monotonic import monotonic +from polyglot.builtins import range is_ci = os.environ.get('CI', '').lower() == 'true' @@ -271,11 +272,11 @@ class TestHTTP(BaseTest): conn = server.connect() # Test pipelining responses = [] - for i in xrange(10): + for i in range(10): conn._HTTPConnection__state = httplib._CS_IDLE conn.request('GET', '/%d'%i) responses.append(conn.response_class(conn.sock, strict=conn.strict, method=conn._method)) - for i in xrange(10): + for i in range(10): r = responses[i] r.begin() self.ae(r.read(), ('%d' % i).encode('ascii')) @@ -426,7 +427,7 @@ class TestHTTP(BaseTest): def test_static_generation(self): # {{{ 'Test static generation' - nums = list(map(str, xrange(10))) + nums = list(map(str, range(10))) def handler(conn): return conn.generate_static_output('test', nums.pop) @@ -435,7 +436,7 @@ class TestHTTP(BaseTest): conn.request('GET', '/an_etagged_path') r = conn.getresponse() data = r.read() - for i in xrange(5): + for i in range(5): conn.request('GET', '/an_etagged_path') r = conn.getresponse() self.assertEqual(data, r.read()) diff --git a/src/calibre/srv/tests/loop.py b/src/calibre/srv/tests/loop.py index bed3820e29..af628456c7 100644 --- a/src/calibre/srv/tests/loop.py +++ b/src/calibre/srv/tests/loop.py @@ -17,6 +17,7 @@ from calibre.srv.tests.base import BaseTest, TestServer from calibre.ptempfile import TemporaryDirectory from calibre.utils.certgen import create_server_cert from calibre.utils.monotonic import monotonic +from polyglot.builtins import range is_ci = os.environ.get('CI', '').lower() == 'true' @@ -167,7 +168,7 @@ class LoopTest(BaseTest): self.ae(buf.read(1000), bytes(buf.ba)) self.ae(b'', buf.read(10)) self.ae(write(b'a'*10), 10) - numbers = bytes(bytearray(xrange(10))) + numbers = bytes(bytearray(range(10))) set(numbers, 1, 3, READ) self.ae(buf.read(1), b'\x01') self.ae(buf.read(10), b'\x02') diff --git a/src/calibre/srv/tests/web_sockets.py b/src/calibre/srv/tests/web_sockets.py index af7a01e635..bc16e86a55 100644 --- a/src/calibre/srv/tests/web_sockets.py +++ b/src/calibre/srv/tests/web_sockets.py @@ -16,6 +16,7 @@ from calibre.srv.web_socket import ( PING, PONG, PROTOCOL_ERROR, CONTINUATION, INCONSISTENT_DATA, CONTROL_CODES) from calibre.utils.monotonic import monotonic from calibre.utils.socket_inheritance import set_socket_inherit +from polyglot.builtins import range HANDSHAKE_STR = '''\ GET / HTTP/1.1\r @@ -230,7 +231,7 @@ class WebSocketTest(BaseTest): # connection before the client has finished sending all # messages, so ignore failures to send packets. isf_test = partial(simple_test, ignore_send_failures=True) - for rsv in xrange(1, 7): + for rsv in range(1, 7): isf_test([{'rsv':rsv, 'opcode':BINARY}], [], close_code=PROTOCOL_ERROR, send_close=False) for opcode in (3, 4, 5, 6, 7, 11, 12, 13, 14, 15): isf_test([{'opcode':opcode}], [], close_code=PROTOCOL_ERROR, send_close=False) From ea33a5d6ad6faa154fc7f85a999a547995977270 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Mar 2019 15:51:21 +0530 Subject: [PATCH 0308/2613] Get rid of more xrange --- src/calibre/ebooks/lit/mssha1.py | 5 +++-- src/calibre/ebooks/lit/writer.py | 12 ++++++------ src/calibre/ebooks/metadata/plucker.py | 3 ++- src/calibre/ebooks/mobi/utils.py | 10 +++++----- src/calibre/ebooks/oeb/base.py | 12 ++++++------ src/calibre/gui2/catalog/catalog_bibtex.py | 6 +++--- src/calibre/gui2/catalog/catalog_csv_xml.py | 4 ++-- src/calibre/gui2/dialogs/search.py | 4 ++-- src/calibre/gui2/toc/location.py | 4 ++-- src/calibre/gui2/toc/main.py | 18 +++++++++--------- src/calibre/utils/podofo/__init__.py | 6 +++--- 11 files changed, 43 insertions(+), 41 deletions(-) diff --git a/src/calibre/ebooks/lit/mssha1.py b/src/calibre/ebooks/lit/mssha1.py index 9982bd592c..48d145ca4e 100644 --- a/src/calibre/ebooks/lit/mssha1.py +++ b/src/calibre/ebooks/lit/mssha1.py @@ -9,6 +9,7 @@ __license__ = 'GPL v3' __copyright__ = '2008, Marshall T. Vandegrift ' import struct, copy +from polyglot.builtins import range # ====================================================================== # Bit-Manipulation helpers @@ -170,7 +171,7 @@ class mssha1(object): D = self.H3 E = self.H4 - for t in xrange(0, 80): + for t in range(0, 80): TEMP = _rotateLeft(A, 5) + f[t](B, C, D) + E + W[t] + K[t/20] E = D D = C @@ -341,7 +342,7 @@ if __name__ == '__main__': data = file.read(16384) file.close() digest = context.hexdigest().upper() - for i in xrange(0, 40, 8): + for i in range(0, 40, 8): print(digest[i:i+8], end=' ') print() main() diff --git a/src/calibre/ebooks/lit/writer.py b/src/calibre/ebooks/lit/writer.py index ce1c3acdcc..c1610b6e50 100644 --- a/src/calibre/ebooks/lit/writer.py +++ b/src/calibre/ebooks/lit/writer.py @@ -31,7 +31,7 @@ import calibre from calibre import plugins msdes, msdeserror = plugins['msdes'] import calibre.ebooks.lit.mssha1 as mssha1 -from polyglot.builtins import codepoint_to_chr, unicode_type, string_or_bytes +from polyglot.builtins import codepoint_to_chr, unicode_type, string_or_bytes, range __all__ = ['LitWriter'] @@ -49,7 +49,7 @@ ALL_MS_COVER_TYPES = [ def invert_tag_map(tag_map): tags, dattrs, tattrs = tag_map - tags = dict((tags[i], i) for i in xrange(len(tags))) + tags = dict((tags[i], i) for i in range(len(tags))) dattrs = dict((v, k) for k, v in dattrs.items()) tattrs = [dict((v, k) for k, v in (map or {}).items()) for map in tattrs] for map in tattrs: @@ -135,7 +135,7 @@ def decint(value): def randbytes(n): - return ''.join(chr(random.randint(0, 255)) for x in xrange(n)) + return ''.join(chr(random.randint(0, 255)) for x in range(n)) def warn(x): @@ -332,7 +332,7 @@ class LitWriter(object): self._oeb = oeb self._logger = oeb.logger self._stream = stream - self._sections = [StringIO() for i in xrange(4)] + self._sections = [StringIO() for i in range(4)] self._directory = [] self._meta = None self._litize_oeb() @@ -363,7 +363,7 @@ class LitWriter(object): 1, PRIMARY_SIZE, 5, SECONDARY_SIZE)) self._write(packguid(LITFILE_GUID)) offset = self._tell() - pieces = list(xrange(offset, offset + (PIECE_SIZE * 5), PIECE_SIZE)) + pieces = list(range(offset, offset + (PIECE_SIZE * 5), PIECE_SIZE)) self._write((5 * PIECE_SIZE) * '\0') aoli1 = len(dchunks) if ichunk else ULL_NEG1 last = len(dchunks) - 1 @@ -662,7 +662,7 @@ class LitWriter(object): hash.update(data) digest = hash.digest() key = [0] * 8 - for i in xrange(0, len(digest)): + for i in range(0, len(digest)): key[i % 8] ^= ord(digest[i]) return ''.join(chr(x) for x in key) diff --git a/src/calibre/ebooks/metadata/plucker.py b/src/calibre/ebooks/metadata/plucker.py index ecf3b207af..7861918b7d 100644 --- a/src/calibre/ebooks/metadata/plucker.py +++ b/src/calibre/ebooks/metadata/plucker.py @@ -17,6 +17,7 @@ from calibre.ebooks.metadata import MetaInformation from calibre.ebooks.pdb.header import PdbHeaderReader from calibre.ebooks.pdb.plucker.reader import SectionHeader, DATATYPE_METADATA, \ MIBNUM_TO_NAME +from polyglot.builtins import range def get_metadata(stream, extract_cover=True): @@ -44,7 +45,7 @@ def get_metadata(stream, extract_cover=True): title = None author = None pubdate = 0 - for i in xrange(record_count): + for i in range(record_count): try: type, length = struct.unpack_from('>HH', section_data, 2 + adv) except struct.error: diff --git a/src/calibre/ebooks/mobi/utils.py b/src/calibre/ebooks/mobi/utils.py index 69ef8f0b9f..bd545e5ce0 100644 --- a/src/calibre/ebooks/mobi/utils.py +++ b/src/calibre/ebooks/mobi/utils.py @@ -14,7 +14,7 @@ from io import BytesIO from calibre.utils.img import save_cover_data_to, scale_image, image_to_data, image_from_data, resize_image from calibre.utils.imghdr import what from calibre.ebooks import normalize -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range from tinycss.color3 import parse_color_string IMAGE_MAX_SIZE = 10 * 1024 * 1024 @@ -242,7 +242,7 @@ def encode_fvwi(val, flags, flag_size=4): bytestring. ''' ans = val << flag_size - for i in xrange(flag_size): + for i in range(flag_size): ans |= (flags & (1 << i)) return encint(ans) @@ -254,7 +254,7 @@ def decode_fvwi(byts, flag_size=4): arg, consumed = decint(bytes(byts)) val = arg >> flag_size flags = 0 - for i in xrange(flag_size): + for i in range(flag_size): flags |= (arg & (1 << i)) return val, flags, consumed @@ -462,7 +462,7 @@ def read_font_record(data, extent=1040): extent = len(font_data) if extent is None else extent extent = min(extent, len(font_data)) - for n in xrange(extent): + for n in range(extent): buf[n] ^= key[n%xor_len] # XOR of buf and key font_data = bytes(buf) @@ -506,7 +506,7 @@ def write_font_record(data, obfuscate=True, compress=True): xor_key = os.urandom(key_len) key = bytearray(xor_key) data = bytearray(data) - for i in xrange(1040): + for i in range(1040): data[i] ^= key[i%key_len] data = bytes(data) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index d312faf993..db678847de 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -22,7 +22,7 @@ from calibre.ebooks.oeb.parse_utils import (barename, XHTML_NS, RECOVER_PARSER, namespace, XHTML, parse_html, NotHTML) from calibre.utils.cleantext import clean_xml_chars from calibre.utils.short_uuid import uuid4 -from polyglot.builtins import unicode_type, string_or_bytes +from polyglot.builtins import unicode_type, string_or_bytes, range XML_NS = 'http://www.w3.org/XML/1998/namespace' OEB_DOC_NS = 'http://openebook.org/namespaces/oeb-document/1.0/' @@ -431,8 +431,8 @@ def serialize(data, media_type, pretty_print=False): return bytes(data) -ASCII_CHARS = set(chr(x) for x in xrange(128)) -UNIBYTE_CHARS = set(chr(x) for x in xrange(256)) +ASCII_CHARS = set(chr(x) for x in range(128)) +UNIBYTE_CHARS = set(chr(x) for x in range(256)) URL_SAFE = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' '0123456789' '_.-/~') @@ -1338,7 +1338,7 @@ class Spine(object): item.linear = self._linear(linear) item.spine_position = index self.items.insert(index, item) - for i in xrange(index, len(self.items)): + for i in range(index, len(self.items)): self.items[i].spine_position = i return item @@ -1346,7 +1346,7 @@ class Spine(object): """Remove :param:`item` from the `Spine`.""" index = item.spine_position self.items.pop(index) - for i in xrange(index, len(self.items)): + for i in range(index, len(self.items)): self.items[i].spine_position = i item.spine_position = None @@ -2044,7 +2044,7 @@ def rel_href(base_href, href): target, frag = urldefrag(href) target = target.split('/') index = 0 - for index in xrange(min(len(base), len(target))): + for index in range(min(len(base), len(target))): if base[index] != target[index]: break else: diff --git a/src/calibre/gui2/catalog/catalog_bibtex.py b/src/calibre/gui2/catalog/catalog_bibtex.py index e98f9a3a09..0e38160819 100644 --- a/src/calibre/gui2/catalog/catalog_bibtex.py +++ b/src/calibre/gui2/catalog/catalog_bibtex.py @@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en' from calibre.gui2 import gprefs from calibre.gui2.catalog.catalog_bibtex_ui import Ui_Form -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range from PyQt5.Qt import QWidget, QListWidgetItem @@ -48,7 +48,7 @@ class PluginWidget(QWidget, Ui_Form): self.name = name fields = gprefs.get(name+'_db_fields', self.all_fields) # Restore the activated db_fields from last use - for x in xrange(self.db_fields.count()): + for x in range(self.db_fields.count()): item = self.db_fields.item(x) item.setSelected(unicode_type(item.text()) in fields) self.bibfile_enc.clear() @@ -72,7 +72,7 @@ class PluginWidget(QWidget, Ui_Form): # Save the currently activated fields fields = [] - for x in xrange(self.db_fields.count()): + for x in range(self.db_fields.count()): item = self.db_fields.item(x) if item.isSelected(): fields.append(unicode_type(item.text())) diff --git a/src/calibre/gui2/catalog/catalog_csv_xml.py b/src/calibre/gui2/catalog/catalog_csv_xml.py index 6280b606b7..03f6c16cc4 100644 --- a/src/calibre/gui2/catalog/catalog_csv_xml.py +++ b/src/calibre/gui2/catalog/catalog_csv_xml.py @@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en' from calibre.gui2 import gprefs from calibre.gui2.ui import get_gui -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range from PyQt5.Qt import QWidget, QListWidgetItem, Qt, QVBoxLayout, QLabel, QListWidget @@ -90,7 +90,7 @@ class PluginWidget(QWidget): def options(self): # Save the currently activated fields fields, all_fields = [], [] - for x in xrange(self.db_fields.count()): + for x in range(self.db_fields.count()): item = self.db_fields.item(x) all_fields.append(unicode_type(item.data(Qt.UserRole))) if item.checkState() == Qt.Checked: diff --git a/src/calibre/gui2/dialogs/search.py b/src/calibre/gui2/dialogs/search.py index 92f76f110e..1bc27dfb21 100644 --- a/src/calibre/gui2/dialogs/search.py +++ b/src/calibre/gui2/dialogs/search.py @@ -19,7 +19,7 @@ from calibre.utils.icu import sort_key from calibre.utils.config import tweaks from calibre.utils.date import now from calibre.utils.localization import localize_user_manual_link -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range box_values = {} last_matchkind = CONTAINS_MATCH @@ -191,7 +191,7 @@ def create_date_tab(self, db): dy.setRange(102, 10000) dy.setValue(now().year) self.date_month = dm = add(_('mo&nth'), QComboBox(w)) - for val, text in [(0, '')] + [(i, strftime('%B', date(2010, i, 1).timetuple())) for i in xrange(1, 13)]: + for val, text in [(0, '')] + [(i, strftime('%B', date(2010, i, 1).timetuple())) for i in range(1, 13)]: dm.addItem(text, val) self.date_day = dd = add(_('&day'), QSpinBox(w)) dd.setRange(0, 31) diff --git a/src/calibre/gui2/toc/location.py b/src/calibre/gui2/toc/location.py index af90566fb6..8dd91685a6 100644 --- a/src/calibre/gui2/toc/location.py +++ b/src/calibre/gui2/toc/location.py @@ -19,7 +19,7 @@ from PyQt5.QtWebKit import QWebElement from calibre.ebooks.oeb.display.webview import load_html from calibre.gui2 import error_dialog, question_dialog, gprefs, secure_web_page from calibre.utils.logging import default_log -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class Page(QWebPage): # {{{ @@ -259,7 +259,7 @@ class ItemEdit(QWidget): self.name.setCursorPosition(0) toc = item.data(0, Qt.UserRole) if toc.dest: - for i in xrange(self.dest_list.count()): + for i in range(self.dest_list.count()): litem = self.dest_list.item(i) if unicode_type(litem.data(Qt.DisplayRole) or '') == toc.dest: dest_index = i diff --git a/src/calibre/gui2/toc/main.py b/src/calibre/gui2/toc/main.py index 986543c682..ba23176964 100644 --- a/src/calibre/gui2/toc/main.py +++ b/src/calibre/gui2/toc/main.py @@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en' import sys, os, textwrap from threading import Thread from functools import partial -from polyglot.builtins import map, unicode_type +from polyglot.builtins import map, unicode_type, range from PyQt5.Qt import (QPushButton, QFrame, QMenu, QInputDialog, QCheckBox, QDialog, QVBoxLayout, QDialogButtonBox, QSize, QStackedWidget, QWidget, @@ -44,7 +44,7 @@ class XPathDialog(QDialog): # {{{ la.setWordWrap(True) l.addWidget(la) self.widgets = [] - for i in xrange(5): + for i in range(5): la = _('Level %s ToC:')%('&%d'%(i+1)) xp = XPathEdit(self) xp.set_msg(la) @@ -307,10 +307,10 @@ class ItemView(QFrame): # {{{ l.addWidget(la, l.rowCount(), 0, 1, 2) def create_from_major_headings(self): - self.create_from_xpath.emit(['//h:h%d'%i for i in xrange(1, 4)], True) + self.create_from_xpath.emit(['//h:h%d'%i for i in range(1, 4)], True) def create_from_all_headings(self): - self.create_from_xpath.emit(['//h:h%d'%i for i in xrange(1, 7)], True) + self.create_from_xpath.emit(['//h:h%d'%i for i in range(1, 7)], True) def create_from_user_xpath(self): d = XPathDialog(self, self.prefs) @@ -404,7 +404,7 @@ class TreeWidget(QTreeWidget): # {{{ def iteritems(self, parent=None): if parent is None: parent = self.invisibleRootItem() - for i in xrange(parent.childCount()): + for i in range(parent.childCount()): child = parent.child(i) yield child for gc in self.iteritems(parent=child): @@ -496,7 +496,7 @@ class TreeWidget(QTreeWidget): # {{{ is_expanded = item.isExpanded() or item.childCount() == 0 gp = parent.parent() or self.invisibleRootItem() idx = gp.indexOfChild(parent) - for gc in [parent.child(i) for i in xrange(parent.indexOfChild(item)+1, parent.childCount())]: + for gc in [parent.child(i) for i in range(parent.indexOfChild(item)+1, parent.childCount())]: parent.removeChild(gc) item.addChild(gc) parent.removeChild(item) @@ -798,7 +798,7 @@ class TOCView(QWidget): # {{{ if item is not None: p = item.parent() or self.root idx = p.indexOfChild(item) - children = [item.child(i) for i in xrange(item.childCount())] + children = [item.child(i) for i in range(item.childCount())] for child in reversed(children): item.removeChild(child) p.insertChild(idx+1, child) @@ -816,7 +816,7 @@ class TOCView(QWidget): # {{{ self.tocw.move_down() def data_changed(self, top_left, bottom_right): - for r in xrange(top_left.row(), bottom_right.row()+1): + for r in range(top_left.row(), bottom_right.row()+1): idx = self.tocw.model().index(r, 0, top_left.parent()) new_title = unicode_type(idx.data(Qt.DisplayRole) or '').strip() toc = idx.data(Qt.UserRole) @@ -908,7 +908,7 @@ class TOCView(QWidget): # {{{ root = TOC() def process_node(parent, toc_parent): - for i in xrange(parent.childCount()): + for i in range(parent.childCount()): item = parent.child(i) title = unicode_type(item.data(0, Qt.DisplayRole) or '').strip() toc = item.data(0, Qt.UserRole) diff --git a/src/calibre/utils/podofo/__init__.py b/src/calibre/utils/podofo/__init__.py index b362cdef2e..0f81fc1d17 100644 --- a/src/calibre/utils/podofo/__init__.py +++ b/src/calibre/utils/podofo/__init__.py @@ -12,7 +12,7 @@ from calibre.constants import plugins, preferred_encoding from calibre.ebooks.metadata import authors_to_string from calibre.ptempfile import TemporaryDirectory from calibre.utils.ipc.simple_worker import fork_job, WorkerError -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range def get_podofo(): @@ -110,7 +110,7 @@ def delete_all_but(path, pages): p.load(raw) total = p.page_count() pages = {total + x if x < 0 else x for x in pages} - for page in xrange(total-1, -1, -1): + for page in range(total-1, -1, -1): if page not in pages: p.delete_page(page) @@ -144,7 +144,7 @@ def test_outline(src): p.load(raw) total = p.page_count() root = p.create_outline(u'Table of Contents') - for i in xrange(0, total): + for i in range(0, total): root.create(u'Page %d'%i, i, True) raw = p.write() out = '/tmp/outlined.pdf' From 2d4127f7b9a83fa780aeab3515fe7cb5ca4862fc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Mar 2019 18:19:24 +0530 Subject: [PATCH 0309/2613] Get rid of more xrange --- src/calibre/gui2/actions/catalog.py | 3 +- src/calibre/gui2/convert/heuristics.py | 4 +-- src/calibre/gui2/convert/regex_builder.py | 6 ++-- .../gui2/convert/search_and_replace.py | 8 ++--- src/calibre/gui2/convert/single.py | 4 +-- src/calibre/gui2/dbus_export/demo.py | 7 +++-- src/calibre/gui2/dbus_export/widgets.py | 3 +- src/calibre/gui2/device_drivers/mtp_config.py | 8 ++--- .../gui2/device_drivers/mtp_folder_browser.py | 8 ++--- src/calibre/gui2/dialogs/authors_edit.py | 8 ++--- src/calibre/gui2/dialogs/custom_recipes.py | 4 +-- src/calibre/gui2/dialogs/duplicates.py | 12 ++++---- src/calibre/gui2/dialogs/exim.py | 3 +- src/calibre/gui2/dialogs/scheduler.py | 6 ++-- src/calibre/gui2/dialogs/tag_editor.py | 4 +-- src/calibre/gui2/metadata/basic_widgets.py | 4 +-- src/calibre/gui2/metadata/diff.py | 4 +-- src/calibre/gui2/metadata/single_download.py | 6 ++-- .../store/stores/mobileread/store_dialog.py | 2 +- src/calibre/gui2/tweak_book/char_select.py | 4 +-- src/calibre/gui2/tweak_book/check.py | 6 ++-- src/calibre/gui2/tweak_book/download.py | 3 +- src/calibre/gui2/tweak_book/file_list.py | 30 +++++++++---------- src/calibre/gui2/tweak_book/preferences.py | 12 ++++---- src/calibre/gui2/tweak_book/reports.py | 20 ++++++------- src/calibre/gui2/tweak_book/search.py | 6 ++-- src/calibre/gui2/tweak_book/spell.py | 14 ++++----- src/calibre/gui2/tweak_book/toc.py | 4 +-- src/calibre/gui2/tweak_book/ui.py | 12 ++++---- src/calibre/gui2/viewer/bookmarkmanager.py | 4 +-- src/calibre/gui2/viewer/ui.py | 4 +-- src/calibre/utils/fonts/metadata.py | 5 +++- src/calibre/utils/fonts/utils.py | 8 ++--- 33 files changed, 122 insertions(+), 114 deletions(-) diff --git a/src/calibre/gui2/actions/catalog.py b/src/calibre/gui2/actions/catalog.py index d0e78ab9c6..0bf4f620b5 100644 --- a/src/calibre/gui2/actions/catalog.py +++ b/src/calibre/gui2/actions/catalog.py @@ -14,6 +14,7 @@ from calibre.gui2.tools import generate_catalog from calibre.utils.config import dynamic from calibre.gui2.actions import InterfaceAction from calibre import sanitize_file_name_unicode +from polyglot.builtins import range class GenerateCatalogAction(InterfaceAction): @@ -34,7 +35,7 @@ class GenerateCatalogAction(InterfaceAction): def generate_catalog(self): rows = self.gui.library_view.selectionModel().selectedRows() if not rows or len(rows) < 2: - rows = xrange(self.gui.library_view.model().rowCount(QModelIndex())) + rows = range(self.gui.library_view.model().rowCount(QModelIndex())) ids = map(self.gui.library_view.model().id, rows) if not ids: diff --git a/src/calibre/gui2/convert/heuristics.py b/src/calibre/gui2/convert/heuristics.py index 0ff2da151d..41d3365fb7 100644 --- a/src/calibre/gui2/convert/heuristics.py +++ b/src/calibre/gui2/convert/heuristics.py @@ -11,7 +11,7 @@ from calibre.gui2.convert.heuristics_ui import Ui_Form from calibre.gui2.convert import Widget from calibre.utils.localization import localize_user_manual_link from calibre.ebooks.conversion.config import OPTIONS -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class HeuristicsWidget(Widget, Ui_Form): @@ -92,7 +92,7 @@ class HeuristicsWidget(Widget, Ui_Form): def save_histories(self): rssb_history = [] history_pats = [unicode_type(self.opt_replace_scene_breaks.lineEdit().text())] + [unicode_type(self.opt_replace_scene_breaks.itemText(i)) - for i in xrange(self.opt_replace_scene_breaks.count())] + for i in range(self.opt_replace_scene_breaks.count())] for p in history_pats[:10]: # Ensure we don't have duplicate items. if p not in rssb_history: diff --git a/src/calibre/gui2/convert/regex_builder.py b/src/calibre/gui2/convert/regex_builder.py index ca60871df1..79d6cd490c 100644 --- a/src/calibre/gui2/convert/regex_builder.py +++ b/src/calibre/gui2/convert/regex_builder.py @@ -17,7 +17,7 @@ from calibre.constants import iswindows from calibre.utils.ipc.simple_worker import fork_job, WorkerError from calibre.ebooks.conversion.search_replace import compile_regular_expression from calibre.ptempfile import TemporaryFile -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class RegexBuilder(QDialog, Ui_RegexBuilder): @@ -107,7 +107,7 @@ class RegexBuilder(QDialog, Ui_RegexBuilder): pos = self.preview.textCursor().position() if self.match_locs: match_loc = len(self.match_locs) - 1 - for i in xrange(len(self.match_locs) - 1, -1, -1): + for i in range(len(self.match_locs) - 1, -1, -1): loc = self.match_locs[i][1] if pos > loc: match_loc = i @@ -118,7 +118,7 @@ class RegexBuilder(QDialog, Ui_RegexBuilder): pos = self.preview.textCursor().position() if self.match_locs: match_loc = 0 - for i in xrange(len(self.match_locs)): + for i in range(len(self.match_locs)): loc = self.match_locs[i][0] if pos < loc: match_loc = i diff --git a/src/calibre/gui2/convert/search_and_replace.py b/src/calibre/gui2/convert/search_and_replace.py index 71e9379317..bbd1b5b481 100644 --- a/src/calibre/gui2/convert/search_and_replace.py +++ b/src/calibre/gui2/convert/search_and_replace.py @@ -16,7 +16,7 @@ from calibre import as_unicode from calibre.utils.localization import localize_user_manual_link from calibre.ebooks.conversion.search_replace import compile_regular_expression from calibre.ebooks.conversion.config import OPTIONS -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class SearchAndReplaceWidget(Widget, Ui_Form): @@ -140,7 +140,7 @@ class SearchAndReplaceWidget(Widget, Ui_Form): def cell_rearrange(self, i): row = self.search_replace.currentRow() - for col in xrange(0, self.search_replace.columnCount()): + for col in range(0, self.search_replace.columnCount()): item1 = self.search_replace.item(row, col) item2 = self.search_replace.item(row+i, col) value = item1.text() @@ -228,9 +228,9 @@ class SearchAndReplaceWidget(Widget, Ui_Form): def get_definitions(self): ans = [] - for row in xrange(0, self.search_replace.rowCount()): + for row in range(0, self.search_replace.rowCount()): colItems = [] - for col in xrange(0, self.search_replace.columnCount()): + for col in range(0, self.search_replace.columnCount()): colItems.append(unicode_type(self.search_replace.item(row, col).text())) ans.append(colItems) return ans diff --git a/src/calibre/gui2/convert/single.py b/src/calibre/gui2/convert/single.py index e8f1ca11b3..9744771052 100644 --- a/src/calibre/gui2/convert/single.py +++ b/src/calibre/gui2/convert/single.py @@ -28,7 +28,7 @@ from calibre.ebooks.conversion.plumber import create_dummy_plumber from calibre.ebooks.conversion.config import delete_specifics from calibre.customize.conversion import OptionRecommendation from calibre.utils.config import prefs -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class GroupModel(QAbstractListModel): @@ -116,7 +116,7 @@ class Config(QDialog, Ui_Dialog): @property def manually_fine_tune_toc(self): - for i in xrange(self.stack.count()): + for i in range(self.stack.count()): w = self.stack.widget(i) if hasattr(w, 'manually_fine_tune_toc'): return w.manually_fine_tune_toc.isChecked() diff --git a/src/calibre/gui2/dbus_export/demo.py b/src/calibre/gui2/dbus_export/demo.py index 4a298bc373..3697d59aea 100644 --- a/src/calibre/gui2/dbus_export/demo.py +++ b/src/calibre/gui2/dbus_export/demo.py @@ -14,6 +14,7 @@ from PyQt5.Qt import ( from calibre.gui2.dbus_export.utils import setup_for_cli_run from calibre.gui2.dbus_export.widgets import factory +from polyglot.builtins import range setup_for_cli_run() @@ -45,13 +46,13 @@ class MainWindow(QMainWindow): q.triggered.connect(QApplication.quit) self.addAction(q) QApplication.instance().setWindowIcon(s.standardIcon(s.SP_ComputerIcon)) - for i, icon in zip(xrange(3), map(s.standardIcon, (s.SP_DialogOkButton, s.SP_DialogHelpButton, s.SP_ArrowUp))): + for i, icon in zip(range(3), map(s.standardIcon, (s.SP_DialogOkButton, s.SP_DialogHelpButton, s.SP_ArrowUp))): ac = m.addAction('One - &%d' % (i + 1)) ac.setShortcut(QKeySequence(Qt.CTRL | (Qt.Key_1 + i), Qt.SHIFT | (Qt.Key_1 + i))) ac.setIcon(icon) m.addSeparator() self.menu_two = m2 = m.addMenu('A &submenu') - for i, icon in zip(xrange(3), map(s.standardIcon, (s.SP_DialogOkButton, s.SP_DialogCancelButton, s.SP_ArrowUp))): + for i, icon in zip(range(3), map(s.standardIcon, (s.SP_DialogOkButton, s.SP_DialogCancelButton, s.SP_ArrowUp))): ac = m2.addAction('Two - &%d' % (i + 1)) ac.setShortcut(QKeySequence(Qt.CTRL | (Qt.Key_A + i))) ac.setIcon(icon) @@ -98,7 +99,7 @@ class MainWindow(QMainWindow): def add_menu(self): mb = self.menu_bar m = mb.addMenu('Created menu %d' % len(mb.actions())) - for i in xrange(3): + for i in range(3): m.addAction('Some action %d' % i) for ac in m.findChildren(QAction): ac.triggered.connect(self.action_triggered) diff --git a/src/calibre/gui2/dbus_export/widgets.py b/src/calibre/gui2/dbus_export/widgets.py index d3f0926379..ed7e4712a1 100644 --- a/src/calibre/gui2/dbus_export/widgets.py +++ b/src/calibre/gui2/dbus_export/widgets.py @@ -12,6 +12,7 @@ from PyQt5.Qt import ( QObject, QMenuBar, QAction, QEvent, QSystemTrayIcon, QApplication, Qt) from calibre.constants import iswindows, isosx +from polyglot.builtins import range UNITY_WINDOW_REGISTRAR = ('com.canonical.AppMenu.Registrar', '/com/canonical/AppMenu/Registrar', 'com.canonical.AppMenu.Registrar') STATUS_NOTIFIER = ("org.kde.StatusNotifierWatcher", "/StatusNotifierWatcher", "org.kde.StatusNotifierWatcher") @@ -233,7 +234,7 @@ class Factory(QObject): def bus_disconnected(self): self._bus = None - for i in xrange(5): + for i in range(5): try: self.bus except Exception: diff --git a/src/calibre/gui2/device_drivers/mtp_config.py b/src/calibre/gui2/device_drivers/mtp_config.py index 6aa1bf38e2..ef3607fd1c 100644 --- a/src/calibre/gui2/device_drivers/mtp_config.py +++ b/src/calibre/gui2/device_drivers/mtp_config.py @@ -20,7 +20,7 @@ from calibre.gui2 import error_dialog from calibre.gui2.dialogs.template_dialog import TemplateDialog from calibre.utils.date import parse_date from calibre.gui2.device_drivers.mtp_folder_browser import Browser, IgnoredFolders -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class FormatsConfig(QWidget): # {{{ @@ -52,7 +52,7 @@ class FormatsConfig(QWidget): # {{{ @property def format_map(self): return [unicode_type(self.f.item(i).data(Qt.UserRole) or '') for i in - xrange(self.f.count()) if self.f.item(i).checkState()==Qt.Checked] + range(self.f.count()) if self.f.item(i).checkState()==Qt.Checked] def validate(self): if not self.format_map: @@ -189,10 +189,10 @@ class IgnoredDevices(QWidget): # {{{ @property def blacklist(self): return [unicode_type(self.f.item(i).data(Qt.UserRole) or '') for i in - xrange(self.f.count()) if self.f.item(i).checkState()==Qt.Checked] + range(self.f.count()) if self.f.item(i).checkState()==Qt.Checked] def ignore_device(self, snum): - for i in xrange(self.f.count()): + for i in range(self.f.count()): i = self.f.item(i) c = unicode_type(i.data(Qt.UserRole) or '') if c == snum: diff --git a/src/calibre/gui2/device_drivers/mtp_folder_browser.py b/src/calibre/gui2/device_drivers/mtp_folder_browser.py index eeb42e5111..76000b5d37 100644 --- a/src/calibre/gui2/device_drivers/mtp_folder_browser.py +++ b/src/calibre/gui2/device_drivers/mtp_folder_browser.py @@ -13,7 +13,7 @@ from PyQt5.Qt import (QTabWidget, QTreeWidget, QTreeWidgetItem, Qt, QDialog, QDialogButtonBox, QVBoxLayout, QSize, pyqtSignal, QIcon, QLabel) from calibre.gui2 import file_icon_provider -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range def browser_item(f, parent): @@ -165,7 +165,7 @@ class IgnoredFolders(QDialog): def iterchildren(self, node): ' Iterate over all descendants of node ' - for i in xrange(node.childCount()): + for i in range(node.childCount()): child = node.child(i) yield child for gc in self.iterchildren(child): @@ -183,13 +183,13 @@ class IgnoredFolders(QDialog): def select_all(self): w = self.tabs.currentWidget() - for i in xrange(w.invisibleRootItem().childCount()): + for i in range(w.invisibleRootItem().childCount()): c = w.invisibleRootItem().child(i) c.setCheckState(0, Qt.Checked) def select_none(self): w = self.tabs.currentWidget() - for i in xrange(w.invisibleRootItem().childCount()): + for i in range(w.invisibleRootItem().childCount()): c = w.invisibleRootItem().child(i) c.setCheckState(0, Qt.Unchecked) diff --git a/src/calibre/gui2/dialogs/authors_edit.py b/src/calibre/gui2/dialogs/authors_edit.py index 5cc479b348..48c5562fc9 100644 --- a/src/calibre/gui2/dialogs/authors_edit.py +++ b/src/calibre/gui2/dialogs/authors_edit.py @@ -16,7 +16,7 @@ from calibre.utils.config_base import tweaks from calibre.gui2 import gprefs from calibre.gui2.complete2 import EditWithComplete from calibre.ebooks.metadata import string_to_authors -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class ItemDelegate(QStyledItemDelegate): @@ -84,7 +84,7 @@ class List(QListWidget): self.mark_as_editable() def mark_as_editable(self): - for i in xrange(self.count()): + for i in range(self.count()): item = self.item(i) item.setFlags(item.flags() | Qt.ItemIsEditable) @@ -92,7 +92,7 @@ class List(QListWidget): item = self.item(i) q = unicode_type(item.text()) remove = [] - for j in xrange(self.count()): + for j in range(self.count()): if i != j and unicode_type(self.item(j).text()) == q: remove.append(j) for x in sorted(remove, reverse=True): @@ -177,7 +177,7 @@ class AuthorsEdit(QDialog): @property def authors(self): ans = [] - for i in xrange(self.al.count()): + for i in range(self.al.count()): ans.append(unicode_type(self.al.item(i).text())) return ans or [_('Unknown')] diff --git a/src/calibre/gui2/dialogs/custom_recipes.py b/src/calibre/gui2/dialogs/custom_recipes.py index 4562361c5e..8c0b5dea1f 100644 --- a/src/calibre/gui2/dialogs/custom_recipes.py +++ b/src/calibre/gui2/dialogs/custom_recipes.py @@ -21,7 +21,7 @@ from calibre.gui2.tweak_book.editor.text import TextEdit from calibre.utils.icu import sort_key from calibre.web.feeds.recipes.collection import get_builtin_recipe_collection, get_builtin_recipe_by_id from calibre.utils.localization import localize_user_manual_link -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range def is_basic_recipe(src): @@ -383,7 +383,7 @@ class BasicRecipe(QWidget): # {{{ def fget(self): title = self.title.text().strip() - feeds = [self.feeds.item(i).data(Qt.UserRole) for i in xrange(self.feeds.count())] + feeds = [self.feeds.item(i).data(Qt.UserRole) for i in range(self.feeds.count())] return options_to_recipe_source(title, self.oldest_article.value(), self.max_articles.value(), feeds) def fset(self, src): diff --git a/src/calibre/gui2/dialogs/duplicates.py b/src/calibre/gui2/dialogs/duplicates.py index 0c0b3d32c7..df1e0acc06 100644 --- a/src/calibre/gui2/dialogs/duplicates.py +++ b/src/calibre/gui2/dialogs/duplicates.py @@ -15,7 +15,7 @@ from PyQt5.Qt import ( from calibre.gui2 import gprefs from calibre.ebooks.metadata import authors_to_string -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class DuplicatesQuestion(QDialog): @@ -70,12 +70,12 @@ class DuplicatesQuestion(QDialog): QApplication.clipboard().setText(self.as_text) def select_all(self): - for i in xrange(self.dup_list.topLevelItemCount()): + for i in range(self.dup_list.topLevelItemCount()): x = self.dup_list.topLevelItem(i) x.setCheckState(0, Qt.Checked) def select_none(self): - for i in xrange(self.dup_list.topLevelItemCount()): + for i in range(self.dup_list.topLevelItemCount()): x = self.dup_list.topLevelItem(i) x.setCheckState(0, Qt.Unchecked) @@ -134,7 +134,7 @@ class DuplicatesQuestion(QDialog): @property def duplicates(self): - for i in xrange(self.dup_list.topLevelItemCount()): + for i in range(self.dup_list.topLevelItemCount()): x = self.dup_list.topLevelItem(i) if x.checkState(0) == Qt.Checked: yield x.data(0, Qt.UserRole) @@ -142,12 +142,12 @@ class DuplicatesQuestion(QDialog): @property def as_text(self): entries = [] - for i in xrange(self.dup_list.topLevelItemCount()): + for i in range(self.dup_list.topLevelItemCount()): x = self.dup_list.topLevelItem(i) check = '✓' if x.checkState(0) == Qt.Checked else '✗' title = '%s %s' % (check, unicode_type(x.text(0))) dups = [] - for child in (x.child(j) for j in xrange(x.childCount())): + for child in (x.child(j) for j in range(x.childCount())): dups.append('\t' + unicode_type(child.text(0))) entries.append(title + '\n' + '\n'.join(dups)) return '\n\n'.join(entries) diff --git a/src/calibre/gui2/dialogs/exim.py b/src/calibre/gui2/dialogs/exim.py index 282540836c..a5e013f435 100644 --- a/src/calibre/gui2/dialogs/exim.py +++ b/src/calibre/gui2/dialogs/exim.py @@ -21,6 +21,7 @@ from calibre.gui2 import choose_dir, error_dialog, question_dialog from calibre.gui2.widgets2 import Dialog from calibre.utils.exim import all_known_libraries, export, Importer, import_data from calibre.utils.icu import numeric_sort_key +from polyglot.builtins import range def disk_usage(path_to_dir, abort=None): @@ -214,7 +215,7 @@ class EximDialog(Dialog): lambda i, sz: self.lib_list.item(i).setText(self.export_lib_text(self.lib_list.item(i).data(Qt.UserRole), sz))), type=Qt.QueuedConnection) def get_lib_sizes(self): - for i in xrange(self.lib_list.count()): + for i in range(self.lib_list.count()): path = self.lib_list.item(i).data(Qt.UserRole) try: sz = disk_usage(path, abort=self.abort_disk_usage) diff --git a/src/calibre/gui2/dialogs/scheduler.py b/src/calibre/gui2/dialogs/scheduler.py index 9180f8057f..27be20cb99 100644 --- a/src/calibre/gui2/dialogs/scheduler.py +++ b/src/calibre/gui2/dialogs/scheduler.py @@ -26,13 +26,13 @@ from calibre.utils.date import utcnow from calibre.utils.network import internet_connected from calibre import force_unicode from calibre.utils.localization import get_lang, canonicalize_lang -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range def convert_day_time_schedule(val): day_of_week, hour, minute = val if day_of_week == -1: - return (tuple(xrange(7)), hour, minute) + return (tuple(range(7)), hour, minute) return ((day_of_week,), hour, minute) @@ -73,7 +73,7 @@ class DaysOfWeek(Base): def __init__(self, parent=None): Base.__init__(self, parent) self.days = [QCheckBox(force_unicode(calendar.day_abbr[d]), - self) for d in xrange(7)] + self) for d in range(7)] for i, cb in enumerate(self.days): row = i % 2 col = i // 2 diff --git a/src/calibre/gui2/dialogs/tag_editor.py b/src/calibre/gui2/dialogs/tag_editor.py index 38b6e921d7..a5f16ff706 100644 --- a/src/calibre/gui2/dialogs/tag_editor.py +++ b/src/calibre/gui2/dialogs/tag_editor.py @@ -8,7 +8,7 @@ from calibre.gui2.dialogs.tag_editor_ui import Ui_TagEditor from calibre.gui2 import question_dialog, error_dialog, gprefs from calibre.constants import islinux from calibre.utils.icu import sort_key, primary_contains -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class TagEditor(QDialog, Ui_TagEditor): @@ -213,7 +213,7 @@ class TagEditor(QDialog, Ui_TagEditor): def filter_tags(self, filter_value, which='available_tags'): collection = getattr(self, which) q = icu_lower(unicode_type(filter_value)) - for i in xrange(collection.count()): # on every available tag + for i in range(collection.count()): # on every available tag item = collection.item(i) item.setHidden(bool(q and not primary_contains(q, unicode_type(item.text())))) diff --git a/src/calibre/gui2/metadata/basic_widgets.py b/src/calibre/gui2/metadata/basic_widgets.py index 0cacf6f85a..3dac5c5893 100644 --- a/src/calibre/gui2/metadata/basic_widgets.py +++ b/src/calibre/gui2/metadata/basic_widgets.py @@ -41,7 +41,7 @@ from calibre.ptempfile import PersistentTemporaryFile, SpooledTemporaryFile from calibre.gui2.languages import LanguagesEdit as LE from calibre.db import SPOOL_SIZE from calibre.ebooks.oeb.polish.main import SUPPORTED as EDIT_SUPPORTED -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range OK_COLOR = 'rgba(0, 255, 0, 12%)' ERR_COLOR = 'rgba(255, 0, 0, 12%)' @@ -1049,7 +1049,7 @@ class FormatsManager(QWidget): return fmt.ext.lower() def get_format_path(self, db, id_, fmt): - for i in xrange(self.formats.count()): + for i in range(self.formats.count()): f = self.formats.item(i) ext = f.ext.lower() if ext == fmt: diff --git a/src/calibre/gui2/metadata/diff.py b/src/calibre/gui2/metadata/diff.py index 01606711ce..286feaa2fd 100644 --- a/src/calibre/gui2/metadata/diff.py +++ b/src/calibre/gui2/metadata/diff.py @@ -9,7 +9,7 @@ __copyright__ = '2013, Kovid Goyal ' import os, weakref from collections import OrderedDict, namedtuple from functools import partial -from polyglot.builtins import zip, unicode_type +from polyglot.builtins import zip, unicode_type, range from PyQt5.Qt import ( QDialog, QWidget, QGridLayout, QLabel, QToolButton, QIcon, @@ -699,7 +699,7 @@ if __name__ == '__main__': ids = tuple(zip(ids[0::2], ids[1::2])) gm = partial(db.get_metadata, index_is_id=True, get_cover=True, cover_as_data=True) get_metadata = lambda x:map(gm, ids[x]) - d = CompareMany(list(xrange(len(ids))), get_metadata, db.field_metadata, db=db) + d = CompareMany(list(range(len(ids))), get_metadata, db.field_metadata, db=db) if d.exec_() == d.Accepted: for changed, mi in d.accepted.itervalues(): if changed and mi is not None: diff --git a/src/calibre/gui2/metadata/single_download.py b/src/calibre/gui2/metadata/single_download.py index ed3ed1cd04..56c2c3f641 100644 --- a/src/calibre/gui2/metadata/single_download.py +++ b/src/calibre/gui2/metadata/single_download.py @@ -40,7 +40,7 @@ from calibre import force_unicode from calibre.utils.config import tweaks from calibre.utils.ipc.simple_worker import fork_job, WorkerError from calibre.ptempfile import TemporaryDirectory -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range # }}} @@ -704,7 +704,7 @@ class CoversModel(QAbstractListModel): # {{{ return 1 return pmap.width()*pmap.height() dcovers = sorted(self.covers[1:], key=keygen, reverse=True) - cmap = {i:self.plugin_for_index(i) for i in xrange(len(self.covers))} + cmap = {i:self.plugin_for_index(i) for i in range(len(self.covers))} for i, x in enumerate(self.covers[0:1] + dcovers): if not x[-1]: good.append(x) @@ -751,7 +751,7 @@ class CoversModel(QAbstractListModel): # {{{ return self.beginInsertRows(QModelIndex(), last_row, last_row) for rows in self.plugin_map.itervalues(): - for i in xrange(len(rows)): + for i in range(len(rows)): if rows[i] >= last_row: rows[i] += 1 self.plugin_map[plugin].insert(-1, last_row) diff --git a/src/calibre/gui2/store/stores/mobileread/store_dialog.py b/src/calibre/gui2/store/stores/mobileread/store_dialog.py index a68dd32ebe..3de3b258d4 100644 --- a/src/calibre/gui2/store/stores/mobileread/store_dialog.py +++ b/src/calibre/gui2/store/stores/mobileread/store_dialog.py @@ -67,7 +67,7 @@ class MobileReadStoreDialog(QDialog, Ui_Dialog): break self.results_view.setColumnWidth(i, x) else: - for i in xrange(self.results_view.model().columnCount()): + for i in range(self.results_view.model().columnCount()): self.results_view.resizeColumnToContents(i) self.results_view.model().sort_col = self.plugin.config.get('dialog_sort_col', 0) diff --git a/src/calibre/gui2/tweak_book/char_select.py b/src/calibre/gui2/tweak_book/char_select.py index d44b985da2..d8204abe69 100644 --- a/src/calibre/gui2/tweak_book/char_select.py +++ b/src/calibre/gui2/tweak_book/char_select.py @@ -22,7 +22,7 @@ from calibre.gui2.tweak_book import tprefs from calibre.gui2.tweak_book.widgets import Dialog, BusyCursor from calibre.utils.icu import safe_chr as chr from calibre.utils.unicode_names import character_name_from_code, points_for_word -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range ROOT = QModelIndex() @@ -427,7 +427,7 @@ class CategoryModel(QAbstractItemModel): return (_('Favorites'), list(tprefs['charmap_favorites'])) else: item = self.categories[pid - 1][1][index.row()] - return (item[0], list(xrange(item[1][0], item[1][1] + 1))) + return (item[0], list(range(item[1][0], item[1][1] + 1))) def get_char_info(self, char_code): ipos = bisect(self.starts, char_code) - 1 diff --git a/src/calibre/gui2/tweak_book/check.py b/src/calibre/gui2/tweak_book/check.py index fa299ca6d2..d04162e3bb 100644 --- a/src/calibre/gui2/tweak_book/check.py +++ b/src/calibre/gui2/tweak_book/check.py @@ -17,7 +17,7 @@ from calibre.ebooks.oeb.polish.check.main import run_checks, fix_errors from calibre.gui2 import NO_URL_FORMATTING from calibre.gui2.tweak_book import tprefs from calibre.gui2.tweak_book.widgets import BusyCursor -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range def icon_for_level(level): @@ -100,7 +100,7 @@ class Check(QSplitter): def copy_to_clipboard(self): items = [] - for item in (self.items.item(i) for i in xrange(self.items.count())): + for item in (self.items.item(i) for i in range(self.items.count())): msg = unicode_type(item.text()) msg = prefix_for_level(item.data(Qt.UserRole).level) + msg items.append(msg) @@ -123,7 +123,7 @@ class Check(QSplitter): elif url == 'run:check': self.check_requested.emit() elif url == 'fix:errors': - errors = [self.items.item(i).data(Qt.UserRole) for i in xrange(self.items.count())] + errors = [self.items.item(i).data(Qt.UserRole) for i in range(self.items.count())] self.fix_requested.emit(errors) elif url.startswith('fix:error,'): num = int(url.rpartition(',')[-1]) diff --git a/src/calibre/gui2/tweak_book/download.py b/src/calibre/gui2/tweak_book/download.py index 8a8b405e19..9f0cb4b2c7 100644 --- a/src/calibre/gui2/tweak_book/download.py +++ b/src/calibre/gui2/tweak_book/download.py @@ -15,6 +15,7 @@ from calibre.gui2.tweak_book import current_container from calibre.gui2.tweak_book.widgets import Dialog from calibre.gui2.progress_indicator import WaitStack from calibre.ebooks.oeb.polish.download import get_external_resources, download_external_resources, replace_resources +from polyglot.builtins import range class ChooseResources(QWidget): @@ -29,7 +30,7 @@ class ChooseResources(QWidget): l.addWidget(i) def __iter__(self): - for i in xrange(self.items.count()): + for i in range(self.items.count()): yield self.items.item(i) def select_none(self): diff --git a/src/calibre/gui2/tweak_book/file_list.py b/src/calibre/gui2/tweak_book/file_list.py index 21f278381f..9acbe741e9 100644 --- a/src/calibre/gui2/tweak_book/file_list.py +++ b/src/calibre/gui2/tweak_book/file_list.py @@ -39,7 +39,7 @@ from calibre.gui2.tweak_book import ( from calibre.gui2.tweak_book.editor import syntax_from_mime from calibre.gui2.tweak_book.templates import template_for from calibre.utils.icu import numeric_sort_key -from polyglot.builtins import iteritems, unicode_type +from polyglot.builtins import iteritems, unicode_type, range try: from PyQt5 import sip @@ -273,21 +273,21 @@ class FileList(QTreeWidget): item.setExpanded(category in state['expanded']) self.verticalScrollBar().setValue(state['pos']) for parent in self.categories.itervalues(): - for c in (parent.child(i) for i in xrange(parent.childCount())): + for c in (parent.child(i) for i in range(parent.childCount())): name = unicode_type(c.data(0, NAME_ROLE) or '') if name in state['selected']: c.setSelected(True) def item_from_name(self, name): for parent in self.categories.itervalues(): - for c in (parent.child(i) for i in xrange(parent.childCount())): + for c in (parent.child(i) for i in range(parent.childCount())): q = unicode_type(c.data(0, NAME_ROLE) or '') if q == name: return c def select_name(self, name, set_as_current_index=False): for parent in self.categories.itervalues(): - for c in (parent.child(i) for i in xrange(parent.childCount())): + for c in (parent.child(i) for i in range(parent.childCount())): q = unicode_type(c.data(0, NAME_ROLE) or '') c.setSelected(q == name) if q == name: @@ -297,7 +297,7 @@ class FileList(QTreeWidget): def select_names(self, names, current_name=None): for parent in self.categories.itervalues(): - for c in (parent.child(i) for i in xrange(parent.childCount())): + for c in (parent.child(i) for i in range(parent.childCount())): q = unicode_type(c.data(0, NAME_ROLE) or '') c.setSelected(q in names) if q == current_name: @@ -558,7 +558,7 @@ class FileList(QTreeWidget): def index_of_name(self, name): for category, parent in self.categories.iteritems(): - for i in xrange(parent.childCount()): + for i in range(parent.childCount()): item = parent.child(i) if unicode_type(item.data(0, NAME_ROLE) or '') == name: return (category, i) @@ -671,7 +671,7 @@ class FileList(QTreeWidget): _('The file(s) %s cannot be deleted.') % ('%s' % ', '.join(bad)), show=True) text = self.categories['text'] - children = (text.child(i) for i in xrange(text.childCount())) + children = (text.child(i) for i in range(text.childCount())) spine_removals = [(unicode_type(item.data(0, NAME_ROLE) or ''), item.isSelected()) for item in children] other_removals = {unicode_type(item.data(0, NAME_ROLE) or '') for item in self.selectedItems() if unicode_type(item.data(0, CATEGORY_ROLE) or '') != 'text'} @@ -684,7 +684,7 @@ class FileList(QTreeWidget): removals.append(self.categories['text'].child(i)) for category, parent in self.categories.iteritems(): if category != 'text': - for i in xrange(parent.childCount()): + for i in range(parent.childCount()): child = parent.child(i) if unicode_type(child.data(0, NAME_ROLE) or '') in other_removals: removals.append(child) @@ -717,12 +717,12 @@ class FileList(QTreeWidget): def dropEvent(self, event): with self: text = self.categories['text'] - pre_drop_order = {text.child(i):i for i in xrange(text.childCount())} + pre_drop_order = {text.child(i):i for i in range(text.childCount())} super(FileList, self).dropEvent(event) - current_order = {text.child(i):i for i in xrange(text.childCount())} + current_order = {text.child(i):i for i in range(text.childCount())} if current_order != pre_drop_order: order = [] - for child in (text.child(i) for i in xrange(text.childCount())): + for child in (text.child(i) for i in range(text.childCount())): name = unicode_type(child.data(0, NAME_ROLE) or '') linear = bool(child.data(0, LINEAR_ROLE)) order.append([name, linear]) @@ -756,7 +756,7 @@ class FileList(QTreeWidget): def edit_next_file(self, currently_editing=None, backwards=False): category = self.categories['text'] seen_current = False - items = (category.child(i) for i in xrange(category.childCount())) + items = (category.child(i) for i in range(category.childCount())) if backwards: items = reversed(tuple(items)) for item in items: @@ -770,7 +770,7 @@ class FileList(QTreeWidget): @property def all_files(self): - return (category.child(i) for category in self.categories.itervalues() for i in xrange(category.childCount())) + return (category.child(i) for category in self.categories.itervalues() for i in range(category.childCount())) @property def searchable_names(self): @@ -838,7 +838,7 @@ class FileList(QTreeWidget): def link_stylesheets(self, names): s = self.categories['styles'] - sheets = [unicode_type(s.child(i).data(0, NAME_ROLE) or '') for i in xrange(s.childCount())] + sheets = [unicode_type(s.child(i).data(0, NAME_ROLE) or '') for i in range(s.childCount())] if not sheets: return error_dialog(self, _('No stylesheets'), _( 'This book currently has no stylesheets. You must first create a stylesheet' @@ -871,7 +871,7 @@ class FileList(QTreeWidget): l.addWidget(bb) if d.exec_() == d.Accepted: tprefs['remove_existing_links_when_linking_sheets'] = r.isChecked() - sheets = [unicode_type(s.item(il).text()) for il in xrange(s.count()) if s.item(il).checkState() == Qt.Checked] + sheets = [unicode_type(s.item(il).text()) for il in range(s.count()) if s.item(il).checkState() == Qt.Checked] if sheets: self.link_stylesheets_requested.emit(names, sheets, r.isChecked()) diff --git a/src/calibre/gui2/tweak_book/preferences.py b/src/calibre/gui2/tweak_book/preferences.py index 6c1b9f720f..ac16fa8ea1 100644 --- a/src/calibre/gui2/tweak_book/preferences.py +++ b/src/calibre/gui2/tweak_book/preferences.py @@ -8,7 +8,7 @@ __copyright__ = '2013, Kovid Goyal ' from operator import attrgetter, methodcaller from collections import namedtuple -from polyglot.builtins import map, unicode_type +from polyglot.builtins import map, unicode_type, range from itertools import product from copy import copy, deepcopy @@ -102,7 +102,7 @@ class BasicSettings(QWidget): # {{{ widget.defaults = prefs.defaults[name] def getter(w): - return list(map(unicode_type, (w.item(i).text() for i in xrange(w.count())))) + return list(map(unicode_type, (w.item(i).text() for i in range(w.count())))) def setter(w, val): order_map = {x:i for i, x in enumerate(val)} @@ -452,7 +452,7 @@ class ToolbarSettings(QWidget): def read_settings(self, prefs=None): prefs = prefs or tprefs val = self.original_settings = {} - for i in xrange(1, self.bars.count()): + for i in range(1, self.bars.count()): name = unicode_type(self.bars.itemData(i) or '') val[name] = copy(prefs[name]) self.current_settings = deepcopy(val) @@ -724,7 +724,7 @@ class Preferences(QDialog): cl.setCurrentRow(0) cl.item(0).setSelected(True) w, h = cl.sizeHintForColumn(0), 0 - for i in xrange(cl.count()): + for i in range(cl.count()): h = cl.sizeHintForRow(i) cl.item(i).setSizeHint(QSize(w, h)) @@ -744,7 +744,7 @@ class Preferences(QDialog): return self.toolbars_panel.changed def restore_all_defaults(self): - for i in xrange(self.stacks.count()): + for i in range(self.stacks.count()): w = self.stacks.widget(i) w.restore_defaults() @@ -768,7 +768,7 @@ class Preferences(QDialog): def accept(self): tprefs.set('preferences_geom', bytearray(self.saveGeometry())) - for i in xrange(self.stacks.count()): + for i in range(self.stacks.count()): w = self.stacks.widget(i) w.commit() QDialog.accept(self) diff --git a/src/calibre/gui2/tweak_book/reports.py b/src/calibre/gui2/tweak_book/reports.py index 804b5c805a..443420872f 100644 --- a/src/calibre/gui2/tweak_book/reports.py +++ b/src/calibre/gui2/tweak_book/reports.py @@ -8,7 +8,7 @@ __copyright__ = '2015, Kovid Goyal ' import time, textwrap, os from threading import Thread -from polyglot.builtins import map +from polyglot.builtins import map, range from operator import itemgetter from functools import partial from collections import defaultdict @@ -76,7 +76,7 @@ class ProxyModel(QSortFilterProxyModel): if not self._filter_text: return True sm = self.sourceModel() - for item in (sm.data(sm.index(row, c, parent)) or '' for c in xrange(sm.columnCount())): + for item in (sm.data(sm.index(row, c, parent)) or '' for c in range(sm.columnCount())): if item and primary_contains(self._filter_text, item): return True return False @@ -147,7 +147,7 @@ class FilesView(QTableView): if self.model().rowCount() > 0: num = min(5, self.model().rowCount()) h = 1000000 - for i in xrange(num): + for i in range(num): self.resizeRowToContents(i) h = min(h, self.rowHeight(i)) self.verticalHeader().setDefaultSectionSize(h) @@ -198,8 +198,8 @@ class FilesView(QTableView): w = csv_writer(buf) w.writerow(self.proxy.sourceModel().COLUMN_HEADERS) cols = self.proxy.columnCount() - for r in xrange(self.proxy.rowCount()): - items = [self.proxy.index(r, c).data(Qt.DisplayRole) for c in xrange(cols)] + for r in range(self.proxy.rowCount()): + items = [self.proxy.index(r, c).data(Qt.DisplayRole) for c in range(cols)] w.writerow(items) return buf.getvalue() @@ -1092,7 +1092,7 @@ class CSSWidget(QWidget): buf = BytesIO() w = csv_writer(buf) w.writerow([_('Style Rule'), _('Number of matches')]) - for r in xrange(self.proxy.rowCount()): + for r in range(self.proxy.rowCount()): entry = self.proxy.mapToSource(self.proxy.index(r, 0)).data(Qt.UserRole) w.writerow([entry.rule.selector, entry.count]) return buf.getvalue() @@ -1238,7 +1238,7 @@ class ClassesWidget(CSSWidget): buf = BytesIO() w = csv_writer(buf) w.writerow([_('Class'), _('Number of matches')]) - for r in xrange(self.proxy.rowCount()): + for r in range(self.proxy.rowCount()): entry = self.proxy.mapToSource(self.proxy.index(r, 0)).data(Qt.UserRole) w.writerow([entry.cls, entry.num_of_matches]) return buf.getvalue() @@ -1328,12 +1328,12 @@ class ReportsWidget(QWidget): if current_page is not None: self.reports.setCurrentRow(current_page) self.layout().setContentsMargins(0, 0, 0, 0) - for i in xrange(self.stack.count()): + for i in range(self.stack.count()): self.stack.widget(i).layout().setContentsMargins(0, 0, 0, 0) def __call__(self, data): jump.clear() - for i in xrange(self.stack.count()): + for i in range(self.stack.count()): st = time.time() self.stack.widget(i)(data) if DEBUG: @@ -1343,7 +1343,7 @@ class ReportsWidget(QWidget): def save(self): save_state('splitter-state', bytearray(self.splitter.saveState())) save_state('report-page', self.reports.currentRow()) - for i in xrange(self.stack.count()): + for i in range(self.stack.count()): self.stack.widget(i).save() def to_csv(self): diff --git a/src/calibre/gui2/tweak_book/search.py b/src/calibre/gui2/tweak_book/search.py index fb4cc483df..eb7432aa94 100644 --- a/src/calibre/gui2/tweak_book/search.py +++ b/src/calibre/gui2/tweak_book/search.py @@ -34,7 +34,7 @@ from calibre.gui2.tweak_book.widgets import BusyCursor from calibre.gui2.widgets2 import FlowLayout, HistoryComboBox from calibre.utils.icu import primary_contains from calibre.ebooks.conversion.search_replace import REGEX_FLAGS, compile_regular_expression -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range # The search panel {{{ @@ -536,7 +536,7 @@ class SearchesModel(QAbstractListModel): def __init__(self, parent): QAbstractListModel.__init__(self, parent) self.searches = tprefs['saved_searches'] - self.filtered_searches = list(xrange(len(self.searches))) + self.filtered_searches = list(range(len(self.searches))) def rowCount(self, parent=QModelIndex()): return len(self.filtered_searches) @@ -647,7 +647,7 @@ class SearchesModel(QAbstractListModel): def add_searches(self, count=1): self.beginResetModel() self.searches = tprefs['saved_searches'] - self.filtered_searches.extend(xrange(len(self.searches) - count, len(self.searches), 1)) + self.filtered_searches.extend(range(len(self.searches) - count, len(self.searches), 1)) self.endResetModel() def remove_searches(self, rows): diff --git a/src/calibre/gui2/tweak_book/spell.py b/src/calibre/gui2/tweak_book/spell.py index d592e98466..3fe4e0522a 100644 --- a/src/calibre/gui2/tweak_book/spell.py +++ b/src/calibre/gui2/tweak_book/spell.py @@ -37,7 +37,7 @@ from calibre.spell.import_from import import_from_oxt from calibre.spell.break_iterator import split_into_words from calibre.utils.localization import calibre_langcode_to_name, get_language, get_lang, canonicalize_lang from calibre.utils.icu import sort_key, primary_sort_key, primary_contains, contains -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range LANG = 0 COUNTRY = 1 @@ -147,12 +147,12 @@ class UserWordList(QListWidget): m.exec_(ev.globalPos()) def select_all(self): - for item in (self.item(i) for i in xrange(self.count())): + for item in (self.item(i) for i in range(self.count())): item.setSelected(True) def copy_to_clipboard(self): words = [] - for item in (self.item(i) for i in xrange(self.count())): + for item in (self.item(i) for i in range(self.count())): if item.isSelected(): words.append(item.data(Qt.UserRole)[0]) if words: @@ -292,7 +292,7 @@ class ManageUserDictionaries(Dialog): if d is not None: dictionaries.mark_user_dictionary_as_active(d.name, self.is_active.isChecked()) self.dictionaries_changed = True - for item in (self.dictionaries.item(i) for i in xrange(self.dictionaries.count())): + for item in (self.dictionaries.item(i) for i in range(self.dictionaries.count())): d = item.data(Qt.UserRole) item.setData(Qt.FontRole, self.emph_font if d.is_active else None) @@ -386,7 +386,7 @@ class ManageUserDictionaries(Dialog): def find_word(self, word, lang): key = (word, lang) - for i in xrange(self.words.count()): + for i in range(self.words.count()): if self.words.item(i).data(Qt.UserRole) == key: return i return -1 @@ -557,7 +557,7 @@ class ManageDictionaries(Dialog): # {{{ item = self.dictionaries.currentItem() bf = QFont(self.dictionaries.font()) bf.setBold(True) - for x in (item.parent().child(i) for i in xrange(item.parent().childCount())): + for x in (item.parent().child(i) for i in range(item.parent().childCount())): x.setData(0, Qt.FontRole, bf if x is item else None) lc = unicode_type(item.parent().data(0, Qt.UserRole)) pl = dprefs['preferred_locales'] @@ -578,7 +578,7 @@ class ManageDictionaries(Dialog): # {{{ item = self.dictionaries.currentItem() bf = QFont(self.dictionaries.font()) bf.setItalic(True) - for x in (item.parent().child(i) for i in xrange(item.parent().childCount())): + for x in (item.parent().child(i) for i in range(item.parent().childCount())): x.setData(0, Qt.FontRole, bf if x is item else None) cc = unicode_type(item.parent().data(0, Qt.UserRole)) lc = unicode_type(item.parent().parent().data(0, Qt.UserRole)) diff --git a/src/calibre/gui2/tweak_book/toc.py b/src/calibre/gui2/tweak_book/toc.py index d2c0de0061..fd84b91fc0 100644 --- a/src/calibre/gui2/tweak_book/toc.py +++ b/src/calibre/gui2/tweak_book/toc.py @@ -16,7 +16,7 @@ from calibre.ebooks.oeb.polish.toc import commit_toc, get_toc from calibre.gui2 import error_dialog from calibre.gui2.toc.main import TOCView, ItemEdit from calibre.gui2.tweak_book import current_container, TOP, actions, tprefs -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class TOCEditor(QDialog): @@ -184,7 +184,7 @@ class TOCViewer(QWidget): def iteritems(self, parent=None): if parent is None: parent = self.invisibleRootItem() - for i in xrange(parent.childCount()): + for i in range(parent.childCount()): child = parent.child(i) yield child for gc in self.iteritems(parent=child): diff --git a/src/calibre/gui2/tweak_book/ui.py b/src/calibre/gui2/tweak_book/ui.py index 8e27f78496..fbd7e11b93 100644 --- a/src/calibre/gui2/tweak_book/ui.py +++ b/src/calibre/gui2/tweak_book/ui.py @@ -9,7 +9,7 @@ __copyright__ = '2013, Kovid Goyal ' import os from functools import partial from itertools import product -from polyglot.builtins import map, unicode_type +from polyglot.builtins import map, unicode_type, range from PyQt5.Qt import ( QDockWidget, Qt, QLabel, QIcon, QAction, QApplication, QWidget, QEvent, @@ -108,14 +108,14 @@ class Central(QStackedWidget): # {{{ def tab_order(self): ans = [] rmap = {v:k for k, v in editors.iteritems()} - for i in xrange(self.editor_tabs.count()): + for i in range(self.editor_tabs.count()): name = rmap.get(self.editor_tabs.widget(i)) if name is not None: ans.append(name) return ans def rename_editor(self, editor, name): - for i in xrange(self.editor_tabs.count()): + for i in range(self.editor_tabs.count()): if self.editor_tabs.widget(i) is editor: fname = name.rpartition('/')[2] self.editor_tabs.setTabText(i, fname) @@ -126,7 +126,7 @@ class Central(QStackedWidget): # {{{ self.editor_tabs.setCurrentWidget(editor) def close_editor(self, editor): - for i in xrange(self.editor_tabs.count()): + for i in range(self.editor_tabs.count()): if self.editor_tabs.widget(i) is editor: self.editor_tabs.removeTab(i) if self.editor_tabs.count() == 0: @@ -136,7 +136,7 @@ class Central(QStackedWidget): # {{{ def editor_modified(self, *args): tb = self.editor_tabs.tabBar() - for i in xrange(self.editor_tabs.count()): + for i in range(self.editor_tabs.count()): editor = self.editor_tabs.widget(i) modified = getattr(editor, 'is_modified', False) tb.setTabIcon(i, self.modified_icon if modified else QIcon()) @@ -152,7 +152,7 @@ class Central(QStackedWidget): # {{{ def close_all_but(self, ed): close = [] if ed is not None: - for i in xrange(self.editor_tabs.count()): + for i in range(self.editor_tabs.count()): q = self.editor_tabs.widget(i) if q is not None and q is not ed: close.append(q) diff --git a/src/calibre/gui2/viewer/bookmarkmanager.py b/src/calibre/gui2/viewer/bookmarkmanager.py index 31bb7d57be..3b81f80eaf 100644 --- a/src/calibre/gui2/viewer/bookmarkmanager.py +++ b/src/calibre/gui2/viewer/bookmarkmanager.py @@ -14,7 +14,7 @@ from PyQt5.Qt import ( from calibre.gui2 import choose_save_file, choose_files from calibre.utils.icu import sort_key -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class BookmarksList(QListWidget): @@ -142,7 +142,7 @@ class BookmarkManager(QWidget): l.scrollToItem(item) def __iter__(self): - for i in xrange(self.bookmarks_list.count()): + for i in range(self.bookmarks_list.count()): yield self.item_to_bm(self.bookmarks_list.item(i)) def item_changed(self, item): diff --git a/src/calibre/gui2/viewer/ui.py b/src/calibre/gui2/viewer/ui.py index f5ddabe73c..19f88e4bc6 100644 --- a/src/calibre/gui2/viewer/ui.py +++ b/src/calibre/gui2/viewer/ui.py @@ -22,7 +22,7 @@ from calibre.gui2.viewer.bookmarkmanager import BookmarkManager from calibre.gui2.viewer.toc import TOCView, TOCSearch from calibre.gui2.viewer.footnote import FootnotesView from calibre.utils.localization import is_rtl -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class DoubleSpinBox(QDoubleSpinBox): # {{{ @@ -187,7 +187,7 @@ class History(list): # {{{ def test_history(): h = History() - for i in xrange(4): + for i in range(4): h.add(i) for i in reversed(h): h.back(i) diff --git a/src/calibre/utils/fonts/metadata.py b/src/calibre/utils/fonts/metadata.py index 94abe6e69d..99993d7f3d 100644 --- a/src/calibre/utils/fonts/metadata.py +++ b/src/calibre/utils/fonts/metadata.py @@ -12,11 +12,13 @@ from struct import calcsize, unpack, unpack_from from collections import namedtuple from calibre.utils.fonts.utils import get_font_names2, get_font_characteristics +from polyglot.builtins import range class UnsupportedFont(ValueError): pass + FontCharacteristics = namedtuple('FontCharacteristics', 'weight, is_italic, is_bold, is_regular, fs_type, panose, width, is_oblique, is_wws, os2_version') FontNames = namedtuple('FontNames', @@ -70,7 +72,7 @@ class FontMetadata(object): sz = calcsize(table_record) self.tables = {} block = f.read(sz * num_tables) - for i in xrange(num_tables): + for i in range(num_tables): table_tag, table_checksum, table_offset, table_length = \ unpack_from(table_record, block, i*sz) self.tables[table_tag.lower()] = (table_offset, table_length, @@ -112,6 +114,7 @@ class FontMetadata(object): ans[f] = getattr(self.characteristics, f) return ans + if __name__ == '__main__': import sys with open(sys.argv[-1], 'rb') as f: diff --git a/src/calibre/utils/fonts/utils.py b/src/calibre/utils/fonts/utils.py index 36bdc05f03..d98b781f40 100644 --- a/src/calibre/utils/fonts/utils.py +++ b/src/calibre/utils/fonts/utils.py @@ -11,7 +11,7 @@ import struct from io import BytesIO from collections import defaultdict -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class UnsupportedFont(ValueError): @@ -32,7 +32,7 @@ def is_truetype_font(raw): def get_tables(raw): num_tables = struct.unpack_from(b'>H', raw, 4)[0] offset = 4*3 # start of the table record entries - for i in xrange(num_tables): + for i in range(num_tables): table_tag, table_checksum, table_offset, table_length = struct.unpack_from( b'>4s3L', raw, offset) yield (table_tag, raw[table_offset:table_offset+table_length], offset, @@ -183,7 +183,7 @@ def _get_font_names(raw, raw_is_table=False): records = defaultdict(list) - for i in xrange(count): + for i in range(count): try: platform_id, encoding_id, language_id, name_id, length, offset = \ struct.unpack_from(b'>6H', table, 6+i*12) @@ -408,7 +408,7 @@ def get_glyph_ids(raw, text, raw_is_table=False): raise UnsupportedFont('Not a supported font, has no cmap table') version, num_tables = struct.unpack_from(b'>HH', table) bmp_table = None - for i in xrange(num_tables): + for i in range(num_tables): platform_id, encoding_id, offset = struct.unpack_from(b'>HHL', table, 4 + (i*8)) if platform_id == 3 and encoding_id == 1: From b4e467ea183b883c0f4f71c0c3d0d15602dbfc60 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Mar 2019 18:30:31 +0530 Subject: [PATCH 0310/2613] Get rid of more xrange --- src/calibre/ebooks/docx/writer/fonts.py | 3 ++- src/calibre/ebooks/docx/writer/tables.py | 5 +++-- src/calibre/ebooks/lrf/html/table.py | 8 ++++---- src/calibre/ebooks/pdb/ereader/__init__.py | 4 ++-- src/calibre/ebooks/pdb/pdf/reader.py | 3 ++- src/calibre/ebooks/pdb/plucker/reader.py | 14 +++++++------- src/calibre/ebooks/pdf/render/gradients.py | 8 ++++---- src/calibre/ebooks/pdf/render/test.py | 3 ++- src/calibre/ebooks/pdf/render/toc.py | 3 ++- src/calibre/ebooks/unihandecode/pykakasi/h2a.py | 7 ++++--- src/calibre/ebooks/unihandecode/pykakasi/k2a.py | 4 ++-- src/calibre/gui2/actions/add.py | 4 ++-- src/calibre/gui2/actions/annotate.py | 5 ++--- src/calibre/gui2/actions/author_mapper.py | 3 ++- src/calibre/gui2/actions/choose_library.py | 4 ++-- src/calibre/gui2/actions/tag_mapper.py | 4 ++-- src/calibre/gui2/library/alternate_views.py | 12 ++++++------ src/calibre/gui2/library/models.py | 6 +++--- src/calibre/gui2/library/views.py | 16 ++++++++-------- src/calibre/gui2/preferences/ignored_devices.py | 7 ++++--- src/calibre/gui2/preferences/texture_chooser.py | 6 +++--- src/calibre/gui2/preferences/tweaks.py | 4 ++-- src/calibre/gui2/tag_browser/model.py | 11 ++++++----- src/calibre/gui2/tag_browser/view.py | 4 ++-- 24 files changed, 78 insertions(+), 70 deletions(-) diff --git a/src/calibre/ebooks/docx/writer/fonts.py b/src/calibre/ebooks/docx/writer/fonts.py index dccb8c22b7..a99ebbb7b6 100644 --- a/src/calibre/ebooks/docx/writer/fonts.py +++ b/src/calibre/ebooks/docx/writer/fonts.py @@ -11,12 +11,13 @@ from uuid import uuid4 from calibre.ebooks.oeb.base import OEB_STYLES from calibre.ebooks.oeb.transforms.subset import find_font_face_rules +from polyglot.builtins import range def obfuscate_font_data(data, key): prefix = bytearray(data[:32]) key = bytearray(reversed(key.bytes)) - prefix = bytes(bytearray(prefix[i]^key[i % len(key)] for i in xrange(len(prefix)))) + prefix = bytes(bytearray(prefix[i]^key[i % len(key)] for i in range(len(prefix)))) return prefix + data[32:] diff --git a/src/calibre/ebooks/docx/writer/tables.py b/src/calibre/ebooks/docx/writer/tables.py index 4094ccec01..b0ab81524a 100644 --- a/src/calibre/ebooks/docx/writer/tables.py +++ b/src/calibre/ebooks/docx/writer/tables.py @@ -10,6 +10,7 @@ from collections import namedtuple from calibre.ebooks.docx.writer.utils import convert_color from calibre.ebooks.docx.writer.styles import read_css_block_borders as rcbb, border_edges +from polyglot.builtins import range class Dummy(object): @@ -309,7 +310,7 @@ class Table(object): for cell in tuple(row.cells): idx = row.cells.index(cell) if cell.col_span > 1 and (cell is row.cells[-1] or not isinstance(row.cells[idx+1], SpannedCell)): - row.cells[idx:idx+1] = [cell] + [SpannedCell(cell, horizontal=True) for i in xrange(1, cell.col_span)] + row.cells[idx:idx+1] = [cell] + [SpannedCell(cell, horizontal=True) for i in range(1, cell.col_span)] # Expand vertically for r, row in enumerate(self.rows): @@ -322,7 +323,7 @@ class Table(object): except Exception: tcell = None if tcell is None: - nrow.cells.extend([SpannedCell(nrow.cells[-1], horizontal=True) for i in xrange(idx - len(nrow.cells))]) + nrow.cells.extend([SpannedCell(nrow.cells[-1], horizontal=True) for i in range(idx - len(nrow.cells))]) nrow.cells.append(sc) else: if isinstance(tcell, SpannedCell): diff --git a/src/calibre/ebooks/lrf/html/table.py b/src/calibre/ebooks/lrf/html/table.py index 6d0485d82f..cc62744954 100644 --- a/src/calibre/ebooks/lrf/html/table.py +++ b/src/calibre/ebooks/lrf/html/table.py @@ -7,7 +7,7 @@ from calibre.ebooks.lrf.fonts import get_font from calibre.ebooks.lrf.pylrs.pylrs import TextBlock, Text, CR, Span, \ CharButton, Plot, Paragraph, \ LrsTextTag -from polyglot.builtins import string_or_bytes +from polyglot.builtins import string_or_bytes, range def ceil(num): @@ -315,7 +315,7 @@ class Table(object): Return widths of columns + self.colpad ''' rows, cols = self.number_or_rows(), self.number_of_columns() - widths = range(cols) + widths = list(range(cols)) for c in range(cols): cellwidths = [0 for i in range(rows)] for r in range(rows): @@ -325,8 +325,8 @@ class Table(object): continue widths[c] = max(cellwidths) - min_widths = [self.minimum_width(i)+10 for i in xrange(cols)] - for i in xrange(len(widths)): + min_widths = [self.minimum_width(i)+10 for i in range(cols)] + for i in range(len(widths)): wp = self.width_percent(i) if wp >= 0.: widths[i] = max(min_widths[i], ceil((wp/100.) * (maxwidth - (cols-1)*self.colpad))) diff --git a/src/calibre/ebooks/pdb/ereader/__init__.py b/src/calibre/ebooks/pdb/ereader/__init__.py index f8c4f7b04b..757322a067 100644 --- a/src/calibre/ebooks/pdb/ereader/__init__.py +++ b/src/calibre/ebooks/pdb/ereader/__init__.py @@ -5,6 +5,7 @@ __copyright__ = '2009, John Schember ' __docformat__ = 'restructuredtext en' import os +from polyglot.builtins import range class EreaderError(Exception): @@ -21,10 +22,9 @@ def image_name(name, taken_names=[]): name = '%s%s.png' % (names, namee) while name in taken_names: - for i in xrange(999999999999999999999999999): + for i in range(999999999999999999999999999): name = '%s%s.png' % (name[:-len('%s' % i)], i) name = name.ljust(32, '\x00')[:32] return name - diff --git a/src/calibre/ebooks/pdb/pdf/reader.py b/src/calibre/ebooks/pdb/pdf/reader.py index 71153add6f..4f166397c4 100644 --- a/src/calibre/ebooks/pdb/pdf/reader.py +++ b/src/calibre/ebooks/pdb/pdf/reader.py @@ -11,6 +11,7 @@ __docformat__ = 'restructuredtext en' from calibre.ebooks.pdb.formatreader import FormatReader from calibre.ptempfile import PersistentTemporaryFile +from polyglot.builtins import range class Reader(FormatReader): @@ -27,7 +28,7 @@ class Reader(FormatReader): pdf = PersistentTemporaryFile('.pdf') pdf.close() pdf = open(pdf, 'wb') - for x in xrange(self.header.section_count()): + for x in range(self.header.section_count()): pdf.write(self.header.section_data(x)) pdf.close() diff --git a/src/calibre/ebooks/pdb/plucker/reader.py b/src/calibre/ebooks/pdb/plucker/reader.py index 9a0d3a0180..82977b5f7b 100644 --- a/src/calibre/ebooks/pdb/plucker/reader.py +++ b/src/calibre/ebooks/pdb/plucker/reader.py @@ -17,7 +17,7 @@ from calibre.ebooks.pdb.formatreader import FormatReader from calibre.ebooks.compression.palmdoc import decompress_doc from calibre.utils.imghdr import identify from calibre.utils.img import save_cover_data_to, Canvas, image_from_data -from polyglot.builtins import codepoint_to_chr +from polyglot.builtins import codepoint_to_chr, range DATATYPE_PHTML = 0 DATATYPE_PHTML_COMPRESSED = 1 @@ -129,7 +129,7 @@ class HeaderRecord(object): self.home_html = None self.reserved = {} - for i in xrange(self.records): + for i in range(self.records): adv = 4*i name, = struct.unpack('>H', raw[6+adv:8+adv]) id, = struct.unpack('>H', raw[8+adv:10+adv]) @@ -166,7 +166,7 @@ class SectionHeaderText(object): # Paragraph attributes. self.attributes = [] - for i in xrange(section_header.paragraphs): + for i in range(section_header.paragraphs): adv = 4*i self.sizes.append(struct.unpack('>H', raw[adv:2+adv])[0]) self.attributes.append(struct.unpack('>H', raw[2+adv:4+adv])[0]) @@ -200,7 +200,7 @@ class SectionMetadata(object): record_count, = struct.unpack('>H', raw[0:2]) adv = 0 - for i in xrange(record_count): + for i in range(record_count): try: type, length = struct.unpack_from('>HH', raw, 2 + adv) except struct.error: @@ -213,7 +213,7 @@ class SectionMetadata(object): # ExceptionalCharSets elif type == 2: ii_adv = 0 - for ii in xrange(length / 2): + for ii in range(length / 2): uid, = struct.unpack('>H', raw[6+adv+ii_adv:8+adv+ii_adv]) mib, = struct.unpack('>H', raw[8+adv+ii_adv:10+adv+ii_adv]) self.exceptional_uid_encodings[uid] = MIBNUM_TO_NAME.get(mib, 'latin-1') @@ -270,9 +270,9 @@ class SectionCompositeImage(object): # to an image record. self.layout = [] offset = 4 - for i in xrange(self.rows): + for i in range(self.rows): col = [] - for j in xrange(self.columns): + for j in range(self.columns): col.append(struct.unpack('>H', raw[offset:offset+2])[0]) offset += 2 self.layout.append(col) diff --git a/src/calibre/ebooks/pdf/render/gradients.py b/src/calibre/ebooks/pdf/render/gradients.py index 6a51f5c111..f4baa5ab5b 100644 --- a/src/calibre/ebooks/pdf/render/gradients.py +++ b/src/calibre/ebooks/pdf/render/gradients.py @@ -8,7 +8,7 @@ __copyright__ = '2013, Kovid Goyal ' __docformat__ = 'restructuredtext en' import sys, copy -from polyglot.builtins import map +from polyglot.builtins import map, range from collections import namedtuple from PyQt5.Qt import QLinearGradient, QPointF @@ -111,7 +111,7 @@ class LinearGradientPattern(Dictionary): do_reflect = spread == gradient.ReflectSpread totl = abs(stops[-1][0] - stops[0][0]) intervals = [abs(stops[i+1][0] - stops[i][0])/totl - for i in xrange(len(stops)-1)] + for i in range(len(stops)-1)] while in_page(llimit): reflect ^= True @@ -139,14 +139,14 @@ class LinearGradientPattern(Dictionary): intervals = [i*rlen for i in intervals] rintervals = list(reversed(intervals)) - for i in xrange(num): + for i in range(num): reflect ^= True pos = i * len(base_stops) tvals = [t] for ival in (rintervals if reflect and do_reflect else intervals): tvals.append(tvals[-1] + ival) - for j in xrange(len(base_stops)): + for j in range(len(base_stops)): stops[pos+j][0] = tvals[j] t = tvals[-1] diff --git a/src/calibre/ebooks/pdf/render/test.py b/src/calibre/ebooks/pdf/render/test.py index da283f785c..829036b235 100644 --- a/src/calibre/ebooks/pdf/render/test.py +++ b/src/calibre/ebooks/pdf/render/test.py @@ -15,6 +15,7 @@ from PyQt5.Qt import (QBrush, QColor, QPoint, QPixmap, QPainterPath, QRectF, QBrush, QColor, QPoint, QPixmap, QPainterPath, QRectF, Qt, QPointF from calibre.ebooks.pdf.render.engine import PdfDevice +from polyglot.builtins import range def full(p, xmax, ymax): @@ -25,7 +26,7 @@ def full(p, xmax, ymax): pp.addRect(0, 0, xmax, ymax) p.drawPath(pp) p.save() - for i in xrange(3): + for i in range(3): col = [0, 0, 0, 200] col[i] = 255 p.setOpacity(0.3) diff --git a/src/calibre/ebooks/pdf/render/toc.py b/src/calibre/ebooks/pdf/render/toc.py index 51faf445db..6e275aaf69 100644 --- a/src/calibre/ebooks/pdf/render/toc.py +++ b/src/calibre/ebooks/pdf/render/toc.py @@ -10,6 +10,7 @@ import os from lxml.html import tostring from lxml.html.builder import (HTML, HEAD, BODY, TABLE, TR, TD, H2, STYLE) +from polyglot.builtins import range def calculate_page_number(num, map_expression, evaljs): @@ -49,7 +50,7 @@ def process_children(toc, table, level, pdf, pdf_page_number_map, evaljs): def toc_as_html(toc, pdf, opts, evaljs): pdf = pdf.engine.pdf indents = [] - for i in xrange(1, 7): + for i in range(1, 7): indents.extend((i, 1.4*i)) html = HTML( HEAD( diff --git a/src/calibre/ebooks/unihandecode/pykakasi/h2a.py b/src/calibre/ebooks/unihandecode/pykakasi/h2a.py index ad42edba39..409a110093 100644 --- a/src/calibre/ebooks/unihandecode/pykakasi/h2a.py +++ b/src/calibre/ebooks/unihandecode/pykakasi/h2a.py @@ -21,6 +21,8 @@ # * # */ +from polyglot.builtins import range + class H2a (object): @@ -79,7 +81,7 @@ class H2a (object): u"\u3063\u3058\u3085":"jju", u"\u3063\u3058\u3087":"jjo", u"\u3063\u3059":"ssu", u"\u3063\u305a":"zzu", u"\u3063\u305b":"sse", u"\u3063\u305e":"zze", - u"\u3063\u305d":"sso", u"\u3063\u305e":"zzo", + u"\u3063\u305d":"sso", u"\u3063\u305c":"zzo", u"\u3063\u305f":"tta", u"\u3063\u3060":"dda", u"\u3063\u3061":"tchi", u"\u3063\u3061\u3083":"tcha", u"\u3063\u3061\u3085":"tchu", u"\u3063\u3061\u3087":"tcho", @@ -173,10 +175,9 @@ class H2a (object): Hstr = "" max_len = -1 r = min(4, len(text)+1) - for x in xrange(r): + for x in range(r): if text[:x] in self.H2a_table: if max_len < x: max_len = x Hstr = self.H2a_table[text[:x]] return (Hstr, max_len) - diff --git a/src/calibre/ebooks/unihandecode/pykakasi/k2a.py b/src/calibre/ebooks/unihandecode/pykakasi/k2a.py index 63a564b9c8..7650199128 100644 --- a/src/calibre/ebooks/unihandecode/pykakasi/k2a.py +++ b/src/calibre/ebooks/unihandecode/pykakasi/k2a.py @@ -22,6 +22,7 @@ # */ from calibre.ebooks.unihandecode.pykakasi.jisyo import jisyo +from polyglot.builtins import range class K2a (object): @@ -38,10 +39,9 @@ class K2a (object): Hstr = "" max_len = -1 r = min(10, len(text)+1) - for x in xrange(r): + for x in range(r): if text[:x] in self.kanwa.kanadict: if max_len < x: max_len = x Hstr = self.kanwa.kanadict[text[:x]] return (Hstr, max_len) - diff --git a/src/calibre/gui2/actions/add.py b/src/calibre/gui2/actions/add.py index 28f45282f0..9b8575bd63 100644 --- a/src/calibre/gui2/actions/add.py +++ b/src/calibre/gui2/actions/add.py @@ -25,7 +25,7 @@ from calibre.gui2.actions import InterfaceAction from calibre.gui2 import question_dialog from calibre.ebooks.metadata import MetaInformation from calibre.ptempfile import PersistentTemporaryFile -from polyglot.builtins import string_or_bytes +from polyglot.builtins import string_or_bytes, range def get_filters(): @@ -311,7 +311,7 @@ class AddAction(InterfaceAction): book_id = db.id(index.row()) orig_fmts = tuple(db.new_api.format(book_id, fmt, as_path=True) for fmt in db.new_api.formats(book_id)) - for x in xrange(num): + for x in range(num): if dlg.duplicate_current_book: mi = origmi else: diff --git a/src/calibre/gui2/actions/annotate.py b/src/calibre/gui2/actions/annotate.py index 33103016df..b0d00e91c6 100644 --- a/src/calibre/gui2/actions/annotate.py +++ b/src/calibre/gui2/actions/annotate.py @@ -12,6 +12,7 @@ from calibre.gui2 import error_dialog from calibre.gui2.actions import InterfaceAction from calibre.devices.usbms.device import Device from calibre.gui2.dialogs.progress import ProgressDialog +from polyglot.builtins import range class Updater(QThread): # {{{ @@ -74,7 +75,7 @@ class FetchAnnotationsAction(InterfaceAction): def get_ids_from_selected_rows(): rows = self.gui.library_view.selectionModel().selectedRows() if not rows or len(rows) < 2: - rows = xrange(self.gui.library_view.model().rowCount(QModelIndex())) + rows = range(self.gui.library_view.model().rowCount(QModelIndex())) ids = map(self.gui.library_view.model().id, rows) return ids @@ -160,5 +161,3 @@ class FetchAnnotationsAction(InterfaceAction): _('Could not fetch annotations for some books. Click ' 'show details to see which ones.'), det_msg='\n'.join(entries), show=True) - - diff --git a/src/calibre/gui2/actions/author_mapper.py b/src/calibre/gui2/actions/author_mapper.py index f4134aa0d5..5bbd41cd47 100644 --- a/src/calibre/gui2/actions/author_mapper.py +++ b/src/calibre/gui2/actions/author_mapper.py @@ -8,6 +8,7 @@ from polyglot.builtins import map from calibre.gui2 import gprefs from calibre.gui2.actions import InterfaceAction +from polyglot.builtins import range class AuthorMapAction(InterfaceAction): @@ -24,7 +25,7 @@ class AuthorMapAction(InterfaceAction): selected = True if not rows or len(rows) < 2: selected = False - rows = xrange(self.gui.library_view.model().rowCount(None)) + rows = range(self.gui.library_view.model().rowCount(None)) ids = set(map(self.gui.library_view.model().id, rows)) self.do_map(ids, selected) diff --git a/src/calibre/gui2/actions/choose_library.py b/src/calibre/gui2/actions/choose_library.py index 67581a1077..cf757e17a6 100644 --- a/src/calibre/gui2/actions/choose_library.py +++ b/src/calibre/gui2/actions/choose_library.py @@ -20,7 +20,7 @@ from calibre.utils.icu import sort_key from calibre.gui2 import (gprefs, warning_dialog, Dispatcher, error_dialog, question_dialog, info_dialog, open_local_file, choose_dir) from calibre.gui2.actions import InterfaceAction -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range def db_class(): @@ -593,7 +593,7 @@ class ChooseLibraryAction(InterfaceAction): import gc from calibre.utils.mem import memory ref = self.dbref - for i in xrange(3): + for i in range(3): gc.collect() if ref() is not None: print('DB object alive:', ref()) diff --git a/src/calibre/gui2/actions/tag_mapper.py b/src/calibre/gui2/actions/tag_mapper.py index b5cef2e748..9830903c09 100644 --- a/src/calibre/gui2/actions/tag_mapper.py +++ b/src/calibre/gui2/actions/tag_mapper.py @@ -4,7 +4,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) -from polyglot.builtins import map +from polyglot.builtins import map, range from calibre.gui2 import gprefs from calibre.gui2.actions import InterfaceAction @@ -24,7 +24,7 @@ class TagMapAction(InterfaceAction): selected = True if not rows or len(rows) < 2: selected = False - rows = xrange(self.gui.library_view.model().rowCount(None)) + rows = range(self.gui.library_view.model().rowCount(None)) ids = set(map(self.gui.library_view.model().id, rows)) self.do_map(ids, selected) diff --git a/src/calibre/gui2/library/alternate_views.py b/src/calibre/gui2/library/alternate_views.py index fe7246068f..1f11a5d84c 100644 --- a/src/calibre/gui2/library/alternate_views.py +++ b/src/calibre/gui2/library/alternate_views.py @@ -30,7 +30,7 @@ from calibre.gui2 import gprefs, config, rating_font, empty_index from calibre.gui2.gestures import GestureManager from calibre.gui2.library.caches import CoverCache, ThumbnailCache from calibre.utils.config import prefs, tweaks -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range CM_TO_INCH = 0.393701 CACHE_FORMAT = 'PPM' @@ -740,8 +740,8 @@ class GridView(QListView): @property def first_visible_row(self): geom = self.viewport().geometry() - for y in xrange(geom.top(), (self.spacing()*2) + geom.top(), 5): - for x in xrange(geom.left(), (self.spacing()*2) + geom.left(), 5): + for y in range(geom.top(), (self.spacing()*2) + geom.top(), 5): + for x in range(geom.left(), (self.spacing()*2) + geom.left(), 5): ans = self.indexAt(QPoint(x, y)).row() if ans > -1: return ans @@ -749,8 +749,8 @@ class GridView(QListView): @property def last_visible_row(self): geom = self.viewport().geometry() - for y in xrange(geom.bottom(), geom.bottom() - 2 * self.spacing(), -5): - for x in xrange(geom.left(), (self.spacing()*2) + geom.left(), 5): + for y in range(geom.bottom(), geom.bottom() - 2 * self.spacing(), -5): + for x in range(geom.left(), (self.spacing()*2) + geom.left(), 5): ans = self.indexAt(QPoint(x, y)).row() if ans > -1: item_width = self.delegate.item_size.width() + 2*self.spacing() @@ -760,7 +760,7 @@ class GridView(QListView): self.ignore_render_requests.clear() self.update_timer.stop() m = self.model() - for r in xrange(self.first_visible_row or 0, self.last_visible_row or (m.count() - 1)): + for r in range(self.first_visible_row or 0, self.last_visible_row or (m.count() - 1)): self.update(m.index(r, 0)) def start_view_animation(self, index): diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 49c6df478e..9f5a37d84f 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -30,7 +30,7 @@ from calibre.constants import filesystem_encoding, DEBUG, config_dir from calibre.gui2.library import DEFAULT_SORT from calibre.utils.localization import calibre_langcode_to_name from calibre.library.coloring import color_row_key -from polyglot.builtins import unicode_type, string_or_bytes +from polyglot.builtins import unicode_type, string_or_bytes, range Counts = namedtuple('Counts', 'library_total total current') @@ -263,7 +263,7 @@ class BooksModel(QAbstractTableModel): # {{{ if alignment != 'left': self.alignment_map[colname] = alignment col = self.column_map.index(colname) - for row in xrange(self.rowCount(QModelIndex())): + for row in range(self.rowCount(QModelIndex())): self.dataChanged.emit(self.index(row, col), self.index(row, col)) @@ -278,7 +278,7 @@ class BooksModel(QAbstractTableModel): # {{{ old[colname] = font_type self.db.new_api.set_pref('styled_columns', old) col = self.column_map.index(colname) - for row in xrange(self.rowCount(QModelIndex())): + for row in range(self.rowCount(QModelIndex())): self.dataChanged.emit(self.index(row, col), self.index(row, col)) diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index 484084094f..57c31b6c4d 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en' import itertools, operator from functools import partial -from polyglot.builtins import map, unicode_type +from polyglot.builtins import map, unicode_type, range from collections import OrderedDict from PyQt5.Qt import ( @@ -688,7 +688,7 @@ class BooksView(QTableView): # {{{ # Because of a bug in Qt 5 we have to ensure that the header is actually # relaid out by changing this value, without this sometimes ghost # columns remain visible when changing libraries - for i in xrange(h.count()): + for i in range(h.count()): val = h.isSectionHidden(i) h.setSectionHidden(i, not val) h.setSectionHidden(i, val) @@ -967,7 +967,7 @@ class BooksView(QTableView): # {{{ @property def visible_columns(self): h = self.horizontalHeader() - logical_indices = (x for x in xrange(h.count()) if not h.isSectionHidden(x)) + logical_indices = (x for x in range(h.count()) if not h.isSectionHidden(x)) rmap = {i:x for i, x in enumerate(self.column_map)} return (rmap[h.visualIndex(x)] for x in logical_indices if h.visualIndex(x) > -1) @@ -1108,7 +1108,7 @@ class BooksView(QTableView): # {{{ row_map = OrderedDict() ids = frozenset(ids) m = self.model() - for row in xrange(m.rowCount(QModelIndex())): + for row in range(m.rowCount(QModelIndex())): if len(row_map) >= len(ids): break c = m.id(row) @@ -1128,7 +1128,7 @@ class BooksView(QTableView): # {{{ rows = set([]) identifiers = set(identifiers) m = self.model() - for row in xrange(m.rowCount(QModelIndex())): + for row in range(m.rowCount(QModelIndex())): if m.id(row) in identifiers: rows.add(row) rows = list(sorted(rows)) @@ -1174,7 +1174,7 @@ class BooksView(QTableView): # {{{ if val is None: return m = self.model() - for row in xrange(m.rowCount(QModelIndex())): + for row in range(m.rowCount(QModelIndex())): if m.id(row) == val: self.set_current_row(row, select=False) break @@ -1193,7 +1193,7 @@ class BooksView(QTableView): # {{{ i.isValid()]) column = ci.column() - for i in xrange(ci.row()+1, self.row_count()): + for i in range(ci.row()+1, self.row_count()): if i in selected_rows: continue try: @@ -1202,7 +1202,7 @@ class BooksView(QTableView): # {{{ pass # No unselected rows after the current row, look before - for i in xrange(ci.row()-1, -1, -1): + for i in range(ci.row()-1, -1, -1): if i in selected_rows: continue try: diff --git a/src/calibre/gui2/preferences/ignored_devices.py b/src/calibre/gui2/preferences/ignored_devices.py index 5cb9820259..b0ecce5bcd 100644 --- a/src/calibre/gui2/preferences/ignored_devices.py +++ b/src/calibre/gui2/preferences/ignored_devices.py @@ -12,6 +12,7 @@ from PyQt5.Qt import (QLabel, QVBoxLayout, QListWidget, QListWidgetItem, Qt, from calibre.customize.ui import enable_plugin from calibre.gui2.preferences import ConfigWidgetBase, test_widget +from polyglot.builtins import range class ConfigWidget(ConfigWidgetBase): @@ -78,7 +79,7 @@ class ConfigWidget(ConfigWidgetBase): def commit(self): devs = {} - for i in xrange(0, self.devices.count()): + for i in range(0, self.devices.count()): e = self.devices.item(i) dev, uid = e.data(Qt.UserRole) if dev not in devs: @@ -89,7 +90,7 @@ class ConfigWidget(ConfigWidgetBase): for dev, bl in devs.iteritems(): dev.set_user_blacklisted_devices(bl) - for i in xrange(self.device_plugins.count()): + for i in range(self.device_plugins.count()): e = self.device_plugins.item(i) dev = e.data(Qt.UserRole) if e.checkState() == Qt.Unchecked: @@ -97,8 +98,8 @@ class ConfigWidget(ConfigWidgetBase): return True # Restart required + if __name__ == '__main__': from PyQt5.Qt import QApplication app = QApplication([]) test_widget('Sharing', 'Ignored Devices') - diff --git a/src/calibre/gui2/preferences/texture_chooser.py b/src/calibre/gui2/preferences/texture_chooser.py index fa45a7b94c..48b65323ce 100644 --- a/src/calibre/gui2/preferences/texture_chooser.py +++ b/src/calibre/gui2/preferences/texture_chooser.py @@ -15,7 +15,7 @@ from PyQt5.Qt import ( from calibre.constants import config_dir from calibre.gui2 import choose_files, error_dialog from calibre.utils.icu import sort_key -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range def texture_dir(): @@ -85,7 +85,7 @@ class TextureChooser(QDialog): self.update_remove_state() if initial: - existing = {unicode_type(i.data(Qt.UserRole) or ''):i for i in (self.images.item(c) for c in xrange(self.images.count()))} + existing = {unicode_type(i.data(Qt.UserRole) or ''):i for i in (self.images.item(c) for c in range(self.images.count()))} item = existing.get(initial, None) if item is not None: item.setSelected(True) @@ -116,7 +116,7 @@ class TextureChooser(QDialog): path = path[0] fname = os.path.basename(path) name = fname.rpartition('.')[0] - existing = {unicode_type(i.data(Qt.UserRole) or ''):i for i in (self.images.item(c) for c in xrange(self.images.count()))} + existing = {unicode_type(i.data(Qt.UserRole) or ''):i for i in (self.images.item(c) for c in range(self.images.count()))} dest = os.path.join(self.tdir, fname) with open(path, 'rb') as s, open(dest, 'wb') as f: shutil.copyfileobj(s, f) diff --git a/src/calibre/gui2/preferences/tweaks.py b/src/calibre/gui2/preferences/tweaks.py index 61e1a2d7b4..ecff365aaa 100644 --- a/src/calibre/gui2/preferences/tweaks.py +++ b/src/calibre/gui2/preferences/tweaks.py @@ -19,7 +19,7 @@ from calibre import isbytestring from calibre.utils.icu import lower from calibre.utils.search_query_parser import (ParseException, SearchQueryParser) -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range from PyQt5.Qt import ( QAbstractListModel, Qt, QStyledItemDelegate, QStyle, QStyleOptionViewItem, @@ -282,7 +282,7 @@ class Tweaks(QAbstractListModel, AdaptSQP): # {{{ self.plugin_tweaks = d def universal_set(self): - return set(xrange(self.rowCount())) + return set(range(self.rowCount())) def get_matches(self, location, query, candidates=None): if candidates is None: diff --git a/src/calibre/gui2/tag_browser/model.py b/src/calibre/gui2/tag_browser/model.py index a50dcfbed0..4415b372ea 100644 --- a/src/calibre/gui2/tag_browser/model.py +++ b/src/calibre/gui2/tag_browser/model.py @@ -23,6 +23,7 @@ from calibre.utils.icu import sort_key, lower, strcmp, collation_order, primary_ from calibre.library.field_metadata import category_icon_map from calibre.gui2.dialogs.confirm_delete import confirm from calibre.utils.formatter import EvalFormatter +from polyglot.builtins import range TAG_SEARCH_STATES = {'clear': 0, 'mark_plus': 1, 'mark_plusplus': 2, 'mark_minus': 3, 'mark_minusminus': 4} @@ -1492,7 +1493,7 @@ class TagsModel(QAbstractItemModel): # {{{ if path[depth] > start_path[depth]: start_path = path my_key = self.get_node(category_index).category_key - for j in xrange(self.rowCount(category_index)): + for j in range(self.rowCount(category_index)): tag_index = self.index(j, 0, category_index) tag_item = self.get_node(tag_index) if tag_item.type == TagTreeItem.CATEGORY: @@ -1503,7 +1504,7 @@ class TagsModel(QAbstractItemModel): # {{{ return True return False - for i in xrange(self.rowCount(QModelIndex())): + for i in range(self.rowCount(QModelIndex())): if process_level(0, self.index(i, 0, QModelIndex()), start_path): break return self.path_found @@ -1517,7 +1518,7 @@ class TagsModel(QAbstractItemModel): # {{{ if not key: return None - for i in xrange(self.rowCount(parent)): + for i in range(self.rowCount(parent)): idx = self.index(i, 0, parent) node = self.get_node(idx) if node.type == TagTreeItem.CATEGORY: @@ -1547,7 +1548,7 @@ class TagsModel(QAbstractItemModel): # {{{ process_tag(self.index(i, 0, tag_index), c) def process_level(category_index): - for j in xrange(self.rowCount(category_index)): + for j in range(self.rowCount(category_index)): tag_index = self.index(j, 0, category_index) tag_item = self.get_node(tag_index) if tag_item.boxed: @@ -1558,7 +1559,7 @@ class TagsModel(QAbstractItemModel): # {{{ else: process_tag(tag_index, tag_item) - for i in xrange(self.rowCount(QModelIndex())): + for i in range(self.rowCount(QModelIndex())): process_level(self.index(i, 0, QModelIndex())) # }}} diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index 9e74fc44d4..49a064257e 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -24,7 +24,7 @@ from calibre.gui2.tag_browser.model import (TagTreeItem, TAG_SEARCH_STATES, TagsModel, DRAG_IMAGE_ROLE, COUNT_ROLE) from calibre.gui2 import config, gprefs, choose_files, pixmap_to_data, rating_font, empty_index from calibre.utils.icu import sort_key -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class TagDelegate(QStyledItemDelegate): # {{{ @@ -723,7 +723,7 @@ class TagsView(QTreeView): # {{{ if not index.isValid(): return self.expand(index) - for r in xrange(self.model().rowCount(index)): + for r in range(self.model().rowCount(index)): self.expand_node_and_descendants(index.child(r, 0)) def collapse_menu_hovered(self, action): From 9cf2e2f671bffaba0a4f23f65254c98aebcc0f16 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Mar 2019 18:44:05 +0530 Subject: [PATCH 0311/2613] Finish getting rid of xrange --- src/calibre/ebooks/lit/maps/opf.py | 4 +++- src/calibre/ebooks/mobi/debug/headers.py | 9 ++++----- src/calibre/ebooks/mobi/debug/index.py | 5 +++-- src/calibre/ebooks/mobi/debug/mobi6.py | 10 +++++----- src/calibre/ebooks/mobi/reader/index.py | 16 +++++++-------- src/calibre/ebooks/mobi/reader/markup.py | 20 +++++++++---------- src/calibre/ebooks/mobi/reader/mobi6.py | 8 ++++---- src/calibre/ebooks/mobi/reader/mobi8.py | 5 +++-- src/calibre/ebooks/mobi/writer2/indexer.py | 5 ++--- src/calibre/ebooks/mobi/writer2/main.py | 6 +++--- src/calibre/ebooks/mobi/writer8/index.py | 4 ++-- src/calibre/ebooks/oeb/polish/check/base.py | 4 ++-- src/calibre/ebooks/oeb/polish/check/links.py | 3 ++- src/calibre/ebooks/oeb/polish/images.py | 3 ++- src/calibre/ebooks/oeb/polish/split.py | 4 ++-- src/calibre/ebooks/oeb/polish/stats.py | 5 +++-- .../ebooks/oeb/polish/tests/parsing.py | 3 ++- src/calibre/ebooks/oeb/transforms/split.py | 4 ++-- src/calibre/ebooks/oeb/transforms/subset.py | 6 +++--- .../gui2/store/config/chooser/models.py | 8 ++++---- .../gui2/store/config/chooser/results_view.py | 3 ++- .../gui2/store/search/download_thread.py | 3 ++- src/calibre/gui2/tweak_book/diff/highlight.py | 5 +++-- src/calibre/gui2/tweak_book/diff/view.py | 14 ++++++------- .../gui2/tweak_book/editor/snippets.py | 8 ++++---- src/calibre/gui2/tweak_book/editor/text.py | 4 ++-- src/calibre/gui2/tweak_book/editor/themes.py | 6 +++--- src/calibre/utils/fonts/sfnt/cff/dict_data.py | 5 +++-- src/calibre/utils/fonts/sfnt/cff/table.py | 10 ++++------ src/calibre/utils/fonts/sfnt/cff/writer.py | 5 ++--- src/calibre/utils/fonts/sfnt/cmap.py | 14 ++++++------- src/calibre/utils/fonts/sfnt/common.py | 11 +++++----- src/calibre/utils/fonts/sfnt/kern.py | 6 +++--- src/calibre/utils/fonts/sfnt/loca.py | 7 +++---- src/calibre/utils/fonts/sfnt/subset.py | 8 ++++---- 35 files changed, 124 insertions(+), 117 deletions(-) diff --git a/src/calibre/ebooks/lit/maps/opf.py b/src/calibre/ebooks/lit/maps/opf.py index 8b8a1f5169..12dcaed4d8 100644 --- a/src/calibre/ebooks/lit/maps/opf.py +++ b/src/calibre/ebooks/lit/maps/opf.py @@ -5,6 +5,8 @@ __copyright__ = '2008, Marshall T. Vandegrift ' Microsoft LIT OPF tag and attribute tables, copied from ConvertLIT. """ +from polyglot.builtins import range + TAGS = [ None, "package", @@ -76,6 +78,6 @@ ATTRS = { 0x0016: "xml:lang", } -TAGS_ATTRS = [{} for i in xrange(43)] +TAGS_ATTRS = [{} for i in range(43)] MAP = (TAGS, ATTRS, TAGS_ATTRS) diff --git a/src/calibre/ebooks/mobi/debug/headers.py b/src/calibre/ebooks/mobi/debug/headers.py index 5651f67966..dbf5d97a70 100644 --- a/src/calibre/ebooks/mobi/debug/headers.py +++ b/src/calibre/ebooks/mobi/debug/headers.py @@ -14,6 +14,7 @@ from calibre.ebooks.mobi.reader.headers import NULL_INDEX from calibre.ebooks.mobi.langcodes import main_language, sub_language from calibre.ebooks.mobi.debug import format_bytes from calibre.ebooks.mobi.utils import get_trailing_data +from polyglot.builtins import range # PalmDB {{{ @@ -224,7 +225,7 @@ class EXTHHeader(object): pos = 12 self.records = [] - for i in xrange(self.count): + for i in range(self.count): pos = self.read_record(pos) self.records.sort(key=lambda x:x.type) self.rmap = {x.type:x for x in self.records} @@ -517,7 +518,7 @@ class MOBIFile(object): self.record_headers = [] self.records = [] - for i in xrange(self.palmdb.number_of_records): + for i in range(self.palmdb.number_of_records): pos = 78 + i * 8 offset, a1, a2, a3, a4 = struct.unpack(b'>LBBBB', self.raw[pos:pos+8]) flags, val = a1, a2 << 16 | a3 << 8 | a4 @@ -557,7 +558,7 @@ class MOBIFile(object): from calibre.ebooks.mobi.huffcdic import HuffReader def huffit(off, cnt): - huffman_record_nums = list(xrange(off, off+cnt)) + huffman_record_nums = list(range(off, off+cnt)) huffrecs = [self.records[r].raw for r in huffman_record_nums] huffs = HuffReader(huffrecs) return huffman_record_nums, huffs.unpack @@ -616,5 +617,3 @@ class TextRecord(object): # {{{ return len(self.raw) # }}} - - diff --git a/src/calibre/ebooks/mobi/debug/index.py b/src/calibre/ebooks/mobi/debug/index.py index 42248cfe9a..e0868b9f49 100644 --- a/src/calibre/ebooks/mobi/debug/index.py +++ b/src/calibre/ebooks/mobi/debug/index.py @@ -15,6 +15,7 @@ from calibre.ebooks.mobi.reader.headers import NULL_INDEX from calibre.ebooks.mobi.reader.index import (CNCX, parse_indx_header, parse_tagx_section, parse_index_record, INDEX_HEADER_FIELDS) from calibre.ebooks.mobi.reader.ncx import (tag_fieldname_map, default_entry) +from polyglot.builtins import range File = namedtuple('File', 'file_number name divtbl_count start_position length') @@ -41,7 +42,7 @@ def read_variable_len_data(data, header): tagx_block_size = header['tagx_block_size'] = struct.unpack_from(b'>I', data, offset + 4)[0] header['tagx_block'] = data[offset:offset+tagx_block_size] offset = idxt_offset + 4 - for i in xrange(header['count']): + for i in range(header['count']): p = struct.unpack_from(b'>H', data, offset)[0] offset += 2 strlen = bytearray(data[p])[0] @@ -77,7 +78,7 @@ def read_index(sections, idx, codec): read_variable_len_data(data, indx_header) index_headers = [] - for i in xrange(idx + 1, idx + 1 + indx_count): + for i in range(idx + 1, idx + 1 + indx_count): # Index record data = sections[i].raw index_headers.append(parse_index_record(table, data, control_byte_count, tags, codec, diff --git a/src/calibre/ebooks/mobi/debug/mobi6.py b/src/calibre/ebooks/mobi/debug/mobi6.py index d67244b705..9cd0307045 100644 --- a/src/calibre/ebooks/mobi/debug/mobi6.py +++ b/src/calibre/ebooks/mobi/debug/mobi6.py @@ -20,7 +20,7 @@ from calibre.ebooks.mobi.utils import (decode_hex_number, decint, from calibre.utils.imghdr import what from calibre.ebooks.mobi.debug import format_bytes from calibre.ebooks.mobi.debug.headers import TextRecord -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class TagX(object): # {{{ @@ -744,7 +744,7 @@ class MOBIFile(object): # {{{ self.index_header.index_encoding) self.index_record = IndexRecord(self.records[pir+1:pir+1+numi], self.index_header, self.cncx) - self.indexing_record_nums = set(xrange(pir, + self.indexing_record_nums = set(range(pir, pir+1+numi+self.index_header.num_of_cncx_blocks)) self.secondary_index_record = self.secondary_index_header = None sir = self.mobi_header.secondary_index_record @@ -754,17 +754,17 @@ class MOBIFile(object): # {{{ self.indexing_record_nums.add(sir) self.secondary_index_record = IndexRecord( self.records[sir+1:sir+1+numi], self.secondary_index_header, self.cncx) - self.indexing_record_nums |= set(xrange(sir+1, sir+1+numi)) + self.indexing_record_nums |= set(range(sir+1, sir+1+numi)) ntr = self.mobi_header.number_of_text_records fii = self.mobi_header.first_image_index self.text_records = [TextRecord(r, self.records[r], - self.mobi_header.extra_data_flags, mf.decompress6) for r in xrange(1, + self.mobi_header.extra_data_flags, mf.decompress6) for r in range(1, min(len(self.records), ntr+1))] self.image_records, self.binary_records = [], [] self.font_records = [] image_index = 0 - for i in xrange(self.mobi_header.first_resource_record, min(self.mobi_header.last_resource_record, len(self.records))): + for i in range(self.mobi_header.first_resource_record, min(self.mobi_header.last_resource_record, len(self.records))): if i in self.indexing_record_nums or i in self.huffman_record_nums: continue image_index += 1 diff --git a/src/calibre/ebooks/mobi/reader/index.py b/src/calibre/ebooks/mobi/reader/index.py index 1e9dcebc92..7e15c617ad 100644 --- a/src/calibre/ebooks/mobi/reader/index.py +++ b/src/calibre/ebooks/mobi/reader/index.py @@ -12,13 +12,14 @@ from collections import OrderedDict, namedtuple from calibre.ebooks.mobi.utils import (decint, count_set_bits, decode_string) +from polyglot.builtins import range TagX = namedtuple('TagX', 'tag num_of_values bitmask eof') PTagX = namedtuple('PTagX', 'tag value_count value_bytes num_of_values') INDEX_HEADER_FIELDS = ( 'len', 'nul1', 'type', 'gen', 'start', 'count', 'code', 'lng', 'total', 'ordt', 'ligt', 'nligt', 'ncncx' - ) + tuple('unknown%d'%i for i in xrange(27)) + ('ocnt', 'oentries', + ) + tuple('unknown%d'%i for i in range(27)) + ('ocnt', 'oentries', 'ordt1', 'ordt2', 'tagx') @@ -73,7 +74,7 @@ def parse_indx_header(data): # ascii character. If we cannot, we map to the ? char. parsed = bytearray(ans['oentries']) - for i in xrange(0, 2*ans['oentries'], 2): + for i in range(0, 2*ans['oentries'], 2): parsed[i//2] = raw[i+1] if 0x20 < raw[i+1] < 0x7f else ord(b'?') ans['ordt_map'] = bytes(parsed).decode('ascii') else: @@ -133,7 +134,7 @@ def parse_tagx_section(data): first_entry_offset, = struct.unpack_from(b'>L', data, 4) control_byte_count, = struct.unpack_from(b'>L', data, 8) - for i in xrange(12, first_entry_offset, 4): + for i in range(12, first_entry_offset, 4): vals = list(bytearray(data[i:i+4])) tags.append(TagX(*vals)) return control_byte_count, tags @@ -177,7 +178,7 @@ def get_tag_map(control_byte_count, tagx, data, strict=False): values = [] if x.value_count is not None: # Read value_count * values_per_entry variable width values. - for _ in xrange(x.value_count * x.num_of_values): + for _ in range(x.value_count * x.num_of_values): byts, consumed = decint(data) data = data[consumed:] values.append(byts) @@ -220,7 +221,7 @@ def parse_index_record(table, data, control_byte_count, tags, codec, # loop through to build up the IDXT position starts idx_positions= [] - for j in xrange(entry_count): + for j in range(entry_count): pos, = struct.unpack_from(b'>H', data, idxt_pos + 4 + (2 * j)) idx_positions.append(pos) # The last entry ends before the IDXT tag (but there might be zero fill @@ -229,7 +230,7 @@ def parse_index_record(table, data, control_byte_count, tags, codec, # For each entry in the IDXT build up the tag map and any associated # text - for j in xrange(entry_count): + for j in range(entry_count): start, end = idx_positions[j:j+2] rec = data[start:end] # Sometimes (in the guide table if the type attribute has non ascii @@ -266,10 +267,9 @@ def read_index(sections, idx, codec): tag_section_start = indx_header['tagx'] control_byte_count, tags = parse_tagx_section(data[tag_section_start:]) - for i in xrange(idx + 1, idx + 1 + indx_count): + for i in range(idx + 1, idx + 1 + indx_count): # Index record data = sections[i][0] parse_index_record(table, data, control_byte_count, tags, codec, indx_header['ordt_map']) return table, cncx - diff --git a/src/calibre/ebooks/mobi/reader/markup.py b/src/calibre/ebooks/mobi/reader/markup.py index a40b27838f..c7961502e3 100644 --- a/src/calibre/ebooks/mobi/reader/markup.py +++ b/src/calibre/ebooks/mobi/reader/markup.py @@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en' import re, os from calibre.ebooks.chardet import strip_encoding_declarations -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range def update_internal_links(mobi8_reader, log): @@ -31,7 +31,7 @@ def update_internal_links(mobi8_reader, log): parts = [] for part in mr.parts: srcpieces = posfid_pattern.split(part) - for j in xrange(1, len(srcpieces), 2): + for j in range(1, len(srcpieces), 2): tag = srcpieces[j] if tag.startswith(b'<'): for m in posfid_index_pattern.finditer(tag): @@ -69,7 +69,7 @@ def remove_kindlegen_markup(parts, aid_anchor_suffix, linked_aids): re.IGNORECASE) within_tag_aid_position_pattern = re.compile(r'''\s[ac]id\s*=['"]([^'"]*)['"]''') - for i in xrange(len(parts)): + for i in range(len(parts)): part = parts[i] srcpieces = find_tag_with_aid_pattern.split(part) for j in range(len(srcpieces)): @@ -95,7 +95,7 @@ def remove_kindlegen_markup(parts, aid_anchor_suffix, linked_aids): within_tag_AmznPageBreak_position_pattern = re.compile( r'''\sdata-AmznPageBreak=['"]([^'"]*)['"]''') - for i in xrange(len(parts)): + for i in range(len(parts)): part = parts[i] srcpieces = find_tag_with_AmznPageBreak_pattern.split(part) for j in range(len(srcpieces)): @@ -229,7 +229,7 @@ def insert_flows_into_markup(parts, flows, mobi8_reader, log): # kindle:flow:XXXX?mime=YYYY/ZZZ (used for style sheets, svg images, etc) tag_pattern = re.compile(r'''(<[^>]*>)''') flow_pattern = re.compile(r'''['"]kindle:flow:([0-9|A-V]+)\?mime=([^'"]+)['"]''', re.IGNORECASE) - for i in xrange(len(parts)): + for i in range(len(parts)): part = parts[i] # flow pattern @@ -265,10 +265,10 @@ def insert_images_into_markup(parts, resource_map, log): style_pattern = re.compile(r'''(<[a-zA-Z0-9]+\s[^>]*style\s*=\s*[^>]*>)''', re.IGNORECASE) - for i in xrange(len(parts)): + for i in range(len(parts)): part = parts[i] srcpieces = img_pattern.split(part) - for j in xrange(1, len(srcpieces), 2): + for j in range(1, len(srcpieces), 2): tag = srcpieces[j] if tag.startswith(']*>)''', re.IGNORECASE) - for i in xrange(len(parts)): + for i in range(len(parts)): part = parts[i] # tag pattern diff --git a/src/calibre/ebooks/mobi/reader/mobi6.py b/src/calibre/ebooks/mobi/reader/mobi6.py index 5f309dd364..cc04f75d79 100644 --- a/src/calibre/ebooks/mobi/reader/mobi6.py +++ b/src/calibre/ebooks/mobi/reader/mobi6.py @@ -23,7 +23,7 @@ from calibre.ebooks.metadata.toc import TOC from calibre.ebooks.mobi.reader.headers import BookHeader from calibre.utils.img import save_cover_data_to from calibre.utils.imghdr import what -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class TopazError(ValueError): @@ -784,7 +784,7 @@ class MobiReader(object): def extract_text(self, offset=1): self.log.debug('Extracting text...') - text_sections = [self.text_section(i) for i in xrange(offset, + text_sections = [self.text_section(i) for i in range(offset, min(self.book_header.records + offset, len(self.sections)))] processed_records = list(range(offset-1, self.book_header.records + offset)) @@ -793,9 +793,9 @@ class MobiReader(object): if self.book_header.compression_type == 'DH': huffs = [self.sections[i][0] for i in - xrange(self.book_header.huff_offset, + range(self.book_header.huff_offset, self.book_header.huff_offset + self.book_header.huff_number)] - processed_records += list(xrange(self.book_header.huff_offset, + processed_records += list(range(self.book_header.huff_offset, self.book_header.huff_offset + self.book_header.huff_number)) huff = HuffReader(huffs) unpack = huff.unpack diff --git a/src/calibre/ebooks/mobi/reader/mobi8.py b/src/calibre/ebooks/mobi/reader/mobi8.py index ab47678f23..7d4aca3cc9 100644 --- a/src/calibre/ebooks/mobi/reader/mobi8.py +++ b/src/calibre/ebooks/mobi/reader/mobi8.py @@ -25,6 +25,7 @@ from calibre.ebooks.metadata.toc import TOC from calibre.ebooks.mobi.utils import read_font_record from calibre.ebooks.oeb.parse_utils import parse_html from calibre.ebooks.oeb.base import XPath, XHTML, xml2text +from polyglot.builtins import range Part = namedtuple('Part', 'num type filename start end aid') @@ -193,7 +194,7 @@ class Mobi8Reader(object): baseptr = skelpos + skellen skeleton = text[skelpos:baseptr] inspos_warned = False - for i in xrange(divcnt): + for i in range(divcnt): insertpos, idtext, filenum, seqnum, startpos, length = \ self.elems[divptr] if i == 0: @@ -253,7 +254,7 @@ class Mobi8Reader(object): self.flowinfo.append(FlowInfo(None, None, None, None)) svg_tag_pattern = re.compile(br'''(]*>)''', re.IGNORECASE) image_tag_pattern = re.compile(br'''(<(?:svg:)?image[^>]*>)''', re.IGNORECASE) - for j in xrange(1, len(self.flows)): + for j in range(1, len(self.flows)): flowpart = self.flows[j] nstr = '%04d' % j m = svg_tag_pattern.search(flowpart) diff --git a/src/calibre/ebooks/mobi/writer2/indexer.py b/src/calibre/ebooks/mobi/writer2/indexer.py index 5e5576db18..7ce7ab7270 100644 --- a/src/calibre/ebooks/mobi/writer2/indexer.py +++ b/src/calibre/ebooks/mobi/writer2/indexer.py @@ -14,6 +14,7 @@ from collections import OrderedDict, defaultdict from calibre.ebooks.mobi.utils import (encint, encode_number_as_hex, encode_tbs, align_block, RECORD_SIZE, CNCX as CNCX_) +from polyglot.builtins import range class CNCX(CNCX_): # {{{ @@ -844,7 +845,7 @@ class Indexer(object): # {{{ deepest = max(i.depth for i in self.indices) - for i in xrange(self.number_of_text_records): + for i in range(self.number_of_text_records): offset = i * RECORD_SIZE next_offset = offset + RECORD_SIZE data = {'ends':[], 'completes':[], 'starts':[], @@ -890,5 +891,3 @@ class Indexer(object): # {{{ # }}} # }}} - - diff --git a/src/calibre/ebooks/mobi/writer2/main.py b/src/calibre/ebooks/mobi/writer2/main.py index 9de6427d68..6fd8739a4c 100644 --- a/src/calibre/ebooks/mobi/writer2/main.py +++ b/src/calibre/ebooks/mobi/writer2/main.py @@ -20,7 +20,7 @@ from calibre.ebooks.mobi.writer2 import (PALMDOC, UNCOMPRESSED) from calibre.ebooks.mobi.utils import (encint, encode_trailing_data, align_block, detect_periodical, RECORD_SIZE, create_text_record) from calibre.ebooks.mobi.writer2.indexer import Indexer -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range # Disabled as I dont care about uncrossable breaks WRITE_UNCROSSABLE_BREAKS = False @@ -106,7 +106,7 @@ class MobiWriter(object): self.log.exception('Failed to generate MOBI index:') else: self.primary_index_record_idx = len(self.records) - for i in xrange(self.last_text_record_idx + 1): + for i in range(self.last_text_record_idx + 1): if i == 0: continue tbs = self.indexer.get_trailing_byte_sequence(i) @@ -125,7 +125,7 @@ class MobiWriter(object): breaks = self.serializer.breaks - for i in xrange(1, self.last_text_record_idx+1): + for i in range(1, self.last_text_record_idx+1): offset = i * RECORD_SIZE pbreak = 0 running = offset diff --git a/src/calibre/ebooks/mobi/writer8/index.py b/src/calibre/ebooks/mobi/writer8/index.py index b97f0051b4..ed7eabbf3f 100644 --- a/src/calibre/ebooks/mobi/writer8/index.py +++ b/src/calibre/ebooks/mobi/writer8/index.py @@ -11,7 +11,7 @@ __docformat__ = 'restructuredtext en' from collections import namedtuple from struct import pack from io import BytesIO -from polyglot.builtins import unicode_type, zip +from polyglot.builtins import unicode_type, zip, range from calibre.ebooks.mobi.utils import CNCX, encint, align_block from calibre.ebooks.mobi.writer8.header import Header @@ -380,7 +380,7 @@ if __name__ == '__main__': # calibre and kindlegen and compare the output import os, subprocess os.chdir('/t') - paras = ['

%d

' % i for i in xrange(4000)] + paras = ['

%d

' % i for i in range(4000)] raw = '' + '\n\n'.join(paras) + '' src = 'index.html' diff --git a/src/calibre/ebooks/oeb/polish/check/base.py b/src/calibre/ebooks/oeb/polish/check/base.py index 39c675f2c0..0b04c08e1b 100644 --- a/src/calibre/ebooks/oeb/polish/check/base.py +++ b/src/calibre/ebooks/oeb/polish/check/base.py @@ -11,8 +11,9 @@ from functools import partial from contextlib import closing from calibre import detect_ncpus as cpu_count +from polyglot.builtins import range -DEBUG, INFO, WARN, ERROR, CRITICAL = xrange(5) +DEBUG, INFO, WARN, ERROR, CRITICAL = range(5) class BaseError(object): @@ -55,4 +56,3 @@ def run_checkers(func, args_list): raise Exception('Failed to run worker: \n%s' % tb) ans.extend(result) return ans - diff --git a/src/calibre/ebooks/oeb/polish/check/links.py b/src/calibre/ebooks/oeb/polish/check/links.py index 8722076947..3656aea5fe 100644 --- a/src/calibre/ebooks/oeb/polish/check/links.py +++ b/src/calibre/ebooks/oeb/polish/check/links.py @@ -21,6 +21,7 @@ from calibre.ebooks.oeb.polish.replace import remove_links_to from calibre.ebooks.oeb.polish.cover import get_raster_cover_name from calibre.ebooks.oeb.polish.utils import guess_type, actual_case_for_name, corrected_case_for_name from calibre.ebooks.oeb.polish.check.base import BaseError, WARN, INFO +from polyglot.builtins import range class BadLink(BaseError): @@ -445,7 +446,7 @@ def check_external_links(container, progress_callback=(lambda num, total:None), done.append(None) progress_callback(len(done), len(external_links)) - workers = [Thread(name="CheckLinks", target=check_links) for i in xrange(min(10, len(external_links)))] + workers = [Thread(name="CheckLinks", target=check_links) for i in range(min(10, len(external_links)))] for w in workers: w.daemon = True w.start() diff --git a/src/calibre/ebooks/oeb/polish/images.py b/src/calibre/ebooks/oeb/polish/images.py index de18909eb0..8ae9f9c413 100644 --- a/src/calibre/ebooks/oeb/polish/images.py +++ b/src/calibre/ebooks/oeb/polish/images.py @@ -10,6 +10,7 @@ from threading import Thread, Event from Queue import Queue, Empty from calibre import detect_ncpus, human_readable, force_unicode, filesystem_encoding +from polyglot.builtins import range class Worker(Thread): @@ -88,7 +89,7 @@ def compress_images(container, report=None, names=None, jpeg_quality=None, progr if not keep_going: abort.set() progress_callback(0, len(images), '') - [Worker(abort, 'CompressImage%d' % i, queue, results, container, jpeg_quality, pc) for i in xrange(min(detect_ncpus(), len(images)))] + [Worker(abort, 'CompressImage%d' % i, queue, results, container, jpeg_quality, pc) for i in range(min(detect_ncpus(), len(images)))] queue.join() before_total = after_total = 0 changed = False diff --git a/src/calibre/ebooks/oeb/polish/split.py b/src/calibre/ebooks/oeb/polish/split.py index fc9f92c600..7b215b43e2 100644 --- a/src/calibre/ebooks/oeb/polish/split.py +++ b/src/calibre/ebooks/oeb/polish/split.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' import copy, os, re -from polyglot.builtins import map, string_or_bytes +from polyglot.builtins import map, string_or_bytes, range from urlparse import urlparse from calibre.ebooks.oeb.base import barename, XPNSMAP, XPath, OPF, XHTML, OEB_DOCS @@ -286,7 +286,7 @@ def multisplit(container, name, xpath, before=True): current = name all_names = [name] - for i in xrange(len(nodes)): + for i in range(len(nodes)): current = split(container, current, '//*[@calibre-split-point="%d"]' % i, before=before) all_names.append(current) diff --git a/src/calibre/ebooks/oeb/polish/stats.py b/src/calibre/ebooks/oeb/polish/stats.py index 4177835eda..45223bc317 100644 --- a/src/calibre/ebooks/oeb/polish/stats.py +++ b/src/calibre/ebooks/oeb/polish/stats.py @@ -18,6 +18,7 @@ from calibre.ebooks.oeb.polish.cascade import iterrules, resolve_styles, iterdec from calibre.utils.icu import ord_string, safe_chr from polyglot.builtins import unicode_type from tinycss.fonts3 import parse_font_family +from polyglot.builtins import range def normalize_font_properties(font): @@ -92,10 +93,10 @@ def get_matching_rules(rules, font): elif fw == 500: q = [500, 400, 300, 200, 100, 600, 700, 800, 900] elif fw < 400: - q = [fw] + list(xrange(fw-100, -100, -100)) + list(xrange(fw+100, + q = [fw] + list(range(fw-100, -100, -100)) + list(range(fw+100, 100, 1000)) else: - q = [fw] + list(xrange(fw+100, 100, 1000)) + list(xrange(fw-100, + q = [fw] + list(range(fw+100, 100, 1000)) + list(range(fw-100, -100, -100)) for wt in q: m = [f for f in matches if f['weight'] == wt] diff --git a/src/calibre/ebooks/oeb/polish/tests/parsing.py b/src/calibre/ebooks/oeb/polish/tests/parsing.py index 43c81550dc..5987821a28 100644 --- a/src/calibre/ebooks/oeb/polish/tests/parsing.py +++ b/src/calibre/ebooks/oeb/polish/tests/parsing.py @@ -15,6 +15,7 @@ from calibre.ebooks.oeb.polish.tests.base import BaseTest from calibre.ebooks.oeb.polish.parsing import parse_html5 as parse from calibre.ebooks.oeb.base import XPath, XHTML_NS, SVG_NS, XLINK_NS from calibre.ebooks.oeb.parse_utils import html5_parse +from polyglot.builtins import range def nonvoid_cdata_elements(test, parse_function): @@ -214,7 +215,7 @@ def timing(): for name, f in (('calibre', partial(parse, line_numbers=False)), ('html5lib', vanilla), ('calibre-old', html5_parse)): timings = [] - for i in xrange(10): + for i in range(10): st = monotonic() f(raw) timings.append(monotonic() - st) diff --git a/src/calibre/ebooks/oeb/transforms/split.py b/src/calibre/ebooks/oeb/transforms/split.py index d58337035c..0c4f6c9ae3 100644 --- a/src/calibre/ebooks/oeb/transforms/split.py +++ b/src/calibre/ebooks/oeb/transforms/split.py @@ -20,7 +20,7 @@ from calibre.ebooks.epub import rules from calibre.ebooks.oeb.base import (OEB_STYLES, XPNSMAP as NAMESPACES, urldefrag, rewrite_links, urlunquote, XHTML, urlnormalize) from calibre.ebooks.oeb.polish.split import do_split -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range from css_selectors import Select, SelectorError XPath = functools.partial(_XPath, namespaces=NAMESPACES) @@ -245,7 +245,7 @@ class FlowSplitter(object): while ordered_ids: pb_id, (pattern, before) = ordered_ids.iteritems().next() del ordered_ids[pb_id] - for i in xrange(len(self.trees)-1, -1, -1): + for i in range(len(self.trees)-1, -1, -1): tree = self.trees[i] elem = pattern(tree) if elem: diff --git a/src/calibre/ebooks/oeb/transforms/subset.py b/src/calibre/ebooks/oeb/transforms/subset.py index 5e580ed93d..91bb5dde52 100644 --- a/src/calibre/ebooks/oeb/transforms/subset.py +++ b/src/calibre/ebooks/oeb/transforms/subset.py @@ -11,7 +11,7 @@ from collections import defaultdict from calibre.ebooks.oeb.base import urlnormalize from calibre.utils.fonts.sfnt.subset import subset, NoGlyphs, UnsupportedFont -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range from tinycss.fonts3 import parse_font_family @@ -287,10 +287,10 @@ class SubsetFonts(object): elif fw == 500: q = [500, 400, 300, 200, 100, 600, 700, 800, 900] elif fw < 400: - q = [fw] + list(xrange(fw-100, -100, -100)) + list(xrange(fw+100, + q = [fw] + list(range(fw-100, -100, -100)) + list(range(fw+100, 100, 1000)) else: - q = [fw] + list(xrange(fw+100, 100, 1000)) + list(xrange(fw-100, + q = [fw] + list(range(fw+100, 100, 1000)) + list(range(fw-100, -100, -100)) for wt in q: matches = [f for f in matching_set if f['weight'] == wt] diff --git a/src/calibre/gui2/store/config/chooser/models.py b/src/calibre/gui2/store/config/chooser/models.py index 42a3094c5f..48e8cf38c1 100644 --- a/src/calibre/gui2/store/config/chooser/models.py +++ b/src/calibre/gui2/store/config/chooser/models.py @@ -13,7 +13,7 @@ from calibre.db.search import _match, CONTAINS_MATCH, EQUALS_MATCH, REGEXP_MATCH from calibre.utils.config_base import prefs from calibre.utils.icu import sort_key from calibre.utils.search_query_parser import SearchQueryParser -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range class Matches(QAbstractItemModel): @@ -56,19 +56,19 @@ class Matches(QAbstractItemModel): self.sort(self.sort_col, self.sort_order) def enable_all(self): - for i in xrange(len(self.matches)): + for i in range(len(self.matches)): index = self.createIndex(i, 0) data = (True) self.setData(index, data, Qt.CheckStateRole) def enable_none(self): - for i in xrange(len(self.matches)): + for i in range(len(self.matches)): index = self.createIndex(i, 0) data = (False) self.setData(index, data, Qt.CheckStateRole) def enable_invert(self): - for i in xrange(len(self.matches)): + for i in range(len(self.matches)): self.toggle_plugin(self.createIndex(i, 0)) def toggle_plugin(self, index): diff --git a/src/calibre/gui2/store/config/chooser/results_view.py b/src/calibre/gui2/store/config/chooser/results_view.py index 1a3e32be6d..45e628630a 100644 --- a/src/calibre/gui2/store/config/chooser/results_view.py +++ b/src/calibre/gui2/store/config/chooser/results_view.py @@ -13,6 +13,7 @@ from PyQt5.Qt import (Qt, QTreeView, QSize, QMenu) from calibre.customize.ui import store_plugins from calibre.gui2.metadata.single_download import RichTextDelegate from calibre.gui2.store.config.chooser.models import Matches +from polyglot.builtins import range class ResultsView(QTreeView): @@ -30,7 +31,7 @@ class ResultsView(QTreeView): for i in self._model.HTML_COLS: self.setItemDelegateForColumn(i, self.rt_delegate) - for i in xrange(self._model.columnCount()): + for i in range(self._model.columnCount()): self.resizeColumnToContents(i) self.model().sort(1, Qt.AscendingOrder) diff --git a/src/calibre/gui2/store/search/download_thread.py b/src/calibre/gui2/store/search/download_thread.py index fd6dc89638..5df4dd0966 100644 --- a/src/calibre/gui2/store/search/download_thread.py +++ b/src/calibre/gui2/store/search/download_thread.py @@ -14,6 +14,7 @@ from Queue import Queue from calibre import browser from calibre.constants import DEBUG from calibre.utils.img import scale_image +from polyglot.builtins import range class GenericDownloadThreadPool(object): @@ -44,7 +45,7 @@ class GenericDownloadThreadPool(object): starts any threads necessary to fill the pool if it is not already full. ''' - for i in xrange(self.thread_count - self.running_threads_count()): + for i in range(self.thread_count - self.running_threads_count()): t = self.thread_type(self.tasks, self.results) self.threads.append(t) t.start() diff --git a/src/calibre/gui2/tweak_book/diff/highlight.py b/src/calibre/gui2/tweak_book/diff/highlight.py index da00a5b8b1..401ed0379b 100644 --- a/src/calibre/gui2/tweak_book/diff/highlight.py +++ b/src/calibre/gui2/tweak_book/diff/highlight.py @@ -14,6 +14,7 @@ from calibre.gui2.tweak_book import tprefs from calibre.gui2.tweak_book.editor.text import get_highlighter as calibre_highlighter, SyntaxHighlighter from calibre.gui2.tweak_book.editor.themes import get_theme, highlight_to_char_format from calibre.gui2.tweak_book.editor.syntax.utils import format_for_pygments_token, NULL_FMT +from polyglot.builtins import range class QtHighlighter(QTextDocument): @@ -59,7 +60,7 @@ class NullHighlighter(object): self.lines = text.splitlines() def copy_lines(self, lo, hi, cursor): - for i in xrange(lo, hi): + for i in range(lo, hi): cursor.insertText(self.lines[i]) cursor.insertBlock() @@ -101,7 +102,7 @@ class PygmentsHighlighter(object): continue def copy_lines(self, lo, hi, cursor): - for i in xrange(lo, hi): + for i in range(lo, hi): for fmt, text in self.lines[i]: cursor.insertText(text, fmt) cursor.setCharFormat(NULL_FMT) diff --git a/src/calibre/gui2/tweak_book/diff/view.py b/src/calibre/gui2/tweak_book/diff/view.py index 1484fae7f6..24c31a517e 100644 --- a/src/calibre/gui2/tweak_book/diff/view.py +++ b/src/calibre/gui2/tweak_book/diff/view.py @@ -12,7 +12,7 @@ from math import ceil from functools import partial from collections import namedtuple, OrderedDict from difflib import SequenceMatcher -from polyglot.builtins import unicode_type, zip +from polyglot.builtins import unicode_type, zip, range import regex from PyQt5.Qt import ( @@ -160,7 +160,7 @@ class TextBrowser(PlainTextEdit): # {{{ def calculate_metrics(self): w = self.fontMetrics() - self.number_width = max(map(lambda x:w.width(str(x)), xrange(10))) + self.number_width = max(map(lambda x:w.width(str(x)), range(10))) self.space_width = w.width(' ') def show_context_menu(self, pos): @@ -612,7 +612,7 @@ class DiffSplit(QSplitter): # {{{ if size > 0: c.beginEditBlock() c.insertText(_('Size: {0} Resolution: {1}x{2}').format(human_readable(size), img.width(), img.height())) - for i in xrange(lines + 1): + for i in range(lines + 1): c.insertBlock() change.extend((start, c.block().blockNumber())) c.insertBlock() @@ -640,7 +640,7 @@ class DiffSplit(QSplitter): # {{{ c.beginEditBlock() c.movePosition(c.StartOfBlock) if delta > 0: - for _ in xrange(delta): + for _ in range(delta): c.insertBlock() else: c.movePosition(c.NextBlock, c.KeepAnchor, -delta) @@ -747,7 +747,7 @@ class DiffSplit(QSplitter): # {{{ def do_insert(self, cursor, highlighter, line_number_map, lo, hi): start_block = cursor.block() highlighter.copy_lines(lo, hi, cursor) - for num, i in enumerate(xrange(start_block.blockNumber(), cursor.blockNumber())): + for num, i in enumerate(range(start_block.blockNumber(), cursor.blockNumber())): line_number_map[i] = lo + num + 1 return start_block.blockNumber(), cursor.block().blockNumber() @@ -806,10 +806,10 @@ class DiffSplit(QSplitter): # {{{ # search for the pair that matches best without being identical # (identical lines must be junk lines, & we don't want to synch up # on junk -- unless we have to) - for j in xrange(blo, bhi): + for j in range(blo, bhi): bj = b[j] cruncher.set_seq2(bj) - for i in xrange(alo, ahi): + for i in range(alo, ahi): ai = a[i] if ai == bj: if eqi is None: diff --git a/src/calibre/gui2/tweak_book/editor/snippets.py b/src/calibre/gui2/tweak_book/editor/snippets.py index e8648c767f..3c2e3b46d8 100644 --- a/src/calibre/gui2/tweak_book/editor/snippets.py +++ b/src/calibre/gui2/tweak_book/editor/snippets.py @@ -24,7 +24,7 @@ from calibre.gui2.tweak_book.widgets import Dialog, PlainTextEdit from calibre.utils.config import JSONConfig from calibre.utils.icu import string_length as strlen from calibre.utils.localization import localize_user_manual_link -from polyglot.builtins import codepoint_to_chr, unicode_type +from polyglot.builtins import codepoint_to_chr, unicode_type, range string_length = lambda x: strlen(unicode_type(x)) # Needed on narrow python builds, as subclasses of unicode dont work KEY = Qt.Key_J @@ -529,7 +529,7 @@ class EditSnippet(QWidget): self.template.setPlainText(snip.get('template') or '') ftypes = snip.get('syntaxes', ()) - for i in xrange(self.types.count()): + for i in range(self.types.count()): i = self.types.item(i) ftype = i.data(Qt.UserRole) i.setCheckState(Qt.Checked if ftype in ftypes else Qt.Unchecked) @@ -544,7 +544,7 @@ class EditSnippet(QWidget): def fget(self): ftypes = [] - for i in xrange(self.types.count()): + for i in range(self.types.count()): i = self.types.item(i) if i.checkState() == Qt.Checked: ftypes.append(i.data(Qt.UserRole)) @@ -657,7 +657,7 @@ class UserSnippets(Dialog): else: error_dialog(self, _('Invalid snippet'), err, show=True) return - user_snippets['snippets'] = [self.snip_list.item(i).data(Qt.UserRole) for i in xrange(self.snip_list.count())] + user_snippets['snippets'] = [self.snip_list.item(i).data(Qt.UserRole) for i in range(self.snip_list.count())] snippets(refresh=True) return Dialog.accept(self) diff --git a/src/calibre/gui2/tweak_book/editor/text.py b/src/calibre/gui2/tweak_book/editor/text.py index d28ae4e5d4..6a7ae1fefa 100644 --- a/src/calibre/gui2/tweak_book/editor/text.py +++ b/src/calibre/gui2/tweak_book/editor/text.py @@ -8,7 +8,7 @@ import os import re import textwrap import unicodedata -from polyglot.builtins import unicode_type, map +from polyglot.builtins import unicode_type, map, range from PyQt5.Qt import ( QColor, QColorDialog, QFont, QFontDatabase, QKeySequence, QPainter, QPalette, @@ -262,7 +262,7 @@ class TextEdit(PlainTextEdit): self.setFont(font) self.highlighter.apply_theme(theme) w = self.fontMetrics() - self.number_width = max(map(lambda x:w.width(str(x)), xrange(10))) + self.number_width = max(map(lambda x:w.width(str(x)), range(10))) self.size_hint = QSize(self.expected_geometry[0] * w.averageCharWidth(), self.expected_geometry[1] * w.height()) self.highlight_color = theme_color(theme, 'HighlightRegion', 'bg') self.highlight_cursor_line() diff --git a/src/calibre/gui2/tweak_book/editor/themes.py b/src/calibre/gui2/tweak_book/editor/themes.py index d4ced42f75..8e76121182 100644 --- a/src/calibre/gui2/tweak_book/editor/themes.py +++ b/src/calibre/gui2/tweak_book/editor/themes.py @@ -18,7 +18,7 @@ from calibre.gui2 import error_dialog from calibre.gui2.tweak_book import tprefs from calibre.gui2.tweak_book.editor import syntax_text_char_format from calibre.gui2.tweak_book.widgets import Dialog -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range underline_styles = {'single', 'dash', 'dot', 'dash_dot', 'dash_dot_dot', 'wave', 'spell'} @@ -35,8 +35,8 @@ def default_theme(): # The solarized themes {{{ SLDX = {'base03':'1c1c1c', 'base02':'262626', 'base01':'585858', 'base00':'626262', 'base0':'808080', 'base1':'8a8a8a', 'base2':'e4e4e4', 'base3':'ffffd7', 'yellow':'af8700', 'orange':'d75f00', 'red':'d70000', 'magenta':'af005f', 'violet':'5f5faf', 'blue':'0087ff', 'cyan':'00afaf', 'green':'5f8700'} # noqa SLD = {'base03':'002b36', 'base02':'073642', 'base01':'586e75', 'base00':'657b83', 'base0':'839496', 'base1':'93a1a1', 'base2':'eee8d5', 'base3':'fdf6e3', 'yellow':'b58900', 'orange':'cb4b16', 'red':'dc322f', 'magenta':'d33682', 'violet':'6c71c4', 'blue':'268bd2', 'cyan':'2aa198', 'green':'859900'} # noqa -m = {'base%d'%n:'base%02d'%n for n in xrange(1, 4)} -m.update({'base%02d'%n:'base%d'%n for n in xrange(1, 4)}) +m = {'base%d'%n:'base%02d'%n for n in range(1, 4)} +m.update({'base%02d'%n:'base%d'%n for n in range(1, 4)}) SLL = {m.get(k, k) : v for k, v in SLD.iteritems()} SLLX = {m.get(k, k) : v for k, v in SLDX.iteritems()} SOLARIZED = \ diff --git a/src/calibre/utils/fonts/sfnt/cff/dict_data.py b/src/calibre/utils/fonts/sfnt/cff/dict_data.py index 44757c564b..137c71fb4e 100644 --- a/src/calibre/utils/fonts/sfnt/cff/dict_data.py +++ b/src/calibre/utils/fonts/sfnt/cff/dict_data.py @@ -8,6 +8,7 @@ __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' from struct import unpack, pack +from polyglot.builtins import range t1_operand_encoding = [None] * 256 t1_operand_encoding[0:32] = (32) * ["do_operator"] @@ -91,7 +92,7 @@ class ByteCode(dict): if len(nibbles) % 2: nibbles.append(0xf) d = bytearray([30]) - for i in xrange(0, len(nibbles), 2): + for i in range(0, len(nibbles), 2): d.append(nibbles[i] << 4 | nibbles[i+1]) return bytes(d) @@ -164,7 +165,7 @@ class Dict(ByteCode): def handle_operator(self, operator, arg_type): if isinstance(arg_type, tuple): value = () - for i in xrange(len(arg_type)-1, -1, -1): + for i in range(len(arg_type)-1, -1, -1): arg = arg_type[i] arghandler = getattr(self, 'arg_' + arg) value = (arghandler(operator),) + value diff --git a/src/calibre/utils/fonts/sfnt/cff/table.py b/src/calibre/utils/fonts/sfnt/cff/table.py index 396ceb6404..e376d35eb4 100644 --- a/src/calibre/utils/fonts/sfnt/cff/table.py +++ b/src/calibre/utils/fonts/sfnt/cff/table.py @@ -15,6 +15,7 @@ from calibre.utils.fonts.sfnt.errors import UnsupportedFont, NoGlyphs from calibre.utils.fonts.sfnt.cff.dict_data import TopDict, PrivateDict from calibre.utils.fonts.sfnt.cff.constants import (cff_standard_strings, STANDARD_CHARSETS) +from polyglot.builtins import range # Useful links # http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5176.CFF.pdf @@ -104,14 +105,14 @@ class Index(list): offset += 1 if self.offset_size == 3: offsets = [unpack(b'>L', b'\0' + raw[i:i+3])[0] - for i in xrange(offset, offset+3*(count+1), 3)] + for i in range(offset, offset+3*(count+1), 3)] else: fmt = {1:'B', 2:'H', 4:'L'}[self.offset_size] fmt = ('>%d%s'%(count+1, fmt)).encode('ascii') offsets = unpack_from(fmt, raw, offset) offset += self.offset_size * (count+1) - 1 - for i in xrange(len(offsets)-1): + for i in range(len(offsets)-1): off, noff = offsets[i:i+2] obj = raw[offset+off:offset+noff] self.append(obj) @@ -166,7 +167,7 @@ class Charset(list): offset += sz count += nleft + 1 self.extend('cid%05d'%x if is_CID else strings[x] for x in - xrange(first, first + nleft+1)) + range(first, first + nleft+1)) def lookup(self, glyph_id): if self.standard_charset is None: @@ -219,6 +220,3 @@ class CFFTable(UnknownTable): CFF(s.raw) self.raw = s.raw - - - diff --git a/src/calibre/utils/fonts/sfnt/cff/writer.py b/src/calibre/utils/fonts/sfnt/cff/writer.py index e3872d4472..0b7b77e5f4 100644 --- a/src/calibre/utils/fonts/sfnt/cff/writer.py +++ b/src/calibre/utils/fonts/sfnt/cff/writer.py @@ -11,6 +11,7 @@ from struct import pack from collections import OrderedDict from calibre.utils.fonts.sfnt.cff.constants import cff_standard_strings +from polyglot.builtins import range class Index(list): @@ -131,7 +132,7 @@ class Subset(object): charsets.extend(cff.charset[1:]) # .notdef is not included endchar_operator = bytes(bytearray([14])) - for i in xrange(self.cff.num_glyphs): + for i in range(self.cff.num_glyphs): cname = self.cff.charset.safe_lookup(i) ok = cname in keep_charnames cs = self.cff.char_strings[i] if ok else endchar_operator @@ -189,5 +190,3 @@ class Subset(object): self.raw += private_dict.raw if private_dict.subrs is not None: self.raw += private_dict.subrs.raw - - diff --git a/src/calibre/utils/fonts/sfnt/cmap.py b/src/calibre/utils/fonts/sfnt/cmap.py index b04665453d..e07c275d6c 100644 --- a/src/calibre/utils/fonts/sfnt/cmap.py +++ b/src/calibre/utils/fonts/sfnt/cmap.py @@ -16,6 +16,7 @@ from collections import OrderedDict from calibre.utils.fonts.utils import read_bmp_prefix from calibre.utils.fonts.sfnt import UnknownTable, max_power_of_two from calibre.utils.fonts.sfnt.errors import UnsupportedFont +from polyglot.builtins import range def split_range(start_code, end_code, cmap): # {{{ @@ -153,7 +154,7 @@ class BMPTable(object): ans = {} for i, ec in enumerate(self.end_count): sc = self.start_count[i] - for code in xrange(sc, ec+1): + for code in range(sc, ec+1): ro = self.range_offset[i] if ro == 0: glyph_id = self.id_delta[i] + code @@ -180,7 +181,7 @@ class CmapTable(UnknownTable): offset = 4 sz = calcsize(b'>HHL') recs = [] - for i in xrange(self.num_tables): + for i in range(self.num_tables): platform, encoding, table_offset = unpack_from(b'>HHL', self.raw, offset) offset += sz @@ -188,7 +189,7 @@ class CmapTable(UnknownTable): self.bmp_table = None - for i in xrange(len(recs)): + for i in range(len(recs)): platform, encoding, offset = recs[i] try: next_offset = recs[i+1][-1] @@ -256,9 +257,9 @@ class CmapTable(UnknownTable): id_delta = [] id_range_offset = [] glyph_index_array = [] - for i in xrange(len(end_code)-1): # skip the closing codes (0xffff) - indices = list(cmap[char_code] for char_code in xrange(start_code[i], end_code[i] + 1)) - if indices == list(xrange(indices[0], indices[0] + len(indices))): + for i in range(len(end_code)-1): # skip the closing codes (0xffff) + indices = list(cmap[char_code] for char_code in range(start_code[i], end_code[i] + 1)) + if indices == list(range(indices[0], indices[0] + len(indices))): # indices is a contiguous list id_delta_temp = set_id_delta(indices[0] - start_code[i]) id_delta.append(id_delta_temp) @@ -290,4 +291,3 @@ class CmapTable(UnknownTable): fmt = b'>4HL' offset = calcsize(fmt) self.raw = pack(fmt, self.version, self.num_tables, 3, 1, offset) + self.bmp_table - diff --git a/src/calibre/utils/fonts/sfnt/common.py b/src/calibre/utils/fonts/sfnt/common.py index 5534fe6e92..59098e0472 100644 --- a/src/calibre/utils/fonts/sfnt/common.py +++ b/src/calibre/utils/fonts/sfnt/common.py @@ -11,6 +11,7 @@ from struct import unpack_from, calcsize from collections import OrderedDict, namedtuple from calibre.utils.fonts.sfnt.errors import UnsupportedFont +from polyglot.builtins import range class Unpackable(object): @@ -41,7 +42,7 @@ class SimpleListTable(list): self.read_extra_header(data) count = data.unpack('H') - for i in xrange(count): + for i in range(count): offset = data.unpack('H') self.append(self.child_class(raw, data.start_pos + offset)) self.read_extra_footer(data) @@ -66,7 +67,7 @@ class ListTable(OrderedDict): self.read_extra_header(data) count = data.unpack('H') - for i in xrange(count): + for i in range(count): tag, coffset = data.unpack('4sH') self[tag] = self.child_class(raw, data.start_pos + coffset) @@ -93,7 +94,7 @@ class IndexTable(list): self.read_extra_header(data) count = data.unpack('H') - for i in xrange(count): + for i in range(count): self.append(data.unpack('H')) def read_extra_header(self, data): @@ -167,6 +168,7 @@ def ExtensionSubstitution(raw, offset, subtable_map={}): raise UnsupportedFont('ExtensionSubstitution has unknown format: 0x%x'%subst_format) return subtable_map[extension_lookup_type](raw, offset+data.start_pos) + CoverageRange = namedtuple('CoverageRange', 'start end start_coverage_index') @@ -186,7 +188,7 @@ class Coverage(object): else: self.ranges = [] ranges = data.unpack('%dH'%(3*count), single_special=False) - for i in xrange(count): + for i in range(count): start, end, start_coverage_index = ranges[i*3:(i+1)*3] self.ranges.append(CoverageRange(start, end, start_coverage_index)) @@ -249,4 +251,3 @@ class UnknownLookupSubTable(object): items.append(read_item(data)) coverage_to_items_map.append(items) return coverage_to_items_map - diff --git a/src/calibre/utils/fonts/sfnt/kern.py b/src/calibre/utils/fonts/sfnt/kern.py index fe139e638c..30b63bce40 100644 --- a/src/calibre/utils/fonts/sfnt/kern.py +++ b/src/calibre/utils/fonts/sfnt/kern.py @@ -12,6 +12,7 @@ from struct import unpack_from, calcsize, pack, error as struct_error from calibre.utils.fonts.sfnt import (UnknownTable, FixedProperty, max_power_of_two) from calibre.utils.fonts.sfnt.errors import UnsupportedFont +from polyglot.builtins import range class KernTable(UnknownTable): @@ -30,7 +31,7 @@ class KernTable(UnknownTable): raise UnsupportedFont('kern table has version: %x'%self._version) offset = 4 if (self._version == 0) else 8 tables = [] - for i in xrange(self.num_tables): + for i in range(self.num_tables): if self._version == 0: version, length, coverage = unpack_from(b'>3H', self.raw, offset) table_format = version @@ -57,7 +58,7 @@ class KernTable(UnknownTable): offset = calcsize(headerfmt + b'4H') entries = [] entrysz = calcsize(b'>2Hh') - for i in xrange(npairs): + for i in range(npairs): try: left, right, value = unpack_from(b'>2Hh', raw, offset) except struct_error: @@ -87,4 +88,3 @@ class KernTable(UnknownTable): header = pack(headerfmt, length, coverage, tuple_index) return header + pack(b'>4H', npairs, search_range, entry_selector, range_shift) + entries - diff --git a/src/calibre/utils/fonts/sfnt/loca.py b/src/calibre/utils/fonts/sfnt/loca.py index 0e3f079699..50765b086b 100644 --- a/src/calibre/utils/fonts/sfnt/loca.py +++ b/src/calibre/utils/fonts/sfnt/loca.py @@ -11,6 +11,7 @@ from struct import calcsize, unpack_from, pack from operator import itemgetter from calibre.utils.fonts.sfnt import UnknownTable +from polyglot.builtins import range class LocaTable(UnknownTable): @@ -46,7 +47,7 @@ class LocaTable(UnknownTable): self.offset_map[glyph_id+1] = offset + sz # Fix all zero entries to be the same as the previous entry, which # means that if the ith entry is zero, the i-1 glyph is not present. - for i in xrange(1, len(self.offset_map)): + for i in range(1, len(self.offset_map)): if self.offset_map[i] == 0: self.offset_map[i] = self.offset_map[i-1] @@ -59,9 +60,7 @@ class LocaTable(UnknownTable): def dump_glyphs(self, sfnt): if not hasattr(self, 'offset_map'): self.load_offsets(sfnt[b'head'], sfnt[b'maxp']) - for i in xrange(len(self.offset_map)-1): + for i in range(len(self.offset_map)-1): off, noff = self.offset_map[i], self.offset_map[i+1] if noff != off: print('Glyph id:', i, 'size:', noff-off) - - diff --git a/src/calibre/utils/fonts/sfnt/subset.py b/src/calibre/utils/fonts/sfnt/subset.py index b1683af139..51d3d485ce 100644 --- a/src/calibre/utils/fonts/sfnt/subset.py +++ b/src/calibre/utils/fonts/sfnt/subset.py @@ -15,7 +15,7 @@ from functools import partial from calibre.utils.icu import safe_chr, ord_string from calibre.utils.fonts.sfnt.container import Sfnt from calibre.utils.fonts.sfnt.errors import UnsupportedFont, NoGlyphs -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, range # TrueType outlines {{{ @@ -115,7 +115,7 @@ def subset(raw, individual_chars, ranges=(), warnings=None): chars = set(map(safe_ord, individual_chars)) for r in ranges: - chars |= set(xrange(safe_ord(r[0]), safe_ord(r[1])+1)) + chars |= set(range(safe_ord(r[0]), safe_ord(r[1])+1)) # Always add the space character for ease of use from the command line if safe_ord(' ') not in chars: @@ -307,10 +307,10 @@ def test_mem(): start_mem = memory() raw = P('fonts/liberation/LiberationSerif-Regular.ttf', data=True) calls = 1000 - for i in xrange(calls): + for i in range(calls): subset(raw, (), (('a', 'z'),)) del raw - for i in xrange(3): + for i in range(3): gc.collect() print ('Leaked memory per call:', (memory() - start_mem)/calls*1024, 'KB') From 373f300ed7f5479dbf9be7ee72b462b0272048d5 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 13 Mar 2019 23:29:14 -0400 Subject: [PATCH 0312/2613] Fix syntax error introduced while getting rid of basestring --- src/odf/userfield.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/odf/userfield.py b/src/odf/userfield.py index 5dc2f0818d..50dbe0e817 100644 --- a/src/odf/userfield.py +++ b/src/odf/userfield.py @@ -62,7 +62,7 @@ class UserFields(object): self.document = None def loaddoc(self): - if isinstance(self.src_file, (bytes, type(u'')): + if isinstance(self.src_file, (bytes, type(u''))): # src_file is a filename, check if it is a zip-file if not zipfile.is_zipfile(self.src_file): raise TypeError("%s is no odt file." % self.src_file) From 6b9d4a16d51d02d22fb32b0e83e6d277df4f4604 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 14 Mar 2019 11:57:27 +0530 Subject: [PATCH 0313/2613] Fix a regression that caused a harmless error popup when displaying tooltips in the select format dialog --- src/calibre/gui2/dialogs/select_formats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/dialogs/select_formats.py b/src/calibre/gui2/dialogs/select_formats.py index eb2d776923..6d4038cc41 100644 --- a/src/calibre/gui2/dialogs/select_formats.py +++ b/src/calibre/gui2/dialogs/select_formats.py @@ -37,7 +37,7 @@ class Formats(QAbstractListModel): fmt = self.fmts[row] count = self.counts[fmt] return _('There is one book with the {} format').format(fmt.upper()) if count == 1 else _( - 'There are {count} books with the {fmt} format', count).format( + 'There are {count} books with the {fmt} format').format( count=count, fmt=fmt.upper()) return None From 7fcf90ba97702d4410f9a99660c0666c99b73be8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 14 Mar 2019 20:17:58 +0530 Subject: [PATCH 0314/2613] Dont use pickle for the db thumbnail cache index --- src/calibre/db/utils.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/calibre/db/utils.py b/src/calibre/db/utils.py index 62970d6fcf..5d02367248 100644 --- a/src/calibre/db/utils.py +++ b/src/calibre/db/utils.py @@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' -import os, errno, cPickle, sys, re +import os, errno, sys, re from locale import localeconv from collections import OrderedDict, namedtuple from polyglot.builtins import map, unicode_type, string_or_bytes @@ -202,7 +202,7 @@ class ThumbnailCache(object): except EnvironmentError as err: self.log('Failed to read thumbnail cache dir:', as_unicode(err)) - self.items = OrderedDict(sorted(items, key=lambda x:order.get(hash(x[0]), 0))) + self.items = OrderedDict(sorted(items, key=lambda x:order.get(x[0], 0))) self._apply_size() def _invalidate_sizes(self): @@ -228,17 +228,20 @@ class ThumbnailCache(object): def _write_order(self): if hasattr(self, 'items'): try: - with open(os.path.join(self.location, 'order'), 'wb') as f: - f.write(cPickle.dumps(tuple(map(hash, self.items)), -1)) + data = '\n'.join(group_id + ' ' + unicode_type(book_id) for (group_id, book_id) in self.items) + with lopen(os.path.join(self.location, 'order'), 'wb') as f: + f.write(data.encode('utf-8')) except EnvironmentError as err: self.log('Failed to save thumbnail cache order:', as_unicode(err)) def _read_order(self): order = {} try: - with open(os.path.join(self.location, 'order'), 'rb') as f: - order = cPickle.loads(f.read()) - order = {k:i for i, k in enumerate(order)} + with lopen(os.path.join(self.location, 'order'), 'rb') as f: + for line in f.read().decode('utf-8').splitlines(): + parts = line.split(' ', 1) + if len(parts) == 2: + order[(parts[0], int(parts[1]))] = len(order) except Exception as err: if getattr(err, 'errno', None) != errno.ENOENT: self.log('Failed to load thumbnail cache order:', as_unicode(err)) From 54ef601e91276889de46863303a6a91a444af40f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 14 Mar 2019 20:46:20 +0530 Subject: [PATCH 0315/2613] Get rid of a pointless use of pickle --- src/calibre/gui2/convert/single.py | 4 ++-- src/calibre/gui2/tools.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/convert/single.py b/src/calibre/gui2/convert/single.py index 9744771052..56290963c5 100644 --- a/src/calibre/gui2/convert/single.py +++ b/src/calibre/gui2/convert/single.py @@ -6,7 +6,7 @@ __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import cPickle, shutil +import shutil from PyQt5.Qt import QAbstractListModel, Qt, QFont, QModelIndex, QDialog, QCoreApplication, QSize @@ -231,7 +231,7 @@ class Config(QDialog, Ui_Dialog): def recommendations(self): recs = [(k, v, OptionRecommendation.HIGH) for k, v in self._recommendations.items()] - return cPickle.dumps(recs, -1) + return recs def show_group_help(self, index): widget = self._groups_model.widgets[index.row()] diff --git a/src/calibre/gui2/tools.py b/src/calibre/gui2/tools.py index fb5112124e..14d94afa89 100644 --- a/src/calibre/gui2/tools.py +++ b/src/calibre/gui2/tools.py @@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en' Logic for setting up conversion jobs ''' -import cPickle, os +import os from PyQt5.Qt import QDialog, QProgressDialog, QTimer @@ -71,7 +71,7 @@ def convert_single_ebook(parent, db, book_ids, auto_conversion=False, # {{{ desc = _('Convert book %(num)d of %(total)d (%(title)s)') % \ {'num':i + 1, 'total':total, 'title':dtitle} - recs = cPickle.loads(d.recommendations) + recs = d.recommendations if d.opf_file is not None: recs.append(('read_metadata_from_opf', d.opf_file.name, OptionRecommendation.HIGH)) @@ -145,7 +145,7 @@ def convert_bulk_ebook(parent, queue, db, book_ids, out_format=None, args=[]): return None output_format = d.output_format - user_recs = cPickle.loads(d.recommendations) + user_recs = d.recommendations book_ids = convert_existing(parent, db, book_ids, output_format) use_saved_single_settings = d.opt_individual_saved_settings.isChecked() From 52c371e8b51cf27edcf645f50de26b8dc986a36b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 14 Mar 2019 21:05:13 +0530 Subject: [PATCH 0316/2613] Replace another use of pickle --- src/calibre/ebooks/metadata/book/render.py | 5 +++-- src/calibre/gui2/book_details.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/metadata/book/render.py b/src/calibre/ebooks/metadata/book/render.py index 6b4519e2aa..9b648356aa 100644 --- a/src/calibre/ebooks/metadata/book/render.py +++ b/src/calibre/ebooks/metadata/book/render.py @@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2014, Kovid Goyal ' -import os, cPickle +import os from functools import partial from binascii import hexlify @@ -20,6 +20,7 @@ from calibre.utils.icu import sort_key from calibre.utils.formatter import EvalFormatter from calibre.utils.date import is_date_undefined from calibre.utils.localization import calibre_langcode_to_name +from calibre.utils.serialize import json_dumps from polyglot.builtins import unicode_type default_sort = ('title', 'title_sort', 'authors', 'author_sort', 'series', 'rating', 'pubdate', 'tags', 'publisher', 'identifiers') @@ -79,7 +80,7 @@ def author_search_href(which, title=None, author=None): def item_data(field_name, value, book_id): - return hexlify(cPickle.dumps((field_name, value, book_id), -1)) + return hexlify(json_dumps((field_name, value, book_id))) def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers=True, rating_font='Liberation Serif', rtl=False): diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index af32669c1a..4b97b1d772 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -2,7 +2,6 @@ # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai # License: GPLv3 Copyright: 2010, Kovid Goyal -import cPickle import os import re from binascii import unhexlify @@ -34,6 +33,7 @@ from calibre.gui2.dnd import ( from calibre.utils.config import tweaks from calibre.utils.img import blend_image, image_from_x from calibre.utils.localization import is_rtl +from calibre.utils.serialize import json_loads from polyglot.builtins import unicode_type _css = None @@ -286,7 +286,7 @@ def details_context_menu_event(view, ev, book_info): # {{{ lambda : book_info.search_requested('authors:"={}"'.format(author.replace('"', r'\"')))) if data: try: - field, value, book_id = cPickle.loads(unhexlify(data)) + field, value, book_id = json_loads(unhexlify(data)) except Exception: field = value = book_id = None if field: From 046f43446e915c4d880ad3eb91db2e30ce345d07 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 11:43:17 +0530 Subject: [PATCH 0317/2613] Replace use of pickle when repairing db on windows --- src/calibre/gui2/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 5c397c09c8..c97f887f08 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -174,9 +174,10 @@ def repair_library(library_path): def windows_repair(library_path=None): from binascii import hexlify, unhexlify - import cPickle, subprocess + import subprocess + from calibre.utils.serialize import json_dumps, json_loads if library_path: - library_path = hexlify(cPickle.dumps(library_path, -1)) + library_path = hexlify(json_dumps(library_path)) winutil.prepare_for_restart() os.environ['CALIBRE_REPAIR_CORRUPTED_DB'] = library_path subprocess.Popen([sys.executable]) @@ -184,7 +185,7 @@ def windows_repair(library_path=None): try: app = Application([]) from calibre.gui2.dialogs.restore_library import repair_library_at - library_path = cPickle.loads(unhexlify(os.environ.pop('CALIBRE_REPAIR_CORRUPTED_DB'))) + library_path = json_loads(unhexlify(os.environ.pop('CALIBRE_REPAIR_CORRUPTED_DB'))) done = repair_library_at(library_path, wait_time=4) except Exception: done = False From fc61fc88bc024e549a70b77c8838a97ce4c64d20 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 11:50:31 +0530 Subject: [PATCH 0318/2613] Replace use of pickle for D'nD in the tag browser --- src/calibre/gui2/tag_browser/model.py | 10 ++++++---- src/calibre/gui2/tag_browser/view.py | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/calibre/gui2/tag_browser/model.py b/src/calibre/gui2/tag_browser/model.py index 4415b372ea..75ea12470e 100644 --- a/src/calibre/gui2/tag_browser/model.py +++ b/src/calibre/gui2/tag_browser/model.py @@ -8,7 +8,7 @@ __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import traceback, cPickle, copy, os +import traceback, copy, os from collections import OrderedDict from PyQt5.Qt import (QAbstractItemModel, QIcon, QFont, Qt, @@ -24,6 +24,8 @@ from calibre.library.field_metadata import category_icon_map from calibre.gui2.dialogs.confirm_delete import confirm from calibre.utils.formatter import EvalFormatter from polyglot.builtins import range +from calibre.utils.serialize import json_dumps, json_loads + TAG_SEARCH_STATES = {'clear': 0, 'mark_plus': 1, 'mark_plusplus': 2, 'mark_minus': 3, 'mark_minusminus': 4} @@ -740,7 +742,7 @@ class TagsModel(QAbstractItemModel): # {{{ data.append(d) else: data.append(None) - raw = bytearray(cPickle.dumps(data, -1)) + raw = bytearray(json_dumps(data)) ans = QMimeData() ans.setData('application/calibre+from_tag_browser', raw) return ans @@ -764,8 +766,8 @@ class TagsModel(QAbstractItemModel): # {{{ return False if not md.hasFormat('application/calibre+from_tag_browser'): return False - data = str(md.data('application/calibre+from_tag_browser')) - src = cPickle.loads(data) + data = bytes(md.data('application/calibre+from_tag_browser')) + src = json_loads(data) for s in src: if s[0] != TagTreeItem.TAG: return False diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index 49a064257e..e19e7c9f15 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import cPickle, os, re +import os, re from functools import partial from itertools import izip @@ -24,6 +24,7 @@ from calibre.gui2.tag_browser.model import (TagTreeItem, TAG_SEARCH_STATES, TagsModel, DRAG_IMAGE_ROLE, COUNT_ROLE) from calibre.gui2 import config, gprefs, choose_files, pixmap_to_data, rating_font, empty_index from calibre.utils.icu import sort_key +from calibre.utils.serialize import json_loads from polyglot.builtins import unicode_type, range @@ -751,8 +752,8 @@ class TagsView(QTreeView): # {{{ if fm_dest['kind'] == 'user': if src_is_tb: if event.dropAction() == Qt.MoveAction: - data = str(event.mimeData().data('application/calibre+from_tag_browser')) - src = cPickle.loads(data) + data = bytes(event.mimeData().data('application/calibre+from_tag_browser')) + src = json_loads(data) for s in src: if s[0] == TagTreeItem.TAG and \ (not s[1].startswith('@') or s[2]): From 1e6d9e95831d6126961e09c3364da502369fd828 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 11:59:46 +0530 Subject: [PATCH 0319/2613] Replace use of pickle for the editor completion worker --- src/calibre/gui2/tweak_book/completion/worker.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/tweak_book/completion/worker.py b/src/calibre/gui2/tweak_book/completion/worker.py index 4fb0c966aa..13959df159 100644 --- a/src/calibre/gui2/tweak_book/completion/worker.py +++ b/src/calibre/gui2/tweak_book/completion/worker.py @@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2014, Kovid Goyal ' -import cPickle, os, sys +import os, sys from threading import Thread, Event, RLock from Queue import Queue from contextlib import closing @@ -16,6 +16,7 @@ from calibre.constants import iswindows from calibre.gui2.tweak_book.completion.basic import Request from calibre.gui2.tweak_book.completion.utils import DataError from calibre.utils.ipc import eintr_retry_call +from calibre.utils.serialize import msgpack_loads, msgpack_dumps COMPLETION_REQUEST = 'completion request' CLEAR_REQUEST = 'clear request' @@ -46,7 +47,7 @@ class CompletionWorker(Thread): 'from {0} import run_main, {1}; run_main({1})'.format(self.__class__.__module__, self.worker_entry_point)) auth_key = os.urandom(32) address, self.listener = create_listener(auth_key) - eintr_retry_call(p.stdin.write, cPickle.dumps((address, auth_key), -1)) + eintr_retry_call(p.stdin.write, msgpack_dumps((address, auth_key))) p.stdin.flush(), p.stdin.close() self.control_conn = eintr_retry_call(self.listener.accept) self.data_conn = eintr_retry_call(self.listener.accept) @@ -172,7 +173,8 @@ def completion_worker(): def run_main(func): from multiprocessing.connection import Client - address, key = cPickle.loads(eintr_retry_call(sys.stdin.read)) + stdin = getattr(sys.stdin, 'buffer', sys.stdin) + address, key = msgpack_loads(eintr_retry_call(stdin.read)) with closing(Client(address, authkey=key)) as control_conn, closing(Client(address, authkey=key)) as data_conn: func(control_conn, data_conn) From 74e316e20bff3be5d453410d33c3f7d8aaa4207a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 14:04:54 +0530 Subject: [PATCH 0320/2613] Replace use of pickle in update URL --- src/calibre/gui2/update.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/update.py b/src/calibre/gui2/update.py index 394e5cc674..9fa507cad6 100644 --- a/src/calibre/gui2/update.py +++ b/src/calibre/gui2/update.py @@ -1,7 +1,7 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' -import re, binascii, cPickle, ssl, json +import re, binascii, ssl, json from polyglot.builtins import map, unicode_type from threading import Thread, Event @@ -16,6 +16,7 @@ from calibre.utils.localization import localize_website_link from calibre.utils.https import get_https_resource_securely from calibre.gui2 import config, dynamic, open_url from calibre.gui2.dialogs.plugin_updater import get_plugin_updates_available +from calibre.utils.serialize import msgpack_dumps, msgpack_loads URL = 'https://code.calibre-ebook.com/latest' # URL = 'http://localhost:8000/latest' @@ -194,7 +195,7 @@ class UpdateMixin(object): has_calibre_update = calibre_version != NO_CALIBRE_UPDATE has_plugin_updates = number_of_plugin_updates > 0 self.plugin_update_found(number_of_plugin_updates) - version_url = binascii.hexlify(cPickle.dumps((calibre_version, number_of_plugin_updates), -1)) + version_url = binascii.hexlify(msgpack_dumps((calibre_version, number_of_plugin_updates))) calibre_version = u'.'.join(map(unicode_type, calibre_version)) if not has_calibre_update and not has_plugin_updates: @@ -248,7 +249,7 @@ class UpdateMixin(object): def update_link_clicked(self, url): url = unicode_type(url) if url.startswith('update:'): - calibre_version, number_of_plugin_updates = cPickle.loads(binascii.unhexlify(url[len('update:'):])) + calibre_version, number_of_plugin_updates = msgpack_loads(binascii.unhexlify(url[len('update:'):])) self.update_found(calibre_version, number_of_plugin_updates, force=True) From 6ad782cb29f7b89b879bfa88a741b00e381c8dc8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 14:39:06 +0530 Subject: [PATCH 0321/2613] Replace use of pickle for sending data to viewer print worker --- src/calibre/gui2/viewer/printing.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/viewer/printing.py b/src/calibre/gui2/viewer/printing.py index 4a65ef3351..56b80a6d35 100644 --- a/src/calibre/gui2/viewer/printing.py +++ b/src/calibre/gui2/viewer/printing.py @@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2015, Kovid Goyal ' -import os, subprocess, cPickle, sys +import os, subprocess, sys from threading import Thread from PyQt5.Qt import ( @@ -22,6 +22,7 @@ from calibre.gui2.viewer.main import vprefs from calibre.utils.icu import numeric_sort_key from calibre.utils.ipc.simple_worker import start_pipe_worker from calibre.utils.filenames import expanduser +from calibre.utils.serialize import msgpack_dumps, msgpack_loads class PrintDialog(Dialog): @@ -143,7 +144,7 @@ class DoPrint(Thread): try: with PersistentTemporaryFile('print-to-pdf-log.txt') as f: p = self.worker = start_pipe_worker('from calibre.gui2.viewer.printing import do_print; do_print()', stdout=f, stderr=subprocess.STDOUT) - p.stdin.write(cPickle.dumps(self.data, -1)), p.stdin.flush(), p.stdin.close() + p.stdin.write(msgpack_dumps(self.data)), p.stdin.flush(), p.stdin.close() rc = p.wait() if rc != 0: f.seek(0) @@ -159,7 +160,8 @@ class DoPrint(Thread): def do_print(): from calibre.customize.ui import plugin_for_input_format - data = cPickle.loads(sys.stdin.read()) + stdin = getattr(sys.stdin, 'buffer', sys.stdin) + data = msgpack_loads(stdin.read()) ext = data['input'].lower().rpartition('.')[-1] input_plugin = plugin_for_input_format(ext) args = ['ebook-convert', data['input'], data['output'], '--paper-size', data['paper_size'], '--pdf-add-toc', From 7e670497eb4a453918d25a5f17b1704d85ce8fa5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 14:49:56 +0530 Subject: [PATCH 0322/2613] Move pickle implementation into the serialize module And make it work on both py2 and py3. Note that unpickling of data between python major versions is not likely to work well. --- src/calibre/library/database.py | 7 ++++--- src/calibre/utils/serialize.py | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/calibre/library/database.py b/src/calibre/library/database.py index dcebaae4e8..8c78324215 100644 --- a/src/calibre/library/database.py +++ b/src/calibre/library/database.py @@ -5,11 +5,12 @@ __copyright__ = '2008, Kovid Goyal ' Backend that implements storage of ebooks in an sqlite database. ''' import sqlite3 as sqlite -import datetime, re, cPickle, sre_constants +import datetime, re, sre_constants from zlib import compress, decompress from calibre.ebooks.metadata import MetaInformation from calibre.ebooks.metadata import string_to_authors +from calibre.utils.serialize import pickle_loads, pickle_dumps from calibre import isbytestring from polyglot.builtins import unicode_type @@ -1090,7 +1091,7 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE; def conversion_options(self, id, format): data = self.conn.get('SELECT data FROM conversion_options WHERE book=? AND format=?', (id, format.upper()), all=False) if data: - return cPickle.loads(str(data)) + return pickle_loads(bytes(data)) return None def has_conversion_options(self, ids, format='PIPE'): @@ -1166,7 +1167,7 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE; self.set_tags(id, val.split(','), append=False) def set_conversion_options(self, id, format, options): - data = sqlite.Binary(cPickle.dumps(options, -1)) + data = sqlite.Binary(pickle_dumps(options)) oid = self.conn.get('SELECT id FROM conversion_options WHERE book=? AND format=?', (id, format.upper()), all=False) if oid: self.conn.execute('UPDATE conversion_options SET data=? WHERE id=?', (data, oid)) diff --git a/src/calibre/utils/serialize.py b/src/calibre/utils/serialize.py index 16315b77ae..2b8bd1e7cc 100644 --- a/src/calibre/utils/serialize.py +++ b/src/calibre/utils/serialize.py @@ -5,6 +5,7 @@ from __future__ import absolute_import, division, print_function, unicode_literals from polyglot.builtins import unicode_type +from calibre.constants import ispy3 MSGPACK_MIME = 'application/x-msgpack' @@ -114,3 +115,24 @@ def msgpack_loads(dump): def json_loads(data): import json return json.loads(data, object_hook=json_decoder) + + +if ispy3: + + def pickle_dumps(data): + import pickle + return pickle.dumps(data, -1) + + def pickle_loads(dump): + import pickle + return pickle.loads(dump, encoding='utf-8') + +else: + + def pickle_dumps(data): + import cPickle as pickle + return pickle.dumps(data, -1) + + def pickle_loads(dump): + import cPickle as pickle + return pickle.loads(dump) From 74497a4ff8d364635a37b0f4b3f815a4d90fcc2c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 14:59:33 +0530 Subject: [PATCH 0323/2613] Dont use pickle to pass temp dir to worker processes --- src/calibre/ptempfile.py | 7 ++++--- src/calibre/utils/ipc/launch.py | 17 ++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/calibre/ptempfile.py b/src/calibre/ptempfile.py index ca758fe954..56ce1c5b4f 100644 --- a/src/calibre/ptempfile.py +++ b/src/calibre/ptempfile.py @@ -105,10 +105,11 @@ def base_dir(): if _base_dir is None: td = os.environ.get('CALIBRE_WORKER_TEMP_DIR', None) if td is not None: - import cPickle, binascii + import binascii + from calibre.utils.serialize import msgpack_loads try: - td = cPickle.loads(binascii.unhexlify(td)) - except: + td = msgpack_loads(binascii.unhexlify(td)) + except Exception: td = None if td and os.path.exists(td): _base_dir = td diff --git a/src/calibre/utils/ipc/launch.py b/src/calibre/utils/ipc/launch.py index b0c777518d..14e80d9eb1 100644 --- a/src/calibre/utils/ipc/launch.py +++ b/src/calibre/utils/ipc/launch.py @@ -6,12 +6,13 @@ __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import subprocess, os, sys, time, binascii, cPickle +import subprocess, os, sys, time, binascii from functools import partial from calibre.constants import iswindows, isosx, isfrozen, filesystem_encoding from calibre.utils.config import prefs from calibre.ptempfile import PersistentTemporaryFile, base_dir +from calibre.utils.serialize import msgpack_dumps from polyglot.builtins import unicode_type, string_or_bytes if iswindows: @@ -104,9 +105,9 @@ class Worker(object): env[key] = val except: pass - env[b'CALIBRE_WORKER'] = b'1' - td = binascii.hexlify(cPickle.dumps(base_dir())) - env[b'CALIBRE_WORKER_TEMP_DIR'] = bytes(td) + env[str('CALIBRE_WORKER')] = str('1') + td = binascii.hexlify(msgpack_dumps(base_dir())).decode('ascii') + env[b'CALIBRE_WORKER_TEMP_DIR'] = str(td) env.update(self._env) return env @@ -176,13 +177,11 @@ class Worker(object): exe = self.gui_executable if self.gui else self.executable env = self.env try: - env[b'ORIGWD'] = binascii.hexlify(cPickle.dumps( - cwd or os.path.abspath(os.getcwdu()))) + origwd = cwd or os.path.abspath(os.getcwdu()) except EnvironmentError: # cwd no longer exists - env[b'ORIGWD'] = binascii.hexlify(cPickle.dumps( - cwd or os.path.expanduser(u'~'))) - + origwd = cwd or os.path.expanduser(u'~') + env[str('ORIGWD')] = binascii.hexlify(msgpack_dumps(origwd)) _cwd = cwd if priority is None: priority = prefs['worker_process_priority'] From c98cc3383d08c83bda52238219ef9f2230c08356 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 15:06:26 +0530 Subject: [PATCH 0324/2613] Dont use pickle for calculating book hashes for the server This has the unfortunate side-effect of making existing caches stale, but cant be helped, given the instability of pickle as a serialization format. --- src/calibre/srv/books.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/srv/books.py b/src/calibre/srv/books.py index ee4ce4ab83..3fd0bed4da 100644 --- a/src/calibre/srv/books.py +++ b/src/calibre/srv/books.py @@ -7,7 +7,6 @@ from __future__ import (unicode_literals, division, absolute_import, from hashlib import sha1 from functools import partial from threading import RLock, Lock -from cPickle import dumps import errno, os, tempfile, shutil, time, json as jsonlib from calibre.constants import cache_dir, iswindows @@ -17,6 +16,7 @@ from calibre.srv.render_book import RENDER_VERSION from calibre.srv.errors import HTTPNotFound, BookNotFound from calibre.srv.routes import endpoint, json from calibre.srv.utils import get_library_data, get_db +from calibre.utils.serialize import json_dumps cache_lock = RLock() queued_jobs = {} @@ -49,7 +49,7 @@ def books_cache_dir(): def book_hash(library_uuid, book_id, fmt, size, mtime): - raw = dumps((library_uuid, book_id, fmt.upper(), size, mtime, RENDER_VERSION)) + raw = json_dumps((library_uuid, book_id, fmt.upper(), size, mtime, RENDER_VERSION)) return sha1(raw).hexdigest().decode('ascii') From 69210a77832816aa481d8df3cac2b1a6c4715c6a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 15:25:58 +0530 Subject: [PATCH 0325/2613] Dont use pickle to calculate etags for tag browser data dumps --- src/calibre/srv/code.py | 6 +++--- src/calibre/srv/metadata.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/calibre/srv/code.py b/src/calibre/srv/code.py index cc61d72e6e..806577d525 100644 --- a/src/calibre/srv/code.py +++ b/src/calibre/srv/code.py @@ -4,7 +4,6 @@ from __future__ import absolute_import, division, print_function, unicode_literals -import cPickle import hashlib import random import shutil @@ -29,6 +28,7 @@ from calibre.utils.config import prefs, tweaks from calibre.utils.icu import sort_key, numeric_sort_key from calibre.utils.localization import get_lang, lang_map_for_ui, localize_website_link from calibre.utils.search_query_parser import ParseException +from calibre.utils.serialize import json_dumps POSTABLE = frozenset({'GET', 'POST', 'HEAD'}) @@ -382,9 +382,9 @@ def tag_browser(ctx, rd): &collapse_at=25&dont_collapse=&hide_empty_categories=&vl='' ''' db, library_id = get_library_data(ctx, rd)[:2] - opts = categories_settings(rd.query, db) + opts = categories_settings(rd.query, db, gst_container=tuple) vl = rd.query.get('vl') or '' - etag = cPickle.dumps([db.last_modified().isoformat(), rd.username, library_id, vl, list(opts)], -1) + etag = json_dumps([db.last_modified().isoformat(), rd.username, library_id, vl, list(opts)]) etag = hashlib.sha1(etag).hexdigest() def generate(): diff --git a/src/calibre/srv/metadata.py b/src/calibre/srv/metadata.py index 9db376d257..ec2d768a9f 100644 --- a/src/calibre/srv/metadata.py +++ b/src/calibre/srv/metadata.py @@ -192,7 +192,7 @@ def icon_map(): return _icon_map -def categories_settings(query, db): +def categories_settings(query, db, gst_container=GroupedSearchTerms): dont_collapse = frozenset(query.get('dont_collapse', '').split(',')) partition_method = query.get('partition_method', 'first letter') if partition_method not in {'first letter', 'disable', 'partition'}: @@ -214,7 +214,7 @@ def categories_settings(query, db): hidden_categories = frozenset(db.pref('tag_browser_hidden_categories', set())) return CategoriesSettings( dont_collapse, collapse_model, collapse_at, sort_by, template, - using_hierarchy, GroupedSearchTerms(db.pref('grouped_search_terms', {})), + using_hierarchy, gst_container(db.pref('grouped_search_terms', {})), hidden_categories, query.get('hide_empty_categories') == 'yes') From fae355fe6581dd6e38c81f9d66628ac1f1ee165a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 15:38:12 +0530 Subject: [PATCH 0326/2613] Replace use of pickle for icon theme cache on Linux --- src/calibre/utils/open_with/linux.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/calibre/utils/open_with/linux.py b/src/calibre/utils/open_with/linux.py index 39b314bce7..b7c150c669 100644 --- a/src/calibre/utils/open_with/linux.py +++ b/src/calibre/utils/open_with/linux.py @@ -6,13 +6,14 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2015, Kovid Goyal ' -import re, shlex, os, cPickle +import re, shlex, os from collections import defaultdict from calibre import walk, guess_type, prints, force_unicode from calibre.constants import filesystem_encoding, cache_dir from calibre.utils.icu import numeric_sort_key as sort_key from calibre.utils.localization import canonicalize_lang, get_lang +from calibre.utils.serialize import msgpack_dumps, msgpack_loads from polyglot.builtins import string_or_bytes @@ -90,7 +91,7 @@ def find_icons(): '/usr/share/pixmaps'] ans = defaultdict(list) sz_pat = re.compile(r'/((?:\d+x\d+)|scalable)/') - cache_file = os.path.join(cache_dir(), 'icon-theme-cache.pickle') + cache_file = os.path.join(cache_dir(), 'icon-theme-cache.calibre_msgpack') exts = {'.svg', '.png', '.xpm'} def read_icon_theme_dir(dirpath): @@ -114,8 +115,9 @@ def find_icons(): try: with open(cache_file, 'rb') as f: - cache = cPickle.load(f) - mtimes, cache = cache['mtimes'], cache['data'] + cache = f.read() + cache = msgpack_loads(cache) + mtimes, cache = cache['mtimes'], cache['data'] except Exception: mtimes, cache = defaultdict(int), defaultdict(dict) @@ -151,9 +153,10 @@ def find_icons(): changed = True if changed: + data = msgpack_dumps({'data':cache, 'mtimes':mtimes}) try: with open(cache_file, 'wb') as f: - cPickle.dump({'data':cache, 'mtimes':mtimes}, f, -1) + f.write(data) except Exception: import traceback traceback.print_exc() From e9b26ebb00bca06223e10c236bce2555c97dd97f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 15:48:32 +0530 Subject: [PATCH 0327/2613] Dont rely on constants from the pickle module --- src/calibre/utils/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/utils/__init__.py b/src/calibre/utils/__init__.py index 070191dd1d..c747ee4daf 100644 --- a/src/calibre/utils/__init__.py +++ b/src/calibre/utils/__init__.py @@ -28,7 +28,7 @@ def join_with_timeout(q, timeout=2): def unpickle_binary_string(data): # Maintains compatibility with python's pickle module protocol version 2 import struct - from pickle import PROTO, SHORT_BINSTRING, BINSTRING + PROTO, SHORT_BINSTRING, BINSTRING = b'\x80', b'U', b'T' if data.startswith(PROTO + b'\x02'): offset = 2 which = data[offset] @@ -47,6 +47,6 @@ def unpickle_binary_string(data): def pickle_binary_string(data): # Maintains compatibility with python's pickle module protocol version 2 import struct - from pickle import PROTO, BINSTRING, STOP + PROTO, STOP, BINSTRING = b'\x80', b'.', b'T' data = bytes(data) return PROTO + b'\x02' + BINSTRING + struct.pack(b' Date: Fri, 15 Mar 2019 15:52:12 +0530 Subject: [PATCH 0328/2613] ... --- setup/resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/resources.py b/setup/resources.py index e12cd18223..3d63baf68a 100644 --- a/setup/resources.py +++ b/setup/resources.py @@ -334,7 +334,7 @@ class Resources(Command): # {{{ if f.endswith('.py'): files.append(self.j(x[0], f)) if self.newer(dest, files): - self.info('\tCreating ebook-convert-complete.pickle') + self.info('\tCreating ' + dest) complete = {} from calibre.ebooks.conversion.plumber import supported_input_formats complete['input_fmts'] = set(supported_input_formats()) From 313ce6b0c9d904fdd998e182f602393164071e3f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 21:16:37 +0530 Subject: [PATCH 0329/2613] A spot of refactoring --- src/calibre/ebooks/metadata/archive.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/calibre/ebooks/metadata/archive.py b/src/calibre/ebooks/metadata/archive.py index 8633be19bc..251b117bd3 100644 --- a/src/calibre/ebooks/metadata/archive.py +++ b/src/calibre/ebooks/metadata/archive.py @@ -147,14 +147,22 @@ def get_comic_book_info(d, mi, series_index='volume'): pass -def get_comic_metadata(stream, stream_type, series_index='volume'): +def parse_comic_comment(comment, series_index='volume'): # See http://code.google.com/p/comicbookinfo/wiki/Example from calibre.ebooks.metadata import MetaInformation - - comment = None - + import json mi = MetaInformation(None, None) + m = json.loads(comment) + if isinstance(m, dict): + for cat in m: + if cat.startswith('ComicBookInfo'): + get_comic_book_info(m[cat], mi, series_index=series_index) + break + return mi + +def get_comic_metadata(stream, stream_type, series_index='volume'): + comment = None if stream_type == 'cbz': from calibre.utils.zipfile import ZipFile zf = ZipFile(stream) @@ -163,12 +171,4 @@ def get_comic_metadata(stream, stream_type, series_index='volume'): from calibre.utils.unrar import comment as get_comment comment = get_comment(stream) - if comment: - import json - m = json.loads(comment) - if hasattr(m, 'iterkeys'): - for cat in m.iterkeys(): - if cat.startswith('ComicBookInfo'): - get_comic_book_info(m[cat], mi, series_index=series_index) - break - return mi + return parse_comic_comment(comment or b'{}', series_index=series_index) From e73e782b56d39769fcae731c9b659640b926a7f4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 21:33:26 +0530 Subject: [PATCH 0330/2613] Remove use of pickle for passing listen address to calibre workers --- src/calibre/utils/ipc/server.py | 36 ++++++++++++++++---------- src/calibre/utils/ipc/simple_worker.py | 9 ++++--- src/calibre/utils/ipc/worker.py | 8 +++--- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/src/calibre/utils/ipc/server.py b/src/calibre/utils/ipc/server.py index 4452d9809c..f96d9d11ed 100644 --- a/src/calibre/utils/ipc/server.py +++ b/src/calibre/utils/ipc/server.py @@ -1,28 +1,35 @@ #!/usr/bin/env python2 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai -from __future__ import with_statement -from __future__ import print_function +from __future__ import print_function, with_statement __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import sys, os, cPickle, time, tempfile, errno, itertools -from math import ceil -from threading import Thread, RLock -from Queue import Queue, Empty -from multiprocessing.connection import Listener, arbitrary_address -from collections import deque -from binascii import hexlify +import errno +import itertools +import os +import sys +import tempfile +import time +from binascii import hexlify +from collections import deque +from math import ceil +from multiprocessing.connection import Listener, arbitrary_address +from Queue import Empty, Queue +from threading import RLock, Thread + +from calibre import detect_ncpus as cpu_count +from calibre.constants import DEBUG, islinux, iswindows +from calibre.ptempfile import base_dir from calibre.utils.ipc import eintr_retry_call from calibre.utils.ipc.launch import Worker from calibre.utils.ipc.worker import PARALLEL_FUNCS -from calibre import detect_ncpus as cpu_count -from calibre.constants import iswindows, DEBUG, islinux -from calibre.ptempfile import base_dir +from calibre.utils.serialize import msgpack_dumps, pickle_loads from polyglot.builtins import string_or_bytes + _counter = 0 @@ -212,7 +219,7 @@ class Server(Thread): redirect_output = not gui env = { - 'CALIBRE_WORKER_ADDRESS' : hexlify(cPickle.dumps(self.listener.address, -1)), + 'CALIBRE_WORKER_ADDRESS' : hexlify(msgpack_dumps(self.listener.address)), 'CALIBRE_WORKER_KEY' : hexlify(self.auth_key), 'CALIBRE_WORKER_RESULT' : hexlify(rfile.encode('utf-8')), } @@ -281,7 +288,8 @@ class Server(Thread): job.returncode = worker.returncode elif os.path.exists(worker.rfile): try: - job.result = cPickle.load(open(worker.rfile, 'rb')) + with lopen(worker.rfile, 'rb') as f: + job.result = pickle_loads(f.read()) os.remove(worker.rfile) except: pass diff --git a/src/calibre/utils/ipc/simple_worker.py b/src/calibre/utils/ipc/simple_worker.py index 78c280ce60..880ba69665 100644 --- a/src/calibre/utils/ipc/simple_worker.py +++ b/src/calibre/utils/ipc/simple_worker.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import os, cPickle, traceback, time, importlib +import os, traceback, time, importlib from binascii import hexlify, unhexlify from multiprocessing.connection import Client from threading import Thread @@ -16,6 +16,7 @@ from contextlib import closing from calibre.constants import iswindows from calibre.utils.ipc import eintr_retry_call from calibre.utils.ipc.launch import Worker +from calibre.utils.serialize import msgpack_loads, msgpack_dumps from polyglot.builtins import unicode_type, string_or_bytes @@ -130,7 +131,7 @@ def create_worker(env, priority='normal', cwd=None, func='main'): env = dict(env) env.update({ - 'CALIBRE_WORKER_ADDRESS': hexlify(cPickle.dumps(listener.address, -1)), + 'CALIBRE_WORKER_ADDRESS': hexlify(msgpack_dumps(listener.address)), 'CALIBRE_WORKER_KEY': hexlify(auth_key), 'CALIBRE_SIMPLE_WORKER': 'calibre.utils.ipc.simple_worker:%s' % func, }) @@ -270,7 +271,7 @@ def compile_code(src): def main(): # The entry point for the simple worker process - address = cPickle.loads(unhexlify(os.environ['CALIBRE_WORKER_ADDRESS'])) + address = msgpack_loads(unhexlify(os.environ['CALIBRE_WORKER_ADDRESS'])) key = unhexlify(os.environ['CALIBRE_WORKER_KEY']) with closing(Client(address, authkey=key)) as conn: args = eintr_retry_call(conn.recv) @@ -300,7 +301,7 @@ def main(): def offload(): # The entry point for the offload worker process - address = cPickle.loads(unhexlify(os.environ['CALIBRE_WORKER_ADDRESS'])) + address = msgpack_loads(unhexlify(os.environ['CALIBRE_WORKER_ADDRESS'])) key = unhexlify(os.environ['CALIBRE_WORKER_KEY']) func_cache = {} with closing(Client(address, authkey=key)) as conn: diff --git a/src/calibre/utils/ipc/worker.py b/src/calibre/utils/ipc/worker.py index e48d94e860..c4ca19cd13 100644 --- a/src/calibre/utils/ipc/worker.py +++ b/src/calibre/utils/ipc/worker.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import os, cPickle, sys, importlib +import os, sys, importlib from multiprocessing.connection import Client from threading import Thread from Queue import Queue @@ -18,6 +18,7 @@ from zipimport import ZipImportError from calibre import prints from calibre.constants import iswindows, isosx from calibre.utils.ipc import eintr_retry_call +from calibre.utils.serialize import msgpack_loads, pickle_dumps PARALLEL_FUNCS = { 'lrfviewer' : @@ -182,7 +183,7 @@ def main(): print('Failed to run pipe worker with command:', sys.argv[-1]) raise return - address = cPickle.loads(unhexlify(os.environ['CALIBRE_WORKER_ADDRESS'])) + address = msgpack_loads(unhexlify(os.environ['CALIBRE_WORKER_ADDRESS'])) key = unhexlify(os.environ['CALIBRE_WORKER_KEY']) resultf = unhexlify(os.environ['CALIBRE_WORKER_RESULT']).decode('utf-8') with closing(Client(address, authkey=key)) as conn: @@ -198,7 +199,8 @@ def main(): result = func(*args, **kwargs) if result is not None and os.path.exists(os.path.dirname(resultf)): - cPickle.dump(result, open(resultf, 'wb'), -1) + with lopen(resultf, 'wb') as f: + f.write(pickle_dumps(result)) notifier.queue.put(None) From dbcb63c290962eab1830ab77756ff8c5440d3319 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 21:45:54 +0530 Subject: [PATCH 0331/2613] Ensure worker env keys are bytes/unicodeon py2/3 --- src/calibre/utils/ipc/server.py | 9 +++++---- src/calibre/utils/ipc/simple_worker.py | 8 ++++---- src/polyglot/builtins.py | 9 +++++++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/calibre/utils/ipc/server.py b/src/calibre/utils/ipc/server.py index f96d9d11ed..58269ce4a5 100644 --- a/src/calibre/utils/ipc/server.py +++ b/src/calibre/utils/ipc/server.py @@ -27,7 +27,7 @@ from calibre.utils.ipc import eintr_retry_call from calibre.utils.ipc.launch import Worker from calibre.utils.ipc.worker import PARALLEL_FUNCS from calibre.utils.serialize import msgpack_dumps, pickle_loads -from polyglot.builtins import string_or_bytes +from polyglot.builtins import string_or_bytes, environ_item _counter = 0 @@ -219,9 +219,10 @@ class Server(Thread): redirect_output = not gui env = { - 'CALIBRE_WORKER_ADDRESS' : hexlify(msgpack_dumps(self.listener.address)), - 'CALIBRE_WORKER_KEY' : hexlify(self.auth_key), - 'CALIBRE_WORKER_RESULT' : hexlify(rfile.encode('utf-8')), + 'CALIBRE_WORKER_ADDRESS' : environ_item(hexlify(msgpack_dumps( + self.listener.address))), + 'CALIBRE_WORKER_KEY' : environ_item(hexlify(self.auth_key)), + 'CALIBRE_WORKER_RESULT' : environ_item(hexlify(rfile.encode('utf-8'))), } cw = self.do_launch(env, gui, redirect_output, rfile, job_name=job_name) if isinstance(cw, string_or_bytes): diff --git a/src/calibre/utils/ipc/simple_worker.py b/src/calibre/utils/ipc/simple_worker.py index 880ba69665..1a8b91ab4b 100644 --- a/src/calibre/utils/ipc/simple_worker.py +++ b/src/calibre/utils/ipc/simple_worker.py @@ -17,7 +17,7 @@ from calibre.constants import iswindows from calibre.utils.ipc import eintr_retry_call from calibre.utils.ipc.launch import Worker from calibre.utils.serialize import msgpack_loads, msgpack_dumps -from polyglot.builtins import unicode_type, string_or_bytes +from polyglot.builtins import unicode_type, string_or_bytes, environ_item class WorkerError(Exception): @@ -131,9 +131,9 @@ def create_worker(env, priority='normal', cwd=None, func='main'): env = dict(env) env.update({ - 'CALIBRE_WORKER_ADDRESS': hexlify(msgpack_dumps(listener.address)), - 'CALIBRE_WORKER_KEY': hexlify(auth_key), - 'CALIBRE_SIMPLE_WORKER': 'calibre.utils.ipc.simple_worker:%s' % func, + 'CALIBRE_WORKER_ADDRESS': environ_item(hexlify(msgpack_dumps(listener.address))), + 'CALIBRE_WORKER_KEY': environ_item(hexlify(auth_key)), + 'CALIBRE_SIMPLE_WORKER': environ_item('calibre.utils.ipc.simple_worker:%s' % func), }) w = Worker(env) diff --git a/src/polyglot/builtins.py b/src/polyglot/builtins.py index 806807f43c..5209ef698a 100644 --- a/src/polyglot/builtins.py +++ b/src/polyglot/builtins.py @@ -40,6 +40,10 @@ if is_py3: def iterkeys(d): return iter(d) + def environ_item(x): + if isinstance(x, bytes): + x = x.decode('utf-8') + return x else: exec("""def reraise(tp, value, tb=None): try: @@ -64,3 +68,8 @@ else: def itervalues(d): return d.itervalues() + + def environ_item(x): + if isinstance(x, unicode_type): + x = x.encode('utf-8') + return x From 20b9cc3a813b0ac646d03d93725e20dfa32c3282 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 21:46:48 +0530 Subject: [PATCH 0332/2613] Remove unused code --- src/calibre/utils/ipc/proxy.py | 168 --------------------------------- 1 file changed, 168 deletions(-) delete mode 100644 src/calibre/utils/ipc/proxy.py diff --git a/src/calibre/utils/ipc/proxy.py b/src/calibre/utils/ipc/proxy.py deleted file mode 100644 index 349267a240..0000000000 --- a/src/calibre/utils/ipc/proxy.py +++ /dev/null @@ -1,168 +0,0 @@ -#!/usr/bin/env python2 -# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai -from __future__ import (unicode_literals, division, absolute_import, - print_function) - -__license__ = 'GPL v3' -__copyright__ = '2011, Kovid Goyal ' -__docformat__ = 'restructuredtext en' - -import os, cPickle, struct -from threading import Thread -from Queue import Queue, Empty -from multiprocessing.connection import arbitrary_address, Listener -from functools import partial - -from calibre import as_unicode, prints -from calibre.constants import iswindows, DEBUG -from calibre.utils.ipc import eintr_retry_call -from polyglot.builtins import unicode_type - - -def _encode(msg): - raw = cPickle.dumps(msg, -1) - size = len(raw) - header = struct.pack('!Q', size) - return header + raw - - -def _decode(raw): - sz = struct.calcsize('!Q') - if len(raw) < sz: - return 'invalid', None - header, = struct.unpack('!Q', raw[:sz]) - if len(raw) != sz + header or header == 0: - return 'invalid', None - return cPickle.loads(raw[sz:]) - - -class Writer(Thread): - - TIMEOUT = 60 # seconds - - def __init__(self, conn): - Thread.__init__(self) - self.daemon = True - self.dataq, self.resultq = Queue(), Queue() - self.conn = conn - self.start() - self.data_written = False - - def close(self): - self.dataq.put(None) - - def flush(self): - pass - - def write(self, raw_data): - self.dataq.put(raw_data) - - try: - ex = self.resultq.get(True, self.TIMEOUT) - except Empty: - raise IOError('Writing to socket timed out') - else: - if ex is not None: - raise IOError('Writing to socket failed with error: %s' % ex) - - def run(self): - while True: - x = self.dataq.get() - if x is None: - break - try: - self.data_written = True - eintr_retry_call(self.conn.send_bytes, x) - except Exception as e: - self.resultq.put(as_unicode(e)) - else: - self.resultq.put(None) - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - self.close() - - -class Server(Thread): - - def __init__(self, dispatcher): - Thread.__init__(self) - self.daemon = True - - self.auth_key = os.urandom(32) - self.address = arbitrary_address('AF_PIPE' if iswindows else 'AF_UNIX') - if iswindows and self.address[1] == ':': - self.address = self.address[2:] - self.listener = Listener(address=self.address, - authkey=self.auth_key, backlog=4) - - self.keep_going = True - self.dispatcher = dispatcher - - @property - def connection_information(self): - if not self.is_alive(): - self.start() - return (self.address, self.auth_key) - - def stop(self): - self.keep_going = False - try: - self.listener.close() - except: - pass - - def run(self): - while self.keep_going: - try: - conn = eintr_retry_call(self.listener.accept) - self.handle_client(conn) - except: - pass - - def handle_client(self, conn): - t = Thread(target=partial(self._handle_client, conn)) - t.daemon = True - t.start() - - def _handle_client(self, conn): - while True: - try: - func_name, args, kwargs = eintr_retry_call(conn.recv) - except EOFError: - try: - conn.close() - except: - pass - return - else: - try: - self.call_func(func_name, args, kwargs, conn) - except: - try: - conn.close() - except: - pass - prints('Proxy function: %s with args: %r and' - ' kwargs: %r failed') - if DEBUG: - import traceback - traceback.print_exc() - break - - def call_func(self, func_name, args, kwargs, conn): - with Writer(conn) as f: - try: - self.dispatcher(f, func_name, args, kwargs) - except Exception as e: - if not f.data_written: - import traceback - # Try to tell the client process what error happened - try: - eintr_retry_call(conn.send_bytes, (_encode(('failed', (unicode_type(e), - as_unicode(traceback.format_exc())))))) - except: - pass - raise From d3ccd4369b7ff9c249559c32daba01c9a40b19c3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Mar 2019 21:57:32 +0530 Subject: [PATCH 0333/2613] Make use of pickle in ipc.pool work on py3 as well --- src/calibre/utils/ipc/pool.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/calibre/utils/ipc/pool.py b/src/calibre/utils/ipc/pool.py index a36de998cd..aff69e4354 100644 --- a/src/calibre/utils/ipc/pool.py +++ b/src/calibre/utils/ipc/pool.py @@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2014, Kovid Goyal ' -import os, cPickle, sys +import os, sys from threading import Thread from collections import namedtuple from Queue import Queue @@ -16,6 +16,7 @@ from calibre.constants import iswindows, DEBUG from calibre.ptempfile import PersistentTemporaryFile from calibre.utils import join_with_timeout from calibre.utils.ipc import eintr_retry_call +from calibre.utils.serialize import msgpack_dumps, msgpack_loads, pickle_dumps, pickle_loads Job = namedtuple('Job', 'id module func args kwargs') Result = namedtuple('Result', 'value err traceback') @@ -95,7 +96,7 @@ class Worker(object): self.name = name or '' def __call__(self, job): - eintr_retry_call(self.conn.send_bytes, cPickle.dumps(job, -1)) + eintr_retry_call(self.conn.send_bytes, pickle_dumps(job)) if job is not None: self.job_id = job.id t = Thread(target=self.recv, name='PoolWorker-'+self.name) @@ -104,7 +105,7 @@ class Worker(object): def recv(self): try: - result = cPickle.loads(eintr_retry_call(self.conn.recv_bytes)) + result = pickle_loads(eintr_retry_call(self.conn.recv_bytes)) wr = WorkerResult(self.job_id, result, False, self) except Exception as err: import traceback @@ -130,7 +131,7 @@ class Pool(Thread): self.results = Queue() self.tracker = Queue() self.terminal_failure = None - self.common_data = cPickle.dumps(None, -1) + self.common_data = pickle_dumps(None) self.worker_data = None self.shutting_down = False @@ -192,7 +193,7 @@ class Pool(Thread): p.stdin.flush(), p.stdin.close() conn = eintr_retry_call(self.listener.accept) w = Worker(p, conn, self.events, self.name) - if self.common_data != cPickle.dumps(None, -1): + if self.common_data != pickle_dumps(None): w.set_common_data(self.common_data) return w @@ -211,7 +212,7 @@ class Pool(Thread): from calibre.utils.ipc.server import create_listener self.auth_key = os.urandom(32) self.address, self.listener = create_listener(self.auth_key) - self.worker_data = cPickle.dumps((self.address, self.auth_key), -1) + self.worker_data = msgpack_dumps((self.address, self.auth_key)) if self.start_worker() is False: return @@ -243,12 +244,12 @@ class Pool(Thread): return False self.results.put(worker_result) else: - self.common_data = cPickle.dumps(event, -1) + self.common_data = pickle_dumps(event) if len(self.common_data) > MAX_SIZE: self.cd_file = PersistentTemporaryFile('pool_common_data') with self.cd_file as f: f.write(self.common_data) - self.common_data = cPickle.dumps(File(f.name), -1) + self.common_data = pickle_dumps(File(f.name)) for worker in self.available_workers: try: worker.set_common_data(self.common_data) @@ -340,7 +341,7 @@ def worker_main(conn): common_data = None while True: try: - job = cPickle.loads(eintr_retry_call(conn.recv_bytes)) + job = pickle_loads(eintr_retry_call(conn.recv_bytes)) except EOFError: break except KeyboardInterrupt: @@ -354,7 +355,9 @@ def worker_main(conn): break if not isinstance(job, Job): if isinstance(job, File): - common_data = cPickle.load(open(job.name, 'rb')) + with lopen(job.name, 'rb') as f: + common_data = f.read() + common_data = pickle_loads(common_data) else: common_data = job continue @@ -374,7 +377,7 @@ def worker_main(conn): import traceback result = Result(None, as_unicode(err), traceback.format_exc()) try: - eintr_retry_call(conn.send_bytes, cPickle.dumps(result, -1)) + eintr_retry_call(conn.send_bytes, pickle_dumps(result)) except EOFError: break except Exception: @@ -388,7 +391,8 @@ def worker_main(conn): def run_main(func): from multiprocessing.connection import Client from contextlib import closing - address, key = cPickle.loads(eintr_retry_call(sys.stdin.read)) + stdin = getattr(sys.stdin, 'buffer', sys.stdin) + address, key = msgpack_loads(eintr_retry_call(stdin.read)) with closing(Client(address, authkey=key)) as conn: raise SystemExit(func(conn)) From 4a967a28c300ee4f74324f664d60b5a54ac13a50 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Mar 2019 09:06:47 +0530 Subject: [PATCH 0334/2613] Remove unused code --- src/calibre/gui2/dialogs/comicconf.py | 91 ------------ src/calibre/gui2/dialogs/comicconf.ui | 202 -------------------------- src/calibre/utils/config_base.py | 6 - 3 files changed, 299 deletions(-) delete mode 100644 src/calibre/gui2/dialogs/comicconf.py delete mode 100644 src/calibre/gui2/dialogs/comicconf.ui diff --git a/src/calibre/gui2/dialogs/comicconf.py b/src/calibre/gui2/dialogs/comicconf.py deleted file mode 100644 index 2bffd4a4c7..0000000000 --- a/src/calibre/gui2/dialogs/comicconf.py +++ /dev/null @@ -1,91 +0,0 @@ -from __future__ import with_statement -__license__ = 'GPL v3' -__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' -__docformat__ = 'restructuredtext en' - -'''''' -from PyQt5.Qt import QDialog -from calibre.gui2.dialogs.comicconf_ui import Ui_Dialog -from calibre.ebooks.lrf.comic.convert_from import config, PROFILES -from polyglot.builtins import unicode_type - - -def set_conversion_defaults(window): - d = ComicConf(window) - d.exec_() - - -def get_bulk_conversion_options(window): - d = ComicConf(window, config_defaults=config(None).as_string()) - if d.exec_() == QDialog.Accepted: - return d.config.parse() - - -def get_conversion_options(window, defaults, title, author): - if defaults is None: - defaults = config(None).as_string() - defaults += '\ntitle=%s\nauthor=%s'%(repr(title), repr(author)) - d = ComicConf(window, config_defaults=defaults, generic=False) - if d.exec_() == QDialog.Accepted: - return d.config.parse(), d.config.src - return None, None - - -class ComicConf(QDialog, Ui_Dialog): - - def __init__(self, window, config_defaults=None, generic=True, - title=_('Set defaults for conversion of comics (CBR/CBZ files)')): - QDialog.__init__(self, window) - Ui_Dialog.__init__(self) - self.setupUi(self) - self.setWindowTitle(title) - self.config = config(config_defaults) - opts = self.config.parse() - if generic: - for i in ('title', 'author'): - getattr(self, 'opt_'+i).setVisible(False) - getattr(self, i+'_label').setVisible(False) - else: - title = opts.title - if not title: - title = _('Unknown') - self.setWindowTitle(_('Set options for converting %s')%title) - author = opts.author - self.opt_title.setText(title) - self.opt_author.setText(author) - self.opt_colors.setValue(opts.colors) - self.opt_profile.addItem(opts.profile) - for x in PROFILES.keys(): - if x != opts.profile: - self.opt_profile.addItem(x) - self.opt_dont_normalize.setChecked(opts.dont_normalize) - self.opt_keep_aspect_ratio.setChecked(opts.keep_aspect_ratio) - self.opt_dont_sharpen.setChecked(opts.dont_sharpen) - self.opt_landscape.setChecked(opts.landscape) - self.opt_no_sort.setChecked(opts.no_sort) - self.opt_despeckle.setChecked(opts.despeckle) - self.opt_wide.setChecked(opts.wide) - self.opt_right2left.setChecked(opts.right2left) - - for opt in self.config.option_set.preferences: - g = getattr(self, 'opt_'+opt.name, False) - if opt.help and g: - g.setToolTip(opt.help) - - def accept(self): - for opt in self.config.option_set.preferences: - g = getattr(self, 'opt_'+opt.name, False) - if not g or not g.isVisible(): - continue - if hasattr(g, 'isChecked'): - val = bool(g.isChecked()) - elif hasattr(g, 'value'): - val = g.value() - elif hasattr(g, 'itemText'): - val = unicode_type(g.itemText(g.currentIndex())) - elif hasattr(g, 'text'): - val = unicode_type(g.text()) - else: - raise Exception('Bad coding') - self.config.set(opt.name, val) - return QDialog.accept(self) diff --git a/src/calibre/gui2/dialogs/comicconf.ui b/src/calibre/gui2/dialogs/comicconf.ui deleted file mode 100644 index 309ff84945..0000000000 --- a/src/calibre/gui2/dialogs/comicconf.ui +++ /dev/null @@ -1,202 +0,0 @@ - - - Dialog - - - - 0 - 0 - 646 - 503 - - - - Dialog - - - - :/images/convert.png:/images/convert.png - - - - - - &Title: - - - opt_title - - - - - - - - - - &Author(s): - - - opt_author - - - - - - - - - - &Number of colors: - - - opt_colors - - - - - - - 8 - - - 3200000 - - - 8 - - - - - - - &Profile: - - - opt_profile - - - - - - - - - - Disable &normalize - - - - - - - Keep &aspect ratio - - - - - - - Disable &sharpening - - - - - - - &Landscape - - - - - - - Don't so&rt - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - &Right to left - - - - - - - De&speckle - - - - - - - &Wide - - - - - - - Disable &trimming - - - - - - - - EnLineEdit - QLineEdit -
calibre/gui2/widgets.h
-
-
- - - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - -
diff --git a/src/calibre/utils/config_base.py b/src/calibre/utils/config_base.py index 5ef1ef5f98..4362e741cc 100644 --- a/src/calibre/utils/config_base.py +++ b/src/calibre/utils/config_base.py @@ -288,12 +288,6 @@ class Config(ConfigInterface): traceback.print_exc() return self.option_set.parse_string(src) - def as_string(self): - if not os.path.exists(self.config_file_path): - return '' - with ExclusiveFile(self.config_file_path) as f: - return f.read().decode('utf-8') - def set(self, name, val): if not self.option_set.has_option(name): raise ValueError('The option %s is not defined.'%name) From 869c2bf89ec4768a94ecc55924d585b45895418d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Mar 2019 09:59:37 +0530 Subject: [PATCH 0335/2613] Persist QByteArray as python bytearrays in JSONConfig --- src/calibre/utils/config.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py index a7e956b991..9f02432e2e 100644 --- a/src/calibre/utils/config.py +++ b/src/calibre/utils/config.py @@ -386,19 +386,23 @@ class XMLConfig(dict): def to_json(obj): if isinstance(obj, bytearray): return {'__class__': 'bytearray', - '__value__': base64.standard_b64encode(bytes(obj))} + '__value__': base64.standard_b64encode(bytes(obj)).decode('ascii')} if isinstance(obj, datetime.datetime): from calibre.utils.date import isoformat return {'__class__': 'datetime.datetime', '__value__': isoformat(obj, as_utc=True)} + if hasattr(obj, 'toBase64'): + return {'__class__': 'bytearray', + '__value__': bytes(obj.toBase64()).decode('ascii')} raise TypeError(repr(obj) + ' is not JSON serializable') def from_json(obj): - if '__class__' in obj: - if obj['__class__'] == 'bytearray': + custom = obj.get('__class__') + if custom is not None: + if custom == 'bytearray': return bytearray(base64.standard_b64decode(obj['__value__'])) - if obj['__class__'] == 'datetime.datetime': + if custom == 'datetime.datetime': from calibre.utils.iso8601 import parse_iso8601 return parse_iso8601(obj['__value__'], assume_utc=True) return obj From 138a0338f73e4389869706fa20ac6be1a515b755 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Mar 2019 10:22:54 +0530 Subject: [PATCH 0336/2613] DRYer --- src/calibre/utils/config.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py index 9f02432e2e..b3163e6b49 100644 --- a/src/calibre/utils/config.py +++ b/src/calibre/utils/config.py @@ -205,11 +205,14 @@ class DynamicConfig(dict): dict.__init__(self, {}) self.name = name self.defaults = {} - self.file_path = os.path.join(config_dir, name+'.pickle') self.refresh() + @property + def file_path(self): + return os.path.join(config_dir, self.name+'.pickle') + def decouple(self, prefix): - self.file_path = os.path.join(os.path.dirname(self.file_path), prefix + os.path.basename(self.file_path)) + self.name = prefix + self.name self.refresh() def refresh(self, clear_current=True): @@ -221,7 +224,7 @@ class DynamicConfig(dict): d = cPickle.loads(raw) if raw.strip() else {} except SystemError: pass - except: + except Exception: print('WARNING: Failed to unpickle stored config object, ignoring') if DEBUG: import traceback @@ -251,14 +254,15 @@ class DynamicConfig(dict): self.__setitem__(key, val) def commit(self): - if hasattr(self, 'file_path') and self.file_path: - if not os.path.exists(self.file_path): - make_config_dir() - with ExclusiveFile(self.file_path) as f: - raw = cPickle.dumps(self, -1) - f.seek(0) - f.truncate() - f.write(raw) + if not getattr(self, 'name', None): + return + if not os.path.exists(self.file_path): + make_config_dir() + raw = cPickle.dumps(self, -1) + with ExclusiveFile(self.file_path) as f: + f.seek(0) + f.truncate() + f.write(raw) dynamic = DynamicConfig() From 8921bb83241036a0ee4dab6cbed5fc2d32149723 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Mar 2019 11:09:23 +0530 Subject: [PATCH 0337/2613] Reduce file lock time --- src/calibre/utils/config.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py index b3163e6b49..f74fcb3c7a 100644 --- a/src/calibre/utils/config.py +++ b/src/calibre/utils/config.py @@ -219,17 +219,17 @@ class DynamicConfig(dict): d = {} if os.path.exists(self.file_path): with ExclusiveFile(self.file_path) as f: - raw = f.read() - try: - d = cPickle.loads(raw) if raw.strip() else {} - except SystemError: - pass - except Exception: - print('WARNING: Failed to unpickle stored config object, ignoring') - if DEBUG: - import traceback - traceback.print_exc() - d = {} + raw = f.read().strip() + try: + d = cPickle.loads(raw) if raw else {} + except SystemError: + pass + except Exception: + print('WARNING: Failed to unpickle stored config object, ignoring') + if DEBUG: + import traceback + traceback.print_exc() + d = {} if clear_current: self.clear() self.update(d) From dc274d8c1c789dde1c2e629e6c3bb4eb0ca5d071 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Mar 2019 12:17:14 +0530 Subject: [PATCH 0338/2613] Use ABC to test for numbers type This is important as long does not exist on py3 and anyway using an ABC is more robust. Also fix a few uses of long() for py3. --- src/calibre/customize/conversion.py | 4 ++-- src/calibre/db/__init__.py | 5 +++-- src/calibre/db/tables.py | 3 ++- src/calibre/db/tests/legacy.py | 4 ++-- src/calibre/db/view.py | 4 ++-- src/calibre/devices/prst1/driver.py | 4 ++-- src/calibre/ebooks/__init__.py | 4 ++-- src/calibre/ebooks/conversion/cli.py | 6 +++--- src/calibre/ebooks/covers.py | 6 +++--- src/calibre/ebooks/css_transform_rules.py | 4 ++-- src/calibre/ebooks/docx/block_styles.py | 5 +++-- src/calibre/ebooks/docx/writer/styles.py | 7 ++++--- src/calibre/ebooks/epub/cfi/tests.py | 4 ++-- src/calibre/ebooks/lit/mssha1.py | 12 ++++++------ src/calibre/ebooks/lit/writer.py | 3 ++- src/calibre/ebooks/lrf/html/table.py | 6 +++--- src/calibre/ebooks/metadata/mobi.py | 6 +++--- src/calibre/ebooks/metadata/topaz.py | 6 +++--- src/calibre/ebooks/mobi/debug/headers.py | 4 ++-- src/calibre/ebooks/mobi/mobiml.py | 7 ++++--- src/calibre/ebooks/mobi/writer2/indexer.py | 7 ++++--- src/calibre/ebooks/mobi/writer8/header.py | 7 ++----- src/calibre/ebooks/oeb/iterator/bookmarks.py | 4 ++-- src/calibre/ebooks/oeb/normalize_css.py | 3 ++- src/calibre/ebooks/oeb/stylizer.py | 10 +++++----- src/calibre/ebooks/oeb/transforms/flatcss.py | 6 +++--- src/calibre/ebooks/oeb/transforms/page_margin.py | 3 ++- src/calibre/ebooks/pdb/header.py | 4 ++-- src/calibre/ebooks/pdf/reflow.py | 6 +++--- src/calibre/ebooks/pdf/render/common.py | 4 ++-- src/calibre/ebooks/pdf/render/from_html.py | 4 ++-- src/calibre/ebooks/pdf/render/serialize.py | 6 +++--- src/calibre/ebooks/txt/processor.py | 4 ++-- src/calibre/gui2/actions/save_to_disk.py | 4 ++-- src/calibre/gui2/dialogs/metadata_bulk.py | 4 ++-- src/calibre/gui2/library/models.py | 6 +++--- src/calibre/gui2/lrf_renderer/text.py | 8 ++++---- src/calibre/gui2/metadata/config.py | 4 ++-- src/calibre/gui2/preferences/device_user_defined.py | 3 ++- src/calibre/gui2/preferences/server.py | 5 +++-- src/calibre/gui2/progress_indicator/__init__.py | 3 ++- .../tweak_book/editor/syntax/pygments_highlighter.py | 3 ++- src/calibre/gui2/tweak_book/preferences.py | 5 +++-- src/calibre/gui2/viewer/position.py | 4 ++-- src/calibre/library/catalogs/bibtex.py | 4 ++-- src/calibre/library/custom_columns.py | 4 ++-- src/calibre/library/database2.py | 4 ++-- src/calibre/srv/opts.py | 6 +++--- src/calibre/srv/routes.py | 2 +- src/calibre/srv/tests/web_sockets.py | 8 ++++---- src/calibre/utils/Zeroconf.py | 3 ++- src/calibre/utils/chm/chm.py | 3 ++- src/calibre/utils/config_base.py | 6 +++--- src/calibre/utils/formatter.py | 4 ++-- src/calibre/utils/formatter_functions.py | 4 ++-- src/calibre/utils/rss_gen.py | 8 ++++---- src/calibre/utils/winreg/dde.py | 6 +++++- src/calibre/utils/winreg/lib.py | 4 ++-- src/polyglot/builtins.py | 2 ++ 59 files changed, 154 insertions(+), 135 deletions(-) diff --git a/src/calibre/customize/conversion.py b/src/calibre/customize/conversion.py index 14fb114cfb..c760d3c8dc 100644 --- a/src/calibre/customize/conversion.py +++ b/src/calibre/customize/conversion.py @@ -2,7 +2,7 @@ ''' Defines the plugin system for conversions. ''' -import re, os, shutil +import re, os, shutil, numbers from calibre import CurrentDir from calibre.customize import Plugin @@ -80,7 +80,7 @@ class OptionRecommendation(object): self.option.choices: raise ValueError('OpRec: %s: Recommended value not in choices'% self.option.name) - if not (isinstance(self.recommended_value, (int, float, str, unicode_type)) or self.recommended_value is None): + if not (isinstance(self.recommended_value, (numbers.Number, bytes, unicode_type)) or self.recommended_value is None): raise ValueError('OpRec: %s:'%self.option.name + repr( self.recommended_value) + ' is not a string or a number') diff --git a/src/calibre/db/__init__.py b/src/calibre/db/__init__.py index 277ffbdd76..87144e4890 100644 --- a/src/calibre/db/__init__.py +++ b/src/calibre/db/__init__.py @@ -9,6 +9,7 @@ __docformat__ = 'restructuredtext en' SPOOL_SIZE = 30*1024*1024 +import numbers from polyglot.builtins import range @@ -16,7 +17,7 @@ def _get_next_series_num_for_list(series_indices, unwrap=True): from calibre.utils.config_base import tweaks from math import ceil, floor if not series_indices: - if isinstance(tweaks['series_index_auto_increment'], (int, float)): + if isinstance(tweaks['series_index_auto_increment'], numbers.Number): return float(tweaks['series_index_auto_increment']) return 1.0 if unwrap: @@ -38,7 +39,7 @@ def _get_next_series_num_for_list(series_indices, unwrap=True): if i not in series_indices: return i return series_indices[-1] + 1 - if isinstance(tweaks['series_index_auto_increment'], (int, float)): + if isinstance(tweaks['series_index_auto_increment'], numbers.Number): return float(tweaks['series_index_auto_increment']) return 1.0 diff --git a/src/calibre/db/tables.py b/src/calibre/db/tables.py index c165edc961..1dfd722ff0 100644 --- a/src/calibre/db/tables.py +++ b/src/calibre/db/tables.py @@ -7,6 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' +import numbers from datetime import datetime, timedelta from collections import defaultdict @@ -24,7 +25,7 @@ def c_parse(val): except (AttributeError, TypeError): # If a value like 2001 is stored in the column, apsw will return it as # an int - if isinstance(val, (int, float)): + if isinstance(val, numbers.Number): return datetime(int(val), 1, 3, tzinfo=utc_tz) if val is None: return UNDEFINED_DATE diff --git a/src/calibre/db/tests/legacy.py b/src/calibre/db/tests/legacy.py index 7282b7fc47..919f817b00 100644 --- a/src/calibre/db/tests/legacy.py +++ b/src/calibre/db/tests/legacy.py @@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' -import inspect, time +import inspect, time, numbers from io import BytesIO from repr import repr from functools import partial @@ -109,7 +109,7 @@ class LegacyTest(BaseTest): def get_values(db): ans = {} for label, loc in db.FIELD_MAP.iteritems(): - if isinstance(label, int): + if isinstance(label, numbers.Integral): label = '#'+db.custom_column_num_map[label]['label'] label = type('')(label) ans[label] = tuple(db.get_property(i, index_is_id=True, loc=loc) diff --git a/src/calibre/db/view.py b/src/calibre/db/view.py index 87663a980d..d4811434c0 100644 --- a/src/calibre/db/view.py +++ b/src/calibre/db/view.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import weakref, operator +import weakref, operator, numbers from functools import partial from itertools import izip, imap from polyglot.builtins import map, unicode_type, range @@ -98,7 +98,7 @@ class View(object): 'marked': self.get_marked, 'series_sort':self.get_series_sort, }.get(col, self._get) - if isinstance(col, int): + if isinstance(col, numbers.Integral): label = self.cache.backend.custom_column_num_map[col]['label'] label = (self.cache.backend.field_metadata.custom_field_prefix + label) if label.endswith('_index'): diff --git a/src/calibre/devices/prst1/driver.py b/src/calibre/devices/prst1/driver.py index 3dbb353713..5b6995b88f 100644 --- a/src/calibre/devices/prst1/driver.py +++ b/src/calibre/devices/prst1/driver.py @@ -24,7 +24,7 @@ from calibre.devices.usbms.books import CollectionsBookList from calibre.devices.usbms.books import BookList from calibre.ebooks.metadata import authors_to_sort_string, authors_to_string from calibre.constants import islinux -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, long_type DBPATH = 'Sony_Reader/database/books.db' THUMBPATH = 'Sony_Reader/database/cache/books/%s/thumbnail/main_thumbnail.jpg' @@ -330,7 +330,7 @@ class PRST1(USBMS): cursor.execute(query) row = cursor.fetchone() - return long(row[0]) + return long_type(row[0]) def get_database_min_id(self, source_id): sequence_min = 0 diff --git a/src/calibre/ebooks/__init__.py b/src/calibre/ebooks/__init__.py index 874aa90bbd..7d90f7c2a5 100644 --- a/src/calibre/ebooks/__init__.py +++ b/src/calibre/ebooks/__init__.py @@ -7,7 +7,7 @@ Code for the conversion of ebook formats and the reading of metadata from various formats. ''' -import traceback, os, re +import traceback, os, re, numbers from calibre import CurrentDir, prints from polyglot.builtins import unicode_type @@ -233,7 +233,7 @@ UNIT_RE = re.compile(r'^(-*[0-9]*[.]?[0-9]*)\s*(%|em|ex|en|px|mm|cm|in|pt|pc|rem def unit_convert(value, base, font, dpi, body_font_size=12): ' Return value in pts' - if isinstance(value, (int, long, float)): + if isinstance(value, numbers.Number): return value try: return float(value) * 72.0 / dpi diff --git a/src/calibre/ebooks/conversion/cli.py b/src/calibre/ebooks/conversion/cli.py index f39e2e006a..a1394b592b 100644 --- a/src/calibre/ebooks/conversion/cli.py +++ b/src/calibre/ebooks/conversion/cli.py @@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en' Command line interface to conversion sub-system ''' -import sys, os +import sys, os, numbers from optparse import OptionGroup, Option from collections import OrderedDict @@ -91,9 +91,9 @@ def option_recommendation_to_cli_option(add_option, rec): attrs['action'] = 'store_false' if rec.recommended_value else \ 'store_true' else: - if isinstance(rec.recommended_value, int): + if isinstance(rec.recommended_value, numbers.Integral): attrs['type'] = 'int' - if isinstance(rec.recommended_value, float): + if isinstance(rec.recommended_value, numbers.Real): attrs['type'] = 'float' if opt.long_switch == 'verbose': diff --git a/src/calibre/ebooks/covers.py b/src/calibre/ebooks/covers.py index 4362983afd..035ca9ad39 100644 --- a/src/calibre/ebooks/covers.py +++ b/src/calibre/ebooks/covers.py @@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2014, Kovid Goyal ' -import re, random, unicodedata +import re, random, unicodedata, numbers from collections import namedtuple from contextlib import contextmanager from math import ceil, sqrt, cos, sin, atan2 @@ -167,7 +167,7 @@ class Block(object): @property def height(self): - return int(ceil(sum(l if isinstance(l, (int, float)) else l.boundingRect().height() for l in self.layouts))) + return int(ceil(sum(l if isinstance(l, numbers.Number) else l.boundingRect().height() for l in self.layouts))) @dynamic_property def position(self): @@ -181,7 +181,7 @@ class Block(object): self.layouts[0].setPosition(QPointF(x, y)) y += self.layouts[0].boundingRect().height() for l in self.layouts[1:]: - if isinstance(l, (int, float)): + if isinstance(l, numbers.Number): y += l else: l.setPosition(QPointF(x, y)) diff --git a/src/calibre/ebooks/css_transform_rules.py b/src/calibre/ebooks/css_transform_rules.py index ceed5d0cd4..58fc483047 100644 --- a/src/calibre/ebooks/css_transform_rules.py +++ b/src/calibre/ebooks/css_transform_rules.py @@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) from functools import partial from collections import OrderedDict -import operator +import operator, numbers from css_parser.css import Property, CSSRule @@ -123,7 +123,7 @@ def unit_convert(value, unit, dpi=96.0, body_font_size=12): def parse_css_length_or_number(raw, default_unit=None): - if isinstance(raw, (int, long, float)): + if isinstance(raw, numbers.Number): return raw, default_unit try: return float(raw), default_unit diff --git a/src/calibre/ebooks/docx/block_styles.py b/src/calibre/ebooks/docx/block_styles.py index bbe0fe4f0c..480738fa06 100644 --- a/src/calibre/ebooks/docx/block_styles.py +++ b/src/calibre/ebooks/docx/block_styles.py @@ -6,6 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' +import numbers from collections import OrderedDict @@ -126,7 +127,7 @@ def border_to_css(edge, style, css): bs = getattr(style, 'border_%s_style' % edge) bc = getattr(style, 'border_%s_color' % edge) bw = getattr(style, 'border_%s_width' % edge) - if isinstance(bw, (float, int, long)): + if isinstance(bw, numbers.Number): # WebKit needs at least 1pt to render borders and 3pt to render double borders bw = max(bw, (3 if bs == 'double' else 1)) if bs is not inherit and bs is not None: @@ -134,7 +135,7 @@ def border_to_css(edge, style, css): if bc is not inherit and bc is not None: css['border-%s-color' % edge] = bc if bw is not inherit and bw is not None: - if isinstance(bw, (int, float, long)): + if isinstance(bw, numbers.Number): bw = '%.3gpt' % bw css['border-%s-width' % edge] = bw diff --git a/src/calibre/ebooks/docx/writer/styles.py b/src/calibre/ebooks/docx/writer/styles.py index e57b558a30..fd8e4cabc9 100644 --- a/src/calibre/ebooks/docx/writer/styles.py +++ b/src/calibre/ebooks/docx/writer/styles.py @@ -6,6 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2015, Kovid Goyal ' +import numbers from collections import Counter, defaultdict from operator import attrgetter @@ -232,7 +233,7 @@ class TextStyle(DOCXStyle): except (ValueError, TypeError, AttributeError): self.spacing = None va = css.first_vertical_align - if isinstance(va, (int, float)): + if isinstance(va, numbers.Number): self.vertical_align = str(int(va * 2)) else: val = { @@ -254,7 +255,7 @@ class TextStyle(DOCXStyle): elif self.padding != padding: self.padding = ignore val = css['border-%s-width' % edge] - if not isinstance(val, (float, int, long)): + if not isinstance(val, numbers.Number): val = {'thin':0.2, 'medium':1, 'thick':2}.get(val, 0) val = min(96, max(2, int(val * 8))) if self.border_width is None: @@ -467,7 +468,7 @@ def read_css_block_borders(self, css, store_css_style=False): setattr(self, 'margin_' + edge, 0) # for e.g.: margin: auto setattr(self, 'css_margin_' + edge, css._style.get('margin-' + edge, '')) val = css['border-%s-width' % edge] - if not isinstance(val, (float, int, long)): + if not isinstance(val, numbers.Number): val = {'thin':0.2, 'medium':1, 'thick':2}.get(val, 0) val = min(96, max(2, int(val * 8))) setattr(self, 'border_%s_width' % edge, val) diff --git a/src/calibre/ebooks/epub/cfi/tests.py b/src/calibre/ebooks/epub/cfi/tests.py index a47074b54d..626660bd30 100644 --- a/src/calibre/ebooks/epub/cfi/tests.py +++ b/src/calibre/ebooks/epub/cfi/tests.py @@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2014, Kovid Goyal ' -import unittest +import unittest, numbers from polyglot.builtins import map from calibre.ebooks.epub.cfi.parse import parser, cfi_sort_key, decode_cfi @@ -29,7 +29,7 @@ class Tests(unittest.TestCase): p = parser() def step(x): - if isinstance(x, int): + if isinstance(x, numbers.Integral): return {'num': x} return {'num':x[0], 'id':x[1]} diff --git a/src/calibre/ebooks/lit/mssha1.py b/src/calibre/ebooks/lit/mssha1.py index 48d145ca4e..6e1e68ffbd 100644 --- a/src/calibre/ebooks/lit/mssha1.py +++ b/src/calibre/ebooks/lit/mssha1.py @@ -9,7 +9,7 @@ __license__ = 'GPL v3' __copyright__ = '2008, Marshall T. Vandegrift ' import struct, copy -from polyglot.builtins import range +from polyglot.builtins import range, long_type # ====================================================================== # Bit-Manipulation helpers @@ -62,10 +62,10 @@ def _bytelist2longBigEndian(list): j = 0 i = 0 while i < imax: - b0 = long(ord(list[j])) << 24 - b1 = long(ord(list[j+1])) << 16 - b2 = long(ord(list[j+2])) << 8 - b3 = long(ord(list[j+3])) + b0 = long_type(ord(list[j])) << 24 + b1 = long_type(ord(list[j+1])) << 16 + b2 = long_type(ord(list[j+2])) << 8 + b3 = long_type(ord(list[j+3])) hl[i] = b0 | b1 | b2 | b3 i = i+1 j = j+4 @@ -204,7 +204,7 @@ class mssha1(object): to the hashed string. """ - leninBuf = long(len(inBuf)) + leninBuf = long_type(len(inBuf)) # Compute number of bytes mod 64. index = (self.count[1] >> 3) & 0x3F diff --git a/src/calibre/ebooks/lit/writer.py b/src/calibre/ebooks/lit/writer.py index c1610b6e50..35fe053902 100644 --- a/src/calibre/ebooks/lit/writer.py +++ b/src/calibre/ebooks/lit/writer.py @@ -16,6 +16,7 @@ import re import copy import uuid import functools +import numbers from urlparse import urldefrag from urllib import unquote as urlunquote from lxml import etree @@ -162,7 +163,7 @@ class ReBinary(object): def write(self, *values): for value in values: - if isinstance(value, (int, long)): + if isinstance(value, numbers.Integral): try: value = codepoint_to_chr(value) except OverflowError: diff --git a/src/calibre/ebooks/lrf/html/table.py b/src/calibre/ebooks/lrf/html/table.py index cc62744954..d849e19443 100644 --- a/src/calibre/ebooks/lrf/html/table.py +++ b/src/calibre/ebooks/lrf/html/table.py @@ -1,7 +1,7 @@ from __future__ import print_function __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' -import math, sys, re +import math, sys, re, numbers from calibre.ebooks.lrf.fonts import get_font from calibre.ebooks.lrf.pylrs.pylrs import TextBlock, Text, CR, Span, \ @@ -137,7 +137,7 @@ class Cell(object): mwidth = 0 for token, attrs in tokens(tb): font = default_font - if isinstance(token, int): # Handle para and line breaks + if isinstance(token, numbers.Integral): # Handle para and line breaks continue if isinstance(token, Plot): return self.pts_to_pixels(token.xsize) @@ -178,7 +178,7 @@ class Cell(object): ls = self.pts_to_pixels(attrs.get('baselineskip', ts['baselineskip']))+\ self.pts_to_pixels(attrs.get('linespace', ts['linespace'])) ws = self.pts_to_pixels(attrs.get('wordspace', ts['wordspace'])) - if isinstance(token, int): # Handle para and line breaks + if isinstance(token, numbers.Integral): # Handle para and line breaks if top != bottom: # Previous element not a line break top = bottom else: diff --git a/src/calibre/ebooks/metadata/mobi.py b/src/calibre/ebooks/metadata/mobi.py index b4ddb8da48..5303a3423d 100644 --- a/src/calibre/ebooks/metadata/mobi.py +++ b/src/calibre/ebooks/metadata/mobi.py @@ -10,7 +10,7 @@ __copyright__ = '2009, Kovid Goyal kovid@kovidgoyal.net and ' \ 'Marshall T. Vandegrift ' __docformat__ = 'restructuredtext en' -import os +import os, numbers from struct import pack, unpack from cStringIO import StringIO @@ -47,7 +47,7 @@ class StreamSlicer(object): def __getitem__(self, key): stream = self._stream base = self.start - if isinstance(key, (int, long)): + if isinstance(key, numbers.Integral): stream.seek(base + key) return stream.read(1) if isinstance(key, slice): @@ -67,7 +67,7 @@ class StreamSlicer(object): def __setitem__(self, key, value): stream = self._stream base = self.start - if isinstance(key, (int, long)): + if isinstance(key, numbers.Integral): if len(value) != 1: raise ValueError("key and value lengths must match") stream.seek(base + key) diff --git a/src/calibre/ebooks/metadata/topaz.py b/src/calibre/ebooks/metadata/topaz.py index 38ccce1fbe..f2c39a3464 100644 --- a/src/calibre/ebooks/metadata/topaz.py +++ b/src/calibre/ebooks/metadata/topaz.py @@ -5,7 +5,7 @@ __copyright__ = '2010, Greg Riker ' __docformat__ = 'restructuredtext en' ''' Read/write metadata from Amazon's topaz format ''' -import StringIO, sys +import StringIO, sys, numbers from struct import pack from calibre.ebooks.metadata import MetaInformation @@ -29,7 +29,7 @@ class StreamSlicer(object): def __getitem__(self, key): stream = self._stream base = self.start - if isinstance(key, (int, long)): + if isinstance(key, numbers.Integral): stream.seek(base + key) return stream.read(1) if isinstance(key, slice): @@ -49,7 +49,7 @@ class StreamSlicer(object): def __setitem__(self, key, value): stream = self._stream base = self.start - if isinstance(key, (int, long)): + if isinstance(key, numbers.Integral): if len(value) != 1: raise ValueError("key and value lengths must match") stream.seek(base + key) diff --git a/src/calibre/ebooks/mobi/debug/headers.py b/src/calibre/ebooks/mobi/debug/headers.py index dbf5d97a70..97923ab579 100644 --- a/src/calibre/ebooks/mobi/debug/headers.py +++ b/src/calibre/ebooks/mobi/debug/headers.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import struct, datetime, os +import struct, datetime, os, numbers from calibre.utils.date import utc_tz from calibre.ebooks.mobi.reader.headers import NULL_INDEX @@ -598,7 +598,7 @@ class TextRecord(object): # {{{ self.trailing_data['raw_bytes'] = raw_trailing_bytes for typ, val in self.trailing_data.iteritems(): - if isinstance(typ, int): + if isinstance(typ, numbers.Integral): print ('Record %d has unknown trailing data of type: %d : %r'% (idx, typ, val)) diff --git a/src/calibre/ebooks/mobi/mobiml.py b/src/calibre/ebooks/mobi/mobiml.py index effa29c7a0..51bff9c57a 100644 --- a/src/calibre/ebooks/mobi/mobiml.py +++ b/src/calibre/ebooks/mobi/mobiml.py @@ -9,6 +9,7 @@ __copyright__ = '2008, Marshall T. Vandegrift ' import copy import re +import numbers from lxml import etree from calibre.ebooks.oeb.base import namespace, barename from calibre.ebooks.oeb.base import XHTML, XHTML_NS, urlnormalize @@ -45,7 +46,7 @@ COLLAPSE = re.compile(r'[ \t\r\n\v]+') def asfloat(value): - if not isinstance(value, (int, long, float)): + if not isinstance(value, numbers.Number): return 0.0 return float(value) @@ -531,9 +532,9 @@ class MobiMLizer(object): valign = style['vertical-align'] not_baseline = valign in ('super', 'sub', 'text-top', 'text-bottom', 'top', 'bottom') or ( - isinstance(valign, (float, int)) and abs(valign) != 0) + isinstance(valign, numbers.Number) and abs(valign) != 0) issup = valign in ('super', 'text-top', 'top') or ( - isinstance(valign, (float, int)) and valign > 0) + isinstance(valign, numbers.Number) and valign > 0) vtag = 'sup' if issup else 'sub' if not_baseline and not ignore_valign and tag not in NOT_VTAGS and not isblock: nroot = etree.Element(XHTML('html'), nsmap=MOBI_NSMAP) diff --git a/src/calibre/ebooks/mobi/writer2/indexer.py b/src/calibre/ebooks/mobi/writer2/indexer.py index 7ce7ab7270..0353cf61b0 100644 --- a/src/calibre/ebooks/mobi/writer2/indexer.py +++ b/src/calibre/ebooks/mobi/writer2/indexer.py @@ -8,6 +8,7 @@ __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' +import numbers from struct import pack from cStringIO import StringIO from collections import OrderedDict, defaultdict @@ -166,7 +167,7 @@ class IndexEntry(object): @property def bytestring(self): buf = StringIO() - if isinstance(self.index, int): + if isinstance(self.index, numbers.Integral): buf.write(encode_number_as_hex(self.index)) else: raw = bytearray(self.index.encode('ascii')) @@ -188,7 +189,7 @@ class IndexEntry(object): for tag in self.tag_nums: attr = self.attr_for_tag(tag) val = getattr(self, attr) - if isinstance(val, int): + if isinstance(val, numbers.Integral): val = [val] for x in val: buf.write(encint(x)) @@ -602,7 +603,7 @@ class Indexer(object): # {{{ # The index of the last entry in the NCX idx = indices[-1].index - if isinstance(idx, int): + if isinstance(idx, numbers.Integral): idx = encode_number_as_hex(idx) else: idx = idx.encode('ascii') diff --git a/src/calibre/ebooks/mobi/writer8/header.py b/src/calibre/ebooks/mobi/writer8/header.py index 069a36c11b..ad77196517 100644 --- a/src/calibre/ebooks/mobi/writer8/header.py +++ b/src/calibre/ebooks/mobi/writer8/header.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import random +import random, numbers from io import BytesIO from collections import OrderedDict from struct import pack @@ -67,7 +67,7 @@ class Header(OrderedDict): positions[name] = buf.tell() if val is None: raise ValueError('Dynamic field %r not set'%name) - if isinstance(val, (int, long)): + if isinstance(val, numbers.Integral): fmt = b'H' if name in self.SHORT_FIELDS else b'I' val = pack(b'>'+fmt, val) buf.write(val) @@ -83,6 +83,3 @@ class Header(OrderedDict): def format_value(self, name, val): return val - - - diff --git a/src/calibre/ebooks/oeb/iterator/bookmarks.py b/src/calibre/ebooks/oeb/iterator/bookmarks.py index 841d409ccb..1677fc3625 100644 --- a/src/calibre/ebooks/oeb/iterator/bookmarks.py +++ b/src/calibre/ebooks/oeb/iterator/bookmarks.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import os +import os, numbers from io import BytesIO from calibre.utils.zipfile import safe_replace @@ -59,7 +59,7 @@ class BookmarksMixin(object): rec = u'%s^%d#%s'%(bm['title'], bm['spine'], bm['pos']) else: pos = bm['pos'] - if isinstance(pos, (int, float)): + if isinstance(pos, numbers.Number): pos = unicode_type(pos) else: pos = pos.replace(u'^', BM_LEGACY_ESC) diff --git a/src/calibre/ebooks/oeb/normalize_css.py b/src/calibre/ebooks/oeb/normalize_css.py index a3bb7a0ad3..02c377974c 100644 --- a/src/calibre/ebooks/oeb/normalize_css.py +++ b/src/calibre/ebooks/oeb/normalize_css.py @@ -6,6 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' +import numbers from polyglot.builtins import zip, string_or_bytes from functools import wraps @@ -392,7 +393,7 @@ def test_normalization(return_tests=False): # {{{ tuple('0 0 0 0'.split()) : '0', }.iteritems(): for prefix in ('margin', 'padding'): - css = {'%s-%s' % (prefix, x) : str(y)+'pt' if isinstance(y, (int, float)) else y for x, y in zip(('left', 'top', 'right', 'bottom'), s)} + css = {'%s-%s' % (prefix, x) : str(y)+'pt' if isinstance(y, numbers.Number) else y for x, y in zip(('left', 'top', 'right', 'bottom'), s)} css = '; '.join(('%s:%s' % (k, v) for k, v in css.iteritems())) style = parseStyle(css) condense_rule(style) diff --git a/src/calibre/ebooks/oeb/stylizer.py b/src/calibre/ebooks/oeb/stylizer.py index 0b4b825657..3c6d71c1ae 100644 --- a/src/calibre/ebooks/oeb/stylizer.py +++ b/src/calibre/ebooks/oeb/stylizer.py @@ -8,7 +8,7 @@ from __future__ import with_statement __license__ = 'GPL v3' __copyright__ = '2008, Marshall T. Vandegrift ' -import os, re, logging, copy, unicodedata +import os, re, logging, copy, unicodedata, numbers from weakref import WeakKeyDictionary from xml.dom import SyntaxErr as CSSSyntaxError from css_parser.css import (CSSStyleRule, CSSPageRule, CSSFontFaceRule, @@ -527,7 +527,7 @@ class Style(object): result = size else: result = self._unit_convert(value, base=base, font=base) - if not isinstance(result, (int, float, long)): + if not isinstance(result, numbers.Number): return base if result < 0: result = normalize_fontsize("smaller", base) @@ -562,20 +562,20 @@ class Style(object): ans = self._unit_convert(str(img_size) + 'px', base=base) else: x = self._unit_convert(x, base=base) - if isinstance(x, (float, int, long)): + if isinstance(x, numbers.Number): ans = x if ans is None: x = self._element.get(attr) if x is not None: x = self._unit_convert(x + 'px', base=base) - if isinstance(x, (float, int, long)): + if isinstance(x, numbers.Number): ans = x if ans is None: ans = self._unit_convert(str(img_size) + 'px', base=base) maa = self._style.get('max-' + attr) if maa is not None: x = self._unit_convert(maa, base=base) - if isinstance(x, (int, float, long)) and (ans is None or x < ans): + if isinstance(x, numbers.Number) and (ans is None or x < ans): ans = x return ans diff --git a/src/calibre/ebooks/oeb/transforms/flatcss.py b/src/calibre/ebooks/oeb/transforms/flatcss.py index dd64a3a2ef..14826539fe 100644 --- a/src/calibre/ebooks/oeb/transforms/flatcss.py +++ b/src/calibre/ebooks/oeb/transforms/flatcss.py @@ -6,7 +6,7 @@ from __future__ import with_statement __license__ = 'GPL v3' __copyright__ = '2008, Marshall T. Vandegrift ' -import re, operator, math +import re, operator, math, numbers from collections import defaultdict from xml.dom import SyntaxErr @@ -28,7 +28,7 @@ STRIPNUM = re.compile(r'[-0-9]+$') def asfloat(value, default): - if not isinstance(value, (int, long, float)): + if not isinstance(value, numbers.Number): value = default return float(value) @@ -378,7 +378,7 @@ class CSSFlattener(object): except: font_size = self.sbase if self.sbase is not None else \ self.context.source.fbase - if tag == 'body' and isinstance(font_size, (int, float)): + if tag == 'body' and isinstance(font_size, numbers.Number): stylizer.body_font_size = font_size if 'align' in node.attrib: if tag != 'img': diff --git a/src/calibre/ebooks/oeb/transforms/page_margin.py b/src/calibre/ebooks/oeb/transforms/page_margin.py index 264f86d68d..f56c97c155 100644 --- a/src/calibre/ebooks/oeb/transforms/page_margin.py +++ b/src/calibre/ebooks/oeb/transforms/page_margin.py @@ -7,6 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' +import numbers from collections import Counter from calibre.ebooks.oeb.base import barename, XPath @@ -89,7 +90,7 @@ class RemoveFakeMargins(object): pass else: if ((hasattr(ti, 'startswith') and ti.startswith('-')) or - isinstance(ti, (int, float)) and ti < 0): + isinstance(ti, numbers.Number) and ti < 0): raise NegativeTextIndent() return style.marginLeft, style.marginRight, style return '', '', None diff --git a/src/calibre/ebooks/pdb/header.py b/src/calibre/ebooks/pdb/header.py index fe9c6fc130..6e954843e1 100644 --- a/src/calibre/ebooks/pdb/header.py +++ b/src/calibre/ebooks/pdb/header.py @@ -10,6 +10,7 @@ __docformat__ = 'restructuredtext en' import re import struct import time +from polyglot.builtins import long_type class PdbHeaderReader(object): @@ -82,7 +83,6 @@ class PdbHeaderBuilder(object): offset = 78 + (8 * nrecords) + 2 for id, record in enumerate(section_lengths): - out_stream.write(struct.pack('>LBBBB', long(offset), 0, 0, 0, 0)) + out_stream.write(struct.pack('>LBBBB', long_type(offset), 0, 0, 0, 0)) offset += record out_stream.write('\x00\x00') - diff --git a/src/calibre/ebooks/pdf/reflow.py b/src/calibre/ebooks/pdf/reflow.py index e3f47e4eef..bc9dd27c9e 100644 --- a/src/calibre/ebooks/pdf/reflow.py +++ b/src/calibre/ebooks/pdf/reflow.py @@ -6,7 +6,7 @@ __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import sys, os +import sys, os, numbers from lxml import etree @@ -222,7 +222,7 @@ class Box(list): def to_html(self): ans = ['<%s>'%self.tag] for elem in self: - if isinstance(elem, int): + if isinstance(elem, numbers.Integral): ans.append('
'%elem) else: ans.append(elem.to_html()+' ') @@ -242,7 +242,7 @@ class ImageBox(Box): if len(self) > 0: ans.append('
') for elem in self: - if isinstance(elem, int): + if isinstance(elem, numbers.Integral): ans.append('
'%elem) else: ans.append(elem.to_html()+' ') diff --git a/src/calibre/ebooks/pdf/render/common.py b/src/calibre/ebooks/pdf/render/common.py index 6b8200fa68..25313a8bc4 100644 --- a/src/calibre/ebooks/pdf/render/common.py +++ b/src/calibre/ebooks/pdf/render/common.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import codecs, zlib +import codecs, zlib, numbers from io import BytesIO from datetime import datetime from binascii import hexlify @@ -69,7 +69,7 @@ def serialize(o, stream): elif isinstance(o, bool): # Must check bool before int as bools are subclasses of int stream.write_raw(b'true' if o else b'false') - elif isinstance(o, (int, long)): + elif isinstance(o, numbers.Integral): stream.write_raw(str(o).encode('ascii') if ispy3 else bytes(o)) elif hasattr(o, 'pdf_serialize'): o.pdf_serialize(stream) diff --git a/src/calibre/ebooks/pdf/render/from_html.py b/src/calibre/ebooks/pdf/render/from_html.py index 1365c22d72..0325a8db63 100644 --- a/src/calibre/ebooks/pdf/render/from_html.py +++ b/src/calibre/ebooks/pdf/render/from_html.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import json, os +import json, os, numbers from polyglot.builtins import map from math import floor from collections import defaultdict @@ -418,7 +418,7 @@ class PDFWriter(QObject): except Exception: doc_margins = None if doc_margins and isinstance(doc_margins, dict): - doc_margins = {k:float(v) for k, v in doc_margins.iteritems() if isinstance(v, (float, int)) and k in {'right', 'top', 'left', 'bottom'}} + doc_margins = {k:float(v) for k, v in doc_margins.iteritems() if isinstance(v, numbers.Number) and k in {'right', 'top', 'left', 'bottom'}} if doc_margins: margin_top = margin_bottom = 0 page_margins = self.convert_page_margins(doc_margins) diff --git a/src/calibre/ebooks/pdf/render/serialize.py b/src/calibre/ebooks/pdf/render/serialize.py index 5c80ed03b8..ed910bc618 100644 --- a/src/calibre/ebooks/pdf/render/serialize.py +++ b/src/calibre/ebooks/pdf/render/serialize.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import hashlib +import hashlib, numbers from polyglot.builtins import map from PyQt5.Qt import QBuffer, QByteArray, QImage, Qt, QColor, qRgba, QPainter @@ -56,7 +56,7 @@ class IndirectObjects(object): def __getitem__(self, o): try: - return self._map[id(self._list[o] if isinstance(o, int) else o)] + return self._map[id(self._list[o] if isinstance(o, numbers.Integral) else o)] except (KeyError, IndexError): raise KeyError('The object %r was not found'%o) @@ -355,7 +355,7 @@ class PDFStream(object): self.current_page.write_line() for x in op: self.current_page.write( - (fmtnum(x) if isinstance(x, (int, long, float)) else x) + ' ') + (fmtnum(x) if isinstance(x, numbers.Number) else x) + ' ') def draw_path(self, path, stroke=True, fill=False, fill_rule='winding'): if not path.ops: diff --git a/src/calibre/ebooks/txt/processor.py b/src/calibre/ebooks/txt/processor.py index e2b272c54b..2e061e94f7 100644 --- a/src/calibre/ebooks/txt/processor.py +++ b/src/calibre/ebooks/txt/processor.py @@ -15,7 +15,7 @@ from calibre.ebooks.metadata.opf2 import OPFCreator from calibre.ebooks.conversion.preprocess import DocAnalysis from calibre.utils.cleantext import clean_ascii_chars -from polyglot.builtins import unicode_type, map, range +from polyglot.builtins import unicode_type, map, range, long_type HTML_TEMPLATE = u'%s \n%s\n' @@ -64,7 +64,7 @@ def split_txt(txt, epub_split_size_kb=0): txt = txt.encode('utf-8') length_byte = len(txt) # Calculating the average chunk value for easy splitting as EPUB (+2 as a safe margin) - chunk_size = long(length_byte / (int(length_byte / (epub_split_size_kb * 1024)) + 2)) + chunk_size = long_type(length_byte / (int(length_byte / (epub_split_size_kb * 1024)) + 2)) # if there are chunks with a superior size then go and break parts = txt.split(b'\n\n') lengths = tuple(map(len, parts)) diff --git a/src/calibre/gui2/actions/save_to_disk.py b/src/calibre/gui2/actions/save_to_disk.py index 6e183872f8..6e1943ec16 100644 --- a/src/calibre/gui2/actions/save_to_disk.py +++ b/src/calibre/gui2/actions/save_to_disk.py @@ -5,7 +5,7 @@ __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import os +import os, numbers from functools import partial from polyglot.builtins import map @@ -121,7 +121,7 @@ class SaveToDiskAction(InterfaceAction): Dispatcher(self.books_saved), paths, path) def save_library_format_by_ids(self, book_ids, fmt, single_dir=True): - if isinstance(book_ids, int): + if isinstance(book_ids, numbers.Integral): book_ids = [book_ids] rows = list(self.gui.library_view.ids_to_rows(book_ids).itervalues()) rows = [self.gui.library_view.model().index(r, 0) for r in rows] diff --git a/src/calibre/gui2/dialogs/metadata_bulk.py b/src/calibre/gui2/dialogs/metadata_bulk.py index 0c87c31b11..612c0148a1 100644 --- a/src/calibre/gui2/dialogs/metadata_bulk.py +++ b/src/calibre/gui2/dialogs/metadata_bulk.py @@ -3,7 +3,7 @@ # License: GPLv3 Copyright: 2008, Kovid Goyal from __future__ import print_function -import re +import re, numbers from collections import defaultdict, namedtuple from io import BytesIO from threading import Thread @@ -773,7 +773,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): val = mi.format_field(field)[1] else: val = mi.get(field, None) - if isinstance(val, (int, float, bool)): + if isinstance(val, (numbers.Number, bool)): val = str(val) elif fm['is_csp']: # convert the csp dict into a list diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 9f5a37d84f..f203a3de30 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -5,7 +5,7 @@ __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import functools, re, os, traceback, errno, time +import functools, re, os, traceback, errno, time, numbers from collections import defaultdict, namedtuple from itertools import groupby @@ -580,7 +580,7 @@ class BooksModel(QAbstractTableModel): # {{{ return data def get_book_info(self, index): - if isinstance(index, int): + if isinstance(index, numbers.Integral): index = self.index(index, 0) # If index is not valid returns None data = self.current_changed(index, None, False) @@ -1649,7 +1649,7 @@ class DeviceBooksModel(BooksModel): # {{{ return (authors_to_string(au)) elif cname == 'size': size = self.db[self.map[row]].size - if not isinstance(size, (float, int)): + if not isinstance(size, numbers.Number): size = 0 return (human_readable(size)) elif cname == 'timestamp': diff --git a/src/calibre/gui2/lrf_renderer/text.py b/src/calibre/gui2/lrf_renderer/text.py index 3467a09e68..d86a5e92b2 100644 --- a/src/calibre/gui2/lrf_renderer/text.py +++ b/src/calibre/gui2/lrf_renderer/text.py @@ -1,7 +1,7 @@ from __future__ import print_function __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' -import sys, collections, operator, copy, re +import sys, collections, operator, copy, re, numbers from PyQt5.Qt import ( Qt, QRectF, QFont, QColor, QPixmap, QGraphicsPixmapItem, QGraphicsItem, @@ -451,7 +451,7 @@ class Line(QGraphicsItem): if self.length_in_space > 0: frac = 1 + float(delta)/self.length_in_space for i in range(len(self.tokens)): - if isinstance(self.tokens[i], (int, float)): + if isinstance(self.tokens[i], numbers.Number): self.tokens[i] *= frac self.current_width = self.line_length @@ -495,7 +495,7 @@ class Line(QGraphicsItem): painter.restore() painter.save() for tok in self.tokens: - if isinstance(tok, (int, float)): + if isinstance(tok, numbers.Number): x += tok elif isinstance(tok, Word): painter.setFont(tok.font) @@ -559,7 +559,7 @@ class Line(QGraphicsItem): def __unicode__(self): s = u'' for tok in self.tokens: - if isinstance(tok, (int, float)): + if isinstance(tok, numbers.Number): s += ' ' elif isinstance(tok, Word): s += unicode_type(tok.string) diff --git a/src/calibre/gui2/metadata/config.py b/src/calibre/gui2/metadata/config.py index 2667d4a966..1f5ae83243 100644 --- a/src/calibre/gui2/metadata/config.py +++ b/src/calibre/gui2/metadata/config.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import textwrap +import textwrap, numbers from PyQt5.Qt import (QWidget, QGridLayout, QGroupBox, QListView, Qt, QSpinBox, QDoubleSpinBox, QCheckBox, QLineEdit, QComboBox, QLabel) @@ -90,7 +90,7 @@ class ConfigWidget(QWidget): def create_widgets(self, opt): val = self.plugin.prefs[opt.name] if opt.type == 'number': - c = QSpinBox if isinstance(opt.default, int) else QDoubleSpinBox + c = QSpinBox if isinstance(opt.default, numbers.Integral) else QDoubleSpinBox widget = c(self) widget.setValue(val) elif opt.type == 'string': diff --git a/src/calibre/gui2/preferences/device_user_defined.py b/src/calibre/gui2/preferences/device_user_defined.py index eb7b7886bf..ae963f61c1 100644 --- a/src/calibre/gui2/preferences/device_user_defined.py +++ b/src/calibre/gui2/preferences/device_user_defined.py @@ -7,6 +7,7 @@ __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' +import numbers from PyQt5.Qt import QDialog, QVBoxLayout, QPlainTextEdit, QTimer, \ QDialogButtonBox, QPushButton, QApplication, QIcon, QMessageBox @@ -63,7 +64,7 @@ class UserDefinedDevice(QDialog): res = '' if len(new_devices) == 1: def fmtid(x): - if isinstance(x, (int, long)): + if isinstance(x, numbers.Integral): x = hex(x) if not x.startswith('0x'): x = '0x' + x diff --git a/src/calibre/gui2/preferences/server.py b/src/calibre/gui2/preferences/server.py index 338a2b0d4d..3a565cb441 100644 --- a/src/calibre/gui2/preferences/server.py +++ b/src/calibre/gui2/preferences/server.py @@ -4,6 +4,7 @@ import errno import json +import numbers import os import sys import textwrap @@ -267,9 +268,9 @@ class AdvancedTab(QWidget): w = Choices elif isinstance(opt.default, bool): w = Bool - elif isinstance(opt.default, (int, long)): + elif isinstance(opt.default, numbers.Integral): w = Int - elif isinstance(opt.default, float): + elif isinstance(opt.default, numbers.Real): w = Float else: w = Text diff --git a/src/calibre/gui2/progress_indicator/__init__.py b/src/calibre/gui2/progress_indicator/__init__.py index 7444d1b158..951feea2c8 100644 --- a/src/calibre/gui2/progress_indicator/__init__.py +++ b/src/calibre/gui2/progress_indicator/__init__.py @@ -5,6 +5,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) +import numbers from PyQt5.Qt import ( Qt, QWidget, QSizePolicy, QSize, QRect, QConicalGradient, QPen, QBrush, QPainter, QTimer, QVBoxLayout, QLabel, QStackedWidget, QDialog, QStackedLayout @@ -93,7 +94,7 @@ class ProgressSpinner(QWidget): return self._size_hint def setSizeHint(self, val): - if isinstance(val, int): + if isinstance(val, numbers.Integral): val = QSize(val, val) self._size_hint = val self.update() diff --git a/src/calibre/gui2/tweak_book/editor/syntax/pygments_highlighter.py b/src/calibre/gui2/tweak_book/editor/syntax/pygments_highlighter.py index db3c67aa07..b866150b80 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/pygments_highlighter.py +++ b/src/calibre/gui2/tweak_book/editor/syntax/pygments_highlighter.py @@ -6,6 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2014, Kovid Goyal ' +import numbers from functools import partial from PyQt5.Qt import QTextBlockUserData @@ -48,7 +49,7 @@ def create_lexer(base_class): statestack.append(statestack[-1]) else: statestack.append(state) - elif isinstance(new_state, int): + elif isinstance(new_state, numbers.Integral): # pop del statestack[new_state:] elif new_state == '#push': diff --git a/src/calibre/gui2/tweak_book/preferences.py b/src/calibre/gui2/tweak_book/preferences.py index ac16fa8ea1..9ee6fe3cc5 100644 --- a/src/calibre/gui2/tweak_book/preferences.py +++ b/src/calibre/gui2/tweak_book/preferences.py @@ -6,6 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' +import numbers from operator import attrgetter, methodcaller from collections import namedtuple from polyglot.builtins import map, unicode_type, range @@ -50,8 +51,8 @@ class BasicSettings(QWidget): # {{{ getter = getter or methodcaller('isChecked') setter = setter or (lambda x, v: x.setChecked(v)) widget.toggled.connect(self.emit_changed) - elif isinstance(defval, (int, float)): - widget = (QSpinBox if isinstance(defval, int) else QDoubleSpinBox)(self) + elif isinstance(defval, numbers.Number): + widget = (QSpinBox if isinstance(defval, numbers.Integral) else QDoubleSpinBox)(self) getter = getter or methodcaller('value') setter = setter or (lambda x, v:x.setValue(v)) widget.valueChanged.connect(self.emit_changed) diff --git a/src/calibre/gui2/viewer/position.py b/src/calibre/gui2/viewer/position.py index 8e02683805..76bed35f27 100644 --- a/src/calibre/gui2/viewer/position.py +++ b/src/calibre/gui2/viewer/position.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import json, time +import json, time, numbers from PyQt5.Qt import QApplication, QEventLoop @@ -83,7 +83,7 @@ class PagePosition(object): self._cpos = None def to_pos(self, pos): - if isinstance(pos, (int, float)): + if isinstance(pos, numbers.Number): self.document.scroll_fraction = pos else: self.scroll_to_cfi(pos) diff --git a/src/calibre/library/catalogs/bibtex.py b/src/calibre/library/catalogs/bibtex.py index f22bcc8d5a..4a6e8a4e27 100644 --- a/src/calibre/library/catalogs/bibtex.py +++ b/src/calibre/library/catalogs/bibtex.py @@ -5,7 +5,7 @@ __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import re, codecs, os +import re, codecs, os, numbers from collections import namedtuple from types import StringType, UnicodeType @@ -143,7 +143,7 @@ class BIBTEX(CatalogPlugin): for field in fields: if field.startswith('#'): item = db.get_field(entry['id'],field,index_is_id=True) - if isinstance(item, (bool, float, int)): + if isinstance(item, (bool, numbers.Number)): item = repr(item) elif field == 'title_sort': item = entry['sort'] diff --git a/src/calibre/library/custom_columns.py b/src/calibre/library/custom_columns.py index ca14b24330..56e53ee91b 100644 --- a/src/calibre/library/custom_columns.py +++ b/src/calibre/library/custom_columns.py @@ -6,7 +6,7 @@ __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import json, re +import json, re, numbers from functools import partial from calibre import prints, force_unicode @@ -346,7 +346,7 @@ class CustomColumns(object): series_id = self.conn.get('SELECT id from %s WHERE value=?'%table, (series,), all=False) if series_id is None: - if isinstance(tweaks['series_index_auto_increment'], (int, float)): + if isinstance(tweaks['series_index_auto_increment'], numbers.Number): return float(tweaks['series_index_auto_increment']) return 1.0 series_indices = self.conn.get(''' diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 59bf0e746c..fea0d5e5fc 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en' The database used to store ebook metadata ''' import os, sys, shutil, cStringIO, glob, time, functools, traceback, re, \ - json, uuid, hashlib, copy, types + json, uuid, hashlib, copy, types, numbers from collections import defaultdict, namedtuple import threading, random from itertools import repeat @@ -2224,7 +2224,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): series_id = self.conn.get('SELECT id from series WHERE name=?', (series,), all=False) if series_id is None: - if isinstance(tweaks['series_index_auto_increment'], (int, float)): + if isinstance(tweaks['series_index_auto_increment'], numbers.Number): return float(tweaks['series_index_auto_increment']) return 1.0 series_indices = self.conn.get( diff --git a/src/calibre/srv/opts.py b/src/calibre/srv/opts.py index 7c5b3e9e8e..1216b06c6f 100644 --- a/src/calibre/srv/opts.py +++ b/src/calibre/srv/opts.py @@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2015, Kovid Goyal ' -import errno, os +import errno, os, numbers from itertools import izip_longest from collections import namedtuple, OrderedDict from operator import attrgetter @@ -248,7 +248,7 @@ def opts_to_parser(usage): else: name = '--' + opt.name.replace('_', '-') otype = 'string' - if isinstance(opt.default, (int, long, float)): + if isinstance(opt.default, numbers.Number): otype = type(opt.default).__name__ add_option(name, type=otype) @@ -278,7 +278,7 @@ def parse_config_file(path=DEFAULT_CONFIG): val = rest if isinstance(opt.default, bool): val = val.lower() in ('true', 'yes', 'y') - elif isinstance(opt.default, (int, long, float)): + elif isinstance(opt.default, numbers.Number): try: val = type(opt.default)(rest) except Exception: diff --git a/src/calibre/srv/routes.py b/src/calibre/srv/routes.py index ab81b054bb..d2dad34078 100644 --- a/src/calibre/srv/routes.py +++ b/src/calibre/srv/routes.py @@ -141,7 +141,7 @@ class Route(object): if '{' in default or '}' in default: raise route_error('The characters {} are not allowed in default values') default = self.defaults[name] = eval(default) - if isinstance(default, (int, long, float)): + if isinstance(default, numbers.Number): self.type_checkers[name] = type(default) if is_sponge and not isinstance(default, type('')): raise route_error('Soak up path component must have a default value of string type') diff --git a/src/calibre/srv/tests/web_sockets.py b/src/calibre/srv/tests/web_sockets.py index bc16e86a55..c456d532ff 100644 --- a/src/calibre/srv/tests/web_sockets.py +++ b/src/calibre/srv/tests/web_sockets.py @@ -4,7 +4,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) -import socket, os, struct, errno +import socket, os, struct, errno, numbers from base64 import standard_b64encode from collections import deque, namedtuple from functools import partial @@ -16,7 +16,7 @@ from calibre.srv.web_socket import ( PING, PONG, PROTOCOL_ERROR, CONTINUATION, INCONSISTENT_DATA, CONTROL_CODES) from calibre.utils.monotonic import monotonic from calibre.utils.socket_inheritance import set_socket_inherit -from polyglot.builtins import range +from polyglot.builtins import range, unicode_type HANDSHAKE_STR = '''\ GET / HTTP/1.1\r @@ -183,11 +183,11 @@ class WebSocketTest(BaseTest): expected_messages, expected_controls = [], [] for ex in expected: - if isinstance(ex, type('')): + if isinstance(ex, unicode_type): ex = TEXT, ex elif isinstance(ex, bytes): ex = BINARY, ex - elif isinstance(ex, int): + elif isinstance(ex, numbers.Integral): ex = ex, b'' if ex[0] in CONTROL_CODES: expected_controls.append(ex) diff --git a/src/calibre/utils/Zeroconf.py b/src/calibre/utils/Zeroconf.py index 2d0c760279..c93231e731 100755 --- a/src/calibre/utils/Zeroconf.py +++ b/src/calibre/utils/Zeroconf.py @@ -87,6 +87,7 @@ import socket import threading import select import traceback +import numbers __all__ = ["Zeroconf", "ServiceInfo", "ServiceBrowser"] @@ -1138,7 +1139,7 @@ class ServiceInfo(object): suffix = '' elif isinstance(value, str): suffix = value - elif isinstance(value, int): + elif isinstance(value, numbers.Integral): suffix = value and 'true' or 'false' else: suffix = '' diff --git a/src/calibre/utils/chm/chm.py b/src/calibre/utils/chm/chm.py index 6c36d54ef7..eb0594879c 100644 --- a/src/calibre/utils/chm/chm.py +++ b/src/calibre/utils/chm/chm.py @@ -31,6 +31,7 @@ import struct import sys from calibre.constants import plugins +from polyglot.builtins import long_type chmlib, chmlib_err = plugins['chmlib'] if chmlib_err: @@ -401,7 +402,7 @@ class CHMFile: if start == -1: st = 0 else: - st = long(start) + st = long_type(start) return chmlib.chm_retrieve_object(self.file, ui, st, len) else: return (0, '') diff --git a/src/calibre/utils/config_base.py b/src/calibre/utils/config_base.py index 4362e741cc..a2ba0c793a 100644 --- a/src/calibre/utils/config_base.py +++ b/src/calibre/utils/config_base.py @@ -6,7 +6,7 @@ __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import os, re, cPickle, traceback +import os, re, cPickle, traceback, numbers from functools import partial from collections import defaultdict from copy import deepcopy @@ -37,7 +37,7 @@ class Option(object): if self.type is None and action is None and choices is None: if isinstance(default, float): self.type = 'float' - elif isinstance(default, int) and not isinstance(default, bool): + elif isinstance(default, numbers.Integral) and not isinstance(default, bool): self.type = 'int' self.choices = choices @@ -234,7 +234,7 @@ class OptionSet(object): def serialize_opt(self, val): if val is val is True or val is False or val is None or \ - isinstance(val, (int, float, long, bytes, unicode_type)): + isinstance(val, (numbers.Number, bytes, unicode_type)): return repr(val) pickle = cPickle.dumps(val, -1) return 'cPickle.loads(%s)'%repr(pickle) diff --git a/src/calibre/utils/formatter.py b/src/calibre/utils/formatter.py index 7644470377..5581d1eb16 100644 --- a/src/calibre/utils/formatter.py +++ b/src/calibre/utils/formatter.py @@ -8,7 +8,7 @@ __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import re, string, traceback +import re, string, traceback, numbers from calibre import prints from calibre.constants import DEBUG @@ -271,7 +271,7 @@ class TemplateFormatter(string.Formatter): def format_field(self, val, fmt): # ensure we are dealing with a string. - if isinstance(val, (int, float)): + if isinstance(val, numbers.Number): if val: val = unicode_type(val) else: diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py index e8a54c6f4f..305db5bcc4 100644 --- a/src/calibre/utils/formatter_functions.py +++ b/src/calibre/utils/formatter_functions.py @@ -12,7 +12,7 @@ __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import inspect, re, traceback +import inspect, re, traceback, numbers from math import trunc from calibre import human_readable @@ -136,7 +136,7 @@ class FormatterFunction(object): return ret if isinstance(ret, list): return ','.join(ret) - if isinstance(ret, (int, float, bool)): + if isinstance(ret, (numbers.Number, bool)): return unicode_type(ret) diff --git a/src/calibre/utils/rss_gen.py b/src/calibre/utils/rss_gen.py index f4419234f7..407c39240b 100644 --- a/src/calibre/utils/rss_gen.py +++ b/src/calibre/utils/rss_gen.py @@ -6,7 +6,7 @@ __author__ = "Andrew Dalke " _generator_name = __name__ + "-" + ".".join(map(str, __version__)) -import datetime +import datetime, numbers from polyglot.builtins import string_or_bytes # Could make this the base class; will need to add 'publish' @@ -166,12 +166,12 @@ class Image: _element(handler, "link", self.link) width = self.width - if isinstance(width, int): + if isinstance(width, numbers.Integral): width = IntElement("width", width) _opt_element(handler, "width", width) height = self.height - if isinstance(height, int): + if isinstance(height, numbers.Integral): height = IntElement("height", height) _opt_element(handler, "height", height) @@ -385,7 +385,7 @@ class RSS2(WriteXmlMixin): self.cloud.publish(handler) ttl = self.ttl - if isinstance(self.ttl, int): + if isinstance(self.ttl, numbers.Integral): ttl = IntElement("ttl", ttl) _opt_element(handler, "tt", ttl) diff --git a/src/calibre/utils/winreg/dde.py b/src/calibre/utils/winreg/dde.py index 54a99c059d..3ec48e0f28 100644 --- a/src/calibre/utils/winreg/dde.py +++ b/src/calibre/utils/winreg/dde.py @@ -6,6 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2015, Kovid Goyal ' +import numbers from ctypes import POINTER, WINFUNCTYPE, c_void_p, c_ulong, c_char_p, windll, byref from ctypes.wintypes import BOOL, DWORD, LPCWSTR, UINT @@ -87,10 +88,11 @@ def dde_error(instance): def default_errcheck(result, func, args): - if (isinstance(result, (int, long)) and result == 0) or (getattr(result, 'value', False) is None): + if (isinstance(result, numbers.Integral) and result == 0) or (getattr(result, 'value', False) is None): dde_error(args[0]) return args + null = object() @@ -111,6 +113,7 @@ def cwrap(name, restype, *args, **kw): func.errcheck=kw.get('errcheck', default_errcheck) return func + GetLastError = cwrap('DdeGetLastError', UINT, a('instance', DWORD), errcheck=no_errcheck) Initialize = cwrap('DdeInitializeW', UINT, a('instance_p', LPDWORD), a('callback', DDECALLBACK), a('command', DWORD), @@ -147,5 +150,6 @@ def send_dde_command(service, topic, command): Disconnect(conversation) Uninitialize(instance) + if __name__ == '__main__': send_dde_command('WinWord', 'System', '[REM_DDE_Direct][FileOpen("C:/cygwin64/home/kovid/demo.docx")]') diff --git a/src/calibre/utils/winreg/lib.py b/src/calibre/utils/winreg/lib.py index 3393bc09f3..741f470deb 100644 --- a/src/calibre/utils/winreg/lib.py +++ b/src/calibre/utils/winreg/lib.py @@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import, __license__ = 'GPL v3' __copyright__ = '2015, Kovid Goyal ' -import ctypes, ctypes.wintypes as types, _winreg as winreg, struct, datetime +import ctypes, ctypes.wintypes as types, _winreg as winreg, struct, datetime, numbers import winerror, win32con # Binding to C library {{{ @@ -112,7 +112,7 @@ def convert_to_registry_data(value, has_expansions=False): if isinstance(value, (list, tuple)): buf = ctypes.create_unicode_buffer('\0'.join(map(type(''), value)) + '\0\0') return buf, winreg.REG_MULTI_SZ, len(buf) * 2 - if isinstance(value, (int, long)): + if isinstance(value, numbers.Integral): try: raw, dtype = struct.pack(str('L'), value), winreg.REG_DWORD except struct.error: diff --git a/src/polyglot/builtins.py b/src/polyglot/builtins.py index 5209ef698a..96c226b182 100644 --- a/src/polyglot/builtins.py +++ b/src/polyglot/builtins.py @@ -30,6 +30,7 @@ if is_py3: codepoint_to_chr = chr unicode_type = str string_or_bytes = str, bytes + long_type = int def iteritems(d): return iter(d.items()) @@ -59,6 +60,7 @@ else: codepoint_to_chr = unichr unicode_type = unicode string_or_bytes = unicode, bytes + long_type = long def iteritems(d): return d.iteritems() From f6e15704b39ea94572a865b5c446fecd5b289e99 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Mar 2019 13:29:10 +0530 Subject: [PATCH 0339/2613] Do not use pickle to store DynamicConfig pickle is not portable between python versions, which makes it particularly unsuited for config files. Old settings are automatically migrated from *.pickle to *.pickle.json Note this has the unfortunate side-effect that upgrading/downgrading or using multiple versions of calibre on the same config directory will make the settings disjoint. I dont see a reasonable way to avoid that. --- src/calibre/utils/config.py | 119 ++++++++++++++++++++++-------------- 1 file changed, 74 insertions(+), 45 deletions(-) diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py index f74fcb3c7a..0bfe201337 100644 --- a/src/calibre/utils/config.py +++ b/src/calibre/utils/config.py @@ -1,4 +1,3 @@ -from __future__ import with_statement from __future__ import print_function __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' @@ -7,16 +6,17 @@ __docformat__ = 'restructuredtext en' ''' Manage application-wide preferences. ''' -import os, cPickle, base64, datetime, json, plistlib +import os, base64, datetime, json, plistlib from copy import deepcopy import optparse from calibre.constants import (config_dir, CONFIG_DIR_MODE, __appname__, - get_version, __author__, DEBUG, iswindows) + get_version, __author__, iswindows) from calibre.utils.lock import ExclusiveFile from calibre.utils.config_base import (make_config_dir, Option, OptionValues, OptionSet, ConfigInterface, Config, prefs, StringConfig, ConfigProxy, read_raw_tweaks, read_tweaks, write_tweaks, tweaks, plugin_dir) +from calibre.utils.serialize import pickle_loads # optparse uses gettext.gettext instead of _ from builtins, so we # monkey patch it. @@ -193,6 +193,46 @@ class OptionParser(optparse.OptionParser): return optparse.OptionParser.add_option_group(self, *args, **kwargs) +def to_json(obj): + if isinstance(obj, bytearray): + return {'__class__': 'bytearray', + '__value__': base64.standard_b64encode(bytes(obj)).decode('ascii')} + if isinstance(obj, datetime.datetime): + from calibre.utils.date import isoformat + return {'__class__': 'datetime.datetime', + '__value__': isoformat(obj, as_utc=True)} + if isinstance(obj, (set, frozenset)): + return {'__class__': 'set', '__value__': tuple(obj)} + if hasattr(obj, 'toBase64'): + return {'__class__': 'bytearray', + '__value__': bytes(obj.toBase64()).decode('ascii')} + raise TypeError(repr(obj) + ' is not JSON serializable') + + +def from_json(obj): + custom = obj.get('__class__') + if custom is not None: + if custom == 'bytearray': + return bytearray(base64.standard_b64decode(obj['__value__'])) + if custom == 'datetime.datetime': + from calibre.utils.iso8601 import parse_iso8601 + return parse_iso8601(obj['__value__'], assume_utc=True) + if custom == 'set': + return set(obj['__value__']) + return obj + + +def json_dumps(obj): + ans = json.dumps(obj, indent=2, default=to_json, sort_keys=True, ensure_ascii=False) + if not isinstance(ans, bytes): + ans = ans.encode('utf-8') + return ans + + +def json_loads(raw): + return json.loads(raw.decode('utf-8'), object_hook=from_json) + + class DynamicConfig(dict): ''' A replacement for QSettings that supports dynamic config keys. @@ -209,29 +249,43 @@ class DynamicConfig(dict): @property def file_path(self): - return os.path.join(config_dir, self.name+'.pickle') + return os.path.join(config_dir, self.name+'.pickle.json') def decouple(self, prefix): self.name = prefix + self.name self.refresh() + def read_old_serialized_representation(self): + from calibre.utils.shared_file import share_open + path = self.file_path.rpartition('.')[0] + try: + with share_open(path, 'rb') as f: + raw = f.read() + except EnvironmentError: + raw = b'' + try: + d = pickle_loads(raw).copy() + except Exception: + d = {} + return d + def refresh(self, clear_current=True): d = {} - if os.path.exists(self.file_path): - with ExclusiveFile(self.file_path) as f: - raw = f.read().strip() - try: - d = cPickle.loads(raw) if raw else {} - except SystemError: - pass - except Exception: - print('WARNING: Failed to unpickle stored config object, ignoring') - if DEBUG: - import traceback - traceback.print_exc() - d = {} if clear_current: self.clear() + if os.path.exists(self.file_path): + with ExclusiveFile(self.file_path) as f: + raw = f.read() + if raw: + try: + d = json_loads(raw) + except Exception as err: + print('Failed to de-serialize JSON representation of stored dynamic data for {} with error: {}'.format( + self.name, err)) + else: + d = self.read_old_serialized_representation() + else: + d = self.read_old_serialized_representation() self.update(d) def __getitem__(self, key): @@ -258,7 +312,7 @@ class DynamicConfig(dict): return if not os.path.exists(self.file_path): make_config_dir() - raw = cPickle.dumps(self, -1) + raw = json_dumps(self) with ExclusiveFile(self.file_path) as f: f.seek(0) f.truncate() @@ -387,40 +441,15 @@ class XMLConfig(dict): self.commit() -def to_json(obj): - if isinstance(obj, bytearray): - return {'__class__': 'bytearray', - '__value__': base64.standard_b64encode(bytes(obj)).decode('ascii')} - if isinstance(obj, datetime.datetime): - from calibre.utils.date import isoformat - return {'__class__': 'datetime.datetime', - '__value__': isoformat(obj, as_utc=True)} - if hasattr(obj, 'toBase64'): - return {'__class__': 'bytearray', - '__value__': bytes(obj.toBase64()).decode('ascii')} - raise TypeError(repr(obj) + ' is not JSON serializable') - - -def from_json(obj): - custom = obj.get('__class__') - if custom is not None: - if custom == 'bytearray': - return bytearray(base64.standard_b64decode(obj['__value__'])) - if custom == 'datetime.datetime': - from calibre.utils.iso8601 import parse_iso8601 - return parse_iso8601(obj['__value__'], assume_utc=True) - return obj - - class JSONConfig(XMLConfig): EXTENSION = '.json' def raw_to_object(self, raw): - return json.loads(raw.decode('utf-8'), object_hook=from_json) + return json_loads(raw) def to_raw(self): - return json.dumps(self, indent=2, default=to_json, sort_keys=True) + return json_dumps(self) def __getitem__(self, key): try: From 457ab4616e6259eafef5740b665fe3c29d66a538 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Mar 2019 13:30:32 +0530 Subject: [PATCH 0340/2613] ... --- src/calibre/utils/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py index 0bfe201337..22934c9b27 100644 --- a/src/calibre/utils/config.py +++ b/src/calibre/utils/config.py @@ -203,7 +203,7 @@ def to_json(obj): '__value__': isoformat(obj, as_utc=True)} if isinstance(obj, (set, frozenset)): return {'__class__': 'set', '__value__': tuple(obj)} - if hasattr(obj, 'toBase64'): + if hasattr(obj, 'toBase64'): # QByteArray return {'__class__': 'bytearray', '__value__': bytes(obj.toBase64()).decode('ascii')} raise TypeError(repr(obj) + ' is not JSON serializable') From 256d770f47bff6a44b78b252304a1c91f5edf341 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Mar 2019 13:56:32 +0530 Subject: [PATCH 0341/2613] Use a more efficient serialization for notified versions --- src/calibre/gui2/update.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/update.py b/src/calibre/gui2/update.py index 9fa507cad6..86da8c1be6 100644 --- a/src/calibre/gui2/update.py +++ b/src/calibre/gui2/update.py @@ -105,7 +105,19 @@ class CheckForUpdates(Thread): def version_key(calibre_version): if calibre_version.count('.') > 1: calibre_version = calibre_version.rpartition('.')[0] - return 'update to version %s' % calibre_version + return calibre_version + + +def is_version_notified(calibre_version): + key = version_key(calibre_version) + done = dynamic.get('notified-version-updates') or set() + return key in done + + +def save_version_notified(calibre_version): + done = dynamic.get('notified-version-updates') or set() + done.add(version_key(calibre_version)) + dynamic.set('notified-version-updates', done) class UpdateNotification(QDialog): @@ -150,7 +162,7 @@ class UpdateNotification(QDialog): self.l.addWidget(self.bb, 2, 0, 1, -1) self.bb.accepted.connect(self.accept) self.bb.rejected.connect(self.reject) - dynamic.set(version_key(calibre_version), False) + save_version_notified(calibre_version) def get_plugins(self): from calibre.gui2.dialogs.plugin_updater import (PluginUpdaterDialog, @@ -215,7 +227,7 @@ class UpdateMixin(object): self.status_bar.update_label.setVisible(True) if has_calibre_update: - if (force or (config.get('new_version_notification') and dynamic.get(version_key(calibre_version), True))): + if (force or (config.get('new_version_notification') and not is_version_notified(calibre_version))): if not no_show_popup: self._update_notification__ = UpdateNotification(calibre_version, number_of_plugin_updates, parent=self) From b23ba9dbdb31865dcddf43fb78cd9423ac64ea5a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Mar 2019 13:58:54 +0530 Subject: [PATCH 0342/2613] ... --- src/calibre/gui2/update.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/gui2/update.py b/src/calibre/gui2/update.py index 86da8c1be6..3e878ba97a 100644 --- a/src/calibre/gui2/update.py +++ b/src/calibre/gui2/update.py @@ -103,6 +103,8 @@ class CheckForUpdates(Thread): def version_key(calibre_version): + if isinstance(calibre_version, bytes): + calibre_version = calibre_version.decode('utf-8') if calibre_version.count('.') > 1: calibre_version = calibre_version.rpartition('.')[0] return calibre_version From dcb128eb8ba92f78c7046050a795b3ef3d8fcb4e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Mar 2019 14:06:15 +0530 Subject: [PATCH 0343/2613] py3: Allow serializing utf-8 bytestrings to JSON This matches behavior of py2 --- src/calibre/utils/config.py | 2 ++ src/calibre/utils/serialize.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py index 22934c9b27..8162af7baa 100644 --- a/src/calibre/utils/config.py +++ b/src/calibre/utils/config.py @@ -203,6 +203,8 @@ def to_json(obj): '__value__': isoformat(obj, as_utc=True)} if isinstance(obj, (set, frozenset)): return {'__class__': 'set', '__value__': tuple(obj)} + if isinstance(obj, bytes): + return obj.decode('utf-8') if hasattr(obj, 'toBase64'): # QByteArray return {'__class__': 'bytearray', '__value__': bytes(obj.toBase64()).decode('ascii')} diff --git a/src/calibre/utils/serialize.py b/src/calibre/utils/serialize.py index 2b8bd1e7cc..cd5cd28a1b 100644 --- a/src/calibre/utils/serialize.py +++ b/src/calibre/utils/serialize.py @@ -43,6 +43,8 @@ def create_encoder(for_json=False): return encoded(3, fm_as_dict(obj), ExtType) elif isinstance(obj, Tag): return encoded(4, obj.as_dict(), ExtType) + if for_json and isinstance(obj, bytes): + return obj.decode('utf-8') raise TypeError('Cannot serialize objects of type {}'.format(type(obj))) return encoder From 7b2620a0accc95936caec4eadee2c9c8bdd3c246 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Mar 2019 14:12:23 +0530 Subject: [PATCH 0344/2613] Move JSON serialization function into config_base --- src/calibre/utils/config.py | 67 ++++++++------------------------ src/calibre/utils/config_base.py | 47 ++++++++++++++++++++++ 2 files changed, 63 insertions(+), 51 deletions(-) diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py index 8162af7baa..2ca0139bba 100644 --- a/src/calibre/utils/config.py +++ b/src/calibre/utils/config.py @@ -1,4 +1,5 @@ from __future__ import print_function + __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' __docformat__ = 'restructuredtext en' @@ -6,17 +7,22 @@ __docformat__ = 'restructuredtext en' ''' Manage application-wide preferences. ''' -import os, base64, datetime, json, plistlib -from copy import deepcopy -import optparse -from calibre.constants import (config_dir, CONFIG_DIR_MODE, __appname__, - get_version, __author__, iswindows) +import optparse +import os +import plistlib +from copy import deepcopy + +from calibre.constants import ( + CONFIG_DIR_MODE, __appname__, __author__, config_dir, get_version, iswindows +) +from calibre.utils.config_base import ( + Config, ConfigInterface, ConfigProxy, Option, OptionSet, OptionValues, + StringConfig, json_dumps, json_loads, make_config_dir, plugin_dir, prefs, + read_raw_tweaks, read_tweaks, tweaks, write_tweaks +) from calibre.utils.lock import ExclusiveFile -from calibre.utils.config_base import (make_config_dir, Option, OptionValues, - OptionSet, ConfigInterface, Config, prefs, StringConfig, ConfigProxy, - read_raw_tweaks, read_tweaks, write_tweaks, tweaks, plugin_dir) -from calibre.utils.serialize import pickle_loads + # optparse uses gettext.gettext instead of _ from builtins, so we # monkey patch it. @@ -193,48 +199,6 @@ class OptionParser(optparse.OptionParser): return optparse.OptionParser.add_option_group(self, *args, **kwargs) -def to_json(obj): - if isinstance(obj, bytearray): - return {'__class__': 'bytearray', - '__value__': base64.standard_b64encode(bytes(obj)).decode('ascii')} - if isinstance(obj, datetime.datetime): - from calibre.utils.date import isoformat - return {'__class__': 'datetime.datetime', - '__value__': isoformat(obj, as_utc=True)} - if isinstance(obj, (set, frozenset)): - return {'__class__': 'set', '__value__': tuple(obj)} - if isinstance(obj, bytes): - return obj.decode('utf-8') - if hasattr(obj, 'toBase64'): # QByteArray - return {'__class__': 'bytearray', - '__value__': bytes(obj.toBase64()).decode('ascii')} - raise TypeError(repr(obj) + ' is not JSON serializable') - - -def from_json(obj): - custom = obj.get('__class__') - if custom is not None: - if custom == 'bytearray': - return bytearray(base64.standard_b64decode(obj['__value__'])) - if custom == 'datetime.datetime': - from calibre.utils.iso8601 import parse_iso8601 - return parse_iso8601(obj['__value__'], assume_utc=True) - if custom == 'set': - return set(obj['__value__']) - return obj - - -def json_dumps(obj): - ans = json.dumps(obj, indent=2, default=to_json, sort_keys=True, ensure_ascii=False) - if not isinstance(ans, bytes): - ans = ans.encode('utf-8') - return ans - - -def json_loads(raw): - return json.loads(raw.decode('utf-8'), object_hook=from_json) - - class DynamicConfig(dict): ''' A replacement for QSettings that supports dynamic config keys. @@ -259,6 +223,7 @@ class DynamicConfig(dict): def read_old_serialized_representation(self): from calibre.utils.shared_file import share_open + from calibre.utils.serialize import pickle_loads path = self.file_path.rpartition('.')[0] try: with share_open(path, 'rb') as f: diff --git a/src/calibre/utils/config_base.py b/src/calibre/utils/config_base.py index a2ba0c793a..e0865fd0d1 100644 --- a/src/calibre/utils/config_base.py +++ b/src/calibre/utils/config_base.py @@ -18,6 +18,53 @@ from polyglot.builtins import unicode_type plugin_dir = os.path.join(config_dir, 'plugins') +def to_json(obj): + import datetime + if isinstance(obj, bytearray): + import base64 + return {'__class__': 'bytearray', + '__value__': base64.standard_b64encode(bytes(obj)).decode('ascii')} + if isinstance(obj, datetime.datetime): + from calibre.utils.date import isoformat + return {'__class__': 'datetime.datetime', + '__value__': isoformat(obj, as_utc=True)} + if isinstance(obj, (set, frozenset)): + return {'__class__': 'set', '__value__': tuple(obj)} + if isinstance(obj, bytes): + return obj.decode('utf-8') + if hasattr(obj, 'toBase64'): # QByteArray + return {'__class__': 'bytearray', + '__value__': bytes(obj.toBase64()).decode('ascii')} + raise TypeError(repr(obj) + ' is not JSON serializable') + + +def from_json(obj): + custom = obj.get('__class__') + if custom is not None: + if custom == 'bytearray': + import base64 + return bytearray(base64.standard_b64decode(obj['__value__'])) + if custom == 'datetime.datetime': + from calibre.utils.iso8601 import parse_iso8601 + return parse_iso8601(obj['__value__'], assume_utc=True) + if custom == 'set': + return set(obj['__value__']) + return obj + + +def json_dumps(obj): + import json + ans = json.dumps(obj, indent=2, default=to_json, sort_keys=True, ensure_ascii=False) + if not isinstance(ans, bytes): + ans = ans.encode('utf-8') + return ans + + +def json_loads(raw): + import json + return json.loads(raw.decode('utf-8'), object_hook=from_json) + + def make_config_dir(): if not os.path.exists(plugin_dir): os.makedirs(plugin_dir, mode=CONFIG_DIR_MODE) From 1e1ad23ec7fce81e109ab3f7abba6496c0f7734b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Mar 2019 14:23:25 +0530 Subject: [PATCH 0345/2613] Forgot to keep from/to_json in config namespace --- src/calibre/utils/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py index 2ca0139bba..a764b907b8 100644 --- a/src/calibre/utils/config.py +++ b/src/calibre/utils/config.py @@ -19,7 +19,7 @@ from calibre.constants import ( from calibre.utils.config_base import ( Config, ConfigInterface, ConfigProxy, Option, OptionSet, OptionValues, StringConfig, json_dumps, json_loads, make_config_dir, plugin_dir, prefs, - read_raw_tweaks, read_tweaks, tweaks, write_tweaks + read_raw_tweaks, read_tweaks, tweaks, write_tweaks, from_json, to_json ) from calibre.utils.lock import ExclusiveFile @@ -32,7 +32,7 @@ if False: # Make pyflakes happy Config, ConfigProxy, Option, OptionValues, StringConfig OptionSet, ConfigInterface, read_tweaks, write_tweaks - read_raw_tweaks, tweaks, plugin_dir, prefs + read_raw_tweaks, tweaks, plugin_dir, prefs, from_json, to_json def check_config_write_access(): From d0b99d7e68522c86cc582248339f60c8004e466b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 17 Mar 2019 18:23:09 +0530 Subject: [PATCH 0346/2613] Move the old .py based config files to JSON The .py format relied on pickle for serialization of complex datatypes and is not stable against multiple python versions. As witht he migration of the .pickle config files, an upgrade/downgrade will make the settings disjoint. --- src/calibre/utils/config_base.py | 119 ++++++++++++++++++------------- 1 file changed, 71 insertions(+), 48 deletions(-) diff --git a/src/calibre/utils/config_base.py b/src/calibre/utils/config_base.py index e0865fd0d1..30f3d87876 100644 --- a/src/calibre/utils/config_base.py +++ b/src/calibre/utils/config_base.py @@ -6,13 +6,13 @@ __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import os, re, cPickle, traceback, numbers +import os, re, traceback, numbers from functools import partial from collections import defaultdict from copy import deepcopy from calibre.utils.lock import ExclusiveFile -from calibre.constants import config_dir, CONFIG_DIR_MODE +from calibre.constants import config_dir, CONFIG_DIR_MODE, ispy3 from polyglot.builtins import unicode_type plugin_dir = os.path.join(config_dir, 'plugins') @@ -242,18 +242,40 @@ class OptionSet(object): return match.group() return '' - def parse_string(self, src): + def parse_old_style(self, src): + if ispy3: + import pickle as cPickle + else: + import cPickle options = {'cPickle':cPickle} - if src is not None: + try: + if not isinstance(src, unicode_type): + src = src.decode('utf-8') + src = src.replace(u'PyQt%d.QtCore' % 4, u'PyQt5.QtCore') + exec(src, options) + except Exception as err: try: - if not isinstance(src, unicode_type): - src = src.decode('utf-8') - src = src.replace(u'PyQt%d.QtCore' % 4, u'PyQt5.QtCore') - exec(src, options) - except: - print('Failed to parse options string:') - print(repr(src)) - traceback.print_exc() + print('Failed to parse options string with error: {}'.format(err)) + except Exception: + pass + return options + + def parse_string(self, src): + options = {} + if src: + is_old_style = (isinstance(src, bytes) and src.startswith(b'#')) or (isinstance(src, unicode_type) and src.startswith(u'#')) + if is_old_style: + options = self.parse_old_style(src) + else: + try: + options = json_loads(src) + if not isinstance(options, dict): + raise Exception('options is not a dictionary') + except Exception as err: + try: + print('Failed to parse options string with error: {}'.format(err)) + except Exception: + pass opts = OptionValues() for pref in self.preferences: val = options.get(pref.name, pref.default) @@ -264,33 +286,9 @@ class OptionSet(object): return opts - def render_group(self, name, desc, opts): - prefs = [pref for pref in self.preferences if pref.group == name] - lines = ['### Begin group: %s'%(name if name else 'DEFAULT')] - if desc: - lines += map(lambda x: '# '+x, desc.split('\n')) - lines.append(' ') - for pref in prefs: - lines.append('# '+pref.name.replace('_', ' ')) - if pref.help: - lines += map(lambda x: '# ' + x, pref.help.split('\n')) - lines.append('%s = %s'%(pref.name, - self.serialize_opt(getattr(opts, pref.name, pref.default)))) - lines.append(' ') - return '\n'.join(lines) - - def serialize_opt(self, val): - if val is val is True or val is False or val is None or \ - isinstance(val, (numbers.Number, bytes, unicode_type)): - return repr(val) - pickle = cPickle.dumps(val, -1) - return 'cPickle.loads(%s)'%repr(pickle) - def serialize(self, opts): - src = '# %s\n\n'%(self.description.replace('\n', '\n# ')) - groups = [self.render_group(name, self.groups.get(name, ''), opts) - for name in [None] + self.group_list] - return src + '\n\n'.join(groups) + data = {pref.name: getattr(opts, pref.name, pref.default) for pref in self.preferences} + return json_dumps(data) class ConfigInterface(object): @@ -322,18 +320,40 @@ class Config(ConfigInterface): def __init__(self, basename, description=''): ConfigInterface.__init__(self, description) - self.config_file_path = os.path.join(config_dir, basename+'.py') + self.filename_base = basename + + @property + def config_file_path(self): + return os.path.join(config_dir, self.filename_base + '.py.json') def parse(self): - src = '' - if os.path.exists(self.config_file_path): - with ExclusiveFile(self.config_file_path) as f: + src = u'' + migrate = False + path = self.config_file_path + if os.path.exists(path): + with ExclusiveFile(path) as f: try: src = f.read().decode('utf-8') except ValueError: - print("Failed to parse", self.config_file_path) + print("Failed to parse", path) traceback.print_exc() - return self.option_set.parse_string(src) + if not src: + path = path.rpartition('.')[0] + from calibre.utils.shared_file import share_open + try: + with share_open(path, 'rb') as f: + src = f.read().decode('utf-8') + except Exception: + pass + else: + migrate = bool(src) + ans = self.option_set.parse_string(src) + if migrate: + new_src = self.option_set.serialize(ans) + with ExclusiveFile(self.config_file_path) as f: + f.seek(0), f.truncate() + f.write(new_src) + return ans def set(self, name, val): if not self.option_set.has_option(name): @@ -344,8 +364,7 @@ class Config(ConfigInterface): src = f.read() opts = self.option_set.parse_string(src) setattr(opts, name, val) - footer = self.option_set.get_override_section(src) - src = self.option_set.serialize(opts)+ '\n\n' + footer + '\n' + src = self.option_set.serialize(opts) f.seek(0) f.truncate() if isinstance(src, unicode_type): @@ -360,7 +379,12 @@ class StringConfig(ConfigInterface): def __init__(self, src, description=''): ConfigInterface.__init__(self, description) + self.set_src(src) + + def set_src(self, src): self.src = src + if isinstance(self.src, bytes): + self.src = self.src.decode('utf-8') def parse(self): return self.option_set.parse_string(self.src) @@ -370,8 +394,7 @@ class StringConfig(ConfigInterface): raise ValueError('The option %s is not defined.'%name) opts = self.option_set.parse_string(self.src) setattr(opts, name, val) - footer = self.option_set.get_override_section(self.src) - self.src = self.option_set.serialize(opts)+ '\n\n' + footer + '\n' + self.set_src(self.option_set.serialize(opts)) class ConfigProxy(object): From 86c1d1747441621b19c535139d1adcf6e06e0b2c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 17 Mar 2019 18:37:12 +0530 Subject: [PATCH 0347/2613] Migrate .pickle config files to JSON format on first read --- src/calibre/utils/config.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py index a764b907b8..07eededc59 100644 --- a/src/calibre/utils/config.py +++ b/src/calibre/utils/config.py @@ -238,6 +238,7 @@ class DynamicConfig(dict): def refresh(self, clear_current=True): d = {} + migrate = False if clear_current: self.clear() if os.path.exists(self.file_path): @@ -251,8 +252,16 @@ class DynamicConfig(dict): self.name, err)) else: d = self.read_old_serialized_representation() + migrate = bool(d) else: d = self.read_old_serialized_representation() + migrate = bool(d) + if migrate and d: + raw = json_dumps(d) + with ExclusiveFile(self.file_path) as f: + f.seek(0), f.truncate() + f.write(raw) + self.update(d) def __getitem__(self, key): From 9505fdf226d17cb945be1349f8cb8f266e52bec4 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 14 Mar 2019 16:15:39 -0400 Subject: [PATCH 0348/2613] Remove ancient db migration code. The last caller for this function was removed in 2012. This gets rid of a python2-specific cStringIO import. --- src/calibre/library/database2.py | 56 +------------------------------- 1 file changed, 1 insertion(+), 55 deletions(-) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index fea0d5e5fc..239f72871f 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -6,11 +6,10 @@ __docformat__ = 'restructuredtext en' ''' The database used to store ebook metadata ''' -import os, sys, shutil, cStringIO, glob, time, functools, traceback, re, \ +import os, sys, shutil, glob, time, functools, traceback, re, \ json, uuid, hashlib, copy, types, numbers from collections import defaultdict, namedtuple import threading, random -from itertools import repeat from calibre import prints, force_unicode from calibre.ebooks.metadata import (title_sort, author_to_author_sort, @@ -3654,59 +3653,6 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): for i in iter(self): yield i[x] - def migrate_old(self, db, progress): - from PyQt5.QtCore import QCoreApplication - header = u'

Migrating old database to ebook library in %s

'%self.library_path - progress.setValue(0) - progress.setLabelText(header) - QCoreApplication.processEvents() - db.conn.row_factory = lambda cursor, row: tuple(row) - db.conn.text_factory = lambda x: unicode_type(x, 'utf-8', 'replace') - books = db.conn.get('SELECT id, title, sort, timestamp, series_index, author_sort, isbn FROM books ORDER BY id ASC') - progress.setAutoReset(False) - progress.setRange(0, len(books)) - - for book in books: - self.conn.execute('INSERT INTO books(id, title, sort, timestamp, series_index, author_sort, isbn) VALUES(?, ?, ?, ?, ?, ?, ?, ?);', book) - - tables = ''' -authors ratings tags series books_tags_link -comments publishers -books_authors_link conversion_options -books_publishers_link -books_ratings_link -books_series_link feeds -'''.split() - for table in tables: - rows = db.conn.get('SELECT * FROM %s ORDER BY id ASC'%table) - for row in rows: - self.conn.execute('INSERT INTO %s VALUES(%s)'%(table, ','.join(repeat('?', len(row)))), row) - - self.conn.commit() - self.refresh('timestamp', True) - for i, book in enumerate(books): - progress.setLabelText(header+_(u'Copying %s')%book[1]) - id = book[0] - self.set_path(id, True) - formats = db.formats(id, index_is_id=True) - if not formats: - formats = [] - else: - formats = formats.split(',') - for format in formats: - data = db.format(id, format, index_is_id=True) - if data: - self.add_format(id, format, cStringIO.StringIO(data), index_is_id=True) - cover = db.cover(id, index_is_id=True) - if cover: - self.set_cover(id, cover) - progress.setValue(i+1) - self.conn.commit() - progress.setLabelText(_('Compacting database')) - self.vacuum() - progress.reset() - return len(books) - def find_books_in_directory(self, dirpath, single_book_per_directory): return find_books_in_directory(dirpath, single_book_per_directory) From e37cf6ab3cf1d545e65cdee2a0313ae4fdd9cdde Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 14 Mar 2019 16:38:10 -0400 Subject: [PATCH 0349/2613] Update PyRSS2Gen to 1.1 Pull functional changes adapted to in-tree calibre cleanups. Upstream officially supports python3 so this should be all that is needed. --- src/calibre/utils/rss_gen.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/calibre/utils/rss_gen.py b/src/calibre/utils/rss_gen.py index 407c39240b..29976d17af 100644 --- a/src/calibre/utils/rss_gen.py +++ b/src/calibre/utils/rss_gen.py @@ -1,7 +1,7 @@ """PyRSS2Gen - A Python library for generating RSS 2.0 feeds.""" __name__ = "PyRSS2Gen" -__version__ = (1, 0, 0) +__version__ = (1, 1, 0) __author__ = "Andrew Dalke " _generator_name = __name__ + "-" + ".".join(map(str, __version__)) @@ -22,12 +22,8 @@ class WriteXmlMixin: handler.endDocument() def to_xml(self, encoding="iso-8859-1"): - try: - import cStringIO as StringIO - StringIO - except ImportError: - import StringIO - f = StringIO.StringIO() + import io + f = io.StringIO() self.write_xml(f, encoding) return f.getvalue() @@ -387,7 +383,7 @@ class RSS2(WriteXmlMixin): ttl = self.ttl if isinstance(self.ttl, numbers.Integral): ttl = IntElement("ttl", ttl) - _opt_element(handler, "tt", ttl) + _opt_element(handler, "ttl", ttl) if self.image is not None: self.image.publish(handler) From e02f836bd00aff66e3deb8cdf426d325c6517093 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 17 Mar 2019 03:58:43 -0400 Subject: [PATCH 0350/2613] lit reader: consistently use bytes when writing to the buffer --- src/calibre/ebooks/lit/reader.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/calibre/ebooks/lit/reader.py b/src/calibre/ebooks/lit/reader.py index 86ff680e62..ab060b8757 100644 --- a/src/calibre/ebooks/lit/reader.py +++ b/src/calibre/ebooks/lit/reader.py @@ -226,7 +226,7 @@ class UnBinary(object): state = 'text' if oc == 0 else 'get attr' if flags & FLAG_OPENING: tag = oc - buf.write('<') + buf.write(b'<') if not (flags & FLAG_CLOSING): is_goingdown = True if tag == 0x8000: @@ -261,9 +261,9 @@ class UnBinary(object): if not is_goingdown: tag_name = None dynamic_tag = 0 - buf.write(' />') + buf.write(b' />') else: - buf.write('>') + buf.write(b'>') frame = (depth, tag_name, current_map, dynamic_tag, errors, in_censorship, False, 'close tag', flags) @@ -288,7 +288,7 @@ class UnBinary(object): in_censorship = True state = 'get value length' continue - buf.write(' ' + encode(attr) + '=') + buf.write(b' ' + encode(attr) + b'=') if attr in ['href', 'src']: state = 'get href length' else: @@ -296,11 +296,11 @@ class UnBinary(object): elif state == 'get value length': if not in_censorship: - buf.write('"') + buf.write(b'"') count = oc - 1 if count == 0: if not in_censorship: - buf.write('"') + buf.write(b'"') in_censorship = False state = 'get attr' continue @@ -313,7 +313,7 @@ class UnBinary(object): elif state == 'get value': if count == 0xfffe: if not in_censorship: - buf.write('%s"' % (oc - 1)) + buf.write(encode('%s"' % (oc - 1))) in_censorship = False state = 'get attr' elif count > 0: @@ -326,7 +326,7 @@ class UnBinary(object): count -= 1 if count == 0: if not in_censorship: - buf.write('"') + buf.write(b'"') in_censorship = False state = 'get attr' @@ -349,14 +349,14 @@ class UnBinary(object): count = oc - 1 if count <= 0 or count > (len(bin) - self.cpos): raise LitError('Invalid character count %d' % count) - buf.write(' ') + buf.write(b' ') state = 'get custom attr' elif state == 'get custom attr': buf.write(encode(c)) count -= 1 if count == 0: - buf.write('=') + buf.write(b'=') state = 'get value length' elif state == 'get href length': From 0b252e86594b024f1a57daac055373b53cafdea7 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 17 Mar 2019 04:18:55 -0400 Subject: [PATCH 0351/2613] palmdoc: consistently use bytes when writing to the buffer --- src/calibre/ebooks/compression/palmdoc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/compression/palmdoc.py b/src/calibre/ebooks/compression/palmdoc.py index ebd0642c6f..5a8272ef9e 100644 --- a/src/calibre/ebooks/compression/palmdoc.py +++ b/src/calibre/ebooks/compression/palmdoc.py @@ -83,7 +83,7 @@ def py_compress_doc(data): i += 1 continue if och == 0 or (och > 8 and och < 0x80): - out.write(ch) + out.write(ch.encode('utf-8')) else: j = i binseq = [ch] @@ -95,6 +95,6 @@ def py_compress_doc(data): binseq.append(ch) j += 1 out.write(pack('>B', len(binseq))) - out.write(''.join(binseq)) + out.write(''.join(binseq).encode('utf-8')) i += len(binseq) - 1 return out.getvalue() From c1fb63378ffcaeb083ebef830349070cbca683e3 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 11 Mar 2019 14:37:02 -0400 Subject: [PATCH 0352/2613] python3: migrate lots of code to io.(Bytes|String)IO instead of c?StringIO This is the only IO representation on python3, and it is backported to python2 to aid in porting but requires determining whether to handle bytes or unicode... which is sort of the point of porting, so let's handle this properly everywhere we can. --- recipes/bloomberg_columns.recipe | 4 +-- recipes/houston_chronicle.recipe | 4 +-- recipes/zeitde_sub.recipe | 4 +-- src/calibre/devices/android/driver.py | 15 +++++----- src/calibre/devices/cybook/t2b.py | 5 ++-- src/calibre/devices/kindle/bookmark.py | 12 ++++---- src/calibre/devices/nook/driver.py | 10 +++---- src/calibre/ebooks/chm/metadata.py | 6 ++-- src/calibre/ebooks/compression/palmdoc.py | 4 +-- .../ebooks/conversion/plugins/htmlz_output.py | 5 ++-- .../ebooks/conversion/plugins/pml_output.py | 8 ++--- src/calibre/ebooks/conversion/plumber.py | 4 +-- src/calibre/ebooks/lit/reader.py | 5 ++-- src/calibre/ebooks/lit/writer.py | 30 +++++++++---------- src/calibre/ebooks/lrf/meta.py | 5 ++-- src/calibre/ebooks/lrf/objects.py | 12 ++++---- src/calibre/ebooks/lrf/pylrs/pylrf.py | 7 ++--- src/calibre/ebooks/metadata/epub.py | 7 ++--- src/calibre/ebooks/metadata/extz.py | 9 +++--- src/calibre/ebooks/metadata/lit.py | 5 ++-- src/calibre/ebooks/metadata/odt.py | 5 ++-- src/calibre/ebooks/metadata/opf2.py | 18 +++++------ src/calibre/ebooks/metadata/snb.py | 4 +-- src/calibre/ebooks/metadata/topaz.py | 9 +++--- src/calibre/ebooks/mobi/writer2/indexer.py | 10 +++---- src/calibre/ebooks/mobi/writer2/main.py | 9 +++--- src/calibre/ebooks/oeb/reader.py | 4 +-- src/calibre/ebooks/pdb/ereader/writer.py | 7 ++--- src/calibre/ebooks/rb/writer.py | 8 ++--- src/calibre/ebooks/rtf/rtfml.py | 10 +++---- src/calibre/gui2/__init__.py | 4 +-- src/calibre/gui2/device.py | 4 +-- src/calibre/gui2/dialogs/catalog.py | 4 +-- src/calibre/translations/dynamic.py | 4 +-- src/calibre/utils/ipc/job.py | 7 ++--- src/calibre/utils/localization.py | 14 ++++----- src/calibre/utils/zipfile.py | 4 +-- src/calibre/web/feeds/news.py | 6 ++-- 38 files changed, 134 insertions(+), 158 deletions(-) diff --git a/recipes/bloomberg_columns.recipe b/recipes/bloomberg_columns.recipe index f43848d89d..552e3278d0 100644 --- a/recipes/bloomberg_columns.recipe +++ b/recipes/bloomberg_columns.recipe @@ -7,7 +7,7 @@ chron.com ''' from datetime import datetime, timedelta from lxml import html, etree -from StringIO import StringIO +import io from calibre.web.feeds.recipes import BasicNewsRecipe import urllib2 from collections import OrderedDict @@ -31,7 +31,7 @@ def get_article_parsed(this_url): page = urllib2.urlopen(req) content = page.read() parser = etree.HTMLParser() - parsed = html.parse(StringIO(content), parser) + parsed = html.parse(io.BytesIO(bytes(content)), parser) return parsed diff --git a/recipes/houston_chronicle.recipe b/recipes/houston_chronicle.recipe index 8079974c0e..2a2ea05dc9 100644 --- a/recipes/houston_chronicle.recipe +++ b/recipes/houston_chronicle.recipe @@ -9,7 +9,7 @@ chron.com import re import time import urllib2 -from StringIO import StringIO +import io from datetime import datetime import traceback import sys @@ -66,7 +66,7 @@ def get_article_parsed(this_url): page = urllib2.urlopen(this_url) content = page.read() parser = etree.HTMLParser() - parsed = html.parse(StringIO(content), parser) + parsed = html.parse(io.BytesIO(bytes(content)), parser) return parsed diff --git a/recipes/zeitde_sub.recipe b/recipes/zeitde_sub.recipe index c396335e49..03905cbbb3 100644 --- a/recipes/zeitde_sub.recipe +++ b/recipes/zeitde_sub.recipe @@ -13,7 +13,7 @@ Die Zeit EPUB import os import zipfile import re -import cStringIO +import io from calibre.web.feeds.news import BasicNewsRecipe from calibre.ptempfile import PersistentTemporaryFile from calibre import walk @@ -272,7 +272,7 @@ class ZeitEPUBAbo(BasicNewsRecipe): with closing(browser.open(cover_url)) as r: cdata = r.read() from calibre.ebooks.metadata.pdf import get_metadata - stream = cStringIO.StringIO(cdata) + stream = io.BytesIO(cdata) cdata = None mi = get_metadata(stream) if mi.cover_data and mi.cover_data[1]: diff --git a/src/calibre/devices/android/driver.py b/src/calibre/devices/android/driver.py index fac9b100e0..c9ddbb22ed 100644 --- a/src/calibre/devices/android/driver.py +++ b/src/calibre/devices/android/driver.py @@ -4,10 +4,9 @@ __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' +import io import os -import cStringIO - from calibre import fsync from calibre.devices.usbms.driver import USBMS from polyglot.builtins import string_or_bytes @@ -391,12 +390,12 @@ class WEBOS(USBMS): coverdata = getattr(metadata, 'thumbnail', None) if coverdata and coverdata[2]: - cover = Image.open(cStringIO.StringIO(coverdata[2])) + cover = Image.open(io.BytesIO(coverdata[2])) else: coverdata = lopen(I('library.png'), 'rb').read() cover = Image.new('RGB', (120,160), 'black') - im = Image.open(cStringIO.StringIO(coverdata)) + im = Image.open(io.BytesIO(coverdata)) im.thumbnail((120, 160), Image.ANTIALIAS) x, y = im.size @@ -406,7 +405,7 @@ class WEBOS(USBMS): draw.text((1, 10), metadata.get('title', _('Unknown')).encode('ascii', 'ignore')) draw.text((1, 140), metadata.get('authors', _('Unknown'))[0].encode('ascii', 'ignore')) - data = cStringIO.StringIO() + data = io.BytesIO() cover.save(data, 'JPEG') coverdata = data.getvalue() @@ -416,12 +415,12 @@ class WEBOS(USBMS): coverdata = getattr(metadata, 'thumbnail', None) if coverdata and coverdata[2]: - cover = Image.open(cStringIO.StringIO(coverdata[2])) + cover = Image.open(io.BytesIO(coverdata[2])) else: coverdata = lopen(I('library.png'), 'rb').read() cover = Image.new('RGB', (52,69), 'black') - im = Image.open(cStringIO.StringIO(coverdata)) + im = Image.open(io.BytesIO(coverdata)) im.thumbnail((52, 69), Image.ANTIALIAS) x, y = im.size @@ -429,7 +428,7 @@ class WEBOS(USBMS): cover2 = cover.resize((52, 69), Image.ANTIALIAS).convert('RGB') - data = cStringIO.StringIO() + data = io.BytesIO() cover2.save(data, 'JPEG') coverdata = data.getvalue() diff --git a/src/calibre/devices/cybook/t2b.py b/src/calibre/devices/cybook/t2b.py index be99ca657c..c435cd5240 100644 --- a/src/calibre/devices/cybook/t2b.py +++ b/src/calibre/devices/cybook/t2b.py @@ -4,7 +4,7 @@ __copyright__ = '2009, John Schember ' Write a t2b file to disk. ''' -import StringIO +import io DEFAULT_T2B_DATA = '\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x0f\xff\xff\xff\xf0\xff\x0f\xc3\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf8\x00\x00\xff\xff\xff\xf0\xff\x0f\xc3\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xe0\xff\xf0\xff\xff\xff\xf0\xff\xff\xc3\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc3\xff\xff\xff\xff\xff\xf0\xff\xff\xc3\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x07\xff\xff\xfc\x00?\xf0\xff\x0f\xc3\x00?\xf0\xc0\xfe\x00?\xff\xff\xff\xff\xff\xff\xff\x0f\xff\xff\xf0<\x0f\xf0\xff\x0f\xc0,\x0f\xf0\x0e\xf0,\x0f\xff\xff\xff\xff\xff\xff\xff\x0f\xff\xff\xff\xff\xc3\xf0\xff\x0f\xc0\xff\x0f\xf0\xff\xf0\xff\xc7\xff\xff\xff\xff\xff\xff\xff\x0f\xff\xff\xff\xff\xc3\xf0\xff\x0f\xc3\xff\xc3\xf0\xff\xc3\xff\xc3\xff\xff\xff\xff\xff\xff\xff\x0f\xff\xff\xff\x00\x03\xf0\xff\x0f\xc3\xff\xc3\xf0\xff\xc3\xff\xc3\xff\xff\xff\xff\xff\xff\xff\x0f\xff\xff\xf0\x1f\xc3\xf0\xff\x0f\xc3\xff\xc3\xf0\xff\xc0\x00\x03\xff\xff\xff\xff\xff\xff\xff\x0b\xff\xff\xf0\xff\xc3\xf0\xff\x0f\xc3\xff\xc3\xf0\xff\xc3\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc3\xff\xff\xf3\xff\xc3\xf0\xff\x0f\xc3\xff\xc3\xf0\xff\xc3\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc0\xff\xfc\xf0\xff\x03\xf0\xff\x0f\xc0\xff\x0f\xf0\xff\xf0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf0\x0f\x00\xf08\x03\xf0\xff\x0f\xc0,\x0f\xf0\xff\xf0\x1f\x03\xff\xff\xff\xff\xff\xff\xff\xff\x00\x0f\xfc\x00\xc3\xf0\xff\x0f\xc3\x00?\xf0\xff\xff\x00\x0f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf0\x0f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf0\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x03\xfe\x94\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc0\x00\x00\x00\x0f\xff\xff\xff\xff\xff\xff\xfc\x7f\xfe\x94\xff\xff\xff\xff\xff\xff\xff\xff\xfc\x0f\xff\xfe\xa9@\xff\xff\xff\xff\xff\xff\xfc?\xfe\xa4\xff\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xe9P\xff\xff\xff\xff\xff\xff\xfe/\xfe\xa8\xff\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xf9T\xff\xff\xff\xff\xf0@\x00+\xfa\xa8?\xff\xff\xff\xff\xff\xff\xff\xfc\xbf\xff\xff\xf9T\xff\xff\xff\xff\xcb\xe4}*\xaa\xaa?\xff\xff\xff\xff\xff\xff\xff\xfc\xbf\xff\xff\xe9T\xff\xff\xff\xff\xc7\xe4\xfd\x1a\xaa\xaa?\xff\xff\xff\xff\xff\xff\xff\xfc\xaf\xea\xaa\xa6\xa4\xff@\x00\x0f\xc3\xe8\xfe\x1a\xaa\xaa?\xff\xff\xff\xff\xff\xff\xff\xfcj\x95UZ\xa4\x00\x7f\xfe\x90\x03\xe8\xfe\n\xaa\xaa?\xff\xff\xff\xff\xff\xff\xff\xfcj\x95UZ\xa4?\xff\xff\xa5C\xe8\xfe\x06\xaa\xaa?\xff\xff\xff\xff\xff\xff\xff\xfcj\x95UZ\xa4?\xff\xff\xeaC\xe8\xbe\x06\xaa\xaa\x0f\xff\xff\xff\xff\xff\xff\xff\xfcj\x95UZ\xa4/\xff\xff\xea\x82\xe8j\x06\xaa\xaa\x0f\xff\xff\xff\xff\xff\xff\xff\xfcj\x95UZ\xa4/\xff\xff\xaa\x82\xe8*F\xaa\xaa\x8f\xff\xff\xff\xff\xff\xff\xff\xfcj\x95UZ\xa4+\xff\xfe\xaa\x82\xe8*\x86\xaa\xaa\x8f\xff\xff\x80\xff\xff\xff\xff\xfcj\x95UV\xa4\x1a\xfa\xaa\xaa\x82\xe8*\x86\xaa\xaa\x8f\xf0\x00T?\xff\xff\x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xfc\xff\xff\xff\xff\xf4\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' # noqa @@ -31,7 +31,7 @@ def write_t2b(t2bfile, coverdata=None): ''' from PIL import Image if coverdata is not None: - coverdata = StringIO.StringIO(coverdata) + coverdata = io.BytesIO(coverdata) cover = Image.open(coverdata).convert("L") cover.thumbnail((96, 144), Image.ANTIALIAS) t2bcover = Image.new('L', (96, 144), 'white') @@ -49,4 +49,3 @@ def write_t2b(t2bfile, coverdata=None): px = [] else: t2bfile.write(DEFAULT_T2B_DATA) - diff --git a/src/calibre/devices/kindle/bookmark.py b/src/calibre/devices/kindle/bookmark.py index 169a10654a..3d08483d17 100644 --- a/src/calibre/devices/kindle/bookmark.py +++ b/src/calibre/devices/kindle/bookmark.py @@ -5,7 +5,7 @@ __license__ = 'GPL v3' __docformat__ = 'restructuredtext en' import os -from cStringIO import StringIO +import io from struct import unpack @@ -51,7 +51,7 @@ class Bookmark(): # {{{ if self.bookmark_extension == 'mbp': MAGIC_MOBI_CONSTANT = 150 with lopen(self.path,'rb') as f: - stream = StringIO(f.read()) + stream = io.BytesIO(f.read()) data = StreamSlicer(stream) self.timestamp, = unpack('>I', data[0x24:0x28]) bpar_offset, = unpack('>I', data[0x4e:0x52]) @@ -148,7 +148,7 @@ class Bookmark(): # {{{ # This will find the first instance of a clipping only book_fs = self.path.replace('.%s' % self.bookmark_extension,'.%s' % self.book_format) with lopen(book_fs,'rb') as f2: - stream = StringIO(f2.read()) + stream = io.BytesIO(f2.read()) mi = get_topaz_metadata(stream) my_clippings = self.path split = my_clippings.find('documents') + len('documents/') @@ -179,7 +179,7 @@ class Bookmark(): # {{{ MAGIC_TOPAZ_CONSTANT = 33.33 self.timestamp = os.path.getmtime(self.path) with lopen(self.path,'rb') as f: - stream = StringIO(f.read()) + stream = io.BytesIO(f.read()) data = StreamSlicer(stream) self.last_read = int(unpack('>I', data[5:9])[0]) self.last_read_location = self.last_read/MAGIC_TOPAZ_CONSTANT + 1 @@ -220,7 +220,7 @@ class Bookmark(): # {{{ elif self.bookmark_extension == 'pdr': self.timestamp = os.path.getmtime(self.path) with lopen(self.path,'rb') as f: - stream = StringIO(f.read()) + stream = io.BytesIO(f.read()) data = StreamSlicer(stream) self.last_read = int(unpack('>I', data[5:9])[0]) entries, = unpack('>I', data[9:13]) @@ -289,7 +289,7 @@ class Bookmark(): # {{{ # Read the book len from the header try: with lopen(book_fs,'rb') as f: - self.stream = StringIO(f.read()) + self.stream = io.BytesIO(f.read()) self.data = StreamSlicer(self.stream) self.nrecs, = unpack('>H', self.data[76:78]) record0 = self.record(0) diff --git a/src/calibre/devices/nook/driver.py b/src/calibre/devices/nook/driver.py index 7268f6439e..22f7e779f4 100644 --- a/src/calibre/devices/nook/driver.py +++ b/src/calibre/devices/nook/driver.py @@ -8,9 +8,7 @@ __docformat__ = 'restructuredtext en' Device driver for Barns and Nobel's Nook ''' -import os, errno - -import cStringIO +import io, os, errno from calibre import fsync, prints from calibre.constants import DEBUG @@ -57,12 +55,12 @@ class NOOK(USBMS): coverdata = getattr(metadata, 'thumbnail', None) if coverdata and coverdata[2]: - cover = Image.open(cStringIO.StringIO(coverdata[2])) + cover = Image.open(io.BytesIO(coverdata[2])) else: coverdata = lopen(I('library.png'), 'rb').read() cover = Image.new('RGB', (96, 144), 'black') - im = Image.open(cStringIO.StringIO(coverdata)) + im = Image.open(io.BytesIO(coverdata)) im.thumbnail((96, 144), Image.ANTIALIAS) x, y = im.size @@ -72,7 +70,7 @@ class NOOK(USBMS): draw.text((1, 15), metadata.get('title', _('Unknown')).encode('ascii', 'ignore')) draw.text((1, 115), metadata.get('authors', _('Unknown')).encode('ascii', 'ignore')) - data = cStringIO.StringIO() + data = io.BytesIO() cover.save(data, 'JPEG') coverdata = data.getvalue() diff --git a/src/calibre/ebooks/chm/metadata.py b/src/calibre/ebooks/chm/metadata.py index b35da416f1..5169765cfe 100644 --- a/src/calibre/ebooks/chm/metadata.py +++ b/src/calibre/ebooks/chm/metadata.py @@ -126,10 +126,10 @@ def _get_cover(soup, rdr): ans = None if ans is not None: from PIL import Image - from cStringIO import StringIO - buf = StringIO() + import io + buf = io.BytesIO() try: - Image.open(StringIO(ans)).convert('RGB').save(buf, 'JPEG') + Image.open(io.BytesIO(ans)).convert('RGB').save(buf, 'JPEG') ans = buf.getvalue() except: ans = None diff --git a/src/calibre/ebooks/compression/palmdoc.py b/src/calibre/ebooks/compression/palmdoc.py index 5a8272ef9e..1027303133 100644 --- a/src/calibre/ebooks/compression/palmdoc.py +++ b/src/calibre/ebooks/compression/palmdoc.py @@ -5,7 +5,7 @@ from __future__ import print_function __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' -from cStringIO import StringIO +import io from struct import pack from calibre.constants import plugins @@ -50,7 +50,7 @@ def test(): def py_compress_doc(data): - out = StringIO() + out = io.BytesIO() i = 0 ldata = len(data) while i < ldata: diff --git a/src/calibre/ebooks/conversion/plugins/htmlz_output.py b/src/calibre/ebooks/conversion/plugins/htmlz_output.py index cdb74077ae..484dffa09e 100644 --- a/src/calibre/ebooks/conversion/plugins/htmlz_output.py +++ b/src/calibre/ebooks/conversion/plugins/htmlz_output.py @@ -6,9 +6,8 @@ __license__ = 'GPL 3' __copyright__ = '2011, John Schember ' __docformat__ = 'restructuredtext en' +import io import os -from cStringIO import StringIO - from calibre.customize.conversion import OutputFormatPlugin, \ OptionRecommendation @@ -127,7 +126,7 @@ class HTMLZOutput(OutputFormatPlugin): # Metadata with open(os.path.join(tdir, u'metadata.opf'), 'wb') as mdataf: - opf = OPF(StringIO(etree.tostring(oeb_book.metadata.to_opf1()))) + opf = OPF(io.BytesIO(etree.tostring(oeb_book.metadata.to_opf1()))) mi = opf.to_book_metadata() if cover_path: mi.cover = u'cover.jpg' diff --git a/src/calibre/ebooks/conversion/plugins/pml_output.py b/src/calibre/ebooks/conversion/plugins/pml_output.py index 20bf1dc18d..4f09bbbee1 100644 --- a/src/calibre/ebooks/conversion/plugins/pml_output.py +++ b/src/calibre/ebooks/conversion/plugins/pml_output.py @@ -4,7 +4,7 @@ __license__ = 'GPL 3' __copyright__ = '2009, John Schember ' __docformat__ = 'restructuredtext en' -import os, cStringIO +import os, io from calibre.customize.conversion import (OutputFormatPlugin, OptionRecommendation) @@ -65,12 +65,12 @@ class PMLOutput(OutputFormatPlugin): for item in manifest: if item.media_type in OEB_RASTER_IMAGES and item.href in image_hrefs.keys(): if opts.full_image_depth: - im = Image.open(cStringIO.StringIO(item.data)) + im = Image.open(io.BytesIO(item.data)) else: - im = Image.open(cStringIO.StringIO(item.data)).convert('P') + im = Image.open(io.BytesIO(item.data)).convert('P') im.thumbnail((300,300), Image.ANTIALIAS) - data = cStringIO.StringIO() + data = io.BytesIO() im.save(data, 'PNG') data = data.getvalue() diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py index 3bfe919ea7..25ad577c8b 100644 --- a/src/calibre/ebooks/conversion/plumber.py +++ b/src/calibre/ebooks/conversion/plumber.py @@ -923,12 +923,12 @@ OptionRecommendation(name='search_replace', def download_cover(self, url): from calibre import browser from PIL import Image - from cStringIO import StringIO + import io from calibre.ptempfile import PersistentTemporaryFile self.log('Downloading cover from %r'%url) br = browser() raw = br.open_novisit(url).read() - buf = StringIO(raw) + buf = io.BytesIO(raw) pt = PersistentTemporaryFile('.jpg') pt.close() img = Image.open(buf) diff --git a/src/calibre/ebooks/lit/reader.py b/src/calibre/ebooks/lit/reader.py index ab060b8757..b487c673a1 100644 --- a/src/calibre/ebooks/lit/reader.py +++ b/src/calibre/ebooks/lit/reader.py @@ -8,9 +8,8 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' \ 'and Marshall T. Vandegrift ' -import struct, os, functools, re +import io, struct, os, functools, re from urlparse import urldefrag -from cStringIO import StringIO from urllib import unquote as urlunquote from lxml import etree @@ -143,7 +142,7 @@ class UnBinary(object): self.is_html = map is HTML_MAP self.tag_atoms, self.attr_atoms = atoms self.dir = os.path.dirname(path) - buf = StringIO() + buf = io.BytesIO() self.binary_to_text(bin, buf) self.raw = buf.getvalue().lstrip() self.escape_reserved() diff --git a/src/calibre/ebooks/lit/writer.py b/src/calibre/ebooks/lit/writer.py index 35fe053902..0cadb1ac99 100644 --- a/src/calibre/ebooks/lit/writer.py +++ b/src/calibre/ebooks/lit/writer.py @@ -7,9 +7,9 @@ from __future__ import print_function __license__ = 'GPL v3' __copyright__ = '2008, Marshall T. Vandegrift ' -from cStringIO import StringIO from struct import pack from itertools import izip, count, chain +import io import time import random import re @@ -151,7 +151,7 @@ class ReBinary(object): self.logger = oeb.logger self.manifest = oeb.manifest self.tags, self.tattrs = map - self.buf = StringIO() + self.buf = io.BytesIO() self.anchors = [] self.page_breaks = [] self.is_html = is_html = map is HTML_MAP @@ -282,7 +282,7 @@ class ReBinary(object): if len(self.anchors) > 6: self.logger.warn("More than six anchors in file %r. " "Some links may not work properly." % self.item.href) - data = StringIO() + data = io.BytesIO() data.write(codepoint_to_chr(len(self.anchors)).encode('utf-8')) for anchor, offset in self.anchors: data.write(codepoint_to_chr(len(anchor)).encode('utf-8')) @@ -333,7 +333,7 @@ class LitWriter(object): self._oeb = oeb self._logger = oeb.logger self._stream = stream - self._sections = [StringIO() for i in range(4)] + self._sections = [io.BytesIO() for i in range(4)] self._directory = [] self._meta = None self._litize_oeb() @@ -403,7 +403,7 @@ class LitWriter(object): piece2_offset = self._tell() self._write('IFCM', pack('= DCHUNK_SIZE: ddata.append((dchunk.getvalue(), quickref, dcount, name)) - dchunk = StringIO() + dchunk = io.BytesIO() dcount = 0 quickref = [] name = en @@ -700,9 +700,9 @@ class LitWriter(object): dcounts = [] ichunk = None if len(ddata) > 1: - ichunk = StringIO() + ichunk = io.BytesIO() for cid, (content, quickref, dcount, name) in izip(count(), ddata): - dchunk = StringIO() + dchunk = io.BytesIO() prev = cid - 1 if cid > 0 else ULL_NEG1 next = cid + 1 if cid < cidmax else ULL_NEG1 rem = DCHUNK_SIZE - (len(content) + 50) diff --git a/src/calibre/ebooks/lrf/meta.py b/src/calibre/ebooks/lrf/meta.py index 882762a78c..6a60e4c63d 100644 --- a/src/calibre/ebooks/lrf/meta.py +++ b/src/calibre/ebooks/lrf/meta.py @@ -13,9 +13,8 @@ to get and set meta information. For example: >>> lrf.category = "History" """ -import struct, zlib, sys, os +import io, struct, zlib, sys, os from shutil import copyfileobj -from cStringIO import StringIO import xml.dom.minidom as dom from functools import wraps @@ -238,7 +237,7 @@ def insert_into_file(fileobj, data, start, end): @param end: The position in fileobj of data that must not be overwritten @return: C{start + len(data) - end} """ - buffer = StringIO() + buffer = io.BytesIO() fileobj.seek(end) copyfileobj(fileobj, buffer, -1) buffer.flush() diff --git a/src/calibre/ebooks/lrf/objects.py b/src/calibre/ebooks/lrf/objects.py index 883ea82ccd..a6bd2c2322 100644 --- a/src/calibre/ebooks/lrf/objects.py +++ b/src/calibre/ebooks/lrf/objects.py @@ -1,7 +1,7 @@ from __future__ import print_function __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' -import struct, array, zlib, cStringIO, collections, re +import struct, array, zlib, io, collections, re from calibre.ebooks.lrf import LRFParseError, PRS500_PROFILE from calibre.constants import ispy3 @@ -98,7 +98,7 @@ class LRFContentObject(LRFObject): tag_map = {} def __init__(self, bytes, objects): - self.stream = bytes if hasattr(bytes, 'read') else cStringIO.StringIO(bytes) + self.stream = bytes if hasattr(bytes, 'read') else io.BytesIO(bytes) length = self.stream_size() self.objects = objects self._contents = [] @@ -601,7 +601,7 @@ class Block(LRFStream, TextCSS): def initialize(self): self.attrs = {} - stream = cStringIO.StringIO(self.stream) + stream = io.BytesIO(self.stream) tag = Tag(stream) if tag.id != 0xF503: raise LRFParseError("Bad block content") @@ -836,7 +836,7 @@ class Text(LRFStream): def initialize(self): self.content = collections.deque() - stream = cStringIO.StringIO(self.stream) + stream = io.BytesIO(self.stream) length = len(self.stream) style = self.style.as_dict() current_style = style.copy() @@ -1017,7 +1017,7 @@ class Canvas(LRFStream): if hasattr(self, attr): self.attrs[attr] = getattr(self, attr) self._contents = [] - stream = cStringIO.StringIO(self.stream) + stream = io.BytesIO(self.stream) while stream.tell() < len(self.stream): tag = Tag(stream) try: @@ -1266,7 +1266,7 @@ class TocLabel(object): class TOCObject(LRFStream): def initialize(self): - stream = cStringIO.StringIO(self.stream) + stream = io.BytesIO(self.stream) c = struct.unpack(" @@ -1814,10 +1813,10 @@ class OPFTest(unittest.TestCase): def testCreator(self): opf = OPFCreator(os.getcwdu(), self.opf) - buf = cStringIO.StringIO() + buf = io.BytesIO() opf.render(buf) raw = buf.getvalue() - self.testReading(opf=OPF(cStringIO.StringIO(raw), os.getcwdu())) + self.testReading(opf=OPF(io.BytesIO(raw), os.getcwdu())) def testSmartUpdate(self): self.opf.smart_update(MetaInformation(self.opf)) @@ -1833,7 +1832,6 @@ def test(): def test_user_metadata(): - from cStringIO import StringIO mi = Metadata('Test title', ['test author1', 'test author2']) um = { '#myseries': {'#value#': u'test series\xe4', 'datatype':'text', @@ -1846,12 +1844,12 @@ def test_user_metadata(): mi.set_all_user_metadata(um) raw = metadata_to_opf(mi) opfc = OPFCreator(os.getcwdu(), other=mi) - out = StringIO() + out = io.BytesIO() opfc.render(out) raw2 = out.getvalue() - f = StringIO(raw) + f = io.BytesIO(raw) opf = OPF(f) - f2 = StringIO(raw2) + f2 = io.BytesIO(raw2) opf2 = OPF(f2) assert um == opf._user_metadata_ assert um == opf2._user_metadata_ diff --git a/src/calibre/ebooks/metadata/snb.py b/src/calibre/ebooks/metadata/snb.py index f6fdb2e2ab..d488c0de0b 100755 --- a/src/calibre/ebooks/metadata/snb.py +++ b/src/calibre/ebooks/metadata/snb.py @@ -6,7 +6,7 @@ __license__ = 'GPL v3' __copyright__ = '2010, Li Fanxi ' import os -from StringIO import StringIO +import io from calibre.ebooks.metadata import MetaInformation from calibre.ebooks.snb.snbfile import SNBFile from lxml import etree @@ -19,7 +19,7 @@ def get_metadata(stream, extract_cover=True): try: if not hasattr(stream, 'write'): - snbFile.Parse(StringIO(stream), True) + snbFile.Parse(io.BytesIO(stream), True) else: stream.seek(0) snbFile.Parse(stream, True) diff --git a/src/calibre/ebooks/metadata/topaz.py b/src/calibre/ebooks/metadata/topaz.py index f2c39a3464..a51822270f 100644 --- a/src/calibre/ebooks/metadata/topaz.py +++ b/src/calibre/ebooks/metadata/topaz.py @@ -5,7 +5,7 @@ __copyright__ = '2010, Greg Riker ' __docformat__ = 'restructuredtext en' ''' Read/write metadata from Amazon's topaz format ''' -import StringIO, sys, numbers +import io, sys, numbers from struct import pack from calibre.ebooks.metadata import MetaInformation @@ -194,7 +194,7 @@ class MetadataUpdater(object): else: return None dkey = self.topaz_headers[x] - dks = StringIO.StringIO() + dks = io.StringIO() dks.write(self.encode_vwi(len(dkey['tag']))) offset += 1 dks.write(dkey['tag']) @@ -290,7 +290,7 @@ class MetadataUpdater(object): delta = updated_md_len - original_md_len # Copy the first 5 bytes of the file: sig + num_recs - ths = StringIO.StringIO() + ths = io.StringIO() ths.write(self.data[:5]) # Rewrite the offsets for hdr_offsets > metadata offset @@ -377,9 +377,8 @@ if __name__ == '__main__': print(get_metadata(open(sys.argv[1], 'rb'))) else: # Test set_metadata() - import cStringIO data = open(sys.argv[1], 'rb') - stream = cStringIO.StringIO() + stream = io.BytesIO() stream.write(data.read()) mi = MetaInformation(title="Updated Title", authors=['Author, Random']) set_metadata(stream, mi) diff --git a/src/calibre/ebooks/mobi/writer2/indexer.py b/src/calibre/ebooks/mobi/writer2/indexer.py index 0353cf61b0..edb9abbe19 100644 --- a/src/calibre/ebooks/mobi/writer2/indexer.py +++ b/src/calibre/ebooks/mobi/writer2/indexer.py @@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en' import numbers from struct import pack -from cStringIO import StringIO +import io from collections import OrderedDict, defaultdict from calibre.ebooks.mobi.utils import (encint, encode_number_as_hex, @@ -166,7 +166,7 @@ class IndexEntry(object): @property def bytestring(self): - buf = StringIO() + buf = io.BytesIO() if isinstance(self.index, numbers.Integral): buf.write(encode_number_as_hex(self.index)) else: @@ -294,7 +294,7 @@ class TBS(object): # {{{ self.book_tbs(data, first) def periodical_tbs(self, data, first, depth_map): - buf = StringIO() + buf = io.BytesIO() has_section_start = (depth_map[1] and set(depth_map[1]).intersection(set(data['starts']))) @@ -496,7 +496,7 @@ class Indexer(object): # {{{ def create_index_record(self, secondary=False): # {{{ header_length = 192 - buf = StringIO() + buf = io.BytesIO() indices = list(SecondaryIndexEntry.entries()) if secondary else self.indices # Write index entries @@ -539,7 +539,7 @@ class Indexer(object): # {{{ # }}} def create_header(self, secondary=False): # {{{ - buf = StringIO() + buf = io.BytesIO() if secondary: tagx_block = TAGX().secondary else: diff --git a/src/calibre/ebooks/mobi/writer2/main.py b/src/calibre/ebooks/mobi/writer2/main.py index 6fd8739a4c..6d61d8ff1e 100644 --- a/src/calibre/ebooks/mobi/writer2/main.py +++ b/src/calibre/ebooks/mobi/writer2/main.py @@ -7,8 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import random, time -from cStringIO import StringIO +import io, random, time from struct import pack from calibre.ebooks import normalize @@ -130,7 +129,7 @@ class MobiWriter(object): pbreak = 0 running = offset - buf = StringIO() + buf = io.BytesIO() while breaks and (breaks[0] - offset) < RECORD_SIZE: pbreak = (breaks.pop(0) - running) >> 3 @@ -163,7 +162,7 @@ class MobiWriter(object): write_page_breaks_after_item=self.write_page_breaks_after_item) text = self.serializer() self.text_length = len(text) - text = StringIO(text) + text = io.BytesIO(text) nrecords = 0 records_size = 0 @@ -228,7 +227,7 @@ class MobiWriter(object): # EOF record self.records.append(b'\xE9\x8E\x0D\x0A') - record0 = StringIO() + record0 = io.BytesIO() # The MOBI Header record0.write(pack(b'>HHIHHHH', self.compression, # compression type # compression type diff --git a/src/calibre/ebooks/oeb/reader.py b/src/calibre/ebooks/oeb/reader.py index 1d0f0a444e..727e0199b4 100644 --- a/src/calibre/ebooks/oeb/reader.py +++ b/src/calibre/ebooks/oeb/reader.py @@ -7,7 +7,7 @@ from __future__ import print_function __license__ = 'GPL v3' __copyright__ = '2008, Marshall T. Vandegrift ' -import sys, os, uuid, copy, re, cStringIO +import sys, os, uuid, copy, re, io from itertools import izip from urlparse import urldefrag, urlparse from urllib import unquote as urlunquote @@ -138,7 +138,7 @@ class OEBReader(object): def _metadata_from_opf(self, opf): from calibre.ebooks.metadata.opf2 import OPF from calibre.ebooks.oeb.transforms.metadata import meta_info_to_oeb_metadata - stream = cStringIO.StringIO(etree.tostring(opf, xml_declaration=True, encoding='utf-8')) + stream = io.BytesIO(etree.tostring(opf, xml_declaration=True, encoding='utf-8')) o = OPF(stream) pwm = o.primary_writing_mode if pwm: diff --git a/src/calibre/ebooks/pdb/ereader/writer.py b/src/calibre/ebooks/pdb/ereader/writer.py index 77c6a0c80a..e1f6006dfe 100644 --- a/src/calibre/ebooks/pdb/ereader/writer.py +++ b/src/calibre/ebooks/pdb/ereader/writer.py @@ -8,6 +8,7 @@ __license__ = 'GPL v3' __copyright__ = '2009, John Schember ' __docformat__ = 'restructuredtext en' +import io import re import struct import zlib @@ -18,8 +19,6 @@ try: except ImportError: import Image -import cStringIO - from calibre.ebooks.pdb.formatwriter import FormatWriter from calibre.ebooks.pdb.header import PdbHeaderBuilder from calibre.ebooks.pml.pmlml import PMLMLizer @@ -141,10 +140,10 @@ class Writer(FormatWriter): for item in manifest: if item.media_type in OEB_RASTER_IMAGES and item.href in image_hrefs.keys(): try: - im = Image.open(cStringIO.StringIO(item.data)).convert('P') + im = Image.open(io.BytesIO(item.data)).convert('P') im.thumbnail((300,300), Image.ANTIALIAS) - data = cStringIO.StringIO() + data = io.BytesIO() im.save(data, 'PNG') data = data.getvalue() diff --git a/src/calibre/ebooks/rb/writer.py b/src/calibre/ebooks/rb/writer.py index ab46ca45a0..dc83476b39 100644 --- a/src/calibre/ebooks/rb/writer.py +++ b/src/calibre/ebooks/rb/writer.py @@ -4,6 +4,7 @@ __license__ = 'GPL 3' __copyright__ = '2009, John Schember ' __docformat__ = 'restructuredtext en' +import io import struct import zlib @@ -13,8 +14,6 @@ try: except ImportError: import Image -import cStringIO - from calibre.ebooks.rb.rbml import RBMLizer from calibre.ebooks.rb import HEADER from calibre.ebooks.rb import unique_name @@ -121,8 +120,8 @@ class RBWriter(object): try: data = '' - im = Image.open(cStringIO.StringIO(item.data)).convert('L') - data = cStringIO.StringIO() + im = Image.open(io.BytesIO(item.data)).convert('L') + data = io.BytesIO() im.save(data, 'PNG') data = data.getvalue() @@ -152,4 +151,3 @@ class RBWriter(object): text += 'BODY=index.html\n' return text - diff --git a/src/calibre/ebooks/rtf/rtfml.py b/src/calibre/ebooks/rtf/rtfml.py index 92de7f0c2e..2e84cfbafc 100644 --- a/src/calibre/ebooks/rtf/rtfml.py +++ b/src/calibre/ebooks/rtf/rtfml.py @@ -10,7 +10,7 @@ Transform OEB content into RTF markup import os import re -import cStringIO +import io from lxml import etree @@ -79,15 +79,15 @@ def txt2rtf(text): if not isinstance(text, unicode_type): return text - buf = cStringIO.StringIO() + buf = io.StringIO() for x in text: val = ord(x) if val == 160: - buf.write('\\~') + buf.write(u'\\~') elif val <= 127: - buf.write(x) + buf.write(unicode_type(x)) else: - c = r'\u{0:d}?'.format(val) + c = unicode_type(r'\u{0:d}?'.format(val)) buf.write(c) return buf.getvalue() diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index a6ea48b34d..17112f9dc5 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -1261,7 +1261,7 @@ def form_to_compiled_form(form): def build_forms(srcdir, info=None, summary=False, check_for_migration=False): - import re, cStringIO + import re, io from PyQt5.uic import compileUi forms = find_forms(srcdir) if info is None: @@ -1286,7 +1286,7 @@ def build_forms(srcdir, info=None, summary=False, check_for_migration=False): if force_compile or not os.path.exists(compiled_form) or os.stat(form).st_mtime > os.stat(compiled_form).st_mtime: if not summary: info('\tCompiling form', form) - buf = cStringIO.StringIO() + buf = io.BytesIO() compileUi(form, buf) dat = buf.getvalue() dat = dat.replace('import images_rc', '') diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index 7d5beb3359..456a0dea3b 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -3,7 +3,7 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' # Imports {{{ -import os, traceback, Queue, time, cStringIO, re, sys, weakref +import os, traceback, Queue, time, io, re, sys, weakref from threading import Thread, Event from PyQt5.Qt import ( @@ -113,7 +113,7 @@ class DeviceJob(BaseJob): # {{{ @property def log_file(self): - return cStringIO.StringIO(self._details.encode('utf-8')) + return io.BytesIO(self._details.encode('utf-8')) # }}} diff --git a/src/calibre/gui2/dialogs/catalog.py b/src/calibre/gui2/dialogs/catalog.py index 0537b35473..1f32406b76 100644 --- a/src/calibre/gui2/dialogs/catalog.py +++ b/src/calibre/gui2/dialogs/catalog.py @@ -22,7 +22,7 @@ class Catalog(QDialog, Ui_Dialog): ''' Catalog Dialog builder''' def __init__(self, parent, dbspec, ids, db): - import re, cStringIO + import re, io from calibre import prints as info from PyQt5.uic import compileUi @@ -68,7 +68,7 @@ class Catalog(QDialog, Ui_Dialog): # Compile the .ui form provided in plugin.zip if not os.path.exists(compiled_form): # info('\tCompiling form', form) - buf = cStringIO.StringIO() + buf = io.BytesIO() compileUi(form, buf) dat = buf.getvalue() dat = re.compile(r'QtGui.QApplication.translate\(.+?,\s+"(.+?)(?' -import cStringIO +import io from gettext import GNUTranslations from calibre.utils.localization import get_lc_messages_path from zipfile import ZipFile @@ -25,7 +25,7 @@ def translate(lang, text): with ZipFile(P('localization/locales.zip', allow_user_override=False), 'r') as zf: try: - buf = cStringIO.StringIO(zf.read(mpath + '/messages.mo')) + buf = io.BytesIO(zf.read(mpath + '/messages.mo')) except: pass else: diff --git a/src/calibre/utils/ipc/job.py b/src/calibre/utils/ipc/job.py index 34a2a24d20..73829f83bb 100644 --- a/src/calibre/utils/ipc/job.py +++ b/src/calibre/utils/ipc/job.py @@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en' _count = 0 -import time, cStringIO +import time, io from Queue import Queue, Empty from calibre import prints @@ -146,7 +146,7 @@ class BaseJob(object): def log_file(self): if self.log_path: return open(self.log_path, 'rb') - return cStringIO.StringIO(_('No details available.').encode('utf-8', + return io.BytesIO(_('No details available.').encode('utf-8', 'replace')) @property @@ -159,6 +159,3 @@ class ParallelJob(BaseJob): def __init__(self, name, description, done, args=[], kwargs={}): self.name, self.args, self.kwargs = name, args, kwargs BaseJob.__init__(self, description, done) - - - diff --git a/src/calibre/utils/localization.py b/src/calibre/utils/localization.py index 9da64132e0..7f42282a47 100644 --- a/src/calibre/utils/localization.py +++ b/src/calibre/utils/localization.py @@ -6,7 +6,7 @@ __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import os, locale, re, cStringIO +import os, locale, re, io from gettext import GNUTranslations, NullTranslations from polyglot.builtins import unicode_type @@ -129,14 +129,14 @@ def get_all_translators(): for lang in available_translations(): mpath = get_lc_messages_path(lang) if mpath is not None: - buf = cStringIO.StringIO(zf.read(mpath + '/messages.mo')) + buf = io.BytesIO(zf.read(mpath + '/messages.mo')) yield lang, GNUTranslations(buf) def get_single_translator(mpath, which='messages'): from zipfile import ZipFile with ZipFile(P('localization/locales.zip', allow_user_override=False), 'r') as zf: - buf = cStringIO.StringIO(zf.read(mpath + '/%s.mo' % which)) + buf = io.BytesIO(zf.read(mpath + '/%s.mo' % which)) return GNUTranslations(buf) @@ -185,14 +185,14 @@ lcdata = { def load_po(path): from calibre.translations.msgfmt import make - buf = cStringIO.StringIO() + buf = io.BytesIO() try: make(path, buf) except Exception: print (('Failed to compile translations file: %s, ignoring') % path) buf = None else: - buf = cStringIO.StringIO(buf.getvalue()) + buf = io.BytesIO(buf.getvalue()) return buf @@ -216,12 +216,12 @@ def set_translators(): with ZipFile(P('localization/locales.zip', allow_user_override=False), 'r') as zf: if buf is None: - buf = cStringIO.StringIO(zf.read(mpath + '/messages.mo')) + buf = io.BytesIO(zf.read(mpath + '/messages.mo')) if mpath == 'nds': mpath = 'de' isof = mpath + '/iso639.mo' try: - iso639 = cStringIO.StringIO(zf.read(isof)) + iso639 = io.BytesIO(zf.read(isof)) except: pass # No iso639 translations for this lang if buf is not None: diff --git a/src/calibre/utils/zipfile.py b/src/calibre/utils/zipfile.py index 9699543d9b..0ff4727de6 100644 --- a/src/calibre/utils/zipfile.py +++ b/src/calibre/utils/zipfile.py @@ -4,7 +4,7 @@ a zip archive, detecting filename encoding, updating zip files, etc. """ from __future__ import print_function import struct, os, time, sys, shutil, stat, re, io -import binascii, cStringIO +import binascii from contextlib import closing from tempfile import SpooledTemporaryFile @@ -835,7 +835,7 @@ class ZipFile: self.start_dir = offset_cd + concat fp.seek(self.start_dir, 0) data = fp.read(size_cd) - fp = cStringIO.StringIO(data) + fp = io.BytesIO(data) total = 0 while total < size_cd: centdir = fp.read(sizeCentralDir) diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index 9a2e616867..9ca3aae8c7 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -7,7 +7,7 @@ Defines various abstract base classes that can be subclassed to create powerful __docformat__ = "restructuredtext en" -import os, time, traceback, re, urlparse, sys, cStringIO +import os, time, traceback, re, urlparse, sys, io from collections import defaultdict from functools import partial from contextlib import nested, closing @@ -1305,7 +1305,7 @@ class BasicNewsRecipe(Recipe): ext = cu.split('/')[-1].rpartition('.')[-1].lower().strip() if ext == 'pdf': from calibre.ebooks.metadata.pdf import get_metadata - stream = cStringIO.StringIO(cdata) + stream = io.BytesIO(cdata) cdata = None mi = get_metadata(stream) if mi.cover_data and mi.cover_data[1]: @@ -1807,7 +1807,7 @@ class CalibrePeriodical(BasicNewsRecipe): ' Either your subscription has expired or you have' ' exceeded the maximum allowed downloads for today.')) raise - f = cStringIO.StringIO(raw) + f = io.BytesIO(raw) from calibre.utils.zipfile import ZipFile zf = ZipFile(f) zf.extractall() From 7d7731f5d065c0c2734c80a07608a60cebe76583 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 17 Mar 2019 19:46:58 +0530 Subject: [PATCH 0353/2613] ... --- src/calibre/utils/config_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/utils/config_base.py b/src/calibre/utils/config_base.py index 30f3d87876..21281e0b46 100644 --- a/src/calibre/utils/config_base.py +++ b/src/calibre/utils/config_base.py @@ -255,7 +255,7 @@ class OptionSet(object): exec(src, options) except Exception as err: try: - print('Failed to parse options string with error: {}'.format(err)) + print('Failed to parse old style options string with error: {}'.format(err)) except Exception: pass return options From dc4c444a71f8663c83bf081939bd6f562783e350 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 17 Mar 2019 20:07:22 +0530 Subject: [PATCH 0354/2613] Handle passing str to json_loads --- src/calibre/utils/config_base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/utils/config_base.py b/src/calibre/utils/config_base.py index 21281e0b46..b78a14b3e3 100644 --- a/src/calibre/utils/config_base.py +++ b/src/calibre/utils/config_base.py @@ -62,7 +62,9 @@ def json_dumps(obj): def json_loads(raw): import json - return json.loads(raw.decode('utf-8'), object_hook=from_json) + if isinstance(raw, bytes): + raw = raw.decode('utf-8') + return json.loads(raw, object_hook=from_json) def make_config_dir(): From 651344027ca375c2a5fa152ef5d6526c0688e4ca Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 17 Mar 2019 20:18:06 +0530 Subject: [PATCH 0355/2613] Nicer error message if the progress_indicator plugin fails to load --- src/calibre/gui2/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index a6ea48b34d..1705f6c8ed 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -823,7 +823,9 @@ class Application(QApplication): args.extend(['-platformpluginpath', sys.extensions_location, '-platform', 'headless']) self.headless = headless qargs = [i.encode('utf-8') if isinstance(i, unicode_type) else i for i in args] - self.pi = plugins['progress_indicator'][0] + self.pi, pi_err = plugins['progress_indicator'] + if pi_err: + raise RuntimeError('Failed to load the progress_indicator C extension, with error: {}'.format(pi_err)) if not isosx and not headless: # On OS X high dpi scaling is turned on automatically by the OS, so we dont need to set it explicitly setup_hidpi() From 14e4682f29b9fbe33deb5b6f0362e55136a76c49 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 18 Mar 2019 07:34:36 +0530 Subject: [PATCH 0356/2613] Fix #1820548 [Backups backtrace](https://bugs.launchpad.net/calibre/+bug/1820548) --- src/calibre/gui2/actions/choose_library.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/gui2/actions/choose_library.py b/src/calibre/gui2/actions/choose_library.py index cf757e17a6..eb77c77610 100644 --- a/src/calibre/gui2/actions/choose_library.py +++ b/src/calibre/gui2/actions/choose_library.py @@ -195,6 +195,8 @@ class BackupStatus(QDialog): # {{{ def mark_all_dirty(self): db = self.db() + if db is None: + return db.new_api.mark_as_dirty(db.new_api.all_book_ids()) # }}} From f760326ed26d74a5a3e9f9e115088d857944ac8d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 19 Mar 2019 12:21:22 +0530 Subject: [PATCH 0357/2613] Fix #1820549 [Ampersand is not escaped from strings on right-click menu](https://bugs.launchpad.net/calibre/+bug/1820549) --- src/calibre/gui2/tag_browser/view.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index e19e7c9f15..29b79dc47e 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -482,12 +482,13 @@ class TagsView(QTreeView): # {{{ def show_context_menu(self, point): def display_name(tag): + ans = tag.name if tag.category == 'search': n = tag.name if len(n) > 45: n = n[:45] + '...' - return "'" + n + "'" - return tag.name + ans = "'" + n + "'" + return ans.replace('&', '&&') index = self.indexAt(point) self.context_menu = QMenu(self) From ac5f1e9039e999a240d865bb7acca465b41a59f1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 19 Mar 2019 12:35:12 +0530 Subject: [PATCH 0358/2613] ... --- src/calibre/gui2/tag_browser/view.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index 29b79dc47e..b0aa64a641 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -488,7 +488,9 @@ class TagsView(QTreeView): # {{{ if len(n) > 45: n = n[:45] + '...' ans = "'" + n + "'" - return ans.replace('&', '&&') + if ans: + ans = ans.replace('&', '&&') + return ans index = self.indexAt(point) self.context_menu = QMenu(self) From c4d30dd75f1e9288bfa6e23383266220df7b825e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 19 Mar 2019 17:58:16 +0530 Subject: [PATCH 0359/2613] Misc fixes for the cStriongIO -> io commit --- .../ebooks/conversion/plugins/htmlz_output.py | 2 +- src/calibre/ebooks/lit/writer.py | 2 ++ src/calibre/ebooks/metadata/mobi.py | 34 +++++++++---------- src/calibre/ebooks/metadata/topaz.py | 23 +++++++++---- src/calibre/ebooks/mobi/writer2/main.py | 2 +- src/calibre/utils/zipfile.py | 10 +++--- 6 files changed, 42 insertions(+), 31 deletions(-) diff --git a/src/calibre/ebooks/conversion/plugins/htmlz_output.py b/src/calibre/ebooks/conversion/plugins/htmlz_output.py index 484dffa09e..4f507ea83d 100644 --- a/src/calibre/ebooks/conversion/plugins/htmlz_output.py +++ b/src/calibre/ebooks/conversion/plugins/htmlz_output.py @@ -126,7 +126,7 @@ class HTMLZOutput(OutputFormatPlugin): # Metadata with open(os.path.join(tdir, u'metadata.opf'), 'wb') as mdataf: - opf = OPF(io.BytesIO(etree.tostring(oeb_book.metadata.to_opf1()))) + opf = OPF(io.BytesIO(etree.tostring(oeb_book.metadata.to_opf1(), encoding='UTF-8'))) mi = opf.to_book_metadata() if cover_path: mi.cover = u'cover.jpg' diff --git a/src/calibre/ebooks/lit/writer.py b/src/calibre/ebooks/lit/writer.py index 0cadb1ac99..b5256101b8 100644 --- a/src/calibre/ebooks/lit/writer.py +++ b/src/calibre/ebooks/lit/writer.py @@ -286,6 +286,8 @@ class ReBinary(object): data.write(codepoint_to_chr(len(self.anchors)).encode('utf-8')) for anchor, offset in self.anchors: data.write(codepoint_to_chr(len(anchor)).encode('utf-8')) + if isinstance(anchor, unicode_type): + anchor = anchor.encode('utf-8') data.write(anchor) data.write(pack('H', data[76:78]) @@ -245,9 +245,9 @@ class MetadataUpdater(object): if not exth: # Construct an empty EXTH block - pad = '\0' * 4 - exth = ['EXTH', pack('>II', 12, 0), pad] - exth = ''.join(exth) + pad = b'\0' * 4 + exth = [b'EXTH', pack('>II', 12, 0), pad] + exth = b''.join(exth) # Update drm_offset(0xa8), title_offset(0x54) if self.encryption_type != 0: @@ -270,9 +270,9 @@ class MetadataUpdater(object): # Pad to a 4-byte boundary trail = len(new_record0.getvalue()) % 4 - pad = '\0' * (4 - trail) # Always pad w/ at least 1 byte + pad = b'\0' * (4 - trail) # Always pad w/ at least 1 byte new_record0.write(pad) - new_record0.write('\0'*(1024*8)) + new_record0.write(b'\0'*(1024*8)) # Rebuild the stream, update the pdbrecords pointers self.patchSection(0,new_record0.getvalue()) @@ -334,7 +334,7 @@ class MetadataUpdater(object): if rec[0] in self.original_exth_records: self.original_exth_records.pop(rec[0]) - if self.type != "BOOKMOBI": + if self.type != b"BOOKMOBI": raise MobiError("Setting metadata only supported for MOBI files of type 'BOOK'.\n" "\tThis is a %r file of type %r" % (self.type[0:4], self.type[4:8])) @@ -382,9 +382,9 @@ class MetadataUpdater(object): update_exth_record((501, b'PDOC')) if mi.pubdate: - update_exth_record((106, str(mi.pubdate).encode(self.codec, 'replace'))) + update_exth_record((106, unicode_type(mi.pubdate).encode(self.codec, 'replace'))) elif mi.timestamp: - update_exth_record((106, str(mi.timestamp).encode(self.codec, 'replace'))) + update_exth_record((106, unicode_type(mi.timestamp).encode(self.codec, 'replace'))) elif self.timestamp: update_exth_record((106, self.timestamp)) else: @@ -429,9 +429,9 @@ class MetadataUpdater(object): exth.write(data) exth = exth.getvalue() trail = len(exth) % 4 - pad = '\0' * (4 - trail) # Always pad w/ at least 1 byte - exth = ['EXTH', pack('>II', len(exth) + 12, len(recs)), exth, pad] - exth = ''.join(exth) + pad = b'\0' * (4 - trail) # Always pad w/ at least 1 byte + exth = [b'EXTH', pack('>II', len(exth) + 12, len(recs)), exth, pad] + exth = b''.join(exth) if getattr(self, 'exth', None) is None: raise MobiError('No existing EXTH record. Cannot update metadata.') @@ -481,8 +481,8 @@ def get_metadata(stream): stream.seek(0) try: raw = stream.read(3) - except: - raw = '' + except Exception: + raw = b'' stream.seek(0) if raw == b'TPZ': from calibre.ebooks.metadata.topaz import get_metadata @@ -521,8 +521,8 @@ def get_metadata(stream): else: try: data = mh.section_data(mh.first_image_index) - except: - data = '' + except Exception: + data = b'' if data and what(None, data) in {'jpg', 'jpeg', 'gif', 'png', 'bmp', 'webp'}: try: mi.cover_data = ('jpg', save_cover_data_to(data)) diff --git a/src/calibre/ebooks/metadata/topaz.py b/src/calibre/ebooks/metadata/topaz.py index a51822270f..12bb199feb 100644 --- a/src/calibre/ebooks/metadata/topaz.py +++ b/src/calibre/ebooks/metadata/topaz.py @@ -12,6 +12,14 @@ from calibre.ebooks.metadata import MetaInformation from calibre import force_unicode +class StringIO(io.StringIO): + + def write(self, x): + if isinstance(x, bytes): + x = x.decode('iso-8859-1') + return io.StringIO.write(self, x) + + class StreamSlicer(object): def __init__(self, stream, start=0, stop=None): @@ -38,7 +46,7 @@ class StreamSlicer(object): start, stop = stop, start size = stop - start if size <= 0: - return "" + return b"" stream.seek(base + start) data = stream.read(size) if stride != 1: @@ -87,7 +95,7 @@ class MetadataUpdater(object): self.data = StreamSlicer(stream) sig = self.data[:4] - if not sig.startswith('TPZ'): + if not sig.startswith(b'TPZ'): raise ValueError("'%s': Not a Topaz file" % getattr(stream, 'name', 'Unnamed stream')) offset = 4 @@ -102,7 +110,7 @@ class MetadataUpdater(object): # Second integrity test - metadata body md_offset = self.topaz_headers['metadata']['blocks'][0]['offset'] md_offset += self.base - if self.data[md_offset+1:md_offset+9] != 'metadata': + if self.data[md_offset+1:md_offset+9] != b'metadata': raise ValueError("'%s': Damaged metadata record" % getattr(stream, 'name', 'Unnamed stream')) def book_length(self): @@ -116,8 +124,9 @@ class MetadataUpdater(object): def decode_vwi(self,bytes): pos, val = 0, 0 done = False + byts = bytearray(bytes) while pos < len(bytes) and not done: - b = ord(bytes[pos]) + b = byts[pos] pos += 1 if (b & 0x80) == 0: done = True @@ -194,12 +203,12 @@ class MetadataUpdater(object): else: return None dkey = self.topaz_headers[x] - dks = io.StringIO() + dks = StringIO() dks.write(self.encode_vwi(len(dkey['tag']))) offset += 1 dks.write(dkey['tag']) offset += len('dkey') - dks.write(chr(0)) + dks.write(u'\0') offset += 1 dks.write(self.data[offset:offset + len_uncomp].decode('iso-8859-1')) return dks.getvalue().encode('iso-8859-1') @@ -233,7 +242,7 @@ class MetadataUpdater(object): return topaz_headers, th_seq def generate_metadata_stream(self): - ms = StringIO.StringIO() + ms = StringIO() ms.write(self.encode_vwi(len(self.md_header['tag'])).encode('iso-8859-1')) ms.write(self.md_header['tag']) ms.write(chr(self.md_header['flags'])) diff --git a/src/calibre/ebooks/mobi/writer2/main.py b/src/calibre/ebooks/mobi/writer2/main.py index 6d61d8ff1e..2bc19bfcdc 100644 --- a/src/calibre/ebooks/mobi/writer2/main.py +++ b/src/calibre/ebooks/mobi/writer2/main.py @@ -282,7 +282,7 @@ class MobiWriter(object): # 0x4c - 0x4f : Language specifier record0.write(iana2mobi( - str(metadata.language[0]))) + unicode_type(metadata.language[0]))) # 0x50 - 0x57 : Input language and Output language record0.write(b'\0' * 8) diff --git a/src/calibre/utils/zipfile.py b/src/calibre/utils/zipfile.py index 0ff4727de6..3b9a9ef7f7 100644 --- a/src/calibre/utils/zipfile.py +++ b/src/calibre/utils/zipfile.py @@ -57,7 +57,7 @@ ZIP_DEFLATED = 8 # The "end of central directory" structure, magic number, size, and indices # (section V.I in the format document) structEndArchive = "<4s4H2LH" -stringEndArchive = "PK\005\006" +stringEndArchive = b"PK\005\006" sizeEndCentDir = struct.calcsize(structEndArchive) _ECD_SIGNATURE = 0 @@ -76,7 +76,7 @@ _ECD_LOCATION = 9 # The "central directory" structure, magic number, size, and indices # of entries in the structure (section V.F in the format document) structCentralDir = "<4s4B4HL2L5H2L" -stringCentralDir = "PK\001\002" +stringCentralDir = b"PK\001\002" sizeCentralDir = struct.calcsize(structCentralDir) # indexes of entries in the central directory structure @@ -103,7 +103,7 @@ _CD_LOCAL_HEADER_OFFSET = 18 # The "local file header" structure, magic number, size, and indices # (section V.A in the format document) structFileHeader = "<4s2B4HL2L2H" -stringFileHeader = "PK\003\004" +stringFileHeader = b"PK\003\004" sizeFileHeader = struct.calcsize(structFileHeader) _FH_SIGNATURE = 0 @@ -121,13 +121,13 @@ _FH_EXTRA_FIELD_LENGTH = 11 # The "Zip64 end of central directory locator" structure, magic number, and size structEndArchive64Locator = "<4sLQL" -stringEndArchive64Locator = "PK\x06\x07" +stringEndArchive64Locator = b"PK\x06\x07" sizeEndCentDir64Locator = struct.calcsize(structEndArchive64Locator) # The "Zip64 end of central directory" record, magic number, size, and indices # (section V.G in the format document) structEndArchive64 = "<4sQ2H2L4Q" -stringEndArchive64 = "PK\x06\x06" +stringEndArchive64 = b"PK\x06\x06" sizeEndCentDir64 = struct.calcsize(structEndArchive64) _CD64_SIGNATURE = 0 From d02a6ea36a0ae51f7a735a57b1e69acfa1c7b959 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 19 Mar 2019 18:00:20 +0530 Subject: [PATCH 0360/2613] Remove unused code --- src/calibre/utils/rss_gen.py | 476 ----------------------------------- 1 file changed, 476 deletions(-) delete mode 100644 src/calibre/utils/rss_gen.py diff --git a/src/calibre/utils/rss_gen.py b/src/calibre/utils/rss_gen.py deleted file mode 100644 index 29976d17af..0000000000 --- a/src/calibre/utils/rss_gen.py +++ /dev/null @@ -1,476 +0,0 @@ -"""PyRSS2Gen - A Python library for generating RSS 2.0 feeds.""" - -__name__ = "PyRSS2Gen" -__version__ = (1, 1, 0) -__author__ = "Andrew Dalke " - -_generator_name = __name__ + "-" + ".".join(map(str, __version__)) - -import datetime, numbers -from polyglot.builtins import string_or_bytes - -# Could make this the base class; will need to add 'publish' - - -class WriteXmlMixin: - - def write_xml(self, outfile, encoding="iso-8859-1"): - from xml.sax import saxutils - handler = saxutils.XMLGenerator(outfile, encoding) - handler.startDocument() - self.publish(handler) - handler.endDocument() - - def to_xml(self, encoding="iso-8859-1"): - import io - f = io.StringIO() - self.write_xml(f, encoding) - return f.getvalue() - - -def _element(handler, name, obj, d={}): - if isinstance(obj, string_or_bytes) or obj is None: - # special-case handling to make the API easier - # to use for the common case. - handler.startElement(name, d) - if obj is not None: - handler.characters(obj) - handler.endElement(name) - else: - # It better know how to emit the correct XML. - obj.publish(handler) - - -def _opt_element(handler, name, obj): - if obj is None: - return - _element(handler, name, obj) - - -def _format_date(dt): - """convert a datetime into an RFC 822 formatted date - - Input date must be in GMT. - """ - # Looks like: - # Sat, 07 Sep 2002 00:00:01 GMT - # Can't use strftime because that's locale dependent - # - # Isn't there a standard way to do this for Python? The - # rfc822 and email.Utils modules assume a timestamp. The - # following is based on the rfc822 module. - return "%s, %02d %s %04d %02d:%02d:%02d GMT" % ( - ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][dt.weekday()], - dt.day, - ["Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][dt.month-1], - dt.year, dt.hour, dt.minute, dt.second) - - -## -# A couple simple wrapper objects for the fields which -# take a simple value other than a string. -class IntElement: - """implements the 'publish' API for integers - - Takes the tag name and the integer value to publish. - - (Could be used for anything which uses str() to be published - to text for XML.) - """ - element_attrs = {} - - def __init__(self, name, val): - self.name = name - self.val = val - - def publish(self, handler): - handler.startElement(self.name, self.element_attrs) - handler.characters(str(self.val)) - handler.endElement(self.name) - - -class DateElement: - """implements the 'publish' API for a datetime.datetime - - Takes the tag name and the datetime to publish. - - Converts the datetime to RFC 2822 timestamp (4-digit year). - """ - - def __init__(self, name, dt): - self.name = name - self.dt = dt - - def publish(self, handler): - _element(handler, self.name, _format_date(self.dt)) -#### - - -class Category: - """Publish a category element""" - - def __init__(self, category, domain=None): - self.category = category - self.domain = domain - - def publish(self, handler): - d = {} - if self.domain is not None: - d["domain"] = self.domain - _element(handler, "category", self.category, d) - - -class Cloud: - """Publish a cloud""" - - def __init__(self, domain, port, path, - registerProcedure, protocol): - self.domain = domain - self.port = port - self.path = path - self.registerProcedure = registerProcedure - self.protocol = protocol - - def publish(self, handler): - _element(handler, "cloud", None, { - "domain": self.domain, - "port": str(self.port), - "path": self.path, - "registerProcedure": self.registerProcedure, - "protocol": self.protocol}) - - -class Image: - """Publish a channel Image""" - element_attrs = {} - - def __init__(self, url, title, link, - width=None, height=None, description=None): - self.url = url - self.title = title - self.link = link - self.width = width - self.height = height - self.description = description - - def publish(self, handler): - handler.startElement("image", self.element_attrs) - - _element(handler, "url", self.url) - _element(handler, "title", self.title) - _element(handler, "link", self.link) - - width = self.width - if isinstance(width, numbers.Integral): - width = IntElement("width", width) - _opt_element(handler, "width", width) - - height = self.height - if isinstance(height, numbers.Integral): - height = IntElement("height", height) - _opt_element(handler, "height", height) - - _opt_element(handler, "description", self.description) - - handler.endElement("image") - - -class Guid: - """Publish a guid - - Defaults to being a permalink, which is the assumption if it's - omitted. Hence strings are always permalinks. - """ - - def __init__(self, guid, isPermaLink=1): - self.guid = guid - self.isPermaLink = isPermaLink - - def publish(self, handler): - d = {} - if self.isPermaLink: - d["isPermaLink"] = "true" - else: - d["isPermaLink"] = "false" - _element(handler, "guid", self.guid, d) - - -class TextInput: - """Publish a textInput - - Apparently this is rarely used. - """ - element_attrs = {} - - def __init__(self, title, description, name, link): - self.title = title - self.description = description - self.name = name - self.link = link - - def publish(self, handler): - handler.startElement("textInput", self.element_attrs) - _element(handler, "title", self.title) - _element(handler, "description", self.description) - _element(handler, "name", self.name) - _element(handler, "link", self.link) - handler.endElement("textInput") - - -class Enclosure: - """Publish an enclosure""" - - def __init__(self, url, length, type): - self.url = url - self.length = length - self.type = type - - def publish(self, handler): - _element(handler, "enclosure", None, - {"url": self.url, - "length": str(self.length), - "type": self.type, - }) - - -class Source: - """Publish the item's original source, used by aggregators""" - - def __init__(self, name, url): - self.name = name - self.url = url - - def publish(self, handler): - _element(handler, "source", self.name, {"url": self.url}) - - -class SkipHours: - """Publish the skipHours - - This takes a list of hours, as integers. - """ - element_attrs = {} - - def __init__(self, hours): - self.hours = hours - - def publish(self, handler): - if self.hours: - handler.startElement("skipHours", self.element_attrs) - for hour in self.hours: - _element(handler, "hour", str(hour)) - handler.endElement("skipHours") - - -class SkipDays: - """Publish the skipDays - - This takes a list of days as strings. - """ - element_attrs = {} - - def __init__(self, days): - self.days = days - - def publish(self, handler): - if self.days: - handler.startElement("skipDays", self.element_attrs) - for day in self.days: - _element(handler, "day", day) - handler.endElement("skipDays") - - -class RSS2(WriteXmlMixin): - """The main RSS class. - - Stores the channel attributes, with the "category" elements under - ".categories" and the RSS items under ".items". - """ - - rss_attrs = {"version": "2.0"} - element_attrs = {} - - def __init__(self, - title, - link, - description, - - language=None, - copyright=None, - managingEditor=None, - webMaster=None, - pubDate=None, # a datetime, *in* *GMT* - lastBuildDate=None, # a datetime - - categories=None, # list of strings or Category - generator=_generator_name, - docs="http://blogs.law.harvard.edu/tech/rss", - cloud=None, # a Cloud - ttl=None, # integer number of minutes - - image=None, # an Image - rating=None, # a string; I don't know how it's used - textInput=None, # a TextInput - skipHours=None, # a SkipHours with a list of integers - skipDays=None, # a SkipDays with a list of strings - - items=None, # list of RSSItems - ): - self.title = title - self.link = link - self.description = description - self.language = language - self.copyright = copyright - self.managingEditor = managingEditor - - self.webMaster = webMaster - self.pubDate = pubDate - self.lastBuildDate = lastBuildDate - - if categories is None: - categories = [] - self.categories = categories - self.generator = generator - self.docs = docs - self.cloud = cloud - self.ttl = ttl - self.image = image - self.rating = rating - self.textInput = textInput - self.skipHours = skipHours - self.skipDays = skipDays - - if items is None: - items = [] - self.items = items - - def publish(self, handler): - handler.startElement("rss", self.rss_attrs) - handler.startElement("channel", self.element_attrs) - _element(handler, "title", self.title) - _element(handler, "link", self.link) - _element(handler, "description", self.description) - - self.publish_extensions(handler) - - _opt_element(handler, "language", self.language) - _opt_element(handler, "copyright", self.copyright) - _opt_element(handler, "managingEditor", self.managingEditor) - _opt_element(handler, "webMaster", self.webMaster) - - pubDate = self.pubDate - if isinstance(pubDate, datetime.datetime): - pubDate = DateElement("pubDate", pubDate) - _opt_element(handler, "pubDate", pubDate) - - lastBuildDate = self.lastBuildDate - if isinstance(lastBuildDate, datetime.datetime): - lastBuildDate = DateElement("lastBuildDate", lastBuildDate) - _opt_element(handler, "lastBuildDate", lastBuildDate) - - for category in self.categories: - if isinstance(category, string_or_bytes): - category = Category(category) - category.publish(handler) - - _opt_element(handler, "generator", self.generator) - _opt_element(handler, "docs", self.docs) - - if self.cloud is not None: - self.cloud.publish(handler) - - ttl = self.ttl - if isinstance(self.ttl, numbers.Integral): - ttl = IntElement("ttl", ttl) - _opt_element(handler, "ttl", ttl) - - if self.image is not None: - self.image.publish(handler) - - _opt_element(handler, "rating", self.rating) - if self.textInput is not None: - self.textInput.publish(handler) - if self.skipHours is not None: - self.skipHours.publish(handler) - if self.skipDays is not None: - self.skipDays.publish(handler) - - for item in self.items: - item.publish(handler) - - handler.endElement("channel") - handler.endElement("rss") - - def publish_extensions(self, handler): - # Derived classes can hook into this to insert - # output after the three required fields. - pass - - -class RSSItem(WriteXmlMixin): - """Publish an RSS Item""" - element_attrs = {} - - def __init__(self, - title=None, # string - link=None, # url as string - description=None, # string - author=None, # email address as string - categories=None, # list of string or Category - comments=None, # url as string - enclosure=None, # an Enclosure - guid=None, # a unique string - pubDate=None, # a datetime - source=None, # a Source - ): - - if title is None and description is None: - raise TypeError( - "must define at least one of 'title' or 'description'") - self.title = title - self.link = link - self.description = description - self.author = author - if categories is None: - categories = [] - self.categories = categories - self.comments = comments - self.enclosure = enclosure - self.guid = guid - self.pubDate = pubDate - self.source = source - # It sure does get tedious typing these names three times... - - def publish(self, handler): - handler.startElement("item", self.element_attrs) - _opt_element(handler, "title", self.title) - _opt_element(handler, "link", self.link) - self.publish_extensions(handler) - _opt_element(handler, "description", self.description) - _opt_element(handler, "author", self.author) - - for category in self.categories: - if isinstance(category, string_or_bytes): - category = Category(category) - category.publish(handler) - - _opt_element(handler, "comments", self.comments) - if self.enclosure is not None: - self.enclosure.publish(handler) - _opt_element(handler, "guid", self.guid) - - pubDate = self.pubDate - if isinstance(pubDate, datetime.datetime): - pubDate = DateElement("pubDate", pubDate) - _opt_element(handler, "pubDate", pubDate) - - if self.source is not None: - self.source.publish(handler) - - handler.endElement("item") - - def publish_extensions(self, handler): - # Derived classes can hook into this to insert - # output after the title and link elements - pass From 40a12c31c128bd840da4ab93b7469a184a0899ea Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 20 Mar 2019 10:41:19 +0530 Subject: [PATCH 0361/2613] Remove unused code --- src/calibre/devices/manager.py | 40 ---------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 src/calibre/devices/manager.py diff --git a/src/calibre/devices/manager.py b/src/calibre/devices/manager.py deleted file mode 100644 index ccb61d7d1e..0000000000 --- a/src/calibre/devices/manager.py +++ /dev/null @@ -1,40 +0,0 @@ -__license__ = 'GPL v3' -__copyright__ = '2008, Kovid Goyal ' - - -''' -Define a threaded interface for working with devices. -''' - -import threading, Queue - - -class DeviceManager(object): - - def __init__(self): - self.devices = [] - self.device_jobs = Queue(0) - - -class Job(object): - count = 0 - - def __init__(self, func, args): - self.completed = False - self.exception = None - - -class Worker(threading.Thread): - - def __init__(self, jobs): - self.jobs = jobs - self.results = [] - threading.Thread.__init__(self) - self.setDaemon(True) - - def run(self): - '''Thread loops taking jobs from the queue as they become available''' - while True: - self.jobs.get(True, None) - # Do job - self.jobs.task_done() From ae735b2ea3b8f2064e91017ed06056287178f9b8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 20 Mar 2019 14:42:46 +0530 Subject: [PATCH 0362/2613] De-vendor html2text --- setup/test.py | 2 + src/calibre/test_build.py | 4 + src/calibre/utils/html2text.py | 518 +++------------------------- src/calibre/utils/html2text_test.py | 12 + 4 files changed, 70 insertions(+), 466 deletions(-) create mode 100644 src/calibre/utils/html2text_test.py diff --git a/setup/test.py b/setup/test.py index da0e63773a..a640683191 100644 --- a/setup/test.py +++ b/setup/test.py @@ -72,6 +72,8 @@ def find_tests(which_tests=None): a(find_tests()) from calibre.utils.search_query_parser_test import find_tests a(find_tests()) + from calibre.utils.html2text import find_tests + a(find_tests()) if ok('dbcli'): from calibre.db.cli.tests import find_tests a(find_tests()) diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index 4d0761b893..d67afd20a6 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -268,6 +268,10 @@ class BuildTest(unittest.TestCase): import readline del readline + def test_html2text(self): + import html2text + del html2text + def test_markdown(self): from calibre.ebooks.txt.processor import create_markdown_object from calibre.ebooks.conversion.plugins.txt_input import MD_EXTENSIONS diff --git a/src/calibre/utils/html2text.py b/src/calibre/utils/html2text.py index c3d386fad9..76b560fd3f 100644 --- a/src/calibre/utils/html2text.py +++ b/src/calibre/utils/html2text.py @@ -1,467 +1,53 @@ #!/usr/bin/env python2 -# -*- coding: utf-8 -*- - -"""html2text: Turn HTML into equivalent Markdown-structured text.""" -# Last upstream version before changes -# __version__ = "2.39" -__license__ = 'GPL 3' -__copyright__ = ''' -Copyright (c) 2011, John Schember -(C) 2004-2008 Aaron Swartz -''' -__contributors__ = ["Martin 'Joey' Schulze", "Ricardo Reyes", "Kevin Jay North"] - -# TODO: -# Support decoded entities with unifiable. - -from polyglot.builtins import codepoint_to_chr -import re, sys, urllib, htmlentitydefs, codecs -import sgmllib -sgmllib.charref = re.compile('&#([xX]?[0-9a-fA-F]+)[^0-9a-fA-F]') - -try: - from textwrap import wrap -except: - pass - -# Use Unicode characters instead of their ascii psuedo-replacements -UNICODE_SNOB = 1 - -# Put the links after each paragraph instead of at the end. -LINKS_EACH_PARAGRAPH = 0 - -# Wrap long lines at position. 0 for no wrapping. (Requires Python 2.3.) -BODY_WIDTH = 0 - -# Don't show internal links (href="#local-anchor") -- corresponding link targets -# won't be visible in the plain text file anyway. -SKIP_INTERNAL_LINKS = True - -# ## Entity Nonsense ### - - -def name2cp(k): - if k == 'apos': - return ord("'") - if hasattr(htmlentitydefs, "name2codepoint"): # requires Python 2.3 - return htmlentitydefs.name2codepoint[k] - else: - k = htmlentitydefs.entitydefs[k] - if k.startswith("&#") and k.endswith(";"): - return int(k[2:-1]) # not in latin-1 - return ord(codecs.latin_1_decode(k)[0]) - - -unifiable = {'rsquo':"'", 'lsquo':"'", 'rdquo':'"', 'ldquo':'"', -'copy':'(C)', 'mdash':'--', 'nbsp':' ', 'rarr':'->', 'larr':'<-', 'middot':'*', -'ndash':'-', 'oelig':'oe', 'aelig':'ae', -'agrave':'a', 'aacute':'a', 'acirc':'a', 'atilde':'a', 'auml':'a', 'aring':'a', -'egrave':'e', 'eacute':'e', 'ecirc':'e', 'euml':'e', -'igrave':'i', 'iacute':'i', 'icirc':'i', 'iuml':'i', -'ograve':'o', 'oacute':'o', 'ocirc':'o', 'otilde':'o', 'ouml':'o', -'ugrave':'u', 'uacute':'u', 'ucirc':'u', 'uuml':'u'} - -unifiable_n = {} - -for k in unifiable.keys(): - unifiable_n[name2cp(k)] = unifiable[k] - - -def charref(name): - if name[0] in ['x','X']: - c = int(name[1:], 16) - else: - c = int(name) - - if not UNICODE_SNOB and c in unifiable_n.keys(): - return unifiable_n[c] - else: - return codepoint_to_chr(c) - - -def entityref(c): - if not UNICODE_SNOB and c in unifiable.keys(): - return unifiable[c] - else: - try: - name2cp(c) - except KeyError: - return "&" + c - else: - return codepoint_to_chr(name2cp(c)) - - -def replaceEntities(s): - s = s.group(1) - if s[0] == "#": - return charref(s[1:]) - else: - return entityref(s) - - -r_unescape = re.compile(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));") - - -def unescape(s): - return r_unescape.sub(replaceEntities, s) - - -def fixattrs(attrs): - # Fix bug in sgmllib.py - if not attrs: - return attrs - newattrs = [] - for attr in attrs: - newattrs.append((attr[0], unescape(attr[1]))) - return newattrs - -# ## End Entity Nonsense ### - - -def onlywhite(line): - """Return true if the line does only consist of whitespace characters.""" - for c in line: - if c != ' ' and c != ' ': - return c == ' ' - return line - - -def optwrap(text): - """Wrap all paragraphs in the provided text.""" - if not BODY_WIDTH: - return text - - assert wrap, "Requires Python 2.3." - result = '' - newlines = 0 - for para in text.split("\n"): - if len(para) > 0: - if para[0] != ' ' and para[0] != '-' and para[0] != '*': - for line in wrap(para, BODY_WIDTH): - result += line + "\n" - result += "\n" - newlines = 2 - else: - if not onlywhite(para): - result += para + "\n" - newlines = 1 - else: - if newlines < 2: - result += "\n" - newlines += 1 - return result - - -def hn(tag): - if tag and tag[0] == 'h' and len(tag) == 2: - try: - n = int(tag[1]) - if n in range(1, 10): - return n - except ValueError: - return 0 - - -class _html2text(sgmllib.SGMLParser): - - def __init__(self, out=None, baseurl=''): - sgmllib.SGMLParser.__init__(self) - - if out is None: - self.out = self.outtextf - else: - self.out = out - self.outtext = u'' - self.quiet = 0 - self.p_p = 0 - self.outcount = 0 - self.start = 1 - self.space = 0 - self.astack = [] - self.list = [] - self.blockquote = 0 - self.pre = 0 - self.startpre = 0 - self.lastWasNL = 0 - self.abbr_title = None # current abbreviation definition - self.abbr_data = None # last inner HTML (for abbr being defined) - self.abbr_list = {} # stack of abbreviations to write later - self.baseurl = baseurl - - def outtextf(self, s): - self.outtext += s - - def close(self): - sgmllib.SGMLParser.close(self) - - self.pbr() - self.o('', 0, 'end') - - return self.outtext - - def handle_charref(self, c): - self.o(charref(c)) - - def handle_entityref(self, c): - self.o(entityref(c)) - - def unknown_starttag(self, tag, attrs): - self.handle_tag(tag, attrs, 1) - - def unknown_endtag(self, tag): - self.handle_tag(tag, None, 0) - - def handle_tag(self, tag, attrs, start): - attrs = fixattrs(attrs) - - if hn(tag): - self.p() - if start: - self.o(hn(tag)*"#" + ' ') - - if tag in ['p', 'div']: - self.p() - - if tag == "br" and start: - self.o(" \n") - - if tag == "hr" and start: - self.p() - self.o("* * *") - self.p() - - if tag in ["head", "style", 'script']: - if start: - self.quiet += 1 - else: - self.quiet -= 1 - - if tag in ["body"]: - self.quiet = 0 # sites like 9rules.com never close - - if tag == "blockquote": - if start: - self.p() - self.o('> ', 0, 1) - self.start = 1 - self.blockquote += 1 - else: - self.blockquote -= 1 - self.p() - - if tag in ['em', 'i']: - self.o("*") - if tag in ['strong', 'b']: - self.o("**") - if tag == "code" and not self.pre: - self.o('`') # TODO: `` `this` `` - if tag == "abbr": - if start: - attrsD = {} - for (x, y) in attrs: - attrsD[x] = y - attrs = attrsD - - self.abbr_title = None - self.abbr_data = '' - if attrs.has_key('title'): # noqa - self.abbr_title = attrs['title'] - else: - if self.abbr_title is not None: - self.abbr_list[self.abbr_data] = self.abbr_title - self.abbr_title = None - self.abbr_data = '' - - if tag == "a": - if start: - attrsD = {} - for (x, y) in attrs: - attrsD[x] = y - attrs = attrsD - if attrs.has_key('href') and not (SKIP_INTERNAL_LINKS and attrs['href'].startswith('#')): # noqa - self.astack.append(attrs) - self.o("[") - else: - self.astack.append(None) - else: - if self.astack: - a = self.astack.pop() - if a: - title = '' - if a.has_key('title'): # noqa - title = ' "%s"' % a['title'] - self.o('](%s%s)' % (a['href'], title)) - - if tag == "img" and start: - attrsD = {} - for (x, y) in attrs: - attrsD[x] = y - attrs = attrsD - if attrs.has_key('src'): # noqa - alt = attrs.get('alt', '') - self.o("![") - self.o(alt) - title = '' - if attrs.has_key('title'): # noqa - title = ' "%s"' % attrs['title'] - self.o('](%s%s)' % (attrs['src'], title)) - - if tag == 'dl' and start: - self.p() - if tag == 'dt' and not start: - self.pbr() - if tag == 'dd' and start: - self.o(' ') - if tag == 'dd' and not start: - self.pbr() - - if tag in ["ol", "ul"]: - if start: - self.list.append({'name':tag, 'num':0}) - else: - if self.list: - self.list.pop() - - self.p() - - if tag == 'li': - if start: - self.pbr() - if self.list: - li = self.list[-1] - else: - li = {'name':'ul', 'num':0} - self.o(" "*len(self.list)) # TODO: line up
  1. s > 9 correctly. - if li['name'] == "ul": - self.o("* ") - elif li['name'] == "ol": - li['num'] += 1 - self.o(repr(li['num'])+". ") - self.start = 1 - else: - self.pbr() - - if tag in ["table", "tr"] and start: - self.p() - if tag == 'td': - self.pbr() - - if tag == "pre": - if start: - self.startpre = 1 - self.pre = 1 - else: - self.pre = 0 - self.p() - - def pbr(self): - if self.p_p == 0: - self.p_p = 1 - - def p(self): - self.p_p = 2 - - def o(self, data, puredata=0, force=0): - if self.abbr_data is not None: - self.abbr_data += data - - if not self.quiet: - if puredata and not self.pre: - data = re.sub(r'\s+', ' ', data) - if data and data[0] == ' ': - self.space = 1 - data = data[1:] - if not data and not force: - return - - if self.startpre: - # self.out(" :") #TODO: not output when already one there - self.startpre = 0 - - bq = (">" * self.blockquote) - if not (force and data and data[0] == ">") and self.blockquote: - bq += " " - - if self.pre: - bq += " " - data = data.replace("\n", "\n"+bq) - - if self.start: - self.space = 0 - self.p_p = 0 - self.start = 0 - - if force == 'end': - # It's the end. - self.p_p = 0 - self.out("\n") - self.space = 0 - - if self.p_p: - self.out(('\n'+bq)*self.p_p) - self.space = 0 - - if self.space: - if not self.lastWasNL: - self.out(' ') - self.space = 0 - - if self.abbr_list and force == "end": - for abbr, definition in self.abbr_list.items(): - self.out(" *[" + abbr + "]: " + definition + "\n") - - self.p_p = 0 - self.out(data) - self.lastWasNL = data and data[-1] == '\n' - self.outcount += 1 - - def handle_data(self, data): - if r'\/script>' in data: - self.quiet -= 1 - self.o(data, 1) - - def unknown_decl(self, data): - pass - - -def wrapwrite(text): - sys.stdout.write(text.encode('utf8')) - - -def html2text_file(html, out=wrapwrite, baseurl=''): - h = _html2text(out, baseurl) - h.feed(html) - h.feed("") - return h.close() - - -def html2text(html, baseurl=''): - return optwrap(html2text_file(html, None, baseurl)) - - -if __name__ == "__main__": - baseurl = '' - if sys.argv[1:]: - arg = sys.argv[1] - if arg.startswith('http://') or arg.startswith('https://'): - baseurl = arg - j = urllib.urlopen(baseurl) - try: - from feedparser import _getCharacterEncoding as enc - enc - except ImportError: - enc = lambda x, y: ('utf-8', 1) - text = j.read() - encoding = enc(j.headers, text)[0] - if encoding == 'us-ascii': - encoding = 'utf-8' - data = text.decode(encoding) - - else: - encoding = 'utf8' - if len(sys.argv) > 2: - encoding = sys.argv[2] - data = open(arg, 'r').read().decode(encoding) - else: - data = sys.stdin.read().decode('utf8') - wrapwrite(html2text(data, baseurl)) +# vim:fileencoding=utf-8 +# License: GPLv3 Copyright: 2019, Kovid Goyal +from __future__ import (unicode_literals, division, absolute_import, + print_function) + + +def rudimentary_html2text(html): + from lxml import html as h + root = h.fromstring(html) + return h.tostring(root, method='text', encoding='unicode') + + +def html2text(html): + try: + from html2text import HTML2Text + except ImportError: + # for people running from source + from calibre.constants import numeric_version + if numeric_version <= (3, 40, 1): + return rudimentary_html2text(html) + raise + + import re + if isinstance(html, bytes): + from calibre.ebooks.chardet import xml_to_unicode + html = xml_to_unicode(html, strip_encoding_pats=True, resolve_entities=True) + # replace tags with as becomes emphasis in html2text + html = re.sub( + r'<\s*(?P/?)\s*[uU]\b(?P[^>]*)>', + r'<\gspan\g>', html) + h2t = HTML2Text() + h2t.default_image_alt = _('Unnamed image') + return h2t.handle(html) + + +def find_tests(): + import unittest + + class TestH2T(unittest.TestCase): + + def test_html2text_behavior(self): + for src, expected in { + 'test': 'test\n\n', + 'test': '_test_\n\n', + 'other': '[other](http://else.where/other)\n\n', + '': '![Unnamed image](test.jpeg)\n\n', + 'test dest': 'test dest\n\n', + '<>a': '<>a\n\n', + }.items(): + self.assertEqual(html2text(src), expected) + + return unittest.defaultTestLoader.loadTestsFromTestCase(TestH2T) diff --git a/src/calibre/utils/html2text_test.py b/src/calibre/utils/html2text_test.py new file mode 100644 index 0000000000..85ff04a803 --- /dev/null +++ b/src/calibre/utils/html2text_test.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +# License: GPL v3 Copyright: 2019, Kovid Goyal + +from __future__ import absolute_import, division, print_function, unicode_literals + +import unittest + +class Test(unittest.TestCase): + +def find_tests(): + return unittest.defaultTestLoader.loadTestsFromTestCase(Test) From 042d74059367ae3632bda98743d0b7d21ce8acd7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 20 Mar 2019 15:02:31 +0530 Subject: [PATCH 0363/2613] ... --- src/calibre/utils/html2text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/utils/html2text.py b/src/calibre/utils/html2text.py index 76b560fd3f..9cffa2f951 100644 --- a/src/calibre/utils/html2text.py +++ b/src/calibre/utils/html2text.py @@ -24,7 +24,7 @@ def html2text(html): import re if isinstance(html, bytes): from calibre.ebooks.chardet import xml_to_unicode - html = xml_to_unicode(html, strip_encoding_pats=True, resolve_entities=True) + html = xml_to_unicode(html, strip_encoding_pats=True, resolve_entities=True)[0] # replace tags with as becomes emphasis in html2text html = re.sub( r'<\s*(?P/?)\s*[uU]\b(?P[^>]*)>', From 2d382274cd684d68c5288e2abc8b0a8aefdb5c97 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 17 Mar 2019 07:46:31 -0400 Subject: [PATCH 0364/2613] py3: gettext no longer has a unicode= argument This is unicode by default "since there's no point in translating to byte strings." Good riddance. --- src/calibre/utils/localization.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/calibre/utils/localization.py b/src/calibre/utils/localization.py index 7f42282a47..79eafd1754 100644 --- a/src/calibre/utils/localization.py +++ b/src/calibre/utils/localization.py @@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en' import os, locale, re, io from gettext import GNUTranslations, NullTranslations -from polyglot.builtins import unicode_type +from polyglot.builtins import is_py3, unicode_type _available_translations = None @@ -244,7 +244,10 @@ def set_translators(): set_translators.lang = t.info().get('language') except Exception: pass - t.install(unicode=True, names=('ngettext',)) + if is_py3: + t.install(names=('ngettext',)) + else: + t.install(unicode=True, names=('ngettext',)) # Now that we have installed a translator, we have to retranslate the help # for the global prefs object as it was instantiated in get_lang(), before # the translator was installed. From 1653c790db82e61a47d75ce25f9f7637fbaa6787 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 19 Mar 2019 14:54:36 -0400 Subject: [PATCH 0365/2613] remove dead code Initially added in commit c1ef643b8ed6c1740438692e345761a401fea1af but I cannot tell what it was ever used for. --- src/calibre/utils/sftp.py | 90 --------------------------------------- 1 file changed, 90 deletions(-) delete mode 100644 src/calibre/utils/sftp.py diff --git a/src/calibre/utils/sftp.py b/src/calibre/utils/sftp.py deleted file mode 100644 index 07a66917da..0000000000 --- a/src/calibre/utils/sftp.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env python2 -from __future__ import print_function -__license__ = 'GPL v3' -__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' -__docformat__ = 'restructuredtext en' - -''' -Create a file handle to a remote file over the sftp protocol. -''' - -import sys, socket, getpass -from urlparse import urlparse -from binascii import hexlify - -import paramiko - - -def agent_auth(transport, username): - """ - Attempt to authenticate to the given transport using any of the private - keys available from an SSH agent. - """ - - agent = paramiko.Agent() - agent_keys = agent.get_keys() - if len(agent_keys) == 0: - return - - for key in agent_keys: - print('Trying ssh-agent key %s' % hexlify(key.get_fingerprint()), end=' ') - try: - transport.auth_publickey(username, key) - print('... success!') - return True - except paramiko.SSHException: - print('... failed.') - return False - - -def portable_getpass(username, hostname, retry): - return getpass.getpass('%sPlease enter the password for %s on %s: '%( - 'Incorrect password. ' if retry else '', username, hostname)) - - -def password_auth(transport, username, hostname, getpw=portable_getpass): - for i in range(3): - pw = getpw(username, hostname, i>0) - transport.auth_password(username, pw) - if transport.is_authenticated(): - return True - return False - - -def connect_to_url(url, getpw=portable_getpass, mode='r+', bufsize=-1): - protocol, host, path = urlparse(url)[:3] - if protocol != 'sftp': - raise ValueError(_('URL must have the scheme sftp')) - try: - username, host = host.split('@') - except: - raise ValueError(_('host must be of the form user@hostname')) - port = 22 - if ':' in host: - host, port = host.split(':') - port = int(port) - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((host, port)) - t = paramiko.Transport(sock) - try: - t.start_client() - except: - raise Exception(_('Failed to negotiate SSH session: ') + str(t.get_exception())) - if not agent_auth(t, username): - if not password_auth(t, username, host, getpw): - raise ValueError(_('Failed to authenticate with server: %s')%url) - sftp = paramiko.SFTPClient.from_transport(t) - return sftp, sftp.open(path, mode=mode, bufsize=bufsize) - - -def main(args=sys.argv): - f = connect_to_url(args[1])[-1] - print(f.read()) - f.seek(0, 2) - print(f.tell()) - f.close() - return 0 - - -if __name__ == '__main__': - sys.exit(main()) From 8594f52fe8e8bd54d3c8b45c409f8ede2e816fd1 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 17 Mar 2019 15:46:27 -0400 Subject: [PATCH 0366/2613] python3: add more urllib wrappers --- src/calibre/__init__.py | 6 +-- src/calibre/db/cli/main.py | 3 +- .../ebooks/conversion/plugins/chm_input.py | 2 +- .../ebooks/conversion/plugins/html_input.py | 2 +- .../ebooks/conversion/plugins/html_output.py | 4 +- .../ebooks/conversion/plugins/oeb_output.py | 2 +- src/calibre/ebooks/docx/writer/links.py | 2 +- src/calibre/ebooks/html/input.py | 2 +- src/calibre/ebooks/htmlz/oeb2html.py | 2 +- src/calibre/ebooks/lit/reader.py | 3 +- src/calibre/ebooks/lit/writer.py | 5 +-- src/calibre/ebooks/lrf/html/convert_from.py | 3 +- src/calibre/ebooks/metadata/__init__.py | 8 +--- src/calibre/ebooks/metadata/kdl.py | 7 ++-- src/calibre/ebooks/metadata/opf2.py | 3 +- .../ebooks/metadata/search_internet.py | 2 +- src/calibre/ebooks/metadata/toc.py | 3 +- src/calibre/ebooks/mobi/reader/mobi8.py | 2 +- src/calibre/ebooks/mobi/writer2/serializer.py | 2 +- src/calibre/ebooks/oeb/base.py | 3 +- src/calibre/ebooks/oeb/polish/check/links.py | 5 +-- src/calibre/ebooks/oeb/polish/container.py | 2 +- src/calibre/ebooks/oeb/polish/download.py | 3 +- src/calibre/ebooks/oeb/polish/replace.py | 2 +- src/calibre/ebooks/oeb/polish/split.py | 2 +- src/calibre/ebooks/oeb/polish/toc.py | 2 +- src/calibre/ebooks/oeb/reader.py | 5 +-- src/calibre/ebooks/oeb/transforms/cover.py | 2 +- .../ebooks/oeb/transforms/filenames.py | 2 +- .../ebooks/oeb/transforms/rasterize.py | 2 +- .../ebooks/oeb/transforms/structure.py | 2 +- .../ebooks/oeb/transforms/trimmanifest.py | 3 +- src/calibre/ebooks/pdf/render/links.py | 3 +- src/calibre/ebooks/rb/reader.py | 4 +- src/calibre/ebooks/textile/functions.py | 9 +---- src/calibre/gui2/dnd.py | 10 ++--- src/calibre/gui2/qt_file_dialogs.py | 2 +- src/calibre/gui2/store/loader.py | 2 +- src/calibre/gui2/store/web_control.py | 2 +- src/calibre/gui2/tweak_book/boss.py | 2 +- src/calibre/gui2/tweak_book/preview.py | 2 +- src/calibre/gui2/viewer/main.py | 2 +- src/calibre/srv/content.py | 2 +- src/calibre/srv/http_request.py | 2 +- src/calibre/srv/legacy.py | 2 +- src/calibre/srv/metadata.py | 2 +- src/calibre/srv/opds.py | 2 +- src/calibre/srv/render_book.py | 3 +- src/calibre/srv/routes.py | 2 +- src/calibre/srv/tests/ajax.py | 2 +- src/calibre/srv/tests/auth.py | 20 +++++----- src/calibre/srv/utils.py | 3 +- src/calibre/translations/__init__.py | 6 ++- src/calibre/utils/https.py | 5 +-- src/calibre/utils/linux_trash.py | 2 +- src/calibre/utils/localization.py | 4 +- src/calibre/utils/open_with/osx.py | 4 +- src/calibre/utils/opensearch/query.py | 4 +- src/calibre/web/__init__.py | 7 ++-- src/calibre/web/feeds/news.py | 7 ++-- src/calibre/web/fetch/simple.py | 37 ++++++++++--------- src/polyglot/urllib.py | 20 +++++++--- 62 files changed, 130 insertions(+), 142 deletions(-) diff --git a/src/calibre/__init__.py b/src/calibre/__init__.py index f5d4a2e628..5f441311e4 100644 --- a/src/calibre/__init__.py +++ b/src/calibre/__init__.py @@ -320,7 +320,7 @@ def extract(path, dir): def get_proxies(debug=True): - from urllib import getproxies + from polyglot.urllib import getproxies proxies = getproxies() for key, proxy in list(proxies.items()): if not proxy or '..' in proxy or key == 'auto': @@ -382,10 +382,10 @@ def get_proxy_info(proxy_scheme, proxy_string): is not available in the string. If an exception occurs parsing the string this method returns None. ''' - import urlparse + from polyglot.urllib import urlparse try: proxy_url = u'%s://%s'%(proxy_scheme, proxy_string) - urlinfo = urlparse.urlparse(proxy_url) + urlinfo = urlparse(proxy_url) ans = { u'scheme': urlinfo.scheme, u'hostname': urlinfo.hostname, diff --git a/src/calibre/db/cli/main.py b/src/calibre/db/cli/main.py index 1a957e0820..9833d919d4 100644 --- a/src/calibre/db/cli/main.py +++ b/src/calibre/db/cli/main.py @@ -8,8 +8,6 @@ import httplib import json import os import sys -from urllib import urlencode -from urlparse import urlparse, urlunparse from calibre import browser, prints from calibre.constants import __appname__, __version__, iswindows @@ -19,6 +17,7 @@ from calibre.utils.config import OptionParser, prefs from calibre.utils.localization import localize_user_manual_link from calibre.utils.lock import singleinstance from calibre.utils.serialize import MSGPACK_MIME +from polyglot.urllib import urlencode, urlparse, urlunparse COMMANDS = ( 'list', 'add', 'remove', 'add_format', 'remove_format', 'show_metadata', diff --git a/src/calibre/ebooks/conversion/plugins/chm_input.py b/src/calibre/ebooks/conversion/plugins/chm_input.py index fc0af0552f..01b81bbbec 100644 --- a/src/calibre/ebooks/conversion/plugins/chm_input.py +++ b/src/calibre/ebooks/conversion/plugins/chm_input.py @@ -108,7 +108,7 @@ class CHMInput(InputFormatPlugin): def _create_html_root(self, hhcpath, log, encoding): from lxml import html - from urllib import unquote as _unquote + from polyglot.urllib import unquote as _unquote from calibre.ebooks.oeb.base import urlquote from calibre.ebooks.chardet import xml_to_unicode hhcdata = self._read_file(hhcpath) diff --git a/src/calibre/ebooks/conversion/plugins/html_input.py b/src/calibre/ebooks/conversion/plugins/html_input.py index fa5e211e4d..e04b82b221 100644 --- a/src/calibre/ebooks/conversion/plugins/html_input.py +++ b/src/calibre/ebooks/conversion/plugins/html_input.py @@ -247,7 +247,7 @@ class HTMLInput(InputFormatPlugin): return link, frag def resource_adder(self, link_, base=None): - from urllib import quote + from polyglot.urllib import quote link, frag = self.link_to_local_path(link_, base=base) if link is None: return link_ diff --git a/src/calibre/ebooks/conversion/plugins/html_output.py b/src/calibre/ebooks/conversion/plugins/html_output.py index 4c82974460..15d2f02c07 100644 --- a/src/calibre/ebooks/conversion/plugins/html_output.py +++ b/src/calibre/ebooks/conversion/plugins/html_output.py @@ -47,7 +47,7 @@ class HTMLOutput(OutputFormatPlugin): Generate table of contents ''' from lxml import etree - from urllib import unquote + from polyglot.urllib import unquote from calibre.ebooks.oeb.base import element from calibre.utils.cleantext import clean_xml_chars @@ -86,7 +86,7 @@ class HTMLOutput(OutputFormatPlugin): from lxml import etree from calibre.utils import zipfile from templite import Templite - from urllib import unquote + from polyglot.urllib import unquote from calibre.ebooks.html.meta import EasyMeta # read template files diff --git a/src/calibre/ebooks/conversion/plugins/oeb_output.py b/src/calibre/ebooks/conversion/plugins/oeb_output.py index 72518e264b..82ae031c4d 100644 --- a/src/calibre/ebooks/conversion/plugins/oeb_output.py +++ b/src/calibre/ebooks/conversion/plugins/oeb_output.py @@ -21,7 +21,7 @@ class OEBOutput(OutputFormatPlugin): recommendations = {('pretty_print', True, OptionRecommendation.HIGH)} def convert(self, oeb_book, output_path, input_plugin, opts, log): - from urllib import unquote + from polyglot.urllib import unquote from lxml import etree self.log, self.opts = log, opts diff --git a/src/calibre/ebooks/docx/writer/links.py b/src/calibre/ebooks/docx/writer/links.py index 6293be50c5..4e6315d738 100644 --- a/src/calibre/ebooks/docx/writer/links.py +++ b/src/calibre/ebooks/docx/writer/links.py @@ -8,9 +8,9 @@ __copyright__ = '2015, Kovid Goyal ' import posixpath, re from uuid import uuid4 -from urlparse import urlparse from calibre.utils.filenames import ascii_text +from polyglot.urllib import urlparse def start_text(tag, prefix_len=0, top_level=True): diff --git a/src/calibre/ebooks/html/input.py b/src/calibre/ebooks/html/input.py index 723fcc3688..6bd6183821 100644 --- a/src/calibre/ebooks/html/input.py +++ b/src/calibre/ebooks/html/input.py @@ -13,13 +13,13 @@ Input plugin for HTML or OPF ebooks. ''' import os, re, sys, errno as gerrno -from urlparse import urlparse, urlunparse from calibre.ebooks.oeb.base import urlunquote from calibre.ebooks.chardet import detect_xml_encoding from calibre.constants import iswindows from calibre import unicode_path, as_unicode, replace_entities from polyglot.builtins import unicode_type +from polyglot.urllib import urlparse, urlunparse class Link(object): diff --git a/src/calibre/ebooks/htmlz/oeb2html.py b/src/calibre/ebooks/htmlz/oeb2html.py index f27a7308d5..ba619d1842 100644 --- a/src/calibre/ebooks/htmlz/oeb2html.py +++ b/src/calibre/ebooks/htmlz/oeb2html.py @@ -15,7 +15,6 @@ import re from functools import partial from lxml import html -from urlparse import urldefrag from calibre import prepare_string_for_xml from calibre.ebooks.oeb.base import ( @@ -23,6 +22,7 @@ from calibre.ebooks.oeb.base import ( from calibre.ebooks.oeb.stylizer import Stylizer from calibre.utils.logging import default_log from polyglot.builtins import unicode_type, string_or_bytes +from polyglot.urllib import urldefrag SELF_CLOSING_TAGS = {'area', 'base', 'basefont', 'br', 'hr', 'input', 'img', 'link', 'meta'} diff --git a/src/calibre/ebooks/lit/reader.py b/src/calibre/ebooks/lit/reader.py index b487c673a1..4cef2e9083 100644 --- a/src/calibre/ebooks/lit/reader.py +++ b/src/calibre/ebooks/lit/reader.py @@ -9,8 +9,6 @@ __copyright__ = '2008, Kovid Goyal ' \ 'and Marshall T. Vandegrift ' import io, struct, os, functools, re -from urlparse import urldefrag -from urllib import unquote as urlunquote from lxml import etree @@ -22,6 +20,7 @@ from calibre.ebooks.oeb.reader import OEBReader from calibre.ebooks import DRMError from calibre import plugins from polyglot.builtins import codepoint_to_chr, unicode_type, string_or_bytes, range +from polyglot.urllib import unquote as urlunquote, urldefrag lzx, lxzerror = plugins['lzx'] msdes, msdeserror = plugins['msdes'] diff --git a/src/calibre/ebooks/lit/writer.py b/src/calibre/ebooks/lit/writer.py index b5256101b8..ecc69ab748 100644 --- a/src/calibre/ebooks/lit/writer.py +++ b/src/calibre/ebooks/lit/writer.py @@ -17,8 +17,6 @@ import copy import uuid import functools import numbers -from urlparse import urldefrag -from urllib import unquote as urlunquote from lxml import etree from calibre.ebooks.lit.reader import DirectoryEntry import calibre.ebooks.lit.maps as maps @@ -33,6 +31,7 @@ from calibre import plugins msdes, msdeserror = plugins['msdes'] import calibre.ebooks.lit.mssha1 as mssha1 from polyglot.builtins import codepoint_to_chr, unicode_type, string_or_bytes, range +from polyglot.urllib import urldefrag, unquote __all__ = ['LitWriter'] @@ -521,7 +520,7 @@ class LitWriter(object): media_type = XHTML_MIME elif media_type in OEB_STYLES: media_type = CSS_MIME - href = urlunquote(item.href) + href = unquote(item.href) item.offset = offset \ if state in ('linear', 'nonlinear') else 0 data.write(pack(' -from __future__ import absolute_import, division, print_function, unicode_literals - +from __future__ import absolute_import from polyglot.builtins import is_py3 if is_py3: - from urllib.request import urlopen, Request # noqa - from urllib.parse import urlencode # noqa + from urllib.request import (build_opener, getproxies, install_opener, # noqa + HTTPBasicAuthHandler, HTTPCookieProcessor, HTTPDigestAuthHandler, # noqa + url2pathname, urlopen, Request) # noqa + from urllib.parse import (parse_qs, quote, unquote, quote_plus, urldefrag, # noqa + urlencode, urljoin, urlparse, urlunparse, urlsplit, urlunsplit) # noqa + from urllib.error import HTTPError, URLError # noqa else: - from urllib import urlencode # noqa - from urllib2 import urlopen, Request # noqa + from urllib import (getproxies, quote, unquote, quote_plus, url2pathname, # noqa + urlencode) # noqa + from urllib2 import (build_opener, install_opener, HTTPBasicAuthHandler, # noqa + HTTPCookieProcessor, HTTPDigestAuthHandler, HTTPError, URLError, # noqa + urlopen, Request) # noqa + from urlparse import (parse_qs, urldefrag, urljoin, urlparse, urlunparse, # noqa + urlsplit, urlunsplit) # noqa From ea6a210e70ac890066146ddfb9edbb61f546671f Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 19 Mar 2019 17:08:50 -0400 Subject: [PATCH 0367/2613] python3: wire up more code to polyglot.http_server --- src/calibre/ebooks/oeb/display/test-cfi/run_rapydscript.py | 6 +++--- src/calibre/utils/serve_coffee.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/calibre/ebooks/oeb/display/test-cfi/run_rapydscript.py b/src/calibre/ebooks/oeb/display/test-cfi/run_rapydscript.py index 887708f454..0ca3698b23 100644 --- a/src/calibre/ebooks/oeb/display/test-cfi/run_rapydscript.py +++ b/src/calibre/ebooks/oeb/display/test-cfi/run_rapydscript.py @@ -8,9 +8,10 @@ __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' import os, shutil, tempfile -import SimpleHTTPServer import SocketServer +from polyglot.http_server import SimpleHTTPRequestHandler + def run_devel_server(): base = os.path.dirname(os.path.abspath(__file__)) @@ -27,7 +28,7 @@ def run_devel_server(): with lopen('cfi-test.pyj', 'rb') as f, lopen('cfi-test.js', 'wb') as js: js.write(compile_pyj(f.read()).encode('utf-8')) PORT = 8000 - Handler = SimpleHTTPServer.SimpleHTTPRequestHandler + Handler = SimpleHTTPRequestHandler httpd = SocketServer.TCPServer(("", PORT), Handler) print('Serving CFI test at http://localhost:%d' % PORT) try: @@ -37,4 +38,3 @@ def run_devel_server(): if __name__ == '__main__': run_devel_server() - diff --git a/src/calibre/utils/serve_coffee.py b/src/calibre/utils/serve_coffee.py index 2239860932..887df3a323 100644 --- a/src/calibre/utils/serve_coffee.py +++ b/src/calibre/utils/serve_coffee.py @@ -18,9 +18,9 @@ if sys.version_info.major > 2: file=sys.stderr) raise SystemExit(1) -import time, BaseHTTPServer, os, sys, re, SocketServer +import time, os, sys, re, SocketServer from threading import Lock, local -from SimpleHTTPServer import SimpleHTTPRequestHandler +from polyglot.http_server import BaseHTTPServer, SimpleHTTPRequestHandler # Compiler {{{ From 83b055122ade5869b09ad1ae48354c0a18722775 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 19 Mar 2019 17:11:00 -0400 Subject: [PATCH 0368/2613] python3: add polyglot.queue wrapper --- src/calibre/db/delete_service.py | 3 +-- src/calibre/devices/smart_device_app/driver.py | 10 +++++----- src/calibre/ebooks/comic/input.py | 2 +- src/calibre/ebooks/metadata/sources/test.py | 2 +- src/calibre/ebooks/metadata/sources/worker.py | 2 +- src/calibre/ebooks/oeb/polish/check/links.py | 2 +- src/calibre/ebooks/oeb/polish/images.py | 2 +- src/calibre/gui2/__init__.py | 4 ++-- src/calibre/gui2/add.py | 2 +- src/calibre/gui2/device.py | 17 +++++++++-------- src/calibre/gui2/dnd.py | 2 +- src/calibre/gui2/icon_theme.py | 2 +- src/calibre/gui2/jobs.py | 2 +- src/calibre/gui2/library/alternate_views.py | 2 +- src/calibre/gui2/metadata/single_download.py | 2 +- src/calibre/gui2/save.py | 2 +- .../gui2/store/search/download_thread.py | 2 +- src/calibre/gui2/threaded_jobs.py | 4 +--- .../gui2/tweak_book/completion/worker.py | 2 +- src/calibre/gui2/tweak_book/preview.py | 2 +- src/calibre/gui2/tweak_book/save.py | 2 +- src/calibre/gui2/ui.py | 2 +- src/calibre/library/sqlite.py | 2 +- src/calibre/srv/auto_reload.py | 2 +- src/calibre/srv/jobs.py | 2 +- src/calibre/srv/loop.py | 2 +- src/calibre/srv/pool.py | 2 +- src/calibre/srv/web_socket.py | 2 +- src/calibre/utils/ipc/job.py | 2 +- src/calibre/utils/ipc/pool.py | 2 +- src/calibre/utils/ipc/server.py | 2 +- src/calibre/utils/ipc/worker.py | 2 +- src/calibre/utils/matcher.py | 2 +- src/calibre/utils/rapydscript.py | 2 +- src/calibre/utils/threadpool.py | 10 +++++----- src/polyglot/queue.py | 10 ++++++++++ 36 files changed, 62 insertions(+), 54 deletions(-) create mode 100644 src/polyglot/queue.py diff --git a/src/calibre/db/delete_service.py b/src/calibre/db/delete_service.py index c33dda1f7c..6698f4680c 100644 --- a/src/calibre/db/delete_service.py +++ b/src/calibre/db/delete_service.py @@ -8,11 +8,11 @@ __copyright__ = '2013, Kovid Goyal ' import os, tempfile, shutil, errno, time, atexit from threading import Thread -from Queue import Queue from calibre.ptempfile import remove_dir from calibre.utils.filenames import remove_dir_if_empty from calibre.utils.recycle_bin import delete_tree, delete_file +from polyglot.queue import Queue class DeleteService(Thread): @@ -159,4 +159,3 @@ def has_jobs(): if __ds is not None: return (not __ds.requests.empty()) or __ds.requests.unfinished_tasks return False - diff --git a/src/calibre/devices/smart_device_app/driver.py b/src/calibre/devices/smart_device_app/driver.py index 7d60bf2916..7d52dc76c8 100644 --- a/src/calibre/devices/smart_device_app/driver.py +++ b/src/calibre/devices/smart_device_app/driver.py @@ -11,7 +11,6 @@ import socket, select, json, os, traceback, time, sys, random import posixpath from collections import defaultdict import hashlib, threading -import Queue from functools import wraps from errno import EAGAIN, EINTR @@ -39,6 +38,7 @@ from calibre.utils.mdns import (publish as publish_zeroconf, unpublish as unpublish_zeroconf, get_all_ips) from calibre.utils.socket_inheritance import set_socket_inherit from polyglot.builtins import unicode_type +from polyglot import queue def synchronous(tlockname): @@ -103,7 +103,7 @@ class ConnectionListener(Thread): {'otherDevice': d.get_gui_name()}) self.driver._send_byte_string(device_socket, (b'%d' % len(s)) + s) sock.close() - except Queue.Empty: + except queue.Empty: pass if getattr(self.driver, 'broadcast_socket', None) is not None: @@ -148,7 +148,7 @@ class ConnectionListener(Thread): try: self.driver.connection_queue.put_nowait(device_socket) - except Queue.Full: + except queue.Full: self._close_socket(device_socket) device_socket = None self.driver._debug('driver is not answering') @@ -993,7 +993,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): raise except: pass - except Queue.Empty: + except queue.Empty: self.is_connected = False return self if self.is_connected else None return None @@ -1969,7 +1969,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): message = 'attaching port to broadcast socket failed. This is not fatal.' self._debug(message) - self.connection_queue = Queue.Queue(1) + self.connection_queue = queue.Queue(1) self.connection_listener = ConnectionListener(self) self.connection_listener.start() return message diff --git a/src/calibre/ebooks/comic/input.py b/src/calibre/ebooks/comic/input.py index a636069fbb..fb6db0d152 100755 --- a/src/calibre/ebooks/comic/input.py +++ b/src/calibre/ebooks/comic/input.py @@ -8,7 +8,6 @@ Based on ideas from comiclrf created by FangornUK. ''' import os, traceback, time -from Queue import Empty from calibre import extract, prints, walk from calibre.constants import filesystem_encoding @@ -17,6 +16,7 @@ from calibre.utils.icu import numeric_sort_key from calibre.utils.ipc.server import Server from calibre.utils.ipc.job import ParallelJob from polyglot.builtins import unicode_type +from polyglot.queue import Empty # If the specified screen has either dimension larger than this value, no image # rescaling is done (we assume that it is a tablet output profile) diff --git a/src/calibre/ebooks/metadata/sources/test.py b/src/calibre/ebooks/metadata/sources/test.py index fec33ffeab..fcd4df3a42 100644 --- a/src/calibre/ebooks/metadata/sources/test.py +++ b/src/calibre/ebooks/metadata/sources/test.py @@ -8,7 +8,6 @@ __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' import os, tempfile, time -from Queue import Queue, Empty from threading import Event from calibre.customize.ui import all_metadata_plugins @@ -16,6 +15,7 @@ from calibre import prints, sanitize_file_name2 from calibre.ebooks.metadata import check_isbn from calibre.ebooks.metadata.sources.base import create_log, get_cached_cover_urls from calibre.ebooks.metadata.sources.prefs import msprefs +from polyglot.queue import Queue, Empty def isbn_test(isbn): diff --git a/src/calibre/ebooks/metadata/sources/worker.py b/src/calibre/ebooks/metadata/sources/worker.py index b8fb28d8e2..436d7014eb 100644 --- a/src/calibre/ebooks/metadata/sources/worker.py +++ b/src/calibre/ebooks/metadata/sources/worker.py @@ -6,7 +6,6 @@ from __future__ import absolute_import, division, print_function, unicode_litera import os from collections import Counter from io import BytesIO -from Queue import Empty, Queue from threading import Event, Thread from calibre.customize.ui import metadata_plugins @@ -18,6 +17,7 @@ from calibre.ebooks.metadata.sources.identify import identify, msprefs from calibre.ebooks.metadata.sources.update import patch_plugins from calibre.utils.date import as_utc from calibre.utils.logging import GUILog +from polyglot.queue import Empty, Queue def merge_result(oldmi, newmi, ensure_fields=None): diff --git a/src/calibre/ebooks/oeb/polish/check/links.py b/src/calibre/ebooks/oeb/polish/check/links.py index 53179a06a8..b581bc6418 100644 --- a/src/calibre/ebooks/oeb/polish/check/links.py +++ b/src/calibre/ebooks/oeb/polish/check/links.py @@ -9,7 +9,6 @@ __copyright__ = '2013, Kovid Goyal ' import os from collections import defaultdict from threading import Thread -from Queue import Queue, Empty from calibre import browser from calibre.ebooks.oeb.base import OEB_DOCS, OEB_STYLES, urlunquote, XHTML_MIME @@ -21,6 +20,7 @@ from calibre.ebooks.oeb.polish.utils import guess_type, actual_case_for_name, co from calibre.ebooks.oeb.polish.check.base import BaseError, WARN, INFO from polyglot.builtins import map, range from polyglot.urllib import urlparse +from polyglot.queue import Queue, Empty class BadLink(BaseError): diff --git a/src/calibre/ebooks/oeb/polish/images.py b/src/calibre/ebooks/oeb/polish/images.py index 8ae9f9c413..680fb47af0 100644 --- a/src/calibre/ebooks/oeb/polish/images.py +++ b/src/calibre/ebooks/oeb/polish/images.py @@ -7,10 +7,10 @@ from __future__ import (unicode_literals, division, absolute_import, import os from functools import partial from threading import Thread, Event -from Queue import Queue, Empty from calibre import detect_ncpus, human_readable, force_unicode, filesystem_encoding from polyglot.builtins import range +from polyglot.queue import Queue, Empty class Worker(Thread): diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 56fbb4e074..d16d949c43 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -3,7 +3,6 @@ __copyright__ = '2008, Kovid Goyal ' """ The GUI """ import glob import os -import Queue import signal import sys import threading @@ -36,6 +35,7 @@ from calibre.utils.date import UNDEFINED_DATE from calibre.utils.file_type_icons import EXT_MAP from calibre.utils.localization import get_lang from polyglot.builtins import unicode_type, string_or_bytes, range +from polyglot import queue try: NO_URL_FORMATTING = QUrl.None_ @@ -502,7 +502,7 @@ class FunctionDispatcher(QObject): if not queued: typ = Qt.AutoConnection if queued is None else Qt.DirectConnection self.dispatch_signal.connect(self.dispatch, type=typ) - self.q = Queue.Queue() + self.q = queue.Queue() self.lock = threading.Lock() def __call__(self, *args, **kwargs): diff --git a/src/calibre/gui2/add.py b/src/calibre/gui2/add.py index 482b735745..7aa6130644 100644 --- a/src/calibre/gui2/add.py +++ b/src/calibre/gui2/add.py @@ -9,7 +9,6 @@ __copyright__ = '2014, Kovid Goyal ' import shutil, os, weakref, traceback, tempfile, time from threading import Thread from collections import OrderedDict -from Queue import Empty from io import BytesIO from polyglot.builtins import map, unicode_type, string_or_bytes @@ -30,6 +29,7 @@ from calibre.ptempfile import PersistentTemporaryDirectory from calibre.utils import join_with_timeout from calibre.utils.config import prefs from calibre.utils.ipc.pool import Pool, Failure +from polyglot.queue import Empty def validate_source(source, parent=None): # {{{ diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index 456a0dea3b..7414e4102f 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -3,7 +3,7 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' # Imports {{{ -import os, traceback, Queue, time, io, re, sys, weakref +import os, traceback, time, io, re, sys, weakref from threading import Thread, Event from PyQt5.Qt import ( @@ -35,6 +35,7 @@ from calibre.utils.img import scale_image from calibre.library.save_to_disk import find_plugboard from calibre.ptempfile import PersistentTemporaryFile, force_unicode as filename_to_unicode from polyglot.builtins import unicode_type, string_or_bytes +from polyglot import queue # }}} @@ -153,8 +154,8 @@ class DeviceManager(Thread): # {{{ self.sleep_time = sleep_time self.connected_slot = connected_slot self.allow_connect_slot = allow_connect_slot - self.jobs = Queue.Queue(0) - self.job_steps = Queue.Queue(0) + self.jobs = queue.Queue(0) + self.job_steps = queue.Queue(0) self.keep_going = True self.job_manager = job_manager self.reported_errors = set([]) @@ -163,7 +164,7 @@ class DeviceManager(Thread): # {{{ self.connected_device = None self.connected_device_kind = None self.ejected_devices = set([]) - self.mount_connection_requests = Queue.Queue(0) + self.mount_connection_requests = queue.Queue(0) self.open_feedback_slot = open_feedback_slot self.open_feedback_only_once_seen = set() self.after_callback_feedback_slot = after_callback_feedback_slot @@ -241,7 +242,7 @@ class DeviceManager(Thread): # {{{ try: job = self.jobs.get_nowait() job.abort(Exception(_('Device no longer connected.'))) - except Queue.Empty: + except queue.Empty: break try: self.connected_device.post_yank_cleanup() @@ -358,13 +359,13 @@ class DeviceManager(Thread): # {{{ if not self.job_steps.empty(): try: return self.job_steps.get_nowait() - except Queue.Empty: + except queue.Empty: pass if not self.jobs.empty(): try: return self.jobs.get_nowait() - except Queue.Empty: + except queue.Empty: pass def run_startup(self, dev): @@ -391,7 +392,7 @@ class DeviceManager(Thread): # {{{ try: (kls,device_kind, folder_path) = \ self.mount_connection_requests.get_nowait() - except Queue.Empty: + except queue.Empty: break if kls is not None: try: diff --git a/src/calibre/gui2/dnd.py b/src/calibre/gui2/dnd.py index 71c47ca44c..2b6201792f 100644 --- a/src/calibre/gui2/dnd.py +++ b/src/calibre/gui2/dnd.py @@ -9,7 +9,6 @@ __docformat__ = 'restructuredtext en' import posixpath, os, re from threading import Thread -from Queue import Queue, Empty from PyQt5.Qt import QPixmap, Qt, QDialog, QLabel, QVBoxLayout, \ QDialogButtonBox, QProgressBar, QTimer, QUrl, QImageReader @@ -21,6 +20,7 @@ from calibre.gui2 import error_dialog from calibre.utils.imghdr import what from polyglot.builtins import unicode_type from polyglot.urllib import unquote, urlparse +from polyglot.queue import Queue, Empty def image_extensions(): diff --git a/src/calibre/gui2/icon_theme.py b/src/calibre/gui2/icon_theme.py index 95fc1dcaca..495a5c2969 100644 --- a/src/calibre/gui2/icon_theme.py +++ b/src/calibre/gui2/icon_theme.py @@ -10,7 +10,6 @@ import os, errno, json, importlib, math, httplib, bz2, shutil, sys from itertools import count from io import BytesIO from polyglot.builtins import map -from Queue import Queue, Empty from threading import Thread, Event from multiprocessing.pool import ThreadPool @@ -39,6 +38,7 @@ from calibre.utils.img import image_from_data, Canvas, optimize_png, optimize_jp from calibre.utils.zipfile import ZipFile, ZIP_STORED from calibre.utils.filenames import atomic_rename from lzma.xz import compress, decompress +from polyglot.queue import Queue, Empty IMAGE_EXTENSIONS = {'png', 'jpg', 'jpeg'} THEME_COVER = 'icon-theme-cover.jpg' diff --git a/src/calibre/gui2/jobs.py b/src/calibre/gui2/jobs.py index 59b6e74be1..8f835be45b 100644 --- a/src/calibre/gui2/jobs.py +++ b/src/calibre/gui2/jobs.py @@ -8,7 +8,6 @@ Job management. ''' import re, time -from Queue import Empty, Queue from PyQt5.Qt import (QAbstractTableModel, QModelIndex, Qt, QPainter, QTimer, pyqtSignal, QIcon, QDialog, QAbstractItemDelegate, QApplication, @@ -31,6 +30,7 @@ from calibre.gui2.widgets2 import Dialog from calibre.utils.search_query_parser import SearchQueryParser, ParseException from calibre.utils.icu import lower from polyglot.builtins import unicode_type, range +from polyglot.queue import Empty, Queue class AdaptSQP(SearchQueryParser): diff --git a/src/calibre/gui2/library/alternate_views.py b/src/calibre/gui2/library/alternate_views.py index 1f11a5d84c..bab59f60d1 100644 --- a/src/calibre/gui2/library/alternate_views.py +++ b/src/calibre/gui2/library/alternate_views.py @@ -9,7 +9,6 @@ __copyright__ = '2013, Kovid Goyal ' import itertools, operator, os, math from types import MethodType from threading import Event, Thread -from Queue import LifoQueue from functools import wraps, partial from textwrap import wrap @@ -31,6 +30,7 @@ from calibre.gui2.gestures import GestureManager from calibre.gui2.library.caches import CoverCache, ThumbnailCache from calibre.utils.config import prefs, tweaks from polyglot.builtins import unicode_type, range +from polyglot.queue import LifoQueue CM_TO_INCH = 0.393701 CACHE_FORMAT = 'PPM' diff --git a/src/calibre/gui2/metadata/single_download.py b/src/calibre/gui2/metadata/single_download.py index 56c2c3f641..fe51133577 100644 --- a/src/calibre/gui2/metadata/single_download.py +++ b/src/calibre/gui2/metadata/single_download.py @@ -13,7 +13,6 @@ DEBUG_DIALOG = False import os, time from threading import Thread, Event from operator import attrgetter -from Queue import Queue, Empty from io import BytesIO from PyQt5.Qt import ( @@ -41,6 +40,7 @@ from calibre.utils.config import tweaks from calibre.utils.ipc.simple_worker import fork_job, WorkerError from calibre.ptempfile import TemporaryDirectory from polyglot.builtins import unicode_type, range +from polyglot.queue import Queue, Empty # }}} diff --git a/src/calibre/gui2/save.py b/src/calibre/gui2/save.py index 1c268c7fe7..d7a1553496 100644 --- a/src/calibre/gui2/save.py +++ b/src/calibre/gui2/save.py @@ -9,7 +9,6 @@ __copyright__ = '2014, Kovid Goyal ' import traceback, errno, os, time, shutil from collections import namedtuple, defaultdict from tempfile import SpooledTemporaryFile -from Queue import Empty from PyQt5.Qt import QObject, Qt, pyqtSignal @@ -26,6 +25,7 @@ from calibre.utils.formatter_functions import load_user_template_functions from calibre.utils.ipc.pool import Pool, Failure from calibre.library.save_to_disk import sanitize_args, get_path_components, find_plugboard, plugboard_save_to_disk_value from polyglot.builtins import unicode_type +from polyglot.queue import Empty BookId = namedtuple('BookId', 'title authors') diff --git a/src/calibre/gui2/store/search/download_thread.py b/src/calibre/gui2/store/search/download_thread.py index 5df4dd0966..b41c4fefe1 100644 --- a/src/calibre/gui2/store/search/download_thread.py +++ b/src/calibre/gui2/store/search/download_thread.py @@ -9,12 +9,12 @@ __docformat__ = 'restructuredtext en' import traceback, base64 from contextlib import closing from threading import Thread -from Queue import Queue from calibre import browser from calibre.constants import DEBUG from calibre.utils.img import scale_image from polyglot.builtins import range +from polyglot.queue import Queue class GenericDownloadThreadPool(object): diff --git a/src/calibre/gui2/threaded_jobs.py b/src/calibre/gui2/threaded_jobs.py index 77f66dec4f..aef553133d 100644 --- a/src/calibre/gui2/threaded_jobs.py +++ b/src/calibre/gui2/threaded_jobs.py @@ -9,11 +9,11 @@ __docformat__ = 'restructuredtext en' import os, time, tempfile, json from threading import Thread, RLock, Event -from Queue import Queue from calibre.utils.ipc.job import BaseJob from calibre.utils.logging import GUILog from calibre.ptempfile import base_dir +from polyglot.queue import Queue class ThreadedJob(BaseJob): @@ -245,5 +245,3 @@ class ThreadedJobServer(Thread): queued_types.append(job.type) ans.append(job) return ans - - diff --git a/src/calibre/gui2/tweak_book/completion/worker.py b/src/calibre/gui2/tweak_book/completion/worker.py index 13959df159..4a0e7b3a66 100644 --- a/src/calibre/gui2/tweak_book/completion/worker.py +++ b/src/calibre/gui2/tweak_book/completion/worker.py @@ -8,7 +8,6 @@ __copyright__ = '2014, Kovid Goyal ' import os, sys from threading import Thread, Event, RLock -from Queue import Queue from contextlib import closing from collections import namedtuple @@ -17,6 +16,7 @@ from calibre.gui2.tweak_book.completion.basic import Request from calibre.gui2.tweak_book.completion.utils import DataError from calibre.utils.ipc import eintr_retry_call from calibre.utils.serialize import msgpack_loads, msgpack_dumps +from polyglot.queue import Queue COMPLETION_REQUEST = 'completion request' CLEAR_REQUEST = 'clear request' diff --git a/src/calibre/gui2/tweak_book/preview.py b/src/calibre/gui2/tweak_book/preview.py index 4d9c2b4288..aa655d7682 100644 --- a/src/calibre/gui2/tweak_book/preview.py +++ b/src/calibre/gui2/tweak_book/preview.py @@ -11,7 +11,6 @@ from bisect import bisect_right from base64 import b64encode from polyglot.builtins import map, unicode_type from threading import Thread -from Queue import Queue, Empty from functools import partial from PyQt5.Qt import ( @@ -31,6 +30,7 @@ from calibre.gui2.viewer.config import config from calibre.gui2.widgets2 import HistoryLineEdit2 from calibre.utils.ipc.simple_worker import offload_worker from polyglot.urllib import urlparse +from polyglot.queue import Queue, Empty shutdown = object() diff --git a/src/calibre/gui2/tweak_book/save.py b/src/calibre/gui2/tweak_book/save.py index 52ce1ac6e0..1b706b51b7 100644 --- a/src/calibre/gui2/tweak_book/save.py +++ b/src/calibre/gui2/tweak_book/save.py @@ -8,7 +8,6 @@ __copyright__ = '2013, Kovid Goyal ' import shutil, os, errno from threading import Thread -from Queue import LifoQueue, Empty from PyQt5.Qt import (QObject, pyqtSignal, QLabel, QWidget, QHBoxLayout, Qt) @@ -18,6 +17,7 @@ from calibre.gui2.progress_indicator import ProgressIndicator from calibre.utils import join_with_timeout from calibre.utils.filenames import atomic_rename, format_permissions from calibre.utils.ipc import RC +from polyglot.queue import LifoQueue, Empty def save_dir_container(container, path): diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 4bdbecded6..10bd4106c3 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -10,7 +10,6 @@ __docformat__ = 'restructuredtext en' '''The main GUI''' import collections, os, sys, textwrap, time, gc, errno, re -from Queue import Queue, Empty from threading import Thread from collections import OrderedDict from io import BytesIO @@ -54,6 +53,7 @@ from calibre.gui2.open_with import register_keyboard_shortcuts from calibre.library import current_library_name from calibre.srv.library_broker import GuiLibraryBroker from polyglot.builtins import unicode_type, string_or_bytes +from polyglot.queue import Queue, Empty class Listener(Thread): # {{{ diff --git a/src/calibre/library/sqlite.py b/src/calibre/library/sqlite.py index 5fd140ce90..d876e96ccf 100644 --- a/src/calibre/library/sqlite.py +++ b/src/calibre/library/sqlite.py @@ -11,7 +11,6 @@ import sqlite3 as sqlite, traceback, time, uuid, sys, os import repr as reprlib from sqlite3 import IntegrityError, OperationalError from threading import Thread -from Queue import Queue from threading import RLock from datetime import datetime from functools import partial @@ -23,6 +22,7 @@ from calibre.constants import iswindows, DEBUG, plugins from calibre.utils.icu import sort_key from calibre import prints from polyglot.builtins import unicode_type +from polyglot.queue import Queue from dateutil.tz import tzoffset diff --git a/src/calibre/srv/auto_reload.py b/src/calibre/srv/auto_reload.py index ca3827adee..e986846cac 100644 --- a/src/calibre/srv/auto_reload.py +++ b/src/calibre/srv/auto_reload.py @@ -8,7 +8,6 @@ __copyright__ = '2015, Kovid Goyal ' import os, sys, subprocess, signal, time, errno, socket, ssl from threading import Thread, Lock -from Queue import Queue, Empty from calibre.constants import islinux, iswindows, isosx from calibre.srv.http_response import create_http_handler @@ -18,6 +17,7 @@ from calibre.srv.standalone import create_option_parser from calibre.srv.utils import create_sock_pair from calibre.srv.web_socket import DummyHandler from calibre.utils.monotonic import monotonic +from polyglot.queue import Queue, Empty MAX_RETRIES = 10 diff --git a/src/calibre/srv/jobs.py b/src/calibre/srv/jobs.py index 3398cd42a0..d529ba3f6c 100644 --- a/src/calibre/srv/jobs.py +++ b/src/calibre/srv/jobs.py @@ -9,11 +9,11 @@ from itertools import count from collections import namedtuple, deque from functools import partial from threading import RLock, Thread, Event -from Queue import Queue, Empty from calibre import detect_ncpus, force_unicode from calibre.utils.monotonic import monotonic from calibre.utils.ipc.simple_worker import fork_job, WorkerError +from polyglot.queue import Queue, Empty StartEvent = namedtuple('StartEvent', 'job_id name module function args kwargs callback data') DoneEvent = namedtuple('DoneEvent', 'job_id') diff --git a/src/calibre/srv/loop.py b/src/calibre/srv/loop.py index 3dd74ccb00..180603c42a 100644 --- a/src/calibre/srv/loop.py +++ b/src/calibre/srv/loop.py @@ -8,7 +8,6 @@ __copyright__ = '2015, Kovid Goyal ' import ssl, socket, select, os, traceback from io import BytesIO -from Queue import Empty, Full from functools import partial from calibre import as_unicode @@ -26,6 +25,7 @@ from calibre.utils.logging import ThreadSafeLog from calibre.utils.monotonic import monotonic from calibre.utils.mdns import get_external_ip from polyglot.builtins import range +from polyglot.queue import Empty, Full READ, WRITE, RDWR, WAIT = 'READ', 'WRITE', 'RDWR', 'WAIT' WAKEUP, JOB_DONE = bytes(bytearray(range(2))) diff --git a/src/calibre/srv/pool.py b/src/calibre/srv/pool.py index 507aef42e5..c83d769fab 100644 --- a/src/calibre/srv/pool.py +++ b/src/calibre/srv/pool.py @@ -7,11 +7,11 @@ __license__ = 'GPL v3' __copyright__ = '2015, Kovid Goyal ' import sys -from Queue import Queue, Full from threading import Thread from calibre.utils.monotonic import monotonic from polyglot.builtins import range +from polyglot.queue import Queue, Full class Worker(Thread): diff --git a/src/calibre/srv/web_socket.py b/src/calibre/srv/web_socket.py index 7305737417..de6f72ecdb 100644 --- a/src/calibre/srv/web_socket.py +++ b/src/calibre/srv/web_socket.py @@ -9,7 +9,6 @@ import httplib, os, weakref, socket from base64 import standard_b64encode from collections import deque from hashlib import sha1 -from Queue import Queue, Empty from struct import unpack_from, pack, error as struct_error from threading import Lock @@ -19,6 +18,7 @@ from calibre.srv.loop import ServerLoop, HandleInterrupt, WRITE, READ, RDWR, Con from calibre.srv.http_response import HTTPConnection, create_http_handler from calibre.srv.utils import DESIRED_SEND_BUFFER_SIZE from calibre.utils.speedups import ReadOnlyFileBuffer +from polyglot.queue import Queue, Empty speedup, err = plugins['speedup'] if not speedup: raise RuntimeError('Failed to load speedup module with error: ' + err) diff --git a/src/calibre/utils/ipc/job.py b/src/calibre/utils/ipc/job.py index 73829f83bb..70cd4612c6 100644 --- a/src/calibre/utils/ipc/job.py +++ b/src/calibre/utils/ipc/job.py @@ -9,10 +9,10 @@ __docformat__ = 'restructuredtext en' _count = 0 import time, io -from Queue import Queue, Empty from calibre import prints from calibre.constants import DEBUG +from polyglot.queue import Queue, Empty class BaseJob(object): diff --git a/src/calibre/utils/ipc/pool.py b/src/calibre/utils/ipc/pool.py index aff69e4354..ea1f1c5cef 100644 --- a/src/calibre/utils/ipc/pool.py +++ b/src/calibre/utils/ipc/pool.py @@ -9,7 +9,6 @@ __copyright__ = '2014, Kovid Goyal ' import os, sys from threading import Thread from collections import namedtuple -from Queue import Queue from calibre import detect_ncpus, as_unicode, prints from calibre.constants import iswindows, DEBUG @@ -17,6 +16,7 @@ from calibre.ptempfile import PersistentTemporaryFile from calibre.utils import join_with_timeout from calibre.utils.ipc import eintr_retry_call from calibre.utils.serialize import msgpack_dumps, msgpack_loads, pickle_dumps, pickle_loads +from polyglot.queue import Queue Job = namedtuple('Job', 'id module func args kwargs') Result = namedtuple('Result', 'value err traceback') diff --git a/src/calibre/utils/ipc/server.py b/src/calibre/utils/ipc/server.py index 58269ce4a5..7bc3d33b42 100644 --- a/src/calibre/utils/ipc/server.py +++ b/src/calibre/utils/ipc/server.py @@ -17,7 +17,6 @@ from binascii import hexlify from collections import deque from math import ceil from multiprocessing.connection import Listener, arbitrary_address -from Queue import Empty, Queue from threading import RLock, Thread from calibre import detect_ncpus as cpu_count @@ -28,6 +27,7 @@ from calibre.utils.ipc.launch import Worker from calibre.utils.ipc.worker import PARALLEL_FUNCS from calibre.utils.serialize import msgpack_dumps, pickle_loads from polyglot.builtins import string_or_bytes, environ_item +from polyglot.queue import Empty, Queue _counter = 0 diff --git a/src/calibre/utils/ipc/worker.py b/src/calibre/utils/ipc/worker.py index c4ca19cd13..a244b5e3f5 100644 --- a/src/calibre/utils/ipc/worker.py +++ b/src/calibre/utils/ipc/worker.py @@ -10,7 +10,6 @@ __docformat__ = 'restructuredtext en' import os, sys, importlib from multiprocessing.connection import Client from threading import Thread -from Queue import Queue from contextlib import closing from binascii import unhexlify from zipimport import ZipImportError @@ -19,6 +18,7 @@ from calibre import prints from calibre.constants import iswindows, isosx from calibre.utils.ipc import eintr_retry_call from calibre.utils.serialize import msgpack_loads, pickle_dumps +from polyglot.queue import Queue PARALLEL_FUNCS = { 'lrfviewer' : diff --git a/src/calibre/utils/matcher.py b/src/calibre/utils/matcher.py index 7da1be1742..091f736c51 100644 --- a/src/calibre/utils/matcher.py +++ b/src/calibre/utils/matcher.py @@ -9,7 +9,6 @@ import atexit, os, sys from math import ceil from unicodedata import normalize from threading import Thread, Lock -from Queue import Queue from operator import itemgetter from collections import OrderedDict from itertools import islice @@ -20,6 +19,7 @@ from polyglot.builtins import map, unicode_type, range from calibre import detect_ncpus as cpu_count, as_unicode from calibre.constants import plugins, filesystem_encoding from calibre.utils.icu import primary_sort_key, primary_find, primary_collator +from polyglot.queue import Queue DEFAULT_LEVEL1 = '/' DEFAULT_LEVEL2 = '-_ 0123456789' diff --git a/src/calibre/utils/rapydscript.py b/src/calibre/utils/rapydscript.py index ee0cf8aa07..67db41e87e 100644 --- a/src/calibre/utils/rapydscript.py +++ b/src/calibre/utils/rapydscript.py @@ -14,7 +14,6 @@ import subprocess import sys from functools import partial from io import BytesIO -from Queue import Empty, Queue from threading import Thread, local from calibre import force_unicode @@ -24,6 +23,7 @@ from calibre.utils.terminal import ANSIStream from duktape import Context, JSError, to_python from lzma.xz import compress, decompress from polyglot.builtins import range +from polyglot.queue import Empty, Queue COMPILER_PATH = 'rapydscript/compiler.js.xz' diff --git a/src/calibre/utils/threadpool.py b/src/calibre/utils/threadpool.py index 9d6503173a..8ed716743c 100644 --- a/src/calibre/utils/threadpool.py +++ b/src/calibre/utils/threadpool.py @@ -48,7 +48,7 @@ __license__ = 'Python license' # standard library modules import threading -import Queue +from polyglot import queue # exceptions @@ -75,7 +75,7 @@ class WorkerThread(threading.Thread): def __init__(self, requestsQueue, resultsQueue, **kwds): """Set up thread in daemonic mode and start it immediatedly. - requestsQueue and resultQueue are instances of Queue.Queue passed + requestsQueue and resultQueue are instances of queue.Queue passed by the ThreadPool class when it creates a new worker thread. """ @@ -174,8 +174,8 @@ class ThreadPool: more work requests in it (see putRequest method). """ - self.requestsQueue = Queue.Queue(q_size) - self.resultsQueue = Queue.Queue() + self.requestsQueue = queue.Queue(q_size) + self.resultsQueue = queue.Queue() self.workers = [] self.workRequests = {} self.createWorkers(num_workers) @@ -223,7 +223,7 @@ class ThreadPool: (request.exception and request.exc_callback): request.callback(request, result) del self.workRequests[request.requestID] - except Queue.Empty: + except queue.Empty: break def wait(self, sleep=0): diff --git a/src/polyglot/queue.py b/src/polyglot/queue.py new file mode 100644 index 0000000000..17323ed37b --- /dev/null +++ b/src/polyglot/queue.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +# License: GPL v3 Copyright: 2019, Eli Schwartz + +from polyglot.builtins import is_py3 + +if is_py3: + from queue import * # noqa +else: + from Queue import * # noqa From e828a4bd985bb152a423c1b0b80523c394719db9 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 19 Mar 2019 17:40:01 -0400 Subject: [PATCH 0369/2613] python3: more use of unicode_type These metadata sources files are part of the infrastructure, not the parts which are downloaded. --- src/calibre/ebooks/metadata/sources/cli.py | 3 ++- src/calibre/ebooks/metadata/sources/identify.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/metadata/sources/cli.py b/src/calibre/ebooks/metadata/sources/cli.py index d7d5153cf9..61b250e1db 100644 --- a/src/calibre/ebooks/metadata/sources/cli.py +++ b/src/calibre/ebooks/metadata/sources/cli.py @@ -21,6 +21,7 @@ from calibre.ebooks.metadata.sources.base import create_log from calibre.ebooks.metadata.sources.identify import identify from calibre.ebooks.metadata.sources.covers import download_cover from calibre.ebooks.metadata.sources.update import patch_plugins +from polyglot.builtins import unicode_type def option_parser(): @@ -99,7 +100,7 @@ def main(args=sys.argv): log = buf.getvalue() result = (metadata_to_opf(result) if opts.opf else - type(u'')(result).encode('utf-8')) + unicode_type(result).encode('utf-8')) if opts.verbose: print (log, file=sys.stderr) diff --git a/src/calibre/ebooks/metadata/sources/identify.py b/src/calibre/ebooks/metadata/sources/identify.py index 5fc4a5bfb0..44cdba029b 100644 --- a/src/calibre/ebooks/metadata/sources/identify.py +++ b/src/calibre/ebooks/metadata/sources/identify.py @@ -27,6 +27,7 @@ from calibre.utils.html2text import html2text from calibre.utils.icu import lower from calibre.utils.date import UNDEFINED_DATE from calibre.utils.formatter import EvalFormatter +from polyglot.builtins import unicode_type # Download worker {{{ @@ -471,7 +472,7 @@ def identify(log, abort, # {{{ for r in presults: log('\n\n---') try: - log(type(u'')(r)) + log(unicode_type(r)) except TypeError: log(repr(r)) if plog: From 938683932048c6d73ce1446d9c4af99a0e3e9c80 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 20 Mar 2019 21:11:45 +0530 Subject: [PATCH 0370/2613] Various ixes for the previous polyglot commit --- src/calibre/db/delete_service.py | 1 + src/calibre/ebooks/docx/writer/links.py | 2 +- .../oeb/display/test-cfi/run_rapydscript.py | 1 + src/calibre/srv/web_socket.py | 2 ++ src/calibre/utils/html2text_test.py | 12 -------- src/calibre/web/fetch/simple.py | 29 +++++++++++++------ src/polyglot/queue.py | 4 +-- 7 files changed, 27 insertions(+), 24 deletions(-) delete mode 100644 src/calibre/utils/html2text_test.py diff --git a/src/calibre/db/delete_service.py b/src/calibre/db/delete_service.py index 6698f4680c..a64349ae43 100644 --- a/src/calibre/db/delete_service.py +++ b/src/calibre/db/delete_service.py @@ -136,6 +136,7 @@ class DeleteService(Thread): finally: shutil.rmtree(tdir) + __ds = None diff --git a/src/calibre/ebooks/docx/writer/links.py b/src/calibre/ebooks/docx/writer/links.py index 4e6315d738..e334abee9b 100644 --- a/src/calibre/ebooks/docx/writer/links.py +++ b/src/calibre/ebooks/docx/writer/links.py @@ -42,7 +42,7 @@ class TOCItem(object): r = makeelement(p, 'w:r') makeelement(r, 'w:fldChar', w_fldCharType='begin') r = makeelement(p, 'w:r') - makeelement(r, 'w:instrText').text = ' TOC \h ' + makeelement(r, 'w:instrText').text = r' TOC \h ' r[0].set('{http://www.w3.org/XML/1998/namespace}space', 'preserve') r = makeelement(p, 'w:r') makeelement(r, 'w:fldChar', w_fldCharType='separate') diff --git a/src/calibre/ebooks/oeb/display/test-cfi/run_rapydscript.py b/src/calibre/ebooks/oeb/display/test-cfi/run_rapydscript.py index 0ca3698b23..a31da7fbac 100644 --- a/src/calibre/ebooks/oeb/display/test-cfi/run_rapydscript.py +++ b/src/calibre/ebooks/oeb/display/test-cfi/run_rapydscript.py @@ -36,5 +36,6 @@ def run_devel_server(): except KeyboardInterrupt: pass + if __name__ == '__main__': run_devel_server() diff --git a/src/calibre/srv/web_socket.py b/src/calibre/srv/web_socket.py index de6f72ecdb..5fdf7ab309 100644 --- a/src/calibre/srv/web_socket.py +++ b/src/calibre/srv/web_socket.py @@ -235,6 +235,7 @@ class MessageWriter(object): return ReadOnlyFileBuffer(create_frame(fin, opcode, raw, self.mask)) # }}} + conn_id = 0 @@ -562,6 +563,7 @@ def run_echo_server(): with HandleInterrupt(s.wakeup): s.serve_forever() + if __name__ == '__main__': # import cProfile # cProfile.runctx('r()', {'r':run_echo_server}, {}, filename='stats.profile') diff --git a/src/calibre/utils/html2text_test.py b/src/calibre/utils/html2text_test.py deleted file mode 100644 index 85ff04a803..0000000000 --- a/src/calibre/utils/html2text_test.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python2 -# vim:fileencoding=utf-8 -# License: GPL v3 Copyright: 2019, Kovid Goyal - -from __future__ import absolute_import, division, print_function, unicode_literals - -import unittest - -class Test(unittest.TestCase): - -def find_tests(): - return unittest.defaultTestLoader.loadTestsFromTestCase(Test) diff --git a/src/calibre/web/fetch/simple.py b/src/calibre/web/fetch/simple.py index 3d0a3dc6db..2adcc443f3 100644 --- a/src/calibre/web/fetch/simple.py +++ b/src/calibre/web/fetch/simple.py @@ -1,5 +1,6 @@ #!/usr/bin/env python2 -from __future__ import with_statement, print_function +from __future__ import print_function, with_statement + __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' @@ -7,25 +8,35 @@ __copyright__ = '2008, Kovid Goyal ' Fetch a webpage and its links recursively. The webpages are saved to disk in UTF-8 encoding with any charset declarations removed. ''' -import sys, socket, os, re, time, threading, traceback -from httplib import responses -from base64 import b64decode -from html5_parser.soup import set_soup_module, parse + +import os +import re +import socket +import sys +import threading +import time +import traceback +from base64 import b64decode +from httplib import responses + +from html5_parser.soup import parse, set_soup_module from calibre import browser, relpath, unicode_path from calibre.constants import filesystem_encoding, iswindows -from calibre.utils.filenames import ascii_filename from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag from calibre.ebooks.chardet import xml_to_unicode from calibre.utils.config import OptionParser -from calibre.utils.logging import Log +from calibre.utils.filenames import ascii_filename from calibre.utils.img import image_from_data, image_to_data from calibre.utils.imghdr import what +from calibre.utils.logging import Log from calibre.web.fetch.utils import rescale_image from polyglot.builtins import unicode_type -from polyglot.urllib import (quote, URLError, url2pathname, urljoin, - urlparse, urlsplit, urlunsplit) +from polyglot.urllib import ( + URLError, quote, url2pathname, urljoin, urlparse, urlsplit, urlunparse, + urlunsplit +) class AbortArticle(Exception): diff --git a/src/polyglot/queue.py b/src/polyglot/queue.py index 17323ed37b..de4cb6fbc5 100644 --- a/src/polyglot/queue.py +++ b/src/polyglot/queue.py @@ -5,6 +5,6 @@ from polyglot.builtins import is_py3 if is_py3: - from queue import * # noqa + from queue import Queue, Empty, Full, PriorityQueue, LifoQueue # noqa else: - from Queue import * # noqa + from Queue import Queue, Empty, Full, PriorityQueue, LifoQueue # noqa From 8e125b56a08e42177d07c783e6b7b598378c6fdb Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 20 Mar 2019 23:54:11 -0400 Subject: [PATCH 0371/2613] python3: listify the range() generator before appending to it We explicitly need a list here. --- src/calibre/ebooks/metadata/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/metadata/__init__.py b/src/calibre/ebooks/metadata/__init__.py index f05de87a89..ba6bf15571 100644 --- a/src/calibre/ebooks/metadata/__init__.py +++ b/src/calibre/ebooks/metadata/__init__.py @@ -135,7 +135,7 @@ def get_title_sort_pat(lang=None): _ignore_starts = u'\'"'+u''.join(codepoint_to_chr(x) for x in - range(0x2018, 0x201e)+[0x2032, 0x2033]) + list(range(0x2018, 0x201e))+[0x2032, 0x2033]) def title_sort(title, order=None, lang=None): From 8aceae428e955ea72eda97abd5c7889f012e779c Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 20 Mar 2019 23:50:46 -0400 Subject: [PATCH 0372/2613] py3: make setup.py gui work Apparently compileUi explicitly opens the file/buffer as unicode, not bytes, and then writes a unicode header string (containing the source file). So the previous attempt to use BytesIO was wrong in this case. Also images.qrc is being constructed completely in the right here and now from a bunch of unicode strings, so just use exactly that. --- setup/gui.py | 2 +- src/calibre/gui2/__init__.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup/gui.py b/setup/gui.py index 1c9c5aefd9..4b6a86126e 100644 --- a/setup/gui.py +++ b/setup/gui.py @@ -58,7 +58,7 @@ class GUI(Command): for s in sources: files.append('%s'%s) manifest = '\n\n%s\n\n'%'\n'.join(sorted(files)) - with open('images.qrc', 'wb') as f: + with open('images.qrc', 'w') as f: f.write(manifest) finally: os.chdir(cwd) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index d16d949c43..1f5325d8d5 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -1288,7 +1288,7 @@ def build_forms(srcdir, info=None, summary=False, check_for_migration=False): if force_compile or not os.path.exists(compiled_form) or os.stat(form).st_mtime > os.stat(compiled_form).st_mtime: if not summary: info('\tCompiling form', form) - buf = io.BytesIO() + buf = io.StringIO() compileUi(form, buf) dat = buf.getvalue() dat = dat.replace('import images_rc', '') @@ -1298,7 +1298,7 @@ def build_forms(srcdir, info=None, summary=False, check_for_migration=False): dat = dat.replace('_("d MMM yyyy")', '"d MMM yyyy"') dat = pat.sub(sub, dat) - open(compiled_form, 'wb').write(dat) + open(compiled_form, 'w').write(dat) num += 1 if num: info('Compiled %d forms' % num) From c940d9941a3c6d514df7eed452913680135a98cf Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 21 Mar 2019 00:23:43 -0400 Subject: [PATCH 0373/2613] python3: make kakasi build Since these are all being opened as non-binary, it makes no sense to then immediately decode them. --- setup/resources.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup/resources.py b/setup/resources.py index 3d63baf68a..6fc5cf92e5 100644 --- a/setup/resources.py +++ b/setup/resources.py @@ -168,7 +168,7 @@ class Kakasi(Command): # {{{ def mkitaiji(self, src, dst): dic = {} for line in open(src, "r"): - line = line.decode("utf-8").strip() + line = line.strip() if line.startswith(';;'): # skip comment continue if re.match(r"^$",line): @@ -182,7 +182,7 @@ class Kakasi(Command): # {{{ def mkkanadict(self, src, dst): dic = {} for line in open(src, "r"): - line = line.decode("utf-8").strip() + line = line.strip() if line.startswith(';;'): # skip comment continue if re.match(r"^$",line): @@ -194,7 +194,7 @@ class Kakasi(Command): # {{{ f.write(msgpack_dumps(dic)) def parsekdict(self, line): - line = line.decode("utf-8").strip() + line = line.strip() if line.startswith(';;'): # skip comment return (yomi, kanji) = line.split(' ') From 45f68f552ba6db4e5495463c947d2234f9638557 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 21 Mar 2019 00:24:47 -0400 Subject: [PATCH 0374/2613] python3: make coffee build add polyglot.socketserver wrapper and fix BaseHTTPServer.HTTPServer --- setup/publish.py | 4 ++-- .../ebooks/oeb/display/test-cfi/run_rapydscript.py | 4 ++-- src/calibre/utils/serve_coffee.py | 13 +++++-------- src/polyglot/http_server.py | 4 ++-- src/polyglot/socketserver.py | 10 ++++++++++ 5 files changed, 21 insertions(+), 14 deletions(-) create mode 100755 src/polyglot/socketserver.py diff --git a/setup/publish.py b/setup/publish.py index d1edbf9d3e..07c589bf3b 100644 --- a/setup/publish.py +++ b/setup/publish.py @@ -241,9 +241,9 @@ class Manual(Command): def serve_manual(self, root): os.chdir(root) - from polyglot.http_server import BaseHTTPServer, SimpleHTTPRequestHandler + from polyglot.http_server import HTTPServer, SimpleHTTPRequestHandler HandlerClass = SimpleHTTPRequestHandler - ServerClass = BaseHTTPServer.HTTPServer + ServerClass = HTTPServer Protocol = "HTTP/1.0" server_address = ('127.0.0.1', 8000) diff --git a/src/calibre/ebooks/oeb/display/test-cfi/run_rapydscript.py b/src/calibre/ebooks/oeb/display/test-cfi/run_rapydscript.py index a31da7fbac..43ec62a2e9 100644 --- a/src/calibre/ebooks/oeb/display/test-cfi/run_rapydscript.py +++ b/src/calibre/ebooks/oeb/display/test-cfi/run_rapydscript.py @@ -8,8 +8,8 @@ __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' import os, shutil, tempfile -import SocketServer +from polyglot import socketserver from polyglot.http_server import SimpleHTTPRequestHandler @@ -29,7 +29,7 @@ def run_devel_server(): js.write(compile_pyj(f.read()).encode('utf-8')) PORT = 8000 Handler = SimpleHTTPRequestHandler - httpd = SocketServer.TCPServer(("", PORT), Handler) + httpd = socketserver.TCPServer(("", PORT), Handler) print('Serving CFI test at http://localhost:%d' % PORT) try: httpd.serve_forever() diff --git a/src/calibre/utils/serve_coffee.py b/src/calibre/utils/serve_coffee.py index 887df3a323..c802e45fec 100644 --- a/src/calibre/utils/serve_coffee.py +++ b/src/calibre/utils/serve_coffee.py @@ -13,14 +13,11 @@ A coffeescript compiler and a simple web server that automatically serves coffeescript files as javascript. ''' import sys, traceback, io -if sys.version_info.major > 2: - print('This script is not Python 3 compatible. Run it with Python 2', - file=sys.stderr) - raise SystemExit(1) - -import time, os, sys, re, SocketServer +import time, os, sys, re from threading import Lock, local -from polyglot.http_server import BaseHTTPServer, SimpleHTTPRequestHandler + +from polyglot import socketserver +from polyglot.http_server import HTTPServer, SimpleHTTPRequestHandler # Compiler {{{ @@ -255,7 +252,7 @@ class Handler(HTTPRequestHandler): # {{{ # }}} -class Server(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer): # {{{ +class Server(socketserver.ThreadingMixIn, HTTPServer): # {{{ daemon_threads = True def handle_error(self, request, client_address): diff --git a/src/polyglot/http_server.py b/src/polyglot/http_server.py index e49d886569..319ec9a29c 100644 --- a/src/polyglot/http_server.py +++ b/src/polyglot/http_server.py @@ -7,7 +7,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera from polyglot.builtins import is_py3 if is_py3: - from http.server import BaseHTTPServer, SimpleHTTPRequestHandler + from http.server import HTTPServer, SimpleHTTPRequestHandler else: - import BaseHTTPServer # noqa + from BaseHTTPServer import HTTPServer # noqa from SimpleHTTPServer import SimpleHTTPRequestHandler # noqa diff --git a/src/polyglot/socketserver.py b/src/polyglot/socketserver.py new file mode 100755 index 0000000000..243cbac5cd --- /dev/null +++ b/src/polyglot/socketserver.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +# License: GPL v3 Copyright: 2019, Eli Schwartz + +from polyglot.builtins import is_py3 + +if is_py3: + from socketserver import TCPServer, ThreadingMixIn # noqa +else: + from SocketServer import TCPServer, ThreadingMixIn # noqa From cb85e778d8361bc11505ca1031cc3491ddd9ecdb Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 21 Mar 2019 00:53:10 -0400 Subject: [PATCH 0375/2613] python3: fix various uses of itertools.i(map|zip) Use the existing polyglot.builtins / future_builtins versions. Also smooth over izip_longest, but don't bother with another polyglot module for one function used in two places. --- src/calibre/customize/profiles.py | 5 ++--- src/calibre/db/view.py | 5 ++--- src/calibre/devices/mtp/driver.py | 7 +++---- .../ebooks/conversion/plugins/html_input.py | 5 ++--- src/calibre/ebooks/lit/writer.py | 8 ++++---- src/calibre/ebooks/mobi/debug/mobi8.py | 6 ++---- src/calibre/ebooks/mobi/reader/mobi8.py | 6 +++--- src/calibre/ebooks/oeb/reader.py | 5 ++--- src/calibre/ebooks/pdf/render/fonts.py | 6 +++--- src/calibre/gui2/tag_browser/view.py | 5 ++--- src/calibre/gui2/tweak_book/widgets.py | 5 ++--- src/calibre/library/caches.py | 14 +++++++------- src/calibre/srv/http_response.py | 6 ++++-- src/calibre/srv/opts.py | 8 ++++++-- src/calibre/srv/routes.py | 5 ++--- src/calibre/utils/fonts/sfnt/head.py | 9 ++++----- src/calibre/utils/fonts/sfnt/maxp.py | 7 ++----- src/calibre/utils/matcher.py | 5 ++--- src/calibre/utils/terminal.py | 9 ++++----- 19 files changed, 58 insertions(+), 68 deletions(-) diff --git a/src/calibre/customize/profiles.py b/src/calibre/customize/profiles.py index 10057f1cc1..2c7fead69f 100644 --- a/src/calibre/customize/profiles.py +++ b/src/calibre/customize/profiles.py @@ -4,9 +4,8 @@ __license__ = 'GPL 3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -from itertools import izip - from calibre.customize import Plugin as _Plugin +from polyglot.builtins import zip FONT_SIZES = [('xx-small', 1), ('x-small', None), @@ -31,7 +30,7 @@ class Plugin(_Plugin): fsizes = list(self.fsizes) self.fkey = list(self.fsizes) self.fsizes = [] - for (name, num), size in izip(FONT_SIZES, fsizes): + for (name, num), size in zip(FONT_SIZES, fsizes): self.fsizes.append((name, num, float(size))) self.fnames = dict((name, sz) for name, _, sz in self.fsizes if name) self.fnums = dict((num, sz) for _, num, sz in self.fsizes if num) diff --git a/src/calibre/db/view.py b/src/calibre/db/view.py index d4811434c0..fc773ac680 100644 --- a/src/calibre/db/view.py +++ b/src/calibre/db/view.py @@ -9,8 +9,7 @@ __docformat__ = 'restructuredtext en' import weakref, operator, numbers from functools import partial -from itertools import izip, imap -from polyglot.builtins import map, unicode_type, range +from polyglot.builtins import map, unicode_type, range, zip from calibre.ebooks.metadata import title_sort from calibre.utils.config_base import tweaks, prefs @@ -374,7 +373,7 @@ class View(object): self.marked_ids = dict.fromkeys(id_dict, u'true') else: # Ensure that all the items in the dict are text - self.marked_ids = dict(izip(id_dict.iterkeys(), imap(unicode_type, + self.marked_ids = dict(zip(id_dict.iterkeys(), map(unicode_type, id_dict.itervalues()))) # This invalidates all searches in the cache even though the cache may # be shared by multiple views. This is not ideal, but... diff --git a/src/calibre/devices/mtp/driver.py b/src/calibre/devices/mtp/driver.py index 9f6383d546..725f497baa 100644 --- a/src/calibre/devices/mtp/driver.py +++ b/src/calibre/devices/mtp/driver.py @@ -9,7 +9,6 @@ __docformat__ = 'restructuredtext en' import json, traceback, posixpath, importlib, os from io import BytesIO -from itertools import izip from calibre import prints from calibre.constants import iswindows, numeric_version @@ -18,7 +17,7 @@ from calibre.devices.mtp.base import debug from calibre.devices.mtp.defaults import DeviceDefaults from calibre.ptempfile import SpooledTemporaryFile, PersistentTemporaryDirectory from calibre.utils.filenames import shorten_components_to -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, zip BASE = importlib.import_module('calibre.devices.mtp.%s.driver'%( 'windows' if iswindows else 'unix')).MTP_DEVICE @@ -421,7 +420,7 @@ class MTP_DEVICE(BASE): routing = {fmt:dest for fmt,dest in self.get_pref('rules')} - for infile, fname, mi in izip(files, names, metadata): + for infile, fname, mi in zip(files, names, metadata): path = self.create_upload_path(prefix, mi, fname, routing) if path and self.is_folder_ignored(storage, path): raise MTPInvalidSendPathError('/'.join(path)) @@ -456,7 +455,7 @@ class MTP_DEVICE(BASE): i, total = 0, len(mtp_files) self.report_progress(0, _('Adding books to device metadata listing...')) - for x, mi in izip(mtp_files, metadata): + for x, mi in zip(mtp_files, metadata): mtp_file, bl_idx = x bl = booklists[bl_idx] book = Book(mtp_file.storage_id, '/'.join(mtp_file.mtp_relpath), diff --git a/src/calibre/ebooks/conversion/plugins/html_input.py b/src/calibre/ebooks/conversion/plugins/html_input.py index e04b82b221..9f257516d9 100644 --- a/src/calibre/ebooks/conversion/plugins/html_input.py +++ b/src/calibre/ebooks/conversion/plugins/html_input.py @@ -9,7 +9,6 @@ __docformat__ = 'restructuredtext en' import re, tempfile, os from functools import partial -from itertools import izip from calibre.constants import islinux, isbsd from calibre.customize.conversion import (InputFormatPlugin, @@ -17,7 +16,7 @@ from calibre.customize.conversion import (InputFormatPlugin, from calibre.utils.localization import get_lang from calibre.utils.filenames import ascii_filename from calibre.utils.imghdr import what -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, zip def sanitize_file_name(x): @@ -216,7 +215,7 @@ class HTMLInput(InputFormatPlugin): use = titles if len(titles) > len(set(titles)): use = headers - for title, item in izip(use, self.oeb.spine): + for title, item in zip(use, self.oeb.spine): if not item.linear: continue toc.add(title, item.href) diff --git a/src/calibre/ebooks/lit/writer.py b/src/calibre/ebooks/lit/writer.py index ecc69ab748..eeef5e675e 100644 --- a/src/calibre/ebooks/lit/writer.py +++ b/src/calibre/ebooks/lit/writer.py @@ -8,7 +8,7 @@ __license__ = 'GPL v3' __copyright__ = '2008, Marshall T. Vandegrift ' from struct import pack -from itertools import izip, count, chain +from itertools import count, chain import io import time import random @@ -30,7 +30,7 @@ import calibre from calibre import plugins msdes, msdeserror = plugins['msdes'] import calibre.ebooks.lit.mssha1 as mssha1 -from polyglot.builtins import codepoint_to_chr, unicode_type, string_or_bytes, range +from polyglot.builtins import codepoint_to_chr, unicode_type, string_or_bytes, range, zip from polyglot.urllib import urldefrag, unquote __all__ = ['LitWriter'] @@ -406,7 +406,7 @@ class LitWriter(object): 1, CCHUNK_SIZE, 0x20000, ULL_NEG1, 1)) cchunk = io.BytesIO() last = 0 - for i, dcount in izip(count(), dcounts): + for i, dcount in zip(count(), dcounts): cchunk.write(decint(last)) cchunk.write(decint(dcount)) cchunk.write(decint(i)) @@ -702,7 +702,7 @@ class LitWriter(object): ichunk = None if len(ddata) > 1: ichunk = io.BytesIO() - for cid, (content, quickref, dcount, name) in izip(count(), ddata): + for cid, (content, quickref, dcount, name) in zip(count(), ddata): dchunk = io.BytesIO() prev = cid - 1 if cid > 0 else ULL_NEG1 next = cid + 1 if cid < cidmax else ULL_NEG1 diff --git a/src/calibre/ebooks/mobi/debug/mobi8.py b/src/calibre/ebooks/mobi/debug/mobi8.py index 5a736c7002..3855a27329 100644 --- a/src/calibre/ebooks/mobi/debug/mobi8.py +++ b/src/calibre/ebooks/mobi/debug/mobi8.py @@ -9,7 +9,6 @@ __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' import sys, os, struct, textwrap -from itertools import izip from calibre import CurrentDir from calibre.ebooks.mobi.debug.containers import ContainerHeader @@ -20,6 +19,7 @@ from calibre.ebooks.mobi.utils import read_font_record, decode_tbs, RECORD_SIZE from calibre.ebooks.mobi.debug import format_bytes from calibre.ebooks.mobi.reader.headers import NULL_INDEX from calibre.utils.imghdr import what +from polyglot.builtins import zip class FDST(object): @@ -36,7 +36,7 @@ class FDST(object): if rest: raise ValueError('FDST record has trailing data: ' '%s'%format_bytes(rest)) - self.sections = tuple(izip(secs[::2], secs[1::2])) + self.sections = tuple(zip(secs[::2], secs[1::2])) def __str__(self): ans = ['FDST record'] @@ -340,5 +340,3 @@ def inspect_mobi(mobi_file, ddir): part.dump(os.path.join(ddir, 'files')) f.dump_flows(os.path.join(ddir, 'flows')) - - diff --git a/src/calibre/ebooks/mobi/reader/mobi8.py b/src/calibre/ebooks/mobi/reader/mobi8.py index 23e7c6d46b..74b3447bd7 100644 --- a/src/calibre/ebooks/mobi/reader/mobi8.py +++ b/src/calibre/ebooks/mobi/reader/mobi8.py @@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en' import struct, re, os from collections import namedtuple -from itertools import repeat, izip +from itertools import repeat from uuid import uuid4 from lxml import etree @@ -24,7 +24,7 @@ from calibre.ebooks.metadata.toc import TOC from calibre.ebooks.mobi.utils import read_font_record from calibre.ebooks.oeb.parse_utils import parse_html from calibre.ebooks.oeb.base import XPath, XHTML, xml2text -from polyglot.builtins import range +from polyglot.builtins import range, zip from polyglot.urllib import urldefrag Part = namedtuple('Part', @@ -125,7 +125,7 @@ class Mobi8Reader(object): sec_start, num_sections = struct.unpack_from(b'>LL', header, 4) secs = struct.unpack_from(b'>%dL' % (num_sections*2), header, sec_start) - self.flow_table = tuple(izip(secs[::2], secs[1::2])) + self.flow_table = tuple(zip(secs[::2], secs[1::2])) self.files = [] if self.header.skelidx != NULL_INDEX: diff --git a/src/calibre/ebooks/oeb/reader.py b/src/calibre/ebooks/oeb/reader.py index 4ba114924a..4c2bc15fb8 100644 --- a/src/calibre/ebooks/oeb/reader.py +++ b/src/calibre/ebooks/oeb/reader.py @@ -8,7 +8,6 @@ __license__ = 'GPL v3' __copyright__ = '2008, Marshall T. Vandegrift ' import sys, os, uuid, copy, re, io -from itertools import izip from collections import defaultdict from lxml import etree @@ -28,7 +27,7 @@ from calibre.utils.localization import get_lang from calibre.ptempfile import TemporaryDirectory from calibre.constants import __appname__, __version__ from calibre import guess_type, xml_replace_entities -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, zip from polyglot.urllib import unquote, urldefrag, urlparse __all__ = ['OEBReader'] @@ -541,7 +540,7 @@ class OEBReader(object): use = titles if len(titles) > len(set(titles)): use = headers - for title, item in izip(use, self.oeb.spine): + for title, item in zip(use, self.oeb.spine): if not item.linear: continue toc.add(title, item.href) diff --git a/src/calibre/ebooks/pdf/render/fonts.py b/src/calibre/ebooks/pdf/render/fonts.py index c31996eefc..ef3d31e27e 100644 --- a/src/calibre/ebooks/pdf/render/fonts.py +++ b/src/calibre/ebooks/pdf/render/fonts.py @@ -8,10 +8,10 @@ __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' import re -from itertools import izip, groupby +from itertools import groupby from operator import itemgetter from collections import Counter, OrderedDict -from polyglot.builtins import map +from polyglot.builtins import map, zip from calibre import as_unicode from calibre.ebooks.pdf.render.common import (Array, String, Stream, @@ -194,7 +194,7 @@ class Font(object): def write_widths(self, objects): glyphs = sorted(self.used_glyphs|{0}) - widths = {g:self.metrics.pdf_scale(w) for g, w in izip(glyphs, + widths = {g:self.metrics.pdf_scale(w) for g, w in zip(glyphs, self.metrics.glyph_widths(glyphs))} counter = Counter() for g, w in widths.iteritems(): diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index b0aa64a641..5f438a3ba0 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -9,7 +9,6 @@ __docformat__ = 'restructuredtext en' import os, re from functools import partial -from itertools import izip from PyQt5.Qt import ( QStyledItemDelegate, Qt, QTreeView, pyqtSignal, QSize, QIcon, QApplication, @@ -25,7 +24,7 @@ from calibre.gui2.tag_browser.model import (TagTreeItem, TAG_SEARCH_STATES, from calibre.gui2 import config, gprefs, choose_files, pixmap_to_data, rating_font, empty_index from calibre.utils.icu import sort_key from calibre.utils.serialize import json_loads -from polyglot.builtins import unicode_type, range +from polyglot.builtins import unicode_type, range, zip class TagDelegate(QStyledItemDelegate): # {{{ @@ -229,7 +228,7 @@ class TagsView(QTreeView): # {{{ expanded_categories.append(category.category_key) states = [c.tag.state for c in category.child_tags()] names = [(c.tag.name, c.tag.category) for c in category.child_tags()] - state_map[category.category_key] = dict(izip(names, states)) + state_map[category.category_key] = dict(zip(names, states)) return expanded_categories, state_map def reread_collapse_parameters(self): diff --git a/src/calibre/gui2/tweak_book/widgets.py b/src/calibre/gui2/tweak_book/widgets.py index fe70f3033d..64b452f035 100644 --- a/src/calibre/gui2/tweak_book/widgets.py +++ b/src/calibre/gui2/tweak_book/widgets.py @@ -7,7 +7,6 @@ __license__ = 'GPL v3' __copyright__ = '2014, Kovid Goyal ' import os, textwrap, unicodedata -from itertools import izip from collections import OrderedDict from PyQt5.Qt import ( @@ -28,7 +27,7 @@ from calibre.gui2.widgets2 import Dialog as BaseDialog, HistoryComboBox from calibre.utils.icu import primary_sort_key, sort_key, primary_contains, numeric_sort_key from calibre.utils.matcher import get_char, Matcher from calibre.gui2.complete2 import EditWithComplete -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, zip ROOT = QModelIndex() PARAGRAPH_SEPARATOR = '\u2029' @@ -348,7 +347,7 @@ class Results(QWidget): [(p.setTextFormat(Qt.RichText), p.setTextOption(self.text_option)) for p in prefixes] self.maxwidth = max([x.size().width() for x in prefixes]) self.results = tuple((prefix, self.make_text(text, positions), text) - for prefix, (text, positions) in izip(prefixes, results.iteritems())) + for prefix, (text, positions) in zip(prefixes, results.iteritems())) else: self.results = () self.current_result = -1 diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py index 05eba9972b..07aa609ae7 100644 --- a/src/calibre/library/caches.py +++ b/src/calibre/library/caches.py @@ -6,8 +6,8 @@ __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import itertools, time, traceback, locale -from itertools import repeat, izip, imap +import time, traceback, locale +from itertools import repeat from datetime import timedelta from threading import Thread @@ -20,7 +20,7 @@ from calibre.db.search import CONTAINS_MATCH, EQUALS_MATCH, REGEXP_MATCH, _match from calibre.ebooks.metadata import title_sort, author_to_author_sort from calibre.ebooks.metadata.opf2 import metadata_to_opf from calibre import prints, force_unicode -from polyglot.builtins import unicode_type, string_or_bytes +from polyglot.builtins import map, unicode_type, string_or_bytes, zip class MetadataBackup(Thread): # {{{ @@ -863,7 +863,7 @@ class ResultCache(SearchQueryParser): # {{{ self.search_restriction_book_count = len(self._map) return list(self._map) matches = self.parse(q) - tmap = list(itertools.repeat(False, len(self._data))) + tmap = list(repeat(False, len(self._data))) for x in matches: tmap[x] = True rv = [x for x in self._map if tmap[x]] @@ -917,7 +917,7 @@ class ResultCache(SearchQueryParser): # {{{ self.marked_ids_dict = dict.fromkeys(id_dict, u'true') else: # Ensure that all the items in the dict are text - self.marked_ids_dict = dict(izip(id_dict.iterkeys(), imap(unicode_type, + self.marked_ids_dict = dict(zip(id_dict.iterkeys(), map(unicode_type, id_dict.itervalues()))) # Set the values in the cache @@ -1039,7 +1039,7 @@ class ResultCache(SearchQueryParser): # {{{ db.initialize_template_cache() temp = db.conn.get('SELECT * FROM meta2') - self._data = list(itertools.repeat(None, temp[-1][0]+2)) if temp else [] + self._data = list(repeat(None, temp[-1][0]+2)) if temp else [] for r in temp: self._data[r[0]] = CacheRow(db, self.composites, r, self.series_col, self.series_sort_col) @@ -1099,7 +1099,7 @@ class ResultCache(SearchQueryParser): # {{{ if only_ids is None: self._map.sort(key=keyg) - tmap = list(itertools.repeat(False, len(self._data))) + tmap = list(repeat(False, len(self._data))) for x in self._map_filtered: tmap[x] = True self._map_filtered = [x for x in self._map if tmap[x]] diff --git a/src/calibre/srv/http_response.py b/src/calibre/srv/http_response.py index 4d51ea1e21..4873182849 100644 --- a/src/calibre/srv/http_response.py +++ b/src/calibre/srv/http_response.py @@ -9,7 +9,7 @@ __copyright__ = '2015, Kovid Goyal ' import os, httplib, hashlib, uuid, struct, repr as reprlib from collections import namedtuple from io import BytesIO, DEFAULT_BUFFER_SIZE -from itertools import chain, repeat, izip_longest +from itertools import chain, repeat from operator import itemgetter from functools import wraps @@ -32,11 +32,13 @@ MULTIPART_SEPARATOR = uuid.uuid4().hex.decode('ascii') COMPRESSIBLE_TYPES = {'application/json', 'application/javascript', 'application/xml', 'application/oebps-package+xml'} if is_py3: import zlib + from itertools import zip_longest else: zlib, zlib2_err = plugins['zlib2'] if zlib2_err: raise RuntimeError('Failed to load the zlib2 module with error: ' + zlib2_err) del zlib2_err + from itertools import izip_longest as zip_longest def header_list_to_file(buf): # {{{ @@ -709,7 +711,7 @@ class HTTPConnection(HTTPRequest): size = sum(map(len, range_parts)) + sum(r.size + 4 for r in ranges) outheaders.set('Content-Length', '%d' % size, replace_all=True) outheaders.set('Content-Type', 'multipart/byteranges; boundary=' + MULTIPART_SEPARATOR, replace_all=True) - output.ranges = izip_longest(ranges, range_parts) + output.ranges = zip_longest(ranges, range_parts) request.status_code = httplib.PARTIAL_CONTENT return output diff --git a/src/calibre/srv/opts.py b/src/calibre/srv/opts.py index 1216b06c6f..75d14ab56e 100644 --- a/src/calibre/srv/opts.py +++ b/src/calibre/srv/opts.py @@ -7,13 +7,17 @@ __license__ = 'GPL v3' __copyright__ = '2015, Kovid Goyal ' import errno, os, numbers -from itertools import izip_longest from collections import namedtuple, OrderedDict from operator import attrgetter from functools import partial from calibre.constants import config_dir from calibre.utils.lock import ExclusiveFile +from polyglot.builtins import is_py3 +if is_py3: + from itertools import zip_longest +else: + from itertools import izip_longest as zip_longest Option = namedtuple('Option', 'name default longdoc shortdoc choices') @@ -193,7 +197,7 @@ options = [] def grouper(n, iterable, fillvalue=None): "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx" args = [iter(iterable)] * n - return izip_longest(*args, fillvalue=fillvalue) + return zip_longest(*args, fillvalue=fillvalue) for shortdoc, name, default, doc in grouper(4, raw_options): diff --git a/src/calibre/srv/routes.py b/src/calibre/srv/routes.py index 23fadadd0f..aff8b42d10 100644 --- a/src/calibre/srv/routes.py +++ b/src/calibre/srv/routes.py @@ -7,13 +7,12 @@ __license__ = 'GPL v3' __copyright__ = '2015, Kovid Goyal ' import httplib, sys, inspect, re, time, numbers, json as jsonlib, textwrap -from itertools import izip from operator import attrgetter from calibre.srv.errors import HTTPSimpleResponse, HTTPNotFound, RouteError from calibre.srv.utils import http_date from calibre.utils.serialize import msgpack_dumps, json_dumps, MSGPACK_MIME -from polyglot.builtins import unicode_type, range +from polyglot.builtins import unicode_type, range, zip from polyglot.urllib import quote as urlquote default_methods = frozenset(('HEAD', 'GET')) @@ -171,7 +170,7 @@ class Route(object): def matches(self, path): args_map = self.defaults.copy() num = 0 - for component, (name, matched) in izip(path, self.matchers): + for component, (name, matched) in zip(path, self.matchers): num += 1 if matched is True: args_map[name] = component diff --git a/src/calibre/utils/fonts/sfnt/head.py b/src/calibre/utils/fonts/sfnt/head.py index f21bd0450e..82ace75472 100644 --- a/src/calibre/utils/fonts/sfnt/head.py +++ b/src/calibre/utils/fonts/sfnt/head.py @@ -7,11 +7,11 @@ __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' -from itertools import izip from struct import unpack_from, pack, calcsize from calibre.utils.fonts.sfnt import UnknownTable, DateTimeProperty, FixedProperty from calibre.utils.fonts.sfnt.errors import UnsupportedFont +from polyglot.builtins import zip class HeadTable(UnknownTable): @@ -47,7 +47,7 @@ class HeadTable(UnknownTable): self._fmt = ('>%s'%(''.join(field_types[1::2]))).encode('ascii') self._fields = field_types[0::2] - for f, val in izip(self._fields, unpack_from(self._fmt, self.raw)): + for f, val in zip(self._fields, unpack_from(self._fmt, self.raw)): setattr(self, f, val) def update(self): @@ -85,7 +85,7 @@ class HorizontalHeader(UnknownTable): self._fmt = ('>%s'%(''.join(field_types[1::2]))).encode('ascii') self._fields = field_types[0::2] - for f, val in izip(self._fields, unpack_from(self._fmt, self.raw)): + for f, val in zip(self._fields, unpack_from(self._fmt, self.raw)): setattr(self, f, val) raw = hmtx.raw @@ -149,7 +149,7 @@ class OS2Table(UnknownTable): self._fmt = ('>%s'%(''.join(field_types[1::2]))).encode('ascii') self._fields = field_types[0::2] - for f, val in izip(self._fields, unpack_from(self._fmt, self.raw)): + for f, val in zip(self._fields, unpack_from(self._fmt, self.raw)): setattr(self, f, val) def zero_fstype(self): @@ -168,4 +168,3 @@ class PostTable(UnknownTable): return (self._version, self._italic_angle, self.underline_position, self.underline_thickness) = unpack_from(b'>llhh', self.raw) - diff --git a/src/calibre/utils/fonts/sfnt/maxp.py b/src/calibre/utils/fonts/sfnt/maxp.py index 03c8b1793a..a52a7324cb 100644 --- a/src/calibre/utils/fonts/sfnt/maxp.py +++ b/src/calibre/utils/fonts/sfnt/maxp.py @@ -7,11 +7,11 @@ __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' -from itertools import izip from struct import unpack_from, pack from calibre.utils.fonts.sfnt import UnknownTable, FixedProperty from calibre.utils.fonts.sfnt.errors import UnsupportedFont +from polyglot.builtins import zip class MaxpTable(UnknownTable): @@ -39,12 +39,9 @@ class MaxpTable(UnknownTable): self._fmt = b'>lH' + b'H'*(len(self.fields)-2) vals = unpack_from(self._fmt, self.raw) - for f, val in izip(self.fields, vals): + for f, val in zip(self.fields, vals): setattr(self, f, val) def update(self): vals = [getattr(self, f) for f in self._fields] self.raw = pack(self._fmt, *vals) - - - diff --git a/src/calibre/utils/matcher.py b/src/calibre/utils/matcher.py index 091f736c51..4044fc3a13 100644 --- a/src/calibre/utils/matcher.py +++ b/src/calibre/utils/matcher.py @@ -13,8 +13,7 @@ from operator import itemgetter from collections import OrderedDict from itertools import islice -from itertools import izip -from polyglot.builtins import map, unicode_type, range +from polyglot.builtins import map, unicode_type, range, zip from calibre import detect_ncpus as cpu_count, as_unicode from calibre.constants import plugins, filesystem_encoding @@ -270,7 +269,7 @@ class CScorer(object): def __call__(self, query): scores, positions = self.m.calculate_scores(query) - for score, pos in izip(scores, positions): + for score, pos in zip(scores, positions): yield score, pos diff --git a/src/calibre/utils/terminal.py b/src/calibre/utils/terminal.py index b4a28420d2..3bf421dfdc 100644 --- a/src/calibre/utils/terminal.py +++ b/src/calibre/utils/terminal.py @@ -8,10 +8,9 @@ __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' import os, sys, re -from itertools import izip from calibre.constants import iswindows -from polyglot.builtins import range +from polyglot.builtins import range, zip if iswindows: import ctypes.wintypes @@ -31,7 +30,7 @@ def fmt(code): RATTRIBUTES = dict( - izip(range(1, 9), ( + zip(range(1, 9), ( 'bold', 'dark', '', @@ -46,7 +45,7 @@ ATTRIBUTES = {v:fmt(k) for k, v in RATTRIBUTES.iteritems()} del ATTRIBUTES[''] RBACKGROUNDS = dict( - izip(range(41, 48), ( + zip(range(41, 48), ( 'red', 'green', 'yellow', @@ -59,7 +58,7 @@ RBACKGROUNDS = dict( BACKGROUNDS = {v:fmt(k) for k, v in RBACKGROUNDS.iteritems()} RCOLORS = dict( - izip(range(31, 38), ( + zip(range(31, 38), ( 'red', 'green', 'yellow', From d66fdc2df71b7aec056ac3707c1a6406cbefafa3 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 21 Mar 2019 01:20:29 -0400 Subject: [PATCH 0376/2613] autopep8 --- setup/resources.py | 8 ++++---- src/calibre/ebooks/lit/writer.py | 3 +-- src/calibre/ebooks/mobi/debug/mobi8.py | 16 ++++++++-------- src/calibre/gui2/tweak_book/widgets.py | 6 +++--- src/calibre/utils/serve_coffee.py | 10 +++++----- src/calibre/utils/terminal.py | 4 ++-- 6 files changed, 23 insertions(+), 24 deletions(-) diff --git a/setup/resources.py b/setup/resources.py index 6fc5cf92e5..a859735148 100644 --- a/setup/resources.py +++ b/setup/resources.py @@ -90,12 +90,12 @@ class Coffee(Command): # {{{ updated = {} for arcname in todo: name = arcname.rpartition('.')[0] - print ('\t%sCompiling %s'%(time.strftime('[%H:%M:%S] ') if + print('\t%sCompiling %s'%(time.strftime('[%H:%M:%S] ') if timestamp else '', name)) src, sig = src_files[arcname] js, errors = compile_coffeescript(open(src, 'rb').read(), filename=src) if errors: - print ('\n\tCompilation of %s failed'%name) + print('\n\tCompilation of %s failed'%name) for line in errors: print(line, file=sys.stderr) if ignore_errors: @@ -105,8 +105,8 @@ class Coffee(Command): # {{{ else: if opts.show_js: self.show_js(js) - print ('#'*80) - print ('#'*80) + print('#'*80) + print('#'*80) zi = zipfile.ZipInfo() zi.filename = arcname zi.date_time = time.localtime()[:6] diff --git a/src/calibre/ebooks/lit/writer.py b/src/calibre/ebooks/lit/writer.py index eeef5e675e..fd292f4a03 100644 --- a/src/calibre/ebooks/lit/writer.py +++ b/src/calibre/ebooks/lit/writer.py @@ -510,8 +510,7 @@ class LitWriter(object): data.write(pack(' Date: Thu, 21 Mar 2019 18:33:19 +0530 Subject: [PATCH 0377/2613] Various fixes for the latest py3 commit --- setup/gui.py | 4 +++- setup/resources.py | 12 ++++++------ src/calibre/ebooks/metadata/__init__.py | 2 +- src/calibre/gui2/__init__.py | 14 +++++++++++--- src/calibre/library/caches.py | 2 +- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/setup/gui.py b/setup/gui.py index 4b6a86126e..ac08e3c0fc 100644 --- a/setup/gui.py +++ b/setup/gui.py @@ -58,7 +58,9 @@ class GUI(Command): for s in sources: files.append('%s'%s) manifest = '\n\n%s\n\n'%'\n'.join(sorted(files)) - with open('images.qrc', 'w') as f: + if not isinstance(manifest, bytes): + manifest = manifest.encode('utf-8') + with open('images.qrc', 'wb') as f: f.write(manifest) finally: os.chdir(cwd) diff --git a/setup/resources.py b/setup/resources.py index a859735148..7f9fc7e1db 100644 --- a/setup/resources.py +++ b/setup/resources.py @@ -145,7 +145,7 @@ class Kakasi(Command): # {{{ if self.newer(dest, src): self.info('\tGenerating Kanwadict') - for line in open(src, "r"): + for line in open(src, "rb"): self.parsekdict(line) self.kanwaout(dest) @@ -167,8 +167,8 @@ class Kakasi(Command): # {{{ def mkitaiji(self, src, dst): dic = {} - for line in open(src, "r"): - line = line.strip() + for line in open(src, "rb"): + line = line.decode('utf-8').strip() if line.startswith(';;'): # skip comment continue if re.match(r"^$",line): @@ -181,8 +181,8 @@ class Kakasi(Command): # {{{ def mkkanadict(self, src, dst): dic = {} - for line in open(src, "r"): - line = line.strip() + for line in open(src, "rb"): + line = line.decode('utf-8').strip() if line.startswith(';;'): # skip comment continue if re.match(r"^$",line): @@ -194,7 +194,7 @@ class Kakasi(Command): # {{{ f.write(msgpack_dumps(dic)) def parsekdict(self, line): - line = line.strip() + line = line.decode('utf-8').strip() if line.startswith(';;'): # skip comment return (yomi, kanji) = line.split(' ') diff --git a/src/calibre/ebooks/metadata/__init__.py b/src/calibre/ebooks/metadata/__init__.py index ba6bf15571..cd32c04ce6 100644 --- a/src/calibre/ebooks/metadata/__init__.py +++ b/src/calibre/ebooks/metadata/__init__.py @@ -11,7 +11,7 @@ import os, sys, re from calibre import relpath, guess_type, remove_bracketed_text, prints, force_unicode from calibre.utils.config_base import tweaks -from polyglot.builtins import codepoint_to_chr, unicode_type +from polyglot.builtins import codepoint_to_chr, unicode_type, range from polyglot.urllib import quote, unquote, urlparse diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 1f5325d8d5..800c6df572 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -1283,12 +1283,19 @@ def build_forms(srcdir, info=None, summary=False, check_for_migration=False): # the qt5 migration force_compile = check_for_migration and not gprefs.get('migrated_forms_to_qt5', False) + class PolyglotStringIO(io.StringIO): + + def write(self, x): + if isinstance(x, bytes): + x = x.decode('utf-8') + io.StringIO.write(self, x) + for form in forms: compiled_form = form_to_compiled_form(form) if force_compile or not os.path.exists(compiled_form) or os.stat(form).st_mtime > os.stat(compiled_form).st_mtime: if not summary: info('\tCompiling form', form) - buf = io.StringIO() + buf = PolyglotStringIO() compileUi(form, buf) dat = buf.getvalue() dat = dat.replace('import images_rc', '') @@ -1297,8 +1304,9 @@ def build_forms(srcdir, info=None, summary=False, check_for_migration=False): dat = dat.replace('_("MMM yyyy")', '"MMM yyyy"') dat = dat.replace('_("d MMM yyyy")', '"d MMM yyyy"') dat = pat.sub(sub, dat) - - open(compiled_form, 'w').write(dat) + if not isinstance(dat, bytes): + dat = dat.encode('utf-8') + open(compiled_form, 'wb').write(dat) num += 1 if num: info('Compiled %d forms' % num) diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py index 07aa609ae7..16eb2698ce 100644 --- a/src/calibre/library/caches.py +++ b/src/calibre/library/caches.py @@ -1000,7 +1000,7 @@ class ResultCache(SearchQueryParser): # {{{ except IndexError: return None try: - return map(self.row, ids) + return list(map(self.row, ids)) except ValueError: pass return None From df0e052c08275d8c5cd6229613223d4ae8f3de2b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 21 Mar 2019 20:33:52 +0530 Subject: [PATCH 0378/2613] Update 1843 --- recipes/1843.recipe | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/recipes/1843.recipe b/recipes/1843.recipe index bbff61247c..88dedbc825 100644 --- a/recipes/1843.recipe +++ b/recipes/1843.recipe @@ -21,11 +21,47 @@ class E1843(BasicNewsRecipe): remove_javascript = True oldest_article = 365 encoding = 'utf-8' - feeds = [ - 'https://www.1843magazine.com/rss/content', - ] + + # feeds = [ + # 'https://www.1843magazine.com/rss/content', + # ] keep_only_tags = [ dict(name='h1', attrs={'class': lambda x: x and 'title' in x.split()}), classes('field-name-field-rubric-summary article-header__overlay-main-image meta-info__author article__body'), ] + + def parse_index(self): + soup = self.index_to_soup('https://www.1843magazine.com') + a = soup.find(text='Print edition').parent + soup = self.index_to_soup(a['href']) + h1 = soup.find(**classes('cover-image__main')) + self.timefmt = ' [%s]' % self.tag_to_string(h1) + img = soup.find(**classes('cover-image__image')).find('img') + self.cover_url = img['src'] + + ans = [] + current_section = articles = None + + for div in soup.findAll(**classes('field-name-field-header node-article')): + if 'field-header' in div['class']: + if current_section and articles: + ans.append((current_section, articles)) + current_section = self.tag_to_string(div) + self.log(current_section) + articles = [] + else: + a = div.find('a', href=True) + title = self.tag_to_string(a) + url = a['href'] + self.log('\t', title, ' at ', url) + desc = '' + r = div.find(**classes('article-rubric')) + if r is not None: + desc = self.tag_to_string(r) + articles.append( + {'title': title, 'url': url, 'description': desc}) + + if current_section and articles: + ans.append((current_section, articles)) + return ans From 3c86c9be6f6c6a0f188cd8156bffc5909b895c2b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 21 Mar 2019 20:40:28 +0530 Subject: [PATCH 0379/2613] pep8 --- src/calibre/gui2/store/stores/smashwords_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/store/stores/smashwords_plugin.py b/src/calibre/gui2/store/stores/smashwords_plugin.py index 6d97da40ea..753af70569 100644 --- a/src/calibre/gui2/store/stores/smashwords_plugin.py +++ b/src/calibre/gui2/store/stores/smashwords_plugin.py @@ -57,7 +57,7 @@ def search(query, max_results=10, timeout=60): if 'Price:' in price: try: price = price.partition('Price:')[2] - price = re.sub('\s', ' ', price).strip() + price = re.sub(r'\s', ' ', price).strip() price = price.split(' ')[0].strip() except Exception: price = 'Unknown' From 5755625d1eda11cba7d742c6fa994627bfb1d0d1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 22 Mar 2019 23:47:21 +0530 Subject: [PATCH 0380/2613] Get rid of has_key from all recipes --- manual/news.rst | 4 ++-- recipes/20minutos.recipe | 5 ++-- recipes/ajc.recipe | 2 +- recipes/animal_politico.recipe | 6 ++--- recipes/ba_herald.recipe | 4 ++-- recipes/benchmark_pl.recipe | 4 ++-- recipes/bighollywood.recipe | 5 ++-- recipes/business_insider.recipe | 5 ++-- recipes/calgary_herald.recipe | 4 ++-- recipes/cd_action.recipe | 4 ++-- recipes/chr_mon.recipe | 5 +--- recipes/cinebel_be.recipe | 7 +++--- recipes/cio_magazine.recipe | 4 ++-- recipes/cnd.recipe | 2 +- recipes/cnd_weekly.recipe | 2 +- recipes/cosmopolitan.recipe | 4 ++-- recipes/cubadebate.recipe | 5 ++-- recipes/dailytportal.recipe | 5 ++-- recipes/degentenaar.recipe | 2 +- recipes/deutsche_welle_bs.recipe | 4 ++-- recipes/deutsche_welle_hr.recipe | 4 ++-- recipes/deutsche_welle_pt.recipe | 4 ++-- recipes/deutsche_welle_sr.recipe | 4 ++-- recipes/dnevnik_cro.recipe | 4 ++-- recipes/dobanevinosti.recipe | 5 ++-- recipes/dobreprogamy.recipe | 4 ++-- recipes/dzieje_pl.recipe | 4 ++-- recipes/edmonton_journal.recipe | 4 ++-- recipes/el_diplo.recipe | 4 ++-- recipes/elclubdelebook.recipe | 5 ++-- recipes/elpais_semanal.recipe | 15 ++++++------ recipes/eluniversalimpresa.recipe | 6 ++--- recipes/espn.recipe | 4 ++-- recipes/estadao.recipe | 2 +- recipes/financialsense.recipe | 5 ++-- recipes/freeway.recipe | 4 ++-- recipes/gameplay_pl.recipe | 4 ++-- recipes/geek_poke.recipe | 2 +- recipes/gildia_pl.recipe | 4 ++-- recipes/gram_pl.recipe | 4 ++-- recipes/in4_pl.recipe | 4 ++-- recipes/infra_pl.recipe | 4 ++-- recipes/jutarnji.recipe | 4 ++-- recipes/klip_me.recipe | 2 +- recipes/lemonde_dip.recipe | 17 +++++++------- recipes/lenta_ru.recipe | 11 +++------ recipes/lrb_payed.recipe | 6 ++--- recipes/metro_news_nl.recipe | 2 +- recipes/moneycontrol.recipe | 9 ++++--- recipes/montreal_gazette.recipe | 4 ++-- recipes/naszdziennik.recipe | 2 +- recipes/ncrnext.recipe | 4 ++-- recipes/newsweek_polska.recipe | 5 ++-- recipes/novosti.recipe | 5 ++-- recipes/nsfw_corp.recipe | 4 ++-- recipes/nspm.recipe | 5 ++-- recipes/ottawa_citizen.recipe | 4 ++-- recipes/pobjeda.recipe | 4 ++-- recipes/politika.recipe | 7 +++--- recipes/polityka.recipe | 2 +- recipes/regina_leader_post.recipe | 6 ++--- recipes/republika.recipe | 4 ++-- recipes/saskatoon_star_phoenix.recipe | 6 ++--- recipes/scprint.recipe | 4 ++-- recipes/sueddeutsche_mobil.recipe | 6 ++--- recipes/techcrunch.recipe | 5 ++-- recipes/the_age.recipe | 4 ++-- recipes/thedgesingapore.recipe | 4 ++-- recipes/theonion.recipe | 4 ++-- recipes/tomshardware.recipe | 4 ++-- recipes/twitchfilms.recipe | 5 ++-- recipes/vancouver_province.recipe | 4 ++-- recipes/vancouver_sun.recipe | 4 ++-- recipes/variety.recipe | 5 ++-- recipes/vedomosti.recipe | 34 +++++++++++++++------------ recipes/wapo_cartoons.recipe | 9 +++---- recipes/wenxuecity-znjy.recipe | 4 ++-- recipes/windows_star.recipe | 4 ++-- recipes/windsor_star.recipe | 8 +++---- recipes/zaobao.recipe | 13 +++++----- 80 files changed, 196 insertions(+), 221 deletions(-) diff --git a/manual/news.rst b/manual/news.rst index 1ea813f20a..a0c80defdf 100644 --- a/manual/news.rst +++ b/manual/news.rst @@ -217,7 +217,7 @@ A reasonably complex real life example that exposes more of the :term:`API` of ` description = self.tag_to_string(summary, use_alt=False) feed = key if key is not None else 'Uncategorized' - if not articles.has_key(feed): + if feed not in articles: articles[feed] = [] if not 'podcasts' in url: articles[feed].append( @@ -225,7 +225,7 @@ A reasonably complex real life example that exposes more of the :term:`API` of ` description=description, content='')) ans = self.sort_index_by(ans, {'The Front Page':-1, 'Dining In, Dining Out':1, 'Obituaries':2}) - ans = [(key, articles[key]) for key in ans if articles.has_key(key)] + ans = [(key, articles[key]) for key in ans if key in articles] return ans def preprocess_html(self, soup): diff --git a/recipes/20minutos.recipe b/recipes/20minutos.recipe index 725278c045..e40fc174fa 100644 --- a/recipes/20minutos.recipe +++ b/recipes/20minutos.recipe @@ -60,7 +60,6 @@ class t20Minutos(BasicNewsRecipe): else: str = self.tag_to_string(item) item.replaceWith(str) - for item in soup.findAll('img'): - if not item.has_key('alt'): # noqa - item['alt'] = 'image' + for item in soup.findAll('img', alt=False): + item['alt'] = 'image' return soup diff --git a/recipes/ajc.recipe b/recipes/ajc.recipe index f27a2fc8e1..0b884373b7 100644 --- a/recipes/ajc.recipe +++ b/recipes/ajc.recipe @@ -112,7 +112,7 @@ class AdvancedUserRecipe1282101454(BasicNewsRecipe): for div in soup.findAll('div', attrs={'class': re.compile(self.author_reg_exp, re.IGNORECASE)}): div.extract() for auth in div.findAll('a'): - if (auth.has_key('class') and auth['class'] == 'cm-source-image'): # noqa + if auth.get('class') == 'cm-source-image': continue names = names + comma + auth.contents[0] comma = ', ' diff --git a/recipes/animal_politico.recipe b/recipes/animal_politico.recipe index adbd6d7b3a..61674548c6 100644 --- a/recipes/animal_politico.recipe +++ b/recipes/animal_politico.recipe @@ -25,7 +25,7 @@ class AdvancedUserRecipe1290663986(BasicNewsRecipe): def generic_parse(self, soup): articles = [] # soup.findAll('li', 'hentry'): - for entry in soup.findAll(lambda tag: tag.name == 'li' and tag.has_key('class') and tag['class'].find('hentry') != -1): # noqa + for entry in soup.findAll('li', attrs={'class': lambda x: x and 'hentry' in x}): article_url = entry.a['href'] + '?print=yes' article_title = entry.find('h3', 'entry-title') article_title = self.tag_to_string(article_title) @@ -48,7 +48,7 @@ class AdvancedUserRecipe1290663986(BasicNewsRecipe): def plumaje_parse(self, soup): articles = [] - blogs_soup = soup.find(lambda tag: tag.name == 'ul' and tag.has_key('class') and tag['class'].find('bloglist-fecha') != -1) # noqa + blogs_soup = soup.find('ul', attrs={'class': lambda x: x and 'bloglist-fecha' in x}) for entry in blogs_soup.findAll('li'): article_title = entry.p article_url = article_title.a['href'] + '?print=yes' @@ -69,7 +69,7 @@ class AdvancedUserRecipe1290663986(BasicNewsRecipe): def boca_parse(self, soup): articles = [] # soup.findAll('li', 'hentry'): - for entry in soup.findAll(lambda tag: tag.name == 'div' and tag.has_key('class') and tag['class'].find('hentry') != -1): # noqa + for entry in soup.findAll('div', attrs={'class': lambda x: x and 'hentry' in x}): article_title = entry.find('h2', 'entry-title') article_url = article_title.a['href'] + '?print=yes' article_title = self.tag_to_string(article_title) diff --git a/recipes/ba_herald.recipe b/recipes/ba_herald.recipe index f8e2272d80..91cac54aa8 100644 --- a/recipes/ba_herald.recipe +++ b/recipes/ba_herald.recipe @@ -62,8 +62,8 @@ class BuenosAiresHerald(BasicNewsRecipe): soup = self.index_to_soup(feedurl) for item in soup.findAll('div', attrs={'class': 'nota_texto_seccion'}): description = self.tag_to_string(item.h2) - atag = item.h2.find('a') - if atag and atag.has_key('href'): # noqa + atag = item.h2.find('a', href=True) + if atag is not None: url = self.INDEX + atag['href'] title = description date = strftime(self.timefmt) diff --git a/recipes/benchmark_pl.recipe b/recipes/benchmark_pl.recipe index 6433742978..83b1b465c9 100644 --- a/recipes/benchmark_pl.recipe +++ b/recipes/benchmark_pl.recipe @@ -50,8 +50,8 @@ class BenchmarkPl(BasicNewsRecipe): def preprocess_html(self, soup): self.append_page(soup, soup.body) - for a in soup('a'): - if a.has_key('href') and not a['href'].startswith('http'): # noqa + for a in soup.findAll('a', href=True): + if not a['href'].startswith('http'): a['href'] = self.INDEX + a['href'] for r in soup.findAll(attrs={'class': ['comments', 'body']}): r.extract() diff --git a/recipes/bighollywood.recipe b/recipes/bighollywood.recipe index 43d30795b5..0f0c06760d 100644 --- a/recipes/bighollywood.recipe +++ b/recipes/bighollywood.recipe @@ -55,7 +55,6 @@ class BigHollywood(BasicNewsRecipe): else: str = self.tag_to_string(item) item.replaceWith(str) - for item in soup.findAll('img'): - if not item.has_key('alt'): # noqa - item['alt'] = 'image' + for item in soup.findAll('img', alt=False): + item['alt'] = 'image' return soup diff --git a/recipes/business_insider.recipe b/recipes/business_insider.recipe index 0720600496..d04913ea17 100644 --- a/recipes/business_insider.recipe +++ b/recipes/business_insider.recipe @@ -59,7 +59,6 @@ class Business_insider(BasicNewsRecipe): if item.string is not None: tstr = item.string item.replaceWith(tstr) - for item in soup.findAll('img'): - if not item.has_key('alt'): # noqa - item['alt'] = 'image' + for item in soup.findAll('img', alt=False): + item['alt'] = 'image' return soup diff --git a/recipes/calgary_herald.recipe b/recipes/calgary_herald.recipe index 02bd202987..d3c4e9d554 100644 --- a/recipes/calgary_herald.recipe +++ b/recipes/calgary_herald.recipe @@ -286,7 +286,7 @@ class CanWestPaper(BasicNewsRecipe): else: description = self.tag_to_string(dtag, False) print("DESCRIPTION: " + description) - if not articles.has_key(key): # noqa + if key not in articles: articles[key] = [] articles[key].append(dict( title=title, url=url, date='', description=description, author='', content='')) @@ -310,5 +310,5 @@ class CanWestPaper(BasicNewsRecipe): for (k, url) in self.postmedia_index_pages: parse_web_index(k, url) - ans = [(key, articles[key]) for key in ans if articles.has_key(key)] # noqa + ans = [(key, articles[key]) for key in ans if key in articles] return ans diff --git a/recipes/cd_action.recipe b/recipes/cd_action.recipe index fd1e7862c2..4d132a8830 100644 --- a/recipes/cd_action.recipe +++ b/recipes/cd_action.recipe @@ -22,7 +22,7 @@ class CD_Action(BasicNewsRecipe): return getattr(self, 'cover_url', self.cover_url) def preprocess_html(self, soup): - for a in soup('a'): - if a.has_key('href') and 'http://' not in a['href'] and 'https://' not in a['href']: # noqa + for a in soup.findAll('a', href=True): + if 'http://' not in a['href'] and 'https://' not in a['href']: a['href'] = self.index + a['href'] return soup diff --git a/recipes/chr_mon.recipe b/recipes/chr_mon.recipe index d2c4519e9f..3ffa429b9a 100644 --- a/recipes/chr_mon.recipe +++ b/recipes/chr_mon.recipe @@ -101,10 +101,7 @@ class CSMonitor(BasicNewsRecipe): else: str = self.tag_to_string(item) item.replaceWith(str) - for item in soup.findAll('img'): + for item in soup.findAll('img', src=True): if 'scorecardresearch' in item['src']: item.extract() - else: - if not item.has_key('alt'): # noqa - item['alt'] = 'image' return soup diff --git a/recipes/cinebel_be.recipe b/recipes/cinebel_be.recipe index 74d5ac1a47..56f8b4d8f0 100644 --- a/recipes/cinebel_be.recipe +++ b/recipes/cinebel_be.recipe @@ -36,10 +36,9 @@ class Cinebel(BasicNewsRecipe): ] def preprocess_html(self, soup): - for alink in soup.findAll('a'): - if alink.has_key('href'): # noqa - tstr = "Site officiel: " + alink['href'] - alink.replaceWith(tstr) + for alink in soup.findAll('a', href=True): + tstr = "Site officiel: " + alink['href'] + alink.replaceWith(tstr) return soup def get_cover_url(self): diff --git a/recipes/cio_magazine.recipe b/recipes/cio_magazine.recipe index 5e8c9b39b2..e2c04f7e0c 100644 --- a/recipes/cio_magazine.recipe +++ b/recipes/cio_magazine.recipe @@ -131,12 +131,12 @@ class CIO_Magazine(BasicNewsRecipe): # Esto esta copiado del NY times feed = key if key is not None else 'Uncategorized' - if not articles.has_key(feed): # noqa + if feed not in articles: articles[feed] = [] if 'podcasts' not in url: articles[feed].append( dict(title=title, url=url, date=pubdate, description=description, content='')) - feeds = [(k, articles[k]) for k in feeds if articles.has_key(k)] # noqa + feeds = [(k, articles[k]) for k in feeds if k in articles] return feeds diff --git a/recipes/cnd.recipe b/recipes/cnd.recipe index 0f8e70ca35..320f355e01 100644 --- a/recipes/cnd.recipe +++ b/recipes/cnd.recipe @@ -54,7 +54,7 @@ class TheCND(BasicNewsRecipe): if re.search('cm', date): continue if (date is not None) and len(date) > 2: - if not articles.has_key(date): # noqa + if date not in articles: articles[date] = [] articles[date].append( {'title': title, 'url': url, 'description': '', 'date': ''}) diff --git a/recipes/cnd_weekly.recipe b/recipes/cnd_weekly.recipe index ae748c2e76..7566ec9548 100644 --- a/recipes/cnd_weekly.recipe +++ b/recipes/cnd_weekly.recipe @@ -54,7 +54,7 @@ class TheCND(BasicNewsRecipe): continue self.log('\tFound article: ', title, 'at', url, '@', date) if (date is not None) and len(date) > 2: - if not articles.has_key(date): # noqa + if date not in articles: articles[date] = [] articles[date].append( {'title': title, 'url': url, 'description': '', 'date': ''}) diff --git a/recipes/cosmopolitan.recipe b/recipes/cosmopolitan.recipe index 9b84088764..ab31ab88bb 100644 --- a/recipes/cosmopolitan.recipe +++ b/recipes/cosmopolitan.recipe @@ -53,8 +53,8 @@ class General(BasicNewsRecipe): for item in soup.body.findAll(name=['table', 'td', 'tr', 'th', 'caption', 'thead', 'tfoot', 'tbody', 'colgroup', 'col']): item.name = 'div' for attrib in attribs: - if item.has_key(attrib): # noqa - del item[attrib] + item[attrib] = '' + del item[attrib] return soup def get_cover_url(self): diff --git a/recipes/cubadebate.recipe b/recipes/cubadebate.recipe index 2ab9c79c8b..ea87b6688c 100644 --- a/recipes/cubadebate.recipe +++ b/recipes/cubadebate.recipe @@ -46,7 +46,6 @@ class CubaDebate(BasicNewsRecipe): def preprocess_html(self, soup): for item in soup.findAll(style=True): del item['style'] - for item in soup.findAll('img'): - if not item.has_key('alt'): # noqa - item['alt'] = 'image' + for item in soup.findAll('img', alt=False): + item['alt'] = 'image' return soup diff --git a/recipes/dailytportal.recipe b/recipes/dailytportal.recipe index 37b749f8fa..00deb4c1db 100644 --- a/recipes/dailytportal.recipe +++ b/recipes/dailytportal.recipe @@ -57,7 +57,6 @@ class Pagina12(BasicNewsRecipe): else: str = self.tag_to_string(item) item.replaceWith(str) - for item in soup.findAll('img'): - if not item.has_key('alt'): # noqa - item['alt'] = 'image' + for item in soup.findAll('img', alt=False): + item['alt'] = 'image' return soup diff --git a/recipes/degentenaar.recipe b/recipes/degentenaar.recipe index 6b6c52bef0..2c08ee7859 100644 --- a/recipes/degentenaar.recipe +++ b/recipes/degentenaar.recipe @@ -64,7 +64,7 @@ class DeGentenaarOnline(BasicNewsRecipe): del item['style'] for item in soup.findAll('span'): item.name = 'div' - if item.has_key('id') and item['id'] == 'lblArticleTitle': # noqa + if item.get('id') == 'lblArticleTitle': item.name = 'h3' soup.html['lang'] = self.lang diff --git a/recipes/deutsche_welle_bs.recipe b/recipes/deutsche_welle_bs.recipe index 72a3761219..0b852c94c8 100644 --- a/recipes/deutsche_welle_bs.recipe +++ b/recipes/deutsche_welle_bs.recipe @@ -65,8 +65,8 @@ class DeutscheWelle_bs(BasicNewsRecipe): if limg: item.name = 'div' del item['href'] - if item.has_key('target'): # noqa - del item['target'] + item['target'] = '' + del item['target'] else: str = self.tag_to_string(item) item.replaceWith(str) diff --git a/recipes/deutsche_welle_hr.recipe b/recipes/deutsche_welle_hr.recipe index 1c1427a8e4..906e4a1d39 100644 --- a/recipes/deutsche_welle_hr.recipe +++ b/recipes/deutsche_welle_hr.recipe @@ -63,8 +63,8 @@ class DeutscheWelle_hr(BasicNewsRecipe): if limg: item.name = 'div' del item['href'] - if item.has_key('target'): # noqa - del item['target'] + item['target'] = '' + del item['target'] else: str = self.tag_to_string(item) item.replaceWith(str) diff --git a/recipes/deutsche_welle_pt.recipe b/recipes/deutsche_welle_pt.recipe index 1fca72963b..4b9a9ea9dc 100644 --- a/recipes/deutsche_welle_pt.recipe +++ b/recipes/deutsche_welle_pt.recipe @@ -54,8 +54,8 @@ class DeutscheWelle_pt(BasicNewsRecipe): if limg: item.name = 'div' del item['href'] - if item.has_key('target'): # noqa - del item['target'] + item['target'] = '' + del item['target'] else: str = self.tag_to_string(item) item.replaceWith(str) diff --git a/recipes/deutsche_welle_sr.recipe b/recipes/deutsche_welle_sr.recipe index 3ea1a2a10f..b9c67e4976 100644 --- a/recipes/deutsche_welle_sr.recipe +++ b/recipes/deutsche_welle_sr.recipe @@ -68,8 +68,8 @@ class DeutscheWelle_sr(BasicNewsRecipe): if limg: item.name = 'div' del item['href'] - if item.has_key('target'): # noqa - del item['target'] + item['target'] = '' + del item['target'] else: str = self.tag_to_string(item) item.replaceWith(str) diff --git a/recipes/dnevnik_cro.recipe b/recipes/dnevnik_cro.recipe index 9060a9185c..02f4a3bcd8 100644 --- a/recipes/dnevnik_cro.recipe +++ b/recipes/dnevnik_cro.recipe @@ -55,8 +55,8 @@ class DnevnikCro(BasicNewsRecipe): for item in soup.body.findAll(name=['table', 'td', 'tr', 'th', 'caption', 'thead', 'tfoot', 'tbody', 'colgroup', 'col']): item.name = 'div' for attrib in attribs: - if item.has_key(attrib): # noqa - del item[attrib] + item[attrib] = '' + del item[attrib] mlang = Tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) diff --git a/recipes/dobanevinosti.recipe b/recipes/dobanevinosti.recipe index 242edabf46..90cbc5866c 100644 --- a/recipes/dobanevinosti.recipe +++ b/recipes/dobanevinosti.recipe @@ -37,7 +37,6 @@ class DobaNevinosti(BasicNewsRecipe): def preprocess_html(self, soup): for item in soup.findAll(style=True): del item['style'] - for item in soup.findAll('img'): - if not item.has_key('alt'): # noqa - item['alt'] = 'image' + for item in soup.findAll('img', alt=False): + item['alt'] = 'image' return soup diff --git a/recipes/dobreprogamy.recipe b/recipes/dobreprogamy.recipe index 878ceb57c3..c97d9c0e8f 100644 --- a/recipes/dobreprogamy.recipe +++ b/recipes/dobreprogamy.recipe @@ -28,8 +28,8 @@ class Dobreprogramy_pl(BasicNewsRecipe): ('Blogi', 'http://feeds.feedburner.com/dobreprogramy/BlogCzytelnikow')] def preprocess_html(self, soup): - for a in soup('a'): - if a.has_key('href') and 'http://' not in a['href'] and 'https://' not in a['href']: # noqa + for a in soup('a', href=True): + if 'http://' not in a['href'] and 'https://' not in a['href']: a['href'] = self.index + a['href'] for r in soup.findAll('iframe'): r.parent.extract() diff --git a/recipes/dzieje_pl.recipe b/recipes/dzieje_pl.recipe index 7a2e9284a6..57d243bd74 100644 --- a/recipes/dzieje_pl.recipe +++ b/recipes/dzieje_pl.recipe @@ -81,8 +81,8 @@ class Dzieje(BasicNewsRecipe): return feeds def preprocess_html(self, soup): - for a in soup('a'): - if a.has_key('href') and not a['href'].startswith('http'): # noqa + for a in soup('a', href=True): + if not a['href'].startswith('http'): a['href'] = self.index + a['href'] self.append_page(soup, soup.body) return soup diff --git a/recipes/edmonton_journal.recipe b/recipes/edmonton_journal.recipe index e8e6ad5a87..9e7ae425bf 100644 --- a/recipes/edmonton_journal.recipe +++ b/recipes/edmonton_journal.recipe @@ -286,7 +286,7 @@ class CanWestPaper(BasicNewsRecipe): else: description = self.tag_to_string(dtag, False) print("DESCRIPTION: " + description) - if not articles.has_key(key): # noqa + if key not in articles: articles[key] = [] articles[key].append(dict( title=title, url=url, date='', description=description, author='', content='')) @@ -310,5 +310,5 @@ class CanWestPaper(BasicNewsRecipe): for (k, url) in self.postmedia_index_pages: parse_web_index(k, url) - ans = [(key, articles[key]) for key in ans if articles.has_key(key)] # noqa + ans = [(key, articles[key]) for key in ans if key in articles] return ans diff --git a/recipes/el_diplo.recipe b/recipes/el_diplo.recipe index 119e010eb9..d9fbe755a8 100644 --- a/recipes/el_diplo.recipe +++ b/recipes/el_diplo.recipe @@ -113,11 +113,11 @@ class ElDiplo_Recipe(BasicNewsRecipe): if aut: auth = self.tag_to_string(aut, use_alt=False).strip() - if not articles.has_key(section): # noqa + if section not in articles: # noqa articles[section] = [] articles[section].append(dict( title=title, author=auth, url=url, date=None, description=description, content='')) - ans = [(s, articles[s]) for s in ans if articles.has_key(s)] # noqa + ans = [(s, articles[s]) for s in ans if s in articles] return ans diff --git a/recipes/elclubdelebook.recipe b/recipes/elclubdelebook.recipe index 47a7043b3a..f186140210 100644 --- a/recipes/elclubdelebook.recipe +++ b/recipes/elclubdelebook.recipe @@ -53,7 +53,6 @@ class ElClubDelEbook(BasicNewsRecipe): else: str = self.tag_to_string(item) item.replaceWith(str) - for item in soup.findAll('img'): - if not item.has_key('alt'): # noqa - item['alt'] = 'image' + for item in soup.findAll('img', alt=False): + item['alt'] = 'image' return soup diff --git a/recipes/elpais_semanal.recipe b/recipes/elpais_semanal.recipe index 1a607b4858..69a0a0fb42 100644 --- a/recipes/elpais_semanal.recipe +++ b/recipes/elpais_semanal.recipe @@ -35,17 +35,16 @@ class ElPaisSemanal(BasicNewsRecipe): def parse_index(self): articles = [] soup = self.index_to_soup(self.index) - for item in soup.findAll('a', attrs={'class': ['g19i003', 'g17r003', 'g17i003']}): + for item in soup.findAll('a', attrs={'class': ['g19i003', 'g17r003', 'g17i003']}, href=True): description = '' title_prefix = '' feed_link = item - if item.has_key('href'): # noqa - url = 'http://www.elpais.com' + item['href'].rpartition('/')[0] - title = title_prefix + self.tag_to_string(feed_link) - date = strftime(self.timefmt) - articles.append({ - 'title': title, 'date': date, 'url': url, 'description': description - }) + url = 'http://www.elpais.com' + item['href'].rpartition('/')[0] + title = title_prefix + self.tag_to_string(feed_link) + date = strftime(self.timefmt) + articles.append({ + 'title': title, 'date': date, 'url': url, 'description': description + }) return [(soup.head.title.string, articles)] def print_version(self, url): diff --git a/recipes/eluniversalimpresa.recipe b/recipes/eluniversalimpresa.recipe index e0cf058494..331da13a86 100644 --- a/recipes/eluniversalimpresa.recipe +++ b/recipes/eluniversalimpresa.recipe @@ -31,7 +31,7 @@ class ElUniversalImpresaRecipe(BasicNewsRecipe): table = soup.find('table', attrs={'width': '500'}) articles = [] - for td in table.findAll(lambda tag: tag.name == 'td' and tag.has_key('class') and tag['class'] == 'arnegro12'): # noqa + for td in table.findAll('td', attrs={'class': 'arnegro12'}): a = td.a a.extract() title = self.tag_to_string(a) @@ -79,8 +79,8 @@ class ElUniversalImpresaRecipe(BasicNewsRecipe): tag = soup.find('font', attrs={'color': '#0F046A'}) if tag: for attr in ['color', 'face', 'helvetica,', 'sans-serif', 'size']: - if tag.has_key(attr): # noqa - del tag[attr] + tag[attr] = '' + del tag[attr] tag.name = 'h1' return soup diff --git a/recipes/espn.recipe b/recipes/espn.recipe index 8c4ce332fa..e29a88b9cb 100644 --- a/recipes/espn.recipe +++ b/recipes/espn.recipe @@ -62,8 +62,8 @@ class ESPN(BasicNewsRecipe): ] def preprocess_html(self, soup): - for div in soup.findAll('div'): - if div.has_key('style') and 'px' in div['style']: # noqa + for div in soup.findAll('div', style=True): + if 'px' in div['style']: div['style'] = '' return soup diff --git a/recipes/estadao.recipe b/recipes/estadao.recipe index cbb06247fe..b2f8215528 100644 --- a/recipes/estadao.recipe +++ b/recipes/estadao.recipe @@ -88,7 +88,7 @@ class Estadao(BasicNewsRecipe): def postprocess_html(self, soup, first): # process all the images. assumes that the new html has the correct # path - for tag in soup.findAll(lambda tag: tag.name.lower() == 'img' and tag.has_key('src')): # noqa + for tag in soup.findAll('img', src=True): iurl = tag['src'] img = Image() img.open(iurl) diff --git a/recipes/financialsense.recipe b/recipes/financialsense.recipe index 9fcfa17413..fdf45c45b8 100644 --- a/recipes/financialsense.recipe +++ b/recipes/financialsense.recipe @@ -57,7 +57,6 @@ class FinancialSense(BasicNewsRecipe): else: str = self.tag_to_string(item) item.replaceWith(str) - for item in soup.findAll('img'): - if not item.has_key('alt'): # noqa - item['alt'] = 'image' + for item in soup.findAll('img', alt=False): + item['alt'] = 'image' return soup diff --git a/recipes/freeway.recipe b/recipes/freeway.recipe index 3662fac972..9e91929371 100644 --- a/recipes/freeway.recipe +++ b/recipes/freeway.recipe @@ -84,8 +84,8 @@ class General(BasicNewsRecipe): for item in soup.body.findAll(name=['table', 'td', 'tr', 'th', 'caption', 'thead', 'tfoot', 'tbody', 'colgroup', 'col']): item.name = 'div' for attrib in attribs: - if item.has_key(attrib): # noqa - del item[attrib] + item[attrib] = '' + del item[attrib] return soup def get_cover_url(self): diff --git a/recipes/gameplay_pl.recipe b/recipes/gameplay_pl.recipe index 10f71c1fad..351cce20e8 100644 --- a/recipes/gameplay_pl.recipe +++ b/recipes/gameplay_pl.recipe @@ -27,7 +27,7 @@ class Gameplay_pl(BasicNewsRecipe): return url def preprocess_html(self, soup): - for a in soup('a'): - if a.has_key('href') and '../' in a['href']: # noqa + for a in soup('a', href=True): + if '../' in a['href']: a['href'] = self.index + a['href'][2:] return soup diff --git a/recipes/geek_poke.recipe b/recipes/geek_poke.recipe index e4e1092940..22193d8bbf 100644 --- a/recipes/geek_poke.recipe +++ b/recipes/geek_poke.recipe @@ -56,7 +56,7 @@ class AdvancedUserRecipe1307556816(BasicNewsRecipe): extra_css = 'body, h3, p, div, span{margin:0px; padding:0px} h3.entry-header{font-size: 0.8em} div.entry-body{font-size: 0.7em}' def postprocess_html(self, soup, first): - for tag in soup.findAll(lambda tag: tag.name.lower() == 'img' and tag.has_key('src')): # noqa + for tag in soup.findAll('img', src=True): iurl = tag['src'] img = Image() img.open(iurl) diff --git a/recipes/gildia_pl.recipe b/recipes/gildia_pl.recipe index 0cc92013ca..4cdf03ad28 100644 --- a/recipes/gildia_pl.recipe +++ b/recipes/gildia_pl.recipe @@ -58,8 +58,8 @@ class Gildia(BasicNewsRecipe): def preprocess_html(self, soup): title = soup.title.renderContents().lower() - for a in soup('a'): - if a.has_key('href') and not a['href'].startswith('http'): # noqa + for a in soup('a', href=True): + if not a['href'].startswith('http'): if '/gry/' in a['href']: a['href'] = 'http://www.gry.gildia.pl' + a['href'] elif u'książk' in title or u'komiks' in title: diff --git a/recipes/gram_pl.recipe b/recipes/gram_pl.recipe index b66ac1e241..77267d93ed 100644 --- a/recipes/gram_pl.recipe +++ b/recipes/gram_pl.recipe @@ -43,8 +43,8 @@ class Gram_pl(BasicNewsRecipe): tag.p.img.extract() tag.p.insert(len(tag.p.contents) - 2, BeautifulSoup('

    Ocena: {0}

    '.format(rate)).h2) - for a in soup('a'): - if a.has_key('href') and 'http://' not in a['href'] and 'https://' not in a['href']: # noqa + for a in soup.findAll('a', href=True): + if 'http://' not in a['href'] and 'https://' not in a['href']: # noqa a['href'] = self.index + a['href'] tag = soup.find(name='span', attrs={'class': 'platforma'}) if tag: diff --git a/recipes/in4_pl.recipe b/recipes/in4_pl.recipe index ab4bffd50c..46c9e930c0 100644 --- a/recipes/in4_pl.recipe +++ b/recipes/in4_pl.recipe @@ -47,7 +47,7 @@ class in4(BasicNewsRecipe): def preprocess_html(self, soup): self.append_page(soup, soup.body) - for a in soup('a'): - if a.has_key('href') and 'http://' not in a['href'] and 'https://' not in a['href']: # noqa + for a in soup.findAll('a', href=True): + if 'http://' not in a['href'] and 'https://' not in a['href']: a['href'] = self.index + a['href'] return soup diff --git a/recipes/infra_pl.recipe b/recipes/infra_pl.recipe index b036f04eb9..e705539191 100644 --- a/recipes/infra_pl.recipe +++ b/recipes/infra_pl.recipe @@ -21,7 +21,7 @@ class INFRA(BasicNewsRecipe): def preprocess_html(self, soup): for item in soup.findAll(style=True): del item['style'] - for a in soup('a'): - if a.has_key('href') and 'http://' not in a['href'] and 'https://' not in a['href']: # noqa + for a in soup.findAll('a', href=True): + if 'http://' not in a['href'] and 'https://' not in a['href']: a['href'] = self.index + a['href'] return soup diff --git a/recipes/jutarnji.recipe b/recipes/jutarnji.recipe index ff3867d6f7..9397cb3067 100644 --- a/recipes/jutarnji.recipe +++ b/recipes/jutarnji.recipe @@ -65,8 +65,8 @@ class Jutarnji(BasicNewsRecipe): for item in soup.body.findAll(name=['table', 'td', 'tr', 'th', 'caption', 'thead', 'tfoot', 'tbody', 'colgroup', 'col']): item.name = 'div' for attrib in attribs: - if item.has_key(attrib): # noqa - del item[attrib] + item[attrib] = '' + del item[attrib] mlang = Tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) diff --git a/recipes/klip_me.recipe b/recipes/klip_me.recipe index 20d73ac23c..2d504ce3ab 100644 --- a/recipes/klip_me.recipe +++ b/recipes/klip_me.recipe @@ -47,7 +47,7 @@ class AdvancedUserRecipe1299694372(BasicNewsRecipe): soup = self.index_to_soup(feedurl) for item in soup.findAll('table', attrs={'class': ['item', 'item new']}): atag = item.a - if atag and atag.has_key('href'): # noqa + if atag and atag.get('href') is not None: url = atag['href'] articles.append({ 'url': url diff --git a/recipes/lemonde_dip.recipe b/recipes/lemonde_dip.recipe index d03c8b6ba8..716daecc79 100644 --- a/recipes/lemonde_dip.recipe +++ b/recipes/lemonde_dip.recipe @@ -61,17 +61,18 @@ class LeMondeDiplomatiqueEn(BasicNewsRecipe): cnt = soup.find('div', attrs={'class': 'som_num'}) for item in cnt.findAll('li'): description = '' - feed_link = item.find('a') + feed_link = item.find('a', href=True) + if feed_link is None: + continue desc = item.find('div', attrs={'class': 'chapo'}) if desc: description = desc.string - if feed_link and feed_link.has_key('href'): # noqa - url = self.PREFIX + feed_link['href'].partition('/../')[2] - title = self.tag_to_string(feed_link) - date = strftime(self.timefmt) - articles.append({ - 'title': title, 'date': date, 'url': url, 'description': description - }) + url = self.PREFIX + feed_link['href'].partition('/../')[2] + title = self.tag_to_string(feed_link) + date = strftime(self.timefmt) + articles.append({ + 'title': title, 'date': date, 'url': url, 'description': description + }) return [(self.title, articles)] def get_cover_url(self): diff --git a/recipes/lenta_ru.recipe b/recipes/lenta_ru.recipe index 1e633b2c17..583954ea75 100644 --- a/recipes/lenta_ru.recipe +++ b/recipes/lenta_ru.recipe @@ -60,14 +60,9 @@ class LentaRURecipe(BasicNewsRecipe): if not feedData: raise NotImplementedError self.log("parse_index: Feed loaded successfully.") - if feedData.feed.has_key('title'): # noqa - self.title = feedData.feed.title - self.log("parse_index: Title updated to: ", self.title) - if feedData.feed.has_key('image'): # noqa - self.log("HAS IMAGE!!!!") def get_virtual_feed_articles(feed): - if feeds.has_key(feed): # noqa + if feed in feeds: return feeds[feed][1] self.log("Adding new feed: ", feed) articles = [] @@ -84,7 +79,7 @@ class LentaRURecipe(BasicNewsRecipe): continue article = {'title': title, 'url': link, 'description': item.get( 'description', ''), 'date': item.get('date', ''), 'content': ''} - if not item.has_key('tags'): # noqa + if not item.get('tags'): get_virtual_feed_articles('_default').append(article) continue for tag in item.tags: @@ -101,7 +96,7 @@ class LentaRURecipe(BasicNewsRecipe): # Select sorted feeds first of all result = [] for feedName in self.sortOrder: - if (not feeds.has_key(feedName)): # noqa + if (not feeds.get(feedName)): continue result.append(feeds[feedName]) del feeds[feedName] diff --git a/recipes/lrb_payed.recipe b/recipes/lrb_payed.recipe index c99a3b8216..8d6e0055a2 100644 --- a/recipes/lrb_payed.recipe +++ b/recipes/lrb_payed.recipe @@ -45,7 +45,7 @@ class LondonReviewOfBooksPayed(BasicNewsRecipe): soup = self.index_to_soup(self.INDEX) cover_item = soup.find('p', attrs={'class': 'cover'}) dates = str(soup.find('span', attrs={'class': 'coverdate'})) - newdates = re.sub('\<.*\>', '', re.split('
    ', dates)[1]) + newdates = re.sub(r'\<.*\>', '', re.split('
    ', dates)[1]) self.timefmt = ' [%s]' % newdates lrbtitle = self.title if cover_item: @@ -58,13 +58,13 @@ class LondonReviewOfBooksPayed(BasicNewsRecipe): description = u'' title_prefix = u'' feed_link = item - if feed_link.has_key('href'): # noqa + if feed_link.get('href'): url = self.INDEX + feed_link['href'] title_link = re.split('
    ', str(feed_link)) if len(title_link) > 1: title = title_prefix + \ re.sub( - '\<.*\>', '', title_link[0]) + ' - ' + re.sub('\<.*\>', '', title_link[1]) + r'\<.*\>', '', title_link[0]) + ' - ' + re.sub(r'\<.*\>', '', title_link[1]) else: title = title_prefix + self.tag_to_string(feed_link) desc = item.findNext('li') diff --git a/recipes/metro_news_nl.recipe b/recipes/metro_news_nl.recipe index 205f71c596..fa5c4fdd7a 100644 --- a/recipes/metro_news_nl.recipe +++ b/recipes/metro_news_nl.recipe @@ -133,7 +133,7 @@ class AdvancedUserRecipe1306097511(BasicNewsRecipe): class MerryPreProcess(): def optimizePicture(self, soup): - for tag in soup.findAll(lambda tag: tag.name.lower() == 'img' and tag.has_key('src')): # noqa + for tag in soup.findAll('img', src=True): try: iurl = tag['src'] img = Image() diff --git a/recipes/moneycontrol.recipe b/recipes/moneycontrol.recipe index 7d9d440c3e..8cc0cfdeac 100644 --- a/recipes/moneycontrol.recipe +++ b/recipes/moneycontrol.recipe @@ -42,11 +42,10 @@ class MoneyControlRecipe(BasicNewsRecipe): h1.append(self.tag_to_string(headline)) freshSoup.body.append(h1) - for p in soup.findAll('p'): - if p.has_key('class'): - if p['class'] == 'MsoNormal': - # We have some weird pagebreak marker here; it will not find all of them however - continue + for p in soup.findAll('p', attrs={'class': true}): + if p['class'] == 'MsoNormal': + # We have some weird pagebreak marker here; it will not find all of them however + continue para = Tag(freshSoup, 'p') # Convert to string; this will loose all formatting but also all illegal markup diff --git a/recipes/montreal_gazette.recipe b/recipes/montreal_gazette.recipe index a0ab8aa8b0..d1366c4c07 100644 --- a/recipes/montreal_gazette.recipe +++ b/recipes/montreal_gazette.recipe @@ -286,7 +286,7 @@ class CanWestPaper(BasicNewsRecipe): else: description = self.tag_to_string(dtag, False) print("DESCRIPTION: " + description) - if not articles.has_key(key): # noqa + if key not in articles: articles[key] = [] articles[key].append(dict( title=title, url=url, date='', description=description, author='', content='')) @@ -310,5 +310,5 @@ class CanWestPaper(BasicNewsRecipe): for (k, url) in self.postmedia_index_pages: parse_web_index(k, url) - ans = [(key, articles[key]) for key in ans if articles.has_key(key)] # noqa + ans = [(key, articles[key]) for key in ans if key in articles] return ans diff --git a/recipes/naszdziennik.recipe b/recipes/naszdziennik.recipe index 50b5aaec4f..b3427b94e1 100644 --- a/recipes/naszdziennik.recipe +++ b/recipes/naszdziennik.recipe @@ -38,7 +38,7 @@ class naszdziennik(BasicNewsRecipe): section = self.tag_to_string(section) # sprawdzamy czy w słowniku artykułów istnieje klucz dotyczący sekcji # jeśli nie istnieje to : - if not articles.has_key(section): # noqa + if section not in articles: # do listy sekcji dodajemy nową sekcje sections.append(section) # deklarujemy nową sekcje w słowniku artykułów przypisując jej diff --git a/recipes/ncrnext.recipe b/recipes/ncrnext.recipe index 92d0ca0e2d..96d3337703 100644 --- a/recipes/ncrnext.recipe +++ b/recipes/ncrnext.recipe @@ -77,7 +77,7 @@ class NrcNextRecipe(BasicNewsRecipe): # Add the article to a temporary list article = {'title': completeTitle, 'date': u'', 'url': href, 'description': '

     

    '} - if not articles.has_key(index): # noqa + if index not in articles: articles[index] = [] articles[index].append(article) @@ -90,7 +90,7 @@ class NrcNextRecipe(BasicNewsRecipe): indices, {u'columnisten': 1, u'koken': 3, u'geld & werk': 2, u'vandaag': 0}) # Apply this sort order to the actual list of feeds and articles answer = [(key, articles[key]) - for key in indices if articles.has_key(key)] # noqa + for key in indices if key in articles] return answer diff --git a/recipes/newsweek_polska.recipe b/recipes/newsweek_polska.recipe index a834b2150e..eda4146c4d 100644 --- a/recipes/newsweek_polska.recipe +++ b/recipes/newsweek_polska.recipe @@ -201,8 +201,7 @@ class Newsweek(BasicNewsRecipe): self.DATE = matches.group(0) # cover - img = main_section.find(lambda tag: tag.name == 'img' and tag.has_key( # noqa - 'alt') and tag.has_key('title')) + img = main_section.find('img', src=True, alt=True, title=True) self.cover_url = img['src'] feeds = [] articles = {} @@ -233,7 +232,7 @@ class Newsweek(BasicNewsRecipe): if article is None: continue - if articles.has_key(section): # noqa + if section in articles: articles[section].append(article) else: articles[section] = [article] diff --git a/recipes/novosti.recipe b/recipes/novosti.recipe index 23383aad75..fee0c4d1b0 100644 --- a/recipes/novosti.recipe +++ b/recipes/novosti.recipe @@ -82,7 +82,6 @@ class Novosti(BasicNewsRecipe): else: str = self.tag_to_string(item) item.replaceWith(str) - for item in soup.findAll('img'): - if not item.has_key('alt'): # noqa - item['alt'] = 'image' + for item in soup.findAll('img', alt=False): + item['alt'] = 'image' return soup diff --git a/recipes/nsfw_corp.recipe b/recipes/nsfw_corp.recipe index 05e832a80d..3681daad63 100644 --- a/recipes/nsfw_corp.recipe +++ b/recipes/nsfw_corp.recipe @@ -55,8 +55,8 @@ class NotSafeForWork(BasicNewsRecipe): def get_feeds(self): self.feeds = [] soup = self.index_to_soup(self.SETTINGS) - for item in soup.findAll('input', attrs={'type': 'text'}): - if item.has_key('value') and item['value'].startswith('https://www.nsfwcorp.com/feed/'): # noqa + for item in soup.findAll('input', value=True, attrs={'type': 'text'}): + if item['value'].startswith('https://www.nsfwcorp.com/feed/'): self.feeds.append(item['value']) return self.feeds return self.feeds diff --git a/recipes/nspm.recipe b/recipes/nspm.recipe index f34e823d20..f2e41e9d1d 100644 --- a/recipes/nspm.recipe +++ b/recipes/nspm.recipe @@ -109,7 +109,6 @@ class Nspm(BasicNewsRecipe): else: str = self.tag_to_string(item) item.replaceWith(str) - for item in soup.findAll('img'): - if not item.has_key('alt'): # noqa - item['alt'] = 'image' + for item in soup.findAll('img', alt=False): + item['alt'] = 'image' return soup diff --git a/recipes/ottawa_citizen.recipe b/recipes/ottawa_citizen.recipe index f72b49a78a..a5f16c5bef 100644 --- a/recipes/ottawa_citizen.recipe +++ b/recipes/ottawa_citizen.recipe @@ -286,7 +286,7 @@ class CanWestPaper(BasicNewsRecipe): else: description = self.tag_to_string(dtag, False) print("DESCRIPTION: " + description) - if not articles.has_key(key): # noqa + if key not in articles: articles[key] = [] articles[key].append(dict( title=title, url=url, date='', description=description, author='', content='')) @@ -310,5 +310,5 @@ class CanWestPaper(BasicNewsRecipe): for (k, url) in self.postmedia_index_pages: parse_web_index(k, url) - ans = [(key, articles[key]) for key in ans if articles.has_key(key)] # noqa + ans = [(key, articles[key]) for key in ans if key in articles] return ans diff --git a/recipes/pobjeda.recipe b/recipes/pobjeda.recipe index 9f52941f88..5671bf30dc 100644 --- a/recipes/pobjeda.recipe +++ b/recipes/pobjeda.recipe @@ -86,8 +86,8 @@ class Pobjeda(BasicNewsRecipe): soup = self.index_to_soup(feedurl) for item in soup.findAll('div', attrs={'class': 'vijest'}): description = self.tag_to_string(item.h2) - atag = item.h1.find('a') - if atag and atag.has_key('href'): # noqa + atag = item.h1.find('a', href=True) + if atag is not None: url = self.INDEX + '/' + atag['href'] title = self.tag_to_string(atag) date = strftime(self.timefmt) diff --git a/recipes/politika.recipe b/recipes/politika.recipe index 48e5359ec9..f46c664fe3 100644 --- a/recipes/politika.recipe +++ b/recipes/politika.recipe @@ -58,10 +58,9 @@ class Politika(BasicNewsRecipe): del item['style'] for item in soup.findAll('a', attrs={'class': 'category'}): item.name = 'span' - if item.has_key('href'): # noqa - del item['href'] - if item.has_key('title'): # noqa - del item['title'] + item['href'] = item['title'] = '' + del item['href'] + del item['title'] return soup def get_cover_url(self): diff --git a/recipes/polityka.recipe b/recipes/polityka.recipe index 33e73c7c2f..8deb4f98f5 100644 --- a/recipes/polityka.recipe +++ b/recipes/polityka.recipe @@ -51,7 +51,7 @@ class Polityka(BasicNewsRecipe): 'http://archiwum.polityka.pl' + div.a['href'],) section = self.tag_to_string(article_page.find( 'h2', attrs={'class': 'box_nag'})).split('/')[0].lstrip().rstrip() - if not articles.has_key(section): # noqa + if section not in articles: articles[section] = [] articles[section].append({ 'title': self.tag_to_string(div.a), diff --git a/recipes/regina_leader_post.recipe b/recipes/regina_leader_post.recipe index ad56dde0fc..1b928de984 100644 --- a/recipes/regina_leader_post.recipe +++ b/recipes/regina_leader_post.recipe @@ -190,7 +190,7 @@ class CanWestPaper(BasicNewsRecipe): # Find each instance of class="sectiontitle", class="featurecontent" for divtag in soup.findAll('div', attrs={'class': ["section_title02", "featurecontent"]}): if divtag['class'].startswith('section_title'): - # div contains section title + # div contains section title if not divtag.h3: continue key = self.tag_to_string(divtag.h3, False) @@ -215,11 +215,11 @@ class CanWestPaper(BasicNewsRecipe): autag = divtag.find('h4') if autag: author = self.tag_to_string(autag, False) - if not articles.has_key(key): # noqa + if key not in articles: articles[key] = [] articles[key].append(dict(title=title, url=url, date=pubdate, description=description, author=author, content='')) ans = [(keyl, articles[keyl]) - for keyl in ans if articles.has_key(keyl)] # noqa + for keyl in ans if keyl in articles] return ans diff --git a/recipes/republika.recipe b/recipes/republika.recipe index 836c6d028c..02daafbe71 100644 --- a/recipes/republika.recipe +++ b/recipes/republika.recipe @@ -46,8 +46,8 @@ class Republika(BasicNewsRecipe): for item in soup.body.findAll(name=['table', 'td', 'tr', 'th', 'caption', 'thead', 'tfoot', 'tbody', 'colgroup', 'col']): item.name = 'div' for attrib in attribs: - if item.has_key(attrib): # noqa - del item[attrib] + item[attrib] = '' + del item[attrib] return soup def parse_index(self): diff --git a/recipes/saskatoon_star_phoenix.recipe b/recipes/saskatoon_star_phoenix.recipe index 1bac2a795b..c78fef6160 100644 --- a/recipes/saskatoon_star_phoenix.recipe +++ b/recipes/saskatoon_star_phoenix.recipe @@ -190,7 +190,7 @@ class CanWestPaper(BasicNewsRecipe): # Find each instance of class="sectiontitle", class="featurecontent" for divtag in soup.findAll('div', attrs={'class': ["section_title02", "featurecontent"]}): if divtag['class'].startswith('section_title'): - # div contains section title + # div contains section title if not divtag.h3: continue key = self.tag_to_string(divtag.h3, False) @@ -215,10 +215,10 @@ class CanWestPaper(BasicNewsRecipe): autag = divtag.find('h4') if autag: author = self.tag_to_string(autag, False) - if not articles.has_key(key): # noqa + if key not in articles: articles[key] = [] articles[key].append(dict(title=title, url=url, date=pubdate, description=description, author=author, content='')) - ans = [(k, articles[k]) for k in ans if articles.has_key(k)] # noqa + ans = [(k, articles[k]) for k in ans if k in articles] return ans diff --git a/recipes/scprint.recipe b/recipes/scprint.recipe index 954b2ba011..e4a2edc3b2 100644 --- a/recipes/scprint.recipe +++ b/recipes/scprint.recipe @@ -45,11 +45,11 @@ class SCPrintMagazine(BasicNewsRecipe): if arttitlet is not None: mylink = arttitlet.find('a') if mylink is not None: - if mylink.has_key('title'): # noqa + if mylink.get('title'): arttitle = mylink['title'] else: arttitle = 'unknown' - if mylink.has_key('href'): # noqa + if mylink.get('href'): artlink = mylink['href'] artlink = artlink.replace( "/article", "/printarticle") diff --git a/recipes/sueddeutsche_mobil.recipe b/recipes/sueddeutsche_mobil.recipe index ccaf22512e..2b4d8415f9 100644 --- a/recipes/sueddeutsche_mobil.recipe +++ b/recipes/sueddeutsche_mobil.recipe @@ -81,7 +81,7 @@ class SZmobil(BasicNewsRecipe): if itt['href'].startswith('article.php?id='): article_url = itt['href'] article_id = int( - re.search("id=(\d*)&etag=", itt['href']).group(1)) + re.search(r"id=(\d*)&etag=", itt['href']).group(1)) # first check if link is a special article in section # "Meinungsseite" @@ -104,7 +104,7 @@ class SZmobil(BasicNewsRecipe): # just another link ("mehr") to an article continue - if itt.has_key('id'): # noqa + if itt.get('id') is not None: shorttitles[article_id] = article_name else: articles.append( @@ -118,7 +118,7 @@ class SZmobil(BasicNewsRecipe): # pubdate = strftime('') pubdate = strftime('[%a, %d %b]') description = '' - if shorttitles.has_key(article_id): # noqa + if shorttitles.get(article_id) is not None: description = shorttitles[article_id] # we do not want the flag ("Impressum") if "HERAUSGEGEBEN VOM" in description: diff --git a/recipes/techcrunch.recipe b/recipes/techcrunch.recipe index 6d130e787a..cfdda7f233 100644 --- a/recipes/techcrunch.recipe +++ b/recipes/techcrunch.recipe @@ -55,7 +55,6 @@ class TechCrunch(BasicNewsRecipe): else: str = self.tag_to_string(item) item.replaceWith(str) - for item in soup.findAll('img'): - if not item.has_key('alt'): # noqa - item['alt'] = 'image' + for item in soup.findAll('img', alt=False): + item['alt'] = 'image' return soup diff --git a/recipes/the_age.recipe b/recipes/the_age.recipe index aad60d29b8..3728fd4d1a 100644 --- a/recipes/the_age.recipe +++ b/recipes/the_age.recipe @@ -45,7 +45,7 @@ class TheAge(BasicNewsRecipe): # Make sure to skip: TheAge - elif section and tag.has_key('href') and len(tag['href'].strip()) > 1: # noqa + elif section and tag.get('href'): url = tag['href'].strip() if url.startswith('/'): url = 'http://www.theage.com.au' + url @@ -105,7 +105,7 @@ class TheAge(BasicNewsRecipe): # Filter out what's left of the text-mode navigation stuff - if re.match('((\s)|(\ \;))*\[[\|\s*]*\]((\s)|(\ \;))*$', contents): + if re.match(r'((\s)|(\ \;))*\[[\|\s*]*\]((\s)|(\ \;))*$', contents): p.extract() continue diff --git a/recipes/thedgesingapore.recipe b/recipes/thedgesingapore.recipe index 57462b3465..9277cc297a 100644 --- a/recipes/thedgesingapore.recipe +++ b/recipes/thedgesingapore.recipe @@ -47,6 +47,6 @@ class Edgesingapore(BasicNewsRecipe): for item in soup.body.findAll(name=['table', 'td', 'tr', 'th', 'caption', 'thead', 'tfoot', 'tbody', 'colgroup', 'col']): item.name = 'div' for attrib in attribs: - if item.has_key(attrib): # noqa - del item[attrib] + item[attrib] = '' + del item[attrib] return self.adeify_images(soup) diff --git a/recipes/theonion.recipe b/recipes/theonion.recipe index dc5ba8a317..af97c0169a 100644 --- a/recipes/theonion.recipe +++ b/recipes/theonion.recipe @@ -78,12 +78,12 @@ class TheOnion(BasicNewsRecipe): if limg: item.name = 'div' item.attrs = [] - if not limg.has_key('alt'): # noqa + if not limg.get('alt'): limg['alt'] = 'image' else: str = self.tag_to_string(item) item.replaceWith(str) for item in soup.findAll('img'): - if item.has_key('data-src'): # noqa + if item.get('data-src'): item['src'] = item['data-src'] return soup diff --git a/recipes/tomshardware.recipe b/recipes/tomshardware.recipe index 8473fb34a3..27b33d8988 100644 --- a/recipes/tomshardware.recipe +++ b/recipes/tomshardware.recipe @@ -57,8 +57,8 @@ class Tomshardware(BasicNewsRecipe): def cleanup_image_tags(self, soup): for item in soup.findAll('img'): for attrib in ['height', 'width', 'border', 'align']: - if item.has_key(attrib): # noqa - del item[attrib] + item[attrib] = '' + del item[attrib] return soup def preprocess_html(self, soup): diff --git a/recipes/twitchfilms.recipe b/recipes/twitchfilms.recipe index 27144c3d14..3279b6c24c 100644 --- a/recipes/twitchfilms.recipe +++ b/recipes/twitchfilms.recipe @@ -45,7 +45,6 @@ class Twitchfilm(BasicNewsRecipe): else: str = self.tag_to_string(item) item.replaceWith(str) - for item in soup.findAll('img'): - if not item.has_key('alt'): # noqa - item['alt'] = 'image' + for item in soup.findAll('img', alt=False): + item['alt'] = 'image' return soup diff --git a/recipes/vancouver_province.recipe b/recipes/vancouver_province.recipe index a97c53750e..588133290d 100644 --- a/recipes/vancouver_province.recipe +++ b/recipes/vancouver_province.recipe @@ -299,7 +299,7 @@ class CanWestPaper(BasicNewsRecipe): else: description = self.tag_to_string(dtag, False) print("DESCRIPTION: " + description) - if not articles.has_key(key): # noqa + if key not in articles: articles[key] = [] articles[key].append(dict( title=title, url=url, date='', description=description, author='', content='')) @@ -323,5 +323,5 @@ class CanWestPaper(BasicNewsRecipe): for (k, url) in self.postmedia_index_pages: parse_web_index(k, url) - ans = [(key, articles[key]) for key in ans if articles.has_key(key)] # noqa + ans = [(key, articles[key]) for key in ans if key in articles] return ans diff --git a/recipes/vancouver_sun.recipe b/recipes/vancouver_sun.recipe index 899c8fbca9..e0c9e4fdce 100644 --- a/recipes/vancouver_sun.recipe +++ b/recipes/vancouver_sun.recipe @@ -287,7 +287,7 @@ class CanWestPaper(BasicNewsRecipe): else: description = self.tag_to_string(dtag, False) print("DESCRIPTION: " + description) - if not articles.has_key(key): # noqa + if key not in articles: articles[key] = [] articles[key].append(dict( title=title, url=url, date='', description=description, author='', content='')) @@ -311,5 +311,5 @@ class CanWestPaper(BasicNewsRecipe): for (k, url) in self.postmedia_index_pages: parse_web_index(k, url) - ans = [(key, articles[key]) for key in ans if articles.has_key(key)] # noqa + ans = [(key, articles[key]) for key in ans if key in articles] # noqa return ans diff --git a/recipes/variety.recipe b/recipes/variety.recipe index f54b732d13..2aa61b3c3f 100644 --- a/recipes/variety.recipe +++ b/recipes/variety.recipe @@ -62,7 +62,6 @@ class Variety(BasicNewsRecipe): else: str = self.tag_to_string(item) item.replaceWith(str) - for item in soup.findAll('img'): - if not item.has_key('alt'): # noqa - item['alt'] = 'image' + for item in soup.findAll('img', alt=False): + item['alt'] = 'image' return soup diff --git a/recipes/vedomosti.recipe b/recipes/vedomosti.recipe index 8133588a1e..f3e67fef11 100644 --- a/recipes/vedomosti.recipe +++ b/recipes/vedomosti.recipe @@ -62,16 +62,22 @@ class VedomostiRecipe(BasicNewsRecipe): if not feedData: raise NotImplementedError self.log("parse_index: Feed loaded successfully.") - if feedData.feed.has_key('title'): # noqa - self.title = feedData.feed.title - self.log("parse_index: Title updated to: ", self.title) - if feedData.feed.has_key('description'): # noqa - self.description = feedData.feed.description - self.log("parse_index: Description updated to: ", - self.description) + try: + if feedData.feed.title: + self.title = feedData.feed.title + self.log("parse_index: Title updated to: ", self.title) + except Exception: + pass + try: + if feedData.feed.description: + self.description = feedData.feed.description + self.log("parse_index: Description updated to: ", + self.description) + except Exception: + pass def get_virtual_feed_articles(feed): - if feeds.has_key(feed): # noqa + if feed in feeds: return feeds[feed][1] self.log("Adding new feed: ", feed) articles = [] @@ -88,7 +94,7 @@ class VedomostiRecipe(BasicNewsRecipe): continue article = {'title': title, 'url': link, 'description': item.get( 'description', ''), 'date': item.get('date', ''), 'content': ''} - if not item.has_key('tags'): # noqa + if not item.get('tags'): # noqa get_virtual_feed_articles('_default').append(article) continue for tag in item.tags: @@ -105,7 +111,7 @@ class VedomostiRecipe(BasicNewsRecipe): # Select sorted feeds first of all result = [] for feedName in self.sortOrder: - if (not feeds.has_key(feedName)): # noqa + if (not feeds.get(feedName)): continue result.append(feeds[feedName]) del feeds[feedName] @@ -142,9 +148,9 @@ class VedomostiRecipe(BasicNewsRecipe): imgDiv = Tag(soup, 'div') imgDiv['class'] = 'article_img' - if img.has_key('width'): # noqa + if img.get('width'): del(img['width']) - if img.has_key('height'): # noqa + if img.get('height'): del(img['height']) # find description @@ -180,11 +186,9 @@ class VedomostiRecipe(BasicNewsRecipe): contents.insert(len(contents.contents), authorsP) # Fix urls that use relative path - urls = contents.findAll('a') + urls = contents.findAll('a', href=True) if urls: for url in urls: - if not url.has_key('href'): # noqa - continue if '/' == url['href'][0]: url['href'] = self.base_url + url['href'] diff --git a/recipes/wapo_cartoons.recipe b/recipes/wapo_cartoons.recipe index 4fe51a5903..d4097910ac 100644 --- a/recipes/wapo_cartoons.recipe +++ b/recipes/wapo_cartoons.recipe @@ -94,8 +94,8 @@ class WaPoCartoonsRecipe(BasicNewsRecipe): img = soup.find('img', attrs={'class': 'pic_big'}) if img: td = img.parent - if td.has_key('style'): # noqa - del td['style'] + td['style'] = '' + del td['style'] td.name = 'div' td['id'] = 'comic_full' freshSoup.body.append(td) @@ -134,11 +134,8 @@ class WaPoCartoonsRecipe(BasicNewsRecipe): 'June': '06', 'July': '07', 'August': '08', 'September': '09', 'October': '10', 'November': '11', 'December': '12'} - opts = select.findAll('option') + opts = select.findAll('option', selected=False) for i in range(1, len(opts)): - if opts[i].has_key('selected'): # noqa - continue - dateString = self.tag_to_string(opts[i]) rest, sep, year = dateString.rpartition(', ') parts = rest.split(' ') diff --git a/recipes/wenxuecity-znjy.recipe b/recipes/wenxuecity-znjy.recipe index 97a0a2f98f..031175812e 100644 --- a/recipes/wenxuecity-znjy.recipe +++ b/recipes/wenxuecity-znjy.recipe @@ -42,11 +42,11 @@ class TheCND(BasicNewsRecipe): url = 'http://bbs.wenxuecity.com' + url title = self.tag_to_string(a) self.log('\tFound article: ', title, ' at:', url) - dateReg = re.search('(\d\d?)/(\d\d?)/(\d\d)', + dateReg = re.search(r'(\d\d?)/(\d\d?)/(\d\d)', self.tag_to_string(a.parent)) date = '%(y)s/%(m)02d/%(d)02d' % {'y': dateReg.group(3), 'm': int(dateReg.group(1)), 'd': int(dateReg.group(2))} - if not articles.has_key(date): # noqa + if date not in articles: # noqa articles[date] = [] articles[date].append( {'title': title, 'url': url, 'description': '', 'date': ''}) diff --git a/recipes/windows_star.recipe b/recipes/windows_star.recipe index ec97b1223e..d66e4cd9c1 100644 --- a/recipes/windows_star.recipe +++ b/recipes/windows_star.recipe @@ -96,10 +96,10 @@ class CanWestPaper(BasicNewsRecipe): autag = divtag.find('h4') if autag: author = self.tag_to_string(autag, False) - if not articles.has_key(key): # noqa + if key not in articles: articles[key] = [] articles[key].append(dict(title=title, url=url, date=pubdate, description=description, author=author, content='')) - ans = [(keyl, articles[key]) for keyl in ans if articles.has_key(keyl)] # noqa + ans = [(keyl, articles[key]) for keyl in ans if keyl in articles] return ans diff --git a/recipes/windsor_star.recipe b/recipes/windsor_star.recipe index 5c20cecb8f..b1837120e5 100644 --- a/recipes/windsor_star.recipe +++ b/recipes/windsor_star.recipe @@ -189,9 +189,9 @@ class CanWestPaper(BasicNewsRecipe): # Find each instance of class="sectiontitle", class="featurecontent" for divtag in soup.findAll('div', attrs={'class': ["section_title02", "featurecontent"]}): - # self.log(" div class = %s" % divtag['class']) + # self.log(" div class = %s" % divtag['class']) if divtag['class'].startswith('section_title'): - # div contains section title + # div contains section title if not divtag.h3: continue key = self.tag_to_string(divtag.h3, False) @@ -221,11 +221,11 @@ class CanWestPaper(BasicNewsRecipe): if autag: author = self.tag_to_string(autag, False) # self.log("author %s" % author) - if not articles.has_key(key): # noqa + if key not in articles: articles[key] = [] articles[key].append(dict(title=title, url=url, date=pubdate, description=description, author=author, content='')) ans = [(keyl, articles[keyl]) - for keyl in ans if articles.has_key(keyl)] # noqa + for keyl in ans if keyl in articles] return ans diff --git a/recipes/zaobao.recipe b/recipes/zaobao.recipe index 48e24a53c0..4d674c4aaf 100644 --- a/recipes/zaobao.recipe +++ b/recipes/zaobao.recipe @@ -83,11 +83,10 @@ class ZAOBAO(BasicNewsRecipe): ] def preprocess_html(self, soup): - for tag in soup.findAll(name='a'): - if tag.has_key('href'): # noqa - tag_url = tag['href'] - if tag_url.find('http://') != -1 and tag_url.find('zaobao.com') == -1: - del tag['href'] + for tag in soup.findAll(name='a', href=True): + tag_url = tag['href'] + if tag_url.find('http://') != -1 and tag_url.find('zaobao.com') == -1: + del tag['href'] return soup def postprocess_html(self, soup, first): @@ -107,8 +106,8 @@ class ZAOBAO(BasicNewsRecipe): for i, item in enumerate(soup.findAll('li')): if i >= self.MAX_ITEMS_IN_INDEX: break - a = item.find('a') - if a and a.has_key('href'): # noqa + a = item.find('a', href=True) + if a is not None: a_url = a['href'] a_title = self.tag_to_string(a) date = '' From 930624d2bef4725bb79f20e03694c916556b8ba0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 22 Mar 2019 23:48:01 +0530 Subject: [PATCH 0381/2613] pep8 --- src/calibre/ebooks/pdf/render/fonts.py | 2 +- src/calibre/utils/serve_coffee.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/pdf/render/fonts.py b/src/calibre/ebooks/pdf/render/fonts.py index ef3d31e27e..9fd6ba925a 100644 --- a/src/calibre/ebooks/pdf/render/fonts.py +++ b/src/calibre/ebooks/pdf/render/fonts.py @@ -239,7 +239,7 @@ class FontManager(object): if name not in STANDARD_FONTS: raise ValueError('%s is not a standard font'%name) if name not in self.std_map: - self.std_map[name] = self.objects.add(Dictionary({ + self.std_map[name] = self.objects.add(Dictionary({ 'Type':Name('Font'), 'Subtype':Name('Type1'), 'BaseFont':Name(name) diff --git a/src/calibre/utils/serve_coffee.py b/src/calibre/utils/serve_coffee.py index 7bab56f4ed..fc8bddb036 100644 --- a/src/calibre/utils/serve_coffee.py +++ b/src/calibre/utils/serve_coffee.py @@ -12,8 +12,7 @@ Utilities to help with developing coffeescript based apps. A coffeescript compiler and a simple web server that automatically serves coffeescript files as javascript. ''' -import sys, traceback, io -import time, os, sys, re +import sys, traceback, io, time, os, re from threading import Lock, local from polyglot import socketserver From c68a5c8ab17f97f639328cfe2bcdba1a9f343640 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 23 Mar 2019 08:06:25 +0530 Subject: [PATCH 0382/2613] Port Tag creation in recipes to work with any version of BeautifulSoup --- recipes/24sata.recipe | 11 +++++++++-- recipes/ajc.recipe | 9 ++++++++- recipes/ap.recipe | 9 ++++++++- recipes/bloomberg_columns.recipe | 9 ++++++++- recipes/boston.com.recipe | 9 ++++++++- recipes/buckmasters.recipe | 21 ++++++++++++++------- recipes/calgary_herald.recipe | 15 +++++++++++---- recipes/climate_progress.recipe | 11 +++++++++-- recipes/degentenaar.recipe | 11 +++++++++-- recipes/dnevni_avaz.recipe | 11 +++++++++-- recipes/dnevnik_cro.recipe | 11 +++++++++-- recipes/dunyahalleri.recipe | 19 +++++++++++++------ recipes/dunyahalleri_haftaninozeti.recipe | 15 +++++++++++---- recipes/economist.recipe | 11 +++++++++-- recipes/economist_free.recipe | 11 +++++++++-- recipes/edmonton_journal.recipe | 15 +++++++++++---- recipes/elperiodico_catalan.recipe | 9 ++++++++- recipes/elperiodico_spanish.recipe | 9 ++++++++- recipes/eltiempo_hn.recipe | 11 +++++++++-- recipes/estadao.recipe | 11 +++++++++-- recipes/fastcompany.recipe | 11 +++++++++-- recipes/fokkeensukke.recipe | 9 ++++++++- recipes/glennbeck.recipe | 9 ++++++++- recipes/hln.recipe | 11 +++++++++-- recipes/hoy.recipe | 9 ++++++++- recipes/hrt.recipe | 11 +++++++++-- recipes/independent.recipe | 9 ++++++++- recipes/joop.recipe | 9 ++++++++- recipes/jutarnji.recipe | 11 +++++++++-- recipes/laprensa_hn.recipe | 11 +++++++++-- recipes/latribuna.recipe | 11 +++++++++-- recipes/lavanguardia.recipe | 9 ++++++++- recipes/lenta_ru.recipe | 13 ++++++++++--- recipes/levante.recipe | 9 ++++++++- recipes/moneycontrol.recipe | 12 ++++++++++-- recipes/montreal_gazette.recipe | 15 +++++++++++---- recipes/nacional_cro.recipe | 11 +++++++++-- recipes/natgeo.recipe | 9 ++++++++- recipes/ncrnext.recipe | 13 ++++++++++--- recipes/new_yorker.recipe | 13 ++++++++++--- recipes/noaa.recipe | 11 +++++++++-- recipes/nrc.nl.recipe | 9 ++++++++- recipes/nspm.recipe | 13 ++++++++++--- recipes/nytimes.recipe | 9 ++++++++- recipes/nytimes_sub.recipe | 9 ++++++++- recipes/nzz_webpaper.recipe | 9 ++++++++- recipes/ottawa_citizen.recipe | 15 +++++++++++---- recipes/pagina_12_print_ed.recipe | 11 +++++++++-- recipes/pobjeda.recipe | 11 +++++++++-- recipes/pressonline.recipe | 9 ++++++++- recipes/revista_muy.recipe | 9 ++++++++- recipes/rts.recipe | 11 +++++++++-- recipes/sarajevo_x.recipe | 9 ++++++++- recipes/scmp.recipe | 9 ++++++++- recipes/southernstar.recipe | 11 +++++++++-- recipes/tijd.recipe | 11 +++++++++-- recipes/uncrate.recipe | 11 +++++++++-- recipes/vancouver_province.recipe | 15 +++++++++++---- recipes/vancouver_sun.recipe | 15 +++++++++++---- recipes/vecernji_list.recipe | 11 +++++++++-- recipes/vedomosti.recipe | 9 ++++++++- recipes/veintitres.recipe | 11 +++++++++-- recipes/vic_times.recipe | 11 +++++++++-- recipes/vrijnederland.recipe | 9 ++++++++- 64 files changed, 580 insertions(+), 131 deletions(-) diff --git a/recipes/24sata.recipe b/recipes/24sata.recipe index d7f080e139..487c29b1a0 100644 --- a/recipes/24sata.recipe +++ b/recipes/24sata.recipe @@ -12,6 +12,13 @@ from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class Cro24Sata(BasicNewsRecipe): title = '24 Sata - Hr' __author__ = 'Darko Miletic' @@ -46,9 +53,9 @@ class Cro24Sata(BasicNewsRecipe): def preprocess_html(self, soup): soup.html['lang'] = self.lang - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=UTF-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/ajc.recipe b/recipes/ajc.recipe index 0b884373b7..95be4ab47a 100644 --- a/recipes/ajc.recipe +++ b/recipes/ajc.recipe @@ -12,6 +12,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class AdvancedUserRecipe1282101454(BasicNewsRecipe): now = datetime.datetime.now() title = 'The AJC' @@ -118,7 +125,7 @@ class AdvancedUserRecipe1282101454(BasicNewsRecipe): comma = ', ' article.author = names if len(names) > 0: - tag = Tag(soup, 'div', [('class', 'cm-story-author')]) + tag = new_tag(soup, 'div', [('class', 'cm-story-author')]) tag.append("by: ") tag.append(names) meta = soup.find('div', attrs={'class': 'cm-story-meta'}) diff --git a/recipes/ap.recipe b/recipes/ap.recipe index 6d395af474..f3d232b7b4 100644 --- a/recipes/ap.recipe +++ b/recipes/ap.recipe @@ -17,6 +17,13 @@ def classes(classes): ) +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class AssociatedPress(BasicNewsRecipe): title = u'Associated Press' @@ -76,7 +83,7 @@ class AssociatedPress(BasicNewsRecipe): def preprocess_html(self, soup, *a): for meta in soup.findAll('meta', attrs=dict(name="twitter:image:alt")): for div in soup.findAll(**classes('LeadFeature')): - img = Tag(soup, 'img') + img = new_tag(soup, 'img') img['src'] = meta['content'] div.insert(0, img) return soup diff --git a/recipes/bloomberg_columns.recipe b/recipes/bloomberg_columns.recipe index 552e3278d0..301f26349e 100644 --- a/recipes/bloomberg_columns.recipe +++ b/recipes/bloomberg_columns.recipe @@ -127,6 +127,13 @@ class BloombergContributor: return self._name +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class BloombergContributors(BasicNewsRecipe): title = u'Bloomberg, Editorial Contributors' description = 'Articles from Bloomberg.com contributors' @@ -175,7 +182,7 @@ class BloombergContributors(BasicNewsRecipe): .strftime("%B %d, %Y %I:%M %p") + " UTC" except: parsed_time = time_stamp - insert_tag = Tag(soup, "p", [("class", "user-inserted")]) + insert_tag = new_tag(soup, "p", [("class", "user-inserted")]) insert_tag.insert(0, parsed_time) soup.time.replaceWith(insert_tag) diff --git a/recipes/boston.com.recipe b/recipes/boston.com.recipe index 05835bdfda..9f3fe59065 100644 --- a/recipes/boston.com.recipe +++ b/recipes/boston.com.recipe @@ -10,6 +10,13 @@ def classes(classes): 'class': lambda x: x and frozenset(x.split()).intersection(q)}) +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class BostonGlobeSubscription(BasicNewsRecipe): title = "Boston Globe Subscription" @@ -204,7 +211,7 @@ class BostonGlobeSubscription(BasicNewsRecipe): imgLink = main.find("a", "comic") img = imgLink.img - body = Tag(soup, "body") + body = new_tag(soup, "body") body.insert(0, title) body.insert(1, byline) body.insert(2, img) diff --git a/recipes/buckmasters.recipe b/recipes/buckmasters.recipe index d72d2f52e1..ef198c0556 100644 --- a/recipes/buckmasters.recipe +++ b/recipes/buckmasters.recipe @@ -2,6 +2,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class AdvancedUserRecipe1282101454(BasicNewsRecipe): title = 'BuckMasters In The Kitchen' language = 'en' @@ -28,15 +35,15 @@ class AdvancedUserRecipe1282101454(BasicNewsRecipe): for img_tag in soup.findAll('img'): parent_tag = img_tag.parent if parent_tag.name == 'a': - new_tag = Tag(soup, 'p') - new_tag.insert(0, img_tag) - parent_tag.replaceWith(new_tag) + ntag = new_tag(soup, 'p') + ntag.insert(0, img_tag) + parent_tag.replaceWith(ntag) elif parent_tag.name == 'p': if not self.tag_to_string(parent_tag) == '': - new_div = Tag(soup, 'div') - new_tag = Tag(soup, 'p') - new_tag.insert(0, img_tag) + new_div = new_tag(soup, 'div') + ntag = new_tag(soup, 'p') + ntag.insert(0, img_tag) parent_tag.replaceWith(new_div) - new_div.insert(0, new_tag) + new_div.insert(0, ntag) new_div.insert(1, parent_tag) return soup diff --git a/recipes/calgary_herald.recipe b/recipes/calgary_herald.recipe index d3c4e9d554..a0e3be0642 100644 --- a/recipes/calgary_herald.recipe +++ b/recipes/calgary_herald.recipe @@ -11,6 +11,13 @@ from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import BeautifulStoneSoup, Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class CanWestPaper(BasicNewsRecipe): postmedia_index_pages = [ @@ -218,21 +225,21 @@ class CanWestPaper(BasicNewsRecipe): pgall = soup.find('div', attrs={'id': 'storyphoto'}) if pgall is not None: # photo gallery perhaps if (soup.find('div', attrs={'id': 'storycontent'}) is None): - allpics = Tag(soup, 'div') + allpics = new_tag(soup, 'div') first_img = pgall.find('div', 'storyimage') if first_img is not None: first_img.extract() tlist = pgall.find('div', attrs={'id': 'relatedthumbs'}) if tlist is not None: for atag in tlist.findAll('a'): - img = Tag(soup, 'img') + img = new_tag(soup, 'img') srcpre, sep, srcpost = atag.img[ 'src'].partition('?') img['src'] = srcpre - pdesc = Tag(soup, 'p') + pdesc = new_tag(soup, 'p') pdesc.insert(0, atag.img['alt']) pdesc['class'] = 'photocaption' - div = Tag(soup, 'div') + div = new_tag(soup, 'div') div.insert(0, pdesc) div.insert(0, img) allpics.append(div) diff --git a/recipes/climate_progress.recipe b/recipes/climate_progress.recipe index db652acafc..09e6beb20f 100644 --- a/recipes/climate_progress.recipe +++ b/recipes/climate_progress.recipe @@ -10,6 +10,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class ClimateProgress(BasicNewsRecipe): title = 'Climate Progress' __author__ = 'Darko Miletic' @@ -47,9 +54,9 @@ class ClimateProgress(BasicNewsRecipe): def preprocess_html(self, soup): soup.html['lang'] = self.lang soup.html['dir'] = self.direction - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=utf-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/degentenaar.recipe b/recipes/degentenaar.recipe index 2c08ee7859..1b64d86e45 100644 --- a/recipes/degentenaar.recipe +++ b/recipes/degentenaar.recipe @@ -9,6 +9,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class DeGentenaarOnline(BasicNewsRecipe): title = 'De Gentenaar' __author__ = 'Darko Miletic' @@ -69,9 +76,9 @@ class DeGentenaarOnline(BasicNewsRecipe): soup.html['lang'] = self.lang soup.html['dir'] = self.direction - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=utf-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/dnevni_avaz.recipe b/recipes/dnevni_avaz.recipe index 45c63466d6..45916f70a7 100644 --- a/recipes/dnevni_avaz.recipe +++ b/recipes/dnevni_avaz.recipe @@ -12,6 +12,13 @@ from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class DnevniAvaz(BasicNewsRecipe): title = 'Dnevni Avaz' __author__ = 'Darko Miletic' @@ -57,9 +64,9 @@ class DnevniAvaz(BasicNewsRecipe): def preprocess_html(self, soup): soup.html['xml:lang'] = self.lang soup.html['lang'] = self.lang - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=UTF-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/dnevnik_cro.recipe b/recipes/dnevnik_cro.recipe index 02f4a3bcd8..b0a948dab5 100644 --- a/recipes/dnevnik_cro.recipe +++ b/recipes/dnevnik_cro.recipe @@ -12,6 +12,13 @@ from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class DnevnikCro(BasicNewsRecipe): title = 'Dnevnik - Hr' __author__ = 'Darko Miletic' @@ -58,9 +65,9 @@ class DnevnikCro(BasicNewsRecipe): item[attrib] = '' del item[attrib] - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=UTF-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/dunyahalleri.recipe b/recipes/dunyahalleri.recipe index af34bb1b1f..055bbabbff 100644 --- a/recipes/dunyahalleri.recipe +++ b/recipes/dunyahalleri.recipe @@ -16,6 +16,13 @@ __license__ = 'GPL v3' __copyright__ = '2017, sukru alatas / alatas.org' +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class DunyaHalleri(BasicNewsRecipe): title = 'Dünya Halleri' description = 'Gözden Kaçanlar Rehberi' @@ -78,20 +85,20 @@ class DunyaHalleri(BasicNewsRecipe): # title insert article_title = soup.title.contents[0] article_title.replace(' - Dünya Halleri'.decode('utf-8', 'replace'), '') - h2 = Tag(soup, 'h2') + h2 = new_tag(soup, 'h2') h2.append(article_title) span.insert(0, h2) # featured image insert meta = soup.findAll('meta', {'property': 'og:image'}, limit=1)[0] if meta: - img = Tag(soup, 'img') + img = new_tag(soup, 'img') img.attrs = [('src', meta['content'])] span.insert(1, img) # gallery normalization for div in soup.findAll('div', {'itemtype': 'http://schema.org/ImageGallery'}): - p = Tag(soup, 'p') + p = new_tag(soup, 'p') for img in div.findAll('img'): img.attrs = [(key, value) for key, value in img.attrs if key in ['src']] @@ -102,9 +109,9 @@ class DunyaHalleri(BasicNewsRecipe): # this block finds the cover image for each embeded youtube video then # changes it to "a href" and "img" for iframe in soup.findAll('iframe'): - a = Tag(soup, 'a') - caption = Tag(soup, 'pre') - img = Tag(soup, 'img') + a = new_tag(soup, 'a') + caption = new_tag(soup, 'pre') + img = new_tag(soup, 'img') m = re.match( r'https\:\/\/(www\.)?youtube.com\/(embed\/|watch\?v\=)' diff --git a/recipes/dunyahalleri_haftaninozeti.recipe b/recipes/dunyahalleri_haftaninozeti.recipe index 68007f8c8f..37d90bda4f 100644 --- a/recipes/dunyahalleri_haftaninozeti.recipe +++ b/recipes/dunyahalleri_haftaninozeti.recipe @@ -16,6 +16,13 @@ __license__ = 'GPL v3' __copyright__ = '2017, sukru alatas / alatas.org' +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class DunyaHalleri_HaftaninOzeti(BasicNewsRecipe): title = 'Dünya Halleri - Haftanın Özeti' description = ('Geçen hafta boyunca Türkiye ve dünyadan haber,' @@ -156,7 +163,7 @@ class DunyaHalleri_HaftaninOzeti(BasicNewsRecipe): def preprocess_html(self, soup): # gallery normalization for div in soup.findAll('div', {'itemtype': 'http://schema.org/ImageGallery'}): - p = Tag(soup, 'p') + p = new_tag(soup, 'p') for img in div.findAll('img'): img.attrs = [(key, value) for key, value in img.attrs if key in ['src']] @@ -167,9 +174,9 @@ class DunyaHalleri_HaftaninOzeti(BasicNewsRecipe): # this block finds the cover image for each embeded youtube video then # changes it to "a href" and "img" for iframe in soup.findAll('iframe'): - a = Tag(soup, 'a') - caption = Tag(soup, 'pre') - img = Tag(soup, 'img') + a = new_tag(soup, 'a') + caption = new_tag(soup, 'pre') + img = new_tag(soup, 'img') m = re.match( r'https\:\/\/(www\.)?youtube.com\/(embed\/|watch\?v\=)' diff --git a/recipes/economist.recipe b/recipes/economist.recipe index 53cd62d2b0..0b9a789a5b 100644 --- a/recipes/economist.recipe +++ b/recipes/economist.recipe @@ -19,6 +19,13 @@ def classes(classes): 'class': lambda x: x and frozenset(x.split()).intersection(q)}) +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class NoArticles(Exception): pass @@ -266,11 +273,11 @@ class Economist(BasicNewsRecipe): for table in list(self.eco_find_image_tables(soup)): caption = table.find('font') img = table.find('img') - div = Tag(soup, 'div') + div = new_tag(soup, 'div') div['style'] = 'text-align:left;font-size:70%' ns = NavigableString(self.tag_to_string(caption)) div.insert(0, ns) - div.insert(1, Tag(soup, 'br')) + div.insert(1, new_tag(soup, 'br')) del img['width'] del img['height'] img.extract() diff --git a/recipes/economist_free.recipe b/recipes/economist_free.recipe index 53cd62d2b0..0b9a789a5b 100644 --- a/recipes/economist_free.recipe +++ b/recipes/economist_free.recipe @@ -19,6 +19,13 @@ def classes(classes): 'class': lambda x: x and frozenset(x.split()).intersection(q)}) +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class NoArticles(Exception): pass @@ -266,11 +273,11 @@ class Economist(BasicNewsRecipe): for table in list(self.eco_find_image_tables(soup)): caption = table.find('font') img = table.find('img') - div = Tag(soup, 'div') + div = new_tag(soup, 'div') div['style'] = 'text-align:left;font-size:70%' ns = NavigableString(self.tag_to_string(caption)) div.insert(0, ns) - div.insert(1, Tag(soup, 'br')) + div.insert(1, new_tag(soup, 'br')) del img['width'] del img['height'] img.extract() diff --git a/recipes/edmonton_journal.recipe b/recipes/edmonton_journal.recipe index 9e7ae425bf..5e6b671dd3 100644 --- a/recipes/edmonton_journal.recipe +++ b/recipes/edmonton_journal.recipe @@ -11,6 +11,13 @@ from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import BeautifulStoneSoup, Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class CanWestPaper(BasicNewsRecipe): postmedia_index_pages = [ @@ -218,21 +225,21 @@ class CanWestPaper(BasicNewsRecipe): pgall = soup.find('div', attrs={'id': 'storyphoto'}) if pgall is not None: # photo gallery perhaps if (soup.find('div', attrs={'id': 'storycontent'}) is None): - allpics = Tag(soup, 'div') + allpics = new_tag(soup, 'div') first_img = pgall.find('div', 'storyimage') if first_img is not None: first_img.extract() tlist = pgall.find('div', attrs={'id': 'relatedthumbs'}) if tlist is not None: for atag in tlist.findAll('a'): - img = Tag(soup, 'img') + img = new_tag(soup, 'img') srcpre, sep, srcpost = atag.img[ 'src'].partition('?') img['src'] = srcpre - pdesc = Tag(soup, 'p') + pdesc = new_tag(soup, 'p') pdesc.insert(0, atag.img['alt']) pdesc['class'] = 'photocaption' - div = Tag(soup, 'div') + div = new_tag(soup, 'div') div.insert(0, pdesc) div.insert(0, img) allpics.append(div) diff --git a/recipes/elperiodico_catalan.recipe b/recipes/elperiodico_catalan.recipe index 5ba20c3724..6d8be7749a 100644 --- a/recipes/elperiodico_catalan.recipe +++ b/recipes/elperiodico_catalan.recipe @@ -11,6 +11,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class ElPeriodico_cat(BasicNewsRecipe): title = 'El Periodico de Catalunya' __author__ = 'Jordi Balcells/Darko Miletic' @@ -58,7 +65,7 @@ class ElPeriodico_cat(BasicNewsRecipe): return url.replace('/default.asp?', '/print.asp?') def preprocess_html(self, soup): - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=utf-8")]) soup.head.insert(0, mcharset) for item in soup.findAll(style=True): diff --git a/recipes/elperiodico_spanish.recipe b/recipes/elperiodico_spanish.recipe index dd5bc8f134..eb8f0fab6a 100644 --- a/recipes/elperiodico_spanish.recipe +++ b/recipes/elperiodico_spanish.recipe @@ -11,6 +11,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class ElPeriodico_cat(BasicNewsRecipe): title = 'El Periodico de Catalunya' __author__ = 'Jordi Balcells/Darko Miletic' @@ -58,7 +65,7 @@ class ElPeriodico_cat(BasicNewsRecipe): return url.replace('/default.asp?', '/print.asp?') def preprocess_html(self, soup): - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=utf-8")]) soup.head.insert(0, mcharset) for item in soup.findAll(style=True): diff --git a/recipes/eltiempo_hn.recipe b/recipes/eltiempo_hn.recipe index 1a8d3808a3..8ca1264097 100644 --- a/recipes/eltiempo_hn.recipe +++ b/recipes/eltiempo_hn.recipe @@ -10,6 +10,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class ElTiempoHn(BasicNewsRecipe): title = 'El Tiempo - Honduras' __author__ = 'Darko Miletic' @@ -36,9 +43,9 @@ class ElTiempoHn(BasicNewsRecipe): def preprocess_html(self, soup): soup.html['lang'] = self.lang soup.html['dir'] = self.direction - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=utf-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/estadao.recipe b/recipes/estadao.recipe index b2f8215528..5e7bf6b43f 100644 --- a/recipes/estadao.recipe +++ b/recipes/estadao.recipe @@ -6,6 +6,13 @@ from calibre.utils.magick import Image, PixelWand from urllib2 import Request, urlopen, URLError +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class Estadao(BasicNewsRecipe): THUMBALIZR_API = '' # ---->Get your at http://www.thumbalizr.com/ and put here LANGUAGE = 'pt_br' @@ -76,11 +83,11 @@ class Estadao(BasicNewsRecipe): for item in soup.findAll(style=True): del item['style'] if not soup.find(attrs={'http-equiv': 'Content-Language'}): - meta0 = Tag(soup, 'meta', [ + meta0 = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.LANGHTM)]) soup.head.insert(0, meta0) if not soup.find(attrs={'http-equiv': 'Content-Type'}): - meta1 = Tag(soup, 'meta', [ + meta1 = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=" + self.ENCHTM)]) soup.head.insert(0, meta1) return soup diff --git a/recipes/fastcompany.recipe b/recipes/fastcompany.recipe index cfd9dd65a6..e19510aff1 100644 --- a/recipes/fastcompany.recipe +++ b/recipes/fastcompany.recipe @@ -10,6 +10,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class FastCompany(BasicNewsRecipe): title = 'Fast Company' __author__ = 'Darko Miletic' @@ -43,9 +50,9 @@ class FastCompany(BasicNewsRecipe): def preprocess_html(self, soup): soup.html['xml:lang'] = self.lang soup.html['lang'] = self.lang - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=UTF-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/fokkeensukke.recipe b/recipes/fokkeensukke.recipe index 906b55c03d..d8fac65ff1 100644 --- a/recipes/fokkeensukke.recipe +++ b/recipes/fokkeensukke.recipe @@ -2,6 +2,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class FokkeEnSukkeRecipe(BasicNewsRecipe): __license__ = 'GPL v3' __author__ = 'kwetal' @@ -79,7 +86,7 @@ class FokkeEnSukkeRecipe(BasicNewsRecipe): if img: title = img['alt'] - tag = Tag(soup, 'div', [('class', 'title')]) + tag = new_tag(soup, 'div', [('class', 'title')]) tag.insert(0, title) cartoon.insert(0, tag) diff --git a/recipes/glennbeck.recipe b/recipes/glennbeck.recipe index 0b40251333..186becf2f5 100644 --- a/recipes/glennbeck.recipe +++ b/recipes/glennbeck.recipe @@ -2,6 +2,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag, Comment +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class GlennBeckRecipe(BasicNewsRecipe): __license__ = 'GPL v3' __author__ = 'kwetal' @@ -71,7 +78,7 @@ class GlennBeckRecipe(BasicNewsRecipe): if (txt.parent.name == 'body' and len(raw) > 0) and not (len(raw) == 6 and raw == ' '): # This is our content; ignore the rest. - para = Tag(freshSoup, 'p') + para = new_tag(freshSoup, 'p') para.append(raw) freshSoup.body.append(para) counter += 1 diff --git a/recipes/hln.recipe b/recipes/hln.recipe index f1369f049d..0ecc477c8a 100644 --- a/recipes/hln.recipe +++ b/recipes/hln.recipe @@ -9,6 +9,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class HLN_be(BasicNewsRecipe): title = 'Het Belang Van Limburg' __author__ = 'Darko Miletic and Sujata Raman' @@ -53,9 +60,9 @@ class HLN_be(BasicNewsRecipe): del item['style'] soup.html['lang'] = self.lang soup.html['dir'] = self.direction - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=utf-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/hoy.recipe b/recipes/hoy.recipe index 20e1b3ed22..104e04ab7c 100644 --- a/recipes/hoy.recipe +++ b/recipes/hoy.recipe @@ -11,6 +11,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class Hoy(BasicNewsRecipe): title = 'HOY' __author__ = 'Fco Javier Nieto' @@ -61,7 +68,7 @@ class Hoy(BasicNewsRecipe): def preprocess_html(self, soup): soup.html['dir'] = self.direction - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=utf-8")]) soup.head.insert(0, mcharset) for item in soup.findAll(style=True): diff --git a/recipes/hrt.recipe b/recipes/hrt.recipe index f84133e939..d2fcf3bcdc 100644 --- a/recipes/hrt.recipe +++ b/recipes/hrt.recipe @@ -12,6 +12,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class HRT(BasicNewsRecipe): title = 'HRT: Vesti' __author__ = 'Darko Miletic' @@ -62,9 +69,9 @@ class HRT(BasicNewsRecipe): def preprocess_html(self, soup): soup.html['xml:lang'] = self.lang soup.html['lang'] = self.lang - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=UTF-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/independent.recipe b/recipes/independent.recipe index 6ca4273895..a4569715fb 100644 --- a/recipes/independent.recipe +++ b/recipes/independent.recipe @@ -11,6 +11,13 @@ def classes(classes): 'class': lambda x: x and frozenset(x.split()).intersection(q)}) +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class TheIndependentNew(BasicNewsRecipe): title = u'The Independent' @@ -65,7 +72,7 @@ class TheIndependentNew(BasicNewsRecipe): for li in div.findAll('li', attrs={'data-gallery-legend': True}): src = imgs.get(li['data-gallery-legend']) if src is not None: - img = Tag(soup, 'img') + img = new_tag(soup, 'img') img['src'] = src img['style'] = 'display:block' li.append(img) diff --git a/recipes/joop.recipe b/recipes/joop.recipe index d2cd92ef4c..4cbdf39eca 100644 --- a/recipes/joop.recipe +++ b/recipes/joop.recipe @@ -3,6 +3,13 @@ from calibre.ebooks.BeautifulSoup import Tag import re +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class JoopRecipe(BasicNewsRecipe): __license__ = 'GPL v3' __author__ = 'kwetal' @@ -89,7 +96,7 @@ class JoopRecipe(BasicNewsRecipe): span = h2.find('span', 'info') if span: txt = span.find(text=True) - div = Tag(soup, 'div', attrs=[('class', 'joop_date')]) + div = new_tag(soup, 'div', attrs=[('class', 'joop_date')]) div.append(txt) h2.replaceWith(div) diff --git a/recipes/jutarnji.recipe b/recipes/jutarnji.recipe index 9397cb3067..ddfb0e6592 100644 --- a/recipes/jutarnji.recipe +++ b/recipes/jutarnji.recipe @@ -11,6 +11,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class Jutarnji(BasicNewsRecipe): title = 'Jutarnji' __author__ = 'Darko Miletic' @@ -68,9 +75,9 @@ class Jutarnji(BasicNewsRecipe): item[attrib] = '' del item[attrib] - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=UTF-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/laprensa_hn.recipe b/recipes/laprensa_hn.recipe index 88c3e58c54..37e50e4b5a 100644 --- a/recipes/laprensa_hn.recipe +++ b/recipes/laprensa_hn.recipe @@ -10,6 +10,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class LaPrensaHn(BasicNewsRecipe): title = 'La Prensa - Honduras' __author__ = 'Darko Miletic' @@ -46,9 +53,9 @@ class LaPrensaHn(BasicNewsRecipe): def preprocess_html(self, soup): soup.html['lang'] = self.lang soup.html['dir'] = self.direction - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=utf-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/latribuna.recipe b/recipes/latribuna.recipe index 3d8709739d..5176c4c4b1 100644 --- a/recipes/latribuna.recipe +++ b/recipes/latribuna.recipe @@ -10,6 +10,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class LaTribuna(BasicNewsRecipe): title = 'La Tribuna - Honduras' __author__ = 'Darko Miletic' @@ -49,9 +56,9 @@ class LaTribuna(BasicNewsRecipe): def preprocess_html(self, soup): soup.html['lang'] = self.lang soup.html['dir'] = self.direction - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=utf-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/lavanguardia.recipe b/recipes/lavanguardia.recipe index c01dd3c57f..6165d1a648 100644 --- a/recipes/lavanguardia.recipe +++ b/recipes/lavanguardia.recipe @@ -11,6 +11,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class LaVanguardia(BasicNewsRecipe): title = 'La Vanguardia Digital' __author__ = 'Darko Miletic' @@ -61,7 +68,7 @@ class LaVanguardia(BasicNewsRecipe): def preprocess_html(self, soup): soup.html['dir'] = self.direction - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=utf-8")]) soup.head.insert(0, mcharset) for item in soup.findAll(style=True): diff --git a/recipes/lenta_ru.recipe b/recipes/lenta_ru.recipe index 583954ea75..a680013cae 100644 --- a/recipes/lenta_ru.recipe +++ b/recipes/lenta_ru.recipe @@ -10,6 +10,13 @@ from calibre.web.feeds.news import BasicNewsRecipe import re +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class LentaRURecipe(BasicNewsRecipe): title = u'Lenta.ru: \u041d\u043e\u0432\u043e\u0441\u0442\u0438' __author__ = 'Nikolai Kotchetkov' @@ -113,7 +120,7 @@ class LentaRURecipe(BasicNewsRecipe): def postprocess_html(self, soup, first_fetch): - contents = Tag(soup, 'div') + contents = new_tag(soup, 'div') # Extract tags with given attributes extractElements = {'div': [{'id': 'readers-block'}]} @@ -155,13 +162,13 @@ class LentaRURecipe(BasicNewsRecipe): # Place article picture after date pic = soup.find('img') if pic: - picDiv = Tag(soup, 'div') + picDiv = new_tag(soup, 'div') picDiv['style'] = 'width: 100%; text-align: center;' pic.extract() picDiv.insert(0, pic) title = pic.get('title', None) if title: - titleDiv = Tag(soup, 'div') + titleDiv = new_tag(soup, 'div') titleDiv['style'] = 'font-size: 0.5em;' titleDiv.insert(0, title) picDiv.insert(1, titleDiv) diff --git a/recipes/levante.recipe b/recipes/levante.recipe index 33652afb00..ab236393cf 100644 --- a/recipes/levante.recipe +++ b/recipes/levante.recipe @@ -2,6 +2,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class LevanteRecipe(BasicNewsRecipe): __license__ = 'GPL v3' __author__ = 'kwetal' @@ -92,7 +99,7 @@ class LevanteRecipe(BasicNewsRecipe): # Nuke some real crappy html theirHead = soup.head theirHead.extract() - myHead = Tag(soup, 'head') + myHead = new_tag(soup, 'head') soup.insert(0, myHead) return soup diff --git a/recipes/moneycontrol.recipe b/recipes/moneycontrol.recipe index 8cc0cfdeac..1c893e6d44 100644 --- a/recipes/moneycontrol.recipe +++ b/recipes/moneycontrol.recipe @@ -1,4 +1,12 @@ from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import Tag + + +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) class MoneyControlRecipe(BasicNewsRecipe): @@ -37,7 +45,7 @@ class MoneyControlRecipe(BasicNewsRecipe): headline = soup.find('td', attrs = {'class': 'heading'}) if headline: - h1 = Tag(freshSoup, 'h1') + h1 = new_tag(freshSoup, 'h1') # Convert to string before adding it to the document! h1.append(self.tag_to_string(headline)) freshSoup.body.append(h1) @@ -47,7 +55,7 @@ class MoneyControlRecipe(BasicNewsRecipe): # We have some weird pagebreak marker here; it will not find all of them however continue - para = Tag(freshSoup, 'p') + para = new_tag(freshSoup, 'p') # Convert to string; this will loose all formatting but also all illegal markup para.append(self.tag_to_string(p)) diff --git a/recipes/montreal_gazette.recipe b/recipes/montreal_gazette.recipe index d1366c4c07..456f082dfd 100644 --- a/recipes/montreal_gazette.recipe +++ b/recipes/montreal_gazette.recipe @@ -11,6 +11,13 @@ from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import BeautifulStoneSoup, Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class CanWestPaper(BasicNewsRecipe): postmedia_index_pages = [ @@ -218,21 +225,21 @@ class CanWestPaper(BasicNewsRecipe): pgall = soup.find('div', attrs={'id': 'storyphoto'}) if pgall is not None: # photo gallery perhaps if (soup.find('div', attrs={'id': 'storycontent'}) is None): - allpics = Tag(soup, 'div') + allpics = new_tag(soup, 'div') first_img = pgall.find('div', 'storyimage') if first_img is not None: first_img.extract() tlist = pgall.find('div', attrs={'id': 'relatedthumbs'}) if tlist is not None: for atag in tlist.findAll('a'): - img = Tag(soup, 'img') + img = new_tag(soup, 'img') srcpre, sep, srcpost = atag.img[ 'src'].partition('?') img['src'] = srcpre - pdesc = Tag(soup, 'p') + pdesc = new_tag(soup, 'p') pdesc.insert(0, atag.img['alt']) pdesc['class'] = 'photocaption' - div = Tag(soup, 'div') + div = new_tag(soup, 'div') div.insert(0, pdesc) div.insert(0, img) allpics.append(div) diff --git a/recipes/nacional_cro.recipe b/recipes/nacional_cro.recipe index e6c33008fa..e11c4028a4 100644 --- a/recipes/nacional_cro.recipe +++ b/recipes/nacional_cro.recipe @@ -12,6 +12,13 @@ from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class NacionalCro(BasicNewsRecipe): title = 'Nacional - Hr' __author__ = 'Darko Miletic' @@ -44,9 +51,9 @@ class NacionalCro(BasicNewsRecipe): def preprocess_html(self, soup): soup.html['lang'] = self.lang soup.html['dir'] = self.direction - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=UTF-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/natgeo.recipe b/recipes/natgeo.recipe index f185b3c731..af9b4e4c9f 100644 --- a/recipes/natgeo.recipe +++ b/recipes/natgeo.recipe @@ -13,6 +13,13 @@ def classes(classes): 'class': lambda x: x and frozenset(x.split()).intersection(q)}) +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class NatGeo(BasicNewsRecipe): title = u'National Geographic' description = 'Daily news articles from The National Geographic' @@ -64,7 +71,7 @@ class NatGeo(BasicNewsRecipe): idx = url.find('.jpg/{width') if idx != -1: url = url[:idx + 4] - img = Tag(soup, "img") + img = new_tag(soup, "img") img['src'] = url div.append(img) diff --git a/recipes/ncrnext.recipe b/recipes/ncrnext.recipe index 96d3337703..a28879028f 100644 --- a/recipes/ncrnext.recipe +++ b/recipes/ncrnext.recipe @@ -2,6 +2,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class NrcNextRecipe(BasicNewsRecipe): __license__ = 'GPL v3' __author__ = 'kwetal' @@ -100,20 +107,20 @@ class NrcNextRecipe(BasicNewsRecipe): if tag: h2 = tag.find('h2', 'vlag') if h2: - new_h2 = Tag(soup, 'h2', attrs=[('class', 'vlag')]) + new_h2 = new_tag(soup, 'h2', attrs=[('class', 'vlag')]) new_h2.append(self.tag_to_string(h2)) h2.replaceWith(new_h2) else: h2 = tag.find('h2') if h2: - new_h2 = Tag(soup, 'h2', attrs=[ + new_h2 = new_tag(soup, 'h2', attrs=[ ('class', 'sub_title')]) new_h2.append(self.tag_to_string(h2)) h2.replaceWith(new_h2) h1 = tag.find('h1') if h1: - new_h1 = Tag(soup, 'h1') + new_h1 = new_tag(soup, 'h1') new_h1.append(self.tag_to_string(h1)) h1.replaceWith(new_h1) diff --git a/recipes/new_yorker.recipe b/recipes/new_yorker.recipe index 93f5d16203..d19cd42c86 100644 --- a/recipes/new_yorker.recipe +++ b/recipes/new_yorker.recipe @@ -23,6 +23,13 @@ def absurl(x): return x +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class NewYorker(BasicNewsRecipe): title = u'New Yorker Magazine' @@ -114,12 +121,12 @@ class NewYorker(BasicNewsRecipe): title = soup.find('meta', itemprop='name') if title: if self.featured_image: - img = Tag(soup, 'img') + img = new_tag(soup, 'img') img['src'] = self.featured_image - div = Tag(soup, 'div') + div = new_tag(soup, 'div') div.append(img) body.insert(0, div) - h1 = Tag(soup, 'h1') + h1 = new_tag(soup, 'h1') h1.append(title.get('content')) body.insert(0, h1) for attr in 'srcset data-src-mobile'.split(): diff --git a/recipes/noaa.recipe b/recipes/noaa.recipe index 87377dca72..c156d215eb 100644 --- a/recipes/noaa.recipe +++ b/recipes/noaa.recipe @@ -10,6 +10,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class NOAA(BasicNewsRecipe): title = 'NOAA Online' __author__ = 'Darko Miletic' @@ -32,9 +39,9 @@ class NOAA(BasicNewsRecipe): def preprocess_html(self, soup): soup.html['xml:lang'] = self.lang soup.html['lang'] = self.lang - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=UTF-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/nrc.nl.recipe b/recipes/nrc.nl.recipe index c3993c6e69..cfa3751b71 100644 --- a/recipes/nrc.nl.recipe +++ b/recipes/nrc.nl.recipe @@ -8,6 +8,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class Pagina12(BasicNewsRecipe): title = 'NRC' __author__ = 'Darko Miletic' @@ -42,7 +49,7 @@ class Pagina12(BasicNewsRecipe): div = soup.find( 'div', attrs={'class': lambda x: x and 'featured-img' in x}) if div is not None: - img = Tag(soup, 'img') + img = new_tag(soup, 'img') img['src'] = src div.append(img) return soup diff --git a/recipes/nspm.recipe b/recipes/nspm.recipe index f2e41e9d1d..ca1089ff7e 100644 --- a/recipes/nspm.recipe +++ b/recipes/nspm.recipe @@ -9,6 +9,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import NavigableString, Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class Nspm(BasicNewsRecipe): title = 'Nova srpska politicka misao' __author__ = 'Darko Miletic' @@ -62,7 +69,7 @@ class Nspm(BasicNewsRecipe): def preprocess_html(self, soup): atitle = soup.body.find('a', attrs={'class': 'contentpagetitle'}) if atitle: - cleanTitle = Tag(soup, 'h1', [('class', 'contentpagetitle')]) + cleanTitle = new_tag(soup, 'h1', [('class', 'contentpagetitle')]) cnt = NavigableString(self.tag_to_string(atitle)) cleanTitle.append(cnt) @@ -73,12 +80,12 @@ class Nspm(BasicNewsRecipe): crdate = soup.body.find('td', attrs={'class': 'createdate'}) if crdate: - cleanCrdate = Tag(soup, 'div', [('class', 'createdate')]) + cleanCrdate = new_tag(soup, 'div', [('class', 'createdate')]) cnt = NavigableString(self.tag_to_string(crdate)) cleanCrdate.append(cnt) # get the dependant element - artText = Tag(soup, 'div', [('class', 'text')]) + artText = new_tag(soup, 'div', [('class', 'text')]) textHolderp = crdate.parent textHolder = textHolderp.nextSibling while textHolder and (not isinstance(textHolder, Tag) or (textHolder.name != textHolderp.name)): diff --git a/recipes/nytimes.recipe b/recipes/nytimes.recipe index 8ef35ee375..53cd997b4e 100644 --- a/recipes/nytimes.recipe +++ b/recipes/nytimes.recipe @@ -67,6 +67,13 @@ def classes(classes): 'class': lambda x: x and frozenset(x.split()).intersection(q)}) +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class NewYorkTimes(BasicNewsRecipe): if is_web_edition: @@ -116,7 +123,7 @@ class NewYorkTimes(BasicNewsRecipe): keep_only_tags = [ dict(id='story'), ] - body = Tag(soup, 'body') + body = new_tag(soup, 'body') for spec in keep_only_tags: for tag in soup.find('body').findAll(**spec): body.insert(len(body.contents), tag) diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index 0670acc39f..6dfa18d188 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -67,6 +67,13 @@ def classes(classes): 'class': lambda x: x and frozenset(x.split()).intersection(q)}) +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class NewYorkTimes(BasicNewsRecipe): if is_web_edition: @@ -116,7 +123,7 @@ class NewYorkTimes(BasicNewsRecipe): keep_only_tags = [ dict(id='story'), ] - body = Tag(soup, 'body') + body = new_tag(soup, 'body') for spec in keep_only_tags: for tag in soup.find('body').findAll(**spec): body.insert(len(body.contents), tag) diff --git a/recipes/nzz_webpaper.recipe b/recipes/nzz_webpaper.recipe index f65d4af015..8847e26547 100644 --- a/recipes/nzz_webpaper.recipe +++ b/recipes/nzz_webpaper.recipe @@ -13,6 +13,13 @@ from calibre.ptempfile import PersistentTemporaryFile from calibre.web.feeds.recipes import BasicNewsRecipe +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class Nzz(BasicNewsRecipe): title = 'NZZ Webpaper' __author__ = 'Bernd Leinfelder' @@ -56,7 +63,7 @@ class Nzz(BasicNewsRecipe): for span in soup.findAll('span', attrs={'data-src-640': True}): imgSrc = span['data-src-640'] # print "image source: "+ imgSrc - imgTag = Tag(soup, "img", [("src", imgSrc)]) + imgTag = new_tag(soup, "img", [("src", imgSrc)]) span.replaceWith(imgTag) # print soup.prettify() diff --git a/recipes/ottawa_citizen.recipe b/recipes/ottawa_citizen.recipe index a5f16c5bef..ac5f4ca441 100644 --- a/recipes/ottawa_citizen.recipe +++ b/recipes/ottawa_citizen.recipe @@ -11,6 +11,13 @@ from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import BeautifulStoneSoup, Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class CanWestPaper(BasicNewsRecipe): postmedia_index_pages = [ @@ -218,21 +225,21 @@ class CanWestPaper(BasicNewsRecipe): pgall = soup.find('div', attrs={'id': 'storyphoto'}) if pgall is not None: # photo gallery perhaps if (soup.find('div', attrs={'id': 'storycontent'}) is None): - allpics = Tag(soup, 'div') + allpics = new_tag(soup, 'div') first_img = pgall.find('div', 'storyimage') if first_img is not None: first_img.extract() tlist = pgall.find('div', attrs={'id': 'relatedthumbs'}) if tlist is not None: for atag in tlist.findAll('a'): - img = Tag(soup, 'img') + img = new_tag(soup, 'img') srcpre, sep, srcpost = atag.img[ 'src'].partition('?') img['src'] = srcpre - pdesc = Tag(soup, 'p') + pdesc = new_tag(soup, 'p') pdesc.insert(0, atag.img['alt']) pdesc['class'] = 'photocaption' - div = Tag(soup, 'div') + div = new_tag(soup, 'div') div.insert(0, pdesc) div.insert(0, img) allpics.append(div) diff --git a/recipes/pagina_12_print_ed.recipe b/recipes/pagina_12_print_ed.recipe index fd25d69b3a..0c1f38bc5b 100644 --- a/recipes/pagina_12_print_ed.recipe +++ b/recipes/pagina_12_print_ed.recipe @@ -12,6 +12,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag, NavigableString +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class Pagina12(BasicNewsRecipe): title = 'Pagina/12 - Edicion Impresa' @@ -84,10 +91,10 @@ class Pagina12(BasicNewsRecipe): if img is not None: img.extract() caption = self.tag_to_string(table).strip() - div = Tag(soup, 'div') + div = new_tag(soup, 'div') div['style'] = 'text-align:center' div.insert(0, img) - div.insert(1, Tag(soup, 'br')) + div.insert(1, new_tag(soup, 'br')) if caption: div.insert(2, NavigableString(caption)) table.replaceWith(div) diff --git a/recipes/pobjeda.recipe b/recipes/pobjeda.recipe index 5671bf30dc..1bb4c1813e 100644 --- a/recipes/pobjeda.recipe +++ b/recipes/pobjeda.recipe @@ -13,6 +13,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class Pobjeda(BasicNewsRecipe): title = 'Pobjeda Online' __author__ = 'Darko Miletic' @@ -59,9 +66,9 @@ class Pobjeda(BasicNewsRecipe): def preprocess_html(self, soup): soup.html['xml:lang'] = self.lang soup.html['lang'] = self.lang - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=UTF-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/pressonline.recipe b/recipes/pressonline.recipe index bdae80d3fc..98f9c84147 100644 --- a/recipes/pressonline.recipe +++ b/recipes/pressonline.recipe @@ -12,6 +12,13 @@ from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class PressOnline(BasicNewsRecipe): title = 'Press Online' __author__ = 'Darko Miletic' @@ -60,7 +67,7 @@ class PressOnline(BasicNewsRecipe): def preprocess_html(self, soup): soup.html['lang'] = self.lang soup.html['dir'] = self.direction - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) soup.head.insert(0, mlang) return self.adeify_images(soup) diff --git a/recipes/revista_muy.recipe b/recipes/revista_muy.recipe index 7e344efd8f..ed5b087861 100644 --- a/recipes/revista_muy.recipe +++ b/recipes/revista_muy.recipe @@ -3,6 +3,13 @@ from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class RevistaMuyInteresante(BasicNewsRecipe): title = 'Revista Muy Interesante' @@ -24,7 +31,7 @@ class RevistaMuyInteresante(BasicNewsRecipe): for img_tag in soup.findAll('img'): imagen = img_tag - new_tag = Tag(soup, 'p') + new_tag = new_tag(soup, 'p') img_tag.replaceWith(new_tag) div = soup.find(attrs={'class': 'article_category'}) div.insert(0, imagen) diff --git a/recipes/rts.recipe b/recipes/rts.recipe index 29c10f168b..2d42bea682 100644 --- a/recipes/rts.recipe +++ b/recipes/rts.recipe @@ -12,6 +12,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class RTS(BasicNewsRecipe): title = 'RTS: Vesti' __author__ = 'Darko Miletic' @@ -50,9 +57,9 @@ class RTS(BasicNewsRecipe): def preprocess_html(self, soup): soup.html['xml:lang'] = self.lang soup.html['lang'] = self.lang - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=UTF-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/sarajevo_x.recipe b/recipes/sarajevo_x.recipe index 5fa8181608..21524ecab6 100644 --- a/recipes/sarajevo_x.recipe +++ b/recipes/sarajevo_x.recipe @@ -10,6 +10,13 @@ from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag, NavigableString +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class SarajevoX(BasicNewsRecipe): title = 'Sarajevo-x.com' __author__ = 'Darko Miletic' @@ -57,7 +64,7 @@ class SarajevoX(BasicNewsRecipe): if sp: sp else: - mtag = Tag(soup, 'div', [ + mtag = new_tag(soup, 'div', [ ("id", "opisslike"), ("class", "opscitech")]) mopis = NavigableString("Opis") mtag.insert(0, mopis) diff --git a/recipes/scmp.recipe b/recipes/scmp.recipe index 46c5d24aad..735ac9a79f 100644 --- a/recipes/scmp.recipe +++ b/recipes/scmp.recipe @@ -12,6 +12,13 @@ def classes(classes): 'class': lambda x: x and frozenset(x.split()).intersection(q)}) +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class SCMP(BasicNewsRecipe): title = 'South China Morning Post' __author__ = 'llam' @@ -71,7 +78,7 @@ class SCMP(BasicNewsRecipe): wrapper = soup.find(**classes('image-wrapper__placeholder')) if wrapper is not None: p = wrapper.parent - img = Tag(soup, 'img') + img = new_tag(soup, 'img') img['src'] = meta['content'] p.append(img) wrapper.extract() diff --git a/recipes/southernstar.recipe b/recipes/southernstar.recipe index 38ed08970b..8bcd12e885 100644 --- a/recipes/southernstar.recipe +++ b/recipes/southernstar.recipe @@ -14,6 +14,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag, NavigableString +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class TheSouthernStar(BasicNewsRecipe): title = 'The Southern Star' @@ -117,10 +124,10 @@ class TheSouthernStar(BasicNewsRecipe): if img is not None: img.extract() caption = self.tag_to_string(table).strip() - div = Tag(soup, 'div') + div = new_tag(soup, 'div') div['style'] = 'text-align:center' div.insert(0, img) - div.insert(1, Tag(soup, 'br')) + div.insert(1, new_tag(soup, 'br')) if caption: div.insert(2, NavigableString(caption)) table.replaceWith(div) diff --git a/recipes/tijd.recipe b/recipes/tijd.recipe index a2dd9aa7d4..86eff286c4 100644 --- a/recipes/tijd.recipe +++ b/recipes/tijd.recipe @@ -9,6 +9,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class DeTijd(BasicNewsRecipe): title = 'De Tijd' __author__ = 'Darko Miletic' @@ -68,11 +75,11 @@ class DeTijd(BasicNewsRecipe): del item['style'] soup.html['lang'] = self.lang soup.html['dir'] = self.direction - mlang = Tag( + mlang = new_tag( soup, 'meta', [("http-equiv", "Content-Language"), ("content", self.lang)] ) - mcharset = Tag( + mcharset = new_tag( soup, 'meta', [("http-equiv", "Content-Type"), ("content", "text/html; charset=utf-8")] ) diff --git a/recipes/uncrate.recipe b/recipes/uncrate.recipe index 09a8ad079d..cb174b8892 100644 --- a/recipes/uncrate.recipe +++ b/recipes/uncrate.recipe @@ -10,6 +10,13 @@ from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class Uncrate(BasicNewsRecipe): title = 'Uncrate' __author__ = 'Darko Miletic' @@ -47,9 +54,9 @@ class Uncrate(BasicNewsRecipe): feeds = [(u'Articles', u'http://feeds.feedburner.com/uncrate')] def preprocess_html(self, soup): - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=utf-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/vancouver_province.recipe b/recipes/vancouver_province.recipe index 588133290d..39ce9681e6 100644 --- a/recipes/vancouver_province.recipe +++ b/recipes/vancouver_province.recipe @@ -11,6 +11,13 @@ from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import BeautifulStoneSoup, Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class CanWestPaper(BasicNewsRecipe): postmedia_index_pages = [ @@ -231,21 +238,21 @@ class CanWestPaper(BasicNewsRecipe): pgall = soup.find('div', attrs={'id': 'storyphoto'}) if pgall is not None: # photo gallery perhaps if (soup.find('div', attrs={'id': 'storycontent'}) is None): - allpics = Tag(soup, 'div') + allpics = new_tag(soup, 'div') first_img = pgall.find('div', 'storyimage') if first_img is not None: first_img.extract() tlist = pgall.find('div', attrs={'id': 'relatedthumbs'}) if tlist is not None: for atag in tlist.findAll('a'): - img = Tag(soup, 'img') + img = new_tag(soup, 'img') srcpre, sep, srcpost = atag.img[ 'src'].partition('?') img['src'] = srcpre - pdesc = Tag(soup, 'p') + pdesc = new_tag(soup, 'p') pdesc.insert(0, atag.img['alt']) pdesc['class'] = 'photocaption' - div = Tag(soup, 'div') + div = new_tag(soup, 'div') div.insert(0, pdesc) div.insert(0, img) allpics.append(div) diff --git a/recipes/vancouver_sun.recipe b/recipes/vancouver_sun.recipe index e0c9e4fdce..45e2b8f9b5 100644 --- a/recipes/vancouver_sun.recipe +++ b/recipes/vancouver_sun.recipe @@ -11,6 +11,13 @@ from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import BeautifulStoneSoup, Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class CanWestPaper(BasicNewsRecipe): compress_news_images = True @@ -219,21 +226,21 @@ class CanWestPaper(BasicNewsRecipe): pgall = soup.find('div', attrs={'id': 'storyphoto'}) if pgall is not None: # photo gallery perhaps if (soup.find('div', attrs={'id': 'storycontent'}) is None): - allpics = Tag(soup, 'div') + allpics = new_tag(soup, 'div') first_img = pgall.find('div', 'storyimage') if first_img is not None: first_img.extract() tlist = pgall.find('div', attrs={'id': 'relatedthumbs'}) if tlist is not None: for atag in tlist.findAll('a'): - img = Tag(soup, 'img') + img = new_tag(soup, 'img') srcpre, sep, srcpost = atag.img[ 'src'].partition('?') img['src'] = srcpre - pdesc = Tag(soup, 'p') + pdesc = new_tag(soup, 'p') pdesc.insert(0, atag.img['alt']) pdesc['class'] = 'photocaption' - div = Tag(soup, 'div') + div = new_tag(soup, 'div') div.insert(0, pdesc) div.insert(0, img) allpics.append(div) diff --git a/recipes/vecernji_list.recipe b/recipes/vecernji_list.recipe index ae627c155e..95a7a0cc70 100644 --- a/recipes/vecernji_list.recipe +++ b/recipes/vecernji_list.recipe @@ -12,6 +12,13 @@ from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class VecernjiList(BasicNewsRecipe): title = 'Vecernji List' __author__ = 'Darko Miletic' @@ -48,9 +55,9 @@ class VecernjiList(BasicNewsRecipe): soup.html['lang'] = self.lang soup.html['dir'] = self.direction - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=UTF-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/vedomosti.recipe b/recipes/vedomosti.recipe index f3e67fef11..0270e221b1 100644 --- a/recipes/vedomosti.recipe +++ b/recipes/vedomosti.recipe @@ -9,6 +9,13 @@ from calibre.ebooks.BeautifulSoup import Tag from calibre.web.feeds.news import BasicNewsRecipe +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class VedomostiRecipe(BasicNewsRecipe): title = u'Ведомости' __author__ = 'Nikolai Kotchetkov' @@ -145,7 +152,7 @@ class VedomostiRecipe(BasicNewsRecipe): if newstop: img = newstop.find('img') if img: - imgDiv = Tag(soup, 'div') + imgDiv = new_tag(soup, 'div') imgDiv['class'] = 'article_img' if img.get('width'): diff --git a/recipes/veintitres.recipe b/recipes/veintitres.recipe index 372ce2fb91..a3f3618954 100644 --- a/recipes/veintitres.recipe +++ b/recipes/veintitres.recipe @@ -10,6 +10,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class Veintitres(BasicNewsRecipe): title = 'Veintitres' __author__ = 'Darko Miletic' @@ -52,9 +59,9 @@ class Veintitres(BasicNewsRecipe): del item['style'] soup.html['lang'] = self.lang soup.html['dir'] = self.direction - mlang = Tag(soup, 'meta', [ + mlang = new_tag(soup, 'meta', [ ("http-equiv", "Content-Language"), ("content", self.lang)]) - mcharset = Tag(soup, 'meta', [ + mcharset = new_tag(soup, 'meta', [ ("http-equiv", "Content-Type"), ("content", "text/html; charset=utf-8")]) soup.head.insert(0, mlang) soup.head.insert(1, mcharset) diff --git a/recipes/vic_times.recipe b/recipes/vic_times.recipe index 822b50f503..148985c43e 100644 --- a/recipes/vic_times.recipe +++ b/recipes/vic_times.recipe @@ -12,6 +12,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag, BeautifulStoneSoup +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class TimesColonist(BasicNewsRecipe): # Customization -- remove sections you don't want. @@ -179,7 +186,7 @@ class TimesColonist(BasicNewsRecipe): authstr = re.sub('/ *Times Colonist', '/', authstr, flags=re.IGNORECASE) authstr = re.sub('BY */', '', authstr, flags=re.IGNORECASE) - newdiv = Tag(soup, 'div') + newdiv = new_tag(soup, 'div') newdiv.insert(0, authstr) newdiv['class'] = 'byline' byline.replaceWith(newdiv) @@ -187,7 +194,7 @@ class TimesColonist(BasicNewsRecipe): capstr = self.tag_to_string(caption, False) capstr = re.sub('Photograph by.*$', '', capstr, flags=re.IGNORECASE) - newdiv = Tag(soup, 'div') + newdiv = new_tag(soup, 'div') newdiv.insert(0, capstr) newdiv['class'] = 'caption' caption.replaceWith(newdiv) diff --git a/recipes/vrijnederland.recipe b/recipes/vrijnederland.recipe index 26be59406f..bd5c7e80ce 100644 --- a/recipes/vrijnederland.recipe +++ b/recipes/vrijnederland.recipe @@ -2,6 +2,13 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag +def new_tag(soup, name, attrs=()): + impl = getattr(soup, 'new_tag', None) + if impl is not None: + return impl(name, attrs=dict(attrs)) + return Tag(soup, name, attrs=attrs or None) + + class VrijNederlandRecipe(BasicNewsRecipe): __license__ = 'GPL v3' __author__ = 'kwetal' @@ -73,7 +80,7 @@ class VrijNederlandRecipe(BasicNewsRecipe): # altogether theirHead = soup.head theirHead.extract() - myHead = Tag(soup, 'head') + myHead = new_tag(soup, 'head') soup.insert(0, myHead) return soup From 9ecadb9c13033ba683c25088baab08a72664459e Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 21 Mar 2019 13:10:56 -0400 Subject: [PATCH 0383/2613] python3: use exec() instead of execfile() --- src/calibre/debug.py | 3 ++- src/calibre/library/catalogs/epub_mobi_builder.py | 4 +++- src/calibre/utils/ipython.py | 3 ++- src/calibre/utils/rapydscript.py | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/calibre/debug.py b/src/calibre/debug.py index 3b8c901377..ee2dd8fd35 100644 --- a/src/calibre/debug.py +++ b/src/calibre/debug.py @@ -248,7 +248,8 @@ def run_script(path, args): g = globals() g['__name__'] = '__main__' g['__file__'] = ef - execfile(ef, g) + with open(ef, 'rb') as f: + exec(compile(f.read(), ef, 'exec'), g) def inspect_mobi(path): diff --git a/src/calibre/library/catalogs/epub_mobi_builder.py b/src/calibre/library/catalogs/epub_mobi_builder.py index 44bbc7f166..b76bdf772f 100644 --- a/src/calibre/library/catalogs/epub_mobi_builder.py +++ b/src/calibre/library/catalogs/epub_mobi_builder.py @@ -4602,7 +4602,9 @@ class CatalogBuilder(object): """ templates = {} - execfile(P('catalog/section_list_templates.py'), templates) + ef = P('catalog/section_list_templates.py') + with open(ef, 'rb')) as f: + exec(compile(f.read(), ef, 'exec'), templates) for name, template in templates.iteritems(): if name.startswith('by_') and name.endswith('_template'): setattr(self, name, force_unicode(template, 'utf-8')) diff --git a/src/calibre/utils/ipython.py b/src/calibre/utils/ipython.py index 4377a2c172..3bfa0f8054 100644 --- a/src/calibre/utils/ipython.py +++ b/src/calibre/utils/ipython.py @@ -214,7 +214,8 @@ def ipython(user_ns=None): c = Config() user_conf = os.path.expanduser('~/.ipython/profile_default/ipython_config.py') if os.path.exists(user_conf): - execfile(user_conf, {'get_config': lambda: c}) + with open(user_conf, 'rb') as f: + exec(compile(f.read(), user_conf, 'exec'), {'get_config': lambda: c}) c.TerminalInteractiveShell.prompts_class = CustomPrompt c.InteractiveShellApp.exec_lines = [ 'from __future__ import division, absolute_import, unicode_literals, print_function', diff --git a/src/calibre/utils/rapydscript.py b/src/calibre/utils/rapydscript.py index 67db41e87e..8dde3e32e7 100644 --- a/src/calibre/utils/rapydscript.py +++ b/src/calibre/utils/rapydscript.py @@ -203,7 +203,8 @@ def compile_srv(): base = base_dir() iconf = os.path.join(base, 'imgsrc', 'srv', 'generate.py') g = {'__file__': iconf} - execfile(iconf, g) + with open(iconf, 'rb') as f: + exec(compile(f.read(), iconf, 'exec'), g) icons = g['merge']().encode('utf-8') with lopen(os.path.join(base, 'resources', 'content-server', 'reset.css'), 'rb') as f: reset = f.read() From 391ca722e0a65558c7f57429bde87055cbc0b897 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 21 Mar 2019 14:03:54 -0400 Subject: [PATCH 0384/2613] python3: PEP 3114 compliance for next() and iterators --- src/calibre/customize/__init__.py | 2 +- src/calibre/db/backend.py | 10 +++++----- src/calibre/db/schema_upgrades.py | 2 +- src/calibre/devices/kobo/bookmark.py | 2 +- src/calibre/devices/kobo/driver.py | 16 ++++++++-------- src/calibre/devices/prs505/sony_cache.py | 5 ++--- src/calibre/devices/smart_device_app/driver.py | 4 ++-- src/calibre/devices/usbms/driver.py | 4 ++-- src/calibre/ebooks/BeautifulSoup.py | 2 +- .../ebooks/conversion/plugins/epub_input.py | 2 +- .../ebooks/conversion/plugins/epub_output.py | 4 ++-- .../ebooks/conversion/plugins/snb_output.py | 4 ++-- src/calibre/ebooks/epub/pages.py | 4 ++-- src/calibre/ebooks/lrf/html/table.py | 2 +- src/calibre/ebooks/mobi/writer2/indexer.py | 4 ++-- src/calibre/ebooks/oeb/base.py | 2 +- src/calibre/ebooks/oeb/polish/jacket.py | 2 +- src/calibre/ebooks/oeb/transforms/split.py | 2 +- src/calibre/ebooks/oeb/transforms/structure.py | 4 ++-- src/calibre/ebooks/pdf/reflow.py | 4 ++-- src/calibre/gui2/actions/__init__.py | 2 +- src/calibre/gui2/custom_column_widgets.py | 2 +- src/calibre/gui2/device.py | 6 +++--- src/calibre/gui2/lrf_renderer/document.py | 3 +-- src/calibre/gui2/lrf_renderer/text.py | 4 ++-- src/calibre/gui2/search_restriction_mixin.py | 2 +- src/calibre/library/database.py | 6 +++--- src/calibre/library/database2.py | 4 ++-- src/calibre/web/feeds/templates.py | 16 ++++++++-------- 29 files changed, 62 insertions(+), 64 deletions(-) diff --git a/src/calibre/customize/__init__.py b/src/calibre/customize/__init__.py index 2a6135fae5..15568991f7 100644 --- a/src/calibre/customize/__init__.py +++ b/src/calibre/customize/__init__.py @@ -212,7 +212,7 @@ class Plugin(object): # {{{ For example to load an image:: pixmap = QPixmap() - pixmap.loadFromData(self.load_resources(['images/icon.png']).itervalues().next()) + next(pixmap.loadFromData(self.load_resources(['images/icon.png']).itervalues()) icon = QIcon(pixmap) :param names: List of paths to resources in the ZIP file using / as separator diff --git a/src/calibre/db/backend.py b/src/calibre/db/backend.py index e7b5b55ac4..72cb901cb6 100644 --- a/src/calibre/db/backend.py +++ b/src/calibre/db/backend.py @@ -46,7 +46,7 @@ from calibre.db.tables import (OneToOneTable, ManyToOneTable, ManyToManyTable, Differences in semantics from pysqlite: 1. execute/executemany operate in autocommit mode - 2. There is no fetchone() method on cursor objects, instead use next() + 2. There is no fetchone() method on cursor objects, instead use next(cursor) 3. There is no executescript ''' @@ -120,7 +120,7 @@ class DBPrefs(dict): # {{{ raw = self.to_raw(val) with self.db.conn: try: - dbraw = self.db.execute('SELECT id,val FROM preferences WHERE key=?', (key,)).next() + dbraw = next(self.db.execute('SELECT id,val FROM preferences WHERE key=?', (key,))) except StopIteration: dbraw = None if dbraw is None or dbraw[1] != raw: @@ -271,7 +271,7 @@ class Connection(apsw.Connection): # {{{ self.execute('pragma cache_size=-5000') self.execute('pragma temp_store=2') - encoding = self.execute('pragma encoding').next()[0] + encoding = next(self.execute('pragma encoding'))[0] self.createcollation('PYNOCASE', partial(pynocase, encoding=encoding)) @@ -306,7 +306,7 @@ class Connection(apsw.Connection): # {{{ if kw.get('all', True): return ans.fetchall() try: - return ans.next()[0] + return next(ans)[0] except (StopIteration, IndexError): return None @@ -875,7 +875,7 @@ class DB(object): if kw.get('all', True): return ans.fetchall() try: - return ans.next()[0] + return next(ans)[0] except (StopIteration, IndexError): return None diff --git a/src/calibre/db/schema_upgrades.py b/src/calibre/db/schema_upgrades.py index 7ad9d2d7c9..d2e18ed94f 100644 --- a/src/calibre/db/schema_upgrades.py +++ b/src/calibre/db/schema_upgrades.py @@ -24,7 +24,7 @@ class SchemaUpgrade(object): # Upgrade database try: while True: - uv = self.db.execute('pragma user_version').next()[0] + uv = next(self.db.execute('pragma user_version'))[0] meth = getattr(self, 'upgrade_version_%d'%uv, None) if meth is None: break diff --git a/src/calibre/devices/kobo/bookmark.py b/src/calibre/devices/kobo/bookmark.py index a08f5573f9..9bc7c89c4c 100644 --- a/src/calibre/devices/kobo/bookmark.py +++ b/src/calibre/devices/kobo/bookmark.py @@ -62,7 +62,7 @@ class Bookmark(): # {{{ kepub_chapter_data = ('{0}-%'.format(row[1]), ) cursor2.execute(kepub_chapter_query, kepub_chapter_data) try: - kepub_chapter = cursor2.next() + kepub_chapter = next(cursor2) chapter_title = kepub_chapter[0] current_chapter = kepub_chapter[1] except StopIteration: diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index e570573f50..2a33f9107f 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -185,7 +185,7 @@ class KOBO(USBMS): cursor = connection.cursor() cursor.execute('SELECT version FROM dbversion') try: - result = cursor.next() + result = next(cursor) dbversion = result['version'] except StopIteration: dbversion = 0 @@ -572,7 +572,7 @@ class KOBO(USBMS): metadata = iter(metadata) for i, location in enumerate(locations): self.report_progress((i+1) / float(len(locations)), _('Adding books to device metadata listing...')) - info = metadata.next() + info = next(metadata) debug_print("KoboTouch::add_books_to_metadata - info=%s" % info) blist = 2 if location[1] == 'cardb' else 1 if location[1] == 'carda' else 0 @@ -790,7 +790,7 @@ class KOBO(USBMS): t = (ContentID,) cursor.execute('select DateLastRead, ReadStatus from Content where BookID is Null and ContentID = ?', t) try: - result = cursor.next() + result = next(cursor) datelastread = result['DateLastRead'] current_ReadStatus = result['ReadStatus'] except StopIteration: @@ -1020,7 +1020,7 @@ class KOBO(USBMS): t = (ContentID,) cursor.execute('select ImageId from Content where BookID is Null and ContentID = ?', t) try: - result = cursor.next() + result = next(cursor) # debug_print("ImageId: ", result[0]) ImageID = result[0] except StopIteration: @@ -2649,7 +2649,7 @@ class KOBOTOUCH(KOBO): t = (ContentID,) cursor.execute('select ImageId from Content where BookID is Null and ContentID = ?', t) try: - result = cursor.next() + result = next(cursor) ImageID = result[0] except StopIteration: ImageID = self.imageid_from_contentid(ContentID) @@ -2752,7 +2752,7 @@ class KOBOTOUCH(KOBO): cursor = connection.cursor() cursor.execute(test_query, test_values) try: - result = cursor.next() + result = next(cursor) except StopIteration: result = None @@ -2860,7 +2860,7 @@ class KOBOTOUCH(KOBO): cursor = connection.cursor() cursor.execute(test_query, test_values) try: - result = cursor.next() + result = next(cursor) except StopIteration: result = None @@ -2909,7 +2909,7 @@ class KOBOTOUCH(KOBO): cursor = connection.cursor() cursor.execute(test_query, test_values) try: - result = cursor.next() + result = next(cursor) except StopIteration: result = None diff --git a/src/calibre/devices/prs505/sony_cache.py b/src/calibre/devices/prs505/sony_cache.py index 132ff00b6d..c8db25b73a 100644 --- a/src/calibre/devices/prs505/sony_cache.py +++ b/src/calibre/devices/prs505/sony_cache.py @@ -705,8 +705,8 @@ class XMLCache(object): child.text = '\n'+'\t'*(level+1) for gc in child: gc.tail = '\n'+'\t'*(level+1) - child.iterchildren(reversed=True).next().tail = '\n'+'\t'*level - root.iterchildren(reversed=True).next().tail = '\n'+'\t'*(level-1) + next(child.iterchildren(reversed=True)).tail = '\n'+'\t'*level + next(root.iterchildren(reversed=True)).tail = '\n'+'\t'*(level-1) def move_playlists_to_bottom(self): for root in self.record_roots.values(): @@ -799,4 +799,3 @@ class XMLCache(object): self.namespaces[i] = ns # }}} - diff --git a/src/calibre/devices/smart_device_app/driver.py b/src/calibre/devices/smart_device_app/driver.py index 7d52dc76c8..8dfe3f468e 100644 --- a/src/calibre/devices/smart_device_app/driver.py +++ b/src/calibre/devices/smart_device_app/driver.py @@ -1471,7 +1471,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): metadata = iter(metadata) for i, infile in enumerate(files): - mdata, fname = metadata.next(), names.next() + mdata, fname = next(metadata), next(names) lpath = self._create_upload_path(mdata, fname, create_dirs=False) self._debug('lpath', lpath) if not hasattr(infile, 'read'): @@ -1497,7 +1497,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): for i, location in enumerate(locations): self.report_progress((i + 1) / float(len(locations)), _('Adding books to device metadata listing...')) - info = metadata.next() + info = next(metadata) lpath = location[0] length = location[1] lpath = self._strip_prefix(lpath) diff --git a/src/calibre/devices/usbms/driver.py b/src/calibre/devices/usbms/driver.py index 1c8e657b7d..0efd62214d 100644 --- a/src/calibre/devices/usbms/driver.py +++ b/src/calibre/devices/usbms/driver.py @@ -311,7 +311,7 @@ class USBMS(CLI, Device): metadata = iter(metadata) for i, infile in enumerate(files): - mdata, fname = metadata.next(), names.next() + mdata, fname = next(metadata), next(names) filepath = self.normalize_path(self.create_upload_path(path, mdata, fname)) if not hasattr(infile, 'read'): infile = self.normalize_path(infile) @@ -350,7 +350,7 @@ class USBMS(CLI, Device): metadata = iter(metadata) for i, location in enumerate(locations): self.report_progress((i+1) / float(len(locations)), _('Adding books to device metadata listing...')) - info = metadata.next() + info = next(metadata) blist = 2 if location[1] == 'cardb' else 1 if location[1] == 'carda' else 0 # Extract the correct prefix from the pathname. To do this correctly, diff --git a/src/calibre/ebooks/BeautifulSoup.py b/src/calibre/ebooks/BeautifulSoup.py index a6a4e0220c..8782dd562e 100644 --- a/src/calibre/ebooks/BeautifulSoup.py +++ b/src/calibre/ebooks/BeautifulSoup.py @@ -332,7 +332,7 @@ class PageElement: g = generator() while True: try: - i = g.next() + i = next(g) except StopIteration: break if i: diff --git a/src/calibre/ebooks/conversion/plugins/epub_input.py b/src/calibre/ebooks/conversion/plugins/epub_input.py index a94e02150e..a72571cf12 100644 --- a/src/calibre/ebooks/conversion/plugins/epub_input.py +++ b/src/calibre/ebooks/conversion/plugins/epub_input.py @@ -18,7 +18,7 @@ def decrypt_font_data(key, data, algorithm): crypt_len = 1024 if is_adobe else 1040 crypt = bytearray(data[:crypt_len]) key = cycle(iter(bytearray(key))) - decrypt = bytes(bytearray(x^key.next() for x in crypt)) + decrypt = bytes(bytearray(x^next(key) for x in crypt)) return decrypt + data[crypt_len:] diff --git a/src/calibre/ebooks/conversion/plugins/epub_output.py b/src/calibre/ebooks/conversion/plugins/epub_output.py index 25f6c3b2aa..294c7afcfc 100644 --- a/src/calibre/ebooks/conversion/plugins/epub_output.py +++ b/src/calibre/ebooks/conversion/plugins/epub_output.py @@ -218,7 +218,7 @@ class EPUBOutput(OutputFormatPlugin): if self.oeb.toc.count() == 0: self.log.warn('This EPUB file has no Table of Contents. ' 'Creating a default TOC') - first = iter(self.oeb.spine).next() + first = next(iter(self.oeb.spine)) self.oeb.toc.add(_('Start'), first.href) from calibre.ebooks.oeb.base import OPF @@ -422,7 +422,7 @@ class EPUBOutput(OutputFormatPlugin): if br.getparent() is None: continue try: - prior = br.itersiblings(preceding=True).next() + prior = next(br.itersiblings(preceding=True)) priortag = barename(prior.tag) priortext = prior.tail except: diff --git a/src/calibre/ebooks/conversion/plugins/snb_output.py b/src/calibre/ebooks/conversion/plugins/snb_output.py index 3861286a96..00d0b0dc34 100644 --- a/src/calibre/ebooks/conversion/plugins/snb_output.py +++ b/src/calibre/ebooks/conversion/plugins/snb_output.py @@ -125,10 +125,10 @@ class SNBOutput(OutputFormatPlugin): if oeb_book.toc.count() == 0: log.warn('This SNB file has no Table of Contents. ' 'Creating a default TOC') - first = iter(oeb_book.spine).next() + first = next(iter(oeb_book.spine)) oeb_book.toc.add(_('Start page'), first.href) else: - first = iter(oeb_book.spine).next() + first = next(iter(oeb_book.spine)) if oeb_book.toc[0].href != first.href: # The pages before the fist item in toc will be stored as # "Cover Pages". diff --git a/src/calibre/ebooks/epub/pages.py b/src/calibre/ebooks/epub/pages.py index d76a4a8c12..200c5e03fe 100644 --- a/src/calibre/ebooks/epub/pages.py +++ b/src/calibre/ebooks/epub/pages.py @@ -32,7 +32,7 @@ def filter_name(name): def build_name_for(expr): if not expr: counter = count(1) - return lambda elem: str(counter.next()) + return lambda elem: str(next(counter)) selector = XPath(expr, namespaces=NSMAP) def name_for(elem): @@ -55,7 +55,7 @@ def add_page_map(opfpath, opts): name = name_for(elem) id = elem.get('id', None) if id is None: - id = elem.attrib['id'] = idgen.next() + id = elem.attrib['id'] = next(idgen) href = '#'.join((item.href, id)) oeb.pages.add(name, href) writer = None # DirWriter(version='2.0', page_map=True) diff --git a/src/calibre/ebooks/lrf/html/table.py b/src/calibre/ebooks/lrf/html/table.py index d849e19443..e82962b5da 100644 --- a/src/calibre/ebooks/lrf/html/table.py +++ b/src/calibre/ebooks/lrf/html/table.py @@ -349,7 +349,7 @@ class Table(object): nc = self.rows[r].cell_iterator() try: while True: - cell = nc.next() + cell = next(nc) cellmatrix[r][rowpos[r]] = cell rowpos[r] += cell.colspan for k in range(1, cell.rowspan): diff --git a/src/calibre/ebooks/mobi/writer2/indexer.py b/src/calibre/ebooks/mobi/writer2/indexer.py index edb9abbe19..5b52e05f0c 100644 --- a/src/calibre/ebooks/mobi/writer2/indexer.py +++ b/src/calibre/ebooks/mobi/writer2/indexer.py @@ -455,7 +455,7 @@ class Indexer(object): # {{{ self.is_periodical else 'book')) self.is_flat_periodical = False if self.is_periodical: - periodical_node = iter(oeb.toc).next() + periodical_node = next(iter(oeb.toc)) sections = tuple(periodical_node) self.is_flat_periodical = len(sections) == 1 @@ -681,7 +681,7 @@ class Indexer(object): # {{{ # }}} def create_periodical_index(self): # {{{ - periodical_node = iter(self.oeb.toc).next() + periodical_node = next(iter(self.oeb.toc)) periodical_node_offset = self.serializer.body_start_offset periodical_node_size = (self.serializer.body_end_offset - periodical_node_offset) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index b6186b4fed..1df7225302 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -1782,7 +1782,7 @@ class PageList(object): for page in self.pages: id = page.id or uuid_id() type = page.type - value = str(values[type].next()) + value = str(next(values[type])) attrib = {'id': id, 'value': value, 'type': type, 'playOrder': '0'} if page.klass: attrib['class'] = page.klass diff --git a/src/calibre/ebooks/oeb/polish/jacket.py b/src/calibre/ebooks/oeb/polish/jacket.py index ac9cd14271..6d6cce3177 100644 --- a/src/calibre/ebooks/oeb/polish/jacket.py +++ b/src/calibre/ebooks/oeb/polish/jacket.py @@ -98,7 +98,7 @@ def add_or_replace_jacket(container): if not found: # Insert new jacket into spine index = 0 - sp = container.abspath_to_name(container.spine_items.next()) + sp = container.abspath_to_name(next(container.spine_items)) if sp == find_cover_page(container): index = 1 itemref = container.opf.makeelement(OPF('itemref'), diff --git a/src/calibre/ebooks/oeb/transforms/split.py b/src/calibre/ebooks/oeb/transforms/split.py index 0c4f6c9ae3..100dbc1536 100644 --- a/src/calibre/ebooks/oeb/transforms/split.py +++ b/src/calibre/ebooks/oeb/transforms/split.py @@ -243,7 +243,7 @@ class FlowSplitter(object): self.trees = [orig_tree] while ordered_ids: - pb_id, (pattern, before) = ordered_ids.iteritems().next() + pb_id, (pattern, before) = next(ordered_ids.iteritems()) del ordered_ids[pb_id] for i in range(len(self.trees)-1, -1, -1): tree = self.trees[i] diff --git a/src/calibre/ebooks/oeb/transforms/structure.py b/src/calibre/ebooks/oeb/transforms/structure.py index 7d11f887b1..ab7ec73fbb 100644 --- a/src/calibre/ebooks/oeb/transforms/structure.py +++ b/src/calibre/ebooks/oeb/transforms/structure.py @@ -85,8 +85,8 @@ class DetectStructure(object): for item in oeb.spine: for elem in pb_xpath(item.data): try: - prev = elem.itersiblings(tag=etree.Element, - preceding=True).next() + prev = next(elem.itersiblings(tag=etree.Element, + preceding=True)) if (barename(elem.tag) in {'h1', 'h2'} and barename( prev.tag) in {'h1', 'h2'} and (not prev.tail or not prev.tail.split())): diff --git a/src/calibre/ebooks/pdf/reflow.py b/src/calibre/ebooks/pdf/reflow.py index bc9dd27c9e..0016dc5400 100644 --- a/src/calibre/ebooks/pdf/reflow.py +++ b/src/calibre/ebooks/pdf/reflow.py @@ -40,7 +40,7 @@ class Image(Element): def __init__(self, img, opts, log, idc): Element.__init__(self) self.opts, self.log = opts, log - self.id = idc.next() + self.id = next(idc) self.top, self.left, self.width, self.height, self.iwidth, self.iheight = \ map(float, map(img.get, ('top', 'left', 'rwidth', 'rheight', 'iwidth', 'iheight'))) @@ -61,7 +61,7 @@ class Text(Element): def __init__(self, text, font_map, opts, log, idc): Element.__init__(self) - self.id = idc.next() + self.id = next(idc) self.opts, self.log = opts, log self.font_map = font_map self.top, self.left, self.width, self.height = map(float, map(text.get, diff --git a/src/calibre/gui2/actions/__init__.py b/src/calibre/gui2/actions/__init__.py index 30f85adef6..92c59c3444 100644 --- a/src/calibre/gui2/actions/__init__.py +++ b/src/calibre/gui2/actions/__init__.py @@ -278,7 +278,7 @@ class InterfaceAction(QObject): For example to load an image:: pixmap = QPixmap() - pixmap.loadFromData(self.load_resources(['images/icon.png']).itervalues().next()) + next(pixmap.loadFromData(self.load_resources(['images/icon.png']).itervalues())) icon = QIcon(pixmap) :param names: List of paths to resources in the ZIP file using / as separator diff --git a/src/calibre/gui2/custom_column_widgets.py b/src/calibre/gui2/custom_column_widgets.py index 1c73867eae..723580ba89 100644 --- a/src/calibre/gui2/custom_column_widgets.py +++ b/src/calibre/gui2/custom_column_widgets.py @@ -837,7 +837,7 @@ class BulkBase(Base): break ans = None if len(values) == 1: - ans = iter(values).next() + ans = next(iter(values)) if isinstance(ans, frozenset): ans = list(ans) return ans diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index 7414e4102f..dcc8b1a6fc 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -411,7 +411,7 @@ class DeviceManager(Thread): # {{{ do_sleep = True while True: - job = self.next() + job = next(self) if job is not None: do_sleep = False self.current_job = job @@ -1494,8 +1494,8 @@ class DeviceMixin(object): # {{{ bad, good, gf, names, remove_ids = [], [], [], [], [] for f in _files: - mi = imetadata.next() - id = ids.next() + mi = next(imetadata) + id = next(ids) if f is None: bad.append(mi.title) else: diff --git a/src/calibre/gui2/lrf_renderer/document.py b/src/calibre/gui2/lrf_renderer/document.py index 6611eb3bc3..644f4d9e17 100644 --- a/src/calibre/gui2/lrf_renderer/document.py +++ b/src/calibre/gui2/lrf_renderer/document.py @@ -521,10 +521,9 @@ class Document(QGraphicsScene): self.next_match() def next_match(self): - page_num = self.last_search.next()[0] + page_num = next(self.last_search)[0] if self.current_page == page_num: self.update() else: self.add_to_history() self.show_page(page_num) - diff --git a/src/calibre/gui2/lrf_renderer/text.py b/src/calibre/gui2/lrf_renderer/text.py index d86a5e92b2..a8c59c7561 100644 --- a/src/calibre/gui2/lrf_renderer/text.py +++ b/src/calibre/gui2/lrf_renderer/text.py @@ -532,12 +532,12 @@ class Line(QGraphicsItem): matches = [] try: while True: - word = words.next() + word = next(words) word.highlight = False if tokens[0] in unicode_type(word.string).lower(): matches.append(word) for c in range(1, len(tokens)): - word = words.next() + word = next(words) print(tokens[c], word.string) if tokens[c] not in unicode_type(word.string): return None diff --git a/src/calibre/gui2/search_restriction_mixin.py b/src/calibre/gui2/search_restriction_mixin.py index cfb6d57409..43763975f2 100644 --- a/src/calibre/gui2/search_restriction_mixin.py +++ b/src/calibre/gui2/search_restriction_mixin.py @@ -255,7 +255,7 @@ class CreateVirtualLibrary(QDialog): # {{{ search = ['%s:"=%s"'%(prefix, x.replace('"', '\\"')) for x in d.names] if search: if not self.editing: - self.vl_name.lineEdit().setText(d.names.next()) + self.vl_name.lineEdit().setText(next(d.names)) self.vl_name.lineEdit().setCursorPosition(0) self.vl_text.setText(d.match_type.join(search)) self.vl_text.setCursorPosition(0) diff --git a/src/calibre/library/database.py b/src/calibre/library/database.py index 8c78324215..b303833439 100644 --- a/src/calibre/library/database.py +++ b/src/calibre/library/database.py @@ -1337,10 +1337,10 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE; formats, metadata, uris = iter(formats), iter(metadata), iter(uris) duplicates = [] for path in paths: - mi = metadata.next() - format = formats.next() + mi = next(metadata) + format = next(formats) try: - uri = uris.next() + uri = next(uris) except StopIteration: uri = None if not add_duplicates and self.has_book(mi): diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 239f72871f..00bc74f20b 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -3498,9 +3498,9 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): ids = [] postimport = [] for path in paths: - mi = metadata.next() + mi = next(metadata) self._add_newbook_tag(mi) - format = formats.next() + format = next(formats) if not add_duplicates and self.has_book(mi): duplicates.append((path, format, mi)) continue diff --git a/src/calibre/web/feeds/templates.py b/src/calibre/web/feeds/templates.py index 385746bbd6..5b180fd1cd 100644 --- a/src/calibre/web/feeds/templates.py +++ b/src/calibre/web/feeds/templates.py @@ -217,23 +217,23 @@ class NavBarTemplate(Template): navbar.append(BR()) navbar.append(BR()) else: - next = 'feed_%d'%(feed+1) if art == number_of_articles_in_feed - 1 \ + next_art = 'feed_%d'%(feed+1) if art == number_of_articles_in_feed - 1 \ else 'article_%d'%(art+1) up = '../..' if art == number_of_articles_in_feed - 1 else '..' - href = '%s%s/%s/index.html'%(prefix, up, next) + href = '%s%s/%s/index.html'%(prefix, up, next_art) navbar.text = '| ' navbar.append(A(_('Next'), href=href)) href = '%s../index.html#article_%d'%(prefix, art) - navbar.iterchildren(reversed=True).next().tail = ' | ' + next(navbar.iterchildren(reversed=True)).tail = ' | ' navbar.append(A(_('Section menu'), href=href)) href = '%s../../index.html#feed_%d'%(prefix, feed) - navbar.iterchildren(reversed=True).next().tail = ' | ' + next(navbar.iterchildren(reversed=True)).tail = ' | ' navbar.append(A(_('Main menu'), href=href)) if art > 0 and not bottom: href = '%s../article_%d/index.html'%(prefix, art-1) - navbar.iterchildren(reversed=True).next().tail = ' | ' + next(navbar.iterchildren(reversed=True)).tail = ' | ' navbar.append(A(_('Previous'), href=href)) - navbar.iterchildren(reversed=True).next().tail = ' | ' + next(navbar.iterchildren(reversed=True)).tail = ' | ' if not bottom: navbar.append(HR()) @@ -413,11 +413,11 @@ class TouchscreenNavBarTemplate(Template): navbar_tr.append(TD(CLASS('article_sections_list'),link)) # | Next - next = 'feed_%d'%(feed+1) if art == number_of_articles_in_feed - 1 \ + next_art = 'feed_%d'%(feed+1) if art == number_of_articles_in_feed - 1 \ else 'article_%d'%(art+1) up = '../..' if art == number_of_articles_in_feed - 1 else '..' - link = A(CLASS('article_link'), _('Next'), href='%s%s/%s/index.html'%(prefix, up, next)) + link = A(CLASS('article_link'), _('Next'), href='%s%s/%s/index.html'%(prefix, up, next_art)) navbar_tr.append(TD(CLASS('article_next'),link)) navbar_t.append(navbar_tr) navbar.append(navbar_t) From 09e97e5af1f5fe7c9fbbaa563c930c3ea8637313 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 21 Mar 2019 15:32:49 -0400 Subject: [PATCH 0385/2613] setup: don't report full pathname when creating msgpack'ed resources The full pathname in the log info was introduced as a side effect of moving off of pickle. --- setup/resources.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup/resources.py b/setup/resources.py index 7f9fc7e1db..b796ea2444 100644 --- a/setup/resources.py +++ b/setup/resources.py @@ -64,7 +64,7 @@ class Coffee(Command): # {{{ for src in self.COFFEE_DIRS: for f in glob.glob(self.j(self.SRC, __appname__, src, '*.coffee')): - bn = os.path.basename(f).rpartition('.')[0] + bn = self.b(f).rpartition('.')[0] arcname = src.replace('/', '.') + '.' + bn + '.js' try: with open(f, 'rb') as fs: @@ -300,7 +300,7 @@ class Resources(Command): # {{{ dest = self.j(self.RESOURCES, 'scripts.calibre_msgpack') if self.newer(dest, self.j(self.SRC, 'calibre', 'linux.py')): - self.info('\tCreating ' + os.path.basename(dest)) + self.info('\tCreating ' + self.b(dest)) with open(dest, 'wb') as f: f.write(msgpack_dumps(scripts)) @@ -325,7 +325,7 @@ class Resources(Command): # {{{ with zipfile.ZipFile(dest, 'w', zipfile.ZIP_STORED) as zf: for n in sorted(files, key=self.b): with open(n, 'rb') as f: - zf.writestr(os.path.basename(n), f.read()) + zf.writestr(self.b(n), f.read()) dest = self.j(self.RESOURCES, 'ebook-convert-complete.calibre_msgpack') files = [] @@ -334,7 +334,7 @@ class Resources(Command): # {{{ if f.endswith('.py'): files.append(self.j(x[0], f)) if self.newer(dest, files): - self.info('\tCreating ' + dest) + self.info('\tCreating ' + self.b(dest)) complete = {} from calibre.ebooks.conversion.plumber import supported_input_formats complete['input_fmts'] = set(supported_input_formats()) From 69711828bd35edfd8bd317f6382f36abc923ab41 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 21 Mar 2019 16:53:31 -0400 Subject: [PATCH 0386/2613] python3: make lopen a direct alias for the builtin open Thanks to PEP 0446, its reason to exist no longer applies and it is the default behavior. However, trying to use it on python3 resulted in errors since "e" is no longer a valid open() mode. --- src/calibre/startup.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/calibre/startup.py b/src/calibre/startup.py index 78a7cad5be..a6911b9f29 100644 --- a/src/calibre/startup.py +++ b/src/calibre/startup.py @@ -10,7 +10,7 @@ Perform various initialization tasks. import locale, sys # Default translation is NOOP -from polyglot.builtins import builtins, unicode_type +from polyglot.builtins import builtins, is_py3, unicode_type builtins.__dict__['_'] = lambda s: s # For strings which belong in the translation tables, but which shouldn't be @@ -125,7 +125,9 @@ if not _run_once: pass # local_open() opens a file that wont be inherited by child processes - if iswindows: + if is_py3: + local_open = open # PEP 446 + elif iswindows: def local_open(name, mode='r', bufsize=-1): mode += 'N' return open(name, mode, bufsize) @@ -223,6 +225,8 @@ def test_lopen(): if win32api.GetHandleInformation(msvcrt.get_osfhandle(f.fileno())) & 0b1: raise SystemExit('File handle is inheritable!') else: + import fcntl + def assert_not_inheritable(f): if not fcntl.fcntl(f, fcntl.F_GETFD) & fcntl.FD_CLOEXEC: raise SystemExit('File handle is inheritable!') @@ -238,14 +242,14 @@ def test_lopen(): print('O_CREAT tested') with copen(n, 'w+b') as f: - f.write('two') + f.write(b'two') with copen(n, 'r') as f: if f.read() == 'two': print('O_TRUNC tested') else: raise Exception('O_TRUNC failed') with copen(n, 'ab') as f: - f.write('three') + f.write(b'three') with copen(n, 'r+') as f: if f.read() == 'twothree': print('O_APPEND tested') From f61dcf6b1a93b6eb2c1b91e3c1b4c2bb86c917c5 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 21 Mar 2019 23:00:57 -0400 Subject: [PATCH 0387/2613] python3: more BytesIO --- src/calibre/utils/logging.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/utils/logging.py b/src/calibre/utils/logging.py index ccf8d21c42..ce822592dc 100644 --- a/src/calibre/utils/logging.py +++ b/src/calibre/utils/logging.py @@ -10,7 +10,7 @@ INFO = 1 WARN = 2 ERROR = 3 -import sys, traceback, cStringIO +import sys, traceback, io from functools import partial from threading import Lock @@ -22,7 +22,7 @@ class Stream(object): def __init__(self, stream=None): if stream is None: - stream = cStringIO.StringIO() + stream = io.BytesIO() self.stream = stream self._prints = partial(prints, safe_encode=True, file=stream) From a7bbf0f51e11b3caa48e0cf7ae269aa743a60ec4 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 21 Mar 2019 23:38:54 -0400 Subject: [PATCH 0388/2613] flake8: uniformly ignore unused polyglot imports No need to have files where every single line contains the trailing comment "noqa" --- setup.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.cfg b/setup.cfg index af4550aa0a..2198e55434 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,6 +2,8 @@ max-line-length = 160 builtins = _,dynamic_property,__,P,I,lopen,icu_lower,icu_upper,icu_title,ngettext,connect_lambda ignore = E12,E203,E22,E231,E241,E401,E402,E731,W391,E722,E741,W504 +per-file-ignores = + src/polyglot/*:F401 [yapf] based_on_style = pep8 From 13d236f55693c23a44d4f949d50da08fcb52e88d Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Fri, 22 Mar 2019 01:04:36 -0400 Subject: [PATCH 0389/2613] python3: make recent_uas build --- setup/browser_data.py | 4 +++- setup/resources.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/setup/browser_data.py b/setup/browser_data.py index 16b3f1fbab..7ee2e6263f 100644 --- a/setup/browser_data.py +++ b/setup/browser_data.py @@ -10,11 +10,13 @@ from datetime import datetime from setup import download_securely +from polyglot.builtins import filter + is_ci = os.environ.get('CI', '').lower() == 'true' def filter_ans(ans): - return filter(None, (x.strip() for x in ans)) + return list(filter(None, (x.strip() for x in ans))) def common_user_agents(): diff --git a/setup/resources.py b/setup/resources.py index b796ea2444..9855dad9dc 100644 --- a/setup/resources.py +++ b/setup/resources.py @@ -270,7 +270,7 @@ class RecentUAs(Command): # {{{ from setup.browser_data import get_data data = get_data() with open(self.UA_PATH, 'wb') as f: - f.write(json.dumps(data, indent=2)) + f.write(json.dumps(data, indent=2).encode('utf-8')) # }}} From a623717d96d65952321876216379104f809408fb Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sat, 23 Mar 2019 23:09:38 -0400 Subject: [PATCH 0390/2613] python3: apply various fixes from python-modernize "dict_six" Imports were then fixed and consolidated to derive from the internal polyglot.builtins --- manual/epub.py | 7 +- setup/plugins_mirror.py | 11 +-- src/calibre/__init__.py | 7 +- src/calibre/customize/ui.py | 5 +- src/calibre/customize/zipplugin.py | 8 +- src/calibre/db/__init__.py | 4 +- src/calibre/db/adding.py | 8 +- src/calibre/db/backend.py | 25 +++--- src/calibre/db/cache.py | 90 +++++++++---------- src/calibre/db/categories.py | 8 +- src/calibre/db/cli/cmd_custom_columns.py | 3 +- src/calibre/db/cli/cmd_list.py | 15 ++-- src/calibre/db/cli/cmd_saved_searches.py | 3 +- src/calibre/db/cli/cmd_set_metadata.py | 4 +- src/calibre/db/cli/tests.py | 4 +- src/calibre/db/fields.py | 44 ++++----- src/calibre/db/lazy.py | 4 +- src/calibre/db/legacy.py | 26 +++--- src/calibre/db/restore.py | 5 +- src/calibre/db/schema_upgrades.py | 8 +- src/calibre/db/search.py | 16 ++-- src/calibre/db/tables.py | 54 +++++------ src/calibre/db/tests/add_remove.py | 19 ++-- src/calibre/db/tests/filesystem.py | 3 +- src/calibre/db/tests/legacy.py | 36 ++++---- src/calibre/db/tests/reading.py | 30 +++---- src/calibre/db/tests/writing.py | 39 ++++---- src/calibre/db/utils.py | 6 +- src/calibre/db/view.py | 13 +-- src/calibre/db/write.py | 62 ++++++------- src/calibre/devices/kobo/driver.py | 16 ++-- src/calibre/devices/mtp/defaults.py | 3 +- src/calibre/devices/mtp/driver.py | 6 +- src/calibre/devices/mtp/filesystem_cache.py | 6 +- src/calibre/devices/mtp/windows/driver.py | 10 +-- src/calibre/devices/scanner.py | 4 +- src/calibre/devices/usbms/device.py | 4 +- src/calibre/devices/usbms/driver.py | 4 +- src/calibre/devices/winusb.py | 12 +-- src/calibre/ebooks/conversion/cli.py | 3 +- .../ebooks/conversion/plugins/fb2_input.py | 4 +- .../ebooks/conversion/plugins/pdf_output.py | 4 +- .../ebooks/conversion/plugins/rtf_input.py | 5 +- src/calibre/ebooks/covers.py | 12 +-- src/calibre/ebooks/css_transform_rules.py | 5 +- src/calibre/ebooks/docx/block_styles.py | 5 +- src/calibre/ebooks/docx/cleanup.py | 6 +- src/calibre/ebooks/docx/fields.py | 3 +- src/calibre/ebooks/docx/fonts.py | 4 +- src/calibre/ebooks/docx/footnotes.py | 4 +- src/calibre/ebooks/docx/images.py | 11 +-- src/calibre/ebooks/docx/index.py | 4 +- src/calibre/ebooks/docx/names.py | 7 +- src/calibre/ebooks/docx/numbering.py | 15 ++-- src/calibre/ebooks/docx/styles.py | 17 ++-- src/calibre/ebooks/docx/tables.py | 10 +-- src/calibre/ebooks/docx/to_html.py | 30 ++++--- src/calibre/ebooks/docx/toc.py | 4 +- src/calibre/ebooks/docx/writer/container.py | 23 ++--- src/calibre/ebooks/docx/writer/images.py | 6 +- src/calibre/ebooks/docx/writer/lists.py | 12 +-- src/calibre/ebooks/docx/writer/styles.py | 12 +-- src/calibre/ebooks/docx/writer/tables.py | 4 +- src/calibre/ebooks/epub/cfi/tests.py | 4 +- src/calibre/ebooks/lrf/pylrs/pylrf.py | 3 +- src/calibre/ebooks/metadata/book/base.py | 24 ++--- .../ebooks/metadata/book/json_codec.py | 7 +- src/calibre/ebooks/metadata/book/serialize.py | 6 +- src/calibre/ebooks/metadata/cli.py | 4 +- src/calibre/ebooks/metadata/html.py | 7 +- src/calibre/ebooks/metadata/opf.py | 3 +- src/calibre/ebooks/metadata/opf2.py | 16 ++-- src/calibre/ebooks/metadata/opf3.py | 14 +-- src/calibre/ebooks/metadata/opf_2_to_3.py | 3 +- src/calibre/ebooks/metadata/pdf.py | 6 +- .../ebooks/metadata/search_internet.py | 3 +- src/calibre/ebooks/metadata/sources/base.py | 5 +- .../ebooks/metadata/sources/identify.py | 26 +++--- src/calibre/ebooks/metadata/sources/update.py | 9 +- src/calibre/ebooks/metadata/sources/worker.py | 3 +- src/calibre/ebooks/metadata/xmp.py | 22 ++--- src/calibre/ebooks/mobi/debug/headers.py | 6 +- src/calibre/ebooks/mobi/debug/index.py | 30 +++---- src/calibre/ebooks/mobi/reader/index.py | 4 +- src/calibre/ebooks/mobi/reader/mobi6.py | 8 +- src/calibre/ebooks/mobi/reader/mobi8.py | 12 +-- src/calibre/ebooks/mobi/reader/ncx.py | 10 +-- src/calibre/ebooks/mobi/utils.py | 4 +- src/calibre/ebooks/mobi/writer2/indexer.py | 13 ++- src/calibre/ebooks/mobi/writer2/main.py | 6 +- src/calibre/ebooks/mobi/writer2/resources.py | 4 +- src/calibre/ebooks/mobi/writer8/exth.py | 4 +- src/calibre/ebooks/mobi/writer8/header.py | 9 +- src/calibre/ebooks/mobi/writer8/main.py | 8 +- src/calibre/ebooks/mobi/writer8/skeleton.py | 10 +-- src/calibre/ebooks/mobi/writer8/tbs.py | 9 +- src/calibre/ebooks/oeb/base.py | 4 +- src/calibre/ebooks/oeb/display/webview.py | 3 +- src/calibre/ebooks/oeb/normalize_css.py | 40 ++++----- src/calibre/ebooks/oeb/parse_utils.py | 10 +-- src/calibre/ebooks/oeb/polish/cascade.py | 13 +-- src/calibre/ebooks/oeb/polish/check/fonts.py | 7 +- src/calibre/ebooks/oeb/polish/check/links.py | 20 ++--- src/calibre/ebooks/oeb/polish/check/main.py | 4 +- src/calibre/ebooks/oeb/polish/check/opf.py | 7 +- .../ebooks/oeb/polish/check/parsing.py | 10 +-- src/calibre/ebooks/oeb/polish/container.py | 18 ++-- src/calibre/ebooks/oeb/polish/cover.py | 16 ++-- src/calibre/ebooks/oeb/polish/css.py | 20 ++--- src/calibre/ebooks/oeb/polish/download.py | 7 +- src/calibre/ebooks/oeb/polish/embed.py | 16 ++-- src/calibre/ebooks/oeb/polish/fonts.py | 5 +- src/calibre/ebooks/oeb/polish/images.py | 4 +- src/calibre/ebooks/oeb/polish/import_book.py | 8 +- src/calibre/ebooks/oeb/polish/main.py | 13 +-- src/calibre/ebooks/oeb/polish/pretty.py | 6 +- src/calibre/ebooks/oeb/polish/replace.py | 22 ++--- src/calibre/ebooks/oeb/polish/report.py | 29 +++--- src/calibre/ebooks/oeb/polish/spell.py | 8 +- src/calibre/ebooks/oeb/polish/split.py | 7 +- src/calibre/ebooks/oeb/polish/stats.py | 10 +-- src/calibre/ebooks/oeb/polish/subset.py | 9 +- src/calibre/ebooks/oeb/polish/tests/base.py | 4 +- .../ebooks/oeb/polish/tests/cascade.py | 5 +- .../ebooks/oeb/polish/tests/container.py | 7 +- .../ebooks/oeb/polish/tests/parsing.py | 4 +- src/calibre/ebooks/oeb/polish/toc.py | 16 ++-- src/calibre/ebooks/oeb/stylizer.py | 8 +- .../ebooks/oeb/transforms/embed_fonts.py | 4 +- src/calibre/ebooks/oeb/transforms/flatcss.py | 22 ++--- src/calibre/ebooks/oeb/transforms/metadata.py | 4 +- .../ebooks/oeb/transforms/page_margin.py | 3 +- src/calibre/ebooks/oeb/transforms/split.py | 4 +- .../ebooks/oeb/transforms/structure.py | 6 +- src/calibre/ebooks/oeb/transforms/subset.py | 10 +-- src/calibre/ebooks/pdf/render/common.py | 6 +- src/calibre/ebooks/pdf/render/fonts.py | 10 +-- src/calibre/ebooks/pdf/render/from_html.py | 7 +- src/calibre/ebooks/pdf/render/links.py | 3 +- src/calibre/ebooks/readability/htmls.py | 4 +- src/calibre/ebooks/rtf2xml/add_brackets.py | 3 +- src/calibre/ebooks/txt/processor.py | 4 +- .../ebooks/unihandecode/pykakasi/j2h.py | 6 +- src/calibre/gui2/__init__.py | 23 ++--- src/calibre/gui2/actions/add.py | 4 +- src/calibre/gui2/actions/annotate.py | 6 +- src/calibre/gui2/actions/author_mapper.py | 5 +- src/calibre/gui2/actions/choose_library.py | 4 +- src/calibre/gui2/actions/copy_to_library.py | 6 +- src/calibre/gui2/actions/edit_metadata.py | 10 +-- src/calibre/gui2/actions/polish.py | 10 +-- src/calibre/gui2/actions/save_to_disk.py | 4 +- src/calibre/gui2/actions/sort.py | 3 +- src/calibre/gui2/actions/tag_mapper.py | 4 +- src/calibre/gui2/actions/toc_edit.py | 4 +- src/calibre/gui2/add.py | 4 +- src/calibre/gui2/bars.py | 4 +- src/calibre/gui2/convert/look_and_feel.py | 6 +- src/calibre/gui2/convert/txt_input.py | 8 +- src/calibre/gui2/covers.py | 23 ++--- src/calibre/gui2/css_transform_rules.py | 6 +- src/calibre/gui2/dbus_export/menu.py | 5 +- src/calibre/gui2/device_drivers/mtp_config.py | 4 +- src/calibre/gui2/dialogs/custom_recipes.py | 6 +- src/calibre/gui2/dialogs/metadata_bulk.py | 20 ++--- src/calibre/gui2/dialogs/opml.py | 4 +- src/calibre/gui2/dialogs/plugin_updater.py | 4 +- src/calibre/gui2/dialogs/scheduler.py | 4 +- src/calibre/gui2/dialogs/search.py | 4 +- src/calibre/gui2/dialogs/smartdevice.py | 4 +- src/calibre/gui2/dialogs/tag_categories.py | 4 +- src/calibre/gui2/email.py | 12 +-- src/calibre/gui2/gestures.py | 11 +-- src/calibre/gui2/icon_theme.py | 8 +- src/calibre/gui2/keyboard.py | 18 ++-- src/calibre/gui2/languages.py | 12 +-- src/calibre/gui2/library/alternate_views.py | 6 +- src/calibre/gui2/library/caches.py | 9 +- src/calibre/gui2/library/models.py | 10 +-- src/calibre/gui2/library/views.py | 8 +- src/calibre/gui2/metadata/basic_widgets.py | 4 +- src/calibre/gui2/metadata/bulk_download.py | 3 +- src/calibre/gui2/metadata/config.py | 6 +- src/calibre/gui2/metadata/diff.py | 12 +-- src/calibre/gui2/metadata/single.py | 5 +- src/calibre/gui2/metadata/single_download.py | 10 +-- src/calibre/gui2/open_with.py | 6 +- src/calibre/gui2/preferences/behavior.py | 4 +- src/calibre/gui2/preferences/coloring.py | 4 +- .../gui2/preferences/create_custom_column.py | 4 +- .../gui2/preferences/ignored_devices.py | 6 +- src/calibre/gui2/preferences/look_feel.py | 4 +- .../gui2/preferences/metadata_sources.py | 9 +- src/calibre/gui2/preferences/misc.py | 4 +- src/calibre/gui2/preferences/plugins.py | 6 +- src/calibre/gui2/preferences/search.py | 6 +- .../gui2/preferences/template_functions.py | 4 +- src/calibre/gui2/preferences/tweaks.py | 18 ++-- src/calibre/gui2/save.py | 12 +-- src/calibre/gui2/tag_browser/model.py | 9 +- src/calibre/gui2/tag_mapper.py | 10 +-- src/calibre/gui2/toc/main.py | 8 +- src/calibre/gui2/tweak_book/__init__.py | 4 +- src/calibre/gui2/tweak_book/boss.py | 34 +++---- src/calibre/gui2/tweak_book/check_links.py | 3 +- .../gui2/tweak_book/completion/basic.py | 14 +-- .../gui2/tweak_book/completion/popup.py | 3 +- src/calibre/gui2/tweak_book/diff/highlight.py | 4 +- src/calibre/gui2/tweak_book/diff/main.py | 14 +-- src/calibre/gui2/tweak_book/diff/view.py | 6 +- src/calibre/gui2/tweak_book/download.py | 6 +- src/calibre/gui2/tweak_book/editor/image.py | 3 +- .../gui2/tweak_book/editor/snippets.py | 10 +-- .../gui2/tweak_book/editor/syntax/base.py | 4 +- .../gui2/tweak_book/editor/syntax/css.py | 6 +- .../gui2/tweak_book/editor/syntax/html.py | 5 +- src/calibre/gui2/tweak_book/editor/themes.py | 24 ++--- src/calibre/gui2/tweak_book/editor/widget.py | 4 +- src/calibre/gui2/tweak_book/file_list.py | 30 +++---- .../gui2/tweak_book/function_replace.py | 8 +- src/calibre/gui2/tweak_book/manage_fonts.py | 6 +- src/calibre/gui2/tweak_book/plugin.py | 4 +- src/calibre/gui2/tweak_book/preferences.py | 13 +-- src/calibre/gui2/tweak_book/reports.py | 4 +- src/calibre/gui2/tweak_book/search.py | 8 +- src/calibre/gui2/tweak_book/spell.py | 6 +- src/calibre/gui2/tweak_book/templates.py | 3 +- src/calibre/gui2/tweak_book/text_search.py | 6 +- src/calibre/gui2/tweak_book/ui.py | 6 +- src/calibre/gui2/tweak_book/widgets.py | 16 ++-- src/calibre/gui2/viewer/config.py | 6 +- src/calibre/gui2/viewer/documentview.py | 4 +- src/calibre/gui2/viewer/gestures.py | 13 +-- src/calibre/gui2/viewer/javascript.py | 5 +- src/calibre/gui2/viewer/toc.py | 7 +- src/calibre/gui2/wizard/__init__.py | 6 +- src/calibre/library/caches.py | 13 +-- src/calibre/library/check_library.py | 5 +- src/calibre/library/database2.py | 30 +++---- src/calibre/library/field_metadata.py | 19 ++-- src/calibre/library/prefs.py | 4 +- src/calibre/library/restore.py | 7 +- src/calibre/library/schema_upgrades.py | 8 +- src/calibre/linux.py | 13 +-- src/calibre/spell/dictionary.py | 12 +-- src/calibre/spell/import_from.py | 5 +- src/calibre/srv/ajax.py | 10 +-- src/calibre/srv/auto_reload.py | 7 +- src/calibre/srv/cdb.py | 3 +- src/calibre/srv/code.py | 5 +- src/calibre/srv/convert.py | 8 +- src/calibre/srv/handler.py | 7 +- src/calibre/srv/http_response.py | 8 +- src/calibre/srv/jobs.py | 11 +-- src/calibre/srv/legacy.py | 8 +- src/calibre/srv/library_broker.py | 19 ++-- src/calibre/srv/loop.py | 8 +- src/calibre/srv/manage_users_cli.py | 3 +- src/calibre/srv/metadata.py | 8 +- src/calibre/srv/opds.py | 4 +- src/calibre/srv/opts.py | 6 +- src/calibre/srv/render_book.py | 16 ++-- src/calibre/srv/routes.py | 8 +- src/calibre/srv/tests/ajax.py | 5 +- src/calibre/srv/tests/auth.py | 5 +- src/calibre/srv/tests/http.py | 4 +- src/calibre/srv/tests/routes.py | 3 +- src/calibre/srv/users.py | 7 +- src/calibre/srv/utils.py | 8 +- src/calibre/test_build.py | 6 +- src/calibre/utils/date.py | 4 +- src/calibre/utils/dbus_service.py | 5 +- src/calibre/utils/filenames.py | 14 +-- src/calibre/utils/fonts/scanner.py | 8 +- src/calibre/utils/fonts/sfnt/cff/table.py | 8 +- src/calibre/utils/fonts/sfnt/cmap.py | 4 +- src/calibre/utils/fonts/sfnt/container.py | 4 +- src/calibre/utils/fonts/sfnt/glyf.py | 4 +- src/calibre/utils/fonts/sfnt/gsub.py | 9 +- src/calibre/utils/fonts/sfnt/loca.py | 4 +- src/calibre/utils/fonts/utils.py | 8 +- src/calibre/utils/fonts/win_fonts.py | 3 +- src/calibre/utils/formatter_functions.py | 14 +-- src/calibre/utils/icu_test.py | 6 +- src/calibre/utils/ipc/launch.py | 4 +- src/calibre/utils/ipc/pool.py | 9 +- src/calibre/utils/localization.py | 6 +- src/calibre/utils/localunzip.py | 7 +- src/calibre/utils/matcher.py | 7 +- src/calibre/utils/open_with/linux.py | 14 +-- src/calibre/utils/open_with/osx.py | 4 +- src/calibre/utils/rapydscript.py | 8 +- src/calibre/utils/resources.py | 4 +- src/calibre/utils/terminal.py | 8 +- src/calibre/utils/test_lock.py | 3 +- src/calibre/utils/unicode_names.py | 3 +- src/calibre/utils/winreg/dde.py | 4 +- src/calibre/utils/winreg/default_programs.py | 19 ++-- src/calibre/utils/wmf/emf.py | 6 +- src/calibre/web/feeds/recipes/__init__.py | 4 +- src/calibre/web/feeds/recipes/collection.py | 8 +- src/calibre/web/feeds/recipes/model.py | 4 +- src/css_selectors/select.py | 22 ++--- src/tinycss/__init__.py | 4 +- src/tinycss/tests/fonts3.py | 8 +- 305 files changed, 1489 insertions(+), 1391 deletions(-) diff --git a/manual/epub.py b/manual/epub.py index f16652b56d..dd93e34817 100644 --- a/manual/epub.py +++ b/manual/epub.py @@ -15,6 +15,7 @@ from calibre.ebooks.oeb.polish.container import get_container, OEB_DOCS from calibre.ebooks.oeb.polish.check.links import check_links, UnreferencedResource from calibre.ebooks.oeb.polish.pretty import pretty_html_tree, pretty_opf from calibre.utils.imghdr import identify +from polyglot.builtins import iteritems class EPUBHelpBuilder(EpubBuilder): @@ -28,7 +29,7 @@ class EPUBHelpBuilder(EpubBuilder): def fix_epub(self, container): ' Fix all the brokenness that sphinx\'s epub builder creates ' - for name, mt in container.mime_map.iteritems(): + for name, mt in iteritems(container.mime_map): if mt in OEB_DOCS: self.workaround_ade_quirks(container, name) pretty_html_tree(container, container.parsed(name)) @@ -49,9 +50,9 @@ class EPUBHelpBuilder(EpubBuilder): def fix_opf(self, container): spine_names = {n for n, l in container.spine_names} spine = container.opf_xpath('//opf:spine')[0] - rmap = {v:k for k, v in container.manifest_id_map.iteritems()} + rmap = {v:k for k, v in iteritems(container.manifest_id_map)} # Add unreferenced text files to the spine - for name, mt in container.mime_map.iteritems(): + for name, mt in iteritems(container.mime_map): if mt in OEB_DOCS and name not in spine_names: spine_names.add(name) container.insert_into_xml(spine, spine.makeelement(OPF('itemref'), idref=rmap[name])) diff --git a/setup/plugins_mirror.py b/setup/plugins_mirror.py index 0d799cb3ab..a1fccc4347 100644 --- a/setup/plugins_mirror.py +++ b/setup/plugins_mirror.py @@ -33,6 +33,7 @@ from email.utils import parsedate from functools import partial from multiprocessing.pool import ThreadPool from xml.sax.saxutils import escape, quoteattr +from polyglot.builtins import iteritems, itervalues # }}} USER_AGENT = 'calibre mirror' @@ -292,7 +293,7 @@ def get_plugin_info(raw, check_for_qt5=False): metadata = names[inits[0]] else: # Legacy plugin - for name, val in names.iteritems(): + for name, val in iteritems(names): if name.endswith('plugin.py'): metadata = val break @@ -331,7 +332,7 @@ def update_plugin_from_entry(plugin, entry): def fetch_plugin(old_index, entry): - lm_map = {plugin['thread_id']:plugin for plugin in old_index.itervalues()} + lm_map = {plugin['thread_id']:plugin for plugin in itervalues(old_index)} raw = read(entry.url) url, name = parse_plugin_zip_url(raw) if url is None: @@ -403,7 +404,7 @@ def fetch_plugins(old_index): log('Failed to get plugin', entry.name, 'at', datetime.utcnow().isoformat(), 'with error:') log(plugin) # Move staged files - for plugin in ans.itervalues(): + for plugin in itervalues(ans): if plugin['file'].startswith('staging_'): src = plugin['file'] plugin['file'] = src.partition('_')[-1] @@ -411,7 +412,7 @@ def fetch_plugins(old_index): raw = bz2.compress(json.dumps(ans, sort_keys=True, indent=4, separators=(',', ': '))) atomic_write(raw, PLUGINS) # Cleanup any extra .zip files - all_plugin_files = {p['file'] for p in ans.itervalues()} + all_plugin_files = {p['file'] for p in itervalues(ans)} extra = set(glob.glob('*.zip')) - all_plugin_files for x in extra: os.unlink(x) @@ -498,7 +499,7 @@ h1 { text-align: center } name, count = x return '%s%s\n' % (escape(name), count) - pstats = map(plugin_stats, sorted(stats.iteritems(), reverse=True, key=lambda x:x[1])) + pstats = map(plugin_stats, sorted(iteritems(stats), reverse=True, key=lambda x:x[1])) stats = '''\ diff --git a/src/calibre/__init__.py b/src/calibre/__init__.py index 5f441311e4..e17ab12edb 100644 --- a/src/calibre/__init__.py +++ b/src/calibre/__init__.py @@ -4,7 +4,8 @@ __copyright__ = '2008, Kovid Goyal ' __docformat__ = 'restructuredtext en' import sys, os, re, time, random, warnings -from polyglot.builtins import builtins, codepoint_to_chr, unicode_type, range +from polyglot.builtins import (builtins, codepoint_to_chr, iteritems, + itervalues, unicode_type, range) builtins.__dict__['dynamic_property'] = lambda func: func(None) from math import floor from functools import partial @@ -706,7 +707,7 @@ def remove_bracketed_text(src, counts = Counter() buf = [] src = force_unicode(src) - rmap = dict([(v, k) for k, v in brackets.iteritems()]) + rmap = dict([(v, k) for k, v in iteritems(brackets)]) for char in src: if char in brackets: counts[char] += 1 @@ -714,7 +715,7 @@ def remove_bracketed_text(src, idx = rmap[char] if counts[idx] > 0: counts[idx] -= 1 - elif sum(counts.itervalues()) < 1: + elif sum(itervalues(counts)) < 1: buf.append(char) return u''.join(buf) diff --git a/src/calibre/customize/ui.py b/src/calibre/customize/ui.py index 74a729c135..ae5d8e254e 100644 --- a/src/calibre/customize/ui.py +++ b/src/calibre/customize/ui.py @@ -23,6 +23,7 @@ from calibre.utils.config import (make_config_dir, Config, ConfigProxy, plugin_dir, OptionParser) from calibre.ebooks.metadata.sources.base import Source from calibre.constants import DEBUG, numeric_version +from polyglot.builtins import iteritems, itervalues builtin_names = frozenset(p.name for p in builtin_plugins) BLACKLISTED_PLUGINS = frozenset({'Marvin XD', 'iOS reader applications'}) @@ -347,7 +348,7 @@ def reread_metadata_plugins(): return (1 if plugin.plugin_path is None else 0), plugin.name for group in (_metadata_readers, _metadata_writers): - for plugins in group.itervalues(): + for plugins in itervalues(group): if len(plugins) > 1: plugins.sort(key=key) @@ -640,7 +641,7 @@ def patch_metadata_plugins(possibly_updated_plugins): # Metadata source plugins dont use initialize() but that # might change in the future, so be safe. patches[i].initialize() - for i, pup in patches.iteritems(): + for i, pup in iteritems(patches): _initialized_plugins[i] = pup # }}} diff --git a/src/calibre/customize/zipplugin.py b/src/calibre/customize/zipplugin.py index 95c18da1b2..fec7842afd 100644 --- a/src/calibre/customize/zipplugin.py +++ b/src/calibre/customize/zipplugin.py @@ -2,7 +2,6 @@ # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import (unicode_literals, division, absolute_import, print_function) -from polyglot.builtins import map, unicode_type __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' @@ -15,7 +14,8 @@ from functools import partial from calibre import as_unicode from calibre.customize import (Plugin, numeric_version, platform, InvalidPlugin, PluginNotFound) -from polyglot.builtins import string_or_bytes +from polyglot.builtins import (itervalues, iterkeys, map, + string_or_bytes, unicode_type) # PEP 302 based plugin loading mechanism, works around the bug in zipimport in # python 2.x that prevents importing from zip files in locations whose paths @@ -202,7 +202,7 @@ class PluginLoader(object): else: m = importlib.import_module(plugin_module) plugin_classes = [] - for obj in m.__dict__.itervalues(): + for obj in itervalues(m.__dict__): if isinstance(obj, type) and issubclass(obj, Plugin) and \ obj.name != 'Trivial Plugin': plugin_classes.append(obj) @@ -281,7 +281,7 @@ class PluginLoader(object): # Legacy plugins if '__init__' not in names: - for name in list(names.iterkeys()): + for name in list(iterkeys(names)): if '.' not in name and name.endswith('plugin'): names['__init__'] = names[name] break diff --git a/src/calibre/db/__init__.py b/src/calibre/db/__init__.py index 87144e4890..82ff46b5e4 100644 --- a/src/calibre/db/__init__.py +++ b/src/calibre/db/__init__.py @@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en' SPOOL_SIZE = 30*1024*1024 import numbers -from polyglot.builtins import range +from polyglot.builtins import iteritems, range def _get_next_series_num_for_list(series_indices, unwrap=True): @@ -82,7 +82,7 @@ def get_data_as_dict(self, prefix=None, authors_as_string=False, ids=None, conve 'rating', 'timestamp', 'size', 'tags', 'comments', 'series', 'series_index', 'uuid', 'pubdate', 'last_modified', 'identifiers', 'languages']).union(set(fdata)) - for x, data in fdata.iteritems(): + for x, data in iteritems(fdata): if data['datatype'] == 'series': FIELDS.add('%d_index'%x) data = [] diff --git a/src/calibre/db/adding.py b/src/calibre/db/adding.py index 44fa239ed5..febd2dda5c 100644 --- a/src/calibre/db/adding.py +++ b/src/calibre/db/adding.py @@ -8,7 +8,7 @@ __copyright__ = '2013, Kovid Goyal ' import os, time, re from collections import defaultdict -from polyglot.builtins import map, unicode_type +from polyglot.builtins import itervalues, map, unicode_type from contextlib import contextmanager from functools import partial @@ -137,7 +137,7 @@ def find_books_in_directory(dirpath, single_book_per_directory, compiled_rules=( if allow_path(path, ext, compiled_rules): formats[ext] = path if formats_ok(formats): - yield list(formats.itervalues()) + yield list(itervalues(formats)) else: books = defaultdict(dict) for path in listdir_impl(dirpath, sort_by_mtime=True): @@ -145,9 +145,9 @@ def find_books_in_directory(dirpath, single_book_per_directory, compiled_rules=( if allow_path(path, ext, compiled_rules): books[icu_lower(key) if isinstance(key, unicode_type) else key.lower()][ext] = path - for formats in books.itervalues(): + for formats in itervalues(books): if formats_ok(formats): - yield list(formats.itervalues()) + yield list(itervalues(formats)) def create_format_map(formats): diff --git a/src/calibre/db/backend.py b/src/calibre/db/backend.py index 72cb901cb6..ba9e696ce5 100644 --- a/src/calibre/db/backend.py +++ b/src/calibre/db/backend.py @@ -12,7 +12,8 @@ import os, shutil, uuid, json, glob, time, hashlib, errno, sys from functools import partial import apsw -from polyglot.builtins import unicode_type, reraise, string_or_bytes +from polyglot.builtins import (iteritems, iterkeys, itervalues, + unicode_type, reraise, string_or_bytes) from calibre import isbytestring, force_unicode, prints, as_unicode from calibre.constants import (iswindows, filesystem_encoding, @@ -222,7 +223,7 @@ def SortedConcatenate(sep=','): def finalize(ctxt): if len(ctxt) == 0: return None - return sep.join(map(ctxt.get, sorted(ctxt.iterkeys()))) + return sep.join(map(ctxt.get, sorted(iterkeys(ctxt)))) return ({}, step, finalize) @@ -247,7 +248,7 @@ def AumSortedConcatenate(): ctxt[ndx] = ':::'.join((author, sort, link)) def finalize(ctxt): - keys = list(ctxt.iterkeys()) + keys = list(iterkeys(ctxt)) l = len(keys) if l == 0: return None @@ -733,7 +734,7 @@ class DB(object): } # Create Tag Browser categories for custom columns - for k in sorted(self.custom_column_label_map.iterkeys()): + for k in sorted(iterkeys(self.custom_column_label_map)): v = self.custom_column_label_map[k] if v['normalized']: is_category = True @@ -786,10 +787,10 @@ class DB(object): 'last_modified':19, 'identifiers':20, 'languages':21, } - for k,v in self.FIELD_MAP.iteritems(): + for k,v in iteritems(self.FIELD_MAP): self.field_metadata.set_field_record_index(k, v, prefer_custom=False) - base = max(self.FIELD_MAP.itervalues()) + base = max(itervalues(self.FIELD_MAP)) for label_ in sorted(self.custom_column_label_map): data = self.custom_column_label_map[label_] @@ -1263,7 +1264,7 @@ class DB(object): ''' with self.conn: # Use a single transaction, to ensure nothing modifies the db while we are reading - for table in self.tables.itervalues(): + for table in itervalues(self.tables): try: table.read(self) except: @@ -1327,7 +1328,7 @@ class DB(object): def remove_formats(self, remove_map): paths = [] - for book_id, removals in remove_map.iteritems(): + for book_id, removals in iteritems(remove_map): for fmt, fname, path in removals: path = self.format_abspath(book_id, fmt, fname, path) if path is not None: @@ -1585,7 +1586,7 @@ class DB(object): if samefile(spath, tpath): # The format filenames may have changed while the folder # name remains the same - for fmt, opath in original_format_map.iteritems(): + for fmt, opath in iteritems(original_format_map): npath = format_map.get(fmt, None) if npath and os.path.abspath(npath.lower()) != os.path.abspath(opath.lower()) and samefile(opath, npath): # opath and npath are different hard links to the same file @@ -1648,7 +1649,7 @@ class DB(object): def remove_books(self, path_map, permanent=False): self.executemany( 'DELETE FROM books WHERE id=?', [(x,) for x in path_map]) - paths = {os.path.join(self.library_path, x) for x in path_map.itervalues() if x} + paths = {os.path.join(self.library_path, x) for x in itervalues(path_map) if x} paths = {x for x in paths if os.path.exists(x) and self.is_deletable(x)} if permanent: for path in paths: @@ -1663,7 +1664,7 @@ class DB(object): self.executemany( 'INSERT OR REPLACE INTO books_plugin_data (book, name, val) VALUES (?, ?, ?)', [(book_id, name, json.dumps(val, default=to_json)) - for book_id, val in val_map.iteritems()]) + for book_id, val in iteritems(val_map)]) def get_custom_book_data(self, name, book_ids, default=None): book_ids = frozenset(book_ids) @@ -1722,7 +1723,7 @@ class DB(object): def set_conversion_options(self, options, fmt): options = [(book_id, fmt.upper(), buffer(pickle_binary_string(data.encode('utf-8') if isinstance(data, unicode_type) else data))) - for book_id, data in options.iteritems()] + for book_id, data in iteritems(options)] self.executemany('INSERT OR REPLACE INTO conversion_options(book,format,data) VALUES (?,?,?)', options) def get_top_level_move_items(self, all_paths): diff --git a/src/calibre/db/cache.py b/src/calibre/db/cache.py index e7f1f14aa6..f04f16edeb 100644 --- a/src/calibre/db/cache.py +++ b/src/calibre/db/cache.py @@ -11,7 +11,7 @@ import os, traceback, random, shutil, operator from io import BytesIO from collections import defaultdict, Set, MutableSet from functools import wraps, partial -from polyglot.builtins import unicode_type, zip, string_or_bytes +from polyglot.builtins import iteritems, iterkeys, itervalues, unicode_type, zip, string_or_bytes from time import time from calibre import isbytestring, as_unicode @@ -170,7 +170,7 @@ class Cache(object): # Reconstruct the user categories, putting them into field_metadata fm = self.field_metadata fm.remove_dynamic_categories() - for user_cat in sorted(self._pref('user_categories', {}).iterkeys(), key=sort_key): + for user_cat in sorted(iterkeys(self._pref('user_categories', {})), key=sort_key): cat_name = '@' + user_cat # add the '@' to avoid name collision while cat_name: try: @@ -181,7 +181,7 @@ class Cache(object): # add grouped search term user categories muc = frozenset(self._pref('grouped_search_make_user_categories', [])) - for cat in sorted(self._pref('grouped_search_terms', {}).iterkeys(), key=sort_key): + for cat in sorted(iterkeys(self._pref('grouped_search_terms', {})), key=sort_key): if cat in muc: # There is a chance that these can be duplicates of an existing # user category. Print the exception and continue. @@ -200,7 +200,7 @@ class Cache(object): self.dirtied_cache = {x:i for i, (x,) in enumerate( self.backend.execute('SELECT book FROM metadata_dirtied'))} if self.dirtied_cache: - self.dirtied_sequence = max(self.dirtied_cache.itervalues())+1 + self.dirtied_sequence = max(itervalues(self.dirtied_cache))+1 self._initialize_dynamic_categories() @write_api @@ -213,7 +213,7 @@ class Cache(object): @write_api def clear_composite_caches(self, book_ids=None): - for field in self.composites.itervalues(): + for field in itervalues(self.composites): field.clear_caches(book_ids=book_ids) @write_api @@ -229,7 +229,7 @@ class Cache(object): def clear_caches(self, book_ids=None, template_cache=True, search_cache=True): if template_cache: self._initialize_template_cache() # Clear the formatter template cache - for field in self.fields.itervalues(): + for field in itervalues(self.fields): if hasattr(field, 'clear_caches'): field.clear_caches(book_ids=book_ids) # Clear the composite cache and ondevice caches if book_ids: @@ -247,7 +247,7 @@ class Cache(object): with self.backend.conn: # Prevent other processes, such as calibredb from interrupting the reload by locking the db self.backend.prefs.load_from_db() self._search_api.saved_searches.load_from_db() - for field in self.fields.itervalues(): + for field in itervalues(self.fields): if hasattr(field, 'table'): field.table.read(self.backend) # Reread data from metadata.db @@ -358,7 +358,7 @@ class Cache(object): self.backend.read_tables() bools_are_tristate = self.backend.prefs['bools_are_tristate'] - for field, table in self.backend.tables.iteritems(): + for field, table in iteritems(self.backend.tables): self.fields[field] = create_field(field, table, bools_are_tristate, self.backend.get_template_functions) if table.metadata['datatype'] == 'composite': @@ -368,7 +368,7 @@ class Cache(object): VirtualTable('ondevice'), bools_are_tristate, self.backend.get_template_functions) - for name, field in self.fields.iteritems(): + for name, field in iteritems(self.fields): if name[0] == '#' and name.endswith('_index'): field.series_field = self.fields[name[:-len('_index')]] self.fields[name[:-len('_index')]].index_field = field @@ -494,7 +494,7 @@ class Cache(object): return frozenset(self.fields[field].table.col_book_map) try: - return frozenset(self.fields[field].table.id_map.itervalues()) + return frozenset(itervalues(self.fields[field].table.id_map)) except AttributeError: raise ValueError('%s is not a many-one or many-many field' % field) @@ -503,7 +503,7 @@ class Cache(object): ''' Return a mapping of id to usage count for all values of the specified field, which must be a many-one or many-many field. ''' try: - return {k:len(v) for k, v in self.fields[field].table.col_book_map.iteritems()} + return {k:len(v) for k, v in iteritems(self.fields[field].table.col_book_map)} except AttributeError: raise ValueError('%s is not a many-one or many-many field' % field) @@ -528,13 +528,13 @@ class Cache(object): @read_api def get_item_id(self, field, item_name): ' Return the item id for item_name (case-insensitive) ' - rmap = {icu_lower(v) if isinstance(v, unicode_type) else v:k for k, v in self.fields[field].table.id_map.iteritems()} + rmap = {icu_lower(v) if isinstance(v, unicode_type) else v:k for k, v in iteritems(self.fields[field].table.id_map)} return rmap.get(icu_lower(item_name) if isinstance(item_name, unicode_type) else item_name, None) @read_api def get_item_ids(self, field, item_names): ' Return the item id for item_name (case-insensitive) ' - rmap = {icu_lower(v) if isinstance(v, unicode_type) else v:k for k, v in self.fields[field].table.id_map.iteritems()} + rmap = {icu_lower(v) if isinstance(v, unicode_type) else v:k for k, v in iteritems(self.fields[field].table.id_map)} return {name:rmap.get(icu_lower(name) if isinstance(name, unicode_type) else name, None) for name in item_names} @read_api @@ -1038,13 +1038,13 @@ class Cache(object): new_dirtied = book_ids - already_dirtied already_dirtied = {book_id:self.dirtied_sequence+i for i, book_id in enumerate(already_dirtied)} if already_dirtied: - self.dirtied_sequence = max(already_dirtied.itervalues()) + 1 + self.dirtied_sequence = max(itervalues(already_dirtied)) + 1 self.dirtied_cache.update(already_dirtied) if new_dirtied: self.backend.executemany('INSERT OR IGNORE INTO metadata_dirtied (book) VALUES (?)', ((x,) for x in new_dirtied)) new_dirtied = {book_id:self.dirtied_sequence+i for i, book_id in enumerate(new_dirtied)} - self.dirtied_sequence = max(new_dirtied.itervalues()) + 1 + self.dirtied_sequence = max(itervalues(new_dirtied)) + 1 self.dirtied_cache.update(new_dirtied) @write_api @@ -1075,7 +1075,7 @@ class Cache(object): if is_series: bimap, simap = {}, {} sfield = self.fields[name + '_index'] - for k, v in book_id_to_val_map.iteritems(): + for k, v in iteritems(book_id_to_val_map): if isinstance(v, string_or_bytes): v, sid = get_series_values(v) else: @@ -1117,7 +1117,7 @@ class Cache(object): @read_api def get_a_dirtied_book(self): if self.dirtied_cache: - return random.choice(tuple(self.dirtied_cache.iterkeys())) + return random.choice(tuple(iterkeys(self.dirtied_cache))) return None @read_api @@ -1220,7 +1220,7 @@ class Cache(object): QPixmap, file object or bytestring. It can also be None, in which case any existing cover is removed. ''' - for book_id, data in book_id_data_map.iteritems(): + for book_id, data in iteritems(book_id_data_map): try: path = self._field_for('path', book_id).replace('/', os.sep) except AttributeError: @@ -1231,7 +1231,7 @@ class Cache(object): for cc in self.cover_caches: cc.invalidate(book_id_data_map) return self._set_field('cover', { - book_id:(0 if data is None else 1) for book_id, data in book_id_data_map.iteritems()}) + book_id:(0 if data is None else 1) for book_id, data in iteritems(book_id_data_map)}) @write_api def add_cover_cache(self, cover_cache): @@ -1332,14 +1332,14 @@ class Cache(object): protected_set_field('identifiers', mi_idents) elif mi_idents: identifiers = self._field_for('identifiers', book_id, default_value={}) - for key, val in mi_idents.iteritems(): + for key, val in iteritems(mi_idents): if val and val.strip(): # Don't delete an existing identifier identifiers[icu_lower(key)] = val protected_set_field('identifiers', identifiers) user_mi = mi.get_all_user_metadata(make_copy=False) fm = self.field_metadata - for key in user_mi.iterkeys(): + for key in iterkeys(user_mi): if (key in fm and user_mi[key]['datatype'] == fm[key]['datatype'] and ( user_mi[key]['datatype'] != 'text' or ( user_mi[key]['is_multiple'] == fm[key]['is_multiple']))): @@ -1433,15 +1433,15 @@ class Cache(object): :param db_only: If True, only remove the record for the format from the db, do not delete the actual format file from the filesystem. ''' table = self.fields['formats'].table - formats_map = {book_id:frozenset((f or '').upper() for f in fmts) for book_id, fmts in formats_map.iteritems()} + formats_map = {book_id:frozenset((f or '').upper() for f in fmts) for book_id, fmts in iteritems(formats_map)} - for book_id, fmts in formats_map.iteritems(): + for book_id, fmts in iteritems(formats_map): for fmt in fmts: self.format_metadata_cache[book_id].pop(fmt, None) if not db_only: removes = defaultdict(set) - for book_id, fmts in formats_map.iteritems(): + for book_id, fmts in iteritems(formats_map): try: path = self._field_for('path', book_id).replace('/', os.sep) except: @@ -1458,7 +1458,7 @@ class Cache(object): size_map = table.remove_formats(formats_map, self.backend) self.fields['size'].table.update_sizes(size_map) - self._update_last_modified(tuple(formats_map.iterkeys())) + self._update_last_modified(tuple(iterkeys(formats_map))) @read_api def get_next_series_num_for(self, series, field='series', current_indices=False): @@ -1481,7 +1481,7 @@ class Cache(object): index_map = {book_id:self._fast_field_for(idf, book_id, default_value=1.0) for book_id in books} if current_indices: return index_map - series_indices = sorted(index_map.itervalues()) + series_indices = sorted(itervalues(index_map)) return _get_next_series_num_for_list(tuple(series_indices), unwrap=False) @read_api @@ -1491,7 +1491,7 @@ class Cache(object): string. ''' table = self.fields['authors'].table result = [] - rmap = {key_func(v):k for k, v in table.id_map.iteritems()} + rmap = {key_func(v):k for k, v in iteritems(table.id_map)} for aut in authors: aid = rmap.get(key_func(aut), None) result.append(author_to_author_sort(aut) if aid is None else table.asort_map[aid]) @@ -1503,10 +1503,10 @@ class Cache(object): implementation of :meth:`has_book` in a worker process without access to the db. ''' try: - return {icu_lower(title) for title in self.fields['title'].table.book_col_map.itervalues()} + return {icu_lower(title) for title in itervalues(self.fields['title'].table.book_col_map)} except TypeError: # Some non-unicode titles in the db - return {icu_lower(as_unicode(title)) for title in self.fields['title'].table.book_col_map.itervalues()} + return {icu_lower(as_unicode(title)) for title in itervalues(self.fields['title'].table.book_col_map)} @read_api def has_book(self, mi): @@ -1518,7 +1518,7 @@ class Cache(object): if isbytestring(title): title = title.decode(preferred_encoding, 'replace') q = icu_lower(title).strip() - for title in self.fields['title'].table.book_col_map.itervalues(): + for title in itervalues(self.fields['title'].table.book_col_map): if q == icu_lower(title): return True return False @@ -1599,7 +1599,7 @@ class Cache(object): duplicates.append((mi, format_map)) else: ids.append(book_id) - for fmt, stream_or_path in format_map.iteritems(): + for fmt, stream_or_path in iteritems(format_map): if self.add_format(book_id, fmt, stream_or_path, dbapi=dbapi, run_hooks=run_hooks): fmt_map[fmt.lower()] = getattr(stream_or_path, 'name', stream_or_path) or '' run_plugins_on_postadd(dbapi or self, book_id, fmt_map) @@ -1618,11 +1618,11 @@ class Cache(object): path = None path_map[book_id] = path if iswindows: - paths = (x.replace(os.sep, '/') for x in path_map.itervalues() if x) + paths = (x.replace(os.sep, '/') for x in itervalues(path_map) if x) self.backend.windows_check_if_files_in_use(paths) self.backend.remove_books(path_map, permanent=permanent) - for field in self.fields.itervalues(): + for field in itervalues(self.fields): try: table = field.table except AttributeError: @@ -1665,7 +1665,7 @@ class Cache(object): restrict_to_book_ids = frozenset(restrict_to_book_ids) id_map = {} default_process_map = {} - for old_id, new_name in item_id_to_new_name_map.iteritems(): + for old_id, new_name in iteritems(item_id_to_new_name_map): new_names = tuple(x.strip() for x in new_name.split(sv)) if sv else (new_name,) # Get a list of books in the VL with the item books_with_id = f.books_for(old_id) @@ -1720,7 +1720,7 @@ class Cache(object): raise ValueError('Cannot rename items for one-one fields: %s' % field) moved_books = set() id_map = {} - for item_id, new_name in item_id_to_new_name_map.iteritems(): + for item_id, new_name in iteritems(item_id_to_new_name_map): new_names = tuple(x.strip() for x in new_name.split(sv)) if sv else (new_name,) books, new_id = func(item_id, new_names[0], self.backend) affected_books.update(books) @@ -1735,7 +1735,7 @@ class Cache(object): if affected_books: if field == 'authors': self._set_field('author_sort', - {k:' & '.join(v) for k, v in self._author_sort_strings_for_books(affected_books).iteritems()}) + {k:' & '.join(v) for k, v in iteritems(self._author_sort_strings_for_books(affected_books))}) self._update_path(affected_books, mark_as_dirtied=False) elif change_index and hasattr(f, 'index_field') and tweaks['series_index_auto_increment'] != 'no_change': for book_id in moved_books: @@ -1835,7 +1835,7 @@ class Cache(object): insensitive). ''' - tag_map = {icu_lower(v):k for k, v in self._get_id_map('tags').iteritems()} + tag_map = {icu_lower(v):k for k, v in iteritems(self._get_id_map('tags'))} tag = icu_lower(tag.strip()) mht = icu_lower(must_have_tag.strip()) if must_have_tag else None tag_id, mht_id = tag_map.get(tag, None), tag_map.get(mht, None) @@ -1848,7 +1848,7 @@ class Cache(object): tagged_books = tagged_books.intersection(self._books_for_field('tags', mht_id)) if tagged_books: if must_have_authors is not None: - amap = {icu_lower(v):k for k, v in self._get_id_map('authors').iteritems()} + amap = {icu_lower(v):k for k, v in iteritems(self._get_id_map('authors'))} books = None for author in must_have_authors: abooks = self._books_for_field('authors', amap.get(icu_lower(author), None)) @@ -1934,7 +1934,7 @@ class Cache(object): db. See db.utils for an implementation. ''' at = self.fields['authors'].table author_map = defaultdict(set) - for aid, author in at.id_map.iteritems(): + for aid, author in iteritems(at.id_map): author_map[icu_lower(author)].add(aid) return (author_map, at.col_book_map.copy(), self.fields['title'].table.book_col_map.copy(), self.fields['languages'].book_value_map.copy()) @@ -2079,12 +2079,12 @@ class Cache(object): def virtual_libraries_for_books(self, book_ids): libraries = self._pref('virtual_libraries', {}) ans = {book_id:[] for book_id in book_ids} - for lib, expr in libraries.iteritems(): + for lib, expr in iteritems(libraries): books = self._search(expr) # We deliberately dont use book_ids as we want to use the search cache for book in book_ids: if book in books: ans[book].append(lib) - return {k:tuple(sorted(v, key=sort_key)) for k, v in ans.iteritems()} + return {k:tuple(sorted(v, key=sort_key)) for k, v in iteritems(ans)} @read_api def user_categories_for_books(self, book_ids, proxy_metadata_map=None): @@ -2101,7 +2101,7 @@ class Cache(object): for book_id in book_ids: proxy_metadata = pmm.get(book_id) or self._get_proxy_metadata(book_id) user_cat_vals = ans[book_id] = {} - for ucat, categories in user_cats.iteritems(): + for ucat, categories in iteritems(user_cats): user_cat_vals[ucat] = res = [] for name, cat, ign in categories: try: @@ -2240,15 +2240,15 @@ def import_library(library_key, importer, library_path, progress=None, abort=Non src.close() cache = Cache(DB(library_path, load_user_formatter_functions=False)) cache.init() - format_data = {int(book_id):data for book_id, data in metadata['format_data'].iteritems()} - for i, (book_id, fmt_key_map) in enumerate(format_data.iteritems()): + format_data = {int(book_id):data for book_id, data in iteritems(metadata['format_data'])} + for i, (book_id, fmt_key_map) in enumerate(iteritems(format_data)): if abort is not None and abort.is_set(): return title = cache._field_for('title', book_id) if progress is not None: progress(title, i + 1, total) cache._update_path((book_id,), mark_as_dirtied=False) - for fmt, fmtkey in fmt_key_map.iteritems(): + for fmt, fmtkey in iteritems(fmt_key_map): if fmt == '.cover': stream = importer.start_file(fmtkey, _('Cover for %s') % title) path = cache._field_for('path', book_id).replace('/', os.sep) diff --git a/src/calibre/db/categories.py b/src/calibre/db/categories.py index 0ae1cee97f..38489a40fb 100644 --- a/src/calibre/db/categories.py +++ b/src/calibre/db/categories.py @@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en' import copy from functools import partial -from polyglot.builtins import unicode_type, map +from polyglot.builtins import iteritems, iterkeys, unicode_type, map from calibre.constants import ispy3 from calibre.ebooks.metadata import author_to_author_sort @@ -75,7 +75,7 @@ class Tag(object): def find_categories(field_metadata): - for category, cat in field_metadata.iteritems(): + for category, cat in iteritems(field_metadata): if (cat['is_category'] and cat['kind'] not in {'user', 'search'}): yield (category, cat['is_multiple'].get('cache_to_list', None), False) elif (cat['datatype'] == 'composite' and @@ -215,11 +215,11 @@ def get_categories(dbcache, sort='name', book_ids=None, first_letter_sort=False) # do the verification in the category loop much faster, at the cost of # temporarily duplicating the categories lists. taglist = {} - for c, items in categories.iteritems(): + for c, items in iteritems(categories): taglist[c] = dict(map(lambda t:(icu_lower(t.name), t), items)) # Add the category values to the user categories - for user_cat in sorted(user_categories.iterkeys(), key=sort_key): + for user_cat in sorted(iterkeys(user_categories), key=sort_key): items = [] names_seen = {} user_cat_is_gst = user_cat in gst diff --git a/src/calibre/db/cli/cmd_custom_columns.py b/src/calibre/db/cli/cmd_custom_columns.py index 0e8a0b5813..b8c54bad2c 100644 --- a/src/calibre/db/cli/cmd_custom_columns.py +++ b/src/calibre/db/cli/cmd_custom_columns.py @@ -7,6 +7,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera from pprint import pformat from calibre import prints +from polyglot.builtins import iteritems readonly = True version = 0 # change this if you change signature of implementation() @@ -37,7 +38,7 @@ List available custom columns. Shows column labels and ids. def main(opts, args, dbctx): - for col, data in dbctx.run('custom_columns').iteritems(): + for col, data in iteritems(dbctx.run('custom_columns')): if opts.details: prints(col) print() diff --git a/src/calibre/db/cli/cmd_list.py b/src/calibre/db/cli/cmd_list.py index 570271c351..a6635236d4 100644 --- a/src/calibre/db/cli/cmd_list.py +++ b/src/calibre/db/cli/cmd_list.py @@ -13,6 +13,7 @@ from calibre import prints from calibre.db.cli.utils import str_width from calibre.ebooks.metadata import authors_to_string from calibre.utils.date import isoformat +from polyglot.builtins import iteritems readonly = True version = 0 # change this if you change signature of implementation() @@ -64,7 +65,7 @@ def implementation( continue if field == 'isbn': x = db.all_field_for('identifiers', book_ids, default_value={}) - data[field] = {k: v.get('isbn') or '' for k, v in x.iteritems()} + data[field] = {k: v.get('isbn') or '' for k, v in iteritems(x)} continue field = field.replace('*', '#') metadata[field] = fm[field] @@ -80,37 +81,37 @@ def implementation( def stringify(data, metadata, for_machine): - for field, m in metadata.iteritems(): + for field, m in iteritems(metadata): if field == 'authors': data[field] = { k: authors_to_string(v) - for k, v in data[field].iteritems() + for k, v in iteritems(data[field]) } else: dt = m['datatype'] if dt == 'datetime': data[field] = { k: isoformat(v, as_utc=for_machine) if v else 'None' - for k, v in data[field].iteritems() + for k, v in iteritems(data[field]) } elif not for_machine: ism = m['is_multiple'] if ism: data[field] = { k: ism['list_to_ui'].join(v) - for k, v in data[field].iteritems() + for k, v in iteritems(data[field]) } if field == 'formats': data[field] = { k: '[' + v + ']' - for k, v in data[field].iteritems() + for k, v in iteritems(data[field]) } def as_machine_data(book_ids, data, metadata): for book_id in book_ids: ans = {'id': book_id} - for field, val_map in data.iteritems(): + for field, val_map in iteritems(data): val = val_map.get(book_id) if val is not None: ans[field.replace('#', '*')] = val diff --git a/src/calibre/db/cli/cmd_saved_searches.py b/src/calibre/db/cli/cmd_saved_searches.py index fd31051782..b06585d48e 100644 --- a/src/calibre/db/cli/cmd_saved_searches.py +++ b/src/calibre/db/cli/cmd_saved_searches.py @@ -9,6 +9,7 @@ version = 0 # change this if you change signature of implementation() from calibre import prints from calibre.srv.changes import saved_searches +from polyglot.builtins import iteritems def implementation(db, notify_changes, action, *args): @@ -56,7 +57,7 @@ Syntax for removing: def main(opts, args, dbctx): args = args or ['list'] if args[0] == 'list': - for name, value in dbctx.run('saved_searches', 'list').iteritems(): + for name, value in iteritems(dbctx.run('saved_searches', 'list')): prints(_('Name:'), name) prints(_('Search string:'), value) print() diff --git a/src/calibre/db/cli/cmd_set_metadata.py b/src/calibre/db/cli/cmd_set_metadata.py index 18a09bafb9..02ac4462de 100644 --- a/src/calibre/db/cli/cmd_set_metadata.py +++ b/src/calibre/db/cli/cmd_set_metadata.py @@ -11,7 +11,7 @@ from calibre.ebooks.metadata.book.base import field_from_string from calibre.ebooks.metadata.book.serialize import read_cover from calibre.ebooks.metadata.opf import get_metadata from calibre.srv.changes import metadata -from polyglot.builtins import unicode_type +from polyglot.builtins import iteritems, unicode_type readonly = False version = 0 # change this if you change signature of implementation() @@ -170,7 +170,7 @@ def main(opts, args, dbctx): vals[field] = val fvals = [] for field, val in sorted( # ensure series_index fields are set last - vals.iteritems(), key=lambda k: 1 if k[0].endswith('_index') else 0): + iteritems(vals), key=lambda k: 1 if k[0].endswith('_index') else 0): if field.endswith('_index'): try: val = float(val) diff --git a/src/calibre/db/cli/tests.py b/src/calibre/db/cli/tests.py index 3c5ad650b0..1f7f960e2c 100644 --- a/src/calibre/db/cli/tests.py +++ b/src/calibre/db/cli/tests.py @@ -13,14 +13,14 @@ import csv import unittest from cStringIO import StringIO - from calibre.db.cli.cmd_check_library import _print_check_library_results +from polyglot.builtins import iteritems class Checker(object): def __init__(self, kw): - for k, v in kw.iteritems(): + for k, v in iteritems(kw): setattr(self, k, v) diff --git a/src/calibre/db/fields.py b/src/calibre/db/fields.py index 1ecf43319c..d42ab52db9 100644 --- a/src/calibre/db/fields.py +++ b/src/calibre/db/fields.py @@ -2,7 +2,6 @@ # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import (unicode_literals, division, absolute_import, print_function) -# from polyglot.builtins import map __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' @@ -20,6 +19,7 @@ from calibre.utils.config_base import tweaks from calibre.utils.icu import sort_key from calibre.utils.date import UNDEFINED_DATE, clean_date_for_sort, parse_date from calibre.utils.localization import calibre_langcode_to_name +from polyglot.builtins import iteritems, iterkeys def bool_sort_key(bools_are_tristate): @@ -150,7 +150,7 @@ class Field(object): id_map = self.table.id_map special_sort = hasattr(self, 'category_sort_value') - for item_id, item_book_ids in self.table.col_book_map.iteritems(): + for item_id, item_book_ids in iteritems(self.table.col_book_map): if book_ids is not None: item_book_ids = item_book_ids.intersection(book_ids) if item_book_ids: @@ -184,7 +184,7 @@ class OneToOneField(Field): return {item_id} def __iter__(self): - return self.table.book_col_map.iterkeys() + return iterkeys(self.table.book_col_map) def sort_keys_for_books(self, get_metadata, lang_map): bcmg = self.table.book_col_map.get @@ -315,7 +315,7 @@ class CompositeField(OneToOneField): for v in vals: if v: val_map[v].add(book_id) - for val, book_ids in val_map.iteritems(): + for val, book_ids in iteritems(val_map): yield val, book_ids def get_composite_categories(self, tag_class, book_rating_map, book_ids, @@ -328,7 +328,7 @@ class CompositeField(OneToOneField): for val in vals: if val: id_map[val].add(book_id) - for item_id, item_book_ids in id_map.iteritems(): + for item_id, item_book_ids in iteritems(id_map): ratings = tuple(r for r in (book_rating_map.get(book_id, 0) for book_id in item_book_ids) if r > 0) avg = sum(ratings)/len(ratings) if ratings else 0 @@ -409,7 +409,7 @@ class OnDeviceField(OneToOneField): val_map = defaultdict(set) for book_id in candidates: val_map[self.for_book(book_id, default_value=default_value)].add(book_id) - for val, book_ids in val_map.iteritems(): + for val, book_ids in iteritems(val_map): yield val, book_ids @@ -456,7 +456,7 @@ class ManyToOneField(Field): return self.table.col_book_map.get(item_id, set()) def __iter__(self): - return self.table.id_map.iterkeys() + return iterkeys(self.table.id_map) def sort_keys_for_books(self, get_metadata, lang_map): sk_map = LazySortMap(self._default_sort_key, self._sort_key, self.table.id_map) @@ -466,7 +466,7 @@ class ManyToOneField(Field): def iter_searchable_values(self, get_metadata, candidates, default_value=None): cbm = self.table.col_book_map empty = set() - for item_id, val in self.table.id_map.iteritems(): + for item_id, val in iteritems(self.table.id_map): book_ids = cbm.get(item_id, empty).intersection(candidates) if book_ids: yield val, book_ids @@ -475,7 +475,7 @@ class ManyToOneField(Field): def book_value_map(self): try: return {book_id:self.table.id_map[item_id] for book_id, item_id in - self.table.book_col_map.iteritems()} + iteritems(self.table.book_col_map)} except KeyError: raise InvalidLinkTable(self.name) @@ -507,7 +507,7 @@ class ManyToManyField(Field): return self.table.col_book_map.get(item_id, set()) def __iter__(self): - return self.table.id_map.iterkeys() + return iterkeys(self.table.id_map) def sort_keys_for_books(self, get_metadata, lang_map): sk_map = LazySortMap(self._default_sort_key, self._sort_key, self.table.id_map) @@ -524,7 +524,7 @@ class ManyToManyField(Field): def iter_searchable_values(self, get_metadata, candidates, default_value=None): cbm = self.table.col_book_map empty = set() - for item_id, val in self.table.id_map.iteritems(): + for item_id, val in iteritems(self.table.id_map): book_ids = cbm.get(item_id, empty).intersection(candidates) if book_ids: yield val, book_ids @@ -534,14 +534,14 @@ class ManyToManyField(Field): cbm = self.table.book_col_map for book_id in candidates: val_map[len(cbm.get(book_id, ()))].add(book_id) - for count, book_ids in val_map.iteritems(): + for count, book_ids in iteritems(val_map): yield count, book_ids @property def book_value_map(self): try: return {book_id:tuple(self.table.id_map[item_id] for item_id in item_ids) - for book_id, item_ids in self.table.book_col_map.iteritems()} + for book_id, item_ids in iteritems(self.table.book_col_map)} except KeyError: raise InvalidLinkTable(self.name) @@ -561,7 +561,7 @@ class IdentifiersField(ManyToManyField): 'Sort by identifier keys' bcmg = self.table.book_col_map.get dv = {self._default_sort_key:None} - return lambda book_id: tuple(sorted(bcmg(book_id, dv).iterkeys())) + return lambda book_id: tuple(sorted(iterkeys(bcmg(book_id, dv)))) def iter_searchable_values(self, get_metadata, candidates, default_value=()): bcm = self.table.book_col_map @@ -573,7 +573,7 @@ class IdentifiersField(ManyToManyField): def get_categories(self, tag_class, book_rating_map, lang_map, book_ids=None): ans = [] - for id_key, item_book_ids in self.table.col_book_map.iteritems(): + for id_key, item_book_ids in iteritems(self.table.col_book_map): if book_ids is not None: item_book_ids = item_book_ids.intersection(book_ids) if item_book_ids: @@ -618,13 +618,13 @@ class FormatsField(ManyToManyField): for val in vals: val_map[val].add(book_id) - for val, book_ids in val_map.iteritems(): + for val, book_ids in iteritems(val_map): yield val, book_ids def get_categories(self, tag_class, book_rating_map, lang_map, book_ids=None): ans = [] - for fmt, item_book_ids in self.table.col_book_map.iteritems(): + for fmt, item_book_ids in iteritems(self.table.col_book_map): if book_ids is not None: item_book_ids = item_book_ids.intersection(book_ids) if item_book_ids: @@ -665,7 +665,7 @@ class SeriesField(ManyToOneField): return ssk(ts(val, order=sso, lang=lang)) sk_map = LazySeriesSortMap(self._default_sort_key, sk, self.table.id_map) bcmg = self.table.book_col_map.get - lang_map = {k:v[0] if v else None for k, v in lang_map.iteritems()} + lang_map = {k:v[0] if v else None for k, v in iteritems(lang_map)} def key(book_id): lang = lang_map.get(book_id, None) @@ -694,8 +694,8 @@ class SeriesField(ManyToOneField): sso = tweaks['title_series_sorting'] ts = title_sort empty = set() - lang_map = {k:v[0] if v else None for k, v in lang_map.iteritems()} - for item_id, val in self.table.id_map.iteritems(): + lang_map = {k:v[0] if v else None for k, v in iteritems(lang_map)} + for item_id, val in iteritems(self.table.id_map): book_ids = cbm.get(item_id, empty).intersection(candidates) if book_ids: lang_counts = Counter() @@ -712,7 +712,7 @@ class TagsField(ManyToManyField): def get_news_category(self, tag_class, book_ids=None): news_id = None ans = [] - for item_id, val in self.table.id_map.iteritems(): + for item_id, val in iteritems(self.table.id_map): if val == _('News'): news_id = item_id break @@ -724,7 +724,7 @@ class TagsField(ManyToManyField): news_books = news_books.intersection(book_ids) if not news_books: return ans - for item_id, item_book_ids in self.table.col_book_map.iteritems(): + for item_id, item_book_ids in iteritems(self.table.col_book_map): item_book_ids = item_book_ids.intersection(news_books) if item_book_ids: name = self.category_formatter(self.table.id_map[item_id]) diff --git a/src/calibre/db/lazy.py b/src/calibre/db/lazy.py index ffa71f8612..e3c5128ed4 100644 --- a/src/calibre/db/lazy.py +++ b/src/calibre/db/lazy.py @@ -15,7 +15,7 @@ from copy import deepcopy from calibre.ebooks.metadata.book.base import Metadata, SIMPLE_GET, TOP_LEVEL_IDENTIFIERS, NULL_VALUES, ALL_METADATA_FIELDS from calibre.ebooks.metadata.book.formatter import SafeFormat from calibre.utils.date import utcnow -from polyglot.builtins import unicode_type +from polyglot.builtins import iterkeys, unicode_type # Lazy format metadata retrieval {{{ ''' @@ -393,7 +393,7 @@ class ProxyMetadata(Metadata): def all_field_keys(self): um = ga(self, '_user_metadata') - return frozenset(ALL_METADATA_FIELDS.union(um.iterkeys())) + return frozenset(ALL_METADATA_FIELDS.union(iterkeys(um))) @property def _proxy_metadata(self): diff --git a/src/calibre/db/legacy.py b/src/calibre/db/legacy.py index 60b2f083d8..3eff229a68 100644 --- a/src/calibre/db/legacy.py +++ b/src/calibre/db/legacy.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' import os, traceback, types -from polyglot.builtins import zip +from polyglot.builtins import iteritems, zip from calibre import force_unicode, isbytestring from calibre.constants import preferred_encoding @@ -171,14 +171,14 @@ class LibraryDatabase(object): return not bool(self.new_api.fields['title'].table.book_col_map) def get_usage_count_by_id(self, field): - return [[k, v] for k, v in self.new_api.get_usage_count_by_id(field).iteritems()] + return [[k, v] for k, v in iteritems(self.new_api.get_usage_count_by_id(field))] def field_id_map(self, field): - return [(k, v) for k, v in self.new_api.get_id_map(field).iteritems()] + return [(k, v) for k, v in iteritems(self.new_api.get_id_map(field))] def get_custom_items_with_ids(self, label=None, num=None): try: - return [[k, v] for k, v in self.new_api.get_id_map(self.custom_field_name(label, num)).iteritems()] + return [[k, v] for k, v in iteritems(self.new_api.get_id_map(self.custom_field_name(label, num)))] except ValueError: return [] @@ -233,7 +233,7 @@ class LibraryDatabase(object): paths, formats, metadata = [], [], [] for mi, format_map in duplicates: metadata.append(mi) - for fmt, path in format_map.iteritems(): + for fmt, path in iteritems(format_map): formats.append(fmt) paths.append(path) duplicates = (paths, formats, metadata) @@ -416,7 +416,7 @@ class LibraryDatabase(object): ans = set() if title: title = icu_lower(force_unicode(title)) - for book_id, x in self.new_api.get_id_map('title').iteritems(): + for book_id, x in iteritems(self.new_api.get_id_map('title')): if icu_lower(x) == title: ans.add(book_id) if not all_matches: @@ -521,7 +521,7 @@ class LibraryDatabase(object): def delete_tags(self, tags): with self.new_api.write_lock: - tag_map = {icu_lower(v):k for k, v in self.new_api._get_id_map('tags').iteritems()} + tag_map = {icu_lower(v):k for k, v in iteritems(self.new_api._get_id_map('tags'))} tag_ids = (tag_map.get(icu_lower(tag), None) for tag in tags) tag_ids = tuple(tid for tid in tag_ids if tid is not None) if tag_ids: @@ -547,7 +547,7 @@ class LibraryDatabase(object): def format_files(self, index, index_is_id=False): book_id = index if index_is_id else self.id(index) - return [(v, k) for k, v in self.new_api.format_files(book_id).iteritems()] + return [(v, k) for k, v in iteritems(self.new_api.format_files(book_id))] def format_metadata(self, book_id, fmt, allow_cache=True, update_db=False, commit=False): return self.new_api.format_metadata(book_id, fmt, allow_cache=allow_cache, update_db=update_db) @@ -632,7 +632,7 @@ class LibraryDatabase(object): def delete_item_from_multiple(self, item, label=None, num=None): field = self.custom_field_name(label, num) existing = self.new_api.get_id_map(field) - rmap = {icu_lower(v):k for k, v in existing.iteritems()} + rmap = {icu_lower(v):k for k, v in iteritems(existing)} item_id = rmap.get(icu_lower(item), None) if item_id is None: return [] @@ -854,7 +854,7 @@ for field in ('authors', 'tags', 'publisher', 'series'): LibraryDatabase.all_formats = MT(lambda self:self.new_api.all_field_names('formats')) LibraryDatabase.all_custom = MT(lambda self, label=None, num=None:self.new_api.all_field_names(self.custom_field_name(label, num))) -for func, field in {'all_authors':'authors', 'all_titles':'title', 'all_tags2':'tags', 'all_series':'series', 'all_publishers':'publisher'}.iteritems(): +for func, field in iteritems({'all_authors':'authors', 'all_titles':'title', 'all_tags2':'tags', 'all_series':'series', 'all_publishers':'publisher'}): def getter(field): def func(self): return self.field_id_map(field) @@ -864,16 +864,16 @@ for func, field in {'all_authors':'authors', 'all_titles':'title', 'all_tags2':' LibraryDatabase.all_tags = MT(lambda self: list(self.all_tag_names())) LibraryDatabase.get_all_identifier_types = MT(lambda self: list(self.new_api.fields['identifiers'].table.all_identifier_types())) LibraryDatabase.get_authors_with_ids = MT( - lambda self: [[aid, adata['name'], adata['sort'], adata['link']] for aid, adata in self.new_api.author_data().iteritems()]) + lambda self: [[aid, adata['name'], adata['sort'], adata['link']] for aid, adata in iteritems(self.new_api.author_data())]) LibraryDatabase.get_author_id = MT( - lambda self, author: {icu_lower(v):k for k, v in self.new_api.get_id_map('authors').iteritems()}.get(icu_lower(author), None)) + lambda self, author: {icu_lower(v):k for k, v in iteritems(self.new_api.get_id_map('authors'))}.get(icu_lower(author), None)) for field in ('tags', 'series', 'publishers', 'ratings', 'languages'): def getter(field): fname = field[:-1] if field in {'publishers', 'ratings'} else field def func(self): - return [[tid, tag] for tid, tag in self.new_api.get_id_map(fname).iteritems()] + return [[tid, tag] for tid, tag in iteritems(self.new_api.get_id_map(fname))] return func setattr(LibraryDatabase, 'get_%s_with_ids' % field, MT(getter(field))) diff --git a/src/calibre/db/restore.py b/src/calibre/db/restore.py index 11526cea34..7db2ad78d1 100644 --- a/src/calibre/db/restore.py +++ b/src/calibre/db/restore.py @@ -16,6 +16,7 @@ from calibre.db.cache import Cache from calibre.constants import filesystem_encoding from calibre.utils.date import utcfromtimestamp from calibre import isbytestring, force_unicode +from polyglot.builtins import iteritems NON_EBOOK_EXTENSIONS = frozenset([ 'jpg', 'jpeg', 'gif', 'png', 'bmp', @@ -206,7 +207,7 @@ class Restore(Thread): self.mismatched_dirs.append(dirpath) alm = mi.get('author_link_map', {}) - for author, link in alm.iteritems(): + for author, link in iteritems(alm): existing_link, timestamp = self.authors_links.get(author, (None, None)) if existing_link is None or existing_link != link and timestamp < mi.timestamp: self.authors_links[author] = (link, mi.timestamp) @@ -259,7 +260,7 @@ class Restore(Thread): self.progress_callback(book['mi'].title, i+1) id_map = db.get_item_ids('authors', [author for author in self.authors_links]) - link_map = {aid:self.authors_links[name][0] for name, aid in id_map.iteritems() if aid is not None} + link_map = {aid:self.authors_links[name][0] for name, aid in iteritems(id_map) if aid is not None} if link_map: db.set_link_for_authors(link_map) db.close() diff --git a/src/calibre/db/schema_upgrades.py b/src/calibre/db/schema_upgrades.py index d2e18ed94f..7b5dc28832 100644 --- a/src/calibre/db/schema_upgrades.py +++ b/src/calibre/db/schema_upgrades.py @@ -11,7 +11,7 @@ import os from calibre import prints from calibre.utils.date import isoformat, DEFAULT_DATE -from polyglot.builtins import unicode_type +from polyglot.builtins import iterkeys, itervalues, unicode_type class SchemaUpgrade(object): @@ -299,7 +299,7 @@ class SchemaUpgrade(object): '''.format(tn=table_name, cn=column_name, vcn=view_column_name)) self.db.execute(script) - for field in self.field_metadata.itervalues(): + for field in itervalues(self.field_metadata): if field['is_category'] and not field['is_custom'] and 'link_column' in field: table = self.db.get( 'SELECT name FROM sqlite_master WHERE type="table" AND name=?', @@ -375,7 +375,7 @@ class SchemaUpgrade(object): '''.format(lt=link_table_name, table=table_name) self.db.execute(script) - for field in self.field_metadata.itervalues(): + for field in itervalues(self.field_metadata): if field['is_category'] and not field['is_custom'] and 'link_column' in field: table = self.db.get( 'SELECT name FROM sqlite_master WHERE type="table" AND name=?', @@ -596,7 +596,7 @@ class SchemaUpgrade(object): custom_recipe_filename) bdir = os.path.dirname(custom_recipes.file_path) for id_, title, script in recipes: - existing = frozenset(map(int, custom_recipes.iterkeys())) + existing = frozenset(map(int, iterkeys(custom_recipes))) if id_ in existing: id_ = max(existing) + 1000 id_ = str(id_) diff --git a/src/calibre/db/search.py b/src/calibre/db/search.py index cc70ec4a39..b4cea09c71 100644 --- a/src/calibre/db/search.py +++ b/src/calibre/db/search.py @@ -19,7 +19,7 @@ from calibre.utils.date import parse_date, UNDEFINED_DATE, now, dt_as_local from calibre.utils.icu import primary_contains, sort_key from calibre.utils.localization import lang_map, canonicalize_lang from calibre.utils.search_query_parser import SearchQueryParser, ParseException -from polyglot.builtins import unicode_type, string_or_bytes +from polyglot.builtins import iteritems, iterkeys, unicode_type, string_or_bytes CONTAINS_MATCH = 0 EQUALS_MATCH = 1 @@ -167,7 +167,7 @@ class DateSearch(object): # {{{ matches |= book_ids return matches - for k, relop in self.operators.iteritems(): + for k, relop in iteritems(self.operators): if query.startswith(k): query = query[len(k):] break @@ -254,7 +254,7 @@ class NumericSearch(object): # {{{ else: relop = lambda x,y: x is not None else: - for k, relop in self.operators.iteritems(): + for k, relop in iteritems(self.operators): if query.startswith(k): query = query[len(k):] break @@ -372,7 +372,7 @@ class KeyPairSearch(object): # {{{ return found if valq == 'true' else candidates - found for m, book_ids in field_iter(): - for key, val in m.iteritems(): + for key, val in iteritems(m): if (keyq and not _match(keyq, (key,), keyq_mkind, use_primary_find_in_search=use_primary_find)): continue @@ -445,7 +445,7 @@ class SavedSearchQueries(object): # {{{ db._set_pref(self.opt_name, smap) def names(self): - return sorted(self.queries.iterkeys(), key=sort_key) + return sorted(iterkeys(self.queries), key=sort_key) # }}} @@ -632,7 +632,7 @@ class Parser(SearchQueryParser): # {{{ text_fields = set() field_metadata = {} - for x, fm in self.field_metadata.iteritems(): + for x, fm in iteritems(self.field_metadata): if x.startswith('@'): continue if fm['search_terms'] and x not in {'series_sort', 'id'}: @@ -670,7 +670,7 @@ class Parser(SearchQueryParser): # {{{ q = canonicalize_lang(query) if q is None: lm = lang_map() - rm = {v.lower():k for k,v in lm.iteritems()} + rm = {v.lower():k for k,v in iteritems(lm)} q = rm.get(query, query) if matchkind == CONTAINS_MATCH and q.lower() in {'true', 'false'}: @@ -799,7 +799,7 @@ class LRUCache(object): # {{{ return self.get(key) def __iter__(self): - return self.item_map.iteritems() + return iteritems(self.item_map) # }}} diff --git a/src/calibre/db/tables.py b/src/calibre/db/tables.py index 1dfd722ff0..b22b53a5b7 100644 --- a/src/calibre/db/tables.py +++ b/src/calibre/db/tables.py @@ -14,7 +14,7 @@ from collections import defaultdict from calibre.constants import plugins from calibre.utils.date import parse_date, UNDEFINED_DATE, utc_tz from calibre.ebooks.metadata import author_to_author_sort -from polyglot.builtins import range +from polyglot.builtins import iteritems, itervalues, range _c_speedup = plugins['speedup'][0].parse_date @@ -154,10 +154,10 @@ class UUIDTable(OneToOneTable): def read(self, db): OneToOneTable.read(self, db) - self.uuid_to_id_map = {v:k for k, v in self.book_col_map.iteritems()} + self.uuid_to_id_map = {v:k for k, v in iteritems(self.book_col_map)} def update_uuid_cache(self, book_id_val_map): - for book_id, uuid in book_id_val_map.iteritems(): + for book_id, uuid in iteritems(book_id_val_map): self.uuid_to_id_map.pop(self.book_col_map.get(book_id, None), None) # discard old uuid self.uuid_to_id_map[uuid] = book_id @@ -226,7 +226,7 @@ class ManyToOneTable(Table): bcm[book] = item_id def fix_link_table(self, db): - linked_item_ids = {item_id for item_id in self.book_col_map.itervalues()} + linked_item_ids = {item_id for item_id in itervalues(self.book_col_map)} extra_item_ids = linked_item_ids - set(self.id_map) if extra_item_ids: for item_id in extra_item_ids: @@ -238,10 +238,10 @@ class ManyToOneTable(Table): def fix_case_duplicates(self, db): case_map = defaultdict(set) - for item_id, val in self.id_map.iteritems(): + for item_id, val in iteritems(self.id_map): case_map[icu_lower(val)].add(item_id) - for v in case_map.itervalues(): + for v in itervalues(case_map): if len(v) > 1: main_id = min(v) v.discard(main_id) @@ -322,7 +322,7 @@ class ManyToOneTable(Table): return affected_books def rename_item(self, item_id, new_name, db): - rmap = {icu_lower(v):k for k, v in self.id_map.iteritems()} + rmap = {icu_lower(v):k for k, v in iteritems(self.id_map)} existing_item = rmap.get(icu_lower(new_name), None) table, col, lcol = self.metadata['table'], self.metadata['column'], self.metadata['link_column'] affected_books = self.col_book_map.get(item_id, set()) @@ -353,9 +353,9 @@ class RatingTable(ManyToOneTable): ManyToOneTable.read_id_maps(self, db) # Ensure there are no records with rating=0 in the table. These should # be represented as rating:None instead. - bad_ids = {item_id for item_id, rating in self.id_map.iteritems() if rating == 0} + bad_ids = {item_id for item_id, rating in iteritems(self.id_map) if rating == 0} if bad_ids: - self.id_map = {item_id:rating for item_id, rating in self.id_map.iteritems() if rating != 0} + self.id_map = {item_id:rating for item_id, rating in iteritems(self.id_map) if rating != 0} db.executemany('DELETE FROM {0} WHERE {1}=?'.format(self.link_table, self.metadata['link_column']), tuple((x,) for x in bad_ids)) db.execute('DELETE FROM {0} WHERE {1}=0'.format( @@ -382,10 +382,10 @@ class ManyToManyTable(ManyToOneTable): cbm[item_id].add(book) bcm[book].append(item_id) - self.book_col_map = {k:tuple(v) for k, v in bcm.iteritems()} + self.book_col_map = {k:tuple(v) for k, v in iteritems(bcm)} def fix_link_table(self, db): - linked_item_ids = {item_id for item_ids in self.book_col_map.itervalues() for item_id in item_ids} + linked_item_ids = {item_id for item_ids in itervalues(self.book_col_map) for item_id in item_ids} extra_item_ids = linked_item_ids - set(self.id_map) if extra_item_ids: for item_id in extra_item_ids: @@ -461,7 +461,7 @@ class ManyToManyTable(ManyToOneTable): return affected_books def rename_item(self, item_id, new_name, db): - rmap = {icu_lower(v):k for k, v in self.id_map.iteritems()} + rmap = {icu_lower(v):k for k, v in iteritems(self.id_map)} existing_item = rmap.get(icu_lower(new_name), None) table, col, lcol = self.metadata['table'], self.metadata['column'], self.metadata['link_column'] affected_books = self.col_book_map.get(item_id, set()) @@ -490,10 +490,10 @@ class ManyToManyTable(ManyToOneTable): def fix_case_duplicates(self, db): from calibre.db.write import uniq case_map = defaultdict(set) - for item_id, val in self.id_map.iteritems(): + for item_id, val in iteritems(self.id_map): case_map[icu_lower(val)].add(item_id) - for v in case_map.itervalues(): + for v in itervalues(case_map): if len(v) > 1: done_books = set() main_id = min(v) @@ -541,19 +541,19 @@ class AuthorsTable(ManyToManyTable): lm[aid] = link def set_sort_names(self, aus_map, db): - aus_map = {aid:(a or '').strip() for aid, a in aus_map.iteritems()} - aus_map = {aid:a for aid, a in aus_map.iteritems() if a != self.asort_map.get(aid, None)} + aus_map = {aid:(a or '').strip() for aid, a in iteritems(aus_map)} + aus_map = {aid:a for aid, a in iteritems(aus_map) if a != self.asort_map.get(aid, None)} self.asort_map.update(aus_map) db.executemany('UPDATE authors SET sort=? WHERE id=?', - [(v, k) for k, v in aus_map.iteritems()]) + [(v, k) for k, v in iteritems(aus_map)]) return aus_map def set_links(self, link_map, db): - link_map = {aid:(l or '').strip() for aid, l in link_map.iteritems()} - link_map = {aid:l for aid, l in link_map.iteritems() if l != self.alink_map.get(aid, None)} + link_map = {aid:(l or '').strip() for aid, l in iteritems(link_map)} + link_map = {aid:l for aid, l in iteritems(link_map) if l != self.alink_map.get(aid, None)} self.alink_map.update(link_map) db.executemany('UPDATE authors SET link=? WHERE id=?', - [(v, k) for k, v in link_map.iteritems()]) + [(v, k) for k, v in iteritems(link_map)]) return link_map def remove_books(self, book_ids, db): @@ -602,7 +602,7 @@ class FormatsTable(ManyToManyTable): fnm[book][fmt] = name sm[book][fmt] = sz - self.book_col_map = {k:tuple(sorted(v)) for k, v in bcm.iteritems()} + self.book_col_map = {k:tuple(sorted(v)) for k, v in iteritems(bcm)} def remove_books(self, book_ids, db): clean = ManyToManyTable.remove_books(self, book_ids, db) @@ -617,21 +617,21 @@ class FormatsTable(ManyToManyTable): (fname, book_id, fmt)) def remove_formats(self, formats_map, db): - for book_id, fmts in formats_map.iteritems(): + for book_id, fmts in iteritems(formats_map): self.book_col_map[book_id] = [fmt for fmt in self.book_col_map.get(book_id, []) if fmt not in fmts] for m in (self.fname_map, self.size_map): - m[book_id] = {k:v for k, v in m[book_id].iteritems() if k not in fmts} + m[book_id] = {k:v for k, v in iteritems(m[book_id]) if k not in fmts} for fmt in fmts: try: self.col_book_map[fmt].discard(book_id) except KeyError: pass db.executemany('DELETE FROM data WHERE book=? AND format=?', - [(book_id, fmt) for book_id, fmts in formats_map.iteritems() for fmt in fmts]) + [(book_id, fmt) for book_id, fmts in iteritems(formats_map) for fmt in fmts]) def zero_max(book_id): try: - return max(self.size_map[book_id].itervalues()) + return max(itervalues(self.size_map[book_id])) except ValueError: return 0 @@ -661,7 +661,7 @@ class FormatsTable(ManyToManyTable): self.size_map[book_id][fmt] = size db.execute('INSERT OR REPLACE INTO data (book,format,uncompressed_size,name) VALUES (?,?,?,?)', (book_id, fmt, size, fname)) - return max(self.size_map[book_id].itervalues()) + return max(itervalues(self.size_map[book_id])) class IdentifiersTable(ManyToManyTable): @@ -702,4 +702,4 @@ class IdentifiersTable(ManyToManyTable): raise NotImplementedError('Cannot rename identifiers') def all_identifier_types(self): - return frozenset(k for k, v in self.col_book_map.iteritems() if v) + return frozenset(k for k, v in iteritems(self.col_book_map) if v) diff --git a/src/calibre/db/tests/add_remove.py b/src/calibre/db/tests/add_remove.py index 7dee5d33ec..a39a698f8b 100644 --- a/src/calibre/db/tests/add_remove.py +++ b/src/calibre/db/tests/add_remove.py @@ -15,6 +15,7 @@ from datetime import timedelta from calibre.db.tests.base import BaseTest, IMG from calibre.ptempfile import PersistentTemporaryFile from calibre.utils.date import now, UNDEFINED_DATE +from polyglot.builtins import iteritems, itervalues def import_test(replacement_data, replacement_fmt=None): @@ -217,14 +218,14 @@ class AddRemoveTest(BaseTest): authors = cache.fields['authors'].table # Delete a single book, with no formats and check cleaning - self.assertIn(_('Unknown'), set(authors.id_map.itervalues())) + self.assertIn(_('Unknown'), set(itervalues(authors.id_map))) olen = len(authors.id_map) - item_id = {v:k for k, v in authors.id_map.iteritems()}[_('Unknown')] + item_id = {v:k for k, v in iteritems(authors.id_map)}[_('Unknown')] cache.remove_books((3,)) for c in (cache, self.init_cache()): table = c.fields['authors'].table self.assertNotIn(3, c.all_book_ids()) - self.assertNotIn(_('Unknown'), set(table.id_map.itervalues())) + self.assertNotIn(_('Unknown'), set(itervalues(table.id_map))) self.assertNotIn(item_id, table.asort_map) self.assertNotIn(item_id, table.alink_map) ae(len(table.id_map), olen-1) @@ -235,17 +236,17 @@ class AddRemoveTest(BaseTest): authorpath = os.path.dirname(bookpath) os.mkdir(os.path.join(authorpath, '.DS_Store')) open(os.path.join(authorpath, 'Thumbs.db'), 'wb').close() - item_id = {v:k for k, v in cache.fields['#series'].table.id_map.iteritems()}['My Series Two'] + item_id = {v:k for k, v in iteritems(cache.fields['#series'].table.id_map)}['My Series Two'] cache.remove_books((1,), permanent=True) for x in (fmtpath, bookpath, authorpath): af(os.path.exists(x), 'The file %s exists, when it should not' % x) for c in (cache, self.init_cache()): table = c.fields['authors'].table self.assertNotIn(1, c.all_book_ids()) - self.assertNotIn('Author Two', set(table.id_map.itervalues())) - self.assertNotIn(6, set(c.fields['rating'].table.id_map.itervalues())) - self.assertIn('A Series One', set(c.fields['series'].table.id_map.itervalues())) - self.assertNotIn('My Series Two', set(c.fields['#series'].table.id_map.itervalues())) + self.assertNotIn('Author Two', set(itervalues(table.id_map))) + self.assertNotIn(6, set(itervalues(c.fields['rating'].table.id_map))) + self.assertIn('A Series One', set(itervalues(c.fields['series'].table.id_map))) + self.assertNotIn('My Series Two', set(itervalues(c.fields['#series'].table.id_map))) self.assertNotIn(item_id, c.fields['#series'].table.col_book_map) self.assertNotIn(1, c.fields['#series'].table.book_col_map) @@ -264,7 +265,7 @@ class AddRemoveTest(BaseTest): fmtpath = cache.format_abspath(1, 'FMT1') bookpath = os.path.dirname(fmtpath) authorpath = os.path.dirname(bookpath) - item_id = {v:k for k, v in cache.fields['#series'].table.id_map.iteritems()}['My Series Two'] + item_id = {v:k for k, v in iteritems(cache.fields['#series'].table.id_map)}['My Series Two'] cache.remove_books((1,)) delete_service().wait() for x in (fmtpath, bookpath, authorpath): diff --git a/src/calibre/db/tests/filesystem.py b/src/calibre/db/tests/filesystem.py index c426f024c0..11c9fbe0d7 100644 --- a/src/calibre/db/tests/filesystem.py +++ b/src/calibre/db/tests/filesystem.py @@ -13,6 +13,7 @@ from io import BytesIO from calibre.constants import iswindows from calibre.db.tests.base import BaseTest from calibre.ptempfile import TemporaryDirectory +from polyglot.builtins import iterkeys class FilesystemTest(BaseTest): @@ -55,7 +56,7 @@ class FilesystemTest(BaseTest): cache2 = self.init_cache(cl) for c in (cache, cache2): data = self.get_filesystem_data(c, 1) - ae(set(orig_data.iterkeys()), set(data.iterkeys())) + ae(set(iterkeys(orig_data)), set(iterkeys(data))) ae(orig_data, data, 'Filesystem data does not match') ae(c.field_for('path', 1), 'Moved/Moved (1)') ae(c.field_for('path', 3), 'Moved1/Moved1 (3)') diff --git a/src/calibre/db/tests/legacy.py b/src/calibre/db/tests/legacy.py index 919f817b00..9310392882 100644 --- a/src/calibre/db/tests/legacy.py +++ b/src/calibre/db/tests/legacy.py @@ -14,7 +14,7 @@ from operator import itemgetter from calibre.library.field_metadata import fm_as_dict from calibre.db.tests.base import BaseTest -from polyglot.builtins import range +from polyglot.builtins import iteritems, iterkeys, range # Utils {{{ @@ -81,7 +81,7 @@ class LegacyTest(BaseTest): # We ignore the key rec_index, since it is not stable for # custom columns (it is created by iterating over a dict) return {k.decode('utf-8') if isinstance(k, bytes) else k:to_unicode(v) - for k, v in x.iteritems() if k != 'rec_index'} + for k, v in iteritems(x) if k != 'rec_index'} return x def get_props(db): @@ -108,7 +108,7 @@ class LegacyTest(BaseTest): 'Test the get_property interface for reading data' def get_values(db): ans = {} - for label, loc in db.FIELD_MAP.iteritems(): + for label, loc in iteritems(db.FIELD_MAP): if isinstance(label, numbers.Integral): label = '#'+db.custom_column_num_map[label]['label'] label = type('')(label) @@ -186,7 +186,7 @@ class LegacyTest(BaseTest): self.assertEqual(dict(db.prefs), dict(ndb.prefs)) - for meth, args in { + for meth, args in iteritems({ 'find_identical_books': [(Metadata('title one', ['author one']),), (Metadata('unknown'),), (Metadata('xxxx'),)], 'get_books_for_category': [('tags', newstag), ('#formats', 'FMT1')], 'get_next_series_num_for': [('A Series One',)], @@ -251,7 +251,7 @@ class LegacyTest(BaseTest): 'book_on_device_string':[(1,), (2,), (3,)], 'books_in_series_of':[(0,), (1,), (2,)], 'books_with_same_title':[(Metadata(db.title(0)),), (Metadata(db.title(1)),), (Metadata('1234'),)], - }.iteritems(): + }): fmt = lambda x: x if meth[0] in {'!', '@'}: fmt = {'!':dict, '@':frozenset}[meth[0]] @@ -277,8 +277,8 @@ class LegacyTest(BaseTest): old = db.get_data_as_dict(prefix='test-prefix') new = ndb.get_data_as_dict(prefix='test-prefix') for o, n in zip(old, new): - o = {type('')(k) if isinstance(k, bytes) else k:set(v) if isinstance(v, list) else v for k, v in o.iteritems()} - n = {k:set(v) if isinstance(v, list) else v for k, v in n.iteritems()} + o = {type('')(k) if isinstance(k, bytes) else k:set(v) if isinstance(v, list) else v for k, v in iteritems(o)} + n = {k:set(v) if isinstance(v, list) else v for k, v in iteritems(n)} self.assertEqual(o, n) ndb.search('title:Unknown') @@ -316,9 +316,9 @@ class LegacyTest(BaseTest): db = self.init_old() cache = ndb.new_api tmap = cache.get_id_map('tags') - t = next(tmap.iterkeys()) + t = next(iterkeys(tmap)) pmap = cache.get_id_map('publisher') - p = next(pmap.iterkeys()) + p = next(iterkeys(pmap)) run_funcs(self, db, ndb, ( ('delete_tag_using_id', t), ('delete_publisher_using_id', p), @@ -647,10 +647,10 @@ class LegacyTest(BaseTest): ndb = self.init_legacy(self.cloned_library) db = self.init_old(self.cloned_library) - a = {v:k for k, v in ndb.new_api.get_id_map('authors').iteritems()}['Author One'] - t = {v:k for k, v in ndb.new_api.get_id_map('tags').iteritems()}['Tag One'] - s = {v:k for k, v in ndb.new_api.get_id_map('series').iteritems()}['A Series One'] - p = {v:k for k, v in ndb.new_api.get_id_map('publisher').iteritems()}['Publisher One'] + a = {v:k for k, v in iteritems(ndb.new_api.get_id_map('authors'))}['Author One'] + t = {v:k for k, v in iteritems(ndb.new_api.get_id_map('tags'))}['Tag One'] + s = {v:k for k, v in iteritems(ndb.new_api.get_id_map('series'))}['A Series One'] + p = {v:k for k, v in iteritems(ndb.new_api.get_id_map('publisher'))}['Publisher One'] run_funcs(self, db, ndb, ( ('rename_author', a, 'Author Two'), ('rename_tag', t, 'News'), @@ -688,11 +688,11 @@ class LegacyTest(BaseTest): run_funcs(self, db, ndb, [(func, idx, label) for idx in range(3)]) # Test renaming/deleting - t = {v:k for k, v in ndb.new_api.get_id_map('#tags').iteritems()}['My Tag One'] - t2 = {v:k for k, v in ndb.new_api.get_id_map('#tags').iteritems()}['My Tag Two'] - a = {v:k for k, v in ndb.new_api.get_id_map('#authors').iteritems()}['My Author Two'] - a2 = {v:k for k, v in ndb.new_api.get_id_map('#authors').iteritems()}['Custom One'] - s = {v:k for k, v in ndb.new_api.get_id_map('#series').iteritems()}['My Series One'] + t = {v:k for k, v in iteritems(ndb.new_api.get_id_map('#tags'))}['My Tag One'] + t2 = {v:k for k, v in iteritems(ndb.new_api.get_id_map('#tags'))}['My Tag Two'] + a = {v:k for k, v in iteritems(ndb.new_api.get_id_map('#authors'))}['My Author Two'] + a2 = {v:k for k, v in iteritems(ndb.new_api.get_id_map('#authors'))}['Custom One'] + s = {v:k for k, v in iteritems(ndb.new_api.get_id_map('#series'))}['My Series One'] run_funcs(self, db, ndb, ( ('delete_custom_item_using_id', t, 'tags'), ('delete_custom_item_using_id', a, 'authors'), diff --git a/src/calibre/db/tests/reading.py b/src/calibre/db/tests/reading.py index 4c95644e1a..3b90b4d93d 100644 --- a/src/calibre/db/tests/reading.py +++ b/src/calibre/db/tests/reading.py @@ -13,7 +13,7 @@ from time import time from calibre.utils.date import utc_tz from calibre.db.tests.base import BaseTest -from polyglot.builtins import range +from polyglot.builtins import iteritems, iterkeys, itervalues, range class ReadingTest(BaseTest): @@ -116,8 +116,8 @@ class ReadingTest(BaseTest): }, } - for book_id, test in tests.iteritems(): - for field, expected_val in test.iteritems(): + for book_id, test in iteritems(tests): + for field, expected_val in iteritems(test): val = cache.field_for(field, book_id) if isinstance(val, tuple) and 'authors' not in field and 'languages' not in field: val, expected_val = set(val), set(expected_val) @@ -130,7 +130,7 @@ class ReadingTest(BaseTest): 'Test sorting' cache = self.init_cache() ae = self.assertEqual - for field, order in { + for field, order in iteritems({ 'title' : [2, 1, 3], 'authors': [2, 1, 3], 'series' : [3, 1, 2], @@ -154,7 +154,7 @@ class ReadingTest(BaseTest): '#yesno':[2, 1, 3], '#comments':[3, 2, 1], 'id': [1, 2, 3], - }.iteritems(): + }): x = list(reversed(order)) ae(order, cache.multisort([(field, True)], ids_to_sort=x), @@ -222,7 +222,7 @@ class ReadingTest(BaseTest): old_metadata = {i:old.get_metadata( i, index_is_id=True, get_cover=True, cover_as_data=True) for i in range(1, 4)} - for mi in old_metadata.itervalues(): + for mi in itervalues(old_metadata): mi.format_metadata = dict(mi.format_metadata) if mi.formats: mi.formats = tuple(mi.formats) @@ -234,7 +234,7 @@ class ReadingTest(BaseTest): new_metadata = {i:cache.get_metadata( i, get_cover=True, cover_as_data=True) for i in range(1, 4)} cache = None - for mi2, mi1 in zip(new_metadata.values(), old_metadata.values()): + for mi2, mi1 in zip(list(new_metadata.values()), list(old_metadata.values())): self.compare_metadata(mi1, mi2) # }}} @@ -262,7 +262,7 @@ class ReadingTest(BaseTest): old.conn.close() old = None cache = self.init_cache(self.library_path) - for book_id, cdata in covers.iteritems(): + for book_id, cdata in iteritems(covers): self.assertEqual(cdata, cache.cover(book_id), 'Reading of cover failed') f = cache.cover(book_id, as_file=True) self.assertEqual(cdata, f.read() if f else f, 'Reading of cover as file failed') @@ -325,7 +325,7 @@ class ReadingTest(BaseTest): old = None cache = self.init_cache(self.cloned_library) - for query, ans in oldvals.iteritems(): + for query, ans in iteritems(oldvals): nr = cache.search(query, '') self.assertEqual(ans, nr, 'Old result: %r != New result: %r for search: %s'%( @@ -407,11 +407,11 @@ class ReadingTest(BaseTest): lf = {i:set(old.formats(i, index_is_id=True).split(',')) if old.formats( i, index_is_id=True) else set() for i in ids} formats = {i:{f:old.format(i, f, index_is_id=True) for f in fmts} for - i, fmts in lf.iteritems()} + i, fmts in iteritems(lf)} old.conn.close() old = None cache = self.init_cache(self.library_path) - for book_id, fmts in lf.iteritems(): + for book_id, fmts in iteritems(lf): self.assertEqual(fmts, set(cache.formats(book_id)), 'Set of formats is not the same') for fmt in fmts: @@ -439,9 +439,9 @@ class ReadingTest(BaseTest): 'Test getting the author sort for authors from the db' cache = self.init_cache() table = cache.fields['authors'].table - table.set_sort_names({next(table.id_map.iterkeys()): 'Fake Sort'}, cache.backend) + table.set_sort_names({next(iterkeys(table.id_map)): 'Fake Sort'}, cache.backend) - authors = tuple(table.id_map.itervalues()) + authors = tuple(itervalues(table.id_map)) nval = cache.author_sort_from_authors(authors) self.assertIn('Fake Sort', nval) @@ -458,7 +458,7 @@ class ReadingTest(BaseTest): cache.set_field('series', {3:'test series'}) cache.set_field('series_index', {3:13}) table = cache.fields['series'].table - series = tuple(table.id_map.itervalues()) + series = tuple(itervalues(table.id_map)) nvals = {s:cache.get_next_series_num_for(s) for s in series} db = self.init_old() self.assertEqual({s:db.get_next_series_num_for(s) for s in series}, nvals) @@ -471,7 +471,7 @@ class ReadingTest(BaseTest): from calibre.ebooks.metadata.book.base import Metadata cache = self.init_cache() db = self.init_old() - for title in cache.fields['title'].table.book_col_map.itervalues(): + for title in itervalues(cache.fields['title'].table.book_col_map): for x in (db, cache): self.assertTrue(x.has_book(Metadata(title))) self.assertTrue(x.has_book(Metadata(title.upper()))) diff --git a/src/calibre/db/tests/writing.py b/src/calibre/db/tests/writing.py index 5806b060bd..e41b30c743 100644 --- a/src/calibre/db/tests/writing.py +++ b/src/calibre/db/tests/writing.py @@ -14,6 +14,7 @@ from io import BytesIO from calibre.ebooks.metadata import author_to_author_sort from calibre.utils.date import UNDEFINED_DATE from calibre.db.tests.base import BaseTest, IMG +from polyglot.builtins import iteritems, itervalues class WritingTest(BaseTest): @@ -166,7 +167,7 @@ class WritingTest(BaseTest): self.assertEqual(cache.set_field('#enum', {1:None}), {1}) cache2 = self.init_cache(cl) for c in (cache, cache2): - for i, val in {1:None, 2:'One', 3:'Three'}.iteritems(): + for i, val in iteritems({1:None, 2:'One', 3:'Three'}): self.assertEqual(c.field_for('#enum', i), val) del cache2 @@ -176,9 +177,9 @@ class WritingTest(BaseTest): self.assertEqual(cache.set_field('#rating', {1:None, 2:4, 3:8}), {1, 2, 3}) cache2 = self.init_cache(cl) for c in (cache, cache2): - for i, val in {1:None, 2:4, 3:2}.iteritems(): + for i, val in iteritems({1:None, 2:4, 3:2}): self.assertEqual(c.field_for('rating', i), val) - for i, val in {1:None, 2:4, 3:8}.iteritems(): + for i, val in iteritems({1:None, 2:4, 3:8}): self.assertEqual(c.field_for('#rating', i), val) del cache2 @@ -191,14 +192,14 @@ class WritingTest(BaseTest): self.assertEqual(cache.set_field('#series', {2:'Series [0]'}), {2}) cache2 = self.init_cache(cl) for c in (cache, cache2): - for i, val in {1:'A Series One', 2:'A Series One', 3:'Series'}.iteritems(): + for i, val in iteritems({1:'A Series One', 2:'A Series One', 3:'Series'}): self.assertEqual(c.field_for('series', i), val) cs_indices = {1:c.field_for('#series_index', 1), 3:c.field_for('#series_index', 3)} for i in (1, 2, 3): self.assertEqual(c.field_for('#series', i), 'Series') - for i, val in {1:2, 2:1, 3:3}.iteritems(): + for i, val in iteritems({1:2, 2:1, 3:3}): self.assertEqual(c.field_for('series_index', i), val) - for i, val in {1:cs_indices[1], 2:0, 3:cs_indices[3]}.iteritems(): + for i, val in iteritems({1:cs_indices[1], 2:0, 3:cs_indices[3]}): self.assertEqual(c.field_for('#series_index', i), val) del cache2 @@ -461,13 +462,13 @@ class WritingTest(BaseTest): tmap = cache.get_id_map('tags') self.assertEqual(cache.remove_items('tags', tmap), {1, 2}) tmap = cache.get_id_map('#tags') - t = {v:k for k, v in tmap.iteritems()}['My Tag Two'] + t = {v:k for k, v in iteritems(tmap)}['My Tag Two'] self.assertEqual(cache.remove_items('#tags', (t,)), {1, 2}) smap = cache.get_id_map('series') self.assertEqual(cache.remove_items('series', smap), {1, 2}) smap = cache.get_id_map('#series') - s = {v:k for k, v in smap.iteritems()}['My Series Two'] + s = {v:k for k, v in iteritems(smap)}['My Series Two'] self.assertEqual(cache.remove_items('#series', (s,)), {1}) for c in (cache, self.init_cache()): @@ -507,7 +508,7 @@ class WritingTest(BaseTest): for c in (cache, c2): self.assertEqual(c.field_for('tags', 1), ()) self.assertEqual(c.field_for('tags', 2), ('b', 'a')) - self.assertNotIn('c', set(c.get_id_map('tags').itervalues())) + self.assertNotIn('c', set(itervalues(c.get_id_map('tags')))) self.assertEqual(c.field_for('series', 1), None) self.assertEqual(c.field_for('series', 2), 'a') self.assertEqual(c.field_for('series_index', 1), 1.0) @@ -520,9 +521,9 @@ class WritingTest(BaseTest): cl = self.cloned_library cache = self.init_cache(cl) # Check that renaming authors updates author sort and path - a = {v:k for k, v in cache.get_id_map('authors').iteritems()}['Unknown'] + a = {v:k for k, v in iteritems(cache.get_id_map('authors'))}['Unknown'] self.assertEqual(cache.rename_items('authors', {a:'New Author'})[0], {3}) - a = {v:k for k, v in cache.get_id_map('authors').iteritems()}['Author One'] + a = {v:k for k, v in iteritems(cache.get_id_map('authors'))}['Author One'] self.assertEqual(cache.rename_items('authors', {a:'Author Two'})[0], {1, 2}) for c in (cache, self.init_cache(cl)): self.assertEqual(c.all_field_names('authors'), {'New Author', 'Author Two'}) @@ -531,7 +532,7 @@ class WritingTest(BaseTest): self.assertEqual(c.field_for('authors', 1), ('Author Two',)) self.assertEqual(c.field_for('author_sort', 1), 'Two, Author') - t = {v:k for k, v in cache.get_id_map('tags').iteritems()}['Tag One'] + t = {v:k for k, v in iteritems(cache.get_id_map('tags'))}['Tag One'] # Test case change self.assertEqual(cache.rename_items('tags', {t:'tag one'}), ({1, 2}, {t:t})) for c in (cache, self.init_cache(cl)): @@ -551,14 +552,14 @@ class WritingTest(BaseTest): self.assertEqual(set(c.field_for('tags', 1)), {'Tag Two', 'News'}) self.assertEqual(set(c.field_for('tags', 2)), {'Tag Two'}) # Test on a custom column - t = {v:k for k, v in cache.get_id_map('#tags').iteritems()}['My Tag One'] + t = {v:k for k, v in iteritems(cache.get_id_map('#tags'))}['My Tag One'] self.assertEqual(cache.rename_items('#tags', {t:'My Tag Two'})[0], {2}) for c in (cache, self.init_cache(cl)): self.assertEqual(c.all_field_names('#tags'), {'My Tag Two'}) self.assertEqual(set(c.field_for('#tags', 2)), {'My Tag Two'}) # Test a Many-one field - s = {v:k for k, v in cache.get_id_map('series').iteritems()}['A Series One'] + s = {v:k for k, v in iteritems(cache.get_id_map('series'))}['A Series One'] # Test case change self.assertEqual(cache.rename_items('series', {s:'a series one'}), ({1, 2}, {s:s})) for c in (cache, self.init_cache(cl)): @@ -574,7 +575,7 @@ class WritingTest(BaseTest): self.assertEqual(c.field_for('series', 2), 'series') self.assertEqual(c.field_for('series_index', 1), 2.0) - s = {v:k for k, v in cache.get_id_map('#series').iteritems()}['My Series One'] + s = {v:k for k, v in iteritems(cache.get_id_map('#series'))}['My Series One'] # Test custom column with rename to existing self.assertEqual(cache.rename_items('#series', {s:'My Series Two'})[0], {2}) for c in (cache, self.init_cache(cl)): @@ -585,7 +586,7 @@ class WritingTest(BaseTest): # Test renaming many-many items to multiple items cache = self.init_cache(self.cloned_library) - t = {v:k for k, v in cache.get_id_map('tags').iteritems()}['Tag One'] + t = {v:k for k, v in iteritems(cache.get_id_map('tags'))}['Tag One'] affected_books, id_map = cache.rename_items('tags', {t:'Something, Else, Entirely'}) self.assertEqual({1, 2}, affected_books) tmap = cache.get_id_map('tags') @@ -600,7 +601,7 @@ class WritingTest(BaseTest): # Test with restriction cache = self.init_cache() cache.set_field('tags', {1:'a,b,c', 2:'x,y,z', 3:'a,x,z'}) - tmap = {v:k for k, v in cache.get_id_map('tags').iteritems()} + tmap = {v:k for k, v in iteritems(cache.get_id_map('tags'))} self.assertEqual(cache.rename_items('tags', {tmap['a']:'r'}, restrict_to_book_ids=()), (set(), {})) self.assertEqual(cache.rename_items('tags', {tmap['a']:'r', tmap['b']:'q'}, restrict_to_book_ids=(1,))[0], {1}) self.assertEqual(cache.rename_items('tags', {tmap['x']:'X'}, restrict_to_book_ids=(2,))[0], {2}) @@ -657,7 +658,7 @@ class WritingTest(BaseTest): ldata = {aid:str(aid) for aid in adata} self.assertEqual({1,2,3}, cache.set_link_for_authors(ldata)) for c in (cache, self.init_cache()): - self.assertEqual(ldata, {aid:d['link'] for aid, d in c.author_data().iteritems()}) + self.assertEqual(ldata, {aid:d['link'] for aid, d in iteritems(c.author_data())}) self.assertEqual({3}, cache.set_link_for_authors({aid:'xxx' if aid == max(adata) else str(aid) for aid in adata}), 'Setting the author link to the same value as before, incorrectly marked some books as dirty') sdata = {aid:'%s, changed' % aid for aid in adata} @@ -709,7 +710,7 @@ class WritingTest(BaseTest): conn.execute('INSERT INTO tags (name) VALUES ("t")') norm = conn.last_insert_rowid() conn.execute('DELETE FROM books_tags_link') - for book_id, vals in {1:(lid, uid), 2:(uid, mid), 3:(lid, norm)}.iteritems(): + for book_id, vals in iteritems({1:(lid, uid), 2:(uid, mid), 3:(lid, norm)}): conn.executemany('INSERT INTO books_tags_link (book,tag) VALUES (?,?)', tuple((book_id, x) for x in vals)) cache.reload_from_db() diff --git a/src/calibre/db/utils.py b/src/calibre/db/utils.py index 5d02367248..d9d2b48893 100644 --- a/src/calibre/db/utils.py +++ b/src/calibre/db/utils.py @@ -9,7 +9,7 @@ __copyright__ = '2013, Kovid Goyal ' import os, errno, sys, re from locale import localeconv from collections import OrderedDict, namedtuple -from polyglot.builtins import map, unicode_type, string_or_bytes +from polyglot.builtins import iteritems, itervalues, map, unicode_type, string_or_bytes from threading import Lock from calibre import as_unicode, prints @@ -208,7 +208,7 @@ class ThumbnailCache(object): def _invalidate_sizes(self): if self.size_changed: size = self.thumbnail_size - remove = (key for key, entry in self.items.iteritems() if size != entry.thumbnail_size) + remove = (key for key, entry in iteritems(self.items) if size != entry.thumbnail_size) for key in remove: self._remove(key) self.size_changed = False @@ -365,7 +365,7 @@ class ThumbnailCache(object): pass if not hasattr(self, 'total_size'): self._load_index() - for entry in self.items.itervalues(): + for entry in itervalues(self.items): self._do_delete(entry.path) self.total_size = 0 self.items = OrderedDict() diff --git a/src/calibre/db/view.py b/src/calibre/db/view.py index fc773ac680..7fd51e783d 100644 --- a/src/calibre/db/view.py +++ b/src/calibre/db/view.py @@ -9,7 +9,8 @@ __docformat__ = 'restructuredtext en' import weakref, operator, numbers from functools import partial -from polyglot.builtins import map, unicode_type, range, zip +from polyglot.builtins import (iteritems, iterkeys, itervalues, map, + unicode_type, range, zip) from calibre.ebooks.metadata import title_sort from calibre.utils.config_base import tweaks, prefs @@ -71,7 +72,7 @@ def format_is_multiple(x, sep=',', repl=None): def format_identifiers(x): if not x: return None - return ','.join('%s:%s'%(k, v) for k, v in x.iteritems()) + return ','.join('%s:%s'%(k, v) for k, v in iteritems(x)) class View(object): @@ -88,7 +89,7 @@ class View(object): self.search_restriction_name = self.base_restriction_name = '' self._field_getters = {} self.column_count = len(cache.backend.FIELD_MAP) - for col, idx in cache.backend.FIELD_MAP.iteritems(): + for col, idx in iteritems(cache.backend.FIELD_MAP): label, fmt = col, lambda x:x func = { 'id': self._get_id, @@ -373,14 +374,14 @@ class View(object): self.marked_ids = dict.fromkeys(id_dict, u'true') else: # Ensure that all the items in the dict are text - self.marked_ids = dict(zip(id_dict.iterkeys(), map(unicode_type, - id_dict.itervalues()))) + self.marked_ids = dict(zip(iterkeys(id_dict), map(unicode_type, + itervalues(id_dict)))) # This invalidates all searches in the cache even though the cache may # be shared by multiple views. This is not ideal, but... cmids = set(self.marked_ids) self.cache.clear_search_caches(old_marked_ids | cmids) if old_marked_ids != cmids: - for funcref in self.marked_listeners.itervalues(): + for funcref in itervalues(self.marked_listeners): func = funcref() if func is not None: func(old_marked_ids, cmids) diff --git a/src/calibre/db/write.py b/src/calibre/db/write.py index 5670fff3f5..abc89e3353 100644 --- a/src/calibre/db/write.py +++ b/src/calibre/db/write.py @@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en' import re from functools import partial from datetime import datetime -from polyglot.builtins import unicode_type, zip +from polyglot.builtins import iteritems, itervalues, unicode_type, zip from calibre.constants import preferred_encoding from calibre.ebooks.metadata import author_to_author_sort, title_sort @@ -131,7 +131,7 @@ def adapt_identifiers(to_tuple, x): if not isinstance(x, dict): x = {k:v for k, v in (y.partition(':')[0::2] for y in to_tuple(x))} ans = {} - for k, v in x.iteritems(): + for k, v in iteritems(x): k, v = clean_identifier(k, v) if k and v: ans[k] = v @@ -194,7 +194,7 @@ def get_adapter(name, metadata): def one_one_in_books(book_id_val_map, db, field, *args): 'Set a one-one field in the books table' if book_id_val_map: - sequence = ((sqlite_datetime(v), k) for k, v in book_id_val_map.iteritems()) + sequence = ((sqlite_datetime(v), k) for k, v in iteritems(book_id_val_map)) db.executemany( 'UPDATE books SET %s=? WHERE id=?'%field.metadata['column'], sequence) field.table.book_col_map.update(book_id_val_map) @@ -210,23 +210,23 @@ def set_title(book_id_val_map, db, field, *args): ans = one_one_in_books(book_id_val_map, db, field, *args) # Set the title sort field field.title_sort_field.writer.set_books( - {k:title_sort(v) for k, v in book_id_val_map.iteritems()}, db) + {k:title_sort(v) for k, v in iteritems(book_id_val_map)}, db) return ans def one_one_in_other(book_id_val_map, db, field, *args): 'Set a one-one field in the non-books table, like comments' - deleted = tuple((k,) for k, v in book_id_val_map.iteritems() if v is None) + deleted = tuple((k,) for k, v in iteritems(book_id_val_map) if v is None) if deleted: db.executemany('DELETE FROM %s WHERE book=?'%field.metadata['table'], deleted) for book_id in deleted: field.table.book_col_map.pop(book_id[0], None) - updated = {k:v for k, v in book_id_val_map.iteritems() if v is not None} + updated = {k:v for k, v in iteritems(book_id_val_map) if v is not None} if updated: db.executemany('INSERT OR REPLACE INTO %s(book,%s) VALUES (?,?)'%( field.metadata['table'], field.metadata['column']), - ((k, sqlite_datetime(v)) for k, v in updated.iteritems())) + ((k, sqlite_datetime(v)) for k, v in iteritems(updated))) field.table.book_col_map.update(updated) return set(book_id_val_map) @@ -234,7 +234,7 @@ def one_one_in_other(book_id_val_map, db, field, *args): def custom_series_index(book_id_val_map, db, field, *args): series_field = field.series_field sequence = [] - for book_id, sidx in book_id_val_map.iteritems(): + for book_id, sidx in iteritems(book_id_val_map): if sidx is None: sidx = 1.0 ids = series_field.ids_for_book(book_id) @@ -285,12 +285,12 @@ def get_db_id(val, db, m, table, kmap, rid_map, allow_case_change, def change_case(case_changes, dirtied, db, table, m, is_authors=False): if is_authors: vals = ((val.replace(',', '|'), item_id) for item_id, val in - case_changes.iteritems()) + iteritems(case_changes)) else: - vals = ((val, item_id) for item_id, val in case_changes.iteritems()) + vals = ((val, item_id) for item_id, val in iteritems(case_changes)) db.executemany( 'UPDATE %s SET %s=? WHERE id=?'%(m['table'], m['column']), vals) - for item_id, val in case_changes.iteritems(): + for item_id, val in iteritems(case_changes): table.id_map[item_id] = val dirtied.update(table.col_book_map[item_id]) if is_authors: @@ -306,14 +306,14 @@ def many_one(book_id_val_map, db, field, allow_case_change, *args): # Map values to db ids, including any new values kmap = safe_lower if dt in {'text', 'series'} else lambda x:x - rid_map = {kmap(item):item_id for item_id, item in table.id_map.iteritems()} + rid_map = {kmap(item):item_id for item_id, item in iteritems(table.id_map)} if len(rid_map) != len(table.id_map): # table has some entries that differ only in case, fix it table.fix_case_duplicates(db) - rid_map = {kmap(item):item_id for item_id, item in table.id_map.iteritems()} + rid_map = {kmap(item):item_id for item_id, item in iteritems(table.id_map)} val_map = {None:None} case_changes = {} - for val in book_id_val_map.itervalues(): + for val in itervalues(book_id_val_map): if val is not None: get_db_id(val, db, m, table, kmap, rid_map, allow_case_change, case_changes, val_map) @@ -321,17 +321,17 @@ def many_one(book_id_val_map, db, field, allow_case_change, *args): if case_changes: change_case(case_changes, dirtied, db, table, m) - book_id_item_id_map = {k:val_map[v] for k, v in book_id_val_map.iteritems()} + book_id_item_id_map = {k:val_map[v] for k, v in iteritems(book_id_val_map)} # Ignore those items whose value is the same as the current value - book_id_item_id_map = {k:v for k, v in book_id_item_id_map.iteritems() + book_id_item_id_map = {k:v for k, v in iteritems(book_id_item_id_map) if v != table.book_col_map.get(k, None)} dirtied |= set(book_id_item_id_map) # Update the book->col and col->book maps deleted = set() updated = {} - for book_id, item_id in book_id_item_id_map.iteritems(): + for book_id, item_id in iteritems(book_id_item_id_map): old_item_id = table.book_col_map.get(book_id, None) if old_item_id is not None: table.col_book_map[old_item_id].discard(book_id) @@ -355,7 +355,7 @@ def many_one(book_id_val_map, db, field, allow_case_change, *args): ) db.executemany(sql.format(table.link_table, m['link_column']), ((book_id, book_id, item_id) for book_id, item_id in - updated.iteritems())) + iteritems(updated))) # Remove no longer used items remove = {item_id for item_id in table.id_map if not @@ -392,15 +392,15 @@ def many_many(book_id_val_map, db, field, allow_case_change, *args): # Map values to db ids, including any new values kmap = safe_lower if dt == 'text' else lambda x:x - rid_map = {kmap(item):item_id for item_id, item in table.id_map.iteritems()} + rid_map = {kmap(item):item_id for item_id, item in iteritems(table.id_map)} if len(rid_map) != len(table.id_map): # table has some entries that differ only in case, fix it table.fix_case_duplicates(db) - rid_map = {kmap(item):item_id for item_id, item in table.id_map.iteritems()} + rid_map = {kmap(item):item_id for item_id, item in iteritems(table.id_map)} val_map = {} case_changes = {} - book_id_val_map = {k:uniq(vals, kmap) for k, vals in book_id_val_map.iteritems()} - for vals in book_id_val_map.itervalues(): + book_id_val_map = {k:uniq(vals, kmap) for k, vals in iteritems(book_id_val_map)} + for vals in itervalues(book_id_val_map): for val in vals: get_db_id(val, db, m, table, kmap, rid_map, allow_case_change, case_changes, val_map, is_authors=is_authors) @@ -408,7 +408,7 @@ def many_many(book_id_val_map, db, field, allow_case_change, *args): if case_changes: change_case(case_changes, dirtied, db, table, m, is_authors=is_authors) if is_authors: - for item_id, val in case_changes.iteritems(): + for item_id, val in iteritems(case_changes): for book_id in table.col_book_map[item_id]: current_sort = field.db_author_sort_for_book(book_id) new_sort = field.author_sort_for_book(book_id) @@ -418,17 +418,17 @@ def many_many(book_id_val_map, db, field, allow_case_change, *args): field.author_sort_field.writer.set_books({book_id:new_sort}, db) book_id_item_id_map = {k:tuple(val_map[v] for v in vals) - for k, vals in book_id_val_map.iteritems()} + for k, vals in iteritems(book_id_val_map)} # Ignore those items whose value is the same as the current value - book_id_item_id_map = {k:v for k, v in book_id_item_id_map.iteritems() + book_id_item_id_map = {k:v for k, v in iteritems(book_id_item_id_map) if v != table.book_col_map.get(k, None)} dirtied |= set(book_id_item_id_map) # Update the book->col and col->book maps deleted = set() updated = {} - for book_id, item_ids in book_id_item_id_map.iteritems(): + for book_id, item_ids in iteritems(book_id_item_id_map): old_item_ids = table.book_col_map.get(book_id, None) if old_item_ids: for old_item_id in old_item_ids: @@ -448,7 +448,7 @@ def many_many(book_id_val_map, db, field, allow_case_change, *args): ((k,) for k in deleted)) if updated: vals = ( - (book_id, val) for book_id, vals in updated.iteritems() + (book_id, val) for book_id, vals in iteritems(updated) for val in vals ) db.executemany('DELETE FROM %s WHERE book=?'%table.link_table, @@ -481,7 +481,7 @@ def many_many(book_id_val_map, db, field, allow_case_change, *args): def identifiers(book_id_val_map, db, field, *args): # {{{ table = field.table updates = set() - for book_id, identifiers in book_id_val_map.iteritems(): + for book_id, identifiers in iteritems(book_id_val_map): if book_id not in table.book_col_map: table.book_col_map[book_id] = {} current_ids = table.book_col_map[book_id] @@ -490,7 +490,7 @@ def identifiers(book_id_val_map, db, field, *args): # {{{ table.col_book_map.get(key, set()).discard(book_id) current_ids.pop(key, None) current_ids.update(identifiers) - for key, val in identifiers.iteritems(): + for key, val in iteritems(identifiers): if key not in table.col_book_map: table.col_book_map[key] = set() table.col_book_map[key].add(book_id) @@ -538,7 +538,7 @@ class Writer(object): def set_books(self, book_id_val_map, db, allow_case_change=True): book_id_val_map = {k:self.adapter(v) for k, v in - book_id_val_map.iteritems() if self.accept_vals(v)} + iteritems(book_id_val_map) if self.accept_vals(v)} if not book_id_val_map: return set() dirtied = self.set_books_func(book_id_val_map, db, self.field, @@ -548,7 +548,7 @@ class Writer(object): def set_books_for_enum(self, book_id_val_map, db, field, allow_case_change): allowed = set(field.metadata['display']['enum_values']) - book_id_val_map = {k:v for k, v in book_id_val_map.iteritems() if v is + book_id_val_map = {k:v for k, v in iteritems(book_id_val_map) if v is None or v in allowed} if not book_id_val_map: return set() diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 2a33f9107f..da71d41885 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -32,7 +32,7 @@ from calibre import prints, fsync from calibre.ptempfile import PersistentTemporaryFile from calibre.constants import DEBUG from calibre.utils.config_base import prefs -from polyglot.builtins import unicode_type, string_or_bytes +from polyglot.builtins import iteritems, itervalues, unicode_type, string_or_bytes EPUB_EXT = '.epub' KEPUB_EXT = '.kepub' @@ -407,7 +407,7 @@ class KOBO(USBMS): # Remove books that are no longer in the filesystem. Cache contains # indices into the booklist if book not in filesystem, None otherwise # Do the operation in reverse order so indices remain valid - for idx in sorted(bl_cache.itervalues(), reverse=True): + for idx in sorted(itervalues(bl_cache), reverse=True): if idx is not None: need_sync = True del bl[idx] @@ -908,13 +908,13 @@ class KOBO(USBMS): ContentID = self.contentid_from_path(book.path, ContentType) - if category in readstatuslist.keys(): + if category in list(readstatuslist.keys()): # Manage ReadStatus self.set_readstatus(connection, ContentID, readstatuslist.get(category)) elif category == 'Shortlist' and self.dbversion >= 14: # Manage FavouritesIndex/Shortlist self.set_favouritesindex(connection, ContentID) - elif category in accessibilitylist.keys(): + elif category in list(accessibilitylist.keys()): # Do not manage the Accessibility List pass else: # No collections @@ -1964,7 +1964,7 @@ class KOBOTOUCH(KOBO): # Remove books that are no longer in the filesystem. Cache contains # indices into the booklist if book not in filesystem, None otherwise # Do the operation in reverse order so indices remain valid - for idx in sorted(bl_cache.itervalues(), reverse=True): + for idx in sorted(itervalues(bl_cache), reverse=True): if idx is not None: if not os.path.exists(self.normalize_path(os.path.join(prefix, bl[idx].lpath))) or not bl[idx].contentID: need_sync = True @@ -2138,7 +2138,7 @@ class KOBOTOUCH(KOBO): from calibre.ebooks.oeb.base import OEB_STYLES is_dirty = False - for cssname, mt in container.mime_map.iteritems(): + for cssname, mt in iteritems(container.mime_map): if mt in OEB_STYLES: newsheet = container.parsed(cssname) oldrules = len(newsheet.cssRules) @@ -2447,7 +2447,7 @@ class KOBOTOUCH(KOBO): debug_print(' Setting bookshelf on device') self.set_bookshelf(connection, book, category) category_added = True - elif category in readstatuslist.keys(): + elif category in list(readstatuslist.keys()): debug_print("KoboTouch:update_device_database_collections - about to set_readstatus - category='%s'"%(category, )) # Manage ReadStatus self.set_readstatus(connection, book.contentID, readstatuslist.get(category)) @@ -2462,7 +2462,7 @@ class KOBOTOUCH(KOBO): debug_print(' and about to set it - %s'%book.title) self.set_favouritesindex(connection, book.contentID) category_added = True - elif category in accessibilitylist.keys(): + elif category in list(accessibilitylist.keys()): # Do not manage the Accessibility List pass diff --git a/src/calibre/devices/mtp/defaults.py b/src/calibre/devices/mtp/defaults.py index ed72ddaad1..9bcd6f2909 100644 --- a/src/calibre/devices/mtp/defaults.py +++ b/src/calibre/devices/mtp/defaults.py @@ -10,6 +10,7 @@ __docformat__ = 'restructuredtext en' import traceback, re from calibre.constants import iswindows +from polyglot.builtins import iteritems class DeviceDefaults(object): @@ -47,7 +48,7 @@ class DeviceDefaults(object): for rule in self.rules: tests = rule[0] matches = True - for k, v in tests.iteritems(): + for k, v in iteritems(tests): if k == 'vendor' and v != vid: matches = False break diff --git a/src/calibre/devices/mtp/driver.py b/src/calibre/devices/mtp/driver.py index 725f497baa..58a19b19c7 100644 --- a/src/calibre/devices/mtp/driver.py +++ b/src/calibre/devices/mtp/driver.py @@ -17,7 +17,7 @@ from calibre.devices.mtp.base import debug from calibre.devices.mtp.defaults import DeviceDefaults from calibre.ptempfile import SpooledTemporaryFile, PersistentTemporaryDirectory from calibre.utils.filenames import shorten_components_to -from polyglot.builtins import unicode_type, zip +from polyglot.builtins import iteritems, itervalues, unicode_type, zip BASE = importlib.import_module('calibre.devices.mtp.%s.driver'%( 'windows' if iswindows else 'unix')).MTP_DEVICE @@ -276,7 +276,7 @@ class MTP_DEVICE(BASE): book.path = mtp_file.mtp_id_path # Remove books in the cache that no longer exist - for idx in sorted(relpath_cache.itervalues(), reverse=True): + for idx in sorted(itervalues(relpath_cache), reverse=True): del bl[idx] need_sync = True @@ -546,7 +546,7 @@ class MTP_DEVICE(BASE): def get_user_blacklisted_devices(self): bl = frozenset(self.prefs['blacklist']) ans = {} - for dev, x in self.prefs['history'].iteritems(): + for dev, x in iteritems(self.prefs['history']): name = x[0] if dev in bl: ans[dev] = name diff --git a/src/calibre/devices/mtp/filesystem_cache.py b/src/calibre/devices/mtp/filesystem_cache.py index f5a3ef690d..1d2744ba98 100644 --- a/src/calibre/devices/mtp/filesystem_cache.py +++ b/src/calibre/devices/mtp/filesystem_cache.py @@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en' import weakref, sys, json from collections import deque from operator import attrgetter -from polyglot.builtins import map, unicode_type +from polyglot.builtins import itervalues, map, unicode_type from datetime import datetime from calibre import human_readable, prints, force_unicode @@ -201,7 +201,7 @@ class FilesystemCache(object): for entry in entries: FileOrFolder(entry, self) - for item in self.id_map.itervalues(): + for item in itervalues(self.id_map): try: p = item.parent except KeyError: @@ -227,7 +227,7 @@ class FilesystemCache(object): return e def iterebooks(self, storage_id): - for x in self.id_map.itervalues(): + for x in itervalues(self.id_map): if x.storage_id == storage_id and x.is_ebook: if x.parent_id == storage_id and x.name.lower().endswith('.txt'): continue # Ignore .txt files in the root diff --git a/src/calibre/devices/mtp/windows/driver.py b/src/calibre/devices/mtp/windows/driver.py index 23c445570b..f99a0309c6 100644 --- a/src/calibre/devices/mtp/windows/driver.py +++ b/src/calibre/devices/mtp/windows/driver.py @@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en' import time, threading, traceback from functools import wraps, partial -from polyglot.builtins import unicode_type, zip +from polyglot.builtins import iteritems, iterkeys, itervalues, unicode_type, zip from itertools import chain from calibre import as_unicode, prints, force_unicode @@ -107,7 +107,7 @@ class MTP_DEVICE(MTPDeviceBase): # Get device data for detected devices. If there is an error, we will # try again for that device the next time this method is called. - for dev in tuple(self.detected_devices.iterkeys()): + for dev in tuple(iterkeys(self.detected_devices)): data = self.detected_devices.get(dev, None) if data is None or data is False: try: @@ -130,7 +130,7 @@ class MTP_DEVICE(MTPDeviceBase): self.currently_connected_pnp_id in self.detected_devices else None) - for dev, data in self.detected_devices.iteritems(): + for dev, data in iteritems(self.detected_devices): if dev in self.blacklisted_devices or dev in self.ejected_devices: # Ignore blacklisted and ejected devices continue @@ -267,10 +267,10 @@ class MTP_DEVICE(MTPDeviceBase): self._currently_getting_sid = unicode_type(storage_id) id_map = self.dev.get_filesystem(storage_id, partial( self._filesystem_callback, {})) - for x in id_map.itervalues(): + for x in itervalues(id_map): x['storage_id'] = storage_id all_storage.append(storage) - items.append(id_map.itervalues()) + items.append(itervalues(id_map)) self._filesystem_cache = FilesystemCache(all_storage, chain(*items)) debug('Filesystem metadata loaded in %g seconds (%d objects)'%( time.time()-st, len(self._filesystem_cache))) diff --git a/src/calibre/devices/scanner.py b/src/calibre/devices/scanner.py index ca3014cda9..1eb5a24b95 100644 --- a/src/calibre/devices/scanner.py +++ b/src/calibre/devices/scanner.py @@ -13,7 +13,7 @@ from threading import Lock from calibre import prints, as_unicode from calibre.constants import (iswindows, isosx, plugins, islinux, isfreebsd, isnetbsd) -from polyglot.builtins import range +from polyglot.builtins import iterkeys, range osx_scanner = linux_scanner = freebsd_scanner = netbsd_scanner = None @@ -77,7 +77,7 @@ class LibUSBScanner(object): dev = USBDevice(*dev) dev.busnum, dev.devnum = fingerprint[:2] ans.add(dev) - extra = set(self.libusb.cache.iterkeys()) - seen + extra = set(iterkeys(self.libusb.cache)) - seen for x in extra: self.libusb.cache.pop(x, None) return ans diff --git a/src/calibre/devices/usbms/device.py b/src/calibre/devices/usbms/device.py index 401728928e..a7eb0b3567 100644 --- a/src/calibre/devices/usbms/device.py +++ b/src/calibre/devices/usbms/device.py @@ -23,7 +23,7 @@ from calibre.devices.errors import DeviceError from calibre.devices.usbms.deviceconfig import DeviceConfig from calibre.constants import iswindows, islinux, isosx, isfreebsd, plugins from calibre.utils.filenames import ascii_filename as sanitize -from polyglot.builtins import string_or_bytes +from polyglot.builtins import iteritems, string_or_bytes if isosx: usbobserver, usbobserver_err = plugins['usbobserver'] @@ -404,7 +404,7 @@ class Device(DeviceConfig, DevicePlugin): bsd_drives = self.osx_bsd_names() drives = self.osx_sort_names(bsd_drives.copy()) mount_map = usbobserver.get_mounted_filesystems() - drives = {k: mount_map.get(v) for k, v in drives.iteritems()} + drives = {k: mount_map.get(v) for k, v in iteritems(drives)} if DEBUG: print() from pprint import pprint diff --git a/src/calibre/devices/usbms/driver.py b/src/calibre/devices/usbms/driver.py index 0efd62214d..c475800ab3 100644 --- a/src/calibre/devices/usbms/driver.py +++ b/src/calibre/devices/usbms/driver.py @@ -20,7 +20,7 @@ from calibre.devices.usbms.cli import CLI from calibre.devices.usbms.device import Device from calibre.devices.usbms.books import BookList, Book from calibre.ebooks.metadata.book.json_codec import JsonCodec -from polyglot.builtins import unicode_type, string_or_bytes +from polyglot.builtins import itervalues, unicode_type, string_or_bytes BASE_TIME = None @@ -281,7 +281,7 @@ class USBMS(CLI, Device): # Remove books that are no longer in the filesystem. Cache contains # indices into the booklist if book not in filesystem, None otherwise # Do the operation in reverse order so indices remain valid - for idx in sorted(bl_cache.itervalues(), reverse=True): + for idx in sorted(itervalues(bl_cache), reverse=True): if idx is not None: need_sync = True del bl[idx] diff --git a/src/calibre/devices/winusb.py b/src/calibre/devices/winusb.py index 5b1a005328..0a7647cce0 100644 --- a/src/calibre/devices/winusb.py +++ b/src/calibre/devices/winusb.py @@ -15,7 +15,7 @@ from ctypes import ( ) from ctypes.wintypes import DWORD, WORD, ULONG, LPCWSTR, HWND, BOOL, LPWSTR, UINT, BYTE, HANDLE, USHORT from pprint import pprint, pformat -from polyglot.builtins import map +from polyglot.builtins import iteritems, itervalues, map from calibre import prints, as_unicode @@ -652,13 +652,13 @@ def get_volume_information(drive_letter): 'max_component_length': max_component_length.value, } - for name, num in {'FILE_CASE_PRESERVED_NAMES':0x00000002, 'FILE_CASE_SENSITIVE_SEARCH':0x00000001, 'FILE_FILE_COMPRESSION':0x00000010, + for name, num in iteritems({'FILE_CASE_PRESERVED_NAMES':0x00000002, 'FILE_CASE_SENSITIVE_SEARCH':0x00000001, 'FILE_FILE_COMPRESSION':0x00000010, 'FILE_NAMED_STREAMS':0x00040000, 'FILE_PERSISTENT_ACLS':0x00000008, 'FILE_READ_ONLY_VOLUME':0x00080000, 'FILE_SEQUENTIAL_WRITE_ONCE':0x00100000, 'FILE_SUPPORTS_ENCRYPTION':0x00020000, 'FILE_SUPPORTS_EXTENDED_ATTRIBUTES':0x00800000, 'FILE_SUPPORTS_HARD_LINKS':0x00400000, 'FILE_SUPPORTS_OBJECT_IDS':0x00010000, 'FILE_SUPPORTS_OPEN_BY_FILE_ID':0x01000000, 'FILE_SUPPORTS_REPARSE_POINTS':0x00000080, 'FILE_SUPPORTS_SPARSE_FILES':0x00000040, 'FILE_SUPPORTS_TRANSACTIONS':0x00200000, 'FILE_SUPPORTS_USN_JOURNAL':0x02000000, 'FILE_UNICODE_ON_DISK':0x00000004, 'FILE_VOLUME_IS_COMPRESSED':0x00008000, - 'FILE_VOLUME_QUOTAS':0x00000020}.iteritems(): + 'FILE_VOLUME_QUOTAS':0x00000020}): ans[name] = bool(num & flags) return ans @@ -809,7 +809,7 @@ def get_storage_number_map(drive_types=(DRIVE_REMOVABLE, DRIVE_FIXED), debug=Fal ' Get a mapping of drive letters to storage numbers for all drives on system (of the specified types) ' mask = GetLogicalDrives() type_map = {letter:GetDriveType(letter + ':' + os.sep) for i, letter in enumerate(string.ascii_uppercase) if mask & (1 << i)} - drives = (letter for letter, dt in type_map.iteritems() if dt in drive_types) + drives = (letter for letter, dt in iteritems(type_map) if dt in drive_types) ans = defaultdict(list) for letter in drives: try: @@ -819,7 +819,7 @@ def get_storage_number_map(drive_types=(DRIVE_REMOVABLE, DRIVE_FIXED), debug=Fal if debug: prints('Failed to get storage number for drive: %s with error: %s' % (letter, as_unicode(err))) continue - for val in ans.itervalues(): + for val in itervalues(ans): val.sort(key=itemgetter(0)) return dict(ans) @@ -859,7 +859,7 @@ def get_storage_number_map_alt(debug=False): if debug: prints('Failed to get storage number for drive: %s with error: %s' % (name[0], as_unicode(err))) continue - for val in ans.itervalues(): + for val in itervalues(ans): val.sort(key=itemgetter(0)) return dict(ans) diff --git a/src/calibre/ebooks/conversion/cli.py b/src/calibre/ebooks/conversion/cli.py index a1394b592b..10e9ce6b8f 100644 --- a/src/calibre/ebooks/conversion/cli.py +++ b/src/calibre/ebooks/conversion/cli.py @@ -17,6 +17,7 @@ from calibre.customize.conversion import OptionRecommendation from calibre import patheq from calibre.ebooks.conversion import ConversionUserFeedBack from calibre.utils.localization import localize_user_manual_link +from polyglot.builtins import iteritems USAGE = '%prog ' + _('''\ input_file output_file [options] @@ -254,7 +255,7 @@ def add_pipeline_options(parser, plumber): )) - for group, (desc, options) in groups.iteritems(): + for group, (desc, options) in iteritems(groups): if group: group = OptionGroup(parser, group, desc) parser.add_option_group(group) diff --git a/src/calibre/ebooks/conversion/plugins/fb2_input.py b/src/calibre/ebooks/conversion/plugins/fb2_input.py index 879836aa85..42122d3a50 100644 --- a/src/calibre/ebooks/conversion/plugins/fb2_input.py +++ b/src/calibre/ebooks/conversion/plugins/fb2_input.py @@ -8,7 +8,7 @@ import os, re from calibre.customize.conversion import InputFormatPlugin, OptionRecommendation from calibre import guess_type -from polyglot.builtins import unicode_type +from polyglot.builtins import iteritems, unicode_type FB2NS = 'http://www.gribuser.ru/xml/fictionbook/2.0' FB21NS = 'http://www.gribuser.ru/xml/fictionbook/2.1' @@ -103,7 +103,7 @@ class FB2Input(InputFormatPlugin): notes = {a.get('href')[1:]: a for a in result.xpath('//a[@link_note and @href]') if a.get('href').startswith('#')} cites = {a.get('link_cite'): a for a in result.xpath('//a[@link_cite]') if not a.get('href', '')} all_ids = {x for x in result.xpath('//*/@id')} - for cite, a in cites.iteritems(): + for cite, a in iteritems(cites): note = notes.get(cite, None) if note: c = 1 diff --git a/src/calibre/ebooks/conversion/plugins/pdf_output.py b/src/calibre/ebooks/conversion/plugins/pdf_output.py index b0b4ad6bae..ee20c0f1ac 100644 --- a/src/calibre/ebooks/conversion/plugins/pdf_output.py +++ b/src/calibre/ebooks/conversion/plugins/pdf_output.py @@ -14,7 +14,7 @@ from calibre.constants import iswindows from calibre.customize.conversion import (OutputFormatPlugin, OptionRecommendation) from calibre.ptempfile import TemporaryDirectory -from polyglot.builtins import unicode_type +from polyglot.builtins import iteritems, unicode_type UNITS = ['millimeter', 'centimeter', 'point', 'inch' , 'pica' , 'didot', 'cicero', 'devicepixel'] @@ -263,7 +263,7 @@ class PDFOutput(OutputFormatPlugin): self.process_fonts() if self.opts.pdf_use_document_margins and self.stored_page_margins: import json - for href, margins in self.stored_page_margins.iteritems(): + for href, margins in iteritems(self.stored_page_margins): item = oeb_book.manifest.hrefs.get(href) if item is not None: root = item.data diff --git a/src/calibre/ebooks/conversion/plugins/rtf_input.py b/src/calibre/ebooks/conversion/plugins/rtf_input.py index e38c76b2d5..98059a3eca 100644 --- a/src/calibre/ebooks/conversion/plugins/rtf_input.py +++ b/src/calibre/ebooks/conversion/plugins/rtf_input.py @@ -5,6 +5,7 @@ __copyright__ = '2008, Kovid Goyal ' import os, glob, re, textwrap from calibre.customize.conversion import InputFormatPlugin, OptionRecommendation +from polyglot.builtins import iteritems border_style_map = { 'single' : 'solid', @@ -145,7 +146,7 @@ class RTFInput(InputFormatPlugin): def convert_images(self, imap): self.default_img = None - for count, val in imap.iteritems(): + for count, val in iteritems(imap): try: imap[count] = self.convert_image(val) except: @@ -210,7 +211,7 @@ class RTFInput(InputFormatPlugin): css += '\n'+'\n'.join(font_size_classes) css += '\n' +'\n'.join(color_classes) - for cls, val in border_styles.iteritems(): + for cls, val in iteritems(border_styles): css += '\n\n.%s {\n%s\n}'%(cls, val) with open(u'styles.css', 'ab') as f: diff --git a/src/calibre/ebooks/covers.py b/src/calibre/ebooks/covers.py index 035ca9ad39..a5a1c7df2d 100644 --- a/src/calibre/ebooks/covers.py +++ b/src/calibre/ebooks/covers.py @@ -10,7 +10,7 @@ import re, random, unicodedata, numbers from collections import namedtuple from contextlib import contextmanager from math import ceil, sqrt, cos, sin, atan2 -from polyglot.builtins import map, zip, string_or_bytes +from polyglot.builtins import iteritems, itervalues, map, zip, string_or_bytes from itertools import chain from PyQt5.Qt import ( @@ -282,7 +282,7 @@ def preserve_fields(obj, fields): try: yield finally: - for f, val in mem.iteritems(): + for f, val in iteritems(mem): if val is null: delattr(obj, f) else: @@ -324,10 +324,10 @@ def load_color_themes(prefs): t = default_color_themes.copy() t.update(prefs.color_themes) disabled = frozenset(prefs.disabled_color_themes) - ans = [theme_to_colors(v) for k, v in t.iteritems() if k not in disabled] + ans = [theme_to_colors(v) for k, v in iteritems(t) if k not in disabled] if not ans: # Ignore disabled and return only the builtin color themes - ans = [theme_to_colors(v) for k, v in default_color_themes.iteritems()] + ans = [theme_to_colors(v) for k, v in iteritems(default_color_themes)] return ans @@ -557,14 +557,14 @@ class Blocks(Style): def all_styles(): return set( - x.NAME for x in globals().itervalues() if + x.NAME for x in itervalues(globals()) if isinstance(x, type) and issubclass(x, Style) and x is not Style ) def load_styles(prefs, respect_disabled=True): disabled = frozenset(prefs.disabled_styles) if respect_disabled else () - ans = tuple(x for x in globals().itervalues() if + ans = tuple(x for x in itervalues(globals()) if isinstance(x, type) and issubclass(x, Style) and x is not Style and x.NAME not in disabled) if not ans and disabled: # If all styles have been disabled, ignore the disabling and return all diff --git a/src/calibre/ebooks/css_transform_rules.py b/src/calibre/ebooks/css_transform_rules.py index 58fc483047..3bd8428c2d 100644 --- a/src/calibre/ebooks/css_transform_rules.py +++ b/src/calibre/ebooks/css_transform_rules.py @@ -13,6 +13,7 @@ from css_parser.css import Property, CSSRule from calibre import force_unicode from calibre.ebooks import parse_css_length from calibre.ebooks.oeb.normalize_css import normalizers, safe_parser +from polyglot.builtins import iteritems def compile_pat(pat): @@ -44,7 +45,7 @@ class StyleDeclaration(object): yield p, None else: if p not in self.expanded_properties: - self.expanded_properties[p] = [Property(k, v, p.literalpriority) for k, v in n(p.name, p.propertyValue).iteritems()] + self.expanded_properties[p] = [Property(k, v, p.literalpriority) for k, v in iteritems(n(p.name, p.propertyValue))] for ep in self.expanded_properties[p]: yield ep, p @@ -338,7 +339,7 @@ def export_rules(serialized_rules): lines = [] for rule in serialized_rules: lines.extend('# ' + l for l in rule_to_text(rule).splitlines()) - lines.extend('%s: %s' % (k, v.replace('\n', ' ')) for k, v in rule.iteritems() if k in allowed_keys) + lines.extend('%s: %s' % (k, v.replace('\n', ' ')) for k, v in iteritems(rule) if k in allowed_keys) lines.append('') return '\n'.join(lines).encode('utf-8') diff --git a/src/calibre/ebooks/docx/block_styles.py b/src/calibre/ebooks/docx/block_styles.py index 480738fa06..05f5f54692 100644 --- a/src/calibre/ebooks/docx/block_styles.py +++ b/src/calibre/ebooks/docx/block_styles.py @@ -8,6 +8,7 @@ __copyright__ = '2013, Kovid Goyal ' import numbers from collections import OrderedDict +from polyglot.builtins import iteritems class Inherit: @@ -115,11 +116,11 @@ def read_border(parent, dest, XPath, get, border_edges=border_edges, name='pBdr' for border in XPath('./w:' + name)(parent): for edge in border_edges: - for prop, val in read_single_border(border, edge, XPath, get).iteritems(): + for prop, val in iteritems(read_single_border(border, edge, XPath, get)): if val is not None: vals[prop % edge] = val - for key, val in vals.iteritems(): + for key, val in iteritems(vals): setattr(dest, key, val) diff --git a/src/calibre/ebooks/docx/cleanup.py b/src/calibre/ebooks/docx/cleanup.py index 30fd9d25d9..6d71805fc0 100644 --- a/src/calibre/ebooks/docx/cleanup.py +++ b/src/calibre/ebooks/docx/cleanup.py @@ -7,7 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' import os -from polyglot.builtins import range +from polyglot.builtins import iterkeys, itervalues, range NBSP = '\xa0' @@ -54,7 +54,7 @@ def merge_run(run): def liftable(css): # A is liftable if all its styling would work just as well if it is # specified on the parent element. - prefixes = {x.partition('-')[0] for x in css.iterkeys()} + prefixes = {x.partition('-')[0] for x in iterkeys(css)} return not (prefixes - {'text', 'font', 'letter', 'color', 'background'}) @@ -134,7 +134,7 @@ def cleanup_markup(log, root, styles, dest_dir, detect_cover, XPath): current_run = [span] # Process dir attributes - class_map = dict(styles.classes.itervalues()) + class_map = dict(itervalues(styles.classes)) parents = ('p', 'div') + tuple('h%d' % i for i in range(1, 7)) for parent in root.xpath('//*[(%s)]' % ' or '.join('name()="%s"' % t for t in parents)): # Ensure that children of rtl parents that are not rtl have an diff --git a/src/calibre/ebooks/docx/fields.py b/src/calibre/ebooks/docx/fields.py index 3d7e457019..038ded9cb3 100644 --- a/src/calibre/ebooks/docx/fields.py +++ b/src/calibre/ebooks/docx/fields.py @@ -9,6 +9,7 @@ __copyright__ = '2013, Kovid Goyal ' import re from calibre.ebooks.docx.index import process_index, polish_index_markup +from polyglot.builtins import iteritems class Field(object): @@ -222,7 +223,7 @@ class Fields(object): def polish_markup(self, object_map): if not self.index_fields: return - rmap = {v:k for k, v in object_map.iteritems()} + rmap = {v:k for k, v in iteritems(object_map)} for idx, blocks in self.index_fields: polish_index_markup(idx, [rmap[b] for b in blocks]) diff --git a/src/calibre/ebooks/docx/fonts.py b/src/calibre/ebooks/docx/fonts.py index 0aed536cab..9532d7c078 100644 --- a/src/calibre/ebooks/docx/fonts.py +++ b/src/calibre/ebooks/docx/fonts.py @@ -14,7 +14,7 @@ from calibre.utils.filenames import ascii_filename from calibre.utils.fonts.scanner import font_scanner, NoFonts from calibre.utils.fonts.utils import panose_to_css_generic_family, is_truetype_font from calibre.utils.icu import ord_string -from polyglot.builtins import codepoint_to_chr, range +from polyglot.builtins import codepoint_to_chr, iteritems, range Embed = namedtuple('Embed', 'name key subsetted') @@ -172,7 +172,7 @@ class Fonts(object): d['font-weight'] = 'bold' if 'Italic' in variant: d['font-style'] = 'italic' - d = ['%s: %s' % (k, v) for k, v in d.iteritems()] + d = ['%s: %s' % (k, v) for k, v in iteritems(d)] d = ';\n\t'.join(d) defs.append('@font-face {\n\t%s\n}\n' % d) return '\n'.join(defs) diff --git a/src/calibre/ebooks/docx/footnotes.py b/src/calibre/ebooks/docx/footnotes.py index a078b9f57c..15f40fb092 100644 --- a/src/calibre/ebooks/docx/footnotes.py +++ b/src/calibre/ebooks/docx/footnotes.py @@ -7,6 +7,7 @@ __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' from collections import OrderedDict +from polyglot.builtins import iteritems class Note(object): @@ -57,10 +58,9 @@ class Footnotes(object): return None, None def __iter__(self): - for anchor, (counter, note) in self.notes.iteritems(): + for anchor, (counter, note) in iteritems(self.notes): yield anchor, counter, note @property def has_notes(self): return bool(self.notes) - diff --git a/src/calibre/ebooks/docx/images.py b/src/calibre/ebooks/docx/images.py index a3fcfc8efb..17a4bb08f0 100644 --- a/src/calibre/ebooks/docx/images.py +++ b/src/calibre/ebooks/docx/images.py @@ -15,6 +15,7 @@ from calibre.ebooks.docx.names import barename from calibre.utils.filenames import ascii_filename from calibre.utils.img import resize_to_fit, image_to_data from calibre.utils.imghdr import what +from polyglot.builtins import iteritems, itervalues class LinkedImageNotFound(ValueError): @@ -66,7 +67,7 @@ def get_image_properties(parent, XPath, get): def get_image_margins(elem): ans = {} - for w, css in {'L':'left', 'T':'top', 'R':'right', 'B':'bottom'}.iteritems(): + for w, css in iteritems({'L':'left', 'T':'top', 'R':'right', 'B':'bottom'}): val = elem.get('dist%s' % w, None) if val is not None: try: @@ -157,7 +158,7 @@ class Images(object): return raw, base def unique_name(self, base): - exists = frozenset(self.used.itervalues()) + exists = frozenset(itervalues(self.used)) c = 1 name = base while name in exists: @@ -242,7 +243,7 @@ class Images(object): ans = self.pic_to_img(pic, alt, inline, title) if ans is not None: if style: - ans.set('style', '; '.join('%s: %s' % (k, v) for k, v in style.iteritems())) + ans.set('style', '; '.join('%s: %s' % (k, v) for k, v in iteritems(style))) yield ans # Now process the floats @@ -253,7 +254,7 @@ class Images(object): ans = self.pic_to_img(pic, alt, anchor, title) if ans is not None: if style: - ans.set('style', '; '.join('%s: %s' % (k, v) for k, v in style.iteritems())) + ans.set('style', '; '.join('%s: %s' % (k, v) for k, v in iteritems(style))) yield ans def pict_to_html(self, pict, page): @@ -275,7 +276,7 @@ class Images(object): style['margin-left'] = '0' if align == 'left' else 'auto' style['margin-right'] = 'auto' if align == 'left' else '0' if style: - hr.set('style', '; '.join(('%s:%s' % (k, v) for k, v in style.iteritems()))) + hr.set('style', '; '.join(('%s:%s' % (k, v) for k, v in iteritems(style)))) yield hr for imagedata in XPath('descendant::v:imagedata[@r:id]')(pict): diff --git a/src/calibre/ebooks/docx/index.py b/src/calibre/ebooks/docx/index.py index a4e8e0ec60..38220a1c86 100644 --- a/src/calibre/ebooks/docx/index.py +++ b/src/calibre/ebooks/docx/index.py @@ -11,7 +11,7 @@ from operator import itemgetter from lxml import etree from calibre.utils.icu import partition_by_first_letter, sort_key -from polyglot.builtins import unicode_type +from polyglot.builtins import iteritems, unicode_type def get_applicable_xe_fields(index, xe_fields, XPath, expand): @@ -103,7 +103,7 @@ def process_index(field, index, xe_fields, log, XPath, expand): if heading_text is not None: groups = partition_by_first_letter(xe_fields, key=itemgetter('text')) items = [] - for key, fields in groups.iteritems(): + for key, fields in iteritems(groups): items.append(key), items.extend(fields) if styles: heading_style = styles[0] diff --git a/src/calibre/ebooks/docx/names.py b/src/calibre/ebooks/docx/names.py index 3db3f5e961..3238743b65 100644 --- a/src/calibre/ebooks/docx/names.py +++ b/src/calibre/ebooks/docx/names.py @@ -11,6 +11,7 @@ import re from lxml.etree import XPath as X from calibre.utils.filenames import ascii_text +from polyglot.builtins import iteritems # Names {{{ TRANSITIONAL_NAMES = { @@ -32,7 +33,7 @@ TRANSITIONAL_NAMES = { STRICT_NAMES = { k:v.replace('http://schemas.openxmlformats.org/officeDocument/2006', 'http://purl.oclc.org/ooxml/officeDocument') - for k, v in TRANSITIONAL_NAMES.iteritems() + for k, v in iteritems(TRANSITIONAL_NAMES) } TRANSITIONAL_NAMESPACES = { @@ -72,7 +73,7 @@ STRICT_NAMESPACES = { 'http://schemas.openxmlformats.org/officeDocument/2006', 'http://purl.oclc.org/ooxml/officeDocument').replace( 'http://schemas.openxmlformats.org/wordprocessingml/2006', 'http://purl.oclc.org/ooxml/wordprocessingml').replace( 'http://schemas.openxmlformats.org/drawingml/2006', 'http://purl.oclc.org/ooxml/drawingml') - for k, v in TRANSITIONAL_NAMESPACES.iteritems() + for k, v in iteritems(TRANSITIONAL_NAMESPACES) } # }}} @@ -138,7 +139,7 @@ class DOCXNamespace(object): return self.XPath('|'.join('descendant::%s' % a for a in args))(elem) def makeelement(self, root, tag, append=True, **attrs): - ans = root.makeelement(self.expand(tag), **{self.expand(k, sep='_'):v for k, v in attrs.iteritems()}) + ans = root.makeelement(self.expand(tag), **{self.expand(k, sep='_'):v for k, v in iteritems(attrs)}) if append: root.append(ans) return ans diff --git a/src/calibre/ebooks/docx/numbering.py b/src/calibre/ebooks/docx/numbering.py index a132cf2233..caad53399d 100644 --- a/src/calibre/ebooks/docx/numbering.py +++ b/src/calibre/ebooks/docx/numbering.py @@ -15,6 +15,7 @@ from lxml.html.builder import OL, UL, SPAN from calibre.ebooks.docx.block_styles import ParagraphStyle from calibre.ebooks.docx.char_styles import RunStyle, inherit from calibre.ebooks.metadata import roman +from polyglot.builtins import iteritems STYLE_MAP = { 'aiueo': 'hiragana', @@ -168,7 +169,7 @@ class NumberingDefinition(object): def copy(self): ans = NumberingDefinition(self.namespace, an_id=self.abstract_numbering_definition_id) - for l, lvl in self.levels.iteritems(): + for l, lvl in iteritems(self.levels): ans.levels[l] = lvl.copy() return ans @@ -224,7 +225,7 @@ class Numbering(object): if alvl is None: alvl = Level(self.namespace) alvl.read_from_xml(lvl, override=True) - for ilvl, so in start_overrides.iteritems(): + for ilvl, so in iteritems(start_overrides): try: nd.levels[ilvl].start = start_override except KeyError: @@ -244,22 +245,22 @@ class Numbering(object): self.instances[num_id] = create_instance(n, d) numbering_links = styles.numbering_style_links - for an_id, style_link in lazy_load.iteritems(): + for an_id, style_link in iteritems(lazy_load): num_id = numbering_links[style_link] self.definitions[an_id] = self.instances[num_id].copy() - for num_id, (an_id, n) in next_pass.iteritems(): + for num_id, (an_id, n) in iteritems(next_pass): d = self.definitions.get(an_id, None) if d is not None: self.instances[num_id] = create_instance(n, d) - for num_id, d in self.instances.iteritems(): + for num_id, d in iteritems(self.instances): self.starts[num_id] = {lvl:d.levels[lvl].start for lvl in d.levels} def get_pstyle(self, num_id, style_id): d = self.instances.get(num_id, None) if d is not None: - for ilvl, lvl in d.levels.iteritems(): + for ilvl, lvl in iteritems(d.levels): if lvl.para_link == style_id: return ilvl @@ -271,7 +272,7 @@ class Numbering(object): def update_counter(self, counter, levelnum, levels): counter[levelnum] += 1 - for ilvl, lvl in levels.iteritems(): + for ilvl, lvl in iteritems(levels): restart = lvl.restart if (restart is None and ilvl == levelnum + 1) or restart == levelnum + 1: counter[ilvl] = lvl.start diff --git a/src/calibre/ebooks/docx/styles.py b/src/calibre/ebooks/docx/styles.py index 1b1847236d..56b5b9a4e3 100644 --- a/src/calibre/ebooks/docx/styles.py +++ b/src/calibre/ebooks/docx/styles.py @@ -12,6 +12,7 @@ from collections import OrderedDict, Counter from calibre.ebooks.docx.block_styles import ParagraphStyle, inherit, twips from calibre.ebooks.docx.char_styles import RunStyle from calibre.ebooks.docx.tables import TableStyle +from polyglot.builtins import iteritems, itervalues class PageProperties(object): @@ -124,7 +125,7 @@ class Styles(object): self.default_paragraph_style = self.default_character_style = None def __iter__(self): - for s in self.id_map.itervalues(): + for s in itervalues(self.id_map): yield s def __getitem__(self, key): @@ -341,7 +342,7 @@ class Styles(object): setattr(s, prop, inherit) setattr(block_style, prop, next(iter(vals))) - for p, runs in layers.iteritems(): + for p, runs in iteritems(layers): has_links = '1' in {r.get('is-link', None) for r in runs} char_styles = [self.resolve_run(r) for r in runs] block_style = self.resolve_paragraph(p) @@ -421,7 +422,7 @@ class Styles(object): ps.pageBreakBefore = True def register(self, css, prefix): - h = hash(frozenset(css.iteritems())) + h = hash(frozenset(iteritems(css))) ans, _ = self.classes.get(h, (None, None)) if ans is None: self.counter[prefix] += 1 @@ -430,17 +431,17 @@ class Styles(object): return ans def generate_classes(self): - for bs in self.para_cache.itervalues(): + for bs in itervalues(self.para_cache): css = bs.css if css: self.register(css, 'block') - for bs in self.run_cache.itervalues(): + for bs in itervalues(self.run_cache): css = bs.css if css: self.register(css, 'text') def class_name(self, css): - h = hash(frozenset(css.iteritems())) + h = hash(frozenset(iteritems(css))) return self.classes.get(h, (None, None))[0] def generate_css(self, dest_dir, docx, notes_nopb, nosupsub): @@ -495,8 +496,8 @@ class Styles(object): prefix = ef + '\n' + prefix ans = [] - for (cls, css) in sorted(self.classes.itervalues(), key=lambda x:x[0]): - b = ('\t%s: %s;' % (k, v) for k, v in css.iteritems()) + for (cls, css) in sorted(itervalues(self.classes), key=lambda x:x[0]): + b = ('\t%s: %s;' % (k, v) for k, v in iteritems(css)) b = '\n'.join(b) ans.append('.%s {\n%s\n}\n' % (cls, b.rstrip(';'))) return prefix + '\n' + '\n'.join(ans) diff --git a/src/calibre/ebooks/docx/tables.py b/src/calibre/ebooks/docx/tables.py index b21d723ce4..a6b5f8ef69 100644 --- a/src/calibre/ebooks/docx/tables.py +++ b/src/calibre/ebooks/docx/tables.py @@ -10,7 +10,7 @@ from lxml.html.builder import TABLE, TR, TD from calibre.ebooks.docx.block_styles import inherit, read_shd as rs, read_border, binary_property, border_props, ParagraphStyle, border_to_css from calibre.ebooks.docx.char_styles import RunStyle -from polyglot.builtins import range +from polyglot.builtins import iteritems, itervalues, range # Read from XML {{{ read_shd = rs @@ -86,7 +86,7 @@ def read_spacing(parent, dest, XPath, get): def read_float(parent, dest, XPath, get): ans = inherit for x in XPath('./w:tblpPr')(parent): - ans = {k.rpartition('}')[-1]: v for k, v in x.attrib.iteritems()} + ans = {k.rpartition('}')[-1]: v for k, v in iteritems(x.attrib)} setattr(dest, 'float', ans) @@ -618,7 +618,7 @@ class Table(object): def __iter__(self): for p in self.paragraphs: yield p - for t in self.sub_tables.itervalues(): + for t in itervalues(self.sub_tables): for p in t: yield p @@ -665,7 +665,7 @@ class Table(object): table_style = self.table_style.css if table_style: table.set('class', self.styles.register(table_style, 'table')) - for elem, style in style_map.iteritems(): + for elem, style in iteritems(style_map): css = style.css if css: elem.set('class', self.styles.register(css, elem.tag)) @@ -686,7 +686,7 @@ class Tables(object): self.sub_tables |= set(self.tables[-1].sub_tables) def apply_markup(self, object_map, page_map): - rmap = {v:k for k, v in object_map.iteritems()} + rmap = {v:k for k, v in iteritems(object_map)} for table in self.tables: table.apply_markup(rmap, page_map[table.tbl]) diff --git a/src/calibre/ebooks/docx/to_html.py b/src/calibre/ebooks/docx/to_html.py index f1301f1f93..85ab2554bc 100644 --- a/src/calibre/ebooks/docx/to_html.py +++ b/src/calibre/ebooks/docx/to_html.py @@ -29,6 +29,8 @@ from calibre.ebooks.docx.fields import Fields from calibre.ebooks.docx.settings import Settings from calibre.ebooks.metadata.opf2 import OPFCreator from calibre.utils.localization import canonicalize_lang, lang_as_iso639_1 +from polyglot.builtins import iteritems, itervalues + NBSP = '\xa0' @@ -122,7 +124,7 @@ class Convert(object): self.read_page_properties(doc) self.resolve_alternate_content(doc) self.current_rels = relationships_by_id - for wp, page_properties in self.page_map.iteritems(): + for wp, page_properties in iteritems(self.page_map): self.current_page = page_properties if wp.tag.endswith('}p'): p = self.convert_p(wp) @@ -162,7 +164,7 @@ class Convert(object): self.styles.apply_contextual_spacing(paras) self.mark_block_runs(paras) - for p, wp in self.object_map.iteritems(): + for p, wp in iteritems(self.object_map): if len(p) > 0 and not p.text and len(p[0]) > 0 and not p[0].text and p[0][0].get('class', None) == 'tab': # Paragraph uses tabs for indentation, convert to text-indent parent = p[0] @@ -192,7 +194,7 @@ class Convert(object): self.tables.apply_markup(self.object_map, self.page_map) numbered = [] - for html_obj, obj in self.object_map.iteritems(): + for html_obj, obj in iteritems(self.object_map): raw = obj.get('calibre_num_id', None) if raw is not None: lvl, num_id = raw.partition(':')[0::2] @@ -212,7 +214,7 @@ class Convert(object): self.log.debug('Converting styles to CSS') self.styles.generate_classes() - for html_obj, obj in self.object_map.iteritems(): + for html_obj, obj in iteritems(self.object_map): style = self.styles.resolve(obj) if style is not None: css = style.css @@ -220,7 +222,7 @@ class Convert(object): cls = self.styles.class_name(css) if cls: html_obj.set('class', cls) - for html_obj, css in self.framed_map.iteritems(): + for html_obj, css in iteritems(self.framed_map): cls = self.styles.class_name(css) if cls: html_obj.set('class', cls) @@ -407,13 +409,13 @@ class Convert(object): doc_anchors = frozenset(self.namespace.XPath('./w:body/w:bookmarkStart[@w:name]')(doc)) if doc_anchors: current_bm = set() - rmap = {v:k for k, v in self.object_map.iteritems()} + rmap = {v:k for k, v in iteritems(self.object_map)} for p in self.namespace.descendants(doc, 'w:p', 'w:bookmarkStart[@w:name]'): if p.tag.endswith('}p'): if current_bm and p in rmap: para = rmap[p] if 'id' not in para.attrib: - para.set('id', generate_anchor(next(iter(current_bm)), frozenset(self.anchor_map.itervalues()))) + para.set('id', generate_anchor(next(iter(current_bm)), frozenset(itervalues(self.anchor_map)))) for name in current_bm: self.anchor_map[name] = para.get('id') current_bm = set() @@ -469,10 +471,10 @@ class Convert(object): # _GoBack is a special bookmark inserted by Word 2010 for # the return to previous edit feature, we ignore it old_anchor = current_anchor - self.anchor_map[anchor] = current_anchor = generate_anchor(anchor, frozenset(self.anchor_map.itervalues())) + self.anchor_map[anchor] = current_anchor = generate_anchor(anchor, frozenset(itervalues(self.anchor_map))) if old_anchor is not None: # The previous anchor was not applied to any element - for a, t in tuple(self.anchor_map.iteritems()): + for a, t in tuple(iteritems(self.anchor_map)): if t == old_anchor: self.anchor_map[a] = current_anchor elif x.tag.endswith('}hyperlink'): @@ -480,11 +482,11 @@ class Convert(object): elif x.tag.endswith('}instrText') and x.text and x.text.strip().startswith('TOC '): old_anchor = current_anchor anchor = str(uuid.uuid4()) - self.anchor_map[anchor] = current_anchor = generate_anchor('toc', frozenset(self.anchor_map.itervalues())) + self.anchor_map[anchor] = current_anchor = generate_anchor('toc', frozenset(itervalues(self.anchor_map))) self.toc_anchor = current_anchor if old_anchor is not None: # The previous anchor was not applied to any element - for a, t in tuple(self.anchor_map.iteritems()): + for a, t in tuple(iteritems(self.anchor_map)): if t == old_anchor: self.anchor_map[a] = current_anchor if current_anchor is not None: @@ -559,7 +561,7 @@ class Convert(object): def resolve_links(self): self.resolved_link_map = {} - for hyperlink, spans in self.link_map.iteritems(): + for hyperlink, spans in iteritems(self.link_map): relationships_by_id = self.link_source_map[hyperlink] span = spans[0] if len(spans) > 1: @@ -585,7 +587,7 @@ class Convert(object): # hrefs that point nowhere give epubcheck a hernia. The element # should be styled explicitly by Word anyway. # span.set('href', '#') - rmap = {v:k for k, v in self.object_map.iteritems()} + rmap = {v:k for k, v in iteritems(self.object_map)} for hyperlink, runs in self.fields.hyperlink_fields: spans = [rmap[r] for r in runs if r in rmap] if not spans: @@ -744,7 +746,7 @@ class Convert(object): if not self.block_runs: return - rmap = {v:k for k, v in self.object_map.iteritems()} + rmap = {v:k for k, v in iteritems(self.object_map)} for border_style, blocks in self.block_runs: paras = tuple(rmap[p] for p in blocks) for p in paras: diff --git a/src/calibre/ebooks/docx/toc.py b/src/calibre/ebooks/docx/toc.py index 53caff03e9..ec40071980 100644 --- a/src/calibre/ebooks/docx/toc.py +++ b/src/calibre/ebooks/docx/toc.py @@ -13,7 +13,7 @@ from lxml.etree import tostring from calibre.ebooks.metadata.toc import TOC from calibre.ebooks.oeb.polish.toc import elem_to_toc_text -from polyglot.builtins import unicode_type, range +from polyglot.builtins import iteritems, unicode_type, range def from_headings(body, log, namespace): @@ -25,7 +25,7 @@ def from_headings(body, log, namespace): level_prev = {i+1:None for i in range(len(xpaths))} level_prev[0] = tocroot level_item_map = {i+1:frozenset(xp(body)) for i, xp in enumerate(xpaths)} - item_level_map = {e:i for i, elems in level_item_map.iteritems() for e in elems} + item_level_map = {e:i for i, elems in iteritems(level_item_map) for e in elems} idcount = count() diff --git a/src/calibre/ebooks/docx/writer/container.py b/src/calibre/ebooks/docx/writer/container.py index 4d45910bc7..e51faed3fc 100644 --- a/src/calibre/ebooks/docx/writer/container.py +++ b/src/calibre/ebooks/docx/writer/container.py @@ -19,6 +19,7 @@ from calibre.utils.date import utcnow from calibre.utils.localization import canonicalize_lang, lang_as_iso639_1 from calibre.utils.zipfile import ZipFile from calibre.ebooks.pdf.render.common import PAPER_SIZES +from polyglot.builtins import iteritems def xml2str(root, pretty_print=False, with_tail=False): @@ -55,7 +56,7 @@ def create_skeleton(opts, namespaces=None): def w(x): return '{%s}%s' % (namespaces['w'], x) - dn = {k:v for k, v in namespaces.iteritems() if k in {'w', 'r', 'm', 've', 'o', 'wp', 'w10', 'wne', 'a', 'pic'}} + dn = {k:v for k, v in iteritems(namespaces) if k in {'w', 'r', 'm', 've', 'o', 'wp', 'w10', 'wne', 'a', 'pic'}} E = ElementMaker(namespace=dn['w'], nsmap=dn) doc = E.document() body = E.body() @@ -73,7 +74,7 @@ def create_skeleton(opts, namespaces=None): E.docGrid(**{w('linePitch'):"360"}), )) - dn = {k:v for k, v in namespaces.iteritems() if k in tuple('wra') + ('wp',)} + dn = {k:v for k, v in iteritems(namespaces) if k in tuple('wra') + ('wp',)} E = ElementMaker(namespace=dn['w'], nsmap=dn) styles = E.styles( E.docDefaults( @@ -120,12 +121,12 @@ class DocumentRelationships(object): def __init__(self, namespace): self.rmap = {} self.namespace = namespace - for typ, target in { + for typ, target in iteritems({ namespace.names['STYLES']: 'styles.xml', namespace.names['NUMBERING']: 'numbering.xml', namespace.names['WEB_SETTINGS']: 'webSettings.xml', namespace.names['FONTS']: 'fontTable.xml', - }.iteritems(): + }): self.add_relationship(target, typ) def get_relationship_id(self, target, rtype, target_mode=None): @@ -145,7 +146,7 @@ class DocumentRelationships(object): namespaces = self.namespace.namespaces E = ElementMaker(namespace=namespaces['pr'], nsmap={None:namespaces['pr']}) relationships = E.Relationships() - for (target, rtype, target_mode), rid in self.rmap.iteritems(): + for (target, rtype, target_mode), rid in iteritems(self.rmap): r = E.Relationship(Id=rid, Type=rtype, Target=target) if target_mode is not None: r.set('TargetMode', target_mode) @@ -172,7 +173,7 @@ class DOCX(object): def contenttypes(self): E = ElementMaker(namespace=self.namespace.namespaces['ct'], nsmap={None:self.namespace.namespaces['ct']}) types = E.Types() - for partname, mt in { + for partname, mt in iteritems({ "/word/footnotes.xml": "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml", "/word/document.xml": "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", "/word/numbering.xml": "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml", @@ -184,15 +185,15 @@ class DOCX(object): "/word/webSettings.xml": "application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml", "/docProps/core.xml": "application/vnd.openxmlformats-package.core-properties+xml", "/docProps/app.xml": "application/vnd.openxmlformats-officedocument.extended-properties+xml", - }.iteritems(): + }): types.append(E.Override(PartName=partname, ContentType=mt)) added = {'png', 'gif', 'jpeg', 'jpg', 'svg', 'xml'} for ext in added: types.append(E.Default(Extension=ext, ContentType=guess_type('a.'+ext)[0])) - for ext, mt in { + for ext, mt in iteritems({ "rels": "application/vnd.openxmlformats-package.relationships+xml", "odttf": "application/vnd.openxmlformats-officedocument.obfuscatedFont", - }.iteritems(): + }): added.add(ext) types.append(E.Default(Extension=ext, ContentType=mt)) for fname in self.images: @@ -270,9 +271,9 @@ class DOCX(object): zf.writestr('word/fontTable.xml', xml2str(self.font_table)) zf.writestr('word/_rels/document.xml.rels', self.document_relationships.serialize()) zf.writestr('word/_rels/fontTable.xml.rels', xml2str(self.embedded_fonts)) - for fname, data_getter in self.images.iteritems(): + for fname, data_getter in iteritems(self.images): zf.writestr(fname, data_getter()) - for fname, data in self.fonts.iteritems(): + for fname, data in iteritems(self.fonts): zf.writestr(fname, data) diff --git a/src/calibre/ebooks/docx/writer/images.py b/src/calibre/ebooks/docx/writer/images.py index 94d762a4e3..6aa6ff8bbb 100644 --- a/src/calibre/ebooks/docx/writer/images.py +++ b/src/calibre/ebooks/docx/writer/images.py @@ -10,7 +10,7 @@ import os import posixpath from collections import namedtuple from functools import partial -from polyglot.builtins import map +from polyglot.builtins import iteritems, itervalues, map from lxml import etree @@ -131,7 +131,7 @@ class ImagesManager(object): if fake_margins: # DOCX does not support setting margins for inline images, so we # fake it by using effect extents to simulate margins - makeelement(parent, 'wp:effectExtent', **{k[-1].lower():v for k, v in get_image_margins(style).iteritems()}) + makeelement(parent, 'wp:effectExtent', **{k[-1].lower():v for k, v in iteritems(get_image_margins(style))}) else: makeelement(parent, 'wp:effectExtent', l='0', r='0', t='0', b='0') if floating is not None: @@ -175,7 +175,7 @@ class ImagesManager(object): return fname def serialize(self, images_map): - for img in self.images.itervalues(): + for img in itervalues(self.images): images_map['word/' + img.fname] = partial(self.get_data, img.item) def get_data(self, item): diff --git a/src/calibre/ebooks/docx/writer/lists.py b/src/calibre/ebooks/docx/writer/lists.py index c9b0d930b4..e3c0d6eec9 100644 --- a/src/calibre/ebooks/docx/writer/lists.py +++ b/src/calibre/ebooks/docx/writer/lists.py @@ -9,6 +9,8 @@ __copyright__ = '2015, Kovid Goyal ' from collections import defaultdict from operator import attrgetter +from polyglot.builtins import iteritems, itervalues + LIST_STYLES = frozenset( 'disc circle square decimal decimal-leading-zero lower-roman upper-roman' ' lower-greek lower-alpha lower-latin upper-alpha upper-latin hiragana hebrew' @@ -62,7 +64,7 @@ class NumberingDefinition(object): items_for_level = defaultdict(list) container_for_level = {} type_for_level = {} - for ilvl, items in self.level_map.iteritems(): + for ilvl, items in iteritems(self.level_map): for container, list_tag, block, list_type, tag_style in items: items_for_level[ilvl].append(list_tag) container_for_level[ilvl] = container @@ -76,7 +78,7 @@ class NumberingDefinition(object): return hash(self.levels) def link_blocks(self): - for ilvl, items in self.level_map.iteritems(): + for ilvl, items in iteritems(self.level_map): for container, list_tag, block, list_type, tag_style in items: block.numbering_id = (self.num_id + 1, ilvl) @@ -148,16 +150,16 @@ class ListsManager(object): ilvl = len(container_tags) - 1 l.level_map[ilvl].append((container_tags[0], list_tag, block, list_type, tag_style)) - [nd.finalize() for nd in lists.itervalues()] + [nd.finalize() for nd in itervalues(lists)] definitions = {} - for defn in lists.itervalues(): + for defn in itervalues(lists): try: defn = definitions[defn] except KeyError: definitions[defn] = defn defn.num_id = len(definitions) - 1 defn.link_blocks() - self.definitions = sorted(definitions.itervalues(), key=attrgetter('num_id')) + self.definitions = sorted(itervalues(definitions), key=attrgetter('num_id')) def serialize(self, parent): for defn in self.definitions: diff --git a/src/calibre/ebooks/docx/writer/styles.py b/src/calibre/ebooks/docx/writer/styles.py index fd8e4cabc9..f1c918ad6b 100644 --- a/src/calibre/ebooks/docx/writer/styles.py +++ b/src/calibre/ebooks/docx/writer/styles.py @@ -15,7 +15,7 @@ from lxml import etree from calibre.ebooks import parse_css_length from calibre.ebooks.docx.writer.utils import convert_color, int_or_zero from calibre.utils.localization import lang_as_iso639_1 -from polyglot.builtins import unicode_type +from polyglot.builtins import iteritems, iterkeys, unicode_type from tinycss.css21 import CSS21Parser css_parser = CSS21Parser() @@ -158,7 +158,7 @@ class DOCXStyle(object): getattr(self, x) for x in self.ALL_PROPS)) def makeelement(self, parent, name, **attrs): - return parent.makeelement(self.w(name), **{self.w(k):v for k, v in attrs.iteritems()}) + return parent.makeelement(self.w(name), **{self.w(k):v for k, v in iteritems(attrs)}) def __hash__(self): return self._hash @@ -365,7 +365,7 @@ class DescendantTextStyle(object): p = [] def add(name, **props): - p.append((name, frozenset(props.iteritems()))) + p.append((name, frozenset(iteritems(props)))) def vals(attr): return getattr(parent_style, attr), getattr(child_style, attr) @@ -562,7 +562,7 @@ class BlockStyle(DOCXStyle): def serialize_properties(self, pPr, normal_style): makeelement, w = self.makeelement, self.w spacing = makeelement(pPr, 'spacing') - for edge, attr in {'top':'before', 'bottom':'after'}.iteritems(): + for edge, attr in iteritems({'top':'before', 'bottom':'after'}): getter = attrgetter('css_margin_' + edge) css_val, css_unit = parse_css_length(getter(self)) if css_unit in ('em', 'ex'): @@ -696,7 +696,7 @@ class StylesManager(object): counts = Counter() smap = {} - for (bs, rs), blocks in used_pairs.iteritems(): + for (bs, rs), blocks in iteritems(used_pairs): s = CombinedStyle(bs, rs, blocks, self.namespace) smap[(bs, rs)] = s counts[s] += sum(1 for b in blocks if not b.is_empty()) @@ -721,7 +721,7 @@ class StylesManager(object): heading_styles.append(style) style.id = style.name = val style.seq = i - self.combined_styles = sorted(counts.iterkeys(), key=attrgetter('seq')) + self.combined_styles = sorted(iterkeys(counts), key=attrgetter('seq')) [ls.apply() for ls in self.combined_styles] descendant_style_map = {} diff --git a/src/calibre/ebooks/docx/writer/tables.py b/src/calibre/ebooks/docx/writer/tables.py index b0ab81524a..de2d3f8382 100644 --- a/src/calibre/ebooks/docx/writer/tables.py +++ b/src/calibre/ebooks/docx/writer/tables.py @@ -10,7 +10,7 @@ from collections import namedtuple from calibre.ebooks.docx.writer.utils import convert_color from calibre.ebooks.docx.writer.styles import read_css_block_borders as rcbb, border_edges -from polyglot.builtins import range +from polyglot.builtins import iteritems, range class Dummy(object): @@ -125,7 +125,7 @@ class Cell(object): makeelement(tcPr, 'w:shd', w_val="clear", w_color="auto", w_fill=bc) b = makeelement(tcPr, 'w:tcBorders', append=False) - for edge, border in self.borders.iteritems(): + for edge, border in iteritems(self.borders): if border is not None and border.width > 0 and border.style != 'none': makeelement(b, 'w:' + edge, w_val=border.style, w_sz=str(border.width), w_color=border.color) if len(b) > 0: diff --git a/src/calibre/ebooks/epub/cfi/tests.py b/src/calibre/ebooks/epub/cfi/tests.py index 626660bd30..f6a6e2180b 100644 --- a/src/calibre/ebooks/epub/cfi/tests.py +++ b/src/calibre/ebooks/epub/cfi/tests.py @@ -10,7 +10,7 @@ import unittest, numbers from polyglot.builtins import map from calibre.ebooks.epub.cfi.parse import parser, cfi_sort_key, decode_cfi -from polyglot.builtins import unicode_type +from polyglot.builtins import iteritems, unicode_type class Tests(unittest.TestCase): @@ -61,7 +61,7 @@ class Tests(unittest.TestCase): if after is not None: ta['after'] = after if params: - ta['params'] = {unicode_type(k):(v,) if isinstance(v, unicode_type) else v for k, v in params.iteritems()} + ta['params'] = {unicode_type(k):(v,) if isinstance(v, unicode_type) else v for k, v in iteritems(params)} if ta: step['text_assertion'] = ta return ans diff --git a/src/calibre/ebooks/lrf/pylrs/pylrf.py b/src/calibre/ebooks/lrf/pylrs/pylrf.py index d8f8c42ddf..0529482017 100644 --- a/src/calibre/ebooks/lrf/pylrs/pylrf.py +++ b/src/calibre/ebooks/lrf/pylrs/pylrf.py @@ -10,6 +10,7 @@ import codecs import os from pylrfopt import tagListOptimizer +from polyglot.builtins import iteritems PYLRF_VERSION = "1.0" @@ -526,7 +527,7 @@ class LrfObject(object): # belongs somewhere, so here it is. # composites = {} - for name, value in tagDict.iteritems(): + for name, value in iteritems(tagDict): if name == 'rubyAlignAndAdjust': continue if name in { diff --git a/src/calibre/ebooks/metadata/book/base.py b/src/calibre/ebooks/metadata/book/base.py index 00f60a7298..4bb37b6c9b 100644 --- a/src/calibre/ebooks/metadata/book/base.py +++ b/src/calibre/ebooks/metadata/book/base.py @@ -14,7 +14,7 @@ from calibre.ebooks.metadata.book import (SC_COPYABLE_FIELDS, TOP_LEVEL_IDENTIFIERS, ALL_METADATA_FIELDS) from calibre.library.field_metadata import FieldMetadata from calibre.utils.icu import sort_key -from polyglot.builtins import unicode_type +from polyglot.builtins import iteritems, iterkeys, unicode_type # Special sets used to optimize the performance of getting and setting # attributes on Metadata objects @@ -137,7 +137,7 @@ class Metadata(object): return object.__getattribute__(self, field) except AttributeError: pass - if field in _data['user_metadata'].iterkeys(): + if field in iterkeys(_data['user_metadata']): d = _data['user_metadata'][field] val = d['#value#'] if d['datatype'] != 'composite': @@ -180,7 +180,7 @@ class Metadata(object): if val and val.lower() != 'und': langs = [val] _data['languages'] = langs - elif field in _data['user_metadata'].iterkeys(): + elif field in iterkeys(_data['user_metadata']): _data['user_metadata'][field]['#value#'] = val _data['user_metadata'][field]['#extra#'] = extra else: @@ -190,7 +190,7 @@ class Metadata(object): self.__dict__[field] = val def __iter__(self): - return object.__getattribute__(self, '_data').iterkeys() + return iterkeys(object.__getattribute__(self, '_data')) def has_key(self, key): return key in object.__getattribute__(self, '_data') @@ -219,7 +219,7 @@ class Metadata(object): def get_extra(self, field, default=None): _data = object.__getattribute__(self, '_data') - if field in _data['user_metadata'].iterkeys(): + if field in iterkeys(_data['user_metadata']): try: return _data['user_metadata'][field]['#extra#'] except: @@ -255,7 +255,7 @@ class Metadata(object): Set all identifiers. Note that if you previously set ISBN, calling this method will delete it. ''' - cleaned = {ck(k):cv(v) for k, v in identifiers.iteritems() if k and v} + cleaned = {ck(k):cv(v) for k, v in iteritems(identifiers) if k and v} object.__getattribute__(self, '_data')['identifiers'] = cleaned def set_identifier(self, typ, val): @@ -287,14 +287,14 @@ class Metadata(object): ''' return a list of the custom fields in this book ''' - return object.__getattribute__(self, '_data')['user_metadata'].iterkeys() + return iterkeys(object.__getattribute__(self, '_data')['user_metadata']) def all_field_keys(self): ''' All field keys known by this instance, even if their value is None ''' _data = object.__getattribute__(self, '_data') - return frozenset(ALL_METADATA_FIELDS.union(_data['user_metadata'].iterkeys())) + return frozenset(ALL_METADATA_FIELDS.union(iterkeys(_data['user_metadata']))) def metadata_for_field(self, key): ''' @@ -320,7 +320,7 @@ class Metadata(object): v = self.get(attr, None) if v is not None: result[attr] = v - for attr in _data['user_metadata'].iterkeys(): + for attr in iterkeys(_data['user_metadata']): v = self.get(attr, None) if v is not None: result[attr] = v @@ -396,7 +396,7 @@ class Metadata(object): return um = {} - for key, meta in metadata.iteritems(): + for key, meta in iteritems(metadata): m = meta.copy() if '#value#' not in m: if m['datatype'] == 'text' and m['is_multiple']: @@ -576,7 +576,7 @@ class Metadata(object): if callable(getattr(other, 'get_identifiers', None)): d = self.get_identifiers() s = other.get_identifiers() - d.update([v for v in s.iteritems() if v[1] is not None]) + d.update([v for v in iteritems(s) if v[1] is not None]) self.set_identifiers(d) else: # other structure not Metadata. Copy the top-level identifiers @@ -749,7 +749,7 @@ class Metadata(object): fmt('Rights', unicode_type(self.rights)) if self.identifiers: fmt('Identifiers', u', '.join(['%s:%s'%(k, v) for k, v in - self.identifiers.iteritems()])) + iteritems(self.identifiers)])) if self.comments: fmt('Comments', self.comments) diff --git a/src/calibre/ebooks/metadata/book/json_codec.py b/src/calibre/ebooks/metadata/book/json_codec.py index 6d15eb5031..4a411b15a2 100644 --- a/src/calibre/ebooks/metadata/book/json_codec.py +++ b/src/calibre/ebooks/metadata/book/json_codec.py @@ -13,6 +13,7 @@ from calibre.ebooks.metadata.book import SERIALIZABLE_FIELDS from calibre.constants import filesystem_encoding, preferred_encoding from calibre.library.field_metadata import FieldMetadata from calibre import isbytestring +from polyglot.builtins import iteritems, itervalues # Translate datetimes to and from strings. The string form is the datetime in # UTC. The returned date is also UTC @@ -149,7 +150,7 @@ class JsonCodec(object): def encode_metadata_attr(self, book, key): if key == 'user_metadata': meta = book.get_all_user_metadata(make_copy=True) - for fm in meta.itervalues(): + for fm in itervalues(meta): if fm['datatype'] == 'datetime': fm['#value#'] = datetime_to_string(fm['#value#']) encode_is_multiple(fm) @@ -184,7 +185,7 @@ class JsonCodec(object): def raw_to_book(self, json_book, book_class, prefix): try: book = book_class(prefix, json_book.get('lpath', None)) - for key,val in json_book.iteritems(): + for key,val in iteritems(json_book): meta = self.decode_metadata(key, val) if key == 'user_metadata': book.set_all_user_metadata(meta) @@ -201,7 +202,7 @@ class JsonCodec(object): if key == 'classifiers': key = 'identifiers' if key == 'user_metadata': - for fm in value.itervalues(): + for fm in itervalues(value): if fm['datatype'] == 'datetime': fm['#value#'] = string_to_datetime(fm['#value#']) decode_is_multiple(fm) diff --git a/src/calibre/ebooks/metadata/book/serialize.py b/src/calibre/ebooks/metadata/book/serialize.py index e1a7189530..8c741cc70f 100644 --- a/src/calibre/ebooks/metadata/book/serialize.py +++ b/src/calibre/ebooks/metadata/book/serialize.py @@ -10,7 +10,7 @@ from calibre.constants import preferred_encoding from calibre.ebooks.metadata.book import SERIALIZABLE_FIELDS from calibre.ebooks.metadata.book.base import Metadata from calibre.utils.imghdr import what -from polyglot.builtins import unicode_type +from polyglot.builtins import iteritems, unicode_type def ensure_unicode(obj, enc=preferred_encoding): @@ -21,7 +21,7 @@ def ensure_unicode(obj, enc=preferred_encoding): if isinstance(obj, (list, tuple)): return [ensure_unicode(x) for x in obj] if isinstance(obj, dict): - return {ensure_unicode(k): ensure_unicode(v) for k, v in obj.iteritems()} + return {ensure_unicode(k): ensure_unicode(v) for k, v in iteritems(obj)} return obj @@ -63,7 +63,7 @@ def metadata_as_dict(mi, encode_cover_data=False): def metadata_from_dict(src): ans = Metadata('Unknown') - for key, value in src.iteritems(): + for key, value in iteritems(src): if key == 'user_metadata': ans.set_all_user_metadata(value) else: diff --git a/src/calibre/ebooks/metadata/cli.py b/src/calibre/ebooks/metadata/cli.py index 5a7643c946..f6ca8ae1bc 100644 --- a/src/calibre/ebooks/metadata/cli.py +++ b/src/calibre/ebooks/metadata/cli.py @@ -16,7 +16,7 @@ from calibre.ebooks.metadata import string_to_authors, authors_to_sort_string, \ from calibre.ebooks.lrf.meta import LRFMetaFile from calibre import prints from calibre.utils.date import parse_date -from polyglot.builtins import unicode_type +from polyglot.builtins import iteritems, unicode_type USAGE=_('%prog ebook_file [options]\n') + \ _(''' @@ -150,7 +150,7 @@ def do_set_metadata(opts, mi, stream, stream_type): if val: orig = mi.get_identifiers() orig.update(val) - val = {k:v for k, v in orig.iteritems() if k and v} + val = {k:v for k, v in iteritems(orig) if k and v} mi.set_identifiers(val) if getattr(opts, 'cover', None) is not None: diff --git a/src/calibre/ebooks/metadata/html.py b/src/calibre/ebooks/metadata/html.py index 55c3849107..e8428d4393 100644 --- a/src/calibre/ebooks/metadata/html.py +++ b/src/calibre/ebooks/metadata/html.py @@ -16,6 +16,7 @@ from calibre.ebooks.metadata.book.base import Metadata from calibre.ebooks.chardet import xml_to_unicode from calibre import replace_entities, isbytestring from calibre.utils.date import parse_date, is_date_undefined +from polyglot.builtins import iteritems, itervalues def get_metadata(stream): @@ -60,7 +61,7 @@ attr_pat = r'''(?:(?P')|(?P"))(?P(?(sq)[^']+|[^"]+))(?(sq)'|")' def parse_meta_tags(src): rmap = {} - for field, names in META_NAMES.iteritems(): + for field, names in iteritems(META_NAMES): for name in names: rmap[name.lower()] = field all_names = '|'.join(rmap) @@ -89,8 +90,8 @@ def parse_meta_tags(src): def parse_comment_tags(src): - all_names = '|'.join(COMMENT_NAMES.itervalues()) - rmap = {v:k for k, v in COMMENT_NAMES.iteritems()} + all_names = '|'.join(itervalues(COMMENT_NAMES)) + rmap = {v:k for k, v in iteritems(COMMENT_NAMES)} ans = {} for match in re.finditer(r'''" % NavigableString.__str__(self, encoding) - -class Declaration(NavigableString): - def __str__(self, encoding=DEFAULT_OUTPUT_ENCODING): - return "" % NavigableString.__str__(self, encoding) - -class Tag(PageElement): - - """Represents a found HTML tag with its attributes and contents.""" - - def _invert(h): - "Cheap function to invert a hash." - i = {} - for k,v in h.items(): - i[v] = k - return i - - XML_ENTITIES_TO_SPECIAL_CHARS = { "apos" : "'", - "quot" : '"', - "amp" : "&", - "lt" : "<", - "gt" : ">" } - - XML_SPECIAL_CHARS_TO_ENTITIES = _invert(XML_ENTITIES_TO_SPECIAL_CHARS) - - def _convertEntities(self, match): - """Used in a call to re.sub to replace HTML, XML, and numeric - entities with the appropriate Unicode characters. If HTML - entities are being converted, any unrecognized entities are - escaped.""" - x = match.group(1) - if self.convertHTMLEntities and x in name2codepoint: - return codepoint_to_chr(name2codepoint[x]) - elif x in self.XML_ENTITIES_TO_SPECIAL_CHARS: - if self.convertXMLEntities: - return self.XML_ENTITIES_TO_SPECIAL_CHARS[x] - else: - return u'&%s;' % x - elif len(x) > 0 and x[0] == '#': - # Handle numeric entities - if len(x) > 1 and x[1] == 'x': - return codepoint_to_chr(int(x[2:], 16)) - else: - return codepoint_to_chr(int(x[1:])) - - elif self.escapeUnrecognizedEntities: - return u'&%s;' % x - else: - return u'&%s;' % x - - def __init__(self, parser, name, attrs=None, parent=None, - previous=None): - "Basic constructor." - - # We don't actually store the parser object: that lets extracted - # chunks be garbage-collected - self.parserClass = parser.__class__ - self.isSelfClosing = parser.isSelfClosingTag(name) - self.name = name - if attrs == None: - attrs = [] - self.attrs = attrs - self.contents = [] - self.setup(parent, previous) - self.hidden = False - self.containsSubstitutions = False - self.convertHTMLEntities = parser.convertHTMLEntities - self.convertXMLEntities = parser.convertXMLEntities - self.escapeUnrecognizedEntities = parser.escapeUnrecognizedEntities - - # Convert any HTML, XML, or numeric entities in the attribute values. - convert = lambda k_val: (k_val[0], - re.sub("&(#\d+|#x[0-9a-fA-F]+|\w+);", - self._convertEntities, - k_val[1])) - self.attrs = map(convert, self.attrs) - - def get(self, key, default=None): - """Returns the value of the 'key' attribute for the tag, or - the value given for 'default' if it doesn't have that - attribute.""" - return self._getAttrMap().get(key, default) - - def has_key(self, key): - return self._getAttrMap().has_key(key) - - def __getitem__(self, key): - """tag[key] returns the value of the 'key' attribute for the tag, - and throws an exception if it's not there.""" - return self._getAttrMap()[key] - - def __iter__(self): - "Iterating over a tag iterates over its contents." - return iter(self.contents) - - def __len__(self): - "The length of a tag is the length of its list of contents." - return len(self.contents) - - def __contains__(self, x): - return x in self.contents - - def __nonzero__(self): - "A tag is non-None even if it has no contents." - return True - - def __setitem__(self, key, value): - """Setting tag[key] sets the value of the 'key' attribute for the - tag.""" - self._getAttrMap() - self.attrMap[key] = value - found = False - for i in range(0, len(self.attrs)): - if self.attrs[i][0] == key: - self.attrs[i] = (key, value) - found = True - if not found: - self.attrs.append((key, value)) - self._getAttrMap()[key] = value - - def __delitem__(self, key): - "Deleting tag[key] deletes all 'key' attributes for the tag." - for item in self.attrs: - if item[0] == key: - self.attrs.remove(item) - #We don't break because bad HTML can define the same - #attribute multiple times. - self._getAttrMap() - if self.attrMap.has_key(key): - del self.attrMap[key] - - def __call__(self, *args, **kwargs): - """Calling a tag like a function is the same as calling its - findAll() method. Eg. tag('a') returns a list of all the A tags - found within this tag.""" - return apply(self.findAll, args, kwargs) - - def __getattr__(self, tag): - #print "Getattr %s.%s" % (self.__class__, tag) - if len(tag) > 3 and tag.rfind('Tag') == len(tag)-3: - return self.find(tag[:-3]) - elif tag.find('__') != 0: - return self.find(tag) - raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__, tag)) - - def __eq__(self, other): - """Returns true iff this tag has the same name, the same attributes, - and the same contents (recursively) as the given tag. - - NOTE: right now this will return false if two tags have the - same attributes in a different order. Should this be fixed?""" - if not hasattr(other, 'name') or not hasattr(other, 'attrs') or not hasattr(other, 'contents') or self.name != other.name or self.attrs != other.attrs or len(self) != len(other): - return False - for i in range(0, len(self.contents)): - if self.contents[i] != other.contents[i]: - return False - return True - - def __ne__(self, other): - """Returns true iff this tag is not identical to the other tag, - as defined in __eq__.""" - return not self == other - - def __repr__(self, encoding=DEFAULT_OUTPUT_ENCODING): - """Renders this tag as a string.""" - return self.__str__(encoding) - - def __unicode__(self): - return self.__str__(None) - - def __str__(self, encoding=DEFAULT_OUTPUT_ENCODING, - prettyPrint=False, indentLevel=0): - """Returns a string or Unicode representation of this tag and - its contents. To get Unicode, pass None for encoding. - - NOTE: since Python's HTML parser consumes whitespace, this - method is not certain to reproduce the whitespace present in - the original string.""" - - encodedName = self.toEncoding(self.name, encoding) - - attrs = [] - if self.attrs: - for key, val in self.attrs: - fmt = '%s="%s"' - if isString(val): - if self.containsSubstitutions and '%SOUP-ENCODING%' in val: - val = self.substituteEncoding(val, encoding) - - # The attribute value either: - # - # * Contains no embedded double quotes or single quotes. - # No problem: we enclose it in double quotes. - # * Contains embedded single quotes. No problem: - # double quotes work here too. - # * Contains embedded double quotes. No problem: - # we enclose it in single quotes. - # * Embeds both single _and_ double quotes. This - # can't happen naturally, but it can happen if - # you modify an attribute value after parsing - # the document. Now we have a bit of a - # problem. We solve it by enclosing the - # attribute in single quotes, and escaping any - # embedded single quotes to XML entities. - if '"' in val: - fmt = "%s='%s'" - if "'" in val: - # TODO: replace with apos when - # appropriate. - val = val.replace("'", "&squot;") - - # Now we're okay w/r/t quotes. But the attribute - # value might also contain angle brackets, or - # ampersands that aren't part of entities. We need - # to escape those to XML entities too. - val = self.BARE_AMPERSAND_OR_BRACKET.sub(self._sub_entity, val) - - attrs.append(fmt % (self.toEncoding(key, encoding), - self.toEncoding(val, encoding))) - close = '' - closeTag = '' - if self.isSelfClosing: - close = ' /' - else: - closeTag = '' % encodedName - - indentTag, indentContents = 0, 0 - if prettyPrint: - indentTag = indentLevel - space = (' ' * (indentTag-1)) - indentContents = indentTag + 1 - contents = self.renderContents(encoding, prettyPrint, indentContents) - if self.hidden: - s = contents - else: - s = [] - attributeString = '' - if attrs: - attributeString = ' ' + ' '.join(attrs) - if prettyPrint: - s.append(space) - s.append('<%s%s%s>' % (encodedName, attributeString, close)) - if prettyPrint: - s.append("\n") - s.append(contents) - if prettyPrint and contents and contents[-1] != "\n": - s.append("\n") - if prettyPrint and closeTag: - s.append(space) - s.append(closeTag) - if prettyPrint and closeTag and self.nextSibling: - s.append("\n") - s = ''.join(s) - return s - - def prettify(self, encoding=DEFAULT_OUTPUT_ENCODING): - return self.__str__(encoding, True) - - def renderContents(self, encoding=DEFAULT_OUTPUT_ENCODING, - prettyPrint=False, indentLevel=0): - """Renders the contents of this tag as a string in the given - encoding. If encoding is None, returns a Unicode string..""" - s=[] - for c in self: - text = None - if isinstance(c, NavigableString): - text = c.__str__(encoding) - elif isinstance(c, Tag): - s.append(c.__str__(encoding, prettyPrint, indentLevel)) - if text and prettyPrint: - text = text.strip() - if text: - if prettyPrint: - s.append(" " * (indentLevel-1)) - s.append(text) - if prettyPrint: - s.append("\n") - return ''.join(s) - - #Soup methods - - def find(self, name=None, attrs={}, recursive=True, text=None, - **kwargs): - """Return only the first child of this Tag matching the given - criteria.""" - r = None - l = self.findAll(name, attrs, recursive, text, 1, **kwargs) - if l: - r = l[0] - return r - findChild = find - - def findAll(self, name=None, attrs={}, recursive=True, text=None, - limit=None, **kwargs): - """Extracts a list of Tag objects that match the given - criteria. You can specify the name of the Tag and any - attributes you want the Tag to have. - - The value of a key-value pair in the 'attrs' map can be a - string, a list of strings, a regular expression object, or a - callable that takes a string and returns whether or not the - string matches for some custom definition of 'matches'. The - same is true of the tag name.""" - generator = self.recursiveChildGenerator - if not recursive: - generator = self.childGenerator - return self._findAll(name, attrs, text, limit, generator, **kwargs) - findChildren = findAll - - # Pre-3.x compatibility methods - first = find - fetch = findAll - - def fetchText(self, text=None, recursive=True, limit=None): - return self.findAll(text=text, recursive=recursive, limit=limit) - - def firstText(self, text=None, recursive=True): - return self.find(text=text, recursive=recursive) - - #Private methods - - def _getAttrMap(self): - """Initializes a map representation of this tag's attributes, - if not already initialized.""" - if not getattr(self, 'attrMap'): - self.attrMap = {} - for (key, value) in self.attrs: - self.attrMap[key] = value - return self.attrMap - - #Generator methods - def childGenerator(self): - for i in range(0, len(self.contents)): - yield self.contents[i] - raise StopIteration - - def recursiveChildGenerator(self): - stack = [(self, 0)] - while stack: - tag, start = stack.pop() - if isinstance(tag, Tag): - for i in range(start, len(tag.contents)): - a = tag.contents[i] - yield a - if isinstance(a, Tag) and tag.contents: - if i < len(tag.contents) - 1: - stack.append((tag, i+1)) - stack.append((a, 0)) - break - raise StopIteration - -# Next, a couple classes to represent queries and their results. -class SoupStrainer: - """Encapsulates a number of ways of matching a markup element (tag or - text).""" - - def __init__(self, name=None, attrs={}, text=None, **kwargs): - self.name = name - if isString(attrs): - kwargs['class'] = attrs - attrs = None - if kwargs: - if attrs: - attrs = attrs.copy() - attrs.update(kwargs) - else: - attrs = kwargs - self.attrs = attrs - self.text = text - - def __str__(self): - if self.text: - return self.text - else: - return "%s|%s" % (self.name, self.attrs) - - def searchTag(self, markupName=None, markupAttrs={}): - found = None - markup = None - if isinstance(markupName, Tag): - markup = markupName - markupAttrs = markup - callFunctionWithTagData = callable(self.name) \ - and not isinstance(markupName, Tag) - - if (not self.name) \ - or callFunctionWithTagData \ - or (markup and self._matches(markup, self.name)) \ - or (not markup and self._matches(markupName, self.name)): - if callFunctionWithTagData: - match = self.name(markupName, markupAttrs) - else: - match = True - markupAttrMap = None - for attr, matchAgainst in self.attrs.items(): - if not markupAttrMap: - if hasattr(markupAttrs, 'get'): - markupAttrMap = markupAttrs - else: - markupAttrMap = {} - for k,v in markupAttrs: - markupAttrMap[k] = v - attrValue = markupAttrMap.get(attr) - if not self._matches(attrValue, matchAgainst): - match = False - break - if match: - if markup: - found = markup - else: - found = markupName - return found - - def search(self, markup): - #print 'looking for %s in %s' % (self, markup) - found = None - # If given a list of items, scan it for a text element that - # matches. - if isList(markup) and not isinstance(markup, Tag): - for element in markup: - if isinstance(element, NavigableString) \ - and self.search(element): - found = element - break - # If it's a Tag, make sure its name or attributes match. - # Don't bother with Tags if we're searching for text. - elif isinstance(markup, Tag): - if not self.text: - found = self.searchTag(markup) - # If it's text, make sure the text matches. - elif isinstance(markup, NavigableString) or \ - isString(markup): - if self._matches(markup, self.text): - found = markup - else: - raise Exception("I don't know how to match against a %s" \ - % markup.__class__) - return found - - def _matches(self, markup, matchAgainst): - #print "Matching %s against %s" % (markup, matchAgainst) - result = False - if matchAgainst == True and type(matchAgainst) == types.BooleanType: - result = markup != None - elif callable(matchAgainst): - result = matchAgainst(markup) - else: - #Custom match methods take the tag as an argument, but all - #other ways of matching match the tag name as a string. - if isinstance(markup, Tag): - markup = markup.name - if markup and not isString(markup): - markup = unicode_type(markup) - #Now we know that chunk is either a string, or None. - if hasattr(matchAgainst, 'match'): - # It's a regexp object. - result = markup and matchAgainst.search(markup) - elif isList(matchAgainst): - result = markup in matchAgainst - elif hasattr(matchAgainst, 'items'): - result = markup.has_key(matchAgainst) - elif matchAgainst and isString(markup): - if isinstance(markup, unicode_type): - matchAgainst = unicode_type(matchAgainst) - else: - matchAgainst = str(matchAgainst) - - if not result: - result = matchAgainst == markup - return result - -class ResultSet(list): - """A ResultSet is just a list that keeps track of the SoupStrainer - that created it.""" - def __init__(self, source): - list.__init__([]) - self.source = source - -# Now, some helper functions. - -def isList(l): - """Convenience method that works with all 2.x versions of Python - to determine whether or not something is listlike.""" - return hasattr(l, '__iter__') \ - or (type(l) in (types.ListType, types.TupleType)) - -def isString(s): - """Convenience method that works with all 2.x versions of Python - to determine whether or not something is stringlike.""" - try: - return isinstance(s, unicode_type) or isinstance(s, string_or_bytes) - except NameError: - return isinstance(s, str) - -def buildTagMap(default, *args): - """Turns a list of maps, lists, or scalars into a single map. - Used to build the SELF_CLOSING_TAGS, NESTABLE_TAGS, and - NESTING_RESET_TAGS maps out of lists and partial maps.""" - built = {} - for portion in args: - if hasattr(portion, 'items'): - #It's a map. Merge it. - for k,v in portion.items(): - built[k] = v - elif isList(portion): - #It's a list. Map each item to the default. - for k in portion: - built[k] = default - else: - #It's a scalar. Map it to the default. - built[portion] = default - return built - -# Now, the parser classes. - -class BeautifulStoneSoup(Tag, SGMLParser): - - """This class contains the basic parser and search code. It defines - a parser that knows nothing about tag behavior except for the - following: - - You can't close a tag without closing all the tags it encloses. - That is, "" actually means - "". - - [Another possible explanation is "", but since - this class defines no SELF_CLOSING_TAGS, it will never use that - explanation.] - - This class is useful for parsing XML or made-up markup languages, - or when BeautifulSoup makes an assumption counter to what you were - expecting.""" - - SELF_CLOSING_TAGS = {} - NESTABLE_TAGS = {} - RESET_NESTING_TAGS = {} - QUOTE_TAGS = {} - PRESERVE_WHITESPACE_TAGS = frozenset() - - MARKUP_MASSAGE = [(re.compile('(<[^<>]*)/>'), - lambda x: x.group(1) + ' />'), - (re.compile(']*)>'), - lambda x: '') - ] - - ROOT_TAG_NAME = u'[document]' - - HTML_ENTITIES = "html" - XML_ENTITIES = "xml" - XHTML_ENTITIES = "xhtml" - # TODO: This only exists for backwards-compatibility - ALL_ENTITIES = XHTML_ENTITIES - - # Used when determining whether a text node is all whitespace and - # can be replaced with a single space. A text node that contains - # fancy Unicode spaces (usually non-breaking) should be left - # alone. - STRIP_ASCII_SPACES = { 9: None, 10: None, 12: None, 13: None, 32: None, } - - def __init__(self, markup="", parseOnlyThese=None, fromEncoding=None, - markupMassage=True, smartQuotesTo=XML_ENTITIES, - convertEntities=None, selfClosingTags=None): - """The Soup object is initialized as the 'root tag', and the - provided markup (which can be a string or a file-like object) - is fed into the underlying parser. - - sgmllib will process most bad HTML, and the BeautifulSoup - class has some tricks for dealing with some HTML that kills - sgmllib, but Beautiful Soup can nonetheless choke or lose data - if your data uses self-closing tags or declarations - incorrectly. - - By default, Beautiful Soup uses regexes to sanitize input, - avoiding the vast majority of these problems. If the problems - don't apply to you, pass in False for markupMassage, and - you'll get better performance. - - The default parser massage techniques fix the two most common - instances of invalid HTML that choke sgmllib: - -
    (No space between name of closing tag and tag close) - (Extraneous whitespace in declaration) - - You can pass in a custom list of (RE object, replace method) - tuples to get Beautiful Soup to scrub your input the way you - want.""" - - self.parseOnlyThese = parseOnlyThese - self.fromEncoding = fromEncoding - self.smartQuotesTo = smartQuotesTo - self.convertEntities = convertEntities - # Set the rules for how we'll deal with the entities we - # encounter - if self.convertEntities: - # It doesn't make sense to convert encoded characters to - # entities even while you're converting entities to Unicode. - # Just convert it all to Unicode. - self.smartQuotesTo = None - if convertEntities == self.HTML_ENTITIES: - self.convertXMLEntities = False - self.convertHTMLEntities = True - self.escapeUnrecognizedEntities = True - elif convertEntities == self.XHTML_ENTITIES: - self.convertXMLEntities = True - self.convertHTMLEntities = True - self.escapeUnrecognizedEntities = False - elif convertEntities == self.XML_ENTITIES: - self.convertXMLEntities = True - self.convertHTMLEntities = False - self.escapeUnrecognizedEntities = False - else: - self.convertXMLEntities = False - self.convertHTMLEntities = False - self.escapeUnrecognizedEntities = False - - self.instanceSelfClosingTags = buildTagMap(None, selfClosingTags) - SGMLParser.__init__(self) - - if hasattr(markup, 'read'): # It's a file-type object. - markup = markup.read() - self.markup = markup - self.markupMassage = markupMassage - try: - self._feed() - except StopParsing: - pass - self.markup = None # The markup can now be GCed - - def convert_charref(self, name): - """This method fixes a bug in Python's SGMLParser.""" - try: - n = int(name) - except ValueError: - return - if not 0 <= n <= 127 : # ASCII ends at 127, not 255 - return - return self.convert_codepoint(n) - - def _feed(self, inDocumentEncoding=None): - # Convert the document to Unicode. - markup = self.markup - if isinstance(markup, unicode_type): - if not hasattr(self, 'originalEncoding'): - self.originalEncoding = None - else: - # Changed detection by Kovid - markup, self.originalEncoding = chardet.xml_to_unicode(markup) - if markup: - if self.markupMassage: - if not isList(self.markupMassage): - self.markupMassage = self.MARKUP_MASSAGE - for fix, m in self.markupMassage: - markup = fix.sub(m, markup) - # TODO: We get rid of markupMassage so that the - # soup object can be deepcopied later on. Some - # Python installations can't copy regexes. If anyone - # was relying on the existence of markupMassage, this - # might cause problems. - del(self.markupMassage) - self.markup = markup - self.reset() - - SGMLParser.feed(self, markup) - # Close out any unfinished strings and close all the open tags. - self.endData() - while self.currentTag.name != self.ROOT_TAG_NAME: - self.popTag() - - def __getattr__(self, methodName): - """This method routes method call requests to either the SGMLParser - superclass or the Tag superclass, depending on the method name.""" - #print "__getattr__ called on %s.%s" % (self.__class__, methodName) - - if methodName.find('start_') == 0 or methodName.find('end_') == 0 \ - or methodName.find('do_') == 0: - return SGMLParser.__getattr__(self, methodName) - elif methodName.find('__') != 0: - return Tag.__getattr__(self, methodName) - else: - raise AttributeError - - def isSelfClosingTag(self, name): - """Returns true iff the given string is the name of a - self-closing tag according to this parser.""" - return self.SELF_CLOSING_TAGS.has_key(name) \ - or self.instanceSelfClosingTags.has_key(name) - - def reset(self): - Tag.__init__(self, self, self.ROOT_TAG_NAME) - self.hidden = 1 - SGMLParser.reset(self) - self.currentData = [] - self.currentTag = None - self.tagStack = [] - self.quoteStack = [] - self.pushTag(self) - - def popTag(self): - self.tagStack.pop() - # Tags with just one string-owning child get the child as a - # 'string' property, so that soup.tag.string is shorthand for - # soup.tag.contents[0] - if len(self.currentTag.contents) == 1 and \ - isinstance(self.currentTag.contents[0], NavigableString): - self.currentTag.string = self.currentTag.contents[0] - - #print "Pop", tag.name - if self.tagStack: - self.currentTag = self.tagStack[-1] - return self.currentTag - - def pushTag(self, tag): - #print "Push", tag.name - if self.currentTag: - self.currentTag.contents.append(tag) - self.tagStack.append(tag) - self.currentTag = self.tagStack[-1] - - def endData(self, containerClass=NavigableString): - if self.currentData: - currentData = ''.join(self.currentData) - # Changed by Kovid to not clobber whitespace inside
     tags and the like
    -            if ( (not currentData.translate(self.STRIP_ASCII_SPACES)) and (
    -                    not frozenset(tag.name for tag in self.tagStack).intersection(
    -                        self.PRESERVE_WHITESPACE_TAGS))):
    -                if '\n' in currentData:
    -                    currentData = '\n'
    -                else:
    -                    currentData = ' '
    -            self.currentData = []
    -            if self.parseOnlyThese and len(self.tagStack) <= 1 and \
    -                   (not self.parseOnlyThese.text or \
    -                    not self.parseOnlyThese.search(currentData)):
    -                return
    -            o = containerClass(currentData)
    -            o.setup(self.currentTag, self.previous)
    -            if self.previous:
    -                self.previous.next = o
    -            self.previous = o
    -            self.currentTag.contents.append(o)
    -
    -
    -    def _popToTag(self, name, inclusivePop=True):
    -        """Pops the tag stack up to and including the most recent
    -        instance of the given tag. If inclusivePop is false, pops the tag
    -        stack up to but *not* including the most recent instqance of
    -        the given tag."""
    -        #print "Popping to %s" % name
    -        if name == self.ROOT_TAG_NAME:
    -            return
    -
    -        numPops = 0
    -        mostRecentTag = None
    -        for i in range(len(self.tagStack)-1, 0, -1):
    -            if name == self.tagStack[i].name:
    -                numPops = len(self.tagStack)-i
    -                break
    -        if not inclusivePop:
    -            numPops = numPops - 1
    -
    -        for i in range(0, numPops):
    -            mostRecentTag = self.popTag()
    -        return mostRecentTag
    -
    -    def _smartPop(self, name):
    -
    -        """We need to pop up to the previous tag of this type, unless
    -        one of this tag's nesting reset triggers comes between this
    -        tag and the previous tag of this type, OR unless this tag is a
    -        generic nesting trigger and another generic nesting trigger
    -        comes between this tag and the previous tag of this type.
    -
    -        Examples:
    -         

    FooBar *

    * should pop to 'p', not 'b'. -

    FooBar *

    * should pop to 'table', not 'p'. -

    Foo

    Bar *

    * should pop to 'tr', not 'p'. - -

    • *
    • * should pop to 'ul', not the first 'li'. -
  2. ** should pop to 'table', not the first 'tr' - tag should - implicitly close the previous tag within the same
    ** should pop to 'tr', not the first 'td' - """ - - nestingResetTriggers = self.NESTABLE_TAGS.get(name) - isNestable = nestingResetTriggers != None - isResetNesting = self.RESET_NESTING_TAGS.has_key(name) - popTo = None - inclusive = True - for i in range(len(self.tagStack)-1, 0, -1): - p = self.tagStack[i] - if (not p or p.name == name) and not isNestable: - #Non-nestable tags get popped to the top or to their - #last occurance. - popTo = name - break - if (nestingResetTriggers != None - and p.name in nestingResetTriggers) \ - or (nestingResetTriggers == None and isResetNesting - and self.RESET_NESTING_TAGS.has_key(p.name)): - - #If we encounter one of the nesting reset triggers - #peculiar to this tag, or we encounter another tag - #that causes nesting to reset, pop up to but not - #including that tag. - popTo = p.name - inclusive = False - break - p = p.parent - if popTo: - self._popToTag(popTo, inclusive) - - def unknown_starttag(self, name, attrs, selfClosing=0): - #print "Start tag %s: %s" % (name, attrs) - if self.quoteStack: - #This is not a real tag. - #print "<%s> is not real!" % name - attrs = ''.join(map(lambda x_y: ' %s="%s"' % (x_y[0], x_y[1]), attrs)) - self.handle_data('<%s%s>' % (name, attrs)) - return - self.endData() - - if not self.isSelfClosingTag(name) and not selfClosing: - self._smartPop(name) - - if self.parseOnlyThese and len(self.tagStack) <= 1 \ - and (self.parseOnlyThese.text or not self.parseOnlyThese.searchTag(name, attrs)): - return - - tag = Tag(self, name, attrs, self.currentTag, self.previous) - if self.previous: - self.previous.next = tag - self.previous = tag - self.pushTag(tag) - if selfClosing or self.isSelfClosingTag(name): - self.popTag() - if name in self.QUOTE_TAGS: - #print "Beginning quote (%s)" % name - self.quoteStack.append(name) - self.literal = 1 - return tag - - def unknown_endtag(self, name): - #print "End tag %s" % name - if self.quoteStack and self.quoteStack[-1] != name: - #This is not a real end tag. - #print " is not real!" % name - self.handle_data('' % name) - return - self.endData() - self._popToTag(name) - if self.quoteStack and self.quoteStack[-1] == name: - self.quoteStack.pop() - self.literal = (len(self.quoteStack) > 0) - - def handle_data(self, data): - self.currentData.append(data) - - def _toStringSubclass(self, text, subclass): - """Adds a certain piece of text to the tree as a NavigableString - subclass.""" - self.endData() - self.handle_data(text) - self.endData(subclass) - - def handle_pi(self, text): - """Handle a processing instruction as a ProcessingInstruction - object, possibly one with a %SOUP-ENCODING% slot into which an - encoding will be plugged later.""" - if text[:3] == "xml": - text = u"xml version='1.0' encoding='%SOUP-ENCODING%'" - self._toStringSubclass(text, ProcessingInstruction) - - def handle_comment(self, text): - "Handle comments as Comment objects." - self._toStringSubclass(text, Comment) - - def handle_charref(self, ref): - "Handle character references as data." - if self.convertEntities: - if ref.lower().startswith('x'): # - ref = int(ref[1:], 16) # Added by Kovid to handle hex numeric entities - try: - data = codepoint_to_chr(int(ref)) - except ValueError: # Bad numerical entity. Added by Kovid - data = u'' - else: - data = '&#%s;' % ref - self.handle_data(data) - - def handle_entityref(self, ref): - """Handle entity references as data, possibly converting known - HTML and/or XML entity references to the corresponding Unicode - characters.""" - data = None - if self.convertHTMLEntities: - try: - data = codepoint_to_chr(name2codepoint[ref]) - except KeyError: - pass - - if not data and self.convertXMLEntities: - data = self.XML_ENTITIES_TO_SPECIAL_CHARS.get(ref) - - if not data and self.convertHTMLEntities and \ - not self.XML_ENTITIES_TO_SPECIAL_CHARS.get(ref): - # TODO: We've got a problem here. We're told this is - # an entity reference, but it's not an XML entity - # reference or an HTML entity reference. Nonetheless, - # the logical thing to do is to pass it through as an - # unrecognized entity reference. - # - # Except: when the input is "&carol;" this function - # will be called with input "carol". When the input is - # "AT&T", this function will be called with input - # "T". We have no way of knowing whether a semicolon - # was present originally, so we don't know whether - # this is an unknown entity or just a misplaced - # ampersand. - # - # The more common case is a misplaced ampersand, so I - # escape the ampersand and omit the trailing semicolon. - data = "&%s" % ref - if not data: - # This case is different from the one above, because we - # haven't already gone through a supposedly comprehensive - # mapping of entities to Unicode characters. We might not - # have gone through any mapping at all. So the chances are - # very high that this is a real entity, and not a - # misplaced ampersand. - data = "&%s;" % ref - self.handle_data(data) - - def handle_decl(self, data): - "Handle DOCTYPEs and the like as Declaration objects." - self._toStringSubclass(data, Declaration) - - def parse_declaration(self, i): - """Treat a bogus SGML declaration as raw data. Treat a CDATA - declaration as a CData object.""" - j = None - if self.rawdata[i:i+9] == '', i) - if k == -1: - k = len(self.rawdata) - data = self.rawdata[i+9:k] - j = k+3 - self._toStringSubclass(data, CData) - else: - try: - j = SGMLParser.parse_declaration(self, i) - except SGMLParseError: - toHandle = self.rawdata[i:] - self.handle_data(toHandle) - j = i + len(toHandle) - return j - -class BeautifulSoup(BeautifulStoneSoup): - - """This parser knows the following facts about HTML: - - * Some tags have no closing tag and should be interpreted as being - closed as soon as they are encountered. - - * The text inside some tags (ie. 'script') may contain tags which - are not really part of the document and which should be parsed - as text, not tags. If you want to parse the text as tags, you can - always fetch it and parse it explicitly. - - * Tag nesting rules: - - Most tags can't be nested at all. For instance, the occurance of - a

    tag should implicitly close the previous

    tag. - -

    Para1

    Para2 - should be transformed into: -

    Para1

    Para2 - - Some tags can be nested arbitrarily. For instance, the occurance - of a

    tag should _not_ implicitly close the previous -
    tag. - - Alice said:
    Bob said:
    Blah - should NOT be transformed into: - Alice said:
    Bob said:
    Blah - - Some tags can be nested, but the nesting is reset by the - interposition of other tags. For instance, a
    , - but not close a tag in another table. - -
    BlahBlah - should be transformed into: -
    BlahBlah - but, - Blah
    Blah - should NOT be transformed into - Blah
    Blah - - Differing assumptions about tag nesting rules are a major source - of problems with the BeautifulSoup class. If BeautifulSoup is not - treating as nestable a tag your page author treats as nestable, - try ICantBelieveItsBeautifulSoup, MinimalSoup, or - BeautifulStoneSoup before writing your own subclass.""" - - def __init__(self, *args, **kwargs): - if not kwargs.has_key('smartQuotesTo'): - kwargs['smartQuotesTo'] = self.HTML_ENTITIES - BeautifulStoneSoup.__init__(self, *args, **kwargs) - - SELF_CLOSING_TAGS = buildTagMap(None, - ['br' , 'hr', 'input', 'img', 'meta', - 'spacer', 'link', 'frame', 'base']) - - PRESERVE_WHITESPACE_TAGS = frozenset(('pre', 'textarea')) - - QUOTE_TAGS = {'script' : None, 'textarea' : None} - - #According to the HTML standard, each of these inline tags can - #contain another tag of the same type. Furthermore, it's common - #to actually use these tags this way. - NESTABLE_INLINE_TAGS = ['span', 'font', 'q', 'object', 'bdo', 'sub', 'sup', - 'center'] - - #According to the HTML standard, these block tags can contain - #another tag of the same type. Furthermore, it's common - #to actually use these tags this way. - # Changed by Kovid: Added HTML 5 block tags - NESTABLE_BLOCK_TAGS = ['blockquote', 'div', 'fieldset', 'ins', 'del', - 'article', 'aside', 'header', 'footer', 'nav', 'figcaption', 'figure', 'section'] - - #Lists can contain other lists, but there are restrictions. - NESTABLE_LIST_TAGS = { 'ol' : [], - 'ul' : [], - 'li' : ['ul', 'ol'], - 'dl' : [], - 'dd' : ['dl'], - 'dt' : ['dl'] } - - #Tables can contain other tables, but there are restrictions. - NESTABLE_TABLE_TAGS = {'table' : [], - 'tr' : ['table', 'tbody', 'tfoot', 'thead'], - 'td' : ['tr'], - 'th' : ['tr'], - 'thead' : ['table'], - 'tbody' : ['table'], - 'tfoot' : ['table'], - } - - NON_NESTABLE_BLOCK_TAGS = ['address', 'form', 'p', 'pre'] - - #If one of these tags is encountered, all tags up to the next tag of - #this type are popped. - RESET_NESTING_TAGS = buildTagMap(None, NESTABLE_BLOCK_TAGS, 'noscript', - NON_NESTABLE_BLOCK_TAGS, - NESTABLE_LIST_TAGS, - NESTABLE_TABLE_TAGS) - - NESTABLE_TAGS = buildTagMap([], NESTABLE_INLINE_TAGS, NESTABLE_BLOCK_TAGS, - NESTABLE_LIST_TAGS, NESTABLE_TABLE_TAGS) - - # Used to detect the charset in a META tag; see start_meta - CHARSET_RE = re.compile("((^|;)\s*charset=)([^;]*)") - - def start_meta(self, attrs): - """Beautiful Soup can detect a charset included in a META tag, - try to convert the document to that charset, and re-parse the - document from the beginning.""" - httpEquiv = None - contentType = None - contentTypeIndex = None - tagNeedsEncodingSubstitution = False - - for i in range(0, len(attrs)): - key, value = attrs[i] - key = key.lower() - if key == 'http-equiv': - httpEquiv = value - elif key == 'content': - contentType = value - contentTypeIndex = i - - if httpEquiv and contentType: # It's an interesting meta tag. - match = self.CHARSET_RE.search(contentType) - if match: - if getattr(self, 'declaredHTMLEncoding') or \ - (self.originalEncoding == self.fromEncoding): - # This is our second pass through the document, or - # else an encoding was specified explicitly and it - # worked. Rewrite the meta tag. - newAttr = self.CHARSET_RE.sub\ - (lambda match:match.group(1) + - "%SOUP-ENCODING%", value) - attrs[contentTypeIndex] = (attrs[contentTypeIndex][0], - newAttr) - tagNeedsEncodingSubstitution = True - else: - # This is our first pass through the document. - # Go through it again with the new information. - newCharset = match.group(3) - if newCharset and newCharset != self.originalEncoding: - self.declaredHTMLEncoding = newCharset - self._feed(self.declaredHTMLEncoding) - raise StopParsing - tag = self.unknown_starttag("meta", attrs) - if tag and tagNeedsEncodingSubstitution: - tag.containsSubstitutions = True - -class StopParsing(Exception): - pass - -class ICantBelieveItsBeautifulSoup(BeautifulSoup): - - """The BeautifulSoup class is oriented towards skipping over - common HTML errors like unclosed tags. However, sometimes it makes - errors of its own. For instance, consider this fragment: - - FooBar - - This is perfectly valid (if bizarre) HTML. However, the - BeautifulSoup class will implicitly close the first b tag when it - encounters the second 'b'. It will think the author wrote - "FooBar", and didn't close the first 'b' tag, because - there's no real-world reason to bold something that's already - bold. When it encounters '' it will close two more 'b' - tags, for a grand total of three tags closed instead of two. This - can throw off the rest of your document structure. The same is - true of a number of other tags, listed below. - - It's much more common for someone to forget to close a 'b' tag - than to actually use nested 'b' tags, and the BeautifulSoup class - handles the common case. This class handles the not-co-common - case: where you can't believe someone wrote what they did, but - it's valid HTML and BeautifulSoup screwed up by assuming it - wouldn't be.""" - - I_CANT_BELIEVE_THEYRE_NESTABLE_INLINE_TAGS = \ - ['em', 'big', 'i', 'small', 'tt', 'abbr', 'acronym', 'strong', - 'cite', 'code', 'dfn', 'kbd', 'samp', 'strong', 'var', 'b', - 'big'] - - I_CANT_BELIEVE_THEYRE_NESTABLE_BLOCK_TAGS = ['noscript'] - - NESTABLE_TAGS = buildTagMap([], BeautifulSoup.NESTABLE_TAGS, - I_CANT_BELIEVE_THEYRE_NESTABLE_BLOCK_TAGS, - I_CANT_BELIEVE_THEYRE_NESTABLE_INLINE_TAGS) - -class MinimalSoup(BeautifulSoup): - """The MinimalSoup class is for parsing HTML that contains - pathologically bad markup. It makes no assumptions about tag - nesting, but it does know which tags are self-closing, that - - ''') + self.comments_view.show_wait() def emit_book_selected(self, book): self.book_selected.emit(book, self.caches) From 2a019ca647d222f052e617abb08286390c2ad517 Mon Sep 17 00:00:00 2001 From: Bradley Heinz Date: Thu, 20 Jun 2019 16:14:23 -0500 Subject: [PATCH 1062/2613] Update COPYRIGHT Update copyright year to now --- COPYRIGHT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COPYRIGHT b/COPYRIGHT index b790d3190a..638c9e505a 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,5 +1,5 @@ Files: * -Copyright: Copyright (C) 2008-2017 Kovid Goyal +Copyright: Copyright (C) 2008-2019 Kovid Goyal License: GPL-3 The full text of the GPL is distributed as in /usr/share/common-licenses/GPL-3 on Debian systems. From 98b978761115461da99f2e92bd14231b45da15be Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 21 Jun 2019 12:02:42 +0530 Subject: [PATCH 1063/2613] Display status badges only for master --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 70c99ddcfd..c133b662a8 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ reading. It is cross platform, running on Linux, Windows and macOS. For more information, see the [calibre About page](https://calibre-ebook.com/about) -[![Build Status](https://api.travis-ci.org/kovidgoyal/calibre.svg)](https://travis-ci.org/kovidgoyal/calibre) -[![Build status](https://ci.appveyor.com/api/projects/status/v3nkfq0t3pse8lep?svg=true&passingText=windows%20OK&failingText=windows%20KO)](https://ci.appveyor.com/project/kovidgoyal/calibre) +[![Build Status](https://api.travis-ci.org/kovidgoyal/calibre.svg?branch=master)](https://travis-ci.org/kovidgoyal/calibre) +[![Build status](https://ci.appveyor.com/api/projects/status/github/kovidgoyal/calibre?svg=true&branch=master)](https://ci.appveyor.com/project/kovidgoyal/calibre) ## Screenshots From abd9e6bcf77d1473b044b2d324a712c4d8499a20 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 21 Jun 2019 17:52:35 +0530 Subject: [PATCH 1064/2613] py3: Fix None comparison when sorting the device books list --- src/calibre/gui2/library/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 94eb87506d..d0a34791ef 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -1304,8 +1304,8 @@ class DeviceDBSortKeyGen(object): # {{{ def __call__(self, x): try: ans = self.keyfunc(getattr(self.db[x], self.attr)) - except: - ans = None + except Exception: + ans = '' return ans # }}} @@ -1485,7 +1485,7 @@ class DeviceBooksModel(BooksModel): # {{{ 'timestamp': ('datetime', functools.partial(dt_factory, assume_utc=True)), 'collections': ('device_collections', lambda x:sorted(x, key=sort_key)), - 'inlibrary': ('in_library', lambda x: x), + 'inlibrary': ('in_library', lambda x: x or ''), }[cname] keygen = keygen if callable(keygen) else DeviceDBSortKeyGen( keygen[0], keygen[1], self.db) From c18eb0cb8c8a5b506b7d0f594c79ff87478ac468 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Fri, 14 Jun 2019 02:25:15 -0400 Subject: [PATCH 1065/2613] standardize on one is_py3 representation --- src/calibre/ebooks/lrf/objects.py | 41 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/src/calibre/ebooks/lrf/objects.py b/src/calibre/ebooks/lrf/objects.py index 1695bc2697..caf226f5d3 100644 --- a/src/calibre/ebooks/lrf/objects.py +++ b/src/calibre/ebooks/lrf/objects.py @@ -5,10 +5,9 @@ __copyright__ = '2008, Kovid Goyal ' import struct, array, zlib, io, collections, re from calibre.ebooks.lrf import LRFParseError, PRS500_PROFILE -from calibre.constants import ispy3 from calibre import entity_to_unicode, prepare_string_for_xml from calibre.ebooks.lrf.tags import Tag -from polyglot.builtins import unicode_type, string_or_bytes +from polyglot.builtins import is_py3, unicode_type, string_or_bytes ruby_tags = { 0xF575: ['rubyAlignAndAdjust', 'W'], @@ -209,7 +208,7 @@ class StyleObject(object): s += '/>\n' return s - if not ispy3: + if not is_py3: __unicode__ = __str__ def as_dict(self): @@ -257,7 +256,7 @@ class Color(object): def __str__(self): return '0x%02x%02x%02x%02x'%(self.a, self.r, self.g, self.b) - if not ispy3: + if not is_py3: __unicode__ = __str__ def __len__(self): @@ -290,7 +289,7 @@ class PageDiv(EmptyPageElement): return '\n\n'%\ (self.pain, self.spacesize, self.linewidth, self.color) - if not ispy3: + if not is_py3: __unicode__ = __str__ @@ -308,7 +307,7 @@ class RuledLine(EmptyPageElement): return '\n\n'%\ (self.linelength, self.linetype, self.linewidth, self.linecolor) - if not ispy3: + if not is_py3: __unicode__ = __str__ @@ -320,7 +319,7 @@ class Wait(EmptyPageElement): def __str__(self): return '\n\n'%(self.time) - if not ispy3: + if not is_py3: __unicode__ = __str__ @@ -334,7 +333,7 @@ class Locate(EmptyPageElement): def __str__(self): return '\n\n'%(self.pos) - if not ispy3: + if not is_py3: __unicode__ = __str__ @@ -347,7 +346,7 @@ class BlockSpace(EmptyPageElement): return '\n\n'%\ (self.xspace, self.yspace) - if not ispy3: + if not is_py3: __unicode__ = __str__ @@ -451,7 +450,7 @@ class Page(LRFStream): s += '\n\n' return s - if not ispy3: + if not is_py3: __unicode__ = __str__ def to_html(self): @@ -642,7 +641,7 @@ class Block(LRFStream, TextCSS): return s return s.rstrip() + ' />\n' - if not ispy3: + if not is_py3: __unicode__ = __str__ def to_html(self): @@ -723,7 +722,7 @@ class Text(LRFStream): s += '%s="%s" '%(name, val) return s.rstrip() + (' />' if self.self_closing else '>') - if not ispy3: + if not is_py3: __unicode__ = __str__ def to_html(self): @@ -923,7 +922,7 @@ class Text(LRFStream): raise LRFParseError('Malformed text stream %s'%([i.name for i in open_containers if isinstance(i, Text.TextTag)],)) return s - if not ispy3: + if not is_py3: __unicode__ = __str__ def to_html(self): @@ -974,7 +973,7 @@ class Image(LRFObject): return '\n'%\ (self.id, self.x0, self.y0, self.x1, self.y1, self.xsize, self.ysize, self.refstream) - if not ispy3: + if not is_py3: __unicode__ = __str__ @@ -987,7 +986,7 @@ class PutObj(EmptyPageElement): def __str__(self): return ''%(self.x1, self.y1, self.refobj) - if not ispy3: + if not is_py3: __unicode__ = __str__ @@ -1038,7 +1037,7 @@ class Canvas(LRFStream): s += '\n'%(self.__class__.__name__,) return s - if not ispy3: + if not is_py3: __unicode__ = __str__ def __iter__(self): @@ -1078,7 +1077,7 @@ class ImageStream(LRFStream): return '\n'%\ (self.id, self.encoding, self.file) - if not ispy3: + if not is_py3: __unicode__ = __str__ @@ -1170,7 +1169,7 @@ class Button(LRFObject): s += '\n' return s - if not ispy3: + if not is_py3: __unicode__ = __str__ refpage = property(fget=lambda self : self.jump_action(2)[0]) @@ -1244,7 +1243,7 @@ class BookAttr(StyleObject, LRFObject): s += '\n' return s - if not ispy3: + if not is_py3: __unicode__ = __str__ @@ -1260,7 +1259,7 @@ class TocLabel(object): def __str__(self): return '%s\n'%(self.refpage, self.refobject, self.label) - if not ispy3: + if not is_py3: __unicode__ = __str__ @@ -1290,7 +1289,7 @@ class TOCObject(LRFStream): s += unicode_type(i) return s + '\n' - if not ispy3: + if not is_py3: __unicode__ = __str__ From 824f909627724f81dffc11a950c319f7adb7ccff Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Fri, 14 Jun 2019 02:28:36 -0400 Subject: [PATCH 1066/2613] do not shadow builtins as variable names --- src/calibre/ebooks/lrf/objects.py | 4 ++-- src/calibre/ebooks/metadata/odt.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/calibre/ebooks/lrf/objects.py b/src/calibre/ebooks/lrf/objects.py index caf226f5d3..b8b276d3a4 100644 --- a/src/calibre/ebooks/lrf/objects.py +++ b/src/calibre/ebooks/lrf/objects.py @@ -97,8 +97,8 @@ class LRFContentObject(LRFObject): tag_map = {} - def __init__(self, bytes, objects): - self.stream = bytes if hasattr(bytes, 'read') else io.BytesIO(bytes) + def __init__(self, byts, objects): + self.stream = byts if hasattr(byts, 'read') else io.BytesIO(byts) length = self.stream_size() self.objects = objects self._contents = [] diff --git a/src/calibre/ebooks/metadata/odt.py b/src/calibre/ebooks/metadata/odt.py index bdad22aebf..5583d25bae 100644 --- a/src/calibre/ebooks/metadata/odt.py +++ b/src/calibre/ebooks/metadata/odt.py @@ -56,13 +56,13 @@ fields = { } -def normalize(str): +def normalize(s): """ The normalize-space function returns the argument string with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of whitespace characters by a single space. """ - return whitespace.sub(' ', str).strip() + return whitespace.sub(' ', s).strip() class MetaCollector: @@ -75,9 +75,9 @@ class MetaCollector: self._content = [] self.dowrite = True - def write(self, str): + def write(self, s): if self.dowrite: - self._content.append(str) + self._content.append(s) def content(self): return ''.join(self._content) From 1f794c4cd2a2d64d5e55091aaa5bd58e9259ccfa Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 13 Jun 2019 17:10:05 -0400 Subject: [PATCH 1067/2613] py3: more work on universal __future__s --- src/calibre/ebooks/lrf/__init__.py | 2 + src/calibre/ebooks/lrf/html/__init__.py | 2 + src/calibre/ebooks/lrf/html/color_map.py | 182 +++++++++--------- src/calibre/ebooks/lrf/html/convert_from.py | 65 ++++--- src/calibre/ebooks/lrf/html/table.py | 13 +- src/calibre/ebooks/lrf/html/table_as_image.py | 4 +- src/calibre/ebooks/lrf/input.py | 19 +- src/calibre/ebooks/lrf/lrs/__init__.py | 5 +- src/calibre/ebooks/lrf/lrs/convert_from.py | 7 +- src/calibre/ebooks/lrf/objects.py | 26 +-- src/calibre/ebooks/lrf/pylrs/__init__.py | 2 + src/calibre/ebooks/lrf/pylrs/elements.py | 20 +- src/calibre/ebooks/lrf/pylrs/pylrf.py | 8 +- src/calibre/ebooks/lrf/pylrs/pylrfopt.py | 4 +- src/calibre/ebooks/lrf/pylrs/pylrs.py | 80 ++++---- src/calibre/ebooks/lrf/tags.py | 6 +- src/calibre/ebooks/metadata/__init__.py | 49 +++-- src/calibre/ebooks/metadata/archive.py | 6 +- src/calibre/ebooks/metadata/book/__init__.py | 1 + src/calibre/ebooks/metadata/book/base.py | 33 ++-- .../ebooks/metadata/book/json_codec.py | 3 +- src/calibre/ebooks/metadata/cli.py | 3 +- src/calibre/ebooks/metadata/epub.py | 2 +- src/calibre/ebooks/metadata/extz.py | 1 + src/calibre/ebooks/metadata/fb2.py | 2 + src/calibre/ebooks/metadata/kdl.py | 4 +- src/calibre/ebooks/metadata/lit.py | 2 + src/calibre/ebooks/metadata/meta.py | 7 +- src/calibre/ebooks/metadata/mobi.py | 7 +- src/calibre/ebooks/metadata/odt.py | 51 +++-- src/calibre/ebooks/metadata/pdb.py | 2 +- src/calibre/ebooks/metadata/pdf.py | 7 +- src/calibre/ebooks/metadata/rar.py | 4 +- src/calibre/ebooks/metadata/rb.py | 9 +- src/calibre/ebooks/metadata/snb.py | 2 +- .../ebooks/metadata/sources/__init__.py | 4 +- src/calibre/ebooks/metadata/sources/amazon.py | 42 ++-- src/calibre/ebooks/metadata/sources/google.py | 4 +- src/calibre/ebooks/metadata/toc.py | 11 +- src/calibre/ebooks/metadata/txt.py | 1 + src/calibre/ebooks/metadata/xisbn.py | 2 +- src/calibre/ebooks/metadata/zip.py | 3 +- 42 files changed, 366 insertions(+), 341 deletions(-) diff --git a/src/calibre/ebooks/lrf/__init__.py b/src/calibre/ebooks/lrf/__init__.py index 6c696b16ed..6be9e69e13 100644 --- a/src/calibre/ebooks/lrf/__init__.py +++ b/src/calibre/ebooks/lrf/__init__.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, division, print_function, unicode_literals + __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' """ diff --git a/src/calibre/ebooks/lrf/html/__init__.py b/src/calibre/ebooks/lrf/html/__init__.py index 9e110971bf..cb4d4686eb 100644 --- a/src/calibre/ebooks/lrf/html/__init__.py +++ b/src/calibre/ebooks/lrf/html/__init__.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, division, print_function, unicode_literals + __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' """ diff --git a/src/calibre/ebooks/lrf/html/color_map.py b/src/calibre/ebooks/lrf/html/color_map.py index 9c74c61018..ce4af2d71d 100644 --- a/src/calibre/ebooks/lrf/html/color_map.py +++ b/src/calibre/ebooks/lrf/html/color_map.py @@ -1,99 +1,101 @@ +from __future__ import absolute_import, division, print_function, unicode_literals + __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' import re NAME_MAP = { - u'aliceblue': u'#F0F8FF', - u'antiquewhite': u'#FAEBD7', - u'aqua': u'#00FFFF', - u'aquamarine': u'#7FFFD4', - u'azure': u'#F0FFFF', - u'beige': u'#F5F5DC', - u'bisque': u'#FFE4C4', - u'black': u'#000000', - u'blanchedalmond': u'#FFEBCD', - u'blue': u'#0000FF', - u'brown': u'#A52A2A', - u'burlywood': u'#DEB887', - u'cadetblue': u'#5F9EA0', - u'chartreuse': u'#7FFF00', - u'chocolate': u'#D2691E', - u'coral': u'#FF7F50', - u'crimson': u'#DC143C', - u'cyan': u'#00FFFF', - u'darkblue': u'#00008B', - u'darkgoldenrod': u'#B8860B', - u'darkgreen': u'#006400', - u'darkkhaki': u'#BDB76B', - u'darkmagenta': u'#8B008B', - u'darkolivegreen': u'#556B2F', - u'darkorange': u'#FF8C00', - u'darkorchid': u'#9932CC', - u'darkred': u'#8B0000', - u'darksalmon': u'#E9967A', - u'darkslateblue': u'#483D8B', - u'darkslategrey': u'#2F4F4F', - u'darkviolet': u'#9400D3', - u'deeppink': u'#FF1493', - u'dodgerblue': u'#1E90FF', - u'firebrick': u'#B22222', - u'floralwhite': u'#FFFAF0', - u'forestgreen': u'#228B22', - u'fuchsia': u'#FF00FF', - u'gainsboro': u'#DCDCDC', - u'ghostwhite': u'#F8F8FF', - u'gold': u'#FFD700', - u'goldenrod': u'#DAA520', - u'indianred ': u'#CD5C5C', - u'indigo ': u'#4B0082', - u'khaki': u'#F0E68C', - u'lavenderblush': u'#FFF0F5', - u'lawngreen': u'#7CFC00', - u'lightblue': u'#ADD8E6', - u'lightcoral': u'#F08080', - u'lightgoldenrodyellow': u'#FAFAD2', - u'lightgray': u'#D3D3D3', - u'lightgrey': u'#D3D3D3', - u'lightskyblue': u'#87CEFA', - u'lightslategrey': u'#778899', - u'lightsteelblue': u'#B0C4DE', - u'lime': u'#87CEFA', - u'linen': u'#FAF0E6', - u'magenta': u'#FF00FF', - u'maroon': u'#800000', - u'mediumaquamarine': u'#66CDAA', - u'mediumblue': u'#0000CD', - u'mediumorchid': u'#BA55D3', - u'mediumpurple': u'#9370D8', - u'mediumseagreen': u'#3CB371', - u'mediumslateblue': u'#7B68EE', - u'midnightblue': u'#191970', - u'moccasin': u'#FFE4B5', - u'navajowhite': u'#FFDEAD', - u'navy': u'#000080', - u'oldlace': u'#FDF5E6', - u'olive': u'#808000', - u'orange': u'#FFA500', - u'orangered': u'#FF4500', - u'orchid': u'#DA70D6', - u'paleturquoise': u'#AFEEEE', - u'papayawhip': u'#FFEFD5', - u'peachpuff': u'#FFDAB9', - u'powderblue': u'#B0E0E6', - u'rosybrown': u'#BC8F8F', - u'royalblue': u'#4169E1', - u'saddlebrown': u'#8B4513', - u'sandybrown': u'#8B4513', - u'seashell': u'#FFF5EE', - u'sienna': u'#A0522D', - u'silver': u'#C0C0C0', - u'skyblue': u'#87CEEB', - u'slategrey': u'#708090', - u'snow': u'#FFFAFA', - u'springgreen': u'#00FF7F', - u'violet': u'#EE82EE', - u'yellowgreen': u'#9ACD32' + 'aliceblue': '#F0F8FF', + 'antiquewhite': '#FAEBD7', + 'aqua': '#00FFFF', + 'aquamarine': '#7FFFD4', + 'azure': '#F0FFFF', + 'beige': '#F5F5DC', + 'bisque': '#FFE4C4', + 'black': '#000000', + 'blanchedalmond': '#FFEBCD', + 'blue': '#0000FF', + 'brown': '#A52A2A', + 'burlywood': '#DEB887', + 'cadetblue': '#5F9EA0', + 'chartreuse': '#7FFF00', + 'chocolate': '#D2691E', + 'coral': '#FF7F50', + 'crimson': '#DC143C', + 'cyan': '#00FFFF', + 'darkblue': '#00008B', + 'darkgoldenrod': '#B8860B', + 'darkgreen': '#006400', + 'darkkhaki': '#BDB76B', + 'darkmagenta': '#8B008B', + 'darkolivegreen': '#556B2F', + 'darkorange': '#FF8C00', + 'darkorchid': '#9932CC', + 'darkred': '#8B0000', + 'darksalmon': '#E9967A', + 'darkslateblue': '#483D8B', + 'darkslategrey': '#2F4F4F', + 'darkviolet': '#9400D3', + 'deeppink': '#FF1493', + 'dodgerblue': '#1E90FF', + 'firebrick': '#B22222', + 'floralwhite': '#FFFAF0', + 'forestgreen': '#228B22', + 'fuchsia': '#FF00FF', + 'gainsboro': '#DCDCDC', + 'ghostwhite': '#F8F8FF', + 'gold': '#FFD700', + 'goldenrod': '#DAA520', + 'indianred ': '#CD5C5C', + 'indigo ': '#4B0082', + 'khaki': '#F0E68C', + 'lavenderblush': '#FFF0F5', + 'lawngreen': '#7CFC00', + 'lightblue': '#ADD8E6', + 'lightcoral': '#F08080', + 'lightgoldenrodyellow': '#FAFAD2', + 'lightgray': '#D3D3D3', + 'lightgrey': '#D3D3D3', + 'lightskyblue': '#87CEFA', + 'lightslategrey': '#778899', + 'lightsteelblue': '#B0C4DE', + 'lime': '#87CEFA', + 'linen': '#FAF0E6', + 'magenta': '#FF00FF', + 'maroon': '#800000', + 'mediumaquamarine': '#66CDAA', + 'mediumblue': '#0000CD', + 'mediumorchid': '#BA55D3', + 'mediumpurple': '#9370D8', + 'mediumseagreen': '#3CB371', + 'mediumslateblue': '#7B68EE', + 'midnightblue': '#191970', + 'moccasin': '#FFE4B5', + 'navajowhite': '#FFDEAD', + 'navy': '#000080', + 'oldlace': '#FDF5E6', + 'olive': '#808000', + 'orange': '#FFA500', + 'orangered': '#FF4500', + 'orchid': '#DA70D6', + 'paleturquoise': '#AFEEEE', + 'papayawhip': '#FFEFD5', + 'peachpuff': '#FFDAB9', + 'powderblue': '#B0E0E6', + 'rosybrown': '#BC8F8F', + 'royalblue': '#4169E1', + 'saddlebrown': '#8B4513', + 'sandybrown': '#8B4513', + 'seashell': '#FFF5EE', + 'sienna': '#A0522D', + 'silver': '#C0C0C0', + 'skyblue': '#87CEEB', + 'slategrey': '#708090', + 'snow': '#FFFAFA', + 'springgreen': '#00FF7F', + 'violet': '#EE82EE', + 'yellowgreen': '#9ACD32' } hex_pat = re.compile(r'#(\d{2})(\d{2})(\d{2})') diff --git a/src/calibre/ebooks/lrf/html/convert_from.py b/src/calibre/ebooks/lrf/html/convert_from.py index 41ec5cb6ce..be4feb2aeb 100644 --- a/src/calibre/ebooks/lrf/html/convert_from.py +++ b/src/calibre/ebooks/lrf/html/convert_from.py @@ -1,4 +1,5 @@ -from __future__ import print_function +from __future__ import absolute_import, division, print_function, unicode_literals + __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' """ @@ -106,7 +107,7 @@ class HTMLConverter(object): re.IGNORECASE), lambda m: '
    '), # Replace entities - (re.compile(u'&(\\S+?);'), partial(entity_to_unicode, + (re.compile(r'&(\S+?);'), partial(entity_to_unicode, exceptions=['lt', 'gt', 'amp', 'quot'])), # Remove comments from within style tags as they can mess up BeatifulSoup (re.compile(r'()', re.IGNORECASE|re.DOTALL), @@ -397,7 +398,7 @@ class HTMLConverter(object): def parse_css(self, style): """ Parse the contents of a {icons}'.format( + icons=icons, reset=reset) + rapydscript_dir = os.path.join(base, 'src', 'pyj') fname = os.path.join(rapydscript_dir, 'viewer-main.pyj') with lopen(fname, 'rb') as f: @@ -234,6 +243,7 @@ def compile_viewer(): '__FAKE_HOST__', FAKE_HOST, 1) base = os.path.join(base, 'resources') atomic_write(base, 'viewer.js', js) + atomic_write(base, 'viewer.html', html) def compile_srv(): From c4295355a248789d9a09bf74ed8569babf8a8a1b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 27 Sep 2018 09:46:21 +0530 Subject: [PATCH 1347/2613] ... --- src/pyj/viewer/router.pyj | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/pyj/viewer/router.pyj diff --git a/src/pyj/viewer/router.pyj b/src/pyj/viewer/router.pyj new file mode 100644 index 0000000000..65ed18978a --- /dev/null +++ b/src/pyj/viewer/router.pyj @@ -0,0 +1,19 @@ +# vim:fileencoding=utf-8 +# License: GPL v3 Copyright: 2018, Kovid Goyal +from __python__ import bound_methods, hash_literals + +from modals import close_all_modals +from utils import parse_url_params + + +def get_current_query(newval): + if newval: + get_current_query.ans = newval + return get_current_query.ans or {} + + +def apply_url(): + close_all_modals() # needed to close any error dialogs, etc when clicking back or forward in the browser or using push_state() to go to a new page + data = parse_url_params() + data.mode = data.mode or 'read_book' + get_current_query.ans = data From fa23f3d43f956e7418028119c4bf0e971afe0f5a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 4 Oct 2018 18:12:27 +0530 Subject: [PATCH 1348/2613] Add a dock for the inspector --- src/calibre/gui2/viewer2/ui.py | 6 ++++-- src/calibre/gui2/viewer2/web_view.py | 32 ++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/viewer2/ui.py b/src/calibre/gui2/viewer2/ui.py index 6939b4a507..e6e17de14a 100644 --- a/src/calibre/gui2/viewer2/ui.py +++ b/src/calibre/gui2/viewer2/ui.py @@ -24,15 +24,17 @@ class EbookViewer(MainWindow): def __init__(self): MainWindow.__init__(self, None) self.book_prepared.connect(self.load_finished, type=Qt.QueuedConnection) - self.web_view = WebView(self) - self.setCentralWidget(self.web_view) def create_dock(title, name, areas=Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea): ans = QDockWidget(title, self) ans.setObjectName(name) ans.close() + return ans self.toc_dock = create_dock(_('Table of Contents'), 'toc-dock') + self.inspector_dock = create_dock(_('Inspector'), 'inspector') + self.web_view = WebView(self) + self.setCentralWidget(self.web_view) def handle_commandline_arg(self, arg): if arg and os.path.isfile(arg) and os.access(arg, os.R_OK): diff --git a/src/calibre/gui2/viewer2/web_view.py b/src/calibre/gui2/viewer2/web_view.py index fcafaa9155..7e13557dfb 100644 --- a/src/calibre/gui2/viewer2/web_view.py +++ b/src/calibre/gui2/viewer2/web_view.py @@ -6,10 +6,12 @@ from __future__ import absolute_import, division, print_function, unicode_litera import os -from PyQt5.Qt import QApplication, QBuffer, QByteArray, QSize, QUrl +from PyQt5.Qt import ( + QApplication, QBuffer, QByteArray, QHBoxLayout, QSize, QTimer, QUrl, QWidget +) from PyQt5.QtWebEngineCore import QWebEngineUrlSchemeHandler from PyQt5.QtWebEngineWidgets import ( - QWebEnginePage, QWebEngineProfile, QWebEngineScript + QWebEnginePage, QWebEngineProfile, QWebEngineScript, QWebEngineView ) from calibre import as_unicode, prints @@ -179,6 +181,30 @@ def viewer_html(): return ans +class Inspector(QWidget): + + def __init__(self, dock_action, parent=None): + QWidget.__init__(self, parent=parent) + self.view_to_debug = parent + self.view = None + self.layout = QHBoxLayout(self) + self.layout.setContentsMargins(0, 0, 0, 0) + self.dock_action = dock_action + QTimer.singleShot(0, self.connect_to_dock) + + def connect_to_dock(self): + ac = self.dock_action + ac.toggled.connect(self.visibility_changed) + if ac.isChecked(): + self.visibility_changed(True) + + def visibility_changed(self, visible): + if visible and self.view is None: + self.view = QWebEngineView(self.view_to_debug) + self.view_to_debug.page().setDevToolsPage(self.view.page()) + self.layout.addWidget(self.view) + + class WebView(RestartingWebEngineView): def __init__(self, parent=None): @@ -194,6 +220,8 @@ class WebView(RestartingWebEngineView): self.setPage(self._page) self.setAcceptDrops(False) self.clear() + if parent is not None: + self.inspector = Inspector(parent.toc_dock.toggleViewAction(), self) def render_process_died(self): if self.dead_renderer_error_shown: From 56baf848fc3485805af03fd453a7aa515464f75d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 4 Oct 2018 18:45:42 +0530 Subject: [PATCH 1349/2613] Make the Inspector dock widget work --- src/calibre/gui2/viewer2/ui.py | 9 +++++---- src/calibre/gui2/viewer2/web_view.py | 4 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/viewer2/ui.py b/src/calibre/gui2/viewer2/ui.py index e6e17de14a..9739aefe09 100644 --- a/src/calibre/gui2/viewer2/ui.py +++ b/src/calibre/gui2/viewer2/ui.py @@ -25,14 +25,15 @@ class EbookViewer(MainWindow): MainWindow.__init__(self, None) self.book_prepared.connect(self.load_finished, type=Qt.QueuedConnection) - def create_dock(title, name, areas=Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea): + def create_dock(title, name, area, areas=Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea): ans = QDockWidget(title, self) ans.setObjectName(name) - ans.close() + self.addDockWidget(area, ans) + ans.setVisible(False) return ans - self.toc_dock = create_dock(_('Table of Contents'), 'toc-dock') - self.inspector_dock = create_dock(_('Inspector'), 'inspector') + self.toc_dock = create_dock(_('Table of Contents'), 'toc-dock', Qt.LeftDockWidgetArea) + self.inspector_dock = create_dock(_('Inspector'), 'inspector', Qt.RightDockWidgetArea) self.web_view = WebView(self) self.setCentralWidget(self.web_view) diff --git a/src/calibre/gui2/viewer2/web_view.py b/src/calibre/gui2/viewer2/web_view.py index 7e13557dfb..82df5fe2c6 100644 --- a/src/calibre/gui2/viewer2/web_view.py +++ b/src/calibre/gui2/viewer2/web_view.py @@ -221,7 +221,9 @@ class WebView(RestartingWebEngineView): self.setAcceptDrops(False) self.clear() if parent is not None: - self.inspector = Inspector(parent.toc_dock.toggleViewAction(), self) + self.inspector = Inspector(parent.inspector_dock.toggleViewAction(), self) + parent.inspector_dock.setWidget(self.inspector) + # QTimer.singleShot(100, lambda: (parent.inspector_dock.setVisible(True), parent.inspector_dock.setMinimumWidth(450))) def render_process_died(self): if self.dead_renderer_error_shown: From 4f87ea3ccc597cfc769388f15209f433236887e7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 4 Oct 2018 21:01:06 +0530 Subject: [PATCH 1350/2613] Also serialize cover when rendering books for viewer --- src/calibre/srv/render_book.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/calibre/srv/render_book.py b/src/calibre/srv/render_book.py index b8eb346afb..95fc1f0943 100644 --- a/src/calibre/srv/render_book.py +++ b/src/calibre/srv/render_book.py @@ -523,17 +523,20 @@ def html_as_dict(root): def render(pathtoebook, output_dir, book_hash=None, serialize_metadata=False): - Container(pathtoebook, output_dir, book_hash=book_hash) + container = Container(pathtoebook, output_dir, book_hash=book_hash) if serialize_metadata: from calibre.ebooks.metadata.meta import get_metadata from calibre.ebooks.metadata.book.serialize import metadata_as_dict with lopen(pathtoebook, 'rb') as f: mi = get_metadata(f, os.path.splitext(pathtoebook)[1][1:].lower()) d = metadata_as_dict(mi) - d.pop('cover_data', None) + cdata = d.pop('cover_data', None) + if cdata and cdata[1] and container.book_render_data['raster_cover_name']: + with lopen(os.path.join(output_dir, container.book_render_data['raster_cover_name']), 'wb') as f: + f.write(cdata[1]) with lopen(os.path.join(output_dir, 'calibre-book-metadata.json'), 'wb') as f: f.write(json.dumps(d)) if __name__ == '__main__': - render(sys.argv[-2], sys.argv[-1]) + render(sys.argv[-2], sys.argv[-1], serialize_metadata=True) From 03f1a3eb485ddc9c2035047eb634158b9f83d37e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 5 Oct 2018 10:22:09 +0530 Subject: [PATCH 1351/2613] Store a reference to the host widget --- src/calibre/gui2/viewer2/web_view.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/viewer2/web_view.py b/src/calibre/gui2/viewer2/web_view.py index 82df5fe2c6..7aea35045f 100644 --- a/src/calibre/gui2/viewer2/web_view.py +++ b/src/calibre/gui2/viewer2/web_view.py @@ -208,6 +208,7 @@ class Inspector(QWidget): class WebView(RestartingWebEngineView): def __init__(self, parent=None): + self._host_widget = None RestartingWebEngineView.__init__(self, parent) self.dead_renderer_error_shown = False self.render_process_failed.connect(self.render_process_died) @@ -223,7 +224,13 @@ class WebView(RestartingWebEngineView): if parent is not None: self.inspector = Inspector(parent.inspector_dock.toggleViewAction(), self) parent.inspector_dock.setWidget(self.inspector) - # QTimer.singleShot(100, lambda: (parent.inspector_dock.setVisible(True), parent.inspector_dock.setMinimumWidth(450))) + # QTimer.singleShot(100, lambda: (parent.inspector_dock.setVisible(True), parent.inspector_dock.setMinimumWidth(650))) + + @property + def host_widget(self): + ans = self._host_widget + if ans is not None and not sip.isdeleted(ans): + return ans def render_process_died(self): if self.dead_renderer_error_shown: @@ -233,6 +240,13 @@ class WebView(RestartingWebEngineView): 'The Qt WebEngine Render process has crashed.' ' You should try restarting the viewer.') , show=True) + def event(self, event): + if event.type() == event.ChildPolished: + child = event.child() + if 'HostView' in child.metaObject().className(): + self._host_widget = child + return QWebEngineView.event(self, event) + def sizeHint(self): return self._size_hint From 4a721d36a5518b45c76eef214642ee86b3ca754d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 5 Oct 2018 10:28:45 +0530 Subject: [PATCH 1352/2613] Load UI css at startup --- src/calibre/gui2/viewer2/web_view.py | 2 +- src/pyj/viewer-main.pyj | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/viewer2/web_view.py b/src/calibre/gui2/viewer2/web_view.py index 7aea35045f..eca3311168 100644 --- a/src/calibre/gui2/viewer2/web_view.py +++ b/src/calibre/gui2/viewer2/web_view.py @@ -224,7 +224,7 @@ class WebView(RestartingWebEngineView): if parent is not None: self.inspector = Inspector(parent.inspector_dock.toggleViewAction(), self) parent.inspector_dock.setWidget(self.inspector) - # QTimer.singleShot(100, lambda: (parent.inspector_dock.setVisible(True), parent.inspector_dock.setMinimumWidth(650))) + # QTimer.singleShot(300, lambda: (parent.inspector_dock.setVisible(True), parent.inspector_dock.setMinimumWidth(650))) @property def host_widget(self): diff --git a/src/pyj/viewer-main.pyj b/src/pyj/viewer-main.pyj index d515a12313..e378a63448 100644 --- a/src/pyj/viewer-main.pyj +++ b/src/pyj/viewer-main.pyj @@ -9,12 +9,14 @@ from gettext import gettext as _ import initialize # noqa: unused-import from ajax import ajax from book_list.globals import set_session_data -from modals import error_dialog, create_modal_container +from book_list.theme import get_color, get_font_family +from dom import get_widget_css, set_css +from modals import create_modal_container, error_dialog from qt import from_python, to_python from read_book.db import new_book from read_book.globals import runtime, ui_operations -from read_book.view import View from read_book.iframe import main as iframe_main +from read_book.view import View from session import session_defaults @@ -150,6 +152,9 @@ if window is window.top: document.body.appendChild(E.div(id='view')) window.onerror = onerror create_modal_container() + document.body.style.fontFamily = get_font_family() + document.head.appendChild(E.style(get_widget_css())) + set_css(document.body, background_color=get_color('window-background'), color=get_color('window-foreground')) else: # iframe iframe_main() From 57a4f1c91d8bfb4784fd0b432d290f2f0c96a3d7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 12 Dec 2018 10:08:48 +0530 Subject: [PATCH 1353/2613] Implement loading of mathjax files --- src/calibre/gui2/viewer2/web_view.py | 16 +++++++++ src/pyj/viewer-main.pyj | 50 +++++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/viewer2/web_view.py b/src/calibre/gui2/viewer2/web_view.py index eca3311168..5fc9aac004 100644 --- a/src/calibre/gui2/viewer2/web_view.py +++ b/src/calibre/gui2/viewer2/web_view.py @@ -4,6 +4,7 @@ from __future__ import absolute_import, division, print_function, unicode_literals +import json import os from PyQt5.Qt import ( @@ -24,6 +25,7 @@ from calibre.gui2.webengine import ( Bridge, RestartingWebEngineView, create_script, from_js, insert_scripts, secure_webengine, to_js ) +from calibre.ptempfile import PersistentTemporaryDirectory from calibre.utils.config import JSONConfig try: @@ -61,6 +63,7 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): def __init__(self, parent=None): QWebEngineUrlSchemeHandler.__init__(self, parent) + self.mathjax_tdir = self.mathjax_manifest = None def requestStarted(self, rq): if bytes(rq.requestMethod()) != b'GET': @@ -96,6 +99,19 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): metadata = get_data('calibre-book-metadata.json')[0] data = b'[' + manifest + b',' + metadata + b']' self.send_reply(rq, mime_type, data) + elif name.startswith('mathjax/'): + if name == 'mathjax/manifest.json': + from calibre.srv.books import get_mathjax_manifest + if self.mathjax_tdir is None: + self.mathjax_tdir = PersistentTemporaryDirectory(prefix='v2mjx-') + self.mathjax_manifest = json.dumps(get_mathjax_manifest(self.mathjax_tdir)['files'], encoding='utf-8') + self.send_reply(rq, 'application/json', self.mathjax_manifest) + else: + path = os.path.abspath(os.path.join(self.mathjax_tdir, name)) + if path.startswith(self.mathjax_tdir): + mt = guess_type(name) + with lopen(path, 'rb') as f: + self.send_reply(rq, mt, f.read()) def send_reply(self, rq, mime_type, data): if sip.isdeleted(rq): diff --git a/src/pyj/viewer-main.pyj b/src/pyj/viewer-main.pyj index e378a63448..74585a976a 100644 --- a/src/pyj/viewer-main.pyj +++ b/src/pyj/viewer-main.pyj @@ -57,8 +57,56 @@ def get_file(book, name, proceed): xhr.send() +def mathjax_file_received(name, proceed, end_type, xhr, ev): + if end_type is 'abort': + return + if end_type is not 'load': + show_error(_('Failed to load MathJax file'), _( + 'Could not load the file: {} with error: {}').format(name, xhr.error_html)) + return + if not xhr.responseType or xhr.responseType is 'text': + result = xhr.responseText + else if xhr.responseType is 'blob' or xhr.responseType is 'json': + result = xhr.response + else: + show_error(_('Failed to load MathJax file'), _( + 'Could not load the file: {} unknown response type: {}').format(name, xhr.responseType)) + return + if name is 'manifest.json': + get_mathjax_files.manifest = result + get_mathjax_files_stage2.files_to_get = list(Object.keys(result)) + get_mathjax_files_stage2.file_data = {} + get_mathjax_files_stage2(proceed) + return + + get_mathjax_files_stage2.file_data[name] = result + get_mathjax_files_stage2.files_to_get.remove(name) + if not get_mathjax_files_stage2.files_to_get.length: + proceed(get_mathjax_files_stage2.file_data) + + +def get_mathjax_manifest(proceed): + xhr = ajax('mathjax/manifest.json', mathjax_file_received.bind(None, 'manifest.json', proceed), ok_code=0) + xhr.responseType = 'json' + xhr.send() + + +def get_mathjax_files_stage2(proceed): + if not get_mathjax_files_stage2.files_to_get.length: + proceed(get_mathjax_files_stage2.file_data) + return + for filename in get_mathjax_files_stage2.files_to_get: + xhr = ajax(f'mathjax/{filename}', mathjax_file_received.bind(None, filename, proceed), ok_code=0) + xhr.responseType = 'blob' if filename.endswith('.woff') else 'text' + xhr.send() + + + def get_mathjax_files(proceed): - pass # TODO: Implement this + if not get_mathjax_files.manifest: + get_mathjax_manifest(proceed) + else: + get_mathjax_files_stage2(proceed) def update_url_state(replace): From c64349dc6bd192f83bc46c6f46dbe42ab059a20c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 12 Dec 2018 10:27:37 +0530 Subject: [PATCH 1354/2613] ... --- src/pyj/viewer-main.pyj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyj/viewer-main.pyj b/src/pyj/viewer-main.pyj index 74585a976a..3773515275 100644 --- a/src/pyj/viewer-main.pyj +++ b/src/pyj/viewer-main.pyj @@ -97,7 +97,7 @@ def get_mathjax_files_stage2(proceed): return for filename in get_mathjax_files_stage2.files_to_get: xhr = ajax(f'mathjax/{filename}', mathjax_file_received.bind(None, filename, proceed), ok_code=0) - xhr.responseType = 'blob' if filename.endswith('.woff') else 'text' + xhr.responseType = 'blob' xhr.send() From 8d27d68dff2d8d07fa08bdcd7d650127a15b10d6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Dec 2018 10:32:50 +0530 Subject: [PATCH 1355/2613] Simplify loading of MathJax files --- src/calibre/gui2/viewer2/web_view.py | 24 ++++++------- src/pyj/read_book/mathjax.pyj | 12 +++++-- src/pyj/viewer-main.pyj | 53 +++------------------------- 3 files changed, 25 insertions(+), 64 deletions(-) diff --git a/src/calibre/gui2/viewer2/web_view.py b/src/calibre/gui2/viewer2/web_view.py index 5fc9aac004..7a29b89a20 100644 --- a/src/calibre/gui2/viewer2/web_view.py +++ b/src/calibre/gui2/viewer2/web_view.py @@ -4,7 +4,6 @@ from __future__ import absolute_import, division, print_function, unicode_literals -import json import os from PyQt5.Qt import ( @@ -63,7 +62,7 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): def __init__(self, parent=None): QWebEngineUrlSchemeHandler.__init__(self, parent) - self.mathjax_tdir = self.mathjax_manifest = None + self.mathjax_tdir = None def requestStarted(self, rq): if bytes(rq.requestMethod()) != b'GET': @@ -100,18 +99,17 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): data = b'[' + manifest + b',' + metadata + b']' self.send_reply(rq, mime_type, data) elif name.startswith('mathjax/'): - if name == 'mathjax/manifest.json': + if self.mathjax_tdir is None: from calibre.srv.books import get_mathjax_manifest - if self.mathjax_tdir is None: - self.mathjax_tdir = PersistentTemporaryDirectory(prefix='v2mjx-') - self.mathjax_manifest = json.dumps(get_mathjax_manifest(self.mathjax_tdir)['files'], encoding='utf-8') - self.send_reply(rq, 'application/json', self.mathjax_manifest) - else: - path = os.path.abspath(os.path.join(self.mathjax_tdir, name)) - if path.startswith(self.mathjax_tdir): - mt = guess_type(name) - with lopen(path, 'rb') as f: - self.send_reply(rq, mt, f.read()) + self.mathjax_tdir = PersistentTemporaryDirectory(prefix='v2mjx-') + get_mathjax_manifest(self.mathjax_tdir) + + path = os.path.abspath(os.path.join(self.mathjax_tdir, name)) + if path.startswith(self.mathjax_tdir): + mt = guess_type(name) + with lopen(path, 'rb') as f: + raw = f.read() + self.send_reply(rq, mt, raw) def send_reply(self, rq, mime_type, data): if sip.isdeleted(rq): diff --git a/src/pyj/read_book/mathjax.pyj b/src/pyj/read_book/mathjax.pyj index 33fcd79626..f0ce401494 100644 --- a/src/pyj/read_book/mathjax.pyj +++ b/src/pyj/read_book/mathjax.pyj @@ -4,6 +4,9 @@ from __python__ import hash_literals from elementmaker import E +from read_book.globals import runtime + + def get_url(mathjax_files, name): ans = mathjax_files[name] if not ans: @@ -58,7 +61,6 @@ def init_mathjax(mathjax_files, link_uid, proceed): def apply_mathjax(mathjax_files, link_uid, proceed): window.MathJax = m = v'{}' - m.AuthorInit = init_mathjax.bind(this, mathjax_files, link_uid, proceed) m.positionToHash = False m.showMathMenu = False m.showMathMenuMSIE = False @@ -67,4 +69,10 @@ def apply_mathjax(mathjax_files, link_uid, proceed): m.TeX = v'{}' m.TeX.extensions = "AMSmath.js AMSsymbols.js noErrors.js noUndefined.js".split(' ') m.CommonHTML = v'{ linebreaks: { automatic: true} }' - document.head.appendChild(E.script(type='text/javascript', src=get_url(mathjax_files, 'MathJax.js'))) + script = E.script(type='text/javascript') + document.head.appendChild(script) + if runtime.is_standalone_viewer: + script.src = f'{runtime.FAKE_PROTOCOL}://{runtime.FAKE_HOST}/mathjax/MathJax.js' + else: + m.AuthorInit = init_mathjax.bind(this, mathjax_files, link_uid, proceed) + script.src = get_url(mathjax_files, 'MathJax.js') diff --git a/src/pyj/viewer-main.pyj b/src/pyj/viewer-main.pyj index 3773515275..641e1f4d62 100644 --- a/src/pyj/viewer-main.pyj +++ b/src/pyj/viewer-main.pyj @@ -18,12 +18,15 @@ from read_book.globals import runtime, ui_operations from read_book.iframe import main as iframe_main from read_book.view import View from session import session_defaults +from viewer.constants import FAKE_HOST, FAKE_PROTOCOL def container_div(id): return E.div(id=id, style='margin: 0; padding: 0; display: none') runtime.is_standalone_viewer = True +runtime.FAKE_HOST = FAKE_HOST +runtime.FAKE_PROTOCOL = FAKE_PROTOCOL book = None view = None @@ -57,56 +60,8 @@ def get_file(book, name, proceed): xhr.send() -def mathjax_file_received(name, proceed, end_type, xhr, ev): - if end_type is 'abort': - return - if end_type is not 'load': - show_error(_('Failed to load MathJax file'), _( - 'Could not load the file: {} with error: {}').format(name, xhr.error_html)) - return - if not xhr.responseType or xhr.responseType is 'text': - result = xhr.responseText - else if xhr.responseType is 'blob' or xhr.responseType is 'json': - result = xhr.response - else: - show_error(_('Failed to load MathJax file'), _( - 'Could not load the file: {} unknown response type: {}').format(name, xhr.responseType)) - return - if name is 'manifest.json': - get_mathjax_files.manifest = result - get_mathjax_files_stage2.files_to_get = list(Object.keys(result)) - get_mathjax_files_stage2.file_data = {} - get_mathjax_files_stage2(proceed) - return - - get_mathjax_files_stage2.file_data[name] = result - get_mathjax_files_stage2.files_to_get.remove(name) - if not get_mathjax_files_stage2.files_to_get.length: - proceed(get_mathjax_files_stage2.file_data) - - -def get_mathjax_manifest(proceed): - xhr = ajax('mathjax/manifest.json', mathjax_file_received.bind(None, 'manifest.json', proceed), ok_code=0) - xhr.responseType = 'json' - xhr.send() - - -def get_mathjax_files_stage2(proceed): - if not get_mathjax_files_stage2.files_to_get.length: - proceed(get_mathjax_files_stage2.file_data) - return - for filename in get_mathjax_files_stage2.files_to_get: - xhr = ajax(f'mathjax/{filename}', mathjax_file_received.bind(None, filename, proceed), ok_code=0) - xhr.responseType = 'blob' - xhr.send() - - - def get_mathjax_files(proceed): - if not get_mathjax_files.manifest: - get_mathjax_manifest(proceed) - else: - get_mathjax_files_stage2(proceed) + proceed({}) def update_url_state(replace): From bd99a17186a76a1f80724c9731c3f2010d09ceab Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Dec 2018 18:07:13 +0530 Subject: [PATCH 1356/2613] Back to loading mathjax via blob urls Fucking stupid Content Security Policy --- src/calibre/gui2/viewer2/mathjax.py | 58 ++++++++++++++++++++++++++++ src/calibre/gui2/viewer2/web_view.py | 28 ++++++++++---- src/pyj/read_book/mathjax.pyj | 16 +++++++- src/pyj/read_book/view.pyj | 2 +- src/pyj/viewer-main.pyj | 50 +++++++++++++++++++++++- 5 files changed, 142 insertions(+), 12 deletions(-) create mode 100644 src/calibre/gui2/viewer2/mathjax.py diff --git a/src/calibre/gui2/viewer2/mathjax.py b/src/calibre/gui2/viewer2/mathjax.py new file mode 100644 index 0000000000..ce9cafbe30 --- /dev/null +++ b/src/calibre/gui2/viewer2/mathjax.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +# License: GPL v3 Copyright: 2018, Kovid Goyal + +from __future__ import absolute_import, division, print_function, unicode_literals + +PATCHED_MATHJAX = ''' + +function postprocess_mathjax(link_uid) { + Array.prototype.forEach.call(document.getElementsByTagName('a'), function(a) { + var href = a.getAttribute('href'); + if (href && href.startsWith('#')) { + a.setAttribute('href', 'javascript: void(0)') + a.setAttribute('data-' + link_uid, JSON.stringify({'frag':href.slice(1)})) + } + }); + document.documentElement.dispatchEvent(new CustomEvent("calibre-mathjax-init-done")); +} + +function monkeypatch(mathjax_files) { + var orig = window.MathJax.Ajax.fileURL.bind(window.MathJax.Ajax); + + window.MathJax.Ajax.fileURL = function(mathjax_name) { + var ans = orig(mathjax_name); + var name = ans.replace(/^\\//g, ''); + if (name.startsWith('../fonts')) name = name.slice(3); + ans = mathjax_files[name]; + if (!ans) ans = ''; + if (typeof ans !== 'string') { + mathjax_files[name] = window.URL.createObjectURL(ans); + ans = mathjax_files[name]; + } + if (ans === name && !name.startsWith('blob:')) { + if (ans.endsWith('.eot') || ans.endsWith('.otf')) return ''; + console.log('WARNING: Failed to resolve MathJax file: ' + mathjax_name); + } + return ans; + } + window.MathJax.Ajax.fileRev = function(mathjax_name) { return ''; } +} + +function init_mathjax(link_uid, mathjax_files) { + monkeypatch(mathjax_files); + window.MathJax.Hub.Register.StartupHook("End", postprocess_mathjax.bind(this, link_uid)) +} + +document.documentElement.addEventListener("calibre-mathjax-init", function(ev) { + +window.MathJax = ev.detail.MathJax; +window.MathJax.AuthorInit = init_mathjax.bind(this, ev.detail.link_uid, ev.detail.mathjax_files); + +__SRC__ +}); +''' + + +def monkeypatch_mathjax(src): + return PATCHED_MATHJAX.replace('__SRC__', src, 1) diff --git a/src/calibre/gui2/viewer2/web_view.py b/src/calibre/gui2/viewer2/web_view.py index 7a29b89a20..92f851181a 100644 --- a/src/calibre/gui2/viewer2/web_view.py +++ b/src/calibre/gui2/viewer2/web_view.py @@ -62,7 +62,7 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): def __init__(self, parent=None): QWebEngineUrlSchemeHandler.__init__(self, parent) - self.mathjax_tdir = None + self.mathjax_tdir = self.mathjax_manifest = None def requestStarted(self, rq): if bytes(rq.requestMethod()) != b'GET': @@ -99,16 +99,28 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): data = b'[' + manifest + b',' + metadata + b']' self.send_reply(rq, mime_type, data) elif name.startswith('mathjax/'): - if self.mathjax_tdir is None: - from calibre.srv.books import get_mathjax_manifest - self.mathjax_tdir = PersistentTemporaryDirectory(prefix='v2mjx-') - get_mathjax_manifest(self.mathjax_tdir) - + from calibre.gui2.viewer2.mathjax import monkeypatch_mathjax + if name == 'mathjax/manifest.json': + if self.mathjax_tdir is None: + import json + from calibre.srv.books import get_mathjax_manifest + self.mathjax_tdir = PersistentTemporaryDirectory(prefix='v2mjx-') + self.mathjax_manifest = json.dumps(get_mathjax_manifest(self.mathjax_tdir)['files']) + self.send_reply(rq, 'application/json', self.mathjax_manifest) + return path = os.path.abspath(os.path.join(self.mathjax_tdir, name)) if path.startswith(self.mathjax_tdir): mt = guess_type(name) - with lopen(path, 'rb') as f: - raw = f.read() + try: + with lopen(path, 'rb') as f: + raw = f.read() + except EnvironmentError as err: + prints("Failed to get mathjax file: {} with error: {}".format(name, err)) + rq.fail(rq.RequestFailed) + return + if 'MathJax.js' in name: + raw = monkeypatch_mathjax(raw.decode('utf-8')).encode('utf-8') + self.send_reply(rq, mt, raw) def send_reply(self, rq, mime_type, data): diff --git a/src/pyj/read_book/mathjax.pyj b/src/pyj/read_book/mathjax.pyj index f0ce401494..1de72145b1 100644 --- a/src/pyj/read_book/mathjax.pyj +++ b/src/pyj/read_book/mathjax.pyj @@ -15,6 +15,7 @@ def get_url(mathjax_files, name): ans = mathjax_files[name] = window.URL.createObjectURL(ans) return ans + def monkeypatch(mathjax_files): StyleString = window.MathJax.Ajax.StyleString.bind(window.MathJax.Ajax) @@ -72,7 +73,18 @@ def apply_mathjax(mathjax_files, link_uid, proceed): script = E.script(type='text/javascript') document.head.appendChild(script) if runtime.is_standalone_viewer: - script.src = f'{runtime.FAKE_PROTOCOL}://{runtime.FAKE_HOST}/mathjax/MathJax.js' + script.onload = def(): + ev = new CustomEvent("calibre-mathjax-init", { + 'detail': { + 'MathJax': m, + 'link_uid': link_uid, + 'mathjax_files': mathjax_files, + } + }) + document.documentElement.dispatchEvent(ev) + document.documentElement.addEventListener("calibre-mathjax-init-done", def(ev): + proceed() + ) else: m.AuthorInit = init_mathjax.bind(this, mathjax_files, link_uid, proceed) - script.src = get_url(mathjax_files, 'MathJax.js') + script.src = get_url(mathjax_files, 'MathJax.js') diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index b37c2673ff..2b7cfbd3f1 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -168,7 +168,7 @@ class View: 'human_scroll': self.on_human_scroll, } entry_point = None if runtime.is_standalone_viewer else 'read_book.iframe' - self.iframe_wrapper = IframeWrapper(handlers, document.getElementById(iframe_id), entry_point, _('Bootstrapping book reader...')) + self.iframe_wrapper = IframeWrapper(handlers, document.getElementById(iframe_id), entry_point, _('Bootstrapping book reader...'), runtime.FAKE_PROTOCOL, runtime.FAKE_HOST) self.search_overlay = SearchOverlay(self) self.content_popup_overlay = ContentPopupOverlay(self) self.overlay = Overlay(self) diff --git a/src/pyj/viewer-main.pyj b/src/pyj/viewer-main.pyj index 641e1f4d62..5dda2545f8 100644 --- a/src/pyj/viewer-main.pyj +++ b/src/pyj/viewer-main.pyj @@ -59,9 +59,57 @@ def get_file(book, name, proceed): xhr.responseType = 'blob' xhr.send() +def mathjax_file_received(name, proceed, end_type, xhr, ev): + if end_type is 'abort': + return + if end_type is not 'load': + show_error(_('Failed to load MathJax file'), _( + 'Could not load the file: {} with error: {}').format(name, xhr.error_html)) + return + if not xhr.responseType or xhr.responseType is 'text': + result = xhr.responseText + else if xhr.responseType is 'blob' or xhr.responseType is 'json': + result = xhr.response + else: + show_error(_('Failed to load MathJax file'), _( + 'Could not load the file: {} unknown response type: {}') +.format(name, xhr.responseType)) + return + if name is 'manifest.json': + get_mathjax_files.manifest = result + get_mathjax_files_stage2.files_to_get = list(Object.keys(result)) + get_mathjax_files_stage2.file_data = {} + get_mathjax_files_stage2(proceed) + return + + get_mathjax_files_stage2.file_data[name] = result + get_mathjax_files_stage2.files_to_get.remove(name) + if not get_mathjax_files_stage2.files_to_get.length: + proceed(get_mathjax_files_stage2.file_data) + +def get_mathjax_manifest(proceed): + xhr = ajax('mathjax/manifest.json', mathjax_file_received.bind(None, 'manifest.json', proceed), ok_code=0) + xhr.responseType = 'json' + xhr.send() + + +def get_mathjax_files_stage2(proceed): + if not get_mathjax_files_stage2.files_to_get.length: + proceed(get_mathjax_files_stage2.file_data) + return + for filename in get_mathjax_files_stage2.files_to_get: + xhr = ajax(f'mathjax/{filename}', mathjax_file_received.bind(None, filename, proceed), ok_code=0) + xhr.responseType = 'blob' + xhr.send() + + def get_mathjax_files(proceed): - proceed({}) + if not get_mathjax_files.manifest: + get_mathjax_manifest(proceed) + else: + get_mathjax_files_stage2(proceed) + def update_url_state(replace): From a3ac8282d469920797f15a5ba87283df9224199e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Dec 2018 18:39:39 +0530 Subject: [PATCH 1357/2613] Fix loading of mathjax files --- src/calibre/gui2/viewer2/mathjax.py | 6 +++--- src/calibre/gui2/viewer2/web_view.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/viewer2/mathjax.py b/src/calibre/gui2/viewer2/mathjax.py index ce9cafbe30..b48e384175 100644 --- a/src/calibre/gui2/viewer2/mathjax.py +++ b/src/calibre/gui2/viewer2/mathjax.py @@ -25,14 +25,14 @@ function monkeypatch(mathjax_files) { var name = ans.replace(/^\\//g, ''); if (name.startsWith('../fonts')) name = name.slice(3); ans = mathjax_files[name]; - if (!ans) ans = ''; + if (!ans) ans = name; if (typeof ans !== 'string') { mathjax_files[name] = window.URL.createObjectURL(ans); ans = mathjax_files[name]; } if (ans === name && !name.startsWith('blob:')) { - if (ans.endsWith('.eot') || ans.endsWith('.otf')) return ''; - console.log('WARNING: Failed to resolve MathJax file: ' + mathjax_name); + if (ans.endsWith('.eot') || ans.endsWith('.otf')) ans = ''; + else console.log('WARNING: Failed to resolve MathJax file: ' + mathjax_name); } return ans; } diff --git a/src/calibre/gui2/viewer2/web_view.py b/src/calibre/gui2/viewer2/web_view.py index 92f851181a..9f97fd92f6 100644 --- a/src/calibre/gui2/viewer2/web_view.py +++ b/src/calibre/gui2/viewer2/web_view.py @@ -119,6 +119,7 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): rq.fail(rq.RequestFailed) return if 'MathJax.js' in name: + # raw = open(os.path.expanduser('~/work/mathjax/unpacked/MathJax.js')).read() raw = monkeypatch_mathjax(raw.decode('utf-8')).encode('utf-8') self.send_reply(rq, mt, raw) From 46c646e49d328cf2bc9473f659e06cd8ebfa8318 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 14 Dec 2018 07:09:17 +0530 Subject: [PATCH 1358/2613] Ensure the QWebEngineProfile has a parent --- src/calibre/gui2/viewer2/web_view.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/viewer2/web_view.py b/src/calibre/gui2/viewer2/web_view.py index 9f97fd92f6..8c2f3d873b 100644 --- a/src/calibre/gui2/viewer2/web_view.py +++ b/src/calibre/gui2/viewer2/web_view.py @@ -170,7 +170,9 @@ class ViewerBridge(Bridge): class WebPage(QWebEnginePage): def __init__(self, parent): - QWebEnginePage.__init__(self, create_profile(), parent) + profile = create_profile() + QWebEnginePage.__init__(self, profile, parent) + profile.setParent(self) secure_webengine(self, for_viewer=True) self.bridge = ViewerBridge(self) From e4e313f1d63f2f906cf198d88272beb7f6fd692c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 15 Dec 2018 13:16:53 +0530 Subject: [PATCH 1359/2613] Proper fix for random crashes --- src/calibre/gui2/viewer2/web_view.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/viewer2/web_view.py b/src/calibre/gui2/viewer2/web_view.py index 8c2f3d873b..a526af7359 100644 --- a/src/calibre/gui2/viewer2/web_view.py +++ b/src/calibre/gui2/viewer2/web_view.py @@ -127,6 +127,8 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): def send_reply(self, rq, mime_type, data): if sip.isdeleted(rq): return + # make the buf a child of rq so that it is automatically deleted when + # rq is deleted buf = QBuffer(parent=rq) buf.open(QBuffer.WriteOnly) # we have to copy data into buf as it will be garbage @@ -134,9 +136,7 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): buf.write(data) buf.seek(0) buf.close() - buf.aboutToClose.connect(buf.deleteLater) rq.reply(mime_type.encode('ascii'), buf) - # }}} From f990929bef24cc1d14566e7b250ebc78144dce5a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 17 Dec 2018 16:02:12 +0530 Subject: [PATCH 1360/2613] Add code to handle unpatched MathJax --- src/calibre/gui2/viewer2/mathjax.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/viewer2/mathjax.py b/src/calibre/gui2/viewer2/mathjax.py index b48e384175..121e9d4e76 100644 --- a/src/calibre/gui2/viewer2/mathjax.py +++ b/src/calibre/gui2/viewer2/mathjax.py @@ -19,6 +19,20 @@ function postprocess_mathjax(link_uid) { function monkeypatch(mathjax_files) { var orig = window.MathJax.Ajax.fileURL.bind(window.MathJax.Ajax); + var StyleString = window.MathJax.Ajax.StyleString.bind(window.MathJax.Ajax); + + window.MathJax.Ajax.StyleString = function(styles) { + return StyleString(styles).replace(/url\\('?(.*?)'?\\)/g, function(match, url) { + if (!url.endsWith('.woff')) return match; + url = mathjax_files[url]; + if (!url) return match; + if (typeof url != "string") { + url = window.URL.createObjectURL(url); + mathjax_files[name] = url; + } + return "url('" + url + "')"; + }); + } window.MathJax.Ajax.fileURL = function(mathjax_name) { var ans = orig(mathjax_name); @@ -30,7 +44,7 @@ function monkeypatch(mathjax_files) { mathjax_files[name] = window.URL.createObjectURL(ans); ans = mathjax_files[name]; } - if (ans === name && !name.startsWith('blob:')) { + if (ans === name && !name.startsWith('blob:') && !name.endsWith('/eot') && !name.endsWith('/woff') && !name.endsWith('/otf')) { if (ans.endsWith('.eot') || ans.endsWith('.otf')) ans = ''; else console.log('WARNING: Failed to resolve MathJax file: ' + mathjax_name); } From 148c7ba86868789079c1d9dc56c71631a124089b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 24 Dec 2018 13:44:00 +0530 Subject: [PATCH 1361/2613] Add a global TODO file --- engine-TODO.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 engine-TODO.rst diff --git a/engine-TODO.rst b/engine-TODO.rst new file mode 100644 index 0000000000..2f4e27e431 --- /dev/null +++ b/engine-TODO.rst @@ -0,0 +1,5 @@ +Update coretext_fontdatabase.mm + +Just import the one from Qt 5.12 wholesale. There have been lots of +improvements to it and hopefully it will just continue to work. +The original file was imported wholesale from Qt 5.6 From 2ccbe705b24558e236df03085a502d402c802a22 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 4 Jan 2019 22:10:33 +0530 Subject: [PATCH 1362/2613] Rebuild coffeescript --- resources/compiled_coffeescript.zip | Bin 103366 -> 87844 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/resources/compiled_coffeescript.zip b/resources/compiled_coffeescript.zip index 275b5da8094f4c814ae7e45694dce5656a1e41a6..c71bb11388a746dbbde0f2e6982de49ec53074e8 100644 GIT binary patch delta 262 zcmX@MoNdWER=xmlW)=|!5U|~-;1_Rs-e8lbhxRji08O4gzn{?)qUudQqbu0B>82B4thxz|)}pLzAjfh5VK5T|LqrfG zLo!qK^a+y~MW%O6X0)E3IFV6oy1*nx@9A&)7`di5P6UeOPh{knt}~I*d3uH?qri0c N$v{^0B*t@$wE*VsPXPb` delta 11406 zcmb61(Vc^X?MWsww5-Fl>C&91q-CMAnj#L$i+tFa=HIw-kC2!Wd2eajtjc4sv+ zONu%=HsSz{8`w^s+wqSEb=sman!>7^A5H}15L&c9;>31=q5+zuF_K?(5BFDq7HIl? z-*P z{_~a1dEBY{#Gar1!_>NU_-_v!!;7}PH< zqn7Q+uQkIfRXI#_T{+;|O{c^yv(6Wca@pb0xVLKYg@$7{_|uMOa+q$`7d)eAarow{ z?crP1ESEVTVA+c~1`A5C$AZ(eaEV)TY|C2k?1j2r=Hk6?%nQBr`ORuou(wy+xwKL> zEzUCB;oG0 z5l*Swb*=|r9@7TIyY|3VoW`bUw%B}gpLn^q2hk#~1^arn9lgtj!yH}#A`pY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jan 2019 22:28:16 +0530 Subject: [PATCH 1363/2613] Use new mathjax location in viewer2 --- src/calibre/gui2/viewer2/web_view.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/calibre/gui2/viewer2/web_view.py b/src/calibre/gui2/viewer2/web_view.py index a526af7359..9872c307b0 100644 --- a/src/calibre/gui2/viewer2/web_view.py +++ b/src/calibre/gui2/viewer2/web_view.py @@ -24,7 +24,6 @@ from calibre.gui2.webengine import ( Bridge, RestartingWebEngineView, create_script, from_js, insert_scripts, secure_webengine, to_js ) -from calibre.ptempfile import PersistentTemporaryDirectory from calibre.utils.config import JSONConfig try: @@ -62,7 +61,8 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): def __init__(self, parent=None): QWebEngineUrlSchemeHandler.__init__(self, parent) - self.mathjax_tdir = self.mathjax_manifest = None + self.mathjax_dir = P('mathjax', allow_user_override=False) + self.mathjax_manifest = None def requestStarted(self, rq): if bytes(rq.requestMethod()) != b'GET': @@ -101,15 +101,14 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): elif name.startswith('mathjax/'): from calibre.gui2.viewer2.mathjax import monkeypatch_mathjax if name == 'mathjax/manifest.json': - if self.mathjax_tdir is None: + if self.mathjax_manifest is None: import json from calibre.srv.books import get_mathjax_manifest - self.mathjax_tdir = PersistentTemporaryDirectory(prefix='v2mjx-') - self.mathjax_manifest = json.dumps(get_mathjax_manifest(self.mathjax_tdir)['files']) + self.mathjax_manifest = json.dumps(get_mathjax_manifest()['files']) self.send_reply(rq, 'application/json', self.mathjax_manifest) return - path = os.path.abspath(os.path.join(self.mathjax_tdir, name)) - if path.startswith(self.mathjax_tdir): + path = os.path.abspath(os.path.join(self.mathjax_dir, '..', name)) + if path.startswith(self.mathjax_dir): mt = guess_type(name) try: with lopen(path, 'rb') as f: From 2c15434babeca2dee15243adcda771c364cc5ba8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 5 Feb 2019 08:37:25 +0530 Subject: [PATCH 1364/2613] DRYer --- src/calibre/gui2/tweak_book/preview.py | 28 ++++---------------- src/calibre/gui2/viewer2/web_view.py | 36 ++++++++++++++------------ 2 files changed, 24 insertions(+), 40 deletions(-) diff --git a/src/calibre/gui2/tweak_book/preview.py b/src/calibre/gui2/tweak_book/preview.py index db07de700a..8125b8ba06 100644 --- a/src/calibre/gui2/tweak_book/preview.py +++ b/src/calibre/gui2/tweak_book/preview.py @@ -14,8 +14,8 @@ from functools import partial from threading import Thread from PyQt5.Qt import ( - QApplication, QBuffer, QByteArray, QHBoxLayout, QIcon, QMenu, QSize, QTimer, - QToolBar, QUrl, QVBoxLayout, QWidget, pyqtSignal + QApplication, QByteArray, QHBoxLayout, QIcon, QMenu, QSize, QTimer, QToolBar, + QUrl, QVBoxLayout, QWidget, pyqtSignal ) from PyQt5.QtWebEngineCore import QWebEngineUrlSchemeHandler from PyQt5.QtWebEngineWidgets import ( @@ -30,6 +30,7 @@ from calibre.ebooks.oeb.base import OEB_DOCS, XHTML_MIME, serialize from calibre.ebooks.oeb.polish.parsing import parse from calibre.gui2 import NO_URL_FORMATTING, error_dialog, open_url from calibre.gui2.tweak_book import TOP, actions, current_container, editors, tprefs +from calibre.gui2.viewer2.web_view import send_reply from calibre.gui2.webengine import ( Bridge, RestartingWebEngineView, create_script, from_js, insert_scripts, secure_webengine, to_js @@ -40,12 +41,6 @@ from polyglot.builtins import unicode_type from polyglot.queue import Empty, Queue from polyglot.urllib import urlparse -try: - from PyQt5 import sip -except ImportError: - import sip - - shutdown = object() @@ -203,25 +198,12 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): 'application/x-font-truetype':'application/x-font-ttf', 'application/font-sfnt': 'application/x-font-ttf', }.get(mime_type, mime_type) - self.send_reply(rq, mime_type, data) + send_reply(rq, mime_type, data) except Exception: import traceback traceback.print_exc() rq.fail(rq.RequestFailed) - def send_reply(self, rq, mime_type, data): - if sip.isdeleted(rq): - return - buf = QBuffer(parent=rq) - buf.open(QBuffer.WriteOnly) - # we have to copy data into buf as it will be garbage - # collected by python - buf.write(data) - buf.seek(0) - buf.close() - buf.aboutToClose.connect(buf.deleteLater) - rq.reply(mime_type.encode('ascii'), buf) - def check_for_parse(self): remove = [] for name, requests in self.requests.iteritems(): @@ -230,7 +212,7 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): if not isinstance(data, bytes): data = data.encode('utf-8') for mime_type, rq in requests: - self.send_reply(rq, mime_type, data) + send_reply(rq, mime_type, data) remove.append(name) for name in remove: del self.requests[name] diff --git a/src/calibre/gui2/viewer2/web_view.py b/src/calibre/gui2/viewer2/web_view.py index 9872c307b0..cd52f74001 100644 --- a/src/calibre/gui2/viewer2/web_view.py +++ b/src/calibre/gui2/viewer2/web_view.py @@ -57,6 +57,21 @@ def get_data(name): return None, None +def send_reply(rq, mime_type, data): + if sip.isdeleted(rq): + return + # make the buf a child of rq so that it is automatically deleted when + # rq is deleted + buf = QBuffer(parent=rq) + buf.open(QBuffer.WriteOnly) + # we have to copy data into buf as it will be garbage + # collected by python + buf.write(data) + buf.seek(0) + buf.close() + rq.reply(mime_type.encode('ascii'), buf) + + class UrlSchemeHandler(QWebEngineUrlSchemeHandler): def __init__(self, parent=None): @@ -88,7 +103,7 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): 'application/x-font-truetype':'application/x-font-ttf', 'application/font-sfnt': 'application/x-font-ttf', }.get(mime_type, mime_type) - self.send_reply(rq, mime_type, data) + send_reply(rq, mime_type, data) except Exception: import traceback traceback.print_exc() @@ -97,7 +112,7 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): manifest, mime_type = get_data('calibre-book-manifest.json') metadata = get_data('calibre-book-metadata.json')[0] data = b'[' + manifest + b',' + metadata + b']' - self.send_reply(rq, mime_type, data) + send_reply(rq, mime_type, data) elif name.startswith('mathjax/'): from calibre.gui2.viewer2.mathjax import monkeypatch_mathjax if name == 'mathjax/manifest.json': @@ -105,7 +120,7 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): import json from calibre.srv.books import get_mathjax_manifest self.mathjax_manifest = json.dumps(get_mathjax_manifest()['files']) - self.send_reply(rq, 'application/json', self.mathjax_manifest) + send_reply(rq, 'application/json', self.mathjax_manifest) return path = os.path.abspath(os.path.join(self.mathjax_dir, '..', name)) if path.startswith(self.mathjax_dir): @@ -121,21 +136,8 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): # raw = open(os.path.expanduser('~/work/mathjax/unpacked/MathJax.js')).read() raw = monkeypatch_mathjax(raw.decode('utf-8')).encode('utf-8') - self.send_reply(rq, mt, raw) + send_reply(rq, mt, raw) - def send_reply(self, rq, mime_type, data): - if sip.isdeleted(rq): - return - # make the buf a child of rq so that it is automatically deleted when - # rq is deleted - buf = QBuffer(parent=rq) - buf.open(QBuffer.WriteOnly) - # we have to copy data into buf as it will be garbage - # collected by python - buf.write(data) - buf.seek(0) - buf.close() - rq.reply(mime_type.encode('ascii'), buf) # }}} From 289c42b87f507a56ac5aa0d1c9222518b1663f91 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 7 Feb 2019 09:49:21 +0530 Subject: [PATCH 1365/2613] Make the current CFI available in python --- src/calibre/gui2/viewer2/web_view.py | 10 ++++++++++ src/pyj/viewer-main.pyj | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/viewer2/web_view.py b/src/calibre/gui2/viewer2/web_view.py index cd52f74001..038db07f51 100644 --- a/src/calibre/gui2/viewer2/web_view.py +++ b/src/calibre/gui2/viewer2/web_view.py @@ -239,6 +239,7 @@ class WebView(RestartingWebEngineView): def __init__(self, parent=None): self._host_widget = None + self.current_cfi = None RestartingWebEngineView.__init__(self, parent) self.dead_renderer_error_shown = False self.render_process_failed.connect(self.render_process_died) @@ -251,11 +252,20 @@ class WebView(RestartingWebEngineView): self.setPage(self._page) self.setAcceptDrops(False) self.clear() + self.urlChanged.connect(self.url_changed) if parent is not None: self.inspector = Inspector(parent.inspector_dock.toggleViewAction(), self) parent.inspector_dock.setWidget(self.inspector) # QTimer.singleShot(300, lambda: (parent.inspector_dock.setVisible(True), parent.inspector_dock.setMinimumWidth(650))) + def url_changed(self, url): + if url.hasFragment(): + frag = url.fragment(url.FullyDecoded) + if frag and frag.startswith('bookpos='): + cfi = frag[len('bookpos='):] + if cfi: + self.current_cfi = cfi + @property def host_widget(self): ans = self._host_widget diff --git a/src/pyj/viewer-main.pyj b/src/pyj/viewer-main.pyj index 5dda2545f8..3a4cf247aa 100644 --- a/src/pyj/viewer-main.pyj +++ b/src/pyj/viewer-main.pyj @@ -18,6 +18,7 @@ from read_book.globals import runtime, ui_operations from read_book.iframe import main as iframe_main from read_book.view import View from session import session_defaults +from utils import encode_query_with_path from viewer.constants import FAKE_HOST, FAKE_PROTOCOL @@ -113,7 +114,12 @@ def get_mathjax_files(proceed): def update_url_state(replace): - pass # TODO: Implement this + if view and view.currently_showing: + bookpos = view.currently_showing.bookpos + if bookpos: + query = {'bookpos': bookpos} + query = encode_query_with_path(query) + window.history.pushState(None, '', query) def show_error(title, msg, details): From 08dfee07665717d6de046a4fd7d7a0b4f42ba433 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Feb 2019 11:05:06 +0530 Subject: [PATCH 1366/2613] Register the clbr: fake network scheme with web engine --- src/calibre/gui2/tweak_book/main.py | 7 ++++++- src/calibre/gui2/viewer2/main.py | 7 ++++++- src/calibre/gui2/webengine.py | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/tweak_book/main.py b/src/calibre/gui2/tweak_book/main.py index 9accee3af3..fd83516468 100644 --- a/src/calibre/gui2/tweak_book/main.py +++ b/src/calibre/gui2/tweak_book/main.py @@ -8,8 +8,9 @@ import sys import time from PyQt5.Qt import QIcon +from PyQt5.QtWebEngineCore import QWebEngineUrlScheme -from calibre.constants import EDITOR_APP_UID, islinux +from calibre.constants import EDITOR_APP_UID, FAKE_PROTOCOL, islinux from calibre.gui2 import ( Application, decouple, set_gui_prefs, setup_gui_option_parser ) @@ -52,6 +53,10 @@ def _run(args, notify=None): # Ensure we can continue to function if GUI is closed os.environ.pop('CALIBRE_WORKER_TEMP_DIR', None) reset_base_dir() + scheme = QWebEngineUrlScheme(FAKE_PROTOCOL.encode('ascii')) + scheme.setSyntax(QWebEngineUrlScheme.Syntax.Host) + scheme.setFlags(QWebEngineUrlScheme.SecureScheme) + QWebEngineUrlScheme.registerScheme(scheme) # The following two lines are needed to prevent circular imports causing # errors during initialization of plugins that use the polish container diff --git a/src/calibre/gui2/viewer2/main.py b/src/calibre/gui2/viewer2/main.py index dca9de93b0..a521d22064 100644 --- a/src/calibre/gui2/viewer2/main.py +++ b/src/calibre/gui2/viewer2/main.py @@ -11,9 +11,10 @@ import sys from threading import Thread from PyQt5.Qt import QIcon, QObject, Qt, QTimer, pyqtSignal +from PyQt5.QtWebEngineCore import QWebEngineUrlScheme from calibre import as_unicode, prints -from calibre.constants import VIEWER_APP_UID, islinux, iswindows +from calibre.constants import FAKE_PROTOCOL, VIEWER_APP_UID, islinux, iswindows from calibre.gui2 import ( Application, error_dialog, set_app_uid, setup_gui_option_parser ) @@ -125,6 +126,10 @@ def main(args=sys.argv): # Ensure viewer can continue to function if GUI is closed os.environ.pop('CALIBRE_WORKER_TEMP_DIR', None) reset_base_dir() + scheme = QWebEngineUrlScheme(FAKE_PROTOCOL.encode('ascii')) + scheme.setSyntax(QWebEngineUrlScheme.Syntax.Host) + scheme.setFlags(QWebEngineUrlScheme.SecureScheme) + QWebEngineUrlScheme.registerScheme(scheme) if iswindows: # Ensure that all ebook viewer instances are grouped together in the task # bar. This prevents them from being grouped with the editor process when diff --git a/src/calibre/gui2/webengine.py b/src/calibre/gui2/webengine.py index fbd7efec41..1c56c6f762 100644 --- a/src/calibre/gui2/webengine.py +++ b/src/calibre/gui2/webengine.py @@ -6,8 +6,8 @@ from __future__ import absolute_import, division, print_function, unicode_litera import json -from PyQt5.Qt import QObject, Qt, QWebEnginePage, pyqtSignal -from PyQt5.QtWebEngineWidgets import QWebEngineScript, QWebEngineView +from PyQt5.Qt import QObject, Qt, pyqtSignal +from PyQt5.QtWebEngineWidgets import QWebEnginePage, QWebEngineScript, QWebEngineView from calibre import prints from calibre.utils.monotonic import monotonic From 9c897eb9269f2ba7c1e133a2bbad18adb8585cf6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 26 Mar 2019 18:07:42 +0530 Subject: [PATCH 1367/2613] Some more iteritems fixes --- src/calibre/gui2/tweak_book/preview.py | 4 ++-- src/calibre/gui2/viewer2/web_view.py | 3 ++- src/calibre/gui2/webengine.py | 7 ++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/calibre/gui2/tweak_book/preview.py b/src/calibre/gui2/tweak_book/preview.py index 8125b8ba06..eb818ec645 100644 --- a/src/calibre/gui2/tweak_book/preview.py +++ b/src/calibre/gui2/tweak_book/preview.py @@ -37,7 +37,7 @@ from calibre.gui2.webengine import ( ) from calibre.gui2.widgets2 import HistoryLineEdit2 from calibre.utils.ipc.simple_worker import offload_worker -from polyglot.builtins import unicode_type +from polyglot.builtins import iteritems, unicode_type from polyglot.queue import Empty, Queue from polyglot.urllib import urlparse @@ -206,7 +206,7 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler): def check_for_parse(self): remove = [] - for name, requests in self.requests.iteritems(): + for name, requests in iteritems(self.requests): data = parse_worker.get_data(name) if data is not None: if not isinstance(data, bytes): diff --git a/src/calibre/gui2/viewer2/web_view.py b/src/calibre/gui2/viewer2/web_view.py index 038db07f51..448c798d35 100644 --- a/src/calibre/gui2/viewer2/web_view.py +++ b/src/calibre/gui2/viewer2/web_view.py @@ -25,6 +25,7 @@ from calibre.gui2.webengine import ( secure_webengine, to_js ) from calibre.utils.config import JSONConfig +from polyglot.builtins import iteritems try: from PyQt5 import sip @@ -301,7 +302,7 @@ class WebView(RestartingWebEngineView): return self._page.bridge def on_bridge_ready(self): - for func, args in self.pending_bridge_ready_actions.iteritems(): + for func, args in iteritems(self.pending_bridge_ready_actions): getattr(self.bridge, func)(*args) def start_book_load(self): diff --git a/src/calibre/gui2/webengine.py b/src/calibre/gui2/webengine.py index 1c56c6f762..f2e00d289e 100644 --- a/src/calibre/gui2/webengine.py +++ b/src/calibre/gui2/webengine.py @@ -12,6 +12,7 @@ from PyQt5.QtWebEngineWidgets import QWebEnginePage, QWebEngineScript, QWebEngin from calibre import prints from calibre.utils.monotonic import monotonic from calibre.utils.rapydscript import special_title +from polyglot.builtins import iteritems def secure_webengine(view_or_page_or_settings, for_viewer=False): @@ -77,10 +78,10 @@ class Bridge(QObject): def __init__(self, page): QObject.__init__(self, page) - self._signals = json.dumps(tuple({k for k, v in self.__class__.__dict__.iteritems() if isinstance(v, pyqtSignal)})) + self._signals = json.dumps(tuple({k for k, v in iteritems(self.__class__.__dict__) if isinstance(v, pyqtSignal)})) self._signals_registered = False page.titleChanged.connect(self._title_changed) - for k, v in self.__class__.__dict__.iteritems(): + for k, v in iteritems(self.__class__.__dict__): if isinstance(v, to_js): v.name = k @@ -98,7 +99,7 @@ class Bridge(QObject): def _register_signals(self): self._signals_registered = True - for k, v in self.__class__.__dict__.iteritems(): + for k, v in iteritems(self.__class__.__dict__): if isinstance(v, to_js): setattr(self, k, to_js_bound(self, k)) self.page.runJavaScript('python_comm._register_signals(' + self._signals + ')', QWebEngineScript.ApplicationWorld) From 47d2364a805d05e4cccd6f7db3db0b05fade9a5a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 29 Mar 2019 09:44:49 +0530 Subject: [PATCH 1368/2613] Explicitly use system proxy in QNetwork --- src/calibre/gui2/__init__.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 7fe34c7ef8..aa1ca33c64 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -16,9 +16,9 @@ from threading import Lock, RLock from PyQt5.Qt import ( QT_VERSION, QApplication, QBuffer, QByteArray, QCoreApplication, QDateTime, QDesktopServices, QDialog, QEvent, QFileDialog, QFileIconProvider, QFileInfo, - QFont, QFontDatabase, QFontInfo, QFontMetrics, QIcon, QLocale, QObject, - QSettings, QSocketNotifier, QStringListModel, Qt, QThread, QTimer, QTranslator, - QUrl, pyqtSignal + QFont, QFontDatabase, QFontInfo, QFontMetrics, QIcon, QLocale, + QNetworkProxyFactory, QObject, QSettings, QSocketNotifier, QStringListModel, Qt, + QThread, QTimer, QTranslator, QUrl, pyqtSignal ) from PyQt5.QtWidgets import QStyle # Gives a nicer error message than import from Qt @@ -38,9 +38,10 @@ from calibre.utils.config import Config, ConfigProxy, JSONConfig, dynamic from calibre.utils.date import UNDEFINED_DATE from calibre.utils.file_type_icons import EXT_MAP from calibre.utils.localization import get_lang -from polyglot.builtins import (iteritems, itervalues, unicode_type, - string_or_bytes, range, map) from polyglot import queue +from polyglot.builtins import ( + iteritems, itervalues, range, string_or_bytes, unicode_type, map +) try: NO_URL_FORMATTING = QUrl.None_ @@ -817,6 +818,7 @@ class Application(QApplication): shutdown_signal_received = pyqtSignal() def __init__(self, args, force_calibre_style=False, override_program_name=None, headless=False, color_prefs=gprefs, windows_app_uid=None): + QNetworkProxyFactory.setUseSystemConfiguration(True) if iswindows: self.windows_app_uid = None if windows_app_uid: From 581c5d898816e9556dea4bfc4b4220b17595fd4d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 29 Mar 2019 09:45:19 +0530 Subject: [PATCH 1369/2613] Remove unneccessary reference to QWebView in .ui file --- src/calibre/gui2/store/web_store_dialog.ui | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/calibre/gui2/store/web_store_dialog.ui b/src/calibre/gui2/store/web_store_dialog.ui index 40f143651c..fbc09e0e5f 100644 --- a/src/calibre/gui2/store/web_store_dialog.ui +++ b/src/calibre/gui2/store/web_store_dialog.ui @@ -82,14 +82,9 @@ - - QWebView - QWidget -
    PyQt5/QtWebKitWidgets
    -
    NPWebView - QWebView + QWidget
    calibre/gui2/store/web_control.h
    From c8e78749eb261c664cb75d3e656adfa6d5daaab7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 29 Mar 2019 13:15:49 +0530 Subject: [PATCH 1370/2613] Start work on migrating get books internal browser to web engine --- src/calibre/constants.py | 1 + src/calibre/gui2/store/web_control.py | 136 --------------------- src/calibre/gui2/store/web_store.py | 112 +++++++++++++++++ src/calibre/gui2/store/web_store_dialog.py | 69 ++++------- src/calibre/gui2/store/web_store_dialog.ui | 110 ----------------- src/calibre/gui_launch.py | 7 ++ src/calibre/utils/ipc/worker.py | 3 + 7 files changed, 147 insertions(+), 291 deletions(-) delete mode 100644 src/calibre/gui2/store/web_control.py create mode 100644 src/calibre/gui2/store/web_store.py delete mode 100644 src/calibre/gui2/store/web_store_dialog.ui diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 4010761ff5..d8bbf2d2c2 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -43,6 +43,7 @@ FAKE_PROTOCOL, FAKE_HOST = 'clbr', 'internal.invalid' VIEWER_APP_UID = 'com.calibre-ebook.viewer' EDITOR_APP_UID = 'com.calibre-ebook.edit-book' MAIN_APP_UID = 'com.calibre-ebook.main-gui' +STORE_DIALOG_APP_UID = 'com.calibre-ebook.store-dialog' try: preferred_encoding = locale.getpreferredencoding() codecs.lookup(preferred_encoding) diff --git a/src/calibre/gui2/store/web_control.py b/src/calibre/gui2/store/web_control.py deleted file mode 100644 index 88c760e828..0000000000 --- a/src/calibre/gui2/store/web_control.py +++ /dev/null @@ -1,136 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, division, print_function, unicode_literals - - -__license__ = 'GPL 3' -__copyright__ = '2011, John Schember ' -__docformat__ = 'restructuredtext en' - -import os - -from PyQt5.Qt import QNetworkCookieJar, QNetworkProxy -from PyQt5.QtWebKitWidgets import QWebView, QWebPage - -from calibre import USER_AGENT, get_proxies -from calibre.ebooks import BOOK_EXTENSIONS -from calibre.gui2 import choose_save_file, NO_URL_FORMATTING -from calibre.gui2.ebook_download import show_download_info -from calibre.ptempfile import PersistentTemporaryFile -from calibre.utils.filenames import ascii_filename -from calibre.web import get_download_filename -from polyglot.builtins import unicode_type -from polyglot.urllib import urlparse - - -class NPWebView(QWebView): - - def __init__(self, *args): - QWebView.__init__(self, *args) - self.gui = None - self.tags = '' - self.create_browser = None - - self._page = NPWebPage() - self.setPage(self._page) - self.cookie_jar = QNetworkCookieJar() - self.page().networkAccessManager().setCookieJar(self.cookie_jar) - - http_proxy = get_proxies().get('http', None) - if http_proxy: - proxy_parts = urlparse(http_proxy) - proxy = QNetworkProxy() - proxy.setType(QNetworkProxy.HttpProxy) - if proxy_parts.username: - proxy.setUser(proxy_parts.username) - if proxy_parts.password: - proxy.setPassword(proxy_parts.password) - if proxy_parts.hostname: - proxy.setHostName(proxy_parts.hostname) - if proxy_parts.port: - proxy.setPort(proxy_parts.port) - self.page().networkAccessManager().setProxy(proxy) - - self.page().setForwardUnsupportedContent(True) - self.page().unsupportedContent.connect(self.start_download) - self.page().downloadRequested.connect(self.start_download) - self.page().networkAccessManager().sslErrors.connect(self.ignore_ssl_errors) - - def createWindow(self, type): - if type == QWebPage.WebBrowserWindow: - return self - else: - return None - - def set_gui(self, gui): - self.gui = gui - - def set_tags(self, tags): - self.tags = tags - - def start_download(self, request): - if not self.gui: - return - - url = unicode_type(request.url().toString(NO_URL_FORMATTING)) - cf = self.get_cookies() - - filename = get_download_filename(url, cf) - ext = os.path.splitext(filename)[1][1:].lower() - filename = ascii_filename(filename[:60] + '.' + ext) - if ext not in BOOK_EXTENSIONS: - if ext == 'acsm': - from calibre.gui2.dialogs.confirm_delete import confirm - if not confirm('

    ' + _('This e-book is a DRMed EPUB file. ' - 'You will be prompted to save this file to your ' - 'computer. Once it is saved, open it with ' - '' - 'Adobe Digital Editions (ADE).

    ADE, in turn ' - 'will download the actual e-book, which will be a ' - '.epub file. You can add this book to calibre ' - 'using "Add Books" and selecting the file from ' - 'the ADE library folder.'), - 'acsm_download', self): - return - name = choose_save_file(self, 'web-store-download-unknown', _('File is not a supported e-book type. Save to disk?'), initial_filename=filename) - if name: - self.gui.download_ebook(url, cf, name, name, False, create_browser=self.create_browser) - else: - show_download_info(filename, self) - self.gui.download_ebook(url, cf, filename, tags=self.tags, create_browser=self.create_browser) - - def ignore_ssl_errors(self, reply, errors): - reply.ignoreSslErrors(errors) - - def get_cookies(self): - ''' - Writes QNetworkCookies to Mozilla cookie .txt file. - - :return: The file path to the cookie file. - ''' - cf = PersistentTemporaryFile(suffix='.txt') - - cf.write('# Netscape HTTP Cookie File\n\n') - - for c in self.page().networkAccessManager().cookieJar().allCookies(): - cookie = [] - domain = unicode_type(c.domain()) - - cookie.append(domain) - cookie.append('TRUE' if domain.startswith('.') else 'FALSE') - cookie.append(unicode_type(c.path())) - cookie.append('TRUE' if c.isSecure() else 'FALSE') - cookie.append(unicode_type(c.expirationDate().toTime_t())) - cookie.append(unicode_type(c.name())) - cookie.append(unicode_type(c.value())) - - cf.write('\t'.join(cookie)) - cf.write('\n') - - cf.close() - return cf.name - - -class NPWebPage(QWebPage): - - def userAgentForUrl(self, url): - return USER_AGENT diff --git a/src/calibre/gui2/store/web_store.py b/src/calibre/gui2/store/web_store.py new file mode 100644 index 0000000000..8c5ee5ddcd --- /dev/null +++ b/src/calibre/gui2/store/web_store.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +# License: GPL v3 Copyright: 2019, Kovid Goyal + +from __future__ import absolute_import, division, print_function, unicode_literals + +import json +import os +from base64 import standard_b64decode, standard_b64encode + +from PyQt5.Qt import ( + QHBoxLayout, QProgressBar, QPushButton, QVBoxLayout, QWidget, pyqtSignal +) +from PyQt5.QtWebEngineWidgets import QWebEngineView + +from calibre import url_slash_cleaner +from calibre.constants import STORE_DIALOG_APP_UID, islinux, iswindows +from calibre.gui2 import Application, set_app_uid +from calibre.gui2.main_window import MainWindow +from calibre.ptempfile import reset_base_dir + + +class View(QWebEngineView): + pass + + +class Central(QWidget): + + home = pyqtSignal() + + def __init__(self, parent=None): + QWidget.__init__(self, parent) + self.l = l = QVBoxLayout(self) + self.view = v = View(self) + v.loadStarted.connect(self.load_started) + v.loadProgress.connect(self.load_progress) + v.loadFinished.connect(self.load_finished) + l.addWidget(v) + self.h = h = QHBoxLayout() + l.addLayout(h) + self.home_button = b = QPushButton(_('Home')) + b.clicked.connect(self.home) + h.addWidget(b) + self.back_button = b = QPushButton(_('Back')) + b.clicked.connect(v.back) + h.addWidget(b) + self.forward_button = b = QPushButton(_('Forward')) + b.clicked.connect(v.forward) + h.addWidget(b) + + self.progress_bar = b = QProgressBar(self) + h.addWidget(b) + + def load_started(self): + self.progress_bar.setValue(0) + + def load_progress(self, amt): + self.progress_bar.setValue(amt) + + def load_finished(self, ok): + self.progress_bar.setValue(100) + + +class Main(MainWindow): + + def __init__(self, data): + MainWindow.__init__(self, None) + self.data = data + self.central = c = Central(self) + c.home.connect(self.go_home) + self.setCentralWidget(c) + + @property + def view(self): + return self.central.view + + def go_home(self): + self.go_to() + + def go_to(self, url=None): + url = url or self.data['base_url'] + url = url_slash_cleaner(url) + self.view.load(url) + + +def main(args): + # Ensure we can continue to function if GUI is closed + os.environ.pop('CALIBRE_WORKER_TEMP_DIR', None) + reset_base_dir() + if iswindows: + # Ensure that all instances are grouped together in the task bar. This + # prevents them from being grouped with viewer/editor process when + # launched from within calibre, as both use calibre-parallel.exe + set_app_uid(STORE_DIALOG_APP_UID) + + data = args[-1] + data = json.loads(standard_b64decode(data)) + override = 'calibre-ebook-viewer' if islinux else None + app = Application(args, override_program_name=override) + app.exec_() + + +if __name__ == '__main__': + sample_data = standard_b64encode( + json.dumps({ + u'window_title': u'MobileRead', + u'base_url': u'https://www.mobileread.com/', + u'detail_url': u'http://www.mobileread.com/forums/showthread.php?t=54477', + u'tags': u'' + }) + ) + main([sample_data]) diff --git a/src/calibre/gui2/store/web_store_dialog.py b/src/calibre/gui2/store/web_store_dialog.py index 1b7cbffa42..f15c4ec62c 100644 --- a/src/calibre/gui2/store/web_store_dialog.py +++ b/src/calibre/gui2/store/web_store_dialog.py @@ -1,57 +1,36 @@ -# -*- coding: utf-8 -*- +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +# License: GPLv3 Copyright: 2019, Kovid Goyal + from __future__ import absolute_import, division, print_function, unicode_literals - -__license__ = 'GPL 3' -__copyright__ = '2011, John Schember ' -__docformat__ = 'restructuredtext en' - -from PyQt5.Qt import QDialog, QUrl - -from calibre import url_slash_cleaner -from calibre.gui2.store.web_store_dialog_ui import Ui_Dialog +import json +from base64 import standard_b64encode -class WebStoreDialog(QDialog, Ui_Dialog): +class WebStoreDialog(object): def __init__(self, gui, base_url, parent=None, detail_url=None, create_browser=None): - QDialog.__init__(self, parent=parent) - self.setupUi(self) - self.gui = gui self.base_url = base_url + self.detail_url = detail_url + self.create_browser = create_browser + self.window_title = None + self.tags = None - self.view.set_gui(self.gui) - self.view.create_browser = create_browser - self.view.loadStarted.connect(self.load_started) - self.view.loadProgress.connect(self.load_progress) - self.view.loadFinished.connect(self.load_finished) - self.home.clicked.connect(self.go_home) - self.reload.clicked.connect(self.view.reload) - self.back.clicked.connect(self.view.back) - - self.go_home(detail_url=detail_url) + def setWindowTitle(self, title): + self.window_title = title def set_tags(self, tags): - self.view.set_tags(tags) + self.tags = tags - def load_started(self): - self.progress.setValue(0) - - def load_progress(self, val): - self.progress.setValue(val) - - def load_finished(self, ok=True): - self.progress.setValue(100) - - def go_home(self, checked=False, detail_url=None): - if detail_url: - url = detail_url - else: - url = self.base_url - - # Reduce redundant /'s because some stores - # (Feedbooks) and server frameworks (cherrypy) - # choke on them. - url = url_slash_cleaner(url) - self.view.load(QUrl(url)) + def exec_(self): + data = {'base_url': self.base_url, 'detail_url': self.detail_url, 'window_title': self.window_title, 'tags': self.tags} + data = json.dumps(data) + if not isinstance(data, bytes): + data = data.encode('utf-8') + data = standard_b64encode(data) + if isinstance(data, bytes): + data = data.decode('ascii') + args = ['store-dialog', data] + self.gui.job_manager.launch_gui_app(args[0], kwargs={'args':args}) diff --git a/src/calibre/gui2/store/web_store_dialog.ui b/src/calibre/gui2/store/web_store_dialog.ui deleted file mode 100644 index fbc09e0e5f..0000000000 --- a/src/calibre/gui2/store/web_store_dialog.ui +++ /dev/null @@ -1,110 +0,0 @@ - - - Dialog - - - - 0 - 0 - 962 - 656 - - - - - - - true - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - - - - about:blank - - - - - - - - - - - Home - - - - - - - Reload - - - - - - - 0 - - - %p% - - - - - - - Back - - - - - - - &Close - - - - - - - - NPWebView - QWidget -

    calibre/gui2/store/web_control.h
    - - - - - - close - clicked() - Dialog - accept() - - - 917 - 635 - - - 480 - 327 - - - - - diff --git a/src/calibre/gui_launch.py b/src/calibre/gui_launch.py index 8a29c5a4b8..f8b35ee2fa 100644 --- a/src/calibre/gui_launch.py +++ b/src/calibre/gui_launch.py @@ -81,6 +81,13 @@ def ebook_viewer(args=sys.argv): main(args) +def store_dialog(args=sys.argv): + detach_gui() + init_dbus() + from calibre.gui2.store.web_store import main + main(args) + + def gui_ebook_edit(path=None, notify=None): ' For launching the editor from inside calibre ' init_dbus() diff --git a/src/calibre/utils/ipc/worker.py b/src/calibre/utils/ipc/worker.py index 981b2d4f45..7c1b1c0f12 100644 --- a/src/calibre/utils/ipc/worker.py +++ b/src/calibre/utils/ipc/worker.py @@ -29,6 +29,9 @@ PARALLEL_FUNCS = { 'ebook-edit' : ('calibre.gui_launch', 'gui_ebook_edit', None), + 'store-dialog' : + ('calibre.gui_launch', 'store_dialog', None), + 'render_pages' : ('calibre.ebooks.comic.input', 'render_pages', 'notification'), From 85fcea41fb1251cddd5ce13775f6600e3d2edae8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 29 Mar 2019 19:56:08 +0530 Subject: [PATCH 1371/2613] Finish porting of web store dialog to QtWebEngine --- src/calibre/gui2/store/web_store.py | 184 +++++++++++++++++++-- src/calibre/gui2/store/web_store_dialog.py | 19 ++- src/calibre/gui2/ui.py | 19 ++- 3 files changed, 201 insertions(+), 21 deletions(-) diff --git a/src/calibre/gui2/store/web_store.py b/src/calibre/gui2/store/web_store.py index 8c5ee5ddcd..327c1cc863 100644 --- a/src/calibre/gui2/store/web_store.py +++ b/src/calibre/gui2/store/web_store.py @@ -6,22 +6,76 @@ from __future__ import absolute_import, division, print_function, unicode_litera import json import os +import shutil from base64 import standard_b64decode, standard_b64encode from PyQt5.Qt import ( - QHBoxLayout, QProgressBar, QPushButton, QVBoxLayout, QWidget, pyqtSignal + QHBoxLayout, QIcon, QLabel, QProgressBar, QPushButton, QSize, QUrl, QVBoxLayout, + QWidget, pyqtSignal ) -from PyQt5.QtWebEngineWidgets import QWebEngineView +from PyQt5.QtWebEngineWidgets import QWebEngineProfile, QWebEngineView -from calibre import url_slash_cleaner -from calibre.constants import STORE_DIALOG_APP_UID, islinux, iswindows -from calibre.gui2 import Application, set_app_uid +from calibre import random_user_agent, url_slash_cleaner +from calibre.constants import STORE_DIALOG_APP_UID, cache_dir, islinux, iswindows +from calibre.ebooks import BOOK_EXTENSIONS +from calibre.gui2 import ( + Application, choose_save_file, error_dialog, gprefs, info_dialog, set_app_uid +) +from calibre.gui2.dialogs.confirm_delete import confirm from calibre.gui2.main_window import MainWindow -from calibre.ptempfile import reset_base_dir +from calibre.ptempfile import PersistentTemporaryDirectory, reset_base_dir +from calibre.utils.ipc import RC +from polyglot.builtins import string_or_bytes -class View(QWebEngineView): - pass +class DownloadItem(QWidget): + + def __init__(self, download_id, filename, parent=None): + QWidget.__init__(self, parent) + self.l = l = QHBoxLayout(self) + self.la = la = QLabel('{}:\xa0'.format(filename)) + la.setMaximumWidth(400) + l.addWidget(la) + + self.pb = pb = QProgressBar(self) + pb.setRange(0, 0) + l.addWidget(pb) + + self.download_id = download_id + + def __call__(self, done, total): + self.pb.setRange(0, total) + self.pb.setValue(done) + + +class DownloadProgress(QWidget): + + def __init__(self, parent=None): + QWidget.__init__(self, parent) + self.setVisible(False) + self.l = QVBoxLayout(self) + self.items = {} + + def add_item(self, download_id, filename): + self.setVisible(True) + item = DownloadItem(download_id, filename, self) + self.l.addWidget(item) + self.items[download_id] = item + + def update_item(self, download_id, done, total): + item = self.items.get(download_id) + if item is not None: + item(done, total) + + def remove_item(self, download_id): + item = self.items.pop(download_id, None) + if item is not None: + self.l.removeWidget(item) + item.setVisible(False) + item.setParent(None) + item.deleteLater() + if not self.items: + self.setVisible(False) class Central(QWidget): @@ -31,13 +85,16 @@ class Central(QWidget): def __init__(self, parent=None): QWidget.__init__(self, parent) self.l = l = QVBoxLayout(self) - self.view = v = View(self) + self.view = v = QWebEngineView(self) v.loadStarted.connect(self.load_started) v.loadProgress.connect(self.load_progress) v.loadFinished.connect(self.load_finished) l.addWidget(v) self.h = h = QHBoxLayout() l.addLayout(h) + self.download_progress = d = DownloadProgress(self) + h.addWidget(d) + self.home_button = b = QPushButton(_('Home')) b.clicked.connect(self.home) h.addWidget(b) @@ -51,6 +108,10 @@ class Central(QWidget): self.progress_bar = b = QProgressBar(self) h.addWidget(b) + self.reload_button = b = QPushButton(_('Reload')) + b.clicked.connect(v.reload) + h.addWidget(b) + def load_started(self): self.progress_bar.setValue(0) @@ -65,10 +126,29 @@ class Main(MainWindow): def __init__(self, data): MainWindow.__init__(self, None) + self.setWindowIcon(QIcon(I('store.png'))) + self.setWindowTitle(data['window_title']) + self.download_data = {} + profile = QWebEngineProfile.defaultProfile() + profile.setCachePath(os.path.join(cache_dir(), 'web_store', 'hc')) + profile.setPersistentStoragePath(os.path.join(cache_dir(), 'web_store', 'ps')) + profile.setHttpUserAgent(random_user_agent(allow_ie=False)) + profile.downloadRequested.connect(self.download_requested) self.data = data self.central = c = Central(self) c.home.connect(self.go_home) self.setCentralWidget(c) + geometry = gprefs.get('store_dialog_main_window_geometry') + if geometry is not None: + self.restoreGeometry(geometry) + self.go_to(data['detail_url'] or None) + + def sizeHint(self): + return QSize(1024, 740) + + def closeEvent(self, e): + gprefs.set('store_dialog_main_window_geometry', bytearray(self.saveGeometry())) + MainWindow.closeEvent(self, e) @property def view(self): @@ -80,7 +160,74 @@ class Main(MainWindow): def go_to(self, url=None): url = url or self.data['base_url'] url = url_slash_cleaner(url) - self.view.load(url) + self.view.load(QUrl(url)) + + def download_requested(self, download_item): + path = download_item.path() + fname = os.path.basename(path) + download_id = download_item.id() + tdir = PersistentTemporaryDirectory() + self.download_data[download_id] = download_item + path = os.path.join(tdir, fname) + download_item.setPath(path) + connect_lambda(download_item.downloadProgress, self, lambda self, done, total: self.download_progress(download_id, done, total)) + connect_lambda(download_item.finished, self, lambda self: self.download_finished(download_id)) + download_item.accept() + self.central.download_progress.add_item(download_id, fname) + + def download_progress(self, download_id, done, total): + self.central.download_progress.update_item(download_id, done, total) + + def download_finished(self, download_id): + self.central.download_progress.remove_item(download_id) + download_item = self.download_data.pop(download_id) + path = download_item.path() + fname = os.path.basename(path) + if download_item.state() == download_item.DownloadInterrupted: + error_dialog(self, _('Download failed'), _( + 'Download of {0} failed with error: {1}').format(fname, download_item.interruptReasonString()), show=True) + return + ext = fname.rpartition('.')[-1].lower() + if ext not in BOOK_EXTENSIONS: + if ext == 'acsm': + if not confirm('

    ' + _( + 'This e-book is a DRMed EPUB file. ' + 'You will be prompted to save this file to your ' + 'computer. Once it is saved, open it with ' + '' + 'Adobe Digital Editions (ADE).

    ADE, in turn ' + 'will download the actual e-book, which will be a ' + '.epub file. You can add this book to calibre ' + 'using "Add Books" and selecting the file from ' + 'the ADE library folder.'), + 'acsm_download', self): + return + name = choose_save_file(self, 'web-store-download-unknown', _( + 'File is not a supported e-book type. Save to disk?'), initial_filename=fname) + if name: + shutil.copyfile(path, name) + os.remove(path) + return + t = RC(print_error=False) + t.start() + t.join(3.0) + if t.conn is None: + error_dialog(self, _('No running calibre'), _( + 'No running calibre instance found. Please start calibre before trying to' + ' download books.'), show=True) + return + tags = self.data['tags'] + if isinstance(tags, string_or_bytes): + tags = list(filter(None, [x.strip() for x in tags.split(',')])) + data = json.dumps({'path': path, 'tags': tags}) + if not isinstance(data, bytes): + data = data.encode('utf-8') + t.conn.send(b'web-store:' + data) + t.conn.close() + + info_dialog(self, _('Download completed'), _( + 'Download of {0} has been completed, the book was added to' + ' your calibre library').format(fname), show=True) def main(args): @@ -95,18 +242,23 @@ def main(args): data = args[-1] data = json.loads(standard_b64decode(data)) - override = 'calibre-ebook-viewer' if islinux else None + override = 'calibre-gui' if islinux else None app = Application(args, override_program_name=override) + m = Main(data) + m.show(), m.raise_() app.exec_() + del m + del app if __name__ == '__main__': sample_data = standard_b64encode( json.dumps({ - u'window_title': u'MobileRead', - u'base_url': u'https://www.mobileread.com/', - u'detail_url': u'http://www.mobileread.com/forums/showthread.php?t=54477', - u'tags': u'' + 'window_title': 'MobileRead', + 'base_url': 'https://www.mobileread.com/', + 'detail_url': 'http://www.mobileread.com/forums/showthread.php?t=54477', + 'id':1, + 'tags': '', }) ) - main([sample_data]) + main(['store-dialog', sample_data]) diff --git a/src/calibre/gui2/store/web_store_dialog.py b/src/calibre/gui2/store/web_store_dialog.py index f15c4ec62c..bb0934a97f 100644 --- a/src/calibre/gui2/store/web_store_dialog.py +++ b/src/calibre/gui2/store/web_store_dialog.py @@ -6,15 +6,20 @@ from __future__ import absolute_import, division, print_function, unicode_litera import json from base64 import standard_b64encode +from itertools import count + +counter = count() class WebStoreDialog(object): - def __init__(self, gui, base_url, parent=None, detail_url=None, create_browser=None): + def __init__( + self, gui, base_url, parent=None, detail_url=None, create_browser=None + ): + self.id = next(counter) self.gui = gui self.base_url = base_url self.detail_url = detail_url - self.create_browser = create_browser self.window_title = None self.tags = None @@ -25,7 +30,13 @@ class WebStoreDialog(object): self.tags = tags def exec_(self): - data = {'base_url': self.base_url, 'detail_url': self.detail_url, 'window_title': self.window_title, 'tags': self.tags} + data = { + 'base_url': self.base_url, + 'detail_url': self.detail_url, + 'window_title': self.window_title, + 'tags': self.tags, + 'id': self.id + } data = json.dumps(data) if not isinstance(data, bytes): data = data.encode('utf-8') @@ -33,4 +44,4 @@ class WebStoreDialog(object): if isinstance(data, bytes): data = data.decode('ascii') args = ['store-dialog', data] - self.gui.job_manager.launch_gui_app(args[0], kwargs={'args':args}) + self.gui.job_manager.launch_gui_app(args[0], kwargs={'args': args}) diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index deee2c7da2..0fa0d73219 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -666,8 +666,25 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ except Exception: import traceback traceback.print_exc() + elif msg.startswith('web-store:'): + import json + try: + data = json.loads(msg[len('web-store:'):]) + except ValueError: + prints('Failed to decode message from other instance: %r' % msg) + path = data['path'] + if data['tags']: + before = self.current_db.new_api.all_book_ids() + self.iactions['Add Books'].add_filesystem_book([path], allow_device=False) + if data['tags']: + db = self.current_db.new_api + after = self.current_db.new_api.all_book_ids() + for book_id in after - before: + tags = list(db.field_for('tags', book_id)) + tags += list(data['tags']) + self.current_db.new_api.set_field('tags', {book_id: tags}) else: - print(msg) + prints(u'Ignoring unknown message from other instance: %r' % msg[:20]) def current_view(self): '''Convenience method that returns the currently visible view ''' From 1eaef1fe3ae714d997bf4a9f6fe8bbbce8dcb89c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 30 Mar 2019 13:01:19 +0530 Subject: [PATCH 1372/2613] py3: base64 port --- src/calibre/gui2/store/web_store.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/store/web_store.py b/src/calibre/gui2/store/web_store.py index 327c1cc863..46b3e722f5 100644 --- a/src/calibre/gui2/store/web_store.py +++ b/src/calibre/gui2/store/web_store.py @@ -7,7 +7,6 @@ from __future__ import absolute_import, division, print_function, unicode_litera import json import os import shutil -from base64 import standard_b64decode, standard_b64encode from PyQt5.Qt import ( QHBoxLayout, QIcon, QLabel, QProgressBar, QPushButton, QSize, QUrl, QVBoxLayout, @@ -26,6 +25,7 @@ from calibre.gui2.main_window import MainWindow from calibre.ptempfile import PersistentTemporaryDirectory, reset_base_dir from calibre.utils.ipc import RC from polyglot.builtins import string_or_bytes +from polyglot.binary import from_base64_bytes, as_base64_bytes class DownloadItem(QWidget): @@ -241,7 +241,7 @@ def main(args): set_app_uid(STORE_DIALOG_APP_UID) data = args[-1] - data = json.loads(standard_b64decode(data)) + data = json.loads(from_base64_bytes(data)) override = 'calibre-gui' if islinux else None app = Application(args, override_program_name=override) m = Main(data) @@ -252,7 +252,7 @@ def main(args): if __name__ == '__main__': - sample_data = standard_b64encode( + sample_data = as_base64_bytes( json.dumps({ 'window_title': 'MobileRead', 'base_url': 'https://www.mobileread.com/', From 188c59b6e8f15acf89e5eb4af3f754193cb94565 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 19 Apr 2019 10:10:36 +0530 Subject: [PATCH 1373/2613] py3: webengine misc fixes --- src/calibre/gui2/webengine.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/webengine.py b/src/calibre/gui2/webengine.py index f2e00d289e..adfcb1fb80 100644 --- a/src/calibre/gui2/webengine.py +++ b/src/calibre/gui2/webengine.py @@ -12,7 +12,7 @@ from PyQt5.QtWebEngineWidgets import QWebEnginePage, QWebEngineScript, QWebEngin from calibre import prints from calibre.utils.monotonic import monotonic from calibre.utils.rapydscript import special_title -from polyglot.builtins import iteritems +from polyglot.builtins import iteritems, unicode_type def secure_webengine(view_or_page_or_settings, for_viewer=False): @@ -42,6 +42,8 @@ def insert_scripts(profile, *scripts): def create_script(name, src, world=QWebEngineScript.ApplicationWorld, injection_point=QWebEngineScript.DocumentReady, on_subframes=True): script = QWebEngineScript() + if isinstance(src, bytes): + src = src.decode('utf-8') script.setSourceCode(src) script.setName(name) script.setWorldId(world) @@ -53,7 +55,7 @@ def create_script(name, src, world=QWebEngineScript.ApplicationWorld, injection_ from_js = pyqtSignal -class to_js(type('')): +class to_js(unicode_type): def __call__(self, *a): prints('WARNING: Calling {}() before the javascript bridge is ready'.format(self.name)) From 27c5324269251c1fd49c83af51a9dd140f1832b7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 4 Jun 2019 20:43:40 +0530 Subject: [PATCH 1374/2613] viewer2: Make serialization of book metadata more robust --- src/calibre/srv/render_book.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/calibre/srv/render_book.py b/src/calibre/srv/render_book.py index 95fc1f0943..a92baaa591 100644 --- a/src/calibre/srv/render_book.py +++ b/src/calibre/srv/render_book.py @@ -11,6 +11,7 @@ import sys from collections import OrderedDict, defaultdict from functools import partial from itertools import count +from datetime import datetime from css_parser import replaceUrls from css_parser.css import CSSRule @@ -30,6 +31,7 @@ from calibre.ebooks.oeb.polish.toc import get_landmarks, get_toc from calibre.ebooks.oeb.polish.utils import extract, guess_type from calibre.utils.logging import default_log from calibre.utils.short_uuid import uuid4 +from calibre.srv.metadata import encode_datetime from polyglot.binary import as_base64_unicode as encode_component, from_base64_unicode as decode_component from polyglot.builtins import iteritems, map, is_py3, unicode_type from polyglot.urllib import quote, urlparse @@ -522,20 +524,30 @@ def html_as_dict(root): return {'ns_map':ns_map, 'tag_map':tags, 'tree':tree} +def serialize_datetimes(d): + for k in tuple(d): + v = d[k] + if isinstance(v, datetime): + v = encode_datetime(v) + d[k] = v + + def render(pathtoebook, output_dir, book_hash=None, serialize_metadata=False): container = Container(pathtoebook, output_dir, book_hash=book_hash) if serialize_metadata: from calibre.ebooks.metadata.meta import get_metadata + from calibre.utils.serialize import json_dumps from calibre.ebooks.metadata.book.serialize import metadata_as_dict with lopen(pathtoebook, 'rb') as f: mi = get_metadata(f, os.path.splitext(pathtoebook)[1][1:].lower()) d = metadata_as_dict(mi) + serialize_datetimes(d), serialize_datetimes(d.get('user_metadata', {})) cdata = d.pop('cover_data', None) if cdata and cdata[1] and container.book_render_data['raster_cover_name']: with lopen(os.path.join(output_dir, container.book_render_data['raster_cover_name']), 'wb') as f: f.write(cdata[1]) with lopen(os.path.join(output_dir, 'calibre-book-metadata.json'), 'wb') as f: - f.write(json.dumps(d)) + f.write(json_dumps(d)) if __name__ == '__main__': From e3fd6f9bffb840ac9632ec7abc240c137f0a051d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 22 Jun 2019 04:55:30 +0530 Subject: [PATCH 1375/2613] Do not use WebKit to display book details We are phasing out WebKit --- src/calibre/ebooks/metadata/book/render.py | 78 ++--- src/calibre/gui2/book_details.py | 312 ++++++++++--------- src/calibre/gui2/dialogs/book_info.py | 21 +- src/calibre/gui2/metadata/single_download.py | 14 +- src/calibre/gui2/widgets2.py | 42 ++- 5 files changed, 250 insertions(+), 217 deletions(-) diff --git a/src/calibre/ebooks/metadata/book/render.py b/src/calibre/ebooks/metadata/book/render.py index 0cb91f5fc3..f8cea2cf91 100644 --- a/src/calibre/ebooks/metadata/book/render.py +++ b/src/calibre/ebooks/metadata/book/render.py @@ -19,7 +19,7 @@ from calibre.utils.formatter import EvalFormatter from calibre.utils.date import is_date_undefined from calibre.utils.localization import calibre_langcode_to_name from calibre.utils.serialize import json_dumps -from polyglot.builtins import unicode_type, filter +from polyglot.builtins import filter from polyglot.binary import as_hex_unicode default_sort = ('title', 'title_sort', 'authors', 'author_sort', 'series', 'rating', 'pubdate', 'tags', 'publisher', 'identifiers') @@ -52,9 +52,18 @@ def get_field_list(mi): yield field, True -def search_href(search_term, value): - search = '%s:"=%s"' % (search_term, value.replace('"', '\\"')) - return prepare_string_for_xml('search:' + as_hex_unicode(search.encode('utf-8')), True) +def action(main, **keys): + keys['type'] = main + return 'action:' + as_hex_unicode(json_dumps(keys)) + + +def search_action(search_term, value, **k): + return action('search', term=search_term, value=value, **k) + + +def search_action_with_data(search_term, value, book_id, field=None): + field = field or search_term + return search_action(search_term, value, field=field, book_id=book_id) DEFAULT_AUTHOR_LINK = 'search-{}'.format(DEFAULT_AUTHOR_SOURCE) @@ -62,7 +71,7 @@ DEFAULT_AUTHOR_LINK = 'search-{}'.format(DEFAULT_AUTHOR_SOURCE) def author_search_href(which, title=None, author=None): if which == 'calibre': - return search_href('authors', author), _('Search the calibre library for books by %s') % author + return 'calibre', _('Search the calibre library for books by %s') % author search_type, key = 'author', which if which.endswith('-book'): key, search_type = which.rpartition('-')[::2] @@ -78,10 +87,6 @@ def author_search_href(which, title=None, author=None): return func(key, title=title, author=author), tt -def item_data(field_name, value, book_id): - return as_hex_unicode(json_dumps((field_name, value, book_id))) - - def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers=True, rating_font='Liberation Serif', rtl=False): if field_list is None: field_list = get_field_list(mi) @@ -149,13 +154,13 @@ def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers= else: if not metadata['is_multiple']: val = '%s' % ( - search_href(field, val), + search_action(field, val), _('Click to see books with {0}: {1}').format(metadata['name'], a(val)), p(val)) else: all_vals = [v.strip() for v in val.split(metadata['is_multiple']['list_to_ui']) if v.strip()] links = ['%s' % ( - search_href(field, x), _('Click to see books with {0}: {1}').format( + search_action(field, x), _('Click to see books with {0}: {1}').format( metadata['name'], a(x)), p(x)) for x in all_vals] val = metadata['is_multiple']['list_to_ui'].join(links) ans.append((field, row % (name, val))) @@ -163,17 +168,16 @@ def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers= if mi.path: path = force_unicode(mi.path, filesystem_encoding) scheme = u'devpath' if isdevice else u'path' - url = prepare_string_for_xml(path if isdevice else - unicode_type(book_id), True) + loc = path if isdevice else book_id pathstr = _('Click to open') extra = '' if isdevice: - durl = url + durl = path if durl.startswith('mtp:::'): durl = ':::'.join((durl.split(':::'))[2:]) extra = '
    %s'%( prepare_string_for_xml(durl)) - link = u'%s%s' % (scheme, url, + link = '%s%s' % (action(scheme, loc=loc), prepare_string_for_xml(path, True), pathstr, extra) ans.append((field, row % (name, link))) elif field == 'formats': @@ -186,15 +190,19 @@ def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers= bpath = os.sep.join((os.path.basename(h), t)) data = ({ 'fmt':x, 'path':a(path or ''), 'fname':a(mi.format_files.get(x, '')), - 'ext':x.lower(), 'id':book_id, 'bpath':bpath, 'sep':os.sep + 'ext':x.lower(), 'id':book_id, 'bpath':bpath, 'sep':os.sep, + 'action':action('format', book_id=book_id, fmt=x, path=path or '', fname=mi.format_files.get(x, '')) } for x in mi.formats) - fmts = [u'{fmt}'.format(**x) + fmts = ['{fmt}'.format(**x) for x in data] - ans.append((field, row % (name, u', '.join(fmts)))) + ans.append((field, row % (name, ', '.join(fmts)))) elif field == 'identifiers': urls = urls_from_identifiers(mi.identifiers) - links = [u'%s' % (a(url), a(id_typ), a(id_val), a(item_data(field, id_typ, book_id)), p(namel)) - for namel, id_typ, id_val, url in urls] + links = [ + '%s' % ( + action('identifier', url=url, name=namel, type=id_typ, value=id_val, field='identifiers', book_id=book_id), + a(id_typ), a(id_val), p(namel)) + for namel, id_typ, id_val, url in urls] links = u', '.join(links) if links: ans.append((field, row % (_('Ids')+':', links))) @@ -220,23 +228,24 @@ def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers= link = lt = formatter.safe_format(default_author_link, vals, '', vals) aut = p(aut) if link: - authors.append(u'%s'%(a(lt), a(link), aut)) + authors.append('%s'%(a(lt), action('author', url=link, name=aut, title=lt), aut)) else: authors.append(aut) - ans.append((field, row % (name, u' & '.join(authors)))) + ans.append((field, row % (name, ' & '.join(authors)))) elif field == 'languages': if not mi.languages: continue names = filter(None, map(calibre_langcode_to_name, mi.languages)) - names = ['%s' % (search_href('languages', n), _( + names = ['%s' % (search_action('languages', n), _( 'Search calibre for books with the language: {}').format(n), n) for n in names] ans.append((field, row % (name, u', '.join(names)))) elif field == 'publisher': if not mi.publisher: continue - val = '%s' % ( - search_href('publisher', mi.publisher), _('Click to see books with {0}: {1}').format(metadata['name'], a(mi.publisher)), - a(item_data('publisher', mi.publisher, book_id)), p(mi.publisher)) + val = '%s' % ( + search_action_with_data('publisher', mi.publisher, book_id), + _('Click to see books with {0}: {1}').format(metadata['name'], a(mi.publisher)), + p(mi.publisher)) ans.append((field, row % (name, val))) elif field == 'title': # otherwise title gets metadata['datatype'] == 'text' @@ -260,11 +269,10 @@ def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers= st = field series = getattr(mi, field) val = _( - '%(sidx)s of ' + '%(sidx)s of ' '%(series)s') % dict( sidx=fmt_sidx(sidx, use_roman=use_roman_numbers), cls="series_name", - series=p(series), href=search_href(st, series), - data=a(item_data(field, series, book_id)), + series=p(series), href=search_action_with_data(st, series, book_id, field), tt=p(_('Click to see books in this series'))) elif metadata['datatype'] == 'datetime': aval = getattr(mi, field) @@ -278,9 +286,9 @@ def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers= all_vals = mi.get(field) if not metadata.get('display', {}).get('is_names', False): all_vals = sorted(all_vals, key=sort_key) - links = ['%s' % ( - search_href(st, x), _('Click to see books with {0}: {1}').format( - metadata['name'], a(x)), a(item_data(field, x, book_id)), p(x)) + links = ['%s' % ( + search_action_with_data(st, x, book_id, field), _('Click to see books with {0}: {1}').format( + metadata['name'], a(x)), p(x)) for x in all_vals] val = metadata['is_multiple']['list_to_ui'].join(links) elif metadata['datatype'] == 'text' or metadata['datatype'] == 'enumeration': @@ -289,9 +297,9 @@ def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers= st = metadata['search_terms'][0] except Exception: st = field - val = '%s' % ( - search_href(st, val), a(_('Click to see books with {0}: {1}').format(metadata['name'], val)), - a(item_data(field, val, book_id)), p(val)) + val = '%s' % ( + search_action_with_data(st, val, book_id, field), a( + _('Click to see books with {0}: {1}').format(metadata['name'], val)), p(val)) ans.append((field, row % (name, val))) diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index d8cfb3bd51..16a032d4e5 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -3,7 +3,6 @@ # License: GPLv3 Copyright: 2010, Kovid Goyal from __future__ import absolute_import, division, print_function, unicode_literals -import os import re from collections import namedtuple from functools import partial @@ -13,7 +12,6 @@ from PyQt5.Qt import ( QMimeData, QPainter, QPalette, QPen, QPixmap, QPropertyAnimation, QRect, QSize, QSizePolicy, Qt, QUrl, QWidget, pyqtProperty, pyqtSignal ) -from PyQt5.QtWebKitWidgets import QWebView from calibre import fit_image from calibre.ebooks import BOOK_EXTENSIONS @@ -30,28 +28,29 @@ from calibre.gui2 import ( from calibre.gui2.dnd import ( dnd_get_files, dnd_get_image, dnd_has_extension, dnd_has_image, image_extensions ) +from calibre.gui2.widgets2 import HTMLDisplay from calibre.utils.config import tweaks from calibre.utils.img import blend_image, image_from_x from calibre.utils.localization import is_rtl from calibre.utils.serialize import json_loads +from polyglot.binary import from_hex_bytes from polyglot.builtins import unicode_type -from polyglot.binary import from_hex_bytes, from_hex_unicode - _css = None InternetSearch = namedtuple('InternetSearch', 'author where') -def set_html(mi, html, web_view): +def set_html(mi, html, text_browser): from calibre.gui2.ui import get_gui gui = get_gui() book_id = getattr(mi, 'id', None) + search_paths = [] if gui and book_id is not None: path = gui.current_db.abspath(book_id, index_is_id=True) if path: - web_view.setHtml(html, QUrl.fromLocalFile(os.path.join(path, 'metadata.html'))) - return - web_view.setHtml(html) + search_paths = [path] + text_browser.setSearchPaths(search_paths) + text_browser.setHtml(html) def css(): @@ -64,9 +63,8 @@ def css(): return _css -def copy_all(web_view): - web_view = getattr(web_view, 'details', web_view) - mf = web_view.page().mainFrame() +def copy_all(text_browser): + mf = getattr(text_browser, 'details', text_browser) c = QApplication.clipboard() md = QMimeData() md.setText(mf.toPlainText()) @@ -193,119 +191,124 @@ def render_data(mi, use_roman_numbers=True, all_fields=False, pref_name='book_di # }}} +# Context menu {{{ -def details_context_menu_event(view, ev, book_info): # {{{ - p = view.page() - mf = p.mainFrame() - r = mf.hitTestContent(ev.pos()) - url = unicode_type(r.linkUrl().toString(NO_URL_FORMATTING)).strip() - menu = p.createStandardContextMenu() - ca = view.pageAction(p.Copy) - for action in list(menu.actions()): - if action is not ca: - menu.removeAction(action) + +def add_format_entries(menu, data, book_info): + from calibre.ebooks.oeb.polish.main import SUPPORTED + from calibre.gui2.ui import get_gui + book_id = int(data['book_id']) + fmt = data['fmt'] + db = get_gui().current_db.new_api + ofmt = fmt.upper() if fmt.startswith('ORIGINAL_') else 'ORIGINAL_' + fmt + nfmt = ofmt[len('ORIGINAL_'):] + fmts = {x.upper() for x in db.formats(book_id)} + for a, t in [ + ('remove', _('Delete the %s format')), + ('save', _('Save the %s format to disk')), + ('restore', _('Restore the %s format')), + ('compare', ''), + ('set_cover', _('Set the book cover from the %s file')), + ]: + if a == 'restore' and not fmt.startswith('ORIGINAL_'): + continue + if a == 'compare': + if ofmt not in fmts or nfmt not in SUPPORTED: + continue + t = _('Compare to the %s format') % (fmt[9:] if fmt.startswith('ORIGINAL_') else ofmt) + else: + t = t % fmt + ac = getattr(book_info, '%s_format_action'%a) + ac.current_fmt = (book_id, fmt) + ac.setText(t) + menu.addAction(ac) + if not fmt.upper().startswith('ORIGINAL_'): + from calibre.gui2.open_with import populate_menu, edit_programs + m = QMenu(_('Open %s with...') % fmt.upper()) + + def connect_action(ac, entry): + connect_lambda(ac.triggered, book_info, lambda book_info: book_info.open_with(book_id, fmt, entry)) + + populate_menu(m, connect_action, fmt) + if len(m.actions()) == 0: + menu.addAction(_('Open %s with...') % fmt.upper(), partial(book_info.choose_open_with, book_id, fmt)) + else: + m.addSeparator() + m.addAction(_('Add other application for %s files...') % fmt.upper(), partial(book_info.choose_open_with, book_id, fmt)) + m.addAction(_('Edit Open With applications...'), partial(edit_programs, fmt, book_info)) + menu.addMenu(m) + menu.ow = m + if fmt.upper() in SUPPORTED: + menu.addSeparator() + menu.addAction(_('Edit %s...') % fmt.upper(), partial(book_info.edit_fmt, book_id, fmt)) + path = data['path'] + if path: + ac = book_info.copy_link_action + ac.current_url = path + ac.setText(_('&Copy path to file')) + menu.addAction(ac) + + +def add_item_specific_entries(menu, data, book_info): + search_internet_added = False + dt = data['type'] + if dt == 'format': + add_format_entries(menu, data, book_info) + elif dt == 'author': + author = data['name'] + menu.addAction(init_manage_action(book_info.manage_action, 'authors', author)) + if hasattr(book_info, 'search_internet'): + menu.sia = sia = create_search_internet_menu(book_info.search_internet, author) + menu.addMenu(sia) + search_internet_added = True + if hasattr(book_info, 'search_requested'): + menu.addAction(_('Search calibre for %s') % author, + lambda : book_info.search_requested('authors:"={}"'.format(author.replace('"', r'\"')))) + elif dt in ('path', 'devpath'): + from calibre.gui2.ui import get_gui + path = data['loc'] + ac = book_info.copy_link_action + if isinstance(path, int): + path = get_gui().library_view.model().db.abspath(path, index_is_id=True) + ac.current_url = path + ac.setText(_('Copy path')) + menu.addAction(ac) + else: + field = data.get('field') + if field is not None: + book_id = int(data['book_id']) + value = data['value'] + if field == 'identifiers': + menu.addAction(book_info.edit_identifiers_action) + elif field in ('tags', 'series', 'publisher') or is_category(field): + menu.addAction(init_manage_action(book_info.manage_action, field, value)) + ac = book_info.remove_item_action + ac.data = (field, value, book_id) + ac.setText(_('Remove %s from this book') % value) + menu.addAction(ac) + return search_internet_added + + +def details_context_menu_event(view, ev, book_info): + url = view.anchorAt(ev.pos()) + menu = view.createStandardContextMenu() menu.addAction(QIcon(I('edit-copy.png')), _('Copy &all'), partial(copy_all, book_info)) search_internet_added = False - if not r.isNull(): - from calibre.ebooks.oeb.polish.main import SUPPORTED - if url.startswith('format:'): - parts = url.split(':') - try: - book_id, fmt = int(parts[1]), parts[2].upper() - except: - import traceback - traceback.print_exc() - else: - from calibre.gui2.ui import get_gui - db = get_gui().current_db.new_api - ofmt = fmt.upper() if fmt.startswith('ORIGINAL_') else 'ORIGINAL_' + fmt - nfmt = ofmt[len('ORIGINAL_'):] - fmts = {x.upper() for x in db.formats(book_id)} - for a, t in [ - ('remove', _('Delete the %s format')), - ('save', _('Save the %s format to disk')), - ('restore', _('Restore the %s format')), - ('compare', ''), - ('set_cover', _('Set the book cover from the %s file')), - ]: - if a == 'restore' and not fmt.startswith('ORIGINAL_'): - continue - if a == 'compare': - if ofmt not in fmts or nfmt not in SUPPORTED: - continue - t = _('Compare to the %s format') % (fmt[9:] if fmt.startswith('ORIGINAL_') else ofmt) - else: - t = t % fmt - ac = getattr(book_info, '%s_format_action'%a) - ac.current_fmt = (book_id, fmt) - ac.setText(t) - menu.addAction(ac) - if not fmt.upper().startswith('ORIGINAL_'): - from calibre.gui2.open_with import populate_menu, edit_programs - m = QMenu(_('Open %s with...') % fmt.upper()) - - def connect_action(ac, entry): - connect_lambda(ac.triggered, book_info, lambda book_info: book_info.open_with(book_id, fmt, entry)) - - populate_menu(m, connect_action, fmt) - if len(m.actions()) == 0: - menu.addAction(_('Open %s with...') % fmt.upper(), partial(book_info.choose_open_with, book_id, fmt)) - else: - m.addSeparator() - m.addAction(_('Add other application for %s files...') % fmt.upper(), partial(book_info.choose_open_with, book_id, fmt)) - m.addAction(_('Edit Open With applications...'), partial(edit_programs, fmt, book_info)) - menu.addMenu(m) - menu.ow = m - if fmt.upper() in SUPPORTED: - menu.addSeparator() - menu.addAction(_('Edit %s...') % fmt.upper(), partial(book_info.edit_fmt, book_id, fmt)) - ac = book_info.copy_link_action - ac.current_url = r.linkElement().attribute('data-full-path') - if ac.current_url: - ac.setText(_('&Copy path to file')) - menu.addAction(ac) - else: - el = r.linkElement() - data = el.attribute('data-item') - author = el.toPlainText() if unicode_type(el.attribute('calibre-data')) == 'authors' else None - if url and not url.startswith('search:'): - for a, t in [('copy', _('&Copy link')), - ]: - ac = getattr(book_info, '%s_link_action'%a) - ac.current_url = url - if url.startswith('path:'): - ac.current_url = el.attribute('title') - ac.setText(t) - menu.addAction(ac) - if author is not None: - menu.addAction(init_manage_action(book_info.manage_action, 'authors', author)) - if hasattr(book_info, 'search_internet'): - menu.sia = sia = create_search_internet_menu(book_info.search_internet, author) - menu.addMenu(sia) - search_internet_added = True - if hasattr(book_info, 'search_requested'): - menu.addAction(_('Search calibre for %s') % author, - lambda : book_info.search_requested('authors:"={}"'.format(author.replace('"', r'\"')))) - if data: - try: - field, value, book_id = json_loads(from_hex_bytes(data)) - except Exception: - field = value = book_id = None - if field: - if author is None: - if field in ('tags', 'series', 'publisher') or is_category(field): - menu.addAction(init_manage_action(book_info.manage_action, field, value)) - elif field == 'identifiers': - menu.addAction(book_info.edit_identifiers_action) - ac = book_info.remove_item_action - ac.data = (field, value, book_id) - ac.setText(_('Remove %s from this book') % value) - menu.addAction(ac) - + if url and url.startswith('action:'): + data = json_loads(from_hex_bytes(url.split(':', 1)[1])) + search_internet_added = add_item_specific_entries(menu, data, book_info) + elif url and not url.startswith('#'): + ac = book_info.copy_link_action + ac.current_url = url + ac.setText(_('Copy link location')) + menu.addAction(ac) if not search_internet_added and hasattr(book_info, 'search_internet'): menu.addSeparator() menu.si = create_search_internet_menu(book_info.search_internet) menu.addMenu(menu.si) + for ac in tuple(menu.actions()): + if not ac.isEnabled(): + menu.removeAction(ac) if len(menu.actions()) > 0: menu.exec_(ev.globalPos()) # }}} @@ -539,7 +542,7 @@ class CoverView(QWidget): # {{{ # Book Info {{{ -class BookInfo(QWebView): +class BookInfo(HTMLDisplay): link_clicked = pyqtSignal(object) remove_format = pyqtSignal(int, object) @@ -555,18 +558,9 @@ class BookInfo(QWebView): edit_identifiers = pyqtSignal() def __init__(self, vertical, parent=None): - QWebView.__init__(self, parent) - s = self.settings() - s.setAttribute(s.JavascriptEnabled, False) + HTMLDisplay.__init__(self, parent) self.vertical = vertical - self.page().setLinkDelegationPolicy(self.page().DelegateAllLinks) - self.linkClicked.connect(self.link_activated) - self._link_clicked = False - self.setAttribute(Qt.WA_OpaquePaintEvent, False) - palette = self.palette() - self.setAcceptDrops(False) - palette.setBrush(QPalette.Base, Qt.transparent) - self.page().setPalette(palette) + self.anchor_clicked.connect(self.link_activated) for x, icon in [ ('remove_format', 'trash.png'), ('save_format', 'save.png'), ('restore_format', 'edit-undo.png'), ('copy_link','edit-copy.png'), @@ -625,28 +619,21 @@ class BookInfo(QWebView): self.manage_category.emit(*self.manage_action.current_fmt) def link_activated(self, link): - self._link_clicked = True if unicode_type(link.scheme()) in ('http', 'https'): return safe_open_url(link) link = unicode_type(link.toString(NO_URL_FORMATTING)) self.link_clicked.emit(link) - def turnoff_scrollbar(self, *args): - self.page().mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff) - def show_data(self, mi): html = render_html(mi, css(), self.vertical, self.parent()) set_html(mi, html, self) def mouseDoubleClickEvent(self, ev): - swidth = self.page().mainFrame().scrollBarGeometry(Qt.Vertical).width() - sheight = self.page().mainFrame().scrollBarGeometry(Qt.Horizontal).height() - if self.width() - ev.x() < swidth or \ - self.height() - ev.y() < sheight: - # Filter out double clicks on the scroll bar - ev.accept() - else: + v = self.viewport() + if v.rect().contains(self.mapFromGlobal(ev.globalPos())): ev.ignore() + else: + return HTMLDisplay.mouseDoubleClickEvent(self, ev) def contextMenuEvent(self, ev): details_context_menu_event(self, ev, self) @@ -867,23 +854,42 @@ class BookDetails(QWidget): # {{{ safe_open_url(url) def handle_click(self, link): - typ, val = link.partition(':')[0::2] - if typ == 'path': - self.open_containing_folder.emit(int(val)) - elif typ == 'format': - id_, fmt = val.split(':') - self.view_specific_format.emit(int(id_), fmt) - elif typ == 'devpath': - self.view_device_book.emit(val) - elif typ == 'search': - self.search_requested.emit(from_hex_unicode(val)) - else: + typ, val = link.partition(':')[::2] + + def search_term(field, val): + self.search_requested.emit('{}:="{}"'.format(field, val.replace('"', '\\"'))) + + def browse(url): try: - safe_open_url(QUrl(link, QUrl.TolerantMode)) - except: + safe_open_url(QUrl(url, QUrl.TolerantMode)) + except Exception: import traceback traceback.print_exc() + if typ == 'action': + data = json_loads(from_hex_bytes(val)) + dt = data['type'] + if dt == 'search': + search_term(data['term'], data['value']) + elif dt == 'author': + url = data['url'] + if url == 'calibre': + search_term('authors', data['name']) + else: + browse(url) + elif dt == 'format': + book_id, fmt = data['book_id'], data['fmt'] + self.view_specific_format.emit(int(book_id), fmt) + elif dt == 'identifier': + if data['url']: + browse(data['url']) + elif dt == 'path': + self.open_containing_folder.emit(int(data['loc'])) + elif dt == 'devpath': + self.view_device_book.emit(data['loc']) + else: + browse(link) + def mouseDoubleClickEvent(self, ev): ev.accept() self.show_book_info.emit() diff --git a/src/calibre/gui2/dialogs/book_info.py b/src/calibre/gui2/dialogs/book_info.py index aec75c3133..ec5820b3cf 100644 --- a/src/calibre/gui2/dialogs/book_info.py +++ b/src/calibre/gui2/dialogs/book_info.py @@ -8,14 +8,15 @@ from PyQt5.Qt import ( QShortcut, QSize, QSplitter, Qt, QTimer, QToolButton, QVBoxLayout, QWidget, pyqtSignal ) -from PyQt5.QtWebKitWidgets import QWebView from calibre import fit_image from calibre.gui2 import NO_URL_FORMATTING, gprefs -from calibre.gui2.book_details import css, details_context_menu_event, render_html, set_html +from calibre.gui2.book_details import ( + css, details_context_menu_event, render_html, set_html +) from calibre.gui2.ui import get_gui from calibre.gui2.widgets import CoverView -from calibre.gui2.widgets2 import Dialog +from calibre.gui2.widgets2 import Dialog, HTMLDisplay from polyglot.builtins import unicode_type @@ -77,10 +78,10 @@ class Configure(Dialog): return Dialog.accept(self) -class Details(QWebView): +class Details(HTMLDisplay): def __init__(self, book_info, parent=None): - QWebView.__init__(self, parent) + HTMLDisplay.__init__(self, parent) self.book_info = book_info def sizeHint(self): @@ -113,20 +114,18 @@ class BookInfo(QDialog): self.splitter.addWidget(self.cover) self.details = Details(parent.book_details.book_info, self) - self.details.page().setLinkDelegationPolicy(self.details.page().DelegateAllLinks) - self.details.linkClicked.connect(self.link_clicked) - s = self.details.page().settings() - s.setAttribute(s.JavascriptEnabled, False) + self.details.anchor_clicked.connect(self.on_link_clicked) self.css = css() self.link_delegate = link_delegate self.details.setAttribute(Qt.WA_OpaquePaintEvent, False) palette = self.details.palette() self.details.setAcceptDrops(False) palette.setBrush(QPalette.Base, Qt.transparent) - self.details.page().setPalette(palette) + self.details.setPalette(palette) self.c = QWidget(self) self.c.l = l2 = QGridLayout(self.c) + l2.setContentsMargins(0, 0, 0, 0) self.c.setLayout(l2) l2.addWidget(self.details, 0, 0, 1, -1) self.splitter.addWidget(self.c) @@ -179,7 +178,7 @@ class BookInfo(QDialog): if mi is not None: self.refresh(self.current_row, mi=mi) - def link_clicked(self, qurl): + def on_link_clicked(self, qurl): link = unicode_type(qurl.toString(NO_URL_FORMATTING)) self.link_delegate(link) diff --git a/src/calibre/gui2/metadata/single_download.py b/src/calibre/gui2/metadata/single_download.py index d984ecceef..e07d726cf6 100644 --- a/src/calibre/gui2/metadata/single_download.py +++ b/src/calibre/gui2/metadata/single_download.py @@ -30,6 +30,7 @@ from calibre.ebooks.metadata.book.base import Metadata from calibre.ebooks.metadata.opf2 import OPF from calibre.gui2 import error_dialog, rating_font, gprefs from calibre.gui2.progress_indicator import draw_snake_spinner +from calibre.gui2.widgets2 import HTMLDisplay from calibre.utils.date import (utcnow, fromordinal, format_date, UNDEFINED_DATE, as_utc) from calibre.library.comments import comments_to_html @@ -312,10 +313,10 @@ class ResultsView(QTableView): # {{{ # }}} -class Comments(QTextBrowser): # {{{ +class Comments(HTMLDisplay): # {{{ def __init__(self, parent=None): - QTextBrowser.__init__(self, parent) + HTMLDisplay.__init__(self, parent) self.setAcceptDrops(False) self.setMaximumWidth(300) self.setMinimumWidth(300) @@ -323,14 +324,9 @@ class Comments(QTextBrowser): # {{{ self.wait_timer.timeout.connect(self.update_wait) self.wait_timer.setInterval(800) self.dots_count = 0 + self.anchor_clicked.connect(self.link_activated) - palette = self.palette() - palette.setBrush(QPalette.Base, Qt.transparent) - self.setPalette(palette) - self.setAttribute(Qt.WA_OpaquePaintEvent, False) - self.anchorClicked.connect(self.link_clicked) - - def link_clicked(self, url): + def link_activated(self, url): from calibre.gui2 import open_url if url.scheme() in {'http', 'https'}: open_url(url) diff --git a/src/calibre/gui2/widgets2.py b/src/calibre/gui2/widgets2.py index dd9e600b35..cb063ba526 100644 --- a/src/calibre/gui2/widgets2.py +++ b/src/calibre/gui2/widgets2.py @@ -1,22 +1,22 @@ #!/usr/bin/env python2 # vim:fileencoding=utf-8 -from __future__ import absolute_import, division, print_function, unicode_literals +# License: GPLv3 Copyright: 2013, Kovid Goyal -__license__ = 'GPL v3' -__copyright__ = '2013, Kovid Goyal ' +from __future__ import absolute_import, division, print_function, unicode_literals import weakref from PyQt5.Qt import ( - QPushButton, QPixmap, QIcon, QColor, Qt, QColorDialog, pyqtSignal, - QKeySequence, QToolButton, QDialog, QDialogButtonBox, QComboBox, QFont, - QAbstractListModel, QModelIndex, QApplication, QStyledItemDelegate, - QUndoCommand, QUndoStack, QLayout, QRect, QSize, QStyle, QSizePolicy, - QPoint, QWidget, QLabel, QCheckBox) + QAbstractListModel, QApplication, QCheckBox, QColor, QColorDialog, QComboBox, + QDialog, QDialogButtonBox, QFont, QIcon, QKeySequence, QLabel, QLayout, + QModelIndex, QPalette, QPixmap, QPoint, QPushButton, QRect, QSize, QSizePolicy, + QStyle, QStyledItemDelegate, Qt, QTextBrowser, QToolButton, QUndoCommand, + QUndoStack, QWidget, pyqtSignal +) from calibre.ebooks.metadata import rating_to_stars from calibre.gui2 import gprefs, rating_font -from calibre.gui2.complete2 import LineEdit, EditWithComplete +from calibre.gui2.complete2 import EditWithComplete, LineEdit from calibre.gui2.widgets import history from polyglot.builtins import unicode_type @@ -427,6 +427,30 @@ class FlowLayout(QLayout): # {{{ # }}} +class HTMLDisplay(QTextBrowser): + + anchor_clicked = pyqtSignal(object) + + def __init__(self, parent=None): + QTextBrowser.__init__(self, parent) + self.setFrameShape(self.NoFrame) + self.setOpenLinks(False) + self.setAttribute(Qt.WA_OpaquePaintEvent, False) + palette = self.palette() + palette.setBrush(QPalette.Base, Qt.transparent) + self.setPalette(palette) + self.setAcceptDrops(False) + self.anchorClicked.connect(self.on_anchor_clicked) + + def on_anchor_clicked(self, qurl): + if not qurl.scheme() and qurl.hasFragment() and qurl.toString().startswith('#'): + frag = qurl.fragment(qurl.FullyDecoded) + if frag: + self.scrollToAnchor(frag) + return + self.anchor_clicked.emit(qurl) + + if __name__ == '__main__': from calibre.gui2 import Application app = Application([]) From a304b67ce3afec6fd94dfc3c3205ac37a988a4d3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 25 Jun 2019 13:38:54 +0530 Subject: [PATCH 1376/2613] Remove WebKit from the ToC Editor --- resources/toc.js | 53 +++++++ src/calibre/ebooks/oeb/polish/choose.coffee | 56 ------- src/calibre/gui2/toc/location.py | 167 +++++++++----------- 3 files changed, 129 insertions(+), 147 deletions(-) create mode 100644 resources/toc.js delete mode 100644 src/calibre/ebooks/oeb/polish/choose.coffee diff --git a/resources/toc.js b/resources/toc.js new file mode 100644 index 0000000000..36bc89c32a --- /dev/null +++ b/resources/toc.js @@ -0,0 +1,53 @@ +/* vim:fileencoding=utf-8 + * + * Copyright (C) 2019 Kovid Goyal + * + * Distributed under terms of the GPLv3 license + */ +(function() { + "use strict"; + var com_id = "COM_ID"; + var com_counter = 0; + + function onclick(event) { + // We dont want this event to trigger onclick on this element's parent + // block, if any. + event.stopPropagation(); + var frac = window.pageYOffset/document.body.scrollHeight; + var loc = []; + var totals = []; + var block = event.currentTarget; + var parent = block; + while (parent && parent.tagName && parent.tagName.toLowerCase() !== 'body') { + totals.push(parent.parentNode.children.length); + var num = 0; + var sibling = parent.previousElementSibling; + while (sibling) { + num += 1; + sibling = sibling.previousElementSibling; + } + loc.push(num); + parent = parent.parentNode; + } + loc.reverse(); + totals.reverse(); + com_counter += 1; + window.calibre_toc_data = [block.tagName.toLowerCase(), block.id, loc, totals, frac]; + document.title = com_id + '-' + com_counter; + } + + function find_blocks() { + for (let elem of document.body.getElementsByTagName('*')) { + style = window.getComputedStyle(elem); + if (style.display === 'block' || style.display === 'flex-box' || style.display === 'box') { + elem.classList.add("calibre_toc_hover"); + elem.onclick = onclick; + } + } + } + + var style = document.createElement('style'); + style.innerText = 'body { background-color: white }' + '.calibre_toc_hover:hover { cursor: pointer !important; border-top: solid 5px green !important }' + '::selection {background:#ffff00; color:#000;}'; + document.documentElement.appendChild(style); + find_blocks(); +})(); diff --git a/src/calibre/ebooks/oeb/polish/choose.coffee b/src/calibre/ebooks/oeb/polish/choose.coffee deleted file mode 100644 index 9843b29224..0000000000 --- a/src/calibre/ebooks/oeb/polish/choose.coffee +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env coffee -# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai - -### - Copyright 2013, Kovid Goyal - Released under the GPLv3 License -### - - -if window?.calibre_utils - log = window.calibre_utils.log - -class AnchorLocator - - ### - # Allow the user to click on any block level element to choose it as the - # location for an anchor. - ### - constructor: () -> - if not this instanceof arguments.callee - throw new Error('AnchorLocator constructor called as function') - - find_blocks: () => - for elem in document.body.getElementsByTagName('*') - style = window.getComputedStyle(elem) - if style.display in ['block', 'flex-box', 'box'] - elem.className += " calibre_toc_hover" - elem.onclick = this.onclick - - onclick: (event) -> - # We dont want this event to trigger onclick on this element's parent - # block, if any. - event.stopPropagation() - frac = window.pageYOffset/document.body.scrollHeight - loc = [] - totals = [] - parent = this - while parent and parent.tagName.toLowerCase() != 'body' - totals.push(parent.parentNode.children.length) - num = 0 - sibling = parent.previousElementSibling - while sibling - num += 1 - sibling = sibling.previousElementSibling - loc.push(num) - parent = parent.parentNode - loc.reverse() - totals.reverse() - - window.py_bridge.onclick(this, JSON.stringify(loc), JSON.stringify(totals), frac) - return false - -calibre_anchor_locator = new AnchorLocator() -calibre_anchor_locator.find_blocks() - - diff --git a/src/calibre/gui2/toc/location.py b/src/calibre/gui2/toc/location.py index a76faae5b2..d36b83c76e 100644 --- a/src/calibre/gui2/toc/location.py +++ b/src/calibre/gui2/toc/location.py @@ -1,102 +1,95 @@ #!/usr/bin/env python2 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai +# License: GPLv3 Copyright: 2013, Kovid Goyal from __future__ import absolute_import, division, print_function, unicode_literals -__license__ = 'GPL v3' -__copyright__ = '2013, Kovid Goyal ' -__docformat__ = 'restructuredtext en' - import json -from PyQt5.Qt import (QWidget, QGridLayout, QListWidget, QSize, Qt, QUrl, - pyqtSlot, pyqtSignal, QVBoxLayout, QFrame, QLabel, - QLineEdit, QTimer, QPushButton, QIcon, QSplitter) -from PyQt5.QtWebKitWidgets import QWebView, QWebPage -from PyQt5.QtWebKit import QWebElement +from PyQt5.Qt import ( + QFrame, QGridLayout, QIcon, QLabel, QLineEdit, QListWidget, QPushButton, QSize, + QSplitter, Qt, QUrl, QVBoxLayout, QWidget, pyqtSignal +) +from PyQt5.QtWebEngineWidgets import QWebEnginePage, QWebEngineScript, QWebEngineView -from calibre.ebooks.oeb.display.webview import load_html -from calibre.gui2 import error_dialog, question_dialog, gprefs, secure_web_page +from calibre.gui2 import error_dialog, gprefs, question_dialog +from calibre.gui2.webengine import secure_webengine from calibre.utils.logging import default_log -from polyglot.builtins import native_string_type, range, unicode_type -from polyglot.binary import as_base64_unicode +from calibre.utils.short_uuid import uuid4 +from polyglot.builtins import range, unicode_type -class Page(QWebPage): # {{{ +class Page(QWebEnginePage): # {{{ elem_clicked = pyqtSignal(object, object, object, object, object) + frag_shown = pyqtSignal(object) def __init__(self): self.log = default_log - QWebPage.__init__(self) - secure_web_page(self.settings()) - self.js = None - self.evaljs = self.mainFrame().evaluateJavaScript - nam = self.networkAccessManager() - nam.setNetworkAccessible(nam.NotAccessible) - self.setLinkDelegationPolicy(self.DelegateAllLinks) + self.current_frag = None + self.com_id = unicode_type(uuid4()) + QWebEnginePage.__init__(self) + secure_webengine(self.settings(), for_viewer=True) + self.titleChanged.connect(self.title_changed) + self.loadFinished.connect(self.show_frag) + s = QWebEngineScript() + s.setName('toc.js') + s.setInjectionPoint(QWebEngineScript.DocumentReady) + s.setRunsOnSubFrames(True) + s.setWorldId(QWebEngineScript.ApplicationWorld) + s.setSourceCode(P('toc.js', allow_user_override=False, data=True).decode('utf-8').replace('COM_ID', self.com_id)) + self.scripts().insert(s) - def javaScriptConsoleMessage(self, msg, lineno, msgid): + def javaScriptConsoleMessage(self, level, msg, lineno, msgid): self.log('JS:', unicode_type(msg)) - def javaScriptAlert(self, frame, msg): + def javaScriptAlert(self, origin, msg): self.log(unicode_type(msg)) - @pyqtSlot(result=bool) - def shouldInterruptJavaScript(self): - return True + def title_changed(self, title): + parts = title.split('-', 1) + if len(parts) == 2 and parts[0] == self.com_id: + self.runJavaScript( + 'JSON.stringify(window.calibre_toc_data)', + QWebEngineScript.ApplicationWorld, self.onclick) - @pyqtSlot(QWebElement, native_string_type, native_string_type, float) - def onclick(self, elem, loc, totals, frac): - elem_id = unicode_type(elem.attribute('id')) or None - tag = unicode_type(elem.tagName()).lower() - self.elem_clicked.emit(tag, frac, elem_id, json.loads(unicode_type(loc)), json.loads(unicode_type(totals))) + def onclick(self, data): + try: + tag, elem_id, loc, totals, frac = json.loads(data) + except Exception: + return + elem_id = elem_id or None + self.elem_clicked.emit(tag, frac, elem_id, loc, totals) + + def show_frag(self, ok): + if ok and self.current_frag: + self.runJavaScript(''' + document.location = '#non-existent-anchor'; + document.location = '#' + {0}; + '''.format(json.dumps(self.current_frag))) + self.current_frag = None + self.runJavaScript('window.pageYOffset/document.body.scrollHeight', QWebEngineScript.ApplicationWorld, self.frag_shown.emit) - def load_js(self): - if self.js is None: - from calibre.utils.resources import compiled_coffeescript - self.js = compiled_coffeescript('ebooks.oeb.display.utils') - self.js += compiled_coffeescript('ebooks.oeb.polish.choose') - if isinstance(self.js, bytes): - self.js = self.js.decode('utf-8') - self.mainFrame().addToJavaScriptWindowObject("py_bridge", self) - self.evaljs(self.js) # }}} -class WebView(QWebView): # {{{ +class WebView(QWebEngineView): # {{{ elem_clicked = pyqtSignal(object, object, object, object, object) + frag_shown = pyqtSignal(object) def __init__(self, parent): - QWebView.__init__(self, parent) + QWebEngineView.__init__(self, parent) self._page = Page() self._page.elem_clicked.connect(self.elem_clicked) + self._page.frag_shown.connect(self.frag_shown) self.setPage(self._page) - raw = ''' - body { background-color: white } - .calibre_toc_hover:hover { cursor: pointer !important; border-top: solid 5px green !important } - ''' - raw = '::selection {background:#ffff00; color:#000;}\n'+raw - data = 'data:text/css;charset=utf-8;base64,' - data += as_base64_unicode(raw) - self.settings().setUserStyleSheetUrl(QUrl(data)) - def load_js(self): - self.page().load_js() + def load_path(self, path, frag=None): + self._page.current_frag = frag + self.setUrl(QUrl.fromLocalFile(path)) def sizeHint(self): return QSize(1500, 300) - - def show_frag(self, frag): - self.page().mainFrame().scrollToAnchor(frag) - - @property - def scroll_frac(self): - try: - val = float(self.page().evaljs('window.pageYOffset/document.body.scrollHeight')) - except (TypeError, ValueError): - val = 0 - return val # }}} @@ -105,6 +98,8 @@ class ItemEdit(QWidget): def __init__(self, parent, prefs=None): QWidget.__init__(self, parent) self.prefs = prefs or gprefs + self.pending_search = None + self.current_frag = None self.setLayout(QVBoxLayout()) self.la = la = QLabel(''+_( @@ -126,6 +121,8 @@ class ItemEdit(QWidget): w.setLayout(l) self.view = WebView(self) self.view.elem_clicked.connect(self.elem_clicked) + self.view.frag_shown.connect(self.update_dest_label, type=Qt.QueuedConnection) + self.view.loadFinished.connect(self.load_finished, type=Qt.QueuedConnection) l.addWidget(self.view, 0, 0, 1, 3) sp.addWidget(w) @@ -178,6 +175,11 @@ class ItemEdit(QWidget): if state is not None: sp.restoreState(state) + def load_finished(self, ok): + if self.pending_search: + self.pending_search() + self.pending_search = None + def keyPressEvent(self, ev): if ev.key() in (Qt.Key_Return, Qt.Key_Enter) and self.search_text.hasFocus(): # Prevent pressing enter in the search box from triggering the dialog's accept() method @@ -187,11 +189,14 @@ class ItemEdit(QWidget): def find(self, forwards=True): text = unicode_type(self.search_text.text()).strip() - flags = QWebPage.FindFlags(0) if forwards else QWebPage.FindBackward + flags = QWebEnginePage.FindFlags(0) if forwards else QWebEnginePage.FindBackward + self.find_data = text, flags, forwards + self.view.findText(text, flags, self.find_callback) + + def find_callback(self, found): d = self.dest_list - if d.count() == 1: - flags |= QWebPage.FindWrapsAroundDocument - if not self.view.findText(text, flags) and text: + text, flags, forwards = self.find_data + if not found and text: if d.count() == 1: return error_dialog(self, _('No match found'), _('No match found for: %s')%text, show=True) @@ -223,7 +228,6 @@ class ItemEdit(QWidget): def current_changed(self, item): name = self.current_name = unicode_type(item.data(Qt.DisplayRole) or '') - self.current_frag = None path = self.container.name_to_abspath(name) # Ensure encoding map is populated root = self.container.parsed(name) @@ -236,17 +240,10 @@ class ItemEdit(QWidget): for x in reversed(nasty): body[0].insert(0, x) self.container.commit_item(name, keep_parsed=True) - encoding = self.container.encoding_map.get(name, None) or 'utf-8' - - load_html(path, self.view, codec=encoding, - mime_type=self.container.mime_map[name]) - self.view.load_js() + self.view.load_path(path, self.current_frag) + self.current_frag = None self.dest_label.setText(self.base_msg + '
    ' + _('File:') + ' ' + name + '
    ' + _('Top of the file')) - if hasattr(self, 'pending_search'): - f = self.pending_search - del self.pending_search - f() def __call__(self, item, where): self.current_item, self.current_where = item, where @@ -271,20 +268,9 @@ class ItemEdit(QWidget): self.dest_list.setCurrentRow(dest_index) self.dest_list.blockSignals(False) item = self.dest_list.item(dest_index) - self.current_changed(item) if frag: self.current_frag = frag - QTimer.singleShot(1, self.show_frag) - - def show_frag(self): - self.view.show_frag(self.current_frag) - QTimer.singleShot(1, self.check_frag) - - def check_frag(self): - pos = self.view.scroll_frac - if pos == 0: - self.current_frag = None - self.update_dest_label() + self.current_changed(item) def get_loctext(self, frac): frac = int(round(frac * 100)) @@ -301,8 +287,7 @@ class ItemEdit(QWidget): self.dest_label.setText(self.base_msg + '
    ' + _('File:') + ' ' + self.current_name + '
    ' + loctext) - def update_dest_label(self): - val = self.view.scroll_frac + def update_dest_label(self, val): self.dest_label.setText(self.base_msg + '
    ' + _('File:') + ' ' + self.current_name + '
    ' + self.get_loctext(val)) From 27798beaf6a402afe5c0acfa92f3a725ead20a44 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 25 Jun 2019 18:41:46 +0530 Subject: [PATCH 1377/2613] Use a separate process for the ToC Editor from the main GUI This is needed because the main GUI does not use web engine --- src/calibre/constants.py | 1 + src/calibre/gui2/actions/toc_edit.py | 50 +++++++++++++++++--- src/calibre/gui2/jobs.py | 4 +- src/calibre/gui2/toc/main.py | 70 +++++++++++++++++++--------- src/calibre/gui_launch.py | 7 +++ src/calibre/utils/ipc/worker.py | 3 ++ src/calibre/utils/lock.py | 25 +++++----- 7 files changed, 120 insertions(+), 40 deletions(-) diff --git a/src/calibre/constants.py b/src/calibre/constants.py index d8bbf2d2c2..e046eb4148 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -44,6 +44,7 @@ VIEWER_APP_UID = 'com.calibre-ebook.viewer' EDITOR_APP_UID = 'com.calibre-ebook.edit-book' MAIN_APP_UID = 'com.calibre-ebook.main-gui' STORE_DIALOG_APP_UID = 'com.calibre-ebook.store-dialog' +TOC_DIALOG_APP_UID = 'com.calibre-ebook.toc-editor' try: preferred_encoding = locale.getpreferredencoding() codecs.lookup(preferred_encoding) diff --git a/src/calibre/gui2/actions/toc_edit.py b/src/calibre/gui2/actions/toc_edit.py index c39f3dc2ee..f830245b74 100644 --- a/src/calibre/gui2/actions/toc_edit.py +++ b/src/calibre/gui2/actions/toc_edit.py @@ -6,6 +6,7 @@ __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' __docformat__ = 'restructuredtext en' +import os from collections import OrderedDict from PyQt5.Qt import (QTimer, QDialog, QGridLayout, QCheckBox, QLabel, @@ -13,6 +14,7 @@ from PyQt5.Qt import (QTimer, QDialog, QGridLayout, QCheckBox, QLabel, from calibre.gui2 import error_dialog, gprefs from calibre.gui2.actions import InterfaceAction +from calibre.utils.monotonic import monotonic from polyglot.builtins import iteritems, unicode_type SUPPORTED = {'EPUB', 'AZW3'} @@ -100,6 +102,7 @@ class ToCEditAction(InterfaceAction): def genesis(self): self.qaction.triggered.connect(self.edit_books) + self.jobs = [] def get_supported_books(self, book_ids): db = self.gui.library_view.model().db @@ -138,15 +141,50 @@ class ToCEditAction(InterfaceAction): self.do_one(book_id, fmt) def do_one(self, book_id, fmt): - from calibre.gui2.toc.main import TOCEditor db = self.gui.current_db path = db.format(book_id, fmt, index_is_id=True, as_path=True) title = db.title(book_id, index_is_id=True) + ' [%s]'%fmt - d = TOCEditor(path, title=title, parent=self.gui) - d.start() - if d.exec_() == d.Accepted: - with open(path, 'rb') as f: - db.add_format(book_id, fmt, f, index_is_id=True) + data = {'path': path, 'title': title} + self.gui.job_manager.launch_gui_app('toc-dialog', kwargs=data) + job = data.copy() + job.update({'book_id': book_id, 'fmt': fmt, 'library_id': db.new_api.library_id, 'started': False, 'start_time': monotonic()}) + self.jobs.append(job) + self.check_for_completions() + + def check_for_completions(self): + from calibre.utils.lock import lock_file + for job in tuple(self.jobs): + lock_path = job['path'] + '.lock' + if job['started']: + if not os.path.exists(lock_path): + self.jobs.remove(job) + continue + try: + lf = lock_file(lock_path, timeout=0.01, sleep_time=0.005) + except EnvironmentError: + continue + else: + self.jobs.remove(job) + ret = int(lf.read().decode('ascii')) + lf.close() + os.remove(lock_path) + if ret == 0: + db = self.gui.current_db + if db.new_api.library_id != job['library_id']: + error_dialog(self.gui, _('Library changed'), _( + 'Cannot save changes made to {0} by the ToC editor as' + ' the calibre library has changed.').format(job['title']), show=True) + else: + db.new_api.add_format(job['book_id'], job['fmt'], job['path'], run_hooks=False) + os.remove(job['path']) + else: + if monotonic() - job['start_time'] > 10: + self.jobs.remove(job) + continue + if os.path.exists(lock_path): + job['started'] = True + if self.jobs: + QTimer.singleShot(100, self.check_for_completions) def edit_books(self): book_id_map = self.get_books_for_editing() diff --git a/src/calibre/gui2/jobs.py b/src/calibre/gui2/jobs.py index 16f138229b..66bf974c94 100644 --- a/src/calibre/gui2/jobs.py +++ b/src/calibre/gui2/jobs.py @@ -281,9 +281,9 @@ class JobManager(QAbstractTableModel, AdaptSQP): # {{{ self.add_job(job) self.threaded_server.add_job(job) - def launch_gui_app(self, name, args=[], kwargs={}, description=''): + def launch_gui_app(self, name, args=(), kwargs=None, description=''): job = ParallelJob(name, description, lambda x: x, - args=args, kwargs=kwargs) + args=list(args), kwargs=kwargs or {}) self.server.run_job(job, gui=True, redirect_output=False) def _kill_job(self, job): diff --git a/src/calibre/gui2/toc/main.py b/src/calibre/gui2/toc/main.py index f5a00b01ae..b779ec4524 100644 --- a/src/calibre/gui2/toc/main.py +++ b/src/calibre/gui2/toc/main.py @@ -1,29 +1,37 @@ #!/usr/bin/env python2 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai +# License: GPLv3 Copyright: 2013, Kovid Goyal + from __future__ import absolute_import, division, print_function, unicode_literals -__license__ = 'GPL v3' -__copyright__ = '2013, Kovid Goyal ' -__docformat__ = 'restructuredtext en' - -import sys, os, textwrap -from threading import Thread +import os +import sys +import textwrap from functools import partial +from threading import Thread -from PyQt5.Qt import (QPushButton, QFrame, QMenu, QInputDialog, QCheckBox, - QDialog, QVBoxLayout, QDialogButtonBox, QSize, QStackedWidget, QWidget, - QLabel, Qt, pyqtSignal, QIcon, QTreeWidget, QGridLayout, QTreeWidgetItem, - QToolButton, QItemSelectionModel, QCursor, QKeySequence, QSizePolicy) +from PyQt5.Qt import ( + QCheckBox, QCursor, QDialog, QDialogButtonBox, QFrame, QGridLayout, QIcon, + QInputDialog, QItemSelectionModel, QKeySequence, QLabel, QMenu, QPushButton, + QSize, QSizePolicy, QStackedWidget, Qt, QToolButton, QTreeWidget, + QTreeWidgetItem, QVBoxLayout, QWidget, pyqtSignal +) -from calibre.ebooks.oeb.polish.container import get_container, AZW3Container +from calibre.constants import TOC_DIALOG_APP_UID, islinux, iswindows +from calibre.ebooks.oeb.polish.container import AZW3Container, get_container from calibre.ebooks.oeb.polish.toc import ( - get_toc, add_id, TOC, commit_toc, from_xpaths, from_links, from_files) -from calibre.gui2 import Application, error_dialog, gprefs, info_dialog, question_dialog + TOC, add_id, commit_toc, from_files, from_links, from_xpaths, get_toc +) +from calibre.gui2 import ( + Application, error_dialog, gprefs, info_dialog, question_dialog, set_app_uid +) +from calibre.gui2.convert.xpath_wizard import XPathEdit from calibre.gui2.progress_indicator import ProgressIndicator from calibre.gui2.toc.location import ItemEdit -from calibre.gui2.convert.xpath_wizard import XPathEdit +from calibre.ptempfile import reset_base_dir +from calibre.utils.lock import ExclusiveFile from calibre.utils.logging import GUILog -from polyglot.builtins import map, unicode_type, range +from polyglot.builtins import map, range, unicode_type ICON_SIZE = 24 @@ -1117,10 +1125,30 @@ class TOCEditor(QDialog): # {{{ # }}} +def main(path=None, title=None): + # Ensure we can continue to function if GUI is closed + os.environ.pop('CALIBRE_WORKER_TEMP_DIR', None) + reset_base_dir() + if iswindows: + # Ensure that all instances are grouped together in the task bar. This + # prevents them from being grouped with viewer/editor process when + # launched from within calibre, as both use calibre-parallel.exe + set_app_uid(TOC_DIALOG_APP_UID) + + with ExclusiveFile(path + '.lock') as wf: + override = 'calibre-gui' if islinux else None + app = Application([], override_program_name=override) + d = TOCEditor(path, title=title) + d.start() + ret = 1 + if d.exec_() == d.Accepted: + ret = 0 + wf.write('{}'.format(ret).encode('ascii')) + del d + del app + raise SystemExit(ret) + + if __name__ == '__main__': - app = Application([], force_calibre_style=True) - app - d = TOCEditor(sys.argv[-1]) - d.start() - d.exec_() - del d # Needed to prevent sigsegv in exit cleanup + main(path=sys.argv[-1], title='test') + os.remove(sys.argv[-1] + '.lock') diff --git a/src/calibre/gui_launch.py b/src/calibre/gui_launch.py index f8b35ee2fa..3d8f98303d 100644 --- a/src/calibre/gui_launch.py +++ b/src/calibre/gui_launch.py @@ -88,6 +88,13 @@ def store_dialog(args=sys.argv): main(args) +def toc_dialog(**kw): + detach_gui() + init_dbus() + from calibre.gui2.toc.main import main + main(**kw) + + def gui_ebook_edit(path=None, notify=None): ' For launching the editor from inside calibre ' init_dbus() diff --git a/src/calibre/utils/ipc/worker.py b/src/calibre/utils/ipc/worker.py index 7c1b1c0f12..f55ac3c951 100644 --- a/src/calibre/utils/ipc/worker.py +++ b/src/calibre/utils/ipc/worker.py @@ -32,6 +32,9 @@ PARALLEL_FUNCS = { 'store-dialog' : ('calibre.gui_launch', 'store_dialog', None), + 'toc-dialog' : + ('calibre.gui_launch', 'toc_dialog', None), + 'render_pages' : ('calibre.ebooks.comic.input', 'render_pages', 'notification'), diff --git a/src/calibre/utils/lock.py b/src/calibre/utils/lock.py index 5d1f46820d..fb37f7c8f0 100644 --- a/src/calibre/utils/lock.py +++ b/src/calibre/utils/lock.py @@ -85,6 +85,19 @@ def retry_for_a_time(timeout, sleep_time, func, error_retry, *args): time.sleep(sleep_time) +def lock_file(path, timeout=15, sleep_time=0.2): + if iswindows: + return retry_for_a_time( + timeout, sleep_time, windows_open, windows_retry, path + ) + f = unix_open(path) + retry_for_a_time( + timeout, sleep_time, fcntl.flock, unix_retry, + f.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB + ) + return f + + class ExclusiveFile(object): def __init__(self, path, timeout=15, sleep_time=0.2): @@ -95,17 +108,7 @@ class ExclusiveFile(object): self.sleep_time = sleep_time def __enter__(self): - if iswindows: - self.file = retry_for_a_time( - self.timeout, self.sleep_time, windows_open, windows_retry, self.path - ) - else: - f = unix_open(self.path) - retry_for_a_time( - self.timeout, self.sleep_time, fcntl.flock, unix_retry, - f.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB - ) - self.file = f + self.file = lock_file(self.path, self.timeout, self.sleep_time) return self.file def __exit__(self, type, value, traceback): From 6f86896da8bfdf7c0ca811643b0eb58326e0baf4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 26 Jun 2019 15:02:12 +0530 Subject: [PATCH 1378/2613] Dont use WebKit to render HTML for EPUB covers --- src/calibre/ebooks/__init__.py | 108 ++++++---------------------- src/calibre/ebooks/metadata/epub.py | 37 +--------- src/calibre/ebooks/metadata/pdf.py | 9 +-- src/calibre/ebooks/render_html.py | 58 +++++++++++++++ src/calibre/gui2/webengine.py | 2 + 5 files changed, 88 insertions(+), 126 deletions(-) create mode 100644 src/calibre/ebooks/render_html.py diff --git a/src/calibre/ebooks/__init__.py b/src/calibre/ebooks/__init__.py index 34b5904d8f..dd6207b6d3 100644 --- a/src/calibre/ebooks/__init__.py +++ b/src/calibre/ebooks/__init__.py @@ -8,8 +8,8 @@ Code for the conversion of ebook formats and the reading of metadata from various formats. ''' -import traceback, os, re, numbers -from calibre import CurrentDir, prints +import os, re, numbers, sys +from calibre import prints from calibre.ebooks.chardet import xml_to_unicode from polyglot.builtins import unicode_type @@ -41,40 +41,6 @@ BOOK_EXTENSIONS = ['lrf', 'rar', 'zip', 'rtf', 'lit', 'txt', 'txtz', 'text', 'ht 'textile', 'markdown', 'ibook', 'ibooks', 'iba', 'azw3', 'ps', 'kepub', 'kfx'] -class HTMLRenderer(object): - - def __init__(self, page, loop): - self.page, self.loop = page, loop - self.data = '' - self.exception = self.tb = None - - def __call__(self, ok): - from PyQt5.Qt import QImage, QPainter, QByteArray, QBuffer - try: - if not ok: - raise RuntimeError('Rendering of HTML failed.') - de = self.page.mainFrame().documentElement() - pe = de.findFirst('parsererror') - if not pe.isNull(): - raise ParserError(pe.toPlainText()) - image = QImage(self.page.viewportSize(), QImage.Format_ARGB32) - image.setDotsPerMeterX(96*(100/2.54)) - image.setDotsPerMeterY(96*(100/2.54)) - painter = QPainter(image) - self.page.mainFrame().render(painter) - painter.end() - ba = QByteArray() - buf = QBuffer(ba) - buf.open(QBuffer.WriteOnly) - image.save(buf, 'JPEG') - self.data = ba.data() - except Exception as e: - self.exception = e - self.traceback = traceback.format_exc() - finally: - self.loop.exit(0) - - def return_raster_image(path): from calibre.utils.imghdr import what if os.access(path, os.R_OK): @@ -145,63 +111,33 @@ def render_html_svg_workaround(path_to_html, log, width=590, height=750): pass if data is None: - from calibre.gui2 import is_ok_to_use_qt - if is_ok_to_use_qt(): - data = render_html_data(path_to_html, width, height) - else: - from calibre.utils.ipc.simple_worker import fork_job, WorkerError - try: - result = fork_job('calibre.ebooks', - 'render_html_data', - (path_to_html, width, height), - no_output=True) - data = result['result'] - except WorkerError as err: - prints(err.orig_tb) - except: - traceback.print_exc() + data = render_html_data(path_to_html, width, height) return data def render_html_data(path_to_html, width, height): - renderer = render_html(path_to_html, width, height) - return getattr(renderer, 'data', None) + from calibre.ptempfile import TemporaryDirectory + from calibre.utils.ipc.simple_worker import fork_job, WorkerError + def report_error(text=''): + prints('Failed to render', path_to_html, 'with errors:', file=sys.stderr) + if text: + prints(text, file=sys.stderr) + if result['stdout_stderr']: + with open(result['stdout_stderr'], 'rb') as f: + prints(f.read(), file=sys.stderr) -def render_html(path_to_html, width=590, height=750, as_xhtml=True): - from PyQt5.QtWebKitWidgets import QWebPage - from PyQt5.Qt import QEventLoop, QPalette, Qt, QUrl, QSize - from calibre.gui2 import is_ok_to_use_qt, secure_web_page - if not is_ok_to_use_qt(): - return None - path_to_html = os.path.abspath(path_to_html) - with CurrentDir(os.path.dirname(path_to_html)): - page = QWebPage() - settings = page.settings() - secure_web_page(settings) - pal = page.palette() - pal.setBrush(QPalette.Background, Qt.white) - page.setPalette(pal) - page.setViewportSize(QSize(width, height)) - page.mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff) - page.mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff) - loop = QEventLoop() - renderer = HTMLRenderer(page, loop) - page.loadFinished.connect(renderer, type=Qt.QueuedConnection) - if as_xhtml: - page.mainFrame().setContent(open(path_to_html, 'rb').read(), - 'application/xhtml+xml', QUrl.fromLocalFile(path_to_html)) + with TemporaryDirectory('-render-html') as tdir: + try: + result = fork_job('calibre.ebooks.render_html', 'main', args=(path_to_html, tdir, 'jpeg')) + except WorkerError as e: + report_error(e.orig_tb) else: - page.mainFrame().load(QUrl.fromLocalFile(path_to_html)) - loop.exec_() - renderer.loop = renderer.page = None - page.loadFinished.disconnect() - del page - del loop - if isinstance(renderer.exception, ParserError) and as_xhtml: - return render_html(path_to_html, width=width, height=height, - as_xhtml=False) - return renderer + if result['result']: + with open(os.path.join(tdir, 'rendered.jpeg'), 'rb') as f: + return f.read() + else: + report_error() def check_ebook_format(stream, current_guess): diff --git a/src/calibre/ebooks/metadata/epub.py b/src/calibre/ebooks/metadata/epub.py index 3773e53fec..3ebac847f5 100644 --- a/src/calibre/ebooks/metadata/epub.py +++ b/src/calibre/ebooks/metadata/epub.py @@ -10,13 +10,11 @@ __copyright__ = '2008, Kovid Goyal ' import io import os import posixpath -import re from contextlib import closing from lxml import etree -from calibre import CurrentDir, walk -from calibre.constants import isosx +from calibre import CurrentDir from calibre.ebooks.metadata.opf import ( get_metadata as get_metadata_from_opf, set_metadata as set_metadata_opf ) @@ -198,39 +196,6 @@ def render_cover(cpage, zf, reader=None): cpage = os.path.join(tdir, cpage) if not os.path.exists(cpage): return - - if isosx: - # On OS X trying to render a HTML cover which uses embedded - # fonts more than once in the same process causes a crash in Qt - # so be safe and remove the fonts as well as any @font-face - # rules - for f in walk('.'): - if os.path.splitext(f)[1].lower() in ('.ttf', '.otf'): - os.remove(f) - ffpat = re.compile(br'@font-face.*?{.*?}', - re.DOTALL|re.IGNORECASE) - with lopen(cpage, 'r+b') as f: - raw = f.read() - f.truncate(0) - f.seek(0) - raw = ffpat.sub(b'', raw) - f.write(raw) - from calibre.ebooks.chardet import xml_to_unicode - raw = xml_to_unicode(raw, - strip_encoding_pats=True, resolve_entities=True)[0] - from lxml import html - for link in html.fromstring(raw).xpath('//link'): - href = link.get('href', '') - if href: - path = os.path.join(os.path.dirname(cpage), href) - if os.path.exists(path): - with lopen(path, 'r+b') as f: - raw = f.read() - f.truncate(0) - f.seek(0) - raw = ffpat.sub(b'', raw) - f.write(raw) - return render_html_svg_workaround(cpage, default_log) diff --git a/src/calibre/ebooks/metadata/pdf.py b/src/calibre/ebooks/metadata/pdf.py index bf29d62e1f..4f7486db9d 100644 --- a/src/calibre/ebooks/metadata/pdf.py +++ b/src/calibre/ebooks/metadata/pdf.py @@ -82,7 +82,7 @@ def read_info(outputdir, get_cover): return ans -def page_images(pdfpath, outputdir, first=1, last=1): +def page_images(pdfpath, outputdir='.', first=1, last=1, image_format='jpeg', prefix='page-images'): pdftoppm = get_tools()[1] outputdir = os.path.abspath(outputdir) args = {} @@ -90,9 +90,10 @@ def page_images(pdfpath, outputdir, first=1, last=1): import win32process as w args['creationflags'] = w.HIGH_PRIORITY_CLASS | w.CREATE_NO_WINDOW try: - subprocess.check_call([pdftoppm, '-cropbox', '-jpeg', '-f', unicode_type(first), - '-l', unicode_type(last), pdfpath, - os.path.join(outputdir, 'page-images')], **args) + subprocess.check_call([ + pdftoppm, '-cropbox', '-' + image_format, '-f', unicode_type(first), + '-l', unicode_type(last), pdfpath, os.path.join(outputdir, prefix) + ], **args) except subprocess.CalledProcessError as e: raise ValueError('Failed to render PDF, pdftoppm errorcode: %s'%e.returncode) diff --git a/src/calibre/ebooks/render_html.py b/src/calibre/ebooks/render_html.py new file mode 100644 index 0000000000..6d745a0eb1 --- /dev/null +++ b/src/calibre/ebooks/render_html.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python2 +# vim:fileencoding=utf-8 +# License: GPL v3 Copyright: 2019, Kovid Goyal + +from __future__ import absolute_import, division, print_function, unicode_literals + +import os +import sys + +from PyQt5.Qt import QApplication, QMarginsF, QPageLayout, QPageSize, Qt, QUrl +from PyQt5.QtWebEngineWidgets import QWebEnginePage + +from calibre.ebooks.metadata.pdf import page_images +from calibre.gui2 import must_use_qt +from calibre.gui2.webengine import secure_webengine + + +class Render(QWebEnginePage): + + def __init__(self): + QWebEnginePage.__init__(self) + secure_webengine(self) + self.loadFinished.connect(self.load_finished, type=Qt.QueuedConnection) + self.pdfPrintingFinished.connect(self.print_finished) + + def load_finished(self, ok): + if ok: + self.start_print() + else: + QApplication.instance().exit(1) + + def start_print(self): + margins = QMarginsF(0, 0, 0, 0) + page_layout = QPageLayout(QPageSize(QPageSize.A4), QPageLayout.Portrait, margins) + self.printToPdf('rendered.pdf', page_layout) + + def print_finished(self, path, ok): + QApplication.instance().exit(0 if ok else 2) + + +def main(path_to_html, tdir, image_format='jpeg'): + if image_format not in ('jpeg', 'png'): + raise ValueError('Image format must be either jpeg or png') + must_use_qt() + path_to_html = os.path.abspath(path_to_html) + os.chdir(tdir) + renderer = Render() + renderer.load(QUrl.fromLocalFile(path_to_html)) + ret = QApplication.instance().exec_() + if ret == 0: + page_images('rendered.pdf', image_format=image_format) + ext = {'jpeg': 'jpg'}.get(image_format, image_format) + os.rename('page-images-1.' + ext, 'rendered.' + image_format) + return ret == 0 + + +if __name__ == '__main__': + main(sys.argv[-1], '.') diff --git a/src/calibre/gui2/webengine.py b/src/calibre/gui2/webengine.py index adfcb1fb80..719e5b60a9 100644 --- a/src/calibre/gui2/webengine.py +++ b/src/calibre/gui2/webengine.py @@ -23,6 +23,8 @@ def secure_webengine(view_or_page_or_settings, for_viewer=False): if not for_viewer: a(s.JavascriptEnabled, False) s.setUnknownUrlSchemePolicy(s.DisallowUnknownUrlSchemes) + if hasattr(view_or_page_or_settings, 'setAudioMuted'): + view_or_page_or_settings.setAudioMuted(True) a(s.JavascriptCanOpenWindows, False) a(s.JavascriptCanAccessClipboard, False) # ensure javascript cannot read from local files From a6576f0effa9d974a9eff315cb11195ee94b786c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 26 Jun 2019 15:15:09 +0530 Subject: [PATCH 1379/2613] LRF Output: Disable the table as image option Implementing it using WebEngine is too painful and LRF is a useless format anyway. --- .../ebooks/conversion/plugins/lrf_output.py | 3 +- src/calibre/ebooks/lrf/html/convert_from.py | 50 +++------ src/calibre/ebooks/lrf/html/table_as_image.py | 102 ------------------ 3 files changed, 13 insertions(+), 142 deletions(-) delete mode 100644 src/calibre/ebooks/lrf/html/table_as_image.py diff --git a/src/calibre/ebooks/conversion/plugins/lrf_output.py b/src/calibre/ebooks/conversion/plugins/lrf_output.py index 88b6a6885d..947d30cdc6 100644 --- a/src/calibre/ebooks/conversion/plugins/lrf_output.py +++ b/src/calibre/ebooks/conversion/plugins/lrf_output.py @@ -117,8 +117,7 @@ class LRFOutput(OutputFormatPlugin): ), OptionRecommendation(name='render_tables_as_images', recommended_value=False, - help=_('Render tables in the HTML as images (useful if the ' - 'document has large or complex tables)') + help=_('This option has no effect') ), OptionRecommendation(name='text_size_multiplier_for_rendered_tables', recommended_value=1.0, diff --git a/src/calibre/ebooks/lrf/html/convert_from.py b/src/calibre/ebooks/lrf/html/convert_from.py index 781d205e05..d21f920d78 100644 --- a/src/calibre/ebooks/lrf/html/convert_from.py +++ b/src/calibre/ebooks/lrf/html/convert_from.py @@ -1727,44 +1727,18 @@ class HTMLConverter(object): self.previous_text = ' ' self.process_children(tag, tag_css, tag_pseudo_css) elif tagname == 'table' and not self.ignore_tables and not self.in_table: - if self.render_tables_as_images: - print('Rendering table...') - from calibre.ebooks.lrf.html.table_as_image import render_table - pheight = int(self.current_page.pageStyle.attrs['textheight']) - pwidth = int(self.current_page.pageStyle.attrs['textwidth']) - images = render_table(self.soup, tag, tag_css, - os.path.dirname(self.target_prefix), - pwidth, pheight, self.profile.dpi, - self.text_size_multiplier_for_rendered_tables) - for path, width, height in images: - stream = ImageStream(path, encoding='PNG') - im = Image(stream, x0=0, y0=0, x1=width, y1=height, - xsize=width, ysize=height) - pb = self.current_block - self.end_current_para() - self.process_alignment(tag_css) - self.current_para.append(Plot(im, xsize=width*720./self.profile.dpi, - ysize=height*720./self.profile.dpi)) - self.current_block.append(self.current_para) - self.current_page.append(self.current_block) - self.current_block = self.book.create_text_block( - textStyle=pb.textStyle, - blockStyle=pb.blockStyle) - self.current_para = Paragraph() - - else: - tag_css = self.tag_css(tag)[0] # Table should not inherit CSS - try: - self.process_table(tag, tag_css) - except Exception as err: - self.log.warning(_('An error occurred while processing a table: %s. Ignoring table markup.')%repr(err)) - self.log.exception('') - self.log.debug(_('Bad table:\n%s')%unicode_type(tag)[:300]) - self.in_table = False - self.process_children(tag, tag_css, tag_pseudo_css) - finally: - if self.minimize_memory_usage: - tag.extract() + tag_css = self.tag_css(tag)[0] # Table should not inherit CSS + try: + self.process_table(tag, tag_css) + except Exception as err: + self.log.warning(_('An error occurred while processing a table: %s. Ignoring table markup.')%repr(err)) + self.log.exception('') + self.log.debug(_('Bad table:\n%s')%unicode_type(tag)[:300]) + self.in_table = False + self.process_children(tag, tag_css, tag_pseudo_css) + finally: + if self.minimize_memory_usage: + tag.extract() else: self.process_children(tag, tag_css, tag_pseudo_css) finally: diff --git a/src/calibre/ebooks/lrf/html/table_as_image.py b/src/calibre/ebooks/lrf/html/table_as_image.py deleted file mode 100644 index 9606e49476..0000000000 --- a/src/calibre/ebooks/lrf/html/table_as_image.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python2 -from __future__ import absolute_import, division, print_function, unicode_literals - -__license__ = 'GPL v3' -__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' -__docformat__ = 'restructuredtext en' - -''' -Render HTML tables as images. -''' -import os, tempfile, atexit, shutil -from PyQt5.Qt import QUrl, QApplication, QSize, QEventLoop, \ - QPainter, QImage, QObject, Qt -from PyQt5.QtWebKitWidgets import QWebPage - -from polyglot.builtins import unicode_type - - -class HTMLTableRenderer(QObject): - - def __init__(self, html, base_dir, width, height, dpi, factor): - ''' - `width, height`: page width and height in pixels - `base_dir`: The directory in which the HTML file that contains the table resides - ''' - from calibre.gui2 import secure_web_page - QObject.__init__(self) - - self.app = None - self.width, self.height, self.dpi = width, height, dpi - self.base_dir = base_dir - self.images = [] - self.tdir = tempfile.mkdtemp(prefix='calibre_render_table') - self.loop = QEventLoop() - self.page = QWebPage() - secure_web_page(self.page.settings()) - self.page.loadFinished.connect(self.render_html) - self.page.mainFrame().setTextSizeMultiplier(factor) - self.page.mainFrame().setHtml(html, - QUrl('file:'+os.path.abspath(self.base_dir))) - - def render_html(self, ok): - try: - if not ok: - return - cwidth, cheight = self.page.mainFrame().contentsSize().width(), self.page.mainFrame().contentsSize().height() - self.page.setViewportSize(QSize(cwidth, cheight)) - factor = float(self.width)/cwidth if cwidth > self.width else 1 - cutoff_height = int(self.height/factor)-3 - image = QImage(self.page.viewportSize(), QImage.Format_ARGB32) - image.setDotsPerMeterX(self.dpi*(100/2.54)) - image.setDotsPerMeterY(self.dpi*(100/2.54)) - painter = QPainter(image) - self.page.mainFrame().render(painter) - painter.end() - cheight = image.height() - cwidth = image.width() - pos = 0 - while pos < cheight: - img = image.copy(0, pos, cwidth, min(cheight-pos, cutoff_height)) - pos += cutoff_height-20 - if cwidth > self.width: - img = img.scaledToWidth(self.width, Qt.SmoothTransform) - f = os.path.join(self.tdir, '%d.png'%pos) - img.save(f) - self.images.append((f, img.width(), img.height())) - finally: - QApplication.quit() - - -def render_table(soup, table, css, base_dir, width, height, dpi, factor=1.0): - head = '' - for e in soup.findAll(['link', 'style']): - head += unicode_type(e)+'\n\n' - style = '' - for key, val in css.items(): - style += key + ':%s;'%val - html = '''\ - - - %s - - - - %s - - - '''%(head, width-10, style, unicode_type(table)) - images, tdir = do_render(html, base_dir, width, height, dpi, factor) - atexit.register(shutil.rmtree, tdir) - return images - - -def do_render(html, base_dir, width, height, dpi, factor): - from calibre.gui2 import is_ok_to_use_qt - if not is_ok_to_use_qt(): - raise Exception('Not OK to use Qt') - tr = HTMLTableRenderer(html, base_dir, width, height, dpi, factor) - tr.loop.exec_() - return tr.images, tr.tdir From 82083ddbb85b6dfedb72389f05c90063a8aa8be2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 26 Jun 2019 20:17:01 +0530 Subject: [PATCH 1380/2613] Drop the dependency on dukpy The dukpy tests are failing on windows with VS 2017. Instead use Web Engine to compile rapydscript code, when the rapydscript binary is not present. --- COPYRIGHT | 4 - bypy/sources.json | 11 - resources/rapydscript/compiler.js.xz | Bin 333944 -> 118924 bytes src/calibre/test_build.py | 2 - src/calibre/utils/rapydscript.py | 390 +++++++++------------------ src/duktape/__init__.py | 383 -------------------------- src/duktape/tests.py | 205 -------------- 7 files changed, 128 insertions(+), 867 deletions(-) delete mode 100644 src/duktape/__init__.py delete mode 100644 src/duktape/tests.py diff --git a/COPYRIGHT b/COPYRIGHT index 638c9e505a..dd5c53bec0 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -4,10 +4,6 @@ License: GPL-3 The full text of the GPL is distributed as in /usr/share/common-licenses/GPL-3 on Debian systems. -Files: src/duktape/* -Copyright: Various -License: MIT - Files: resources/content-server/font-awesome/* Copyright: Various License: MIT and SIL OFL diff --git a/bypy/sources.json b/bypy/sources.json index d6a9afb318..4360cf08e5 100644 --- a/bypy/sources.json +++ b/bypy/sources.json @@ -639,17 +639,6 @@ } }, - { - "name": "dukpy", - "python": 2, - "unix": { - "filename": "dukpy-0.3.tar.gz", - "hash": "sha1:31c67f087f9d55798f2c00aba46fa18c3d8fb8aa", - "urls": ["https://github.com/kovidgoyal/dukpy/archive/v0.3.tar.gz"] - } - }, - - { "name": "chardet", "unix": { diff --git a/resources/rapydscript/compiler.js.xz b/resources/rapydscript/compiler.js.xz index 96169f6ec62574c2f70e069da3a98fae4908763d..d321f732d6a2871794895901417052868b009ede 100644 GIT binary patch literal 118924 zcmV(hK={A?H+ooF000E$*0e?f03iV!0000G&sfapWP{)YT>uy0eC%m9AERJPPk=qm zXFFl)8qHF4js+xrHbSHLttw>R-MKa`oGz?%+f_AVuI^hHo6?n>m2>#r=dF z&R;NlrIM2M5rht8w4(%G&P#s?dV`774!~m*(`48!jD%6QGLmVm4nhaYUhb>urf^oEq8k3cnF%rAuB6q*Fk$R(haQ`}w`=zYf309^smNeKp|`IjVU zQz&kifJn5dKOQeBkq#j2lu*^mUy6Cs%x_I$eMRKI8OeO~hli?Dx~-EA51qcWxknI} z<38GL?P9QJSX3SUlv?n6gRvw6tT_QE2U0`FWsOoCJXNN)d*Aj2&>(p-m~*YNs>4+{ zg4+{@04_?mS7u5>yGoup$?WwpD#q@cA2i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>0o5idPx3idzHNKma}-UsEylbKU5yvT9EQp4$TztE1^!4Ib|s!jFAV> z+8HYahB6d99#_zx?&!QwzfH;w;Ug{DVb5{GH=9~NFLP8n=6p-=s-KAfFkQdj;Wn3N zcWSpWCe2?^hFV}bb5P4-9->(D3^hAIJd>1WID0_-g_?T^;ekV+bd7@ z-g_lYj`J8$vtc-oQEaAq2b*Z`WXA;3k9$|r5h#!suWlwJV)ES1o}L?+}bbacCfs%*bR z+kmjDN>H#ds2k9X4cQBYI1!|_@75a!tm4uLzuVp7LkAYC8k{Z|uqjvBiA0q}Y~7Qh1ZXF zX7apJpyN!wx5yqX^4G3~2BTk-?nD+IMpOvarje7jCV55Xp56{F-tnW1`56Ty+GbR1 z0;svr+XV?@i58T;V0I>|=^BziYE>ofZ6iw0-Zn z!J`7hrKWN-JxFi>RKJfug==-1G2DM;p7h6Nt331;oSPCKzo>jVFRti$l_*sdQ?D!B zME@65!HrO5fei-K(7?6*r1_g^%~(sno_eyo9uLiDL-}g_;Ywu+{&=YS{9mVNAsqK3 z42tc~IJ*4u$9yFR%*IBP`IxFZ74MsBs5{}7BBT@yq$RTeJc^HB#Lu@JV^5_Cs5#aY zu`(`yyQOSv9nbHouJMjZl-uEdb?Q@;-abP5@Ott7)Nx2>Pty=^cjir+sk^(}TgSZm zwLg2GQaHzS%MzjHKN>ckP%I-+SU(??;_?3N&a#zH05o15)f(u$BZPAGz|iz2YEi=aaXY3v@wBtOn!=oa)lPv z6W-s2dzNn<7o|}E?m6lU{Ns#eco%g{7b=f^4=Glw@w;2m3p%ZTFceyYV5Ztp5aj*^ zn&JZC_$n?nea4M>8)O%`PVWx&09Gxoy+e|ufS`uVWy78cO9_ha<74+3nJSDPfV`^N zxP!Ye+VBSID0Rx`5pMX8X5lc2f(+v$ZzB}A$GJR=1Zfa`3QgEE! from __future__ import absolute_import, division, print_function, unicode_literals -import atexit import errno -import glob import json import os import re -import shutil import subprocess -import sys -from functools import partial from io import BytesIO -from threading import Thread, local +from lzma.xz import compress, decompress from calibre import force_unicode -from calibre.constants import ( - FAKE_HOST, FAKE_PROTOCOL, __appname__, __version__, cache_dir -) +from calibre.constants import FAKE_HOST, FAKE_PROTOCOL, __appname__, __version__ +from calibre.ptempfile import TemporaryDirectory from calibre.utils.filenames import atomic_rename -from calibre.utils.terminal import ANSIStream -from duktape import Context, JSError, to_python -from lzma.xz import compress, decompress -from polyglot.builtins import itervalues, range, exec_path, raw_input, error_message, filter, getcwd, zip, unicode_type -from polyglot.queue import Empty, Queue +from polyglot.builtins import exec_path, itervalues, unicode_type, zip, as_bytes COMPILER_PATH = 'rapydscript/compiler.js.xz' special_title = '__webengine_messages_pending__' @@ -41,49 +31,142 @@ def update_rapydscript(): d = os.path.dirname base = d(d(d(d(d(abspath(__file__)))))) base = os.path.join(base, 'rapydscript') - raw = subprocess.check_output(['node', '--harmony', os.path.join(base, 'bin', 'export')]) - if isinstance(raw, unicode_type): - raw = raw.encode('utf-8') + with TemporaryDirectory() as tdir: + subprocess.check_call(['node', '--harmony', os.path.join(base, 'bin', 'web-repl-export'), tdir]) + with open(os.path.join(tdir, 'rapydscript.js'), 'rb') as f: + raw = f.read() path = P(COMPILER_PATH, allow_user_override=False) with open(path, 'wb') as f: compress(raw, f, 9) - base = os.path.join(base, 'src', 'lib') - dest = os.path.join(P('rapydscript', allow_user_override=False), 'lib') - if not os.path.exists(dest): - os.mkdir(dest) - for x in glob.glob(os.path.join(base, '*.pyj')): - shutil.copy2(x, dest) # }}} # Compiler {{{ -tls = local() - - def to_dict(obj): return dict(zip(list(obj.keys()), list(obj.values()))) def compiler(): - c = getattr(tls, 'compiler', None) - if c is None: - c = tls.compiler = Context() - c.eval('exports = {}; sha1sum = Duktape.sha1sum;', noreturn=True) - buf = BytesIO() - decompress(P(COMPILER_PATH, data=True, allow_user_override=False), buf) - c.eval(buf.getvalue().decode('utf-8'), fname=COMPILER_PATH, noreturn=True) - return c + ans = getattr(compiler, 'ans', None) + if ans is not None: + return ans + from calibre import walk + from calibre.gui2 import must_use_qt + from calibre.gui2.webengine import secure_webengine + from PyQt5.QtWebEngineWidgets import QWebEnginePage, QWebEngineScript + from PyQt5.Qt import QApplication, QEventLoop + must_use_qt() + + buf = BytesIO() + decompress(P(COMPILER_PATH, data=True, allow_user_override=False), buf) + + base = base_dir() + rapydscript_dir = os.path.join(base, 'src', 'pyj') + cache_path = os.path.join(module_cache_dir(), 'embedded-compiler-write-cache.json') + + def create_vfs(): + ans = {} + for x in walk(rapydscript_dir): + if x.endswith('.pyj'): + r = os.path.relpath(x, rapydscript_dir).replace('\\', '/') + with open(x, 'rb') as f: + ans['__stdlib__/' + r] = f.read().decode('utf-8') + return ans + + def vfs_script(): + try: + with open(cache_path, 'rb') as f: + write_cache = f.read().decode('utf-8') + except Exception: + write_cache = '{}' + + return ''' +(function() { +"use strict"; +var vfs = VFS; + +function read_file_sync(name) { + var ans = vfs[name]; + if (ans) return ans; + ans = write_cache[name]; + if (ans) return ans; + return null; +} + +function write_file_sync(name, data) { + write_cache[name] = data; +} + +RapydScript.virtual_file_system = { + 'read_file_sync': read_file_sync, + 'write_file_sync': write_file_sync +}; + +window.compiler = RapydScript.create_embedded_compiler(); +document.title = 'compiler initialized'; +})(); +'''.replace('VFS', json.dumps(create_vfs()) + ';\n' + 'window.write_cache = ' + write_cache, 1) + + def create_script(src, name): + s = QWebEngineScript() + s.setName(name) + s.setInjectionPoint(QWebEngineScript.DocumentReady) + s.setWorldId(QWebEngineScript.ApplicationWorld) + s.setRunsOnSubFrames(True) + s.setSourceCode(src) + return s + + class Compiler(QWebEnginePage): + + def __init__(self): + QWebEnginePage.__init__(self) + self.errors = [] + secure_webengine(self) + script = buf.getvalue().decode('utf-8') + script += '\n\n;;\n\n' + vfs_script() + self.scripts().insert(create_script(script, 'rapydscript.js')) + self.setHtml('

    initialize') + while self.title() != 'compiler initialized': + self.spin_loop() + + def spin_loop(self): + QApplication.instance().processEvents(QEventLoop.ExcludeUserInputEvents) + + def javaScriptConsoleMessage(self, level, msg, line_num, source_id): + if level: + self.errors.append(msg) + else: + print('{}:{}:{}'.format(source_id, line_num, msg)) + + def __call__(self, src, options): + self.compiler_result = None + self.errors = [] + self.working = True + options['basedir'] = '__stdlib__' + src = 'var js = window.compiler.compile({}, {}); [js, window.write_cache]'.format(*map(json.dumps, (src, options))) + self.runJavaScript(src, QWebEngineScript.ApplicationWorld, self.compilation_done) + while self.working: + self.spin_loop() + if self.compiler_result is None: + raise CompileFailure('Failed to compile rapydscript code with error: ' + '\n'.join(self.errors)) + write_cache = self.compiler_result[1] + with open(cache_path, 'wb') as f: + f.write(as_bytes(json.dumps(write_cache))) + return self.compiler_result[0] + + def compilation_done(self, js): + self.working = False + self.compiler_result = js + + compiler.ans = Compiler() + return compiler.ans class CompileFailure(ValueError): pass -def default_lib_dir(): - return P('rapydscript/lib', allow_user_override=False) - - _cache_dir = None @@ -105,38 +188,14 @@ def compile_pyj(data, filename='', beautify=True, private_scope=True, lib if isinstance(data, bytes): data = data.decode('utf-8') c = compiler() - c.g.current_options = { + result = c(data, { 'beautify':beautify, 'private_scope':private_scope, - 'omit_baselib': omit_baselib, - 'libdir': libdir or default_lib_dir(), - 'basedir': getcwd() if not filename or filename == '' else os.path.dirname(filename), + 'keep_baselib': not omit_baselib, 'filename': filename, 'js_version': js_version, - } - c.g.rs_source_code = data - ok, result = c.eval( - ''' - ans = [null, null]; - try { - ans = [true, exports["compile"](rs_source_code, %s, current_options)]; - } catch(e) { - ans = [false, e] - } - ans; - ''' % json.dumps(filename)) - if ok: - return result - presult = to_python(result) - if 'message' in result: - msg = presult['message'] - if 'filename' in presult and 'line' in presult: - msg = '%s:%s:%s' % (presult['filename'], presult['line'], msg) - raise CompileFailure(msg) - if result.stack: - # Javascript error object instead of ParseError - raise CompileFailure(result.stack) - raise CompileFailure(repr(presult)) + }) + return result has_external_compiler = None @@ -166,7 +225,9 @@ def compile_fast(data, filename=None, beautify=True, private_scope=True, libdir= has_external_compiler = detect_external_compiler() if not has_external_compiler: return compile_pyj(data, filename or '', beautify, private_scope, libdir, omit_baselib, js_version or 6) - args = ['--cache-dir', module_cache_dir(), '--import-path', libdir or default_lib_dir()] + args = ['--cache-dir', module_cache_dir()] + if libdir: + args += ['--import-path', libdir] if not beautify: args.append('--uglify') if not private_scope: @@ -303,198 +364,3 @@ def msgfmt(po_data_as_string): ctx.g.msgfmt_options = {'use_fuzzy': False} return ctx.eval('exports.msgfmt(po_data, msgfmt_options)') # }}} - -# REPL {{{ - - -def leading_whitespace(line): - return line[:len(line) - len(line.lstrip())] - - -def format_error(data): - return ':'.join(map(unicode_type, (data['file'], data['line'], data['col'], data['message']))) - - -class Repl(Thread): - - LINE_CONTINUATION_CHARS = r'\:' - daemon = True - - def __init__(self, ps1='>>> ', ps2='... ', show_js=False, libdir=None): - Thread.__init__(self, name='RapydScriptREPL') - self.to_python = to_python - self.JSError = JSError - self.enc = getattr(sys.stdin, 'encoding', None) or 'utf-8' - try: - import readline - self.readline = readline - except ImportError: - pass - self.output = ANSIStream(sys.stdout) - self.to_repl = Queue() - self.from_repl = Queue() - self.ps1, self.ps2 = ps1, ps2 - self.show_js, self.libdir = show_js, libdir - self.prompt = '' - self.completions = None - self.start() - - def init_ctx(self): - self.prompt = self.ps1 - - self.ctx = compiler() - self.ctx.g.Duktape.write = self.output.write - self.ctx.eval(r'''console = { log: function() { Duktape.write(Array.prototype.slice.call(arguments).join(' ') + '\n');}}; - console['error'] = console['log'];''') - self.ctx.g.repl_options = { - 'show_js': self.show_js, - 'histfile':False, - 'input':True, 'output':True, 'ps1':self.ps1, 'ps2':self.ps2, - 'terminal':self.output.isatty, - 'enum_global': 'Object.keys(this)', - 'lib_path': self.libdir or os.path.dirname(P(COMPILER_PATH)) # TODO: Change this to load pyj files from the src code - } - - def get_from_repl(self): - while True: - try: - return self.from_repl.get(True, 1) - except Empty: - if not self.is_alive(): - raise SystemExit(1) - - def run(self): - self.init_ctx() - rl = None - - def set_prompt(p): - self.prompt = p - - def prompt(lw): - self.from_repl.put(to_python(lw)) - - self.ctx.g.set_prompt = set_prompt - self.ctx.g.prompt = prompt - - self.ctx.eval(''' - listeners = {}; - rl = { - setPrompt:set_prompt, - write:Duktape.write, - clearLine: function() {}, - on: function(ev, cb) { listeners[ev] = cb; return rl; }, - prompt: prompt, - sync_prompt: true, - send_line: function(line) { listeners['line'](line); }, - send_interrupt: function() { listeners['SIGINT'](); }, - close: function() {listeners['close'](); }, - }; - repl_options.readline = { createInterface: function(options) { rl.completer = options.completer; return rl; }}; - exports.init_repl(repl_options) - ''', fname='') - rl = self.ctx.g.rl - completer = to_python(rl.completer) - send_interrupt = to_python(rl.send_interrupt) - send_line = to_python(rl.send_line) - - while True: - ev, line = self.to_repl.get() - try: - if ev == 'SIGINT': - self.output.write('\n') - send_interrupt() - elif ev == 'line': - send_line(line) - else: - val = completer(line) - val = to_python(val) - self.from_repl.put(val[0]) - except Exception as e: - if isinstance(e, JSError): - print(e.stack or error_message(e), file=sys.stderr) - else: - import traceback - traceback.print_exc() - - for i in range(100): - # Do this many times to ensure we dont deadlock - self.from_repl.put(None) - - def __call__(self): - if hasattr(self, 'readline'): - history = os.path.join(cache_dir(), 'pyj-repl-history.txt') - self.readline.parse_and_bind("tab: complete") - try: - self.readline.read_history_file(history) - except EnvironmentError as e: - if e.errno != errno.ENOENT: - raise - atexit.register(partial(self.readline.write_history_file, history)) - - def completer(text, num): - if self.completions is None: - self.to_repl.put(('complete', text)) - self.completions = list(filter(None, self.get_from_repl())) - if not self.completions: - return None - try: - return self.completions[num] - except (IndexError, TypeError, AttributeError, KeyError): - self.completions = None - - if hasattr(self, 'readline'): - self.readline.set_completer(completer) - - while True: - lw = self.get_from_repl() - if lw is None: - raise SystemExit(1) - q = self.prompt - if hasattr(self, 'readline'): - self.readline.set_pre_input_hook(lambda:(self.readline.insert_text(lw), self.readline.redisplay())) - else: - q += lw - try: - line = raw_input(q) - self.to_repl.put(('line', line)) - except EOFError: - return - except KeyboardInterrupt: - self.to_repl.put(('SIGINT', None)) - -# }}} - - -def main(args=sys.argv): - import argparse - ver = compiler().g.exports.rs_version - parser = argparse.ArgumentParser(prog='pyj', - description='RapydScript compiler and REPL. If passed input on stdin, it is compiled and written to stdout. Otherwise a REPL is started.') - parser.add_argument('--version', action='version', - version='Using RapydScript compiler version: '+ver) - parser.add_argument('--show-js', action='store_true', help='Have the REPL output the compiled javascript before executing it') - parser.add_argument('--libdir', help='Where to look for imported modules') - parser.add_argument('--omit-baselib', action='store_true', default=False, help='Omit the RapydScript base library') - parser.add_argument('--no-private-scope', action='store_true', default=False, help='Do not wrap the output in its own private scope') - args = parser.parse_args(args) - libdir = os.path.expanduser(args.libdir) if args.libdir else None - - if sys.stdin.isatty(): - Repl(show_js=args.show_js, libdir=libdir)() - else: - try: - enc = getattr(sys.stdin, 'encoding', 'utf-8') or 'utf-8' - data = compile_pyj(sys.stdin.read().decode(enc), libdir=libdir, private_scope=not args.no_private_scope, omit_baselib=args.omit_baselib) - print(data.encode(enc)) - except JSError as e: - raise SystemExit(error_message(e)) - except CompileFailure as e: - raise SystemExit(error_message(e)) - - -def entry(): - main(sys.argv[1:]) - - -if __name__ == '__main__': - main() diff --git a/src/duktape/__init__.py b/src/duktape/__init__.py deleted file mode 100644 index f68317cbe1..0000000000 --- a/src/duktape/__init__.py +++ /dev/null @@ -1,383 +0,0 @@ -#!/usr/bin/env python2 -# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai -from __future__ import absolute_import, division, print_function, unicode_literals - -__copyright__ = '2011, Kovid Goyal ' -__docformat__ = 'restructuredtext en' - - -__all__ = ['dukpy', 'Context', 'undefined', 'JSError', 'to_python'] - -import errno, os, sys, numbers, hashlib, json -from functools import partial - -import dukpy - -from calibre.constants import iswindows -from calibre.utils.filenames import atomic_rename -from polyglot.builtins import error_message, getcwd, reraise, unicode_type - -Context_, undefined = dukpy.Context, dukpy.undefined - -fs = ''' -exports.writeFileSync = Duktape.writefile; -exports.readFileSync = Duktape.readfile; -''' -vm = ''' -function handle_result(result) { - if (result[0]) return result[1]; - var cls = Error; - var e = result[1]; - if (e.name) { - try { - cls = eval(e.name); - } catch(ex) {} - } - var err = new cls(e.message); - err.fileName = e.fileName; - err.lineNumber = e.lineNumber; - err.stack = e.stack; - throw err; -} -exports.createContext = Duktape.create_context; -exports.runInContext = function(code, ctx) { - return handle_result(Duktape.run_in_context(code, ctx)); -}; -exports.runInThisContext = function(code, options) { - try { - return eval(code); - } catch (e) { - console.error('Error:' + e + ' while evaluating: ' + options.filename); - throw e; - } -}; -''' -path = ''' -exports.join = function () { return arguments[0] + '/' + arguments[1]; } -exports.dirname = function(x) { return Duktape.dirname(x); } -''' -util = ''' -exports.inspect = function(x) { return x.toString(); }; -exports.inherits = function(ctor, superCtor) { - try { - ctor.super_ = superCtor; - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - } catch(e) { console.log('util.inherits() failed with error:', e); throw e; } -}; -''' - -_assert = ''' -module.exports = function(x) {if (!x) throw x + " is false"; }; -exports.ok = module.exports; -exports.notStrictEqual = exports.strictEqual = exports.deepEqual = function() {}; -''' - -stream = ''' -module.exports = {}; -''' - - -def sha1sum(x): - return hashlib.sha1(x).hexdigest() - - -def load_file(base_dirs, builtin_modules, name): - try: - ans = builtin_modules.get(name) - if ans is not None: - return [True, ans] - ans = {'fs':fs, 'vm':vm, 'path':path, 'util':util, 'assert':_assert, 'stream':stream}.get(name) - if ans is not None: - return [True, ans] - if not name.endswith('.js'): - name += '.js' - - def do_open(*args): - with open(os.path.join(*args), 'rb') as f: - return [True, f.read().decode('utf-8')] - - for b in base_dirs: - try: - return do_open(b, name) - except EnvironmentError as e: - if e.errno != errno.ENOENT: - raise - raise EnvironmentError('No module named: %s found in the base directories: %s' % (name, os.pathsep.join(base_dirs))) - except Exception as e: - return [False, unicode_type(e)] - - -def readfile(path, enc='utf-8'): - try: - with open(path, 'rb') as f: - return [f.read().decode(enc or 'utf-8'), None, None] - except UnicodeDecodeError as e: - return None, '', 'Failed to decode the file: %s with specified encoding: %s' % (path, enc) - except EnvironmentError as e: - return [None, errno.errorcode[e.errno], 'Failed to read from file: %s with error: %s' % (path, error_message(e) or e)] - - -def atomic_write(name, raw): - bdir, bname = os.path.dirname(os.path.abspath(name)), os.path.basename(name) - tname = ('_' if iswindows else '.') + bname - with open(os.path.join(bdir, tname), 'wb') as f: - f.write(raw) - atomic_rename(f.name, name) - - -def writefile(path, data, enc='utf-8'): - if enc == undefined: - enc = 'utf-8' - try: - if isinstance(data, unicode_type): - data = data.encode(enc or 'utf-8') - atomic_write(path, data) - except UnicodeEncodeError as e: - return ['', 'Failed to encode the data for file: %s with specified encoding: %s' % (path, enc)] - except EnvironmentError as e: - return [errno.errorcode[e.errno], 'Failed to write to file: %s with error: %s' % (path, error_message(e) or e)] - return [None, None] - - -class Function(object): - - def __init__(self, func): - self.func = func - self.name = func.name - - def __repr__(self): - # For some reason x._Formals is undefined in duktape - x = self.func - return unicode_type('[Function: %s(...) from file: %s]' % (x.name, x.fileName)) - - def __call__(self, *args, **kwargs): - try: - return self.func(*args, **kwargs) - except dukpy.JSError as e: - self.reraise(e) - - def reraise(self, e): - reraise(JSError, JSError(e), sys.exc_info()[2]) - - -def to_python(x): - try: - if isinstance(x, (numbers.Number, unicode_type, bytes, bool)): - if isinstance(x, unicode_type): - x = x.encode('utf-8') - if isinstance(x, numbers.Integral): - x = int(x) - return x - except TypeError: - pass - name = x.__class__.__name__ - if name == 'Array proxy': - return [to_python(y) for y in x] - if name == 'Object proxy': - return {to_python(k):to_python(v) for k, v in x.items()} - if name == 'Function proxy': - return Function(x) - return x - - -class JSError(Exception): - - def __init__(self, ex): - e = ex.args[0] - if isinstance(e, dict): - if 'message' in e: - fn, ln = e.get('fileName'), e.get('lineNumber') - msg = unicode_type(e['message']) - if ln: - msg = unicode_type(ln) + ':' + msg - if fn: - msg = unicode_type(fn) + ':' + msg - Exception.__init__(self, msg) - for k, v in e.items(): - if k != 'message': - setattr(self, k, v) - else: - setattr(self, 'js_message', v) - else: - Exception.__init__(self, unicode_type(to_python(e))) - else: - # Happens if js code throws a string or integer rather than a - # subclass of Error - Exception.__init__(self, unicode_type(e)) - self.name = self.js_message = self.fileName = self.lineNumber = self.stack = None - - def as_dict(self): - return { - 'name':self.name or undefined, - 'message': self.js_message or error_message(self), - 'fileName': self.fileName or undefined, - 'lineNumber': self.lineNumber or undefined, - 'stack': self.stack or undefined - } - - -contexts = {} - - -def create_context(base_dirs, *args): - data = to_python(args[0]) if args else {} - ctx = Context(base_dirs=base_dirs) - for k, val in data.items(): - setattr(ctx.g, k, val) - key = id(ctx) - contexts[key] = ctx - return key - - -def run_in_context(code, ctx, options=None): - c = contexts[ctx] - try: - ans = c.eval(code) - except JSError as e: - return [False, e.as_dict()] - except Exception as e: - import traceback - traceback.print_exc() - return [False, {'message':unicode_type(e)}] - return [True, to_python(ans)] - - -class Context(object): - - def __init__(self, base_dirs=(), builtin_modules=None): - self._ctx = Context_() - self.g = self._ctx.g - self.g.Duktape.load_file = partial(load_file, base_dirs or (getcwd(),), builtin_modules or {}) - self.g.Duktape.pyreadfile = readfile - self.g.Duktape.pywritefile = writefile - self.g.Duktape.create_context = partial(create_context, base_dirs) - self.g.Duktape.run_in_context = run_in_context - self.g.Duktape.cwd = getcwd - self.g.Duktape.sha1sum = sha1sum - self.g.Duktape.dirname = os.path.dirname - self.g.Duktape.errprint = lambda *args: print(*args, file=sys.stderr) - self.eval(''' - console = { - log: function() { print(Array.prototype.join.call(arguments, ' ')); }, - error: function() { Duktape.errprint(Array.prototype.join.call(arguments, ' ')); }, - debug: function() { print(Array.prototype.join.call(arguments, ' ')); } - }; - - Duktape.modSearch = function (id, require, exports, module) { - var ans = Duktape.load_file(id); - if (ans[0]) return ans[1]; - throw ans[1]; - } - - if (!String.prototype.trim) { - (function() { - // Make sure we trim BOM and NBSP - var rtrim = /^[\\s\uFEFF\xA0]+|[\\s\uFEFF\xA0]+$/g; - String.prototype.trim = function() { - return this.replace(rtrim, ''); - }; - })(); - }; - if (!String.prototype.trimLeft) { - (function() { - // Make sure we trim BOM and NBSP - var rtrim = /^[\\s\uFEFF\xA0]+/g; - String.prototype.trimLeft = function() { - return this.replace(rtrim, ''); - }; - })(); - }; - if (!String.prototype.trimRight) { - (function() { - // Make sure we trim BOM and NBSP - var rtrim = /[\\s\uFEFF\xA0]+$/g; - String.prototype.trimRight = function() { - return this.replace(rtrim, ''); - }; - })(); - }; - if (!String.prototype.startsWith) { - String.prototype.startsWith = function(searchString, position) { - position = position || 0; - return this.indexOf(searchString, position) === position; - }; - } - if (!String.prototype.endsWith) { - String.prototype.endsWith = function(searchString, position) { - var subjectString = this.toString(); - if (position === undefined || position > subjectString.length) { - position = subjectString.length; - } - position -= searchString.length; - var lastIndex = subjectString.indexOf(searchString, position); - return lastIndex !== -1 && lastIndex === position; - }; - } - Duktape.readfile = function(path, encoding) { - var x = Duktape.pyreadfile(path, encoding); - var data = x[0]; var errcode = x[1]; var errmsg = x[2]; - if (errmsg !== null) throw {code:errcode, message:errmsg}; - return data; - } - - Duktape.writefile = function(path, data, encoding) { - var x = Duktape.pywritefile(path, data, encoding); - var errcode = x[0]; var errmsg = x[1]; - if (errmsg !== null) throw {code:errcode, message:errmsg}; - } - - process = { - 'platform': 'duktape', - 'env': {'HOME': _HOME_, 'TERM':_TERM_}, - 'exit': function() {}, - 'cwd':Duktape.cwd - } - - '''.replace( - '_HOME_', json.dumps(os.path.expanduser('~'))).replace('_TERM_', json.dumps(os.environ.get('TERM', ''))), - '') - - def reraise(self, e): - reraise(JSError, JSError(e), sys.exc_info()[2]) - - def eval(self, code='', fname='', noreturn=False): - try: - return self._ctx.eval(code, noreturn, fname) - except dukpy.JSError as e: - self.reraise(e) - - def eval_file(self, path, noreturn=False): - try: - return self._ctx.eval_file(path, noreturn) - except dukpy.JSError as e: - self.reraise(e) - - -def test_build(): - import unittest - - def load_tests(loader, suite, pattern): - from duktape import tests - for x in vars(tests).values(): - if isinstance(x, type) and issubclass(x, unittest.TestCase): - tests = loader.loadTestsFromTestCase(x) - suite.addTests(tests) - return suite - - class TestRunner(unittest.main): - - def createTests(self): - tl = unittest.TestLoader() - suite = unittest.TestSuite() - self.test = load_tests(tl, suite, None) - - result = TestRunner(verbosity=0, buffer=True, catchbreak=True, failfast=True, argv=sys.argv[:1], exit=False).result - if not result.wasSuccessful(): - raise SystemExit(1) diff --git a/src/duktape/tests.py b/src/duktape/tests.py deleted file mode 100644 index 351d4c74cd..0000000000 --- a/src/duktape/tests.py +++ /dev/null @@ -1,205 +0,0 @@ -import os -import sys -import tempfile -import unittest -from threading import Event, Thread - -import dukpy - -undefined, JSError, Context = dukpy.undefined, dukpy.JSError, dukpy.Context - - -class ContextTests(unittest.TestCase): - - def setUp(self): - self.ctx = Context() - self.g = self.ctx.g - - def test_create_context(self): - pass - - def test_create_new_global_env(self): - new = self.ctx.new_global_env() - - # The new context should have a distinct global object - self.g.a = 1 - self.assertIs(new.g.a, undefined) - - def test_eval(self): - pass - - def test_eval_file(self): - pass - - def test_undefined(self): - self.assertEqual(repr(undefined), 'undefined') - - def test_roundtrip(self): - self.g.g = self.ctx.eval('function f() {return 1;}; f') - self.assertEqual(self.g.g.name, 'f') - self.g.a = self.ctx.eval('[1,2,3]') - self.assertEqual(self.g.a[2], 3) - - -class ValueTests(unittest.TestCase): - - def setUp(self): - self.ctx = Context() - self.g = self.ctx.g - - def test_simple(self): - for value in [undefined, None, True, False]: - self.g.value = value - self.assertIs(self.g.value, value) - - for value in ["foo", 42, 3.141592, 3.141592e20]: - self.g.value = value - self.assertEqual(self.g.value, value) - - def test_object(self): - self.g.value = {} - self.assertEqual(dict(self.g.value), {}) - - self.g.value = {'a': 1} - self.assertEqual(dict(self.g.value), {'a': 1}) - - self.g.value = {'a': {'b': 2}} - self.assertEqual(dict(self.g.value.a), {'b': 2}) - - def test_array(self): - self.g.value = [] - self.assertEqual(list(self.g.value), []) - - self.g.value = [0, 1, 2] - self.assertEqual(self.g.value[0], 0) - self.assertEqual(self.g.value[1], 1) - self.assertEqual(self.g.value[2], 2) - self.assertEqual(self.g.value[3], undefined) - self.assertEqual(list(self.g.value), [0, 1, 2]) - self.assertEqual(len(self.g.value), 3) - - self.g.value[1] = 9 - self.assertEqual(self.g.value[0], 0) - self.assertEqual(self.g.value[1], 9) - self.assertEqual(self.g.value[2], 2) - self.assertEqual(self.g.value[3], undefined) - self.assertEqual(list(self.g.value), [0, 9, 2]) - self.assertEqual(len(self.g.value), 3) - - def test_callable(self): - def f(x): - return x * x - num = sys.getrefcount(f) - self.g.func = f - self.assertEqual(sys.getrefcount(f), num + 1) - self.assertEqual(self.g.func(123), 15129) - self.g.func = undefined - self.assertEqual(sys.getrefcount(f), num) - - a = 13450234 - - def rval(): - return a - num = sys.getrefcount(a) - self.g.func = rval - self.assertEqual(self.g.eval('func()'), a) - self.assertEqual(sys.getrefcount(a), num) - - def bad(): - raise Exception('testing a python exception xyz') - self.g.func = bad - val = self.g.eval('try{func();}catch(err) {err.message}') - self.assertTrue('testing a python exception xyz' in val) - self.assertTrue('bad at 0x' in val) - - def test_proxy(self): - self.g.obj1 = {'a': 42} - self.g.obj2 = self.g.obj1 - self.assertEqual(self.g.obj1.a, self.g.obj2.a) - self.ctx.eval('function f() {nonexistent()}') - try: - self.g.f() - self.assert_('No error raised for bad function') - except JSError as e: - e = e.args[0] - self.assertEqual('ReferenceError', e['name']) - self.assertIn('nonexistent', e['message']) - - -class EvalTests(unittest.TestCase): - - def setUp(self): - self.ctx = Context() - self.g = self.ctx.g - - with tempfile.NamedTemporaryFile( - prefix='dukpy-test-', suffix='.js', delete=False) as fobj: - fobj.write(b'1+1') - self.testfile = fobj.name - - def tearDown(self): - os.remove(self.testfile) - - def test_eval_invalid_args(self): - with self.assertRaises(TypeError): - self.ctx.eval() - - with self.assertRaises(TypeError): - self.ctx.eval(123) - - def test_eval(self): - self.assertEqual(self.ctx.eval("1+1"), 2) - - def test_eval_kwargs(self): - self.assertEqual(self.ctx.eval(code="1+1"), 2) - - def test_eval_errors(self): - try: - self.ctx.eval('1+/1') - self.assert_('No error raised for malformed js') - except JSError as e: - e = e.args[0] - self.assertEqual('SyntaxError', e['name']) - self.assertEqual('', e['fileName']) - self.assertEqual(1, e['lineNumber']) - self.assertIn('line 1', e['message']) - - try: - self.ctx.eval('\na()', fname='xxx') - self.assert_('No error raised for malformed js') - except JSError as e: - e = e.args[0] - self.assertEqual('ReferenceError', e['name']) - self.assertEqual('xxx', e['fileName']) - self.assertEqual(2, e['lineNumber']) - - def test_eval_multithreading(self): - ev = Event() - self.ctx.g.func = ev.wait - t = Thread(target=self.ctx.eval, args=('func()',)) - t.daemon = True - t.start() - t.join(0.01) - self.assertTrue(t.is_alive()) - ev.set() - t.join(1) - self.assertFalse(t.is_alive()) - - def test_eval_noreturn(self): - self.assertIsNone(self.ctx.eval("1+1", noreturn=True)) - - def test_eval_file_invalid_args(self): - with self.assertRaises(TypeError): - self.ctx.eval_file() - - with self.assertRaises(TypeError): - self.ctx.eval_file(123) - - def test_eval_file(self): - self.assertEqual(self.ctx.eval_file(self.testfile), 2) - - def test_eval_file_kwargs(self): - self.assertEqual(self.ctx.eval_file(path=self.testfile), 2) - - def test_eval_file_noreturn(self): - self.assertIsNone(self.ctx.eval_file(self.testfile, noreturn=True)) From d14acdaf672db12af1c8904fa906076f522ec558 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 26 Jun 2019 20:27:17 +0530 Subject: [PATCH 1381/2613] py3: Port one more execfile() --- src/calibre/utils/rapydscript.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/utils/rapydscript.py b/src/calibre/utils/rapydscript.py index 0e3d22902c..fda31d5761 100644 --- a/src/calibre/utils/rapydscript.py +++ b/src/calibre/utils/rapydscript.py @@ -88,9 +88,9 @@ var vfs = VFS; function read_file_sync(name) { var ans = vfs[name]; - if (ans) return ans; + if (typeof ans === "string") return ans; ans = write_cache[name]; - if (ans) return ans; + if (typeof ans === "string") return ans; return null; } @@ -288,7 +288,7 @@ def compile_viewer(): base = base_dir() iconf = os.path.join(base, 'imgsrc', 'srv', 'generate.py') g = {'__file__': iconf} - execfile(iconf, g) + exec_path(iconf, g) icons = g['merge']().encode('utf-8') with lopen(os.path.join(base, 'resources', 'content-server', 'reset.css'), 'rb') as f: reset = f.read() From 4c365f7a311a8363657cdd241cc9166c3efcb912 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 26 Jun 2019 20:56:06 +0530 Subject: [PATCH 1382/2613] Remove the rapydscript stdlib from resources It is now bundled inside the compiler --- resources/rapydscript/lib/aes.pyj | 646 --------------------- resources/rapydscript/lib/elementmaker.pyj | 83 --- resources/rapydscript/lib/encodings.pyj | 126 ---- resources/rapydscript/lib/gettext.pyj | 569 ------------------ resources/rapydscript/lib/math.pyj | 192 ------ resources/rapydscript/lib/operator.pyj | 11 - resources/rapydscript/lib/pythonize.pyj | 20 - resources/rapydscript/lib/random.pyj | 94 --- resources/rapydscript/lib/re.pyj | 472 --------------- resources/rapydscript/lib/traceback.pyj | 51 -- resources/rapydscript/lib/uuid.pyj | 77 --- 11 files changed, 2341 deletions(-) delete mode 100644 resources/rapydscript/lib/aes.pyj delete mode 100644 resources/rapydscript/lib/elementmaker.pyj delete mode 100644 resources/rapydscript/lib/encodings.pyj delete mode 100644 resources/rapydscript/lib/gettext.pyj delete mode 100644 resources/rapydscript/lib/math.pyj delete mode 100644 resources/rapydscript/lib/operator.pyj delete mode 100644 resources/rapydscript/lib/pythonize.pyj delete mode 100644 resources/rapydscript/lib/random.pyj delete mode 100644 resources/rapydscript/lib/re.pyj delete mode 100644 resources/rapydscript/lib/traceback.pyj delete mode 100644 resources/rapydscript/lib/uuid.pyj diff --git a/resources/rapydscript/lib/aes.pyj b/resources/rapydscript/lib/aes.pyj deleted file mode 100644 index 666ed42e9b..0000000000 --- a/resources/rapydscript/lib/aes.pyj +++ /dev/null @@ -1,646 +0,0 @@ -# vim:fileencoding=utf-8 -# License: BSD Copyright: 2016, Kovid Goyal - -# globals: crypto - -# Internal API {{{ - -def string_to_bytes_encoder(string): - return TextEncoder('utf-8').encode(string + '') - -def string_to_bytes_slow(string): - escstr = encodeURIComponent(string) - binstr = escstr.replace(/%([0-9A-F]{2})/g, def(match, p1): - return String.fromCharCode('0x' + p1) - ) - ua = Uint8Array(binstr.length) - for i, ch in enumerate(binstr): - ua[i] = ch.charCodeAt(0) - return ua - -def as_hex(array, sep=''): - num = array.BYTES_PER_ELEMENT or 1 - fmt = '{:0' + num * 2 + 'x}' - return [str.format(fmt, x) for x in array].join(sep) - -def bytes_to_string_decoder(bytes, offset): - offset = offset or 0 - if offset: - bytes = bytes.subarray(offset) - return TextDecoder('utf-8').decode(bytes) - -def bytes_to_string_slow(bytes, offset): - ans = v'[]' - i = offset or 0 - while i < bytes.length: - c = bytes[i] - if c < 128: - ans.push(String.fromCharCode(c)) - i += 1 - elif 191 < c < 224: - ans.push(String.fromCharCode(((c & 0x1f) << 6) | (bytes[i + 1] & 0x3f))) - i += 2 - else: - ans.push(String.fromCharCode(((c & 0x0f) << 12) | ((bytes[i + 1] & 0x3f) << 6) | (bytes[i + 2] & 0x3f))) - i += 3 - return ans.join('') - -string_to_bytes = string_to_bytes_encoder if jstype(TextEncoder) is 'function' else string_to_bytes_slow -bytes_to_string = bytes_to_string_decoder if jstype(TextDecoder) is 'function' else bytes_to_string_slow - -def increment_counter(c): - # c must be a Uint8Array of length 16 - for v'var i = 15; i >= 12; i--': - if c[i] is 255: - c[i] = 0 - else: - c[i] += 1 - break - -def convert_to_int32(bytes, output, offset, length): - offset = offset or 0 - length = length or bytes.length - for v'var i = offset, j = 0; i < offset + length; i += 4, j++': - output[j] = (bytes[i] << 24) | (bytes[i + 1] << 16) | (bytes[i + 2] << 8) | bytes[i + 3] - -def convert_to_int32_pad(bytes): - extra = bytes.length % 4 - if extra: - t = Uint8Array(bytes.length + 4 - extra) - t.set(bytes) - bytes = t - ans = Uint32Array(bytes.length / 4) - convert_to_int32(bytes, ans) - return ans - -if not Uint8Array.prototype.fill: - Uint8Array.prototype.fill = Uint32Array.prototype.fill = def(val, start, end): - start = start or 0 - if end is undefined: - end = this.length - if start < 0: - start += this.length - if end < 0: - end += this.length - for v'var i = start; i < end; i++': - this[i] = val - -def from_64_to_32(num): - # convert 64-bit number to two BE Int32s - ans = Uint32Array(2) - ans[0] = (num / 0x100000000) | 0 - ans[1] = num & 0xFFFFFFFF - return ans - -# Lookup tables for AES {{{ -# Number of rounds by keysize -number_of_rounds = {16: 10, 24: 12, 32: 14} -# Round constant words -rcon = v'new Uint32Array([0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91])' - -# S-box and Inverse S-box (S is for Substitution) -S = v'new Uint32Array([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe,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12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d])' - -# Transformations for encryption -T1 = v'new Uint32Array([0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a])' -T2 = v'new Uint32Array([0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616])' -T3 = v'new Uint32Array([0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16])' -T4 = v'new Uint32Array([0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c])' - -# Transformations for decryption -T5 = v'new Uint32Array([0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742])' -T6 = v'new Uint32Array([0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857])' -T7 = v'new Uint32Array([0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8])' -T8 = v'new Uint32Array([0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0])' - -# Transformations for decryption key expansion -U1 = v'new Uint32Array([0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3])' -U2 = v'new Uint32Array([0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697])' -U3 = v'new Uint32Array([0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46])' -U4 = v'new Uint32Array([0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d])' - -# }}} - -class AES: # {{{ - - def __init__(self, key): - self.working_mem = [Uint32Array(4), Uint32Array(4)] - rounds = number_of_rounds[key.length] - if not rounds: - raise ValueError('invalid key size (must be length 16, 24 or 32)') - - # encryption round keys - self._Ke = v'[]' - - # decryption round keys - self._Kd = v'[]' - - for v'var i = 0; i <= rounds; i++': - self._Ke.push(Uint32Array(4)) - self._Kd.push(Uint32Array(4)) - - round_key_count = (rounds + 1) * 4 - KC = key.length / 4 - - # convert the key into ints - tk = Uint32Array(KC) - convert_to_int32(key, tk) - - # copy values into round key arrays - index = 0 - for v'var i = 0; i < KC; i++': - index = i >> 2 - self._Ke[index][i % 4] = tk[i] - self._Kd[rounds - index][i % 4] = tk[i] - - # key expansion (fips-197 section 5.2) - rconpointer = 0 - t = KC - while t < round_key_count: - tt = tk[KC - 1] - tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^ - (S[(tt >> 8) & 0xFF] << 16) ^ - (S[ tt & 0xFF] << 8) ^ - S[(tt >> 24) & 0xFF] ^ - (rcon[rconpointer] << 24)) - rconpointer += 1 - - # key expansion (for non-256 bit) - if KC != 8: - for v'var i = 1; i < KC; i++': - tk[i] ^= tk[i - 1] - - # key expansion for 256-bit keys is "slightly different" (fips-197) - else: - for v'var i = 1; i < (KC / 2); i++': - tk[i] ^= tk[i - 1] - tt = tk[(KC / 2) - 1] - - tk[KC / 2] ^= (S[ tt & 0xFF] ^ - (S[(tt >> 8) & 0xFF] << 8) ^ - (S[(tt >> 16) & 0xFF] << 16) ^ - (S[(tt >> 24) & 0xFF] << 24)) - - for v'var i = (KC / 2) + 1; i < KC; i++': - tk[i] ^= tk[i - 1] - - # copy values into round key arrays - i = 0 - while i < KC and t < round_key_count: - r = t >> 2 - c = t % 4 - self._Ke[r][c] = tk[i] - self._Kd[rounds - r][c] = tk[v'i++'] - t += 1 - - # inverse-cipher-ify the decryption round key (fips-197 section 5.3) - for v'var r = 1; r < rounds; r++': - for v'var c = 0; c < 4; c++': - tt = self._Kd[r][c] - self._Kd[r][c] = (U1[(tt >> 24) & 0xFF] ^ - U2[(tt >> 16) & 0xFF] ^ - U3[(tt >> 8) & 0xFF] ^ - U4[ tt & 0xFF]) - - def _crypt(self, ciphertext, offset, encrypt): - if encrypt: - R1 = T1; R2 = T2; R3 = T3; R4 = T4 - o1 = 1; o3 = 3 - SB = S - K = self._Ke - else: - R1 = T5; R2 = T6; R3 = T7; R4 = T8 - o1 = 3; o3 = 1 - SB = Si - K = self._Kd - rounds = K.length - 1 - a = self.working_mem[0] - t = self.working_mem[1] - - # XOR plaintext with key - for v'var i = 0; i < 4; i++': - t[i] ^= K[0][i] - - # apply round transforms - for v'var r = 1; r < rounds; r++': - for v'var i = 0; i < 4; i++': - a[i] = (R1[(t[i] >> 24) & 0xff] ^ - R2[(t[(i + o1) % 4] >> 16) & 0xff] ^ - R3[(t[(i + 2) % 4] >> 8) & 0xff] ^ - R4[ t[(i + o3) % 4] & 0xff] ^ - K[r][i]) - t.set(a) - - # the last round is special - for v'var i = 0; i < 4; i++': - tt = K[rounds][i] - ciphertext[offset + 4 * i] = (SB[(t[i] >> 24) & 0xff] ^ (tt >> 24)) & 0xff - ciphertext[offset + 4 * i + 1] = (SB[(t[(i + o1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff - ciphertext[offset + 4 * i + 2] = (SB[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff - ciphertext[offset + 4 * i + 3] = (SB[ t[(i + o3) % 4] & 0xff] ^ tt ) & 0xff - - def encrypt(self, plaintext, ciphertext, offset): - convert_to_int32(plaintext, self.working_mem[1], offset, 16) - return self._crypt(ciphertext, offset, True) - - def encrypt32(self, plaintext, ciphertext, offset): - self.working_mem[1].set(plaintext) - return self._crypt(ciphertext, offset, True) - - def decrypt(self, ciphertext, plaintext, offset): - convert_to_int32(ciphertext, self.working_mem[1], offset, 16) - return self._crypt(plaintext, offset, False) - - def decrypt32(self, ciphertext, plaintext, offset): - self.working_mem[1].set(ciphertext) - return self._crypt(plaintext, offset, False) -# }}} - -def random_bytes_insecure(sz): - ans = Uint8Array(sz) - for v'var i = 0; i < sz; i++': - ans[i] = Math.floor(Math.random() * 256) - return ans - -def random_bytes_secure(sz): - ans = Uint8Array(sz) - crypto.getRandomValues(ans) - return ans - -random_bytes = random_bytes_secure if jstype(crypto) is not 'undefined' and jstype(crypto.getRandomValues) is 'function' else random_bytes_insecure -if random_bytes is random_bytes_insecure: - try: - noderandom = require('crypto').randomBytes - random_bytes = def(sz): - return Uint8Array(noderandom(sz)) - except: - print('WARNING: Using insecure RNG for AES') - -class ModeOfOperation: # {{{ - - def __init__(self, key): - self.key = key or generate_key(32) - self.aes = AES(self.key) - - @property - def key_as_js(self): - return typed_array_as_js(self.key) - - def tag_as_bytes(self, tag): - if isinstance(tag, Uint8Array): - return tag - if not tag: - return Uint8Array(0) - if jstype(tag) is 'string': - return string_to_bytes(tag) - raise TypeError('Invalid tag, must be a string or a Uint8Array') -# }}} - -class GaloisField: # {{{ - - def __init__(self, sub_key): - k32 = Uint32Array(4) - convert_to_int32(sub_key, k32, 0) - self.m = self.generate_hash_table(k32) - self.wmem = Uint32Array(4) - - def power(self, x, out): - lsb = x[3] & 1 - for v'var i = 3; i > 0; --i': - out[i] = (x[i] >>> 1) | ((x[i - 1] & 1) << 31) - out[0] = x[0] >>> 1 - if lsb: - out[0] ^= 0xE1000000 - - def multiply(self, x, y): - z_i = Uint32Array(4) - v_i = Uint32Array(y) - for v'var i = 0; i < 128; ++i': - x_i = x[(i / 32) | 0] & (1 << (31 - i % 32)) - if x_i: - z_i[0] ^= v_i[0] - z_i[1] ^= v_i[1] - z_i[2] ^= v_i[2] - z_i[3] ^= v_i[3] - self.power(v_i, v_i) - return z_i - - def generate_sub_hash_table(self, mid): - bits = mid.length - size = 1 << bits - half = size >>> 1 - m = Array(size) - m[half] = Uint32Array(mid) - i = half >>> 1 - while i > 0: - m[i] = Uint32Array(4) - self.power(m[2 * i], m[i]) - i >>= 1 - i = 2 - while i < half: - for v'var j = 1; j < i; ++j': - m_i = m[i] - m_j = m[j] - m[i + j] = x = Uint32Array(4) - for v'var c = 0; c < 4; c++': - x[c] = m_i[c] ^ m_j[c] - i *= 2 - m[0] = Uint32Array(4) - for v'i = half + 1; i < size; ++i': - x = m[i ^ half] - m[i] = y = Uint32Array(4) - for v'var c = 0; c < 4; c++': - y[c] = mid[c] ^ x[c] - return m - - def generate_hash_table(self, key_as_int32_array): - bits = key_as_int32_array.length - multiplier = 8 / bits - per_int = 4 * multiplier - size = 16 * multiplier - ans = Array(size) - for v'var i =0; i < size; ++i': - tmp = Uint32Array(4) - idx = (i/ per_int) | 0 - shft = ((per_int - 1 - (i % per_int)) * bits) - tmp[idx] = (1 << (bits - 1)) << shft - ans[i] = self.generate_sub_hash_table(self.multiply(tmp, key_as_int32_array)) - return ans - - def table_multiply(self, x): - z = Uint32Array(4) - for v'var i = 0; i < 32; ++i': - idx = (i / 8) | 0 - x_i = (x[idx] >>> ((7 - (i % 8)) * 4)) & 0xF - ah = self.m[i][x_i] - z[0] ^= ah[0] - z[1] ^= ah[1] - z[2] ^= ah[2] - z[3] ^= ah[3] - return z - - def ghash(self, x, y): - # Corresponds to the XOR + mult_H operation from the paper - z = self.wmem - z[0] = y[0] ^ x[0] - z[1] = y[1] ^ x[1] - z[2] = y[2] ^ x[2] - z[3] = y[3] ^ x[3] - return self.table_multiply(z) - -# }}} - -# }}} - -def generate_key(sz): - if not number_of_rounds[sz]: - raise ValueError('Invalid key size, must be: 16, 24 or 32') - return random_bytes(sz) - -def generate_tag(sz): - return random_bytes(sz or 32) - -def typed_array_as_js(x): - name = x.constructor.name or 'Uint8Array' - return '(new ' + name + '(' + JSON.stringify(Array.prototype.slice.call(x)) + '))' - -class CBC(ModeOfOperation): # {{{ - - def encrypt_bytes(self, bytes, tag_bytes, iv): - iv = first_iv = iv or random_bytes(16) - mlen = bytes.length + tag_bytes.length - padsz = (16 - (mlen % 16)) % 16 - inputbytes = Uint8Array(mlen + padsz) - if tag_bytes.length: - inputbytes.set(tag_bytes) - inputbytes.set(bytes, tag_bytes.length) - - offset = 0 - outputbytes = Uint8Array(inputbytes.length) - for v'var block = 0; block < inputbytes.length; block += 16': - if block > 0: - iv, offset = outputbytes, block - 16 - for v'var i = 0; i < 16; i++': - inputbytes[block + i] ^= iv[offset + i] - self.aes.encrypt(inputbytes, outputbytes, block) - return {'iv':first_iv, 'cipherbytes':outputbytes} - - def encrypt(self, plaintext, tag): - return self.encrypt_bytes(string_to_bytes(plaintext), self.tag_as_bytes(tag)) - - def decrypt_bytes(self, inputbytes, tag_bytes, iv): - offset = 0 - outputbytes = Uint8Array(inputbytes.length) - for v'var block = 0; block < inputbytes.length; block += 16': - self.aes.decrypt(inputbytes, outputbytes, block) - if block > 0: - iv, offset = inputbytes, block - 16 - for v'var i = 0; i < 16; i++': - outputbytes[block + i] ^= iv[offset + i] - for v'var i = 0; i < tag_bytes.length; i++': - if tag_bytes[i] != outputbytes[i]: - raise ValueError('Corrupt message') - outputbytes = outputbytes.subarray(tag_bytes.length) - return outputbytes - - def decrypt(self, output_from_encrypt, tag): - ans = self.decrypt_bytes(output_from_encrypt.cipherbytes, self.tag_as_bytes(tag), output_from_encrypt.iv) - return str.rstrip(bytes_to_string(ans), '\0') -# }}} - -class CTR(ModeOfOperation): # {{{ - - # Note that this mode of operation requires the pair of (counterbytes, - # secret key) to always be unique, for every block. Therefore, if you are - # using it for bi-directional messaging it is best to use a different - # secret key for each direction - - def __init__(self, key, iv): - ModeOfOperation.__init__(self, key) - self.wmem = Uint8Array(16) - self.counter_block = Uint8Array(iv or 16) - if self.counter_block.length != 16: - raise ValueError('iv must be 16 bytes long') - self.counter_index = 16 - - def _crypt(self, bytes): - for v'var i = 0; i < bytes.length; i++, self.counter_index++': - if self.counter_index is 16: - self.counter_index = 0 - self.aes.encrypt(self.counter_block, self.wmem, 0) - increment_counter(self.counter_block) - bytes[i] ^= self.wmem[self.counter_index] - self.counter_index = 16 - - def encrypt(self, plaintext, tag): - outbytes = string_to_bytes(plaintext) - counterbytes = Uint8Array(self.counter_block) - if tag: - tag_bytes = self.tag_as_bytes(tag) - t = Uint8Array(outbytes.length + tag_bytes.length) - t.set(tag_bytes) - t.set(outbytes, tag_bytes.length) - outbytes = t - self._crypt(outbytes) - return {'cipherbytes':outbytes, 'counterbytes':counterbytes} - - def __enter__(self): - self.before_index = self.counter_index - self.before_counter = Uint8Array(self.counter_block) - - def __exit__(self): - self.counter_index = self.before_index - self.counter_block = self.before_counter - - def decrypt(self, output_from_encrypt, tag): - b = Uint8Array(output_from_encrypt.cipherbytes) - with self: - self.counter_block = output_from_encrypt.counterbytes - self.counter_index = 16 - self._crypt(b) - offset = 0 - if tag: - tag_bytes = self.tag_as_bytes(tag) - for v'var i = 0; i < tag_bytes.length; i++': - if tag_bytes[i] != b[i]: - raise ValueError('Corrupted message') - offset = tag_bytes.length - return bytes_to_string(b, offset) -# }}} - -class GCM(ModeOfOperation): # {{{ - - # Note that this mode of operation requires the pair of (iv, - # secret key) to always be unique, for every message. Therefore, if you are - # using it for bi-directional messaging it is best to use a different - # secret key for each direction (you could also use random_key, - # but that has a non-zero probability of repeating keys). - # See http://web.cs.ucdavis.edu/~rogaway/ocb/gcm.pdf - - def __init__(self, key, random_iv=False): - ModeOfOperation.__init__(self, key) - self.random_iv = random_iv - if not random_iv: - self.current_iv = Uint8Array(12) - - # Generate the hash subkey - H = Uint8Array(16) - self.aes.encrypt(Uint8Array(16), H, 0) - self.galois = GaloisField(H) - - # Working memory - self.J0 = Uint32Array(4) - self.wmem = Uint32Array(4) - self.byte_block = Uint8Array(16) - - def increment_iv(self): - c = self.current_iv - for v'var i = 11; i >=0; i--': - if c[i] is 255: - if i is 0: - raise ValueError('The GCM IV space is exhausted, cannot encrypt anymore messages with this key as doing so would cause the IV to repeat') - c[i] = 0 - else: - c[i] += 1 - break - - def _create_j0(self, iv): - J0 = self.J0 - if iv.length is 12: - convert_to_int32(iv, J0) - J0[3] = 1 - else: - J0.fill(0) - tmp = convert_to_int32_pad(iv) - while tmp.length: - J0 = self.galois.ghash(J0, tmp) - tmp = tmp.subarray(4) - tmp = Uint32Array(4) - tmp.set(from_64_to_32(iv.length * 8), 2) - J0 = self.galois.ghash(J0, tmp) - return J0 - - def _start(self, iv, additional_data): - J0 = self._create_j0(iv) - # Generate initial counter block - in_block = Uint32Array(J0) - in_block[3] = (in_block[3] + 1) & 0xFFFFFFFF # increment counter - - # Process additional_data - S = Uint32Array(4) - overflow = additional_data.length % 16 - for v'var i = 0; i < additional_data.length - overflow; i += 16': - convert_to_int32(additional_data, self.wmem, i, 16) - S = self.galois.ghash(S, self.wmem) - if overflow: - self.byte_block.fill(0) - self.byte_block.set(additional_data.subarray(additional_data.length - overflow)) - convert_to_int32(self.byte_block, self.wmem) - S = self.galois.ghash(S, self.wmem) - return J0, in_block, S - - def _finish(self, iv, J0, adata_len, S, outbytes): - # Mix the lengths into S - lengths = Uint32Array(4) - lengths.set(from_64_to_32(adata_len * 8)) - lengths.set(from_64_to_32(outbytes.length * 8), 2) - S = self.galois.ghash(S, lengths) - - # Create the tag - self.aes.encrypt32(J0, self.byte_block, 0) - convert_to_int32(self.byte_block, self.wmem) - tag = Uint32Array(4) - for v'var i = 0; i < S.length; i++': - tag[i] = S[i] ^ self.wmem[i] - return {'iv':iv, 'cipherbytes':outbytes, 'tag':tag} - - def _crypt(self, iv, bytes, additional_data, decrypt): - ghash = self.galois.ghash.bind(self.galois) - outbytes = Uint8Array(bytes.length) - J0, in_block, S = self._start(iv, additional_data) - bb = self.byte_block - enc = self.aes.encrypt32.bind(self.aes) - hash_bytes = bytes if decrypt else outbytes - - # Create the ciphertext, encrypting block by block - for v'var i = 0, counter_index = 16; i < bytes.length; i++, counter_index++': - if counter_index is 16: - # Encrypt counter and increment it - enc(in_block, bb, 0) - in_block[3] = (in_block[3] + 1) & 0xFFFFFFFF # increment counter - counter_index = 0 - # Output is XOR of encrypted counter with input - outbytes[i] = bytes[i] ^ bb[counter_index] - if counter_index is 15: - # We have completed a block, update the hash - convert_to_int32(hash_bytes, self.wmem, i - 15, 16) - S = ghash(S, self.wmem) - - # Check if we have a last partial block - overflow = outbytes.length % 16 - if overflow: - # partial output block - bb.fill(0) - bb.set(hash_bytes.subarray(hash_bytes.length - overflow)) - convert_to_int32(bb, self.wmem) - S = ghash(S, self.wmem) - - return self._finish(iv, J0, additional_data.length, S, outbytes) - - def encrypt(self, plaintext, tag): - if self.random_iv: - iv = random_bytes(12) - else: - self.increment_iv() - iv = self.current_iv - return self._crypt(iv, string_to_bytes(plaintext), self.tag_as_bytes(tag), False) - - def decrypt(self, output_from_encrypt, tag): - if output_from_encrypt.tag.length != 4: - raise ValueError('Corrupted message') - ans = self._crypt(output_from_encrypt.iv, output_from_encrypt.cipherbytes, self.tag_as_bytes(tag), True) - if ans.tag != output_from_encrypt.tag: - raise ValueError('Corrupted message') - return bytes_to_string(ans.cipherbytes) -# }}} diff --git a/resources/rapydscript/lib/elementmaker.pyj b/resources/rapydscript/lib/elementmaker.pyj deleted file mode 100644 index fb29f8ff6a..0000000000 --- a/resources/rapydscript/lib/elementmaker.pyj +++ /dev/null @@ -1,83 +0,0 @@ -# vim:fileencoding=utf-8 -# License: GPL v3 Copyright: 2015, Kovid Goyal - -html_elements = { - 'a', 'abbr', 'acronym', 'address', 'area', - 'article', 'aside', 'audio', 'b', 'big', 'blockquote', 'br', 'button', - 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', - 'command', 'datagrid', 'datalist', 'dd', 'del', 'details', 'dfn', - 'dialog', 'dir', 'div', 'dl', 'dt', 'em', 'event-source', 'fieldset', - 'figcaption', 'figure', 'footer', 'font', 'form', 'header', 'h1', - 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'iframe', 'img', 'input', 'ins', - 'keygen', 'kbd', 'label', 'legend', 'li', 'm', 'map', 'menu', 'meter', - 'multicol', 'nav', 'nextid', 'ol', 'output', 'optgroup', 'option', - 'p', 'pre', 'progress', 'q', 's', 'samp', 'script', 'section', 'select', - 'small', 'sound', 'source', 'spacer', 'span', 'strike', 'strong', 'style', - 'sub', 'sup', 'table', 'tbody', 'td', 'textarea', 'time', 'tfoot', - 'th', 'thead', 'tr', 'tt', 'u', 'ul', 'var', 'video' -} - -mathml_elements = { - 'maction', 'math', 'merror', 'mfrac', 'mi', - 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', - 'mprescripts', 'mroot', 'mrow', 'mspace', 'msqrt', 'mstyle', 'msub', - 'msubsup', 'msup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', - 'munderover', 'none' -} - -svg_elements = { - 'a', 'animate', 'animateColor', 'animateMotion', - 'animateTransform', 'clipPath', 'circle', 'defs', 'desc', 'ellipse', - 'font-face', 'font-face-name', 'font-face-src', 'g', 'glyph', 'hkern', - 'linearGradient', 'line', 'marker', 'metadata', 'missing-glyph', - 'mpath', 'path', 'polygon', 'polyline', 'radialGradient', 'rect', - 'set', 'stop', 'svg', 'switch', 'text', 'title', 'tspan', 'use' -} - -html5_tags = html_elements.union(mathml_elements).union(svg_elements) - -def _makeelement(tag, *args, **kwargs): - ans = this.createElement(tag) - - for attr in kwargs: - vattr = str.replace(str.rstrip(attr, '_'), '_', '-') - val = kwargs[attr] - if callable(val): - if str.startswith(attr, 'on'): - attr = attr[2:] - ans.addEventListener(attr, val) - elif val is True: - ans.setAttribute(vattr, vattr) - elif jstype(val) is 'string': - ans.setAttribute(vattr, val) - - for arg in args: - if jstype(arg) is 'string': - arg = this.createTextNode(arg) - ans.appendChild(arg) - return ans - -def maker_for_document(document): - # Create an elementmaker to be used with the specified document - E = _makeelement.bind(document) - Object.defineProperties(E, { - tag: { - 'value':_makeelement.bind(document, tag) - } for tag in html5_tags - }) - return E - -if jstype(document) is 'undefined': - E = maker_for_document({ - 'createTextNode': def(value): return value;, - 'createElement': def(name): - return { - 'name':name, - 'children':[], - 'attributes':{}, - 'setAttribute': def(name, val): this.attributes[name] = val;, - 'appendChild': def(child): this.children.push(child);, - } - }) -else: - E = maker_for_document(document) diff --git a/resources/rapydscript/lib/encodings.pyj b/resources/rapydscript/lib/encodings.pyj deleted file mode 100644 index d72e9b54f6..0000000000 --- a/resources/rapydscript/lib/encodings.pyj +++ /dev/null @@ -1,126 +0,0 @@ -# vim:fileencoding=utf-8 -# License: BSD Copyright: 2016, Kovid Goyal - -def base64encode(bytes, altchars, pad_char): - # Convert an array of bytes into a base-64 encoded string - l = bytes.length - remainder = l % 3 - main_length = l - remainder - encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' + (altchars or '+/') - pad_char = '=' if pad_char is undefined else pad_char - ans = v'[]' - for v'var i = 0; i < main_length; i += 3': - chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2] - ans.push(encodings[(chunk & 16515072) >> 18], encodings[(chunk & 258048) >> 12], encodings[(chunk & 4032) >> 6], encodings[chunk & 63]) - if remainder is 1: - chunk = bytes[main_length] - ans.push(encodings[(chunk & 252) >> 2], encodings[(chunk & 3) << 4], pad_char, pad_char) - elif remainder is 2: - chunk = (bytes[main_length] << 8) | bytes[main_length + 1] - ans.push(encodings[(chunk & 64512) >> 10], encodings[(chunk & 1008) >> 4], encodings[(chunk & 15) << 2], pad_char) - return ans.join('') - -def base64decode(string): - # convert the output of base64encode back into an array of bytes - # (Uint8Array) only works with the standard altchars and pad_char - if jstype(window) is not 'undefined': - chars = window.atob(string) - else: - chars = new Buffer(string, 'base64').toString('binary') # noqa: undef - ans = Uint8Array(chars.length) - for i in range(ans.length): - ans[i] = chars.charCodeAt(i) - return ans - -def urlsafe_b64encode(bytes, pad_char): - return base64encode(bytes, '-_', pad_char) - -def urlsafe_b64decode(string): - string = String.prototype.replace.call(string, /[_-]/g, def(m): return '+' if m is '-' else '/';) - return base64decode(string) - -def hexlify(bytes): - ans = v'[]' - for v'var i = 0; i < bytes.length; i++': - x = bytes[i].toString(16) - if x.length is 1: - x = '0' + x - ans.push(x) - return ans.join('') - -def unhexlify(string): - num = string.length // 2 - if num * 2 is not string.length: - raise ValueError('string length is not a multiple of two') - ans = Uint8Array(num) - for v'var i = 0; i < num; i++': - x = parseInt(string[i*2:i*2+2], 16) - if isNaN(x): - raise ValueError('string is not hex-encoded') - ans[i] = x - return ans - -utf8_decoder_table = v'''[ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 00..1f - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 20..3f - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 40..5f - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 60..7f - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, // 80..9f - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, // a0..bf - 8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // c0..df - 0xa,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x4,0x3,0x3, // e0..ef - 0xb,0x6,0x6,0x6,0x5,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, // f0..ff - 0x0,0x1,0x2,0x3,0x5,0x8,0x7,0x1,0x1,0x1,0x4,0x6,0x1,0x1,0x1,0x1, // s0..s0 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1, // s1..s2 - 1,2,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1, // s3..s4 - 1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,3,1,1,1,1,1,1, // s5..s6 - 1,3,1,1,1,1,1,3,1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // s7..s8 -]''' - -def _from_code_point(x): - if x <= 0xFFFF: - return String.fromCharCode(x) - x -= 0x10000 - return String.fromCharCode((x >> 10) + 0xD800, (x % 0x400) + 0xDC00) - -def utf8_decode(bytes, errors, replacement): - # Convert an array of UTF-8 encoded bytes into a string - state = 0 - ans = v'[]' - - for v'var i = 0, l = bytes.length; i < l; i++': # noqa - byte = bytes[i] - typ = utf8_decoder_table[byte] - codep = (byte & 0x3f) | (codep << 6) if state is not 0 else (0xff >> typ) & (byte) - state = utf8_decoder_table[256 + state*16 + typ] - if state is 0: - ans.push(_from_code_point(codep)) - elif state is 1: - if not errors or errors is 'strict': - raise UnicodeDecodeError(str.format('The byte 0x{:02x} at position {} is not valid UTF-8', byte, i)) - elif errors is 'replace': - ans.push(replacement or '?') - return ans.join('') - -def utf8_encode_js(string): - # Encode a string as an array of UTF-8 bytes - escstr = encodeURIComponent(string) - ans = v'[]' - for v'var i = 0; i < escstr.length; i++': - ch = escstr[i] - if ch is '%': - ans.push(parseInt(escstr[i+1:i+3], 16)) - i += 2 - else: - ans.push(ch.charCodeAt(0)) - return Uint8Array(ans) - -if jstype(TextEncoder) is 'function': - _u8enc = TextEncoder('utf-8') - utf8_encode = _u8enc.encode.bind(_u8enc) - _u8enc = undefined -else: - utf8_encode = utf8_encode_js - -def utf8_encode_native(string): - return _u8enc.encode(string) diff --git a/resources/rapydscript/lib/gettext.pyj b/resources/rapydscript/lib/gettext.pyj deleted file mode 100644 index 2a5b3c690f..0000000000 --- a/resources/rapydscript/lib/gettext.pyj +++ /dev/null @@ -1,569 +0,0 @@ -# vim:fileencoding=utf-8 -# License: BSD Copyright: 2015, Kovid Goyal - -# noqa: eol-semicolon - -# The Plural-Forms parser {{{ -# From: https://github.com/SlexAxton/Jed/blob/master/jed.js licensed under the WTFPL - -Jed = {} - -vr''' - Jed.PF = {}; - - Jed.PF.parse = function ( p ) { - var plural_str = Jed.PF.extractPluralExpr( p ); - return Jed.PF.parser.parse.call(Jed.PF.parser, plural_str); - }; - - Jed.PF.compile = function ( p ) { - // Handle trues and falses as 0 and 1 - function imply( val ) { - return (val === true ? 1 : val ? val : 0); - } - - var ast = Jed.PF.parse( p ); - return function ( n ) { - return imply( Jed.PF.interpreter( ast )( n ) ); - }; - }; - - Jed.PF.interpreter = function ( ast ) { - return function ( n ) { - var res; - switch ( ast.type ) { - case 'GROUP': - return Jed.PF.interpreter( ast.expr )( n ); - case 'TERNARY': - if ( Jed.PF.interpreter( ast.expr )( n ) ) { - return Jed.PF.interpreter( ast.truthy )( n ); - } - return Jed.PF.interpreter( ast.falsey )( n ); - case 'OR': - return Jed.PF.interpreter( ast.left )( n ) || Jed.PF.interpreter( ast.right )( n ); - case 'AND': - return Jed.PF.interpreter( ast.left )( n ) && Jed.PF.interpreter( ast.right )( n ); - case 'LT': - return Jed.PF.interpreter( ast.left )( n ) < Jed.PF.interpreter( ast.right )( n ); - case 'GT': - return Jed.PF.interpreter( ast.left )( n ) > Jed.PF.interpreter( ast.right )( n ); - case 'LTE': - return Jed.PF.interpreter( ast.left )( n ) <= Jed.PF.interpreter( ast.right )( n ); - case 'GTE': - return Jed.PF.interpreter( ast.left )( n ) >= Jed.PF.interpreter( ast.right )( n ); - case 'EQ': - return Jed.PF.interpreter( ast.left )( n ) == Jed.PF.interpreter( ast.right )( n ); - case 'NEQ': - return Jed.PF.interpreter( ast.left )( n ) != Jed.PF.interpreter( ast.right )( n ); - case 'MOD': - return Jed.PF.interpreter( ast.left )( n ) % Jed.PF.interpreter( ast.right )( n ); - case 'VAR': - return n; - case 'NUM': - return ast.val; - default: - throw new Error("Invalid Token found."); - } - }; - }; - - Jed.PF.extractPluralExpr = function ( p ) { - // trim first - p = p.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); - - if (! /;\s*$/.test(p)) { - p = p.concat(';'); - } - - var nplurals_re = /nplurals\=(\d+);/, - plural_re = /plural\=(.*);/, - nplurals_matches = p.match( nplurals_re ), - res = {}, - plural_matches; - - // Find the nplurals number - if ( nplurals_matches.length > 1 ) { - res.nplurals = nplurals_matches[1]; - } - else { - throw new Error('nplurals not found in plural_forms string: ' + p ); - } - - // remove that data to get to the formula - p = p.replace( nplurals_re, "" ); - plural_matches = p.match( plural_re ); - - if (!( plural_matches && plural_matches.length > 1 ) ) { - throw new Error('`plural` expression not found: ' + p); - } - return plural_matches[ 1 ]; - }; - - /* Jison generated parser */ - Jed.PF.parser = (function(){ - -var parser = {trace: function trace() { }, -yy: {}, -symbols_: {"error":2,"expressions":3,"e":4,"EOF":5,"?":6,":":7,"||":8,"&&":9,"<":10,"<=":11,">":12,">=":13,"!=":14,"==":15,"%":16,"(":17,")":18,"n":19,"NUMBER":20,"$accept":0,"$end":1}, -terminals_: {2:"error",5:"EOF",6:"?",7:":",8:"||",9:"&&",10:"<",11:"<=",12:">",13:">=",14:"!=",15:"==",16:"%",17:"(",18:")",19:"n",20:"NUMBER"}, -productions_: [0,[3,2],[4,5],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,1],[4,1]], -performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { - -var $0 = $$.length - 1; -switch (yystate) { -case 1: return { type : 'GROUP', expr: $$[$0-1] }; -case 2:this.$ = { type: 'TERNARY', expr: $$[$0-4], truthy : $$[$0-2], falsey: $$[$0] }; -break; -case 3:this.$ = { type: "OR", left: $$[$0-2], right: $$[$0] }; -break; -case 4:this.$ = { type: "AND", left: $$[$0-2], right: $$[$0] }; -break; -case 5:this.$ = { type: 'LT', left: $$[$0-2], right: $$[$0] }; -break; -case 6:this.$ = { type: 'LTE', left: $$[$0-2], right: $$[$0] }; -break; -case 7:this.$ = { type: 'GT', left: $$[$0-2], right: $$[$0] }; -break; -case 8:this.$ = { type: 'GTE', left: $$[$0-2], right: $$[$0] }; -break; -case 9:this.$ = { type: 'NEQ', left: $$[$0-2], right: $$[$0] }; -break; -case 10:this.$ = { type: 'EQ', left: $$[$0-2], right: $$[$0] }; -break; -case 11:this.$ = { type: 'MOD', left: $$[$0-2], right: $$[$0] }; -break; -case 12:this.$ = { type: 'GROUP', expr: $$[$0-1] }; -break; -case 13:this.$ = { type: 'VAR' }; -break; -case 14:this.$ = { type: 'NUM', val: Number(yytext) }; -break; -} -}, -table: [{3:1,4:2,17:[1,3],19:[1,4],20:[1,5]},{1:[3]},{5:[1,6],6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{4:17,17:[1,3],19:[1,4],20:[1,5]},{5:[2,13],6:[2,13],7:[2,13],8:[2,13],9:[2,13],10:[2,13],11:[2,13],12:[2,13],13:[2,13],14:[2,13],15:[2,13],16:[2,13],18:[2,13]},{5:[2,14],6:[2,14],7:[2,14],8:[2,14],9:[2,14],10:[2,14],11:[2,14],12:[2,14],13:[2,14],14:[2,14],15:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{4:18,17:[1,3],19:[1,4],20:[1,5]},{4:19,17:[1,3],19:[1,4],20:[1,5]},{4:20,17:[1,3],19:[1,4],20:[1,5]},{4:21,17:[1,3],19:[1,4],20:[1,5]},{4:22,17:[1,3],19:[1,4],20:[1,5]},{4:23,17:[1,3],19:[1,4],20:[1,5]},{4:24,17:[1,3],19:[1,4],20:[1,5]},{4:25,17:[1,3],19:[1,4],20:[1,5]},{4:26,17:[1,3],19:[1,4],20:[1,5]},{4:27,17:[1,3],19:[1,4],20:[1,5]},{6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[1,28]},{6:[1,7],7:[1,29],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{5:[2,3],6:[2,3],7:[2,3],8:[2,3],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,3]},{5:[2,4],6:[2,4],7:[2,4],8:[2,4],9:[2,4],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,4]},{5:[2,5],6:[2,5],7:[2,5],8:[2,5],9:[2,5],10:[2,5],11:[2,5],12:[2,5],13:[2,5],14:[2,5],15:[2,5],16:[1,16],18:[2,5]},{5:[2,6],6:[2,6],7:[2,6],8:[2,6],9:[2,6],10:[2,6],11:[2,6],12:[2,6],13:[2,6],14:[2,6],15:[2,6],16:[1,16],18:[2,6]},{5:[2,7],6:[2,7],7:[2,7],8:[2,7],9:[2,7],10:[2,7],11:[2,7],12:[2,7],13:[2,7],14:[2,7],15:[2,7],16:[1,16],18:[2,7]},{5:[2,8],6:[2,8],7:[2,8],8:[2,8],9:[2,8],10:[2,8],11:[2,8],12:[2,8],13:[2,8],14:[2,8],15:[2,8],16:[1,16],18:[2,8]},{5:[2,9],6:[2,9],7:[2,9],8:[2,9],9:[2,9],10:[2,9],11:[2,9],12:[2,9],13:[2,9],14:[2,9],15:[2,9],16:[1,16],18:[2,9]},{5:[2,10],6:[2,10],7:[2,10],8:[2,10],9:[2,10],10:[2,10],11:[2,10],12:[2,10],13:[2,10],14:[2,10],15:[2,10],16:[1,16],18:[2,10]},{5:[2,11],6:[2,11],7:[2,11],8:[2,11],9:[2,11],10:[2,11],11:[2,11],12:[2,11],13:[2,11],14:[2,11],15:[2,11],16:[2,11],18:[2,11]},{5:[2,12],6:[2,12],7:[2,12],8:[2,12],9:[2,12],10:[2,12],11:[2,12],12:[2,12],13:[2,12],14:[2,12],15:[2,12],16:[2,12],18:[2,12]},{4:30,17:[1,3],19:[1,4],20:[1,5]},{5:[2,2],6:[1,7],7:[2,2],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,2]}], -defaultActions: {6:[2,1]}, -parseError: function parseError(str, hash) { - throw new Error(str); -}, -parse: function parse(input) { - var self = this, - stack = [0], - vstack = [null], // semantic value stack - lstack = [], // location stack - table = this.table, - yytext = '', - yylineno = 0, - yyleng = 0, - recovering = 0, - TERROR = 2, - EOF = 1; - - //this.reductionCount = this.shiftCount = 0; - - this.lexer.setInput(input); - this.lexer.yy = this.yy; - this.yy.lexer = this.lexer; - if (typeof this.lexer.yylloc == 'undefined') - this.lexer.yylloc = {}; - var yyloc = this.lexer.yylloc; - lstack.push(yyloc); - - if (typeof this.yy.parseError === 'function') - this.parseError = this.yy.parseError; - - function popStack (n) { - stack.length = stack.length - 2*n; - vstack.length = vstack.length - n; - lstack.length = lstack.length - n; - } - - function lex() { - var token; - token = self.lexer.lex() || 1; // $end = 1 - // if token isn't its numeric value, convert - if (typeof token !== 'number') { - token = self.symbols_[token] || token; - } - return token; - } - - var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected, errStr; - while (true) { - // retreive state number from top of stack - state = stack[stack.length-1]; - - // use default actions if available - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || symbol === undefined) - symbol = lex(); - // read action for current state and first input - action = table[state] && table[state][symbol]; - } - - // handle parse error - _handle_error: - if (typeof action === 'undefined' || !action.length || !action[0]) { - - if (!recovering) { - // Report error - expected = []; - for (p in table[state]) if (this.terminals_[p] && p > 2) { - expected.push("'"+this.terminals_[p]+"'"); - } - errStr = ''; - if (this.lexer.showPosition) { - errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'"; - } else { - errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " + - (symbol == 1 /*EOF*/ ? "end of input" : - ("'"+(this.terminals_[symbol] || symbol)+"'")); - } - this.parseError(errStr, - {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); - } - - // just recovered from another error - if (recovering == 3) { - if (symbol == EOF) { - throw new Error(errStr || 'Parsing halted.'); - } - - // discard current lookahead and grab another - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - symbol = lex(); - } - - // try to recover from error - while (1) { - // check for error recovery rule in this state - if ((TERROR.toString()) in table[state]) { - break; - } - if (state === 0) { - throw new Error(errStr || 'Parsing halted.'); - } - popStack(1); - state = stack[stack.length-1]; - } - - preErrorSymbol = symbol; // save the lookahead token - symbol = TERROR; // insert generic error symbol as new lookahead - state = stack[stack.length-1]; - action = table[state] && table[state][TERROR]; - recovering = 3; // allow 3 real symbols to be shifted before reporting a new error - } - - // this shouldn't happen, unless resolve defaults are off - if (action[0] instanceof Array && action.length > 1) { - throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol); - } - - switch (action[0]) { - - case 1: // shift - //this.shiftCount++; - - stack.push(symbol); - vstack.push(this.lexer.yytext); - lstack.push(this.lexer.yylloc); - stack.push(action[1]); // push state - symbol = null; - if (!preErrorSymbol) { // normal execution/no error - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - if (recovering > 0) - recovering--; - } else { // error just occurred, resume old lookahead f/ before error - symbol = preErrorSymbol; - preErrorSymbol = null; - } - break; - - case 2: // reduce - //this.reductionCount++; - - len = this.productions_[action[1]][1]; - - // perform semantic action - yyval.$ = vstack[vstack.length-len]; // default to $$ = $1 - // default location, uses first token for firsts, last for lasts - yyval._$ = { - first_line: lstack[lstack.length-(len||1)].first_line, - last_line: lstack[lstack.length-1].last_line, - first_column: lstack[lstack.length-(len||1)].first_column, - last_column: lstack[lstack.length-1].last_column - }; - r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); - - if (typeof r !== 'undefined') { - return r; - } - - // pop off stack - if (len) { - stack = stack.slice(0,-1*len*2); - vstack = vstack.slice(0, -1*len); - lstack = lstack.slice(0, -1*len); - } - - stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) - vstack.push(yyval.$); - lstack.push(yyval._$); - // goto new state = table[STATE][NONTERMINAL] - newState = table[stack[stack.length-2]][stack[stack.length-1]]; - stack.push(newState); - break; - - case 3: // accept - return true; - } - - } - - return true; -}};/* Jison generated lexer */ -var lexer = (function(){ - -var lexer = ({EOF:1, -parseError:function parseError(str, hash) { - if (this.yy.parseError) { - this.yy.parseError(str, hash); - } else { - throw new Error(str); - } - }, -setInput:function (input) { - this._input = input; - this._more = this._less = this.done = false; - this.yylineno = this.yyleng = 0; - this.yytext = this.matched = this.match = ''; - this.conditionStack = ['INITIAL']; - this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; - return this; - }, -input:function () { - var ch = this._input[0]; - this.yytext+=ch; - this.yyleng++; - this.match+=ch; - this.matched+=ch; - var lines = ch.match(/\n/); - if (lines) this.yylineno++; - this._input = this._input.slice(1); - return ch; - }, -unput:function (ch) { - this._input = ch + this._input; - return this; - }, -more:function () { - this._more = true; - return this; - }, -pastInput:function () { - var past = this.matched.substr(0, this.matched.length - this.match.length); - return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); - }, -upcomingInput:function () { - var next = this.match; - if (next.length < 20) { - next += this._input.substr(0, 20-next.length); - } - return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); - }, -showPosition:function () { - var pre = this.pastInput(); - var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput() + "\n" + c+"^"; - }, -next:function () { - if (this.done) { - return this.EOF; - } - if (!this._input) this.done = true; - - var token, - match, - col, - lines; - if (!this._more) { - this.yytext = ''; - this.match = ''; - } - var rules = this._currentRules(); - for (var i=0;i < rules.length; i++) { - match = this._input.match(this.rules[rules[i]]); - if (match) { - lines = match[0].match(/\n.*/g); - if (lines) this.yylineno += lines.length; - this.yylloc = {first_line: this.yylloc.last_line, - last_line: this.yylineno+1, - first_column: this.yylloc.last_column, - last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}; - this.yytext += match[0]; - this.match += match[0]; - this.matches = match; - this.yyleng = this.yytext.length; - this._more = false; - this._input = this._input.slice(match[0].length); - this.matched += match[0]; - token = this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]); - if (token) return token; - else return; - } - } - if (this._input === "") { - return this.EOF; - } else { - this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), - {text: "", token: null, line: this.yylineno}); - } - }, -lex:function lex() { - var r = this.next(); - if (typeof r !== 'undefined') { - return r; - } else { - return this.lex(); - } - }, -begin:function begin(condition) { - this.conditionStack.push(condition); - }, -popState:function popState() { - return this.conditionStack.pop(); - }, -_currentRules:function _currentRules() { - return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; - }, -topState:function () { - return this.conditionStack[this.conditionStack.length-2]; - }, -pushState:function begin(condition) { - this.begin(condition); - }}); -lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { - -var YYSTATE=YY_START; -switch($avoiding_name_collisions) { -case 0:/* skip whitespace */ -break; -case 1:return 20 -break; -case 2:return 19 -break; -case 3:return 8 -break; -case 4:return 9 -break; -case 5:return 6 -break; -case 6:return 7 -break; -case 7:return 11 -break; -case 8:return 13 -break; -case 9:return 10 -break; -case 10:return 12 -break; -case 11:return 14 -break; -case 12:return 15 -break; -case 13:return 16 -break; -case 14:return 17 -break; -case 15:return 18 -break; -case 16:return 5 -break; -case 17:return 'INVALID' -break; -} -}; -lexer.rules = [/^\s+/,/^[0-9]+(\.[0-9]+)?\b/,/^n\b/,/^\|\|/,/^&&/,/^\?/,/^:/,/^<=/,/^>=/,/^/,/^!=/,/^==/,/^%/,/^\(/,/^\)/,/^$/,/^./]; -lexer.conditions = {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],"inclusive":true}};return lexer;})() -parser.lexer = lexer; -return parser; -})(); -''' -plural_forms_parser = Jed.PF -# }}} - -def _get_plural_forms_function(plural_forms_string): - return plural_forms_parser.compile(plural_forms_string or "nplurals=2; plural=(n != 1);") - -_gettext = def(text): return text - -_ngettext = def(text, plural, n): return text if n is 1 else plural - -def gettext(text): - return _gettext(text) - -def ngettext(text, plural, n): - return _ngettext(text, plural, n) - -def install(translation_data): - t = new Translations(translation_data) - t.install() - for func in register_callback.install_callbacks: - try: - func(t) - except: - pass - return t - -has_prop = Object.prototype.hasOwnProperty.call.bind(Object.prototype.hasOwnProperty) - -def register_callback(func): - # Register callbacks that will be called when new translation data is - # installed - register_callback.install_callbacks.push(func) -register_callback.install_callbacks = v'[]' - -empty_translation_data = {'entries': {}} - -class Translations: - - def __init__(self, translation_data): - translation_data = translation_data or empty_translation_data - func = _get_plural_forms_function(translation_data.plural_forms) - self.translations = [[translation_data, func]] - self.language = translation_data['language'] - - def add_fallback(self, fallback): - fallback = fallback or empty_translation_data - func = _get_plural_forms_function(fallback.plural_forms) - self.translations.push([fallback, func]) - - def gettext(self, text): - for t in self.translations: - m = t[0].entries - if has_prop(m, text): - return m[text][0] - return text - - def ngettext(self, text, plural, n): - for t in self.translations: - m = t[0].entries - if has_prop(m, text): - idx = t[1](n) - return m[text][idx] or (text if n is 1 else plural) - return text if n is 1 else plural - - def install(self): - nonlocal _gettext, _ngettext - _gettext = def (): - return self.gettext.apply(self, arguments) - _ngettext = def (): - return self.ngettext.apply(self, arguments) diff --git a/resources/rapydscript/lib/math.pyj b/resources/rapydscript/lib/math.pyj deleted file mode 100644 index 0cd65ae590..0000000000 --- a/resources/rapydscript/lib/math.pyj +++ /dev/null @@ -1,192 +0,0 @@ -########################################################### -# RapydScript Standard Library -# Author: Alexander Tsepkov -# Copyright 2013 Pyjeon Software LLC -# License: Apache License 2.0 -# This library is covered under Apache license, so that -# you can distribute it with your RapydScript applications. -########################################################### - - -# basic implementation of Python's 'math' library - -# NOTE: this is only meant to aid those porting lots of Python code into RapydScript, -# if you're writing a new RapydScript application, in most cases you probably want to -# use JavaScript's Math module directly instead - - -pi = Math.PI -e = Math.E - -######################################## -# Number-theoretic and representation functions -######################################## -def ceil(x): - return Math.ceil(x) -def copysign(x, y): - x = Math.abs(x) - if y < 0: - return -x - else: - return x -def fabs(x): - return Math.abs(x) -def factorial(x): - if Math.abs(int(x)) is not x: - raise ValueError("factorial() only accepts integral values") - factorial.cache = [] - r = def(n): - if n is 0 or n is 1: - return 1 - if not factorial.cache[n]: - factorial.cache[n] = r(n-1) * n - return factorial.cache[n] - return r(x) -def floor(x): - return Math.floor(x) -def fmod(x, y): - # javascript's % operator isn't consistent with C fmod implementation, this function is - while y <= x: - x -= y - return x -def fsum(iterable): - # like Python's fsum, this method is much more resilient to rounding errors than regular sum - partials = [] # sorted, non-overlapping partial sums - for x in iterable: - i = 0 - for y in partials: - if Math.abs(x) < Math.abs(y): - x, y = y, x - hi = x + y - lo = y - (hi - x) - if lo: - partials[i] = lo - i += 1 - x = hi - #partials[i:] = [x] - partials.splice(i, partials.length-i, x) - return sum(partials) -def isinf(x): - return not isFinite(x) -def isnan(x): - return isNaN(x) -def modf(x): - m = fmod(x, 1) - return m, x-m -def trunc(x): - return x | 0 - -######################################## -# Power and logarithmic functions -######################################## -def exp(x): - return Math.exp(x) -def expm1(x): - # NOTE: Math.expm1() is currently only implemented in Firefox, this provides alternative implementation - # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/expm1 - #return Math.expm1(x) - if Math.abs(x) < 1e-5: - return x + 0.5*x*x - else: - return Math.exp(x) - 1 -def log(x, base=e): - return Math.log(x)/Math.log(base) -def log1p(x): - # NOTE: Math.log1p() is currently only implemented in Firefox, this provides alternative implementation - # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log1p - # this version has been taken from http://phpjs.org/functions/log1p/ - # admittedly it's not as accurate as MDN version, as you can see from math.log1p(1) result - ret = 0 - n = 50 - if x <= -1: - return Number.NEGATIVE_INFINITY - if x < 0 or x > 1: - return Math.log(1 + x) - for i in range(1, n): - if i % 2 is 0: - ret -= Math.pow(x, i) / i - else: - ret += Math.pow(x, i) / i - return ret -def log10(x): - # NOTE: Math.log10() is currently only implemented in Firefox, this provides alternative implementation - # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log10 - # I didn't find a more accurate algorithm so I'm using the basic implementation - return Math.log(x)/Math.LN10 -def pow(x, y): - if x < 0 and int(y) is not y: - raise ValueError('math domain error') - if isnan(y) and x is 1: - return 1 - return Math.pow(x, y) -def sqrt(x): - return Math.sqrt(x) - -######################################## -# Trigonometric functions -######################################## -def acos(x): return Math.acos(x) -def asin(x): return Math.asin(x) -def atan(x): return Math.atan(x) -def atan2(y, x): return Math.atan2(y, x) -def cos(x): return Math.cos(x) -def sin(x): return Math.sin(x) -def hypot(x, y): return Math.sqrt(x*x + y*y) -def tan(x): return Math.tan(x) - -######################################## -# Angular conversion -######################################## -def degrees(x): return x*180/pi -def radians(x): return x*pi/180 - -######################################## -# Hyperbolic functions -######################################## -def acosh(x): - # NOTE: will be replaced with official, when it becomes mainstream - # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acosh - return Math.log(x + Math.sqrt(x*x - 1)) -def asinh(x): - # NOTE: will be replaced with official, when it becomes mainstream - # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asinh - return Math.log(x + Math.sqrt(x*x + 1)) -def atanh(x): - # NOTE: will be replaced with official, when it becomes mainstream - # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atanh - return 0.5 * Math.log((1 + x) / (1 - x)) -def cosh(x): - # NOTE: will be replaced with official, when it becomes mainstream - # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cosh - return (Math.exp(x) + Math.exp(-x)) / 2 -def sinh(x): - # NOTE: will be replaced with official, when it becomes mainstream - # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sinh - return (Math.exp(x) - Math.exp(-x)) / 2 -def tanh(x): - # NOTE: will be replaced with official, when it becomes mainstream - # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tanh - return (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x)) - - - -#import stdlib -#print(math.ceil(4.2)) -#print(math.floor(4.2)) -#print(math.fabs(-6)) -#print(math.copysign(-5, 7)) -#print(math.factorial(4)) -#print(math.fmod(-1e100, 1e100)) -# -#d = [0.9999999, 1, 2, 3] -#print(sum(d), math.fsum(d)) -#print(math.isinf(5), math.isinf(Infinity)) -#print(math.modf(5.5)) -#print(math.trunc(2.6), math.trunc(-2.6)) -#print(math.exp(1e-5), math.expm1(1e-5)) -#print(math.log(10), math.log(10, 1000)) -#print(math.log1p(1e-15), math.log1p(1)) -#print(math.log10(1000), math.log(1000, 10)) -#print(math.pow(1, 0), math.pow(1, NaN), math.pow(0, 0), math.pow(NaN, 0), math.pow(4,3), math.pow(100, -2)) -#print(math.hypot(3,4)) -#print(math.acosh(2), math.asinh(1), math.atanh(0.5), math.cosh(1), math.cosh(-1), math.sinh(1), math.tanh(1)) diff --git a/resources/rapydscript/lib/operator.pyj b/resources/rapydscript/lib/operator.pyj deleted file mode 100644 index fc9fb7a9dd..0000000000 --- a/resources/rapydscript/lib/operator.pyj +++ /dev/null @@ -1,11 +0,0 @@ -add = __add__ = def(x, y): return x + y -sub = __sub__ = def(x, y): return x - y -mul = __mul__ = def(x, y): return x * y -div = __div__ = def(x, y): return x / y - -lt = __lt__ = def(x, y): return x < y -le = __le__ = def(x, y): return x <= y -eq = __eq__ = def(x, y): return x is y -ne = __ne__ = def(x, y): return x is not y -ge = __ge__ = def(x, y): return x >= y -gt = __gt__ = def(x, y): return x > y diff --git a/resources/rapydscript/lib/pythonize.pyj b/resources/rapydscript/lib/pythonize.pyj deleted file mode 100644 index e3da389361..0000000000 --- a/resources/rapydscript/lib/pythonize.pyj +++ /dev/null @@ -1,20 +0,0 @@ -# vim:fileencoding=utf-8 -# License: BSD Copyright: 2016, Kovid Goyal -# globals: ρσ_str - -def strings(): - string_funcs = set(( - 'capitalize strip lstrip rstrip islower isupper isspace lower upper swapcase' - ' center count endswith startswith find rfind index rindex format join ljust rjust' - ' partition rpartition replace split rsplit splitlines zfill').split(' ')) - - if not arguments.length: - exclude = {'split', 'replace'} - elif arguments[0]: - exclude = Array.prototype.slice.call(arguments) - else: - exclude = None - if exclude: - string_funcs = string_funcs.difference(set(exclude)) - for name in string_funcs: - String.prototype[name] = ρσ_str.prototype[name] diff --git a/resources/rapydscript/lib/random.pyj b/resources/rapydscript/lib/random.pyj deleted file mode 100644 index bacd5791b2..0000000000 --- a/resources/rapydscript/lib/random.pyj +++ /dev/null @@ -1,94 +0,0 @@ -########################################################### -# RapydScript Standard Library -# Author: Alexander Tsepkov -# Copyright 2013 Pyjeon Software LLC -# License: Apache License 2.0 -# This library is covered under Apache license, so that -# you can distribute it with your RapydScript applications. -########################################################### - - -# basic implementation of Python's 'random' library - -# JavaScript's Math.random() does not allow seeding its random generator, to bypass that, this module implements its own -# version that can be seeded. I decided on RC4 algorithm for this. - -# please don't mess with this from the outside - -ρσ_seed_state = { - 'key': [], - 'key_i': 0, - 'key_j': 0 -} - -ρσ_get_random_byte = def(): - ρσ_seed_state.key_i = (ρσ_seed_state.key_i + 1) % 256 - ρσ_seed_state.key_j = (ρσ_seed_state.key_j + ρσ_seed_state.key[ρσ_seed_state.key_i]) % 256 - ρσ_seed_state.key[ρσ_seed_state.key_i], ρσ_seed_state.key[ρσ_seed_state.key_j] = \ - ρσ_seed_state.key[ρσ_seed_state.key_j], ρσ_seed_state.key[ρσ_seed_state.key_i] - return ρσ_seed_state.key[(ρσ_seed_state.key[ρσ_seed_state.key_i] + \ - ρσ_seed_state.key[ρσ_seed_state.key_j]) % 256] - -def seed(x=Date().getTime()): - ρσ_seed_state.key_i = ρσ_seed_state.key_j = 0 - if jstype(x) is 'number': - x = x.toString() - elif jstype(x) is not 'string': - raise TypeError("unhashable type: '" + jstype(x) + "'") - for i in range(256): - ρσ_seed_state.key[i] = i - j = 0 - for i in range(256): - j = (j + ρσ_seed_state.key[i] + x.charCodeAt(i % x.length)) % 256 - ρσ_seed_state.key[i], ρσ_seed_state.key[j] = ρσ_seed_state.key[j], ρσ_seed_state.key[i] -seed() - -def random(): - n = 0 - m = 1 - for i in range(8): - n += ρσ_get_random_byte() * m - m *= 256 - return v'n / 0x10000000000000000' - -# unlike the python version, this DOES build a range object, feel free to reimplement -def randrange(): - return choice(range.apply(this, arguments)) - -def randint(a, b): - return int(random()*(b-a+1) + a) - -def uniform(a, b): - return random()*(b-a) + a - -def choice(seq): - if seq.length > 0: - return seq[Math.floor(random()*seq.length)] - else: - raise IndexError() - -# uses Fisher-Yates algorithm to shuffle an array -def shuffle(x, random_f=random): - for i in range(x.length): - j = Math.floor(random_f() * (i+1)) - x[i], x[j] = x[j], x[i] - return x - -# similar to shuffle, but only shuffles a subset and creates a copy -def sample(population, k): - x = population.slice() - for i in range(population.length-1, population.length-k-1, -1): - j = Math.floor(random() * (i+1)) - x[i], x[j] = x[j], x[i] - return x.slice(population.length-k) - - -#import stdlib -#a = range(50) -#random.seed(5) -#print(random.choice(a)) -#print(random.shuffle(a)) -#print(random.randrange(10)) -#print(random.randint(1,5)) -#print(random.uniform(1,5)) -#print(random.sample(range(20),5)) diff --git a/resources/rapydscript/lib/re.pyj b/resources/rapydscript/lib/re.pyj deleted file mode 100644 index 1ad1142e72..0000000000 --- a/resources/rapydscript/lib/re.pyj +++ /dev/null @@ -1,472 +0,0 @@ -# vim:fileencoding=utf-8 -# License: BSD -# Copyright: 2015, Kovid Goyal -# Copyright: 2013, Alexander Tsepkov - -# globals: ρσ_iterator_symbol, ρσ_list_decorate - -# basic implementation of Python's 're' library - -from __python__ import bound_methods - -# Alias DB from http://www.unicode.org/Public/8.0.0/ucd/NameAliases.txt {{{ -_ALIAS_MAP = {"null":0,"nul":0,"start of heading":1,"soh":1,"start of text":2,"stx":2,"end of text":3,"etx":3,"end of transmission":4,"eot":4,"enquiry":5,"enq":5,"acknowledge":6,"ack":6,"alert":7,"bel":7,"backspace":8,"bs":8,"character tabulation":9,"horizontal tabulation":9,"ht":9,"tab":9,"line feed":10,"new line":10,"end of line":10,"lf":10,"nl":10,"eol":10,"line tabulation":11,"vertical tabulation":11,"vt":11,"form feed":12,"ff":12,"carriage return":13,"cr":13,"shift out":14,"locking-shift one":14,"so":14,"shift in":15,"locking-shift zero":15,"si":15,"data link escape":16,"dle":16,"device control one":17,"dc1":17,"device control two":18,"dc2":18,"device control three":19,"dc3":19,"device control four":20,"dc4":20,"negative acknowledge":21,"nak":21,"synchronous idle":22,"syn":22,"end of transmission block":23,"etb":23,"cancel":24,"can":24,"end of medium":25,"eom":25,"substitute":26,"sub":26,"escape":27,"esc":27,"information separator four":28,"file separator":28,"fs":28,"information separator three":29,"group separator":29,"gs":29,"information separator two":30,"record separator":30,"rs":30,"information separator one":31,"unit separator":31,"us":31,"sp":32,"delete":127,"del":127,"padding character":128,"pad":128,"high octet preset":129,"hop":129,"break permitted here":130,"bph":130,"no break here":131,"nbh":131,"index":132,"ind":132,"next line":133,"nel":133,"start of selected area":134,"ssa":134,"end of selected area":135,"esa":135,"character tabulation set":136,"horizontal tabulation set":136,"hts":136,"character tabulation with justification":137,"horizontal tabulation with justification":137,"htj":137,"line tabulation set":138,"vertical tabulation set":138,"vts":138,"partial line forward":139,"partial line down":139,"pld":139,"partial line backward":140,"partial line up":140,"plu":140,"reverse line feed":141,"reverse index":141,"ri":141,"single shift two":142,"single-shift-2":142,"ss2":142,"single shift three":143,"single-shift-3":143,"ss3":143,"device control string":144,"dcs":144,"private use one":145,"private use-1":145,"pu1":145,"private use two":146,"private use-2":146,"pu2":146,"set transmit state":147,"sts":147,"cancel character":148,"cch":148,"message waiting":149,"mw":149,"start of guarded area":150,"start of protected area":150,"spa":150,"end of guarded area":151,"end of protected area":151,"epa":151,"start of string":152,"sos":152,"single graphic character introducer":153,"sgc":153,"single character introducer":154,"sci":154,"control sequence introducer":155,"csi":155,"string terminator":156,"st":156,"operating system command":157,"osc":157,"privacy message":158,"pm":158,"application program command":159,"apc":159,"nbsp":160,"shy":173,"latin capital letter gha":418,"latin small letter gha":419,"cgj":847,"alm":1564,"syriac sublinear colon skewed left":1801,"kannada letter llla":3294,"lao letter fo fon":3741,"lao letter fo fay":3743,"lao letter ro":3747,"lao letter lo":3749,"tibetan mark bka- shog gi mgo rgyan":4048,"fvs1":6155,"fvs2":6156,"fvs3":6157,"mvs":6158,"zwsp":8203,"zwnj":8204,"zwj":8205,"lrm":8206,"rlm":8207,"lre":8234,"rle":8235,"pdf":8236,"lro":8237,"rlo":8238,"nnbsp":8239,"mmsp":8287,"wj":8288,"lri":8294,"rli":8295,"fsi":8296,"pdi":8297,"weierstrass elliptic function":8472,"micr on us symbol":9288,"micr dash symbol":9289,"leftwards triangle-headed arrow with double vertical stroke":11130,"rightwards triangle-headed arrow with double vertical stroke":11132,"yi syllable iteration mark":40981,"presentation form for vertical right white lenticular bracket":65048,"vs1":65024,"vs2":65025,"vs3":65026,"vs4":65027,"vs5":65028,"vs6":65029,"vs7":65030,"vs8":65031,"vs9":65032,"vs10":65033,"vs11":65034,"vs12":65035,"vs13":65036,"vs14":65037,"vs15":65038,"vs16":65039,"byte order mark":65279,"bom":65279,"zwnbsp":65279,"cuneiform sign nu11 tenu":74452,"cuneiform sign nu11 over nu11 bur over bur":74453,"byzantine musical symbol fthora skliron chroma vasis":118981,"vs17":917760,"vs18":917761,"vs19":917762,"vs20":917763,"vs21":917764,"vs22":917765,"vs23":917766,"vs24":917767,"vs25":917768,"vs26":917769,"vs27":917770,"vs28":917771,"vs29":917772,"vs30":917773,"vs31":917774,"vs32":917775,"vs33":917776,"vs34":917777,"vs35":917778,"vs36":917779,"vs37":917780,"vs38":917781,"vs39":917782,"vs40":917783,"vs41":917784,"vs42":917785,"vs43":917786,"vs44":917787,"vs45":917788,"vs46":917789,"vs47":917790,"vs48":917791,"vs49":917792,"vs50":917793,"vs51":917794,"vs52":917795,"vs53":917796,"vs54":917797,"vs55":917798,"vs56":917799,"vs57":917800,"vs58":917801,"vs59":917802,"vs60":917803,"vs61":917804,"vs62":917805,"vs63":917806,"vs64":917807,"vs65":917808,"vs66":917809,"vs67":917810,"vs68":917811,"vs69":917812,"vs70":917813,"vs71":917814,"vs72":917815,"vs73":917816,"vs74":917817,"vs75":917818,"vs76":917819,"vs77":917820,"vs78":917821,"vs79":917822,"vs80":917823,"vs81":917824,"vs82":917825,"vs83":917826,"vs84":917827,"vs85":917828,"vs86":917829,"vs87":917830,"vs88":917831,"vs89":917832,"vs90":917833,"vs91":917834,"vs92":917835,"vs93":917836,"vs94":917837,"vs95":917838,"vs96":917839,"vs97":917840,"vs98":917841,"vs99":917842,"vs100":917843,"vs101":917844,"vs102":917845,"vs103":917846,"vs104":917847,"vs105":917848,"vs106":917849,"vs107":917850,"vs108":917851,"vs109":917852,"vs110":917853,"vs111":917854,"vs112":917855,"vs113":917856,"vs114":917857,"vs115":917858,"vs116":917859,"vs117":917860,"vs118":917861,"vs119":917862,"vs120":917863,"vs121":917864,"vs122":917865,"vs123":917866,"vs124":917867,"vs125":917868,"vs126":917869,"vs127":917870,"vs128":917871,"vs129":917872,"vs130":917873,"vs131":917874,"vs132":917875,"vs133":917876,"vs134":917877,"vs135":917878,"vs136":917879,"vs137":917880,"vs138":917881,"vs139":917882,"vs140":917883,"vs141":917884,"vs142":917885,"vs143":917886,"vs144":917887,"vs145":917888,"vs146":917889,"vs147":917890,"vs148":917891,"vs149":917892,"vs150":917893,"vs151":917894,"vs152":917895,"vs153":917896,"vs154":917897,"vs155":917898,"vs156":917899,"vs157":917900,"vs158":917901,"vs159":917902,"vs160":917903,"vs161":917904,"vs162":917905,"vs163":917906,"vs164":917907,"vs165":917908,"vs166":917909,"vs167":917910,"vs168":917911,"vs169":917912,"vs170":917913,"vs171":917914,"vs172":917915,"vs173":917916,"vs174":917917,"vs175":917918,"vs176":917919,"vs177":917920,"vs178":917921,"vs179":917922,"vs180":917923,"vs181":917924,"vs182":917925,"vs183":917926,"vs184":917927,"vs185":917928,"vs186":917929,"vs187":917930,"vs188":917931,"vs189":917932,"vs190":917933,"vs191":917934,"vs192":917935,"vs193":917936,"vs194":917937,"vs195":917938,"vs196":917939,"vs197":917940,"vs198":917941,"vs199":917942,"vs200":917943,"vs201":917944,"vs202":917945,"vs203":917946,"vs204":917947,"vs205":917948,"vs206":917949,"vs207":917950,"vs208":917951,"vs209":917952,"vs210":917953,"vs211":917954,"vs212":917955,"vs213":917956,"vs214":917957,"vs215":917958,"vs216":917959,"vs217":917960,"vs218":917961,"vs219":917962,"vs220":917963,"vs221":917964,"vs222":917965,"vs223":917966,"vs224":917967,"vs225":917968,"vs226":917969,"vs227":917970,"vs228":917971,"vs229":917972,"vs230":917973,"vs231":917974,"vs232":917975,"vs233":917976,"vs234":917977,"vs235":917978,"vs236":917979,"vs237":917980,"vs238":917981,"vs239":917982,"vs240":917983,"vs241":917984,"vs242":917985,"vs243":917986,"vs244":917987,"vs245":917988,"vs246":917989,"vs247":917990,"vs248":917991,"vs249":917992,"vs250":917993,"vs251":917994,"vs252":917995,"vs253":917996,"vs254":917997,"vs255":917998,"vs256":917999} -# }}} - -_ASCII_CONTROL_CHARS = {'a':7, 'b':8, 'f': 12, 'n': 10, 'r': 13, 't': 9, 'v': 11} -_HEX_PAT = /^[a-fA-F0-9]/ -_NUM_PAT = /^[0-9]/ -_GROUP_PAT = /<([^>]+)>/ -_NAME_PAT = /^[a-zA-Z ]/ - -I = IGNORECASE = 2 -L = LOCALE = 4 -M = MULTILINE = 8 -D = DOTALL = 16 -U = UNICODE = 32 -X = VERBOSE = 64 -DEBUG = 128 -A = ASCII = 256 - -supports_unicode = RegExp.prototype.unicode is not undefined - -_RE_ESCAPE = /[-\/\\^$*+?.()|[\]{}]/g - -_re_cache_map = {} -_re_cache_items = v'[]' - -error = SyntaxError # This is the error JS throws for invalid regexps -has_prop = Object.prototype.hasOwnProperty.call.bind(Object.prototype.hasOwnProperty) - -def _expand(groups, repl, group_name_map): - i = 0 - - def next(): - nonlocal i - return v'repl[i++]' - - def peek(): - return repl[i] - - def read_digits(count, pat, base, maxval, prefix): - ans = prefix or '' - greedy = count is Number.MAX_VALUE - while count > 0: - count -= 1 - if not pat.test(peek()): - if greedy: - break - return ans - ans += next() - nval = parseInt(ans, base) - if nval > maxval: - return ans - return nval - - def read_escape_sequence(): - nonlocal i - q = next() - if not q or q is '\\': - return '\\' - if '"\''.indexOf(q) is not -1: - return q - if _ASCII_CONTROL_CHARS[q]: - return String.fromCharCode(_ASCII_CONTROL_CHARS[q]) - if '0' <= q <= '9': - ans = read_digits(Number.MAX_VALUE, _NUM_PAT, 10, Number.MAX_VALUE, q) - if jstype(ans) is 'number': - return groups[ans] or '' - return '\\' + ans - if q is 'g': - m = _GROUP_PAT.exec(repl[i:]) - if m is not None: - i += m[0].length - gn = m[1] - if isNaN(parseInt(gn, 10)): - if not has_prop(group_name_map, gn): - return '' - gn = group_name_map[gn][-1] - return groups[gn] or '' - if q is 'x': - code = read_digits(2, _HEX_PAT, 16, 0x10FFFF) - if jstype(code) is 'number': - return String.fromCharCode(code) - return '\\x' + code - if q is 'u': - code = read_digits(4, _HEX_PAT, 16, 0x10FFFF) - if jstype(code) is 'number': - return String.fromCharCode(code) - return '\\u' + code - if q is 'U': - code = read_digits(8, _HEX_PAT, 16, 0x10FFFF) - if jstype(code) is 'number': - if code <= 0xFFFF: - return String.fromCharCode(code) - code -= 0x10000 - return String.fromCharCode(0xD800+(code>>10), 0xDC00+(code&0x3FF)) - return '\\U' + code - if q is 'N' and peek() is '{': - next() - name = '' - while _NAME_PAT.test(peek()): - name += next() - if peek() is not '}': - return '\\N{' + name - next() - key = (name or '').toLowerCase() - if not name or not has_prop(_ALIAS_MAP, key): - return '\\N{' + name + '}' - code = _ALIAS_MAP[key] - if code <= 0xFFFF: - return String.fromCharCode(code) - code -= 0x10000 - return String.fromCharCode(0xD800+(code>>10), 0xDC00+(code&0x3FF)) - - return '\\' + q - - ans = ch = '' - while True: - ch = next() - if ch is '\\': - ans += read_escape_sequence() - elif not ch: - break - else: - ans += ch - return ans - -def transform_regex(source, flags): - pos = 0 - previous_backslash = in_class = False - ans = '' - group_map = {} - flags = flags or 0 - group_count = 0 - - while pos < source.length: - ch = v'source[pos++]' - if previous_backslash: - ans += '\\' + ch - previous_backslash = False - continue - - if in_class: - if ch is ']': - in_class = False - ans += ch - continue - - if ch is '\\': - previous_backslash = True - continue - - if ch is '[': - in_class = True - if source[pos] is ']': # in python the empty set is not allowed, instead []] is the same as [\]] - pos += 1 - ch = r'[\]' - elif ch is '(': - if source[pos] is '?': - extension = source[pos + 1] - if extension is '#': - close = source.indexOf(')', pos + 1) - if close is -1: - raise ValueError('Expecting a closing )') - pos = close + 1 - continue - if 'aiLmsux'.indexOf(extension) is not -1: - flag_map = {'a':ASCII, 'i':IGNORECASE, 'L':LOCALE, 'm':MULTILINE, 's':DOTALL, 'u':UNICODE, 'x':VERBOSE} - close = source.indexOf(')', pos + 1) - if close is -1: - raise SyntaxError('Expecting a closing )') - flgs = source[pos+1:close] - for v'var i = 0; i < flgs.length; i++': - q = flgs[i] # noqa:undef - if not has_prop(flag_map, q): - raise SyntaxError('Invalid flag: ' + q) - flags |= flag_map[q] - pos = close + 1 - continue - if extension is '<': - raise SyntaxError('Look behind assertions are not supported in JavaScript') - if extension is '(': - raise SyntaxError('Group existence assertions are not supported in JavaScript') - if extension is 'P': - pos += 2 - q = source[pos] - if q is '<': - close = source.indexOf('>', pos) - if close is -1: - raise SyntaxError('Named group not closed, expecting >') - name = source[pos+1:close] - if not has_prop(group_map, name): - group_map[name] = v'[]' - group_map[name].push(v'++group_count') - pos = close + 1 - elif q is '=': - close = source.indexOf(')', pos) - if close is -1: - raise SyntaxError('Named group back-reference not closed, expecting a )') - name = source[pos+1:close] - if not isNaN(parseInt(name, 10)): - ans += '\\' + name - else: - if not has_prop(group_map, name): - raise SyntaxError('Invalid back-reference. The named group: ' + name + ' has not yet been defined.') - ans += '\\' + group_map[name][-1] - pos = close + 1 - continue - else: - raise SyntaxError('Expecting < or = after (?P') - else: - group_count += 1 - elif ch is '.' and (flags & DOTALL): - ans += r'[\s\S]' # JavaScript has no DOTALL - continue - - ans += ch - - return ans, flags, group_map - -class MatchObject: - - def __init__(self, regex, match, pos, endpos): - self.re = regex - self.string = match.input - self._start_pos = match.index - self._groups = match - self.pos, self.endpos = pos, endpos - - def _compute_extents(self): - # compute start/end for each group - match = self._groups - self._start = v'Array(match.length)' - self._end = v'Array(match.length)' - self._start[0] = self._start_pos - self._end[0] = self._start_pos + match[0].length - offset = self._start_pos - extent = match[0] - loc = 0 - for v'var i = 1; i < match.length; i++': - g = match[i] - loc = extent.indexOf(g, loc) - if loc is -1: - self._start[i] = self._start[i-1] - self._end[i] = self._end[i-1] - else: - self._start[i] = offset + loc - loc += g.length - self._end[i] = offset + loc # noqa:undef - - def groups(self, defval=None): - ans = v'[]' - for v'var i = 1; i < self._groups.length; i++': - val = self._groups[i] # noqa:undef - if val is undefined: - val = defval - ans.push(val) - return ans - - def _group_number(self, g): - if jstype(g) is 'number': - return g - if has_prop(self.re.group_name_map, g): - return self.re.group_name_map[g][-1] - return g - - def _group_val(self, q, defval): - val = undefined - if jstype(q) is 'number' and -1 < q < self._groups.length: - val = self._groups[q] - else: - if has_prop(self.re.group_name_map, q): - val = self._groups[self.re.group_name_map[q][-1]] - if val is undefined: - val = defval - return val - - def group(self): - if arguments.length is 0: - return self._groups[0] - ans = v'[]' - for v'var i = 0; i < arguments.length; i++': - q = arguments[i] # noqa:undef - ans.push(self._group_val(q, None)) - return ans[0] if ans.length is 1 else ans - - def start(self, g): - if self._start is undefined: - self._compute_extents() - val = self._start[self._group_number(g or 0)] - if val is undefined: - val = -1 - return val - - def end(self, g): - if self._end is undefined: - self._compute_extents() - val = self._end[self._group_number(g or 0)] - if val is undefined: - val = -1 - return val - - def span(self, g): - return [self.start(g), self.end(g)] - - def expand(self, repl): - return _expand(repl, this._groups, this.re.group_name_map) - - def groupdict(self, defval=None): - gnm = self.re.group_name_map - names = Object.keys(gnm) - ans = {} - for v"var i = 0; i < names.length; i++": - name = names[i] # noqa:undef - if has_prop(gnm, name): - val = self._groups[gnm[name][-1]] - if val is undefined: - val = defval - ans[name] = val - return ans - - def captures(self, group_name): - ans = [] - if not has_prop(self.re.group_name_map, group_name): - return ans - groups = self.re.group_name_map[group_name] - for v'var i = 0; i < groups.length; i++': - val = self._groups[groups[i]] # noqa:undef - if val is not undefined: - ans.push(val) - return ans - - def capturesdict(self): - gnm = self.re.group_name_map - names = Object.keys(gnm) - ans = {} - for v'var i = 0; i < names.length; i++': - name = names[i] # noqa:undef - ans[name] = self.captures(name) - return ans - -class RegexObject: - - def __init__(self, pattern, flags): - self.pattern = pattern.source if isinstance(pattern, RegExp) else pattern - self.js_pattern, self.flags, self.group_name_map = transform_regex(self.pattern, flags) - - modifiers = '' - if self.flags & IGNORECASE: modifiers += 'i' - if self.flags & MULTILINE: modifiers += 'm' - if not (self.flags & ASCII) and supports_unicode: - modifiers += 'u' - self._modifiers = modifiers + 'g' - self._pattern = RegExp(self.js_pattern, self._modifiers) - - def _do_search(self, pat, string, pos, endpos): - pat.lastIndex = 0 - if endpos is not None: - string = string[:endpos] - while True: - n = pat.exec(string) - if n is None: - return None - if n.index >= pos: - return MatchObject(self, n, pos, endpos) - - def search(self, string, pos=0, endpos=None): - return self._do_search(self._pattern, string, pos, endpos) - - def match(self, string, pos=0, endpos=None): - return self._do_search(RegExp('^' + self.js_pattern, self._modifiers), string, pos, endpos) - - def split(self, string, maxsplit=0): - self._pattern.lastIndex = 0 - return string.split(self._pattern, maxsplit or undefined) - - def findall(self, string): - self._pattern.lastIndex = 0 - return ρσ_list_decorate(string.match(self._pattern) or v'[]') - - def finditer(self, string): - # We have to copy pat since lastIndex is mutable - pat = RegExp(this._pattern.source, this._modifiers) # noqa: unused-local - ans = v"{'_string':string, '_r':pat, '_self':self}" - ans[ρσ_iterator_symbol] = def(): - return this - ans['next'] = def(): - m = this._r.exec(this._string) - if m is None: - return v"{'done':true}" - return v"{'done':false, 'value':new MatchObject(this._self, m, 0, null)}" - return ans - - def subn(self, repl, string, count=0): - expand = _expand - if jstype(repl) is 'function': - expand = def(m, repl, gnm): return '' + repl(MatchObject(self, m, 0, None)) - this._pattern.lastIndex = 0 - num = 0 - matches = v'[]' - - while count < 1 or num < count: - m = this._pattern.exec(string) - if m is None: - break - matches.push(m) - num += 1 - - for v'var i = matches.length - 1; i > -1; i--': - m = matches[i] # noqa:undef - start = m.index - end = start + m[0].length - string = string[:start] + expand(m, repl, self.group_name_map) + string[end:] - return string, matches.length - - def sub(self, repl, string, count=0): - return self.subn(repl, string, count)[0] - -def _get_from_cache(pattern, flags): - if isinstance(pattern, RegExp): - pattern = pattern.source - key = JSON.stringify(v'[pattern, flags]') - if has_prop(_re_cache_map, key): - return _re_cache_map[key] - if _re_cache_items.length >= 100: - v'delete _re_cache_map[_re_cache_items.shift()]' - ans = RegexObject(pattern, flags) - _re_cache_map[key] = ans - _re_cache_items.push(key) - return ans - -def compile(pattern, flags=0): - return _get_from_cache(pattern, flags) - -def search(pattern, string, flags=0): - return _get_from_cache(pattern, flags).search(string) - -def match(pattern, string, flags=0): - return _get_from_cache(pattern, flags).match(string) - -def split(pattern, string, maxsplit=0, flags=0): - return _get_from_cache(pattern, flags).split(string) - -def findall(pattern, string, flags=0): - return _get_from_cache(pattern, flags).findall(string) - -def finditer(pattern, string, flags=0): - return _get_from_cache(pattern, flags).finditer(string) - -def sub(pattern, repl, string, count=0, flags=0): - return _get_from_cache(pattern, flags).sub(repl, string, count) - -def subn(pattern, repl, string, count=0, flags=0): - return _get_from_cache(pattern, flags).subn(repl, string, count) - -def escape(string): - return string.replace(_RE_ESCAPE, '\\$&') - -def purge(): - nonlocal _re_cache_map, _re_cache_items - _re_cache_map = {} - _re_cache_items = v'[]' diff --git a/resources/rapydscript/lib/traceback.pyj b/resources/rapydscript/lib/traceback.pyj deleted file mode 100644 index a25bb32cff..0000000000 --- a/resources/rapydscript/lib/traceback.pyj +++ /dev/null @@ -1,51 +0,0 @@ -# vim:fileencoding=utf-8 -# License: BSD Copyright: 2016, Kovid Goyal -# globals: ρσ_str, ρσ_last_exception - -def _get_internal_traceback(err): - if isinstance(err, Exception) and err.stack: - lines = ρσ_str.splitlines(err.stack) - for i, line in enumerate(lines): - line = ρσ_str.strip(line) - # These two conditions work on desktop Chrome and Firefox to identify the correct - # line in the traceback. - if line.startsWith('at new ' + err.name) or line.startsWith(err.name + '@'): - return err.__repr__() + '\n' + lines.slice(i+1).join('\n') - return err and err.stack - -def format_exception(exc, limit): - if not isinstance(exc, Error): - if exc and exc.toString: - return [exc.toString()] - return [] - tb = _get_internal_traceback(exc) - if tb: - lines = ρσ_str.splitlines(tb) - e = lines[0] - lines = [l for l in lines[1:]] - if limit: - lines = lines[:limit+1] if limit > 0 else lines[limit:] - lines.reverse() - lines.push(e) - lines.insert(0, 'Traceback (most recent call last):') - return [l+'\n' for l in lines] - return [exc.toString()] - -def format_exc(limit): - return format_exception(ρσ_last_exception, limit).join('') - -def print_exc(limit): - print(format_exc(limit)) - -def format_stack(limit): - stack = Error().stack - if not stack: - return [] - lines = str.splitlines(stack)[2:] - lines.reverse() - if limit: - lines = lines[:limit+1] if limit > 0 else lines[limit:] - return [l + '\n' for l in lines] - -def print_stack(limit): - print(format_stack(limit).join('')) diff --git a/resources/rapydscript/lib/uuid.pyj b/resources/rapydscript/lib/uuid.pyj deleted file mode 100644 index ad69d1e085..0000000000 --- a/resources/rapydscript/lib/uuid.pyj +++ /dev/null @@ -1,77 +0,0 @@ -# vim:fileencoding=utf-8 -# License: BSD Copyright: 2017, Kovid Goyal -# globals: crypto -from __python__ import hash_literals - -from encodings import hexlify, urlsafe_b64decode, urlsafe_b64encode - -RFC_4122 = 1 - -if jstype(crypto) is 'object' and crypto.getRandomValues: - random_bytes = def (num): - ans = Uint8Array(num or 16) - crypto.getRandomValues(ans) - return ans -else: - random_bytes = def (num): - ans = Uint8Array(num or 16) - for i in range(ans.length): - ans[i] = Math.floor(Math.random() * 256) - return ans - - -def uuid4_bytes(): - data = random_bytes() - data[6] = 0b01000000 | (data[6] & 0b1111) - data[8] = (((data[8] >> 4) & 0b11 | 0b1000) << 4) | (data[8] & 0b1111) - return data - - -def as_str(): - h = this.hex - return h[:8] + '-' + h[8:12] + '-' + h[12:16] + '-' + h[16:20] + '-' + h[20:] - - -def uuid4(): - b = uuid4_bytes() - return { - 'hex': hexlify(b), - 'bytes': b, - 'variant': RFC_4122, - 'version': 4, - '__str__': as_str, - 'toString': as_str, - } - - -def num_to_string(numbers, alphabet, pad_to_length): - ans = v'[]' - alphabet_len = alphabet.length - numbers = Array.prototype.slice.call(numbers) - for v'var i = 0; i < numbers.length - 1; i++': - x = divmod(numbers[i], alphabet_len) - numbers[i] = x[0] - numbers[i+1] += x[1] - for v'var i = 0; i < numbers.length; i++': - number = numbers[i] - while number: - x = divmod(number, alphabet_len) - number = x[0] - ans.push(alphabet[x[1]]) - if pad_to_length and pad_to_length > ans.length: - ans.push(alphabet[0].repeat(pad_to_length - ans.length)) - return ans.join('') - - -def short_uuid(): - # A totally random uuid encoded using only URL and filename safe characters - return urlsafe_b64encode(random_bytes(), '') - - -def short_uuid4(): - # A uuid4 encoded using only URL and filename safe characters - return urlsafe_b64encode(uuid4_bytes(), '') - - -def decode_short_uuid(val): - return urlsafe_b64decode(val + '==') From 055c2a9f2f1e126be61a81683041f1e0fab4c3f2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 27 Jun 2019 05:44:52 +0530 Subject: [PATCH 1383/2613] Ensure rendering of HTML does not hang --- src/calibre/ebooks/render_html.py | 33 ++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/render_html.py b/src/calibre/ebooks/render_html.py index 6d745a0eb1..ad367c6088 100644 --- a/src/calibre/ebooks/render_html.py +++ b/src/calibre/ebooks/render_html.py @@ -7,12 +7,18 @@ from __future__ import absolute_import, division, print_function, unicode_litera import os import sys -from PyQt5.Qt import QApplication, QMarginsF, QPageLayout, QPageSize, Qt, QUrl +from PyQt5.Qt import ( + QApplication, QMarginsF, QPageLayout, QPageSize, Qt, QTimer, QUrl +) from PyQt5.QtWebEngineWidgets import QWebEnginePage from calibre.ebooks.metadata.pdf import page_images from calibre.gui2 import must_use_qt from calibre.gui2.webengine import secure_webengine +from calibre.utils.monotonic import monotonic + +LOAD_TIMEOUT = 20 +PRINT_TIMEOUT = 10 class Render(QWebEnginePage): @@ -20,8 +26,12 @@ class Render(QWebEnginePage): def __init__(self): QWebEnginePage.__init__(self) secure_webengine(self) + self.printing_started = False self.loadFinished.connect(self.load_finished, type=Qt.QueuedConnection) self.pdfPrintingFinished.connect(self.print_finished) + self.hang_timer = t = QTimer(self) + t.setInterval(500) + t.timeout.connect(self.hang_check) def load_finished(self, ok): if ok: @@ -29,13 +39,29 @@ class Render(QWebEnginePage): else: QApplication.instance().exit(1) + def start_load(self, path_to_html): + self.load(QUrl.fromLocalFile(path_to_html)) + self.start_time = monotonic() + self.hang_timer.start() + + def hang_check(self): + if self.printing_started: + if monotonic() - self.start_time > PRINT_TIMEOUT: + QApplication.instance().exit(4) + else: + if monotonic() - self.start_time > LOAD_TIMEOUT: + QApplication.instance().exit(3) + def start_print(self): margins = QMarginsF(0, 0, 0, 0) page_layout = QPageLayout(QPageSize(QPageSize.A4), QPageLayout.Portrait, margins) self.printToPdf('rendered.pdf', page_layout) + self.printing_started = True + self.start_time = monotonic() def print_finished(self, path, ok): QApplication.instance().exit(0 if ok else 2) + self.hang_timer.stop() def main(path_to_html, tdir, image_format='jpeg'): @@ -45,7 +71,7 @@ def main(path_to_html, tdir, image_format='jpeg'): path_to_html = os.path.abspath(path_to_html) os.chdir(tdir) renderer = Render() - renderer.load(QUrl.fromLocalFile(path_to_html)) + renderer.start_load(path_to_html) ret = QApplication.instance().exec_() if ret == 0: page_images('rendered.pdf', image_format=image_format) @@ -55,4 +81,5 @@ def main(path_to_html, tdir, image_format='jpeg'): if __name__ == '__main__': - main(sys.argv[-1], '.') + if not main(sys.argv[-1], '.'): + raise SystemExit('Failed to render HTML') From ff8965d510907d626984ef021353bd497634e03c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 27 Jun 2019 05:49:33 +0530 Subject: [PATCH 1384/2613] Make embedded compiler behave more like external one --- resources/rapydscript/compiler.js.xz | Bin 118924 -> 118856 bytes src/calibre/utils/rapydscript.py | 2 ++ 2 files changed, 2 insertions(+) diff --git a/resources/rapydscript/compiler.js.xz b/resources/rapydscript/compiler.js.xz index d321f732d6a2871794895901417052868b009ede..32836c32be515cf96abe32fa0ae716bc56da7345 100644 GIT binary patch literal 118856 zcmV(tKuy0eC%m9AERJPPk=qm zXFFl)8qHF4js+xrHbSHLttw>R-MKa`oGz?%+f_AVuI^gVz=aaE@>d1SuB`D za*yd}0hY(O%ejcFU3BFD^KT~DMA1Xd_~4UYtoYUAQN`l##tRfg>rw48^qeO^cCDMa zkXR*B=zftYkf@tNS~~le*${nN{qQ^u4_mJ#d-{5|jZ8^(Ilmoo;~DSj zq3w(_X}k-pK?`1w9O^uQ~8*4hUk#jqELkoPbid1z|qQaL^P|9rPs6}N#4=`x-w z$Oj9Q$s5G!)Lk&%>m7!v3~!sW7j~%?vEIBab;4_vhu9*?NIv_egQba2JqxW06bDtq zXDYTn&p~tZ=j3EskkIRc%HblYC~Xh)E3$vKlgogF`90E}Tn3qbh8>e^Bqhsd`sdQ) zK*?7o(K-*E2_O@|@}Hl1h0R+R`OY2v(~1q$Pd9!7l$;=`sO%dTT&JUjMX9jwB%qNG zzL&oN8jpCS$2(c+{cyazL4+x~-WzwtX6wZpsj^vu0!4JAiV=X#-Y5}MeP#Z`Jo z6)PFTT`h0xKrI>BoGMxLK!f0HZAh7ITj?}|ITYKb=!-1)UCQy8Try*n2~`IhkS+aE zzN@lMlLLj|>>=%!J8@HatNkhv6n0kO%&kBDN=EUKU`_d}F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tpl2{j@klQK006un9!o!nWV-+X=AZ}h;X<2m35Bu5XZr#G00004Sz6obHroII diff --git a/src/calibre/utils/rapydscript.py b/src/calibre/utils/rapydscript.py index fda31d5761..2c7a6f53b8 100644 --- a/src/calibre/utils/rapydscript.py +++ b/src/calibre/utils/rapydscript.py @@ -144,6 +144,8 @@ document.title = 'compiler initialized'; self.errors = [] self.working = True options['basedir'] = '__stdlib__' + options['write_name'] = True + options['keep_docstrings'] = False src = 'var js = window.compiler.compile({}, {}); [js, window.write_cache]'.format(*map(json.dumps, (src, options))) self.runJavaScript(src, QWebEngineScript.ApplicationWorld, self.compilation_done) while self.working: From 2224f8e7ae91c8780c22e934661de18aa3132d8e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 27 Jun 2019 05:51:25 +0530 Subject: [PATCH 1385/2613] Ensure hang timer is stopped --- src/calibre/ebooks/render_html.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/ebooks/render_html.py b/src/calibre/ebooks/render_html.py index ad367c6088..dfcf0b9f8f 100644 --- a/src/calibre/ebooks/render_html.py +++ b/src/calibre/ebooks/render_html.py @@ -37,6 +37,7 @@ class Render(QWebEnginePage): if ok: self.start_print() else: + self.hang_timer.stop() QApplication.instance().exit(1) def start_load(self, path_to_html): @@ -47,9 +48,11 @@ class Render(QWebEnginePage): def hang_check(self): if self.printing_started: if monotonic() - self.start_time > PRINT_TIMEOUT: + self.hang_timer.stop() QApplication.instance().exit(4) else: if monotonic() - self.start_time > LOAD_TIMEOUT: + self.hang_timer.stop() QApplication.instance().exit(3) def start_print(self): From 070ad5351ebc0973f576138a902bb1493f0c619b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 27 Jun 2019 08:30:23 +0530 Subject: [PATCH 1386/2613] Remove old viewer and coffeescript and viewer resources Since the PDF output code is also going to be replaced, none of this is required. --- resources/coffee-script.js | 12 - resources/compiled_coffeescript.zip | Bin 87844 -> 0 bytes resources/viewer/blank.html | 11 - resources/viewer/bookmarks.js | 49 - resources/viewer/hyphenate/Hyphenator.js | 3281 --------- resources/viewer/hyphenate/patterns.zip | Bin 628424 -> 0 bytes resources/viewer/hyphenation.js | 28 - resources/viewer/images.js | 52 - resources/viewer/jquery.js | 6240 ----------------- resources/viewer/jquery_scrollTo.js | 215 - resources/viewer/referencing.js | 72 - setup/check.py | 8 - setup/commands.py | 5 +- setup/resources.py | 104 +- src/calibre/ebooks/oeb/display/cfi.coffee | 671 -- src/calibre/ebooks/oeb/display/extract.coffee | 211 - .../ebooks/oeb/display/full_screen.coffee | 67 - .../ebooks/oeb/display/indexing.coffee | 132 - src/calibre/ebooks/oeb/display/mathjax.coffee | 129 - src/calibre/ebooks/oeb/display/paged.coffee | 672 -- .../ebooks/oeb/display/test-cfi/birds.webm | Bin 1324945 -> 0 bytes .../oeb/display/test-cfi/cfi-test.coffee | 97 - .../ebooks/oeb/display/test-cfi/cfi-test.pyj | 74 - .../ebooks/oeb/display/test-cfi/iframe.html | 32 - .../ebooks/oeb/display/test-cfi/index.html | 150 - .../ebooks/oeb/display/test-cfi/marker.png | Bin 751 -> 0 bytes .../ebooks/oeb/display/test-cfi/run.py | 26 - .../oeb/display/test-cfi/run_rapydscript.py | 40 - src/calibre/ebooks/oeb/display/utils.coffee | 151 - src/calibre/gui2/__init__.py | 17 - .../tweak_book/editor/syntax/javascript.py | 2 +- src/calibre/gui2/viewer/__init__.py | 0 src/calibre/gui2/viewer/bookmarkmanager.py | 235 - src/calibre/gui2/viewer/config.py | 456 -- src/calibre/gui2/viewer/config.ui | 1213 ---- src/calibre/gui2/viewer/documentview.py | 1420 ---- src/calibre/gui2/viewer/fake_net.py | 187 - src/calibre/gui2/viewer/flip.py | 116 - src/calibre/gui2/viewer/footnote.py | 155 - src/calibre/gui2/viewer/gestures.py | 377 - src/calibre/gui2/viewer/image_popup.py | 177 - src/calibre/gui2/viewer/inspector.py | 53 - src/calibre/gui2/viewer/javascript.py | 82 - src/calibre/gui2/viewer/keys.py | 104 - src/calibre/gui2/viewer/main.py | 1356 ---- src/calibre/gui2/viewer/position.py | 91 - src/calibre/gui2/viewer/printing.py | 230 - src/calibre/gui2/viewer/table_popup.py | 82 - src/calibre/gui2/viewer/toc.py | 411 -- src/calibre/gui2/viewer/ui.py | 425 -- src/calibre/utils/resources.py | 69 +- src/calibre/utils/serve_coffee.py | 331 - 52 files changed, 7 insertions(+), 20111 deletions(-) delete mode 100644 resources/coffee-script.js delete mode 100644 resources/compiled_coffeescript.zip delete mode 100644 resources/viewer/blank.html delete mode 100644 resources/viewer/bookmarks.js delete mode 100644 resources/viewer/hyphenate/Hyphenator.js delete mode 100644 resources/viewer/hyphenate/patterns.zip delete mode 100644 resources/viewer/hyphenation.js delete mode 100644 resources/viewer/images.js delete mode 100644 resources/viewer/jquery.js delete mode 100644 resources/viewer/jquery_scrollTo.js delete mode 100644 resources/viewer/referencing.js delete mode 100644 src/calibre/ebooks/oeb/display/cfi.coffee delete mode 100644 src/calibre/ebooks/oeb/display/extract.coffee delete mode 100644 src/calibre/ebooks/oeb/display/full_screen.coffee delete mode 100644 src/calibre/ebooks/oeb/display/indexing.coffee delete mode 100644 src/calibre/ebooks/oeb/display/mathjax.coffee delete mode 100644 src/calibre/ebooks/oeb/display/paged.coffee delete mode 100644 src/calibre/ebooks/oeb/display/test-cfi/birds.webm delete mode 100644 src/calibre/ebooks/oeb/display/test-cfi/cfi-test.coffee delete mode 100644 src/calibre/ebooks/oeb/display/test-cfi/cfi-test.pyj delete mode 100644 src/calibre/ebooks/oeb/display/test-cfi/iframe.html delete mode 100644 src/calibre/ebooks/oeb/display/test-cfi/index.html delete mode 100644 src/calibre/ebooks/oeb/display/test-cfi/marker.png delete mode 100644 src/calibre/ebooks/oeb/display/test-cfi/run.py delete mode 100644 src/calibre/ebooks/oeb/display/test-cfi/run_rapydscript.py delete mode 100644 src/calibre/ebooks/oeb/display/utils.coffee delete mode 100644 src/calibre/gui2/viewer/__init__.py delete mode 100644 src/calibre/gui2/viewer/bookmarkmanager.py delete mode 100644 src/calibre/gui2/viewer/config.py delete mode 100644 src/calibre/gui2/viewer/config.ui delete mode 100644 src/calibre/gui2/viewer/documentview.py delete mode 100644 src/calibre/gui2/viewer/fake_net.py delete mode 100644 src/calibre/gui2/viewer/flip.py delete mode 100644 src/calibre/gui2/viewer/footnote.py delete mode 100644 src/calibre/gui2/viewer/gestures.py delete mode 100644 src/calibre/gui2/viewer/image_popup.py delete mode 100644 src/calibre/gui2/viewer/inspector.py delete mode 100644 src/calibre/gui2/viewer/javascript.py delete mode 100644 src/calibre/gui2/viewer/keys.py delete mode 100644 src/calibre/gui2/viewer/main.py delete mode 100644 src/calibre/gui2/viewer/position.py delete mode 100644 src/calibre/gui2/viewer/printing.py delete mode 100644 src/calibre/gui2/viewer/table_popup.py delete mode 100644 src/calibre/gui2/viewer/toc.py delete mode 100644 src/calibre/gui2/viewer/ui.py delete mode 100644 src/calibre/utils/serve_coffee.py diff --git a/resources/coffee-script.js b/resources/coffee-script.js deleted file mode 100644 index fd33ca6455..0000000000 --- a/resources/coffee-script.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * CoffeeScript Compiler v1.9.3 - * http://coffeescript.org - * - * Copyright 2011, Jeremy Ashkenas - * Released under the MIT License - */ -(function(root){var CoffeeScript=function(){function require(e){return require[e]}return require["./helpers"]=function(){var e={},t={exports:e};return function(){var t,n,i,r,s,o;e.starts=function(e,t,n){return t===e.substr(n,t.length)},e.ends=function(e,t,n){var i;return i=t.length,t===e.substr(e.length-i-(n||0),i)},e.repeat=s=function(e,t){var n;for(n="";t>0;)1&t&&(n+=e),t>>>=1,e+=e;return n},e.compact=function(e){var t,n,i,r;for(r=[],t=0,i=e.length;i>t;t++)n=e[t],n&&r.push(n);return r},e.count=function(e,t){var n,i;if(n=i=0,!t.length)return 1/0;for(;i=1+e.indexOf(t,i);)n++;return n},e.merge=function(e,t){return n(n({},e),t)},n=e.extend=function(e,t){var n,i;for(n in t)i=t[n],e[n]=i;return e},e.flatten=i=function(e){var t,n,r,s;for(n=[],r=0,s=e.length;s>r;r++)t=e[r],t instanceof Array?n=n.concat(i(t)):n.push(t);return n},e.del=function(e,t){var n;return n=e[t],delete e[t],n},e.some=null!=(r=Array.prototype.some)?r:function(e){var t,n,i;for(n=0,i=this.length;i>n;n++)if(t=this[n],e(t))return!0;return!1},e.invertLiterate=function(e){var t,n,i;return i=!0,n=function(){var n,r,s,o;for(s=e.split("\n"),o=[],n=0,r=s.length;r>n;n++)t=s[n],i&&/^([ ]{4}|[ ]{0,3}\t)/.test(t)?o.push(t):(i=/^\s*$/.test(t))?o.push(t):o.push("# "+t);return o}(),n.join("\n")},t=function(e,t){return t?{first_line:e.first_line,first_column:e.first_column,last_line:t.last_line,last_column:t.last_column}:e},e.addLocationDataFn=function(e,n){return function(i){return"object"==typeof i&&i.updateLocationDataIfMissing&&i.updateLocationDataIfMissing(t(e,n)),i}},e.locationDataToString=function(e){var t;return"2"in e&&"first_line"in e[2]?t=e[2]:"first_line"in e&&(t=e),t?t.first_line+1+":"+(t.first_column+1)+"-"+(t.last_line+1+":"+(t.last_column+1)):"No location data"},e.baseFileName=function(e,t,n){var i,r;return null==t&&(t=!1),null==n&&(n=!1),r=n?/\\|\//:/\//,i=e.split(r),e=i[i.length-1],t&&e.indexOf(".")>=0?(i=e.split("."),i.pop(),"coffee"===i[i.length-1]&&i.length>1&&i.pop(),i.join(".")):e},e.isCoffee=function(e){return/\.((lit)?coffee|coffee\.md)$/.test(e)},e.isLiterate=function(e){return/\.(litcoffee|coffee\.md)$/.test(e)},e.throwSyntaxError=function(e,t){var n;throw n=new SyntaxError(e),n.location=t,n.toString=o,n.stack=""+n,n},e.updateSyntaxError=function(e,t,n){return e.toString===o&&(e.code||(e.code=t),e.filename||(e.filename=n),e.stack=""+e),e},o=function(){var e,t,n,i,r,o,a,c,h,l,u,p,d,f,m;return this.code&&this.location?(u=this.location,a=u.first_line,o=u.first_column,h=u.last_line,c=u.last_column,null==h&&(h=a),null==c&&(c=o),r=this.filename||"[stdin]",e=this.code.split("\n")[a],m=o,i=a===h?c+1:e.length,l=e.slice(0,m).replace(/[^\s]/g," ")+s("^",i-m),"undefined"!=typeof process&&null!==process&&(n=(null!=(p=process.stdout)?p.isTTY:void 0)&&!(null!=(d=process.env)?d.NODE_DISABLE_COLORS:void 0)),(null!=(f=this.colorful)?f:n)&&(t=function(e){return""+e+""},e=e.slice(0,m)+t(e.slice(m,i))+e.slice(i),l=t(l)),r+":"+(a+1)+":"+(o+1)+": error: "+this.message+"\n"+e+"\n"+l):Error.prototype.toString.call(this)},e.nameWhitespaceCharacter=function(e){switch(e){case" ":return"space";case"\n":return"newline";case"\r":return"carriage return";case" ":return"tab";default:return e}}}.call(this),t.exports}(),require["./rewriter"]=function(){var e={},t={exports:e};return function(){var t,n,i,r,s,o,a,c,h,l,u,p,d,f,m,g,v,y,b,k=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1},w=[].slice;for(f=function(e,t,n){var i;return i=[e,t],i.generated=!0,n&&(i.origin=n),i},e.Rewriter=function(){function e(){}return e.prototype.rewrite=function(e){return this.tokens=e,this.removeLeadingNewlines(),this.closeOpenCalls(),this.closeOpenIndexes(),this.normalizeLines(),this.tagPostfixConditionals(),this.addImplicitBracesAndParens(),this.addLocationDataToGeneratedTokens(),this.tokens},e.prototype.scanTokens=function(e){var t,n,i;for(i=this.tokens,t=0;n=i[t];)t+=e.call(this,n,t,i);return!0},e.prototype.detectEnd=function(e,t,n){var i,o,a,c,h;for(h=this.tokens,i=0;c=h[e];){if(0===i&&t.call(this,c,e))return n.call(this,c,e);if(!c||0>i)return n.call(this,c,e-1);o=c[0],k.call(s,o)>=0?i+=1:(a=c[0],k.call(r,a)>=0&&(i-=1)),e+=1}return e-1},e.prototype.removeLeadingNewlines=function(){var e,t,n,i,r;for(i=this.tokens,e=t=0,n=i.length;n>t&&(r=i[e][0],"TERMINATOR"===r);e=++t);return e?this.tokens.splice(0,e):void 0},e.prototype.closeOpenCalls=function(){var e,t;return t=function(e,t){var n;return")"===(n=e[0])||"CALL_END"===n||"OUTDENT"===e[0]&&")"===this.tag(t-1)},e=function(e,t){return this.tokens["OUTDENT"===e[0]?t-1:t][0]="CALL_END"},this.scanTokens(function(n,i){return"CALL_START"===n[0]&&this.detectEnd(i+1,t,e),1})},e.prototype.closeOpenIndexes=function(){var e,t;return t=function(e){var t;return"]"===(t=e[0])||"INDEX_END"===t},e=function(e){return e[0]="INDEX_END"},this.scanTokens(function(n,i){return"INDEX_START"===n[0]&&this.detectEnd(i+1,t,e),1})},e.prototype.indexOfTag=function(){var e,t,n,i,r,s,o;for(t=arguments[0],r=arguments.length>=2?w.call(arguments,1):[],e=0,n=i=0,s=r.length;s>=0?s>i:i>s;n=s>=0?++i:--i){for(;"HERECOMMENT"===this.tag(t+n+e);)e+=2;if(null!=r[n]&&("string"==typeof r[n]&&(r[n]=[r[n]]),o=this.tag(t+n+e),0>k.call(r[n],o)))return-1}return t+n+e-1},e.prototype.looksObjectish=function(e){var t,n;return this.indexOfTag(e,"@",null,":")>-1||this.indexOfTag(e,null,":")>-1?!0:(n=this.indexOfTag(e,s),n>-1&&(t=null,this.detectEnd(n+1,function(e){var t;return t=e[0],k.call(r,t)>=0},function(e,n){return t=n}),":"===this.tag(t+1))?!0:!1)},e.prototype.findTagsBackwards=function(e,t){var n,i,o,a,c,h,l;for(n=[];e>=0&&(n.length||(a=this.tag(e),0>k.call(t,a)&&(c=this.tag(e),0>k.call(s,c)||this.tokens[e].generated)&&(h=this.tag(e),0>k.call(u,h))));)i=this.tag(e),k.call(r,i)>=0&&n.push(this.tag(e)),o=this.tag(e),k.call(s,o)>=0&&n.length&&n.pop(),e-=1;return l=this.tag(e),k.call(t,l)>=0},e.prototype.addImplicitBracesAndParens=function(){var e,t;return e=[],t=null,this.scanTokens(function(i,l,p){var d,m,g,v,y,b,w,T,C,E,F,N,L,x,S,D,R,A,I,_,O,$,j,M,B,V,P,U;if(U=i[0],F=(N=l>0?p[l-1]:[])[0],C=(p.length-1>l?p[l+1]:[])[0],j=function(){return e[e.length-1]},M=l,g=function(e){return l-M+e},v=function(){var e,t;return null!=(e=j())?null!=(t=e[2])?t.ours:void 0:void 0},y=function(){var e;return v()&&"("===(null!=(e=j())?e[0]:void 0)},w=function(){var e;return v()&&"{"===(null!=(e=j())?e[0]:void 0)},b=function(){var e;return v&&"CONTROL"===(null!=(e=j())?e[0]:void 0)},B=function(t){var n;return n=null!=t?t:l,e.push(["(",n,{ours:!0}]),p.splice(n,0,f("CALL_START","(")),null==t?l+=1:void 0},d=function(){return e.pop(),p.splice(l,0,f("CALL_END",")",["","end of input",i[2]])),l+=1},V=function(t,n){var r,s;return null==n&&(n=!0),r=null!=t?t:l,e.push(["{",r,{sameLine:!0,startsLine:n,ours:!0}]),s=new String("{"),s.generated=!0,p.splice(r,0,f("{",s,i)),null==t?l+=1:void 0},m=function(t){return t=null!=t?t:l,e.pop(),p.splice(t,0,f("}","}",i)),l+=1},y()&&("IF"===U||"TRY"===U||"FINALLY"===U||"CATCH"===U||"CLASS"===U||"SWITCH"===U))return e.push(["CONTROL",l,{ours:!0}]),g(1);if("INDENT"===U&&v()){if("=>"!==F&&"->"!==F&&"["!==F&&"("!==F&&","!==F&&"{"!==F&&"TRY"!==F&&"ELSE"!==F&&"="!==F)for(;y();)d();return b()&&e.pop(),e.push([U,l]),g(1)}if(k.call(s,U)>=0)return e.push([U,l]),g(1);if(k.call(r,U)>=0){for(;v();)y()?d():w()?m():e.pop();t=e.pop()}if((k.call(c,U)>=0&&i.spaced||"?"===U&&l>0&&!p[l-1].spaced)&&(k.call(o,C)>=0||k.call(h,C)>=0&&!(null!=(L=p[l+1])?L.spaced:void 0)&&!(null!=(x=p[l+1])?x.newLine:void 0)))return"?"===U&&(U=i[0]="FUNC_EXIST"),B(l+1),g(2);if(k.call(c,U)>=0&&this.indexOfTag(l+1,"INDENT")>-1&&this.looksObjectish(l+2)&&!this.findTagsBackwards(l,["CLASS","EXTENDS","IF","CATCH","SWITCH","LEADING_WHEN","FOR","WHILE","UNTIL"]))return B(l+1),e.push(["INDENT",l+2]),g(3);if(":"===U){for(I=function(){var e;switch(!1){case e=this.tag(l-1),0>k.call(r,e):return t[1];case"@"!==this.tag(l-2):return l-2;default:return l-1}}.call(this);"HERECOMMENT"===this.tag(I-2);)I-=2;return this.insideForDeclaration="FOR"===C,P=0===I||(S=this.tag(I-1),k.call(u,S)>=0)||p[I-1].newLine,j()&&(D=j(),$=D[0],O=D[1],("{"===$||"INDENT"===$&&"{"===this.tag(O-1))&&(P||","===this.tag(I-1)||"{"===this.tag(I-1)))?g(1):(V(I,!!P),g(2))}if(w()&&k.call(u,U)>=0&&(j()[2].sameLine=!1),T="OUTDENT"===F||N.newLine,k.call(a,U)>=0||k.call(n,U)>=0&&T)for(;v();)if(R=j(),$=R[0],O=R[1],A=R[2],_=A.sameLine,P=A.startsLine,y()&&","!==F)d();else if(w()&&!this.insideForDeclaration&&_&&"TERMINATOR"!==U&&":"!==F)m();else{if(!w()||"TERMINATOR"!==U||","===F||P&&this.looksObjectish(l+1))break;if("HERECOMMENT"===C)return g(1);m()}if(!(","!==U||this.looksObjectish(l+1)||!w()||this.insideForDeclaration||"TERMINATOR"===C&&this.looksObjectish(l+2)))for(E="OUTDENT"===C?1:0;w();)m(l+E);return g(1)})},e.prototype.addLocationDataToGeneratedTokens=function(){return this.scanTokens(function(e,t,n){var i,r,s,o,a,c;return e[2]?1:e.generated||e.explicit?("{"===e[0]&&(s=null!=(a=n[t+1])?a[2]:void 0)?(r=s.first_line,i=s.first_column):(o=null!=(c=n[t-1])?c[2]:void 0)?(r=o.last_line,i=o.last_column):r=i=0,e[2]={first_line:r,first_column:i,last_line:r,last_column:i},1):1})},e.prototype.normalizeLines=function(){var e,t,r,s,o;return o=r=s=null,t=function(e,t){var r,s,a,c;return";"!==e[1]&&(r=e[0],k.call(p,r)>=0)&&!("TERMINATOR"===e[0]&&(s=this.tag(t+1),k.call(i,s)>=0))&&!("ELSE"===e[0]&&"THEN"!==o)&&!!("CATCH"!==(a=e[0])&&"FINALLY"!==a||"->"!==o&&"=>"!==o)||(c=e[0],k.call(n,c)>=0&&this.tokens[t-1].newLine)},e=function(e,t){return this.tokens.splice(","===this.tag(t-1)?t-1:t,0,s)},this.scanTokens(function(n,a,c){var h,l,u,p,f,m;if(m=n[0],"TERMINATOR"===m){if("ELSE"===this.tag(a+1)&&"OUTDENT"!==this.tag(a-1))return c.splice.apply(c,[a,1].concat(w.call(this.indentation()))),1;if(u=this.tag(a+1),k.call(i,u)>=0)return c.splice(a,1),0}if("CATCH"===m)for(h=l=1;2>=l;h=++l)if("OUTDENT"===(p=this.tag(a+h))||"TERMINATOR"===p||"FINALLY"===p)return c.splice.apply(c,[a+h,0].concat(w.call(this.indentation()))),2+h;return k.call(d,m)>=0&&"INDENT"!==this.tag(a+1)&&("ELSE"!==m||"IF"!==this.tag(a+1))?(o=m,f=this.indentation(c[a]),r=f[0],s=f[1],"THEN"===o&&(r.fromThen=!0),c.splice(a+1,0,r),this.detectEnd(a+2,t,e),"THEN"===m&&c.splice(a,1),1):1})},e.prototype.tagPostfixConditionals=function(){var e,t,n;return n=null,t=function(e,t){var n,i;return i=e[0],n=this.tokens[t-1][0],"TERMINATOR"===i||"INDENT"===i&&0>k.call(d,n)},e=function(e){return"INDENT"!==e[0]||e.generated&&!e.fromThen?n[0]="POST_"+n[0]:void 0},this.scanTokens(function(i,r){return"IF"!==i[0]?1:(n=i,this.detectEnd(r+1,t,e),1)})},e.prototype.indentation=function(e){var t,n;return t=["INDENT",2],n=["OUTDENT",2],e?(t.generated=n.generated=!0,t.origin=n.origin=e):t.explicit=n.explicit=!0,[t,n]},e.prototype.generate=f,e.prototype.tag=function(e){var t;return null!=(t=this.tokens[e])?t[0]:void 0},e}(),t=[["(",")"],["[","]"],["{","}"],["INDENT","OUTDENT"],["CALL_START","CALL_END"],["PARAM_START","PARAM_END"],["INDEX_START","INDEX_END"],["STRING_START","STRING_END"],["REGEX_START","REGEX_END"]],e.INVERSES=l={},s=[],r=[],m=0,v=t.length;v>m;m++)y=t[m],g=y[0],b=y[1],s.push(l[b]=g),r.push(l[g]=b);i=["CATCH","THEN","ELSE","FINALLY"].concat(r),c=["IDENTIFIER","SUPER",")","CALL_END","]","INDEX_END","@","THIS"],o=["IDENTIFIER","NUMBER","STRING","STRING_START","JS","REGEX","REGEX_START","NEW","PARAM_START","CLASS","IF","TRY","SWITCH","THIS","BOOL","NULL","UNDEFINED","UNARY","YIELD","UNARY_MATH","SUPER","THROW","@","->","=>","[","(","{","--","++"],h=["+","-"],a=["POST_IF","FOR","WHILE","UNTIL","WHEN","BY","LOOP","TERMINATOR"],d=["ELSE","->","=>","TRY","FINALLY","THEN"],p=["TERMINATOR","CATCH","FINALLY","ELSE","OUTDENT","LEADING_WHEN"],u=["TERMINATOR","INDENT","OUTDENT"],n=[".","?.","::","?::"]}.call(this),t.exports}(),require["./lexer"]=function(){var e={},t={exports:e};return function(){var t,n,i,r,s,o,a,c,h,l,u,p,d,f,m,g,v,y,b,k,w,T,C,E,F,N,L,x,S,D,R,A,I,_,O,$,j,M,B,V,P,U,G,H,q,X,W,Y,K,z,J,Q,Z,et,tt,nt,it,rt,st,ot,at,ct,ht,lt,ut=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};ot=require("./rewriter"),P=ot.Rewriter,w=ot.INVERSES,at=require("./helpers"),nt=at.count,ht=at.starts,tt=at.compact,ct=at.repeat,it=at.invertLiterate,st=at.locationDataToString,lt=at.throwSyntaxError,e.Lexer=S=function(){function e(){}return e.prototype.tokenize=function(e,t){var n,i,r,s;for(null==t&&(t={}),this.literate=t.literate,this.indent=0,this.baseIndent=0,this.indebt=0,this.outdebt=0,this.indents=[],this.ends=[],this.tokens=[],this.chunkLine=t.line||0,this.chunkColumn=t.column||0,e=this.clean(e),r=0;this.chunk=e.slice(r);)if(n=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.stringToken()||this.numberToken()||this.regexToken()||this.jsToken()||this.literalToken(),s=this.getLineAndColumnFromChunk(n),this.chunkLine=s[0],this.chunkColumn=s[1],r+=n,t.untilBalanced&&0===this.ends.length)return{tokens:this.tokens,index:r};return this.closeIndentation(),(i=this.ends.pop())&&this.error("missing "+i.tag,i.origin[2]),t.rewrite===!1?this.tokens:(new P).rewrite(this.tokens)},e.prototype.clean=function(e){return e.charCodeAt(0)===t&&(e=e.slice(1)),e=e.replace(/\r/g,"").replace(z,""),et.test(e)&&(e="\n"+e,this.chunkLine--),this.literate&&(e=it(e)),e},e.prototype.identifierToken=function(){var e,t,n,i,r,c,h,l,u,p,d,f,m,g,y,b;return(l=v.exec(this.chunk))?(h=l[0],r=l[1],t=l[2],c=r.length,u=void 0,"own"===r&&"FOR"===this.tag()?(this.token("OWN",r),r.length):"from"===r&&"YIELD"===this.tag()?(this.token("FROM",r),r.length):(d=this.tokens,p=d[d.length-1],i=t||null!=p&&("."===(f=p[0])||"?."===f||"::"===f||"?::"===f||!p.spaced&&"@"===p[0]),y="IDENTIFIER",!i&&(ut.call(E,r)>=0||ut.call(a,r)>=0)&&(y=r.toUpperCase(),"WHEN"===y&&(m=this.tag(),ut.call(N,m)>=0)?y="LEADING_WHEN":"FOR"===y?this.seenFor=!0:"UNLESS"===y?y="IF":ut.call(J,y)>=0?y="UNARY":ut.call(B,y)>=0&&("INSTANCEOF"!==y&&this.seenFor?(y="FOR"+y,this.seenFor=!1):(y="RELATION","!"===this.value()&&(u=this.tokens.pop(),r="!"+r)))),ut.call(C,r)>=0&&(i?(y="IDENTIFIER",r=new String(r),r.reserved=!0):ut.call(V,r)>=0&&this.error("reserved word '"+r+"'",{length:r.length})),i||(ut.call(s,r)>=0&&(e=r,r=o[r]),y=function(){switch(r){case"!":return"UNARY";case"==":case"!=":return"COMPARE";case"&&":case"||":return"LOGIC";case"true":case"false":return"BOOL";case"break":case"continue":return"STATEMENT";default:return y}}()),b=this.token(y,r,0,c),e&&(b.origin=[y,e,b[2]]),b.variable=!i,u&&(g=[u[2].first_line,u[2].first_column],b[2].first_line=g[0],b[2].first_column=g[1]),t&&(n=h.lastIndexOf(":"),this.token(":",":",n,t.length)),h.length)):0},e.prototype.numberToken=function(){var e,t,n,i,r;return(n=I.exec(this.chunk))?(i=n[0],t=i.length,/^0[BOX]/.test(i)?this.error("radix prefix in '"+i+"' must be lowercase",{offset:1}):/E/.test(i)&&!/^0x/.test(i)?this.error("exponential notation in '"+i+"' must be indicated with a lowercase 'e'",{offset:i.indexOf("E")}):/^0\d*[89]/.test(i)?this.error("decimal literal '"+i+"' must not be prefixed with '0'",{length:t}):/^0\d+/.test(i)&&this.error("octal literal '"+i+"' must be prefixed with '0o'",{length:t}),(r=/^0o([0-7]+)/.exec(i))&&(i="0x"+parseInt(r[1],8).toString(16)),(e=/^0b([01]+)/.exec(i))&&(i="0x"+parseInt(e[1],2).toString(16)),this.token("NUMBER",i,0,t),t):0},e.prototype.stringToken=function(){var e,t,n,i,r,s,o,a,c,h,l,u,m,g,v,y;if(l=(Y.exec(this.chunk)||[])[0],!l)return 0;if(g=function(){switch(l){case"'":return W;case'"':return q;case"'''":return f;case'"""':return p}}(),s=3===l.length,u=this.matchWithInterpolations(g,l),y=u.tokens,r=u.index,e=y.length-1,n=l.charAt(0),s){for(a=null,i=function(){var e,t,n;for(n=[],o=e=0,t=y.length;t>e;o=++e)v=y[o],"NEOSTRING"===v[0]&&n.push(v[1]);return n}().join("#{}");h=d.exec(i);)t=h[1],(null===a||(m=t.length)>0&&a.length>m)&&(a=t);a&&(c=RegExp("^"+a,"gm")),this.mergeInterpolationTokens(y,{delimiter:n},function(t){return function(n,i){return n=t.formatString(n),0===i&&(n=n.replace(F,"")),i===e&&(n=n.replace(K,"")),c&&(n=n.replace(c,"")),n}}(this))}else this.mergeInterpolationTokens(y,{delimiter:n},function(t){return function(n,i){return n=t.formatString(n),n=n.replace(G,function(t,r){return 0===i&&0===r||i===e&&r+t.length===n.length?"":" "})}}(this));return r},e.prototype.commentToken=function(){var e,t,n;return(n=this.chunk.match(c))?(e=n[0],t=n[1],t&&((n=u.exec(e))&&this.error("block comments cannot contain "+n[0],{offset:n.index,length:n[0].length}),t.indexOf("\n")>=0&&(t=t.replace(RegExp("\\n"+ct(" ",this.indent),"g"),"\n")),this.token("HERECOMMENT",t,0,e.length)),e.length):0},e.prototype.jsToken=function(){var e,t;return"`"===this.chunk.charAt(0)&&(e=T.exec(this.chunk))?(this.token("JS",(t=e[0]).slice(1,-1),0,t.length),t.length):0},e.prototype.regexToken=function(){var e,t,n,r,s,o,a,c,h,l,u,p,d;switch(!1){case!(o=M.exec(this.chunk)):this.error("regular expressions cannot begin with "+o[2],{offset:o.index+o[1].length});break;case!(o=this.matchWithInterpolations(m,"///")):d=o.tokens,s=o.index;break;case!(o=$.exec(this.chunk)):if(p=o[0],e=o[1],t=o[2],this.validateEscapes(e,{isRegex:!0,offsetInChunk:1}),s=p.length,h=this.tokens,c=h[h.length-1],c)if(c.spaced&&(l=c[0],ut.call(i,l)>=0)){if(!t||O.test(p))return 0}else if(u=c[0],ut.call(A,u)>=0)return 0;t||this.error("missing / (unclosed regex)");break;default:return 0}switch(r=j.exec(this.chunk.slice(s))[0],n=s+r.length,a=this.makeToken("REGEX",null,0,n),!1){case!!Z.test(r):this.error("invalid regular expression flags "+r,{offset:s,length:r.length});break;case!(p||1===d.length):null==e&&(e=this.formatHeregex(d[0][1])),this.token("REGEX",""+this.makeDelimitedLiteral(e,{delimiter:"/"})+r,0,n,a);break;default:this.token("REGEX_START","(",0,0,a),this.token("IDENTIFIER","RegExp",0,0),this.token("CALL_START","(",0,0),this.mergeInterpolationTokens(d,{delimiter:'"',"double":!0},this.formatHeregex),r&&(this.token(",",",",s,0),this.token("STRING",'"'+r+'"',s,r.length)),this.token(")",")",n,0),this.token("REGEX_END",")",n,0)}return n},e.prototype.lineToken=function(){var e,t,n,i,r;if(!(n=R.exec(this.chunk)))return 0;if(t=n[0],this.seenFor=!1,r=t.length-1-t.lastIndexOf("\n"),i=this.unfinished(),r-this.indebt===this.indent)return i?this.suppressNewlines():this.newlineToken(0),t.length;if(r>this.indent){if(i)return this.indebt=r-this.indent,this.suppressNewlines(),t.length;if(!this.tokens.length)return this.baseIndent=this.indent=r,t.length;e=r-this.indent+this.outdebt,this.token("INDENT",e,t.length-r,r),this.indents.push(e),this.ends.push({tag:"OUTDENT"}),this.outdebt=this.indebt=0,this.indent=r}else this.baseIndent>r?this.error("missing indentation",{offset:t.length}):(this.indebt=0,this.outdentToken(this.indent-r,i,t.length));return t.length},e.prototype.outdentToken=function(e,t,n){var i,r,s,o;for(i=this.indent-e;e>0;)s=this.indents[this.indents.length-1],s?s===this.outdebt?(e-=this.outdebt,this.outdebt=0):this.outdebt>s?(this.outdebt-=s,e-=s):(r=this.indents.pop()+this.outdebt,n&&(o=this.chunk[n],ut.call(y,o)>=0)&&(i-=r-e,e=r),this.outdebt=0,this.pair("OUTDENT"),this.token("OUTDENT",e,0,n),e-=r):e=0;for(r&&(this.outdebt-=e);";"===this.value();)this.tokens.pop();return"TERMINATOR"===this.tag()||t||this.token("TERMINATOR","\n",n,0),this.indent=i,this},e.prototype.whitespaceToken=function(){var e,t,n,i;return(e=et.exec(this.chunk))||(t="\n"===this.chunk.charAt(0))?(i=this.tokens,n=i[i.length-1],n&&(n[e?"spaced":"newLine"]=!0),e?e[0].length:0):0},e.prototype.newlineToken=function(e){for(;";"===this.value();)this.tokens.pop();return"TERMINATOR"!==this.tag()&&this.token("TERMINATOR","\n",e,0),this},e.prototype.suppressNewlines=function(){return"\\"===this.value()&&this.tokens.pop(),this},e.prototype.literalToken=function(){var e,t,n,s,o,a,c,u,p,d;if((e=_.exec(this.chunk))?(d=e[0],r.test(d)&&this.tagParameters()):d=this.chunk.charAt(0),u=d,n=this.tokens,t=n[n.length-1],"="===d&&t&&(!t[1].reserved&&(s=t[1],ut.call(C,s)>=0)&&(t.origin&&(t=t.origin),this.error("reserved word '"+t[1]+"' can't be assigned",t[2])),"||"===(o=t[1])||"&&"===o))return t[0]="COMPOUND_ASSIGN",t[1]+="=",d.length;if(";"===d)this.seenFor=!1,u="TERMINATOR";else if(ut.call(D,d)>=0)u="MATH";else if(ut.call(h,d)>=0)u="COMPARE";else if(ut.call(l,d)>=0)u="COMPOUND_ASSIGN";else if(ut.call(J,d)>=0)u="UNARY";else if(ut.call(Q,d)>=0)u="UNARY_MATH";else if(ut.call(U,d)>=0)u="SHIFT";else if(ut.call(x,d)>=0||"?"===d&&(null!=t?t.spaced:void 0))u="LOGIC";else if(t&&!t.spaced)if("("===d&&(a=t[0],ut.call(i,a)>=0))"?"===t[0]&&(t[0]="FUNC_EXIST"),u="CALL_START";else if("["===d&&(c=t[0],ut.call(b,c)>=0))switch(u="INDEX_START",t[0]){case"?":t[0]="INDEX_SOAK"}switch(p=this.makeToken(u,d),d){case"(":case"{":case"[":this.ends.push({tag:w[d],origin:p});break;case")":case"}":case"]":this.pair(d)}return this.tokens.push(p),d.length},e.prototype.tagParameters=function(){var e,t,n,i;if(")"!==this.tag())return this;for(t=[],i=this.tokens,e=i.length,i[--e][0]="PARAM_END";n=i[--e];)switch(n[0]){case")":t.push(n);break;case"(":case"CALL_START":if(!t.length)return"("===n[0]?(n[0]="PARAM_START",this):this;t.pop()}return this},e.prototype.closeIndentation=function(){return this.outdentToken(this.indent)},e.prototype.matchWithInterpolations=function(t,n){var i,r,s,o,a,c,h,l,u,p,d,f,m,g,v;if(v=[],l=n.length,this.chunk.slice(0,l)!==n)return null;for(m=this.chunk.slice(l);;){if(g=t.exec(m)[0],this.validateEscapes(g,{isRegex:"/"===n.charAt(0),offsetInChunk:l}),v.push(this.makeToken("NEOSTRING",g,l)),m=m.slice(g.length),l+=g.length,"#{"!==m.slice(0,2))break;p=this.getLineAndColumnFromChunk(l+1),c=p[0],r=p[1],d=(new e).tokenize(m.slice(1),{line:c,column:r,untilBalanced:!0}),h=d.tokens,o=d.index,o+=1,u=h[0],i=h[h.length-1],u[0]=u[1]="(",i[0]=i[1]=")",i.origin=["","end of interpolation",i[2]],"TERMINATOR"===(null!=(f=h[1])?f[0]:void 0)&&h.splice(1,1),v.push(["TOKENS",h]),m=m.slice(o),l+=o}return m.slice(0,n.length)!==n&&this.error("missing "+n,{length:n.length}),s=v[0],a=v[v.length-1],s[2].first_column-=n.length,a[2].last_column+=n.length,0===a[1].length&&(a[2].last_column-=1),{tokens:v,index:l+n.length}},e.prototype.mergeInterpolationTokens=function(e,t,n){var i,r,s,o,a,c,h,l,u,p,d,f,m,g,v,y;for(e.length>1&&(u=this.token("STRING_START","(",0,0)),s=this.tokens.length,o=a=0,h=e.length;h>a;o=++a){switch(g=e[o],m=g[0],y=g[1],m){case"TOKENS":if(2===y.length)continue;l=y[0],v=y;break;case"NEOSTRING":if(i=n(g[1],o),0===i.length){if(0!==o)continue;r=this.tokens.length}2===o&&null!=r&&this.tokens.splice(r,2),g[0]="STRING",g[1]=this.makeDelimitedLiteral(i,t),l=g,v=[g]}this.tokens.length>s&&(p=this.token("+","+"),p[2]={first_line:l[2].first_line,first_column:l[2].first_column,last_line:l[2].first_line,last_column:l[2].first_column}),(d=this.tokens).push.apply(d,v)}return u?(c=e[e.length-1],u.origin=["STRING",null,{first_line:u[2].first_line,first_column:u[2].first_column,last_line:c[2].last_line,last_column:c[2].last_column}],f=this.token("STRING_END",")"),f[2]={first_line:c[2].last_line,first_column:c[2].last_column,last_line:c[2].last_line,last_column:c[2].last_column}):void 0},e.prototype.pair=function(e){var t,n,i,r,s;return i=this.ends,n=i[i.length-1],e!==(s=null!=n?n.tag:void 0)?("OUTDENT"!==s&&this.error("unmatched "+e),r=this.indents,t=r[r.length-1],this.outdentToken(t,!0),this.pair(e)):this.ends.pop()},e.prototype.getLineAndColumnFromChunk=function(e){var t,n,i,r,s;return 0===e?[this.chunkLine,this.chunkColumn]:(s=e>=this.chunk.length?this.chunk:this.chunk.slice(0,+(e-1)+1||9e9),i=nt(s,"\n"),t=this.chunkColumn,i>0?(r=s.split("\n"),n=r[r.length-1],t=n.length):t+=s.length,[this.chunkLine+i,t])},e.prototype.makeToken=function(e,t,n,i){var r,s,o,a,c;return null==n&&(n=0),null==i&&(i=t.length),s={},o=this.getLineAndColumnFromChunk(n),s.first_line=o[0],s.first_column=o[1],r=Math.max(0,i-1),a=this.getLineAndColumnFromChunk(n+r),s.last_line=a[0],s.last_column=a[1],c=[e,t,s]},e.prototype.token=function(e,t,n,i,r){var s;return s=this.makeToken(e,t,n,i),r&&(s.origin=r),this.tokens.push(s),s},e.prototype.tag=function(){var e,t;return e=this.tokens,t=e[e.length-1],null!=t?t[0]:void 0},e.prototype.value=function(){var e,t;return e=this.tokens,t=e[e.length-1],null!=t?t[1]:void 0},e.prototype.unfinished=function(){var e;return L.test(this.chunk)||"\\"===(e=this.tag())||"."===e||"?."===e||"?::"===e||"UNARY"===e||"MATH"===e||"UNARY_MATH"===e||"+"===e||"-"===e||"YIELD"===e||"**"===e||"SHIFT"===e||"RELATION"===e||"COMPARE"===e||"LOGIC"===e||"THROW"===e||"EXTENDS"===e},e.prototype.formatString=function(e){return e.replace(X,"$1")},e.prototype.formatHeregex=function(e){return e.replace(g,"$1$2")},e.prototype.validateEscapes=function(e,t){var n,i,r,s,o,a,c,h;return null==t&&(t={}),s=k.exec(e),!s||(s[0],n=s[1],a=s[2],i=s[3],h=s[4],t.isRegex&&a&&"0"!==a.charAt(0))?void 0:(o=a?"octal escape sequences are not allowed":"invalid escape sequence",r="\\"+(a||i||h),this.error(o+" "+r,{offset:(null!=(c=t.offsetInChunk)?c:0)+s.index+n.length,length:r.length}))},e.prototype.makeDelimitedLiteral=function(e,t){var n;return null==t&&(t={}),""===e&&"/"===t.delimiter&&(e="(?:)"),n=RegExp("(\\\\\\\\)|(\\\\0(?=[1-7]))|\\\\?("+t.delimiter+")|\\\\?(?:(\\n)|(\\r)|(\\u2028)|(\\u2029))|(\\\\.)","g"),e=e.replace(n,function(e,n,i,r,s,o,a,c,h){switch(!1){case!n:return t.double?n+n:n;case!i:return"\\x00";case!r:return"\\"+r;case!s:return"\\n";case!o:return"\\r";case!a:return"\\u2028";case!c:return"\\u2029";case!h:return t.double?"\\"+h:h}}),""+t.delimiter+e+t.delimiter},e.prototype.error=function(e,t){var n,i,r,s,o,a;return null==t&&(t={}),r="first_line"in t?t:(o=this.getLineAndColumnFromChunk(null!=(s=t.offset)?s:0),i=o[0],n=o[1],o,{first_line:i,first_column:n,last_column:n+(null!=(a=t.length)?a:1)-1}),lt(e,r)},e}(),E=["true","false","null","this","new","delete","typeof","in","instanceof","return","throw","break","continue","debugger","yield","if","else","switch","for","while","do","try","catch","finally","class","extends","super"],a=["undefined","then","unless","until","loop","of","by","when"],o={and:"&&",or:"||",is:"==",isnt:"!=",not:"!",yes:"true",no:"false",on:"true",off:"false"},s=function(){var e;e=[];for(rt in o)e.push(rt);return e}(),a=a.concat(s),V=["case","default","function","var","void","with","const","let","enum","export","import","native","implements","interface","package","private","protected","public","static"],H=["arguments","eval","yield*"],C=E.concat(V).concat(H),e.RESERVED=V.concat(E).concat(a).concat(H),e.STRICT_PROSCRIBED=H,t=65279,v=/^(?!\d)((?:(?!\s)[$\w\x7f-\uffff])+)([^\n\S]*:(?!:))?/,I=/^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i,_=/^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>*\/%])\2=?|\?(\.|::)|\.{2,3})/,et=/^[^\n\S]+/,c=/^###([^#][\s\S]*?)(?:###[^\n\S]*|###$)|^(?:\s*#(?!##[^#]).*)+/,r=/^[-=]>/,R=/^(?:\n[^\n\S]*)+/,T=/^`[^\\`]*(?:\\.[^\\`]*)*`/,Y=/^(?:'''|"""|'|")/,W=/^(?:[^\\']|\\[\s\S])*/,q=/^(?:[^\\"#]|\\[\s\S]|\#(?!\{))*/,f=/^(?:[^\\']|\\[\s\S]|'(?!''))*/,p=/^(?:[^\\"#]|\\[\s\S]|"(?!"")|\#(?!\{))*/,X=/((?:\\\\)+)|\\[^\S\n]*\n\s*/g,G=/\s*\n\s*/g,d=/\n+([^\n\S]*)(?=\S)/g,$=/^\/(?!\/)((?:[^[\/\n\\]|\\[^\n]|\[(?:\\[^\n]|[^\]\n\\])*\])*)(\/)?/,j=/^\w*/,Z=/^(?!.*(.).*\1)[imgy]*$/,m=/^(?:[^\\\/#]|\\[\s\S]|\/(?!\/\/)|\#(?!\{))*/,g=/((?:\\\\)+)|\\(\s)|\s+(?:#.*)?/g,M=/^(\/|\/{3}\s*)(\*)/,O=/^\/=?\s/,u=/\*\//,L=/^\s*(?:,|\??\.(?![.\d])|::)/,k=/((?:^|[^\\])(?:\\\\)*)\\(?:(0[0-7]|[1-7])|(x(?![\da-fA-F]{2}).{0,2})|(u(?![\da-fA-F]{4}).{0,4}))/,F=/^[^\n\S]*\n/,K=/\n[^\n\S]*$/,z=/\s+$/,l=["-=","+=","/=","*=","%=","||=","&&=","?=","<<=",">>=",">>>=","&=","^=","|=","**=","//=","%%="],J=["NEW","TYPEOF","DELETE","DO"],Q=["!","~"],x=["&&","||","&","|","^"],U=["<<",">>",">>>"],h=["==","!=","<",">","<=",">="],D=["*","/","%","//","%%"],B=["IN","OF","INSTANCEOF"],n=["TRUE","FALSE"],i=["IDENTIFIER",")","]","?","@","THIS","SUPER"],b=i.concat(["NUMBER","STRING","STRING_END","REGEX","REGEX_END","BOOL","NULL","UNDEFINED","}","::"]),A=b.concat(["++","--"]),N=["INDENT","OUTDENT","TERMINATOR"],y=[")","}","]"]}.call(this),t.exports}(),require["./parser"]=function(){var e={},t={exports:e},n=function(){function e(){this.yy={}}var t=function(e,t,n,i){for(n=n||{},i=e.length;i--;n[e[i]]=t);return n},n=[1,20],i=[1,75],r=[1,71],s=[1,76],o=[1,77],a=[1,73],c=[1,74],h=[1,50],l=[1,52],u=[1,53],p=[1,54],d=[1,55],f=[1,45],m=[1,46],g=[1,27],v=[1,60],y=[1,61],b=[1,70],k=[1,43],w=[1,26],T=[1,58],C=[1,59],E=[1,57],F=[1,38],N=[1,44],L=[1,56],x=[1,65],S=[1,66],D=[1,67],R=[1,68],A=[1,42],I=[1,64],_=[1,29],O=[1,30],$=[1,31],j=[1,32],M=[1,33],B=[1,34],V=[1,35],P=[1,78],U=[1,6,26,34,108],G=[1,88],H=[1,81],q=[1,80],X=[1,79],W=[1,82],Y=[1,83],K=[1,84],z=[1,85],J=[1,86],Q=[1,87],Z=[1,91],et=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],tt=[1,97],nt=[1,98],it=[1,99],rt=[1,100],st=[1,102],ot=[1,103],at=[1,96],ct=[2,112],ht=[1,6,25,26,34,55,60,63,72,73,74,75,77,79,80,84,90,91,92,97,99,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],lt=[2,79],ut=[1,108],pt=[2,58],dt=[1,112],ft=[1,117],mt=[1,118],gt=[1,120],vt=[1,6,25,26,34,46,55,60,63,72,73,74,75,77,79,80,84,90,91,92,97,99,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],yt=[2,76],bt=[1,6,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],kt=[1,155],wt=[1,157],Tt=[1,152],Ct=[1,6,25,26,34,46,55,60,63,72,73,74,75,77,79,80,84,86,90,91,92,97,99,108,110,111,112,116,117,132,135,136,139,140,141,142,143,144,145,146,147,148],Et=[2,95],Ft=[1,6,25,26,34,49,55,60,63,72,73,74,75,77,79,80,84,90,91,92,97,99,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],Nt=[1,6,25,26,34,46,49,55,60,63,72,73,74,75,77,79,80,84,86,90,91,92,97,99,108,110,111,112,116,117,123,124,132,135,136,139,140,141,142,143,144,145,146,147,148],Lt=[1,206],xt=[1,205],St=[1,6,25,26,34,38,55,60,63,72,73,74,75,77,79,80,84,90,91,92,97,99,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],Dt=[2,56],Rt=[1,216],At=[6,25,26,55,60],It=[6,25,26,46,55,60,63],_t=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,135,136,142,144,145,146,147],Ot=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132],$t=[72,73,74,75,77,80,90,91],jt=[1,235],Mt=[2,133],Bt=[1,6,25,26,34,46,55,60,63,72,73,74,75,77,79,80,84,90,91,92,97,99,108,110,111,112,116,117,123,124,132,135,136,141,142,143,144,145,146,147],Vt=[1,244],Pt=[6,25,26,60,92,97],Ut=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,117,132],Gt=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,111,117,132],Ht=[123,124],qt=[60,123,124],Xt=[1,255],Wt=[6,25,26,60,84],Yt=[6,25,26,49,60,84],Kt=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,135,136,144,145,146,147],zt=[11,28,30,32,33,36,37,40,41,42,43,44,51,52,53,57,58,79,82,85,89,94,95,96,102,106,107,110,112,114,116,125,131,133,134,135,136,137,139,140],Jt=[2,122],Qt=[6,25,26],Zt=[2,57],en=[1,268],tn=[1,269],nn=[1,6,25,26,34,55,60,63,79,84,92,97,99,104,105,108,110,111,112,116,117,127,129,132,135,136,141,142,143,144,145,146,147],rn=[26,127,129],sn=[1,6,26,34,55,60,63,79,84,92,97,99,108,111,117,132],on=[2,71],an=[1,291],cn=[1,292],hn=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,127,132,135,136,141,142,143,144,145,146,147],ln=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,112,116,117,132],un=[1,303],pn=[1,304],dn=[6,25,26,60],fn=[1,6,25,26,34,55,60,63,79,84,92,97,99,104,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],mn=[25,60],gn={trace:function(){},yy:{},symbols_:{error:2,Root:3,Body:4,Line:5,TERMINATOR:6,Expression:7,Statement:8,Return:9,Comment:10,STATEMENT:11,Value:12,Invocation:13,Code:14,Operation:15,Assign:16,If:17,Try:18,While:19,For:20,Switch:21,Class:22,Throw:23,Block:24,INDENT:25,OUTDENT:26,Identifier:27,IDENTIFIER:28,AlphaNumeric:29,NUMBER:30,String:31,STRING:32,STRING_START:33,STRING_END:34,Regex:35,REGEX:36,REGEX_START:37,REGEX_END:38,Literal:39,JS:40,DEBUGGER:41,UNDEFINED:42,NULL:43,BOOL:44,Assignable:45,"=":46,AssignObj:47,ObjAssignable:48,":":49,ThisProperty:50,RETURN:51,HERECOMMENT:52,PARAM_START:53,ParamList:54,PARAM_END:55,FuncGlyph:56,"->":57,"=>":58,OptComma:59,",":60,Param:61,ParamVar:62,"...":63,Array:64,Object:65,Splat:66,SimpleAssignable:67,Accessor:68,Parenthetical:69,Range:70,This:71,".":72,"?.":73,"::":74,"?::":75,Index:76,INDEX_START:77,IndexValue:78,INDEX_END:79,INDEX_SOAK:80,Slice:81,"{":82,AssignList:83,"}":84,CLASS:85,EXTENDS:86,OptFuncExist:87,Arguments:88,SUPER:89,FUNC_EXIST:90,CALL_START:91,CALL_END:92,ArgList:93,THIS:94,"@":95,"[":96,"]":97,RangeDots:98,"..":99,Arg:100,SimpleArgs:101,TRY:102,Catch:103,FINALLY:104,CATCH:105,THROW:106,"(":107,")":108,WhileSource:109,WHILE:110,WHEN:111,UNTIL:112,Loop:113,LOOP:114,ForBody:115,FOR:116,BY:117,ForStart:118,ForSource:119,ForVariables:120,OWN:121,ForValue:122,FORIN:123,FOROF:124,SWITCH:125,Whens:126,ELSE:127,When:128,LEADING_WHEN:129,IfBlock:130,IF:131,POST_IF:132,UNARY:133,UNARY_MATH:134,"-":135,"+":136,YIELD:137,FROM:138,"--":139,"++":140,"?":141,MATH:142,"**":143,SHIFT:144,COMPARE:145,LOGIC:146,RELATION:147,COMPOUND_ASSIGN:148,$accept:0,$end:1},terminals_:{2:"error",6:"TERMINATOR",11:"STATEMENT",25:"INDENT",26:"OUTDENT",28:"IDENTIFIER",30:"NUMBER",32:"STRING",33:"STRING_START",34:"STRING_END",36:"REGEX",37:"REGEX_START",38:"REGEX_END",40:"JS",41:"DEBUGGER",42:"UNDEFINED",43:"NULL",44:"BOOL",46:"=",49:":",51:"RETURN",52:"HERECOMMENT",53:"PARAM_START",55:"PARAM_END",57:"->",58:"=>",60:",",63:"...",72:".",73:"?.",74:"::",75:"?::",77:"INDEX_START",79:"INDEX_END",80:"INDEX_SOAK",82:"{",84:"}",85:"CLASS",86:"EXTENDS",89:"SUPER",90:"FUNC_EXIST",91:"CALL_START",92:"CALL_END",94:"THIS",95:"@",96:"[",97:"]",99:"..",102:"TRY",104:"FINALLY",105:"CATCH",106:"THROW",107:"(",108:")",110:"WHILE",111:"WHEN",112:"UNTIL",114:"LOOP",116:"FOR",117:"BY",121:"OWN",123:"FORIN",124:"FOROF",125:"SWITCH",127:"ELSE",129:"LEADING_WHEN",131:"IF",132:"POST_IF",133:"UNARY",134:"UNARY_MATH",135:"-",136:"+",137:"YIELD",138:"FROM",139:"--",140:"++",141:"?",142:"MATH",143:"**",144:"SHIFT",145:"COMPARE",146:"LOGIC",147:"RELATION",148:"COMPOUND_ASSIGN"},productions_:[0,[3,0],[3,1],[4,1],[4,3],[4,2],[5,1],[5,1],[8,1],[8,1],[8,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[24,2],[24,3],[27,1],[29,1],[29,1],[31,1],[31,3],[35,1],[35,3],[39,1],[39,1],[39,1],[39,1],[39,1],[39,1],[39,1],[16,3],[16,4],[16,5],[47,1],[47,3],[47,5],[47,1],[48,1],[48,1],[48,1],[9,2],[9,1],[10,1],[14,5],[14,2],[56,1],[56,1],[59,0],[59,1],[54,0],[54,1],[54,3],[54,4],[54,6],[61,1],[61,2],[61,3],[61,1],[62,1],[62,1],[62,1],[62,1],[66,2],[67,1],[67,2],[67,2],[67,1],[45,1],[45,1],[45,1],[12,1],[12,1],[12,1],[12,1],[12,1],[68,2],[68,2],[68,2],[68,2],[68,1],[68,1],[76,3],[76,2],[78,1],[78,1],[65,4],[83,0],[83,1],[83,3],[83,4],[83,6],[22,1],[22,2],[22,3],[22,4],[22,2],[22,3],[22,4],[22,5],[13,3],[13,3],[13,1],[13,2],[87,0],[87,1],[88,2],[88,4],[71,1],[71,1],[50,2],[64,2],[64,4],[98,1],[98,1],[70,5],[81,3],[81,2],[81,2],[81,1],[93,1],[93,3],[93,4],[93,4],[93,6],[100,1],[100,1],[100,1],[101,1],[101,3],[18,2],[18,3],[18,4],[18,5],[103,3],[103,3],[103,2],[23,2],[69,3],[69,5],[109,2],[109,4],[109,2],[109,4],[19,2],[19,2],[19,2],[19,1],[113,2],[113,2],[20,2],[20,2],[20,2],[115,2],[115,4],[115,2],[118,2],[118,3],[122,1],[122,1],[122,1],[122,1],[120,1],[120,3],[119,2],[119,2],[119,4],[119,4],[119,4],[119,6],[119,6],[21,5],[21,7],[21,4],[21,6],[126,1],[126,2],[128,3],[128,4],[130,3],[130,5],[17,1],[17,3],[17,3],[17,3],[15,2],[15,2],[15,2],[15,2],[15,2],[15,2],[15,3],[15,2],[15,2],[15,2],[15,2],[15,2],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,5],[15,4],[15,3]],performAction:function(e,t,n,i,r,s,o){var a=s.length-1; -switch(r){case 1:return this.$=i.addLocationDataFn(o[a],o[a])(new i.Block);case 2:return this.$=s[a];case 3:this.$=i.addLocationDataFn(o[a],o[a])(i.Block.wrap([s[a]]));break;case 4:this.$=i.addLocationDataFn(o[a-2],o[a])(s[a-2].push(s[a]));break;case 5:this.$=s[a-1];break;case 6:case 7:case 8:case 9:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 27:case 32:case 34:case 45:case 46:case 47:case 48:case 56:case 57:case 67:case 68:case 69:case 70:case 75:case 76:case 79:case 83:case 89:case 133:case 134:case 136:case 166:case 167:case 183:case 189:this.$=s[a];break;case 10:case 25:case 26:case 28:case 30:case 33:case 35:this.$=i.addLocationDataFn(o[a],o[a])(new i.Literal(s[a]));break;case 23:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Block);break;case 24:case 31:case 90:this.$=i.addLocationDataFn(o[a-2],o[a])(s[a-1]);break;case 29:case 146:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Parens(s[a-1]));break;case 36:this.$=i.addLocationDataFn(o[a],o[a])(new i.Undefined);break;case 37:this.$=i.addLocationDataFn(o[a],o[a])(new i.Null);break;case 38:this.$=i.addLocationDataFn(o[a],o[a])(new i.Bool(s[a]));break;case 39:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Assign(s[a-2],s[a]));break;case 40:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Assign(s[a-3],s[a]));break;case 41:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Assign(s[a-4],s[a-1]));break;case 42:case 72:case 77:case 78:case 80:case 81:case 82:case 168:case 169:this.$=i.addLocationDataFn(o[a],o[a])(new i.Value(s[a]));break;case 43:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Assign(i.addLocationDataFn(o[a-2])(new i.Value(s[a-2])),s[a],"object"));break;case 44:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Assign(i.addLocationDataFn(o[a-4])(new i.Value(s[a-4])),s[a-1],"object"));break;case 49:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Return(s[a]));break;case 50:this.$=i.addLocationDataFn(o[a],o[a])(new i.Return);break;case 51:this.$=i.addLocationDataFn(o[a],o[a])(new i.Comment(s[a]));break;case 52:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Code(s[a-3],s[a],s[a-1]));break;case 53:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Code([],s[a],s[a-1]));break;case 54:this.$=i.addLocationDataFn(o[a],o[a])("func");break;case 55:this.$=i.addLocationDataFn(o[a],o[a])("boundfunc");break;case 58:case 95:this.$=i.addLocationDataFn(o[a],o[a])([]);break;case 59:case 96:case 128:case 170:this.$=i.addLocationDataFn(o[a],o[a])([s[a]]);break;case 60:case 97:case 129:this.$=i.addLocationDataFn(o[a-2],o[a])(s[a-2].concat(s[a]));break;case 61:case 98:case 130:this.$=i.addLocationDataFn(o[a-3],o[a])(s[a-3].concat(s[a]));break;case 62:case 99:case 132:this.$=i.addLocationDataFn(o[a-5],o[a])(s[a-5].concat(s[a-2]));break;case 63:this.$=i.addLocationDataFn(o[a],o[a])(new i.Param(s[a]));break;case 64:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Param(s[a-1],null,!0));break;case 65:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Param(s[a-2],s[a]));break;case 66:case 135:this.$=i.addLocationDataFn(o[a],o[a])(new i.Expansion);break;case 71:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Splat(s[a-1]));break;case 73:this.$=i.addLocationDataFn(o[a-1],o[a])(s[a-1].add(s[a]));break;case 74:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Value(s[a-1],[].concat(s[a])));break;case 84:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Access(s[a]));break;case 85:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Access(s[a],"soak"));break;case 86:this.$=i.addLocationDataFn(o[a-1],o[a])([i.addLocationDataFn(o[a-1])(new i.Access(new i.Literal("prototype"))),i.addLocationDataFn(o[a])(new i.Access(s[a]))]);break;case 87:this.$=i.addLocationDataFn(o[a-1],o[a])([i.addLocationDataFn(o[a-1])(new i.Access(new i.Literal("prototype"),"soak")),i.addLocationDataFn(o[a])(new i.Access(s[a]))]);break;case 88:this.$=i.addLocationDataFn(o[a],o[a])(new i.Access(new i.Literal("prototype")));break;case 91:this.$=i.addLocationDataFn(o[a-1],o[a])(i.extend(s[a],{soak:!0}));break;case 92:this.$=i.addLocationDataFn(o[a],o[a])(new i.Index(s[a]));break;case 93:this.$=i.addLocationDataFn(o[a],o[a])(new i.Slice(s[a]));break;case 94:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Obj(s[a-2],s[a-3].generated));break;case 100:this.$=i.addLocationDataFn(o[a],o[a])(new i.Class);break;case 101:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Class(null,null,s[a]));break;case 102:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Class(null,s[a]));break;case 103:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Class(null,s[a-1],s[a]));break;case 104:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Class(s[a]));break;case 105:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Class(s[a-1],null,s[a]));break;case 106:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Class(s[a-2],s[a]));break;case 107:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Class(s[a-3],s[a-1],s[a]));break;case 108:case 109:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Call(s[a-2],s[a],s[a-1]));break;case 110:this.$=i.addLocationDataFn(o[a],o[a])(new i.Call("super",[new i.Splat(new i.Literal("arguments"))]));break;case 111:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Call("super",s[a]));break;case 112:this.$=i.addLocationDataFn(o[a],o[a])(!1);break;case 113:this.$=i.addLocationDataFn(o[a],o[a])(!0);break;case 114:this.$=i.addLocationDataFn(o[a-1],o[a])([]);break;case 115:case 131:this.$=i.addLocationDataFn(o[a-3],o[a])(s[a-2]);break;case 116:case 117:this.$=i.addLocationDataFn(o[a],o[a])(new i.Value(new i.Literal("this")));break;case 118:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Value(i.addLocationDataFn(o[a-1])(new i.Literal("this")),[i.addLocationDataFn(o[a])(new i.Access(s[a]))],"this"));break;case 119:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Arr([]));break;case 120:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Arr(s[a-2]));break;case 121:this.$=i.addLocationDataFn(o[a],o[a])("inclusive");break;case 122:this.$=i.addLocationDataFn(o[a],o[a])("exclusive");break;case 123:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Range(s[a-3],s[a-1],s[a-2]));break;case 124:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Range(s[a-2],s[a],s[a-1]));break;case 125:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Range(s[a-1],null,s[a]));break;case 126:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Range(null,s[a],s[a-1]));break;case 127:this.$=i.addLocationDataFn(o[a],o[a])(new i.Range(null,null,s[a]));break;case 137:this.$=i.addLocationDataFn(o[a-2],o[a])([].concat(s[a-2],s[a]));break;case 138:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Try(s[a]));break;case 139:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Try(s[a-1],s[a][0],s[a][1]));break;case 140:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Try(s[a-2],null,null,s[a]));break;case 141:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Try(s[a-3],s[a-2][0],s[a-2][1],s[a]));break;case 142:this.$=i.addLocationDataFn(o[a-2],o[a])([s[a-1],s[a]]);break;case 143:this.$=i.addLocationDataFn(o[a-2],o[a])([i.addLocationDataFn(o[a-1])(new i.Value(s[a-1])),s[a]]);break;case 144:this.$=i.addLocationDataFn(o[a-1],o[a])([null,s[a]]);break;case 145:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Throw(s[a]));break;case 147:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Parens(s[a-2]));break;case 148:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.While(s[a]));break;case 149:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.While(s[a-2],{guard:s[a]}));break;case 150:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.While(s[a],{invert:!0}));break;case 151:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.While(s[a-2],{invert:!0,guard:s[a]}));break;case 152:this.$=i.addLocationDataFn(o[a-1],o[a])(s[a-1].addBody(s[a]));break;case 153:case 154:this.$=i.addLocationDataFn(o[a-1],o[a])(s[a].addBody(i.addLocationDataFn(o[a-1])(i.Block.wrap([s[a-1]]))));break;case 155:this.$=i.addLocationDataFn(o[a],o[a])(s[a]);break;case 156:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.While(i.addLocationDataFn(o[a-1])(new i.Literal("true"))).addBody(s[a]));break;case 157:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.While(i.addLocationDataFn(o[a-1])(new i.Literal("true"))).addBody(i.addLocationDataFn(o[a])(i.Block.wrap([s[a]]))));break;case 158:case 159:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.For(s[a-1],s[a]));break;case 160:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.For(s[a],s[a-1]));break;case 161:this.$=i.addLocationDataFn(o[a-1],o[a])({source:i.addLocationDataFn(o[a])(new i.Value(s[a]))});break;case 162:this.$=i.addLocationDataFn(o[a-3],o[a])({source:i.addLocationDataFn(o[a-2])(new i.Value(s[a-2])),step:s[a]});break;case 163:this.$=i.addLocationDataFn(o[a-1],o[a])(function(){return s[a].own=s[a-1].own,s[a].name=s[a-1][0],s[a].index=s[a-1][1],s[a]}());break;case 164:this.$=i.addLocationDataFn(o[a-1],o[a])(s[a]);break;case 165:this.$=i.addLocationDataFn(o[a-2],o[a])(function(){return s[a].own=!0,s[a]}());break;case 171:this.$=i.addLocationDataFn(o[a-2],o[a])([s[a-2],s[a]]);break;case 172:this.$=i.addLocationDataFn(o[a-1],o[a])({source:s[a]});break;case 173:this.$=i.addLocationDataFn(o[a-1],o[a])({source:s[a],object:!0});break;case 174:this.$=i.addLocationDataFn(o[a-3],o[a])({source:s[a-2],guard:s[a]});break;case 175:this.$=i.addLocationDataFn(o[a-3],o[a])({source:s[a-2],guard:s[a],object:!0});break;case 176:this.$=i.addLocationDataFn(o[a-3],o[a])({source:s[a-2],step:s[a]});break;case 177:this.$=i.addLocationDataFn(o[a-5],o[a])({source:s[a-4],guard:s[a-2],step:s[a]});break;case 178:this.$=i.addLocationDataFn(o[a-5],o[a])({source:s[a-4],step:s[a-2],guard:s[a]});break;case 179:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Switch(s[a-3],s[a-1]));break;case 180:this.$=i.addLocationDataFn(o[a-6],o[a])(new i.Switch(s[a-5],s[a-3],s[a-1]));break;case 181:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Switch(null,s[a-1]));break;case 182:this.$=i.addLocationDataFn(o[a-5],o[a])(new i.Switch(null,s[a-3],s[a-1]));break;case 184:this.$=i.addLocationDataFn(o[a-1],o[a])(s[a-1].concat(s[a]));break;case 185:this.$=i.addLocationDataFn(o[a-2],o[a])([[s[a-1],s[a]]]);break;case 186:this.$=i.addLocationDataFn(o[a-3],o[a])([[s[a-2],s[a-1]]]);break;case 187:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.If(s[a-1],s[a],{type:s[a-2]}));break;case 188:this.$=i.addLocationDataFn(o[a-4],o[a])(s[a-4].addElse(i.addLocationDataFn(o[a-2],o[a])(new i.If(s[a-1],s[a],{type:s[a-2]}))));break;case 190:this.$=i.addLocationDataFn(o[a-2],o[a])(s[a-2].addElse(s[a]));break;case 191:case 192:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.If(s[a],i.addLocationDataFn(o[a-2])(i.Block.wrap([s[a-2]])),{type:s[a-1],statement:!0}));break;case 193:case 194:case 197:case 198:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Op(s[a-1],s[a]));break;case 195:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Op("-",s[a]));break;case 196:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Op("+",s[a]));break;case 199:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Op(s[a-2].concat(s[a-1]),s[a]));break;case 200:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Op("--",s[a]));break;case 201:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Op("++",s[a]));break;case 202:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Op("--",s[a-1],null,!0));break;case 203:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Op("++",s[a-1],null,!0));break;case 204:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Existence(s[a-1]));break;case 205:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Op("+",s[a-2],s[a]));break;case 206:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Op("-",s[a-2],s[a]));break;case 207:case 208:case 209:case 210:case 211:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Op(s[a-1],s[a-2],s[a]));break;case 212:this.$=i.addLocationDataFn(o[a-2],o[a])(function(){return"!"===s[a-1].charAt(0)?new i.Op(s[a-1].slice(1),s[a-2],s[a]).invert():new i.Op(s[a-1],s[a-2],s[a])}());break;case 213:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Assign(s[a-2],s[a],s[a-1]));break;case 214:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Assign(s[a-4],s[a-1],s[a-3]));break;case 215:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Assign(s[a-3],s[a],s[a-2]));break;case 216:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Extends(s[a-2],s[a]))}},table:[{1:[2,1],3:1,4:2,5:3,7:4,8:5,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{1:[3]},{1:[2,2],6:P},t(U,[2,3]),t(U,[2,6],{118:69,109:89,115:90,110:x,112:S,116:R,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(U,[2,7],{118:69,109:92,115:93,110:x,112:S,116:R,132:Z}),t(et,[2,11],{87:94,68:95,76:101,72:tt,73:nt,74:it,75:rt,77:st,80:ot,90:at,91:ct}),t(et,[2,12],{76:101,87:104,68:105,72:tt,73:nt,74:it,75:rt,77:st,80:ot,90:at,91:ct}),t(et,[2,13]),t(et,[2,14]),t(et,[2,15]),t(et,[2,16]),t(et,[2,17]),t(et,[2,18]),t(et,[2,19]),t(et,[2,20]),t(et,[2,21]),t(et,[2,22]),t(et,[2,8]),t(et,[2,9]),t(et,[2,10]),t(ht,lt,{46:[1,106]}),t(ht,[2,80]),t(ht,[2,81]),t(ht,[2,82]),t(ht,[2,83]),t([1,6,25,26,34,38,55,60,63,72,73,74,75,77,79,80,84,90,92,97,99,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],[2,110],{88:107,91:ut}),t([6,25,55,60],pt,{54:109,61:110,62:111,27:113,50:114,64:115,65:116,28:i,63:dt,82:b,95:ft,96:mt}),{24:119,25:gt},{7:121,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:123,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:124,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:125,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:127,8:126,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,138:[1,128],139:B,140:V},{12:130,13:131,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:132,50:63,64:47,65:48,67:129,69:23,70:24,71:25,82:b,89:w,94:T,95:C,96:E,107:L},{12:130,13:131,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:132,50:63,64:47,65:48,67:133,69:23,70:24,71:25,82:b,89:w,94:T,95:C,96:E,107:L},t(vt,yt,{86:[1,137],139:[1,134],140:[1,135],148:[1,136]}),t(et,[2,189],{127:[1,138]}),{24:139,25:gt},{24:140,25:gt},t(et,[2,155]),{24:141,25:gt},{7:142,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(bt,[2,100],{39:22,69:23,70:24,71:25,64:47,65:48,29:49,35:51,27:62,50:63,31:72,12:130,13:131,45:132,24:144,67:146,25:gt,28:i,30:r,32:s,33:o,36:a,37:c,40:h,41:l,42:u,43:p,44:d,82:b,86:[1,145],89:w,94:T,95:C,96:E,107:L}),{7:147,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,141,142,143,144,145,146,147],[2,50],{12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,9:18,10:19,45:21,39:22,69:23,70:24,71:25,56:28,67:36,130:37,109:39,113:40,115:41,64:47,65:48,29:49,35:51,27:62,50:63,118:69,31:72,8:122,7:148,11:n,28:i,30:r,32:s,33:o,36:a,37:c,40:h,41:l,42:u,43:p,44:d,51:f,52:m,53:g,57:v,58:y,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,114:D,125:A,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V}),t(et,[2,51]),t(vt,[2,77]),t(vt,[2,78]),t(ht,[2,32]),t(ht,[2,33]),t(ht,[2,34]),t(ht,[2,35]),t(ht,[2,36]),t(ht,[2,37]),t(ht,[2,38]),{4:149,5:3,7:4,8:5,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,150],27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:151,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:kt,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,63:wt,64:47,65:48,66:156,67:36,69:23,70:24,71:25,82:b,85:k,89:w,93:153,94:T,95:C,96:E,97:Tt,100:154,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(ht,[2,116]),t(ht,[2,117],{27:158,28:i}),{25:[2,54]},{25:[2,55]},t(Ct,[2,72]),t(Ct,[2,75]),{7:159,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:160,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:161,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:163,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:162,25:gt,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{27:168,28:i,50:169,64:170,65:171,70:164,82:b,95:ft,96:E,120:165,121:[1,166],122:167},{119:172,123:[1,173],124:[1,174]},t([6,25,60,84],Et,{31:72,83:175,47:176,48:177,10:178,27:179,29:180,50:181,28:i,30:r,32:s,33:o,52:m,95:ft}),t(Ft,[2,26]),t(Ft,[2,27]),t(ht,[2,30]),{12:130,13:182,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:132,50:63,64:47,65:48,67:183,69:23,70:24,71:25,82:b,89:w,94:T,95:C,96:E,107:L},t(Nt,[2,25]),t(Ft,[2,28]),{4:184,5:3,7:4,8:5,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(U,[2,5],{7:4,8:5,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,9:18,10:19,45:21,39:22,69:23,70:24,71:25,56:28,67:36,130:37,109:39,113:40,115:41,64:47,65:48,29:49,35:51,27:62,50:63,118:69,31:72,5:185,11:n,28:i,30:r,32:s,33:o,36:a,37:c,40:h,41:l,42:u,43:p,44:d,51:f,52:m,53:g,57:v,58:y,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,110:x,112:S,114:D,116:R,125:A,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V}),t(et,[2,204]),{7:186,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:187,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:188,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:189,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:190,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:191,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:192,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:193,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:194,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(et,[2,154]),t(et,[2,159]),{7:195,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(et,[2,153]),t(et,[2,158]),{88:196,91:ut},t(Ct,[2,73]),{91:[2,113]},{27:197,28:i},{27:198,28:i},t(Ct,[2,88],{27:199,28:i}),{27:200,28:i},t(Ct,[2,89]),{7:202,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,63:Lt,64:47,65:48,67:36,69:23,70:24,71:25,78:201,81:203,82:b,85:k,89:w,94:T,95:C,96:E,98:204,99:xt,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{76:207,77:st,80:ot},{88:208,91:ut},t(Ct,[2,74]),{6:[1,210],7:209,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,211],27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(St,[2,111]),{7:214,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:kt,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,63:wt,64:47,65:48,66:156,67:36,69:23,70:24,71:25,82:b,85:k,89:w,92:[1,212],93:213,94:T,95:C,96:E,100:154,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t([6,25],Dt,{59:217,55:[1,215],60:Rt}),t(At,[2,59]),t(At,[2,63],{46:[1,219],63:[1,218]}),t(At,[2,66]),t(It,[2,67]),t(It,[2,68]),t(It,[2,69]),t(It,[2,70]),{27:158,28:i},{7:214,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:kt,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,63:wt,64:47,65:48,66:156,67:36,69:23,70:24,71:25,82:b,85:k,89:w,93:153,94:T,95:C,96:E,97:Tt,100:154,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(et,[2,53]),{4:221,5:3,7:4,8:5,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,26:[1,220],27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,135,136,142,143,144,145,146,147],[2,193],{118:69,109:89,115:90,141:X}),{109:92,110:x,112:S,115:93,116:R,118:69,132:Z},t(_t,[2,194],{118:69,109:89,115:90,141:X,143:Y}),t(_t,[2,195],{118:69,109:89,115:90,141:X,143:Y}),t(_t,[2,196],{118:69,109:89,115:90,141:X,143:Y}),t(et,[2,197],{118:69,109:92,115:93}),t(Ot,[2,198],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{7:222,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(et,[2,200],{72:yt,73:yt,74:yt,75:yt,77:yt,80:yt,90:yt,91:yt}),{68:95,72:tt,73:nt,74:it,75:rt,76:101,77:st,80:ot,87:94,90:at,91:ct},{68:105,72:tt,73:nt,74:it,75:rt,76:101,77:st,80:ot,87:104,90:at,91:ct},t($t,lt),t(et,[2,201],{72:yt,73:yt,74:yt,75:yt,77:yt,80:yt,90:yt,91:yt}),t(et,[2,202]),t(et,[2,203]),{6:[1,225],7:223,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,224],27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:226,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{24:227,25:gt,131:[1,228]},t(et,[2,138],{103:229,104:[1,230],105:[1,231]}),t(et,[2,152]),t(et,[2,160]),{25:[1,232],109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},{126:233,128:234,129:jt},t(et,[2,101]),{7:236,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(bt,[2,104],{24:237,25:gt,72:yt,73:yt,74:yt,75:yt,77:yt,80:yt,90:yt,91:yt,86:[1,238]}),t(Ot,[2,145],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Ot,[2,49],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{6:P,108:[1,239]},{4:240,5:3,7:4,8:5,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t([6,25,60,97],Mt,{118:69,109:89,115:90,98:241,63:[1,242],99:xt,110:x,112:S,116:R,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Bt,[2,119]),t([6,25,97],Dt,{59:243,60:Vt}),t(Pt,[2,128]),{7:214,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:kt,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,63:wt,64:47,65:48,66:156,67:36,69:23,70:24,71:25,82:b,85:k,89:w,93:245,94:T,95:C,96:E,100:154,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(Pt,[2,134]),t(Pt,[2,135]),t(Nt,[2,118]),{24:246,25:gt,109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},t(Ut,[2,148],{118:69,109:89,115:90,110:x,111:[1,247],112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Ut,[2,150],{118:69,109:89,115:90,110:x,111:[1,248],112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(et,[2,156]),t(Gt,[2,157],{118:69,109:89,115:90,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,132,135,136,141,142,143,144,145,146,147],[2,161],{117:[1,249]}),t(Ht,[2,164]),{27:168,28:i,50:169,64:170,65:171,82:b,95:ft,96:mt,120:250,122:167},t(Ht,[2,170],{60:[1,251]}),t(qt,[2,166]),t(qt,[2,167]),t(qt,[2,168]),t(qt,[2,169]),t(et,[2,163]),{7:252,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:253,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t([6,25,84],Dt,{59:254,60:Xt}),t(Wt,[2,96]),t(Wt,[2,42],{49:[1,256]}),t(Wt,[2,45]),t(Yt,[2,46]),t(Yt,[2,47]),t(Yt,[2,48]),{38:[1,257],68:105,72:tt,73:nt,74:it,75:rt,76:101,77:st,80:ot,87:104,90:at,91:ct},t($t,yt),{6:P,34:[1,258]},t(U,[2,4]),t(Kt,[2,205],{118:69,109:89,115:90,141:X,142:W,143:Y}),t(Kt,[2,206],{118:69,109:89,115:90,141:X,142:W,143:Y}),t(_t,[2,207],{118:69,109:89,115:90,141:X,143:Y}),t(_t,[2,208],{118:69,109:89,115:90,141:X,143:Y}),t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,144,145,146,147],[2,209],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y}),t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,145,146],[2,210],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,147:Q}),t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,146],[2,211],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,147:Q}),t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,145,146,147],[2,212],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K}),t(Gt,[2,192],{118:69,109:89,115:90,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Gt,[2,191],{118:69,109:89,115:90,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(St,[2,108]),t(Ct,[2,84]),t(Ct,[2,85]),t(Ct,[2,86]),t(Ct,[2,87]),{79:[1,259]},{63:Lt,79:[2,92],98:260,99:xt,109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},{79:[2,93]},{7:261,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,79:[2,127],82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(zt,[2,121]),t(zt,Jt),t(Ct,[2,91]),t(St,[2,109]),t(Ot,[2,39],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{7:262,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:263,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(St,[2,114]),t([6,25,92],Dt,{59:264,60:Vt}),t(Pt,Mt,{118:69,109:89,115:90,63:[1,265],110:x,112:S,116:R,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{56:266,57:v,58:y},t(Qt,Zt,{62:111,27:113,50:114,64:115,65:116,61:267,28:i,63:dt,82:b,95:ft,96:mt}),{6:en,25:tn},t(At,[2,64]),{7:270,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(nn,[2,23]),{6:P,26:[1,271]},t(Ot,[2,199],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Ot,[2,213],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{7:272,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:273,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(Ot,[2,216],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(et,[2,190]),{7:274,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(et,[2,139],{104:[1,275]}),{24:276,25:gt},{24:279,25:gt,27:277,28:i,65:278,82:b},{126:280,128:234,129:jt},{26:[1,281],127:[1,282],128:283,129:jt},t(rn,[2,183]),{7:285,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,101:284,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(sn,[2,102],{118:69,109:89,115:90,24:286,25:gt,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(et,[2,105]),{7:287,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(ht,[2,146]),{6:P,26:[1,288]},{7:289,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t([11,28,30,32,33,36,37,40,41,42,43,44,51,52,53,57,58,82,85,89,94,95,96,102,106,107,110,112,114,116,125,131,133,134,135,136,137,139,140],Jt,{6:on,25:on,60:on,97:on}),{6:an,25:cn,97:[1,290]},t([6,25,26,92,97],Zt,{12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,9:18,10:19,45:21,39:22,69:23,70:24,71:25,56:28,67:36,130:37,109:39,113:40,115:41,64:47,65:48,29:49,35:51,27:62,50:63,118:69,31:72,8:122,66:156,7:214,100:293,11:n,28:i,30:r,32:s,33:o,36:a,37:c,40:h,41:l,42:u,43:p,44:d,51:f,52:m,53:g,57:v,58:y,63:wt,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,110:x,112:S,114:D,116:R,125:A,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V}),t(Qt,Dt,{59:294,60:Vt}),t(hn,[2,187]),{7:295,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:296,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:297,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(Ht,[2,165]),{27:168,28:i,50:169,64:170,65:171,82:b,95:ft,96:mt,122:298},t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,112,116,132],[2,172],{118:69,109:89,115:90,111:[1,299],117:[1,300],135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(ln,[2,173],{118:69,109:89,115:90,111:[1,301],135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{6:un,25:pn,84:[1,302]},t([6,25,26,84],Zt,{31:72,48:177,10:178,27:179,29:180,50:181,47:305,28:i,30:r,32:s,33:o,52:m,95:ft}),{7:306,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,307],27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(ht,[2,31]),t(Ft,[2,29]),t(Ct,[2,90]),{7:308,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,79:[2,125],82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{79:[2,126],109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},t(Ot,[2,40],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{26:[1,309],109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},{6:an,25:cn,92:[1,310]},t(Pt,on),{24:311,25:gt},t(At,[2,60]),{27:113,28:i,50:114,61:312,62:111,63:dt,64:115,65:116,82:b,95:ft,96:mt},t(dn,pt,{61:110,62:111,27:113,50:114,64:115,65:116,54:313,28:i,63:dt,82:b,95:ft,96:mt}),t(At,[2,65],{118:69,109:89,115:90,110:x,112:S,116:R,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(nn,[2,24]),{26:[1,314],109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},t(Ot,[2,215],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{24:315,25:gt,109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},{24:316,25:gt},t(et,[2,140]),{24:317,25:gt},{24:318,25:gt},t(fn,[2,144]),{26:[1,319],127:[1,320],128:283,129:jt},t(et,[2,181]),{24:321,25:gt},t(rn,[2,184]),{24:322,25:gt,60:[1,323]},t(mn,[2,136],{118:69,109:89,115:90,110:x,112:S,116:R,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(et,[2,103]),t(sn,[2,106],{118:69,109:89,115:90,24:324,25:gt,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{108:[1,325]},{97:[1,326],109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},t(Bt,[2,120]),{7:214,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,63:wt,64:47,65:48,66:156,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,100:327,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:214,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:kt,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,63:wt,64:47,65:48,66:156,67:36,69:23,70:24,71:25,82:b,85:k,89:w,93:328,94:T,95:C,96:E,100:154,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(Pt,[2,129]),{6:an,25:cn,26:[1,329]},t(Gt,[2,149],{118:69,109:89,115:90,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Gt,[2,151],{118:69,109:89,115:90,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Gt,[2,162],{118:69,109:89,115:90,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Ht,[2,171]),{7:330,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:331,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:332,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(Bt,[2,94]),{10:178,27:179,28:i,29:180,30:r,31:72,32:s,33:o,47:333,48:177,50:181,52:m,95:ft},t(dn,Et,{31:72,47:176,48:177,10:178,27:179,29:180,50:181,83:334,28:i,30:r,32:s,33:o,52:m,95:ft}),t(Wt,[2,97]),t(Wt,[2,43],{118:69,109:89,115:90,110:x,112:S,116:R,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{7:335,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{79:[2,124],109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},t(et,[2,41]),t(St,[2,115]),t(et,[2,52]),t(At,[2,61]),t(Qt,Dt,{59:336,60:Rt}),t(et,[2,214]),t(hn,[2,188]),t(et,[2,141]),t(fn,[2,142]),t(fn,[2,143]),t(et,[2,179]),{24:337,25:gt},{26:[1,338]},t(rn,[2,185],{6:[1,339]}),{7:340,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(et,[2,107]),t(ht,[2,147]),t(ht,[2,123]),t(Pt,[2,130]),t(Qt,Dt,{59:341,60:Vt}),t(Pt,[2,131]),t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,132],[2,174],{118:69,109:89,115:90,117:[1,342],135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(ln,[2,176],{118:69,109:89,115:90,111:[1,343],135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Ot,[2,175],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Wt,[2,98]),t(Qt,Dt,{59:344,60:Xt}),{26:[1,345],109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},{6:en,25:tn,26:[1,346]},{26:[1,347]},t(et,[2,182]),t(rn,[2,186]),t(mn,[2,137],{118:69,109:89,115:90,110:x,112:S,116:R,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{6:an,25:cn,26:[1,348]},{7:349,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:350,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{6:un,25:pn,26:[1,351]},t(Wt,[2,44]),t(At,[2,62]),t(et,[2,180]),t(Pt,[2,132]),t(Ot,[2,177],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Ot,[2,178],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Wt,[2,99])],defaultActions:{60:[2,54],61:[2,55],96:[2,113],203:[2,93]},parseError:function(e,t){if(!t.recoverable)throw Error(e); -this.trace(e)},parse:function(e){function t(){var e;return e=f.lex()||p,"number"!=typeof e&&(e=n.symbols_[e]||e),e}var n=this,i=[0],r=[null],s=[],o=this.table,a="",c=0,h=0,l=0,u=2,p=1,d=s.slice.call(arguments,1),f=Object.create(this.lexer),m={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(m.yy[g]=this.yy[g]);f.setInput(e,m.yy),m.yy.lexer=f,m.yy.parser=this,f.yylloc===void 0&&(f.yylloc={});var v=f.yylloc;s.push(v);var y=f.options&&f.options.ranges;this.parseError="function"==typeof m.yy.parseError?m.yy.parseError:Object.getPrototypeOf(this).parseError;for(var b,k,w,T,C,E,F,N,L,x={};;){if(w=i[i.length-1],this.defaultActions[w]?T=this.defaultActions[w]:((null===b||b===void 0)&&(b=t()),T=o[w]&&o[w][b]),T===void 0||!T.length||!T[0]){var S="";L=[];for(E in o[w])this.terminals_[E]&&E>u&&L.push("'"+this.terminals_[E]+"'");S=f.showPosition?"Parse error on line "+(c+1)+":\n"+f.showPosition()+"\nExpecting "+L.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(c+1)+": Unexpected "+(b==p?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(S,{text:f.match,token:this.terminals_[b]||b,line:f.yylineno,loc:v,expected:L})}if(T[0]instanceof Array&&T.length>1)throw Error("Parse Error: multiple actions possible at state: "+w+", token: "+b);switch(T[0]){case 1:i.push(b),r.push(f.yytext),s.push(f.yylloc),i.push(T[1]),b=null,k?(b=k,k=null):(h=f.yyleng,a=f.yytext,c=f.yylineno,v=f.yylloc,l>0&&l--);break;case 2:if(F=this.productions_[T[1]][1],x.$=r[r.length-F],x._$={first_line:s[s.length-(F||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(F||1)].first_column,last_column:s[s.length-1].last_column},y&&(x._$.range=[s[s.length-(F||1)].range[0],s[s.length-1].range[1]]),C=this.performAction.apply(x,[a,h,c,m.yy,T[1],r,s].concat(d)),C!==void 0)return C;F&&(i=i.slice(0,2*-1*F),r=r.slice(0,-1*F),s=s.slice(0,-1*F)),i.push(this.productions_[T[1]][0]),r.push(x.$),s.push(x._$),N=o[i[i.length-2]][i[i.length-1]],i.push(N);break;case 3:return!0}}return!0}};return e.prototype=gn,gn.Parser=e,new e}();return require!==void 0&&e!==void 0&&(e.parser=n,e.Parser=n.Parser,e.parse=function(){return n.parse.apply(n,arguments)},e.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var n=require("fs").readFileSync(require("path").normalize(t[1]),"utf8");return e.parser.parse(n)},t!==void 0&&require.main===t&&e.main(process.argv.slice(1))),t.exports}(),require["./scope"]=function(){var e={},t={exports:e};return function(){var t,n=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};e.Scope=t=function(){function e(e,t,n,i){var r,s;this.parent=e,this.expressions=t,this.method=n,this.referencedVars=i,this.variables=[{name:"arguments",type:"arguments"}],this.positions={},this.parent||(this.utilities={}),this.root=null!=(r=null!=(s=this.parent)?s.root:void 0)?r:this}return e.prototype.add=function(e,t,n){return this.shared&&!n?this.parent.add(e,t,n):Object.prototype.hasOwnProperty.call(this.positions,e)?this.variables[this.positions[e]].type=t:this.positions[e]=this.variables.push({name:e,type:t})-1},e.prototype.namedMethod=function(){var e;return(null!=(e=this.method)?e.name:void 0)||!this.parent?this.method:this.parent.namedMethod()},e.prototype.find=function(e){return this.check(e)?!0:(this.add(e,"var"),!1)},e.prototype.parameter=function(e){return this.shared&&this.parent.check(e,!0)?void 0:this.add(e,"param")},e.prototype.check=function(e){var t;return!!(this.type(e)||(null!=(t=this.parent)?t.check(e):void 0))},e.prototype.temporary=function(e,t,n){return null==n&&(n=!1),n?(t+parseInt(e,36)).toString(36).replace(/\d/g,"a"):e+(t||"")},e.prototype.type=function(e){var t,n,i,r;for(i=this.variables,t=0,n=i.length;n>t;t++)if(r=i[t],r.name===e)return r.type;return null},e.prototype.freeVariable=function(e,t){var i,r,s;for(null==t&&(t={}),i=0;;){if(s=this.temporary(e,i,t.single),!(this.check(s)||n.call(this.root.referencedVars,s)>=0))break;i++}return(null!=(r=t.reserve)?r:!0)&&this.add(s,"var",!0),s},e.prototype.assign=function(e,t){return this.add(e,{value:t,assigned:!0},!0),this.hasAssignments=!0},e.prototype.hasDeclarations=function(){return!!this.declaredVariables().length},e.prototype.declaredVariables=function(){var e;return function(){var t,n,i,r;for(i=this.variables,r=[],t=0,n=i.length;n>t;t++)e=i[t],"var"===e.type&&r.push(e.name);return r}.call(this).sort()},e.prototype.assignedVariables=function(){var e,t,n,i,r;for(n=this.variables,i=[],e=0,t=n.length;t>e;e++)r=n[e],r.type.assigned&&i.push(r.name+" = "+r.type.value);return i},e}()}.call(this),t.exports}(),require["./nodes"]=function(){var e={},t={exports:e};return function(){var t,n,i,r,s,o,a,c,h,l,u,p,d,f,m,g,v,y,b,k,w,T,C,E,F,N,L,x,S,D,R,A,I,_,O,$,j,M,B,V,P,U,G,H,q,X,W,Y,K,z,J,Q,Z,et,tt,nt,it,rt,st,ot,at,ct,ht,lt,ut,pt,dt,ft,mt,gt,vt,yt,bt,kt=function(e,t){function n(){this.constructor=e}for(var i in t)wt.call(t,i)&&(e[i]=t[i]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},wt={}.hasOwnProperty,Tt=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1},Ct=[].slice;Error.stackTraceLimit=1/0,P=require("./scope").Scope,dt=require("./lexer"),$=dt.RESERVED,V=dt.STRICT_PROSCRIBED,ft=require("./helpers"),et=ft.compact,rt=ft.flatten,it=ft.extend,lt=ft.merge,tt=ft.del,gt=ft.starts,nt=ft.ends,mt=ft.some,Z=ft.addLocationDataFn,ht=ft.locationDataToString,vt=ft.throwSyntaxError,e.extend=it,e.addLocationDataFn=Z,Q=function(){return!0},D=function(){return!1},X=function(){return this},S=function(){return this.negated=!this.negated,this},e.CodeFragment=h=function(){function e(e,t){var n;this.code=""+t,this.locationData=null!=e?e.locationData:void 0,this.type=(null!=e?null!=(n=e.constructor)?n.name:void 0:void 0)||"unknown"}return e.prototype.toString=function(){return""+this.code+(this.locationData?": "+ht(this.locationData):"")},e}(),st=function(e){var t;return function(){var n,i,r;for(r=[],n=0,i=e.length;i>n;n++)t=e[n],r.push(t.code);return r}().join("")},e.Base=r=function(){function e(){}return e.prototype.compile=function(e,t){return st(this.compileToFragments(e,t))},e.prototype.compileToFragments=function(e,t){var n;return e=it({},e),t&&(e.level=t),n=this.unfoldSoak(e)||this,n.tab=e.indent,e.level!==L&&n.isStatement(e)?n.compileClosure(e):n.compileNode(e)},e.prototype.compileClosure=function(e){var n,i,r,a,h,l,u;return(a=this.jumps())&&a.error("cannot use a pure statement in an expression"),e.sharedScope=!0,r=new c([],s.wrap([this])),n=[],((i=this.contains(at))||this.contains(ct))&&(n=[new x("this")],i?(h="apply",n.push(new x("arguments"))):h="call",r=new z(r,[new t(new x(h))])),l=new o(r,n).compileNode(e),(r.isGenerator||(null!=(u=r.base)?u.isGenerator:void 0))&&(l.unshift(this.makeCode("(yield* ")),l.push(this.makeCode(")"))),l},e.prototype.cache=function(e,t,n){var r,s,o;return r=null!=n?n(this):this.isComplex(),r?(s=new x(e.scope.freeVariable("ref")),o=new i(s,this),t?[o.compileToFragments(e,t),[this.makeCode(s.value)]]:[o,s]):(s=t?this.compileToFragments(e,t):this,[s,s])},e.prototype.cacheToCodeFragments=function(e){return[st(e[0]),st(e[1])]},e.prototype.makeReturn=function(e){var t;return t=this.unwrapAll(),e?new o(new x(e+".push"),[t]):new M(t)},e.prototype.contains=function(e){var t;return t=void 0,this.traverseChildren(!1,function(n){return e(n)?(t=n,!1):void 0}),t},e.prototype.lastNonComment=function(e){var t;for(t=e.length;t--;)if(!(e[t]instanceof l))return e[t];return null},e.prototype.toString=function(e,t){var n;return null==e&&(e=""),null==t&&(t=this.constructor.name),n="\n"+e+t,this.soak&&(n+="?"),this.eachChild(function(t){return n+=t.toString(e+q)}),n},e.prototype.eachChild=function(e){var t,n,i,r,s,o,a,c;if(!this.children)return this;for(a=this.children,i=0,s=a.length;s>i;i++)if(t=a[i],this[t])for(c=rt([this[t]]),r=0,o=c.length;o>r;r++)if(n=c[r],e(n)===!1)return this;return this},e.prototype.traverseChildren=function(e,t){return this.eachChild(function(n){var i;return i=t(n),i!==!1?n.traverseChildren(e,t):void 0})},e.prototype.invert=function(){return new I("!",this)},e.prototype.unwrapAll=function(){var e;for(e=this;e!==(e=e.unwrap()););return e},e.prototype.children=[],e.prototype.isStatement=D,e.prototype.jumps=D,e.prototype.isComplex=Q,e.prototype.isChainable=D,e.prototype.isAssignable=D,e.prototype.unwrap=X,e.prototype.unfoldSoak=D,e.prototype.assigns=D,e.prototype.updateLocationDataIfMissing=function(e){return this.locationData?this:(this.locationData=e,this.eachChild(function(t){return t.updateLocationDataIfMissing(e)}))},e.prototype.error=function(e){return vt(e,this.locationData)},e.prototype.makeCode=function(e){return new h(this,e)},e.prototype.wrapInBraces=function(e){return[].concat(this.makeCode("("),e,this.makeCode(")"))},e.prototype.joinFragmentArrays=function(e,t){var n,i,r,s,o;for(n=[],r=s=0,o=e.length;o>s;r=++s)i=e[r],r&&n.push(this.makeCode(t)),n=n.concat(i);return n},e}(),e.Block=s=function(e){function t(e){this.expressions=et(rt(e||[]))}return kt(t,e),t.prototype.children=["expressions"],t.prototype.push=function(e){return this.expressions.push(e),this},t.prototype.pop=function(){return this.expressions.pop()},t.prototype.unshift=function(e){return this.expressions.unshift(e),this},t.prototype.unwrap=function(){return 1===this.expressions.length?this.expressions[0]:this},t.prototype.isEmpty=function(){return!this.expressions.length},t.prototype.isStatement=function(e){var t,n,i,r;for(r=this.expressions,n=0,i=r.length;i>n;n++)if(t=r[n],t.isStatement(e))return!0;return!1},t.prototype.jumps=function(e){var t,n,i,r,s;for(s=this.expressions,n=0,r=s.length;r>n;n++)if(t=s[n],i=t.jumps(e))return i},t.prototype.makeReturn=function(e){var t,n;for(n=this.expressions.length;n--;)if(t=this.expressions[n],!(t instanceof l)){this.expressions[n]=t.makeReturn(e),t instanceof M&&!t.expression&&this.expressions.splice(n,1);break}return this},t.prototype.compileToFragments=function(e,n){return null==e&&(e={}),e.scope?t.__super__.compileToFragments.call(this,e,n):this.compileRoot(e)},t.prototype.compileNode=function(e){var n,i,r,s,o,a,c,h,l;for(this.tab=e.indent,l=e.level===L,i=[],h=this.expressions,s=o=0,a=h.length;a>o;s=++o)c=h[s],c=c.unwrapAll(),c=c.unfoldSoak(e)||c,c instanceof t?i.push(c.compileNode(e)):l?(c.front=!0,r=c.compileToFragments(e),c.isStatement(e)||(r.unshift(this.makeCode(""+this.tab)),r.push(this.makeCode(";"))),i.push(r)):i.push(c.compileToFragments(e,E));return l?this.spaced?[].concat(this.joinFragmentArrays(i,"\n\n"),this.makeCode("\n")):this.joinFragmentArrays(i,"\n"):(n=i.length?this.joinFragmentArrays(i,", "):[this.makeCode("void 0")],i.length>1&&e.level>=E?this.wrapInBraces(n):n)},t.prototype.compileRoot=function(e){var t,n,i,r,s,o,a,c,h,u,p;for(e.indent=e.bare?"":q,e.level=L,this.spaced=!0,e.scope=new P(null,this,null,null!=(h=e.referencedVars)?h:[]),u=e.locals||[],r=0,s=u.length;s>r;r++)o=u[r],e.scope.parameter(o);return a=[],e.bare||(c=function(){var e,n,r,s;for(r=this.expressions,s=[],i=e=0,n=r.length;n>e&&(t=r[i],t.unwrap()instanceof l);i=++e)s.push(t);return s}.call(this),p=this.expressions.slice(c.length),this.expressions=c,c.length&&(a=this.compileNode(lt(e,{indent:""})),a.push(this.makeCode("\n"))),this.expressions=p),n=this.compileWithDeclarations(e),e.bare?n:[].concat(a,this.makeCode("(function() {\n"),n,this.makeCode("\n}).call(this);\n"))},t.prototype.compileWithDeclarations=function(e){var t,n,i,r,s,o,a,c,h,u,p,d,f,m;for(r=[],c=[],h=this.expressions,s=o=0,a=h.length;a>o&&(i=h[s],i=i.unwrap(),i instanceof l||i instanceof x);s=++o);return e=lt(e,{level:L}),s&&(d=this.expressions.splice(s,9e9),u=[this.spaced,!1],m=u[0],this.spaced=u[1],p=[this.compileNode(e),m],r=p[0],this.spaced=p[1],this.expressions=d),c=this.compileNode(e),f=e.scope,f.expressions===this&&(n=e.scope.hasDeclarations(),t=f.hasAssignments,n||t?(s&&r.push(this.makeCode("\n")),r.push(this.makeCode(this.tab+"var ")),n&&r.push(this.makeCode(f.declaredVariables().join(", "))),t&&(n&&r.push(this.makeCode(",\n"+(this.tab+q))),r.push(this.makeCode(f.assignedVariables().join(",\n"+(this.tab+q))))),r.push(this.makeCode(";\n"+(this.spaced?"\n":"")))):r.length&&c.length&&r.push(this.makeCode("\n"))),r.concat(c)},t.wrap=function(e){return 1===e.length&&e[0]instanceof t?e[0]:new t(e)},t}(r),e.Literal=x=function(e){function t(e){this.value=e}return kt(t,e),t.prototype.makeReturn=function(){return this.isStatement()?this:t.__super__.makeReturn.apply(this,arguments)},t.prototype.isAssignable=function(){return g.test(this.value)},t.prototype.isStatement=function(){var e;return"break"===(e=this.value)||"continue"===e||"debugger"===e},t.prototype.isComplex=D,t.prototype.assigns=function(e){return e===this.value},t.prototype.jumps=function(e){return"break"!==this.value||(null!=e?e.loop:void 0)||(null!=e?e.block:void 0)?"continue"!==this.value||(null!=e?e.loop:void 0)?void 0:this:this},t.prototype.compileNode=function(e){var t,n,i;return n="this"===this.value?(null!=(i=e.scope.method)?i.bound:void 0)?e.scope.method.context:this.value:this.value.reserved?'"'+this.value+'"':this.value,t=this.isStatement()?""+this.tab+n+";":n,[this.makeCode(t)]},t.prototype.toString=function(){return' "'+this.value+'"'},t}(r),e.Undefined=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return kt(t,e),t.prototype.isAssignable=D,t.prototype.isComplex=D,t.prototype.compileNode=function(e){return[this.makeCode(e.level>=T?"(void 0)":"void 0")]},t}(r),e.Null=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return kt(t,e),t.prototype.isAssignable=D,t.prototype.isComplex=D,t.prototype.compileNode=function(){return[this.makeCode("null")]},t}(r),e.Bool=function(e){function t(e){this.val=e}return kt(t,e),t.prototype.isAssignable=D,t.prototype.isComplex=D,t.prototype.compileNode=function(){return[this.makeCode(this.val)]},t}(r),e.Return=M=function(e){function t(e){this.expression=e}return kt(t,e),t.prototype.children=["expression"],t.prototype.isStatement=Q,t.prototype.makeReturn=X,t.prototype.jumps=X,t.prototype.compileToFragments=function(e,n){var i,r;return i=null!=(r=this.expression)?r.makeReturn():void 0,!i||i instanceof t?t.__super__.compileToFragments.call(this,e,n):i.compileToFragments(e,n)},t.prototype.compileNode=function(e){var t,n,i;return t=[],n=null!=(i=this.expression)?"function"==typeof i.isYieldReturn?i.isYieldReturn():void 0:void 0,n||t.push(this.makeCode(this.tab+("return"+(this.expression?" ":"")))),this.expression&&(t=t.concat(this.expression.compileToFragments(e,N))),n||t.push(this.makeCode(";")),t},t}(r),e.Value=z=function(e){function t(e,n,i){return!n&&e instanceof t?e:(this.base=e,this.properties=n||[],i&&(this[i]=!0),this)}return kt(t,e),t.prototype.children=["base","properties"],t.prototype.add=function(e){return this.properties=this.properties.concat(e),this},t.prototype.hasProperties=function(){return!!this.properties.length},t.prototype.bareLiteral=function(e){return!this.properties.length&&this.base instanceof e},t.prototype.isArray=function(){return this.bareLiteral(n)},t.prototype.isRange=function(){return this.bareLiteral(j)},t.prototype.isComplex=function(){return this.hasProperties()||this.base.isComplex()},t.prototype.isAssignable=function(){return this.hasProperties()||this.base.isAssignable()},t.prototype.isSimpleNumber=function(){return this.bareLiteral(x)&&B.test(this.base.value)},t.prototype.isString=function(){return this.bareLiteral(x)&&y.test(this.base.value)},t.prototype.isRegex=function(){return this.bareLiteral(x)&&v.test(this.base.value)},t.prototype.isAtomic=function(){var e,t,n,i;for(i=this.properties.concat(this.base),e=0,t=i.length;t>e;e++)if(n=i[e],n.soak||n instanceof o)return!1;return!0},t.prototype.isNotCallable=function(){return this.isSimpleNumber()||this.isString()||this.isRegex()||this.isArray()||this.isRange()||this.isSplice()||this.isObject()},t.prototype.isStatement=function(e){return!this.properties.length&&this.base.isStatement(e)},t.prototype.assigns=function(e){return!this.properties.length&&this.base.assigns(e)},t.prototype.jumps=function(e){return!this.properties.length&&this.base.jumps(e)},t.prototype.isObject=function(e){return this.properties.length?!1:this.base instanceof A&&(!e||this.base.generated)},t.prototype.isSplice=function(){var e,t;return t=this.properties,e=t[t.length-1],e instanceof U},t.prototype.looksStatic=function(e){var t;return this.base.value===e&&1===this.properties.length&&"prototype"!==(null!=(t=this.properties[0].name)?t.value:void 0)},t.prototype.unwrap=function(){return this.properties.length?this:this.base},t.prototype.cacheReference=function(e){var n,r,s,o,a;return a=this.properties,s=a[a.length-1],2>this.properties.length&&!this.base.isComplex()&&!(null!=s?s.isComplex():void 0)?[this,this]:(n=new t(this.base,this.properties.slice(0,-1)),n.isComplex()&&(r=new x(e.scope.freeVariable("base")),n=new t(new O(new i(r,n)))),s?(s.isComplex()&&(o=new x(e.scope.freeVariable("name")),s=new w(new i(o,s.index)),o=new w(o)),[n.add(s),new t(r||n.base,[o||s])]):[n,r])},t.prototype.compileNode=function(e){var t,n,i,r,s;for(this.base.front=this.front,s=this.properties,t=this.base.compileToFragments(e,s.length?T:null),(this.base instanceof O||s.length)&&B.test(st(t))&&t.push(this.makeCode(".")),n=0,i=s.length;i>n;n++)r=s[n],t.push.apply(t,r.compileToFragments(e));return t},t.prototype.unfoldSoak=function(e){return null!=this.unfoldedSoak?this.unfoldedSoak:this.unfoldedSoak=function(n){return function(){var r,s,o,a,c,h,l,p,d,f;if(o=n.base.unfoldSoak(e))return(p=o.body.properties).push.apply(p,n.properties),o;for(d=n.properties,s=a=0,c=d.length;c>a;s=++a)if(h=d[s],h.soak)return h.soak=!1,r=new t(n.base,n.properties.slice(0,s)),f=new t(n.base,n.properties.slice(s)),r.isComplex()&&(l=new x(e.scope.freeVariable("ref")),r=new O(new i(l,r)),f.base=l),new b(new u(r),f,{soak:!0});return!1}}(this)()},t}(r),e.Comment=l=function(e){function t(e){this.comment=e}return kt(t,e),t.prototype.isStatement=Q,t.prototype.makeReturn=X,t.prototype.compileNode=function(e,t){var n,i;return i=this.comment.replace(/^(\s*)#(?=\s)/gm,"$1 *"),n="/*"+ut(i,this.tab)+(Tt.call(i,"\n")>=0?"\n"+this.tab:"")+" */",(t||e.level)===L&&(n=e.indent+n),[this.makeCode("\n"),this.makeCode(n)]},t}(r),e.Call=o=function(e){function n(e,t,n){this.args=null!=t?t:[],this.soak=n,this.isNew=!1,this.isSuper="super"===e,this.variable=this.isSuper?null:e,e instanceof z&&e.isNotCallable()&&e.error("literal is not a function")}return kt(n,e),n.prototype.children=["variable","args"],n.prototype.newInstance=function(){var e,t;return e=(null!=(t=this.variable)?t.base:void 0)||this.variable,e instanceof n&&!e.isNew?e.newInstance():this.isNew=!0,this},n.prototype.superReference=function(e){var n,r,s,o,a,c,h,l;return a=e.scope.namedMethod(),(null!=a?a.klass:void 0)?(o=a.klass,c=a.name,l=a.variable,o.isComplex()&&(s=new x(e.scope.parent.freeVariable("base")),r=new z(new O(new i(s,o))),l.base=r,l.properties.splice(0,o.properties.length)),(c.isComplex()||c instanceof w&&c.index.isAssignable())&&(h=new x(e.scope.parent.freeVariable("name")),c=new w(new i(h,c.index)),l.properties.pop(),l.properties.push(c)),n=[new t(new x("__super__"))],a["static"]&&n.push(new t(new x("constructor"))),n.push(null!=h?new w(h):c),new z(null!=s?s:o,n).compile(e)):(null!=a?a.ctor:void 0)?a.name+".__super__.constructor":this.error("cannot call super outside of an instance method.")},n.prototype.superThis=function(e){var t;return t=e.scope.method,t&&!t.klass&&t.context||"this"},n.prototype.unfoldSoak=function(e){var t,i,r,s,o,a,c,h,l;if(this.soak){if(this.variable){if(i=yt(e,this,"variable"))return i;c=new z(this.variable).cacheReference(e),s=c[0],l=c[1]}else s=new x(this.superReference(e)),l=new z(s);return l=new n(l,this.args),l.isNew=this.isNew,s=new x("typeof "+s.compile(e)+' === "function"'),new b(s,new z(l),{soak:!0})}for(t=this,a=[];;)if(t.variable instanceof n)a.push(t),t=t.variable;else{if(!(t.variable instanceof z))break;if(a.push(t),!((t=t.variable.base)instanceof n))break}for(h=a.reverse(),r=0,o=h.length;o>r;r++)t=h[r],i&&(t.variable instanceof n?t.variable=i:t.variable.base=i),i=yt(e,t,"variable");return i},n.prototype.compileNode=function(e){var t,n,i,r,s,o,a,c,h,l;if(null!=(h=this.variable)&&(h.front=this.front),r=G.compileSplattedArray(e,this.args,!0),r.length)return this.compileSplat(e,r);for(i=[],l=this.args,n=o=0,a=l.length;a>o;n=++o)t=l[n],n&&i.push(this.makeCode(", ")),i.push.apply(i,t.compileToFragments(e,E));return s=[],this.isSuper?(c=this.superReference(e)+(".call("+this.superThis(e)),i.length&&(c+=", "),s.push(this.makeCode(c))):(this.isNew&&s.push(this.makeCode("new ")),s.push.apply(s,this.variable.compileToFragments(e,T)),s.push(this.makeCode("("))),s.push.apply(s,i),s.push(this.makeCode(")")),s},n.prototype.compileSplat=function(e,t){var n,i,r,s,o,a;return this.isSuper?[].concat(this.makeCode(this.superReference(e)+".apply("+this.superThis(e)+", "),t,this.makeCode(")")):this.isNew?(s=this.tab+q,[].concat(this.makeCode("(function(func, args, ctor) {\n"+s+"ctor.prototype = func.prototype;\n"+s+"var child = new ctor, result = func.apply(child, args);\n"+s+"return Object(result) === result ? result : child;\n"+this.tab+"})("),this.variable.compileToFragments(e,E),this.makeCode(", "),t,this.makeCode(", function(){})"))):(n=[],i=new z(this.variable),(o=i.properties.pop())&&i.isComplex()?(a=e.scope.freeVariable("ref"),n=n.concat(this.makeCode("("+a+" = "),i.compileToFragments(e,E),this.makeCode(")"),o.compileToFragments(e))):(r=i.compileToFragments(e,T),B.test(st(r))&&(r=this.wrapInBraces(r)),o?(a=st(r),r.push.apply(r,o.compileToFragments(e))):a="null",n=n.concat(r)),n=n.concat(this.makeCode(".apply("+a+", "),t,this.makeCode(")")))},n}(r),e.Extends=d=function(e){function t(e,t){this.child=e,this.parent=t}return kt(t,e),t.prototype.children=["child","parent"],t.prototype.compileToFragments=function(e){return new o(new z(new x(bt("extend",e))),[this.child,this.parent]).compileToFragments(e)},t}(r),e.Access=t=function(e){function t(e,t){this.name=e,this.name.asKey=!0,this.soak="soak"===t}return kt(t,e),t.prototype.children=["name"],t.prototype.compileToFragments=function(e){var t;return t=this.name.compileToFragments(e),g.test(st(t))?t.unshift(this.makeCode(".")):(t.unshift(this.makeCode("[")),t.push(this.makeCode("]"))),t},t.prototype.isComplex=D,t}(r),e.Index=w=function(e){function t(e){this.index=e}return kt(t,e),t.prototype.children=["index"],t.prototype.compileToFragments=function(e){return[].concat(this.makeCode("["),this.index.compileToFragments(e,N),this.makeCode("]"))},t.prototype.isComplex=function(){return this.index.isComplex()},t}(r),e.Range=j=function(e){function t(e,t,n){this.from=e,this.to=t,this.exclusive="exclusive"===n,this.equals=this.exclusive?"":"="}return kt(t,e),t.prototype.children=["from","to"],t.prototype.compileVariables=function(e){var t,n,i,r,s,o;return e=lt(e,{top:!0}),t=tt(e,"isComplex"),n=this.cacheToCodeFragments(this.from.cache(e,E,t)),this.fromC=n[0],this.fromVar=n[1],i=this.cacheToCodeFragments(this.to.cache(e,E,t)),this.toC=i[0],this.toVar=i[1],(o=tt(e,"step"))&&(r=this.cacheToCodeFragments(o.cache(e,E,t)),this.step=r[0],this.stepVar=r[1]),s=[this.fromVar.match(R),this.toVar.match(R)],this.fromNum=s[0],this.toNum=s[1],this.stepVar?this.stepNum=this.stepVar.match(R):void 0},t.prototype.compileNode=function(e){var t,n,i,r,s,o,a,c,h,l,u,p,d,f;return this.fromVar||this.compileVariables(e),e.index?(a=this.fromNum&&this.toNum,s=tt(e,"index"),o=tt(e,"name"),h=o&&o!==s,f=s+" = "+this.fromC,this.toC!==this.toVar&&(f+=", "+this.toC),this.step!==this.stepVar&&(f+=", "+this.step),l=[s+" <"+this.equals,s+" >"+this.equals],c=l[0],r=l[1],n=this.stepNum?pt(this.stepNum[0])>0?c+" "+this.toVar:r+" "+this.toVar:a?(u=[pt(this.fromNum[0]),pt(this.toNum[0])],i=u[0],d=u[1],u,d>=i?c+" "+d:r+" "+d):(t=this.stepVar?this.stepVar+" > 0":this.fromVar+" <= "+this.toVar,t+" ? "+c+" "+this.toVar+" : "+r+" "+this.toVar),p=this.stepVar?s+" += "+this.stepVar:a?h?d>=i?"++"+s:"--"+s:d>=i?s+"++":s+"--":h?t+" ? ++"+s+" : --"+s:t+" ? "+s+"++ : "+s+"--",h&&(f=o+" = "+f),h&&(p=o+" = "+p),[this.makeCode(f+"; "+n+"; "+p)]):this.compileArray(e)},t.prototype.compileArray=function(e){var t,n,i,r,s,o,a,c,h,l,u,p,d;return this.fromNum&&this.toNum&&20>=Math.abs(this.fromNum-this.toNum)?(h=function(){p=[];for(var e=l=+this.fromNum,t=+this.toNum;t>=l?t>=e:e>=t;t>=l?e++:e--)p.push(e);return p}.apply(this),this.exclusive&&h.pop(),[this.makeCode("["+h.join(", ")+"]")]):(o=this.tab+q,s=e.scope.freeVariable("i",{single:!0}),u=e.scope.freeVariable("results"),c="\n"+o+u+" = [];",this.fromNum&&this.toNum?(e.index=s,n=st(this.compileNode(e))):(d=s+" = "+this.fromC+(this.toC!==this.toVar?", "+this.toC:""),i=this.fromVar+" <= "+this.toVar,n="var "+d+"; "+i+" ? "+s+" <"+this.equals+" "+this.toVar+" : "+s+" >"+this.equals+" "+this.toVar+"; "+i+" ? "+s+"++ : "+s+"--"),a="{ "+u+".push("+s+"); }\n"+o+"return "+u+";\n"+e.indent,r=function(e){return null!=e?e.contains(at):void 0},(r(this.from)||r(this.to))&&(t=", arguments"),[this.makeCode("(function() {"+c+"\n"+o+"for ("+n+")"+a+"}).apply(this"+(null!=t?t:"")+")")])},t}(r),e.Slice=U=function(e){function t(e){this.range=e,t.__super__.constructor.call(this)}return kt(t,e),t.prototype.children=["range"],t.prototype.compileNode=function(e){var t,n,i,r,s,o,a;return s=this.range,o=s.to,i=s.from,r=i&&i.compileToFragments(e,N)||[this.makeCode("0")],o&&(t=o.compileToFragments(e,N),n=st(t),(this.range.exclusive||-1!==+n)&&(a=", "+(this.range.exclusive?n:B.test(n)?""+(+n+1):(t=o.compileToFragments(e,T),"+"+st(t)+" + 1 || 9e9")))),[this.makeCode(".slice("+st(r)+(a||"")+")")]},t}(r),e.Obj=A=function(e){function n(e,t){this.generated=null!=t?t:!1,this.objects=this.properties=e||[]}return kt(n,e),n.prototype.children=["properties"],n.prototype.compileNode=function(e){var n,r,s,o,a,c,h,u,p,d,f,m,g,v,y,b,k,w,T,C,E;if(T=this.properties,this.generated)for(h=0,g=T.length;g>h;h++)b=T[h],b instanceof z&&b.error("cannot have an implicit value in an implicit object");for(r=p=0,v=T.length;v>p&&(w=T[r],!((w.variable||w).base instanceof O));r=++p);for(s=T.length>r,a=e.indent+=q,m=this.lastNonComment(this.properties),n=[],s&&(k=e.scope.freeVariable("obj"),n.push(this.makeCode("(\n"+a+k+" = "))),n.push(this.makeCode("{"+(0===T.length||0===r?"}":"\n"))),o=f=0,y=T.length;y>f;o=++f)w=T[o],o===r&&(0!==o&&n.push(this.makeCode("\n"+a+"}")),n.push(this.makeCode(",\n"))),u=o===T.length-1||o===r-1?"":w===m||w instanceof l?"\n":",\n",c=w instanceof l?"":a,s&&r>o&&(c+=q),w instanceof i&&w.variable instanceof z&&w.variable.hasProperties()&&w.variable.error("invalid object key"),w instanceof z&&w["this"]&&(w=new i(w.properties[0].name,w,"object")),w instanceof l||(r>o?(w instanceof i||(w=new i(w,w,"object")),(w.variable.base||w.variable).asKey=!0):(w instanceof i?(d=w.variable,E=w.value):(C=w.base.cache(e),d=C[0],E=C[1]),w=new i(new z(new x(k),[new t(d)]),E))),c&&n.push(this.makeCode(c)),n.push.apply(n,w.compileToFragments(e,L)),u&&n.push(this.makeCode(u));return s?n.push(this.makeCode(",\n"+a+k+"\n"+this.tab+")")):0!==T.length&&n.push(this.makeCode("\n"+this.tab+"}")),this.front&&!s?this.wrapInBraces(n):n},n.prototype.assigns=function(e){var t,n,i,r;for(r=this.properties,t=0,n=r.length;n>t;t++)if(i=r[t],i.assigns(e))return!0;return!1},n}(r),e.Arr=n=function(e){function t(e){this.objects=e||[]}return kt(t,e),t.prototype.children=["objects"],t.prototype.compileNode=function(e){var t,n,i,r,s,o,a;if(!this.objects.length)return[this.makeCode("[]")];if(e.indent+=q,t=G.compileSplattedArray(e,this.objects),t.length)return t;for(t=[],n=function(){var t,n,i,r;for(i=this.objects,r=[],t=0,n=i.length;n>t;t++)a=i[t],r.push(a.compileToFragments(e,E));return r}.call(this),r=s=0,o=n.length;o>s;r=++s)i=n[r],r&&t.push(this.makeCode(", ")),t.push.apply(t,i);return st(t).indexOf("\n")>=0?(t.unshift(this.makeCode("[\n"+e.indent)),t.push(this.makeCode("\n"+this.tab+"]"))):(t.unshift(this.makeCode("[")),t.push(this.makeCode("]"))),t},t.prototype.assigns=function(e){var t,n,i,r;for(r=this.objects,t=0,n=r.length;n>t;t++)if(i=r[t],i.assigns(e))return!0;return!1},t}(r),e.Class=a=function(e){function n(e,t,n){this.variable=e,this.parent=t,this.body=null!=n?n:new s,this.boundFuncs=[],this.body.classBody=!0}return kt(n,e),n.prototype.children=["variable","parent","body"],n.prototype.determineName=function(){var e,n,i;return this.variable?(n=this.variable.properties,i=n[n.length-1],e=i?i instanceof t&&i.name.value:this.variable.base.value,Tt.call(V,e)>=0&&this.variable.error("class variable name may not be "+e),e&&(e=g.test(e)&&e)):null},n.prototype.setContext=function(e){return this.body.traverseChildren(!1,function(t){return t.classBody?!1:t instanceof x&&"this"===t.value?t.value=e:t instanceof c&&t.bound?t.context=e:void 0})},n.prototype.addBoundFunctions=function(e){var n,i,r,s,o;for(o=this.boundFuncs,i=0,r=o.length;r>i;i++)n=o[i],s=new z(new x("this"),[new t(n)]).compile(e),this.ctor.body.unshift(new x(s+" = "+bt("bind",e)+"("+s+", this)"))},n.prototype.addProperties=function(e,n,r){var s,o,a,h,l,u;return u=e.base.properties.slice(0),h=function(){var e;for(e=[];o=u.shift();)o instanceof i&&(a=o.variable.base,delete o.context,l=o.value,"constructor"===a.value?(this.ctor&&o.error("cannot define more than one constructor in a class"),l.bound&&o.error("cannot define a constructor as a bound function"),l instanceof c?o=this.ctor=l:(this.externalCtor=r.classScope.freeVariable("class"),o=new i(new x(this.externalCtor),l))):o.variable["this"]?l["static"]=!0:(s=a.isComplex()?new w(a):new t(a),o.variable=new z(new x(n),[new t(new x("prototype")),s]),l instanceof c&&l.bound&&(this.boundFuncs.push(a),l.bound=!1))),e.push(o);return e}.call(this),et(h)},n.prototype.walkBody=function(e,t){return this.traverseChildren(!1,function(r){return function(o){var a,c,h,l,u,p,d;if(a=!0,o instanceof n)return!1;if(o instanceof s){for(d=c=o.expressions,h=l=0,u=d.length;u>l;h=++l)p=d[h],p instanceof i&&p.variable.looksStatic(e)?p.value["static"]=!0:p instanceof z&&p.isObject(!0)&&(a=!1,c[h]=r.addProperties(p,e,t));o.expressions=c=rt(c)}return a&&!(o instanceof n)}}(this))},n.prototype.hoistDirectivePrologue=function(){var e,t,n;for(t=0,e=this.body.expressions;(n=e[t])&&n instanceof l||n instanceof z&&n.isString();)++t;return this.directives=e.splice(0,t)},n.prototype.ensureConstructor=function(e){return this.ctor||(this.ctor=new c,this.externalCtor?this.ctor.body.push(new x(this.externalCtor+".apply(this, arguments)")):this.parent&&this.ctor.body.push(new x(e+".__super__.constructor.apply(this, arguments)")),this.ctor.body.makeReturn(),this.body.expressions.unshift(this.ctor)),this.ctor.ctor=this.ctor.name=e,this.ctor.klass=null,this.ctor.noReturn=!0},n.prototype.compileNode=function(e){var t,n,r,a,h,l,u,p,f;return(a=this.body.jumps())&&a.error("Class bodies cannot contain pure statements"),(n=this.body.contains(at))&&n.error("Class bodies shouldn't reference arguments"),u=this.determineName()||"_Class",u.reserved&&(u="_"+u),l=new x(u),r=new c([],s.wrap([this.body])),t=[],e.classScope=r.makeScope(e.scope),this.hoistDirectivePrologue(),this.setContext(u),this.walkBody(u,e),this.ensureConstructor(u),this.addBoundFunctions(e),this.body.spaced=!0,this.body.expressions.push(l),this.parent&&(f=new x(e.classScope.freeVariable("superClass",{reserve:!1})),this.body.expressions.unshift(new d(l,f)),r.params.push(new _(f)),t.push(this.parent)),(p=this.body.expressions).unshift.apply(p,this.directives),h=new O(new o(r,t)),this.variable&&(h=new i(this.variable,h)),h.compileToFragments(e)},n}(r),e.Assign=i=function(e){function n(e,t,n,i){var r,s,o;this.variable=e,this.value=t,this.context=n,this.param=i&&i.param,this.subpattern=i&&i.subpattern,o=s=this.variable.unwrapAll().value,r=Tt.call(V,o)>=0,r&&"object"!==this.context&&this.variable.error('variable name may not be "'+s+'"')}return kt(n,e),n.prototype.children=["variable","value"],n.prototype.isStatement=function(e){return(null!=e?e.level:void 0)===L&&null!=this.context&&Tt.call(this.context,"?")>=0 -},n.prototype.assigns=function(e){return this["object"===this.context?"value":"variable"].assigns(e)},n.prototype.unfoldSoak=function(e){return yt(e,this,"variable")},n.prototype.compileNode=function(e){var t,n,i,r,s,o,a,h,l,u,p,d,f,m;if(i=this.variable instanceof z){if(this.variable.isArray()||this.variable.isObject())return this.compilePatternMatch(e);if(this.variable.isSplice())return this.compileSplice(e);if("||="===(h=this.context)||"&&="===h||"?="===h)return this.compileConditional(e);if("**="===(l=this.context)||"//="===l||"%%="===l)return this.compileSpecialMath(e)}return this.value instanceof c&&(this.value["static"]?(this.value.klass=this.variable.base,this.value.name=this.variable.properties[0],this.value.variable=this.variable):(null!=(u=this.variable.properties)?u.length:void 0)>=2&&(p=this.variable.properties,o=p.length>=3?Ct.call(p,0,r=p.length-2):(r=0,[]),a=p[r++],s=p[r++],"prototype"===(null!=(d=a.name)?d.value:void 0)&&(this.value.klass=new z(this.variable.base,o),this.value.name=s,this.value.variable=this.variable))),this.context||(m=this.variable.unwrapAll(),m.isAssignable()||this.variable.error('"'+this.variable.compile(e)+'" cannot be assigned'),("function"==typeof m.hasProperties?m.hasProperties():void 0)||(this.param?e.scope.add(m.value,"var"):e.scope.find(m.value))),f=this.value.compileToFragments(e,E),n=this.variable.compileToFragments(e,E),"object"===this.context?n.concat(this.makeCode(": "),f):(t=n.concat(this.makeCode(" "+(this.context||"=")+" "),f),E>=e.level?t:this.wrapInBraces(t))},n.prototype.compilePatternMatch=function(e){var i,r,s,o,a,c,h,l,u,d,f,m,v,y,b,k,T,C,N,S,D,R,A,I,_,j,M,B;if(I=e.level===L,j=this.value,y=this.variable.base.objects,!(b=y.length))return s=j.compileToFragments(e),e.level>=F?this.wrapInBraces(s):s;if(l=this.variable.isObject(),I&&1===b&&!((v=y[0])instanceof G))return v instanceof n?(T=v,C=T.variable,h=C.base,v=T.value):h=l?v["this"]?v.properties[0].name:v:new x(0),i=g.test(h.unwrap().value||0),j=new z(j),j.properties.push(new(i?t:w)(h)),N=v.unwrap().value,Tt.call($,N)>=0&&v.error("assignment to a reserved word: "+v.compile(e)),new n(v,j,null,{param:this.param}).compileToFragments(e,L);for(M=j.compileToFragments(e,E),B=st(M),r=[],o=!1,(!g.test(B)||this.variable.assigns(B))&&(r.push([this.makeCode((k=e.scope.freeVariable("ref"))+" = ")].concat(Ct.call(M))),M=[this.makeCode(k)],B=k),c=d=0,f=y.length;f>d;c=++d){if(v=y[c],h=c,l&&(v instanceof n?(S=v,D=S.variable,h=D.base,v=S.value):v.base instanceof O?(R=new z(v.unwrapAll()).cacheReference(e),v=R[0],h=R[1]):h=v["this"]?v.properties[0].name:v),!o&&v instanceof G)m=v.name.unwrap().value,v=v.unwrap(),_=b+" <= "+B+".length ? "+bt("slice",e)+".call("+B+", "+c,(A=b-c-1)?(u=e.scope.freeVariable("i",{single:!0}),_+=", "+u+" = "+B+".length - "+A+") : ("+u+" = "+c+", [])"):_+=") : []",_=new x(_),o=u+"++";else{if(!o&&v instanceof p){(A=b-c-1)&&(1===A?o=B+".length - 1":(u=e.scope.freeVariable("i",{single:!0}),_=new x(u+" = "+B+".length - "+A),o=u+"++",r.push(_.compileToFragments(e,E))));continue}m=v.unwrap().value,(v instanceof G||v instanceof p)&&v.error("multiple splats/expansions are disallowed in an assignment"),"number"==typeof h?(h=new x(o||h),i=!1):i=l&&g.test(h.unwrap().value||0),_=new z(new x(B),[new(i?t:w)(h)])}null!=m&&Tt.call($,m)>=0&&v.error("assignment to a reserved word: "+v.compile(e)),r.push(new n(v,_,null,{param:this.param,subpattern:!0}).compileToFragments(e,E))}return I||this.subpattern||r.push(M),a=this.joinFragmentArrays(r,", "),E>e.level?a:this.wrapInBraces(a)},n.prototype.compileConditional=function(e){var t,i,r,s;return r=this.variable.cacheReference(e),i=r[0],s=r[1],!i.properties.length&&i.base instanceof x&&"this"!==i.base.value&&!e.scope.check(i.base.value)&&this.variable.error('the variable "'+i.base.value+"\" can't be assigned with "+this.context+" because it has not been declared before"),Tt.call(this.context,"?")>=0?(e.isExistentialEquals=!0,new b(new u(i),s,{type:"if"}).addElse(new n(s,this.value,"=")).compileToFragments(e)):(t=new I(this.context.slice(0,-1),i,new n(s,this.value,"=")).compileToFragments(e),E>=e.level?t:this.wrapInBraces(t))},n.prototype.compileSpecialMath=function(e){var t,i,r;return i=this.variable.cacheReference(e),t=i[0],r=i[1],new n(t,new I(this.context.slice(0,-1),r,this.value)).compileToFragments(e)},n.prototype.compileSplice=function(e){var t,n,i,r,s,o,a,c,h,l,u,p;return a=this.variable.properties.pop().range,i=a.from,l=a.to,n=a.exclusive,o=this.variable.compile(e),i?(c=this.cacheToCodeFragments(i.cache(e,F)),r=c[0],s=c[1]):r=s="0",l?i instanceof z&&i.isSimpleNumber()&&l instanceof z&&l.isSimpleNumber()?(l=l.compile(e)-s,n||(l+=1)):(l=l.compile(e,T)+" - "+s,n||(l+=" + 1")):l="9e9",h=this.value.cache(e,E),u=h[0],p=h[1],t=[].concat(this.makeCode("[].splice.apply("+o+", ["+r+", "+l+"].concat("),u,this.makeCode(")), "),p),e.level>L?this.wrapInBraces(t):t},n}(r),e.Code=c=function(e){function t(e,t,n){this.params=e||[],this.body=t||new s,this.bound="boundfunc"===n,this.isGenerator=!!this.body.contains(function(e){var t;return e instanceof I&&("yield"===(t=e.operator)||"yield*"===t)})}return kt(t,e),t.prototype.children=["params","body"],t.prototype.isStatement=function(){return!!this.ctor},t.prototype.jumps=D,t.prototype.makeScope=function(e){return new P(e,this.body,this)},t.prototype.compileNode=function(e){var r,a,c,h,l,u,d,f,m,g,v,y,k,w,C,E,F,N,L,S,D,R,A,O,$,j,M,B,V,P,U,G,H;if(this.bound&&(null!=(A=e.scope.method)?A.bound:void 0)&&(this.context=e.scope.method.context),this.bound&&!this.context)return this.context="_this",H=new t([new _(new x(this.context))],new s([this])),a=new o(H,[new x("this")]),a.updateLocationDataIfMissing(this.locationData),a.compileNode(e);for(e.scope=tt(e,"classScope")||this.makeScope(e.scope),e.scope.shared=tt(e,"sharedScope"),e.indent+=q,delete e.bare,delete e.isExistentialEquals,L=[],h=[],O=this.params,u=0,m=O.length;m>u;u++)N=O[u],N instanceof p||e.scope.parameter(N.asReference(e));for($=this.params,d=0,g=$.length;g>d;d++)if(N=$[d],N.splat||N instanceof p){for(j=this.params,f=0,v=j.length;v>f;f++)F=j[f],F instanceof p||!F.name.value||e.scope.add(F.name.value,"var",!0);V=new i(new z(new n(function(){var t,n,i,r;for(i=this.params,r=[],n=0,t=i.length;t>n;n++)F=i[n],r.push(F.asReference(e));return r}.call(this))),new z(new x("arguments")));break}for(M=this.params,E=0,y=M.length;y>E;E++)N=M[E],N.isComplex()?(U=R=N.asReference(e),N.value&&(U=new I("?",R,N.value)),h.push(new i(new z(N.name),U,"=",{param:!0}))):(R=N,N.value&&(C=new x(R.name.value+" == null"),U=new i(new z(N.name),N.value,"="),h.push(new b(C,U)))),V||L.push(R);for(G=this.body.isEmpty(),V&&h.unshift(V),h.length&&(B=this.body.expressions).unshift.apply(B,h),l=S=0,k=L.length;k>S;l=++S)F=L[l],L[l]=F.compileToFragments(e),e.scope.parameter(st(L[l]));for(P=[],this.eachParamName(function(e,t){return Tt.call(P,e)>=0&&t.error("multiple parameters named "+e),P.push(e)}),G||this.noReturn||this.body.makeReturn(),c="function",this.isGenerator&&(c+="*"),this.ctor&&(c+=" "+this.name),c+="(",r=[this.makeCode(c)],l=D=0,w=L.length;w>D;l=++D)F=L[l],l&&r.push(this.makeCode(", ")),r.push.apply(r,F);return r.push(this.makeCode(") {")),this.body.isEmpty()||(r=r.concat(this.makeCode("\n"),this.body.compileWithDeclarations(e),this.makeCode("\n"+this.tab))),r.push(this.makeCode("}")),this.ctor?[this.makeCode(this.tab)].concat(Ct.call(r)):this.front||e.level>=T?this.wrapInBraces(r):r},t.prototype.eachParamName=function(e){var t,n,i,r,s;for(r=this.params,s=[],t=0,n=r.length;n>t;t++)i=r[t],s.push(i.eachName(e));return s},t.prototype.traverseChildren=function(e,n){return e?t.__super__.traverseChildren.call(this,e,n):void 0},t}(r),e.Param=_=function(e){function t(e,t,n){var i,r;this.name=e,this.value=t,this.splat=n,r=i=this.name.unwrapAll().value,Tt.call(V,r)>=0&&this.name.error('parameter name "'+i+'" is not allowed')}return kt(t,e),t.prototype.children=["name","value"],t.prototype.compileToFragments=function(e){return this.name.compileToFragments(e,E)},t.prototype.asReference=function(e){var t,n;return this.reference?this.reference:(n=this.name,n["this"]?(t=n.properties[0].name.value,t.reserved&&(t="_"+t),n=new x(e.scope.freeVariable(t))):n.isComplex()&&(n=new x(e.scope.freeVariable("arg"))),n=new z(n),this.splat&&(n=new G(n)),n.updateLocationDataIfMissing(this.locationData),this.reference=n)},t.prototype.isComplex=function(){return this.name.isComplex()},t.prototype.eachName=function(e,t){var n,r,s,o,a,c;if(null==t&&(t=this.name),n=function(t){return e("@"+t.properties[0].name.value,t)},t instanceof x)return e(t.value,t);if(t instanceof z)return n(t);for(c=t.objects,r=0,s=c.length;s>r;r++)a=c[r],a instanceof i?this.eachName(e,a.value.unwrap()):a instanceof G?(o=a.name.unwrap(),e(o.value,o)):a instanceof z?a.isArray()||a.isObject()?this.eachName(e,a.base):a["this"]?n(a):e(a.base.value,a.base):a instanceof p||a.error("illegal parameter "+a.compile())},t}(r),e.Splat=G=function(e){function t(e){this.name=e.compile?e:new x(e)}return kt(t,e),t.prototype.children=["name"],t.prototype.isAssignable=Q,t.prototype.assigns=function(e){return this.name.assigns(e)},t.prototype.compileToFragments=function(e){return this.name.compileToFragments(e)},t.prototype.unwrap=function(){return this.name},t.compileSplattedArray=function(e,n,i){var r,s,o,a,c,h,l,u,p,d,f;for(l=-1;(f=n[++l])&&!(f instanceof t););if(l>=n.length)return[];if(1===n.length)return f=n[0],c=f.compileToFragments(e,E),i?c:[].concat(f.makeCode(bt("slice",e)+".call("),c,f.makeCode(")"));for(r=n.slice(l),h=u=0,d=r.length;d>u;h=++u)f=r[h],o=f.compileToFragments(e,E),r[h]=f instanceof t?[].concat(f.makeCode(bt("slice",e)+".call("),o,f.makeCode(")")):[].concat(f.makeCode("["),o,f.makeCode("]"));return 0===l?(f=n[0],a=f.joinFragmentArrays(r.slice(1),", "),r[0].concat(f.makeCode(".concat("),a,f.makeCode(")"))):(s=function(){var t,i,r,s;for(r=n.slice(0,l),s=[],t=0,i=r.length;i>t;t++)f=r[t],s.push(f.compileToFragments(e,E));return s}(),s=n[0].joinFragmentArrays(s,", "),a=n[l].joinFragmentArrays(r,", "),p=n[n.length-1],[].concat(n[0].makeCode("["),s,n[l].makeCode("].concat("),a,p.makeCode(")")))},t}(r),e.Expansion=p=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return kt(t,e),t.prototype.isComplex=D,t.prototype.compileNode=function(){return this.error("Expansion must be used inside a destructuring assignment or parameter list")},t.prototype.asReference=function(){return this},t.prototype.eachName=function(){},t}(r),e.While=J=function(e){function t(e,t){this.condition=(null!=t?t.invert:void 0)?e.invert():e,this.guard=null!=t?t.guard:void 0}return kt(t,e),t.prototype.children=["condition","guard","body"],t.prototype.isStatement=Q,t.prototype.makeReturn=function(e){return e?t.__super__.makeReturn.apply(this,arguments):(this.returns=!this.jumps({loop:!0}),this)},t.prototype.addBody=function(e){return this.body=e,this},t.prototype.jumps=function(){var e,t,n,i,r;if(e=this.body.expressions,!e.length)return!1;for(t=0,i=e.length;i>t;t++)if(r=e[t],n=r.jumps({loop:!0}))return n;return!1},t.prototype.compileNode=function(e){var t,n,i,r;return e.indent+=q,r="",n=this.body,n.isEmpty()?n=this.makeCode(""):(this.returns&&(n.makeReturn(i=e.scope.freeVariable("results")),r=""+this.tab+i+" = [];\n"),this.guard&&(n.expressions.length>1?n.expressions.unshift(new b(new O(this.guard).invert(),new x("continue"))):this.guard&&(n=s.wrap([new b(this.guard,n)]))),n=[].concat(this.makeCode("\n"),n.compileToFragments(e,L),this.makeCode("\n"+this.tab))),t=[].concat(this.makeCode(r+this.tab+"while ("),this.condition.compileToFragments(e,N),this.makeCode(") {"),n,this.makeCode("}")),this.returns&&t.push(this.makeCode("\n"+this.tab+"return "+i+";")),t},t}(r),e.Op=I=function(e){function n(e,t,n,i){if("in"===e)return new k(t,n);if("do"===e)return this.generateDo(t);if("new"===e){if(t instanceof o&&!t["do"]&&!t.isNew)return t.newInstance();(t instanceof c&&t.bound||t["do"])&&(t=new O(t))}return this.operator=r[e]||e,this.first=t,this.second=n,this.flip=!!i,this}var r,s;return kt(n,e),r={"==":"===","!=":"!==",of:"in",yieldfrom:"yield*"},s={"!==":"===","===":"!=="},n.prototype.children=["first","second"],n.prototype.isSimpleNumber=D,n.prototype.isYield=function(){var e;return"yield"===(e=this.operator)||"yield*"===e},n.prototype.isYieldReturn=function(){return this.isYield()&&this.first instanceof M},n.prototype.isUnary=function(){return!this.second},n.prototype.isComplex=function(){var e;return!(this.isUnary()&&("+"===(e=this.operator)||"-"===e)&&this.first instanceof z&&this.first.isSimpleNumber())},n.prototype.isChainable=function(){var e;return"<"===(e=this.operator)||">"===e||">="===e||"<="===e||"==="===e||"!=="===e},n.prototype.invert=function(){var e,t,i,r,o;if(this.isChainable()&&this.first.isChainable()){for(e=!0,t=this;t&&t.operator;)e&&(e=t.operator in s),t=t.first;if(!e)return new O(this).invert();for(t=this;t&&t.operator;)t.invert=!t.invert,t.operator=s[t.operator],t=t.first;return this}return(r=s[this.operator])?(this.operator=r,this.first.unwrap()instanceof n&&this.first.invert(),this):this.second?new O(this).invert():"!"===this.operator&&(i=this.first.unwrap())instanceof n&&("!"===(o=i.operator)||"in"===o||"instanceof"===o)?i:new n("!",this)},n.prototype.unfoldSoak=function(e){var t;return("++"===(t=this.operator)||"--"===t||"delete"===t)&&yt(e,this,"first")},n.prototype.generateDo=function(e){var t,n,r,s,a,h,l,u;for(h=[],n=e instanceof i&&(l=e.value.unwrap())instanceof c?l:e,u=n.params||[],r=0,s=u.length;s>r;r++)a=u[r],a.value?(h.push(a.value),delete a.value):h.push(a);return t=new o(e,h),t["do"]=!0,t},n.prototype.compileNode=function(e){var t,n,i,r,s,o;if(n=this.isChainable()&&this.first.isChainable(),n||(this.first.front=this.front),"delete"===this.operator&&e.scope.check(this.first.unwrapAll().value)&&this.error("delete operand may not be argument or var"),("--"===(r=this.operator)||"++"===r)&&(s=this.first.unwrapAll().value,Tt.call(V,s)>=0)&&this.error('cannot increment/decrement "'+this.first.unwrapAll().value+'"'),this.isYield())return this.compileYield(e);if(this.isUnary())return this.compileUnary(e);if(n)return this.compileChain(e);switch(this.operator){case"?":return this.compileExistence(e);case"**":return this.compilePower(e);case"//":return this.compileFloorDivision(e);case"%%":return this.compileModulo(e);default:return i=this.first.compileToFragments(e,F),o=this.second.compileToFragments(e,F),t=[].concat(i,this.makeCode(" "+this.operator+" "),o),F>=e.level?t:this.wrapInBraces(t)}},n.prototype.compileChain=function(e){var t,n,i,r;return i=this.first.second.cache(e),this.first.second=i[0],r=i[1],n=this.first.compileToFragments(e,F),t=n.concat(this.makeCode(" "+(this.invert?"&&":"||")+" "),r.compileToFragments(e),this.makeCode(" "+this.operator+" "),this.second.compileToFragments(e,F)),this.wrapInBraces(t)},n.prototype.compileExistence=function(e){var t,n;return this.first.isComplex()?(n=new x(e.scope.freeVariable("ref")),t=new O(new i(n,this.first))):(t=this.first,n=t),new b(new u(t),n,{type:"if"}).addElse(this.second).compileToFragments(e)},n.prototype.compileUnary=function(e){var t,i,r;return i=[],t=this.operator,i.push([this.makeCode(t)]),"!"===t&&this.first instanceof u?(this.first.negated=!this.first.negated,this.first.compileToFragments(e)):e.level>=T?new O(this).compileToFragments(e):(r="+"===t||"-"===t,("new"===t||"typeof"===t||"delete"===t||r&&this.first instanceof n&&this.first.operator===t)&&i.push([this.makeCode(" ")]),(r&&this.first instanceof n||"new"===t&&this.first.isStatement(e))&&(this.first=new O(this.first)),i.push(this.first.compileToFragments(e,F)),this.flip&&i.reverse(),this.joinFragmentArrays(i,""))},n.prototype.compileYield=function(e){var t,n;return n=[],t=this.operator,null==e.scope.parent&&this.error("yield statements must occur within a function generator."),Tt.call(Object.keys(this.first),"expression")>=0&&!(this.first instanceof W)?this.isYieldReturn()?n.push(this.first.compileToFragments(e,L)):null!=this.first.expression&&n.push(this.first.expression.compileToFragments(e,F)):(n.push([this.makeCode("("+t+" ")]),n.push(this.first.compileToFragments(e,F)),n.push([this.makeCode(")")])),this.joinFragmentArrays(n,"")},n.prototype.compilePower=function(e){var n;return n=new z(new x("Math"),[new t(new x("pow"))]),new o(n,[this.first,this.second]).compileToFragments(e)},n.prototype.compileFloorDivision=function(e){var i,r;return r=new z(new x("Math"),[new t(new x("floor"))]),i=new n("/",this.first,this.second),new o(r,[i]).compileToFragments(e)},n.prototype.compileModulo=function(e){var t;return t=new z(new x(bt("modulo",e))),new o(t,[this.first,this.second]).compileToFragments(e)},n.prototype.toString=function(e){return n.__super__.toString.call(this,e,this.constructor.name+" "+this.operator)},n}(r),e.In=k=function(e){function t(e,t){this.object=e,this.array=t}return kt(t,e),t.prototype.children=["object","array"],t.prototype.invert=S,t.prototype.compileNode=function(e){var t,n,i,r,s;if(this.array instanceof z&&this.array.isArray()&&this.array.base.objects.length){for(s=this.array.base.objects,n=0,i=s.length;i>n;n++)if(r=s[n],r instanceof G){t=!0;break}if(!t)return this.compileOrTest(e)}return this.compileLoopTest(e)},t.prototype.compileOrTest=function(e){var t,n,i,r,s,o,a,c,h,l,u,p;for(c=this.object.cache(e,F),u=c[0],a=c[1],h=this.negated?[" !== "," && "]:[" === "," || "],t=h[0],n=h[1],p=[],l=this.array.base.objects,i=s=0,o=l.length;o>s;i=++s)r=l[i],i&&p.push(this.makeCode(n)),p=p.concat(i?a:u,this.makeCode(t),r.compileToFragments(e,T));return F>e.level?p:this.wrapInBraces(p)},t.prototype.compileLoopTest=function(e){var t,n,i,r;return i=this.object.cache(e,E),r=i[0],n=i[1],t=[].concat(this.makeCode(bt("indexOf",e)+".call("),this.array.compileToFragments(e,E),this.makeCode(", "),n,this.makeCode(") "+(this.negated?"< 0":">= 0"))),st(r)===st(n)?t:(t=r.concat(this.makeCode(", "),t),E>e.level?t:this.wrapInBraces(t))},t.prototype.toString=function(e){return t.__super__.toString.call(this,e,this.constructor.name+(this.negated?"!":""))},t}(r),e.Try=Y=function(e){function t(e,t,n,i){this.attempt=e,this.errorVariable=t,this.recovery=n,this.ensure=i}return kt(t,e),t.prototype.children=["attempt","recovery","ensure"],t.prototype.isStatement=Q,t.prototype.jumps=function(e){var t;return this.attempt.jumps(e)||(null!=(t=this.recovery)?t.jumps(e):void 0)},t.prototype.makeReturn=function(e){return this.attempt&&(this.attempt=this.attempt.makeReturn(e)),this.recovery&&(this.recovery=this.recovery.makeReturn(e)),this},t.prototype.compileNode=function(e){var t,n,r,s;return e.indent+=q,s=this.attempt.compileToFragments(e,L),t=this.recovery?(r=new x("_error"),this.errorVariable?this.recovery.unshift(new i(this.errorVariable,r)):void 0,[].concat(this.makeCode(" catch ("),r.compileToFragments(e),this.makeCode(") {\n"),this.recovery.compileToFragments(e,L),this.makeCode("\n"+this.tab+"}"))):this.ensure||this.recovery?[]:[this.makeCode(" catch (_error) {}")],n=this.ensure?[].concat(this.makeCode(" finally {\n"),this.ensure.compileToFragments(e,L),this.makeCode("\n"+this.tab+"}")):[],[].concat(this.makeCode(this.tab+"try {\n"),s,this.makeCode("\n"+this.tab+"}"),t,n)},t}(r),e.Throw=W=function(e){function t(e){this.expression=e}return kt(t,e),t.prototype.children=["expression"],t.prototype.isStatement=Q,t.prototype.jumps=D,t.prototype.makeReturn=X,t.prototype.compileNode=function(e){return[].concat(this.makeCode(this.tab+"throw "),this.expression.compileToFragments(e),this.makeCode(";"))},t}(r),e.Existence=u=function(e){function t(e){this.expression=e}return kt(t,e),t.prototype.children=["expression"],t.prototype.invert=S,t.prototype.compileNode=function(e){var t,n,i,r;return this.expression.front=this.front,i=this.expression.compile(e,F),g.test(i)&&!e.scope.check(i)?(r=this.negated?["===","||"]:["!==","&&"],t=r[0],n=r[1],i="typeof "+i+" "+t+' "undefined" '+n+" "+i+" "+t+" null"):i=i+" "+(this.negated?"==":"!=")+" null",[this.makeCode(C>=e.level?i:"("+i+")")]},t}(r),e.Parens=O=function(e){function t(e){this.body=e}return kt(t,e),t.prototype.children=["body"],t.prototype.unwrap=function(){return this.body},t.prototype.isComplex=function(){return this.body.isComplex()},t.prototype.compileNode=function(e){var t,n,i;return n=this.body.unwrap(),n instanceof z&&n.isAtomic()?(n.front=this.front,n.compileToFragments(e)):(i=n.compileToFragments(e,N),t=F>e.level&&(n instanceof I||n instanceof o||n instanceof f&&n.returns),t?i:this.wrapInBraces(i))},t}(r),e.For=f=function(e){function t(e,t){var n;this.source=t.source,this.guard=t.guard,this.step=t.step,this.name=t.name,this.index=t.index,this.body=s.wrap([e]),this.own=!!t.own,this.object=!!t.object,this.object&&(n=[this.index,this.name],this.name=n[0],this.index=n[1]),this.index instanceof z&&this.index.error("index cannot be a pattern matching expression"),this.range=this.source instanceof z&&this.source.base instanceof j&&!this.source.properties.length,this.pattern=this.name instanceof z,this.range&&this.index&&this.index.error("indexes do not apply to range loops"),this.range&&this.pattern&&this.name.error("cannot pattern match over range loops"),this.own&&!this.object&&this.name.error("cannot use own with for-in"),this.returns=!1}return kt(t,e),t.prototype.children=["body","source","guard","step"],t.prototype.compileNode=function(e){var t,n,r,o,a,c,h,l,u,p,d,f,m,v,y,k,w,T,C,F,N,S,D,A,I,_,$,j,B,V,P,U,G,H;return t=s.wrap([this.body]),D=t.expressions,T=D[D.length-1],(null!=T?T.jumps():void 0)instanceof M&&(this.returns=!1),B=this.range?this.source.base:this.source,j=e.scope,this.pattern||(F=this.name&&this.name.compile(e,E)),v=this.index&&this.index.compile(e,E),F&&!this.pattern&&j.find(F),v&&j.find(v),this.returns&&($=j.freeVariable("results")),y=this.object&&v||j.freeVariable("i",{single:!0}),k=this.range&&F||v||y,w=k!==y?k+" = ":"",this.step&&!this.range&&(A=this.cacheToCodeFragments(this.step.cache(e,E,ot)),V=A[0],U=A[1],P=U.match(R)),this.pattern&&(F=y),H="",d="",h="",f=this.tab+q,this.range?p=B.compileToFragments(lt(e,{index:y,name:F,step:this.step,isComplex:ot})):(G=this.source.compile(e,E),!F&&!this.own||g.test(G)||(h+=""+this.tab+(S=j.freeVariable("ref"))+" = "+G+";\n",G=S),F&&!this.pattern&&(N=F+" = "+G+"["+k+"]"),this.object||(V!==U&&(h+=""+this.tab+V+";\n"),this.step&&P&&(u=0>pt(P[0]))||(C=j.freeVariable("len")),a=""+w+y+" = 0, "+C+" = "+G+".length",c=""+w+y+" = "+G+".length - 1",r=y+" < "+C,o=y+" >= 0",this.step?(P?u&&(r=o,a=c):(r=U+" > 0 ? "+r+" : "+o,a="("+U+" > 0 ? ("+a+") : "+c+")"),m=y+" += "+U):m=""+(k!==y?"++"+y:y+"++"),p=[this.makeCode(a+"; "+r+"; "+w+m)])),this.returns&&(I=""+this.tab+$+" = [];\n",_="\n"+this.tab+"return "+$+";",t.makeReturn($)),this.guard&&(t.expressions.length>1?t.expressions.unshift(new b(new O(this.guard).invert(),new x("continue"))):this.guard&&(t=s.wrap([new b(this.guard,t)]))),this.pattern&&t.expressions.unshift(new i(this.name,new x(G+"["+k+"]"))),l=[].concat(this.makeCode(h),this.pluckDirectCall(e,t)),N&&(H="\n"+f+N+";"),this.object&&(p=[this.makeCode(k+" in "+G)],this.own&&(d="\n"+f+"if (!"+bt("hasProp",e)+".call("+G+", "+k+")) continue;")),n=t.compileToFragments(lt(e,{indent:f}),L),n&&n.length>0&&(n=[].concat(this.makeCode("\n"),n,this.makeCode("\n"))),[].concat(l,this.makeCode(""+(I||"")+this.tab+"for ("),p,this.makeCode(") {"+d+H),n,this.makeCode(this.tab+"}"+(_||"")))},t.prototype.pluckDirectCall=function(e,t){var n,r,s,a,h,l,u,p,d,f,m,g,v,y,b,k;for(r=[],d=t.expressions,h=l=0,u=d.length;u>l;h=++l)s=d[h],s=s.unwrapAll(),s instanceof o&&(k=null!=(f=s.variable)?f.unwrapAll():void 0,(k instanceof c||k instanceof z&&(null!=(m=k.base)?m.unwrapAll():void 0)instanceof c&&1===k.properties.length&&("call"===(g=null!=(v=k.properties[0].name)?v.value:void 0)||"apply"===g))&&(a=(null!=(y=k.base)?y.unwrapAll():void 0)||k,p=new x(e.scope.freeVariable("fn")),n=new z(p),k.base&&(b=[n,k],k.base=b[0],n=b[1]),t.expressions[h]=new o(n,s.args),r=r.concat(this.makeCode(this.tab),new i(p,a).compileToFragments(e,L),this.makeCode(";\n"))));return r},t}(J),e.Switch=H=function(e){function t(e,t,n){this.subject=e,this.cases=t,this.otherwise=n}return kt(t,e),t.prototype.children=["subject","cases","otherwise"],t.prototype.isStatement=Q,t.prototype.jumps=function(e){var t,n,i,r,s,o,a,c;for(null==e&&(e={block:!0}),o=this.cases,i=0,s=o.length;s>i;i++)if(a=o[i],n=a[0],t=a[1],r=t.jumps(e))return r;return null!=(c=this.otherwise)?c.jumps(e):void 0},t.prototype.makeReturn=function(e){var t,n,i,r,o;for(r=this.cases,t=0,n=r.length;n>t;t++)i=r[t],i[1].makeReturn(e);return e&&(this.otherwise||(this.otherwise=new s([new x("void 0")]))),null!=(o=this.otherwise)&&o.makeReturn(e),this},t.prototype.compileNode=function(e){var t,n,i,r,s,o,a,c,h,l,u,p,d,f,m,g;for(c=e.indent+q,h=e.indent=c+q,o=[].concat(this.makeCode(this.tab+"switch ("),this.subject?this.subject.compileToFragments(e,N):this.makeCode("false"),this.makeCode(") {\n")),f=this.cases,a=l=0,p=f.length;p>l;a=++l){for(m=f[a],r=m[0],t=m[1],g=rt([r]),u=0,d=g.length;d>u;u++)i=g[u],this.subject||(i=i.invert()),o=o.concat(this.makeCode(c+"case "),i.compileToFragments(e,N),this.makeCode(":\n"));if((n=t.compileToFragments(e,L)).length>0&&(o=o.concat(n,this.makeCode("\n"))),a===this.cases.length-1&&!this.otherwise)break;s=this.lastNonComment(t.expressions),s instanceof M||s instanceof x&&s.jumps()&&"debugger"!==s.value||o.push(i.makeCode(h+"break;\n"))}return this.otherwise&&this.otherwise.expressions.length&&o.push.apply(o,[this.makeCode(c+"default:\n")].concat(Ct.call(this.otherwise.compileToFragments(e,L)),[this.makeCode("\n")])),o.push(this.makeCode(this.tab+"}")),o},t}(r),e.If=b=function(e){function t(e,t,n){this.body=t,null==n&&(n={}),this.condition="unless"===n.type?e.invert():e,this.elseBody=null,this.isChain=!1,this.soak=n.soak}return kt(t,e),t.prototype.children=["condition","body","elseBody"],t.prototype.bodyNode=function(){var e;return null!=(e=this.body)?e.unwrap():void 0},t.prototype.elseBodyNode=function(){var e;return null!=(e=this.elseBody)?e.unwrap():void 0},t.prototype.addElse=function(e){return this.isChain?this.elseBodyNode().addElse(e):(this.isChain=e instanceof t,this.elseBody=this.ensureBlock(e),this.elseBody.updateLocationDataIfMissing(e.locationData)),this},t.prototype.isStatement=function(e){var t;return(null!=e?e.level:void 0)===L||this.bodyNode().isStatement(e)||(null!=(t=this.elseBodyNode())?t.isStatement(e):void 0)},t.prototype.jumps=function(e){var t;return this.body.jumps(e)||(null!=(t=this.elseBody)?t.jumps(e):void 0)},t.prototype.compileNode=function(e){return this.isStatement(e)?this.compileStatement(e):this.compileExpression(e)},t.prototype.makeReturn=function(e){return e&&(this.elseBody||(this.elseBody=new s([new x("void 0")]))),this.body&&(this.body=new s([this.body.makeReturn(e)])),this.elseBody&&(this.elseBody=new s([this.elseBody.makeReturn(e)])),this},t.prototype.ensureBlock=function(e){return e instanceof s?e:new s([e])},t.prototype.compileStatement=function(e){var n,i,r,s,o,a,c;return r=tt(e,"chainChild"),(o=tt(e,"isExistentialEquals"))?new t(this.condition.invert(),this.elseBodyNode(),{type:"if"}).compileToFragments(e):(c=e.indent+q,s=this.condition.compileToFragments(e,N),i=this.ensureBlock(this.body).compileToFragments(lt(e,{indent:c})),a=[].concat(this.makeCode("if ("),s,this.makeCode(") {\n"),i,this.makeCode("\n"+this.tab+"}")),r||a.unshift(this.makeCode(this.tab)),this.elseBody?(n=a.concat(this.makeCode(" else ")),this.isChain?(e.chainChild=!0,n=n.concat(this.elseBody.unwrap().compileToFragments(e,L))):n=n.concat(this.makeCode("{\n"),this.elseBody.compileToFragments(lt(e,{indent:c}),L),this.makeCode("\n"+this.tab+"}")),n):a)},t.prototype.compileExpression=function(e){var t,n,i,r;return i=this.condition.compileToFragments(e,C),n=this.bodyNode().compileToFragments(e,E),t=this.elseBodyNode()?this.elseBodyNode().compileToFragments(e,E):[this.makeCode("void 0")],r=i.concat(this.makeCode(" ? "),n,this.makeCode(" : "),t),e.level>=C?this.wrapInBraces(r):r},t.prototype.unfoldSoak=function(){return this.soak&&this},t}(r),K={extend:function(e){return"function(child, parent) { for (var key in parent) { if ("+bt("hasProp",e)+".call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }"},bind:function(){return"function(fn, me){ return function(){ return fn.apply(me, arguments); }; }"},indexOf:function(){return"[].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }"},modulo:function(){return"function(a, b) { return (+a % (b = +b) + b) % b; }"},hasProp:function(){return"{}.hasOwnProperty"},slice:function(){return"[].slice"}},L=1,N=2,E=3,C=4,F=5,T=6,q=" ",g=/^(?!\d)[$\w\x7f-\uffff]+$/,B=/^[+-]?\d+$/,m=/^[+-]?0x[\da-f]+/i,R=/^[+-]?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)$/i,y=/^['"]/,v=/^\//,bt=function(e,t){var n,i;return i=t.scope.root,e in i.utilities?i.utilities[e]:(n=i.freeVariable(e),i.assign(n,K[e](t)),i.utilities[e]=n)},ut=function(e,t){return e=e.replace(/\n/g,"$&"+t),e.replace(/\s+$/,"")},pt=function(e){return null==e?0:e.match(m)?parseInt(e,16):parseFloat(e)},at=function(e){return e instanceof x&&"arguments"===e.value&&!e.asKey},ct=function(e){return e instanceof x&&"this"===e.value&&!e.asKey||e instanceof c&&e.bound||e instanceof o&&e.isSuper},ot=function(e){return e.isComplex()||("function"==typeof e.isAssignable?e.isAssignable():void 0)},yt=function(e,t,n){var i;if(i=t[n].unfoldSoak(e))return t[n]=i.body,i.body=new z(t),i}}.call(this),t.exports}(),require["./sourcemap"]=function(){var e={},t={exports:e};return function(){var e,n;e=function(){function e(e){this.line=e,this.columns=[]}return e.prototype.add=function(e,t,n){var i,r;return r=t[0],i=t[1],null==n&&(n={}),this.columns[e]&&n.noReplace?void 0:this.columns[e]={line:this.line,column:e,sourceLine:r,sourceColumn:i}},e.prototype.sourceLocation=function(e){for(var t;!((t=this.columns[e])||0>=e);)e--;return t&&[t.sourceLine,t.sourceColumn]},e}(),n=function(){function t(){this.lines=[]}var n,i,r,s;return t.prototype.add=function(t,n,i){var r,s,o,a;return null==i&&(i={}),o=n[0],s=n[1],a=(r=this.lines)[o]||(r[o]=new e(o)),a.add(s,t,i)},t.prototype.sourceLocation=function(e){var t,n,i;for(n=e[0],t=e[1];!((i=this.lines[n])||0>=n);)n--;return i&&i.sourceLocation(t)},t.prototype.generate=function(e,t){var n,i,r,s,o,a,c,h,l,u,p,d,f,m,g,v;for(null==e&&(e={}),null==t&&(t=null),v=0,s=0,a=0,o=0,d=!1,n="",f=this.lines,u=i=0,c=f.length;c>i;u=++i)if(l=f[u])for(m=l.columns,r=0,h=m.length;h>r;r++)if(p=m[r]){for(;p.line>v;)s=0,d=!1,n+=";",v++;d&&(n+=",",d=!1),n+=this.encodeVlq(p.column-s),s=p.column,n+=this.encodeVlq(0),n+=this.encodeVlq(p.sourceLine-a),a=p.sourceLine,n+=this.encodeVlq(p.sourceColumn-o),o=p.sourceColumn,d=!0}return g={version:3,file:e.generatedFile||"",sourceRoot:e.sourceRoot||"",sources:e.sourceFiles||[""],names:[],mappings:n},e.inline&&(g.sourcesContent=[t]),JSON.stringify(g,null,2)},r=5,i=1<e?1:0,a=(Math.abs(e)<<1)+o;a||!t;)n=a&s,a>>=r,a&&(n|=i),t+=this.encodeBase64(n);return t},n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t.prototype.encodeBase64=function(e){return n[e]||function(){throw Error("Cannot Base64 encode value: "+e)}()},t}(),t.exports=n}.call(this),t.exports}(),require["./coffee-script"]=function(){var e={},t={exports:e};return function(){var t,n,i,r,s,o,a,c,h,l,u,p,d,f,m,g,v,y,b={}.hasOwnProperty,k=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};if(a=require("fs"),v=require("vm"),f=require("path"),t=require("./lexer").Lexer,d=require("./parser").parser,h=require("./helpers"),n=require("./sourcemap"),e.VERSION="1.9.3",e.FILE_EXTENSIONS=[".coffee",".litcoffee",".coffee.md"],e.helpers=h,y=function(e){return function(t,n){var i;null==n&&(n={});try{return e.call(this,t,n) -}catch(r){if(i=r,"string"!=typeof t)throw i;throw h.updateSyntaxError(i,t,n.filename)}}},e.compile=r=y(function(e,t){var i,r,s,o,a,c,l,u,f,m,g,v,y,b,k;for(v=h.merge,o=h.extend,t=o({},t),t.sourceMap&&(g=new n),k=p.tokenize(e,t),t.referencedVars=function(){var e,t,n;for(n=[],e=0,t=k.length;t>e;e++)b=k[e],b.variable&&n.push(b[1]);return n}(),c=d.parse(k).compileToFragments(t),s=0,t.header&&(s+=1),t.shiftLine&&(s+=1),r=0,f="",u=0,m=c.length;m>u;u++)a=c[u],t.sourceMap&&(a.locationData&&!/^[;\s]*$/.test(a.code)&&g.add([a.locationData.first_line,a.locationData.first_column],[s,r],{noReplace:!0}),y=h.count(a.code,"\n"),s+=y,y?r=a.code.length-(a.code.lastIndexOf("\n")+1):r+=a.code.length),f+=a.code;return t.header&&(l="Generated by CoffeeScript "+this.VERSION,f="// "+l+"\n"+f),t.sourceMap?(i={js:f},i.sourceMap=g,i.v3SourceMap=g.generate(t,e),i):f}),e.tokens=y(function(e,t){return p.tokenize(e,t)}),e.nodes=y(function(e,t){return"string"==typeof e?d.parse(p.tokenize(e,t)):d.parse(e)}),e.run=function(e,t){var n,i,s,o;return null==t&&(t={}),s=require.main,s.filename=process.argv[1]=t.filename?a.realpathSync(t.filename):".",s.moduleCache&&(s.moduleCache={}),i=t.filename?f.dirname(a.realpathSync(t.filename)):a.realpathSync("."),s.paths=require("module")._nodeModulePaths(i),(!h.isCoffee(s.filename)||require.extensions)&&(n=r(e,t),e=null!=(o=n.js)?o:n),s._compile(e,s.filename)},e.eval=function(e,t){var n,i,s,o,a,c,h,l,u,p,d,m,g,y,k,w,T;if(null==t&&(t={}),e=e.trim()){if(o=null!=(m=v.Script.createContext)?m:v.createContext,c=null!=(g=v.isContext)?g:function(){return t.sandbox instanceof o().constructor},o){if(null!=t.sandbox){if(c(t.sandbox))w=t.sandbox;else{w=o(),y=t.sandbox;for(l in y)b.call(y,l)&&(T=y[l],w[l]=T)}w.global=w.root=w.GLOBAL=w}else w=global;if(w.__filename=t.filename||"eval",w.__dirname=f.dirname(w.__filename),w===global&&!w.module&&!w.require){for(n=require("module"),w.module=i=new n(t.modulename||"eval"),w.require=s=function(e){return n._load(e,i,!0)},i.filename=w.__filename,k=Object.getOwnPropertyNames(require),a=0,u=k.length;u>a;a++)d=k[a],"paths"!==d&&(s[d]=require[d]);s.paths=i.paths=n._nodeModulePaths(process.cwd()),s.resolve=function(e){return n._resolveFilename(e,i)}}}p={};for(l in t)b.call(t,l)&&(T=t[l],p[l]=T);return p.bare=!0,h=r(e,p),w===global?v.runInThisContext(h):v.runInContext(h,w)}},e.register=function(){return require("./register")},require.extensions)for(m=this.FILE_EXTENSIONS,l=0,u=m.length;u>l;l++)s=m[l],null==(i=require.extensions)[s]&&(i[s]=function(){throw Error("Use CoffeeScript.register() or require the coffee-script/register module to require "+s+" files.")});e._compileFile=function(e,t){var n,i,s,o;null==t&&(t=!1),s=a.readFileSync(e,"utf8"),o=65279===s.charCodeAt(0)?s.substring(1):s;try{n=r(o,{filename:e,sourceMap:t,literate:h.isLiterate(e)})}catch(c){throw i=c,h.updateSyntaxError(i,o,e)}return n},p=new t,d.lexer={lex:function(){var e,t;return t=d.tokens[this.pos++],t?(e=t[0],this.yytext=t[1],this.yylloc=t[2],d.errorToken=t.origin||t,this.yylineno=this.yylloc.first_line):e="",e},setInput:function(e){return d.tokens=e,this.pos=0},upcomingInput:function(){return""}},d.yy=require("./nodes"),d.yy.parseError=function(e,t){var n,i,r,s,o,a;return o=t.token,s=d.errorToken,a=d.tokens,i=s[0],r=s[1],n=s[2],r=function(){switch(!1){case s!==a[a.length-1]:return"end of input";case"INDENT"!==i&&"OUTDENT"!==i:return"indentation";case"IDENTIFIER"!==i&&"NUMBER"!==i&&"STRING"!==i&&"STRING_START"!==i&&"REGEX"!==i&&"REGEX_START"!==i:return i.replace(/_START$/,"").toLowerCase();default:return h.nameWhitespaceCharacter(r)}}(),h.throwSyntaxError("unexpected "+r,n)},o=function(e,t){var n,i,r,s,o,a,c,h,l,u,p,d;return s=void 0,r="",e.isNative()?r="native":(e.isEval()?(s=e.getScriptNameOrSourceURL(),s||(r=e.getEvalOrigin()+", ")):s=e.getFileName(),s||(s=""),h=e.getLineNumber(),i=e.getColumnNumber(),u=t(s,h,i),r=u?s+":"+u[0]+":"+u[1]:s+":"+h+":"+i),o=e.getFunctionName(),a=e.isConstructor(),c=!(e.isToplevel()||a),c?(l=e.getMethodName(),d=e.getTypeName(),o?(p=n="",d&&o.indexOf(d)&&(p=d+"."),l&&o.indexOf("."+l)!==o.length-l.length-1&&(n=" [as "+l+"]"),""+p+o+n+" ("+r+")"):d+"."+(l||"")+" ("+r+")"):a?"new "+(o||"")+" ("+r+")":o?o+" ("+r+")":r},g={},c=function(t){var n,i;if(g[t])return g[t];if(i=null!=f?f.extname(t):void 0,!(0>k.call(e.FILE_EXTENSIONS,i)))return n=e._compileFile(t,!0),g[t]=n.sourceMap},Error.prepareStackTrace=function(t,n){var i,r,s;return s=function(e,t,n){var i,r;return r=c(e),r&&(i=r.sourceLocation([t-1,n-1])),i?[i[0]+1,i[1]+1]:null},r=function(){var t,r,a;for(a=[],t=0,r=n.length;r>t&&(i=n[t],i.getFunction()!==e.run);t++)a.push(" at "+o(i,s));return a}(),""+t+"\n"+r.join("\n")+"\n"}}.call(this),t.exports}(),require["./browser"]=function(){var exports={},module={exports:exports};return function(){var CoffeeScript,compile,runScripts,indexOf=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};CoffeeScript=require("./coffee-script"),CoffeeScript.require=require,compile=CoffeeScript.compile,CoffeeScript.eval=function(code,options){return null==options&&(options={}),null==options.bare&&(options.bare=!0),eval(compile(code,options))},CoffeeScript.run=function(e,t){return null==t&&(t={}),t.bare=!0,t.shiftLine=!0,Function(compile(e,t))()},"undefined"!=typeof window&&null!==window&&("undefined"!=typeof btoa&&null!==btoa&&"undefined"!=typeof JSON&&null!==JSON&&"undefined"!=typeof unescape&&null!==unescape&&"undefined"!=typeof encodeURIComponent&&null!==encodeURIComponent&&(compile=function(e,t){var n,i,r;return null==t&&(t={}),t.sourceMap=!0,t.inline=!0,i=CoffeeScript.compile(e,t),n=i.js,r=i.v3SourceMap,n+"\n//# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(r)))+"\n//# sourceURL=coffeescript"}),CoffeeScript.load=function(e,t,n,i){var r;return null==n&&(n={}),null==i&&(i=!1),n.sourceFiles=[e],r=window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLHTTP"):new window.XMLHttpRequest,r.open("GET",e,!0),"overrideMimeType"in r&&r.overrideMimeType("text/plain"),r.onreadystatechange=function(){var s,o;if(4===r.readyState){if(0!==(o=r.status)&&200!==o)throw Error("Could not load "+e);if(s=[r.responseText,n],i||CoffeeScript.run.apply(CoffeeScript,s),t)return t(s)}},r.send(null)},runScripts=function(){var e,t,n,i,r,s,o,a,c,h,l;for(l=window.document.getElementsByTagName("script"),t=["text/coffeescript","text/literate-coffeescript"],e=function(){var e,n,i,r;for(r=[],e=0,n=l.length;n>e;e++)c=l[e],i=c.type,indexOf.call(t,i)>=0&&r.push(c);return r}(),s=0,n=function(){var t;return t=e[s],t instanceof Array?(CoffeeScript.run.apply(CoffeeScript,t),s++,n()):void 0},i=function(i,r){var s,o;return s={literate:i.type===t[1]},o=i.src||i.getAttribute("data-src"),o?CoffeeScript.load(o,function(t){return e[r]=t,n()},s,!0):(s.sourceFiles=["embedded"],e[r]=[i.innerHTML,s])},r=o=0,a=e.length;a>o;r=++o)h=e[r],i(h,r);return n()},window.addEventListener?window.addEventListener("DOMContentLoaded",runScripts,!1):window.attachEvent("onload",runScripts))}.call(this),module.exports}(),require["./coffee-script"]}();"function"==typeof define&&define.amd?define(function(){return CoffeeScript}):root.CoffeeScript=CoffeeScript})(this); \ No newline at end of file diff --git a/resources/compiled_coffeescript.zip b/resources/compiled_coffeescript.zip deleted file mode 100644 index c71bb11388a746dbbde0f2e6982de49ec53074e8..0000000000000000000000000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bnf5lZQof$`8Y}l?EZGQTOM_f n?%nV1_Itg1+js8lbhdUo_wL{Af#BQyod>=9NB8fq{P6z)Y?5Uq diff --git a/resources/viewer/blank.html b/resources/viewer/blank.html deleted file mode 100644 index da7c5a637d..0000000000 --- a/resources/viewer/blank.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - blank - - - -

     
    - - - diff --git a/resources/viewer/bookmarks.js b/resources/viewer/bookmarks.js deleted file mode 100644 index 253524326f..0000000000 --- a/resources/viewer/bookmarks.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * bookmarks management - * Copyright 2008 Kovid Goyal - * License: GNU GPL v3 - */ - -function selector_in_parent(elem) { - var num = elem.prevAll().length; - var sel = " > *:eq("+num+") "; - return sel; -} - -function selector(elem) { - var obj = elem; - var sel = ""; - while (obj[0] != document) { - sel = selector_in_parent(obj) + sel; - obj = obj.parent(); - } - if (sel.length > 2 && sel.charAt(1) == ">") sel = sel.substring(2); - return sel; -} - -function calculate_bookmark(y, node) { - var elem = $(node); - var sel = selector(elem); - var ratio = (y - elem.offset().top)/elem.height(); - if (ratio > 1) { ratio = 1; } - if (ratio < 0) { ratio = 0; } - sel = sel + "|" + ratio; - return sel; -} - -function animated_scrolling_done() { - window.py_bridge.animated_scroll_done(); -} - -function scroll_to_bookmark(bookmark) { - bm = bookmark.split("|"); - var ratio = 0.7 * parseFloat(bm[1]); - $.scrollTo($(bm[0]), 1000, - { - over:ratio, - axis: 'y', // Do not scroll in the x direction - onAfter:function(){window.py_bridge.animated_scroll_done()} - } - ); -} - diff --git a/resources/viewer/hyphenate/Hyphenator.js b/resources/viewer/hyphenate/Hyphenator.js deleted file mode 100644 index 75aac3e5b4..0000000000 --- a/resources/viewer/hyphenate/Hyphenator.js +++ /dev/null @@ -1,3281 +0,0 @@ - -/** @license Hyphenator 5.1.0 - client side hyphenation for webbrowsers - * Copyright (C) 2015 Mathias Nater, Zürich (mathiasnater at gmail dot com) - * https://github.com/mnater/Hyphenator - * - * Released under the MIT license - * http://mnater.github.io/Hyphenator/LICENSE.txt - */ - -/* - * Comments are jsdoc3 formatted. See http://usejsdoc.org - * Use mergeAndPack.html to get rid of the comments and to reduce the file size of this script! - */ - -/* The following comment is for JSLint: */ -/*jslint browser: true */ - -/** - * @desc Provides all functionality to do hyphenation, except the patterns that are loaded externally - * @global - * @namespace Hyphenator - * @author Mathias Nater, - * @version 5.1.0 - * @example - * <script src = "Hyphenator.js" type = "text/javascript"></script> - * <script type = "text/javascript"> - * Hyphenator.run(); - * </script> - */ -var Hyphenator = (function (window) { - 'use strict'; - - /** - * @member Hyphenator~contextWindow - * @access private - * @desc - * contextWindow stores the window for the actual document to be hyphenated. - * If there are frames this will change. - * So use contextWindow instead of window! - */ - var contextWindow = window, - - - /** - * @member {Object.} Hyphenator~supportedLangs - * @desc - * A generated key-value object that stores supported languages and meta data. - * The key is the {@link http://tools.ietf.org/rfc/bcp/bcp47.txt bcp47} code of the language and the value - * is an object of type {@link Hyphenator~supportedLangs~supportedLanguage} - * @namespace Hyphenator~supportedLangs - * @access private - * //Check if language lang is supported: - * if (supportedLangs.hasOwnProperty(lang)) - */ - supportedLangs = (function () { - /** - * @typedef {Object} Hyphenator~supportedLangs~supportedLanguage - * @property {string} file - The name of the pattern file - * @property {number} script - The script type of the language (e.g. 'latin' for english), this type is abbreviated by an id - * @property {string} prompt - The sentence prompted to the user, if Hyphenator.js doesn't find a language hint - */ - - /** - * @lends Hyphenator~supportedLangs - */ - var r = {}, - /** - * @method Hyphenator~supportedLangs~o - * @desc - * Sets a value of Hyphenator~supportedLangs - * @access protected - * @param {string} code The {@link http://tools.ietf.org/rfc/bcp/bcp47.txt bcp47} code of the language - * @param {string} file The name of the pattern file - * @param {Number} script A shortcut for a specific script: latin:0, cyrillic: 1, arabic: 2, armenian:3, bengali: 4, devangari: 5, greek: 6 - * gujarati: 7, kannada: 8, lao: 9, malayalam: 10, oriya: 11, persian: 12, punjabi: 13, tamil: 14, telugu: 15 - * @param {string} prompt The sentence prompted to the user, if Hyphenator.js doesn't find a language hint - */ - o = function (code, file, script, prompt) { - r[code] = {'file': file, 'script': script, 'prompt': prompt}; - }; - - o('be', 'be.js', 1, 'Мова гэтага сайта не можа быць вызначаны аўтаматычна. Калі ласка пакажыце мову:'); - o('ca', 'ca.js', 0, ''); - o('cs', 'cs.js', 0, 'Jazyk této internetové stránky nebyl automaticky rozpoznán. Určete prosím její jazyk:'); - o('da', 'da.js', 0, 'Denne websides sprog kunne ikke bestemmes. Angiv venligst sprog:'); - o('bn', 'bn.js', 4, ''); - o('de', 'de.js', 0, 'Die Sprache dieser Webseite konnte nicht automatisch bestimmt werden. Bitte Sprache angeben:'); - o('el', 'el-monoton.js', 6, ''); - o('el-monoton', 'el-monoton.js', 6, ''); - o('el-polyton', 'el-polyton.js', 6, ''); - o('en', 'en-us.js', 0, 'The language of this website could not be determined automatically. Please indicate the main language:'); - o('en-gb', 'en-gb.js', 0, 'The language of this website could not be determined automatically. Please indicate the main language:'); - o('en-us', 'en-us.js', 0, 'The language of this website could not be determined automatically. Please indicate the main language:'); - o('eo', 'eo.js', 0, 'La lingvo de ĉi tiu retpaĝo ne rekoneblas aŭtomate. Bonvolu indiki ĝian ĉeflingvon:'); - o('es', 'es.js', 0, 'El idioma del sitio no pudo determinarse autom%E1ticamente. Por favor, indique el idioma principal:'); - o('et', 'et.js', 0, 'Veebilehe keele tuvastamine ebaõnnestus, palun valige kasutatud keel:'); - o('fi', 'fi.js', 0, 'Sivun kielt%E4 ei tunnistettu automaattisesti. M%E4%E4rit%E4 sivun p%E4%E4kieli:'); - o('fr', 'fr.js', 0, 'La langue de ce site n%u2019a pas pu %EAtre d%E9termin%E9e automatiquement. Veuillez indiquer une langue, s.v.p.%A0:'); - o('grc', 'grc.js', 6, ''); - o('gu', 'gu.js', 7, ''); - o('hi', 'hi.js', 5, ''); - o('hu', 'hu.js', 0, 'A weboldal nyelvét nem sikerült automatikusan megállapítani. Kérem adja meg a nyelvet:'); - o('hy', 'hy.js', 3, 'Չհաջողվեց հայտնաբերել այս կայքի լեզուն։ Խնդրում ենք նշեք հիմնական լեզուն՝'); - o('it', 'it.js', 0, 'Lingua del sito sconosciuta. Indicare una lingua, per favore:'); - o('kn', 'kn.js', 8, 'ಜಾಲ ತಾಣದ ಭಾಷೆಯನ್ನು ನಿರ್ಧರಿಸಲು ಸಾಧ್ಯವಾಗುತ್ತಿಲ್ಲ. ದಯವಿಟ್ಟು ಮುಖ್ಯ ಭಾಷೆಯನ್ನು ಸೂಚಿಸಿ:'); - o('la', 'la.js', 0, ''); - o('lt', 'lt.js', 0, 'Nepavyko automatiškai nustatyti šios svetainės kalbos. Prašome įvesti kalbą:'); - o('lv', 'lv.js', 0, 'Šīs lapas valodu nevarēja noteikt automātiski. Lūdzu norādiet pamata valodu:'); - o('ml', 'ml.js', 10, 'ഈ വെ%u0D2C%u0D4D%u200Cസൈറ്റിന്റെ ഭാഷ കണ്ടുപിടിയ്ക്കാ%u0D28%u0D4D%u200D കഴിഞ്ഞില്ല. ഭാഷ ഏതാണെന്നു തിരഞ്ഞെടുക്കുക:'); - o('nb', 'nb-no.js', 0, 'Nettstedets språk kunne ikke finnes automatisk. Vennligst oppgi språk:'); - o('no', 'nb-no.js', 0, 'Nettstedets språk kunne ikke finnes automatisk. Vennligst oppgi språk:'); - o('nb-no', 'nb-no.js', 0, 'Nettstedets språk kunne ikke finnes automatisk. Vennligst oppgi språk:'); - o('nl', 'nl.js', 0, 'De taal van deze website kan niet automatisch worden bepaald. Geef de hoofdtaal op:'); - o('or', 'or.js', 11, ''); - o('pa', 'pa.js', 13, ''); - o('pl', 'pl.js', 0, 'Języka tej strony nie można ustalić automatycznie. Proszę wskazać język:'); - o('pt', 'pt.js', 0, 'A língua deste site não pôde ser determinada automaticamente. Por favor indique a língua principal:'); - o('ru', 'ru.js', 1, 'Язык этого сайта не может быть определен автоматически. Пожалуйста укажите язык:'); - o('sk', 'sk.js', 0, ''); - o('sl', 'sl.js', 0, 'Jezika te spletne strani ni bilo mogoče samodejno določiti. Prosim navedite jezik:'); - o('sr-cyrl', 'sr-cyrl.js', 1, 'Језик овог сајта није детектован аутоматски. Молим вас наведите језик:'); - o('sr-latn', 'sr-latn.js', 0, 'Jezika te spletne strani ni bilo mogoče samodejno določiti. Prosim navedite jezik:'); - o('sv', 'sv.js', 0, 'Spr%E5ket p%E5 den h%E4r webbplatsen kunde inte avg%F6ras automatiskt. V%E4nligen ange:'); - o('ta', 'ta.js', 14, ''); - o('te', 'te.js', 15, ''); - o('tr', 'tr.js', 0, 'Bu web sitesinin dili otomatik olarak tespit edilememiştir. Lütfen dökümanın dilini seçiniz%A0:'); - o('uk', 'uk.js', 1, 'Мова цього веб-сайту не може бути визначена автоматично. Будь ласка, вкажіть головну мову:'); - o('ro', 'ro.js', 0, 'Limba acestui sit nu a putut fi determinată automat. Alege limba principală:'); - - return r; - }()), - - - /** - * @member {string} Hyphenator~basePath - * @desc - * A string storing the basepath from where Hyphenator.js was loaded. - * This is used to load the pattern files. - * The basepath is determined dynamically by searching all script-tags for Hyphenator.js - * If the path cannot be determined {@link http://mnater.github.io/Hyphenator/} is used as fallback. - * @access private - * @see {@link Hyphenator~loadPatterns} - */ - basePath = (function () { - var s = contextWindow.document.getElementsByTagName('script'), i = 0, p, src, t = s[i], r = ''; - while (!!t) { - if (!!t.src) { - src = t.src; - p = src.indexOf('Hyphenator.js'); - if (p !== -1) { - r = src.substring(0, p); - } - } - i += 1; - t = s[i]; - } - return !!r ? r : '//mnater.github.io/Hyphenator/'; - }()), - - /** - * @member {boolean} Hyphenator~isLocal - * @access private - * @desc - * isLocal is true, if Hyphenator is loaded from the same domain, as the webpage, but false, if - * it's loaded from an external source (i.e. directly from github) - */ - isLocal = (function () { - var re = false; - if (window.location.href.indexOf(basePath) !== -1) { - re = true; - } - return re; - }()), - - /** - * @member {boolean} Hyphenator~documentLoaded - * @access private - * @desc - * documentLoaded is true, when the DOM has been loaded. This is set by {@link Hyphenator~runWhenLoaded} - */ - documentLoaded = false, - - /** - * @member {boolean} Hyphenator~persistentConfig - * @access private - * @desc - * if persistentConfig is set to true (defaults to false), config options and the state of the - * toggleBox are stored in DOM-storage (according to the storage-setting). So they haven't to be - * set for each page. - * @default false - * @see {@link Hyphenator.config} - */ - persistentConfig = false, - - /** - * @member {boolean} Hyphenator~doFrames - * @access private - * @desc - * switch to control if frames/iframes should be hyphenated, too. - * defaults to false (frames are a bag of hurt!) - * @default false - * @see {@link Hyphenator.config} - */ - doFrames = false, - - /** - * @member {Object.} Hyphenator~dontHyphenate - * @desc - * A key-value object containing all html-tags whose content should not be hyphenated - * @access private - */ - dontHyphenate = {'video': true, 'audio': true, 'script': true, 'code': true, 'pre': true, 'img': true, 'br': true, 'samp': true, 'kbd': true, 'var': true, 'abbr': true, 'acronym': true, 'sub': true, 'sup': true, 'button': true, 'option': true, 'label': true, 'textarea': true, 'input': true, 'math': true, 'svg': true, 'style': true}, - - /** - * @member {boolean} Hyphenator~enableCache - * @desc - * A variable to set if caching is enabled or not - * @default true - * @access private - * @see {@link Hyphenator.config} - */ - enableCache = true, - - /** - * @member {string} Hyphenator~storageType - * @desc - * A variable to define what html5-DOM-Storage-Method is used ('none', 'local' or 'session') - * @default 'local' - * @access private - * @see {@link Hyphenator.config} - */ - storageType = 'local', - - /** - * @member {Object|undefined} Hyphenator~storage - * @desc - * An alias to the storage defined in storageType. This is set by {@link Hyphenator~createStorage}. - * Set by {@link Hyphenator.run} - * @default null - * @access private - * @see {@link Hyphenator~createStorage} - */ - storage, - - /** - * @member {boolean} Hyphenator~enableReducedPatternSet - * @desc - * A variable to set if storing the used patterns is set - * @default false - * @access private - * @see {@link Hyphenator.config} - * @see {@link Hyphenator.getRedPatternSet} - */ - enableReducedPatternSet = false, - - /** - * @member {boolean} Hyphenator~enableRemoteLoading - * @desc - * A variable to set if pattern files should be loaded remotely or not - * @default true - * @access private - * @see {@link Hyphenator.config} - */ - enableRemoteLoading = true, - - /** - * @member {boolean} Hyphenator~displayToggleBox - * @desc - * A variable to set if the togglebox should be displayed or not - * @default false - * @access private - * @see {@link Hyphenator.config} - */ - displayToggleBox = false, - - /** - * @method Hyphenator~onError - * @desc - * A function that can be called upon an error. - * @see {@link Hyphenator.config} - * @access private - */ - onError = function (e) { - window.alert("Hyphenator.js says:\n\nAn Error occurred:\n" + e.message); - }, - - /** - * @method Hyphenator~onWarning - * @desc - * A function that can be called upon a warning. - * @see {@link Hyphenator.config} - * @access private - */ - onWarning = function (e) { - window.console.log(e.message); - }, - - /** - * @method Hyphenator~createElem - * @desc - * A function alias to document.createElementNS or document.createElement - * @access private - */ - createElem = function (tagname, context) { - context = context || contextWindow; - var el; - if (window.document.createElementNS) { - el = context.document.createElementNS('http://www.w3.org/1999/xhtml', tagname); - } else if (window.document.createElement) { - el = context.document.createElement(tagname); - } - return el; - }, - - /** - * @member {boolean} Hyphenator~css3 - * @desc - * A variable to set if css3 hyphenation should be used - * @default false - * @access private - * @see {@link Hyphenator.config} - */ - css3 = false, - - /** - * @typedef {Object} Hyphenator~css3_hsupport - * @property {boolean} support - if css3-hyphenation is supported - * @property {string} property - the css property name to access hyphen-settings (e.g. -webkit-hyphens) - * @property {Object.} supportedBrowserLangs - an object caching tested languages - * @property {function} checkLangSupport - a method that checks if the browser supports a requested language - */ - - /** - * @member {Hyphenator~css3_h9n} Hyphenator~css3_h9n - * @desc - * A generated object containing information for CSS3-hyphenation support - * This is set by {@link Hyphenator~css3_gethsupport} - * @default undefined - * @access private - * @see {@link Hyphenator~css3_gethsupport} - * @example - * //Check if browser supports a language - * css3_h9n.checkLangSupport(<lang>) - */ - css3_h9n, - - /** - * @method Hyphenator~css3_gethsupport - * @desc - * This function sets {@link Hyphenator~css3_h9n} for the current UA - * @type function - * @access private - * @see Hyphenator~css3_h9n - */ - css3_gethsupport = function () { - var s, - createLangSupportChecker = function (prefix) { - var testStrings = [ - //latin: 0 - 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', - //cyrillic: 1 - 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя', - //arabic: 2 - 'أبتثجحخدذرزسشصضطظعغفقكلمنهوي', - //armenian: 3 - 'աբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆ', - //bengali: 4 - 'ঁংঃঅআইঈউঊঋঌএঐওঔকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ়ঽািীুূৃৄেৈোৌ্ৎৗড়ঢ়য়ৠৡৢৣ', - //devangari: 5 - 'ँंःअआइईउऊऋऌएऐओऔकखगघङचछजझञटठडढणतथदधनपफबभमयरलळवशषसहऽािीुूृॄेैोौ्॒॑ॠॡॢॣ', - //greek: 6 - 'αβγδεζηθικλμνξοπρσςτυφχψω', - //gujarati: 7 - 'બહઅઆઇઈઉઊઋૠએઐઓઔાિીુૂૃૄૢૣેૈોૌકખગઘઙચછજઝઞટઠડઢણતથદધનપફસભમયરલળવશષ', - //kannada: 8 - 'ಂಃಅಆಇಈಉಊಋಌಎಏಐಒಓಔಕಖಗಘಙಚಛಜಝಞಟಠಡಢಣತಥದಧನಪಫಬಭಮಯರಱಲಳವಶಷಸಹಽಾಿೀುೂೃೄೆೇೈೊೋೌ್ೕೖೞೠೡ', - //lao: 9 - 'ກຂຄງຈຊຍດຕຖທນບປຜຝພຟມຢຣລວສຫອຮະັາິີຶືຸູົຼເແໂໃໄ່້໊໋ໜໝ', - //malayalam: 10 - 'ംഃഅആഇഈഉഊഋഌഎഏഐഒഓഔകഖഗഘങചഛജഝഞടഠഡഢണതഥദധനപഫബഭമയരറലളഴവശഷസഹാിീുൂൃെേൈൊോൌ്ൗൠൡൺൻർൽൾൿ', - //oriya: 11 - 'ଁଂଃଅଆଇଈଉଊଋଌଏଐଓଔକଖଗଘଙଚଛଜଝଞଟଠଡଢଣତଥଦଧନପଫବଭମଯରଲଳଵଶଷସହାିୀୁୂୃେୈୋୌ୍ୗୠୡ', - //persian: 12 - 'أبتثجحخدذرزسشصضطظعغفقكلمنهوي', - //punjabi: 13 - 'ਁਂਃਅਆਇਈਉਊਏਐਓਔਕਖਗਘਙਚਛਜਝਞਟਠਡਢਣਤਥਦਧਨਪਫਬਭਮਯਰਲਲ਼ਵਸ਼ਸਹਾਿੀੁੂੇੈੋੌ੍ੰੱ', - //tamil: 14 - 'ஃஅஆஇஈஉஊஎஏஐஒஓஔகஙசஜஞடணதநனபமயரறலளழவஷஸஹாிீுூெேைொோௌ்ௗ', - //telugu: 15 - 'ఁంఃఅఆఇఈఉఊఋఌఎఏఐఒఓఔకఖగఘఙచఛజఝఞటఠడఢణతథదధనపఫబభమయరఱలళవశషసహాిీుూృౄెేైొోౌ్ౕౖౠౡ' - ], - f = function (lang) { - var shadow, - computedHeight, - bdy, - r = false; - - //check if lang has already been tested - if (this.supportedBrowserLangs.hasOwnProperty(lang)) { - r = this.supportedBrowserLangs[lang]; - } else if (supportedLangs.hasOwnProperty(lang)) { - //create and append shadow-test-element - bdy = window.document.getElementsByTagName('body')[0]; - shadow = createElem('div', window); - shadow.id = 'Hyphenator_LanguageChecker'; - shadow.style.width = '5em'; - shadow.style[prefix] = 'auto'; - shadow.style.hyphens = 'auto'; - shadow.style.fontSize = '12px'; - shadow.style.lineHeight = '12px'; - shadow.style.visibility = 'hidden'; - shadow.lang = lang; - shadow.style['-webkit-locale'] = "'" + lang + "'"; - shadow.innerHTML = testStrings[supportedLangs[lang].script]; - bdy.appendChild(shadow); - //measure its height - computedHeight = shadow.offsetHeight; - //remove shadow element - bdy.removeChild(shadow); - r = (computedHeight > 12) ? true : false; - this.supportedBrowserLangs[lang] = r; - } else { - r = false; - } - return r; - }; - return f; - }, - r = { - support: false, - supportedBrowserLangs: {}, - property: '', - checkLangSupport: {} - }; - - if (window.getComputedStyle) { - s = window.getComputedStyle(window.document.getElementsByTagName('body')[0], null); - } else { - //ancient Browsers don't support CSS3 anyway - css3_h9n = r; - return; - } - - if (s.hyphens !== undefined) { - r.support = true; - r.property = 'hyphens'; - r.checkLangSupport = createLangSupportChecker('hyphens'); - } else if (s['-webkit-hyphens'] !== undefined) { - r.support = true; - r.property = '-webkit-hyphens'; - r.checkLangSupport = createLangSupportChecker('-webkit-hyphens'); - } else if (s.MozHyphens !== undefined) { - r.support = true; - r.property = '-moz-hyphens'; - r.checkLangSupport = createLangSupportChecker('MozHyphens'); - } else if (s['-ms-hyphens'] !== undefined) { - r.support = true; - r.property = '-ms-hyphens'; - r.checkLangSupport = createLangSupportChecker('-ms-hyphens'); - } - css3_h9n = r; - }, - - /** - * @member {string} Hyphenator~hyphenateClass - * @desc - * A string containing the css-class-name for the hyphenate class - * @default 'hyphenate' - * @access private - * @example - * <p class = "hyphenate">Text</p> - * @see {@link Hyphenator.config} - */ - hyphenateClass = 'hyphenate', - - /** - * @member {string} Hyphenator~urlHyphenateClass - * @desc - * A string containing the css-class-name for the urlhyphenate class - * @default 'urlhyphenate' - * @access private - * @example - * <p class = "urlhyphenate">Text</p> - * @see {@link Hyphenator.config} - */ - urlHyphenateClass = 'urlhyphenate', - - /** - * @member {string} Hyphenator~classPrefix - * @desc - * A string containing a unique className prefix to be used - * whenever Hyphenator sets a CSS-class - * @access private - */ - classPrefix = 'Hyphenator' + Math.round(Math.random() * 1000), - - /** - * @member {string} Hyphenator~hideClass - * @desc - * The name of the class that hides elements - * @access private - */ - hideClass = classPrefix + 'hide', - - /** - * @member {RegExp} Hyphenator~hideClassRegExp - * @desc - * RegExp to remove hideClass from a list of classes - * @access private - */ - hideClassRegExp = new RegExp("\\s?\\b" + hideClass + "\\b", "g"), - - /** - * @member {string} Hyphenator~hideClass - * @desc - * The name of the class that unhides elements - * @access private - */ - unhideClass = classPrefix + 'unhide', - - /** - * @member {RegExp} Hyphenator~hideClassRegExp - * @desc - * RegExp to remove unhideClass from a list of classes - * @access private - */ - unhideClassRegExp = new RegExp("\\s?\\b" + unhideClass + "\\b", "g"), - - /** - * @member {string} Hyphenator~css3hyphenateClass - * @desc - * The name of the class that hyphenates elements with css3 - * @access private - */ - css3hyphenateClass = classPrefix + 'css3hyphenate', - - /** - * @member {CSSEdit} Hyphenator~css3hyphenateClass - * @desc - * The var where CSSEdit class is stored - * @access private - */ - css3hyphenateClassHandle, - - /** - * @member {string} Hyphenator~dontHyphenateClass - * @desc - * A string containing the css-class-name for elements that should not be hyphenated - * @default 'donthyphenate' - * @access private - * @example - * <p class = "donthyphenate">Text</p> - * @see {@link Hyphenator.config} - */ - dontHyphenateClass = 'donthyphenate', - - /** - * @member {number} Hyphenator~min - * @desc - * A number wich indicates the minimal length of words to hyphenate. - * @default 6 - * @access private - * @see {@link Hyphenator.config} - */ - min = 6, - - /** - * @member {number} Hyphenator~orphanControl - * @desc - * Control how the last words of a line are handled: - * level 1 (default): last word is hyphenated - * level 2: last word is not hyphenated - * level 3: last word is not hyphenated and last space is non breaking - * @default 1 - * @access private - */ - orphanControl = 1, - - /** - * @member {boolean} Hyphenator~isBookmarklet - * @desc - * True if Hyphanetor runs as bookmarklet. - * @access private - */ - isBookmarklet = (function () { - var loc = null, - re = false, - scripts = contextWindow.document.getElementsByTagName('script'), - i = 0, - l = scripts.length; - while (!re && i < l) { - loc = scripts[i].getAttribute('src'); - if (!!loc && loc.indexOf('Hyphenator.js?bm=true') !== -1) { - re = true; - } - i += 1; - } - return re; - }()), - - /** - * @member {string|null} Hyphenator~mainLanguage - * @desc - * The general language of the document. In contrast to {@link Hyphenator~defaultLanguage}, - * mainLanguage is defined by the client (i.e. by the html or by a prompt). - * @access private - * @see {@link Hyphenator~autoSetMainLanguage} - */ - mainLanguage = null, - - /** - * @member {string|null} Hyphenator~defaultLanguage - * @desc - * The language defined by the developper. This language setting is defined by a config option. - * It is overwritten by any html-lang-attribute and only taken in count, when no such attribute can - * be found (i.e. just before the prompt). - * @access private - * @see {@link Hyphenator.config} - * @see {@link Hyphenator~autoSetMainLanguage} - */ - defaultLanguage = '', - - /** - * @member {ElementCollection} Hyphenator~elements - * @desc - * A class representing all elements (of type Element) that have to be hyphenated. This var is filled by - * {@link Hyphenator~gatherDocumentInfos} - * @access private - */ - elements = (function () { - /** - * @constructor Hyphenator~elements~ElementCollection~Element - * @desc represents a DOM Element with additional information - * @access private - */ - var Element = function (element) { - /** - * @member {Object} Hyphenator~elements~ElementCollection~Element~element - * @desc A DOM Element - * @access protected - */ - this.element = element; - /** - * @member {boolean} Hyphenator~elements~ElementCollection~Element~hyphenated - * @desc Marks if the element has been hyphenated - * @access protected - */ - this.hyphenated = false; - /** - * @member {boolean} Hyphenator~elements~ElementCollection~Element~treated - * @desc Marks if information of the element has been collected but not hyphenated (e.g. dohyphenation is off) - * @access protected - */ - this.treated = false; - }, - /** - * @constructor Hyphenator~elements~ElementCollection - * @desc A collection of Elements to be hyphenated - * @access protected - */ - ElementCollection = function () { - /** - * @member {number} Hyphenator~elements~ElementCollection~count - * @desc The Number of collected Elements - * @access protected - */ - this.count = 0; - /** - * @member {number} Hyphenator~elements~ElementCollection~hyCount - * @desc The Number of hyphenated Elements - * @access protected - */ - this.hyCount = 0; - /** - * @member {Object.>} Hyphenator~elements~ElementCollection~list - * @desc The collection of elements, where the key is a language code and the value is an array of elements - * @access protected - */ - this.list = {}; - }; - /** - * @member {Object} Hyphenator~elements~ElementCollection.prototype - * @augments Hyphenator~elements~ElementCollection - * @access protected - */ - ElementCollection.prototype = { - /** - * @method Hyphenator~elements~ElementCollection.prototype~add - * @augments Hyphenator~elements~ElementCollection - * @access protected - * @desc adds a DOM element to the collection - * @param {Object} el - The DOM element - * @param {string} lang - The language of the element - */ - add: function (el, lang) { - var elo = new Element(el); - if (!this.list.hasOwnProperty(lang)) { - this.list[lang] = []; - } - this.list[lang].push(elo); - this.count += 1; - return elo; - }, - - /** - * @method Hyphenator~elements~ElementCollection.prototype~remove - * @augments Hyphenator~elements~ElementCollection - * @access protected - * @desc removes a DOM element from the collection - * @param {Object} el - The DOM element - */ - remove: function (el) { - var lang, i, e, l; - for (lang in this.list) { - if (this.list.hasOwnProperty(lang)) { - for (i = 0; i < this.list[lang].length; i += 1) { - if (this.list[lang][i].element === el) { - e = i; - l = lang; - break; - } - } - } - } - this.list[l].splice(e, 1); - this.count -= 1; - this.hyCount -= 1; - }, - /** - * @callback Hyphenator~elements~ElementCollection.prototype~each~callback fn - The callback that is executed for each element - * @param {string} [k] The key (i.e. language) of the collection - * @param {Hyphenator~elements~ElementCollection~Element} element - */ - - /** - * @method Hyphenator~elements~ElementCollection.prototype~each - * @augments Hyphenator~elements~ElementCollection - * @access protected - * @desc takes each element of the collection as an argument of fn - * @param {Hyphenator~elements~ElementCollection.prototype~each~callback} fn - A function that takes an element as an argument - */ - each: function (fn) { - var k; - for (k in this.list) { - if (this.list.hasOwnProperty(k)) { - if (fn.length === 2) { - fn(k, this.list[k]); - } else { - fn(this.list[k]); - } - } - } - } - }; - return new ElementCollection(); - }()), - - - /** - * @member {Object.} Hyphenator~exceptions - * @desc - * An object containing exceptions as comma separated strings for each language. - * When the language-objects are loaded, their exceptions are processed, copied here and then deleted. - * Exceptions can also be set by the user. - * @see {@link Hyphenator~prepareLanguagesObj} - * @access private - */ - exceptions = {}, - - /** - * @member {Object.} Hyphenator~docLanguages - * @desc - * An object holding all languages used in the document. This is filled by - * {@link Hyphenator~gatherDocumentInfos} - * @access private - */ - docLanguages = {}, - - /** - * @member {string} Hyphenator~url - * @desc - * A string containing a insane RegularExpression to match URL's - * @access private - */ - url = '(?:\\w*:\/\/)?(?:(?:\\w*:)?(?:\\w*)@)?(?:(?:(?:[\\d]{1,3}\\.){3}(?:[\\d]{1,3}))|(?:(?:www\\.|[a-zA-Z]\\.)?[a-zA-Z0-9\\-\\.]+\\.(?:[a-z]{2,4})))(?::\\d*)?(?:\/[\\w#!:\\.?\\+=&%@!\\-]*)*', - // protocoll usr pwd ip or host tld port path - - /** - * @member {string} Hyphenator~mail - * @desc - * A string containing a RegularExpression to match mail-adresses - * @access private - */ - mail = '[\\w-\\.]+@[\\w\\.]+', - - /** - * @member {string} Hyphenator~zeroWidthSpace - * @desc - * A string that holds a char. - * Depending on the browser, this is the zero with space or an empty string. - * zeroWidthSpace is used to break URLs - * @access private - */ - zeroWidthSpace = (function () { - var zws, ua = window.navigator.userAgent.toLowerCase(); - zws = String.fromCharCode(8203); //Unicode zero width space - if (ua.indexOf('msie 6') !== -1) { - zws = ''; //IE6 doesn't support zws - } - if (ua.indexOf('opera') !== -1 && ua.indexOf('version/10.00') !== -1) { - zws = ''; //opera 10 on XP doesn't support zws - } - return zws; - }()), - - /** - * @method Hyphenator~onBeforeWordHyphenation - * @desc - * This method is called just before a word is hyphenated. - * It is called with two parameters: the word and its language. - * The method must return a string (aka the word). - * @see {@link Hyphenator.config} - * @access private - * @param {string} word - * @param {string} lang - * @return {string} The word that goes into hyphenation - */ - onBeforeWordHyphenation = function (word) { - return word; - }, - - /** - * @method Hyphenator~onAfterWordHyphenation - * @desc - * This method is called for each word after it is hyphenated. - * Takes the word as a first parameter and its language as a second parameter. - * Returns a string that will replace the word that has been hyphenated. - * @see {@link Hyphenator.config} - * @access private - * @param {string} word - * @param {string} lang - * @return {string} The word that goes into hyphenation - */ - onAfterWordHyphenation = function (word) { - return word; - }, - - /** - * @method Hyphenator~onHyphenationDone - * @desc - * A method to be called, when the last element has been hyphenated. - * If there are frames the method is called for each frame. - * Therefore the location.href of the contextWindow calling this method is given as a parameter - * @see {@link Hyphenator.config} - * @param {string} context - * @access private - */ - onHyphenationDone = function (context) { - return context; - }, - - /** - * @name Hyphenator~selectorFunction - * @desc - * A function set by the user that has to return a HTMLNodeList or array of Elements to be hyphenated. - * By default this is set to false so we can check if a selectorFunction is set… - * @see {@link Hyphenator.config} - * @see {@link Hyphenator~mySelectorFunction} - * @default false - * @type {function|boolean} - * @access private - */ - selectorFunction = false, - - /** - * @name Hyphenator~flattenNodeList - * @desc - * Takes a nodeList and returns an array with all elements that are not contained by another element in the nodeList - * By using this function the elements returned by selectElements can be 'flattened'. - * @see {@link Hyphenator~selectElements} - * @param {nodeList} nl - * @return {Array} Array of 'parent'-elements - * @access private - */ - flattenNodeList = function (nl) { - var parentElements = [], - i = 0, - j = 0, - isParent = true; - - parentElements.push(nl[0]); //add the first item, since this is always an parent - - for (i = 1; i < nl.length; i += 1) { //cycle through nodeList - for (j = 0; j < parentElements.length; j += 1) { //cycle through parentElements - if (parentElements[j].contains(nl[i])) { - isParent = false; - break; - } - } - if (isParent) { - parentElements.push(nl[i]); - } - isParent = true; - } - - return parentElements; - }, - - /** - * @method Hyphenator~mySelectorFunction - * @desc - * A function that returns a HTMLNodeList or array of Elements to be hyphenated. - * By default it uses the classname ('hyphenate') to select the elements. - * @access private - */ - mySelectorFunction = function (hyphenateClass) { - var tmp, el = [], i, l; - if (window.document.getElementsByClassName) { - el = contextWindow.document.getElementsByClassName(hyphenateClass); - } else if (window.document.querySelectorAll) { - el = contextWindow.document.querySelectorAll('.' + hyphenateClass); - } else { - tmp = contextWindow.document.getElementsByTagName('*'); - l = tmp.length; - for (i = 0; i < l; i += 1) { - if (tmp[i].className.indexOf(hyphenateClass) !== -1 && tmp[i].className.indexOf(dontHyphenateClass) === -1) { - el.push(tmp[i]); - } - } - } - return el; - }, - - /** - * @method Hyphenator~selectElements - * @desc - * A function that uses either selectorFunction set by the user - * or the default mySelectorFunction. - * @access private - */ - selectElements = function () { - var elems; - if (selectorFunction) { - elems = selectorFunction(); - } else { - elems = mySelectorFunction(hyphenateClass); - } - if (elems.length !== 0) { - elems = flattenNodeList(elems); - } - return elems; - }, - - /** - * @member {string} Hyphenator~intermediateState - * @desc - * The visibility of elements while they are hyphenated: - * 'visible': unhyphenated text is visible and then redrawn when hyphenated. - * 'hidden': unhyphenated text is made invisible as soon as possible and made visible after hyphenation. - * @default 'hidden' - * @see {@link Hyphenator.config} - * @access private - */ - intermediateState = 'hidden', - - /** - * @member {string} Hyphenator~unhide - * @desc - * How hidden elements unhide: either simultaneous (default: 'wait') or progressively. - * 'wait' makes Hyphenator.js to wait until all elements are hyphenated (one redraw) - * With 'progressive' Hyphenator.js unhides elements as soon as they are hyphenated. - * @see {@link Hyphenator.config} - * @access private - */ - unhide = 'wait', - - /** - * @member {Array.} Hyphenator~CSSEditors - * @desc A container array that holds CSSEdit classes - * For each window object one CSSEdit class is inserted - * @access private - */ - CSSEditors = [], - - /** - * @constructor Hyphenator~CSSEdit - * @desc - * This class handles access and editing of StyleSheets. - * Thanks to this styles (e.g. hiding and unhiding elements upon hyphenation) - * can be changed in one place instead for each element. - * @access private - */ - CSSEdit = function (w) { - w = w || window; - var doc = w.document, - /** - * @member {Object} Hyphenator~CSSEdit~sheet - * @desc - * A StyleSheet, where Hyphenator can write to. - * If no StyleSheet can be found, lets create one. - * @access private - */ - sheet = (function () { - var i, - l = doc.styleSheets.length, - s, - element, - r = false; - for (i = 0; i < l; i += 1) { - s = doc.styleSheets[i]; - try { - if (!!s.cssRules) { - r = s; - break; - } - } catch (ignore) {} - } - if (r === false) { - element = doc.createElement('style'); - element.type = 'text/css'; - doc.getElementsByTagName('head')[0].appendChild(element); - r = doc.styleSheets[doc.styleSheets.length - 1]; - } - return r; - }()), - - /** - * @typedef {Object} Hyphenator~CSSEdit~changes - * @property {Object} sheet - The StyleSheet where the change was made - * @property {number} index - The index of the changed rule - */ - - /** - * @member {Array.} Hyphenator~CSSEdit~changes - * @desc - * Sets a CSS rule for a specified selector - * @access private - */ - changes = [], - - /** - * @typedef Hyphenator~CSSEdit~rule - * @property {number} index - The index of the rule - * @property {Object} rule - The style rule - */ - /** - * @method Hyphenator~CSSEdit~findRule - * @desc - * Searches the StyleSheets for a given selector and returns an object containing the rule. - * If nothing can be found, false is returned. - * @param {string} sel - * @return {Hyphenator~CSSEdit~rule|false} - * @access private - */ - findRule = function (sel) { - var s, rule, sheets = w.document.styleSheets, rules, i, j, r = false; - for (i = 0; i < sheets.length; i += 1) { - s = sheets[i]; - try { //FF has issues here with external CSS (s.o.p) - if (!!s.cssRules) { - rules = s.cssRules; - } else if (!!s.rules) { - // IE < 9 - rules = s.rules; - } - } catch (ignore) {} - if (!!rules && !!rules.length) { - for (j = 0; j < rules.length; j += 1) { - rule = rules[j]; - if (rule.selectorText === sel) { - r = { - index: j, - rule: rule - }; - } - } - } - } - return r; - }, - /** - * @method Hyphenator~CSSEdit~addRule - * @desc - * Adds a rule to the {@link Hyphenator~CSSEdit~sheet} - * @param {string} sel - The selector to be added - * @param {string} rulesStr - The rules for the specified selector - * @return {number} index of the new rule - * @access private - */ - addRule = function (sel, rulesStr) { - var i, r; - if (!!sheet.insertRule) { - if (!!sheet.cssRules) { - i = sheet.cssRules.length; - } else { - i = 0; - } - r = sheet.insertRule(sel + '{' + rulesStr + '}', i); - } else if (!!sheet.addRule) { - // IE < 9 - if (!!sheet.rules) { - i = sheet.rules.length; - } else { - i = 0; - } - sheet.addRule(sel, rulesStr, i); - r = i; - } - return r; - }, - /** - * @method Hyphenator~CSSEdit~removeRule - * @desc - * Removes a rule with the specified index from the specified sheet - * @param {Object} sheet - The style sheet - * @param {number} index - the index of the rule - * @access private - */ - removeRule = function (sheet, index) { - if (sheet.deleteRule) { - sheet.deleteRule(index); - } else { - // IE < 9 - sheet.removeRule(index); - } - }; - - return { - /** - * @method Hyphenator~CSSEdit.setRule - * @desc - * Sets a CSS rule for a specified selector - * @access public - * @param {string} sel - Selector - * @param {string} rulesString - CSS-Rules - */ - setRule: function (sel, rulesString) { - var i, existingRule, cssText; - existingRule = findRule(sel); - if (!!existingRule) { - if (!!existingRule.rule.cssText) { - cssText = existingRule.rule.cssText; - } else { - // IE < 9 - cssText = existingRule.rule.style.cssText.toLowerCase(); - } - if (cssText !== sel + ' { ' + rulesString + ' }') { - //cssText of the found rule is not uniquely selector + rulesString, - if (cssText.indexOf(rulesString) !== -1) { - //maybe there are other rules or IE < 9 - //clear existing def - existingRule.rule.style.visibility = ''; - } - //add rule and register for later removal - i = addRule(sel, rulesString); - changes.push({sheet: sheet, index: i}); - } - } else { - i = addRule(sel, rulesString); - changes.push({sheet: sheet, index: i}); - } - }, - /** - * @method Hyphenator~CSSEdit.clearChanges - * @desc - * Removes all changes Hyphenator has made from the StyleSheets - * @access public - */ - clearChanges: function () { - var change = changes.pop(); - while (!!change) { - removeRule(change.sheet, change.index); - change = changes.pop(); - } - } - }; - }, - - /** - * @member {string} Hyphenator~hyphen - * @desc - * A string containing the character for in-word-hyphenation - * @default the soft hyphen - * @access private - * @see {@link Hyphenator.config} - */ - hyphen = String.fromCharCode(173), - - /** - * @member {string} Hyphenator~urlhyphen - * @desc - * A string containing the character for url/mail-hyphenation - * @default the zero width space - * @access private - * @see {@link Hyphenator.config} - * @see {@link Hyphenator~zeroWidthSpace} - */ - urlhyphen = zeroWidthSpace, - - /** - * @method Hyphenator~hyphenateURL - * @desc - * Puts {@link Hyphenator~urlhyphen} (default: zero width space) after each no-alphanumeric char that my be in a URL. - * @param {string} url to hyphenate - * @returns string the hyphenated URL - * @access public - */ - hyphenateURL = function (url) { - var tmp = url.replace(/([:\/\.\?#&\-_,;!@]+)/gi, '$&' + urlhyphen), - parts = tmp.split(urlhyphen), - i; - for (i = 0; i < parts.length; i += 1) { - if (parts[i].length > (2 * min)) { - parts[i] = parts[i].replace(/(\w{3})(\w)/gi, "$1" + urlhyphen + "$2"); - } - } - if (parts[parts.length - 1] === "") { - parts.pop(); - } - return parts.join(urlhyphen); - }, - - /** - * @member {boolean} Hyphenator~safeCopy - * @desc - * Defines wether work-around for copy issues is active or not - * @default true - * @access private - * @see {@link Hyphenator.config} - * @see {@link Hyphenator~registerOnCopy} - */ - safeCopy = true, - - /** - * @method Hyphenator~zeroTimeOut - * @desc - * defer execution of a function on the call stack - * Analog to window.setTimeout(fn, 0) but without a clamped delay if postMessage is supported - * @access private - * @see {@link http://dbaron.org/log/20100309-faster-timeouts} - */ - zeroTimeOut = (function () { - if (window.postMessage && window.addEventListener) { - return (function () { - var timeouts = [], - msg = "Hyphenator_zeroTimeOut_message", - setZeroTimeOut = function (fn) { - timeouts.push(fn); - window.postMessage(msg, "*"); - }, - handleMessage = function (event) { - if (event.source === window && event.data === msg) { - event.stopPropagation(); - if (timeouts.length > 0) { - //var efn = timeouts.shift(); - //efn(); - timeouts.shift()(); - } - } - }; - window.addEventListener("message", handleMessage, true); - return setZeroTimeOut; - }()); - } - return function (fn) { - window.setTimeout(fn, 0); - }; - }()), - - /** - * @member {Object} Hyphenator~hyphRunFor - * @desc - * stores location.href for documents where run() has been executed - * to warn when Hyphenator.run() executed multiple times - * @access private - * @see {@link Hyphenator~runWhenLoaded} - */ - hyphRunFor = {}, - - /** - * @method Hyphenator~runWhenLoaded - * @desc - * A crossbrowser solution for the DOMContentLoaded-Event based on - *
    jQuery - * I added some functionality: e.g. support for frames and iframes… - * @param {Object} w the window-object - * @param {function()} f the function to call when the document is ready - * @access private - */ - runWhenLoaded = function (w, f) { - var toplevel, - add = window.document.addEventListener ? 'addEventListener' : 'attachEvent', - rem = window.document.addEventListener ? 'removeEventListener' : 'detachEvent', - pre = window.document.addEventListener ? '' : 'on', - - init = function (context) { - if (hyphRunFor[context.location.href]) { - onWarning(new Error("Warning: multiple execution of Hyphenator.run() – This may slow down the script!")); - } - contextWindow = context || window; - f(); - hyphRunFor[contextWindow.location.href] = true; - }, - - doScrollCheck = function () { - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - w.document.documentElement.doScroll("left"); - } catch (error) { - window.setTimeout(doScrollCheck, 1); - return; - } - //maybe modern IE fired DOMContentLoaded - if (!hyphRunFor[w.location.href]) { - documentLoaded = true; - init(w); - } - }, - - doOnEvent = function (e) { - var i, fl, haveAccess; - if (!!e && e.type === 'readystatechange' && w.document.readyState !== 'interactive' && w.document.readyState !== 'complete') { - return; - } - - //DOM is ready/interactive, but frames may not be loaded yet! - //cleanup events - w.document[rem](pre + 'DOMContentLoaded', doOnEvent, false); - w.document[rem](pre + 'readystatechange', doOnEvent, false); - - //check frames - fl = w.frames.length; - if (fl === 0 || !doFrames) { - //there are no frames! - //cleanup events - w[rem](pre + 'load', doOnEvent, false); - documentLoaded = true; - init(w); - } else if (doFrames && fl > 0) { - //we have frames, so wait for onload and then initiate runWhenLoaded recursevly for each frame: - if (!!e && e.type === 'load') { - //cleanup events - w[rem](pre + 'load', doOnEvent, false); - for (i = 0; i < fl; i += 1) { - haveAccess = undefined; - //try catch isn't enough for webkit - try { - //opera throws only on document.toString-access - haveAccess = w.frames[i].document.toString(); - } catch (err) { - haveAccess = undefined; - } - if (!!haveAccess) { - runWhenLoaded(w.frames[i], f); - } - } - init(w); - } - } - }; - if (documentLoaded || w.document.readyState === 'complete') { - //Hyphenator has run already (documentLoaded is true) or - //it has been loaded after onLoad - documentLoaded = true; - doOnEvent({type: 'load'}); - } else { - //register events - w.document[add](pre + 'DOMContentLoaded', doOnEvent, false); - w.document[add](pre + 'readystatechange', doOnEvent, false); - w[add](pre + 'load', doOnEvent, false); - toplevel = false; - try { - toplevel = !window.frameElement; - } catch (ignore) {} - if (toplevel && w.document.documentElement.doScroll) { - doScrollCheck(); //calls init() - } - } - }, - - /** - * @method Hyphenator~getLang - * @desc - * Gets the language of an element. If no language is set, it may use the {@link Hyphenator~mainLanguage}. - * @param {Object} el The first parameter is an DOM-Element-Object - * @param {boolean} fallback The second parameter is a boolean to tell if the function should return the {@link Hyphenator~mainLanguage} - * if there's no language found for the element. - * @return {string} The language of the element - * @access private - */ - getLang = function (el, fallback) { - try { - return !!el.getAttribute('lang') ? el.getAttribute('lang').toLowerCase() : - !!el.getAttribute('xml:lang') ? el.getAttribute('xml:lang').toLowerCase() : - el.tagName.toLowerCase() !== 'html' ? getLang(el.parentNode, fallback) : - fallback ? mainLanguage : - null; - } catch (ignore) {} - }, - - /** - * @method Hyphenator~autoSetMainLanguage - * @desc - * Retrieves the language of the document from the DOM and sets the lang attribute of the html-tag. - * The function looks in the following places: - *

    a"; - - var all = div.getElementsByTagName("*"), - a = div.getElementsByTagName("a")[0]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return; - } - - jQuery.support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: div.firstChild.nodeType === 3, - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText insted) - style: /red/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: a.getAttribute("href") === "/a", - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55$/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: div.getElementsByTagName("input")[0].value === "on", - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected, - - parentNode: div.removeChild( div.appendChild( document.createElement("div") ) ).parentNode === null, - - // Will be defined later - deleteExpando: true, - checkClone: false, - scriptEval: false, - noCloneEvent: true, - boxModel: null - }; - - script.type = "text/javascript"; - try { - script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); - } catch(e) {} - - root.insertBefore( script, root.firstChild ); - - // Make sure that the execution of code works by injecting a script - // tag with appendChild/createTextNode - // (IE doesn't support this, fails, and uses .text instead) - if ( window[ id ] ) { - jQuery.support.scriptEval = true; - delete window[ id ]; - } - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete script.test; - - } catch(e) { - jQuery.support.deleteExpando = false; - } - - root.removeChild( script ); - - if ( div.attachEvent && div.fireEvent ) { - div.attachEvent("onclick", function click() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - jQuery.support.noCloneEvent = false; - div.detachEvent("onclick", click); - }); - div.cloneNode(true).fireEvent("onclick"); - } - - div = document.createElement("div"); - div.innerHTML = ""; - - var fragment = document.createDocumentFragment(); - fragment.appendChild( div.firstChild ); - - // WebKit doesn't clone checked state correctly in fragments - jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; - - // Figure out if the W3C box model works as expected - // document.body must exist before we can do this - jQuery(function() { - var div = document.createElement("div"); - div.style.width = div.style.paddingLeft = "1px"; - - document.body.appendChild( div ); - jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; - document.body.removeChild( div ).style.display = 'none'; - - div = null; - }); - - // Technique from Juriy Zaytsev - // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ - var eventSupported = function( eventName ) { - var el = document.createElement("div"); - eventName = "on" + eventName; - - var isSupported = (eventName in el); - if ( !isSupported ) { - el.setAttribute(eventName, "return;"); - isSupported = typeof el[eventName] === "function"; - } - el = null; - - return isSupported; - }; - - jQuery.support.submitBubbles = eventSupported("submit"); - jQuery.support.changeBubbles = eventSupported("change"); - - // release memory in IE - root = script = div = all = a = null; -})(); - -jQuery.props = { - "for": "htmlFor", - "class": "className", - readonly: "readOnly", - maxlength: "maxLength", - cellspacing: "cellSpacing", - rowspan: "rowSpan", - colspan: "colSpan", - tabindex: "tabIndex", - usemap: "useMap", - frameborder: "frameBorder" -}; -var expando = "jQuery" + now(), uuid = 0, windowData = {}; - -jQuery.extend({ - cache: {}, - - expando:expando, - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - "object": true, - "applet": true - }, - - data: function( elem, name, data ) { - if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { - return; - } - - elem = elem == window ? - windowData : - elem; - - var id = elem[ expando ], cache = jQuery.cache, thisCache; - - if ( !id && typeof name === "string" && data === undefined ) { - return null; - } - - // Compute a unique ID for the element - if ( !id ) { - id = ++uuid; - } - - // Avoid generating a new cache unless none exists and we - // want to manipulate it. - if ( typeof name === "object" ) { - elem[ expando ] = id; - thisCache = cache[ id ] = jQuery.extend(true, {}, name); - - } else if ( !cache[ id ] ) { - elem[ expando ] = id; - cache[ id ] = {}; - } - - thisCache = cache[ id ]; - - // Prevent overriding the named cache with undefined values - if ( data !== undefined ) { - thisCache[ name ] = data; - } - - return typeof name === "string" ? thisCache[ name ] : thisCache; - }, - - removeData: function( elem, name ) { - if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { - return; - } - - elem = elem == window ? - windowData : - elem; - - var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ]; - - // If we want to remove a specific section of the element's data - if ( name ) { - if ( thisCache ) { - // Remove the section of cache data - delete thisCache[ name ]; - - // If we've removed all the data, remove the element's cache - if ( jQuery.isEmptyObject(thisCache) ) { - jQuery.removeData( elem ); - } - } - - // Otherwise, we want to remove all of the element's data - } else { - if ( jQuery.support.deleteExpando ) { - delete elem[ jQuery.expando ]; - - } else if ( elem.removeAttribute ) { - elem.removeAttribute( jQuery.expando ); - } - - // Completely remove the data cache - delete cache[ id ]; - } - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - if ( typeof key === "undefined" && this.length ) { - return jQuery.data( this[0] ); - - } else if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - var parts = key.split("."); - parts[1] = parts[1] ? "." + parts[1] : ""; - - if ( value === undefined ) { - var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); - - if ( data === undefined && this.length ) { - data = jQuery.data( this[0], key ); - } - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - } else { - return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() { - jQuery.data( this, key, value ); - }); - } - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); -jQuery.extend({ - queue: function( elem, type, data ) { - if ( !elem ) { - return; - } - - type = (type || "fx") + "queue"; - var q = jQuery.data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( !data ) { - return q || []; - } - - if ( !q || jQuery.isArray(data) ) { - q = jQuery.data( elem, type, jQuery.makeArray(data) ); - - } else { - q.push( data ); - } - - return q; - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), fn = queue.shift(); - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift("inprogress"); - } - - fn.call(elem, function() { - jQuery.dequeue(elem, type); - }); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - } - - if ( data === undefined ) { - return jQuery.queue( this[0], type ); - } - return this.each(function( i, elem ) { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; - type = type || "fx"; - - return this.queue( type, function() { - var elem = this; - setTimeout(function() { - jQuery.dequeue( elem, type ); - }, time ); - }); - }, - - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - } -}); -var rclass = /[\n\t]/g, - rspace = /\s+/, - rreturn = /\r/g, - rspecialurl = /href|src|style/, - rtype = /(button|input)/i, - rfocusable = /(button|input|object|select|textarea)/i, - rclickable = /^(a|area)$/i, - rradiocheck = /radio|checkbox/; - -jQuery.fn.extend({ - attr: function( name, value ) { - return access( this, name, value, true, jQuery.attr ); - }, - - removeAttr: function( name, fn ) { - return this.each(function(){ - jQuery.attr( this, name, "" ); - if ( this.nodeType === 1 ) { - this.removeAttribute( name ); - } - }); - }, - - addClass: function( value ) { - if ( jQuery.isFunction(value) ) { - return this.each(function(i) { - var self = jQuery(this); - self.addClass( value.call(this, i, self.attr("class")) ); - }); - } - - if ( value && typeof value === "string" ) { - var classNames = (value || "").split( rspace ); - - for ( var i = 0, l = this.length; i < l; i++ ) { - var elem = this[i]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className ) { - elem.className = value; - - } else { - var className = " " + elem.className + " ", setClass = elem.className; - for ( var c = 0, cl = classNames.length; c < cl; c++ ) { - if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { - setClass += " " + classNames[c]; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - if ( jQuery.isFunction(value) ) { - return this.each(function(i) { - var self = jQuery(this); - self.removeClass( value.call(this, i, self.attr("class")) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - var classNames = (value || "").split(rspace); - - for ( var i = 0, l = this.length; i < l; i++ ) { - var elem = this[i]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - var className = (" " + elem.className + " ").replace(rclass, " "); - for ( var c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[c] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function(i) { - var self = jQuery(this); - self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, i = 0, self = jQuery(this), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery.data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " "; - for ( var i = 0, l = this.length; i < l; i++ ) { - if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - if ( value === undefined ) { - var elem = this[0]; - - if ( elem ) { - if ( jQuery.nodeName( elem, "option" ) ) { - return (elem.attributes.value || {}).specified ? elem.value : elem.text; - } - - // We need to handle select boxes special - if ( jQuery.nodeName( elem, "select" ) ) { - var index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { - var option = options[ i ]; - - if ( option.selected ) { - // Get the specifc value for the option - value = jQuery(option).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - } - - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) { - return elem.getAttribute("value") === null ? "on" : elem.value; - } - - - // Everything else, we just grab the value - return (elem.value || "").replace(rreturn, ""); - - } - - return undefined; - } - - var isFunction = jQuery.isFunction(value); - - return this.each(function(i) { - var self = jQuery(this), val = value; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call(this, i, self.val()); - } - - // Typecast each time if the value is a Function and the appended - // value is therefore different each time. - if ( typeof val === "number" ) { - val += ""; - } - - if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) { - this.checked = jQuery.inArray( self.val(), val ) >= 0; - - } else if ( jQuery.nodeName( this, "select" ) ) { - var values = jQuery.makeArray(val); - - jQuery( "option", this ).each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - this.selectedIndex = -1; - } - - } else { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - // don't set attributes on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { - return undefined; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery(elem)[name](value); - } - - var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), - // Whether we are setting (or getting) - set = value !== undefined; - - // Try to normalize/fix the name - name = notxml && jQuery.props[ name ] || name; - - // Only do all the following if this is a node (faster for style) - if ( elem.nodeType === 1 ) { - // These attributes require special treatment - var special = rspecialurl.test( name ); - - // Safari mis-reports the default selected property of an option - // Accessing the parent's selectedIndex property fixes it - if ( name === "selected" && !jQuery.support.optSelected ) { - var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } - - // If applicable, access the attribute via the DOM 0 way - if ( name in elem && notxml && !special ) { - if ( set ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } - - elem[ name ] = value; - } - - // browsers index elements by id/name on forms, give priority to attributes. - if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) { - return elem.getAttributeNode( name ).nodeValue; - } - - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - if ( name === "tabIndex" ) { - var attributeNode = elem.getAttributeNode( "tabIndex" ); - - return attributeNode && attributeNode.specified ? - attributeNode.value : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - - return elem[ name ]; - } - - if ( !jQuery.support.style && notxml && name === "style" ) { - if ( set ) { - elem.style.cssText = "" + value; - } - - return elem.style.cssText; - } - - if ( set ) { - // convert the value to a string (all browsers do this but IE) see #1070 - elem.setAttribute( name, "" + value ); - } - - var attr = !jQuery.support.hrefNormalized && notxml && special ? - // Some attributes require a special call on IE - elem.getAttribute( name, 2 ) : - elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return attr === null ? undefined : attr; - } - - // elem is actually elem.style ... set the style - // Using attr for specific style information is now deprecated. Use style instead. - return jQuery.style( elem, name, value ); - } -}); -var rnamespaces = /\.(.*)$/, - fcleanup = function( nm ) { - return nm.replace(/[^\w\s\.\|`]/g, function( ch ) { - return "\\" + ch; - }); - }; - -/* - * A number of helper functions used for managing events. - * Many of the ideas behind this code originated from - * Dean Edwards' addEvent library. - */ -jQuery.event = { - - // Bind an event to an element - // Original by Dean Edwards - add: function( elem, types, handler, data ) { - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // For whatever reason, IE has trouble passing the window object - // around, causing it to be cloned in the process - if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) { - elem = window; - } - - var handleObjIn, handleObj; - - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - } - - // Make sure that the function being executed has a unique ID - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure - var elemData = jQuery.data( elem ); - - // If no elemData is found then we must be trying to bind to one of the - // banned noData elements - if ( !elemData ) { - return; - } - - var events = elemData.events = elemData.events || {}, - eventHandle = elemData.handle, eventHandle; - - if ( !eventHandle ) { - elemData.handle = eventHandle = function() { - // Handle the second event of a trigger and when - // an event is called after a page has unloaded - return typeof jQuery !== "undefined" && !jQuery.event.triggered ? - jQuery.event.handle.apply( eventHandle.elem, arguments ) : - undefined; - }; - } - - // Add elem as a property of the handle function - // This is to prevent a memory leak with non-native events in IE. - eventHandle.elem = elem; - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = types.split(" "); - - var type, i = 0, namespaces; - - while ( (type = types[ i++ ]) ) { - handleObj = handleObjIn ? - jQuery.extend({}, handleObjIn) : - { handler: handler, data: data }; - - // Namespaced event handlers - if ( type.indexOf(".") > -1 ) { - namespaces = type.split("."); - type = namespaces.shift(); - handleObj.namespace = namespaces.slice(0).sort().join("."); - - } else { - namespaces = []; - handleObj.namespace = ""; - } - - handleObj.type = type; - handleObj.guid = handler.guid; - - // Get the current list of functions bound to this event - var handlers = events[ type ], - special = jQuery.event.special[ type ] || {}; - - // Init the event handler queue - if ( !handlers ) { - handlers = events[ type ] = []; - - // Check for a special event handler - // Only use addEventListener/attachEvent if the special - // events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add the function to the element's handler list - handlers.push( handleObj ); - - // Keep track of which events have been used, for global triggering - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, pos ) { - // don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - var ret, type, fn, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, - elemData = jQuery.data( elem ), - events = elemData && elemData.events; - - if ( !elemData || !events ) { - return; - } - - // types is actually an event object here - if ( types && types.type ) { - handler = types.handler; - types = types.type; - } - - // Unbind all events for the element - if ( !types || typeof types === "string" && types.charAt(0) === "." ) { - types = types || ""; - - for ( type in events ) { - jQuery.event.remove( elem, type + types ); - } - - return; - } - - // Handle multiple events separated by a space - // jQuery(...).unbind("mouseover mouseout", fn); - types = types.split(" "); - - while ( (type = types[ i++ ]) ) { - origType = type; - handleObj = null; - all = type.indexOf(".") < 0; - namespaces = []; - - if ( !all ) { - // Namespaced event handlers - namespaces = type.split("."); - type = namespaces.shift(); - - namespace = new RegExp("(^|\\.)" + - jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)") - } - - eventType = events[ type ]; - - if ( !eventType ) { - continue; - } - - if ( !handler ) { - for ( var j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( all || namespace.test( handleObj.namespace ) ) { - jQuery.event.remove( elem, origType, handleObj.handler, j ); - eventType.splice( j--, 1 ); - } - } - - continue; - } - - special = jQuery.event.special[ type ] || {}; - - for ( var j = pos || 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( handler.guid === handleObj.guid ) { - // remove the given handler for the given type - if ( all || namespace.test( handleObj.namespace ) ) { - if ( pos == null ) { - eventType.splice( j--, 1 ); - } - - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - - if ( pos != null ) { - break; - } - } - } - - // remove generic event handler if no more handlers exist - if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - removeEvent( elem, type, elemData.handle ); - } - - ret = null; - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - var handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - delete elemData.events; - delete elemData.handle; - - if ( jQuery.isEmptyObject( elemData ) ) { - jQuery.removeData( elem ); - } - } - }, - - // bubbling is internal - trigger: function( event, data, elem /*, bubbling */ ) { - // Event object or event type - var type = event.type || event, - bubbling = arguments[3]; - - if ( !bubbling ) { - event = typeof event === "object" ? - // jQuery.Event object - event[expando] ? event : - // Object literal - jQuery.extend( jQuery.Event(type), event ) : - // Just the event type (string) - jQuery.Event(type); - - if ( type.indexOf("!") >= 0 ) { - event.type = type = type.slice(0, -1); - event.exclusive = true; - } - - // Handle a global trigger - if ( !elem ) { - // Don't bubble custom events when global (to avoid too much overhead) - event.stopPropagation(); - - // Only trigger if we've ever bound an event for it - if ( jQuery.event.global[ type ] ) { - jQuery.each( jQuery.cache, function() { - if ( this.events && this.events[type] ) { - jQuery.event.trigger( event, data, this.handle.elem ); - } - }); - } - } - - // Handle triggering a single element - - // don't do events on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { - return undefined; - } - - // Clean up in case it is reused - event.result = undefined; - event.target = elem; - - // Clone the incoming data, if any - data = jQuery.makeArray( data ); - data.unshift( event ); - } - - event.currentTarget = elem; - - // Trigger the event, it is assumed that "handle" is a function - var handle = jQuery.data( elem, "handle" ); - if ( handle ) { - handle.apply( elem, data ); - } - - var parent = elem.parentNode || elem.ownerDocument; - - // Trigger an inline bound script - try { - if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { - if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) { - event.result = false; - } - } - - // prevent IE from throwing an error for some elements with some event types, see #3533 - } catch (e) {} - - if ( !event.isPropagationStopped() && parent ) { - jQuery.event.trigger( event, data, parent, true ); - - } else if ( !event.isDefaultPrevented() ) { - var target = event.target, old, - isClick = jQuery.nodeName(target, "a") && type === "click", - special = jQuery.event.special[ type ] || {}; - - if ( (!special._default || special._default.call( elem, event ) === false) && - !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { - - try { - if ( target[ type ] ) { - // Make sure that we don't accidentally re-trigger the onFOO events - old = target[ "on" + type ]; - - if ( old ) { - target[ "on" + type ] = null; - } - - jQuery.event.triggered = true; - target[ type ](); - } - - // prevent IE from throwing an error for some elements with some event types, see #3533 - } catch (e) {} - - if ( old ) { - target[ "on" + type ] = old; - } - - jQuery.event.triggered = false; - } - } - }, - - handle: function( event ) { - var all, handlers, namespaces, namespace, events; - - event = arguments[0] = jQuery.event.fix( event || window.event ); - event.currentTarget = this; - - // Namespaced event handlers - all = event.type.indexOf(".") < 0 && !event.exclusive; - - if ( !all ) { - namespaces = event.type.split("."); - event.type = namespaces.shift(); - namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)"); - } - - var events = jQuery.data(this, "events"), handlers = events[ event.type ]; - - if ( events && handlers ) { - // Clone the handlers to prevent manipulation - handlers = handlers.slice(0); - - for ( var j = 0, l = handlers.length; j < l; j++ ) { - var handleObj = handlers[ j ]; - - // Filter the functions by class - if ( all || namespace.test( handleObj.namespace ) ) { - // Pass in a reference to the handler function itself - // So that we can later remove it - event.handler = handleObj.handler; - event.data = handleObj.data; - event.handleObj = handleObj; - - var ret = handleObj.handler.apply( this, arguments ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - - if ( event.isImmediatePropagationStopped() ) { - break; - } - } - } - } - - return event.result; - }, - - props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), - - fix: function( event ) { - if ( event[ expando ] ) { - return event; - } - - // store a copy of the original event object - // and "clone" to set read-only properties - var originalEvent = event; - event = jQuery.Event( originalEvent ); - - for ( var i = this.props.length, prop; i; ) { - prop = this.props[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary - if ( !event.target ) { - event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either - } - - // check if target is a textnode (safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && event.fromElement ) { - event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; - } - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && event.clientX != null ) { - var doc = document.documentElement, body = document.body; - event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); - event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); - } - - // Add which for key events - if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) { - event.which = event.charCode || event.keyCode; - } - - // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) - if ( !event.metaKey && event.ctrlKey ) { - event.metaKey = event.ctrlKey; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && event.button !== undefined ) { - event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); - } - - return event; - }, - - // Deprecated, use jQuery.guid instead - guid: 1E8, - - // Deprecated, use jQuery.proxy instead - proxy: jQuery.proxy, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady, - teardown: jQuery.noop - }, - - live: { - add: function( handleObj ) { - jQuery.event.add( this, handleObj.origType, jQuery.extend({}, handleObj, {handler: liveHandler}) ); - }, - - remove: function( handleObj ) { - var remove = true, - type = handleObj.origType.replace(rnamespaces, ""); - - jQuery.each( jQuery.data(this, "events").live || [], function() { - if ( type === this.origType.replace(rnamespaces, "") ) { - remove = false; - return false; - } - }); - - if ( remove ) { - jQuery.event.remove( this, handleObj.origType, liveHandler ); - } - } - - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( this.setInterval ) { - this.onbeforeunload = eventHandle; - } - - return false; - }, - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - } -}; - -var removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - elem.removeEventListener( type, handle, false ); - } : - function( elem, type, handle ) { - elem.detachEvent( "on" + type, handle ); - }; - -jQuery.Event = function( src ) { - // Allow instantiation without the 'new' keyword - if ( !this.preventDefault ) { - return new jQuery.Event( src ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - // Event type - } else { - this.type = src; - } - - // timeStamp is buggy for some events on Firefox(#3843) - // So we won't rely on the native value - this.timeStamp = now(); - - // Mark it as fixed - this[ expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - } - // otherwise set the returnValue property of the original event to false (IE) - e.returnValue = false; - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Checks if an event happened on an element within another element -// Used in jQuery.event.special.mouseenter and mouseleave handlers -var withinElement = function( event ) { - // Check if mouse(over|out) are still within the same parent element - var parent = event.relatedTarget; - - // Firefox sometimes assigns relatedTarget a XUL element - // which we cannot access the parentNode property of - try { - // Traverse up the tree - while ( parent && parent !== this ) { - parent = parent.parentNode; - } - - if ( parent !== this ) { - // set the correct event type - event.type = event.data; - - // handle event if we actually just moused on to a non sub-element - jQuery.event.handle.apply( this, arguments ); - } - - // assuming we've left the element since we most likely mousedover a xul element - } catch(e) { } -}, - -// In case of event delegation, we only need to rename the event.type, -// liveHandler will take care of the rest. -delegate = function( event ) { - event.type = event.data; - jQuery.event.handle.apply( this, arguments ); -}; - -// Create mouseenter and mouseleave events -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - setup: function( data ) { - jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); - }, - teardown: function( data ) { - jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); - } - }; -}); - -// submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function( data, namespaces ) { - if ( this.nodeName.toLowerCase() !== "form" ) { - jQuery.event.add(this, "click.specialSubmit", function( e ) { - var elem = e.target, type = elem.type; - - if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { - return trigger( "submit", this, arguments ); - } - }); - - jQuery.event.add(this, "keypress.specialSubmit", function( e ) { - var elem = e.target, type = elem.type; - - if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { - return trigger( "submit", this, arguments ); - } - }); - - } else { - return false; - } - }, - - teardown: function( namespaces ) { - jQuery.event.remove( this, ".specialSubmit" ); - } - }; - -} - -// change delegation, happens here so we have bind. -if ( !jQuery.support.changeBubbles ) { - - var formElems = /textarea|input|select/i, - - changeFilters, - - getVal = function( elem ) { - var type = elem.type, val = elem.value; - - if ( type === "radio" || type === "checkbox" ) { - val = elem.checked; - - } else if ( type === "select-multiple" ) { - val = elem.selectedIndex > -1 ? - jQuery.map( elem.options, function( elem ) { - return elem.selected; - }).join("-") : - ""; - - } else if ( elem.nodeName.toLowerCase() === "select" ) { - val = elem.selectedIndex; - } - - return val; - }, - - testChange = function testChange( e ) { - var elem = e.target, data, val; - - if ( !formElems.test( elem.nodeName ) || elem.readOnly ) { - return; - } - - data = jQuery.data( elem, "_change_data" ); - val = getVal(elem); - - // the current data will be also retrieved by beforeactivate - if ( e.type !== "focusout" || elem.type !== "radio" ) { - jQuery.data( elem, "_change_data", val ); - } - - if ( data === undefined || val === data ) { - return; - } - - if ( data != null || val ) { - e.type = "change"; - return jQuery.event.trigger( e, arguments[1], elem ); - } - }; - - jQuery.event.special.change = { - filters: { - focusout: testChange, - - click: function( e ) { - var elem = e.target, type = elem.type; - - if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) { - return testChange.call( this, e ); - } - }, - - // Change has to be called before submit - // Keydown will be called before keypress, which is used in submit-event delegation - keydown: function( e ) { - var elem = e.target, type = elem.type; - - if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") || - (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || - type === "select-multiple" ) { - return testChange.call( this, e ); - } - }, - - // Beforeactivate happens also before the previous element is blurred - // with this event you can't trigger a change event, but you can store - // information/focus[in] is not needed anymore - beforeactivate: function( e ) { - var elem = e.target; - jQuery.data( elem, "_change_data", getVal(elem) ); - } - }, - - setup: function( data, namespaces ) { - if ( this.type === "file" ) { - return false; - } - - for ( var type in changeFilters ) { - jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); - } - - return formElems.test( this.nodeName ); - }, - - teardown: function( namespaces ) { - jQuery.event.remove( this, ".specialChange" ); - - return formElems.test( this.nodeName ); - } - }; - - changeFilters = jQuery.event.special.change.filters; -} - -function trigger( type, elem, args ) { - args[0].type = type; - return jQuery.event.handle.apply( elem, args ); -} - -// Create "bubbling" focus and blur events -if ( document.addEventListener ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - jQuery.event.special[ fix ] = { - setup: function() { - this.addEventListener( orig, handler, true ); - }, - teardown: function() { - this.removeEventListener( orig, handler, true ); - } - }; - - function handler( e ) { - e = jQuery.event.fix( e ); - e.type = fix; - return jQuery.event.handle.call( this, e ); - } - }); -} - -jQuery.each(["bind", "one"], function( i, name ) { - jQuery.fn[ name ] = function( type, data, fn ) { - // Handle object literals - if ( typeof type === "object" ) { - for ( var key in type ) { - this[ name ](key, data, type[key], fn); - } - return this; - } - - if ( jQuery.isFunction( data ) ) { - fn = data; - data = undefined; - } - - var handler = name === "one" ? jQuery.proxy( fn, function( event ) { - jQuery( this ).unbind( event, handler ); - return fn.apply( this, arguments ); - }) : fn; - - if ( type === "unload" && name !== "one" ) { - this.one( type, data, fn ); - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - jQuery.event.add( this[i], type, handler, data ); - } - } - - return this; - }; -}); - -jQuery.fn.extend({ - unbind: function( type, fn ) { - // Handle object literals - if ( typeof type === "object" && !type.preventDefault ) { - for ( var key in type ) { - this.unbind(key, type[key]); - } - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - jQuery.event.remove( this[i], type, fn ); - } - } - - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.live( types, data, fn, selector ); - }, - - undelegate: function( selector, types, fn ) { - if ( arguments.length === 0 ) { - return this.unbind( "live" ); - - } else { - return this.die( types, null, fn, selector ); - } - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - - triggerHandler: function( type, data ) { - if ( this[0] ) { - var event = jQuery.Event( type ); - event.preventDefault(); - event.stopPropagation(); - jQuery.event.trigger( event, data, this[0] ); - return event.result; - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, i = 1; - - // link all the functions, so any of them can unbind this click handler - while ( i < args.length ) { - jQuery.proxy( fn, args[ i++ ] ); - } - - return this.click( jQuery.proxy( fn, function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - })); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -var liveMap = { - focus: "focusin", - blur: "focusout", - mouseenter: "mouseover", - mouseleave: "mouseout" -}; - -jQuery.each(["live", "die"], function( i, name ) { - jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) { - var type, i = 0, match, namespaces, preType, - selector = origSelector || this.selector, - context = origSelector ? this : jQuery( this.context ); - - if ( jQuery.isFunction( data ) ) { - fn = data; - data = undefined; - } - - types = (types || "").split(" "); - - while ( (type = types[ i++ ]) != null ) { - match = rnamespaces.exec( type ); - namespaces = ""; - - if ( match ) { - namespaces = match[0]; - type = type.replace( rnamespaces, "" ); - } - - if ( type === "hover" ) { - types.push( "mouseenter" + namespaces, "mouseleave" + namespaces ); - continue; - } - - preType = type; - - if ( type === "focus" || type === "blur" ) { - types.push( liveMap[ type ] + namespaces ); - type = type + namespaces; - - } else { - type = (liveMap[ type ] || type) + namespaces; - } - - if ( name === "live" ) { - // bind live handler - context.each(function(){ - jQuery.event.add( this, liveConvert( type, selector ), - { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } ); - }); - - } else { - // unbind live handler - context.unbind( liveConvert( type, selector ), fn ); - } - } - - return this; - } -}); - -function liveHandler( event ) { - var stop, elems = [], selectors = [], args = arguments, - related, match, handleObj, elem, j, i, l, data, - events = jQuery.data( this, "events" ); - - // Make sure we avoid non-left-click bubbling in Firefox (#3861) - if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) { - return; - } - - event.liveFired = this; - - var live = events.live.slice(0); - - for ( j = 0; j < live.length; j++ ) { - handleObj = live[j]; - - if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) { - selectors.push( handleObj.selector ); - - } else { - live.splice( j--, 1 ); - } - } - - match = jQuery( event.target ).closest( selectors, event.currentTarget ); - - for ( i = 0, l = match.length; i < l; i++ ) { - for ( j = 0; j < live.length; j++ ) { - handleObj = live[j]; - - if ( match[i].selector === handleObj.selector ) { - elem = match[i].elem; - related = null; - - // Those two events require additional checking - if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { - related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; - } - - if ( !related || related !== elem ) { - elems.push({ elem: elem, handleObj: handleObj }); - } - } - } - } - - for ( i = 0, l = elems.length; i < l; i++ ) { - match = elems[i]; - event.currentTarget = match.elem; - event.data = match.handleObj.data; - event.handleObj = match.handleObj; - - if ( match.handleObj.origHandler.apply( match.elem, args ) === false ) { - stop = false; - break; - } - } - - return stop; -} - -function liveConvert( type, selector ) { - return "live." + (type && type !== "*" ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&"); -} - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( fn ) { - return fn ? this.bind( name, fn ) : this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } -}); - -// Prevent memory leaks in IE -// Window isn't included so as not to unbind existing unload events -// More info: -// - http://isaacschlueter.com/2006/10/msie-memory-leaks/ -if ( window.attachEvent && !window.addEventListener ) { - window.attachEvent("onunload", function() { - for ( var id in jQuery.cache ) { - if ( jQuery.cache[ id ].handle ) { - // Try/Catch is to handle iframes being unloaded, see #4280 - try { - jQuery.event.remove( jQuery.cache[ id ].handle.elem ); - } catch(e) {} - } - } - }); -} -/*! - * Sizzle CSS Selector Engine - v1.0 - * Copyright 2009, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function(){ - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function(selector, context, results, seed) { - results = results || []; - var origContext = context = context || document; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var parts = [], m, set, checkSet, extra, prune = true, contextXML = isXML(context), - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context ); - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set ); - } - } - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - var ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; - } - - if ( context ) { - var ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray(set); - } else { - prune = false; - } - - while ( parts.length ) { - var cur = parts.pop(), pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - } else if ( context && context.nodeType === 1 ) { - for ( var i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - } else { - for ( var i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function(results){ - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort(sortOrder); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[i-1] ) { - results.splice(i--, 1); - } - } - } - } - - return results; -}; - -Sizzle.matches = function(expr, set){ - return Sizzle(expr, null, null, set); -}; - -Sizzle.find = function(expr, context, isXML){ - var set, match; - - if ( !expr ) { - return []; - } - - for ( var i = 0, l = Expr.order.length; i < l; i++ ) { - var type = Expr.order[i], match; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - var left = match[1]; - match.splice(1,1); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace(/\\/g, ""); - set = Expr.find[ type ]( match, context, isXML ); - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = context.getElementsByTagName("*"); - } - - return {set: set, expr: expr}; -}; - -Sizzle.filter = function(expr, set, inplace, not){ - var old = expr, result = [], curLoop = set, match, anyFound, - isXMLFilter = set && set[0] && isXML(set[0]); - - while ( expr && set.length ) { - for ( var type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - var filter = Expr.filter[ type ], found, item, left = match[1]; - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( var i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - var pass = not ^ !!found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - } else { - curLoop[i] = false; - } - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw "Syntax error, unrecognized expression: " + msg; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - match: { - ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - leftMatch: {}, - attrMap: { - "class": "className", - "for": "htmlFor" - }, - attrHandle: { - href: function(elem){ - return elem.getAttribute("href"); - } - }, - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !/\W/.test(part), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - ">": function(checkSet, part){ - var isPartStr = typeof part === "string"; - - if ( isPartStr && !/\W/.test(part) ) { - part = part.toLowerCase(); - - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - } else { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - "": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck; - - if ( typeof part === "string" && !/\W/.test(part) ) { - var nodeCheck = part = part.toLowerCase(); - checkFn = dirNodeCheck; - } - - checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); - }, - "~": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck; - - if ( typeof part === "string" && !/\W/.test(part) ) { - var nodeCheck = part = part.toLowerCase(); - checkFn = dirNodeCheck; - } - - checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); - } - }, - find: { - ID: function(match, context, isXML){ - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - return m ? [m] : []; - } - }, - NAME: function(match, context){ - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], results = context.getElementsByName(match[1]); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - TAG: function(match, context){ - return context.getElementsByTagName(match[1]); - } - }, - preFilter: { - CLASS: function(match, curLoop, inplace, result, not, isXML){ - match = " " + match[1].replace(/\\/g, "") + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - ID: function(match){ - return match[1].replace(/\\/g, ""); - }, - TAG: function(match, curLoop){ - return match[1].toLowerCase(); - }, - CHILD: function(match){ - if ( match[1] === "nth" ) { - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - ATTR: function(match, curLoop, inplace, result, not, isXML){ - var name = match[1].replace(/\\/g, ""); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - PSEUDO: function(match, curLoop, inplace, result, not){ - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - if ( !inplace ) { - result.push.apply( result, ret ); - } - return false; - } - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - POS: function(match){ - match.unshift( true ); - return match; - } - }, - filters: { - enabled: function(elem){ - return elem.disabled === false && elem.type !== "hidden"; - }, - disabled: function(elem){ - return elem.disabled === true; - }, - checked: function(elem){ - return elem.checked === true; - }, - selected: function(elem){ - // Accessing this property makes selected-by-default - // options in Safari work properly - elem.parentNode.selectedIndex; - return elem.selected === true; - }, - parent: function(elem){ - return !!elem.firstChild; - }, - empty: function(elem){ - return !elem.firstChild; - }, - has: function(elem, i, match){ - return !!Sizzle( match[3], elem ).length; - }, - header: function(elem){ - return /h\d/i.test( elem.nodeName ); - }, - text: function(elem){ - return "text" === elem.type; - }, - radio: function(elem){ - return "radio" === elem.type; - }, - checkbox: function(elem){ - return "checkbox" === elem.type; - }, - file: function(elem){ - return "file" === elem.type; - }, - password: function(elem){ - return "password" === elem.type; - }, - submit: function(elem){ - return "submit" === elem.type; - }, - image: function(elem){ - return "image" === elem.type; - }, - reset: function(elem){ - return "reset" === elem.type; - }, - button: function(elem){ - return "button" === elem.type || elem.nodeName.toLowerCase() === "button"; - }, - input: function(elem){ - return /input|select|textarea|button/i.test(elem.nodeName); - } - }, - setFilters: { - first: function(elem, i){ - return i === 0; - }, - last: function(elem, i, match, array){ - return i === array.length - 1; - }, - even: function(elem, i){ - return i % 2 === 0; - }, - odd: function(elem, i){ - return i % 2 === 1; - }, - lt: function(elem, i, match){ - return i < match[3] - 0; - }, - gt: function(elem, i, match){ - return i > match[3] - 0; - }, - nth: function(elem, i, match){ - return match[3] - 0 === i; - }, - eq: function(elem, i, match){ - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function(elem, match, i, array){ - var name = match[1], filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - } else if ( name === "not" ) { - var not = match[3]; - - for ( var i = 0, l = not.length; i < l; i++ ) { - if ( not[i] === elem ) { - return false; - } - } - - return true; - } else { - Sizzle.error( "Syntax error, unrecognized expression: " + name ); - } - }, - CHILD: function(elem, match){ - var type = match[1], node = elem; - switch (type) { - case 'only': - case 'first': - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - if ( type === "first" ) { - return true; - } - node = elem; - case 'last': - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - return true; - case 'nth': - var first = match[2], last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - var doneName = match[0], - parent = elem.parentNode; - - if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { - var count = 0; - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - parent.sizcache = doneName; - } - - var diff = elem.nodeIndex - last; - if ( first === 0 ) { - return diff === 0; - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - ID: function(elem, match){ - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - TAG: function(elem, match){ - return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; - }, - CLASS: function(elem, match){ - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - ATTR: function(elem, match){ - var name = match[1], - result = Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - POS: function(elem, match, i, array){ - var name = match[2], filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num){ - return "\\" + (num - 0 + 1); - })); -} - -var makeArray = function(array, results) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch(e){ - makeArray = function(array, results) { - var ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - } else { - if ( typeof array.length === "number" ) { - for ( var i = 0, l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - } else { - for ( var i = 0; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - if ( a == b ) { - hasDuplicate = true; - } - return a.compareDocumentPosition ? -1 : 1; - } - - var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} else if ( "sourceIndex" in document.documentElement ) { - sortOrder = function( a, b ) { - if ( !a.sourceIndex || !b.sourceIndex ) { - if ( a == b ) { - hasDuplicate = true; - } - return a.sourceIndex ? -1 : 1; - } - - var ret = a.sourceIndex - b.sourceIndex; - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} else if ( document.createRange ) { - sortOrder = function( a, b ) { - if ( !a.ownerDocument || !b.ownerDocument ) { - if ( a == b ) { - hasDuplicate = true; - } - return a.ownerDocument ? -1 : 1; - } - - var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); - aRange.setStart(a, 0); - aRange.setEnd(a, 0); - bRange.setStart(b, 0); - bRange.setEnd(b, 0); - var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} - -// Utility function for retreiving the text value of an array of DOM nodes -function getText( elems ) { - var ret = "", elem; - - for ( var i = 0; elems[i]; i++ ) { - elem = elems[i]; - - // Get the text from text nodes and CDATA nodes - if ( elem.nodeType === 3 || elem.nodeType === 4 ) { - ret += elem.nodeValue; - - // Traverse everything else, except comment nodes - } else if ( elem.nodeType !== 8 ) { - ret += getText( elem.childNodes ); - } - } - - return ret; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date).getTime(); - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - var root = document.documentElement; - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function(match, context, isXML){ - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; - } - }; - - Expr.filter.ID = function(elem, match){ - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - root = form = null; // release memory in IE -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function(match, context){ - var results = context.getElementsByTagName(match[1]); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - Expr.attrHandle.href = function(elem){ - return elem.getAttribute("href", 2); - }; - } - - div = null; // release memory in IE -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, div = document.createElement("div"); - div.innerHTML = "

    "; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function(query, context, extra, seed){ - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && context.nodeType === 9 && !isXML(context) ) { - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(e){} - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - div = null; // release memory in IE - })(); -} - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
    "; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function(match, context, isXML) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - div = null; // release memory in IE -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - elem = elem[dir]; - var match = false; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem.sizcache = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - elem = elem[dir]; - var match = false; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem.sizcache = doneName; - elem.sizset = i; - } - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -var contains = document.compareDocumentPosition ? function(a, b){ - return !!(a.compareDocumentPosition(b) & 16); -} : function(a, b){ - return a !== b && (a.contains ? a.contains(b) : true); -}; - -var isXML = function(elem){ - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function(selector, context){ - var tmpSet = [], later = "", match, - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = getText; -jQuery.isXMLDoc = isXML; -jQuery.contains = contains; - -return; - -window.Sizzle = Sizzle; - -})(); -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - slice = Array.prototype.slice; - -// Implement the identical functionality for filter and not -var winnow = function( elements, qualifier, keep ) { - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - return !!qualifier.call( elem, i, elem ) === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return (elem === qualifier) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return (jQuery.inArray( elem, qualifier ) >= 0) === keep; - }); -}; - -jQuery.fn.extend({ - find: function( selector ) { - var ret = this.pushStack( "", "find", selector ), length = 0; - - for ( var i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( var n = length; n < ret.length; n++ ) { - for ( var r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && jQuery.filter( selector, this ).length > 0; - }, - - closest: function( selectors, context ) { - if ( jQuery.isArray( selectors ) ) { - var ret = [], cur = this[0], match, matches = {}, selector; - - if ( cur && selectors.length ) { - for ( var i = 0, l = selectors.length; i < l; i++ ) { - selector = selectors[i]; - - if ( !matches[selector] ) { - matches[selector] = jQuery.expr.match.POS.test( selector ) ? - jQuery( selector, context || this.context ) : - selector; - } - } - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( selector in matches ) { - match = matches[selector]; - - if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) { - ret.push({ selector: selector, elem: cur }); - delete matches[selector]; - } - } - cur = cur.parentNode; - } - } - - return ret; - } - - var pos = jQuery.expr.match.POS.test( selectors ) ? - jQuery( selectors, context || this.context ) : null; - - return this.map(function( i, cur ) { - while ( cur && cur.ownerDocument && cur !== context ) { - if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selectors) ) { - return cur; - } - cur = cur.parentNode; - } - return null; - }); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - if ( !elem || typeof elem === "string" ) { - return jQuery.inArray( this[0], - // If it receives a string, the selector is used - // If it receives nothing, the siblings are used - elem ? jQuery( elem ) : this.parent().children() ); - } - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context || this.context ) : - jQuery.makeArray( selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( elem.parentNode.firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call(arguments).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], cur = elem[dir]; - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); -var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g, - rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i, - rtagName = /<([\w:]+)/, - rtbody = /"; - }, - wrapMap = { - option: [ 1, "" ], - legend: [ 1, "
    ", "
    " ], - thead: [ 1, "", "
    " ], - tr: [ 2, "", "
    " ], - td: [ 3, "", "
    " ], - col: [ 2, "", "
    " ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }; - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and - - - - - -
    -

    Testing cfi.coffee

    -

    Click anywhere and the location will be marked with a marker, whose position is set via a CFI.

    -

    - Reset CFI to None -   - Test viewport location calculation: - -

    -

    A div with scrollbars

    -

    Scroll down and click on some elements. Make sure to hit both - bold and not bold text as well as different points on the image

    -
    But I must explain to you how all this mistaken - idea of denouncing pleasure and praising pain was born and I - will give you a complete account of the system, and expound the - actual teachings of the great explorer of the truth, the - master-builder of human happiness. No one rejects, dislikes, or - avoids pleasure itself, because it is pleasure, but because - those who do not know how to pursue pleasure rationally - encounter consequences that are extremely painful. Nor again is - there anyone who loves or pursues or desires to obtain - pain of itself, because it is pain, but because occasionally - circumstances occur in which toil and pain can procure him some - great pleasure. To take a trivial example, which of us ever - undertakes laborious physical exercise, except to obtain some - advantage from it? But who has any right to find fault with a - man who chooses to enjoy a pleasure that has no annoying - consequences, or one who avoids a pain that produces no - resultant pleasure? On the other hand, we denounce with - righteous indignation and dislike men who are so beguiled and - demoralized by the charms of pleasure of the moment, so blinded - by desire, that they cannot foresee - Test Image - -
    -

    Some entities and comments

    -

    Entities: & © § > some text after entities

    -

    An invisible Comment: followed by some text

    -

    An invalid (in HTML) CDATA: followed by some text

    -

    Margins padding borders

    -

    Try clicking in the margins, borders and padding. CFI - calculation should fail.

    - -

    But I must explain to you how all this mistaken - idea of denouncing pleasure and praising pain was born and I will - give you a complete account of the system, and expound the actual - teachings of the great explorer of the truth, the master-builder of - human happiness. No one rejects, dislikes, or avoids pleasure - itself, because it is pleasure, but because those who do not know - how to pursue pleasure rationally encounter consequences that are - extremely painful. Nor again is there anyone who loves or - pursues or desires to obtain pain of itself, because it is - pain, but because occasionally circumstances occur in which toil - and pain can procure him some great pleasure. To take a trivial - example, which of us ever undertakes laborious physical exercise, - except to obtain some advantage from it? But who has any right to - find fault with a man who chooses to enjoy a pleasure that has no - annoying consequences, or one who avoids a pain that produces no - resultant pleasure? On the other hand, we denounce with righteous - indignation and dislike men who are so beguiled and demoralized by - the charms of pleasure of the moment, so blinded by desire, that - they cannot foresee

    - -

    Lots of collapsed whitespace

    -

    Try clicking the A character after the colon: - A suffix

    - -

    Lots of nested/sibling tags

    -

    A bunch of nested and sibling - tags, all mixed together. Click all - over this paragraph to test things.

    - -

    Images

    -

    Try clicking at different points along the image. Also try - changing the magnification and then hitting reload.

    - Test Image - -

    Iframes

    -

    Try clicking anywhere in the iframe below:

    - - -

    Video

    -

    Try clicking on this video while it is playing. The page should - reload with the video paused at the point it was at when you - clicked. To play the video you should right click on it and select - play (otherwise the click will cause a reload). -

    - - -
    - - - - - diff --git a/src/calibre/ebooks/oeb/display/test-cfi/marker.png b/src/calibre/ebooks/oeb/display/test-cfi/marker.png deleted file mode 100644 index 6dcc1fb7ba693b0af2e108a59e3e99c439bfdc55..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 751 zcmVvA>c ziyb~c5Rlt>S1qO$pR{q*&Xq}-IOlYj{(#*&8t@8Z^QX*Y45*O?UsO3>W%~=Xw^J? zB69JK_?I6^_rh!GsAUM!1-ankJ(2I%M9#lUzKLB9b|o+cuzbSe>kSMLsqdc<5dweN zHq1I(J%RV<-kyH(b5rE#p?xz+@f(+eonnB#gjRDkt*gveMj&-V)(Uw-cX9u!34Dg% zorHnNz(kNXRzd&=?cmThQqf5ml-Nt~{xTAtBX}4;6+tQ%690wBl?O>I^btoi*IzaCjXEG%C3AE{QDiXgtoC(!AMi_5P;K4-O$qU`lx~d8qZ%- zLgUR_$LW{XEvwc6v%`(h2TqATkBfkpBA_J3(0G!PppO}7Bv$mSn#IHnly=^;A)}3F z$KX0oT>8I@1zH##<4(r}YFMlg5tQJ}^)lM$5n!}8)9V$x8o=@nAJ7eO$270fmAMb3 z=Dx3~*jp5kAUf6@FC|{a{{-JPUd4K`m@44Nc55yg`HNi8%sdBbkua~nR{^)Vz#8p~ zuHsdto-u!5Ud0(?Wm2oG1v - Released under the GPLv3 License -### - -class CalibreUtils - # This class is a namespace to expose functions via the - # window.calibre_utils object. - - constructor: () -> - if not this instanceof arguments.callee - throw new Error('CalibreUtils constructor called as function') - this.dom_attr = 'calibre_f3fa75ca98eb4413a4ee413f20f60226' - this.dom_data = [] - - # Data API {{{ - - retrieve: (node, key, def=null) -> - # Retrieve data previously stored on node (a DOM node) with key (a - # string). If no such data is found then return the value of def. - idx = parseInt(node.getAttribute(this.dom_attr)) - if isNaN(idx) - return def - data = this.dom_data[idx] - if not data.hasOwnProperty(key) - return def - return data[key] - - store: (node, key, val) -> - # Store arbitrary javscript object val on DOM node node with key (a - # string). This can be later retrieved by the retrieve method. - idx = parseInt(node.getAttribute(this.dom_attr)) - if isNaN(idx) - idx = this.dom_data.length - node.setAttribute(this.dom_attr, idx+'') - this.dom_data.push({}) - this.dom_data[idx][key] = val - # }}} - - log: (args...) -> # {{{ - # Output args to the window.console object. args are automatically - # coerced to strings - if args - msg = args.join(' ') - if window?.console?.log - window.console.log(msg) - else if process?.stdout?.write - process.stdout.write(msg + '\n') - # }}} - - stack_trace: () -> # {{{ - currentFunction = arguments.callee.caller - while (currentFunction) - fn = currentFunction.toString() - this.log(fn) - currentFunction = currentFunction.caller - - # }}} - - window_scroll_pos: (win=window) -> # {{{ - # The current scroll position of the browser window - if typeof(win.pageXOffset) == 'number' - x = win.pageXOffset - y = win.pageYOffset - else # IE < 9 - if document.body and ( document.body.scrollLeft or document.body.scrollTop ) - x = document.body.scrollLeft - y = document.body.scrollTop - else if document.documentElement and ( document.documentElement.scrollLeft or document.documentElement.scrollTop) - y = document.documentElement.scrollTop - x = document.documentElement.scrollLeft - return [x, y] - # }}} - - viewport_to_document: (x, y, doc=window?.document) -> # {{{ - # Convert x, y from the viewport (window) co-ordinate system to the - # document (body) co-ordinate system - until doc == window.document - # We are in a frame - frame = doc.defaultView.frameElement - rect = frame.getBoundingClientRect() - x += rect.left - y += rect.top - doc = frame.ownerDocument - win = doc.defaultView - [wx, wy] = this.window_scroll_pos(win) - x += wx - y += wy - return [x, y] - # }}} - - absleft: (elem) -> # {{{ - # The left edge of elem in document co-ords. Works in all - # circumstances, including column layout. Note that this will cause - # a relayout if the render tree is dirty. Also, because of a bug in the - # version of WebKit bundled with Qt 4.8, this does not always work, see - # https://bugs.launchpad.net/bugs/1132641 for a test case. - r = elem.getBoundingClientRect() - return this.viewport_to_document(r.left, 0, elem.ownerDocument)[0] - # }}} - - abstop: (elem) -> # {{{ - # The left edge of elem in document co-ords. Works in all - # circumstances, including column layout. Note that this will cause - # a relayout if the render tree is dirty. Also, because of a bug in the - # version of WebKit bundled with Qt 4.8, this does not always work, see - # https://bugs.launchpad.net/bugs/1132641 for a test case. - r = elem.getBoundingClientRect() - return this.viewport_to_document(r.top, 0, elem.ownerDocument)[0] - # }}} - - word_at_point: (x, y) -> # {{{ - # Return the word at the specified point (in viewport co-ordinates) - range = if document.caretPositionFromPoint then document.caretPositionFromPoint(x, y) else document.caretRangeFromPoint(x, y) - if range == null - return null - node = range.startContainer - if node?.nodeType != Node.TEXT_NODE - return null - offset = range.startOffset - range = document.createRange() - range.selectNodeContents(node) - try - range.setStart(node, offset) - range.setEnd(node, offset+1) - catch error # Happens if offset is invalid - null - range.expand('word') - ans = range.toString().trim() - range.detach() - matches = ans.split(/\b/) - return if matches.length > 0 then matches[0] else null - - # }}} - - setup_epub_reading_system: (name, version, layout, features) -> # {{{ - window.navigator.epubReadingSystem = { - 'name':name, 'version':version, 'layoutStyle':layout, - 'hasFeature': (feature, version=1.0) -> - if (version == null or version == 1.0) and feature.toLowerCase() in features - return true - return false - } - # }}} - -if window? - window.calibre_utils = new CalibreUtils() - diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index aa1ca33c64..d79d789ac6 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -1346,23 +1346,6 @@ def event_type_name(ev_or_etype): return 'UnknownEventType' -def secure_web_page(qwebpage_or_qwebsettings): - from PyQt5.QtWebKit import QWebSettings - settings = qwebpage_or_qwebsettings if isinstance(qwebpage_or_qwebsettings, QWebSettings) else qwebpage_or_qwebsettings.settings() - settings.setAttribute(QWebSettings.JavaEnabled, False) - settings.setAttribute(QWebSettings.PluginsEnabled, False) - settings.setAttribute(QWebSettings.JavascriptCanOpenWindows, False) - settings.setAttribute(QWebSettings.JavascriptCanAccessClipboard, False) - settings.setAttribute(QWebSettings.LocalContentCanAccessFileUrls, False) # ensure javascript cannot read from local files - settings.setAttribute(QWebSettings.NotificationsEnabled, False) - settings.setThirdPartyCookiePolicy(QWebSettings.AlwaysBlockThirdPartyCookies) - settings.setAttribute(QWebSettings.OfflineStorageDatabaseEnabled, False) - settings.setAttribute(QWebSettings.LocalStorageEnabled, False) - QWebSettings.setOfflineStorageDefaultQuota(0) - QWebSettings.setOfflineStoragePath(None) - return settings - - empty_model = QStringListModel(['']) empty_index = empty_model.index(0) diff --git a/src/calibre/gui2/tweak_book/editor/syntax/javascript.py b/src/calibre/gui2/tweak_book/editor/syntax/javascript.py index 3cd576edcf..4b13636eb3 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/javascript.py +++ b/src/calibre/gui2/tweak_book/editor/syntax/javascript.py @@ -90,4 +90,4 @@ Highlighter = create_highlighter('JavascriptHighlighter', JavascriptLexer) if __name__ == '__main__': from calibre.gui2.tweak_book.editor.widget import launch_editor - launch_editor(P('viewer/images.js'), syntax='javascript') + launch_editor(P('viewer.js'), syntax='javascript') diff --git a/src/calibre/gui2/viewer/__init__.py b/src/calibre/gui2/viewer/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/calibre/gui2/viewer/bookmarkmanager.py b/src/calibre/gui2/viewer/bookmarkmanager.py deleted file mode 100644 index 55e388a8f6..0000000000 --- a/src/calibre/gui2/viewer/bookmarkmanager.py +++ /dev/null @@ -1,235 +0,0 @@ -#!/usr/bin/env python2 -# vim:fileencoding=utf-8 -from __future__ import absolute_import, division, print_function, unicode_literals - -__license__ = 'GPL v3' -__copyright__ = '2013, Kovid Goyal ' - -import json - -from PyQt5.Qt import ( - Qt, QListWidget, QListWidgetItem, QItemSelectionModel, QAction, - QGridLayout, QPushButton, QIcon, QWidget, pyqtSignal, QLabel) - -from calibre.gui2 import choose_save_file, choose_files -from calibre.utils.icu import sort_key -from polyglot.builtins import unicode_type, range - - -class BookmarksList(QListWidget): - - changed = pyqtSignal() - bookmark_activated = pyqtSignal(object) - - def __init__(self, parent=None): - QListWidget.__init__(self, parent) - self.setDragEnabled(True) - self.setDragDropMode(self.InternalMove) - self.setDefaultDropAction(Qt.MoveAction) - self.setAlternatingRowColors(True) - self.setStyleSheet('QListView::item { padding: 0.5ex }') - self.viewport().setAcceptDrops(True) - self.setDropIndicatorShown(True) - self.setContextMenuPolicy(Qt.ActionsContextMenu) - self.ac_edit = ac = QAction(QIcon(I('edit_input.png')), _('Edit this bookmark'), self) - self.addAction(ac) - self.ac_delete = ac = QAction(QIcon(I('trash.png')), _('Remove this bookmark'), self) - self.addAction(ac) - self.ac_sort = ac = QAction(_('Sort by name'), self) - self.addAction(ac) - self.ac_sort_pos = ac = QAction(_('Sort by position in book'), self) - self.addAction(ac) - - def dropEvent(self, ev): - QListWidget.dropEvent(self, ev) - if ev.isAccepted(): - self.changed.emit() - - def keyPressEvent(self, ev): - if ev.key() in (Qt.Key_Enter, Qt.Key_Return): - i = self.currentItem() - if i is not None: - self.bookmark_activated.emit(i) - ev.accept() - return - if ev.key() in (Qt.Key_Delete, Qt.Key_Backspace): - i = self.currentItem() - if i is not None: - self.ac_delete.trigger() - ev.accept() - return - return QListWidget.keyPressEvent(self, ev) - - -class BookmarkManager(QWidget): - - edited = pyqtSignal(object) - activated = pyqtSignal(object) - create_requested = pyqtSignal() - - def __init__(self, parent): - QWidget.__init__(self, parent) - self.l = l = QGridLayout(self) - l.setContentsMargins(0, 0, 0, 0) - self.setLayout(l) - - self.bookmarks_list = bl = BookmarksList(self) - bl.itemChanged.connect(self.item_changed) - l.addWidget(bl, 0, 0, 1, -1) - bl.itemClicked.connect(self.item_activated) - bl.bookmark_activated.connect(self.item_activated) - bl.changed.connect(lambda : self.edited.emit(self.get_bookmarks())) - bl.ac_edit.triggered.connect(self.edit_bookmark) - bl.ac_sort.triggered.connect(self.sort_by_name) - bl.ac_sort_pos.triggered.connect(self.sort_by_pos) - bl.ac_delete.triggered.connect(self.delete_bookmark) - - self.la = la = QLabel(_( - 'Double click to edit and drag-and-drop to re-order the bookmarks')) - la.setWordWrap(True) - l.addWidget(la, l.rowCount(), 0, 1, -1) - - self.button_new = b = QPushButton(QIcon(I('bookmarks.png')), _('&New'), self) - b.clicked.connect(self.create_requested) - b.setToolTip(_('Create a new bookmark at the current location')) - l.addWidget(b) - - self.button_delete = b = QPushButton(QIcon(I('trash.png')), _('&Remove'), self) - b.setToolTip(_('Remove the currently selected bookmark')) - b.clicked.connect(self.delete_bookmark) - l.addWidget(b, l.rowCount() - 1, 1) - - self.button_delete = b = QPushButton(_('Sort by &name'), self) - b.setToolTip(_('Sort bookmarks by name')) - b.clicked.connect(self.sort_by_name) - l.addWidget(b) - - self.button_delete = b = QPushButton(_('Sort by &position'), self) - b.setToolTip(_('Sort bookmarks by position in book')) - b.clicked.connect(self.sort_by_pos) - l.addWidget(b, l.rowCount() - 1, 1) - - self.button_export = b = QPushButton(QIcon(I('back.png')), _('E&xport'), self) - b.clicked.connect(self.export_bookmarks) - l.addWidget(b) - - self.button_import = b = QPushButton(QIcon(I('forward.png')), _('&Import'), self) - b.clicked.connect(self.import_bookmarks) - l.addWidget(b, l.rowCount() - 1, 1) - - def item_activated(self, item): - bm = self.item_to_bm(item) - self.activated.emit(bm) - - def set_bookmarks(self, bookmarks=()): - self.bookmarks_list.clear() - for bm in bookmarks: - if bm['title'] != 'calibre_current_page_bookmark': - i = QListWidgetItem(bm['title']) - i.setData(Qt.UserRole, self.bm_to_item(bm)) - i.setFlags(i.flags() | Qt.ItemIsEditable) - self.bookmarks_list.addItem(i) - if self.bookmarks_list.count() > 0: - self.bookmarks_list.setCurrentItem(self.bookmarks_list.item(0), QItemSelectionModel.ClearAndSelect) - - def set_current_bookmark(self, bm): - for i, q in enumerate(self): - if bm == q: - l = self.bookmarks_list - item = l.item(i) - l.setCurrentItem(item, QItemSelectionModel.ClearAndSelect) - l.scrollToItem(item) - - def __iter__(self): - for i in range(self.bookmarks_list.count()): - yield self.item_to_bm(self.bookmarks_list.item(i)) - - def item_changed(self, item): - self.bookmarks_list.blockSignals(True) - title = unicode_type(item.data(Qt.DisplayRole)) - if not title: - title = _('Unknown') - item.setData(Qt.DisplayRole, title) - bm = self.item_to_bm(item) - bm['title'] = title - item.setData(Qt.UserRole, self.bm_to_item(bm)) - self.bookmarks_list.blockSignals(False) - self.edited.emit(self.get_bookmarks()) - - def delete_bookmark(self): - row = self.bookmarks_list.currentRow() - if row > -1: - self.bookmarks_list.takeItem(row) - self.edited.emit(self.get_bookmarks()) - - def edit_bookmark(self): - item = self.bookmarks_list.currentItem() - if item is not None: - self.bookmarks_list.editItem(item) - - def sort_by_name(self): - bm = self.get_bookmarks() - bm.sort(key=lambda x:sort_key(x['title'])) - self.set_bookmarks(bm) - self.edited.emit(bm) - - def sort_by_pos(self): - from calibre.ebooks.epub.cfi.parse import cfi_sort_key - - def pos_key(b): - if b.get('type', None) == 'cfi': - return b['spine'], cfi_sort_key(b['pos']) - return (None, None) - bm = self.get_bookmarks() - bm.sort(key=pos_key) - self.set_bookmarks(bm) - self.edited.emit(bm) - - def bm_to_item(self, bm): - return bm.copy() - - def item_to_bm(self, item): - return item.data(Qt.UserRole).copy() - - def get_bookmarks(self): - return list(self) - - def export_bookmarks(self): - filename = choose_save_file( - self, 'export-viewer-bookmarks', _('Export bookmarks'), - filters=[(_('Saved bookmarks'), ['calibre-bookmarks'])], all_files=False, initial_filename='bookmarks.calibre-bookmarks') - if filename: - data = json.dumps(self.get_bookmarks(), indent=True) - if not isinstance(data, bytes): - data = data.encode('utf-8') - with lopen(filename, 'wb') as fileobj: - fileobj.write(data) - - def import_bookmarks(self): - files = choose_files(self, 'export-viewer-bookmarks', _('Import bookmarks'), - filters=[(_('Saved bookmarks'), ['calibre-bookmarks'])], all_files=False, select_only_single_file=True) - if not files: - return - filename = files[0] - - imported = None - with lopen(filename, 'rb') as fileobj: - imported = json.load(fileobj) - - if imported is not None: - bad = False - try: - for bm in imported: - if 'title' not in bm: - bad = True - break - except Exception: - pass - - if not bad: - bookmarks = self.get_bookmarks() - for bm in imported: - if bm not in bookmarks: - bookmarks.append(bm) - self.set_bookmarks([bm for bm in bookmarks if bm['title'] != 'calibre_current_page_bookmark']) - self.edited.emit(self.get_bookmarks()) diff --git a/src/calibre/gui2/viewer/config.py b/src/calibre/gui2/viewer/config.py deleted file mode 100644 index 246fc0f376..0000000000 --- a/src/calibre/gui2/viewer/config.py +++ /dev/null @@ -1,456 +0,0 @@ -#!/usr/bin/env python2 -# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai -from __future__ import absolute_import, division, print_function, unicode_literals - -__license__ = 'GPL v3' -__copyright__ = '2012, Kovid Goyal ' -__docformat__ = 'restructuredtext en' - -import zipfile -from functools import partial - -from PyQt5.Qt import ( - QFont, QDialog, Qt, QColor, QColorDialog, QMenu, QInputDialog, - QListWidgetItem, QFormLayout, QLabel, QLineEdit, QDialogButtonBox) - -from calibre.constants import isxp -from calibre.utils.config import Config, StringConfig, JSONConfig -from calibre.utils.icu import sort_key -from calibre.utils.localization import get_language, calibre_langcode_to_name -from calibre.gui2 import min_available_height, error_dialog -from calibre.gui2.languages import LanguagesEdit -from calibre.gui2.shortcuts import ShortcutConfig -from calibre.gui2.viewer.config_ui import Ui_Dialog -from polyglot.builtins import iteritems, unicode_type - - -def config(defaults=None): - desc = _('Options to customize the e-book viewer') - if defaults is None: - c = Config('viewer', desc) - else: - c = StringConfig(defaults, desc) - - c.add_opt('remember_window_size', default=False, - help=_('Remember last used window size')) - c.add_opt('user_css', default='', - help=_('Set the user CSS stylesheet. This can be used to customize the look of all books.')) - c.add_opt('max_fs_width', default=800, - help=_("Set the maximum width that the book's text and pictures will take" - " when in fullscreen mode. This allows you to read the book text" - " without it becoming too wide.")) - c.add_opt('max_fs_height', default=-1, - help=_("Set the maximum height that the book's text and pictures will take" - " when in fullscreen mode. This allows you to read the book text" - " without it becoming too tall. Note that this setting only takes effect in paged mode (which is the default mode).")) - c.add_opt('fit_images', default=True, - help=_('Resize images larger than the viewer window to fit inside it')) - c.add_opt('hyphenate', default=False, help=_('Hyphenate text')) - c.add_opt('hyphenate_default_lang', default='en', - help=_('Default language for hyphenation rules')) - c.add_opt('search_online_url', default='https://www.google.com/search?q={text}', - help=_('The URL to use when searching for selected text online')) - c.add_opt('remember_current_page', default=True, - help=_('Save the current position in the document, when quitting')) - c.add_opt('copy_bookmarks_to_file', default=True, - help=_('Copy bookmarks to the e-book file for easy sharing, if possible')) - c.add_opt('wheel_flips_pages', default=False, - help=_('Have the mouse wheel turn pages')) - c.add_opt('wheel_scroll_fraction', default=100, - help=_('Control how much the mouse wheel scrolls by in flow mode')) - c.add_opt('line_scroll_fraction', default=100, - help=_('Control how much the arrow keys scroll by in flow mode')) - c.add_opt('tap_flips_pages', default=True, - help=_('Tapping on the screen turns pages')) - c.add_opt('line_scrolling_stops_on_pagebreaks', default=False, - help=_('Prevent the up and down arrow keys from scrolling past ' - 'page breaks')) - c.add_opt('page_flip_duration', default=0.5, - help=_('The time, in seconds, for the page flip animation. Default' - ' is half a second.')) - c.add_opt('font_magnification_step', default=0.2, - help=_('The amount by which to change the font size when clicking' - ' the font larger/smaller buttons. Should be a number between ' - '0 and 1.')) - c.add_opt('fullscreen_clock', default=False, action='store_true', - help=_('Show a clock in fullscreen mode.')) - c.add_opt('fullscreen_pos', default=False, action='store_true', - help=_('Show reading position in fullscreen mode.')) - c.add_opt('fullscreen_scrollbar', default=True, action='store_false', - help=_('Show the scrollbar in fullscreen mode.')) - c.add_opt('start_in_fullscreen', default=False, action='store_true', - help=_('Start viewer in full screen mode')) - c.add_opt('show_fullscreen_help', default=True, action='store_false', - help=_('Show full screen usage help')) - c.add_opt('cols_per_screen', default=1) - c.add_opt('cols_per_screen_portrait', default=1) - c.add_opt('cols_per_screen_landscape', default=1) - c.add_opt('cols_per_screen_migrated', default=False, action='store_true') - c.add_opt('use_book_margins', default=False, action='store_true') - c.add_opt('top_margin', default=20) - c.add_opt('side_margin', default=40) - c.add_opt('bottom_margin', default=20) - c.add_opt('text_color', default=None) - c.add_opt('background_color', default=None) - c.add_opt('show_controls', default=True) - - fonts = c.add_group('FONTS', _('Font options')) - fonts('serif_family', default='Liberation Serif', - help=_('The serif font family')) - fonts('sans_family', default='Liberation Sans', - help=_('The sans-serif font family')) - fonts('mono_family', default='Liberation Mono', - help=_('The monospace font family')) - fonts('default_font_size', default=20, help=_('The standard font size in px')) - fonts('mono_font_size', default=16, help=_('The monospace font size in px')) - fonts('standard_font', default='serif', help=_('The standard font type')) - fonts('minimum_font_size', default=8, help=_('The minimum font size in px')) - - oparse = c.parse - - def parse(): - ans = oparse() - if not ans.cols_per_screen_migrated: - ans.cols_per_screen_portrait = ans.cols_per_screen_landscape = ans.cols_per_screen - return ans - c.parse = parse - - return c - - -def load_themes(): - return JSONConfig('viewer_themes') - - -class ConfigDialog(QDialog, Ui_Dialog): - - def __init__(self, shortcuts, parent=None): - QDialog.__init__(self, parent) - self.setupUi(self) - - for x in ('text', 'background'): - getattr(self, 'change_%s_color_button'%x).clicked.connect( - partial(self.change_color, x, reset=False)) - getattr(self, 'reset_%s_color_button'%x).clicked.connect( - partial(self.change_color, x, reset=True)) - self.css.setToolTip(_('Set the user CSS stylesheet. This can be used to customize the look of all books.')) - - self.shortcuts = shortcuts - self.shortcut_config = ShortcutConfig(shortcuts, parent=self) - bb = self.buttonBox - bb.button(bb.RestoreDefaults).clicked.connect(self.restore_defaults) - - with zipfile.ZipFile(P('viewer/hyphenate/patterns.zip', - allow_user_override=False), 'r') as zf: - pats = [x.split('.')[0].replace('-', '_') for x in zf.namelist()] - - lang_pats = { - 'el_monoton': get_language('el').partition(';')[0] + _(' monotone'), 'el_polyton':get_language('el').partition(';')[0] + _(' polytone'), - 'sr_cyrl': get_language('sr') + _(' cyrillic'), 'sr_latn': get_language('sr') + _(' latin'), - } - - def gl(pat): - return lang_pats.get(pat, get_language(pat)) - names = list(map(gl, pats)) - pmap = {} - for i in range(len(pats)): - pmap[names[i]] = pats[i] - for x in sorted(names): - self.hyphenate_default_lang.addItem(x, pmap[x]) - self.hyphenate_pats = pats - self.hyphenate_names = names - p = self.tabs.widget(1) - p.layout().addWidget(self.shortcut_config) - - if isxp: - self.hyphenate.setVisible(False) - self.hyphenate_default_lang.setVisible(False) - self.hyphenate_label.setVisible(False) - - self.themes = load_themes() - self.save_theme_button.clicked.connect(self.save_theme) - self.load_theme_button.m = m = QMenu() - self.load_theme_button.setMenu(m) - m.triggered.connect(self.load_theme) - self.delete_theme_button.m = m = QMenu() - self.delete_theme_button.setMenu(m) - m.triggered.connect(self.delete_theme) - - opts = config().parse() - self.load_options(opts) - self.init_load_themes() - self.init_dictionaries() - - self.clear_search_history_button.clicked.connect(self.clear_search_history) - self.resize(self.width(), min(self.height(), max(575, min_available_height()-25))) - - for x in 'add remove change'.split(): - getattr(self, x + '_dictionary_website_button').clicked.connect(getattr(self, x + '_dictionary_website')) - - def clear_search_history(self): - from calibre.gui2 import config - config['viewer_search_history'] = [] - config['viewer_toc_search_history'] = [] - - def save_theme(self): - themename, ok = QInputDialog.getText(self, _('Theme name'), - _('Choose a name for this theme')) - if not ok: - return - themename = unicode_type(themename).strip() - if not themename: - return - c = config('') - c.add_opt('theme_name_xxx', default=themename) - self.save_options(c) - self.themes['theme_'+themename] = c.src - self.init_load_themes() - self.theming_message.setText(_('Saved settings as the theme named: %s')% - themename) - - def init_load_themes(self): - for x in ('load', 'delete'): - m = getattr(self, '%s_theme_button'%x).menu() - m.clear() - for x in self.themes: - title = x[len('theme_'):] - ac = m.addAction(title) - ac.theme_id = x - - def load_theme(self, ac): - theme = ac.theme_id - raw = self.themes[theme] - self.load_options(config(raw).parse()) - self.theming_message.setText(_('Loaded settings from the theme %s')% - theme[len('theme_'):]) - - def delete_theme(self, ac): - theme = ac.theme_id - del self.themes[theme] - self.init_load_themes() - self.theming_message.setText(_('Deleted the theme named: %s')% - theme[len('theme_'):]) - - def init_dictionaries(self): - from calibre.gui2.viewer.main import dprefs - self.word_lookups = dprefs['word_lookups'] - - @property - def word_lookups(self): - return dict(self.dictionary_list.item(i).data(Qt.UserRole) for i in range(self.dictionary_list.count())) - - @word_lookups.setter - def word_lookups(self, wl): - self.dictionary_list.clear() - for langcode, url in sorted(iteritems(wl), key=lambda lc_url:sort_key(calibre_langcode_to_name(lc_url[0]))): - i = QListWidgetItem('%s: %s' % (calibre_langcode_to_name(langcode), url), self.dictionary_list) - i.setData(Qt.UserRole, (langcode, url)) - - def add_dictionary_website(self): - class AD(QDialog): - - def __init__(self, parent): - QDialog.__init__(self, parent) - self.setWindowTitle(_('Add a dictionary website')) - self.l = l = QFormLayout(self) - self.la = la = QLabel('

    '+ - _('Choose a language and enter the website address (URL) for it below.' - ' The URL must have the placeholder %s in it, which will be replaced by the actual word being' - ' looked up') % '{word}') - la.setWordWrap(True) - l.addRow(la) - self.le = LanguagesEdit(self) - l.addRow(_('&Language:'), self.le) - self.url = u = QLineEdit(self) - u.setMinimumWidth(350) - u.setPlaceholderText(_('For example: %s') % 'https://dictionary.com/{word}') - l.addRow(_('&URL:'), u) - self.bb = bb = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel) - l.addRow(bb) - bb.accepted.connect(self.accept), bb.rejected.connect(self.reject) - self.resize(self.sizeHint()) - - def accept(self): - if '{word}' not in self.url.text(): - return error_dialog(self, _('Invalid URL'), _( - 'The URL {0} does not have the placeholder {1} in it.').format(self.url.text(), '{word}'), show=True) - QDialog.accept(self) - - d = AD(self) - if d.exec_() == d.Accepted: - url = d.url.text() - if url: - wl = self.word_lookups - for lc in d.le.lang_codes: - wl[lc] = url - self.word_lookups = wl - - def remove_dictionary_website(self): - idx = self.dictionary_list.currentIndex() - if idx.isValid(): - lc, url = idx.data(Qt.UserRole) - wl = self.word_lookups - wl.pop(lc, None) - self.word_lookups = wl - - def change_dictionary_website(self): - idx = self.dictionary_list.currentIndex() - if idx.isValid(): - lc, url = idx.data(Qt.UserRole) - url, ok = QInputDialog.getText(self, _('Enter new website'), 'URL:', text=url) - if ok: - wl = self.word_lookups - wl[lc] = url - self.word_lookups = wl - - def restore_defaults(self): - opts = config('').parse() - self.load_options(opts) - from calibre.gui2.viewer.main import dprefs, vprefs - self.word_lookups = dprefs.defaults['word_lookups'] - self.opt_singleinstance.setChecked(vprefs.defaults['singleinstance']) - - def load_options(self, opts): - self.opt_remember_window_size.setChecked(opts.remember_window_size) - self.opt_remember_current_page.setChecked(opts.remember_current_page) - self.opt_copy_bookmarks_to_file.setChecked(opts.copy_bookmarks_to_file) - self.opt_wheel_flips_pages.setChecked(opts.wheel_flips_pages) - self.opt_wheel_scroll_fraction.setValue(opts.wheel_scroll_fraction) - self.opt_line_scroll_fraction.setValue(opts.line_scroll_fraction) - self.opt_tap_flips_pages.setChecked(opts.tap_flips_pages) - self.opt_page_flip_duration.setValue(opts.page_flip_duration) - fms = opts.font_magnification_step - if fms < 0.01 or fms > 1: - fms = 0.2 - self.opt_font_mag_step.setValue(int(fms*100)) - self.opt_line_scrolling_stops_on_pagebreaks.setChecked( - opts.line_scrolling_stops_on_pagebreaks) - self.serif_family.setCurrentFont(QFont(opts.serif_family)) - self.sans_family.setCurrentFont(QFont(opts.sans_family)) - self.mono_family.setCurrentFont(QFont(opts.mono_family)) - self.default_font_size.setValue(opts.default_font_size) - self.minimum_font_size.setValue(opts.minimum_font_size) - self.mono_font_size.setValue(opts.mono_font_size) - self.standard_font.setCurrentIndex( - {'serif':0, 'sans':1, 'mono':2}[opts.standard_font]) - self.css.setPlainText(opts.user_css) - self.max_fs_width.setValue(opts.max_fs_width) - self.max_fs_height.setValue(opts.max_fs_height) - pats, names = self.hyphenate_pats, self.hyphenate_names - try: - idx = pats.index(opts.hyphenate_default_lang) - except ValueError: - idx = pats.index('en_us') - idx = self.hyphenate_default_lang.findText(names[idx]) - self.hyphenate_default_lang.setCurrentIndex(idx) - self.hyphenate.setChecked(opts.hyphenate) - self.hyphenate_default_lang.setEnabled(opts.hyphenate) - self.search_online_url.setText(opts.search_online_url or '') - self.opt_fit_images.setChecked(opts.fit_images) - self.opt_fullscreen_clock.setChecked(opts.fullscreen_clock) - self.opt_fullscreen_scrollbar.setChecked(opts.fullscreen_scrollbar) - self.opt_start_in_fullscreen.setChecked(opts.start_in_fullscreen) - self.opt_show_fullscreen_help.setChecked(opts.show_fullscreen_help) - self.opt_fullscreen_pos.setChecked(opts.fullscreen_pos) - self.opt_cols_per_screen_portrait.setValue(opts.cols_per_screen_portrait) - self.opt_cols_per_screen_landscape.setValue(opts.cols_per_screen_landscape) - self.opt_override_book_margins.setChecked(not opts.use_book_margins) - for x in ('top', 'bottom', 'side'): - getattr(self, 'opt_%s_margin'%x).setValue(getattr(opts, - x+'_margin')) - for x in ('text', 'background'): - setattr(self, 'current_%s_color'%x, getattr(opts, '%s_color'%x)) - self.update_sample_colors() - self.opt_show_controls.setChecked(opts.show_controls) - from calibre.gui2.viewer.main import vprefs - self.opt_singleinstance.setChecked(bool(vprefs['singleinstance'])) - - def change_color(self, which, reset=False): - if reset: - setattr(self, 'current_%s_color'%which, None) - else: - initial = getattr(self, 'current_%s_color'%which) - if initial: - initial = QColor(initial) - else: - initial = Qt.black if which == 'text' else Qt.white - title = (_('Choose text color') if which == 'text' else - _('Choose background color')) - col = QColorDialog.getColor(initial, self, - title, QColorDialog.ShowAlphaChannel) - if col.isValid(): - name = unicode_type(col.name()) - setattr(self, 'current_%s_color'%which, name) - self.update_sample_colors() - - def update_sample_colors(self): - for x in ('text', 'background'): - val = getattr(self, 'current_%s_color'%x) - if not val: - val = 'inherit' if x == 'text' else 'transparent' - ss = 'QLabel { %s: %s }'%('background-color' if x == 'background' - else 'color', val) - getattr(self, '%s_color_sample'%x).setStyleSheet(ss) - - def accept(self, *args): - if self.shortcut_config.is_editing: - from calibre.gui2 import info_dialog - info_dialog(self, _('Still editing'), - _('You are in the middle of editing a keyboard shortcut.' - ' First complete that by clicking outside the' - ' shortcut editing box.'), show=True) - return - self.save_options(config()) - return QDialog.accept(self, *args) - - def save_options(self, c): - c.set('serif_family', unicode_type(self.serif_family.currentFont().family())) - c.set('sans_family', unicode_type(self.sans_family.currentFont().family())) - c.set('mono_family', unicode_type(self.mono_family.currentFont().family())) - c.set('default_font_size', self.default_font_size.value()) - c.set('minimum_font_size', self.minimum_font_size.value()) - c.set('mono_font_size', self.mono_font_size.value()) - c.set('standard_font', {0:'serif', 1:'sans', 2:'mono'}[ - self.standard_font.currentIndex()]) - c.set('user_css', unicode_type(self.css.toPlainText())) - c.set('remember_window_size', self.opt_remember_window_size.isChecked()) - c.set('fit_images', self.opt_fit_images.isChecked()) - c.set('max_fs_width', int(self.max_fs_width.value())) - max_fs_height = self.max_fs_height.value() - if max_fs_height <= self.max_fs_height.minimum(): - max_fs_height = -1 - c.set('max_fs_height', max_fs_height) - c.set('hyphenate', self.hyphenate.isChecked()) - c.set('remember_current_page', self.opt_remember_current_page.isChecked()) - c.set('copy_bookmarks_to_file', self.opt_copy_bookmarks_to_file.isChecked()) - c.set('wheel_flips_pages', self.opt_wheel_flips_pages.isChecked()) - c.set('wheel_scroll_fraction', self.opt_wheel_scroll_fraction.value()) - c.set('line_scroll_fraction', self.opt_line_scroll_fraction.value()) - c.set('tap_flips_pages', self.opt_tap_flips_pages.isChecked()) - c.set('page_flip_duration', self.opt_page_flip_duration.value()) - c.set('font_magnification_step', - float(self.opt_font_mag_step.value())/100.) - idx = self.hyphenate_default_lang.currentIndex() - c.set('hyphenate_default_lang', - self.hyphenate_default_lang.itemData(idx)) - c.set('line_scrolling_stops_on_pagebreaks', - self.opt_line_scrolling_stops_on_pagebreaks.isChecked()) - c.set('search_online_url', self.search_online_url.text().strip()) - c.set('fullscreen_clock', self.opt_fullscreen_clock.isChecked()) - c.set('fullscreen_pos', self.opt_fullscreen_pos.isChecked()) - c.set('fullscreen_scrollbar', self.opt_fullscreen_scrollbar.isChecked()) - c.set('show_fullscreen_help', self.opt_show_fullscreen_help.isChecked()) - c.set('cols_per_screen_migrated', True) - c.set('cols_per_screen_portrait', int(self.opt_cols_per_screen_portrait.value())) - c.set('cols_per_screen_landscape', int(self.opt_cols_per_screen_landscape.value())) - c.set('start_in_fullscreen', self.opt_start_in_fullscreen.isChecked()) - c.set('use_book_margins', not - self.opt_override_book_margins.isChecked()) - c.set('text_color', self.current_text_color) - c.set('background_color', self.current_background_color) - c.set('show_controls', self.opt_show_controls.isChecked()) - for x in ('top', 'bottom', 'side'): - c.set(x+'_margin', int(getattr(self, 'opt_%s_margin'%x).value())) - from calibre.gui2.viewer.main import dprefs, vprefs - dprefs['word_lookups'] = self.word_lookups - vprefs['singleinstance'] = self.opt_singleinstance.isChecked() diff --git a/src/calibre/gui2/viewer/config.ui b/src/calibre/gui2/viewer/config.ui deleted file mode 100644 index 8c15e81d5e..0000000000 --- a/src/calibre/gui2/viewer/config.ui +++ /dev/null @@ -1,1213 +0,0 @@ - - - Dialog - - - - 0 - 0 - 839 - 630 - - - - Configure E-book viewer - - - - :/images/config.png:/images/config.png - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults - - - - - - - 0 - - - - &General - - - - - - QToolBox::tab { - background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, - stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3); - border-radius: 5px; - color: black; - font-weight: bold; - } - - QToolBox::tab:selected { - font-style: italic; - } - -QToolBox::tab:hover { - color: red; - font-style: italic; -} - - - 0 - - - - - 0 - 0 - 799 - 354 - - - - &Font options - - - - - - Se&rif family: - - - serif_family - - - - - - - - - - &Sans family: - - - sans_family - - - - - - - - - - &Monospace family: - - - mono_family - - - - - - - - - - &Default font size: - - - default_font_size - - - - - - - px - - - 8 - - - 100 - - - - - - - Monospace &font size: - - - mono_font_size - - - - - - - px - - - 8 - - - 100 - - - - - - - S&tandard font: - - - standard_font - - - - - - - - Serif - - - - - Sans-serif - - - - - Monospace - - - - - - - - Font &magnification step size: - - - opt_font_mag_step - - - - - - - The amount by which the font size is increased/decreased - when you click the font size larger/smaller buttons - - - % - - - - - - - Minimum font si&ze: - - - minimum_font_size - - - - - - - The minimum font size in pixels - - - px - - - 8 - - - - - - - - - 0 - 0 - 799 - 354 - - - - Text &layout in paged mode - - - - QFormLayout::ExpandingFieldsGrow - - - - - <p>These options only apply in "paged" mode, where the text is broken up into pages, as in a paper book. To get into this mode, use the button with the yellow scroll icon in the top right corner of the viewer window. - - - true - - - - - - - Qt::Horizontal - - - - - - - In &portrait orientation: - - - opt_cols_per_screen_portrait - - - - - - - Controls the number of pages on the screen when the viewer window's width is less than its height - - - 1 - - - 5 - - - - - - - &Override the page margin settings specified in the book - - - true - - - - - - - &Top margin: - - - opt_top_margin - - - - - - - px - - - 10 - - - 1000 - - - - - - - &Side margin: - - - opt_side_margin - - - - - - - px - - - 10 - - - 1000 - - - - - - - &Bottom margin: - - - opt_bottom_margin - - - - - - - px - - - 10 - - - 1000 - - - - - - - Qt::Horizontal - - - - - - - The number of pages of text to show on screen - - - - - - - In &landscape orientation: - - - opt_cols_per_screen_landscape - - - - - - - Controls the number of pages on the screen when the viewer window's height is less than its width - - - 1 - - - 5 - - - - - - - - - 0 - 0 - 799 - 354 - - - - F&ull screen options - - - - - - Maximum text width in &fullscreen: - - - max_fs_width - - - - - - - Set the maximum width that the book's text and pictures will take when in fullscreen mode. This allows you to read the book text without it becoming too wide. - - - px - - - 100 - - - 10000 - - - - - - - Show reading &position in full screen mode - - - - - - - Show &scrollbar in full screen mode - - - - - - - &Start viewer in full screen mode - - - - - - - Show &help message when starting full screen mode - - - - - - - Maximum text height in fullscreen (paged mode): - - - - - - - Show &clock in full screen mode - - - - - - - Disabled - - - px - - - 100 - - - 10000 - - - 25 - - - - - - - - - 0 - 0 - 799 - 354 - - - - Colors and backgrounds - - - - - - Background color: - - - - - - - - - Sample - - - - - - - &Change - - - - - - - &Reset - - - - - - - - - Text color: - - - - - - - - - Sample - - - - - - - &Change - - - - - - - Reset - - - - - - - - - - - 0 - 0 - 799 - 354 - - - - Page fl&ip/scrolling options - - - - - - - - Page flip &duration: - - - opt_page_flip_duration - - - - - - - disabled - - - secs - - - 1 - - - 0.100000000000000 - - - 3.000000000000000 - - - 0.100000000000000 - - - 0.500000000000000 - - - - - - - &Tapping on the page flips pages - - - - - - - Mouse &wheel flips pages - - - - - - - Line &scrolling stops at page breaks - - - - - - - Scrolling in flow mode - - - - - - Control the amount the mouse &wheel scrolls: - - - opt_wheel_scroll_fraction - - - - - - - This is a percentage, by making it less than 100 you can decrease the amount the wheel scrolls by, by making it more than 100 you can increase the scroll amount. - - - % - - - 1 - - - 1000 - - - 5 - - - - - - - Control the amount the arrow &keys scroll: - - - opt_line_scroll_fraction - - - - - - - This is a percentage, by making it less than 100 you can decrease the amount the arrow keys scroll by, by making it more than 100 you can increase the scroll amount. - - - % - - - 1 - - - 1000 - - - 5 - - - - - - - - - - - - - - 0 - 0 - 799 - 354 - - - - &Miscellaneous options - - - - - - H&yphenate (break line in the middle of large words) - - - - - - - Default &language for hyphenation: - - - hyphenate_default_lang - - - - - - - The default language to use for hyphenation rules. If the book does not specify a language, this will be used. - - - - - - - Show &controls in the viewer window - - - - - - - Search &online URL: - - - search_online_url - - - - - - - Change the search engine used to perform online searches for selected text. -You must enter the search URL for the search engine, with the placeholder -{text}, which will be replaced by the selected text. - - - - - - - Remember last used &window size and layout - - - - - - - Remember the current &page when quitting - - - - - - - Keep a copy of all bookmarks/current page information inside the e-book file, so that you can share them by simply sending the e-book file itself. Currently only works with e-books in the EPUB format. - - - Keep a copy of &bookmarks/current page inside the e-book file, for easy sharing - - - - - - - Normally, you can view multiple books in calibre, each in its own viewer window. With this option, if you attempt to view a second book, it will replace the previously opened book instead of using a new window. - - - Allow only a single book to be &viewed at a time (needs restart) - - - - - - - &Resize images larger than the viewer window (needs restart) - - - - - - - Clear search &history - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - &Keyboard shortcuts - - - - - - Double click to change a keyboard shortcut - - - true - - - - - - - - User &stylesheet - - - - - - <p>A CSS stylesheet that can be used to control the look and feel of books. For examples, click <a href="https://www.mobileread.com/forums/showthread.php?t=51500">here</a>. - - - true - - - true - - - - - - - - - - - &Theming - - - - QFormLayout::ExpandingFieldsGrow - - - - - You can save and load the viewer settings as <i>themes</i> - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Save current settings as a theme: - - - save_theme_button - - - - - - - &Save - - - - :/images/save.png:/images/save.png - - - Qt::ToolButtonTextBesideIcon - - - - - - - Load a previously saved theme: - - - load_theme_button - - - - - - - &Load - - - - :/images/document_open.png:/images/document_open.png - - - QToolButton::InstantPopup - - - Qt::ToolButtonTextBesideIcon - - - - - - - Delete a saved theme: - - - - - - - &Delete - - - - :/images/trash.png:/images/trash.png - - - QToolButton::InstantPopup - - - Qt::ToolButtonTextBesideIcon - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - &Dictionaries - - - - - - When you lookup a word, the viewer opens the word's definition in a dictionary website. The dictionary website is chosen based on the language of the book. You can customize the website used for a particular language here. - - - true - - - - - - - - - - - - - 0 - 0 - - - - &Add website - - - - :/images/plus.png:/images/plus.png - - - - - - - - 0 - 0 - - - - &Remove website - - - - :/images/minus.png:/images/minus.png - - - - - - - - 0 - 0 - - - - &Change website - - - - :/images/edit_input.png:/images/edit_input.png - - - - - - - - - - - - - buttonBox - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 258 - 623 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 326 - 623 - - - 286 - 274 - - - - - hyphenate - toggled(bool) - hyphenate_default_lang - setEnabled(bool) - - - 89 - 226 - - - 332 - 259 - - - - - opt_override_book_margins - toggled(bool) - opt_top_margin - setEnabled(bool) - - - 137 - 189 - - - 367 - 218 - - - - - opt_override_book_margins - toggled(bool) - opt_side_margin - setEnabled(bool) - - - 71 - 193 - - - 347 - 253 - - - - - opt_override_book_margins - toggled(bool) - opt_bottom_margin - setEnabled(bool) - - - 513 - 196 - - - 371 - 281 - - - - - diff --git a/src/calibre/gui2/viewer/documentview.py b/src/calibre/gui2/viewer/documentview.py deleted file mode 100644 index d055186000..0000000000 --- a/src/calibre/gui2/viewer/documentview.py +++ /dev/null @@ -1,1420 +0,0 @@ -#!/usr/bin/env python2 -from __future__ import absolute_import, division, print_function, unicode_literals - -__license__ = 'GPL v3' -__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' -__docformat__ = 'restructuredtext en' - -# Imports {{{ -import math, json -from functools import partial - -from PyQt5.Qt import ( - QSize, QSizePolicy, QUrl, Qt, QPainter, QPalette, QBrush, - QDialog, QColor, QPoint, QImage, QRegion, QIcon, QAction, QMenu, - pyqtSignal, QApplication, pyqtSlot, QKeySequence) -from PyQt5.QtWebKitWidgets import QWebPage, QWebView -from PyQt5.QtWebKit import QWebSettings, QWebElement - -from calibre.gui2.viewer.flip import SlideFlip -from calibre.gui2.shortcuts import Shortcuts -from calibre.gui2 import safe_open_url, secure_web_page, error_dialog -from calibre import prints -from calibre.customize.ui import all_viewer_plugins -from calibre.gui2.viewer.keys import SHORTCUTS -from calibre.gui2.viewer.javascript import JavaScriptLoader -from calibre.gui2.viewer.position import PagePosition -from calibre.gui2.viewer.config import config, ConfigDialog, load_themes -from calibre.gui2.viewer.image_popup import ImagePopup, render_svg -from calibre.gui2.viewer.table_popup import TablePopup -from calibre.gui2.viewer.inspector import WebInspector -from calibre.gui2.viewer.gestures import GestureHandler -from calibre.gui2.viewer.footnote import Footnotes -from calibre.gui2.viewer.fake_net import NetworkAccessManager -from calibre.ebooks.oeb.display.webview import load_html -from calibre.constants import isxp, iswindows, DEBUG, __version__ -from polyglot.builtins import iteritems, map, unicode_type, string_or_bytes -from polyglot.binary import as_base64_unicode -# }}} - - -def apply_settings(settings, opts): - settings.setFontSize(QWebSettings.DefaultFontSize, opts.default_font_size) - settings.setFontSize(QWebSettings.DefaultFixedFontSize, opts.mono_font_size) - settings.setFontSize(QWebSettings.MinimumLogicalFontSize, opts.minimum_font_size) - settings.setFontSize(QWebSettings.MinimumFontSize, opts.minimum_font_size) - settings.setFontFamily(QWebSettings.StandardFont, {'serif':opts.serif_family, 'sans':opts.sans_family, 'mono':opts.mono_family}[opts.standard_font]) - settings.setFontFamily(QWebSettings.SerifFont, opts.serif_family) - settings.setFontFamily(QWebSettings.SansSerifFont, opts.sans_family) - settings.setFontFamily(QWebSettings.FixedFont, opts.mono_family) - settings.setAttribute(QWebSettings.ZoomTextOnly, True) - - -def apply_basic_settings(settings): - secure_web_page(settings) - # PrivateBrowsing disables console messages - # settings.setAttribute(QWebSettings.PrivateBrowsingEnabled, True) - - # Miscellaneous - settings.setAttribute(QWebSettings.LinksIncludedInFocusChain, True) - settings.setAttribute(QWebSettings.DeveloperExtrasEnabled, True) - - -class Document(QWebPage): # {{{ - - page_turn = pyqtSignal(object) - mark_element = pyqtSignal(QWebElement) - settings_changed = pyqtSignal() - animated_scroll_done_signal = pyqtSignal() - - def set_font_settings(self, opts): - settings = self.settings() - apply_settings(settings, opts) - - def do_config(self, parent=None): - d = ConfigDialog(self.shortcuts, parent) - if d.exec_() == QDialog.Accepted: - opts = config().parse() - self.apply_settings(opts) - - def apply_settings(self, opts): - with self.page_position: - self.set_font_settings(opts) - self.set_user_stylesheet(opts) - self.misc_config(opts) - self.settings_changed.emit() - self.after_load() - - def __init__(self, shortcuts, parent=None, debug_javascript=False): - QWebPage.__init__(self, parent) - self.nam = NetworkAccessManager(self) - self.setNetworkAccessManager(self.nam) - self.setObjectName("py_bridge") - self.in_paged_mode = False - self.first_load = True - self.jump_to_cfi_listeners = set() - - self.debug_javascript = debug_javascript - self.anchor_positions = {} - self.index_anchors = set() - self.current_language = None - self.loaded_javascript = False - self.js_loader = JavaScriptLoader( - dynamic_coffeescript=self.debug_javascript) - self.in_fullscreen_mode = False - self.math_present = False - - self.setLinkDelegationPolicy(self.DelegateAllLinks) - self.scroll_marks = [] - self.shortcuts = shortcuts - pal = self.palette() - pal.setBrush(QPalette.Background, QColor(0xee, 0xee, 0xee)) - self.setPalette(pal) - self.page_position = PagePosition(self) - - settings = self.settings() - - # Fonts - self.all_viewer_plugins = tuple(all_viewer_plugins()) - for pl in self.all_viewer_plugins: - pl.load_fonts() - opts = config().parse() - self.set_font_settings(opts) - - apply_basic_settings(settings) - self.set_user_stylesheet(opts) - self.misc_config(opts) - - # Load javascript - self.mainFrame().javaScriptWindowObjectCleared.connect( - self.add_window_objects) - - self.turn_off_internal_scrollbars() - - def turn_off_internal_scrollbars(self): - mf = self.mainFrame() - mf.setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff) - mf.setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff) - - def set_user_stylesheet(self, opts): - brules = ['background-color: %s !important'%opts.background_color] if opts.background_color else ['background-color: white'] - prefix = ''' - body { %s } - '''%('; '.join(brules)) - if opts.text_color: - prefix += '\n\nbody, p, div { color: %s !important }'%opts.text_color - raw = prefix + opts.user_css - raw = '::selection {background:#ffff00; color:#000;}\n'+raw - data = 'data:text/css;charset=utf-8;base64,' - data += as_base64_unicode(raw) - self.settings().setUserStyleSheetUrl(QUrl(data)) - - def findText(self, q, flags): - if self.hyphenatable: - q = unicode_type(q) - hyphenated_q = self.javascript( - 'hyphenate_text(%s, "%s")' % (json.dumps(q, ensure_ascii=False), self.loaded_lang), typ='string') - if hyphenated_q and QWebPage.findText(self, hyphenated_q, flags): - return True - return QWebPage.findText(self, q, flags) - - def misc_config(self, opts): - self.hyphenate = opts.hyphenate - self.hyphenate_default_lang = opts.hyphenate_default_lang - self.do_fit_images = opts.fit_images - self.page_flip_duration = opts.page_flip_duration - self.enable_page_flip = self.page_flip_duration > 0.1 - self.font_magnification_step = opts.font_magnification_step - self.wheel_flips_pages = opts.wheel_flips_pages - self.wheel_scroll_fraction = opts.wheel_scroll_fraction - self.line_scroll_fraction = opts.line_scroll_fraction - self.tap_flips_pages = opts.tap_flips_pages - self.line_scrolling_stops_on_pagebreaks = opts.line_scrolling_stops_on_pagebreaks - screen_width = QApplication.desktop().screenGeometry().width() - # Leave some space for the scrollbar and some border - self.max_fs_width = min(opts.max_fs_width, screen_width-50) - self.max_fs_height = opts.max_fs_height - self.fullscreen_clock = opts.fullscreen_clock - self.fullscreen_scrollbar = opts.fullscreen_scrollbar - self.fullscreen_pos = opts.fullscreen_pos - self.start_in_fullscreen = opts.start_in_fullscreen - self.show_fullscreen_help = opts.show_fullscreen_help - self.use_book_margins = opts.use_book_margins - self.cols_per_screen_portrait = opts.cols_per_screen_portrait - self.cols_per_screen_landscape = opts.cols_per_screen_landscape - self.side_margin = opts.side_margin - self.top_margin, self.bottom_margin = opts.top_margin, opts.bottom_margin - self.show_controls = opts.show_controls - self.remember_current_page = opts.remember_current_page - self.copy_bookmarks_to_file = opts.copy_bookmarks_to_file - self.search_online_url = opts.search_online_url or 'https://www.google.com/search?q={text}' - - def fit_images(self): - if self.do_fit_images and not self.in_paged_mode: - self.javascript('setup_image_scaling_handlers()') - - def add_window_objects(self): - self.mainFrame().addToJavaScriptWindowObject("py_bridge", self) - self.loaded_javascript = False - - def load_javascript_libraries(self): - if self.loaded_javascript: - return - self.loaded_javascript = True - evaljs = self.mainFrame().evaluateJavaScript - self.loaded_lang = self.js_loader(evaljs, self.current_language, - self.hyphenate_default_lang) - evaljs('window.calibre_utils.setup_epub_reading_system(%s, %s, %s, %s)' % tuple(map(json.dumps, ( - 'calibre-desktop', __version__, 'paginated' if self.in_paged_mode else 'scrolling', - 'dom-manipulation layout-changes mouse-events keyboard-events'.split())))) - self.javascript('window.mathjax.base = %s'%(json.dumps(self.nam.mathjax_base, ensure_ascii=False))) - for pl in self.all_viewer_plugins: - pl.load_javascript(evaljs) - evaljs('py_bridge.mark_element.connect(window.calibre_extract.mark)') - - @pyqtSlot() - def animated_scroll_done(self): - self.animated_scroll_done_signal.emit() - - @property - def hyphenatable(self): - # Qt fails to render soft hyphens correctly on windows xp - return not isxp and self.hyphenate and getattr(self, 'loaded_lang', '') and not self.math_present - - @pyqtSlot() - def init_hyphenate(self): - if self.hyphenatable: - self.javascript('do_hyphenation("%s")'%self.loaded_lang) - - @pyqtSlot(int) - def page_turn_requested(self, backwards): - self.page_turn.emit(bool(backwards)) - - def after_load(self, last_loaded_path=None): - self.javascript('window.paged_display.read_document_margins()') - self.set_bottom_padding(0) - self.fit_images() - w = 1 if iswindows else 0 - self.math_present = self.javascript('window.mathjax.check_for_math(%d)' % w, bool) - self.init_hyphenate() - self.javascript('full_screen.save_margins()') - if self.in_fullscreen_mode: - self.switch_to_fullscreen_mode() - if self.in_paged_mode: - self.switch_to_paged_mode(last_loaded_path=last_loaded_path) - self.read_anchor_positions(use_cache=False) - evaljs = self.mainFrame().evaluateJavaScript - for pl in self.all_viewer_plugins: - pl.run_javascript(evaljs) - self.first_load = False - - def colors(self): - ans = json.loads(self.javascript(''' - bs = getComputedStyle(document.body); - JSON.stringify([bs.backgroundColor, bs.color]) - ''')) - return ans if isinstance(ans, list) else ['white', 'black'] - - def read_anchor_positions(self, use_cache=True): - self.anchor_positions = self.javascript('book_indexing.anchor_positions(%s, %s);' % ( - json.dumps(tuple(self.index_anchors)), 'true' if use_cache else 'false')) - if not isinstance(self.anchor_positions, dict): - # Some weird javascript error happened - self.anchor_positions = {} - return {k:tuple(v) for k, v in iteritems(self.anchor_positions)} - - def switch_to_paged_mode(self, onresize=False, last_loaded_path=None): - if onresize and not self.loaded_javascript: - return - cols_per_screen = self.cols_per_screen_portrait if self.is_portrait else self.cols_per_screen_landscape - cols_per_screen = max(1, min(5, cols_per_screen)) - self.javascript(''' - window.paged_display.use_document_margins = %s; - window.paged_display.set_geometry(%d, %d, %d, %d); - '''%( - ('true' if self.use_book_margins else 'false'), - cols_per_screen, self.top_margin, self.side_margin, - self.bottom_margin - )) - force_fullscreen_layout = self.nam.is_single_page(last_loaded_path) - self.update_contents_size_for_paged_mode(force_fullscreen_layout) - - def update_contents_size_for_paged_mode(self, force_fullscreen_layout=None): - # Setup the contents size to ensure that there is a right most margin. - # Without this WebKit renders the final column with no margin, as the - # columns extend beyond the boundaries (and margin) of body - if force_fullscreen_layout is None: - force_fullscreen_layout = self.javascript('window.paged_display.is_full_screen_layout', typ=bool) - f = 'true' if force_fullscreen_layout else 'false' - side_margin = self.javascript('window.paged_display.layout(%s)'%f, typ=int) - mf = self.mainFrame() - sz = mf.contentsSize() - scroll_width = self.javascript('document.body.scrollWidth', int) - # At this point sz.width() is not reliable, presumably because Qt - # has not yet been updated - if scroll_width > self.window_width: - sz.setWidth(scroll_width+side_margin) - self.setPreferredContentsSize(sz) - self.javascript('window.paged_display.fit_images()') - - @property - def column_boundaries(self): - if not self.loaded_javascript: - return (0, 1) - ans = self.javascript('JSON.stringify(paged_display.column_boundaries())') - return tuple(int(x) for x in json.loads(ans)) - - def after_resize(self): - if self.in_paged_mode: - self.setPreferredContentsSize(QSize()) - self.switch_to_paged_mode(onresize=True) - self.javascript('if (window.mathjax) window.mathjax.after_resize();') - - def switch_to_fullscreen_mode(self): - self.in_fullscreen_mode = True - self.javascript('full_screen.on(%d, %d, %s)'%(self.max_fs_width, self.max_fs_height, - 'true' if self.in_paged_mode else 'false')) - - def switch_to_window_mode(self): - self.in_fullscreen_mode = False - self.javascript('full_screen.off(%s)'%('true' if self.in_paged_mode - else 'false')) - - @pyqtSlot(str) - def debug(self, msg): - prints(unicode_type(msg)) - - @pyqtSlot(int) - def jump_to_cfi_finished(self, job_id): - for l in self.jump_to_cfi_listeners: - l(job_id) - - def reference_mode(self, enable): - self.javascript(('enter' if enable else 'leave')+'_reference_mode()') - - def set_reference_prefix(self, prefix): - self.javascript('reference_prefix = "%s"'%prefix) - - def goto(self, ref): - self.javascript('goto_reference("%s")'%ref) - - def goto_bookmark(self, bm): - if bm['type'] == 'legacy': - bm = bm['pos'] - bm = bm.strip() - if bm.startswith('>'): - bm = bm[1:].strip() - self.javascript('scroll_to_bookmark("%s")'%bm) - elif bm['type'] == 'cfi': - self.page_position.to_pos(bm['pos']) - - def javascript(self, string, typ=None): - ans = self.mainFrame().evaluateJavaScript(string) - if typ in {'int', int}: - try: - return int(ans) - except (TypeError, ValueError): - return 0 - if typ in {'float', float}: - try: - return float(ans) - except (TypeError, ValueError): - return 0.0 - if typ == 'string': - return ans or '' - if typ in {bool, 'bool'}: - return bool(ans) - return ans - - def javaScriptConsoleMessage(self, msg, lineno, msgid): - if DEBUG or self.debug_javascript: - prints(msg) - - def javaScriptAlert(self, frame, msg): - if DEBUG: - prints(msg) - else: - return QWebPage.javaScriptAlert(self, frame, msg) - - def scroll_by(self, dx=0, dy=0): - self.mainFrame().scroll(dx, dy) - - def scroll_to(self, x=0, y=0): - self.mainFrame().setScrollPosition(QPoint(x, y)) - - def jump_to_anchor(self, anchor): - if not self.loaded_javascript: - return - self.javascript('window.paged_display.jump_to_anchor("%s")'%anchor) - - def element_ypos(self, elem): - try: - ans = int(elem.evaluateJavaScript('$(this).offset().top')) - except (TypeError, ValueError): - raise ValueError('No ypos found') - return ans - - def elem_outer_xml(self, elem): - return unicode_type(elem.toOuterXml()) - - def bookmark(self): - pos = self.page_position.current_pos - return {'type':'cfi', 'pos':pos} - - @property - def at_bottom(self): - return self.height - self.ypos <= self.window_height - - @property - def at_top(self): - return self.ypos <=0 - - def test(self): - pass - - @property - def ypos(self): - return self.mainFrame().scrollPosition().y() - - @property - def window_height(self): - return self.javascript('window.innerHeight', 'int') - - @property - def window_width(self): - return self.javascript('window.innerWidth', 'int') - - @property - def is_portrait(self): - return self.window_width < self.window_height - - @property - def xpos(self): - return self.mainFrame().scrollPosition().x() - - @property - def scroll_fraction(self): - if self.in_paged_mode: - return self.javascript(''' - ans = 0.0; - if (window.paged_display) { - ans = window.paged_display.current_pos(); - } - ans;''', typ='float') - else: - try: - return abs(float(self.ypos)/(self.height-self.window_height)) - except ZeroDivisionError: - return 0. - - @scroll_fraction.setter - def scroll_fraction(self, val): - if self.in_paged_mode and self.loaded_javascript: - self.javascript('paged_display.scroll_to_pos(%f)'%val) - else: - npos = val * (self.height - self.window_height) - if npos < 0: - npos = 0 - self.scroll_to(x=self.xpos, y=npos) - - @property - def page_number(self): - ' The page number is the number of the page at the left most edge of the screen (starting from 0) ' - if self.in_paged_mode: - return self.javascript( - 'ans = 0; if (window.paged_display) ans = window.paged_display.column_boundaries()[0]; ans;', typ='int') - - @page_number.setter - def page_number(self, val): - if self.in_paged_mode and self.loaded_javascript: - self.javascript('if (window.paged_display) window.paged_display.scroll_to_column(%d)' % int(val)) - return True - - @property - def page_dimensions(self): - if self.in_paged_mode: - return self.javascript( - ''' - ans = '' - if (window.paged_display) - ans = window.paged_display.col_width + ':' + window.paged_display.current_page_height; - ans;''', typ='string') - - @property - def hscroll_fraction(self): - try: - return float(self.xpos)/self.width - except ZeroDivisionError: - return 0. - - @property - def height(self): - # Note that document.body.offsetHeight does not include top and bottom - # margins on body and in some cases does not include the top margin on - # the first element inside body either. See ticket #8791 for an example - # of the latter. - q = self.mainFrame().contentsSize().height() - if q < 0: - # Don't know if this is still needed, but it can't hurt - j = self.javascript('document.body.offsetHeight', 'int') - if j >= 0: - q = j - return q - - @property - def width(self): - return self.mainFrame().contentsSize().width() # offsetWidth gives inaccurate results - - def set_bottom_padding(self, amount): - s = QSize(-1, -1) if amount == 0 else QSize(self.viewportSize().width(), - self.height+amount) - self.setPreferredContentsSize(s) - - def extract_node(self): - return unicode_type(self.mainFrame().evaluateJavaScript( - 'window.calibre_extract.extract()')) - -# }}} - - -class DocumentView(QWebView): # {{{ - - magnification_changed = pyqtSignal(object) - DISABLED_BRUSH = QBrush(Qt.lightGray, Qt.Dense5Pattern) - gesture_handler = lambda s, e: False - last_loaded_path = None - - def initialize_view(self, debug_javascript=False): - self.setRenderHints(QPainter.Antialiasing|QPainter.TextAntialiasing|QPainter.SmoothPixmapTransform) - self.flipper = SlideFlip(self) - self.gesture_handler = GestureHandler(self) - self.is_auto_repeat_event = False - self.debug_javascript = debug_javascript - self.shortcuts = Shortcuts(SHORTCUTS, 'shortcuts/viewer') - self.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) - self._size_hint = QSize(510, 680) - self.initial_pos = 0.0 - self.to_bottom = False - self.document = Document(self.shortcuts, parent=self, - debug_javascript=debug_javascript) - self.document.nam.load_error.connect(self.on_unhandled_load_error) - self.footnotes = Footnotes(self) - self.document.settings_changed.connect(self.footnotes.clone_settings) - self.setPage(self.document) - self.inspector = WebInspector(self, self.document) - self.manager = None - self._reference_mode = False - self._ignore_scrollbar_signals = False - self.loading_url = None - self.loadFinished.connect(self.load_finished) - self.document.linkClicked.connect(self.link_clicked) - self.document.linkHovered.connect(self.link_hovered) - self.document.selectionChanged[()].connect(self.selection_changed) - self.document.animated_scroll_done_signal.connect(self.animated_scroll_done, type=Qt.QueuedConnection) - self.document.page_turn.connect(self.page_turn_requested) - d = self.document - self.unimplemented_actions = list(map(self.pageAction, - [d.DownloadImageToDisk, d.OpenLinkInNewWindow, d.DownloadLinkToDisk, d.CopyImageUrlToClipboard, - d.OpenImageInNewWindow, d.OpenLink, d.Reload, d.InspectElement, d.Copy])) - - self.search_online_action = QAction(QIcon(I('search.png')), '', self) - self.search_online_action.triggered.connect(self.search_online) - self.addAction(self.search_online_action) - self.dictionary_action = QAction(QIcon(I('dictionary.png')), - _('&Lookup in dictionary'), self) - self.dictionary_action.triggered.connect(self.lookup) - self.addAction(self.dictionary_action) - self.image_popup = ImagePopup(self) - self.table_popup = TablePopup(self) - self.view_image_action = QAction(QIcon(I('view-image.png')), _('View &image...'), self) - self.view_image_action.triggered.connect(self.image_popup) - self.view_table_action = QAction(QIcon(I('view.png')), _('View &table...'), self) - self.view_table_action.triggered.connect(self.popup_table) - self.search_action = QAction(QIcon(I('dictionary.png')), - _('&Search for next occurrence'), self) - self.search_action.triggered.connect(self.search_next) - self.addAction(self.search_action) - - self.goto_location_action = QAction(_('Go to...'), self) - self.goto_location_menu = m = QMenu(self) - self.goto_location_actions = a = { - 'Next Page': self.next_page, - 'Previous Page': self.previous_page, - 'Section Top' : partial(self.scroll_to, 0), - 'Document Top': self.goto_document_start, - 'Section Bottom':partial(self.scroll_to, 1), - 'Document Bottom': self.goto_document_end, - 'Next Section': self.goto_next_section, - 'Previous Section': self.goto_previous_section, - } - for name, key in [(_('Next section'), 'Next Section'), - (_('Previous section'), 'Previous Section'), - (None, None), - (_('Document start'), 'Document Top'), - (_('Document end'), 'Document Bottom'), - (None, None), - (_('Section start'), 'Section Top'), - (_('Section end'), 'Section Bottom'), - (None, None), - (_('Next page'), 'Next Page'), - (_('Previous page'), 'Previous Page')]: - if key is None: - m.addSeparator() - else: - m.addAction(name, a[key], self.shortcuts.get_sequences(key)[0]) - self.goto_location_action.setMenu(self.goto_location_menu) - - self.restore_fonts_action = QAction(_('Default font size'), self) - self.restore_fonts_action.setCheckable(True) - self.restore_fonts_action.triggered.connect(self.restore_font_size) - - def goto_next_section(self, *args): - if self.manager is not None: - self.manager.goto_next_section() - - def goto_previous_section(self, *args): - if self.manager is not None: - self.manager.goto_previous_section() - - def goto_document_start(self, *args): - if self.manager is not None: - self.manager.goto_start() - - def goto_document_end(self, *args): - if self.manager is not None: - self.manager.goto_end() - - def animated_scroll_done(self): - if self.manager is not None: - self.manager.scrolled(self.document.scroll_fraction) - - def reference_mode(self, enable): - self._reference_mode = enable - self.document.reference_mode(enable) - - def goto(self, ref): - self.document.goto(ref) - - def goto_bookmark(self, bm): - self.document.goto_bookmark(bm) - - def config(self, parent=None): - self.document.do_config(parent) - if self.document.in_fullscreen_mode: - self.document.switch_to_fullscreen_mode() - self.setFocus(Qt.OtherFocusReason) - - def load_theme(self, theme_id): - themes = load_themes() - theme = themes[theme_id] - opts = config(theme).parse() - self.document.apply_settings(opts) - if self.document.in_fullscreen_mode: - self.document.switch_to_fullscreen_mode() - self.setFocus(Qt.OtherFocusReason) - - def bookmark(self): - return self.document.bookmark() - - @property - def selected_text(self): - return self.document.selectedText().replace('\u00ad', '').strip() - - @property - def selected_html(self): - return self.document.selectedHtml().replace('\u00ad', '').strip() - - def selection_changed(self): - if self.manager is not None: - self.manager.selection_changed(self.selected_text, self.selected_html) - - def _selectedText(self): - t = unicode_type(self.selectedText()).strip() - if not t: - return '' - if len(t) > 40: - t = t[:40] + '...' - t = t.replace('&', '&&') - return _("S&earch online for '%s'")%t - - def popup_table(self): - html = self.document.extract_node() - self.table_popup(html, self.as_url(self.last_loaded_path), - self.document.font_magnification_step) - - def contextMenuEvent(self, ev): - from_touch = ev.reason() == ev.Other - mf = self.document.mainFrame() - r = mf.hitTestContent(ev.pos()) - img = r.pixmap() - elem = r.element() - if elem.isNull(): - elem = r.enclosingBlockElement() - if img.isNull() and elem.tagName().lower() == 'img': - # QtWebKit return null pixmaps for svg images - iqurl = r.imageUrl() - path = self.path(iqurl) - img = render_svg(self, path) - table = None - parent = elem - while not parent.isNull(): - if (unicode_type(parent.tagName()) == 'table' or unicode_type(parent.localName()) == 'table'): - table = parent - break - parent = parent.parent() - self.image_popup.current_img = img - self.image_popup.current_url = r.imageUrl() - menu = self.document.createStandardContextMenu() - for action in self.unimplemented_actions: - menu.removeAction(action) - - if self.manager is not None and self.manager.action_copy.isEnabled(): - menu.addAction(self.manager.action_copy) - - if not img.isNull(): - cia = self.pageAction(self.document.CopyImageToClipboard) - for action in menu.actions(): - if action is cia: - action.setText(_('&Copy image')) - menu.addAction(self.view_image_action) - if table is not None: - self.document.mark_element.emit(table) - menu.addAction(self.view_table_action) - - text = self._selectedText() - if text and img.isNull(): - self.search_online_action.setText(text) - for x, sc in (('search_online', 'Search online'), ('dictionary', 'Lookup word'), ('search', 'Next occurrence')): - ac = getattr(self, '%s_action' % x) - menu.addAction(ac.icon(), '%s [%s]' % (unicode_type(ac.text()), ','.join(self.shortcuts.get_shortcuts(sc))), ac.trigger) - - if from_touch and self.manager is not None: - word = unicode_type(mf.evaluateJavaScript('window.calibre_utils.word_at_point(%f, %f)' % (ev.pos().x(), ev.pos().y())) or '') - if word: - menu.addAction(self.dictionary_action.icon(), _('Lookup %s in the dictionary') % word, partial(self.manager.lookup, word)) - menu.addAction(self.search_online_action.icon(), _('Search for %s online') % word, partial(self.do_search_online, word)) - - if not text and img.isNull(): - menu.addSeparator() - if self.manager.action_back.isEnabled(): - menu.addAction(self.manager.action_back) - if self.manager.action_forward.isEnabled(): - menu.addAction(self.manager.action_forward) - menu.addAction(self.goto_location_action) - - if self.manager is not None: - menu.addSeparator() - menu.addAction(self.manager.action_table_of_contents) - - menu.addSeparator() - menu.addAction(self.manager.action_font_size_larger) - self.restore_fonts_action.setChecked(self.multiplier == 1) - menu.addAction(self.restore_fonts_action) - menu.addAction(self.manager.action_font_size_smaller) - - menu.addSeparator() - menu.addAction(_('I&nspect'), self.inspect) - - if not text and img.isNull() and self.manager is not None: - menu.addSeparator() - if (not self.document.show_controls or self.document.in_fullscreen_mode) and self.manager is not None: - menu.addAction(self.manager.toggle_toolbar_action) - menu.addAction(self.manager.action_full_screen) - - menu.addSeparator() - menu.addAction(self.manager.action_reload) - menu.addAction(self.manager.action_quit) - - for plugin in self.document.all_viewer_plugins: - plugin.customize_context_menu(menu, ev, r) - - if from_touch: - from calibre.constants import plugins - pi = plugins['progress_indicator'][0] - for x in (menu, self.goto_location_menu): - if hasattr(pi, 'set_touch_menu_style'): - pi.set_touch_menu_style(x) - helpt = QAction(QIcon(I('help.png')), _('Show supported touch screen gestures'), menu) - helpt.triggered.connect(self.gesture_handler.show_help) - menu.insertAction(menu.actions()[0], helpt) - else: - self.goto_location_menu.setStyle(self.style()) - self.context_menu = menu - menu.exec_(ev.globalPos()) - - def inspect(self): - self.inspector.show() - self.inspector.raise_() - self.pageAction(self.document.InspectElement).trigger() - - def lookup(self, *args): - if self.manager is not None: - t = unicode_type(self.selectedText()).strip() - if t: - self.manager.lookup(t.split()[0]) - - def search_next(self): - if self.manager is not None: - t = unicode_type(self.selectedText()).strip() - if t: - self.manager.search.set_search_string(t) - - def search_online(self): - t = unicode_type(self.selectedText()).strip() - if t: - self.do_search_online(t) - - def do_search_online(self, text): - url = self.document.search_online_url.replace('{text}', QUrl().toPercentEncoding(text)) - if not isinstance(url, bytes): - url = url.encode('utf-8') - safe_open_url(QUrl.fromEncoded(url)) - - def set_manager(self, manager): - self.manager = manager - self.scrollbar = manager.horizontal_scrollbar - self.scrollbar.valueChanged[(int)].connect(self.scroll_horizontally) - - def scroll_horizontally(self, amount): - self.document.scroll_to(y=self.document.ypos, x=amount) - - @property - def scroll_pos(self): - return (self.document.ypos, self.document.ypos + self.document.window_height) - - @property - def viewport_rect(self): - # (left, top, right, bottom) of the viewport in document co-ordinates - # When in paged mode, left and right are the numbers of the columns - # at the left edge and *after* the right edge of the viewport - d = self.document - if d.in_paged_mode: - try: - l, r = d.column_boundaries - except ValueError: - l, r = (0, 1) - else: - l, r = d.xpos, d.xpos + d.window_width - return (l, d.ypos, r, d.ypos + d.window_height) - - def link_hovered(self, link, text, context): - link, text = unicode_type(link), unicode_type(text) - if link: - self.setCursor(Qt.PointingHandCursor) - else: - self.unsetCursor() - - def link_clicked(self, url): - if self.manager is not None: - self.manager.link_clicked(url) - - def footnote_link_clicked(self, qurl): - if qurl.scheme() in ('http', 'https'): - self.link_clicked(qurl) - return - path = qurl.toLocalFile() - link = self.as_url(path) - if qurl.hasFragment(): - link.setFragment(qurl.fragment(QUrl.FullyEncoded), QUrl.StrictMode) - self.link_clicked(link) - - def sizeHint(self): - return self._size_hint - - @property - def scroll_fraction(self): - return self.document.scroll_fraction - - @scroll_fraction.setter - def scroll_fraction(self, val): - self.document.scroll_fraction = float(val) - - @property - def hscroll_fraction(self): - return self.document.hscroll_fraction - - @property - def content_size(self): - return self.document.width, self.document.height - - @property - def current_language(self): - return self.document.current_language - - @current_language.setter - def current_language(self, val): - self.document.current_language = val - - def search(self, text, backwards=False): - flags = self.document.FindBackward if backwards else self.document.FindFlags(0) - found = self.document.findText(text, flags) - if found and self.document.in_paged_mode: - self.document.javascript('paged_display.snap_to_selection()') - return found - - def path(self, url=None): - url = url or self.url() - return self.document.nam.as_abspath(url) - - def as_url(self, path): - return self.document.nam.as_url(path) - - def load_path(self, path, pos=0.0): - self.initial_pos = pos - self.last_loaded_path = path - # This is needed otherwise percentage margins on body are not correctly - # evaluated in read_document_margins() in paged mode. - self.document.setPreferredContentsSize(QSize()) - - url = self.as_url(path) - entries = set() - for ie in getattr(path, 'index_entries', []): - if ie.start_anchor: - entries.add(ie.start_anchor) - if ie.end_anchor: - entries.add(ie.end_anchor) - self.document.index_anchors = entries - - def callback(lu): - self.loading_url = lu - if self.manager is not None: - self.manager.load_started() - - load_html(path, self, codec=getattr(path, 'encoding', 'utf-8'), mime_type=getattr(path, - 'mime_type', 'text/html'), loading_url=url, pre_load_callback=callback) - - def on_unhandled_load_error(self, name, tb): - error_dialog(self, _('Failed to load file'), _( - 'Failed to load the file: {}. Click "Show details" for more information').format(name), det_msg=tb, show=True) - - def initialize_scrollbar(self): - if getattr(self, 'scrollbar', None) is not None: - if self.document.in_paged_mode: - self.scrollbar.setVisible(False) - return - delta = self.document.width - self.size().width() - if delta > 0: - self._ignore_scrollbar_signals = True - self.scrollbar.blockSignals(True) - self.scrollbar.setRange(0, delta) - self.scrollbar.setValue(0) - self.scrollbar.setSingleStep(1) - self.scrollbar.setPageStep(int(delta//10)) - self.scrollbar.setVisible(delta > 0) - self.scrollbar.blockSignals(False) - self._ignore_scrollbar_signals = False - - def load_finished(self, ok): - if self.loading_url is None: - # An