--Based on ] → ] → ]
--Frequency lists: https://raw.githubusercontent.com/hugolpz/font2svg-linguist/master/data/cmn-lists.json
--See also: ], ], ]
--Kangxi radicals : https://jsfiddle.net/rmvw3ocb/1/
--Output: ]
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 ].",
"\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, "·")
table.insert(char_info, match(section, "{{Han ety}}") and tick or cross)
table.insert(char_info, "]")
table.insert(char_info, "]")
table.insert(char_info, "]")
table.insert(char_info, "]")
table.insert(char_info, "]")
table.insert(char_info, "]")
table.insert(char_info, "]")
-- table.insert(char_info, "]")
-- table.insert(char_info, "]")
-- table.insert(char_info, "]")
-- table.insert(char_info, "]")
table.insert(char_info, "]")
table.insert(char_info, "]")
-- table.insert(char_info, "]")
-- table.insert(char_info, match(section, "|m=") and tick or cross)
-- table.insert(char_info, match(section, "|m%-s=") and tick or cross)
-- table.insert(char_info, match(section, "|c=") and tick or cross)
-- table.insert(char_info, match(section, "|c%-t=") and tick or cross)
-- table.insert(char_info, match(section, "|g=") and tick or cross)
-- table.insert(char_info, match(section, "pfs=") and tick or cross)
-- table.insert(char_info, match(section, "gd=") and tick or cross)
-- table.insert(char_info, match(section, "|j=") and tick or cross)
-- table.insert(char_info, match(section, "|mb=") and tick or cross)
-- table.insert(char_info, match(section, "|md=") and tick or cross)
-- table.insert(char_info, match(section, "|mn=") and tick or cross)
-- table.insert(char_info, match(section, "|mn%-t=") and tick or cross)
-- table.insert(char_info, match(section, "|w=") and tick or cross)
-- table.insert(char_info, match(section, "|x=") and tick or cross)
break
end
end
table.insert(result, "\n|-\n!"..i.."\n!]\n|"..
(found and table.concat(char_info, "\n|") or "colspan=8|Chinese section not found"))
end
return table.concat(result, "")
end
return export