Module:yue-pron/hom/list

From Wiktionary, the free dictionary
Jump to navigation Jump to search
This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}

function export.show(frame)
	local hom = mw.loadData("Module:yue-pron/hom")
	local link = require("Module:zh/link").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