Heuristic: Italicize common cases, reduce false positives.

This commit is contained in:
John Schember 2011-01-29 08:40:21 -05:00
parent 755c2226f7
commit 22684e7617

View File

@ -155,7 +155,7 @@ class HeuristicProcessor(object):
]
for word in ITALICIZE_WORDS:
html = re.sub(r'(?<=\s|>)' + word + r'(?=\s|<)', '<i>%s</i>' % word, html)
html = re.sub(r'(?<=\s|>)' + re.escape(word) + r'(?=\s|<)', '<i>%s</i>' % word, html)
for pat in ITALICIZE_STYLE_PATS:
html = re.sub(pat, lambda mo: '<i>%s</i>' % mo.group('words'), html)