Module:Sports rbr table/matchup
Jump to navigation
Jump to search
Usage
Basic usage
This module is an extension of Module:Sports rbr table, showing matchups and head-to-head results table.
In it's simplest form, only several parameters need to be used to build a table.
What you type | <syntaxhighlight lang=moin> Source: [<span title="Script error: No such module "delink".">citation needed] </syntaxhighlight>
= Win; = OT win; = Loss; = OT loss |
What it looks like | Source: [<span title="Script error: No such module "delink".">citation needed]
= Win; = OT win; = Loss; = OT loss |
Parameters
General parameters
Style–specific parameters
Style–specific parameters | |
---|---|
Parameter | Description |
opp1 oropp_ABC |
The forward slash (/ ) delimited list of round-by-round opponents of the team. For example, |opp1=DEF/GHI/JKL/MNO/PQR/STU/VWX for seven games.
|
legend_style |
Legend colors and text to display based on usage. The default is WL . See the legend section below for more information on legend syntax.
|
rdrobin |
Number of times each team plays all other teams. The default is 1 (i.e. single round-robin).
|
ticon |
The name of the template to trigger to show teams' identity (e.g. three-letter codes, team colors, team icons) |
Legend
Key
The keys below correspond to res1
or res_ABC
usage: the forward slash (/
) delimited list of matchup results of the team.
For example, |res1=W/OTL/FW/W/L
for five games with the round-by-round results of win, OT loss, win by forfeit, win, loss.
Key | Legend color |
---|---|
W |
Win |
D |
Draw |
L |
Loss |
OTW |
OT win |
OTL |
OT loss |
FW |
Win by forfeit |
FL |
Loss by forfeit |
Style
Legend colors and text will be displayed based on usage.
Legend style | WL
|
WLF
|
BSK
|
BSKF
|
FBR
|
FBRF
|
---|---|---|---|---|---|---|
Colors |
|
|
|
|
|
|
Examples
Example 1: Cells contain literal texts
What you type | <syntaxhighlight lang=moin> Source: [<span title="Script error: No such module "delink".">citation needed] </syntaxhighlight>
= Win; = Draw; = Loss |
What it looks like | Source: [<span title="Script error: No such module "delink".">citation needed]
= Win; = Draw; = Loss |
Example 2: Cells contain icons
What you type | <syntaxhighlight lang=moin> Source: [<span title="Script error: No such module "delink".">citation needed] </syntaxhighlight>
= Win; = Draw; = Loss |
What it looks like | Source: [<span title="Script error: No such module "delink".">citation needed]
= Win; = Draw; = Loss |
Example 3: Double round-robin schedule
What you type | <syntaxhighlight lang=moin> Source: [<span title="Script error: No such module "delink".">citation needed] </syntaxhighlight>
= Win; = OT win; = Loss; = OT loss |
What it looks like | Source: [<span title="Script error: No such module "delink".">citation needed]
= Win; = OT win; = Loss; = OT loss |
See also
Tracking category
- Category:Pages using sports rbr table with dubious updated parameter (0) (pages where the updated date does not match the parent page name)
- Category:Pages using sports rbr table with legendorder (2) (pages where the
|legendorder=
parameter is used) - Category:Pages using sports rbr table with rnd parameters (0) (pages where the
|rnd1=
parameter is used and may be converted to|firstround=
) - Category:Pages using sports rbr table with unsupported parameters (0) (pages where unsupported parameters are used, or where the
|header=
is potentially missing)
local pp = {} local rdrobin, multirb local tblkey = { ['WL'] = 'W/L', ['WLF'] = 'W/FW/L/FL', ['BSK'] = 'W/OTW/L/OTL', ['BSKF'] = 'W/OTW/FW/L/OTL/FL', ['FBR'] = 'W/D/L', ['FBRF'] = 'W/FW/D/L/FL', } 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 = { W = { 'Win', color_map.blue1 }, D = { 'Draw', color_map.yellow2 }, L = { 'Loss', color_map.red1 }, OTW = { 'OT win', color_map.blue3 }, OTL = { 'OT loss', color_map.red3 }, FW = { 'Win by forfeit', '#5CDEFD' }, FL = { 'Loss by forfeit', '#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'] = 'Team ╲ Game' args['legendpos'] = 'b' args['legendorder'] = args['legendorder'] or 'W/OTW/FW/D/L/OTL/FL' 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('Round ' .. 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