mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
TXT/RTF Output: Handle XML processing instructions embedded in content correctly. Fixes #7644 (Convert epub to rtf or txt - text sections get lost)
This commit is contained in:
parent
5825d31ed8
commit
3096514c42
@ -191,6 +191,10 @@ class RTFMLizer(object):
|
||||
def dump_text(self, elem, stylizer, tag_stack=[]):
|
||||
if not isinstance(elem.tag, basestring) \
|
||||
or namespace(elem.tag) != XHTML_NS:
|
||||
p = elem.getparent()
|
||||
if isinstance(p.tag, basestring) and namespace(p.tag) == XHTML_NS \
|
||||
and elem.tail:
|
||||
return elem.tail
|
||||
return u''
|
||||
|
||||
text = u''
|
||||
|
@ -155,6 +155,10 @@ class TXTMLizer(object):
|
||||
|
||||
if not isinstance(elem.tag, basestring) \
|
||||
or namespace(elem.tag) != XHTML_NS:
|
||||
p = elem.getparent()
|
||||
if isinstance(p.tag, basestring) and namespace(p.tag) == XHTML_NS \
|
||||
and elem.tail:
|
||||
return [elem.tail]
|
||||
return ['']
|
||||
|
||||
text = ['']
|
||||
|
Loading…
x
Reference in New Issue
Block a user