Fix XML writer
This commit is contained in:
parent
75ede91b5d
commit
ccedfba57a
@ -30,14 +30,17 @@ local function write_elem(tree, indent)
|
|||||||
end
|
end
|
||||||
out = out .. '>'
|
out = out .. '>'
|
||||||
local inner_indent = indent and indent .. ' '
|
local inner_indent = indent and indent .. ' '
|
||||||
|
local is_string
|
||||||
for _, elem in ipairs(tree) do
|
for _, elem in ipairs(tree) do
|
||||||
if type(elem) == 'string' then
|
if type(elem) == 'string' then
|
||||||
if inner_indent then
|
if inner_indent and not is_string then
|
||||||
out = out .. inner_indent
|
out = out .. inner_indent
|
||||||
end
|
end
|
||||||
out = out .. escape_text(elem)
|
out = out .. escape_text(elem)
|
||||||
|
is_string = true
|
||||||
else
|
else
|
||||||
out = out .. write_elem(elem, inner_indent)
|
out = out .. write_elem(elem, inner_indent)
|
||||||
|
is_string = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if indent then out = out .. indent end
|
if indent then out = out .. indent end
|
||||||
|
Loading…
Reference in New Issue
Block a user