EPUB Output: Strip -- characters from inside comments, as some ebook reading apps cannot handle them. Fixes #1256059 [epub file not rendering in Android Mantano reader](https://bugs.launchpad.net/calibre/+bug/1256059)

This commit is contained in:
Kovid Goyal 2013-11-29 07:55:55 +05:30
parent 995bbcda49
commit 200833412c

View File

@ -325,6 +325,11 @@ def xpath(elem, expr):
return elem.xpath(expr, namespaces=XPNSMAP)
def xml2str(root, pretty_print=False, strip_comments=False, with_tail=True):
if not strip_comments:
# -- in comments trips up adobe digital editions
for x in root.iterdescendants(etree.Comment):
if x.text and '--' in x.text:
x.text = x.text.replace('--', '__')
ans = etree.tostring(root, encoding='utf-8', xml_declaration=True,
pretty_print=pretty_print, with_tail=with_tail)