Don't serialize namespaced attributes into XML

This commit is contained in:
Marcel Fabian Krüger 2023-12-23 11:55:31 +01:00
parent 9c43b61387
commit 9b85cdb610

View File

@ -20,9 +20,12 @@ local function write_elem(tree, indent)
if not tree[0] then print('ERR', require'inspect'(tree)) end
local escaped_name = escape_name(assert(tree[0]))
local i = 0
for attr, val in next, tree do if type(attr) == 'string' and string.byte(attr) ~= 0x3A then
for attr, val in next, tree do if type(attr) == 'string' then
if not string.find(attr, ':', 1, true) then
-- if string.byte(attr) ~= 0x3A then
i = i + 1
attrs[i] = string.format(' %s="%s"', escape_name(attr), escape_text(val))
end
end end
table.sort(attrs)
local out = string.format('%s<%s%s', indent or '', escaped_name, table.concat(attrs))