Pāriet uz saturu

Modulis:Vieta

Permanently protected module
Vikipēdijas lapa
Dokumentācijas ikona Moduļa dokumentācija[izveidot]
local p = {}

local function makeLink(link, text)
	return "[[" .. link .. "|" .. text .. "]]"
end

function p.main(frame)
	local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Veidne:Vieta'})
	local out = {}

	for i, v in ipairs(args) do
		local link = args[i .. 's'] or v
		out[#out+1] = makeLink(link, v)
	end
	--table.sort(out, function(a, b) return a > b end)

	local tagad
	if args['td'] then
		tagad = ' (tagad ' .. frame:expandTemplate{ title="flag", args = { args['td'] } } .. ')'
	end

	local result = frame:expandTemplate{ title="flaga", args = { args[1], args['flagvar'] } } .. ' ' .. mw.text.listToText( out, ', ', ', ' ) .. (tagad or '')

	return result
end

return p