DOCX Output: Fix comments/XML processing instructions in the middle of text causing text to be skipped. Fixes #1727599 [Private bug](https://bugs.launchpad.net/calibre/+bug/1727599)

This commit is contained in:
Kovid Goyal 2017-10-31 12:39:04 +05:30
parent 6d95b25dbd
commit 43011b9a97
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -522,8 +522,14 @@ class Convert(object):
tag_style.set('border-%s-style' % edge, 'none')
self.add_block_tag(tagname, html_tag, tag_style, stylizer, float_spec=float_spec)
for child in html_tag.iterchildren('*'):
self.process_tag(child, stylizer, float_spec=float_spec)
for child in html_tag.iterchildren():
if isinstance(getattr(child, 'tag', None), basestring):
self.process_tag(child, stylizer, float_spec=float_spec)
else: # Comment/PI/etc.
tail = getattr(child, 'tail', None)
if tail:
block = self.create_block_from_parent(html_tag, stylizer)
block.add_text(tail, tag_style, is_parent_style=False, link=self.current_link, lang=self.current_lang)
is_block = html_tag in self.blocks.open_html_blocks
self.blocks.finish_tag(html_tag)