diff --git a/src/calibre/ebooks/lit/writer.py b/src/calibre/ebooks/lit/writer.py index 1e72ab2e4a..56e510aae2 100644 --- a/src/calibre/ebooks/lit/writer.py +++ b/src/calibre/ebooks/lit/writer.py @@ -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)