Jump to content

Module:Bracket/doc

From Humanipedia

This is the documentation page for Module:Bracket

Lua error in package.lua at line 80: module 'Module:Yesno' not found.

Wrapper for bracket templates, which can be used in place of the following for reduced Post-expand include size:

Usage[edit source]

{{#invoke:Bracket|template_name}}

Example[edit source]

{{#invoke:Bracket|16TeamBracket-Compact-Tennis3}}

1st round 2nd round Semifinals Finals
 
   
   
   
   
   
   
   
   
   
   
   
   
   
   
 


Adding new templates[edit source]

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 and the standard parameter of Module: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 = </syntaxhighlight> would have <syntaxhighlight lang="lua" inline>group1 = "RD1-group1"</syntaxhighlight>. Any parameters that start with a number or 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 if 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 = 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:
    • 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 have sets set to the value of ##. In addition, these templates will have <syntaxhighlight lang="lua" inline>{seeds = "yes", nowrap = "yes"}</syntaxhighlight> set.
    • Templates with -Compact in TEMPLATE-NAME will automatically default to <syntaxhighlight lang="lua" inline>compact = "yes"</syntaxhighlight>