From 76fe7be36f219bd0d7ac3a5abec01fed5613fefe Mon Sep 17 00:00:00 2001 From: John Schember Date: Tue, 25 Jan 2011 19:17:41 -0500 Subject: [PATCH] Heuristic: Tweak italicizing common works to ensure it does not match inside of a word. --- src/calibre/ebooks/conversion/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/conversion/utils.py b/src/calibre/ebooks/conversion/utils.py index f6e259b6f9..7882d82d47 100644 --- a/src/calibre/ebooks/conversion/utils.py +++ b/src/calibre/ebooks/conversion/utils.py @@ -155,7 +155,7 @@ class HeuristicProcessor(object): ] for word in ITALICIZE_WORDS: - html = html.replace(word, '%s' % word) + html = re.sub(r'(?<=\s|>)' + word + r'(?=\s|<)', '%s' % word, html) for pat in ITALICIZE_STYLE_PATS: html = re.sub(pat, lambda mo: '%s' % mo.group('words'), html)