Module
TemplateSource/doc
From Dogcraft Wiki
(Created page with "{{#invoke:Test|test}}") |
mNo edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{#invoke: | Meant to be used with the '''{{t|Template source}}''' template. Returns the plaintext contents of a template. Obeys the mostly the same behaviours as transclusion would, respects '''<nowiki><onlyinclude></nowiki>''', '''<nowiki><includeonly></nowiki>''', and '''<nowiki><noinclude></nowiki>''' tags. This module is primarily meant to be used as input to '''<nowiki><syntaxhighlight></nowiki>''', which doesn't handle some tags (like '''<nowiki><templatestyles></nowiki>''' or '''<nowiki><categorytree></nowiki>''') correctly. | ||
== Example == | |||
The source of the '''{{t|Pagetabs}}''' template, wrapped in a '''<nowiki><syntaxhighlight></nowiki>''' tag. | |||
<syntaxhighlight inline style="padding:.5rem;">{{#tag:syntaxhighlight|{{#invoke:TemplateSource|templateSource|Template:Pagetabs}}|lang=html|line=1}}</syntaxhighlight> generates: | |||
{{#tag:syntaxhighlight|{{#invoke:TemplateSource|templateSource|Template:Pagetabs}}|lang=html|line=1}} | |||
Latest revision as of 21:05, 31 January 2026
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:
{{#ifeq: {{NAMESPACE}} | {{ns:Template}} | {{#ifeq: {{#sub:{{ROOTPAGENAME}}|0|3}} | Tab | [[Category:Tabs]] |}} |}}<templatestyles src="Pagetabs/styles.css" /><div class="pagetabs noexcerpt noscrollbar" {{#if:{{{styles|}}}|style="{{{styles}}}|}} ><!--
--><div>[[{{{tab1|}}}|{{{title1|{{{tab1|}}}}}}]]</div><!--
--><div>[[{{{tab2|}}}|{{{title2|{{{tab2|}}}}}}]]</div><!--
-->{{#if:{{{tab3|}}}|<div>[[{{{tab3|}}}|{{{title3|{{{tab3|}}}}}}]]</div>}}<!--
-->{{#if:{{{tab4|}}}|<div>[[{{{tab4|}}}|{{{title4|{{{tab4|}}}}}}]]</div>}}<!--
-->{{#if:{{{tab5|}}}|<div>[[{{{tab5|}}}|{{{title5|{{{tab5|}}}}}}]]</div>}}<!--
-->{{#if:{{{tab6|}}}|<div>[[{{{tab6|}}}|{{{title6|{{{tab6|}}}}}}]]</div>}}<!--
--></div>
<hr />
<!-- moved to Template:Tab Userpage <div class="pagetabsmore">{{Pagetabs/pagetabsmore|username=|style=position:absolute; bottom:24px;}}</div> -->