From a9b4c3f4dbab5f1a3e268a43d444beb5996b52f7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 26 Aug 2023 11:35:55 +0530 Subject: [PATCH] also check for tables inside paragraphs --- src/calibre/ebooks/conversion/plugins/fb2_input.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/conversion/plugins/fb2_input.py b/src/calibre/ebooks/conversion/plugins/fb2_input.py index 809b4ac77b..017137b65c 100644 --- a/src/calibre/ebooks/conversion/plugins/fb2_input.py +++ b/src/calibre/ebooks/conversion/plugins/fb2_input.py @@ -124,8 +124,9 @@ class FB2Input(InputFormatPlugin): img.set('src', self.binary_map.get(src, src)) # make paragraphs

tags + has_block_elements = etree.XPath('descendant::*[name()="div" or name()="table"]') for divp in result.xpath('//body/div[@class="paragraph"]'): - if not divp.xpath('descendant::div'): + if not has_block_elements(divp): divp.tag = 'p' index = transform.tostring(result)