Module:ISO 3166/sandbox: Difference between revisions

Content deleted Content added
fix "GB-ENG-Greenwich"
Move validity test to inside p.strip, unstripnowiki
Line 54:
 
function p.strip(text)
if not text then return nil end
local accents = {["À"]="A",["Á"]="A",["Â"]="A",["Ã"]="A", -- accent list
["Ä"]="A",["Å"]="A",["Ç"]="C",["È"]="E",["É"]="E",
Line 70 ⟶ 72:
}
text = mw.text.unstripNoWiki(text) -- Remove <nowiki> tags
text = mw.ustring.upper(text) -- Case insensitivity
text = mw.ustring.gsub(text,"[À-Ý]",accents) -- Deaccent
Line 100 ⟶ 103:
 
function p.luacode(args)
if args[1] thenlocal code1 = p.strip(args[1]) end
if args[2] thenlocal code2 = p.strip(args[2]) end
 
if args["codetype"]=="3" then args["codetype"]="alpha3" end