diff options
author | Norbert Preining <norbert@preining.info> | 2020-01-24 03:00:54 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-01-24 03:00:54 +0000 |
commit | e1192611f0655a1ccaff0dff2f53c7c65fa5db07 (patch) | |
tree | 232f5be17a2221a57cc6515bfe8692772b3a3e89 /support/make4ht/domfilters/make4ht-tablerows.lua | |
parent | f7e5d81fe9880913485f7f8c541eeca7adf4c195 (diff) |
CTAN sync 202001240300
Diffstat (limited to 'support/make4ht/domfilters/make4ht-tablerows.lua')
-rw-r--r-- | support/make4ht/domfilters/make4ht-tablerows.lua | 14 |
1 files changed, 13 insertions, 1 deletions
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 |