<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://elite.mistflux.co.uk/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ATemplate_parameter_value%2Fdoc</id>
	<title>Module:Template parameter value/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://elite.mistflux.co.uk/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ATemplate_parameter_value%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://elite.mistflux.co.uk/w/index.php?title=Module:Template_parameter_value/doc&amp;action=history"/>
	<updated>2026-10-31T22:43:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://elite.mistflux.co.uk/w/index.php?title=Module:Template_parameter_value/doc&amp;diff=112247&amp;oldid=prev</id>
		<title>Wikipedia&gt;Ahecht: /* getParameter */ Set to -1 for last occurrence.</title>
		<link rel="alternate" type="text/html" href="https://elite.mistflux.co.uk/w/index.php?title=Module:Template_parameter_value/doc&amp;diff=112247&amp;oldid=prev"/>
		<updated>2025-04-16T17:15:29Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;getParameter: &lt;/span&gt; Set to -1 for last occurrence.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{high risk}}&lt;br /&gt;
{{lua|Module:Wikitext Parsing}}&lt;br /&gt;
Implements {{tl|Template parameter value}} and {{tl|HasTemplate}}, and can be used from other modules.&lt;br /&gt;
&lt;br /&gt;
== Module functions ==&lt;br /&gt;
=== getParameter ===&lt;br /&gt;
getParameter takes 4 arguments: The page name (string), the template/s (string or table of strings), the parameter (string), and an optional options table. It will return either &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; and the contents of the requested parameter or &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; and a reason for failure.&lt;br /&gt;
&lt;br /&gt;
The following options are available:&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;template_index&amp;#039;&amp;#039;&amp;#039;: Which occurrence of the template to look for the parameter in. Set to -1 for last occurrence. (default: 1)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;parameter_index&amp;#039;&amp;#039;&amp;#039;: Which occurrence of the parameter to look for (default: 1; only applies when &amp;lt;code&amp;gt;ignore_subtemplates&amp;lt;/code&amp;gt; is false)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;ignore_subtemplates&amp;#039;&amp;#039;&amp;#039;: If parameters should only be searched for in the top-level template, ignoring the parameters in subtemplates (default: false)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;only_subtemplates&amp;#039;&amp;#039;&amp;#039;: If parameters should only be searched for in subtemplates of the top-level template (default: false)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;ignore_blank&amp;#039;&amp;#039;&amp;#039;: Whether or not blank values should count towards &amp;lt;code&amp;gt;parameter_index&amp;lt;/code&amp;gt; (default: false)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;treat_as_regex&amp;#039;&amp;#039;&amp;#039;: Whether or not the template string(s) should be treated as a lua regex (default: false)&lt;br /&gt;
&lt;br /&gt;
=== getTemplate ===&lt;br /&gt;
getTemplate takes 3 arguments: The page name (string), the template/s (string or table of strings), and an optional options table. It will return either &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; and the text of the requested template or &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; and a reason for failure.&lt;br /&gt;
&lt;br /&gt;
getTemplate supports the options &amp;lt;code&amp;gt;template_index&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;treat_as_regex&amp;lt;/code&amp;gt; from getParameter.&lt;br /&gt;
&lt;br /&gt;
=== Helper functions ===&lt;br /&gt;
The module exposes some of the helper functions used (&amp;lt;code&amp;gt;matchAllTemplates&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getParameters&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;getAllParameters&amp;lt;/code&amp;gt;) for convenience. Each function has some comments above it in the code explaining its rough purpose.&lt;br /&gt;
&lt;br /&gt;
== Template functions ==&lt;br /&gt;
&amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; implements {{tl|Template parameter value}} and acts as a template wrapper for &amp;lt;code&amp;gt;getParameter&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;hasTemplate&amp;lt;/code&amp;gt; implements {{tl|HasTemplate}} and somewhat acts as a wrapper for &amp;lt;code&amp;gt;getTemplate&amp;lt;/code&amp;gt; (it only provides if the template was found, not the template text itself).&lt;br /&gt;
&lt;br /&gt;
== Testcases ==&lt;br /&gt;
Testcases are available at [[Module talk:Template parameter value/testcases]]&lt;/div&gt;</summary>
		<author><name>Wikipedia&gt;Ahecht</name></author>
	</entry>
</feed>