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:
Kovid Goyal 2010-11-25 09:48:14 -07:00
parent 5825d31ed8
commit 3096514c42
2 changed files with 8 additions and 0 deletions

View File

@ -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''

View File

@ -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 = ['']