Module:ISO 3166/sandbox: Difference between revisions

Content deleted Content added
add warnings
simplify
Line 135:
 
function p.luacode(args)
local notRecognized ='%s ("%s") is not a recognized %s in [[ISO 3166-%s]] ([[Module:ISO 3166]]).'
args[1], args[2] = args[1] or '', args[2] or ''
local code1 = p.strip(args[1])
Line 152 ⟶ 151:
return cats('nocountry', args), '<span style="font-size:100%" class="error">"No parameter for the country given"</span>'
end
 
local notRecognized ='%s ("%s") is not a recognized %s in [[ISO 3166-%s]] ([[Module:ISO 3166]]).'
if code2 == "" then --3166-1 code
Line 190 ⟶ 191:
return p.luacode(args)
end
mw.addWarning(string.format(notRecognized, code2, args[2], 'subdivision', '2:' .. alpha2))
if args[2] ~= "" then
mw.addWarning(string.format(notRecognized, code2, args[2], 'subdivision', '2:' .. alpha2))
end
return cats('nosubdivision', args)
end