Submodule of Module:zh-glyph, for generating the tables at Wiktionary:About Chinese/phonetic series and Wiktionary:About Chinese/phonetic series 2.
local export = {}
local m_phonetic = mw.loadData("Module:zh-glyph/phonetic")
local m_och = require("Module:och-pron").retrieve_pron
function export.show(frame)
local phonekeys = {}
for k in pairs(m_phonetic) do table.insert(phonekeys, k) end
table.sort(phonekeys)
local result = { "The table below lists all the phonetic series of ] recognised by ].\n==List==" }
if mw.ustring.match(mw.title.getCurrentTitle().text, "2$") then
i, j = 529, 1056
other = "← ]"
else
i, j = 1, 528
other = "→ ]"
end
table.insert(result, "\n'''''<center>" .. other .. "</center>'''''")
table.insert(result, "\n{| class=\"Hani\" style=\"font-size:150%; border:1px solid #aaa\" cellpadding=\"10\"")
k = 1
for _, base in ipairs(phonekeys) do
if k >= i and k <= j then
local och = mw.text.split(m_och(base, nil, true) or "", ",")
table.insert(result, "\n|-\n!width=17% style=\"background-color:#D1E8F0;\"|]" .. (och ~= "" and "<span class=\"IPA\" style=\"font-size:60%\"> (" .. och .. ")</span>" or "") .. "\n|style=\"background-color:#FAF9E8;\"|")
for derivation in mw.text.gsplit(m_phonetic, "") do
table.insert(result, " ]")
end
end
k = k + 1
end
table.insert(result, "\n|}\n'''''<center>" .. other .. "</center>'''''")
return table.concat(result)
end
return export