From e1192611f0655a1ccaff0dff2f53c7c65fa5db07 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 24 Jan 2020 03:00:54 +0000 Subject: CTAN sync 202001240300 --- support/make4ht/domfilters/make4ht-tablerows.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'support/make4ht/domfilters/make4ht-tablerows.lua') diff --git a/support/make4ht/domfilters/make4ht-tablerows.lua b/support/make4ht/domfilters/make4ht-tablerows.lua index 155c24529a..3e3931b368 100644 --- a/support/make4ht/domfilters/make4ht-tablerows.lua +++ b/support/make4ht/domfilters/make4ht-tablerows.lua @@ -1,5 +1,16 @@ local log = logging.new ("tablerows") return function(dom) + local has_child_elements = function(child) + -- detect if the element contains child elements + local child_elements = 0 + local children = child:get_children() + for _, el in ipairs(children) do + local step = el:is_element() and 1 or 0 + -- log:info("element name", el._name) + child_elements = child_elements + step + end + return child_elements > 0 + end local is_empty_row = function(row) local not_empty = false local element_count = 0 @@ -11,7 +22,8 @@ return function(dom) if child:is_element() then element_count = element_count + 1 -- empty rows contain only one element, it is not empty otherwise - if element_count > 1 then return false end + if element_count > 1 or has_child_elements(child) then return false end + -- detect if it contains only whitespace not_empty = child:get_text():gsub("%s","") ~= "" or not_empty end -- cgit v1.2.3