mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -308,6 +308,23 @@ class LitWriter(object):
|
||||
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…
x
Reference in New Issue
Block a user