No edit summary |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
⚫ | |||
local m_team = require('Module:Team') |
local m_team = require('Module:Team') |
||
local util_args = require('Module:ArgsUtil') |
local util_args = require('Module:ArgsUtil') |
||
⚫ | |||
+ | local h = {} |
||
local p = {} |
local p = {} |
||
− | function p.teamHist( |
+ | function p.teamHist(args) |
local i = 1 |
local i = 1 |
||
+ | local ret |
||
if args['teamhist' .. 1] then |
if args['teamhist' .. 1] then |
||
local tbl = mw.html.create('table'):addClass('teamhist') |
local tbl = mw.html.create('table'):addClass('teamhist') |
||
while args['teamhist' .. i] do |
while args['teamhist' .. i] do |
||
− | tbl:tag('tr') |
+ | local tr = tbl:tag('tr') |
⚫ | |||
⚫ | |||
+ | h.printRoleAndTeam(tr, args, i) |
||
⚫ | |||
⚫ | |||
− | :done() |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
i = i + 1 |
i = i + 1 |
||
end |
end |
||
− | + | ret = tostring(tbl) |
|
i = i - 1 |
i = i - 1 |
||
end |
end |
||
+ | local last = { |
||
⚫ | |||
− | team = m_team.teamlinkname(args['teamhist' .. i]), |
+ | team = args['teamhist' .. i] and m_team.teamlinkname(args['teamhist' .. i]), |
date = args['teamdate' .. i], |
date = args['teamdate' .. i], |
||
− | role = args['teamrole' .. i] |
+ | role = args['teamrole' .. i], |
+ | sub = util_args.castAsBool(args['issub' .. i]), |
||
+ | trainee = util_args.castAsBool(args['istrainee' .. i]), |
||
} |
} |
||
⚫ | |||
+ | end |
||
+ | |||
+ | function h.printDate(tr, date) |
||
⚫ | |||
⚫ | |||
+ | :wikitext(date) |
||
+ | end |
||
+ | |||
+ | function h.printRoleAndTeam(tr, args, i) |
||
⚫ | |||
+ | h.printRole(td, args, i) |
||
+ | h.printTeam(td, args['teamhist' .. i]) |
||
+ | end |
||
+ | |||
+ | function h.printRole(td, args, i) |
||
⚫ | |||
+ | sub = util_args.castAsBool(args['issub' .. i]), |
||
+ | trainee = util_args.castAsBool(args['istrainee' .. i]), |
||
+ | }):image()) |
||
⚫ | |||
+ | end |
||
+ | |||
+ | function h.printTeam(td, team) |
||
⚫ | |||
end |
end |
||
Latest revision as of 17:13, 27 December 2020
Edit the documentation or categories for this module.
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(' ')
end
function h.printTeam(td, team)
td:wikitext(m_team.rightmediumlinked(team))
end
return p