Module:ISO 3166: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
m (Allowing named altnames) |
(Working deaccenting) |
||
Line 14: | Line 14: | ||
local function strip(text) |
local function strip(text) |
||
text = |
text = mw.ustring.upper(text) --Case insensitivity |
||
text = string.gsub(text,"^THE ","") --Remove definite article |
text = string.gsub(text,"^THE ","") --Remove definite article |
||
text = string.gsub(text,"[%s%-%,%.%(%)%/%\']","") --Remove spacing and punctuation |
text = string.gsub(text,"[%s%-%,%.%(%)%/%\']","") --Remove spacing and punctuation |
||
local accents = {["À"]="A",["Á"]="A",["Â"]="A",["Ã"]="A",["Ä"]="A",["Å"]="A",["C"]="C",["È"]="E",["É"]="E", |
|||
--text = string.gsub(text,"[\768-\879]","") --Unicode deaccenting doesn't work |
|||
["Ê"]="E",["Ë"]="E",["Ì"]="I",["Í"]="I",["Î"]="I",["Ï"]="I",["Ñ"]="N",["Ò"]="O",["Ó"]="O", |
|||
["Ô"]="O",["Õ"]="O",["Ö"]="O",["Ø"]="O",["Ù"]="U",["Ú"]="U",["Û"]="U",["Ü"]="U",["Ý"]="Y"} |
|||
text = mw.ustring.gsub(text,"[À-Ý]",accents) --Deaccent |
|||
return text |
return text |
||
end |
end |