Smarten punctuation: Fix bug in handling of comments

This commit is contained in:
Kovid Goyal 2010-10-17 15:03:22 -06:00
parent d3fa7cd6ee
commit c0609cd4cd

View File

@ -543,6 +543,13 @@ class HTMLPreProcessor(object):
def smarten_punctuation(self, html):
from calibre.utils.smartypants import smartyPants
from calibre.ebooks.chardet import substitute_entites
from uuid import uuid4
start = 'calibre-smartypants-'+str(uuid4())
stop = 'calibre-smartypants-'+str(uuid4())
html = html.replace('<!--', start)
html = html.replace('-->', stop)
html = smartyPants(html)
html = html.replace(start, '<!--')
html = html.replace(stop, '-->')
return substitute_entites(html)