မဝ်ဂျူ:no-diacritics
မံက်ပြာကတ်
Documentation for this module may be created at မဝ်ဂျူ:no-diacritics/doc
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