Modulo:IPA/shabloni
Dokumentizo por ica modulo povas kreesar ye Modulo:IPA/shabloni/dokumentado
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},
["qual"] = {list = true, allow_holes = true},
["lang"] = {required = false, default = ""},
}
local err = nil
local args = require("Module:parametri").process(frame:getParent().args, params)
local lang = args["lang"]
lang = require("Module:lingui").getByCode(lang)
if not lang then
if args["lang"] == "" then
err = "Nula linguo-kodexo esis adjuntita.[[Kategorio:Linguo-kodexo mankas/IPA]]"
else
err = "La linguo-kodexo '" .. args["lang"] .. "' ne esas valida.[[Kategorio:Linguo-kodexo esas nevalida/IPA]]"
end
end
-- Temporary test to see which Finnish entries use {{IPA}} rather than {{fi-IPA}}
if lang and (lang:getCode() == "ca" or lang:getCode() == "fi") then
require("Module:debug").track("IPA/" .. lang:getCode())
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]
local qual = args["qual"][i]
if lang and lang:getCode() == "en" and mw.ustring.find(pron, "iə") then
require("Module:debug").track("IPA/ambig")
end
if lang and lang:getCode() == "ps" and mw.ustring.find(pron, "ɤ") then
require("Module:debug").track("IPA/Pashto")
end
if pron or note or qual then
table.insert(items, {pron = pron, note = note, qualifiers = {qual}})
end
end
return m_IPA.format_IPA_full(lang, items, err)
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:parametri").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