Kontent qismiga oʻtish

Modul:def-see

Vikilug‘atdan olingan

Bu modul uchun Modul:def-see/doc nomli hujjat sahifasini yaratishingiz mumkin

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;