<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://159.13.49.45/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="http://159.13.49.45/index.php?action=history&amp;feed=atom&amp;title=Module%3AUnsubst%2Fdoc"/>
	<link rel="alternate" type="text/html" href="http://159.13.49.45/index.php?title=Module:Unsubst/doc&amp;action=history"/>
	<updated>2026-04-03T22:54:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>http://159.13.49.45/index.php?title=Module:Unsubst/doc&amp;diff=733&amp;oldid=prev</id>
		<title>Nat: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="http://159.13.49.45/index.php?title=Module:Unsubst/doc&amp;diff=733&amp;oldid=prev"/>
		<updated>2025-04-07T11:05:44Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:05, 7 April 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key mediawiki:diff:1.41:old-732:rev-733 --&gt;
&lt;/table&gt;</summary>
		<author><name>Nat</name></author>
	</entry>
	<entry>
		<id>http://159.13.49.45/index.php?title=Module:Unsubst/doc&amp;diff=732&amp;oldid=prev</id>
		<title>wikipedia&gt;Anomie: Undid revision 1263623150 by 2001:1670:18:2288:284A:9C05:EFBF:FB32 (talk) - rvv</title>
		<link rel="alternate" type="text/html" href="http://159.13.49.45/index.php?title=Module:Unsubst/doc&amp;diff=732&amp;oldid=prev"/>
		<updated>2024-12-17T22:56:02Z</updated>

		<summary type="html">&lt;p&gt;Undid revision &lt;a href=&quot;/index.php/Special:Diff/1263623150&quot; title=&quot;Special:Diff/1263623150&quot;&gt;1263623150&lt;/a&gt; by &lt;a href=&quot;/index.php/Special:Contributions/2001:1670:18:2288:284A:9C05:EFBF:FB32&quot; title=&quot;Special:Contributions/2001:1670:18:2288:284A:9C05:EFBF:FB32&quot;&gt;2001:1670:18:2288:284A:9C05:EFBF:FB32&lt;/a&gt; (&lt;a href=&quot;/index.php?title=User_talk:2001:1670:18:2288:284A:9C05:EFBF:FB32&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User talk:2001:1670:18:2288:284A:9C05:EFBF:FB32 (page does not exist)&quot;&gt;talk&lt;/a&gt;) - rvv&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;
{{high-risk|all=pages=yes}}&lt;br /&gt;
{{Module rating|protected}}&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. This module implements that trick.&lt;br /&gt;
&lt;br /&gt;
Infoboxes should use [[Module:Unsubst-infobox]], as should any other templates with parameters listed in block format by default.&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:&amp;lt;noinclude /&amp;gt;#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;. 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;lt;code&amp;gt;__DATE__&amp;lt;/code&amp;gt;, that value in the generated template invocation will be the current month and year.&lt;br /&gt;
&lt;br /&gt;
Some templates have a {{tag|noinclude|o}} but no matching {{tag|noinclude|c}} at the end of the template. In such cases the missing {{tag|noinclude|c}} must be added before the ending &amp;lt;code&amp;gt;{{))}}&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Advanced ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{SAFESUBST:&amp;lt;noinclude /&amp;gt;#invoke:Unsubst||$params=[ parameters ]|$aliases=[ aliases ]|$flags=[ flags ]|$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;
Due to Lua limitations, parameters are normally ordered randomly when the template is substituted. {{para|$params}} can be used in #invoke:Unsubst to list template parameters in order, comma-separated (e.g. &amp;lt;code&amp;gt;egg,bacon,sausage,cheese,spam&amp;lt;/code&amp;gt;). Numbered parameters should be before others in the list. Any remaining parameters are tacked onto the end of the generated invocation.&lt;br /&gt;
&lt;br /&gt;
Parameter aliases can be listed in {{para|$aliases}} (and shouldn&amp;#039;t be listed in {{para|$params}}), and will be replaced automatically. Each alias and its replacement should be formatted as &amp;lt;code&amp;gt;alias&amp;gt;replacement&amp;lt;/code&amp;gt;, and each of those pairs should be comma-separated (e.g. &amp;lt;code&amp;gt;œuf&amp;gt;egg,melt&amp;gt;cheese&amp;lt;/code&amp;gt;). Note that this parameter can function with or without {{para|$params}}.&lt;br /&gt;
&lt;br /&gt;
Parameter {{para|$flags}} can be used to modify other facets of the module&amp;#039;s behaviour; entries are comma-separated. Valid flags are &amp;lt;code&amp;gt;override&amp;lt;/code&amp;gt; (allows parameters in the #invoke: to take precedence over parameters in the original template invocation); &amp;lt;code&amp;gt;keep-whitespace&amp;lt;/code&amp;gt; (prevents whitespace from being trimmed from unnamed parameters); and &amp;lt;code&amp;gt;remove-empty&amp;lt;/code&amp;gt; (removes empty parameters).&lt;br /&gt;
&lt;br /&gt;
These parameters can be manipulated using parser functions to provide more complicated options (note that in the parameters any parser function, or template or module invocation, should also have &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;SAFESUBST:&amp;lt;noinclude /&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Parameter {{para|$template-name}} will override the subst&amp;#039;d template&amp;#039;s name with the template name assigned to this parameter.&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:&amp;lt;noinclude /&amp;gt;#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;
| {{tlsc|example}} || {{tlc|Example|date{{=}}{{#time:F Y}}|foo{{=}}bar}}&lt;br /&gt;
|-&lt;br /&gt;
| {{tlsc|example|foo{{=}}X}} || {{tlc|Example|date{{=}}{{#time:F Y}}|foo{{=}}X}}&lt;br /&gt;
|-&lt;br /&gt;
| {{tlsc|example|baz{{=}}X}} || {{tlc|Example|baz{{=}}X|date{{=}}{{#time:F Y}}|foo{{=}}bar}}&lt;br /&gt;
|-&lt;br /&gt;
| {{tlsc|example|date{{=}}January 2001}} || {{tlc|Example|date{{=}}January 2001|foo{{=}}bar}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{sandbox other||&lt;br /&gt;
| &amp;lt;!-- Categories below this line, please; interwikis at Wikidata --&amp;gt;&lt;br /&gt;
[[Category:Wikipedia 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>wikipedia&gt;Anomie</name></author>
	</entry>
</feed>