وحدة:IPA/templates
< وحدة:IPA
يمكن إنشاء صفحة توثيق الوحدة في وحدة:IPA/templates/شرح
local m_IPA = require("Module:IPA")
local export = {}
-- Used for [[قالب: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.")
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 [[قالب: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