Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Module:Build bracket/sandbox

From Wikipedia, the free encyclopedia
<Module:Build bracket
This is themodule sandbox page forModule:Build bracket (diff).
See also the companion subpage fortest cases (run).
Module documentation[view] [edit] [history] [purge]
WarningThis Lua module is used onapproximately 8,700 pages and changes may be widely noticed. Test changes in the module's/sandbox or/testcases subpages, or in your ownmodule sandbox. Consider discussing changes atWikipedia talk:High-risk templates before implementing them.
Thismodule is rated asready 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 onhelp pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed throughsandbox 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 byModule:RoundN orModule: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), andN-way brackets (N teams per match). The syntax is slightly more complicated than the aforementioned brackets, but simpler than using the standard wikitable code.

Usage

[edit]
{{#invoke:Build bracket|main| rounds =| col1-headers = | col1-matches = | col2-headers = | col2-matches = ...| col1-col2-paths = | col2-col3-paths = ...}}

Parameters

[edit]
ParameterDescriptionDefault
roundsnumber of rounds (columns).1
autocolset toyes to automatically set set maximum round to display based on entries.no
rowsmanually set the number of rows.Automatic
teams-per-matchenter the number of teams in each match. Usecolm-teams-per-match to set individual columns2
colm-headers(optional) enter the row numbers where headers are desired in columnm. Separate entries with,. Half integer values are allowed.Automatic
colm-matchesenter the row numbers where a match is desired in columnm. Matches take up two rows by default. Separate entries with,. Half integer values are allowed.
colm-textenter the row numbers where additional text is desired in columnm. Separate entries with,. Half integer values are allowed.
colm-colm+1-pathsenter the starting and ending row numbers, separated by-, from columnsm andm+1 where a path is desired. Separate entries with,. Half integer values are allowed.
colm-colm+1-crossenter the row number where paths intersect from columnm tom+1.
RDm-altnameAlternate name forRDm (e.g., if|RD1-altname=first, thenfirst-team1 can be used instead ofRD1-team1). UseRDmh-altname for cells under headermh.
text-altnameAlternate name forRDm-textk (e.g., if|text-altname=details, thenRDm-details1 can be used instead ofRDm-text1).
maxroundfinal round to display. This parameter should be omitted unless it is less than the default value set byrounds.
minroundfirst round to display.1
heightthe amount of vertical visibility desired for the bracket. Creates a vertical scroll bar. Enter a number with units (e.g.,30em or480px).
col-spacingthe amount of horizontal space between rounds. Enter as a plain number (e.g.,10 for 10px).5
seed-widththe width of the cells for seeds. Plain numbers are assumed to be in px units (e.g.,25 for 25px or2em for 2em)25
team-widththe width of the cells for team names. Plain numbers are assumed to be in px units (e.g.,200 for 200px or15em for 15em)150
score-widththe width of the cells for scores. Plain numbers are assumed to be in px units (e.g.,25 for 25px or2em for 2em)25
agg-widththe 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 or2em for 2em)25
seedsset tono to omit seeds in in all matches. set toyes to show seed cells to show for all matches.
legsthe number of legs for all rounds. UseRDm-legs to individually set columns. UseRDm-legsk to individually set teams.1
autolegsset toyes to automatically generate score cells per team. Iflegs orRDm-legs is used,autolegs will be set tono .no
byesset toyes to hide any team cells that are empty. Alternatively, set tom to have rounds1 throughm hide any team cells that are empty. UseRDm-byes for just matches under columnm. UseRDmh-byes for just matches under headerh only in columnm.no
RDm-hideset toyes to hide the all matches in columnsm unless any of those entries are non empty. UseRDmh-byes to hide the (alpha)hth header and all matches beneath it in columnm. Useful for consolation matches.
show-bye-pathsset toyes to replace any team cells that that are hiddenbyes with a path.no
aggregateSet tosets orlegs to sum the sets/legs won and append to the end of the scores. Set toscore to sum the scores from each set/leg and append to the end of the scores. Set toy oryes 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
boldwinnerset tohigh to automatically bold the seed/team/score with the higher score in each match. Set tolow for the lowest score. Set toaggregate to only bold the higher aggregate score. Set toaggregate-low to only bold the lower aggregate score.no
shiftvertically shifts all of the entries by the number entered. UseRDm-shift for individual in columns.0
RDm,RDmhThe header text of the (alphahth) header in columnm (e.g.,RD1 orRD1a for the first header andRD1b for the second header in column 1).
RDm-seedkThe seed of thekth team in columnm. Alternatively, useRDmh-seedk for thekth team under headermh.
RDm-teamkThe name of thekth team in columnm. Alternatively, useRDmh-teamk for thekth team under headermh.
RDm-scorekThe score of thekth team in columnm. Alternatively, useRDmh-scorek for thekth team under headermh. Append the suffix-l for thelth leg or-agg for the aggregate score.
RDm-textkThe text above thekth match in columnm. Alternatively, useRDmh-textk for thekth match under headermh.
RDm-groupkThe text for thekth group in columnm. Group text will appear to the left of whenever two paths meet.
RD-shadethe background color (in hex format, e.g.#ABCDEF) of all headers. UseRDm-shade orRDmh-shade for individual headers.#F2F2F2
RDm-RD(m+1)-path[a]set tono or0 to omit the paths from roundm to roundm+1.yes
paramstyle[b]set tonumbered change the parameter name style ofRDm-textk,RDm-seedk,RDm-teamk, andRDm-scorek to a numbered notation (|1=,|2=...). Set|seeds=yes add seeds.
  1. ^Does not currently work for paths under subheaders.
  2. ^numbered may not be compatible with certain other features, e.g. groups.

Parameter hierarchy

[edit]
  • 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 byRD1-team3.
Upper round
Lower round
RD1-team3 orRD1b-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 forma-b, wherea is associated match in the first column, andb is associated match in the second column. Path codes can be grouped; for example,(a,b)-c is equivalent toa-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.

ExampleOutput
1-3
(1,5)-3
3-1,3-5:red

Examples

[edit]

Note: These are only examples to illustrate parameters. Standard 4-team, 8-team, etc. brackets are better handled byModule:Team bracket.

Standard 4-team bracket

{{#invoke:Build bracket|main| rounds=2| col1-headers = 1| col2-headers = 1| col1-matches = 3,7| col2-matches = 5| col1-col2-paths = (3,7)-5<!-- Defaults -->| RD2 = Grand Final| RD1-seed1 = 1| RD1-seed3 = 2}}
SemifinalsGrand Final
1
2

3-way bracket

{{#invoke:Build bracket|main| rounds=2| teams-per-match = 3| col1-headers = 1| col2-headers = 1| col1-matches = 3,7,11| col2-matches = 7| col1-col2-paths = (3,7,11)-7}}
SemifinalsFinal

Double-elimination bracket

{{#invoke:Build bracket|main| rounds=4| col1-headers = 1,7| col2-headers = 1,7| col3-headers = 7| col4-headers = 1| col1-matches = 4,11| col2-matches = 3,10| col3-matches = 9| col4-matches = 6| col1-col2-paths = 4-3, 11-10| col2-col3-paths = 3-3, 10-9| col3-col4-paths = (3,9)-6<!-- Defaults -->| RD1 = Upper round 1| RD2 = Upper final| RD3b = Lower final}}
Upper round 1Upper finalFinal
Lower round 1Lower round 2Lower final

Crossing paths

{{#invoke:Build bracket|main| rounds=2| col1-matches = 3,7| col2-matches = 3,7| col1-col2-paths = 3-7, 7-3| col1-col2-cross = 5}}
SemifinalsFinal

Text

[edit]
{{#invoke:Build bracket|main| rounds=2| col1-matches = 3,6| col2-matches = 4.5| col1-col2-paths = (3,6)-4.5| RD1-text1 = Text 1| RD1-text2 = Text 2| RD2-text1 = Text 3}}
SemifinalsFinal
Text 1
Text 3
Text 2

Groups

[edit]
{{#invoke:Build bracket|main| rounds=3| col1-matches = 3,6,9,12| col2-matches = 4.5,10.5| col3-matches = 7.5| col1-col2-paths = (3,6)-4.5, (9,12)-10.5| col2-col3-paths = (4.5,10.5)-7.5| RD1-group1 = Group 1| RD1-group2 = Group 2| RD2-group1 = Group 3}}
QuarterfinalsSemifinalsFinal
Group 1
Group 3
Group 2

Legs and aggregate

[edit]
{{#invoke:Build bracket|main| rounds=3| legs = 2| RD1-legs = 3| aggregate = y| col1-matches = 3,6,9,12| col2-matches = 4.5,10.5| col3-matches = 7.5| col1-col2-paths = (3,6)-4.5, (9,12)-10.5| col2-col3-paths = (4.5,10.5)-7.5}}
QuarterfinalsSemifinalsFinal

Byes

[edit]
{{#invoke:Build bracket|main| rounds=3| RD1-byes = y| col1-matches = 3,6,9,12| col2-matches = 4.5,10.5| col3-matches = 7.5| col1-col2-paths = (3,6)-4.5, (9,12)-10.5| col2-col3-paths = (4.5,10.5)-7.5| RD1-team1 = Team 1| RD1-team2 = Team 2}}
QuarterfinalsSemifinalsFinal
Team 1
Team 2


Bold winner

{{#invoke:Build bracket|main| rounds=2| legs = 3| boldwinner=y| col1-matches = 3,7| col2-matches = 5| col1-col2-paths = (3,7)-5| RD1-seed1 = 1 | RD1-team1 = Team 1 | RD1-score1-1 = 5  | RD1-score1-2 = 12 | RD1-score1-3 = 15| RD1-seed2 = 4 | RD1-team2 = Team 2 | RD1-score2-1 = 11 | RD1-score2-2 = 10 | RD1-score2-3 = 4| RD1-seed3 = 2 | RD1-team3 = Team 3 | RD1-score3-1 = 6  | RD1-score3-2 = 13 | RD1-score3-3 = {{ndash}}| RD1-seed4 = 3 | RD1-team4 = Team 4 | RD1-score4-1 = 3  | RD1-score4-2 = 2  | RD1-score4-3 = {{ndash}}| RD2-seed1 = 4 | RD2-team1 = Team 2 | RD2-score1-1 = 2  | RD2-score1-2 = 2  | RD2-score1-3 = 5| RD2-seed2 = 2 | RD2-team2 = Team 3 | RD2-score2-1 = 1  | RD2-score2-2 = 7  | RD2-score2-3 = 2}}
SemifinalsFinal
1Team 151215
4Team 211104
4Team 2225
2Team 3172
2Team 3613
3Team 432

See also

The abovedocumentation istranscluded fromModule:Build bracket/doc.(edit |history)
Editors can experiment in this module'ssandbox(edit |diff) andtestcases(edit |run) pages.
Add categories to the/doc subpage.Subpages of this module.
localp={}-- SubmoduleslocalHelpers=require("Module:Build bracket/Helpers/sandbox")localConfig=require("Module:Build bracket/Config")localParams=require("Module:Build bracket/Params/sandbox")localStateChecks=require("Module:Build bracket/StateChecks")localLogic=require("Module:Build bracket/Logic/sandbox")localPaths=require("Module:Build bracket/Paths/sandbox")localRender=require("Module:Build bracket/Render/sandbox")-- 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
Retrieved from "https://en.wikipedia.org/w/index.php?title=Module:Build_bracket/sandbox&oldid=1307932005"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp