Module:IPA/templates

Definition from Wiktionary, the free dictionary
Jump to: navigation, search
The following documentation is located at Module:IPA/templates/documentation. [edit]
See also: subpages of this module.
Text-x-generic with pencil.svg This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local m_IPA = require("Module:IPA")
 
local export = {}
 
-- Used for [[Template:IPAchar]] and [[Template:IPA]].
function export.IPA(frame)
	local args = frame:getParent().args
 
	-- Gather parameters
	local pronunciations = {}
	local notes = {}
	local i = 1
	local pron = args[i]; if pron == "" then pron = nil end
 
	while pron do
		table.insert(pronunciations, pron)
 
		local note = args['n' .. i]; if note == "" then note = nil end
		notes[#pronunciations] = note
 
		i = i + 1
		pron = args[i]; if pron == "" then pron = nil end
	end
 
	-- Format
	if #pronunciations == 0 then
		return "[[Category:Pronunciation templates without a pronunciation]]"
	else
		return m_IPA.IPA_multiple(pronunciations, notes)
	end
end
 
return export