Module:def-see
Jump to navigation
Jump to search
- The following documentation is located at Module:def-see/documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module is called by {{def-see}}
.
local export = {};
local full_link = require("Module:links").full_link;
local lang_code = require("Module:languages").getByCode;
local sc_code = require("Module:scripts").getByCode;
function export.main (frame)
local args = require("Module:parameters").process(frame:getParent().args, {
[1] = {required = true, default = "und"},
['sc'] = {},
[2] = {list = true, required = true},
['alt'] = {list = true, allow_holes = true},
['id'] = {list = true, allow_holes = true},
['g'] = {list = true, allow_holes = true},
['tr'] = {list = true, allow_holes = true},
['ts'] = {list = true, allow_holes = true},
['t'] = {list = true, allow_holes = true},
['pos'] = {list = true, allow_holes = true},
['lit'] = {list = true, allow_holes = true},
});
local lang = lang_code(args[1]);
local sc; if (args.sc) then sc = sc_code(args.sc); end
local links = {};
for i, v in ipairs(args[2]) do
links[i] = full_link({
lang = lang,
sc = sc,
term = v,
alt = args.alt[i],
id = args.id[i],
genders = args.g[i],
tr = args.tr[i],
ts = args.ts[i],
gloss = args.t[i],
pos = args.pos[i],
lit = args.lit[i],
}, "term");
end
local s = links[1];
if (#links > 1) then
for i = 2, #links - 1 do
s = s .. ', ' .. links[i];
end
s = s .. ' and ' .. links[#links];
end
return frame:expandTemplate { title = "non-gloss definition", args = {
'See ' .. s .. '.'
} };
end
return export;