Jump to content

Module:Unsubst/doc: Difference between revisions

templates2>CrafterNova
wording fix
 
Dat Hack3r (talk | contribs)
m Small changes to the documentation because this isn't Wikipedia.
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<!-- Categories where indicated at the bottom of this page, please. -->
{{High-risk| 3841439 |all-pages = yes}}
{{Module rating|protected}}
This is a helper module to facilitate a substituted template transform into a template transclusion.
This is a helper module to facilitate a substituted template transform into a template transclusion.


Maintenance templates, such as {{tl|Citation needed}} or {{tl|Refimprove}}, should never be substituted. A trick to avoid that is to make a template substitute to its transcluded form.
Maintenance templates, such as {{tlx|Citation needed}} or {{tlx|Refimprove}}, should never be substituted. A trick to avoid that is to make a template substitute to its transcluded form.


Infoboxes should use [[Module:Unsubst-infobox]], as should any other templates with parameters listed in block format by default.
Infoboxes should use [[Module:Unsubst-infobox]], as should any other templates with parameters listed in block format by default.


=== Usage ===
=== Usage ===
To turn a template into a self-substituting template, wrap the existing template code with:
To turn a template into a self-substituting template, wrap the existing template code with:
<pre>
<syntaxhighlight lang="wikitext">
{{SAFESUBST:<noinclude />#invoke:Unsubst||$B=
{{SAFESUBST:<noinclude />#invoke:Unsubst||$B=


Line 18: Line 13:


}}
}}
</pre>
</syntaxhighlight>


The wikitext to display when not substed must be given as "$B". All other parameters passed to the #invoke will be copied to the generated template invocation as default values. If the value of any of these default parameters is <code>__DATE__</code>, that value in the generated template invocation will be the current month and year.
The wikitext to display when not substed must be given as "$B". All other parameters passed to the #invoke will be copied to the generated template invocation as default values. If the value of any of these default parameters is <code>__DATE__</code>, that value in the generated template invocation will be the current month and year.
Line 25: Line 20:


==== Advanced ====
==== Advanced ====
<pre>
<pre>
{{SAFESUBST:<noinclude />#invoke:Unsubst||$params=[ parameters ]|$aliases=[ aliases ]|$flags=[ flags ]|$B=
{{SAFESUBST:<noinclude />#invoke:Unsubst||$params=[ parameters ]|$aliases=[ aliases ]|$flags=[ flags ]|$B=
Line 67: Line 61:


<includeonly>{{sandbox other||
<includeonly>{{sandbox other||
| <!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Wiki metatemplates]]
[[Category:Wikipedia metatemplates]]
[[Category:Modules that add a tracking category]]
[[Category:Modules that add a tracking category]]
}}</includeonly>
}}</includeonly>