Module:Infobox/TeamHist

local m_team = require('Module:Team') local util_args = require('Module:ArgsUtil') local Role = require('Module:Role')

local h = {} local p = {}

function p.teamHist(args) local i = 1 local ret if args['teamhist' .. 1] then local tbl = mw.html.create('table'):addClass('teamhist') while args['teamhist' .. i] do			local tr = tbl:tag('tr') h.printDate(tr, args['teamdate' .. i]) h.printRoleAndTeam(tr, args, i)			i = i + 1 end ret = tostring(tbl) i = i - 1 end local last = { team = args['teamhist' .. i] and m_team.teamlinkname(args['teamhist' .. i]), date = args['teamdate' .. i], role = args['teamrole' .. i], sub = util_args.castAsBool(args['issub' .. i]), trainee = util_args.castAsBool(args['istrainee' .. i]), }	return ret, last end

function h.printDate(tr, date) tr:tag('td') :addClass('teamdate') :wikitext(date) end

function h.printRoleAndTeam(tr, args, i)	local td = tr:tag('td') h.printRole(td, args, i) h.printTeam(td, args['teamhist' .. i]) end

function h.printRole(td, args, i) td:wikitext(Role(args['teamrole' .. i], { sub = util_args.castAsBool(args['issub' .. i]), trainee = util_args.castAsBool(args['istrainee' .. i]), }):image) :wikitext('&#8198;') end

function h.printTeam(td, team) td:wikitext(m_team.rightmediumlinked(team)) end

return p