<?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%3AIf_in_page%2Fdoc</id>
	<title>Template:If in page/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%3AIf_in_page%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://moasspedia.org/w/index.php?title=Template:If_in_page/doc&amp;action=history"/>
	<updated>2026-04-06T02:53:38Z</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:If_in_page/doc&amp;diff=19154&amp;oldid=prev</id>
		<title>Wikipedia&gt;Danski454: /* TemplateData */ sp</title>
		<link rel="alternate" type="text/html" href="https://moasspedia.org/w/index.php?title=Template:If_in_page/doc&amp;diff=19154&amp;oldid=prev"/>
		<updated>2019-07-01T22:09:18Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;TemplateData: &lt;/span&gt; sp&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;
{{lua|Module:If in page}}&lt;br /&gt;
&amp;lt;!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --&amp;gt;&lt;br /&gt;
This template searches the current page for a provided [[mw:Extension:Scribunto/Lua reference manual#Ustring patterns|Lua mw.ustring pattern]]. If you need help with these, you could ask [[Wikipedia talk:Lua]], [[Wikipedia:Village pump (technical)]], or a [[:Category:User lua|user who knows Lua]]. &lt;br /&gt;
&lt;br /&gt;
Note: the pattern is parsed by MediaWiki before being sent to the module, this means templates and magic words are decoded. If you want to add a &amp;lt;code&amp;gt;{{!}}&amp;lt;/code&amp;gt; pipe character use &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;
== Usage ==&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{If in page |pattern |value if present |value if absent}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; searches the current page for a given pattern&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{If in page |pattern |value if present |value if absent |page=page}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; can be used to search a page other than the current page&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{If in page |pattern |value if present |value if absent |sub=yes}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; if the pattern matches, substitutes &amp;lt;code&amp;gt;%1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%3&amp;lt;/code&amp;gt;, etc. in &amp;lt;code&amp;gt;value if present&amp;lt;/code&amp;gt; with first, second, third, etc. capture groups. Does not work with &amp;lt;code&amp;gt;%0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{If in page |%{%{[Uu]se British English%}%}|colour|color}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; would output colour if a page contains {{tl|Use British English}} or color if it does not&lt;br /&gt;
&lt;br /&gt;
== TemplateData ==&lt;br /&gt;
{{TemplateData header}}&lt;br /&gt;
&amp;lt;templatedata&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
	&amp;quot;params&amp;quot;: {&lt;br /&gt;
		&amp;quot;1&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Pattern&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;A valid pattern for mw.ustring.match&amp;quot;,&lt;br /&gt;
			&amp;quot;required&amp;quot;: true&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;2&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Value if present&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The value to output if the pattern matches the content of the page&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;content&amp;quot;,&lt;br /&gt;
			&amp;quot;suggested&amp;quot;: true&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;3&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Value if absent&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The value to output if the pattern matches the content of the page&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;content&amp;quot;,&lt;br /&gt;
			&amp;quot;suggested&amp;quot;: true&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;page&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Page&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The page to search, if not the current page&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;sub&amp;quot;: {&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;If set, then value if present will have %n replaced with capture groups, see doc&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;boolean&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/templatedata&amp;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;
&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wikipedia&gt;Danski454</name></author>
	</entry>
</feed>