Template:Param/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(Better documentation.)
Line 3: Line 3:
This template is for giving examples of template parameter source code which is useful in template documentation and talk page discussions of template code.
This template is for giving examples of template parameter source code which is useful in template documentation and talk page discussions of template code.


== Parameters ==
== Parameters and Examples ==
* {{Param}} Parameter name. Displays the number 1 by default.
{| class=standard-table | style="width:100%"
* {{Param|2}} – additional text to be inserted after the parameter name, without a separator. Use {{Code|select=1||}} for separator.
|-
! Parameter
! Description
! Example
! Preview
|-
| align=center | {{Code|{{Param}}}}
| Parameter name. Displays the number 1 by default, and also if the parameter is empty.<br>
The parameter name is highlighted in white, and also uses the CSS property {{Code|style=1|user-select: all}}, to quickly copy the parameter name.
| {{CodeBlock|&#123;&#123;Param&#125;&#125;}} {{CodeBlock|&#123;&#123;Param&#124;&#125;&#125;}} {{CodeBlock|&#123;&#123;Param&#124;{{tint|color=comment|type}}&#125;&#125;}}
| {{Capsule|margin=5px|{{Param}}}} {{Capsule|margin=5px|{{Param|}}}} {{Capsule|margin=5px|{{Param|type}}}}
|-
| align=center | {{Code|{{Param|2}}}}
| The text to be inserted after the parameter name and the pipe symbol ({{Code|style=2|&#124;}}). Leave blank to display only the pipe symbol.
| {{CodeBlock|&#123;&#123;Param&#124;&#124;&#125;&#125;}} {{CodeBlock|&#123;&#123;Param&#124;{{tint|color=comment|color}}&#124;&#125;&#125;}} {{CodeBlock|&#123;&#123;Param&#124;{{tint|color=comment|color}}&#124;{{tint|color=comment|initial}}&#125;&#125;}}
| {{Capsule|margin=5px|{{Param||}}}} {{Capsule|margin=5px|{{Param|color|}}}} {{Capsule|margin=5px|{{Param|color|initial}}}}
|-
| align=center | {{Code|{{Param|suf}}}}
| Additional text to be inserted after the parameter name, without any separator. It can be useful if there are parameters with many subtypes.
| {{CodeBlock|&#123;&#123;Param&#124;{{tint|color=comment|name/}}&#124;{{tint|color=yellow|suf}}&#61;{{tint|color=comment|<lang code>}}&#125;&#125;}} {{CodeBlock|&#123;&#123;Param&#124;{{tint|color=comment|name/}}&#124;{{tint|color=yellow|suf}}&#61;{{tint|color=comment|<lang code>}}&#124;&#125;&#125;}} {{CodeBlock|&#123;&#123;Param&#124;{{tint|color=comment|name/}}&#124;{{tint|color=yellow|suf}}&#61;{{tint|color=comment|<lang code>}}&#124;{{tint|color=comment|default}}&#125;&#125;}}
| {{Capsule|margin=5px|{{Param|name/|suf=<lang code>}}}} {{Capsule|margin=5px|{{Param|name/|suf=<lang code>|}}}} {{Capsule|margin=5px|{{Param|name/|suf=<lang code>|default}}}}
|-
|}


== Examples ==
== Other Examples ==
* {{Code|select=1|&#123;&#123;Param&#125;&#125;}} → {{Param}}
* {{Code|<nowiki>{{Param}}</nowiki>}} → {{Param}}
* {{Code|&#123;&#123;Param&#124;text&#125;&#125;}} → {{Param|text}}
* {{Code|<nowiki>{{Param|}}</nowiki>}} → {{Param|}}
* {{Code|&#123;&#123;Param&#124;name&#124;:<lang>&#125;&#125;}} → {{Param|name|:<lang>}}
 
* {{Code|&#123;&#123;Param&#124;2&#61;&#38;#124;text&#125;&#125;}} → {{Param|2=&#124;text}}
 
* {{Code|<nowiki>{{Param||}}</nowiki>}} → {{Param||}}
* {{Code|<nowiki>{{Param|2=}}</nowiki>}} → {{Param|2=}}
 
 
* {{Code|<nowiki>{{Param|suf=:part}}</nowiki>}} → {{Param|suf=:part}}
* {{Code|<nowiki>{{Param||suf=:part|}}</nowiki>}} → {{Param||suf=:part|}}
* {{Code|<nowiki>{{Param|suf=:part|2=}}</nowiki>}} → {{Param|suf=:part|2=}}
 
 
* {{Code|<nowiki>{{Param||text}}</nowiki>}} → {{Param||text}}
* {{Code|<nowiki>{{Param|2=text}}</nowiki>}} → {{Param|2=text}}
* {{Code|<nowiki>{{Param||suf=:part|text}}</nowiki>}} → {{Param||suf=:part|text}}
* {{Code|<nowiki>{{Param|suf=:part|2=text}}</nowiki>}} → {{Param|suf=:part|2=text}}
 
 
* {{Code|<nowiki>{{Param|parameter}}</nowiki>}} → {{Param|parameter}}
* {{Code|<nowiki>{{Param|parameter|}}</nowiki>}} → {{Param|parameter|}}
* {{Code|<nowiki>{{Param|parameter|text}}</nowiki>}} → {{Param|parameter|text}}
* {{Code|<nowiki>{{Param|parameter|suf=:part}}</nowiki>}} → {{Param|parameter|suf=:part}}
* {{Code|<nowiki>{{Param|parameter|suf=:part|}}</nowiki>}} → {{Param|parameter|suf=:part|}}
* {{Code|<nowiki>{{Param|parameter|suf=:part|text}}</nowiki>}} → {{Param|parameter|suf=:part|text}}
 
 
*{{Code|<nowiki>{{Param|foo}}</nowiki>}} → {{Param|foo}}
*{{Code|<nowiki>{{Param|foo|bar}}</nowiki>}} → {{Param|foo|bar}}
*{{Code|<nowiki>{{Param|foo|{{Param|bar}}}}</nowiki>}} → {{Param|foo|{{Param|bar}}}}
*{{Code|<nowiki>{{Param|foo|{{Param|bar|{{Param|baz|derp}}}}}}</nowiki>}} → {{Param|foo|{{Param|bar|{{Param|baz|derp}}}}}}

Revision as of 10:31, 29 April 2023

Edit-copy.png
This is a documentation subpage for Template:Param.
Don't forget to purge the contents of the base page upon creating or editing this subpage.

This template is for giving examples of template parameter source code which is useful in template documentation and talk page discussions of template code.

Parameters and Examples

Parameter Description Example Preview
{{{1}}} Parameter name. Displays the number 1 by default, and also if the parameter is empty.

The parameter name is highlighted in white, and also uses the CSS property user-select: all, to quickly copy the parameter name.

{{Param}}
{{Param|}}
{{Param|type}}
{{{1}}}
{{{1}}}
{{{type}}}
{{{2}}} The text to be inserted after the parameter name and the pipe symbol (|). Leave blank to display only the pipe symbol.
{{Param||}}
{{Param|color|}}
{{Param|color|initial}}
{{{1|}}}
{{{color|}}}
{{{color|initial}}}
{{{suf}}} Additional text to be inserted after the parameter name, without any separator. It can be useful if there are parameters with many subtypes.
{{Param|name/|suf=<lang code>}}
{{Param|name/|suf=<lang code>|}}
{{Param|name/|suf=<lang code>|default}}
{{{name/}}}
{{{name/|}}}
{{{name/|default}}}

Other Examples

  • {{Param}}{{{1}}}
  • {{Param|}}{{{1}}}


  • {{Param||}}{{{1|}}}
  • {{Param|2=}}{{{1|}}}


  • {{Param|suf=:part}}{{{1}}}
  • {{Param||suf=:part|}}{{{1|}}}
  • {{Param|suf=:part|2=}}{{{1|}}}


  • {{Param||text}}{{{1|text}}}
  • {{Param|2=text}}{{{1|text}}}
  • {{Param||suf=:part|text}}{{{1|text}}}
  • {{Param|suf=:part|2=text}}{{{1|text}}}


  • {{Param|parameter}}{{{parameter}}}
  • {{Param|parameter|}}{{{parameter|}}}
  • {{Param|parameter|text}}{{{parameter|text}}}
  • {{Param|parameter|suf=:part}}{{{parameter}}}
  • {{Param|parameter|suf=:part|}}{{{parameter|}}}
  • {{Param|parameter|suf=:part|text}}{{{parameter|text}}}


  • {{Param|foo}}{{{foo}}}
  • {{Param|foo|bar}}{{{foo|bar}}}
  • {{Param|foo|{{Param|bar}}}}{{{foo|{{{bar}}}}}}
  • {{Param|foo|{{Param|bar|{{Param|baz|derp}}}}}}{{{foo|{{{bar|{{{baz|derp}}}}}}}}}