<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.limswiki.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AUnsubst%2Fdoc</id>
	<title>Module:Unsubst/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.limswiki.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AUnsubst%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://www.limswiki.org/index.php?title=Module:Unsubst/doc&amp;action=history"/>
	<updated>2026-04-05T03:19:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>https://www.limswiki.org/index.php?title=Module:Unsubst/doc&amp;diff=27140&amp;oldid=prev</id>
		<title>Shawndouglas: Created as needed.</title>
		<link rel="alternate" type="text/html" href="https://www.limswiki.org/index.php?title=Module:Unsubst/doc&amp;diff=27140&amp;oldid=prev"/>
		<updated>2016-08-18T20:11:07Z</updated>

		<summary type="html">&lt;p&gt;Created as needed.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;!-- Categories where indicated at the bottom of this page, please. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Helper module to facilitate a substituted template transform into a template transclusion.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&lt;br /&gt;
To turn a template into a self-substituting template, wrap the existing template code with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{ {{{|safesubst:}}}#invoke:Unsubst||$B=&lt;br /&gt;
&lt;br /&gt;
 [ ... existing template code ... ]&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wikitext to display when not substed must be given as &amp;quot;$B&amp;quot;. A parameter &amp;quot;$N&amp;quot; may also be seen in some templates; this was required in an older version of the module, but is no longer necessary and may be removed. Such templates are automatically placed in [[:Category:Calls to Module:Unsubst that use $N]].&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;__DATE__&amp;quot;, that value in the generated template invocation will be the current month and year.&lt;br /&gt;
&lt;br /&gt;
Some templates have a &amp;lt;nowiki&amp;gt;&amp;lt;noinclude&amp;gt;&amp;lt;/nowiki&amp;gt; but no matching &amp;lt;nowiki&amp;gt;&amp;lt;/noinclude&amp;gt;&amp;lt;/nowiki&amp;gt; at the end of the template. In such cases the missing &amp;lt;nowiki&amp;gt;&amp;lt;/noinclude&amp;gt;&amp;lt;/nowiki&amp;gt; must be added before the ending &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
Consider a template Template:Example containing the following code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{ {{{|safesubst:}}}#invoke:Unsubst||foo=bar |date=__DATE__ |$B=&lt;br /&gt;
&lt;br /&gt;
 [ ... Template code goes here ... ]&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Original !! Result&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;{{subst:example}}&amp;lt;/nowiki&amp;gt; || &amp;lt;nowiki&amp;gt;{{Example|foo=bar|date=&amp;lt;/nowiki&amp;gt;{{#time:F Y}}}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;{{subst:example|foo=X}}&amp;lt;/nowiki&amp;gt; || &amp;lt;nowiki&amp;gt;{{Example|foo=X|date=&amp;lt;/nowiki&amp;gt;{{#time:F Y}}}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;{{subst:example|baz=X}}&amp;lt;/nowiki&amp;gt; || &amp;lt;nowiki&amp;gt;{{Example|foo=bar|baz=X|date=&amp;lt;/nowiki&amp;gt;{{#time:F Y}}}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;{{subst:example|date=January 2001}}&amp;lt;/nowiki&amp;gt; || &amp;lt;nowiki&amp;gt;{{Example|foo=bar|date=January 2001}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{#ifeq:{{SUBPAGENAME}}|sandbox |&lt;br /&gt;
| &amp;lt;!-- Categories below this line, please; interwikis at Wikidata --&amp;gt;&lt;br /&gt;
[[Category:LIMSwiki metatemplates]]&lt;br /&gt;
[[Category:Modules that add a tracking category]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Shawndouglas</name></author>
	</entry>
</feed>