mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-03-06 04:54:01 +01:00
Fix bug #2696: Remove comments from lit output because they are not supported by the format.
This commit is contained in:
parent
c8df10343a
commit
a7d0e84abd
1 changed files with 17 additions and 0 deletions
|
|
@ -308,6 +308,23 @@ def _litize_oeb(self):
|
|||
else:
|
||||
self._logger.warn('No suitable cover image found.')
|
||||
|
||||
# Remove comments because they are not supported by LIT HTML
|
||||
for item in oeb.spine:
|
||||
for elem in item.data.getiterator():
|
||||
print elem.tag
|
||||
if isinstance(elem, etree._Comment):
|
||||
tail = elem.tail
|
||||
parent = elem.getparent()
|
||||
parent.remove(elem)
|
||||
|
||||
text = u''
|
||||
if parent.text:
|
||||
text += parent.text
|
||||
if tail:
|
||||
text += tail
|
||||
|
||||
parent.text = text
|
||||
|
||||
def __call__(self, oeb, path):
|
||||
if hasattr(path, 'write'):
|
||||
return self._dump_stream(oeb, path)
|
||||
|
|
|
|||
Loading…
Reference in a new issue