Template:Yesno/doc: Difference between revisions
DansFriend (talk | contribs) (Created page with "{{t|Yesno}} evaluates any input and produces a normalized <samp>yes</samp> or nil output, based on the content of the input and several configurable options. It is not used in article prose, but in coding complex templates. == Usage == The template distinguishes five different types of input, supplied on the first unnamed parameter: # '''Yes''': Case-insensitive forms of <code>Yes</code>, <code>y</code>, <code>true</code>, <code>on</code>, and <code>1</code>; e.g. {{tlx...") |
DansFriend (talk | contribs) No edit summary |
||
Line 10: | Line 10: | ||
By default, the template returns "yes" in the first and last case but returns nil (blank, empty string) in the other cases. | By default, the template returns "yes" in the first and last case but returns nil (blank, empty string) in the other cases. | ||
<includeonly>[[Category:Templates]]</includeonly> | <includeonly>[[Category:Templates]]</includeonly><noinclude>[[Category:Template documentation]]</noinclude> |
Latest revision as of 00:54, 12 July 2023
{{Yesno}} 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 used in article prose, but in coding complex templates.
Usage
The template distinguishes five different types of input, supplied on the first unnamed parameter:
- Yes: Case-insensitive forms of
Yes
,y
,true
,on
, and1
; e.g.{{Yesno|yEs}}
→ yes - No: Case-insensitive forms of
No
,n
,false
,off
, and0
; e.g.{{Yesno|nO}}
→ - Nothing: When the input is defined but either contains no value or consists of whitespace character only; i.e.
{{Yesno|}}
or{{Yesno| }}
→ - Negation: When the input is either
¬
(alt code 170) or entirely missing; i.e.{{Yesno|¬}}
or{{Yesno}}
→ - Anything else: e.g.
{{Yesno|Purple monkey dish washer}}
→ yes
By default, the template returns "yes" in the first and last case but returns nil (blank, empty string) in the other cases.