Module:User:Yug/char-summary
- This module lacks a documentation subpage. You may create it.
- Useful links: root page • root page’s subpages • links • transclusions • testcases • user page • user talk page • userspace
This is a private module sandbox of Yug, for their own experimentation. Items in this module may be added and removed at Yug's discretion; do not rely on this module's stability.
--Based on [[Module:User:Wyang/char-summary]] → [[Module:User:Justinrleung/char-summary]] → [[Module:User:Yug/char-summary]]
--Frequency lists: https://raw.githubusercontent.com/hugolpz/font2svg-linguist/master/data/cmn-lists.json
--See also: [[:Commons:User:Yug/hz2]], [[:Commons:User:Yug/MOOC]], [[:Commons:Template:Hanzigallery]]
--Kangxi radicals : https://jsfiddle.net/rmvw3ocb/1/
--Output: [[User:Yug/kangxi-rads]]
local export = {}
local match = mw.ustring.match
local rads_list = "⼀⼁⼂⼃⼄⼅⼆⼇⼈⼉⼊⼋⼌⼍⼎⼏⼐⼑⼒⼓⼔⼕⼖⼗⼘⼙⼚⼛⼜⼝⼞⼟⼠⼡⼢⼣⼤⼥⼦⼧⼨⼩⼪⼫⼬⼭⼮⼯⼰⼱⼲⼳⼴⼵⼶⼷⼸⼹⼺⼻⼼⼽⼾⼿⽀⽁⽂⽃⽄⽅⽆⽇⽈⽉⽊⽋⽌⽍⽎⽏⽐⽑⽒⽓⽔⽕⽖⽗⽘⽙⽚⽛⽜⽝⽞⽟⽠⽡⽢⽣⽤⽥⽦⽧⽨⽩⽪⽫⽬⽭⽮⽯⽰⽱⽲⽳⽴⽵⽶⽷⽸⽹⽺⽻⽼⽽⽾⽿⾀⾁⾂⾃⾄⾅⾆⾇⾈⾉⾊⾋⾌⾍⾎⾏⾐⾑⾒⾓⾔⾕⾖⾗⾘⾙⾚⾛⾜⾝⾞⾟⾠⾡⾢⾣⾤⾥⾦⾧⾨⾩⾪⾫⾬⾭⾮⾯⾰⾱⾲⾳⾴⾵⾶⾷⾸⾹⾺⾻⾼⾽⾾⾿⿀⿁⿂⿃⿄⿅⿆⿇⿈⿉⿊⿋⿌⿍⿎⿏⿐⿑⿒⿓⿔⿕"
local char_list = "一丨丶丿乙亅二亠人儿入八冂冖冫几凵刀力勹匕匚匸十卜卩厂厶又口囗土士夂夊夕大女子宀寸小尢尸屮山巛工己巾干幺广廴廾弋弓彐彡彳心戈戶手支攴文斗斤方无日曰月木欠止歹殳毋比毛氏气水火爪父爻爿片牙牛犬玄玉瓜瓦甘生用田疋疒癶白皮皿目矛矢石示禸禾穴立竹米糸缶网羊羽老而耒耳聿肉臣自至臼舌舛舟艮色艸虍虫血行衣襾見角言谷豆豕豸貝赤走足身車辛辰辵邑酉釆里金長門阜隶隹雨靑非面革韋韭音頁風飛食首香馬骨高髟鬥鬯鬲鬼魚鳥鹵鹿麥麻黃黍黑黹黽鼎鼓鼠鼻齊齒龍龜龠"
function export.main(frame)
local result = {
"Summary of entries for the most common Chinese characters. See [[Module:User:Yug/char-summary]].",
"\n{| class=\"wikitable sortable\" style=\"text-align:center; font-size:120%\"",
"\n|-\n!n!!Character!!Sources!!Han etym!!Oracle bone!!Bronze!!Bamboo and silk!!Big seal!!Small seal!!Clerical-han!!Kangxi!!Red!!Order",
-- !!Mandarin!!Sichuanese!!Cantonese!!Taishanese!!Gan!!Sixian!!Meixian!!Jin!!Min Bei!!Min Dong!!Hokkien!!Teochew!!Wu!!Xiang"
}
local tick, cross = "<span style=\"color:green\">✓</span>", "<span style=\"color:red\">✘</span>"
local i = 0
for cp in mw.ustring.gcodepoint(char_list) do
local found = false
i = i + 1
local char_info = {}
local ch = mw.ustring.char(cp)
local content = mw.title.new(ch):getContent()
local sections = mw.text.split(content, '%-%-%-%-')
for _, section in ipairs(sections) do
if match(section, "==Chinese==") then
found = true
table.insert(char_info, "[https://xiaoxue.iis.sinica.edu.tw/yanbian?char=" .. ch .. " snc]·[https://hanziyuan.net/#" .. ch .. " hzy]")
table.insert(char_info, match(section, "{{Han ety[lm]}}") and tick or cross)
table.insert(char_info, "[[File:" .. ch .. "-oracle.svg|30px]]")
table.insert(char_info, "[[File:" .. ch .. "-bronze.svg|30px]]")
table.insert(char_info, "[[File:" .. ch .. "-silk.svg|30px]]")
table.insert(char_info, "[[File:" .. ch .. "-bigseal.svg|30px]]")
table.insert(char_info, "[[File:" .. ch .. "-seal.svg|30px]]")
table.insert(char_info, "[[File:" .. ch .. "-clerical-han.svg|30px]]")
table.insert(char_info, "[[File:" .. ch .. "-mingti-kangxi.svg|30px]]")
-- table.insert(char_info, "[[File:" .. ch .. "-songti.svg|30px]]")
-- table.insert(char_info, "[[File:" .. ch .. "-kaishu.svg|30px]]")
-- table.insert(char_info, "[[File:" .. ch .. "-xinshu.svg|30px]]")
-- table.insert(char_info, "[[File:" .. ch .. "-bw.png|30px]]")
table.insert(char_info, "[[File:" .. ch .. "-red.png|30px]]")
table.insert(char_info, "[[File:" .. ch .. "-order.gif|30px]]")
-- table.insert(char_info, "[[:Media:" .. ch .. "-order.gif|a]]")
-- table.insert(char_info, match(section, "|m=[^%s|]") and tick or cross)
-- table.insert(char_info, match(section, "|m%-s=[^%s|]") and tick or cross)
-- table.insert(char_info, match(section, "|c=[^%s|]") and tick or cross)
-- table.insert(char_info, match(section, "|c%-t=[^%s|]") and tick or cross)
-- table.insert(char_info, match(section, "|g=[^%s|]") and tick or cross)
-- table.insert(char_info, match(section, "pfs=[^%s|]") and tick or cross)
-- table.insert(char_info, match(section, "gd=[^%s|]") and tick or cross)
-- table.insert(char_info, match(section, "|j=[^%s|]") and tick or cross)
-- table.insert(char_info, match(section, "|mb=[^%s|]") and tick or cross)
-- table.insert(char_info, match(section, "|md=[^%s|]") and tick or cross)
-- table.insert(char_info, match(section, "|mn=[^%s|]") and tick or cross)
-- table.insert(char_info, match(section, "|mn%-t=[^%s|]") and tick or cross)
-- table.insert(char_info, match(section, "|w=[^%s|]") and tick or cross)
-- table.insert(char_info, match(section, "|x=[^%s|]") and tick or cross)
break
end
end
table.insert(result, "\n|-\n!"..i.."\n![["..ch.."]]\n|"..
(found and table.concat(char_info, "\n|") or "colspan=8|Chinese section not found"))
end
return table.concat(result, "")
end
return export