Help:Templates: Difference between revisions

Jump to navigation Jump to search
removed safesubst (got it a bit wrong + less relevant to the topic)
(other pages section; intro redo; - see below for inclusion tags (might make a new page); typos)
(removed safesubst (got it a bit wrong + less relevant to the topic))
 
Line 59: Line 59:
<div style="padding: 5px 10px 5px; border-left: 5px solid lightpink;">In source editing, substitution is executed with word <code>subst:</code> in the template call, e.g. <code><nowiki>{{subst:Mirror universe}}</nowiki></code></div>
<div style="padding: 5px 10px 5px; border-left: 5px solid lightpink;">In source editing, substitution is executed with word <code>subst:</code> in the template call, e.g. <code><nowiki>{{subst:Mirror universe}}</nowiki></code></div>


Many templates call other templates, magic words or parser functions. Substituting a template will only transclude calls in its code. In order to substitute all templates, magic words and parser functions, safe substitution may be used.
Note that substitution will increase the length of the wikicode on page considerably and might make difficult to edit. Some templates are designed so that they are dynamic, so substitution may defeat the purpose.
<div style="padding: 5px 10px 5px; border-left: 5px solid lightpink;">In source editing, safe substitution is executed with word <code>safesubst:</code> in the template call, e.g. <code><nowiki>{{safesubst:Mirror universe}}</nowiki></code></div>
 
Note that substitution and safe substitution will increase the length of the wikicode on page considerably and might make difficult to edit. Some templates are designed so that they are dynamic, so safe substitution in particular may defeat the purpose.


The wikicode of a template may also be called.
The wikicode of a template may also be called.
Line 72: Line 69:
<div style="padding: 5px 10px 5px; border-left: 5px solid lightpink;">When transcluding or substituting a page other than a template, the template call is slightly different in source editing. The prefix “Template:” is left out, but the ''namespace'' prefix should be used for any other type of page. For example, this help page is called with <code><nowiki>{{Help:Templates}}</nowiki></code>. For main namespace (articles), the namespace prefix is empty, so only a colon : is used, for example <code><nowiki>{{:Tristan Wolf}}</nowiki></code> for [[Tristan Wolf]].
<div style="padding: 5px 10px 5px; border-left: 5px solid lightpink;">When transcluding or substituting a page other than a template, the template call is slightly different in source editing. The prefix “Template:” is left out, but the ''namespace'' prefix should be used for any other type of page. For example, this help page is called with <code><nowiki>{{Help:Templates}}</nowiki></code>. For main namespace (articles), the namespace prefix is empty, so only a colon : is used, for example <code><nowiki>{{:Tristan Wolf}}</nowiki></code> for [[Tristan Wolf]].


Substitution of another page works similarly, but with <code><nowiki>subst:</nowiki></code> (or equivalent) ahead of the namespace prefix, e.g. <code><nowiki>{{subst:Help:Templates}}</nowiki></code> or <code><nowiki>{{safesubst::Tristan Wolf}}</nowiki></code></div>
Substitution of another page works similarly, but with <code><nowiki>subst:</nowiki></code> (or equivalent) ahead of the namespace prefix, e.g. <code><nowiki>{{subst:Help:Templates}}</nowiki></code> or <code><nowiki>{{subst::Tristan Wolf}}</nowiki></code></div>


=== More on the topic ===
=== More on the topic ===
1,769

edits

Navigation menu