ข้ามไปเนื้อหา

มอดูล:Cyrs-entryname

จาก วิกิพจนานุกรม พจนานุกรมเสรี

local export = {}
local u = mw.ustring.char

local remove_diacritics = u(0x0300) .. u(0x0301) ..  u(0x0308) .. u(0x0484) .. "-" .. u(0x0486) -- varia, oksia, trema, kamora, dasia, psili

function export.makeEntryName(text, lang, sc)
	if lang == "zle-ort" then text = mw.ustring.gsub(text, "і" .. u(0x0308), mw.ustring.toNFC) end -- remove trema other than for "ї" in Old Ruthenian
	return mw.ustring.toNFC(mw.ustring.gsub(text, "[" .. remove_diacritics .. "]", "")) -- remove other diacritics, then recompose again
end

return export