summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-02-28 23:46:36 +0000
committerKarl Berry <karl@freefriends.org>2018-02-28 23:46:36 +0000
commit1218a8f71bfc4d59b07360b0a83aaf8de831d117 (patch)
tree9fb4f0c57c1bd83e6fdddeaa70cb6c6825cf3289 /Master/texmf-dist/tex/luatex
parent9e7da4a10152b2d4e13563fd86ec830328532014 (diff)
luaxml (28feb18)
git-svn-id: svn://tug.org/texlive/trunk@46768 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
-rw-r--r--Master/texmf-dist/tex/luatex/luaxml/luaxml-domobject.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaxml/luaxml-domobject.lua b/Master/texmf-dist/tex/luatex/luaxml/luaxml-domobject.lua
index 46be64803b3..21f67a6f4ed 100644
--- a/Master/texmf-dist/tex/luatex/luaxml/luaxml-domobject.lua
+++ b/Master/texmf-dist/tex/luatex/luaxml/luaxml-domobject.lua
@@ -103,7 +103,7 @@ local function serialize_dom(parser, current,level, output)
text_content = text_content:gsub('"nil"','')
text_content = text_content:gsub('%s*$','')
attributes = {}
- elseif xtype == "ELEMENT" and void[name] then
+ elseif xtype == "ELEMENT" and void[name] and #current._children < 1 then
local format = get_action(xtype, "void")
insert(format, name, prepare_attributes(attributes))
return output
@@ -238,6 +238,7 @@ local parse = function(
)
local current = current or self
local text = {}
+ if current:is_text() then return current._text or "" end
for _, el in ipairs(current:get_children()) do
if el:is_text() then
text[#text+1] = el._text or ""
@@ -314,7 +315,9 @@ local parse = function(
return el._parent
end
- --- Execute function on the current element and all it's children elements
+ --- Execute function on the current element and all it's children elements.
+ -- The traversing of child elements of a given node can be disabled when the executed
+ -- function returns false.
-- @return nothing
function DOM_Object:traverse_elements(
fn, --- function which will be executed on the current element and all it's children