From 13dbd42f35d3b5bc36ee3fa46a8ec2cab19e1d71 Mon Sep 17 00:00:00 2001 From: ldolse Date: Mon, 13 Dec 2010 16:19:50 -0500 Subject: [PATCH] Added ellipsis substitutions to the smarten punctuation option --- src/calibre/ebooks/conversion/preprocess.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/ebooks/conversion/preprocess.py b/src/calibre/ebooks/conversion/preprocess.py index 3ff816b3bf..bc4df4233a 100644 --- a/src/calibre/ebooks/conversion/preprocess.py +++ b/src/calibre/ebooks/conversion/preprocess.py @@ -554,5 +554,8 @@ class HTMLPreProcessor(object): html = smartyPants(html) html = html.replace(start, '') + # convert ellipsis to entities to prevent unwrapping + html = re.sub('(?u)(?<=\w)(\.\s?){3}', '…', html) + html = re.sub('(?u)(?<=\w)\s(\.\s?){3}', ' …', html) return substitute_entites(html)