local export = {}
local u = mw.ustring.char
local a, b, c, d, e = u(0xF000), u(0xF001), u(0xF002), u(0xF003), u(0xF004)
local oneChar = {
= "е" .. a
}
local twoChars = {
= "а" .. a, = "г" .. a, = "г" .. b, = "к" .. a, = "к" .. b, = "к" .. c, = "к" .. d, = "о" .. a, = "п" .. a, = "п" .. b, = "с" .. a, = "т" .. a, = "т" .. b, = "х" .. a, = "х" .. b, = "х" .. c, = "х" .. e, = "ц" .. a, = "ц" .. b, = "ч" .. a, = "ч" .. b
}
local fourChars = {
= "х" .. d
}
function export.makeSortKey(text, lang, sc)
text = mw.ustring.lower(text)
for from, to in pairs(fourChars) do
text = mw.ustring.gsub(text, from, to)
end
for from, to in pairs(twoChars) do
text = mw.ustring.gsub(text, from, to)
end
return mw.ustring.upper(mw.ustring.gsub(text, ".", oneChar))
end
return export