Zum Inhalt springen

Modul:IPA/templates

Vun Wiktionary
Dissen Vörlaag hef dokumentatsie neudig.
Maak de dokumentatsie veur dissen modul ovver t doel en gebroek op de dokumentatsieziede.

local m_IPA = require("Modul:IPA")
 
local export = {}
 
-- Used for [[Vörlaag:IPA]].
function export.IPA(frame)
	local args = frame:getParent().args
	local lang = args["lang"] or (mw.title.getCurrentTitle().nsText == "Vörlaag" and "und") or error("Language code has not been specified. Please pass the parameter \"lang\" to the template.")
	lang = require("Modul:languages").getByCode(lang) or error("Den Spraakkood \"" .. lang .. "\" gevt et nich.")
 
	-- 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
 
	return m_IPA.format_IPA_full(lang, pronunciations, notes)
end
 
-- Used for [[Vörlaag:IPAchar]].
function export.IPAchar(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
	return m_IPA.format_IPA_multiple(lang, pronunciations, notes)
end
 
return export