Módulo:Utf8ToAnsi
Aspeto
A documentação para este módulo pode ser editada em Módulo:Utf8ToAnsi/doc.
Este módulo converte caracteres acentuados (do português) na sua versão ANSI "escaped".
local export = {}
-- this function enables the module to be called from a template
function export.main(frame)
if type(export[frame.args[1]]) == 'function' then
return export[frame.args[1]](frame.args[2], frame.args[3])
else
return export[frame.args[1]][frame.args[2]]
end
end
function export.convert_diacritics(word)
word = mw.ustring.gsub(word, "à", "a")
word = mw.ustring.gsub(word, "á", "a")
word = mw.ustring.gsub(word, "â", "a")
word = mw.ustring.gsub(word, "ã", "a")
word = mw.ustring.gsub(word, "ç", "c")
word = mw.ustring.gsub(word, "é", "e")
word = mw.ustring.gsub(word, "ê", "e")
word = mw.ustring.gsub(word, "í", "i")
word = mw.ustring.gsub(word, "ó", "o")
word = mw.ustring.gsub(word, "ô", "o")
word = mw.ustring.gsub(word, "ú", "u")
word = mw.ustring.gsub(word, "ü", "u")
return word
end
return export