diff --git a/inputters/xml.lua b/inputters/xml.lua index 01573137d..bb4242c2a 100644 --- a/inputters/xml.lua +++ b/inputters/xml.lua @@ -7,6 +7,12 @@ inputter._name = "xml" inputter.order = 2 local function startcommand (parser, command, options) + -- Discard list values (non-key/value), stuffed by LXP/expat to make it possible to deduce the order of keys in + -- the source. We're not using it, so we don't care and it is clutter in the AST that makes it different from + -- ASTs generated from SIL inputs. + for i = 1, #options do + options[i] = nil + end local stack = parser:getcallbacks().stack local lno, col, pos = parser:pos() local position = { lno = lno, col = col, pos = pos } diff --git a/inputters/xml_spec.lua b/inputters/xml_spec.lua index d983251a2..f7d25a861 100644 --- a/inputters/xml_spec.lua +++ b/inputters/xml_spec.lua @@ -36,6 +36,11 @@ describe("#XML #inputter", function () assert.is.equal("bar", t[1]) end) + it("commands should parse only named arguments", function () + local t = inputter:parse([[bar]])[1][1] + assert.is.equal(0, #t.options) + end) + -- it("commands with quoted arg with escape", function() -- local t = inputter:parse([[bar]]) -- assert.is.equal("foo", t.command)