From 44ae597f1415a9b528eb5b08eb842250249dd9e4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 5 Jul 2016 15:28:52 +0530 Subject: [PATCH] Smarten punctuation: Fix double dashes and triple dots being smartened even inside attribute values. Fixes #1598465 [Problem with smarten punctuation when using ebook-convert](https://bugs.launchpad.net/calibre/+bug/1598465) There was a postprocess step that calibre was doing after the call to smartypants that was unneccessary and was causing this bug. --- src/calibre/ebooks/conversion/preprocess.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/calibre/ebooks/conversion/preprocess.py b/src/calibre/ebooks/conversion/preprocess.py index bf181bb7c0..182aee4567 100644 --- a/src/calibre/ebooks/conversion/preprocess.py +++ b/src/calibre/ebooks/conversion/preprocess.py @@ -62,7 +62,7 @@ def wrap_lines(match): else: return ital+' ' -def smarten_punctuation(html, log): +def smarten_punctuation(html, log=None): from calibre.utils.smartypants import smartyPants from calibre.ebooks.chardet import substitute_entites from calibre.ebooks.conversion.utils import HeuristicProcessor @@ -76,10 +76,6 @@ def smarten_punctuation(html, log): html = smartyPants(html) html = html.replace(start, '') - # convert ellipsis to entities to prevent wrapping - html = re.sub(r'(?u)(?<=\w)\s?(\.\s?){2}\.', '…', html) - # convert double dashes to em-dash - html = re.sub(r'\s--\s', u'\u2014', html) return substitute_entites(html) class DocAnalysis(object):