Module:Sandbox/Jackmcbarn: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
test the combine function
Jackmcbarn (talk | contribs)
Reverted to revision 619340622 by Jackmcbarn (talk). (TW)
Line 1:
local p = {}
return { marks = { { lat = "37.105", long = "37.314", mark = "Rif_Aleppo2.svg", marksize = "279", label = "[[Battle of Aleppo (2012–present)|Aleppo]]", link = "File:Rif_Aleppo2.svg", label_size = "140", position = "left" } } }
 
function p.mark(frame)
local argsToReturn = {}
local extra = {}
local args = {}
for k,v in pairs(frame.args) do
args[k] = v
end
for k,v in ipairs({'lat', 'long', 'mark', 'marksize', 'label', 'link', 'label_size', 'position'}) do
if args[v] then
table.insert(argsToReturn, string.format("%s = %q", v, mw.text.trim(args[v])))
args[v] = nil
end
end
if args[1] and mw.text.trim(args[1]) == 'Syria' then args[1] = nil end
for k,v in pairs(args) do
table.insert(extra, 'EXTRA ' .. k .. ' = ' .. v)
end
if #extra > 0 then
error(table.concat(extra, ', '))
end
return '{ ' .. table.concat(argsToReturn, ', ') .. ' },'
end
 
return p