Module:DisplayTemplate: Difference between revisions
Appearance
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode |
||
| Line 11: | Line 11: | ||
local templateContent = mw.getCurrentFrame():expandTemplate{title = templateName} | local templateContent = mw.getCurrentFrame():expandTemplate{title = templateName} | ||
templateContent = templateContent:gsub("%[%[Category:[^]]+%]%]", "") | |||
return templateContent | return templateContent | ||
end | end | ||
return p | return p | ||
Revision as of 22:26, 3 April 2025
Documentation for this module may be created at Module:DisplayTemplate/doc
-- Module:ShowTemplateContent
-- Uses Lua to invoke the content of a template to an article without calling 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