Jump to content

Module:DisplayTemplate: Difference between revisions

m MarkWD moved page Module:ShowTemplateContent to Module:DisplayTemplate without leaving a redirect
// via Wikitext Extension for VSCode
Line 1: Line 1:
-- Module:ShowTemplateContent
-- Module:DisplayTemplate
-- Uses Lua to invoke the content of a template to an article without invoking its Categories
-- Uses Lua to invoke the content of a template to an article without invoking its Categories



Revision as of 06:03, 13 April 2025

Documentation for this module may be created at Module:DisplayTemplate/doc

-- Module:DisplayTemplate
-- Uses Lua to invoke the content of a template to an article without invoking its Categories

local p = {}

function p.showTemplate(frame)
    local templateName = frame.args[1]
    if not templateName then
        return "Error: No template name provided."
    end
    
    local templateContent = mw.getCurrentFrame():expandTemplate{title = templateName}
    templateContent = templateContent:gsub("%[%[Category:[^]]+%]%]", "")
    return templateContent
end

return p