Template:Yesno/doc

Revision as of 01:43, 9 June 2021 by Saucy (talk | contribs) (doc)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This template evaluates any input and produces a normalized yes or nil output, based on the content of the input and several configurable options. It is not meant for use directly in articles, but for making templates.

In a nutshell edit

If the input the template receives is (not case sensitive) "no", "n", "false", "off", "0", is only whitespace, or is entirely missing; then the template returns an empty string. If any other value is received, then the template returns "yes".

This is useful for creating opt-in parameters in templates. For example, a nocat parameter:

{{#if: {{yesno| {{{nocat|}}} }} ||[[Category:Your category here]]}}

In this example, the template adds the page to the category, but if the user does not want that then they can set the parameter nocat=yes, nocat=y, etc.

This is a basic use case for this template. What the template outputs can be changed. For more complex usage, read Wikipedia's documentation.

TemplateData edit

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

Template 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