มอดูล:ady-sortkey
หน้าตา
- This มอดูล lacks a documentation subpage. Please create it.
- Useful links: subpage list • links • transclusions • testcases • sandbox
local export = {}
local u = mw.ustring.char
local a = u(0xF000)
local b = u(0xF001)
local c = u(0xF002)
local d = u(0xF003)
local e = u(0xF004)
local f = u(0xF005)
local g = u(0xF006)
local h = u(0xF007)
local i = u(0xF008)
local j = u(0xF009)
local k = u(0xF00A)
local monographs = {
["ё"] = "е" .. a
}
local digraphs = {
["гу"] = "г" .. a, ["гъ"] = "г" .. b, ["гь"] = "г" .. d, ["дж"] = "д" .. a, ["дз"] = "д" .. c, ["жъ"] = "ж" .. a, ["жь"] = "ж" .. c, ["ку"] = "к" .. a, ["къ"] = "к" .. b, ["кь"] = "к" .. h, ["кӏ"] = "к" .. i, ["лъ"] = "л" .. a, ["ль"] = "л" .. c, ["лӏ"] = "л" .. d, ["пӏ"] = "п" .. a, ["сӏ"] = "с" .. a, ["тӏ"] = "т" .. a, ["фӏ"] = "ф" .. a, ["ху"] = "х" .. a, ["хъ"] = "х" .. b, ["хь"] = "х" .. d, ["цу"] = "ц" .. a, ["цӏ"] = "ц" .. b, ["чъ"] = "ч" .. a, ["чӏ"] = "ч" .. c, ["шъ"] = "ш" .. a, ["шӏ"] = "ш" .. c, ["ӏу"] = "ӏ" .. a, ["ӏь"] = "ӏ" .. b
}
local trigraphs = {
["гъу"] = "г" .. c, ["джу"] = "д" .. b, ["дзу"] = "д" .. d, ["жъу"] = "ж" .. b, ["къу"] = "к" .. c, ["кхъ"] = "к" .. d, ["къӏ"] = "к" .. f, ["кӏу"] = "к" .. j, ["кӏь"] = "к" .. k, ["лъу"] = "л" .. b, ["лӏу"] = "л" .. e, ["пӏу"] = "п" .. b, ["сӏу"] = "с" .. b, ["тӏу"] = "т" .. b, ["фӏу"] = "ф" .. b, ["хъу"] = "х" .. c, ["цӏу"] = "ц" .. c, ["чъу"] = "ч" .. b, ["чӏу"] = "ч" .. d, ["шъу"] = "ш" .. b, ["шӏу"] = "ш" .. d
}
local tetragraphs = {
["кхъу"] = "к" .. e, ["къӏу"] = "к" .. g
}
function export.makeSortKey(text, lang, sc)
for from, to in pairs(tetragraphs) do
text = mw.ustring.gsub(text, from, to)
end
for from, to in pairs(trigraphs) do
text = mw.ustring.gsub(text, from, to)
end
for from, to in pairs(digraphs) do
text = mw.ustring.gsub(text, from, to)
end
for from, to in pairs(monographs) do
text = mw.ustring.gsub(text, from, to)
end
return text
end
return export