Skip to content

Commit fd1f53b

Browse files
lmn8manoelcampos
lmn8
authored andcommitted
Add attributes in toXML for tag:only-of-type
1 parent 3b36570 commit fd1f53b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

xml2lua.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,11 @@ function xml2lua.toXml(tb, tableName, level)
195195
if type(getFirstKey(v)) == "number" then
196196
table.insert(xmltb, spaces..xml2lua.toXml(v, k, level))
197197
else
198-
table.insert(
199-
xmltb,
200-
spaces..'<'..k..'>\n'.. xml2lua.toXml(v, k, level+1)..
201-
'\n'..spaces..'</'..k..'>')
198+
local attrs = attrToXml(v._attr)
199+
v._attr = nil
200+
table.insert(xmltb,
201+
spaces..'<'..k..attrs..'>\n'.. xml2lua.toXml(v, k, level+1)..
202+
'\n'..spaces..'</'..k..'>')
202203
end
203204
end
204205
else

0 commit comments

Comments
 (0)