Template:Yesno

From OS-Tan Collections Wiki
Revision as of 18:40, 10 December 2023 by Halian (talk | contribs) (Created page with "{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: {{{1|¬}}} }} |no |n |f |false |off |0 = {{{no|<!-- null -->}}} | = {{{blank|{{{no|<!-- null -->}}}}}} |¬ = {{{¬|}}} |yes |y |t |true |on |1 = {{{yes|yes}}} |#default = {{{def|{{{yes|yes}}}}}} }}<noinclude> {{Documentation}} </noinclude>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Documentation icon Template documentation[view] [edit] [history] [purge]

{{Yesno}} evaluates any input and produces a normalized yes or nil output, based on the content of the input and several configurable options.

Usage

The template distinguishes five different types of input, supplied on the first unnamed parameter:

  1. Yes: Case-insensitive forms of Yes, y, true, on, and 1
  2. No: Case-insensitive forms of No, n, false, off, and 0
  3. Nothing: When the input is defined but either contains no value or consists of whitespace character only
  4. Negation: When the input is either ¬ (alt code 170) or entirely missing
  5. Anything else

By default, the template returns "yes" in the first and last case but returns nil (blank, empty string) in the other cases.