E-book viewer: Fix sorting of highlights incorrect in books that use HTML ids with a hyphen in them. Fixes #1951507 [Private bug](https://bugs.launchpad.net/calibre/+bug/1951507)

This commit is contained in:
Kovid Goyal 2021-11-19 12:07:18 +05:30
parent dec5cb9d20
commit d0c5241e97
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 1 deletions

View File

@ -17,7 +17,7 @@ class Parser:
def __init__(self):
# All allowed unicode characters + escaped special characters
special_char = r'[\[\](),;=^]'
special_char = r'[\[\](),;=^-]'
unescaped_char = '[[\t\n\r -\ud7ff\ue000-\ufffd\U00010000-\U0010ffff]--%s]' % special_char
escaped_char = r'\^' + special_char
chars = r'(?:%s|(?:%s))+' % (unescaped_char, escaped_char)

View File

@ -86,6 +86,7 @@ class Tests(unittest.TestCase):
# Test parsing of text assertions
('/1:3[aa^,b]', a('aa,b'), ''),
('/1:3[aa^-b]', a('aa-b'), ''),
('/1:3[aa^,b,c1]', a('aa,b', 'c1'), ''),
('/1:3[,aa^,b]', a(after='aa,b'), ''),
('/1:3[;s=a]', a(s='a'), ''),