Fix bug #2696: Remove comments from lit output because they are not supported by the format.

This commit is contained in:
John Schember 2009-06-27 10:47:32 -04:00
parent c8df10343a
commit a7d0e84abd

View File

@ -308,6 +308,23 @@ class LitWriter(object):
else: else:
self._logger.warn('No suitable cover image found.') 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): def __call__(self, oeb, path):
if hasattr(path, 'write'): if hasattr(path, 'write'):
return self._dump_stream(oeb, path) return self._dump_stream(oeb, path)