Template:Yesno: Difference between revisions

Template page
RTGame>Fadyblok240
(any no values return nothing)
m (1 revision imported)
Line 1: Line 1:
<includeonly>{{#switch: {{lc: {{{1|}}}}}
{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: {{{1|¬}}} }}
  | y | yes | t | true | 1 = {{{yes|yes}}}
  |no
  | n | no  | f | false | 0 | = {{{no|}}}
|n
|<!--blank--> = {{{blank|{{{no|}}} }}}
|false
  | #default = {{{yes|yes}}}
  |0        = {{{no|<!-- null -->}}}
}}</includeonly><noinclude>{{documentation}}
  |         = {{{blank|{{{no|<!-- null -->}}}}}}
<!-- Put categories/interwiki on the documentation page --></noinclude>
|¬        = {{{¬|}}}
|yes
|y
|true
|1        = {{{yes|yes}}}
  |#default = {{{def|{{{yes|yes}}}}}}
}}<noinclude>{{/doc}}</noinclude>

Revision as of 16:51, 2 May 2021

Template documentation[view][edit][history][purge]
This documentation is transcluded from Template:Yesno/doc. Changes can be proposed in the talk page.

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).

  1. {{yesno|yes}} result "yes" (also applies to "Yes", "YeS", etc, "Y", "y" and "1")
  2. {{yesno|no}} result "" (also applies to "No", "NO", "nO", "N", "n" and "0")
  3. {{yesno}} result ""
  4. {{yesno|¬}} result ""
  5. {{yesno|purplemonkeydishwasher}} result "yes" (also applies to any other value not given above).


Each of these can be over-ridden.

  1. {{yesno|yes|yes=bacon}} result "bacon" (also applies to "Yes", "YeS", etc, "Y", "y" and "1")
  2. {{yesno|no|no=ham}} result "ham" (also applies to "No", "NO", "nO", "N", "n" and "0")
  3. {{yesno|blank= eggs}} result "eggs"
    1. but {{yesno|no=ham}} result "ham"
    2. and {{yesno|blank= eggs|no=ham}} result "eggs"
  4. {{yesno|¬|¬=sausage}} result "sausage"
  5. {{yesno|purplemonkeydishwasher|def=cup-of-tea}} result "cup-of-tea" (also applies to any other value not given above).
    1. but {{yesno|purplemonkeydishwasher|yes=bacon}} result "bacon"
    2. 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.