local export = {}
local u = mw.ustring.char
local remove_diacritics = u(0x0300) .. u(0x0301) .. u(0x0304) -- grave, acute, macron
local CyrlChars = {
["I"] = "ӏ", ["l"] = "ӏ", ["І"] = "ӏ", ["Ӏ"] = "ӏ", ["ᴴ"] = "ᵸ"
}
function export.makeEntryName(text, lang, sc)
local UTF8_char = "[%z\1-\127\194-\244][\128-\191]*"
if sc == "Cyrl" then -- if script is Cyrillic, correct "false" palochkas and dialectal nasal ᵸ written as Latin ᴴ; not desirable if using another script
text = text:gsub(UTF8_char, CyrlChars)
end
return mw.ustring.gsub(mw.ustring.toNFD(text), "[" .. remove_diacritics .. "]", "") -- decompose and remove appropriate diacritics
end
return export