This module is rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing.
This module is intended to be used to create and edit intricate sports brackets that cannot be made by Module:RoundN or Module:Team bracket. For example, additional headers (for double-elimination brackets; 3rd-, 5th-, 7th-place matches; etc), singular omitted matches (i.e., having a horizonal line instead of a match), and N-way brackets (N teams per match). The syntax is slightly more complicated than the aforementioned brackets, but simpler than using the standard wikitable code.
set to yes to automatically set set maximum round to display based on entries.
no
rows
manually set the number of rows.
Automatic
teams-per-match
enter the number of teams in each match. Use colm-teams-per-match to set individual columns
2
colm-headers
(optional) enter the row numbers where headers are desired in column m. Separate entries with ,. Half integer values are allowed.
Automatic
colm-matches
enter the row numbers where a match is desired in column m. Matches take up two rows by default. Separate entries with ,. Half integer values are allowed.
colm-text
enter the row numbers where additional text is desired in column m. Separate entries with ,. Half integer values are allowed.
colm-colm+1-paths
enter the starting and ending row numbers, separated by -, from columns m and m+1 where a path is desired. Separate entries with ,. Half integer values are allowed.
colm-colm+1-cross
enter the row number where paths intersect from column m to m+1.
RDm-altname
Alternate name for RDm (e.g., if |RD1-altname=first, then first-team1 can be used instead of RD1-team1). Use RDmh-altname for cells under header mh.
text-altname
Alternate name for RDm-textk (e.g., if |text-altname=details, then RDm-details1 can be used instead of RDm-text1).
maxround
final round to display. This parameter should be omitted unless it is less than the default value set by rounds.
minround
first round to display.
1
height
the amount of vertical visibility desired for the bracket. Creates a vertical scroll bar. Enter a number with units (e.g., 30em or 480px).
col-spacing
the amount of horizontal space between rounds. Enter as a plain number (e.g., 10 for 10px).
5
seed-width
the width of the cells for seeds. Plain numbers are assumed to be in px units (e.g., 25 for 25px or 2em for 2em)
25
team-width
the width of the cells for team names. Plain numbers are assumed to be in px units (e.g., 200 for 200px or 15em for 15em)
150
score-width
the width of the cells for scores. Plain numbers are assumed to be in px units (e.g., 25 for 25px or 2em for 2em)
25
agg-width
the width of the cells for aggregate scores. score-width will change aggregate score widths unless this parameter is used. Plain numbers are assumed to be in px units (e.g., 25 for 25px or 2em for 2em)
25
seeds
set to no to omit seeds in in all matches. set to yes to show seed cells to show for all matches.
legs
the number of legs for all rounds. Use RDm-legs to individually set columns. Use RDm-legsk to individually set teams.
1
autolegs
set to yes to automatically generate score cells per team. If legs or RDm-legs is used, autolegs will be set to no .
no
byes
set to yes to hide any team cells that are empty. Alternatively, set to m to have rounds 1 through m hide any team cells that are empty. Use RDm-byes for just matches under column m. Use RDmh-byes for just matches under header h only in column m.
no
RDm-hide
set to yes to hide the all matches in columns m unless any of those entries are non empty. Use RDmh-byes to hide the (alpha) hth header and all matches beneath it in column m. Useful for consolation matches.
show-bye-paths
set to yes to replace any team cells that that are hidden byes with a path.
no
aggregate
Set to sets or legs to sum the sets/legs won and append to the end of the scores. Set to score to sum the scores from each set/leg and append to the end of the scores. Set to y or yes to enable the -agg suffix, but without any auto computation. Only works when there are two or more legs/sets in the round. Any automatically computed value can be overridden by setting the value manually with the -agg suffix for the score.
no
boldwinner
set to high to automatically bold the seed/team/score with the higher score in each match. Set to low for the lowest score. Set to aggregate to only bold the higher aggregate score. Set to aggregate-low to only bold the lower aggregate score.
no
shift
vertically shifts all of the entries by the number entered. Use RDm-shift for individual in columns.
0
RDm, RDmh
The header text of the (alpha hth) header in column m (e.g., RD1 or RD1a for the first header and RD1b for the second header in column 1).
RDm-seedk
The seed of the kth team in column m. Alternatively, use RDmh-seedk for the kth team under header mh.
RDm-teamk
The name of the kth team in column m. Alternatively, use RDmh-teamk for the kth team under header mh.
RDm-scorek
The score of the kth team in column m. Alternatively, use RDmh-scorek for the kth team under header mh. Append the suffix -l for the lth leg or -agg for the aggregate score.
RDm-textk
The text above the kth match in column m. Alternatively, use RDmh-textk for the kth match under header mh.
RDm-groupk
The text for the kth group in column m. Group text will appear to the left of whenever two paths meet.
RD-shade
the background color (in hex format, e.g. #ABCDEF) of all headers. Use RDm-shade or RDmh-shade for individual headers.
set to numbered change the parameter name style of RDm-textk, RDm-seedk, RDm-teamk, and RDm-scorek to a numbered notation (|1=,|2=...). Set |seeds=yes add seeds.
^Does not currently work for paths under subheaders.
^numbered may not be compatible with certain other features, e.g. groups.
Whenever there are multiple headers in a single column, more than one parameter may be assigned to a cell value. For example, in the following bracket, both |RD1-team3= and |RD1b-team1= can be used to assign the third team in the first column. By default, entries with subheader prefixes will override those without. In the below example, RD1b-team1 will override any value that has been set by RD1-team3.
Upper round
Lower round
RD1-team3 or RD1b-team1
Parameters used in articles take precedence over parameters used in the template itself. For example, suppose ArticleX used the template NTeamBracket, and suppose NTeamBracket had the parameter |RD1-seed1=1 set. If ArticleX implemented {{NTeamBracket|RD1-seed1=2}}, then the first team in round 1 would have a seed of 2.
Path codes
Path codes are entered in the form a-b, where a is associated match in the first column, and b is associated match in the second column. Path codes can be grouped; for example, (a,b)-c is equivalent to a-c, b-c. To add color, append :color to the end of a path, e.g. 3-5:red. Only one extra color can be used in a bracket.
localp={}-- SubmoduleslocalHelpers=require("Module:Build bracket/Helpers")localConfig=require("Module:Build bracket/Config")localParams=require("Module:Build bracket/Params")localStateChecks=require("Module:Build bracket/StateChecks")localLogic=require("Module:Build bracket/Logic")localPaths=require("Module:Build bracket/Paths")localRender=require("Module:Build bracket/Render")-- local Deprecations = require('Module:Build bracket/Deprecations')functionp.main(frame)-- Shared mutable state passed among submoduleslocalstate={headerindex={},rlegs={},maxlegs={},hascross={},crossCell={},pathCell={},skipPath={},hide={},byes={},teamsPerMatch={},matchgroup={},maxtpm=0}localconfig={}-- 1) Parse args & set config (also installs arg accessors on Helpers)Config.init(frame,state,config,Helpers)-- 2) Bind StateChecks (used by Params/Logic/Paths/Render)StateChecks.bind(state,config,Helpers)-- 3) Build entries skeleton from args (headers/teams/text/lines/groups)Params.buildSkeleton(state,config,Helpers,StateChecks)-- 4) Discover indices/byes/hide across the skeletonParams.scanStructure(state,config,Helpers,StateChecks)-- 5) assign per-entry paramsParams.assign(state,config,Helpers,StateChecks)-- 5.5) apply minround slicing (reindex to start at 1)Params.sliceForMinround(state,config)-- 6) Logic passes (max legs, grouping, aggregates, bolding)Logic.updateMaxLegs(state,config,Helpers)Logic.matchGroups(state,config)Logic.computeAggregate(state,config,Helpers,StateChecks)Logic.boldWinner(state,config,Helpers,StateChecks)-- 7) paths + derive groups from pathsPaths.build(state,config,Helpers,StateChecks)Paths.attachGroups(state,config,Helpers,StateChecks)-- (Harmless guard if user passed odd ranges)if(tonumber(config.c)or1)<(tonumber(config.minc)or1)thenconfig.c=config.mincend-- 8) Render HTML tablelocalhtml=Render.buildTable(frame,state,config,Helpers,StateChecks)returntostring(html)end-- Exposed for tests/scripts that invoke without a framep._main=p.mainreturnp