mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-27 15:55:59 +01:00
Revert code to handle smart quotes as quote delimiters in the search query parser
It is still possible to type normal quotes in safari by long tapping the quote button
This commit is contained in:
parent
2de4dc5a73
commit
f258b3d53e
2 changed files with 3 additions and 6 deletions
|
|
@ -142,15 +142,14 @@ def __init__(self):
|
|||
WORD = 2
|
||||
QUOTED_WORD = 3
|
||||
EOF = 4
|
||||
REPLACEMENTS = tuple((u'\\' + x, unichr(i + 1)) for i, x in enumerate(ur'\"()“”'))
|
||||
REPLACEMENTS = tuple((u'\\' + x, unichr(i + 1)) for i, x in enumerate(ur'\"()'))
|
||||
|
||||
# Had to translate named constants to numeric values
|
||||
lex_scanner = re.Scanner([
|
||||
(ur'[()]', lambda x,t: (Parser.OPCODE, t)),
|
||||
(ur'@.+?:[^"“)\s]+', lambda x,t: (Parser.WORD, unicode(t))),
|
||||
(ur'[^"“()\s]+', lambda x,t: (Parser.WORD, unicode(t))),
|
||||
(ur'@.+?:[^")\s]+', lambda x,t: (Parser.WORD, unicode(t))),
|
||||
(ur'[^"()\s]+', lambda x,t: (Parser.WORD, unicode(t))),
|
||||
(ur'".*?((?<!\\)")', lambda x,t: (Parser.QUOTED_WORD, t[1:-1])),
|
||||
(ur'“.*?((?<!\\)”)', lambda x,t: (Parser.QUOTED_WORD, t[1:-1])),
|
||||
(ur'\s+', None)
|
||||
], flags=re.DOTALL)
|
||||
|
||||
|
|
|
|||
|
|
@ -385,10 +385,8 @@ def t(query, *a):
|
|||
|
||||
t('xxx', 'W', 'xxx')
|
||||
t('"a \\" () b"', 'Q', 'a " () b')
|
||||
t('“a \\"“\\” () b”', 'Q', 'a "“” () b')
|
||||
t('"a“b"', 'Q', 'a“b')
|
||||
t('"a”b"', 'Q', 'a”b')
|
||||
t('a:“b ”', 'W', 'a:', 'Q', 'b ')
|
||||
|
||||
|
||||
def find_tests():
|
||||
|
|
|
|||
Loading…
Reference in a new issue