diff --git a/luamml-xmlwriter.lua b/luamml-xmlwriter.lua index a2b5abe..6880074 100644 --- a/luamml-xmlwriter.lua +++ b/luamml-xmlwriter.lua @@ -34,6 +34,10 @@ local function write_elem(tree, indent) return out .. '/>' end out = out .. '>' + -- Never indent the content if it's purely text. + if #tree == 1 and type(tree[1]) == 'string' then + indent = nil + end local inner_indent = indent and indent .. ' ' local is_string for _, elem in ipairs(tree) do