summaryrefslogtreecommitdiff
path: root/support/make4ht/domfilters/make4ht-tablerows.lua
diff options
context:
space:
mode:
Diffstat (limited to 'support/make4ht/domfilters/make4ht-tablerows.lua')
-rw-r--r--support/make4ht/domfilters/make4ht-tablerows.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/support/make4ht/domfilters/make4ht-tablerows.lua b/support/make4ht/domfilters/make4ht-tablerows.lua
index ef36a85750..11dbfcaa71 100644
--- a/support/make4ht/domfilters/make4ht-tablerows.lua
+++ b/support/make4ht/domfilters/make4ht-tablerows.lua
@@ -4,11 +4,17 @@ return function(dom)
-- detect if the element contains child elements
local child_elements = 0
local children = child:get_children()
- for _, el in ipairs(children) do
+ local last_child_pos
+ for pos, el in ipairs(children) do
+ last_child_pos = pos
local step = el:is_element() and 1 or 0
-- log:info("element name", el._name)
child_elements = child_elements + step
end
+ -- longtable has <td><p></p></td> inside empty rows, we regard them as empty
+ if child_elements == 1 and children[last_child_pos]:get_element_name() == "p" and child:get_text():gsub("%s", "") == "" then
+ child_elements = 0
+ end
return child_elements > 0
end
local is_empty_row = function(row)