Module
TemplateSource
From Dogcraft Wiki
No edit summary |
No edit summary |
||
| Line 2: | Line 2: | ||
function p.test(frame) | function p.test(frame) | ||
return frame:getParent():getTitle() .. ":" .. frame | return frame:getParent():getTitle() .. ":" .. frame:getParent().args[1] | ||
end | end | ||
return p | return p | ||
Revision as of 23:38, 5 February 2025
Meant to be used with the {{Template source}} template. Returns the plaintext contents of a template. Obeys the mostly the same behaviours as transclusion would, respects <onlyinclude>, <includeonly>, and <noinclude> tags. This module is primarily meant to be used as input to <syntaxhighlight>, which doesn't handle some tags (like <templatestyles> or <categorytree>) correctly.
Example
The source of the {{Pagetabs}} template, wrapped in a <syntaxhighlight> tag.
{{#tag:syntaxhighlight|{{#invoke:TemplateSource|templateSource|Template:Pagetabs}}|lang=html|line=1}} generates:
<strong class="error"><span class="scribunto-error" id="mw-scribunto-error-0">Script error: The function "templateSource" does not exist.</span></strong>
This page was last modified on 5 February 2025, at 23:38. (2 days ago)