Module:Sandbox/Jackmcbarn: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
don't double-index
Jackmcbarn (talk | contribs)
Reverted to revision 611290135 by Jackmcbarn (talk). (TW)
Line 1:
local p = {}
 
local function splitp.mark(str, delimframe)
local retval, endposargsToReturn = {}, 1
local extra = {}
for elem, pos in str:gmatch('(.-)' .. delim .. '()') do
local args = {}
table.insert(retval, elem)
for k,v in pairs(frame.args) do
endpos = pos
args[k] = v
end
for k,v in ipairs({'lat', 'long', 'mark', 'marksize', 'label', 'link', 'label_size', 'position'}) do
table.insert(retval, str:sub(endpos))
if args[v] then
return retval
table.insert(argsToReturn, string.format("%s = %q", v, mw.text.trim(args[v])))
end
args[v] = nil
 
end
function p.main(frame)
end
local list = mw.text.trim(frame.args[1])
if args[1] and mw.text.trim(args[1]) == 'Syria' then args[1] = nil end
local listEntries = split(list, '\n')
for k,v in pairs(args) do
table.sort(listEntries, function(a,b)
local aWordstable.insert(extra, bWords'EXTRA =' split(a,.. 'k .. '), split(b,= ' '.. v)
end)
return (aWords[2] .. aWords[1]) < (bWords[2] .. bWords[1])
if #extra > 0 then
end)
return error(table.concat(listEntriesextra, '\n, '))
end
return '{ ' .. table.concat(argsToReturn, ', ') .. ' },'
end