Ашаблон:Yesno
Внешний вид
Ашаблон адокументациа[аԥхьара] [аредакциазура] [аҭоурых] [purge]
Ахәҭаҷ/асекциа адырра апроцесс аԥсуа бызшәа аиҭагара ахь. Абызшәа адырра шәазҟазазар, ишәылшоит шәхы алашәырхәыр. |
{{Yesno}}
(or {{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}}
→ ааи - 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}}
→ ааи
By default, the template returns "yes" in the first and last case but returns nil (blank, empty string) in the other cases.
Two short-hand templates for the most common uses that override the default behavior:
{{yesno-yes}}
or{{YesNo-Yes}}
– always returns "yes" (or the specified replacement result in|yes=
) unless an explicit negative value is given; i.e., it evaluates to "yes" even when the value is empty or missing.{{yesno-no}}
or{{YesNo-No}}
– always returns "no" (or the specified replacement result in|no=
) unless an explicit positive value is given; i.e., it evaluates to "no" even when the value is present, as long as it does not contain anything that resolves to "yes".