Module:ltc-pron/table

local export = {} local m_baxter = require("Module:ltc-pron/baxter") local data = mw.loadData("Module:ltc-pron/data")

local people = { Baxter = {"B", "Baxter"}, Karlgren = {"K", "Bernard Karlgren"}, Shao = {"S", "Shao Rongfen"}, Wang = {"W", "Wang Li"}, Pulleyblank = {"Pb", "Edwin Pulleyblank"}, Zhengzhang = {"Zz", "Zhengzhang Shangfang"}, Li = {"Li", "Li Rong"}, Pan = {"Pan", "Pan Wuyun"} }

local function show(N,info,prons) local reconstructions = {} for key,val in pairs(prons) do		table.insert(reconstructions,key) for i=1,N do			info[i].pron[key] = val[i] end end local res = '(Keys: '	for key,val in pairs(people) do		res = res .. val[1] .. '=' .. val[2] .. ', '	end	res = res:sub(1,-3)	res = res .. ')\n {| class="wikitable" \n' .. '! scope=col | # \n' .. '! scope=col | Name \n' .. '! scope=col | B \n' for _,person in ipairs(reconstructions) do res = res .. ' ! scope=col | ' .. people[person][1] .. '\n' end res = res .. '\n' local ncol = #reconstructions + 3 for i=1,N do		if info[i].caption then res = res .. '|-\n' res = res .. '| colspan=' .. ncol .. ' align=center | ' .. info[i].caption .. '\n' end res = res .. '|-\n' res = res .. '! scope=row | ' .. i .. '\n' res = res .. '|' .. table.concat(info[i].names,'/') .. '\n' res = res .. '|' .. info[i].baxter .. '\n' for _,person in ipairs(reconstructions) do res = res .. '|' .. info[i].pron[person] .. '\n' end end res = res .. '|}'	return res end

function export.init(frame) local N = 38 local inits = {} for i=1,N do		inits[i] = {names={}, pron={}} inits[i].baxter = m_baxter.baxter_initial[i] end for key,val in pairs(data.init_type) do		table.insert(inits[val].names,key) end inits[1].caption = "脣音 / bilabial" inits[5].caption = "舌頭音 / alveolar" inits[9].caption = "舌上音 / retroflex" inits[13].caption = "齒頭音 / dental" inits[18].caption = "正齒音 / retroflex?" inits[23].caption = "正齒音 / post-alveolar" inits[28].caption = "? / velar" inits[32].caption = "喉音 / glottal" inits[36].caption = "miscellaneous" return show(N,inits,data.initialConv) end

function export.final(frame) local N = 160 local finals = {} for i=1,N do		finals[i] = {names={}, pron={}} finals[i].baxter = m_baxter.baxter_final[i] end local sources = { data.fin_type, data.fin_type_open, data.fin_type_deng_open, data.final_deng, data.final_openness }	for _,s in ipairs(sources) do		for key,val in pairs(s) do			table.insert(finals[val].names,key) end end finals[1].caption = "通攝 ung" finals[9].caption = "江攝 ong" finals[11].caption = "止攝 i"	finals[22].caption = "遇攝 o"	finals[25].caption = "蟹攝 ai" finals[43].caption = "臻攝 en" finals[61].caption = "山攝 an" finals[89].caption = "效攝 au" finals[94].caption = "果攝 ar" finals[98].caption = "假攝 a"	finals[101].caption = "宕攝 ang" finals[109].caption = "梗攝 eng" finals[133].caption = "曾攝 erng" finals[136].caption = "流攝 eu" finals[139].caption = "深攝 em" finals[143].caption = "咸攝 am" return show(N,finals,data.finalConv) end

return export