mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Fix sorting of bookmarks by position in book not working on windows and OS X. Fixes #1402152 [error when sorting bookmarks by position](https://bugs.launchpad.net/calibre/+bug/1402152)
This commit is contained in:
parent
cfbf573c1b
commit
8aaf03ef28
@ -6,9 +6,11 @@ from __future__ import (unicode_literals, division, absolute_import,
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
|
|
||||||
import regex
|
import regex, sys
|
||||||
from future_builtins import map, zip
|
from future_builtins import map, zip
|
||||||
|
|
||||||
|
is_narrow_build = sys.maxunicode < 0x10ffff
|
||||||
|
|
||||||
class Parser(object):
|
class Parser(object):
|
||||||
|
|
||||||
''' See epubcfi.ebnf for the specification that this parser tries to
|
''' See epubcfi.ebnf for the specification that this parser tries to
|
||||||
@ -19,6 +21,9 @@ class Parser(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
# All allowed unicode characters + escaped special characters
|
# All allowed unicode characters + escaped special characters
|
||||||
special_char = r'[\[\](),;=^]'
|
special_char = r'[\[\](),;=^]'
|
||||||
|
if is_narrow_build:
|
||||||
|
unescaped_char = '[[\t\n\r -\ud7ff\ue000-\ufffd]--%s]' % special_char
|
||||||
|
else:
|
||||||
unescaped_char = '[[\t\n\r -\ud7ff\ue000-\ufffd\U00010000-\U0010ffff]--%s]' % special_char
|
unescaped_char = '[[\t\n\r -\ud7ff\ue000-\ufffd\U00010000-\U0010ffff]--%s]' % special_char
|
||||||
escaped_char = r'\^' + special_char
|
escaped_char = r'\^' + special_char
|
||||||
chars = r'(?:%s|(?:%s))+' % (unescaped_char, escaped_char)
|
chars = r'(?:%s|(?:%s))+' % (unescaped_char, escaped_char)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user