Template:Yesno
This template normalises an input to be a yes/no output.
Usage
The template has five possible outputs depending on the default parameter (input if you will).
In its simplest usage, these will all be either "yes" or "" (blank = nothing no characters).
- {{Yesno|yes}} → "yes" (also applies to "Yes", "YeS", etc, "Y", "y" and "1")
- {{Yesno|no}} → "" (also applies to "No", "NO", "nO", "N", "n" and "0")
- {{Yesno}} → ""
- {{Yesno|¬}} → ""
- {{Yesno|purplemonkeydishwasher}} → "yes" (also applies to any other value not given above)
Each of these can be over-ridden.
- {{Yesno|yes|yesTemplate:=bacon}} → "bacon" (also applies to "Yes", "YeS", etc, "Y", "y" and "1")
- {{Yesno|no|noTemplate:=ham}} → "ham" (also applies to "No", "NO", "nO", "N", "n" and "0")
- {{Yesno|blankTemplate:=eggs}} → "eggs"
- but {{Yesno|noTemplate:=ham}} → "ham"
- and {{Yesno|blankTemplate:=eggs|noTemplate:=ham}} → "eggs"
- {{Yesno|¬|¬Template:=sausage|blankTemplate:=eggs|noTemplate:=ham}} → "sausage"
- and {{Yesno|¬Template:=sausage|blankTemplate:=eggs|noTemplate:=ham}} → "sausage"
- {{Yesno|purplemonkeydishwasher|defTemplate:=cup-of-tea}} → "{{Yesno|purplemonkeydishwasher|defTemplate:=cup-of-tea}}" (also applies to any other value not given above)
- but {{Yesno|purplemonkeydishwasher|yesTemplate:=bacon}} → "bacon"
- and {{Yesno|purplemonkeydishwasher|defTemplate:=cup-of-tea|yesTemplate:=bacon}} → "cup-of-tea"
This may be used (apparently perversely) thus:
- {{Yesno|yes|yesTemplate:=no|noTemplate:=yes}} → "no"
- {{Yesno|no|yesTemplate:=no|noTemplate:=yes}} → "yes"
This creates a logical inversion.
TemplateData
This is the TemplateData documentation for this template used by VisualEditor and other tools.
Yesno
This template normalises an input to be a yes or nil output.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Input value | 1 | The value to be evaluated. | String | required |
Output on yes | yes | Specifies the output of the template when the input value is a case-insensitive forms of 'Yes', 'Y', 'True' or '1'. | String | optional |
Output on no | no | Specifies the output of the template when the input value is a case-insensitive forms of 'No', 'N', 'False', or '0'. | String | optional |
Output on blank input | blank | Specifies the output of the template when the input value is defined but is either empty or contains nothing but whitespace character(s). | String | optional |
Output on ¬ | ¬ | Specifies the output of the template when the input value is either '¬' or entirely missing (undefined). | String | optional |
Definite output | def | Specifies the output of the template when the input value is defined but not a form of 'yes', 'no', '1', '0', '¬' or blank. | String | optional |
See also
[[Category:Utility templates{{#translation:}}]]