Documentation for this module may be created at Module:Participants list team/doc
local getArgs = require('Module:Arguments').getArgs
local Links = require('Module:Links')
local Flags = require('Module:Flags')
local Participants = {}
function Participants.main(frame)
local args = getArgs(frame)
local currentTitleSplit = mw.text.split(mw.title.getCurrentTitle().text, '/')
local container = mw.html.create('div')
:addClass('p-team-container')
local teamsize = args.teamsize
local currentTitle = mw.title.getCurrentTitle().text
local gameCategory = mw.text.split(currentTitle, '/')[1]
for key, value in ipairs (args) do
local pValues = mw.text.jsonDecode(value)
local participant = mw.html.create('div')
if pValues.team then
local teamName = mw.html.create('div')
:wikitext('[['.. gameCategory .. '/' .. pValues.team ..']]')
participant:node(teamName)
end
local relativeParent = mw.html.create('div')
:addClass('team-list')
local playerList = mw.html.create('table')
:addClass('table-bordered list')
local players = {}
for i = 1, teamsize, 1 do
if pValues['p'.. i] then
players['p'.. i] = mw.html.create('tr')
:node(mw.html.create('th'):wikitext(i))
:node(mw.html.create('td'):wikitext('[['.. pValues['p'.. i] ..']]'))
playerList:node(players['p'.. i])
end
end
if pValues.c then
local coach = mw.html.create('tr')
:node(mw.html.create('th'):node(mw.html.create('abbr'):attr('title', 'coach'):wikitext('C')))
:node(mw.html.create('td'):wikitext(pValues.c))
playerList:node(coach)
end
relativeParent:node(playerList)
local logo = mw.html.create('div')
if pValues.image then
logo:node('[[File:' .. pValues.image .. '|]]')
else
logo:node('[[File:Participant_team_placeholder.jpg]]')
end
container:node(participant:node(relativeParent)):node(logo)
end
return container
end
return Participants