Plantilla:Yesno-no Ver historial

Revisión del 21:00 13 ene 2021 de JanKlaaseen (discusión | contribs.) (Página creada con «{{safesubst:<noinclude />yesno|{{{1}}}|yes={{{yes|yes}}}|no={{{no|no}}}|blank={{{blank|no}}}|¬={{{¬|no}}}|def={{{def|no}}}}}<noinclude> {{Documentation|Template:Yesno/doc…»)
(difs.) ← Revisión anterior | Revisión actual (difs.) | Revisión siguiente → (difs.)

no

Documentation icon Template documentation[view] [edit] [history] [purge ]

Plantilla:High-use Plantilla:Tlx (or Plantilla:Tlg) 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:

  1. Yes: Case-insensitive forms of Yes, y, true, on, and 1; e.g. Plantilla:Tlx
  2. No: Case-insensitive forms of No, n, false, off, and 0; e.g. Plantilla:Tlx
  3. Nothing: When the input is defined but either contains no value or consists of whitespace character only; i.e. {{Yesno|}} or Plantilla:Tlx
  4. Negation: When the input is either ¬ or entirely missing; i.e. Plantilla:Tlx or Plantilla:Tlx
  5. Anything else: e.g. Plantilla:Tlx

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:

) unless an explicit negative value is given; i.e., it evaluates to "yes" even when the value is empty or missing.

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

Customizing the output

Template's default output can be customized with five named parameters, respectively: |yes=

, |no=

, |blank=

, |¬=

and |def=

. If these parameters are specified, the template response is as follows:

  1. Yes: Template returns the contents of |yes=

, otherwise returns "yes". For example:

  1. No: Template returns the contents of |no=

, otherwise returns blank. For example:

  1. Nothing: Template returns the contents of |blank=

, or of |no=

in absence of the former; otherwise, returns blank.
  1. Negation: Template returns the contents of |¬=

, otherwise returns blank. For example:

  1. Anything else: Template returns the contents of |def=

, or of |yes=

in absence of the former; otherwise, returns "yes".

For the named parameters, use of a blank value is not the same as omitting the parameter. A blank named parameter tells the template that the customized return value is blank. For example:

Logical distinctions

Overview of Plantilla:Tlx logical values and their associated texts
Input
parameter 1
(Plantilla:Code)
In code Logical return value Default
return text
Return text when set:
Plantilla:Code
Plantilla:Code
Plantilla:Code
Plantilla:Code
Plantilla:Code
Note
yes, y, true, 1* Plantilla:Code Plantilla:Nowrap "yes" "Pos" * Case-insensitive (Y=y)
Plantilla:Nowrap Plantilla:Nowrap Plantilla:Code "yes" "Def" "Pos" when Plantilla:Nowrap
no, n, false, 0* Plantilla:Code Plantilla:Code "" Plantilla:Var "Neg" * Case-insensitive (N=n)
Plantilla:Var Plantilla:Code Plantilla:Code "" Plantilla:Var "Blank" "Neg" when Plantilla:Nowrap
1=Plantilla:Var Plantilla:Code Plantilla:Code "" Plantilla:Var "Blank" "Neg" when Plantilla:Nowrap
¬ Plantilla:Code Plantilla:Code "" Plantilla:Var "Undefined"
Plantilla:Var Plantilla:Code Plantilla:Code "" Plantilla:Var "Undefined"
Comparison with related templates
Input parameter 1 (Plantilla:Code) Plantilla:Tl Plantilla:Tl Plantilla:Tl
yes, y, true, 1* "yes" "yes" "yes"
Plantilla:Nowrap "yes" "yes" "no"
no, n, false, 0* "" Plantilla:Var "no" "no"
Plantilla:Var "" Plantilla:Var "yes" "no"
1=Plantilla:Var "" Plantilla:Var "yes" "no"
¬ "" Plantilla:Var "yes" "no"
Plantilla:Var "" Plantilla:Var "yes" "no"

Full parameter list

Unnamed parameter 1= the input value to be evaluated. The other parameters (all named, all optional), are the return values for their respective logical outcome. When set, each one overrules their default return value.

{{yesno
|
| yes  =
| no   =
| blank=
| ¬    =
| def  =
}}

See also

  • Module:yesno
  • Plantilla:Tlx – slower than Yesno, but can properly handle ref tags inside the parameters
  • Plantilla:Tlx – variant of Yesno that defaults to "yes" if value is not explicitly negative
  • Plantilla:Tlx – variant of Yesno that defaults to "no" if value is not explicitly positive

TemplateData

Plantilla:TemplateData header

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

Parámetros de la plantilla

ParámetroDescripciónTipoEstado
Input value1

The value to be evaluated

Cadenaobligatorio
Output on yesyes

Specifies the output of the template when the input value is a case-insensitive forms of 'Yes', 'Y', 'True' or '1'

Cadenaopcional
Output on nono

Specifies the output of the template when the input value is a case-insensitive forms of 'No', 'N', 'False, or '0'

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

Cadenaopcional
Output on ¬¬

Specifies the output of the template when the input value is either '¬' or entirely missing (undefined)

Cadenaopcional
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

Cadenaopcional

Plantilla:Sandbox other

The above documentation is transcluded from Template:Yesno/doc.
[[Special:PrefixIndex/Plantilla:Plantilla:Documentation/template page/|Subpages of this template]].