Template:For Each/Raw: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (12 revisions imported: Initial import from smithfam) |
||
| (3 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 | ||
| Line 10: | Line 11: | ||
| param={{#if: {{{value}}} | 1}} | | param={{#if: {{{value}}} | 1}} | ||
}}{{#if: {{{value}}} | }}{{#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> | }}}}</includeonly> | ||
Latest revision as of 13: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