Module:zh-glyph/display-phonetic

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 Old Chinese recognised by Zhengzhang (2003).\n==List==" } if mw.ustring.match(mw.title.getCurrentTitle.text, "2$") then i, j = 529, 1056 other = "← Previous page" else i, j = 1, 528 other = "→ Next page" end table.insert(result, "\n " .. other .. " ") 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 "", ",")[1] table.insert(result, "\n|-\n!width=17% style=\"background-color:#D1E8F0;\"|" .. base .. "" .. (och ~= "" and " (" .. och .. ") " or "") .. "\n|style=\"background-color:#FAF9E8;\"|") for derivation in mw.text.gsplit(m_phonetic[base], "") do table.insert(result, " " .. derivation .. "") end end k = k + 1 end table.insert(result, "\n|}\n " .. other .. " ") return table.concat(result) end

return export