Template:Table row unless

From Angelina Jordan Wiki

Documentation

This template either outputs the code for a table row or doesn't, based on a specified condition. The code is output when the condition is false rather than when it is true, making this template "the opposite of" {{table row if}}. Both templates are intended to be used in infobox templates. They are not for forming arbitrary table rows.

Note that the template outputs HTML-style table code, not wiki-style. This is because the former tends to be a little more "robust" (i.e., less error-prone) than the latter.

Usage

  • {{table row unless|condition|label|content}}

If condition evaluates to a "true" boolean value (i.e., if it contains any non-whitespace characters), then nothing is output. Otherwise, a 2-column table row is output with label in a header cell in the left column and content in a data cell in the right column, as seen in the example below.

Example

<table class="wikitable">
{{table row unless|something|label 1|content 1}}
{{table row unless||label 2|content 2}}
{{table row unless| |label 3|content 3}}
</table>

label 2 content 2
label 3 content 3

As illustrated by the last template call in this example (the one with "content 3"), if the first unnamed/positional parameter consists only of whitespace (in this case, a space character, but it could also be a newline or a combination of spaces and newlines), then it evaluates to "false" and the table row gets displayed.