mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Smarten punctuation: Fix a double quote preceded by a hyphen at the end of a sentence (before the start of the next tag) being converted into an opening quote instead of closing quote. Fixes #1286477 [Smarten punctuation uses wrong character at end of paragraph](https://bugs.launchpad.net/calibre/+bug/1286477)
This commit is contained in:
parent
4f2cb6552d
commit
7c3354caf9
@ -696,6 +696,10 @@ def educateQuotes(str):
|
||||
""" % (close_class,), re.VERBOSE)
|
||||
str = closing_double_quotes_regex.sub(r"""\1”""", str)
|
||||
|
||||
if str.endswith('-"'):
|
||||
# A string that endswith -" is sometimes used for dialogue
|
||||
str = str[:-1] + '”'
|
||||
|
||||
# Any remaining quotes should be opening ones.
|
||||
str = re.sub(r'"', r"""“""", str)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user