Module:Test template call
Jump to navigation
Jump to search
Documentation for this module may be created at Module:Test template call/doc
local p = {}
function p.callTemplate(frame)
local templateName = frame.args[1] -- Get template name from first argument
local templateArgs = {}
-- Pass all arguments from the module invocation to the template
--[[ The module invocation is: #invoke:YourModuleName|callTemplate|Template:MyTemplate|arg1|arg2=value}} ]]
for k, v in pairs(frame.args) do
if type(k) == "number" and k > 1 then -- Exclude the template name argument
table.insert(templateArgs, v)
elseif type(k) == "string" then
templateArgs[k] = v
end
end
return frame:expandTemplate{ title = templateName, args = templateArgs }
end
return p