FANDOM


local p = {}
 
-------------------------------
------- ExplodeForeach --------
-------------------------------
-- Arguments are as follow :
--1 = template name
--2 = a string to process
--3 = that string's separators
--delim = the delimiter between the resulting templates 
function p.ExplodeForeach(frame)
	local args = frame:getParent().args
	if args[2] == nil then return "" end
 
	local template = args[1]
	local inputs = mw.text.split( args[2], args[3])
	local delimiter = args.delim
 
	for i = 1, #inputs do
		if not (inputs[i] == "") then -- No empty strings will be processed
			inputs[i] = frame:expandTemplate{ title = template, args = { inputs[i] } }
		end
	end
 
	return table.concat( inputs, delimiter)
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.