From ccedfba57a6ddce621aaaeeead9bff2ce691bd03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Wed, 23 Jun 2021 18:48:30 +0200 Subject: [PATCH] Fix XML writer --- luamml-xmlwriter.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/luamml-xmlwriter.lua b/luamml-xmlwriter.lua index 38884ba..271fb07 100644 --- a/luamml-xmlwriter.lua +++ b/luamml-xmlwriter.lua @@ -30,14 +30,17 @@ local function write_elem(tree, indent) end out = out .. '>' local inner_indent = indent and indent .. ' ' + local is_string for _, elem in ipairs(tree) do if type(elem) == 'string' then - if inner_indent then + if inner_indent and not is_string then out = out .. inner_indent end out = out .. escape_text(elem) + is_string = true else out = out .. write_elem(elem, inner_indent) + is_string = nil end end if indent then out = out .. indent end