Modul:Laoo-sortkey
Penampilan
- Modul ini kekurangan sublaman pendokumenan. Sila mencipta laman pendokumenan berkaitan.
- Pautan berguna: senarai sublaman • pautan • transklusi • kes ujian • kotak pasir
local export = {}
local u = mw.ustring.char
local a = u(0xF000)
local minorMarkSet = "([" .. u(0xEC8) .. "-" .. u(0xECE) .. "])"
local minorMarks = {
[u(0xEC8)] = "1", [u(0xEC9)] = "2", [u(0xECA)] = "3", [u(0xECB)] = "4", [u(0xECC)] = "5", [u(0xECD)] = "6", [u(0xECE)] = "7"
}
local monographs = {
["[%pໆ]"] = "", ["ຼ"] = "ລ" .. a, ["ຽ"] = "ຍ" .. a, ["ໜ"] = "ຫນ" .. a, ["ໝ"] = "ຫມ" .. a
}
function export.makeSortKey(text, lang, sc)
local minorKey = ""
for mark in mw.ustring.gmatch(text, minorMarkSet) do
minorKey = minorKey .. minorMarks[mark]
end
text = mw.ustring.gsub(text, minorMarkSet, "")
for from, to in pairs(monographs) do
text = mw.ustring.gsub(text, from, to)
end
text = mw.ustring.gsub(text, "([ເແໂໃໄ])([ກ-ຮໞໟ])", "%2%1")
return text .. minorKey
end
return export