Difference between revisions of "Template:Firstdata/doc"
Jump to navigation
Jump to search
imported>DePiep |
imported>DePiep |
||
| Line 6: | Line 6: | ||
:In article: <code><nowiki>{{Infobox foo|name= |height=1200 m |location=Spain }}</nowiki></code> | :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> | + | :In template code: <code><nowiki>{{Firstdata |{{{name|}}} |{{{location|}}}| {{{height|}}} }}</nowiki></code> |
:returns <code>Spain</code> for further processing | :returns <code>Spain</code> for further processing | ||
Revision as of 14:10, 3 October 2019
| 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|||}} →