มอดูล:Thai-sortkey
หน้าตา
- The following documentation is located at มอดูล:Thai-sortkey/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
มอดูลนี้จำเป็นสำหรับ มอดูล:collation ส่วนการเรียงในหมวดหมู่ไม่ต้องใส่ เพราะระบบ thwikt เรียง Thai ให้อยู่แล้ว
ดูเพิ่มเติม มีเดียวิกิ:Thai-sortkey.js สำหรับรุ่นจาวาสคริปต์
local export = {}
local u = mw.ustring.char
local minorMarkSet = "([" .. u(0xE47) .. "-" .. u(0xE4E) .. u(0x302) .. u(0x304) .. u(0x331) .. "])"
local minorMarks = {
[u(0xE47)] = "0", [u(0xE48)] = "1", [u(0xE49)] = "2", [u(0xE4A)] = "3", [u(0xE4B)] = "4",
[u(0xE4C)] = "5", [u(0xE4D)] = "6", [u(0xE4E)] = "7", [u(0x302)] = "8", [u(0x304)] = "9", [u(0x331)] = "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, "")
text = mw.ustring.gsub(text, "[%pๆ]", "")
text = mw.ustring.gsub(text, "([เแโใไ])(ʼ?[ก-ฮ])", "%2%1")
return text .. minorKey
end
return export