Modul:no-diacritics
A modult a Modul:no-diacritics/doc lapon tudod dokumentálni
local export = {}
local acute_or_grave = "[" .. mw.ustring.char(0x301) .. mw.ustring.char(0x300) .. "]"
local accentedLetters = 'áàéèóò'
-- Decompose, remove acutes and graves, return first return value.
-- Beware: this decomposes Å to A + ◌̊.
function export.removeAccents(term)
return term:find("[\128-\255]") and mw.ustring.gsub(mw.ustring.toNFD(term), acute_or_grave, "")
or term
end
function export.hasAccents(term)
regex = '[' .. accentedLetters .. ']'
return mw.ustring.match(term, regex) ~= nil
end
return export