DOCX Output: Fix text immediately after a hidden tag not being included. Fixes #1717403 [Sections of Text Missing After Conversion (DOCX)](https://bugs.launchpad.net/calibre/+bug/1717403)

This commit is contained in:
Kovid Goyal 2017-09-20 13:20:47 +05:30
parent ff828ae47d
commit f19fbaf61c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -477,12 +477,12 @@ class Convert(object):
def process_tag(self, html_tag, stylizer, is_first_tag=False, float_spec=None):
tagname = barename(html_tag.tag)
if tagname in {'script', 'style', 'title', 'meta'}:
return
tag_style = stylizer.style(html_tag)
if tag_style.is_hidden:
return
ignore_tag_contents = tagname in {'script', 'style', 'title', 'meta'} or tag_style.is_hidden
display = tag_style._get('display')
is_block = False
if not ignore_tag_contents:
previous_link = self.current_link
if tagname == 'a' and html_tag.get('href'):
self.current_link = (self.current_item, html_tag.get('href'), html_tag.get('title'))
@ -491,7 +491,6 @@ class Convert(object):
if tag_lang:
self.current_lang = tag_lang
display = tag_style._get('display')
is_float = tag_style['float'] in {'left', 'right'} and not is_first_tag
if float_spec is None and is_float:
float_spec = FloatSpec(self.docx.namespace, html_tag, tag_style)
@ -534,6 +533,8 @@ class Convert(object):
self.current_link = previous_link
self.current_lang = previous_lang
# Now, process the tail if any
if display == 'table-row':
return # We ignore the tail for these tags