summaryrefslogtreecommitdiff
path: root/support/make4ht/domfilters
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-10-12 03:00:58 +0000
committerNorbert Preining <norbert@preining.info>2021-10-12 03:00:58 +0000
commit20b79660fb560eb1dd8e80d44837e0d4c17ca03c (patch)
treea96f0dee853efcdecf8395053a4919908aeeb71a /support/make4ht/domfilters
parentaac7fdc4c391b318efbdee17381ac83783b2fbbb (diff)
CTAN sync 202110120300
Diffstat (limited to 'support/make4ht/domfilters')
-rw-r--r--support/make4ht/domfilters/make4ht-mathmlfixes.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/support/make4ht/domfilters/make4ht-mathmlfixes.lua b/support/make4ht/domfilters/make4ht-mathmlfixes.lua
index 55c0da379b..42f1e55775 100644
--- a/support/make4ht/domfilters/make4ht-mathmlfixes.lua
+++ b/support/make4ht/domfilters/make4ht-mathmlfixes.lua
@@ -37,6 +37,30 @@ local function fix_nested_mstyle(el)
end
end
+-- if element contains
+-- wrap everything in <mrow>
+local function top_mrow(math)
+ local children = math:get_children()
+ local put_mrow = false
+ -- don't process elements with one or zero children
+ -- don't process elements that already are mrow
+ if #children < 2 or math:get_element_name() == "mrow" then return nil end
+ for _,v in ipairs(children) do
+ if v:is_element() and is_token_element(v) then
+ put_mrow = true
+ break
+ end
+ end
+ if put_mrow then
+ local mrow = math:create_element("mrow")
+ for _, el in ipairs(children) do
+ mrow:add_child_node(el)
+ end
+ math._children = {mrow}
+ end
+
+end
+
local function get_fence(el, attr, form)
-- convert fence attribute to <mo> element
-- attr: open | close
@@ -108,6 +132,7 @@ return function(dom)
end
fix_token_elements(el)
fix_nested_mstyle(el)
+ top_mrow(el)
end)
return dom
end