Difference between revisions of "Template:For Each"

From Green Family Wiki
Jump to: navigation, search
(Created page with "<noinclude>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: repl...")
 
Line 7: Line 7:
 
| template={{{template}}}
 
| template={{{template}}}
 
| index=1
 
| index=1
 +
| value={{#explode|{{{1|}}}|{{#if:{{{2|}}}|{{{2}}}|,}}|0}}
 
}}</includeonly>
 
}}</includeonly>

Revision as of 22:55, 14 June 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)