Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Module:For each named parameter

Permanently protected module
From Wikipedia, the free encyclopedia

local p = {}

function p.main(frame) 
	local code = mw.text.unstripNoWiki(frame.args.code or frame.args[2])
	local results = {}
	local sep = frame.args[1] or ''
	for key, value in pairs(frame:getParent().args) do
		if type(key) ~= 'number' then
			local actualCode = code:gsub("{{{([^{}|]*)|?[^{}]*}}}", {name = key, value = value})
			local result = frame:getParent():preprocess(actualCode)
			if #result > 0 then
				table.insert(results, result)
			end
		end
	end
	return table.concat(results, sep)
end
return p