From 22684e7617d4012c7c533db72072b9205a4ba40a Mon Sep 17 00:00:00 2001 From: John Schember Date: Sat, 29 Jan 2011 08:40:21 -0500 Subject: [PATCH] Heuristic: Italicize common cases, reduce false positives. --- 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 7882d82d47..ad2214fcb5 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 = re.sub(r'(?<=\s|>)' + word + r'(?=\s|<)', '%s' % word, html) + html = re.sub(r'(?<=\s|>)' + re.escape(word) + r'(?=\s|<)', '%s' % word, html) for pat in ITALICIZE_STYLE_PATS: html = re.sub(pat, lambda mo: '%s' % mo.group('words'), html)