Difference between revisions of "Template:Infobox Template/choice"

From Twinsuniverse
Jump to: navigation, search
(new subpage to template-infobox)
 
(added the nonchoice option)
Line 3: Line 3:
 
| single = {{categorizer|category=Single-choice templates|label=Single value|nocat={{{nocat|false}}}}}
 
| single = {{categorizer|category=Single-choice templates|label=Single value|nocat={{{nocat|false}}}}}
 
| multiple = {{categorizer|category=Multiple-choice templates|label=Multiple values|nocat={{{nocat|false}}}}}
 
| multiple = {{categorizer|category=Multiple-choice templates|label=Multiple values|nocat={{{nocat|false}}}}}
 +
| none = {{categorizer|category=Nonchoice templates|display=none|nocat={{{nocat|false}}}}}
 
| {{maintenance task|nocat={{{nocat|false}}}
 
| {{maintenance task|nocat={{{nocat|false}}}
 
     |category=Templates of unknown choice
 
     |category=Templates of unknown choice
Line 18: Line 19:
 
#* ''single''
 
#* ''single''
 
#* ''multiple''
 
#* ''multiple''
 +
#* ''none''
 
#* any other (non)empty value defaults to: ''unknown''
 
#* any other (non)empty value defaults to: ''unknown''
 
* '''nocat''': Whether or not to suppress categorization under the selected category (defaults to false, which means auto categorization).
 
* '''nocat''': Whether or not to suppress categorization under the selected category (defaults to false, which means auto categorization).
Line 37: Line 39:
  
 
:{{categorizer|category=Multiple-choice templates|label=Multiple values|nocat=true}}
 
:{{categorizer|category=Multiple-choice templates|label=Multiple values|nocat=true}}
 +
 +
 +
You don't have to specify "choice" for templates that don't offer one, by specifying the "none" value, so this won't display anything:
 +
<nowiki>{{Infobox Template/choice|none}}</nowiki>
 +
 +
Instead, this would still categorize the page under the [[:Category:Nonchoice templates|Nonchoice templates]] category, inline with the other values above.
  
  

Revision as of 22:51, 2 June 2014

This template offers a way to specify whether another template accepts one single or multiple choices, from a selection of values. It can also automatically categorize the template page under the related category for that type of choice.


Note: "multiple choice" means here the ability to select multiple values from the set of available ones, not that there are multiple values available (as all cases have that).

Parameters

  1. The type of choice the template accepts (no parameter name and value is case insensitive):
    • single
    • multiple
    • none
    • any other (non)empty value defaults to: unknown
  • nocat: Whether or not to suppress categorization under the selected category (defaults to false, which means auto categorization).

Syntax

{{Infobox Template/choice|value}}

Examples

Common use includes the unnamed parameter with either values "single" or "multiple":

{{Infobox Template/choice|single}}
{{Infobox Template/choice|multiple}}
Single value [list all]
Multiple values [list all]


The case of the value is not important:

{{Infobox Template/choice|MULtipLE}}
Multiple values [list all]


You don't have to specify "choice" for templates that don't offer one, by specifying the "none" value, so this won't display anything:

{{Infobox Template/choice|none}}

Instead, this would still categorize the page under the Nonchoice templates category, inline with the other values above.


You may leave "choice" undefined (which would raise the Templates of unknown choice maintenance task) by not specifying any valid value, so these all have the same result:

{{Infobox Template/choice}}
{{Infobox Template/choice|}}
{{Infobox Template/choice|yeah}}
{{Infobox Template/choice|true}}
{{Infobox Template/choice|inevitable}}
{{Infobox Template/choice|there is no spoon}}
{{Infobox Template/choice|7}}
{{Infobox Template/choice|C}}
unknown [list all]


The nocat parameter may be used to suppress automatic categorization like this (any value will do):

{{Infobox Template/choice|single|nocat=true}}

This would render the same result as the first example above, but would not automatically categorize under Category:Single-choice templates. This feature works both on valid values and the maintenance task mentioned above.