diff --git a/src/calibre/utils/smartypants.py b/src/calibre/utils/smartypants.py index fa3119bf53..a670b3abd1 100644 --- a/src/calibre/utils/smartypants.py +++ b/src/calibre/utils/smartypants.py @@ -597,14 +597,19 @@ def educateQuotes(str): str = re.sub(r"""(?<=\W)'(?=\w)""", r"""‘""", str) str = re.sub(r"""(?<=\w)"(?=\W)""", r"""”""", str) str = re.sub(r"""(?<=\w)'(?=\W)""", r"""’""", str) - + + # The following are commented out as smartypants tokenizes text by + # stripping out html tags. Therefore, there is no guarantee that the + # start-of-line and end-ol-line regex operators will match anything + # meaningful + # Special case for Quotes at end of line with a preceeding space (may change just to end of line) - str = re.sub(r"""(?<=\s)"$""", r"""”""", str) - str = re.sub(r"""(?<=\s)'$""", r"""’""", str) - + #str = re.sub(r"""(?<=\s)"$""", r"""”""", str) + #str = re.sub(r"""(?<=\s)'$""", r"""’""", str) + # Special case for Quotes at beginning of line with a space - multiparagraph quoted text: - str = re.sub(r"""^"(?=\s)""", r"""“""", str) - str = re.sub(r"""^'(?=\s)""", r"""‘""", str) + #str = re.sub(r"""^"(?=\s)""", r"""“""", str) + #str = re.sub(r"""^'(?=\s)""", r"""‘""", str) # Special case for decade abbreviations (the '80s): str = re.sub(r"""\b'(?=\d{2}s)""", r"""’""", str)