Template:Tl

From Terraria Wiki
Jump to navigation Jump to search
Important.svg
CAUTION: Terraria Wiki code is complex!!!
If you want to use this code on another wiki, wiki.gg staff are not able to assist you.
Please consider picking a different wiki to adapt code from, or making your own templates!
Remember that content on a wiki is more important than fancy formatting.
Template-info.svg Documentation The documentation below is transcluded from Template:Tl/doc. (edit | history)

This template returns an exemplary use of a template while linking to the template description page, if the template exists. It can also handle parser functions.

Usage

All parameters are optional.

  • Templates: {{ tl | <template name> | <template parameter 1> | ... | <template parameter n> | nl = y/yes | code = y/yes }}
  • Parser functions: {{ tl | #<parser function name>: | <parser function parameter 1> | ... | <parser function parameter n> | nl = y/yes | code = y/yes }}
First unnamed parameter

Template (without the Template: prefix) or parser function name. The colon at the end of the parser function's name may be omitted, or it may immediately be followed by the parser function's first parameter (i.e., without the first vertical bar).

Unnamed parameters

Other parameters, ad infinitum.

nl

Set this parameter to suppress the link to the template/parser function documentation. Links to parser function documentation are stored in Template:Tl/parser function links.

code

Set this parameter to wrap the output in <code> tags.

Notes

  • To display named parameters or to otherwise include equals signs, use the magic word {{=}}. Unescaped equals signs will cause the entire parameter to be hidden.
  • In rare cases, the list of parameters can be defined in a single, special parameter called __paramslist. Equals signs can be used normally there and parameters must be separated with the character (this character must also be at the very start). This method can be useful for dynamic lists of parameters, but the regular method should be used whenever possible.

Examples

Code Result
{{tl|stub}} {{stub}}
{{tl|stub|1}} {{stub|1}}
{{tl|stub|1|2}} {{stub|1|2}}
{{tl|nl=y|stub|1|2}} {{stub|1|2}}
{{tl|code=y|stub|1|2}} {{stub|1|2}}
{{tl|nl=y|code=y|stub|1|2}} {{stub|1|2}}
{{tl|non-existent template|1|2}} {{non-existent template|1|2}}
{{tl|#if}} {{#if:}}
{{tl|#if:}} {{#if:}}
{{tl|#if:condition}} {{#if:condition}}
{{tl|#if:condition|then|else}} {{#if:condition|then|else}}
{{tl|#listmap:|list{{=}}1, 2, 3}} {{#listmap:|list=1, 2, 3}}