Template:Yesno: Difference between revisions
simplify, defaults to yes, and no parameter not used |
m Protected "Template:Yesno": Highly visible template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite)) |
||
(11 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
{{#switch: {{lc: {{{1|¬}}} }} |
{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: {{{1|¬}}} }} |
||
|no |
|no |
||
|n |
|n |
||
| |
|false |
||
| |
|0 = {{{no|<!-- null -->}}} |
||
| = {{{blank|{{{no|<!-- null -->}}}}}} |
|||
|¬ = {{{¬|}}} |
|¬ = {{{¬|}}} |
||
|yes |
|yes |
||
|y |
|y |
||
| |
|true |
||
| |
|1 = {{{yes|yes}}} |
||
|#default = {{{def|{{{yes|yes}}}}}} |
|||
}}<noinclude> |
}}<noinclude> |
||
{{ |
{{Documentation}} |
||
{{documentation}} |
|||
</noinclude> |
</noinclude> |
Latest revision as of 05:49, 30 August 2019
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|yes=bacon}} → "bacon" (also applies to "Yes", "YeS", etc, "Y", "y" and "1")
- {{Yesno|no|no=ham}} → "ham" (also applies to "No", "NO", "nO", "N", "n" and "0")
- {{Yesno|blank=eggs}} → "eggs"
- {{Yesno|¬|¬=sausage|blank=eggs|no=ham}} → "sausage"
- and {{Yesno|¬=sausage|blank=eggs|no=ham}} → "sausage"
- {{Yesno|purplemonkeydishwasher|def=cup-of-tea}} → "{{Yesno|purplemonkeydishwasher|def=cup-of-tea}}" (also applies to any other value not given above)
This may be used (apparently perversely) thus:
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 |