Template:Yesno/doc

Template page
Revision as of 21:46, 19 February 2024 by Mausterio (talk | contribs) (Created page with "<includeonly> {{Languages|Template:Yesno/doc}} </includeonly>{{Documentation subpage}} <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS 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). * {{Tlx|Yesno|yes}} → "yes" (also applies to "Yes",...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:Documentation subpage

This template normalises an input to be a yes/no output.

Usage[edit]

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"
    • but {{Yesno|no=ham}} → "ham"
    • and {{Yesno|blank=eggs|no=ham}} → "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)
    • but {{Yesno|purplemonkeydishwasher|yes=bacon}} → "bacon"
    • and {{Yesno|purplemonkeydishwasher|def=cup-of-tea|yes=bacon}} → "cup-of-tea"

This may be used (apparently perversely) thus:

  • {{Yesno|yes|yes=no|no=yes}} → "no"
  • {{Yesno|no|yes=no|no=yes}} → "yes"

This creates a logical inversion.

TemplateData[edit]

Template:TemplateData header

This template normalises an input to be a yes or nil output.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Input value1

The value to be evaluated.

Stringrequired
Output on yesyes

Specifies the output of the template when the input value is a case-insensitive forms of 'Yes', 'Y', 'True' or '1'.

Stringoptional
Output on nono

Specifies the output of the template when the input value is a case-insensitive forms of 'No', 'N', 'False', or '0'.

Stringoptional
Output on blank inputblank

Specifies the output of the template when the input value is defined but is either empty or contains nothing but whitespace character(s).

Stringoptional
Output on ¬¬

Specifies the output of the template when the input value is either '¬' or entirely missing (undefined).

Stringoptional
Definite outputdef

Specifies the output of the template when the input value is defined but not a form of 'yes', 'no', '1', '0', '¬' or blank.

Stringoptional

See also[edit]