Module:ISO 3166: Difference between revisions

m
1 revision imported
(update with code from BrandonXLF per request on the talk page)
m (1 revision imported)
 
(4 intermediate revisions by 4 users not shown)
Line 35:
--[[----------I S O N A M E----------]]-- -- Find the ISO name of a country/region
 
local function isoname(data,code,lang)
if data[code]["isonames"] then
local name = data[code]["isodisplaynames"] and data[code]["isodisplaynames"][lang]
Line 101:
function p.luacode(args)
 
if string.find(args[1] or '',"%-") then
args[1], args[2] = string.match(args[1] or '',"^([^%-]*)%-(.*)$")
end
Line 120:
if not args[1] then
if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry = '' end
return catnocountry, '<span style="font-size:100%" class="error">"No parameter for the country given"</span>'
end
Line 133 ⟶ 134:
end
end
if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry = '' end
return catnocountry
else --3166-2 code
Line 150 ⟶ 152:
end
end
if mw.title.getCurrentTitle().namespace ~= 0 then catnosubdivision = '' end
if empty then
return catnosubdivision
else
return catnosubdivision
end
end
end
if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry = '' end
return catnocountry
end
Line 258:
if region == '' then
region = p.luacode({country, nocat = 'true'})
if mw.title.getCurrentTitle().namespace ~= 0 then catnocountry, catnosubdivision = '', '' end
if region == '' then
tracking = tracking .. catnocountry