mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
RTF Output: Fix failure to convert documents that contain comments with the -- string inside the comment. Fixes #1272588 [Private bug](https://bugs.launchpad.net/calibre/+bug/1272588)
This commit is contained in:
parent
77b463b79a
commit
de0226ba47
@ -114,7 +114,9 @@ class RTFMLizer(object):
|
|||||||
output += '{\\page }'
|
output += '{\\page }'
|
||||||
for item in self.oeb_book.spine:
|
for item in self.oeb_book.spine:
|
||||||
self.log.debug('Converting %s to RTF markup...' % item.href)
|
self.log.debug('Converting %s to RTF markup...' % item.href)
|
||||||
content = unicode(etree.tostring(item.data, encoding=unicode))
|
# Removing comments is needed as comments with -- inside them can
|
||||||
|
# cause fromstring() to fail
|
||||||
|
content = re.sub(ur'<!--.*?-->', u'', etree.tostring(item.data, encoding=unicode), flags=re.DOTALL)
|
||||||
content = self.remove_newlines(content)
|
content = self.remove_newlines(content)
|
||||||
content = self.remove_tabs(content)
|
content = self.remove_tabs(content)
|
||||||
content = etree.fromstring(content)
|
content = etree.fromstring(content)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user