Template:Table row if/doc

From Angelina Jordan Wiki
This is a subpage documenting Template:Table row if. To change the template, edit that page; to change the template's documentation (seen below), edit this one.

Documentation

This template is a conditional version of {{table row}}. It either outputs the code for a 2-column table row or doesn't, based on a specified condition. (Note that this template is not for general use in forming all table rows. It is intended to be used specifically to create infobox templates.)

This 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. So it should only be used inside of an HTML-style table (<table>…</table>).

This template is used on a great many pages. Making any changes to it will cause lots of jobs to be added to the processing queue.

Usage

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

In the first form, the table row will be output using the given label and content if only if condition evaluates to a "true" boolean value (i.e., if it contains any non-whitespace characters).

In the second form, content is used as the condition — i.e., if there is any content to show then show it in a table row, otherwise don't show anything.

With any luck, the following example will clarify all of this.

Example

<table class="wikitable">
{{table row if|something is true|show|this content}}
{{table row if||do|nothing}}
{{table row if|there is content to show|show it with this label}}
{{table row if||nope}}
{{table row if| |neither}}
</table>

show this content
show it with this label there is content to show

As illustrated by the last template call in this example (the one with "neither"), 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 is not displayed.