Module:Hani-sortkey/templates
Appearance
- The following documentation is located at Module:Hani-sortkey/templates/documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • testcases • sandbox
This module contains template-callable functions for demonstrating Module:Hani-sortkey.
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
Categories:
- Sortkey-generating modules by script
- Han script modules
- Sortkey-generating modules
- Chinese Pidgin English modules
- Yonaguni modules
- Daur modules
- Southern Pinghua modules
- Shaojiang Min modules
- Jie modules
- Datian Min modules
- Central Bai modules
- Translingual modules
- Tuoba modules
- Ai-Cham modules
- Shaozhou Tuhua modules
- Zhuang modules
- Gaya modules
- Sichuanese modules
- Northern Pinghua modules
- Goguryeo modules
- Kikai modules
- Vietnamese modules
- Yoron modules
- Taishanese modules
- Zauzou modules
- Kyakala modules
- Sanxiang Min modules
- Nùng modules
- Literary Chinese modules
- Zakhring modules
- Gan modules
- Baekje modules
- Old Chinese modules
- Wuhuan modules
- Lama Bai modules
- Hakka modules
- Zhenan Min modules
- Puxian Min modules
- Yemaek modules
- Jin modules
- Macau Pidgin Portuguese modules
- Okinoerabu modules
- Chinese modules
- Bala modules
- Northern Min modules
- Japanese modules
- Kunigami modules
- Leizhou Min modules
- Dungan modules
- Hachijō modules
- Old Japanese modules
- Miyako modules
- Caolan modules
- E modules
- Wu modules
- Teochew modules
- Hainanese modules
- Min Nan modules
- Tuyuhun modules
- Xianbei modules
- Yaeyama modules
- Xiang modules
- Bouyei modules
- Tokunoshima modules
- Classical Tibetan modules
- Mandarin modules
- Central Min modules
- Longyan Min modules
- Middle Mongol modules
- Cantonese modules
- Eastern Min modules
- Waxiang modules
- Southern Amami Ōshima modules
- Northern Amami Ōshima modules
- Sui modules
- Tày modules
- Middle Vietnamese modules
- Alchuka modules
- Hokkien modules
- Middle Chinese modules
- Biao-Jiao Mien modules
- Okinawan modules
- Bailang modules
- Old Uyghur modules
- Khitan modules
- Hailufeng Min modules
- Biyo modules
- Buyeo modules
- Panyi Bai modules
- Huizhou modules
- Southern Bai modules
- Rouran modules
- Template interface modules