mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
995bbcda49
commit
200833412c
@ -325,6 +325,11 @@ def xpath(elem, expr):
|
|||||||
return elem.xpath(expr, namespaces=XPNSMAP)
|
return elem.xpath(expr, namespaces=XPNSMAP)
|
||||||
|
|
||||||
def xml2str(root, pretty_print=False, strip_comments=False, with_tail=True):
|
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,
|
ans = etree.tostring(root, encoding='utf-8', xml_declaration=True,
|
||||||
pretty_print=pretty_print, with_tail=with_tail)
|
pretty_print=pretty_print, with_tail=with_tail)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user