Vorlage:booland
<templatestyles src="TOC nonum/styles.css"></templatestyles>
⧼templatedata-doc-params⧽
| ⧼templatedata-doc-param-name⧽ | ⧼templatedata-doc-param-desc⧽ | ⧼templatedata-doc-param-type⧽ | ⧼templatedata-doc-param-status⧽ | |
|---|---|---|---|---|
| 1. Wert | 1 | 1. Wert zur Verknüpfung | ⧼templatedata-doc-param-type-boolean⧽ | ⧼templatedata-doc-param-status-required⧽ |
| 2. Wert | 2 | 2. Wert zur Verknüpfung | ⧼templatedata-doc-param-type-boolean⧽ | ⧼templatedata-doc-param-status-required⧽ |
| weiterer Wert | 3 | Weiterer Wert zur Verknüpfung | ⧼templatedata-doc-param-type-boolean⧽ | ⧼templatedata-doc-param-status-optional⧽ |
| weitere Werte | 4 | Beliebig viele weitere Werte zur Verknüpfung | ⧼templatedata-doc-param-type-boolean⧽ | ⧼templatedata-doc-param-status-optional⧽ |
Kopiervorlage
<syntaxhighlight lang="wikitext" copy>
</syntaxhighlight>
Hinweise
Im Unterschied zur Wikisyntax werden nicht nur leere Strings als „false“ betrachtet, sondern auch solche, welche 0, - oder false enthalten.
Die Vorlage erzeugt einen nichtleeren String (1, also „wahr“), wenn alle Parameter nach vorstehender Regel „wahr“ sind, ansonsten einen leeren String.
Alle Parameter müssen erst ausgewertet werden, bevor sie verknüpft werden können. Das ist ein Problem, wenn die Ermittlung aufwändig ist („teuer“ oder sonst performancekritisch). Besser ist dann: <syntaxhighlight lang="wikitext" copy> {{#if: Vorlage:A-Vorlage
| <Aktion>
</syntaxhighlight>
Beispiele
{{#if: {{booland|| }} | Ja | Nein}}ergibt
Nein
{{#if: {{booland|xxx| }} | Ja | Nein}}ergibt
Nein
{{#if: {{booland| |yyy}} | Ja | Nein}}ergibt
Nein
{{#if: {{booland|xxx|yyy}} | Ja | Nein}}ergibt
Ja
{{#if: {{booland|xxx|yyy| }} | Ja | Nein}}ergibt
Nein
{{#if: {{booland|xxx|yyy|}} | Ja | Nein}}ergibt
Nein
Wahrheitstabellen
| Eingabe | Ausgabe |
|---|---|
| {{booland| | }} | |
| {{booland| |1}} | |
| {{booland|1| }} | |
| {{booland|1|1}} | 1 |
| Eingabe | Ausgabe |
|---|---|
| {{booland| | | }} | |
| {{booland| |1| }} | |
| {{booland|1| | }} | |
| {{booland|1|1| }} | |
| {{booland| | |1}} | |
| {{booland| |1|1}} | |
| {{booland|1| |1}} | |
| {{booland|1|1|1}} | 1 |
| Eingabe | Ausgabe |
|---|---|
| {{booland| | | | }} | |
| {{booland| |1| | }} | |
| {{booland|1| | | }} | |
| {{booland|1|1| | }} | |
| {{booland| | |1| }} | |
| {{booland| |1|1| }} | |
| {{booland|1| |1| }} | |
| {{booland|1|1|1| }} | |
| {{booland| | | |1}} | |
| {{booland| |1| |1}} | |
| {{booland|1| | |1}} | |
| {{booland|1|1| |1}} | |
| {{booland| | |1|1}} | |
| {{booland| |1|1|1}} | |
| {{booland|1| |1|1}} | |
| {{booland|1|1|1|1}} | 1 |
Siehe auch
Lua
Verwendetes Modul: Expr #TemplateBooland