Module:Nyms
Appearance
local export = {}
local m_languages = require("Module:languages")
local m_links = require("Module:links")
function export.nyms(frame)
local params = {
[1] = {required = true, default = "und"},
[2] = {list = true, allow_holes = true, required = true},
["alt"] = {list = true, allow_holes = true},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local lang = m_languages.getByCode(args[1]) or m_languages.err(args[1], 1)
local maxindex = math.max(args[2].maxindex, args["alt"].maxindex)
for i = 1, maxindex do
args[2][i] = m_links.full_link({lang = lang, term = args[2][i], alt = args["alt"][i]})
end
return "<span class=\"nyms " .. frame.args[1] .. "\">'''[[Wiktionary:Semantic relations|" .. mw.getContentLanguage():ucfirst(frame.args[1]) .. "]]''': " .. table.concat(args[2], ", ") .. "</span>"
end
return export