Module:IPA/templates

local m_IPA = require("Module:IPA")

local export = {}

-- Used for Template:IPA. function export.IPA(frame) local params = { [1] = {list = true, allow_holes = true}, ["n"] = {list = true, allow_holes = true}, ["lang"] = {required = true, default = "und"}, }	local args = require("Module:parameters").process(frame:getParent.args, params) local lang = args["lang"] lang = require("Module:languages").getByCode(lang) or error("The language code \"" .. lang .. "\" is not valid.") -- Temporary test to see which Finnish entries use rather than if lang:getCode == "fi" then require("Module:debug").track("IPA-fi") end local items = {} for i = 1, math.max(args[1].maxindex, args["n"].maxindex) do		local pron = args[1][i] local note = args["n"][i] if pron or note then table.insert(items, {pron = pron, note = note}) end end return m_IPA.format_IPA_full(lang, items) end

-- Used for Template:IPAchar. function export.IPAchar(frame) local params = { [1] = {list = true, allow_holes = true}, ["n"] = {list = true, allow_holes = true}, ["lang"] = {}, -- This parameter is not used and does nothing, but is allowed for futureproofing. }	local args = require("Module:parameters").process(frame:getParent.args, params) local items = {} for i = 1, math.max(args[1].maxindex, args["n"].maxindex) do		local pron = args[1][i] local note = args["n"][i] if pron or note then table.insert(items, {pron = pron, note = note}) end end -- Format return m_IPA.format_IPA_multiple(nil, items) end

return export