Modul:Hani-sortkey/data/serializer
Penampilan
- Modul ini kekurangan sublaman pendokumenan. Sila mencipta laman pendokumenan berkaitan.
- Pautan berguna: laman akar • sublaman • pautan • transklusi • kes ujian • kotak pasir
local insert = table.insert
local export = {}
local byte_lookup = {
[0x07] = "\\a",
[0x08] = "\\b",
[0x09] = "\\t",
[0x0A] = "\\n",
[0x0B] = "\\v",
[0x0C] = "\\f",
[0x0D] = "\\r",
[0x22] = "\\\"",
[0x5C] = "\\\\",
}
local _char = string.char
local function char(ch)
return byte_lookup[ch] or
(ch < 0x20 or ch >= 0x7F) and "\\" .. ("%03d"):format(ch) or
_char(ch)
end
function export.main(checker)
local keys = require("Module:Hani-sortkey/data")
local radicals = require("Module:Hani-sortkey/data/core").radicals
local ret, val = {}
for i = 1, 0x323AF do
if keys[i] then
for r, as in keys[i]:gmatch("(%d+)%.(.*)") do
insert(ret, char(tonumber(r)))
-- Negative additional stroke counts are subtractive (i.e. -1 becomes -9, -2 becomes -8 etc.), so that lower values sort before higher ones (i.e. -3, -2, -1 ...).
as = tonumber(as)
insert(ret, char(as < 0 and 0 - as or as + 10))
end
end
end
-- Compress the result.
for i = 1, #ret do
local ch = ret[i]
if ch:match("^\\%d%d%d$") then
local nxt = ret[i + 1]
if not (nxt and nxt:sub(1, 1):match("%d")) then
ret[i] = ("\\%d"):format(ch:sub(2))
end
end
end
return table.concat(ret)
end
return export
Kategori:
- Modul Sortkey-generating mengikut tulisan
- Tulisan Han modules
- Modul Sortkey-generating
- Chinese Pidgin English modules
- Leizhou Min modules
- Southern Pinghua modules
- Jie modules
- Datian Min modules
- Central Bai modules
- Translingual modules
- Tuoba modules
- Ai-Cham modules
- Shaozhou Tuhua modules
- Zhuang modules
- Min Timur modules
- Sichuanese modules
- Northern Pinghua modules
- Goguryeo modules
- Vietnam modules
- Taishanese modules
- Zauzou modules
- Kyakala modules
- Sanxiang Min modules
- Nùng modules
- Hokkien modules
- Zakhring modules
- Gan modules
- Baekje modules
- Cina Kuno modules
- Kantonis modules
- Lama Bai modules
- Hakka modules
- Zhenan Min modules
- Jin modules
- Macau Pidgin Portuguese modules
- Cina modules
- Min Utara modules
- Jepun modules
- Caolan modules
- E modules
- Wu modules
- Teochew modules
- Tuyuhun modules
- Xianbei modules
- Puxian Min modules
- Xiang modules
- Hachijō modules
- Min Nan modules
- Bouyei modules
- Mongol Pertengahan modules
- Biyo modules
- Longyan Min modules
- Huizhou modules
- Wuhuan modules
- Central Min modules
- Waxianghua modules
- Tibet Klasik modules
- Daur modules
- Mandarin modules
- Tày modules
- Middle Vietnamese modules
- Alchuka modules
- Dungan modules
- Literary Chinese modules
- Biao-Jiao Mien modules
- Sui modules
- Bailang modules
- Middle Chinese modules
- Khitan modules
- Hailufeng Min modules
- Bala modules
- Buyeo modules
- Panyi Bai modules
- Hainanese modules
- Southern Bai modules
- Rouran modules
- Modul Data mengikut tulisan
- Modul Data
- Tulisan Han data modules
- Chinese Pidgin English data modules
- Leizhou Min data modules
- Southern Pinghua data modules
- Jie data modules
- Datian Min data modules
- Central Bai data modules
- Translingual data modules
- Tuoba data modules
- Ai-Cham data modules
- Shaozhou Tuhua data modules
- Zhuang data modules
- Min Timur data modules
- Sichuanese data modules
- Northern Pinghua data modules
- Goguryeo data modules
- Vietnam data modules
- Taishanese data modules
- Zauzou data modules
- Kyakala data modules
- Sanxiang Min data modules
- Nùng data modules
- Hokkien data modules
- Zakhring data modules
- Gan data modules
- Baekje data modules
- Cina Kuno data modules
- Kantonis data modules
- Lama Bai data modules
- Hakka data modules
- Zhenan Min data modules
- Jin data modules
- Macau Pidgin Portuguese data modules
- Cina data modules
- Min Utara data modules
- Jepun data modules
- Caolan data modules
- E data modules
- Wu data modules
- Teochew data modules
- Tuyuhun data modules
- Xianbei data modules
- Puxian Min data modules
- Xiang data modules
- Hachijō data modules
- Min Nan data modules
- Bouyei data modules
- Mongol Pertengahan data modules
- Biyo data modules
- Longyan Min data modules
- Huizhou data modules
- Wuhuan data modules
- Central Min data modules
- Waxianghua data modules
- Tibet Klasik data modules
- Daur data modules
- Mandarin data modules
- Tày data modules
- Middle Vietnamese data modules
- Alchuka data modules
- Dungan data modules
- Literary Chinese data modules
- Biao-Jiao Mien data modules
- Sui data modules
- Bailang data modules
- Middle Chinese data modules
- Khitan data modules
- Hailufeng Min data modules
- Bala data modules
- Buyeo data modules
- Panyi Bai data modules
- Hainanese data modules
- Southern Bai data modules
- Rouran data modules
- Templat dan modul yang memerlukan pendokumenan