Module:ISO 3166: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
(Added support for England Wales etc.)
Line 7: Line 7:
local p = {}
local p = {}
local getArgs = require("Module:Arguments").getArgs
local getArgs = require("Module:Arguments").getArgs
local data = mw.loadData("Module:ISO 3166/data/National")
local data = mw.loadData("Module:ISO 3166/data/National/sandbox")


--[[----------F I N D N A M E----------]]---- Finds the name in the database
--[[----------F I N D N A M E----------]]---- Finds the name in the database
Line 109: Line 109:
end
end
if not args[2] then
if not args[2] then --3166-1 code
--3166-1 code
for alpha2,cdata in pairs(data) do
for alpha2,cdata in pairs(data) do
if findname(alpha2,cdata,args[1]) then
if findname(alpha2,cdata,args[1]) then
Line 121: Line 120:
end
end
return '[[Category:Wikipedia page with obscure country]]'
return '[[Category:Wikipedia page with obscure country]]'
else --3166-2 code
else
for alpha2,cdata in pairs(data) do
--3166-2 code
for alpha2,cdata in pairs(data) do
if findname(alpha2,cdata,args[1]) then
if findname(alpha2,cdata,args[1]) then
if mw.ustring.match(alpha2,"GB") then -- For England, Wales etc.
local sdata = mw.loadData("Module:ISO 3166/data/"..alpha2)
alpha2 = "GB"
end
local sdata = mw.loadData("Module:ISO 3166/data/"..alpha2)
local empty = true
local empty = true
for scode,scdata in pairs(sdata) do
for scode,scdata in pairs(sdata) do