Module:User:Surjection/invoker

Hello, you have come here looking for the meaning of the word Module:User:Surjection/invoker. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:User:Surjection/invoker, but we will also tell you about its etymology, its characteristics and you will know how to say Module:User:Surjection/invoker in singular and plural. Everything you need to know about the word Module:User:Surjection/invoker you have here. The definition of the word Module:User:Surjection/invoker will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:User:Surjection/invoker, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.


--[[
Replaces double-braced template "pseudo-invocations" (⦃⦃template¦1¦2¦a=3⦄⦄) by
calling module invocations according to the specified parameters.
	-- text: The text to find and replace pseudo-invocations in.
	-- templates: The supported templates for pseudo-invocations.
	   It should be a table mapping template names to functions.
	   The functions should take a single parameter, which will be
	   a table comprising the template arguments.
]]--
-- To wrap existing template entry points, try ].
return function (text, templates)
	local m_templateparser = require("Module:templateparser")

	local function invoke (contents)
		local template = "{{" .. mw.ustring.gsub(contents, "¦", "|") .. "}}"
		local name, args = m_templateparser.parseTemplate(template)
		if not name then
			error("Invalid pseudo-template syntax")
		end
		if not templates then
			error("Unsupported pseudo-template: " .. name)
		end
		return templates(args)
	end

	-- handle nested templates
	while mw.ustring.find(text, "⦃⦃*⦃") do
		text = mw.ustring.gsub(text, "⦃⦃(-)⦄⦄", invoke)
	end
	text = mw.ustring.gsub(text, "⦃⦃(.-)⦄⦄", invoke)
	return text
end