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