模組:yue-pron/hom/list

Ùi Wiktionary

可在模組:yue-pron/hom/list/doc建立此模組的說明文件

local export = {}

function export.show(frame)
	local hom = mw.loadData("Module:yue-pron/hom")
	local link = require("Module:zh").link
	local text = {}
	for jyutping, homophones in pairs(hom) do
		local append = "\n* " .. jyutping .. ": "
		local hom = {}
		for _, homophone in ipairs(homophones) do
			table.insert(hom, link(nil, nil, { homophone, tr = "-" }))
		end
		append = append .. table.concat(hom, ", ")
		table.insert(text, append)
	end
	table.sort(text)
	return 	"A list of the Cantonese homophones available:" .. table.concat(text)
end

return export