<?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%3ASp%2Fdoc</id>
	<title>Template:Sp/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%3ASp%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://moasspedia.org/w/index.php?title=Template:Sp/doc&amp;action=history"/>
	<updated>2026-04-09T20:37:14Z</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:Sp/doc&amp;diff=31289&amp;oldid=prev</id>
		<title>Wikipedia&gt;Qwerfjkl at 21:46, 24 February 2022</title>
		<link rel="alternate" type="text/html" href="https://moasspedia.org/w/index.php?title=Template:Sp/doc&amp;diff=31289&amp;oldid=prev"/>
		<updated>2022-02-24T21:46:34Z</updated>

		<summary type="html">&lt;p&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;
&amp;lt;!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE --&amp;gt;&lt;br /&gt;
{{distinguish|template:sp?}}&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
{{tlx|sp}} will insert a single, ordinary space character, using the [[numeric character reference]] &amp;lt;code&amp;gt;&amp;amp;amp;#32;&amp;lt;/code&amp;gt;. It is a more readable alternative to using that code.&lt;br /&gt;
&lt;br /&gt;
=== Anywhere you need a regular space ===&lt;br /&gt;
You can use {{tl|sp}} anywhere you need a regular, breaking space. If you need a non-breaking space or multiple spaces in a row, use {{tl|space}}.&lt;br /&gt;
&lt;br /&gt;
=== Inserting a space inside a parser function ===&lt;br /&gt;
Sometimes when using [[Help:parser functions|parser functions]], you need to insert a space at the beginning or end of an optional message. {{tl|sp}} can be used for that purpose. In the following examples, look closely at the spacing between words and punctuation to see the subtle differences.&lt;br /&gt;
&lt;br /&gt;
;Example&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;I like green{{#if:{{{blue|}}}|and blue}}.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
The above example works fine if &amp;#039;blue&amp;#039; does not have a value (&amp;#039;&amp;lt;code&amp;gt;I like green.&amp;lt;/code&amp;gt;&amp;#039;).&lt;br /&gt;
&lt;br /&gt;
However, if &amp;#039;blue&amp;#039; is set to true (&amp;lt;code&amp;gt;|blue=true&amp;lt;/code&amp;gt;), then the message is incorrectly run together (&amp;#039;&amp;lt;code&amp;gt;I like greenand blue.&amp;lt;/code&amp;gt;&amp;#039;).&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;I like green {{#if:{{{blue|}}}|and blue}}.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Adding the space between &amp;#039;green&amp;#039; and &amp;#039;&amp;amp;#123;&amp;amp;#123;#if&amp;#039; avoids running the &amp;#039;&amp;lt;code&amp;gt;green and&amp;lt;/code&amp;gt;&amp;#039; together, but now there will be an extra space if &amp;#039;blue&amp;#039; is not set (&amp;#039;&amp;lt;code&amp;gt;I like green .&amp;lt;/code&amp;gt;&amp;#039;).&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;I like green{{#if:{{{blue|}}}| and blue}}.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Adding the space between the pipe (&amp;#039;&amp;amp;#124;&amp;#039;) and the word &amp;#039;and&amp;#039; doesn&amp;#039;t work. Any leading or trailing spaces from a parser function output are stripped, so this produces exactly the same output as the first example when &amp;#039;blue&amp;#039; is true (&amp;#039;&amp;lt;code&amp;gt;I like greenand blue.&amp;lt;/code&amp;gt;&amp;#039;).&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;I like green{{#if:{{{blue|}}}|{{sp}}and blue}}.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
This one works! By inserting the {{tl|sp}} in the parser function output, the space is not stripped, and the correct output is given whether blue is set to true (&amp;#039;&amp;lt;code&amp;gt;I like green and blue.&amp;lt;/code&amp;gt;&amp;#039;) or not set at all (&amp;#039;&amp;lt;code&amp;gt;I like green.&amp;lt;/code&amp;gt;&amp;#039;).&lt;br /&gt;
&lt;br /&gt;
=== Disabling default substitution ===&lt;br /&gt;
Suppose you have a template, {{tl|Example}}, that uses [[WP:substitution|substitution]], like this:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{{{{subst|subst:}}}#if{{{condition|}}}|message}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
When the template is [[WP:Transclusion|transcluded]] and saved, the result would be interpreted as:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{subst:#if{{{condition|}}}|message}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could override the substitution by setting the &amp;#039;subst&amp;#039; attribute to {{tl|sp}}:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{Example| subst={{sp}} }}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Now the result would be interpreted as:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{ #if{{{condition|}}}|message}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
The extra blank space preceding the &amp;#039;#if&amp;#039; would not affect the template at all (except to suppress the default substitution).&lt;br /&gt;
&lt;br /&gt;
== TemplateData ==&lt;br /&gt;
{{TemplateDataHeader}}&lt;br /&gt;
&amp;lt;templatedata&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
	&amp;quot;params&amp;quot;: {},&lt;br /&gt;
	&amp;quot;description&amp;quot;: &amp;quot;Inserts a single space character; mainly used in parser functions&amp;quot;,&lt;br /&gt;
	&amp;quot;format&amp;quot;: &amp;quot;inline&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/templatedata&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* {{tlx|If}} - runs the laser function &amp;lt;code&amp;gt;#if:&amp;lt;/code&amp;gt;, but retains whitespace&lt;br /&gt;
* {{tlx|fdw-iw}} – a template that uses {{tl|sp}} with parser functions&lt;br /&gt;
* {{tlx|verify spelling}} – for spelling issues&lt;br /&gt;
{{Inline spacing templates}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{Sandbox other||&lt;br /&gt;
&amp;lt;!-- Categories below this line; interwikis at Wikidata --&amp;gt;&lt;br /&gt;
[[Category:Inline spacing templates]]&lt;br /&gt;
[[Category:Typing-aid templates]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wikipedia&gt;Qwerfjkl</name></author>
	</entry>
</feed>