From 3df6200ca7cf5499a496ab165d12d6e7294830fc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 24 Mar 2022 21:02:00 +0530 Subject: [PATCH] DOCX Output: Fix a comment immediately after a
  • tag breaking the conversion --- src/calibre/ebooks/docx/writer/from_html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/docx/writer/from_html.py b/src/calibre/ebooks/docx/writer/from_html.py index 16283c085f..a7ed841b78 100644 --- a/src/calibre/ebooks/docx/writer/from_html.py +++ b/src/calibre/ebooks/docx/writer/from_html.py @@ -586,7 +586,7 @@ class Convert: else: text = html_tag.text is_list_item = tagname == 'li' - has_sublist = is_list_item and len(html_tag) and barename(html_tag[0].tag) in ('ul', 'ol') and len(html_tag[0]) + has_sublist = is_list_item and len(html_tag) and isinstance(html_tag[0].tag, str) and barename(html_tag[0].tag) in ('ul', 'ol') and len(html_tag[0]) if text and has_sublist and not text.strip(): text = '' # whitespace only, ignore if text: