มอดูล:Lana-sortkey
หน้าตา
- The following documentation is located at มอดูล:Lana-sortkey/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
มอดูลนี้จำเป็นสำหรับการเรียงในหมวดหมู่ และมอดูลภาษาที่ใช้ร่วมกัน คือ มอดูล:nod-sortkey มอดูล:khb-sortkey ซึ่งใช้ใน มอดูล:collation
local export = {}
local u = mw.ustring.char
local minorMarkSet = "([" .. u(0x1A73) .. "-" .. u(0x1A7C) .. "])"
local minorMarks = {
[u(0x1A73)] = "0", [u(0x1A74)] = "0", [u(0x1A75)] = "1", [u(0x1A76)] = "2", [u(0x1A77)] = "3",
[u(0x1A78)] = "4", [u(0x1A79)] = "5", [u(0x1A7A)] = "6", [u(0x1A7B)] = "7", [u(0x1A7C)] = "8"
}
local monographs = {
["[%pᪧ]"] = "", ["ᩓ"] = "ᩃᩯ", ["ᩔ"] = "ᩈ᩠ᩈ",
["ᩕ"] = "᩠ᩁ", ["ᩖ"] = "᩠ᩃ", ["ᩗ"] = "᩠ᩃ",
["ᩘ"] = "᩠ᨦ", ["ᩙ"] = "᩠ᨦ", ["ᩚ"] = "᩠ᨻ",
["ᩜ"] = "᩠ᨾ", ["ᩝ"] = "᩠ᨷ", ["ᩞ"] = "᩠ᩈ", ["ᩤ"] = "ᩣ"
}
local digraphs = {
["([ᨭ-ᨱ])ᩛ"] = "%1᩠ᨮ", ["([ᨲ-ᨶ])ᩛ"] = "%1᩠ᨳ", ["([ᨷ-ᨾ])ᩛ"] = "%1᩠ᨻ"
}
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(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 .. minorKey
end
return export