Jump to content

Template:Concat/doc

From Meta, a Wikimedia project coordination wiki

Wikitext

[edit]

This Template:Concat contains:


{{{1|}}}{{{2|}}}{{{3|}}}...{{{150|}}}


Purpose

[edit]

This template concatenates parameters 1 − 150, as far as defined.

Newlines and spaces are preserved in the "expansion", and rendered as usual.

Usage

[edit]
{{Concat
  |data
  |data
  |...
}}

or

{{Concat
  |number=data
  |number=data
  |...
}}

The first form is not useful to apply directly; it can be useful in another template, e.g. Template:For. The second form sorts the data by parameter number, and removes duplicates: only the lastly defined value of a parameter counts; however, a defined value cannot be made undefined by any code later in the template call.

Examples

[edit]
Code Result
{{Concat|}}
{{Concat|a}} a
"{{Concat| a |b |c| d

}}"

" a b c d

"

{{Concat|a|b|c}} abc
{{Concat|2=a|3=b|1=c}} cab
{{Concat|2=a|3=b|2=c}} cb
{{Concat|100=a|200=b}} ab
{{Concat|1=2=3|4=5=6}} 2=35=6
{{for|, |call=concat and link to w:en:|pcv1=John_|pv=2||Lennon|Wayne}} John_, John_Lennon, John_Wayne

The last example uses Template:concat and link to w:en: containing "[[w:en:{{{1|}}}{{{2|}}}|{{{1|}}}{{{2|}}}]]".