Module:Bracket/doc: Difference between revisions
Appearance
Content deleted Content added
{{Module rating|beta}} |
→Example: Adding new templates |
||
Line 19: | Line 19: | ||
[[Category:Tournament bracket templates]][[Category:4-Team bracket templates]][[Category:6-Team bracket templates]][[Category:7-Team bracket templates]][[Category:8-Team bracket templates]][[Category:16-Team bracket templates]] |
[[Category:Tournament bracket templates]][[Category:4-Team bracket templates]][[Category:6-Team bracket templates]][[Category:7-Team bracket templates]][[Category:8-Team bracket templates]][[Category:16-Team bracket templates]] |
||
}}</includeonly> |
}}</includeonly> |
||
== Adding new templates == |
|||
New templates can be added using the following format: |
|||
<syntaxhighlight lang="lua">p['TEMPLATE_NAME'] = function (frame) |
|||
return p._teamBracket(frame, 'TEMPLATE_NAME', {ALTERNATIVE_PARAMETER_NAMES}, {PARAMETER_DEFAULTS}) |
|||
end</syntaxhighlight> |
|||
* '''TEMPLATE_NAME''' is the name of the template without "Template:" |
|||
* '''ALTERNATIVE_PARAMETER_NAMES''' is an array of custom parameters parameters and the standard parameter of [[:Moduke:Team Bracket]] that they translate to, in the form <syntaxhighlight lang="lua" inline>CUSTOM_NAME = "STANDARD_NAME"</syntaxhighlight>. For example, a template that uses <syntaxhighlight lang="wikitext" inline>|RD1-group1 = {{{RD1-group1|{{{group1|}}}}}}</syntaxhighlight> would have <syntaxhighlight lang="lua" inline>group1 = "RD1-group1"</syntaxhighlight>. Any parameters that start with a number of contain a dash need to be specified as <syntaxhighlight lang="lua" inline>['CUSTOM_NAME']</syntaxhighlight>, e.g. <syntaxhighlight lang="lua" inline>['RD1-seed01'] = 'RD1-seed1'</syntaxhighlight>. |
|||
* '''PARAMETER_DEFAULTS''' is an array of default parameter values that are used in a parameter is not specified. For example, a template that uses <syntaxhighlight lang="wikitext" inline>|RD1 = Quarterfinals</syntaxhighlight> would have <syntaxhighlight lang="lua" inline>RD1 = "Quarterfinals"</syntaxhighlight>, or a template that uses <syntaxhighlight lang="wikitext" inline>|team-width = {{{team-width|125}}}</syntaxhighlight> would have <syntaxhighlight lang="lua" inline>['team-width'] = "125"</syntaxhighlight>. Some parameters are automatically determined based on ''TEMPLATE-NAME'' unless explicity specified in ''PARAMETER_DEFAULTS'': |
|||
** <code>rounds</code> is automatically calculated based on the <code>##Team</code> or <code>##Round</code> text present in ''TEMPLATE-NAME''. This does not need to be specified. |
|||
** Templates with <code>-Tennis##</code> or <code>-Squash##</code> in ''TEMPLATE-NAME'' will have <code>sets</code> set to the value of <code>##</code>. In addition, these templates will have <syntaxhighlight lang="lua" inline>{seeds = "yes", nowrap = "yes"}</syntaxhighlight> set. |
|||
** Templates with <code>-Compact</code> in ''TEMPLATE-NAME'' will automatically default to <syntaxhighlight lang="lua" inline>compact = "yes"</syntaxhighlight> |
Revision as of 19:56, 22 August 2024
Wrapper for bracket templates, which can be used in place of the following for reduced Post-expand include size:
- {{2TeamBracket}}
- {{4TeamBracket}}
- {{4TeamBracket-Tennis3}}
- {{4TeamBracket-Tennis35}}
- {{4TeamBracket-Tennis5}}
- {{6TeamBracket}}
- {{7TeamBracket}}
- {{8TeamBracket}}
- {{8TeamBracket-Byes}}
- {{8TeamBracket-Compact-Byes}}
- {{8TeamBracket-Compact-NoSeeds-Byes}}
- {{8TeamBracket-Tennis3}}
- {{8TeamBracket-Tennis5}}
- {{16TeamBracket}}
- {{16TeamBracket-Byes}}
- {{16TeamBracket-Compact-Archery}}
- {{16TeamBracket-Compact-NoSeeds-Byes}}
- {{16TeamBracket-Compact-Tennis3}}
- {{16TeamBracket-Compact-Tennis3-Byes}}
- {{16TeamBracket-Compact-Tennis5}}
- {{16TeamBracket-Compact-Tennis5-Byes}}
- {{16TeamBracket-Tennis3}}
- {{16TeamBracket-Tennis5}}
- {{32TeamBracket}}
- {{32TeamBracket-Byes}}
- {{32TeamBracket-Compact-NoSeeds-Byes}}
- {{32TeamBracket-Compact-Squash5}}
- {{32TeamBracket-Compact-Tennis3}}
- {{32TeamBracket-Tennis3}}
- {{64TeamBracket}}
Usage
{{#invoke:Bracket|template_name}}
Example
{{#invoke:Bracket|16TeamBracket-Compact-Tennis3}}
1st round | 2nd round | Semifinals | Finals | ||||||||||||||||||||||||
Adding new templates
New templates can be added using the following format:
p['TEMPLATE_NAME'] = function (frame)
return p._teamBracket(frame, 'TEMPLATE_NAME', {ALTERNATIVE_PARAMETER_NAMES}, {PARAMETER_DEFAULTS})
end
- TEMPLATE_NAME is the name of the template without "Template:"
- ALTERNATIVE_PARAMETER_NAMES is an array of custom parameters parameters and the standard parameter of Moduke:Team Bracket that they translate to, in the form
CUSTOM_NAME = "STANDARD_NAME"
. For example, a template that uses|RD1-group1 = {{{RD1-group1|{{{group1|}}}}}}
would havegroup1 = "RD1-group1"
. Any parameters that start with a number of contain a dash need to be specified as['CUSTOM_NAME']
, e.g.['RD1-seed01'] = 'RD1-seed1'
. - PARAMETER_DEFAULTS is an array of default parameter values that are used in a parameter is not specified. For example, a template that uses
|RD1 = Quarterfinals
would haveRD1 = "Quarterfinals"
, or a template that uses|team-width = {{{team-width|125}}}
would have['team-width'] = "125"
. Some parameters are automatically determined based on TEMPLATE-NAME unless explicity specified in PARAMETER_DEFAULTS:rounds
is automatically calculated based on the##Team
or##Round
text present in TEMPLATE-NAME. This does not need to be specified.- Templates with
-Tennis##
or-Squash##
in TEMPLATE-NAME will havesets
set to the value of##
. In addition, these templates will have{seeds = "yes", nowrap = "yes"}
set. - Templates with
-Compact
in TEMPLATE-NAME will automatically default tocompact = "yes"