mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
ff828ae47d
commit
f19fbaf61c
@ -477,12 +477,12 @@ class Convert(object):
|
|||||||
|
|
||||||
def process_tag(self, html_tag, stylizer, is_first_tag=False, float_spec=None):
|
def process_tag(self, html_tag, stylizer, is_first_tag=False, float_spec=None):
|
||||||
tagname = barename(html_tag.tag)
|
tagname = barename(html_tag.tag)
|
||||||
if tagname in {'script', 'style', 'title', 'meta'}:
|
|
||||||
return
|
|
||||||
tag_style = stylizer.style(html_tag)
|
tag_style = stylizer.style(html_tag)
|
||||||
if tag_style.is_hidden:
|
ignore_tag_contents = tagname in {'script', 'style', 'title', 'meta'} or tag_style.is_hidden
|
||||||
return
|
display = tag_style._get('display')
|
||||||
|
is_block = False
|
||||||
|
|
||||||
|
if not ignore_tag_contents:
|
||||||
previous_link = self.current_link
|
previous_link = self.current_link
|
||||||
if tagname == 'a' and html_tag.get('href'):
|
if tagname == 'a' and html_tag.get('href'):
|
||||||
self.current_link = (self.current_item, html_tag.get('href'), html_tag.get('title'))
|
self.current_link = (self.current_item, html_tag.get('href'), html_tag.get('title'))
|
||||||
@ -491,7 +491,6 @@ class Convert(object):
|
|||||||
if tag_lang:
|
if tag_lang:
|
||||||
self.current_lang = 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
|
is_float = tag_style['float'] in {'left', 'right'} and not is_first_tag
|
||||||
if float_spec is None and is_float:
|
if float_spec is None and is_float:
|
||||||
float_spec = FloatSpec(self.docx.namespace, html_tag, tag_style)
|
float_spec = FloatSpec(self.docx.namespace, html_tag, tag_style)
|
||||||
@ -534,6 +533,8 @@ class Convert(object):
|
|||||||
self.current_link = previous_link
|
self.current_link = previous_link
|
||||||
self.current_lang = previous_lang
|
self.current_lang = previous_lang
|
||||||
|
|
||||||
|
# Now, process the tail if any
|
||||||
|
|
||||||
if display == 'table-row':
|
if display == 'table-row':
|
||||||
return # We ignore the tail for these tags
|
return # We ignore the tail for these tags
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user