Module:Unsubst/doc: Difference between revisions
Appearance
m 1 revision imported |
Dat Hack3r (talk | contribs) m Small changes to the documentation because this isn't Wikipedia. |
||
Line 1: | Line 1: | ||
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 {{ | 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: | ||
< | <syntaxhighlight lang="wikitext"> | ||
{{SAFESUBST:<noinclude />#invoke:Unsubst||$B= | {{SAFESUBST:<noinclude />#invoke:Unsubst||$B= | ||
Line 18: | Line 13: | ||
}} | }} | ||
</ | </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|| | ||
[[Category:Wiki metatemplates]] | |||
[[Category: | |||
[[Category:Modules that add a tracking category]] | [[Category:Modules that add a tracking category]] | ||
}}</includeonly> | }}</includeonly> |