Module:Foreach

local p = {}

function p.w(frame) -- called from Template:Fe

local pframe = frame:getParent local tplname = pframe.args[1] local delim = pframe.args[2] local arr = mw.text.split(pframe.args[3],"%s*,%s*") r = '' for n,v in ipairs(arr) do      if n > 1 then r = r .. delim end r = r .. frame:expandTemplate{title = tplname, args = {v, pframe.args[4]}} end return r end return p