local export = {}
local m_link = require('Module:links')
local m_quotations = require('Module:Quotations')
local m_languages = require("Module:languages")
function export.show(frame)
local list_with_holes = { list = true, allow_holes = true }
local params = {
[1] = { required = true },
[2] = { required = true, list = true, allow_holes = true },
["tr"] = list_with_holes,
["ts"] = list_with_holes,
["t"] = list_with_holes,
["pos"] = list_with_holes,
["gloss"] = { alias_of = "t" },
["year"] = list_with_holes,
["author"] = list_with_holes,
["work"] = list_with_holes,
["chap"] = list_with_holes,
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local lang = args[1] and m_languages.getByCode(args[1])
local quotes = {}
local reference = {}
local maxindex = math.max(args[2].maxindex, args.tr.maxindex, args.ts.maxindex)
for i = 1, maxindex do
term = m_link.full_link{
lang = lang,
sc = sc,
alt = args[2][i],
tr = args.tr[i],
ts = args.ts[i],
gloss = args.t[i],
pos = args.pos[i],
}
work = m_quotations.Create{
args[1], nil, args.work[i], args.chap[i],
form = "work",
}
if (args.work[i] or args.chap[i]) then
table.insert(quotes, work .. ": " .. term)
else
table.insert(quotes, term);
end
end
local output = { table.concat(quotes, '</li><li>') }
return '<span class="vsSwitcher vsToggleCategory-quotations" data-vs-showtext="quotations ▼" data-vs-hidetext="quotations ▲">'
..'<span class="vsToggleElement vsButtonText-quotations" style="display:inline-block;"> </span>'
..'<ul class="vsHide"><li>' .. table.concat(output) .. '</li></ul>'
..'</span>'
end
return export