Improve pretty-printing for text-only nodes
This commit is contained in:
parent
b738939001
commit
06eb95d9c1
@ -34,6 +34,10 @@ local function write_elem(tree, indent)
|
|||||||
return out .. '/>'
|
return out .. '/>'
|
||||||
end
|
end
|
||||||
out = out .. '>'
|
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 inner_indent = indent and indent .. ' '
|
||||||
local is_string
|
local is_string
|
||||||
for _, elem in ipairs(tree) do
|
for _, elem in ipairs(tree) do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user