Template:Yesno: Difference between revisions

From Campaigns
Jump to navigation Jump to search
add additional paramerters, "t", "f" - requested on talk - worked in sandbox /testcases
m 1 revision imported
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
  |no
  |no
  |n
  |n
|f
  |false
  |false
|off
  |0        = {{{no|<!-- null -->}}}
  |0        = {{{no|<!-- null -->}}}
  |        = {{{blank|{{{no|<!-- null -->}}}}}}
  |        = {{{blank|{{{no|<!-- null -->}}}}}}
Line 10: Line 8:
  |yes
  |yes
  |y
  |y
|t
  |true
  |true
|on
  |1        = {{{yes|yes}}}
  |1        = {{{yes|yes}}}
  |#default = {{{def|{{{yes|yes}}}}}}
  |#default = {{{def|{{{yes|yes}}}}}}

Latest revision as of 00:37, 4 November 2021

Template documentation


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

  • → "yes" (also applies to "Yes", "YeS", etc, "Y", "y" and "1")
  • → "" (also applies to "No", "NO", "nO", "N", "n" and "0")
  • → ""
  • → ""
  • → "yes" (also applies to any other value not given above)

Each of these can be over-ridden.

  • → "bacon" (also applies to "Yes", "YeS", etc, "Y", "y" and "1")
  • → "ham" (also applies to "No", "NO", "nO", "N", "n" and "0")
  • → "eggs"
    • but → "ham"
    • and → "eggs"
  • → "sausage"
    • and → "sausage"
  • → "" (also applies to any other value not given above)
    • but → "bacon"
    • and → "cup-of-tea"

This may be used (apparently perversely) thus:

  • → "no"
  • → "yes"

This creates a logical inversion.

TemplateData

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

Template parameters[Edit template data]

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

[[Category:Utility templates{{#translation:}}]]