模組:Hani-sortkey/templates
local export = {}
local m_sortkey = require("Module:Hani-sortkey")
local m_sortkey_sandbox = require("Module:Hani-sortkey/sandbox")
local lang = require("Module:languages").getByCode("zh")
local sc = require("Module:scripts").getByCode("Hani")
local function tag(text)
return require("Module:script utilities").tag_text(text, lang, sc)
end
local function link(text)
return require("Module:links").full_link{ term = text, lang = lang, sc = sc, tr = "-" }
end
local a = {}
a[1] = '命裡有時終須有,命裡無時莫強求' -- punctuation
a[2] = 'gas爐' -- non-cjk
a[3] = 'γ粒子' -- non-cjk
a[4] = 'PS/2接口' -- non-cjk + symbols
a[5] = '濕𣲷𣲷' -- exotic unicode
a[6] = '得個……字' -- punctuation?
a[7] = '赛车' -- simplified
function export.showSorting(frame)
local terms = {}
if frame.args[1] then
for i, term in ipairs(frame.args) do
table.insert(terms, mw.text.trim(term))
end
else
terms = a
end
local module = frame.args.sandbox and m_sortkey_sandbox or m_sortkey
local function comp(term1, term2)
return (module.makeSortKey(term1)) < (module.makeSortKey(term2))
end
table.sort(terms, comp)
for i, term in pairs(terms) do
local title = mw.title.new(term)
local exists = title and title.exists
terms[i] = "\n* " .. ( exists and link(term) or tag(term) ) .. " (<code>" .. (module.makeSortKey(term)) .. "</code>)"
end
return table.concat(terms)
end
function export.sortkey(frame)
return (m_sortkey.makeSortKey(frame.args[1], frame.args[2], frame.args[3]))
end
function export.showIDSLinks(frame)
local out = {}
for IDS, sortkey in pairs(mw.loadData("Module:Hani-sortkey/data/unsupported")) do
table.insert(out, "\n* " .. link(IDS) .. " → <code>" .. sortkey .. "</code>")
end
return table.concat(out)
end
return export
分类:
- 各文字排序鍵生成模塊
- 漢字模塊
- 排序鍵生成模塊
- 洋涇浜英語模塊
- 與那國語模塊
- 雷州話模塊
- 南部平話模塊
- 中古蒙古語模塊
- 中部白語模塊
- 跨語言模塊
- 錦語模塊
- 韶州土話模塊
- 壯語模塊
- 閩東語模塊
- 四川話模塊
- 北部平話模塊
- 高句麗語模塊
- 喜界語模塊
- 官話模塊
- 與論語模塊
- 台山話模塊
- 柔若語模塊
- 恰喀拉語模塊
- 布依語模塊
- 儂語模塊
- 泉漳話模塊
- 扎話模塊
- 贛語模塊
- 百濟語模塊
- 上古漢語模塊
- 粵語模塊
- 拉瑪白語模塊
- 客家語模塊
- 晉語模塊
- 澳門皮欽葡萄牙語模塊
- 漢語模塊
- 閩北語模塊
- 日語模塊
- 國頭語模塊
- 水語模塊
- 沖永良部語模塊
- 碧約語模塊
- 鮮卑語模塊
- 宮古語模塊
- 高欄語模塊
- 誒話模塊
- 吳語模塊
- 潮州話模塊
- 文言文模塊
- 八重山語模塊
- 烏桓語模塊
- 八丈語模塊
- 閩南語模塊
- 湘語模塊
- 吐谷渾語模塊
- 德之島語模塊
- 徽語模塊
- 閩中語模塊
- 沖繩語模塊
- 莆仙語模塊
- 中古漢語模塊
- 東干語模塊
- 海南話模塊
- 瓦鄉話模塊
- 南奄美大島語模塊
- 古典藏語模塊
- 達斡爾語模塊
- 岱依語模塊
- 中古越南語模塊
- 阿勒楚喀語模塊
- 柔然語模塊
- 白狼語模塊
- 標敏語模塊
- 羯語模塊
- 北部白語模塊
- 古回鶻語模塊
- 契丹語模塊
- 越南語模塊
- 巴拉語模塊
- 扶餘語模塊
- 古典日語模塊
- 北奄美大島語模塊
- 南部白語模塊
- 拓跋語模塊
- Template interface modules
- 需要說明文檔的模板和模組