Difference between revisions of "Template:Infobox Template/categories"
J McKalling (Talk | contribs) (new subpage to template-infobox) |
J McKalling (Talk | contribs) (improved the cell split logic) |
||
Line 3: | Line 3: | ||
|{{#if: {{{cat2|}}} <!-- multiple arguments --> | |{{#if: {{{cat2|}}} <!-- multiple arguments --> | ||
| {{categorizer|category=Multi-categorizing templates|label=Multiple:|nocat={{{nocat|false}}}}} | | {{categorizer|category=Multi-categorizing templates|label=Multiple:|nocat={{{nocat|false}}}}} | ||
− | + | | {{categorizer|category=Categorizing templates|label=One:|nocat={{{nocat|false}}}}} | |
− | + | }}</td></tr> | |
− | + | <tr><td colspan="2"> | |
+ | {{ <!-- one or more arguments --> | ||
#vardefine: cat | 1 }}{{ | #vardefine: cat | 1 }}{{ | ||
#while: | {{{ cat{{#var: cat }} |}}} | #while: | {{{ cat{{#var: cat }} |}}} | ||
Line 13: | Line 14: | ||
}} | }} | ||
|<!-- no arguments --> | |<!-- no arguments --> | ||
− | {{categorizer|category=Noncategorizing templates|label= | + | {{categorizer|category=Noncategorizing templates|label=''none''|nocat={{{nocat|false}}}}} |
}}</includeonly><noinclude> | }}</includeonly><noinclude> | ||
This template renders information about another template, a variable list of categories, under which that template may categorize its articles. Depending on the amount of specified categories, this template may also categorize that template under the category that represents that amount. [[:Category:Noncategorizing templates|Noncategorizing]], (normal) [[:Category:Categorizing templates|Categorizing]] or [[:Category:Multi-categorizing templates|Multi-categorizing]]. | This template renders information about another template, a variable list of categories, under which that template may categorize its articles. Depending on the amount of specified categories, this template may also categorize that template under the category that represents that amount. [[:Category:Noncategorizing templates|Noncategorizing]], (normal) [[:Category:Categorizing templates|Categorizing]] or [[:Category:Multi-categorizing templates|Multi-categorizing]]. | ||
Line 31: | Line 32: | ||
==Syntax== | ==Syntax== | ||
<nowiki>{{Infobox Template/categories|cat1=value|val1=value}}</nowiki> | <nowiki>{{Infobox Template/categories|cat1=value|val1=value}}</nowiki> | ||
+ | |||
+ | <span style="color:red">Warning</span>: 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== | ==Examples== | ||
Line 36: | Line 39: | ||
<nowiki>{{Infobox Template/categories|cat1=Child characters|val1=Child}}</nowiki> | <nowiki>{{Infobox Template/categories|cat1=Child characters|val1=Child}}</nowiki> | ||
− | :{{categorizer|category=Child characters|label=Child|nocat=true}} | + | :{{categorizer|category=Categorizing templates|label=One:|nocat=true}} |
+ | :*{{categorizer|category=Child characters|label=Child|nocat=true}} | ||
− | You can also specify multiple categories for one template | + | You can also specify multiple categories for one template: |
<nowiki>{{Infobox Template/categories|cat1=Child characters|val1=Child|cat2=Adult characters|val2=Adult}}</nowiki> | <nowiki>{{Infobox Template/categories|cat1=Child characters|val1=Child|cat2=Adult characters|val2=Adult}}</nowiki> | ||
Revision as of 23:00, 1 June 2014
This template renders information about another template, a variable list of categories, under which that template may categorize its articles. Depending on the amount of specified categories, this template may also categorize that template under the category that represents that amount. Noncategorizing, (normal) Categorizing or Multi-categorizing.
Parameters
- cat1: The name of the category the template may categorize under (parameter allows duplicates with increasing number; cat1, cat2, cat3, etc)
- val1: The value that the template requires for categorization under the category specified by cat1 (parameter allows duplicates with increasing number; val1, val2, val3, etc)
- nocat: Whether or not to suppress categorization under the automatically chosen category (defaults to false, which means auto categorization).
Note: the number-suffixed parameter pairs must be specified in pairs and in proper order, because the first empty/not specified pair terminates the list.
Note: although this template does not limit the amount of possible cat#/val# parameter pairs, the parent infobox limits to thirty pairs.
Note: if no cat#/val# parameter pair is detected, the default 'none' category will be used. These parameters always require a number, even if they are the only pair.
Syntax
{{Infobox Template/categories|cat1=value|val1=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 the pair of cat1 and val1 parameters to specify the category a template may categorize under:
{{Infobox Template/categories|cat1=Child characters|val1=Child}}
You can also specify multiple categories for one template:
{{Infobox Template/categories|cat1=Child characters|val1=Child|cat2=Adult characters|val2=Adult}}
You may leave the "categories" undefined by not specifying cat#/val# parameter pairs (the cat parameter specifically), or not maintaining proper ordering, so these all have the same result:
{{Infobox Template/categories}} {{Infobox Template/categories|cat1=|val1=}} {{Infobox Template/categories|cat=something|val=something}} {{Infobox Template/categories|cat1=|val1=something}} {{Infobox Template/categories|cat1=|val1=|cat2=something|val2=something}} {{Infobox Template/categories|cat1=something|val1=something|cat1=|val1=}}
- none [list all]
The nocat parameter may be used to suppress automatic categorization like this (any value will do):
{{Infobox Template/categories|cat1=Child characters|val1=Child|nocat=true}}
This would render the same result as the first example above, but would not automatically categorize under Category:Categorizing templates.