Template:Foreach: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(adding optional pass_thru parameters to pass through to called template)
(bring improvements over from Foreach2)
Line 1: Line 1:
<includeonly><!--
<includeonly><!--
  -->{{#ifexpr:{{{up_to}}}>0|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|1}}}}|{{#if:{{{pass_thru_name|}}}|{{{pass_thru_name}}}={{{pass_thru_arg}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>0|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|1}}|{{{pass_thru_name1}}}={{{pass_thru_arg1|}}}|{{{pass_thru_name2}}}={{{pass_thru_arg2|}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>1|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|2}}}}|{{#if:{{{pass_thru_name|}}}|{{{pass_thru_name}}}={{{pass_thru_arg}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>1|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|2}}|{{{pass_thru_name1}}}={{{pass_thru_arg1|}}}|{{{pass_thru_name2}}}={{{pass_thru_arg2|}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>2|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|3}}}}|{{#if:{{{pass_thru_name|}}}|{{{pass_thru_name}}}={{{pass_thru_arg}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>2|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|3}}|{{{pass_thru_name1}}}={{{pass_thru_arg1|}}}|{{{pass_thru_name2}}}={{{pass_thru_arg2|}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>3|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|4}}}}|{{#if:{{{pass_thru_name|}}}|{{{pass_thru_name}}}={{{pass_thru_arg}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>3|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|4}}|{{{pass_thru_name1}}}={{{pass_thru_arg1|}}}|{{{pass_thru_name2}}}={{{pass_thru_arg2|}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>4|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|5}}}}|{{#if:{{{pass_thru_name|}}}|{{{pass_thru_name}}}={{{pass_thru_arg}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>4|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|5}}|{{{pass_thru_name1}}}={{{pass_thru_arg1|}}}|{{{pass_thru_name2}}}={{{pass_thru_arg2|}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>5|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|6}}}}|{{#if:{{{pass_thru_name|}}}|{{{pass_thru_name}}}={{{pass_thru_arg}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>5|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|6}}|{{{pass_thru_name1}}}={{{pass_thru_arg1|}}}|{{{pass_thru_name2}}}={{{pass_thru_arg2|}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>6|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|7}}}}|{{#if:{{{pass_thru_name|}}}|{{{pass_thru_name}}}={{{pass_thru_arg}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>6|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|7}}|{{{pass_thru_name1}}}={{{pass_thru_arg1|}}}|{{{pass_thru_name2}}}={{{pass_thru_arg2|}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>7|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|8}}}}|{{#if:{{{pass_thru_name|}}}|{{{pass_thru_name}}}={{{pass_thru_arg}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>7|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|8}}|{{{pass_thru_name1}}}={{{pass_thru_arg1|}}}|{{{pass_thru_name2}}}={{{pass_thru_arg2|}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>8|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|9}}}}|{{#if:{{{pass_thru_name|}}}|{{{pass_thru_name}}}={{{pass_thru_arg}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>8|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|9}}|{{{pass_thru_name1}}}={{{pass_thru_arg1|}}}|{{{pass_thru_name2}}}={{{pass_thru_arg2|}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>9|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|10}}}}|{{#if:{{{pass_thru_name|}}}|{{{pass_thru_name}}}={{{pass_thru_arg}}}}}}}<!--
  -->{{#ifexpr:{{{up_to}}}>9|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|10}}|{{{pass_thru_name1}}}={{{pass_thru_arg1|}}}|{{{pass_thru_name2}}}={{{pass_thru_arg2|}}}}}}}<!--
-->{{#ifexpr:{{{up_to}}}>10|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|11}}}}|{{#if:{{{pass_thru_name|}}}|{{{pass_thru_name}}}={{{pass_thru_arg}}}}}}}<!--
-->{{#ifexpr:{{{up_to}}}>10|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|11}}|{{{pass_thru_name1}}}={{{pass_thru_arg1|}}}|{{{pass_thru_name2}}}={{{pass_thru_arg2|}}}}}}}<!--
-->{{#ifexpr:{{{up_to}}}>11|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|12}}}}|{{#if:{{{pass_thru_name|}}}|{{{pass_thru_name}}}={{{pass_thru_arg}}}}}}}<!--
-->{{#ifexpr:{{{up_to}}}>11|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|12}}|{{{pass_thru_name1}}}={{{pass_thru_arg1|}}}|{{{pass_thru_name2}}}={{{pass_thru_arg2|}}}}}}}<!--
-->{{#ifexpr:{{{up_to}}}>12|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|13}}}}|{{#if:{{{pass_thru_name|}}}|{{{pass_thru_name}}}={{{pass_thru_arg}}}}}}}</includeonly><noinclude>
-->{{#ifexpr:{{{up_to}}}>12|{{{{{call}}}|{{#explode:{{{item_in}}}|{{{delim|,}}}|13}}|{{{pass_thru_name1}}}={{{pass_thru_arg1|}}}|{{{pass_thru_name2}}}={{{pass_thru_arg2|}}}}}}}</includeonly><noinclude>
Passes a list of items separated by a delimiter to a specified template.
Passes a list of items separated by a delimiter to a specified template.


[[Category:Macro templates]]
[[Category:Macro templates]]
</noinclude>
</noinclude>

Revision as of 04:49, 11 December 2015

Passes a list of items separated by a delimiter to a specified template.