Difference between revisions of "Template:Infobox Template/variables"
J McKalling (Talk | contribs) (new subpage to template-infobox) |
J McKalling (Talk | contribs) (added infobox) |
||
(One intermediate revision by the same user not shown) | |||
Line 9: | Line 9: | ||
#while: | {{#explode:{{{ {{#var: arg }}|}}}|!|0}} | #while: | {{#explode:{{{ {{#var: arg }}|}}}|!|0}} | ||
|<nowiki/> | |<nowiki/> | ||
− | * {{#explode:{{{ {{#var: arg }}|}}}|!|0}}{{superlink|article=Template:{{#explode:{{{ {{#var: arg }}|}}}|!|1}}|label=template|hide={{#if: {{#explode:{{{ {{#var: arg }}|}}}|!|1}}||true}}}} ''{{#if: {{#explode:{{{ {{#var: arg }}|}}}|!|2}}|(active)|(free for reuse)}}''{{ | + | * {{#explode:{{{ {{#var: arg }}|}}}|!|0}}{{superlink|article=Template:{{#explode:{{{ {{#var: arg }}|}}}|!|1}}|label=template|hide={{#if: {{#explode:{{{ {{#var: arg }}|}}}|!|1}}|false|true}}}} ''{{#if: {{#explode:{{{ {{#var: arg }}|}}}|!|2}}|(active)|(free for reuse)}}''{{ |
#vardefine: arg | {{#expr: {{#var: arg }} + 1 }}}} | #vardefine: arg | {{#expr: {{#var: arg }} + 1 }}}} | ||
}} | }} | ||
|<!-- no arguments --> | |<!-- no arguments --> | ||
{{categorizer|category=Non variable-using templates|label=''none''|nocat={{{nocat|false}}}}} | {{categorizer|category=Non variable-using templates|label=''none''|nocat={{{nocat|false}}}}} | ||
− | }}</includeonly><noinclude> | + | }}</includeonly><noinclude>{{Infobox Template |
+ | |purpose=infobox | ||
+ | |singletag=no | ||
+ | |multiline=optional | ||
+ | |gamerelated=no | ||
+ | |suppressible=recursively | ||
+ | |choice=multiple | ||
+ | |cat1=Non variable-using templates!''none'' | ||
+ | |cat2=Variable-using templates!''one'' | ||
+ | |cat3=Multi variable-using templates!''multiple'' | ||
+ | |cat4=Non variable-using templates!''unknown''!maintenance | ||
+ | |var1=arg | ||
+ | }} | ||
+ | |||
This template renders information about another template, a list of variables that are used by it. Depending on the amount of specified variables, this template may also categorize that template under the category that represents that amount. [[:Category:Non variable-using templates|Non variable-using]], [[:Category:Variable-using templates|Variable-using]] or [[:Category:Multi variable-using templates|Multi variable-using]]. | This template renders information about another template, a list of variables that are used by it. Depending on the amount of specified variables, this template may also categorize that template under the category that represents that amount. [[:Category:Non variable-using templates|Non variable-using]], [[:Category:Variable-using templates|Variable-using]] or [[:Category:Multi variable-using templates|Multi variable-using]]. | ||
Line 96: | Line 109: | ||
This would render the same result as the first example above, but would not automatically categorize under [[:Category:Variable-using templates]]. | This would render the same result as the first example above, but would not automatically categorize under [[:Category:Variable-using templates]]. | ||
− | |||
</noinclude> | </noinclude> |
Latest revision as of 17:43, 6 June 2014
Infobox Template/variables | |
---|---|
Purpose |
Infobox [list all] |
Single tag |
No [list all] |
Multi-line |
Optional [list all] |
Protected |
No [list all] |
Game related |
No [list all] |
Categorization | |
Suppressible |
Recursively [list all] |
Choice |
Multiple categories [list all] |
Categories |
Multiple: [list all] |
|
|
Variables | |
Names |
One: [list all] |
|
|
Subpages |
This template renders information about another template, a list of variables that are used by it. Depending on the amount of specified variables, this template may also categorize that template under the category that represents that amount. Non variable-using, Variable-using or Multi variable-using.
Parameters
- The name of a variable that the template uses, with an optional source template name if it is inherited, separated by exclamation mark (no parameter name, multiple parameters allowed, case sensitive)
- nocat: Whether or not to suppress categorization under the automatically chosen category (defaults to false, which means auto categorization).
Note: the unnamed parameters must be specified in proper order if using their positional numbers, because the first number that is empty/not specified terminates the list. If the list is empty this way, the default 'none' category will be used.
Note: although this template does not limit the amount of possible unnamed parameters, the parent infobox limits to ten.
Syntax
{{Infobox Template/variables|value!value}}
Warning: this template will often force a table cell to split in two, so do not use it outside table cells! Infoboxes use tables, so in there would be fine.
Examples
Common use includes at least one unnamed parameter to specify the variable name that the template uses:
{{Infobox Template/variables|myVar}}
- One: [list all]
- myVar (free for reuse)
If the template inherits the variable from another template that it uses, the name of the source template may be specified as well, separated with exclamation mark like this:
{{Infobox Template/variables|lba!Infobox Character/adventure}}
You can also specify multiple variables for one template, mixing own and inherited variables:
{{Infobox Template/variables |messages |lba!Infobox Character/adventure }}
Additionally, it is possible to specify that a variable is not allowed to be reused by other templates on the same page, by providing a third value for any unnamed parameter (any value will do):
{{Infobox Template/variables |messages |lba!Infobox Character/adventure!do-not-reuse }}
This is also possible for variables that are not inherited, by specifying two exclamation marks (an empty 2nd value):
{{Infobox Template/variables |messages!!do-not-reuse |lba!Infobox Character/adventure }}
You may leave the "variables" undefined by not specifying any unnamed parameters (specifically the part left of the 1st separator), or not maintaining proper ordering, so these all have the same result:
{{Infobox Template/variables}} {{Infobox Template/variables|}} {{Infobox Template/variables|!someTemplate}} {{Infobox Template/variables|var=somevar!someTemplate}} {{Infobox Template/variables||someVar!someTemplate}} {{Infobox Template/variables|1=someVar!someTemplate|1=}} {{Infobox Template/variables|2=someVar!someTemplate}}
- none [list all]
The nocat parameter may be used to suppress automatic categorization like this (any value will do):
{{Infobox Template/variables|myVar|nocat=true}}
This would render the same result as the first example above, but would not automatically categorize under Category:Variable-using templates.