Module:IPAc-en/documentation

-- This module generates automatic documentation for Template:IPAc-en.

local data = mw.loadData('Module:IPAc-en/data') local p = {}

local function buildTable(options) local ret = {} ret[#ret + 1] = '{|' .. (options.class and (' class="' .. options.class .. ) or )	if options.headerRow then		for i, header in ipairs(options.headerRow) do			ret[#ret + 1] = '! ' .. header		end	end	if options.rows then		for i, t in ipairs(options.rows) do			ret[#ret + 1] = '|-'			for j, data in ipairs(t) do				ret[#ret + 1] = '| ' .. data			end		end	end	ret[#ret + 1] = '|}'	return table.concat(ret, '\n') end

function p.pronunciation local rows = {} for code, t in pairs(data.pronunciation) do		rows[#rows + 1] = {code, t.text} end table.sort(rows, function (t1, t2)		return t1[1] < t2[1]	end) return buildTable{ class = 'wikitable', headers = {'Code', 'Output'}, rows = rows } end

return p