Jump to content

Module:Team appearances list

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Izkala (talk | contribs) at 12:57, 31 May 2015 (This module produces a horizontal list of team appearances at a specified sports competition; each item is in the format: [[<team> at the <year> <competition>|<year]]. The module requires the following parameters: begin_year, interval, team and competitio). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

-- This module produces a horizontal list of team appearances at a specified
-- sports competition; each item is in the format:
-- [[<team> at the <year> <competition>|<year]]. The module requires the
-- following parameters: begin_year, interval, team and competition. end_year
-- may be optionally defined if the sports competition is now defunct.

local p = {}
local hlist = require('Module:List').horizontal

function p.main(frame)
	local args = require('Module:Arguments').getArgs(frame)
	return p._main(args)
end
 
function p._main(args)
	local appearances = {}
	for i = args.begin_year, (args.end_year or os.date('%Y')+args.interval), 
			args.interval do
		table.insert(appearances, mw.ustring.format('[[%s at the %s %s|%s]]',
			args.team, i, args.competition, i))
	end
	return hlist(appearances)
end

return p