diff options
author | Karl Berry <karl@freefriends.org> | 2020-01-23 21:55:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-01-23 21:55:17 +0000 |
commit | f74db910cfdba799460326738cc42e0ee57c3366 (patch) | |
tree | 95fc397a27f88691852418443c83f224ebe991bf /Master/texmf-dist/scripts/make4ht/domfilters/make4ht-tablerows.lua | |
parent | 0b9bafc4f15f46c47c222b08f16cb2c276358cdc (diff) |
make4ht (23jan20)
git-svn-id: svn://tug.org/texlive/trunk@53514 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/make4ht/domfilters/make4ht-tablerows.lua')
-rw-r--r-- | Master/texmf-dist/scripts/make4ht/domfilters/make4ht-tablerows.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-tablerows.lua b/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-tablerows.lua index 155c24529ac..3e3931b368a 100644 --- a/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-tablerows.lua +++ b/Master/texmf-dist/scripts/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 |