require('strict')
local getArgs = require('Module:Arguments').getArgslocal cd = require('Module:CountryData')local list = require('Module:List');local p =
local knownargs =
local labels =
local function getLocalLabel(alias) local label = labels[string.upper(alias)]
return labelend
local countryData = ; -- Used to store country data to avoid the need of repeated calls to Module:CountryData. This saves a little time if the same abbreviation appears multiple times in the template.
local function getCountryData(frame, alias) local ualias = string.upper(alias)
if (countryData[ualias]
return countryData[ualias]end
local function splitLabel(s) local islist = true local res = for k,v in ipairs(mw.text.split(s or , '%s*/%s*')) do local v1 = v:match('^%s*([A-Z][A-Z][A-Z]?)%s*$') if v1 then table.insert(res,v1) else local v2 = v:match('^%s*(%[%[[^%[%]|]*|[A-Z][A-Z][A-Z]?%]%])%s*$') if v2 then table.insert(res,v2) else islist = false end end end return islist and res or end
function p.main(frame) local args = getArgs(frame) local listformat = args['format'] if (listformat
"") then listformat = "unbulleted" end local items =
-- Old syntax "Two parameter region" use case, where param 1 is an article, param 2 is a label, and param 3 is the date. We assume this case if argument 4 is nil. if (args[3] ~= nil and args[4]
-- Didn't find a local label? Check for country data. if (label
i = i + 2 j = j + 2 end end
-- Add known parameters of Module:List to the table for k, v in pairs(args) do if (knownargs[k]
local out = list.makeList(listformat, items)
-- Preview message and category local parameterMsg = require('Module:If preview')._warning .. ""
-- Check for invalid parameters for k, v in pairs(args) do if (type(k) ~= 'number' and knownargs[k] ~= true) then local msg = parameterMsg:gsub('_VALUE_', k) out = out .. msg end end
return outend
return p