Template:Yesno
Jump to navigation
Jump to search
![]() |
This template is used on 4,718,779+ pages. To avoid large-scale disruption and unnecessary server load, any changes should first be tested in this template's /sandbox or /testcases subpage, or in your own user space. The tested changes can then be added in one single edit to this template. Please consider discussing any changes on the talk page before implementing them. |
This template normalises an input to be a yes/no output.
Usage
The template discerns five possible logical outputs depending on the first parameter (input if you will).
In its simplest usage these will all be either "yes" or "" (blank - nothing no characters).
- {{yesno|yes}} result "yes" (also applies to "Yes", "YeS", etc, "Y", "y" and "1")
- {{yesno|no}} result "" (also applies to "No", "NO", "nO", "N", "n" and "0")
- {{yesno}} result ""
- {{yesno|¬}} result ""
- {{yesno|purplemonkeydishwasher}} result "yes" (also applies to any other value not given above).
Each of these can be over-ridden.
- {{yesno|yes|yes=bacon}} result "bacon" (also applies to "Yes", "YeS", etc, "Y", "y" and "1")
- {{yesno|no|no=ham}} result "ham": (also applies to "No", "NO", "nO", "N", "n" and "0")
- {{yesno||blank=eggs}} result "eggs"
- but {{yesno||no=ham}} result "ham"
- and {{yesno||blank=eggs|no=ham}} result "eggs"
- {{yesno|¬|¬=sausage}} result "sausage"
- {{yesno|purplemonkeydishwasher|def=cup-of-tea}} result "cup-of-tea" (also applies to any other value not given above).
- but {{yesno|purplemonkeydishwasher|yes=bacon}} result "bacon"
- but {{yesno|purplemonkeydishwasher|def=cup-of-tea|yes=bacon}} result "cup-of-tea"
This may be used (apparently perversely) thus:
- {{yesno|yes|yes=no|no=yes}} result "no"
- {{yesno|no|yes=no|no=yes}} result "yes"
This creates a logical inversion.
Full parameter list
Unnamed parameter 1= the input value to be evaluated. The other parameters (all named, all optional), are the return values for their respective logical outcome. When set, each one overrules their default return value.
{{yesno | | yes = | no = | blank= | ¬ = | def = }}
Overview of {{yesno}} logical values and their associated texts | ||||||
---|---|---|---|---|---|---|
Input parameter 1 ( <syntaxhighlight lang="text" enclose="none">1=</syntaxhighlight> )
|
In code | Logical return value | Default return text |
Return text when set:<syntaxhighlight lang="text" enclose="none">yes=Pos</syntaxhighlight> <syntaxhighlight lang="text" enclose="none">no=Neg</syntaxhighlight> <syntaxhighlight lang="text" enclose="none">blank=Blank</syntaxhighlight> <syntaxhighlight lang="text" enclose="none">¬=Undefined</syntaxhighlight> <syntaxhighlight lang="text" enclose="none">def=Def</syntaxhighlight>
|
Note | |
yes, y, 1* | <syntaxhighlight lang="text" enclose="none">{{yesno|yes}}</syntaxhighlight>
|
<syntaxhighlight lang="text" enclose="none">yes by definition</syntaxhighlight>
|
"yes" | "Pos" | * Case-insensitive (Y=y) | |
Some Text | <syntaxhighlight lang="text" enclose="none">{{yesno|Some Text}}</syntaxhighlight>
|
<syntaxhighlight lang="text" enclose="none">yes by default</syntaxhighlight>
|
"yes" | "Def" | "Pos" when <syntaxhighlight lang="text" enclose="none">def=<omitted></syntaxhighlight>
| |
no, n, 0* | <syntaxhighlight lang="text" enclose="none">{{yesno|no}}</syntaxhighlight>
|
<syntaxhighlight lang="text" enclose="none">no by definition</syntaxhighlight>
|
"" | "Neg" | * Case-insensitive (N=n) | |
<blank> | <syntaxhighlight lang="text" enclose="none">{{yesno|}}</syntaxhighlight>
|
<syntaxhighlight lang="text" enclose="none">blank</syntaxhighlight>
|
"" | "Blank" | "Neg" when <syntaxhighlight lang="text" enclose="none">blank=<omitted></syntaxhighlight>
| |
1=<blank> | <syntaxhighlight lang="text" enclose="none">{{yesno|1=}}</syntaxhighlight>
|
<syntaxhighlight lang="text" enclose="none">blank</syntaxhighlight>
|
"" | "Blank" | "Neg" when <syntaxhighlight lang="text" enclose="none">blank=<omitted></syntaxhighlight>
| |
¬ | <syntaxhighlight lang="text" enclose="none">{{yesno|¬}}</syntaxhighlight>
|
<syntaxhighlight lang="text" enclose="none">¬</syntaxhighlight>
|
"" | "Undefined" | ||
<omitted> | <syntaxhighlight lang="text" enclose="none">{{yesno}}</syntaxhighlight>
|
<syntaxhighlight lang="text" enclose="none">¬</syntaxhighlight>
|
"" | "Undefined" |
The above documentation is transcluded from Template:Yesno/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |