Vorlage:Yesno

Version vom 27. März 2018, 13:26 Uhr von ICON (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: {{{1|¬}}} }} |no |n |nein |0 = {{{no|<!-- null -->}}} |…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)

Dokumentation[Bearbeiten]

Usage

The template discerns five possible logical outputs depending on the first parameter (input if you will).

In its simplest usage these will all be either "yes" or "" (blank — nothing no characters).

  1. {{yesno|yes}} results in "yes" (also applies to "Yes", "YeS", etc, "Y", "y" and "1")
  2. {{yesno|no}} results in "" (also applies to "No", "NO", "nO", "N", "n" and "0")
  3. {{yesno}} results in ""
  4. {{yesno|¬}} results in ""
  5. {{yesno|purplemonkeydishwasher}} result "yes" (also applies to any other value not given above).


Each of these can be over-ridden.

  1. {{yesno|yes|yes=bacon}} results in "bacon" (also applies to "Yes", "YeS", etc, "Y", "y" and "1")
  2. {{yesno|no|no=ham}} results in "ham": (also applies to "No", "NO", "nO", "N", "n" and "0")
  3. {{yesno||blank=eggs}} results in "eggs"
    1. but {{yesno||no=ham}} results in "ham"
    2. and {{yesno||blank=eggs|no=ham}} results in "eggs"
  4. {{yesno|¬|¬=sausage}} results in "sausage"
  5. {{yesno|purplemonkeydishwasher|def=cup-of-tea}} results in "cup-of-tea" (also applies to any other value not given above).
    1. but {{yesno|purplemonkeydishwasher|yes=bacon}} results in "bacon"
    2. and {{yesno|purplemonkeydishwasher|def=cup-of-tea|yes=bacon}} results in "cup-of-tea"

This may be used (apparently perversely) thus:

  • {{yesno|yes|yes=no|no=yes}} results in "no"
  • {{yesno|no|yes=no|no=yes}} results in "yes"

This creates a logical inversion.

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  =
}}
Overview of {{yesno}} logical values and their associated texts
Input
parameter 1
(1=)
In code Logical return value Default
return text
Return text when set:
yes=Pos
no=Neg
blank=Blank
¬=Undefined
def=Def
Note
yes, y, 1* {{yesno|yes}} yes by definition "yes" "Pos" * Case-insensitive (Y=y)
Some Text {{yesno|Some Text}} yes by default "yes" "Def" "Pos" when def=<omitted>
no, n, 0* {{yesno|no}} no by definition "" "Neg" * Case-insensitive (N=n)
<blank> {{yesno|}} blank "" "Blank" "Neg" when blank=<omitted>
1=<blank> {{yesno|1=}} blank "" "Blank" "Neg" when blank=<omitted>
¬ {{yesno|¬}} ¬ "" "Undefined"
<omitted> {{yesno}} ¬ "" "Undefined"

Bei technischen Fragen zu dieser Vorlage kannst du dich an den Administrator wenden. Inhaltliche Fragen und Vorschläge gehören zunächst auf die Diskussionsseite.