Module:ISO 3166: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
(add optional "nocat" needed for template:infobox country and use the main data module since it appears to be the same as the sandbox)
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/sandbox")
local data = mw.loadData("Module:ISO 3166/data/National")


--[[----------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 104: Line 104:
local eot = args.error or ""
local eot = args.error or ""
local nocat = (args.nocat and args.nocat == 'true') or nil
if not args[1] then
if not args[1] then
Line 119: Line 121:
end
end
end
end
return '[[Category:Wikipedia page with obscure country]]'
return nocat and '' or '[[Category:Wikipedia page with obscure country]]'
else --3166-2 code
else --3166-2 code
for alpha2,cdata in pairs(data) do
for alpha2,cdata in pairs(data) do
Line 137: Line 139:
end
end
if empty then
if empty then
return '[[Category:Wikipedia page with obscure subdivision]]'
return nocat and '' or '[[Category:Wikipedia page with obscure subdivision]]'
else
else
return '[[Category:Wikipedia page with obscure subdivision]]'
return nocat and '' or '[[Category:Wikipedia page with obscure subdivision]]'
end
end
end
end
end
end
return '[[Category:Wikipedia page with obscure country]]'
return nocat and '' or '[[Category:Wikipedia page with obscure country]]'
end
end