Anonymous user
Module:Template invocation: Difference between revisions
fixes requested at Module talk:Template invocation: keys of parameters may be numbers or strings so need a custom sort; that break was wrong as more could be following
m (1 revision imported) |
(fixes requested at Module talk:Template invocation: keys of parameters may be numbers or strings so need a custom sort; that break was wrong as more could be following) |
||
Line 94:
for k, v in ipairs(invArgs) do
if type(v) == 'string' and v:find('=', 1, true) then
-- Likely something like 1=foo=bar
ret[#ret + 1] = seps.pipe▼
ret[#ret + 1] = v▼
invArgs[k] = nil -- Erase the key so that we don't add the value twice▼
end
▲ ret[#ret + 1] = seps.pipe
▲ ret[#ret + 1] = v
▲ invArgs[k] = nil -- Erase the key so that we don't add the value twice
end
local
for k,
end
table.sort(
-- Sort with keys of type number first, then string.
for i, v in ipairs(invArgs_list) do -- Add named args based on sorted parameter list▼
if type(a) == type(b) then
return a < b
elseif type(a) == 'number' then
return true
end
end)
ret[#ret + 1] = seps.pipe
ret[#ret + 1] = tostring(v)
ret[#ret + 1] = seps.equals
ret[#ret + 1] = invArgs[v]
|