Mô tổ:Zh-sortkey/templates
Vẻ ngoài
- Dưới đâyLời thuyết minh đươngNằm ởModule:Zh-sortkey/templates/doc.[Biên tập]
- Tương quan liên kết:Căn giao diện•Căn giao diện tử giao diện•Bổn giao diện tử giao diện•Liên nhập•Khảm nhập bao hàm•Thí nghiệm dùng lệ•Hộp cát
Bổn mô khối bao hàm dùng với biểu thịModule:Zh-sortkeyNhưng cung khuôn mẫu thuyên chuyển hàm số.
localexport={}
localm_sortkey=require("Module:zh-sortkey")
localm_sortkey_sandbox=require("Module:zh-sortkey/sandbox")
locallang=require("Module:languages").getByCode("zh")
localsc=require("Module:scripts").getByCode("Hani")
localfunctiontag(text)
returnrequire("Module:script utilities").tag_text(text,lang,sc)
end
localfunctionlink(text)
returnrequire("Module:links").full_link{term=text,lang=lang,sc=sc}
end
locala={}
a[1]=' mệnh lí hữu thời chung tu hữu, mệnh lí vô thời mạc cưỡng cầu '-- punctuation
a[2]='gas lò '-- non-cjk
a[3]='γ hạt '-- non-cjk
a[4]='PS/2 tiếp lời '-- non-cjk + symbols
a[5]=' ướt 𣲷𣲷'-- exotic unicode
a[6]=' đến cái…… Tự '-- punctuation?
a[7]=' đua xe '-- simplified
functionexport.showSorting(frame)
localterms={}
ifframe.args[1]then
fori,terminipairs(frame.args)do
table.insert(terms,mw.text.trim(term))
end
else
terms=a
end
localmodule=frame.args.sandboxandm_sortkey_sandboxorm_sortkey
localfunctioncomp(term1,term2)
returnmodule.makeSortKey(term1)<module.makeSortKey(term2)
end
table.sort(terms,comp)
fori,terminpairs(terms)do
localtitle=mw.title.new(term)
localexists=titleandtitle.exists
terms[i]="\n* "..(existsandlink(term)ortag(term)).."(<code>"..module.makeSortKey(term).."</code>)"
end
returntable.concat(terms)
end
functionexport.showDataModules(frame)
localchars={}
localcodepoints={}
localmodules={}
forcharinmw.ustring.gmatch(frame.args[1],".")do
table.insert(chars,char)
table.insert(codepoints,mw.ustring.codepoint(char))
table.insert(modules,m_sortkey.getData(char,true)or"")
end
localout={}
fori,charinipairs(chars)do
localexists=mw.title.new(char).exists
table.insert(out,"\n* "..(existsandlink(char)ortag(char)).."( [["..modules[i].."]] trung"..codepoints[i]..")")
end
returntable.concat(out)
end
functionexport.sortkey(frame)
returnm_sortkey.makeSortKey(frame.args[1],frame.args[2],frame.args[3])
end
functionexport.showIDSLinks(frame)
localout={}
forIDS,sortkeyinpairs(mw.loadData("Module:zh-sortkey/data/unsupported"))do
table.insert(out,"\n* "..link(IDS).."→ <code>"..sortkey.."</code>")
end
returntable.concat(out)
end
returnexport