<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://moasspedia.org/w/index.php?action=history&amp;feed=atom&amp;title=Template%3AConditional_template_call_with_newline%2Fdoc</id>
	<title>Template:Conditional template call with newline/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://moasspedia.org/w/index.php?action=history&amp;feed=atom&amp;title=Template%3AConditional_template_call_with_newline%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://moasspedia.org/w/index.php?title=Template:Conditional_template_call_with_newline/doc&amp;action=history"/>
	<updated>2026-04-07T05:22:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.2</generator>
	<entry>
		<id>https://moasspedia.org/w/index.php?title=Template:Conditional_template_call_with_newline/doc&amp;diff=9568&amp;oldid=prev</id>
		<title>Wikipedia&gt;Bsherr: /* Sample 1 */replacing Template:Tld with Template:Tlc, plus general and typo fixes as found</title>
		<link rel="alternate" type="text/html" href="https://moasspedia.org/w/index.php?title=Template:Conditional_template_call_with_newline/doc&amp;diff=9568&amp;oldid=prev"/>
		<updated>2020-08-09T22:50:24Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Sample 1: &lt;/span&gt;replacing &lt;a href=&quot;/wiki/Template:Tld&quot; class=&quot;mw-redirect&quot; title=&quot;Template:Tld&quot;&gt;Template:Tld&lt;/a&gt; with &lt;a href=&quot;/wiki/Template:Tlc&quot; class=&quot;mw-redirect&quot; title=&quot;Template:Tlc&quot;&gt;Template:Tlc&lt;/a&gt;, plus general and typo fixes as found&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}&lt;br /&gt;
This template calls template {{{2}}} with parameter {{{3}}} and adds a newline at the end, all under condition {{{1}}}. Successive calls should &amp;#039;&amp;#039;not&amp;#039;&amp;#039; be separated by a newline.&lt;br /&gt;
&lt;br /&gt;
This templates has been used to avoid writing out the condition twice, once for the template call and once for the newline, but also [[Template:If]] can be used to preserve newlines.&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
===Sample 1===&lt;br /&gt;
Example using [[Template:2x]], which simply repeats its argument twice, so &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{2x|Pizza}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; produces {{2x|Pizza}}.  One can combine this with {{tlc|Conditional template call with newline}} in the following code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#tag:pre|{{Conditional template call with newline|1|2x|Pizza}}{{Conditional template call with newline|0|2x|Bora}}{{Conditional template call with newline|1|2x|Bang}}}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:which produces&lt;br /&gt;
&lt;br /&gt;
{{#tag:pre|{{Conditional template call with newline|1|2x|Pizza}}{{Conditional template call with newline|0|2x|Bora}}{{Conditional template call with newline|1|2x|Bang}}}}&lt;br /&gt;
&lt;br /&gt;
Notice how {{2x|Bora}} is suppressed, and there is a newline between {{2x|Pizza}} and {{2x|Bang}}.&lt;br /&gt;
&lt;br /&gt;
===Sample 2===&lt;br /&gt;
Sample usage with full substitution of the template to create a newline in wikitext.&lt;br /&gt;
&lt;br /&gt;
1. Create a sample template : &amp;quot;[[Template:testnewline]]&amp;quot;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;overflow:auto&amp;quot;&amp;gt;&lt;br /&gt;
ABC{{&amp;lt;includeonly&amp;gt;subst:&amp;lt;/includeonly&amp;gt;Conditional template call with newline|{{&amp;lt;includeonly&amp;gt;subst:&amp;lt;/includeonly&amp;gt;#ifeq:{{{align|}}}|{{{align}}}|1|0}}|void|1|substctc=subst:|subst=subst:}}&lt;br /&gt;
DEF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. When called empty (&amp;lt;nowiki&amp;gt;{{subst:testnewline}}&amp;lt;/nowiki&amp;gt;), it generates the following wikitext:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ABC&lt;br /&gt;
DEF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. When called as &amp;lt;nowiki&amp;gt;{{subst:testnewline|align=somevalue}}&amp;lt;/nowiki&amp;gt;, it generates the following wikitext (note the newline):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ABC&lt;br /&gt;
&lt;br /&gt;
DEF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===Mandatory parameters===&lt;br /&gt;
;&amp;lt;kbd&amp;gt;1&amp;lt;/kbd&amp;gt;: 1st unnamed parameter, a condition to be evaluated. Should result in 1 for true or 0 for false. One can use the result 0 or 1 directly. If the condition is true, the second template will be called and a newline added afterwards. &amp;lt;br&amp;gt;Sample condition: &amp;lt;nowiki&amp;gt;{{#ifeq:{{{align|}}}|{{{align}}}|1|0}}&amp;lt;/nowiki&amp;gt;. The condition is true if the template is called with a parameter &amp;quot;align=somevalue&amp;quot;, it&amp;#039;s false if align is not included.&lt;br /&gt;
;&amp;lt;kbd&amp;gt;2&amp;lt;/kbd&amp;gt;: 2nd unnamed parameter, the name of template to be called. &amp;lt;br&amp;gt; Can be &amp;quot;!&amp;quot; for [[Template:!]] or even &amp;quot;void&amp;quot; for [[Template:Void]]&lt;br /&gt;
&lt;br /&gt;
===Optional parameters===&lt;br /&gt;
;&amp;lt;kbd&amp;gt;3&amp;lt;/kbd&amp;gt;: 3rd unnamed parameter, value to be assigned to {{{1}}} when calling template {{{2}}}&lt;br /&gt;
;&amp;lt;kbd&amp;gt;substctc&amp;lt;/kbd&amp;gt;: for substitution of some parser functions and auxiliary templates called inside the template, use the value &amp;quot;subst:&amp;quot;; recommended when the template is substituted; note that in that case any parser functions or templates in the condition have to be substituted too.&lt;br /&gt;
;&amp;lt;kbd&amp;gt;subst&amp;lt;/kbd&amp;gt;: for substitution of template {{{2}}}, use the value &amp;quot;subst:&amp;quot;&lt;br /&gt;
;&amp;lt;kbd&amp;gt;p1n&amp;lt;/kbd&amp;gt;: name of an additional parameter used by template {{{2}}}&lt;br /&gt;
;&amp;lt;kbd&amp;gt;p1v&amp;lt;/kbd&amp;gt;: value to be assigned to {{{p1n}}} when calling template {{{2}}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
++++ PLEASE ADD CATEGORIES AND INTERWIKIS BELOW THIS LINE, THANK YOU. --&amp;gt;&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wikipedia&gt;Bsherr</name></author>
	</entry>
</feed>