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:
Kovid Goyal 2014-04-30 21:09:22 +05:30
parent 4f2cb6552d
commit 7c3354caf9

View File

@ -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)