Module:User:Surjection/wrapper

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This is a private module sandbox of Surjection, for their own experimentation. Items in this module may be added and removed at Surjection's discretion; do not rely on this module's stability.


local export = {}

-- Wraps the template invocation with double-braces for [[Module:invoker]]
function export.wrap(frame)
	local result = "⦃⦃" .. frame.args[1]
	local args = frame:getParent().args
	for _, v in ipairs(args) do
		result = result .. "¦" .. v
	end
	for k, v in pairs(args) do
		if type(k) ~= "number" then
			result = result .. "¦" .. tostring(k) .. "=" .. v
		end
	end
	return result .. "⦄⦄"
end

return export