Module:Sports rbr table/matchup
Apparence
La documentation de ce module est générée par le modèle {{Documentation module}}.
Les éditeurs peuvent travailler dans le bac à sable (créer).
Voir les statistiques d'appel depuis le wikicode sur l'outil wstat et les appels depuis d'autres modules.
local pp = {}
local rdrobin, multirb
local tblkey = {
['WL'] = 'V/D',
['WLF'] = 'V/FV/L/FD',
['BSK'] = 'V/PV/L/PD',
['BSKF'] = 'V/PV/FV/D/PD/FD',
['FBR'] = 'V/N/D',
['FBRF'] = 'V/FV/N/D/FD',
}
function pp.defaults(args,yesno,color_map)
rdrobin = tonumber(args['rdrobin'] or 1)
multirb = rdrobin >= 2
local legendtype = args['legend_style'] or 'WL'
local opt_colors = {
V = { 'Victoire', color_map.blue1 },
N = { 'Nul', color_map.yellow2 },
D = { 'Défaite', color_map.red1 },
PV = { 'Victoire après prolongation', color_map.blue3 },
PD = { 'Défaite après prolongation', color_map.red3 },
FV = { 'Victoire par forfait', '#5CDEFD' },
FD = { 'Défaite par forfait', '#D98080' }
}
local colors = mw.text.split(mw.ustring.gsub(tblkey[legendtype], '</', '<FORWARDSLASH'), '%s*/%s*')
for k=1,#colors do
local legend = colors[k]
args['color_' .. legend] = opt_colors[legend][2]
args['text_' .. legend] = opt_colors[legend][1]
end
args['header'] = 'Équipe ╲ Match'
args['legendpos'] = 'b'
args['legendorder'] = args['legendorder'] or 'V/PV/FV/N/D/PD/FD'
return args
end
function pp.addtl_args(k)
return k == 'style' or k == 'legend_style' or k == 'rdrobin' or k == 'ticon'
end
function pp.get_argvalues_for_maxround(args,x,del)
del = del or ''
return args['pos' .. del .. x] or args['res' .. del .. x] or ''
end
function pp.get_rounds_or_maxrounds(rounds,maxrounds,args,team_list)
if multirb then return (#team_list - 1) * rdrobin else return #team_list - 1 end
end
function pp.header(root,args,labels,maxrounds,navbar,team_list,firstround)
local row = root:tag('tr')
row:tag('th')
:css('white-space', 'nowrap'):cssText('style')
:wikitext((not multirb and (args['header'] or labels['teamround']) or ' ') .. navbar)
-- if not a single round-robin
if (multirb) then
for r=1,rdrobin do
row:tag('th')
:addClass('sportsrbrtable-rnd')
:attr('scope', 'col')
:attr('colspan', #team_list - 1)
:wikitext('Journée ' .. r)
end
row = root:tag('tr')
row:tag('th')
:css('white-space', 'nowrap'):cssText('style')
:wikitext(args['header'] or labels['teamround'])
end
for r=1,maxrounds do
row:tag('th')
:addClass('sportsrbrtable-rnd')
:attr('scope', 'col')
:css('width', (args['ticon'] == nil) and (args['rdwidth'] or '35px') or nil)
:wikitext(args['rnd' .. (r + (firstround - 1))] or (r + (firstround - 1)))
end
return row
end
function pp.rowtext(frame,args,legend_symbols,posrt,opprt)
if args['ticon'] then return frame:expandTemplate{ title = args['ticon'], args = { opprt } } else return opprt end
return legend_symbols[posrt] or posrt
end
function pp.rowbg(posrc,opprt)
return (opprt ~= '') and posrc or ''
end
function pp.legendtext(legend_symbols,v)
return ' '
end
return pp