Difference between revisions of "Template:For Each"
m (10 revisions imported: Initial import from smithfam) |
|||
| (4 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
* Second parameter: delimiter to search for; default is comma | * Second parameter: delimiter to search for; default is comma | ||
* Third parameter: replacement delimiter; default is the search delimiter, or comma+space if none | * Third parameter: replacement delimiter; default is the search delimiter, or comma+space if none | ||
| − | * ''template'': template to apply to each substring (string provided as first parameter; index provided as ''index'') | + | * ''template'': template to apply to each substring (string provided as first parameter; index provided as ''index''; ''param'' provided as ''param''); default is Id |
| + | * ''param'': extra parameter to pass to the template; default is empty | ||
</noinclude><includeonly>{{For Each/Raw|{{{1|}}}|{{#if:{{{2|}}}|{{{2}}}|,}}|{{{3|{{Select|{{{2}}}|, | | </noinclude><includeonly>{{For Each/Raw|{{{1|}}}|{{#if:{{{2|}}}|{{{2}}}|,}}|{{{3|{{Select|{{{2}}}|, | | ||
| param={{#if:{{{2|}}}|1|2}} | | param={{#if:{{{2|}}}|1|2}} | ||
}}}}}|| | }}}}}|| | ||
| − | | template={{{template}}} | + | | template={{#if:{{{template|}}}|{{{template}}}|Id}} |
| + | | param={{{param|}}} | ||
| index=1 | | index=1 | ||
| value={{#explode:{{{1|}}}|{{#if:{{{2|}}}|{{{2}}}|,}}|0}} | | value={{#explode:{{{1|}}}|{{#if:{{{2|}}}|{{{2}}}|,}}|0}} | ||
}}</includeonly> | }}</includeonly> | ||
Latest revision as of 12:11, 7 December 2015
Apply a template to each element of a list.
- First parameter: string to split
- Second parameter: delimiter to search for; default is comma
- Third parameter: replacement delimiter; default is the search delimiter, or comma+space if none
- template: template to apply to each substring (string provided as first parameter; index provided as index; param provided as param); default is Id
- param: extra parameter to pass to the template; default is empty