Difference between revisions of "Template:Firstdata/doc"
Jump to navigation
Jump to search
imported>DePiep |
imported>Uzume |
||
| (5 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> | <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> | ||
| + | In template code, one can list multiple input parameters, and this template will return the first input value that is not blank. | ||
| + | |||
| + | Example: | ||
| + | |||
| + | :In article: <code><nowiki>{{Infobox foo|name= |height=1200 m |location=Spain }}</nowiki></code> | ||
| + | :In template code: <code><nowiki>{{Firstdata |{{{name|}}} |{{{location|}}}| {{{height|}}} }}</nowiki></code> | ||
| + | :returns <code>Spain</code> for further processing | ||
| + | |||
== Usage == | == Usage == | ||
| − | Can have up to | + | Can have up to five parameters input. Will return the first parameter that is not blank. |
<pre> | <pre> | ||
| Line 9: | Line 17: | ||
|2= | |2= | ||
|3= | |3= | ||
| + | |4= | ||
| + | |5= | ||
}} | }} | ||
</pre> | </pre> | ||
| Line 18: | Line 28: | ||
Whitespace is stripped. | Whitespace is stripped. | ||
| − | == | + | ==Example== |
* <nowiki>{{firstdata||two|three}}</nowiki> → {{firstdata||two|three}} | * <nowiki>{{firstdata||two|three}}</nowiki> → {{firstdata||two|three}} | ||
* <nowiki>{{firstdata|one||three}}</nowiki> → {{firstdata|one||three}} | * <nowiki>{{firstdata|one||three}}</nowiki> → {{firstdata|one||three}} | ||
* <nowiki>{{firstdata|||}}</nowiki> → {{firstdata|||}} | * <nowiki>{{firstdata|||}}</nowiki> → {{firstdata|||}} | ||
| + | ==See also== | ||
| + | *{{tl|If empty}} | ||
<includeonly>{{sandbox other|| | <includeonly>{{sandbox other|| | ||
Latest revision as of 17:38, 28 June 2020
| 40px | This is a documentation subpage for Template:Firstdata. It contains usage information, categories and other content that is not part of the original template page. |
In template code, one can list multiple input parameters, and this template will return the first input value that is not blank.
Example:
- In article:
{{Infobox foo|name= |height=1200 m |location=Spain }} - In template code:
{{Firstdata |{{{name|}}} |{{{location|}}}| {{{height|}}} }} - returns
Spainfor further processing
Usage
Can have up to five parameters input. Will return the first parameter that is not blank.
{{firstdata
|1=
|2=
|3=
|4=
|5=
}}
or
{{firstdata|||}}
Practical use is inside an other template:
{{firstdata|{{{foo|}}} |{{{bar|}}} }}
Whitespace is stripped.
Example
- {{firstdata||two|three}} → two
- {{firstdata|one||three}} → one
- {{firstdata|||}} →
See also
- {{If empty}}