mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
DOCX Output: When detecting empty list items that contain a nested list, ignore whitespace
This commit is contained in:
parent
51e4651c34
commit
dbd738e5f6
@ -575,9 +575,12 @@ class Convert(object):
|
|||||||
self.images_manager.add_image(html_tag, block, stylizer, as_block=True)
|
self.images_manager.add_image(html_tag, block, stylizer, as_block=True)
|
||||||
else:
|
else:
|
||||||
text = html_tag.text
|
text = html_tag.text
|
||||||
|
is_list_item = tagname == 'li'
|
||||||
|
if text and is_list_item and not text.strip():
|
||||||
|
text = '' # whitespace only, ignore
|
||||||
if text:
|
if text:
|
||||||
block.add_text(text, tag_style, ignore_leading_whitespace=True, is_parent_style=True, link=self.current_link, lang=self.current_lang)
|
block.add_text(text, tag_style, ignore_leading_whitespace=True, is_parent_style=True, link=self.current_link, lang=self.current_lang)
|
||||||
elif tagname == 'li' and len(html_tag) and barename(html_tag[0].tag) in ('ul', 'ol') and len(html_tag[0]):
|
elif is_list_item and len(html_tag) and barename(html_tag[0].tag) in ('ul', 'ol') and len(html_tag[0]):
|
||||||
block.force_not_empty = True
|
block.force_not_empty = True
|
||||||
|
|
||||||
def add_inline_tag(self, tagname, html_tag, tag_style, stylizer):
|
def add_inline_tag(self, tagname, html_tag, tag_style, stylizer):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user