Module:Params/doc: Difference between revisions

Content deleted Content added
mNo edit summary
m cutting: emphasis
 
(314 intermediate revisions by 10 users not shown)
Line 1:
{{Module rating|beta}}
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
{{Module rating|release}}
{{Side box
| image = [[File:Amplification-1294300.svg|48px|alt=|link=]]
| above = '''About the latest changes'''
| text = See the '''[[Module:Params/ChangeLog|ChangeLog]]'''
| below = <small>Last update: {{#time:j xg Y|{{REVISIONTIMESTAMP:Module:Params}}}}</small><br /><small>[[Module:Params/testcases|Testcases]] · [[Module:Params/doc/examples|Examples]] · [[Module:Params/sandbox|Sandbox]]</small>
| textstyle = padding: .85em; text-align: center;
}}
 
The <code><nowikisyntaxhighlight lang="wikitext" inline>{{#invoke:params}}</nowiki></codesyntaxhighlight> module is designed to be adopted by those templates that want to have a deep control of their parameters. It is particularly useful to [[variadic template]]s, to which it offers the possibility to count, list, map and propagate the parameters received without knowing their number in advance.
 
The module offers elegant shortcuts to non variadic templates as well. Outside templates the moduleit has virtually no applications; hence, if you plan to make experiments, make sure to do them from within a template, or you will not be able to see much (you can use {{tl|Template sandbox}} for that). Under {{rel|Module:Params/testcases}} you can find helper templates that can be specifically used for testing the module's capabilities in flexible ways. Finally, under {{rel|Module:Params/doc/examples}} you can find some of the examples shown in this documentation page.
 
{{A note}} In case your template uses <syntaxhighlight lang="wikitext" inline>{{#invoke:params}}</syntaxhighlight>, please add {{tji|lua|Module&#58;Params}} to its documentation page, so that if breaking changes will be introduced in the future the template will be easily traceable without performing <span class="plainlinks">[//en.wikipedia.org/w/index.php?search=insource%3A%2Finvoke%3Aparams%2Fi&title=Special%3ASearch&profile=advanced&fulltext=1&ns10=1&limit=500&sort=last_edit_desc an “in source” search]</span>.
Among the possibilities that the module offers there is that of performing a series of actions after novel arguments have been concatenated to the template's incoming parameters. As this sometimes makes it necessary to keep the parameter slots clean from intereferences, instead of named arguments in order to specify options this module uses ''piping functions'' (i.e. functions that expect to be piped instead of returning to the caller), or ''modifiers''. This creates a syntax similar to the following example:
 
Please, do not edit this module without having done extensive testing in the [[Module:Params/sandbox|module's sandbox]] first.
 
== General usage ==
Among the possibilities that the module offers there is that of performing a series of actions after novel arguments have been concatenated to templates' incoming parameters. As this makes it necessary to keep the argument slots clean from interference, instead of named arguments in order to specify options this module uses ''piping functions'' (i.e. functions that expect to be [[Pipeline (software)|piped]] instead of returning to the caller), or ''modifiers''. This creates a syntax similar to the following example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|[modifier]|[...]|[modifier]|[...]|function|[...]}}</syntaxhighlight>
 
For instance, as the name suggests, the <code>[[#list|<code>list]]</code>]] function lists the parameters wherewith a template was called;. By default it does not add delimiters, but returns an indistinct blob of text in which keys and values are sticked to each other. However, by using the <code>[[#setting|setting]]</code> modifier, we are able to declare a key-value delimiter (<code>p</code>) and an iteration delimiter (<code>i</code>). And so, if we imagined a template named <code><nowikisyntaxhighlight lang="wikitext" inline>{{Exampleexample template}}</nowiki></codesyntaxhighlight> containing the following wikitext,
 
<syntaxhighlight lang="wikitext">{{#invoke:params|listsetting|<i/dd><dt>p|<br /dt><dd>|<dl><dt>: |</dd></dl>list}}</syntaxhighlight>
 
and such template were called with the following argumentsparameters,
 
<syntaxhighlight lang="wikitext">{{Exampletj|example template|Beast of Bodmin=: A large feline inhabiting Bodmin Moor.
|Morgawr=: A sea serpent.|Owlman=: A giant owl-like creature.}}</syntaxhighlight>
 
the following result would be produced:
 
: Beast of Bodmin: A large feline inhabiting Bodmin Moor<br />Morgawr: A sea serpent<br />Owlman: A giant owl-like creature
 
We can also do more sophisticated things; for instance, by exploiting the possibility to set a header (<code>h</code>) and a footer (<code>f</code>), we can transform the previous code into a generator of [https://html.spec.whatwg.org/multipage/grouping-content.html#the-dl-element definition lists],
 
<syntaxhighlight lang="wikitext">{{#invoke:params|setting|h/p/i/f|<dl><dt>|</dt><dd>|</dd><dt>|</dd></dl>|list}}</syntaxhighlight>
 
thus yielding:
 
:; Beast of Bodmin
:: A large feline inhabiting Bodmin Moor.
:; Morgawr
:: A sea serpent.
:; Owlman
:: A giant owl-like creature.
 
However, byBy placing the <code>[[#with_name_matching|<code>with_name_matching]]</code>]] modifier before the <code>[[#list|<code>list]]</code>]] function we wouldwill be able to filter some parameters out – such as, for instance, all parameter names that do not end with an “n”:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|with_name_matching|n$|listsetting|<h/ddp/i/f|<dl><dt>|</dt><dd>|<dl/dd><dt>|</dd></dl>|list}}</syntaxhighlight>
 
Thus, the previous code wouldwill produce:
 
:; Beast of Bodmin
:: A large feline inhabiting Bodmin Moor.
:; Owlman
:: A giant owl-like creature.}}
 
This mechanism has the intrinsic advantage that it allows to concatenateconcatenating infinite modifiers. And so, in order to get the accurate result that we want to obtain we could write:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|non-sequential|with_name_matching|^B|with_name_matching|n$|with_name_matchingwith_value_matching|^Afeline|non-sequentialsetting|with_name_matchingh/p/i/f|^E<dl><dt>|</dt><dd>|</dd><dt>|</dd></dl>|list}}</syntaxhighlight>
 
The two modifiers <code>[[#sequential|<code>sequential]]</code>]] and <code>[[#non-sequential|<code>non-sequential]]</code>]] refer to a technical jargon used in wikitext: given a parameter list, the subgroup of sequential parameters is constituted by the largest group of consecutive numericalnumeric parameters starting from {{paratjp|1:}} – this is known as the parameters' “sequence”. A parameter list that does not have a first parameter specified does not possess a sequence.
 
== Functions ==
 
Here follows the list of functions. AllYou modifiersmight are applicablewant to eachsee of them (seealso [[#Modifiers (piping functions)|§ Modifiers]]).
 
{{vpad|clear=none}}
 
=== <code>self</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>self</code> <span style="nowrap">({{module:params/doc/link to the code|self|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label3 = Not affected by | data3 = Any modifier
| header4 = See also
| data5 = <code>&#123;&#123;[[:mw:Help:Magic words#FULLPAGENAME|FULLPAGENAME]]&#125;&#125;</code>
}}
 
; Brief
: ''Return the name of the current template''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|self}}</syntaxhighlight>
 
This argumentless function guarantees that the name of the template invoking this module is shown, regardless if this is transcluded or not.
 
As a possible example, if a Wikipedia page named <code>Page X</code> contained only a transclusion of a template named <syntaxhighlight lang="wikitext" inline>{{foobar}}</syntaxhighlight>, and the latter contained the following wikitext,
 
<syntaxhighlight lang="wikitext">{{#invoke:params|self}}
 
{{FULLPAGENAME}}</syntaxhighlight>
 
if we visited <code>Template:Foobar</code> we would see,
 
<pre>Template:Foobar
 
Template:Foobar</pre>
 
whereas if we visited <code>Page X</code> we would see:
 
<pre>Template:Foobar
 
Page X</pre>
 
Therefore by writing
 
<syntaxhighlight lang="wikitext">{{#ifeq:{{#invoke:params|self}}|{{FULLPAGENAME}}
|Page is not being transcluded
|Page is being transcluded
}}</syntaxhighlight>
 
it is possible to understand whether a page is being transcluded or not. For most cases the {{tag|includeonly}} and {{tag|noinclude}} will offer a simpler solution, however there can be cases in which this becomes the way to go.
 
If <code>Page X</code> transcluded <syntaxhighlight lang="wikitext" inline>{{foobar 2}}</syntaxhighlight> and the latter were a redirect to <syntaxhighlight lang="wikitext" inline>{{foobar}}</syntaxhighlight>, we would still see
 
<pre>Template:Foobar
 
Page X</pre>
 
A typical use case of this function is that of providing stable links for editing transcluded templates. E.g.:
 
<syntaxhighlight lang="wikitext">{{edit|{{#invoke:params|self}}|edit this template}}</syntaxhighlight>
 
Another possible use case is that of transcluding a subtemplate. E.g.:
 
<syntaxhighlight lang="wikitext">{{{{#invoke:params|self}}/my subtemplate|foo|bar}}</syntaxhighlight>
 
{{vpad|1.5em|clear=none}}
 
=== <code>count</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>count</code> <span style="nowrap">({{module:params/doc/link to the code|count|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Often preceeded by | data2 = <code>[[#sequential|sequential]]</code>
| label3 = Not affected by | data3 = <code>[[#all_sorted|all_sorted]]</code>, <code>[[#reassorted|reassorted]]</code>, <code>[[#setting|setting]]</code>,<br /><code>[[#sorting_sequential_values|sorting_sequential_val…]]</code>,<br /><code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#mapping_by_replacing|mapping_by_replacing]]</code>
| header4 = See also
| data5 = {{mlx|ParameterCount|}}
}}
 
; Brief
: Counts''Count the number of parameters wherebywherewith a template was called''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|count}}</syntaxhighlight>
Line 56 ⟶ 149:
This function does not take arguments.
 
The number that this function yields depends on the modifiers that precede it. For instance, in a template that is called with both named and unnamed parameters,
=== <code>list</code> ===
 
<syntaxhighlight lang="wikitext" inline>{{#invoke:params|count}}</syntaxhighlight>
 
and
 
<syntaxhighlight lang="wikitext" inline>{{#invoke:params|sequential|count}}</syntaxhighlight>
 
will return different results.
 
{{vpad|1.5em|clear=none}}
 
=== <code>concat_and_call</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>concat_and_call</code> <span style="nowrap">({{module:params/doc/link to the code|concat_and_call|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Not affected by | data2 = <code>[[#all_sorted|all_sorted]]</code>, <code>[[#reassorted|reassorted]]</code>
| header3 = See also
| data4 = <code>[[#combining_by_calling|combining_by_calling]]</code>, <code>[[#concat_and_invoke|concat_and_invoke]]</code>, <code>[[#concat_and_magic|concat_and_magic]]</code>, <code>{{mfl|template wrapper|wrap}}</code>
}}
 
; Brief
: ''Prepend positive numeric arguments to the current parameters, or impose non-numeric or negative numeric arguments, then propagate everything to a custom template''
: Lists the template parameters (both their names and their values)
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|listconcat_and_call|template name|[argumentprepend separator1]|[key-prepend 2]|[...]|[prepend n]|[named item 1=value separator1]|[header...]|[named item n=value n]|[footer...]}}</syntaxhighlight>
 
This function comes in handy in case of [[Wikipedia:Wrapper templates|wrapper templates]]. For example, if our <syntaxhighlight lang="wikitext" inline>{{wrapper template}}</syntaxhighlight> had the following code,
If no arguments are passed the vertical bar (<code>&#124;</code>) will be used as parameter separator and the equals sign (<code>=</code>) will be used as key-value separator, with no header and no footer.
 
<syntaxhighlight lang="wikitext">{{#invoke:params|concat_and_call|foobar|elbow|earth|room|7=classy|hello=not today}}</syntaxhighlight>
 
and were called with,
 
{{tj|wrapper template|one|two|three|hello: world|wind: spicy}}
 
the following call to the <syntaxhighlight lang="wikitext" inline>{{foobar}}</syntaxhighlight> template would be performed:
 
{{tj|foobar|elbow|earth|room|7: classy|8: one|9: two|10: three
|wind: spicy|hello: not today}}
 
By using the <code>[[#cutting|cutting]]</code> modifier it is possible to impose numeric positive parameters instead of prepending them. For instance, the following code echoes all incoming parameters to <syntaxhighlight lang="wikitext" inline>{{my template}}</syntaxhighlight>, with the exception of {{para|3}}, which is replaced with <code>hello world</code>:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|cutting|3|0|concat_and_call|my template|{{{1|}}}|{{{2|}}}|hello world}}</syntaxhighlight>
 
If the numeric parameters to replace are a limited number, as in the example above, a better alternative might be that of using <code>[[#imposing|imposing]]</code>.
 
If no other argument besides the ''template name'' is provided this function simply echoes the current parameters to another template.
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this function except the ''template name'' will not be trimmed of their leading and trailing spaces. The <code>concat_and_call</code> ''function name'' itself, however, will be trimmed of its surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>concat_and_invoke</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>concat_and_invoke</code> <span style="nowrap">({{module:params/doc/link to the code|concat_and_invoke|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Not affected by | data2 = <code>[[#all_sorted|all_sorted]]</code>, <code>[[#reassorted|reassorted]]</code>
| header3 = See also
| data4 = <code>[[#concat_and_call|concat_and_call]]</code>, <code>[[#concat_and_magic|concat_and_magic]]</code>
}}
 
=== <code>list_values</code> ===
; Brief
: ''Prepend positive numeric arguments to the current parameters, or impose non-numeric or negative numeric arguments, then propagate everything to a custom module''
: Lists the template parameter values
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|list_valuesconcat_and_invoke|module name|function name|[argumentprepend separator1]|[headerprepend 2]|[...]|[prepend n]|[named item 1=value 1]|[...]|[named item n=value n]|[footer...]}}</syntaxhighlight>
 
Exactly like <code>[[#concat_and_call|concat_and_call]]</code>, but invokes a module instead of calling a template.
If no arguments are passed the vertical bar (<code>&#124;</code>) will be used as parameter separator, with no header and no footer.
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this function except the ''module name'' and the ''function name'' will not be trimmed of their leading and trailing spaces. The <code>concat_and_invoke</code> ''function name'' itself, however, will be trimmed of its surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>concat_and_magic</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>concat_and_magic</code> <span style="nowrap">({{module:params/doc/link to the code|concat_and_magic|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Not affected by | data2 = <code>[[#all_sorted|all_sorted]]</code>, <code>[[#reassorted|reassorted]]</code>
| header3 = See also
| data4 = <code>[[#concat_and_call|concat_and_call]]</code>, <code>[[#concat_and_invoke|concat_and_invoke]]</code>
}}
 
=== <code>merge_and_call</code> ===
; Brief
: Prepends''Prepend user-givenpositive unnamednumeric arguments to the current parameters, or impose usernon-givennumeric namedor negative numeric arguments;, then propagate everything to a custom templateparser function''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|merge_and_callconcat_and_magic|templateparser namefunction|[prepend 1]|[prepend 2]|[...]|[itemprepend n]|[named item 1=value 1]|[...]|[named item n=value n]|[...]}}</syntaxhighlight>
}}</syntaxhighlight>
 
Exactly like <code>[[#concat_and_call|concat_and_call]]</code>, but calls a [[:mw:Help:Magic words#Parser functions|parser function]] instead of a template.
For example, if our <code><nowiki>{{Example template}}</nowiki></code> had the following code,
 
{{vpad|clear=none}}
<syntaxhighlight lang="wikitext">{{#invoke:params|merge_and_call|foo bar|elbow|earth|room|7=classy|hello=not today}}</syntaxhighlight>
 
{{A note}} All arguments passed to this function except the magic word will not be trimmed of their leading and trailing spaces. The <code>concat_and_magic</code> ''function name'' itself, however, will be trimmed of its surrounding spaces.
and it were called with,
 
{{vpad|1.5em|clear=none}}
<syntaxhighlight lang="wikitext">{{example template|one|two|three|hello=world|wind=spicy}}</syntaxhighlight>
 
=== <code>value_of</code> ===
the following call to the <code><nowiki>{{Foo bar}}</nowiki></code> template would be performed:
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>value_of</code> <span style="nowrap">({{module:params/doc/link to the code|value_of|code}})</span>
| label1 = Num. of arguments | data1 = 1
| label2 = Relevant [[#setting|function-only variables]] | data2 = <code>h</code>, <code>f</code>, <code>n</code>
| label3 = Not affected by | data3 = <code>[[#all_sorted|all_sorted]]</code>, <code>[[#reassorted|reassorted]]</code>
| header4 = See also
| data5 = <code>[[#list_values|list_values]]</code>, <code>[[#coins|coins]]</code>, <code>[[#unique_coins|unique_coins]]</code>
}}
 
; Brief
<syntaxhighlight lang="wikitext">{{foo bar|elbow|earth|room|7=classy|8=one|9=two|10=three|wind=spicy|hello=not today}}</syntaxhighlight>
: ''Get the value of a single parameter''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|value_of|parameter name}}</syntaxhighlight>
 
Without modifiers this function is similar to writing <syntaxhighlight lang="wikitext" inline>{{{parameter name|}}}</syntaxhighlight>. With modifiers, however, it allows reaching parameters that would be unreachable without knowing their number in advance. For instance, writing
If no other argument besides the template name are provided this function simply echoes the current parameters to another template.
 
<syntaxhighlight lang="wikitext">{{#invoke:params|cutting|-2|0|value_of|1}}</syntaxhighlight>
 
will expand to the value of the second-last sequential parameter, independently of how many parameters the template was called with. If no matching parameter is found this function expands to nothing. A header (<code>h</code>), a footer (<code>f</code>), and a fallback text (<code>n</code>) can be declared via the <code>[[#setting|setting]]</code> modifier – the strings assigned to the key-value pair delimiter (<code>p</code>), the iteration delimiter (<code>i</code>) and the last iteration delimiter (<code>l</code>) will be ignored.
 
For instance, the {{Tl|If then show}} template could be rewritten as
 
<syntaxhighlight lang="wikitext">{{#invoke:params|with_value_not_matching|^%s*$|setting|h/f/n|{{{3|}}}|{{{4|}}}|{{{2|}}}|value_of|1}}</syntaxhighlight>
 
Simplifying, the following wikitext expands to the first parameter that is not empty:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|with_value_not_matching||strict|squeezing|value_of|1}}</syntaxhighlight>
 
Whereas the following wikitext expands to the first parameter that is not blank (i.e. neither empty nor containing only [[whitespace]]s)
 
<syntaxhighlight lang="wikitext">{{#invoke:params|with_value_not_matching|^%s*$|squeezing|value_of|1}}</syntaxhighlight>
 
{{vpad|1.5em|clear=none}}
 
=== <code>list</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>list</code> <span style="nowrap">({{module:params/doc/link to the code|list|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = [[#all_sorted|Sortable]] | data2 = Yes
| label3 = Relevant [[#setting|function-only variables]] | data3 = <code>h</code>, <code>p</code>, <code>i</code>, <code>l</code>, <code>f</code>, <code>n</code>
| header4 = See also
| data5 = <code>[[#list_values|list_values]]</code>
}}
 
=== <code>merge_and_invoke</code> ===
; Brief
: ''List the template parameters (both their names and their values)''
: Prepends user-given unnamed arguments to the current parameters, or impose user-given named arguments; then propagate everything to a custom module
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|merge_and_invoke|template name|[prepend 1]|[prepend 2]|[...]|[item n]|[named item 1=value 1]|[...]|[named item n=value n]|[...]list}}</syntaxhighlight>
 
This function does not take arguments.
 
If the <code>[[#setting|setting]]</code> modifier was not placed earlier, this function will not add delimiters, but will return an indistinct blob of text in which keys and values are sticked to each other. A header (<code>h</code>), a key-value pair delimiter (<code>p</code>), an iteration delimiter (<code>i</code>), a last iteration delimiter (<code>l</code>), a footer (<code>f</code>), and a fallback text (<code>n</code>) can be declared via <code>[[#setting|setting]]</code>.
 
For example, the following code
 
<syntaxhighlight lang="wikitext">{{#invoke:params|setting|h/i/p/f/n|'''Parameters passed:''' |); | (|)|'''No parameters were passed'''|list}}</syntaxhighlight>
 
will generate an output similar to the following.
 
: '''Parameters passed:''' Owlman (A giant owl-like creature); Beast of Bodmin (A large feline inhabiting Bodmin Moor); Morgawr (A sea serpent)
 
{{vpad|1.5em|clear=none}}
 
=== <code>list_values</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>list_values</code> <span style="nowrap">({{module:params/doc/link to the code|list_values|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = [[#all_sorted|Sortable]] | data2 = Yes
| label3 = Often preceeded by | data3 = <code>[[#sequential|sequential]]</code>
| label4 = Relevant [[#setting|function-only variables]] | data4 = <code>h</code>, <code>i</code>, <code>l</code>, <code>f</code>, <code>n</code>
| header5 = See also
| data6 = <code>[[#list|list]]</code>, <code>[[#value_of|value_of]]</code>, <code>[[#coins|coins]]</code>, <code>[[#unique_coins|unique_coins]]</code>, {{mlx|separated entries|}}
}}
 
; Brief
: ''List the values of the incoming parameters''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|list_values}}</syntaxhighlight>
 
This function does not take arguments.
 
The <code>[[#sequential|sequential]]</code> modifier often accompanies this function. If the <code>[[#setting|setting]]</code> modifier was not placed earlier, this function will not add delimiters, but will return an indistinct blob of text in which values are sticked to each other. A header (<code>h</code>), an iteration delimiter (<code>i</code>), a last iteration delimiter (<code>l</code>), a footer (<code>f</code>), and a fallback text (<code>n</code>) can be declared via <code>[[#setting|setting]]</code> – the string assigned to the key-value pair delimiter (<code>p</code>) will be ignored.
 
For example, the following code
 
<syntaxhighlight lang="wikitext">{{#invoke:params|setting|h/i/p/f/n|'''Parameters passed:''' |); | (|)|'''No parameters were passed'''|list_values}}</syntaxhighlight>
 
will generate an output similar to the following.
 
: '''Values of parameters passed:''' A giant owl-like creature; A large feline inhabiting Bodmin Moor; A sea serpent.
 
{{vpad|1.5em|clear=none}}
 
=== <code>coins</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>coins</code> <span style="nowrap">({{module:params/doc/link to the code|coins|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = [[#all_sorted|Sortable]] | data2 = Yes
| label3 = Often preceeded by | data3 = <code>[[#sequential|sequential]]</code>, <code>[[#trimming_values|trimming_values]]</code>
| label4 = Relevant [[#setting|function-only variables]] | data4 = <code>h</code>, <code>i</code>, <code>l</code>, <code>f</code>, <code>n</code>
| header5 = See also
| data6 = <code>[[#unique_coins|unique_coins]]</code>, <code>[[#list|list]]</code>, <code>[[#value_of|value_of]]</code>
}}
 
; Brief
: ''Associate custom strings to possible parameter values and list the custom string when the associated value is present''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|coins|[first coin = value 1]|[second coin = value 2]|[...]|[last coin = value N]}}</syntaxhighlight>
 
This function is identical to the <code>[[#unique_coins|unique_coins]]</code> function, except that it allows the repetition of identical flags. See there for more information.
 
{{vpad|1.5em|clear=none}}
 
=== <code>unique_coins</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>unique_coins</code> <span style="nowrap">({{module:params/doc/link to the code|unique_coins|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = [[#all_sorted|Sortable]] | data2 = Yes
| label3 = Often preceeded by | data3 = <code>[[#sequential|sequential]]</code>, <code>[[#trimming_values|trimming_values]]</code>
| label4 = Relevant [[#setting|function-only variables]] | data4 = <code>h</code>, <code>i</code>, <code>l</code>, <code>f</code>, <code>n</code>
| header5 = See also
| data6 = <code>[[#coins|coins]]</code>, <code>[[#list|list]]</code>, <code>[[#value_of|value_of]]</code>
}}
 
; Brief
: ''Associate custom strings to possible parameter values and list the custom string when the associated value is present, but not more than once''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|unique_coins|[first coin = value 1]|[second coin = value 2]|[...]|[last coin = value N]}}</syntaxhighlight>
 
This function is used to detect the existence of flag parameters. For this reason, it is often accompanied by the <code>[[#sequential|sequential]]</code> modifier (or, equivalently, by <code>...&#124;[[#excluding_non-numeric_names|excluding_non-numeric_names]]&#124;[[#clearing|clearing]]&#124;...</code>). For a similar function that allows the repetition of identical flags, see the <code>[[#coins|coins]]</code> function.
 
A typical use case of this function is that of constructing [[URL]]s. For example, the following template named <syntaxhighlight lang="wikitext" inline>{{example template}}</syntaxhighlight> checks for the <code>html</code>, <code>xml</code>, <code>comments</code> and <code>removenowiki</code> flags in order to append respectively the following strings to the final URL: <code>&amp;wpGenerateRawHtml=1</code>, <code>&amp;wpGenerateXml=1</code>, <code>&amp;wpRemoveComments=0</code>, <code>&amp;wpRemoveNowiki=1</code>.
 
<syntaxhighlight lang="wikitext">{{#if:{{{input|}}}
| <span class="plainlinks">[{{fullurl:Special:ExpandTemplates|wpInput={{urlencode:{{{input}}}|QUERY}}{{#if:{{{title|}}}|&wpContextTitle={{urlencode|{{{title}}}|QUERY}}}}{{#invoke:params|excluding_non-numeric_names|clearing|sequential|trimming_values|unique_coins
| html = &wpGenerateRawHtml=1
| xml = &wpGenerateXml=1
| comments = &wpRemoveComments=0
| removenowiki = &wpRemoveNowiki=1
}}}} {{#if:{{{label|}}}|{{{label|}}}|Expand <code>{{{input}}}</code>}}]</span>
| {{Error|Error: The {{para|input}} parameter is missing.}}
}}</syntaxhighlight>
 
And so, when transcluded as,
Exactly like [[#merge_and_call|<code>merge_and_call</code>]], but invokes a module instead of calling a template.
 
<syntaxhighlight lang="wikitext">{{example template|comments|xml
| input = Hello world {<nowiki />{#time:r{{!}}now}<nowiki />}
}}</syntaxhighlight>
 
it will generate the following output:
 
: {{module:params/doc/examples/link to expanded template|comments|xml
| input = Hello world {<nowiki />{#time:r{{!}}now}<nowiki />}
}}
 
A copy of the example above is available at &#123;&#123;{{rel|Module:Params/doc/examples/link to expanded template}}&#125;&#125;.
 
If the <code>[[#setting|setting]]</code> modifier was not placed earlier, this function will not add delimiters, but will return an indistinct blob of text in which values are sticked to each other. A header (<code>h</code>), an iteration delimiter (<code>i</code>), a last iteration delimiter (<code>l</code>), a footer (<code>f</code>), and a fallback text (<code>n</code>) can be declared via <code>[[#setting|setting]]</code> – the string assigned to the key-value pair delimiter (<code>p</code>) will be ignored.
 
{{vpad|1.5em|clear=none}}
 
=== <code>call_for_each</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>call_for_each</code> <span style="nowrap">({{module:params/doc/link to the code|call_for_each|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = [[#all_sorted|Sortable]] | data2 = Yes
| label3 = Relevant [[#setting|function-only variables]] | data3 = <code>h</code>, <code>i</code>, <code>l</code>, <code>f</code>, <code>n</code>
| header4 = See also
| data5 = <code>[[#call_for_each_value|call_for_each_value]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#invoke_for_each|invoke_for_each]]</code>, <code>[[#magic_for_each|magic_for_each]]</code>, <code>[[#call_for_each_group|call_for_each_group]]</code>, {{mlx|for loop|}}, {{tl2|for loop}}
}}
 
; Brief
: ''For each parameter passed to the callercurrent template, callscall a custom template with at least two parameters (key and value)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|call_for_each|template name|[append 1]|[append 2]|[...]|[append n]|[named param 1=value 1]|[...]|[named param n=value n]|[...]
}}</syntaxhighlight>
 
Some functions are like shortcuts. The <code>X_for_each|F</code> functions are similar to <code>mapping_by_X(ing)|F|(names_and_values|)list_values</code>. The latter syntax (i.e. the modifier version) allows a <code>values_and_names</code> flag to invert the order from key-value to value-key.
All other unnamed parameters following the template name will be appended to the key-value pair. Named parameters will be passed verbatim.
 
All unnamed arguments following the ''template name'' will be placed after the key-value pair. Named arguments will be passed verbatim. A header (<code>h</code>), an iteration delimiter (<code>i</code>), a last iteration delimiter (<code>l</code>), a footer (<code>f</code>), and a fallback text (<code>n</code>) can be declared via the <code>[[#setting|setting]]</code> modifier – the string assigned to the key-value pair delimiter (<code>p</code>) will be ignored.
 
Calling a template for each key-value pair with
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|call_for_each|foobar}}</syntaxhighlight>
 
will be different from writing
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|for_each|{{foobar|$#|$@}}}}</syntaxhighlight>
 
In the first example each key-value pair will be passed to the <syntaxhighlight lang="wikitext" inline>{{foobar}}</syntaxhighlight> template, while in the second example the <code>$#</code> and <code>$@</code> tokens will be expanded ''after'' the <syntaxhighlight lang="wikitext" inline>{{foobar}}</syntaxhighlight> template has been called. In most cases this will make no difference, however there are several situations where it will lead to nonsensical results.
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this function except the ''template name'' will not be trimmed of their leading and trailing spaces. The <code>call_for_each</code> ''function name'' itself, however, will be trimmed of its surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>invoke_for_each</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>invoke_for_each</code> <span style="nowrap">({{module:params/doc/link to the code|invoke_for_each|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = [[#all_sorted|Sortable]] | data2 = Yes
| label3 = Relevant [[#setting|function-only variables]] | data3 = <code>h</code>, <code>i</code>, <code>l</code>, <code>f</code>, <code>n</code>
| header4 = See also
| data5 = <code>[[#invoke_for_each_value|invoke_for_each_value]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#call_for_each|call_for_each]]</code>, <code>[[#magic_for_each|magic_for_each]]</code>
}}
 
; Brief
: ''For each parameter passed to the callercurrent template, invokesinvoke a custom module function with at least two arguments (key and value)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|invoke_for_each|module name|module function|[append 1]|[append 2]|[...]|[append n]|[named param 1=value 1]|[...]|[named param n=value n]|[...]}}</syntaxhighlight>
 
Exactly like <code>[[#call_for_each|<code>call_for_each]]</code>]], but invokes a module instead of calling a template.
 
Invoking a module function for each key-value pair with
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|invoke_for_each|foobar|main}}</syntaxhighlight>
 
will be different from writing
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|for_each|{{#invoke:foobar|main|$#|$@}}}}</syntaxhighlight>
 
In the first example each key-value pair will be passed to the <syntaxhighlight lang="wikitext" inline>{{#invoke:foobar|main}}</syntaxhighlight> module function, while in the second example the <code>$#</code> and <code>$@</code> tokens will be expanded ''after'' the module function has been invoked. There might be cases in which this will make no difference, however there are several situations where it will lead to nonsensical results.
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this function except the ''module name'' and the ''function name'' will not be trimmed of their leading and trailing spaces. The <code>invoke_for_each</code> ''function name'' itself, however, will be trimmed of its surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>magic_for_each</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>magic_for_each</code> <span style="nowrap">({{module:params/doc/link to the code|magic_for_each|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = [[#all_sorted|Sortable]] | data2 = Yes
| label3 = Relevant [[#setting|function-only variables]] | data3 = <code>h</code>, <code>i</code>, <code>l</code>, <code>f</code>, <code>n</code>
| header4 = See also
| data5 = <code>[[#magic_for_each_value|magic_for_each_value]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#call_for_each|call_for_each]]</code>, <code>[[#invoke_for_each|invoke_for_each]]</code>
}}
 
; Brief
: ''For each parameter passed to the current template, call a magic word with at least two arguments (key and value)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|magic_for_each|parser function|[append 1]|[append 2]|[...]|[append n]|[named param 1=value 1]|[...]|[named param n=value n]|[...]}}</syntaxhighlight>
 
Exactly like <code>[[#call_for_each|call_for_each]]</code>, but calls a [[:mw:Help:Magic words#Parser functions|parser function]] instead of a template.
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this function except the magic word will not be trimmed of their leading and trailing spaces. The <code>magic_for_each</code> ''function name'' itself, however, will be trimmed of its surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>call_for_each_value</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>call_for_each_value</code> <span style="nowrap">({{module:params/doc/link to the code|call_for_each_value|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = [[#all_sorted|Sortable]] | data2 = Yes
| label3 = Often preceeded by | data3 = <code>[[#sequential|sequential]]</code>
| label4 = Relevant [[#setting|function-only variables]] | data4 = <code>h</code>, <code>i</code>, <code>l</code>, <code>f</code>, <code>n</code>
| header5 = See also
| data6 = <code>[[#call_for_each|call_for_each]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#invoke_for_each_value|invoke_for_each_value]]</code>, <code>[[#magic_for_each_value|magic_for_each_value]]</code>, <code>[[#call_for_each_group|call_for_each_group]]</code>, {{mlx|for loop|}}, {{tl2|for loop}}
}}
 
; Brief
: ''For each parameter passed to the callercurrent template, callscall a custom template with at least one parameter (i.e. the parameter's value)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|call_for_each_value|template name|[append 1]|[append 2]|[...]|[append n]|[named param 1=value 1]|[...]|[named param n=value n]|[...]}}</syntaxhighlight>
 
AllThe other<code>[[#sequential|sequential]]</code> modifier often accompanies this function. All unnamed parametersarguments following the ''template name'' will be appended after the value parameter. Named parametersarguments will be passed verbatim. A header (<code>h</code>), an iteration delimiter (<code>i</code>), a last iteration delimiter (<code>l</code>), a footer (<code>f</code>), and a fallback text (<code>n</code>) can be declared via the <code>[[#setting|setting]]</code> modifier – the string assigned to the key-value pair delimiter (<code>p</code>) will be ignored.
 
For example, calling {{tl|tl}} with each parameter can be done by writing
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|setting|i|, |call_for_each_value|tl}}</syntaxhighlight>
 
This will be different from writing
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|setting|i|, |for_each|{{tl|$@}}}}</syntaxhighlight>
 
In the first example each value will be passed to the {{tl|tl}} template, while in the second example the <code>$@</code> token will be expanded ''after'' the {{tl|tl}} template has been called. Here this will make no difference, however there are several situations where it will lead to nonsensical results.
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this function except the ''template name'' will not be trimmed of their leading and trailing spaces. The <code>call_for_each_value</code> ''function name'' itself, however, will be trimmed of its surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>invoke_for_each_value</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>invoke_for_each_value</code> <span style="nowrap">({{module:params/doc/link to the code|invoke_for_each_value|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = [[#all_sorted|Sortable]] | data2 = Yes
| label3 = Often preceeded by | data3 = <code>[[#sequential|sequential]]</code>
| label4 = Relevant [[#setting|function-only variables]] | data4 = <code>h</code>, <code>i</code>, <code>l</code>, <code>f</code>, <code>n</code>
| header5 = See also
| data6 = <code>[[#call_for_each_value|call_for_each_value]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#invoke_for_each|invoke_for_each]]</code>, <code>[[#magic_for_each_value|magic_for_each_value]]</code>
}}
 
; Brief
: ''For each parameter passed to the callercurrent template, invokesinvoke a custom module function with at least one argument (i.e. the parameter's value)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|invoke_for_each_value|module name|module function|[append 1]|[append 2]|[...]|[append n]|[named param 1=value 1]|[...]|[named param n=value n]|[...]}}</syntaxhighlight>
 
Exactly like <code>[[#call_for_each_value|<code>call_for_each_value]]</code>]], but invokes a module instead of calling a template.
 
Invoking a module function for each value with
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|invoke_for_each_value|foobar|main}}</syntaxhighlight>
 
will be different from writing
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|for_each|{{#invoke:foobar|main|$@}}}}</syntaxhighlight>
 
In the first example each value will be passed to the {{ml|foobar|main}} module function, while in the second example the <code>$@</code> token will be expanded ''after'' the module function has been invoked. There might be cases in which this will make no difference, however there are several situations where it will lead to nonsensical results.
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this function except the ''module name'' and the ''function name'' will not be trimmed of their leading and trailing spaces. The <code>invoke_for_each_value</code> ''function name'' itself, however, will be trimmed of its surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>magic_for_each_value</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>magic_for_each_value</code> <span style="nowrap">({{module:params/doc/link to the code|magic_for_each_value|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = [[#all_sorted|Sortable]] | data2 = Yes
| label3 = Often preceeded by | data3 = <code>[[#sequential|sequential]]</code>
| label4 = Relevant [[#setting|function-only variables]] | data4 = <code>h</code>, <code>i</code>, <code>l</code>, <code>f</code>, <code>n</code>
| header5 = See also
| data6 = <code>[[#call_for_each_value|call_for_each_value]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#invoke_for_each_value|invoke_for_each_value]]</code>, <code>[[#magic_for_each|magic_for_each]]</code>
}}
 
; Brief
: ''For each parameter passed to the current template, call a magic word with at least one argument (i.e. the parameter's value)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|magic_for_each_value|parser function|[append 1]|[append 2]|[...]|[append n]|[named param 1=value 1]|[...]|[named param n=value n]|[...]}}</syntaxhighlight>
 
Exactly like <code>[[#call_for_each_value|call_for_each_value]]</code>, but calls a [[:mw:Help:Magic words#Parser functions|parser function]] instead of a template.
 
For example, if a template had the following code,
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|setting|ih|&preloadparams%5b%5d{{=}}|magic_for_each_value|urlencode|QUERY}}</syntaxhighlight>
 
and were transcluded as <syntaxhighlight lang="wikitext" inline>{{example template|hello world|àèìòù|foobar}}</syntaxhighlight>, the <code><nowiki>{{</nowiki>[[:mw:Help:Magic words#URL data|urlencode]]:...|QUERY<nowiki>}}</nowiki></code> parser function would be called for each incoming parameter as first argument and with <code>QUERY</code> as second argument, and finally the returned text would be prefixed with <code>&preloadparams%5b%5d=</code>. This would generate,
 
<pre>&preloadparams%5b%5d=hello+world&preloadparams%5b%5d=%C3%A0%C3%A8%C3%AC%C3%B2%C3%B9&preloadparams%5b%5d=foo+bar</pre>
 
which can be used to allow the creation of pages [[:mw:Manual:Creating pages with preloaded text#Using parameters|with preloaded text and parameters]].
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this function except the magic word will not be trimmed of their leading and trailing spaces. The <code>magic_for_each_value</code> ''function name'' itself, however, will be trimmed of its surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>call_for_each_group</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>call_for_each_group</code> <span style="nowrap">({{module:params/doc/link to the code|call_for_each_group|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Often preceeded by | data2 = <code>[[#all_sorted|all_sorted]]</code>, <code>[[#reassorted|reassorted]]</code>
| label3 = [[#all_sorted|Sortable]] | data3 = Yes
| label4 = Relevant [[#setting|function-only variables]] | data4 = <code>h</code>, <code>i</code>, <code>l</code>, <code>f</code>, <code>n</code>
| header5 = See also
| data6 = <code>[[#grouping_by_calling|grouping_by_calling]]</code>, <code>[[#call_for_each|call_for_each]]</code>, <code>[[#call_for_each_value|call_for_each_value]]</code>, {{mlx|for loop|}}, {{tl2|for loop}}
}}
 
; Brief
: ''Call a custom template for each group of parameters that have the same numeric suffix''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|call_for_each_group|template name|[append 1]|[append 2]|[...]|[append n]|[named param 1=value 1]|[...]|[named param n=value n]|[...]
}}</syntaxhighlight>
 
The custom template will be repeatedly called with the numeric id of the group (i.e. the numeric suffix) as '''parameter zero''' (i.e. {{param|0}}). This will be an empty string for the group of incoming parameters that do not have a numeric suffix. A hyphen before the numeric suffix will be interpreted as a minus sign (and therefore the group id will be treated as a negative number). Numeric incoming parameters will be treated as if their prefix is an empty string (these can be captured using <code>&#123;&#123;&#123;&#125;&#125;&#125;</code> or <code>&#123;&#123;&#123;&#124;''fallback text''&#125;&#125;&#125;</code> in the callback template). Spaces between the prefix and the numeric suffix will be ignored (therefore writing {{para|foobar123}} will be identical to writing {{para|foobar&nbsp;123}} – in case of collisions one of the two values will be discarded). In the unlikely scenario that the prefix is itself a number (e.g. {{para|1 1}}, {{para|2 1}}, etc.), if this is <code>0</code> or a negative number it will be decreased by one unit in order to leave the parameter zero undisturbed (so <code>0</code> will become <code>-1</code>, <code>-1</code> will become <code>-2</code>, and so on – if needed, you can use <code>...|[[#purging|purging]]|0|1|...</code> in the callback template to renormalize these numbers).
 
All unnamed arguments that follow the ''template name'' in the invocation of this module will appear as sequential parameters in each call. Named arguments will be passed verbatim. Both named and unnamed arguments passed to this function will be given precedence in case of collisions. Numeric argument names below <code>1</code> will be decreased by one unit (i.e. <code>...|call_for_each_group&#124;example template&#124;0=Hello world&#124;...</code> will become {{para|-1|Hello world}} in the callback template – see above).
 
A header (<code>h</code>), an iteration delimiter (<code>i</code>), a last iteration delimiter (<code>l</code>), a footer (<code>f</code>), and a fallback text (<code>n</code>) can be declared via the <code>[[#setting|setting]]</code> modifier – the string assigned to the key-value pair delimiter (<code>p</code>) will be ignored.
 
If you are a module writer, you might recognize some distant similarities between this function and <code>[[Module:TableTools#affixNums|TableTools.affixNums]]</code>.
 
For example, if a template named <syntaxhighlight lang="wikitext" inline>{{foobar}}</syntaxhighlight> contained the following code,
 
<syntaxhighlight lang="wikitext">{{#invoke:params|reassorted|call_for_each_group|example template|hello|world|foo=bar}}</syntaxhighlight>
 
writing
 
<syntaxhighlight lang="wikitext">{{foobar
| 1 = Lorem
| 2 = ipsum
| bicycle-1 = dolor
| bicycle1 = sit
| boat1 = amet
| car2 = consectetur
| bicycle2 = adipiscing
| other = elit
| sunscreen = vestibulum
| = ultricies
| foo1 = neque nisl
}}</syntaxhighlight>
 
will be equivalent to writing
 
<syntaxhighlight lang="wikitext">{{example template
| 0 =
| 1 = hello
| 2 = world
| = ultricies
| foo = bar
| other = elit
| sunscreen = vestibulum
}}{{example template
| 0 = -1
| 1 = hello
| 2 = world
| bicycle = dolor
| foo = bar
}}{{example template
| 0 = 1
| 1 = hello
| 2 = world
| = Lorem
| bicycle = sit
| boat = amet
| foo = bar
}}{{example template
| 0 = 2
| 1 = hello
| 2 = world
| = ipsum
| bicycle = adipiscing
| car = consectetur
| foo = bar
}}</syntaxhighlight>
 
'''The modifiers <code>[[#sequential|sequential]]</code>, <code>[[#non-sequential|non-sequential]]</code>, <code>[[#all_sorted|all_sorted]]</code> and <code>[[#reassorted|reassorted]]</code> will affect what groups of parameters will be iterated, not what parameters will be grouped.''' Before calling this function you will likely want to reduce the list of parameters via one of the <code>with_*_matching</code> group of modifiers (for instance <code>...|with_name_matching|.%-%d+$|or|[^%-]%d+$|call_for_each_group|...</code> leaves only the parameters in which both the prefix and the numeric suffix are not empty strings). The <code>[[#reassorted|reassorted]]</code> modifier often accompanies this function.
 
{{vpad|clear=none}}
 
{{Warnsign}} In writing templates, there is often the habit of signaling [[:mw:Help:Substitution#Multilevel substitution|multilevel substitutions]] using the <syntaxhighlight lang="wikitext" inline>{{{|safesubst:}}}</syntaxhighlight> notation. This is a dangerous practice, because <syntaxhighlight lang="wikitext" inline>{{{|safesubst:}}}</syntaxhighlight> means “write the parameter with an empty name, otherwise write <code>safesubst:</code>”. Due to the fact that <code>call_for_each_group</code> '''can pass parameters with an empty name''', a callback template should never use <syntaxhighlight lang="wikitext" inline>{{{|safesubst:}}}</syntaxhighlight> to notate multilevel substitutions, but should use instead <syntaxhighlight lang="wikitext" inline>safesubst:<noinclude /></syntaxhighlight>. Not following this advice can lead to bugs that are hard to debug.
 
{{vpad|clear=none}}
 
At &#123;&#123;{{rel|Module:Params/doc/examples/list of authors}}&#125;&#125; you can find an example of how to use this function to list authors the same way {{tl|Cite book}} does. For instance, writing
 
<syntaxhighlight lang="wikitext">{{module:params/doc/examples/list of authors
| last1 = Playfair
| first1 = I. S. O.
| author-link1 = Ian Stanley Ord Playfair
| last2 = Stitt
| first2 = G. M. S.
| last3 = Molony
| first3 = C. J. C.
| last4 = Toomer
| first4 = S. E.
}}</syntaxhighlight>
 
will generate
 
{{module:params/doc/examples/list of authors
| last1 = Playfair
| first1 = I. S. O.
| author-link1 = Ian Stanley Ord Playfair
| last2 = Stitt
| first2 = G. M. S.
| last3 = Molony
| first3 = C. J. C.
| last4 = Toomer
| first4 = S. E.
}}
 
See also &#123;&#123;{{rel|Module:Params/doc/examples/tablebox}}&#125;&#125; for an example of how to exploit this function to create [[Template:Infobox|infoboxes]], and &#123;&#123;{{rel|Module:Params/doc/examples/four cells per row table}}&#125;&#125; for an example of how to exploit this function to create n-column tables.
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this function except the ''template name'' will not be trimmed of their leading and trailing spaces. The <code>call_for_each_group</code> ''function name'' itself, however, will be trimmed of its surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>for_each</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Function <code>for_each</code> <span style="nowrap">({{module:params/doc/link to the code|for_each|code}})</span>
| label1 = Num. of arguments | data1 = 1
| label2 = [[#all_sorted|Sortable]] | data2 = Yes
| label3 = Relevant [[#setting|function-only variables]] | data3 = <code>h</code>, <code>i</code>, <code>l</code>, <code>f</code>, <code>n</code>
| header4 = See also
| data5 = <code>[[#list|list]]</code>, <code>[[#list_values|list_values]]</code>, {{mlx|for nowiki|}}, {{tl2|for nowiki}}, {{tl2|expand wikitext}}
}}
 
; Brief
: ''For each parameter passed to the callercurrent template, expandsexpand all occurrences of <code>$#</code> and <code>$@</code> within a given text, as key and value respectively''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|for_each|wikitext|[header]|[footer]}}</syntaxhighlight>
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|for_each|Arg name: $#, Arg value: $@}}</syntaxhighlight>
 
The text returned by this function is not expanded further (currently this module does not offer an <code>expand_for_each</code> function). If you need wikitext expansion, use either <code>[[#concat_and_call|concat_and_call]]</code> to propagate the incoming parameters altogether to the {{tl|for nowiki}} template, or <code>[[#mapping_by_calling|mapping_by_calling]]</code> to propagate the incoming parameters one by one to {{tl|expand wikitext}}.
 
Example #1 (wikitext expanded via the {{tl|for nowiki}} template – suggested):
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|concat_and_call|for nowiki|<br />|<nowiki>Parameter value is “{{{1}}}”</nowiki>}}</syntaxhighlight>
 
Example #2 (wikitext expanded via the {{tl|expand wikitext}} template – less efficient but more flexible):
 
<syntaxhighlight lang="wikitext">{{#invoke:params|setting|i|<br />|mapping_by_calling|expand wikitext|names_and_values_as|2|3|
let|1|<nowiki>Parameter name is “{{{2}}}”, parameter value is “{{{3}}}”</nowiki>|
let|unstrip|yes|
list_values}}</syntaxhighlight>
 
{{vpad|clear=none}}
 
{{A note}} The argument passed to this function will not be trimmed of its leading and trailing spaces. The <code>for_each</code> ''function name'' itself, however, will be trimmed of its surrounding spaces.
 
{{vpad|clear=none}}
 
== Modifiers (piping functions) ==
The following are ''modifiers'', i.e. functions that expect to be piped instead of returning to the caller. Each of them can be followed by either another modifier or a non-piping function. The actions that modifiers do are done sequentially, in the same order chosen during the invocation of this module. Some modifiers, however, after signaling their presence to the modifiers that might follow, add their action to the queue of actions that will be done last (e.g. <code>[[#sequential|sequential]]</code>, <code>[[#non-sequential|non-sequential]]</code>, <code>[[#all_sorted|all_sorted]]</code>, <code>[[#reassorted|reassorted]]</code>).
 
{{vpad|clear=none}}
 
=== <code>sequential</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>sequential</code> <span style="nowrap">({{module:params/doc/link to the code|sequential|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = No
| label3 = Conflicts with | data3 = <code>[[#non-sequential|non-sequential]]</code>, <code>[[#all_sorted|all_sorted]]</code>, <code>[[#reassorted|reassorted]]</code>
| header4 = See also
| data5 = <code>[[#non-sequential|non-sequential]]</code>, <code>[[#all_sorted|all_sorted]]</code>, <code>[[#reassorted|reassorted]]</code>, <code>[[#squeezing|squeezing]]</code>, <code>[[#filling_the_gaps|filling_the_gaps]]</code>, <code>[[#clearing|clearing]]</code>
}}
 
; Brief
: Reduces''(IN FUNCTIONS ONLY, DOES NOT AFFECT MODIFIERS) Reduce the parameter list to the subgroup of consecutive parameters that follow {{paratjp|1:}}''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|sequential|pipe function name}}</syntaxhighlight>
Line 157 ⟶ 804:
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|count}}</syntaxhighlight>
 
This functionmodifier does not take arguments besides the name of the function that mustwill follow.
 
Using <code>sequential</code> together with <code>[[#non-sequential|non-sequential]]</code> will generate an error.
 
{{vpad|clear=none}}
 
{{A note}} Like <code>[[#non-sequential|non-sequential]]</code>, the <code>sequential</code> modifier permanently marks a query. For instance, writing <syntaxhighlight lang="wikitext" inline>{{#invoke:params|sequential|with_name_not_matching|1|...}}</syntaxhighlight> will first mark the query as “sequential”, then will discard the first element from the sequence (leaving all the others intact). And so, no matter how many other parameters will be present, nothing will be shown.
 
{{vpad|1.5em|clear=none}}
 
=== <code>non-sequential</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>non-sequential</code> <span style="nowrap">({{module:params/doc/link to the code|non-sequential|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = No
| label3 = Conflicts with | data3 = <code>[[#sequential|sequential]]</code>
| header4 = See also
| data5 = <code>[[#sequential|sequential]]</code>, <code>[[#all_sorted|all_sorted]]</code>, <code>[[#reassorted|reassorted]]</code>
}}
 
; Brief
: Reduces''(IN FUNCTIONS ONLY, DOES NOT AFFECT MODIFIERS) Reduce the parameter list by subtractingdiscarding the subgroup of consecutive parameters that follow {{paratjp|1:}}''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|non-sequential|pipe function name}}</syntaxhighlight>
Line 167 ⟶ 832:
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|non-sequential|listsetting|ih/p|{{!}}|{{=}}|<nowiki>{{</nowiki>foobar{{!}}|<nowiki>}}</nowiki>list}}</syntaxhighlight>
 
This functionmodifier does not take arguments besides the name of the function that mustwill follow.
 
Using <code>non-sequential</code> together with <code>[[#sequential|sequential]]</code> will generate an error.
 
{{vpad|clear=none}}
 
{{A note}} Like <code>[[#sequential|sequential]]</code>, the <code>non-sequential</code> modifier permanently marks a query, and no matter what transformations will follow (see <code>[[#squeezing|squeezing]]</code>) the parameters' “sequence” will not be shown.
 
{{vpad|1.5em|clear=none}}
 
=== <code>all_sorted</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>all_sorted</code> <span style="nowrap">({{module:params/doc/link to the code|all_sorted|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = No
| label3 = Conflicts with | data3 = <code>[[#sequential|sequential]]</code>, <code>[[#reassorted|reassorted]]</code>
| label4 = Has no effects on | data4 = <code>[[#count|count]]</code>, <code>[[#value_of|value_of]]</code>, <code>[[#concat_and_call|concat_and_call]]</code>, <code>[[#concat_and_invoke|concat_and_invoke]]</code>, <code>[[#concat_and_magic|concat_and_magic]]</code>
| header5 = See also
| data6 = [[Natural sort order]], <code>[[#reassorted|reassorted]]</code>, <code>[[#sequential|sequential]]</code>, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
=== <code>with_name_matching</code> ===
; Brief
: ''(IN FUNCTIONS ONLY, DOES NOT AFFECT MODIFIERS) When the time will come, all parameters will be dispatched sorted: first the numeric ones in ascending order, then the rest in [[natural sort order|natural order]]''
: Removes from the parameter list all the parameters whose name ''does not match'' the given pattern
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|with_name_matching|patternall_sorted|pipe function name}}</syntaxhighlight>
 
{{A note}} This modifier sorts the way ''functions'' iterate across ''all'' parameters based on ''their names''. If you want to sort ''sequential parameters'' based on ''their values'', see <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>.
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|with_name_matchingall_sorted|n$setting|list|<ih/dd><dt>p|</dt><dd>{{!}}|<dl><dt>{{=}}|</dd></dl>list}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
Normally only sequential parameters are dispatched sorted, whereas non-sequential ones are dispatched randomly. The <code>all_sorted</code> modifier ensures that nothing is left out of ([[natural sort order|natural]]) order. Attention must be paid to the fact that parameters whose name is a negative number will appear first. To avoid this the <code>[[#squeezing|squeezing]]</code> modifier can be used.<ref>To be precise, the order will not be strictly alphabetical, because this would imply that a template called with the following parameters <syntaxhighlight lang="wikitext" inline>{{foobar|-4=you|9=wanna|.=me?|11=marry|-8=do}}</syntaxhighlight> would see them reordered as follows: <syntaxhighlight lang="wikitext" inline>{{foobar|-8=do|-4=you|.=me?|9=wanna|11=marry}}</syntaxhighlight> (with the dot in the middle between negative and positive numbers). To avoid this, '''numbers are always displayed first''' (i.e. <syntaxhighlight lang="wikitext" inline>{{foobar|-8=do|-4=you|9=wanna|11=marry|.=me?}}</syntaxhighlight>).</ref>
 
The <code>all_sorted</code> modifier only affects the way parameters are shown, but has no effects on functions that do not iterate or cannot impose an order, such as:
 
* <code>[[#count|count]]</code>
* <code>[[#value_of|value_of]]</code>
* <code>[[#concat_and_call|concat_and_call]]</code>
* <code>[[#concat_and_invoke|concat_and_invoke]]</code>
* <code>[[#concat_and_magic|concat_and_magic]]</code>
 
{{vpad|clear=none}}
 
{{A note}} The <code>all_sorted</code> modifier cannot be used with functions that propagate several parameters together in a single call, like <code>[[#concat_and_call|concat_and_call]]</code>, <code>[[#concat_and_invoke|concat_and_invoke]]</code>, and <code>[[#concat_and_magic|concat_and_magic]]</code>, because during a call the order of arguments is always lost. For the same reason, it is not possible to guess the order of named parameters a template was transcluded with.
 
{{vpad|1.5em|clear=none}}
 
=== <code>reassorted</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>reassorted</code> <span style="nowrap">({{module:params/doc/link to the code|reassorted|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = No
| label3 = Conflicts with | data3 = <code>[[#sequential|sequential]]</code>, <code>[[#all_sorted|all_sorted]]</code>
| label4 = Has no effects on | data4 = <code>[[#count|count]]</code>, <code>[[#value_of|value_of]]</code>, <code>[[#concat_and_call|concat_and_call]]</code>, <code>[[#concat_and_invoke|concat_and_invoke]]</code>, <code>[[#concat_and_magic|concat_and_magic]]</code>
| header5 = See also
| data6 = [[Natural sort order]], <code>[[#all_sorted|all_sorted]]</code>, <code>[[#sequential|sequential]]</code>, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
=== <code>with_name_not_matching</code> ===
; Brief
: ''(IN FUNCTIONS ONLY, DOES NOT AFFECT MODIFIERS) When the time will come, all parameters will be dispatched sorted: first non numeric ones in [[natural sort order|natural order]]'', then the numeric ones in ascending order
: Removes from the parameter list all the parameters whose name ''matches'' the given pattern
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|with_name_not_matching|patternreassorted|pipe function name}}</syntaxhighlight>
 
This modifier is identical to <code>[[#all_sorted|all_sorted]]</code>, but numbers are iterated last (as in “bar, foo, hello, zebra, 1, 2, 3, …”).
 
{{vpad|clear=none}}
 
{{A note}} The <code>reassorted</code> modifier cannot be used with functions that propagate several parameters together in a single call, like <code>[[#concat_and_call|concat_and_call]]</code>, <code>[[#concat_and_invoke|concat_and_invoke]]</code>, and <code>[[#concat_and_magic|concat_and_magic]]</code>, because during a call the order of arguments is always lost. For the same reason, it is not possible to guess the order of named parameters a template was transcluded with.
 
{{vpad|1.5em|clear=none}}
 
=== <code>setting</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>setting</code> <span style="nowrap">({{module:params/doc/link to the code|setting|code}})</span>
| label1 = Num. of arguments | data1 = 2–7 (variable)
| label2 = Repeatable | data2 = Yes
| header3 = Memory slots
| data4 = {{aligned table|fullwidth=y
| col1header=y | col1style=display:block;
| <code>p</code>| Key-value delimiter
| <code>i</code>| Iteration delimiter
| <code>l</code>| Last iteration delimiter
| <code>h</code>| Header text
| <code>f</code>| Footer text
| <code>n</code>| Fallback text
}}
}}
 
; Brief
: ''Define glue strings''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|directives|...|pipe function name}}</syntaxhighlight>
 
This modifier allows some internal variables to be set and later be used by functions. It takes a variable number of arguments, relying on the first argument to understand how many other arguments to read. A few examples will introduce it better than words:
 
* <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|i|{{!}}|list_values}}</syntaxhighlight>
*: ↳ Set the value of ''iteration delimiter'' to <code>|</code>, then list all values
* <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|ih|{{!}}|list_values}}</syntaxhighlight>
*: ↳ Set the value of both ''header text'' and ''iteration delimiter'' to <code>|</code>, then list all values
* <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|ih/p|{{!}}|{{=}}|list}}</syntaxhighlight>
*: ↳ Set the value of both ''header text'' and ''iteration delimiter'' to <code>|</code>, set ''key-value pair delimiter'' to <code>=</code>, then list all parameters
* <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|ih/p/n|{{!}}|{{=}}|No parameters were passed|list}}</syntaxhighlight>
*: ↳ Set the value of both ''header text'' and ''iteration delimiter'' to <code>|</code>, set ''key-value pair delimiter'' to <code>=</code>, set ''fallback text'' to <code>No parameters were passed</code>, then list all parameters
 
The first argument is a slash-separated list of lists of slots to assign; one slot is referred by exactly one character and each list of slots maps exactly one argument. A slot indicates which internal variable to set. If more than one slot is aggregated within the same slash-separated list the same text will be assigned to more than one variable.
 
The slots available are the following:
 
{| class="wikitable" style="margin-left: auto; margin-right: auto;"
|-
! Slots
! Variable
! Description
|-
| <code>p</code>
| ''Key-value pair delimiter''
| The string of text that will be placed between each parameter name and its value; it is never inserted by functions that only iterate between values, or by functions that pass the key-value pairs to external calls.
|-
| <code>i</code>
| ''Iteration delimiter''
| The string of text that will be placed between each iteration; it is never inserted unless there are two or more parameters to show when <code>l</code> is not given, or three or more parameters when <code>l</code> is given.
|-
| <code>l</code>
| ''Last iteration delimiter''
| The string of text that will be placed between the second last and the last iteration; it is never inserted unless there are two or more parameters to show; if omitted defaults to <code>i</code>.
|-
| <code>h</code>
| ''Header text''
| The string of text that will be placed before the iteration begins; it is never inserted if there are no parameters to show.
|-
| <code>f</code>
| ''Footer text''
| The string of text that will be placed after the iteration is over; it is never inserted if there are no parameters to show.
|-
| <code>n</code>
| ''Fallback text''
| The string of text that will be placed if there are no parameters to show.
|}
 
All space characters in the directives arguments are discarded. Therefore writing <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|ih/p|...}}</syntaxhighlight> will be equivalent to writing
 
<syntaxhighlight lang="wikitext">{{#invoke:params|setting| i
h / p |...}}</syntaxhighlight>
 
In theory, instead of assigning different slots at once (i.e. <syntaxhighlight lang="wikitext" inline>{{...|setting|ih/p|{{!}}|{{=}}|...}}</syntaxhighlight>), it is possible to write separate invocations of <code>setting</code> for each variable, as in <syntaxhighlight lang="wikitext" inline>{{...|setting|ih|{{!}}|setting|p|{{=}}...}}</syntaxhighlight>. This method however will be slightly less efficient.
 
Sometimes it might be necessary to make the values assigned depend on conditional expressions. For instance, the following imaginary <syntaxhighlight lang="wikitext" inline>{{Foobar see also}}</syntaxhighlight> template uses the <code>[[:mw:Help:Extension:ParserFunctions##ifexpr|#ifexpr]]</code> parser function to properly show the “and” conjunction and possibly an [[Serial comma|Oxford comma]] when more than two page names are provided:
 
<syntaxhighlight lang="wikitext">{{Hatnote|{{{altphrase|Foobar see also}}}: {{#if:{{{1|}}}
|{{#invoke:params|sequential|squeezing|setting|i/l|, |{{#ifexpr:{{#invoke:params|sequential|squeezing|count}} > 2|,}} and |trimming_values|for_each|[[$@]]}}
|{{Error|{{tl|Foobar see also}} requires at least one page name}}
}}}}</syntaxhighlight>
 
You can find this example at &#123;&#123;{{rel|Module:Params/doc/examples/Oxford comma}}&#125;&#125;. For instance, <syntaxhighlight lang="wikitext" inline>{{module:params/doc/examples/Oxford comma|Latin|English|German|Italian}}</syntaxhighlight> will generate
 
{{module:params/doc/examples/Oxford comma|Latin|English|German|Italian}}
 
{{vpad|clear=none}}
 
{{A note}} The <code>setting</code> modifier will be trimmed of its surrounding spaces. The directives argument will be stripped of all space characters, including internal spaces. All the other arguments passed to this modifier will be parsed verbatim (i.e. leading and trailing spaces will not be removed).
 
{{vpad|1.5em|clear=none}}
 
=== <code>squeezing</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>squeezing</code> <span style="nowrap">({{module:params/doc/link to the code|squeezing|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#filling_the_gaps|filling_the_gaps]]</code>, <code>[[#sequential|sequential]]</code>, <code>[[#clearing|clearing]]</code>, <code>[[Module:TableTools#compressSparseArray|TableTools.compressSparseArray]]</code>
}}
 
; Brief
: ''Rearrange all parameters that have numeric names to form a compact sequence starting from 1, keeping the same order''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|squeezing|pipe function name}}</syntaxhighlight>
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|with_name_not_matchingsqueezing|n$sequential|countsetting|i/p|<br />|: |list}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow. If you are a module writer, you might recognize some similarities between this function and <code>[[Module:TableTools#compressSparseArray|TableTools.compressSparseArray]]</code>.
 
The following three concatenations will lead to the same result of discarding all parameters with numeric names:
 
# <syntaxhighlight lang="wikitext" inline>{{...|excluding_numeric_names|...}}</syntaxhighlight>
# <syntaxhighlight lang="wikitext" inline>{{...|with_name_not_matching|^%-?%d+$|...}}</syntaxhighlight>
# <syntaxhighlight lang="wikitext" inline>{{...|non-sequential|squeezing|...}}</syntaxhighlight>
# <syntaxhighlight lang="wikitext" inline>{{...|squeezing|non-sequential|...}}</syntaxhighlight>
 
The first solution is the most optimized one. Furthermore, in the last two solutions the numeric parameters are discarded just before the final function is invoked (sometimes this might be a wanted result).
 
{{vpad|1.5em|clear=none}}
 
=== <code>filling_the_gaps</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>filling_the_gaps</code> <span style="nowrap">({{module:params/doc/link to the code|filling_the_gaps|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#squeezing|squeezing]]</code>, <code>[[#sequential|sequential]]</code>, <code>[[#clearing|clearing]]</code>
}}
 
; Brief
: ''Assign an empty string to all undefined numeric parameters between 1 or a lower numeric parameter name provided and the maximum numeric parameter provided''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|filling_the_gaps|pipe function name}}</syntaxhighlight>
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|filling_the_gaps|sequential|setting|i/p|<br />|: |list}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
Note that when all numeric parameters are lower than 1, the gap between 1 and the maximum numeric parameter will not be filled. The following table provides some examples.
 
{| class="wikitable" style="margin-left: auto; margin-right: auto;"
|+ Numeric parameters provided
|-
! Before calling <code>filling_the_gaps</code>
! After calling <code>filling_the_gaps</code>
|-
| 1
| 1
|-
| 2
| 1, 2
|-
| 6, 9
| 1, 2, 3, 4, 5, 6, 7, 8, 9
|-
| -5, -3
| -5, -4, -3
|-
| -5, -3, 1
| -5, -4, -3, -2, -1, 0, 1
|-
| -1
| -1
|-
| -2
| -2
|}
 
{{A note}} There is a safety limit of at most 1024 undefined parameters that can be filled using this modifier.
 
{{vpad|1.5em|clear=none}}
 
=== <code>clearing</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>clearing</code> <span style="nowrap">({{module:params/doc/link to the code|clearing|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| label3 = Often accompanied by | data3 = <code>[[#sequential|sequential]]</code>
| header4 = See also
| data5 = <code>[[#sequential|sequential]]</code>, <code>[[#squeezing|squeezing]]</code>, <code>[[#filling_the_gaps|filling_the_gaps]]</code>
}}
 
; Brief
: ''Remove all numeric parameters that are not in the sequence''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|clearing|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
Unlike <code>[[#sequential|sequential]]</code> – which affects only the way parameters are shown – this modifier actually removes all non-sequential numeric parameters, albeit leaves non-numeric parameters intact.
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|clearing|setting|i/p|<br />|: |list}}</syntaxhighlight>
 
If you want to remove also non-numeric parameters, add the <code>[[#excluding_non-numeric_names|excluding_non-numeric_names]]</code> modifier:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|clearing|excluding_non-numeric_names|setting|i/p|<br />|: |list}}</syntaxhighlight>
 
If you want instead to remove sequential parameters and leave the rest, use <syntaxhighlight lang="wikitext" inline>{{...|cutting|-1|1|...}}</syntaxhighlight>:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|cutting|-1|1|setting|i/p|<br />|: |list}}</syntaxhighlight>
 
{{vpad|1.5em|clear=none}}
 
=== <code>cutting</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>cutting</code> <span style="nowrap">({{module:params/doc/link to the code|cutting|code}})</span>
| label1 = Num. of arguments | data1 = 2
| label2 = Repeatable | data2 = Yes
| label3 = Often accompanied by | data3 = <code>[[#sequential|sequential]]</code>
| header4 = See also
| data5 = <code>[[#sequential|sequential]]</code>, <code>[[#squeezing|squeezing]]</code>, <code>[[#filling_the_gaps|filling_the_gaps]]</code>, <code>[[#clearing|clearing]]</code>, <code>[[#cropping|cropping]]</code>, <code>[[#purging|purging]]</code>, <code>[[#backpurging|backpurging]]</code>, <code>[[#reversing_numeric_names|reversing_numeric_names]]</code><!--, <code>[[#mirroring_numeric_names|mirroring_numeric_names]]</code>, <code>[[#pivoting_numeric_names|pivoting_numeric_names]]</code>, <code>[[#swapping_numeric_names|swapping_numeric_names]]</code>-->, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
; Brief
: ''Remove zero or more parameters from the beginning and the end of the '''parameters' sequence'''''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|cutting|left trim|right trim|pipe function name}}</syntaxhighlight>
 
The first argument indicates how many sequential parameters must be removed from the beginning of the parameter sequence, the second argument indicates how many sequential parameters must be removed from the end of the parameter list. If any of the two arguments contains a negative number its absolute value indicates what must be left ''on the opposite side'' – i.e. <syntaxhighlight lang="wikitext" inline>{{#invoke:params|cutting|-3|0|list}}</syntaxhighlight> indicates that the last three arguments must not be discarded.
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|cutting|0|2|sequential|call_for_each_value|example template}}</syntaxhighlight>
 
If the absolute value of the sum of the two arguments (left and right cut) is greater than the number of ''sequential'' parameters available, the behavior will be the same as if the sum had been equal to the number of sequential parameters available, both when this is a positive value and when it is a negative value (with opposite results). After the desired sequential parameters have been discarded, '''all''' other positive numeric parameters will be shifted accordingly.
 
In some cases it might be necessary to concatenate more than one invocation of the <code>cutting</code> modifier. For instance, the following code prints the last unnamed parameter passed, but only if at least two parameters were passed:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|cutting|1|0|cutting|-1|0|list_values}}</syntaxhighlight>
 
{{A note|Suggestion:}} Although <syntaxhighlight lang="wikitext" inline>{{#invoke:params|cutting|-1|1|...}}</syntaxhighlight> de facto gets rid of all sequential parameters, in most cases it is clearer and more idiomatic to write <syntaxhighlight lang="wikitext" inline>{{#invoke:params|non-sequential|...}}</syntaxhighlight> to obtain the same effect. The last method however cannot be used when it is important that sequential parameters are removed before a particular modifier is called, because <code>[[#non-sequential|non-sequential]]</code> does not take effect until the final function is invoked. Writing instead <syntaxhighlight lang="wikitext" inline>{{#invoke:params|sequential|cutting|-1|1|...}}</syntaxhighlight> will leave zero arguments to show.
 
{{vpad|1.5em|clear=none}}
 
=== <code>cropping</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>cropping</code> <span style="nowrap">({{module:params/doc/link to the code|cropping|code}})</span>
| label1 = Num. of arguments | data1 = 2
| label2 = Repeatable | data2 = Yes
| label3 = Often accompanied by | data3 = <code>[[#sequential|sequential]]</code>
| header4 = See also
| data5 = <code>[[#sequential|sequential]]</code>, <code>[[#squeezing|squeezing]]</code>, <code>[[#filling_the_gaps|filling_the_gaps]]</code>, <code>[[#clearing|clearing]]</code>, <code>[[#cutting|cutting]]</code>, <code>[[#purging|purging]]</code>, <code>[[#backpurging|backpurging]]</code>, <code>[[#reversing_numeric_names|reversing_numeric_names]]</code><!--, <code>[[#mirroring_numeric_names|mirroring_numeric_names]]</code>, <code>[[#pivoting_numeric_names|pivoting_numeric_names]]</code>, <code>[[#swapping_numeric_names|swapping_numeric_names]]</code>-->, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
; Brief
: ''Remove zero or more parameters from the beginning and the end of the '''list of numeric parameters''' (not only the sequential ones)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|cropping|left crop|right crop|pipe function name}}</syntaxhighlight>
 
This modifier is very similar to <code>[[#cutting|cutting]]</code>, but instead of removing arguments from the extremities of the parameters' ''sequence'', arguments will be removed counting from the first and the last numeric arguments given (i.e. {{para|-1000|...}} and {{para|1000|...}} in the case of <syntaxhighlight lang="wikitext" inline>{{foobar|-1000=hello|1=my|1000=darling}}</syntaxhighlight>). If any of the two arguments contains a negative number its absolute value indicates what must be left ''on the opposite side''.
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|cropping|2|1|sequential|call_for_each_value|example template}}</syntaxhighlight>
 
For instance, when a template transcluded as <syntaxhighlight lang="wikitext" inline>{{example template|-2=minus two|0=zero|1=one|2=two|3=three|19=nineteen|20=twenty}}</syntaxhighlight> uses the <code>[[#cutting|cutting]]</code> modifier with <code>2</code> and <code>1</code> as arguments, as in the example above, the following parameters will be left:
 
: -2: minus two
: 0: zero
: 16: nineteen
: 17: twenty]
 
If instead the template uses the <code>[[#cutting|cropping]]</code> modifier with <code>2</code> and <code>1</code> as arguments, the following parameters will be left:
: 0: zero
: 1: one
: 2: two
: 3: three
: 19: nineteen
 
If the absolute value of the sum of the two arguments (left and right crop) is greater than the difference between the largest and the lowest ''numeric'' parameters available, the behavior will be the same as if the sum had been equal to the number of numeric parameters available, both when this is a positive value and when it is a negative value (with opposite results). When ''sequential'' parameters are present among the discarded parameters, all the remaining numeric parameters greater than zero will be shifted accordingly.
 
{{vpad|1.5em|clear=none}}
 
=== <code>purging</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>purging</code> <span style="nowrap">({{module:params/doc/link to the code|purging|code}})</span>
| label1 = Num. of arguments | data1 = 2
| label2 = Repeatable | data2 = Yes
| label3 = Often accompanied by | data3 = <code>[[#sequential|sequential]]</code>
| header4 = See also
| data5 = <code>[[#sequential|sequential]]</code>, <code>[[#squeezing|squeezing]]</code>, <code>[[#filling_the_gaps|filling_the_gaps]]</code>, <code>[[#clearing|clearing]]</code>, <code>[[#cutting|cutting]]</code>, <code>[[#cropping|cropping]]</code>, <code>[[#backpurging|backpurging]]</code>, <code>[[#reversing_numeric_names|reversing_numeric_names]]</code><!--, <code>[[#mirroring_numeric_names|mirroring_numeric_names]]</code>, <code>[[#pivoting_numeric_names|pivoting_numeric_names]]</code>, <code>[[#swapping_numeric_names|swapping_numeric_names]]</code>-->, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
; Brief
: ''Remove zero or more parameters from any point of the list of numeric parameters, shifting everything accordingly''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|purging|start offset|length|pipe function name}}</syntaxhighlight>
 
The first argument indicates at which point in the parameter list the removal must begin, the second argument indicates how many parameters must be discarded among it and what lies ''on the right side''. If the second argument contains zero or a negative number its absolute value indicates what must be left ''at the end of the right side'' of the list of numeric parameters – i.e. <syntaxhighlight lang="wikitext" inline>{{#invoke:params|purging|5|0|list}}</syntaxhighlight> indicates that every numeric argument whose numeric name is greater than <code>4</code> must be removed.
 
Example #1 (purge the first parameter):
 
<syntaxhighlight lang="wikitext">{{#invoke:params|purging|1|1|call_for_each_value|example template}}</syntaxhighlight>
 
Example #2 (purge the second, third, and four parameters):
 
<syntaxhighlight lang="wikitext">{{#invoke:params|purging|2|3|call_for_each_value|example template}}</syntaxhighlight>
 
{{vpad|1.5em|clear=none}}
 
=== <code>backpurging</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>backpurging</code> <span style="nowrap">({{module:params/doc/link to the code|backpurging|code}})</span>
| label1 = Num. of arguments | data1 = 2
| label2 = Repeatable | data2 = Yes
| label3 = Often accompanied by | data3 = <code>[[#sequential|sequential]]</code>
| header4 = See also
| data5 = <code>[[#sequential|sequential]]</code>, <code>[[#squeezing|squeezing]]</code>, <code>[[#filling_the_gaps|filling_the_gaps]]</code>, <code>[[#clearing|clearing]]</code>, <code>[[#cutting|cutting]]</code>, <code>[[#cropping|cropping]]</code>, <code>[[#purging|purging]]</code>, <code>[[#reversing_numeric_names|reversing_numeric_names]]</code><!--, <code>[[#mirroring_numeric_names|mirroring_numeric_names]]</code>, <code>[[#pivoting_numeric_names|pivoting_numeric_names]]</code>, <code>[[#swapping_numeric_names|swapping_numeric_names]]</code>-->, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
; Brief
: ''Remove zero or more parameters from any point of the list of numeric parameters, moving backwards and shifting everything accordingly''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|backpurging|start offset|length|pipe function name}}</syntaxhighlight>
 
The first argument indicates at which point in the parameter list the removal must begin, the second argument indicates how many parameters must be discarded among it and what lies ''on the left side''. If the second argument contains zero or a negative number its absolute value indicates what must be left ''at the end of the left side'' of the list of numeric parameters – i.e. <syntaxhighlight lang="wikitext" inline>{{#invoke:params|purging|5|0|list}}</syntaxhighlight> indicates that every numeric argument whose numeric name is less than <code>6</code> must be removed.
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|backpurging|3|1|call_for_each_value|example template}}</syntaxhighlight>
 
The following code removes all parameters with negative and zero numeric names, then lists the rest:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|backpurging|0|0|for_each|[$#: $@]}}</syntaxhighlight>
 
{{vpad|1.5em|clear=none}}
 
=== <code>reversing_numeric_names</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>reversing_numeric_names</code> <span style="nowrap">({{module:params/doc/link to the code|reversing_numeric_names|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| label3 = Often accompanied by | data3 = <code>[[#sequential|sequential]]</code>
| header4 = See also
| data5 = <code>[[#sequential|sequential]]</code>, <code>[[#squeezing|squeezing]]</code>, <code>[[#filling_the_gaps|filling_the_gaps]]</code>, <code>[[#clearing|clearing]]</code>, <code>[[#cutting|cutting]]</code>, <code>[[#cropping|cropping]]</code>, <code>[[#purging|purging]]</code>, <code>[[#backpurging|backpurging]]</code><!--, <code>[[#mirroring_numeric_names|mirroring_numeric_names]]</code>, <code>[[#pivoting_numeric_names|pivoting_numeric_names]]</code>, <code>[[#swapping_numeric_names|swapping_numeric_names]]</code>-->, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
; Brief
: ''Reverse the order of all numeric parameters (not only sequential ones), making sure that the largest numeric parameter and {{para|1}} are swapped''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|reversing_numeric_names|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|reversing_numeric_names|for_each|[$#: $@]}}</syntaxhighlight>
 
{{A note}} If negative parameters are present this function becomes non-invertible. This means that <syntaxhighlight lang="wikitext" inline>{{#invoke:params|reversing_numeric_names|reversing_numeric_names|...}}</syntaxhighlight> will not restore the original parameter names, but will shift all numeric parameters so that what formerly was the smallest parameter name will now become {{para|1}}.
<!--
{{vpad|1.5em|clear=none}}
 
=== <code>mirroring_numeric_names</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>mirroring_numeric_names</code> <span style="nowrap">({{module:params/doc/link to the code|mirroring_numeric_names|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| label3 = Often accompanied by | data3 = <code>[[#sequential|sequential]]</code>
| header4 = See also
| data5 = <code>[[#sequential|sequential]]</code>, <code>[[#squeezing|squeezing]]</code>, <code>[[#filling_the_gaps|filling_the_gaps]]</code>, <code>[[#clearing|clearing]]</code>, <code>[[#cutting|cutting]]</code>, <code>[[#cropping|cropping]]</code>, <code>[[#purging|purging]]</code>, <code>[[#backpurging|backpurging]]</code>, <code>[[#reversing_numeric_names|reversing_numeric_names]]</code>, <code>[[#pivoting_numeric_names|pivoting_numeric_names]]</code>, <code>[[#swapping_numeric_names|swapping_numeric_names]]</code>, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
; Brief
: ''Reverse the order of all numeric parameters (not only sequential ones)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mirroring_numeric_names|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
This modifier reverses the order of numeric parameters, making sure that the minimum and the maximum numeric parameters remain always the same (albeit inverted).
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|mirroring_numeric_names|for_each|[$#: $@]}}</syntaxhighlight>
 
{{vpad|1.5em|clear=none}}
 
=== <code>pivoting_numeric_names</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>pivoting_numeric_names</code> <span style="nowrap">({{module:params/doc/link to the code|pivoting_numeric_names|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| label3 = Often accompanied by | data3 = <code>[[#sequential|sequential]]</code>
| header4 = See also
| data5 = <code>[[#sequential|sequential]]</code>, <code>[[#squeezing|squeezing]]</code>, <code>[[#filling_the_gaps|filling_the_gaps]]</code>, <code>[[#clearing|clearing]]</code>, <code>[[#cutting|cutting]]</code>, <code>[[#cropping|cropping]]</code>, <code>[[#purging|purging]]</code>, <code>[[#backpurging|backpurging]]</code>, <code>[[#reversing_numeric_names|reversing_numeric_names]]</code>, <code>[[#mirroring_numeric_names|mirroring_numeric_names]]</code>, <code>[[#swapping_numeric_names|swapping_numeric_names]]</code>, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
; Brief
: ''Reverse the order of all numeric parameters (not only sequential ones), '''keeping the parameters' sequence always centered'''''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|pivoting_numeric_names|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
This modifier reverses the order of numeric parameters, making sure that those in the parameters' sequence always remain in the sequence. As a consequence, the values of the minimum and the maximum numeric parameters may change. If no sequence is present this modifier is identical to <code>[[#mirroring_numeric_names|mirroring_numeric_names]]</code>.
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|pivoting_numeric_names|for_each|[$#: $@]}}</syntaxhighlight>
 
{{vpad|1.5em|clear=none}}
 
=== <code>swapping_numeric_names</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>swapping_numeric_names</code> <span style="nowrap">({{module:params/doc/link to the code|swapping_numeric_names|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| label3 = Often accompanied by | data3 = <code>[[#sequential|sequential]]</code>
| header4 = See also
| data5 = <code>[[#sequential|sequential]]</code>, <code>[[#squeezing|squeezing]]</code>, <code>[[#filling_the_gaps|filling_the_gaps]]</code>, <code>[[#clearing|clearing]]</code>, <code>[[#cutting|cutting]]</code>, <code>[[#cropping|cropping]]</code>, <code>[[#purging|purging]]</code>, <code>[[#backpurging|backpurging]]</code>, <code>[[#mirroring_numeric_names|mirroring_numeric_names]]</code>, <code>[[#pivoting_numeric_names|pivoting_numeric_names]]</code>, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
; Brief
: ''Swap the lowest numeric parameter with the highest, the second lowest with the second highest, and so on, keeping the sequence in the same place albeit in reverse order''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|swapping_numeric_names|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|swapping_numeric_names|for_each|[$#: $@]}}</syntaxhighlight>
-->
{{vpad|1.5em|clear=none}}
 
=== <code>sorting_sequential_values</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>sorting_sequential_values</code> <span style="nowrap">({{module:params/doc/link to the code|sorting_sequential_values|code}})</span>
| label1 = Num. of arguments | data1 = 0 or 1
| label2 = Repeatable | data2 = Yes
| label3 = Often accompanied by | data3 = <code>[[#sequential|sequential]]</code>
| header4 = See also
| data5 = <code>[[#sequential|sequential]]</code>, <code>[[#squeezing|squeezing]]</code>, <code>[[#filling_the_gaps|filling_the_gaps]]</code>, <code>[[#clearing|clearing]]</code>, <code>[[#cutting|cutting]]</code>, <code>[[#cropping|cropping]]</code>, <code>[[#purging|purging]]</code>, <code>[[#backpurging|backpurging]]</code>, <code>[[#reversing_numeric_names|reversing_numeric_names]]</code><!--, <code>[[#mirroring_numeric_names|mirroring_numeric_names]]</code>, <code>[[#pivoting_numeric_names|pivoting_numeric_names]]</code>, <code>[[#swapping_numeric_names|swapping_numeric_names]]</code>-->, <code>[[#all_sorted|all_sorted]]</code>, <code>[[#reassorted|reassorted]]</code>
}}
 
; Brief
: ''Sort the order of sequential values''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|sorting_sequential_values|[criterion]|pipe function name}}</syntaxhighlight>
 
{{A note}} This modifier sorts ''sequential parameters'' based on ''their values''. If you want to sort the way ''functions'' iterate across ''all'' parameters based on ''their names'', see <code>[[#all_sorted|all_sorted]]</code>.
 
This modifier optionally supports one argument to specify the sorting criterion. If this is omitted it is assumed that sequential values must be ordered alphabetically. Currently the only other possible criterion is <code>naturally</code>, for ordering sequential values in [[natural sort order]].
 
Example (alphabetical sort order):
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sorting_sequential_values|for_each|[$#: $@]}}</syntaxhighlight>
 
Example (natural sort order):
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sorting_sequential_values|naturally|for_each|[$#: $@]}}</syntaxhighlight>
<!--
{{vpad|1.5em|clear=none}}
 
=== <code>inserting</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>inserting</code> <span style="nowrap">({{module:params/doc/link to the code|inserting|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#imposing|imposing]]</code>, <code>[[#providing|providing]]</code>, <code>[[#sequential|sequential]]</code>, <code>[[#squeezing|squeezing]]</code>, <code>[[#filling_the_gaps|filling_the_gaps]]</code>, <code>[[#clearing|clearing]]</code>, <code>[[#cutting|cutting]]</code>, <code>[[#cropping|cropping]]</code>, <code>[[#purging|purging]]</code>, <code>[[#backpurging|backpurging]]</code>, <code>[[#reversing_numeric_names|reversing_numeric_names]]</code>, <code>[[#mirroring_numeric_names|mirroring_numeric_names]]</code>, <code>[[#pivoting_numeric_names|pivoting_numeric_names]]</code>, <code>[[#swapping_numeric_names|swapping_numeric_names]]</code>, <code>[[#discarding|discarding]]</code>, <code>[[#all_sorted|all_sorted]]</code>, <code>[[#reassorted|reassorted]]</code>, <code>[[#new|new]]</code>
}}
 
; Brief
: ''Add one or more numeric parameters to the list of parameters, shifting everything accordingly''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|inserting|position|how many|...|pipe function name}}</syntaxhighlight>
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|inserting|1|2|hello|world|for_each|[$#: $@]}}</syntaxhighlight>
 
Currently, appending parameters after the last numeric parameter requires some workaround. The following example will add three new parameters and list all parameters:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|
all_sorted|
entering_substack|
backpurging|0|0|
detaching_substack|
reversing_numeric_names|
inserting|1|3|added parameter 3|added parameter 2|added parameter 1|
reversing_numeric_names|
merging_substack|
for_each|[$#:$@]}}</syntaxhighlight>
 
Similarly, the following workaround will append three parameters at the end of the sequence:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|
all_sorted|
entering_substack|
clearing|
detaching_substack|
reversing_numeric_names|
inserting|1|3|added parameter 3|added parameter 2|added parameter 1|
reversing_numeric_names|
leaving_substack|
inserting|1|3||||
flushing|
for_each|[$#:$@]}}</syntaxhighlight>
 
{{vpad|clear=none}}
 
{{A note}} The values of the parameters inserted will not be trimmed of their leading and trailing spaces. The first two numeric arguments and the <code>inserting</code> modifier name itself, however, will be trimmed of their surrounding spaces.
-->
{{vpad|1.5em|clear=none}}
 
=== <code>imposing</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>imposing</code> <span style="nowrap">({{module:params/doc/link to the code|imposing|code}})</span>
| label1 = Num. of arguments | data1 = 2
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#providing|providing]]</code>, <code>[[#discarding|discarding]]</code><!--, <code>[[#inserting|inserting]]</code>-->, <code>[[#filling_the_gaps|filling_the_gaps]]</code><!--, <code>[[#new|new]]</code>-->
}}
 
; Brief
: ''Impose a new value to a parameter''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|imposing|name|value|pipe function name}}</syntaxhighlight>
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|imposing|foo|bar|imposing|hello|world|for_each|[$#: $@]}}</syntaxhighlight>
 
{{vpad|clear=none}}
 
{{A note}} The value assigned will not be trimmed of its leading and trailing spaces. The name of the parameter and the <code>imposing</code> modifier name itself, however, will be trimmed of their surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>providing</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>providing</code> <span style="nowrap">({{module:params/doc/link to the code|providing|code}})</span>
| label1 = Num. of arguments | data1 = 2
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#imposing|imposing]]</code>, <code>[[#discarding|discarding]]</code><!--, <code>[[#inserting|inserting]]</code>-->, <code>[[#filling_the_gaps|filling_the_gaps]]</code><!--, <code>[[#new|new]]</code>-->
}}
 
; Brief
: ''Assign a new value to a parameter, but only when missing''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|providing|name|value|pipe function name}}</syntaxhighlight>
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|providing|foo|bar|providing|hello|world|for_each|[$#: $@]}}</syntaxhighlight>
 
{{vpad|clear=none}}
 
{{A note}} The value assigned will not be trimmed of its leading and trailing spaces. The name of the parameter and the <code>providing</code> modifier name itself, however, will be trimmed of their surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>discarding</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>discarding</code> <span style="nowrap">({{module:params/doc/link to the code|discarding|code}})</span>
| label1 = Num. of arguments | data1 = 1 or 2
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#clearing|clearing]]</code>, <code>[[#cutting|cutting]]</code>, <code>[[#cropping|cropping]]</code>, <code>[[#purging|purging]]</code>, <code>[[#backpurging|backpurging]]</code><!--, <code>[[#inserting|inserting]]</code>, <code>[[#new|new]]</code>-->
}}
 
; Brief
: ''Discard one or more numeric parameters or one non-numeric parameter''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|discarding|name|[how many]|pipe function name}}</syntaxhighlight>
 
If, and only if, the name of the parameter is numeric, it is possible to add a second argument to indicate how many contiguous parameters must be discarded starting from the first argument. If the discarded parameters is part of the parameters' sequence one or more holes will be created. To avoid creating holes, use <code>[[#purging|purging]]</code> or <code>[[#backpurging|backpurging]]</code>.
 
Example #1 (discard the parameter named {{para|hello}}):
 
<syntaxhighlight lang="wikitext">{{#invoke:params|discarding|hello|for_each|[$#: $@]}}</syntaxhighlight>
 
Example #2 (discard the parameter named {{para|5}}):
 
<syntaxhighlight lang="wikitext">{{#invoke:params|discarding|5|for_each|[$#: $@]}}</syntaxhighlight>
 
Example #3 (discard the parameters named {{para|1}}, {{para|2}}, {{para|3}} and {{para|4}}):
 
<syntaxhighlight lang="wikitext">{{#invoke:params|discarding|1|4|for_each|[$#: $@]}}</syntaxhighlight>
 
It is possible to use this modifier to check for unknown parameters:
 
<syntaxhighlight lang="wikitext">{{#ifexpr:{{#invoke:params|discarding|hello|discarding|wind|count}} > 0
|{{Error|Error: The only parameters accepted are {{para|hello}} and {{para|wind}}.}}
|Everything is good: do something
}}</syntaxhighlight>
 
You can find this example at &#123;&#123;{{rel|Module:Params/doc/examples/check for unknown parameters}}&#125;&#125;. For instance, <syntaxhighlight lang="wikitext" inline>{{module:params/doc/examples/check for unknown parameters|hello=world|wind=surfing}}</syntaxhighlight> will generate
 
: {{module:params/doc/examples/check for unknown parameters|hello=world|wind=surfing}}
 
For simple cases like this, however, specialized modules are available; you might want to have a look at:
 
* {{ml|Check for unknown parameters|check}}
* {{ml|Check for deprecated parameters|check}}
* {{ml|Check for clobbered parameters|check}}
* {{ml|Parameter validation|validateparams}}
* {{ml|TemplatePar|valid}}
 
When used to discard single parameters, this modifier is equivalent to writing <code>...&#124;[[#with_name_not_matching|with_name_not_matching]]&#124;''parameter name''&#124;strict&#124;...</code>. However, due to the fact that <code>[[#with_name_not_matching|with_name_not_matching]]</code> needs to cross-check for the possible presence of <code>or</code> keywords, using <code>discarding</code> will be slightly more efficient.
 
{{A note}} All arguments passed to this modifier and the <code>discarding</code> modifier name itself will be trimmed of their surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>excluding_non-numeric_names</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>excluding_non-numeric_names</code> <span style="nowrap">({{module:params/doc/link to the code|excluding_non-numeric_names|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#excluding_non-numeric_names|excluding_non-numeric_names]]</code>, <code>[[#with_name_matching|with_name_matching]]</code>, <code>[[#with_name_not_matching|with_name_not_matching]]</code>, <code>[[#clearing|clearing]]</code>
}}
 
; Brief
: ''Discard all non-numeric parameters''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|excluding_non-numeric_names|pipe function name}}</syntaxhighlight>
 
This modifier is only syntax sugar for <code>...&#124;with_name_matching&#124;^%-?%d+$&#124;...</code> (but using a slighly faster optimization). For the inverse modifier, see <code>[[#excluding_numeric_names|excluding_numeric_names]]</code>. If you want to remove also non-sequential parameters, add the <code>[[#clearing|clearing]]</code> modifier to the pipeline (<code>...&#124;excluding_non-numeric_names&#124;clearing&#124;...</code>).
 
{{vpad|1.5em|clear=none}}
 
=== <code>excluding_numeric_names</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>excluding_numeric_names</code> <span style="nowrap">({{module:params/doc/link to the code|excluding_numeric_names|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#excluding_non-numeric_names|excluding_non-numeric_names]]</code>, <code>[[#with_name_matching|with_name_matching]]</code>, <code>[[#with_name_not_matching|with_name_not_matching]]</code>
}}
 
; Brief
: ''Discard all numeric parameters (not only the sequential ones)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|excluding_numeric_names|pipe function name}}</syntaxhighlight>
 
This modifier is only syntax sugar for <code>...&#124;with_name_not_matching&#124;^%-?%d+$&#124;...</code> (but using a slighly faster optimization). For the inverse modifier, see <code>[[#excluding_non-numeric_names|excluding_non-numeric_names]]</code>.
 
{{vpad|1.5em|clear=none}}
 
=== <code>with_name_matching</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>with_name_matching</code> <span style="nowrap">({{module:params/doc/link to the code|with_name_matching|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#excluding_numeric_names|excluding_numeric_names]]</code>, <code>[[#excluding_non-numeric_names|excluding_non-numeric_names]]</code>, <code>[[#with_name_not_matching|with_name_not_matching]]</code>, <code>[[#with_value_matching|with_value_matching]]</code>, <code>[[#with_value_not_matching|with_value_not_matching]]</code>
}}
 
; Brief
: ''Discard all parameters whose name ''does not match '''any''''' of the given patterns''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|with_name_matching|target 1|[plain flag 1]|[or]|[target 2]|[plain flag 2]|[or]|[...]|[target N]|[plain flag N]|pipe function name}}</syntaxhighlight>
 
Internally this modifier uses Lua's <code>[[:mw:Extension:Scribunto/Lua reference manual#string.find|string.find()]]</code> function to find whether parameter names match against given patterns; therefore, unless a ''plain flag'' is set, please use the same syntax of [[:mw:Extension:Scribunto/Lua reference manual#Patterns|Lua patterns]]. The ''plain flag'' can be either <code>plain</code> or <code>strict</code> or omitted. When omitted it is assumed that the target string is a Lua pattern. The difference between <code>plain</code> and <code>strict</code> is that the latter also requires that the lengths match (this happens only when the two strings are 100% identical). In order to facilitate wikitext scripting in the ''plain flag'' argument, the <code>pattern</code> keyword is available too, equivalent to omitting the argument.
 
To express a [[Disjunction (logical connective)|logical OR]] the <code>or</code> keyword is available. To express a [[Logical conjunction|logical AND]] instead, concatenate more invocations of <code>with_name_matching</code>.
 
{{vpad|clear=none}}
 
For the sake of argument we will imagine that we are invoking <code>with_name_matching</code> from within the {{tl|Infobox artery}} template, and this is being called with the following parameters:
 
{{tj|Infobox artery
| Name: Pulmonary artery
| Latin: truncus pulmonalis, arteria pulmonalis
| Image: <nowiki>{{Heart diagram 250px}}</nowiki>
| Caption: Anterior (frontal) view of the opened heart. (Pulmonary artery upper right.)
| Image2: Alveoli diagram.png
| Caption2: Diagram of the alveoli with both cross-section and external view.
| BranchFrom: <nowiki>[[right ventricle]]</nowiki>
| BranchTo:
| Vein: <nowiki>[[pulmonary vein]]</nowiki>
| Precursor: truncus arteriosus
| Supplies:
}}
 
{{vpad|clear=none}}
 
Test cases:
 
* List only the parameters whose names match against the <code>^Image</code> pattern:
*: ↳ <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|ih/p|{{!}}|{{=}}|with_name_matching|^Image|list}}</syntaxhighlight>
*:: ↳ {{highlight round|bc=#ff9|<nowiki>|Image={{Heart diagram 250px}}|Image2=Alveoli diagram.png</nowiki>}}
* List the parameters whose names match against both patterns <code>^Image</code> '''and''' <code>%d+$</code>:
*: ↳ <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|ih/p|{{!}}|{{=}}|with_name_matching|^Image|with_name_matching|%d+$|list}}</syntaxhighlight>
*:: ↳ {{highlight round|bc=#ff9|<nowiki>|Image2=Alveoli diagram.png</nowiki>}}
* List the parameters whose names match against either the <code>^Name</code> '''or''' the <code>^Latin$</code> pattern:
*: ↳ <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|ih/p|{{!}}|{{=}}|with_name_matching|^Name$|or|^Latin$|list}}</syntaxhighlight>
*:: ↳ {{highlight round|bc=#ff9|<nowiki>|Latin=truncus pulmonalis, arteria pulmonalis|Name=Pulmonary artery</nowiki>}}
* List the parameters whose names match against either the <code>ma</code> plain string '''or''' the <code>me$</code> pattern:
*: ↳ <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|ih/p|{{!}}|{{=}}|with_name_matching|ma|plain|or|me$|list}}</syntaxhighlight>
*:: ↳ {{highlight round|bc=#ff9|<nowiki>|Image={{Heart diagram 250px}}|Name=Pulmonary artery|Image2=Alveoli diagram.png</nowiki>}}
 
{{vpad|clear=none}}
 
Using <code>with_name_matching</code> it is easy to emulate the behaviour of [[Module:Enumerate]] (or similar modules). For instance, the following examples creates a bullet list of all the parameters passed of type <code>&#124;foobar1</code>, <code>&#124;foobar2</code> … <code>&#124;foobarN</code>:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|all_sorted|with_name_matching|^foobar%d+$|setting|ih|
* |list_values}}</syntaxhighlight>
 
It is possible to see this example live at &#123;&#123;{{rel|Module:Params/doc/examples/enumerate}}&#125;&#125;.
 
{{vpad|clear=none}}
 
{{A note}} The ''target'' arguments passed to this modifier will not be trimmed of their leading and trailing spaces. The <code>or</code>, <code>plain</code>, <code>strict</code> and <code>pattern</code> keywords, and the <code>with_name_matching</code> modifier name itself, however, will be trimmed of their surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>with_name_not_matching</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>with_name_not_matching</code> <span style="nowrap">({{module:params/doc/link to the code|with_name_not_matching|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#excluding_numeric_names|excluding_numeric_names]]</code>, <code>[[#excluding_non-numeric_names|excluding_non-numeric_names]]</code>,<code>[[#with_name_matching|with_name_matching]]</code>, <code>[[#with_value_matching|with_value_matching]]</code>, <code>[[#with_value_not_matching|with_value_not_matching]]</code>
}}
 
; Brief
: ''Discard all parameters whose name ''matches '''all''''' the given patterns''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|with_name_not_matching|target 1|[plain flag 1]|[and]|[target 2]|[plain flag 2]|[and]|[...]|[target N]|[plain flag N]|pipe function name}}</syntaxhighlight>
 
Internally this modifier uses Lua's <code>[[:mw:Extension:Scribunto/Lua reference manual#string.find|string.find()]]</code> function to find whether parameter names match against given patterns; therefore, unless a plain flag is set, please use the same syntax of [[:mw:Extension:Scribunto/Lua reference manual#Patterns|Lua patterns]]. The plain flag can be either <code>plain</code> or <code>strict</code> or omitted. When omitted it is assumed that the target string is a Lua pattern. The difference between <code>plain</code> and <code>strict</code> is that the latter also requires that the lengths match (this happens only when the two strings are 100% identical). In order to facilitate wikitext scripting in the ''plain flag'' argument, the <code>pattern</code> keyword is available too, equivalent to omitting the argument.
 
To express a [[Disjunction (logical connective)|logical OR]] the <code>or</code> keyword is available. To express a [[Logical conjunction|logical AND]] instead, concatenate more invocations of <code>with_name_not_matching</code>.
 
{{vpad|clear=none}}
 
For the sake of argument we will imagine that we are invoking <code>with_name_not_matching</code> from within the {{tl|Infobox artery}} template, and this is being transcluded using the same parameters that we had imagined in the previous example at <code>[[#with_name_matching|with_name_matching]]</code>:
 
* List only the parameters whose names do not match against the <code>a</code> pattern:
*: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|ih/p|{{!}}|{{=}}|with_name_not_matching|a|list}}</syntaxhighlight>
*:: ↳ {{highlight round|bc=#ff9|<nowiki>|Precursor=truncus arteriosus|Supplies=|Vein=pulmonary vein</nowiki>}}
* List the parameters whose names do not match against the <code>a</code> plain string '''and''' do not match against the <code>l</code> plain string either:
*: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|ih/p|{{!}}|{{=}}|with_name_not_matching|a|plain|with_name_not_matching|l|plain|list}}</syntaxhighlight>
*:: ↳ {{highlight round|bc=#ff9|<nowiki>|Precursor=truncus arteriosus|Vein=pulmonary vein</nowiki>}}
* List the parameters whose names do not match against either the <code>a</code> plain string '''or''' the <code>n</code> plain string:
*: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|ih/p|{{!}}|{{=}}|with_name_not_matching|a|plain|or|n|plain|list}}</syntaxhighlight>
*:: ↳ {{highlight round|bc=#ff9|<nowiki>|Precursor=truncus arteriosus|Supplies=|Image={{Heart diagram 250px}}|Name=Pulmonary artery|Image2=Alveoli diagram.png|Vein=pulmonary vein</nowiki>}}
 
{{vpad|clear=none}}
 
{{N.b.}} For the sake of efficiency, please don't use this modifier with the <code>strict</code> flag unless accompanied by <code>or</code>, use <code>[[#discarding|discarding]]</code> instead!
 
{{A note}} The ''target'' arguments passed to this modifier will not be trimmed of their leading and trailing spaces. The <code>or</code>, <code>plain</code>, <code>strict</code> and <code>pattern</code> keywords, and the <code>with_name_not_matching</code> modifier name itself, however, will be trimmed of their surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>with_value_matching</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>with_value_matching</code> <span style="nowrap">({{module:params/doc/link to the code|with_value_matching|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#with_name_matching|with_name_matching]]</code>, <code>[[#with_name_not_matching|with_name_not_matching]]</code>, <code>[[#with_value_not_matching|with_value_not_matching]]</code>
}}
 
; Brief
: Removes from the parameter list''Discard all the parameters whose value ''does not match '''any''''' of the given patternpatterns''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|with_value_matching|patterntarget 1|[plain flag 1]|[or]|[target 2]|[plain flag 2]|[or]|[...]|[target N]|[plain flag N]|pipe function name}}</syntaxhighlight>
 
Exactly like <code>[[#with_name_matching|with_name_matching]]</code>, but applied to parameter values instead of names.
 
Internally this modifier uses Lua's <code>[[:mw:Extension:Scribunto/Lua reference manual#string.find|string.find()]]</code> function to find whether parameter names match against given patterns; therefore, unless a plain flag is set, please use the same syntax of [[:mw:Extension:Scribunto/Lua reference manual#Patterns|Lua patterns]]. The plain flag can be either <code>plain</code> or <code>strict</code> or omitted. When omitted it is assumed that the target string is a Lua pattern. The difference between <code>plain</code> and <code>strict</code> is that the latter also requires that the lengths match (this happens only when the two strings are 100% identical). In order to facilitate wikitext scripting in the ''plain flag'' argument, the <code>pattern</code> keyword is available too, equivalent to omitting the argument.
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|with_value_matching|n$banana|count}}</syntaxhighlight>
 
{{vpad|clear=none}}
 
{{A note}} The ''target'' arguments passed to this modifier will not be trimmed of their leading and trailing spaces. The <code>or</code>, <code>plain</code>, <code>strict</code> and <code>pattern</code> keywords, and the <code>with_value_matching</code> modifier name itself, however, will be trimmed of their surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>with_value_not_matching</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>with_value_not_matching</code> <span style="nowrap">({{module:params/doc/link to the code|with_value_not_matching|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#with_name_matching|with_name_matching]]</code>, <code>[[#with_name_not_matching|with_name_not_matching]]</code>, <code>[[#with_value_matching|with_value_matching]]</code>
}}
 
; Brief
: Removes from the parameter list''Discard all the parameters whose value ''matches '''all''''' the given patternpatterns''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|with_value_not_matching|patterntarget 1|[plain flag 1]|[and]|[target 2]|[plain flag 2]|[and]|[...]|[target N]|[plain flag N]|pipe function name}}</syntaxhighlight>
 
Exactly like <code>[[#with_name_not_matching|with_name_not_matching]]</code>, but applied to parameter values instead of names.
Example:
 
Internally this modifier uses Lua's <code>[[:mw:Extension:Scribunto/Lua reference manual#string.find|string.find()]]</code> function to find whether parameter names match against given patterns; therefore, unless a plain flag is set, please use the same syntax of [[:mw:Extension:Scribunto/Lua reference manual#Patterns|Lua patterns]]. The plain flag can be either <code>plain</code> or <code>strict</code> or omitted. When omitted it is assumed that the target string is a Lua pattern. The difference between <code>plain</code> and <code>strict</code> is that the latter also requires that the lengths match (this happens only when the two strings are 100% identical). In order to facilitate wikitext scripting in the ''plain flag'' argument, the <code>pattern</code> keyword is available too, equivalent to omitting the argument.
<syntaxhighlight lang="wikitext">{{#invoke:params|with_value_not_matching|n$|count}}</syntaxhighlight>
 
For instance, before calling <code>[[#list|list]]</code>, the following code will get rid of all blank parameters (i.e. parameters whose values contain only zero or more spaces):
 
<syntaxhighlight lang="wikitext">{{#invoke:params|with_value_not_matching|^%s*$|setting|hi/p|{{!}}|{{=}}|list}}</syntaxhighlight>
 
A typical use case of this modifier is that of purging all empty incoming parameters before calling another template, especially when this [[Help:Conditional expressions#Checking for template parameters|distinguishes between empty and undefined parameters]].
 
<syntaxhighlight lang="wikitext">{{#invoke:params|with_value_not_matching|^%s*$|concat_and_call|my template}}</syntaxhighlight>
 
{{vpad|clear=none}}
 
{{A note}} The ''target'' arguments passed to this modifier will not be trimmed of their leading and trailing spaces. The <code>or</code>, <code>plain</code>, <code>strict</code> and <code>pattern</code> keywords, and the <code>with_value_not_matching</code> modifier name itself, however, will be trimmed of their surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>trimming_values</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>trimming_values</code> <span style="nowrap">({{module:params/doc/link to the code|trimming_values|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
}}
 
=== <code>trimmed</code> ===
; Brief
: ''Remove leading and trailing spaces from values''
: Removes zero or more parameters from the beginning and/or the end of the parameter list
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|trimmed|left trim|right trimtrimming_values|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
Most modifiers are order-dependent, therefore placing <code>trimming_values</code> in different positions can generate different results. For instance, imagining our <syntaxhighlight lang="wikitext" inline>{{example template}}</syntaxhighlight> being called with the following spaced arguments: <syntaxhighlight lang="wikitext" inline>{{example template| wanna | be | my | friend | ? }}</syntaxhighlight>. If <syntaxhighlight lang="wikitext" inline>{{example template}}</syntaxhighlight> contained the following code,
 
<syntaxhighlight lang="wikitext">{{#invoke:params|with_value_matching|%s+$|trimming_values|setting|i/p|{{!}}|{{=}}|list}}</syntaxhighlight>
 
the following text would be printed: <code>1=wanna|2=be|3=my|4=friend|5=?</code>. But if instead it contained the following code,
 
<syntaxhighlight lang="wikitext">{{#invoke:params|trimming_values|with_value_matching|%s+$|setting|i/p|{{!}}|{{=}}|list}}</syntaxhighlight>
 
no arguments would be shown.
 
Order affects also performance, and how many values will be trimmed of their leading and trailing spaces will depend on where <code>trimming_values</code> is placed. For instance, if a template were invoked with 50 parameters and its code contained <syntaxhighlight lang="wikitext" inline>{{#invoke:params|trimming_values|cutting|-1|0|list}}</syntaxhighlight>, first all its values would be trimmed of leading and trailing blank spaces and then its first 49 parameters would be discarded. On the other hand, writing <syntaxhighlight lang="wikitext" inline>{{#invoke:params|cutting|-1|0|trimming_values|list}}</syntaxhighlight> would first discard 49 parameters and then trim the only value left, resulting in a more efficient code. As a general rule, placing <code>trimming_values</code> as the last modifier is usually the best choice.
 
In most cases placing <code>trimming_values</code> together with <code>non-sequential</code> will result in an empty call with no effects, because non-sequential parameters are normally stripped of their leading and trailing spaces by default – this however depends on the caller, and if the current template is being called by a module it is in theory possible in specific conditions for named parameters to retain their leading and trailing spaces (namely in non-sequential numeric parameters).
 
Using <code>trimming_values</code> makes this module behave like many Wikipedia modules behave. For example, if we wanted to emulate {{ml|Separated entries|main}}, writing
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|squeezing|trimming_values|setting|i|XXXX|list_values}}</syntaxhighlight>
 
will be equivalent to writing,
 
<syntaxhighlight lang="wikitext">{{#invoke:separated entries|main|separator=XXXX}}</syntaxhighlight>
 
whereas writing
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|squeezing|trimming_values|setting|i/l|XXXX|YYYY|list_values}}</syntaxhighlight>
 
will be equivalent to writing
 
<syntaxhighlight lang="wikitext">{{#invoke:separated entries|main|separator=XXXX|conjunction=YYYY}}</syntaxhighlight>
 
The &#123;&#123;{{rel|Module:Params/doc/examples/trim and call}}&#125;&#125; example template shows how to call any arbitrary template trimming all parameters beforehand.
 
{{vpad|1.5em|clear=none}}
 
=== <code>converting_values_to_lowercase</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>converting_values_to_lowercase</code> <span style="nowrap">({{module:params/doc/link to the code|converting_values_to_lowercase|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#mapping_by_replacing|mapping_by_replacing]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>
}}
 
; Brief
: ''Convert all parameter values to lower case''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|converting_values_to_lowercase|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
This modifier converts all parameter values to lower [[Letter case|case]]. It is identical to writing <code>...&#124;[[#mapping_by_magic|mapping_by_magic]]&#124;[[:mw:Help:Magic words#lc|lc]]&#124;...</code>, but without the burden of calling a parser function.
 
{{vpad|1.5em|clear=none}}
 
=== <code>converting_values_to_uppercase</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>converting_values_to_uppercase</code> <span style="nowrap">({{module:params/doc/link to the code|converting_values_to_uppercase|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#mapping_by_replacing|mapping_by_replacing]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>
}}
 
; Brief
: ''Convert all parameter values to upper case''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|converting_values_to_uppercase|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
This modifier converts all parameter values to upper [[Letter case|case]]. It is identical to writing <code>...&#124;[[#mapping_by_magic|mapping_by_magic]]&#124;[[:mw:Help:Magic words#uc|uc]]&#124;...</code>, but without the burden of calling a parser function.
 
{{vpad|1.5em|clear=none}}
 
=== <code>mapping_by_calling</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>mapping_by_calling</code> <span style="nowrap">({{module:params/doc/link to the code|mapping_by_calling|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#call_for_each|call_for_each]]</code>, <code>[[#call_for_each_value|call_for_each_value]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#mapping_by_replacing|mapping_by_replacing]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#renaming_by_calling|renaming_by_calling]]</code>, <code>[[#renaming_by_invoking|renaming_by_invoking]]</code>, <code>[[#renaming_by_magic|renaming_by_magic]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>, <code>[[#grouping_by_calling|grouping_by_calling]]</code>
}}
 
; Brief
: ''[[Map (higher-order function)|Map]] all parameter values, replacing their content with the expansion of a given template repeatedly called with one parameter (the parameter's value)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mapping_by_calling|template name|[call style]|[let]|[...]|[number of additional parameters]|[parameter 1]|[parameter 2]|[...]|[parameter N]|pipe function name}}</syntaxhighlight>
 
This modifier (temporarily) changes the content of the parameters the current template is being called with, replacing each of them with the text returned by another template. The latter will be repeatedly called with at least one parameter as first sequential parameter: the parameter's value.
 
It is possible to pass the parameter's value as a different parameter, or pass the parameter's name as well, by specifying a ''call style flag'' immediately after the ''template name'' (see below).
 
If the ''call style flag'' or (if omitted) the ''template name'' is followed by one or more groups of three arguments led by the <code>let</code> keyword (i.e. <code>let&#124;name&#124;value</code>), these will be passed to the mapping template.
 
If the last group of three arguments or (if omitted) the ''call style flag'' or (if omitted) the ''template name'' is followed by a number, this will be parsed as the amount of positional parameters to add. These will always follow the current parameter's name and/or value if any of the latter are passed using a numeric name greater than zero.
 
In case of collisions, the parameters assigned via the <code>let</code> keyword will be given precedence over everything else.
 
For instance, before listing all parameters,
 
<syntaxhighlight lang="wikitext">{{#invoke:params|mapping_by_calling|foobar|setting|i/p|{{!}}|{{=}}|list}}</syntaxhighlight>
 
will replace each value with the expansion of <syntaxhighlight lang="wikitext" inline>{{foobar|VALUE}}</syntaxhighlight> (where <code>VALUE</code> indicates each different value).
 
On the other hand,
 
<syntaxhighlight lang="wikitext">{{#invoke:params|mapping_by_calling|foobar|names_and_values|let|rice|nope|let|curry|lots!|2|hello|world|setting|i/p|{{!}}|{{=}}|list}}</syntaxhighlight>
 
will do the same, but using the expansion of <syntaxhighlight lang="wikitext" inline>{{foobar|NAME|VALUE|hello|world|rice=nope|curry=lots!}}</syntaxhighlight> (where <code>NAME</code> and <code>VALUE</code> indicate each different name and value).
 
Possible ''call style flags'' are:
 
{| class="wikitable"
|-
! ''Call style flag''
! Example
! Corresponding call
|-
| <code>names_and_values</code>
| <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mapping_by_calling|example template|names_and_values|let|foo|bar|2|hello|world|setting|i/p|<br />| → |list}}</syntaxhighlight>
| <syntaxhighlight lang="wikitext" inline>{{example template|NAME|VALUE|hello|world|foo=bar}}</syntaxhighlight>
|-
| <code>values_and_names</code>
| <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mapping_by_calling|example template|values_and_names|let|foo|bar|2|hello|world|setting|i/p|<br />| → |list}}</syntaxhighlight>
| <syntaxhighlight lang="wikitext" inline>{{example template|VALUE|NAME|hello|world|foo=bar}}</syntaxhighlight>
|-
| <code>names_only</code>
| <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mapping_by_calling|example template|names_only|let|foo|bar|2|hello|world|setting|i/p|<br />| → |list}}</syntaxhighlight>
| <syntaxhighlight lang="wikitext" inline>{{example template|NAME|hello|world|foo=bar}}</syntaxhighlight>
|-
| <code>values_only</code>
| <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mapping_by_calling|example template|values_only|let|foo|bar|2|hello|world|setting|i/p|<br />| → |list}}</syntaxhighlight>
| <syntaxhighlight lang="wikitext" inline>{{example template|VALUE|hello|world|foo=bar}}</syntaxhighlight>
|-
| <code>names_and_values_as&#124;...&#124;...</code>
| <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mapping_by_calling|example template|names_and_values_as|my_name|my_value|let|foo|bar|2|hello|world|setting|i/p|<br />| → |list}}</syntaxhighlight>
| <syntaxhighlight lang="wikitext" inline>{{example template|hello|world|my_name=NAME|my_value=VALUE|foo=bar}}</syntaxhighlight>
|-
| <code>names_only_as&#124;...</code>
| <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mapping_by_calling|example template|names_only_as|my_name|let|foo|bar|2|hello|world|setting|i/p|<br />| → |list}}</syntaxhighlight>
| <syntaxhighlight lang="wikitext" inline>{{example template|hello|world|my_name=NAME|foo=bar}}</syntaxhighlight>
|-
| <code>values_only_as&#124;...</code>
| <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mapping_by_calling|example template|values_only_as|my_value|let|foo|bar|2|hello|world|setting|i/p|<br />| → |list}}</syntaxhighlight>
| <syntaxhighlight lang="wikitext" inline>{{example template|hello|world|my_value=VALUE|foo=bar}}</syntaxhighlight>
|-
| <code>blindly</code>
| <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mapping_by_calling|example template|blindly|let|foo|bar|2|hello|world|setting|i/p|<br />| → |list}}</syntaxhighlight>
| <syntaxhighlight lang="wikitext" inline>{{example template|hello|world|foo=bar}}</syntaxhighlight>
|}
 
If the ''call style flags'' argument is omitted it defaults to <code>values_only</code>.
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this modifier except the <code>mapping_by_calling</code> modifier name itself, the ''template name'', the ''call style flag'', the <code>let</code> keyword, the passed parameter names, and the number of additional parameters will not be trimmed of their leading and trailing spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>mapping_by_invoking</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>mapping_by_invoking</code> <span style="nowrap">({{module:params/doc/link to the code|mapping_by_invoking|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#invoke_for_each|invoke_for_each]]</code>, <code>[[#invoke_for_each_value|invoke_for_each_value]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#mapping_by_replacing|mapping_by_replacing]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#renaming_by_calling|renaming_by_calling]]</code>, <code>[[#renaming_by_invoking|renaming_by_invoking]]</code>, <code>[[#renaming_by_magic|renaming_by_magic]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>, <code>[[#grouping_by_calling|grouping_by_calling]]</code>
}}
 
; Brief
: ''[[Map (higher-order function)|Map]] all parameter values, replacing their content with the text returned by a given module function repeatedly invoked with at least one argument (the parameter's value)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mapping_by_invoking|module name|function name|[call style]|[let]|[...]|[number of additional arguments]|[argument 1]|[argument 2]|[...]|[argument N]|pipe function name}}</syntaxhighlight>
 
This modifier (temporarily) changes the content of the parameters the current template is being called with, replacing each of them with the text returned by a custom module function. The latter will be repeatedly called with at least one argument as first sequential argument: the parameter's value.
 
It is possible to pass the parameter's value as a different argument, or pass the parameter's name as well, by specifying a ''call style flag'' immediately after the ''function name'' (see <code>[[#mapping_by_calling|mapping_by_calling]]</code> for the list of possible flags). If omitted, the ''call style flags'' argument defaults to <code>values_only</code>.
 
If the ''call style flag'' or (if omitted) the ''function name'' is followed by one or more groups of three arguments led by the <code>let</code> keyword (i.e. <code>let&#124;name&#124;value</code>), these will be passed to the mapping module function.
 
If the last group of three arguments or (if omitted) the ''call style flag'' or (if omitted) the ''function name'' is followed by a number, this will be parsed as the amount of positional parameters to add. These will always follow the current parameter's name and/or value if any of the latter are passed using a numeric name greater than zero.
 
In case of collisions, the arguments assigned via the <code>let</code> keyword will be given precedence over everything else.
 
For instance, before listing all parameters,
 
<syntaxhighlight lang="wikitext">{{#invoke:params|mapping_by_invoking|foobar|main|setting|i/p|{{!}}|{{=}}|list}}</syntaxhighlight>
 
will replace each value with the expansion of <syntaxhighlight lang="wikitext" inline>{{#invoke:foobar|main|VALUE}}</syntaxhighlight> (where <code>VALUE</code> indicates each different value).
 
On the other hand,
 
<syntaxhighlight lang="wikitext">{{#invoke:params|mapping_by_invoking|foobar|main|names_and_values|let|rice|nope|let|curry|lots!|2|hello|world|setting|i/p|{{!}}|{{=}}|list}}</syntaxhighlight>
 
will do the same, but using the expansion of <syntaxhighlight lang="wikitext" inline>{{#invoke:foobar|main|NAME|VALUE|hello|world|rice=nope|curry=lots!}}</syntaxhighlight> (where <code>NAME</code> and <code>VALUE</code> indicate each different name and value).
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this modifier except the <code>mapping_by_invoking</code> modifier name itself, the ''module name'', the ''function name'', the ''call style flag'', the <code>let</code> keyword, the passed parameter names, and the number of additional arguments will not be trimmed of their leading and trailing spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>mapping_by_magic</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>mapping_by_magic</code> <span style="nowrap">({{module:params/doc/link to the code|mapping_by_magic|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#magic_for_each|magic_for_each]]</code>, <code>[[#magic_for_each_value|magic_for_each_value]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#mapping_by_replacing|mapping_by_replacing]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#renaming_by_calling|renaming_by_calling]]</code>, <code>[[#renaming_by_invoking|renaming_by_invoking]]</code>, <code>[[#renaming_by_magic|renaming_by_magic]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>, <code>[[#grouping_by_calling|grouping_by_calling]]</code>
}}
 
; Brief
: ''[[Map (higher-order function)|Map]] all parameter values, replacing their content with the expansion of a given parser function repeatedly called with at least one argument (the parameter's value)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mapping_by_magic|parser function|[call style]|[let]|[...]|[number of additional arguments]|[argument 1]|[argument 2]|[...]|[argument N]|pipe function name}}</syntaxhighlight>
 
This modifier (temporarily) changes the content of the parameters the current template is being called with, replacing each of them with the text returned by a [[:mw:Help:Magic words#Parser functions|parser function]]. The latter will be repeatedly called with at least one argument as first sequential argument: the parameter's value.
 
It is possible to pass the parameter's value as a different argument, or pass the parameter's name as well, by specifying a ''call style flag'' immediately after the ''parser function name'' (see <code>[[#mapping_by_calling|mapping_by_calling]]</code> for the list of possible flags). If omitted, the ''call style flags'' argument defaults to <code>values_only</code>.
 
If the ''call style flag'' or (if omitted) the ''template name'' is followed by one or more groups of three arguments led by the <code>let</code> keyword (i.e. <code>let&#124;name&#124;value</code>), these will be passed to the parser function.
 
If the last group of three arguments or (if omitted) the ''call style flag'' or (if omitted) the ''template name'' is followed by a number, this will be parsed as the amount of positional arguments to add. These will always follow the current parameter's name and/or value if any of the latter are passed using a numeric name greater than zero.
 
In case of collisions, the arguments assigned via the <code>let</code> keyword will be given precedence over everything else.
 
For instance, before listing all parameters,
 
<syntaxhighlight lang="wikitext">{{#invoke:params|mapping_by_magic|uc|setting|i/p|{{!}}|{{=}}|list}}</syntaxhighlight>
 
will replace each value with the expansion of <syntaxhighlight lang="wikitext" inline>{{uc:VALUE}}</syntaxhighlight> (where <code>VALUE</code> indicates each different value).
 
On the other hand,
 
<syntaxhighlight lang="wikitext">{{#invoke:params|mapping_by_magic|plural|names_and_values|1|They are many|setting|i/p|{{!}}|{{=}}|list}}</syntaxhighlight>
 
will do the same, but using the expansion of <syntaxhighlight lang="wikitext" inline>{{plural:NAME|VALUE|They are many}}</syntaxhighlight> (where <code>NAME</code> and <code>VALUE</code> indicate each different name and value).
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this modifier except the <code>mapping_by_magic</code> modifier name itself, the parser function's name, the ''call style flag'', the <code>let</code> keyword, the passed parameter names, and the number of additional arguments will not be trimmed of their leading and trailing spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>mapping_by_replacing</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>mapping_by_replacing</code> <span style="nowrap">({{module:params/doc/link to the code|mapping_by_replacing|code}})</span>
| label1 = Num. of arguments | data1 = 2–4
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#mapping_by_mixing|mapping_by_mixing]]</code>, <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#renaming_by_calling|renaming_by_calling]]</code>, <code>[[#renaming_by_invoking|renaming_by_invoking]]</code>, <code>[[#renaming_by_magic|renaming_by_magic]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>, <code>[[#renaming_by_mixing|renaming_by_mixing]]</code>, <code>[[#grouping_by_calling|grouping_by_calling]]</code>, <code>[[#mixing_names_and_values]]</code>
}}
 
; Brief
: ''[[Map (higher-order function)|Map]] all parameter values performing [[String operations#String substitution|string substitutions]]''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mapping_by_replacing|target|replace|[count]|[plain flag]|pipe function name}}</syntaxhighlight>
 
This modifier (temporarily) changes the content of the parameters the current template is being called with, replacing each of them with the result of a string substitution. Its syntax is very simlar to {{mfl|string|replace}}.
 
Internally the modifier uses Lua's <code>[[:mw:Extension:Scribunto/Lua reference manual#string.gsub|string.gsub()]]</code> function to perform substitutions; therefore, unless a ''plain flag'' is set, please use the same syntax of [[:mw:Extension:Scribunto/Lua reference manual#Patterns|Lua patterns]]. The ''plain flag'' can be either <code>plain</code> or <code>strict</code> or omitted. When omitted it is assumed that the target string is a Lua pattern. The difference between <code>plain</code> and <code>strict</code> is that the latter also requires that the lengths match (this happens only when the two strings are 100% identical). In <code>strict</code> mode the ''replace'' argument will not accept directives (e.g. <code>%0</code>, <code>%1</code>, etc.). In order to facilitate wikitext scripting in the ''plain flag'' argument, the <code>pattern</code> keyword is available too, equivalent to omitting the argument.
 
The ''count'' argument prescribes how many substitutions will be performed at most. If blank or omitted, all matches found will be substituted.
 
This modifier uses <code>[[:mw:Extension:Scribunto/Lua reference manual#string.gsub|string.gsub()]]</code> for performance reasons; if you need to use <code>[[:mw:Extension:Scribunto/Lua reference manual#mw.ustring.gsub|mw.ustring.gsub()]]</code> instead, you will need to invoke the <code>[[Module:String#replace|replace]]</code> function from [[Module:String]] via <code>...&#124;[[#mapping_by_invoking|mapping_by_invoking]]&#124;[[Module:String|string]]&#124;[[Module:String#replace|replace]]&#124;...</code>.
 
The following table shows examples of equivalent instructions. Please be aware that invoking <code>[[:mw:Extension:Scribunto/Lua reference manual#mw.ustring.gsub|mw.ustring.gsub()]]</code> can be much slower.
 
{| class="wikitable"
|-
! <code>[[:mw:Extension:Scribunto/Lua reference manual#string.gsub|string.gsub()]]</code>
! <code>[[:mw:Extension:Scribunto/Lua reference manual#mw.ustring.gsub|mw.ustring.gsub()]]</code> (via [[Module:String]])
|-
| <code>...&#124;mapping_by_replacing&#124;target&#124;replace&#124;...</code>
| <code>...&#124;mapping_by_invoking&#124;string&#124;replace&#124;4&#124;target&#124;replace&#124;&#124;false&#124;...</code>
|-
| <code>...&#124;mapping_by_replacing&#124;target&#124;replace&#124;count&#124;...</code>
| <code>...&#124;mapping_by_invoking&#124;string&#124;replace&#124;4&#124;target&#124;replace&#124;count&#124;false&#124;...</code>
|-
| <code>...&#124;mapping_by_replacing&#124;target&#124;replace&#124;plain&#124;...</code>
| <code>...&#124;mapping_by_invoking&#124;string&#124;replace&#124;2&#124;target&#124;replace&#124;...</code><br />or, equivalently,<br /><code>...&#124;mapping_by_invoking&#124;string&#124;replace&#124;4&#124;target&#124;replace&#124;&#124;true&#124;...</code>
|-
| <code>...&#124;mapping_by_replacing&#124;target&#124;replace&#124;count&#124;plain&#124;...</code>
| <code>...&#124;mapping_by_invoking&#124;string&#124;replace&#124;3&#124;target&#124;replace&#124;count&#124;...</code><br />or, equivalently,<br /><code>...&#124;mapping_by_invoking&#124;string&#124;replace&#124;4&#124;target&#124;replace&#124;count&#124;true&#124;...</code>
|}
 
There is not a corresponding translation for the <code>strict</code> flag in [[Module:String]]. However, as it goes with the <code>plain</code> flag, in that case you won't need <code>[[:mw:Extension:Scribunto/Lua reference manual#mw.ustring.gsub|mw.ustring.gsub()]]</code> in the first place.
 
For example,
 
<syntaxhighlight lang="wikitext">...|mapping_by_renaming|foo|bar|1|...</syntaxhighlight>
 
will be equivalent to writing
 
<syntaxhighlight lang="wikitext">...|mapping_by_invoking|string|replace|4|foo|bar|1|false|...</syntaxhighlight>
 
The first syntax, however, will be less computationally expensive.
 
At &#123;&#123;{{rel|Module:Params/doc/examples/informal tablebox}}&#125;&#125; you can find an example on how to exploit this function to create “informal” [[Template:Infobox|infoboxes]].
 
{{vpad|clear=none}}
 
{{A note}} The ''target'' and ''replace'' arguments passed to this modifier will not be trimmed of their leading and trailing spaces. The <code>or</code>, <code>plain</code>, <code>strict</code> and <code>pattern</code> keywords, the ''count'' argument, and the <code>mapping_by_replacing</code> modifier name itself, however, will be trimmed of their surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>mapping_by_mixing</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>mapping_by_mixing</code> <span style="nowrap">({{module:params/doc/link to the code|mapping_by_mixing|code}})</span>
| label1 = Num. of arguments | data1 = 1
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <!--<code>[[#mapping_to_names|mapping_to_names]]</code>, --><code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#renaming_by_calling|renaming_by_calling]]</code>, <code>[[#renaming_by_invoking|renaming_by_invoking]]</code>, <code>[[#renaming_by_magic|renaming_by_magic]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>, <code>[[#renaming_by_mixing|renaming_by_mixing]]</code><!--, <code>[[#renaming_to_values|renaming_to_values]]</code>-->, <code>[[#grouping_by_calling|grouping_by_calling]]</code>, <code>[[#mixing_names_and_values|mixing_names_and_values]]</code><!--, <code>[[#swapping_names_and_values|swapping_names_and_values]]</code>-->
}}
 
; Brief
: ''[[Map (higher-order function)|Map]] all parameter values replacing their current values with the expansion of a custom string containing the <code>$#</code> and <code>$@</code> placeholders''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mapping_by_mixing|mixing string|pipe function name}}</syntaxhighlight>
 
This modifier (temporarily) changes the content of the parameters the current template is being called with, replacing each of them with the expansion of a custom string that expects the same syntax as the <code>[[#for_each|for_each]]</code> function.
 
For instance, the following code will wrap all parameter values in quotes
 
<syntaxhighlight lang="wikitext">...|mapping_by_mixing|“$@”|...</syntaxhighlight>
 
whereas the following code will replace all values with the string <code>&#91;NAME::VALUE&#93;</code>, where <code>NAME</code> and <code>VALUE</code> are each parameter's name and value:
 
<syntaxhighlight lang="wikitext">...|mapping_by_mixing|[$#::$@]|...</syntaxhighlight>
<!--
If you need to map all parameters exactly matching their names, please use <code>[[#mapping_to_names|mapping_to_names]]</code>.
-->
{{vpad|clear=none}}
 
{{A note}} Both the ''mixing string'' argument and the <code>mapping_by_mixing</code> modifier name itself will be trimmed of their surrounding spaces.
 
{{vpad|1.5em|clear=none}}
<!--
=== <code>mapping_to_names</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>mapping_to_names</code> <span style="nowrap">({{module:params/doc/link to the code|mapping_to_names|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#mapping_by_mixing|mapping_by_mixing]]</code>, <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#renaming_by_calling|renaming_by_calling]]</code>, <code>[[#renaming_by_invoking|renaming_by_invoking]]</code>, <code>[[#renaming_by_magic|renaming_by_magic]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>, <code>[[#renaming_by_mixing|renaming_by_mixing]]</code>, <code>[[#renaming_to_values|renaming_to_values]]</code>, <code>[[#grouping_by_calling|grouping_by_calling]]</code>, <code>[[#mixing_names_and_values|mixing_names_and_values]]</code>, <code>[[#swapping_names_and_values|swapping_names_and_values]]</code>
}}
 
; Brief
: ''[[Map (higher-order function)|Map]] all parameter values, replacing the latter with their parameter name''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mapping_to_names|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
After calling this modifier, all parameters will have their value identical to their name. It is a shortcut for <code>...&#124;[[#mapping_by_mixing|mapping_by_mixing]]&#124;$#&#124;...</code>, but slightly more efficient.
 
{{vpad|clear=none}}
 
{{A note}} The <code>mapping_to_names</code> modifier name will be trimmed of its surrounding spaces.
 
{{vpad|1.5em|clear=none}}
-->
 
=== <code>converting_names_to_lowercase</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>converting_names_to_lowercase</code> <span style="nowrap">({{module:params/doc/link to the code|converting_names_to_lowercase|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#mapping_by_replacing|mapping_by_replacing]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>
}}
 
; Brief
: ''Convert all parameter names to lower case''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|converting_names_to_lowercase|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
This modifier converts all parameter names to lower [[Letter case|case]]. It is identical to writing <code>...&#124;[[#renaming_by_magic|renaming_by_magic]]&#124;[[:mw:Help:Magic words#lc|lc]]&#124;...</code>, but without the burden of calling a parser function.
 
{{A note}} In case of collisions between identical names, only one parameter, randomly chosen, will be left for a given name.
 
{{vpad|1.5em|clear=none}}
 
=== <code>converting_names_to_uppercase</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>converting_names_to_uppercase</code> <span style="nowrap">({{module:params/doc/link to the code|converting_names_to_uppercase|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#mapping_by_replacing|mapping_by_replacing]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>
}}
 
; Brief
: ''Convert all parameter names to upper case''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|converting_names_to_uppercase|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
This modifier converts all parameter names to upper [[Letter case|case]]. It is identical to writing <code>...&#124;[[#renaming_by_magic|renaming_by_magic]]&#124;[[:mw:Help:Magic words#uc|uc]]&#124;...</code>, but without the burden of calling a parser function.
 
{{A note}} In case of collisions between identical names, only one parameter, randomly chosen, will be left for a given name.
 
{{vpad|1.5em|clear=none}}
 
=== <code>renaming_by_calling</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>renaming_by_calling</code> <span style="nowrap">({{module:params/doc/link to the code|renaming_by_calling|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#mapping_by_replacing|mapping_by_replacing]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#renaming_by_invoking|renaming_by_invoking]]</code>, <code>[[#renaming_by_magic|renaming_by_magic]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>, <code>[[#grouping_by_calling|grouping_by_calling]]</code>
}}
 
; Brief
: ''Rename all parameters, replacing their former names with the expansion of a given template repeatedly called with at least one parameter (the parameter's former name)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|renaming_by_calling|template name|[call style]|[let]|[...]|[number of additional parameters]|[parameter 1]|[parameter 2]|[...]|[parameter N]|pipe function name}}</syntaxhighlight>
 
This modifier works similarly to <code>[[#mapping_by_calling|mapping_by_calling]]</code>, but instead of replacing parameters' values '''it renames the parameters themselves'''. Care must be used knowing that if a new name collides with another new name one of the two parameters will be removed without knowing which one. New names and old names do not create collisions. If a name is returned identical it will be considered as “unchanged” and in case of conflicts the renamed one will prevail. Possible leading and trailing spaces in the new names are always stripped. Here, if omitted, the ''call style flags'' argument defaults to <code>names_only</code>.
 
For instance, the following example uses {{tl|2x}} to rename all incoming parameters by doubling their names:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|setting|h/i/p/f|[|][|: |]|renaming_by_calling|2x|list}}</syntaxhighlight>
 
Same, but adding a hyphen in between:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|setting|h/i/p/f|[|][|: |]|renaming_by_calling|2x|1|-|list}}</syntaxhighlight>
 
The following example calls the {{Tl|P1}} template to rename all parameters using their value as their new name:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|renaming_by_calling|P1|values_only|for_each|[$#: $@]}}</syntaxhighlight>
 
This modifier can be particularly useful for sanitizing parameter names (e.g. collapsing several spaces into single spaces, changing the [[letter case]], and so on).
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this modifier except the <code>renaming_by_calling</code> modifier name itself, the ''template name'', the ''call style flag'', the <code>let</code> keyword, the passed parameter names, and the number of additional arguments will not be trimmed of their leading and trailing spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>renaming_by_invoking</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>renaming_by_invoking</code> <span style="nowrap">({{module:params/doc/link to the code|renaming_by_invoking|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#mapping_by_replacing|mapping_by_replacing]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#renaming_by_calling|renaming_by_calling]]</code>, <code>[[#renaming_by_magic|renaming_by_magic]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>, <code>[[#grouping_by_calling|grouping_by_calling]]</code>
}}
 
; Brief
: ''Rename all parameters, replacing their former names with the text returned by a given module function repeatedly called with at least one argument (the parameter's former name)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|renaming_by_invoking|module name|function name|[call style]|[let]|[...]|[number of additional arguments]|[argument 1]|[argument 2]|[...]|[argument N]|pipe function name}}</syntaxhighlight>
 
This modifier works similarly to <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, but instead of replacing parameters' values '''it renames the parameters themselves'''. Care must be used knowing that if a new name collides with another new name one of the two parameters will be removed without knowing which one. New names and old names do not create collisions. If a name is returned identical it will be considered as “unchanged” and in case of conflicts the renamed one will prevail. Possible leading and trailing spaces in the new names are always stripped. Here, if omitted, the ''call style flags'' argument defaults to <code>names_only</code>.
 
For instance, the following example uses {{mfl|string|replace}} to rename all parameters of type {{para|arg1}}, {{para|arg2}}, … {{para|argN}} into {{para|1}}, {{para|2}} … {{para|N}}, thus creating a novel sequence:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|setting|h/i/p/f|[|][|: |]|with_name_matching|^arg%d+$|renaming_by_invoking|string|replace|4|^arg(%d+)$|%1|1|false|list}}</syntaxhighlight>
 
This modifier can be particularly useful for sanitizing parameter names (e.g. collapsing several spaces into single spaces, changing the [[letter case]], and so on).
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this modifier except the <code>renaming_by_invoking</code> modifier name itself, the ''module name'', the ''function name'', the ''call style flag'', the <code>let</code> keyword, the passed parameter names, and the number of additional arguments will not be trimmed of their leading and trailing spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>renaming_by_magic</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>renaming_by_magic</code> <span style="nowrap">({{module:params/doc/link to the code|renaming_by_magic|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#mapping_by_replacing|mapping_by_replacing]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#renaming_by_calling|renaming_by_calling]]</code>, <code>[[#renaming_by_invoking|renaming_by_invoking]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>, <code>[[#grouping_by_calling|grouping_by_calling]]</code>
}}
 
; Brief
: ''Rename all parameters, replacing their former names with the text returned by a given parser function repeatedly called with at least one argument (the parameter's former name)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|renaming_by_magic|parser function|[call style]|[let]|[...]|[number of additional arguments]|[argument 1]|[argument 2]|[...]|[argument N]|pipe function name}}</syntaxhighlight>
 
This modifier works similarly to <code>[[#mapping_by_magic|mapping_by_magic]]</code>, but instead of replacing parameters' values '''it renames the parameters themselves'''. Care must be used knowing that if a new name collides with another new name one of the two parameters will be removed without knowing which one. New names and old names do not create collisions. If a name is returned identical it will be considered as “unchanged” and in case of conflicts the renamed one will prevail. Possible leading and trailing spaces in the new names are always stripped. Here, if omitted, the ''call style flags'' argument defaults to <code>names_only</code>.
 
For instance, the following example uses &#123;&#123;[[:mw:Special:MyLanguage/expr##expr|#expr]]&#125;&#125; to transform all numeric parameters into even numbers (you can replace the expression <code>%0 * 2</code> with any other expression):
 
<syntaxhighlight lang="wikitext">{{#invoke:params|all_sorted|excluding_non-numeric_names|renaming_by_replacing|^.*$|%0 * 2|1|renaming_by_magic|#expr|setting|h/i/p/f|[|][|: |]|list}}</syntaxhighlight>
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this modifier except the <code>renaming_by_magic</code> modifier name itself, the ''parser function name'', the ''call style flag'', the <code>let</code> keyword, the passed parameter names, and the number of additional arguments will not be trimmed of their leading and trailing spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>renaming_by_replacing</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>renaming_by_replacing</code> <span style="nowrap">({{module:params/doc/link to the code|renaming_by_replacing|code}})</span>
| label1 = Num. of arguments | data1 = 2–4
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#mapping_by_mixing|mapping_by_mixing]]</code>, <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#mapping_by_replacing|mapping_by_replacing]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#renaming_by_calling|renaming_by_calling]]</code>, <code>[[#renaming_by_invoking|renaming_by_invoking]]</code>, <code>[[#renaming_by_magic|renaming_by_magic]]</code>, <code>[[#renaming_by_mixing|renaming_by_mixing]]</code>, <code>[[#grouping_by_calling|grouping_by_calling]]</code>, <code>[[#mixing_names_and_values]]</code>
}}
 
; Brief
: ''Rename all parameters, replacing their former names with the text returned by a [[String operations#String substitution|string substitutions]]''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|renaming_by_replacing|target|replace|[count]|[plain flag]|pipe function name}}</syntaxhighlight>
 
This modifier works similarly to <code>[[#mapping_by_replacing|mapping_by_replacing]]</code>, but instead of replacing parameters' values '''it renames the parameters themselves'''. Care must be used knowing that if a new name collides with another new name one of the two parameters will be removed without knowing which one. New names and old names do not create collisions. If a name is returned identical it will be considered as “unchanged” and in case of conflicts the renamed one will prevail. Possible leading and trailing spaces in the new names are always stripped (however they are not stripped while searching for the name to replace).
 
Since there can be only one parameter name that matches exactly a literal string, when used with the <code>strict</code> flag this modifier directly accesses the requested key without looping through the entire list of parameters (so it will be much faster).
 
For instance, the following example renames all parameters of type {{para|arg1}}, {{para|arg2}}, … {{para|argN}} into {{para|1}}, {{para|2}} … {{para|N}}, thus creating a novel sequence:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|setting|h/i/p/f|[|][|: |]|with_name_matching|^arg%d+$|renaming_by_replacing|^arg(%d+)$|%1|1|list}}</syntaxhighlight>
 
This modifier can be particularly useful for sanitizing parameter names (e.g. collapsing several spaces into single spaces, changing the [[letter case]], and so on).
 
For performance reasons this modifier uses <code>[[:mw:Extension:Scribunto/Lua reference manual#string.gsub|string.gsub()]]</code>; if you need to use <code>[[:mw:Extension:Scribunto/Lua reference manual#mw.ustring.gsub|mw.ustring.gsub()]]</code> instead, you will need to invoke the <code>[[Module:String#replace|replace]]</code> function from [[Module:String]] via <code>...&#124;[[#renaming_by_invoking|renaming_by_invoking]]&#124;[[Module:String|string]]&#124;[[Module:String#replace|replace]]&#124;...</code>.
 
The following table shows examples of equivalent instructions. Please be aware that invoking <code>[[:mw:Extension:Scribunto/Lua reference manual#mw.ustring.gsub|mw.ustring.gsub()]]</code> can be much slower.
 
{| class="wikitable"
|-
! <code>[[:mw:Extension:Scribunto/Lua reference manual#string.gsub|string.gsub()]]</code>
! <code>[[:mw:Extension:Scribunto/Lua reference manual#mw.ustring.gsub|mw.ustring.gsub()]]</code> (via [[Module:String]])
|-
| <code>...&#124;renaming_by_replacing&#124;target&#124;replace&#124;...</code>
| <code>...&#124;renaming_by_invoking&#124;string&#124;replace&#124;4&#124;target&#124;replace&#124;&#124;false&#124;...</code>
|-
| <code>...&#124;renaming_by_replacing&#124;target&#124;replace&#124;count&#124;...</code>
| <code>...&#124;renaming_by_invoking&#124;string&#124;replace&#124;4&#124;target&#124;replace&#124;count&#124;false&#124;...</code>
|-
| <code>...&#124;renaming_by_replacing&#124;target&#124;replace&#124;plain&#124;...</code>
| <code>...&#124;renaming_by_invoking&#124;string&#124;replace&#124;2&#124;target&#124;replace&#124;...</code><br />or, equivalently,<br /><code>...&#124;renaming_by_invoking&#124;string&#124;replace&#124;4&#124;target&#124;replace&#124;&#124;true&#124;...</code>
|-
| <code>...&#124;renaming_by_replacing&#124;target&#124;replace&#124;count&#124;plain&#124;...</code>
| <code>...&#124;renaming_by_invoking&#124;string&#124;replace&#124;3&#124;target&#124;replace&#124;count&#124;...</code><br />or, equivalently,<br /><code>...&#124;renaming_by_invoking&#124;string&#124;replace&#124;4&#124;target&#124;replace&#124;count&#124;true&#124;...</code>
|}
 
There is not a corresponding translation for the <code>strict</code> flag in [[Module:String]]. However, as it goes with the <code>plain</code> flag, in that case you won't need <code>[[:mw:Extension:Scribunto/Lua reference manual#mw.ustring.gsub|mw.ustring.gsub()]]</code> in the first place.
 
{{vpad|clear=none}}
 
{{A note}} The ''target'' and ''replace'' arguments passed to this modifier will not be trimmed of their leading and trailing spaces. The <code>or</code>, <code>plain</code>, <code>strict</code> and <code>pattern</code> keywords, the ''count'' argument, and the <code>mapping_by_replacing</code> modifier name itself, however, will be trimmed of their surrounding spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>renaming_by_mixing</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>renaming_by_mixing</code> <span style="nowrap">({{module:params/doc/link to the code|renaming_by_mixing|code}})</span>
| label1 = Num. of arguments | data1 = 1
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <!--<code>[[#mapping_to_names|mapping_to_names]]</code>, --><code>[[#mapping_by_mixing|mapping_by_mixing]]</code>, <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#renaming_by_calling|renaming_by_calling]]</code>, <code>[[#renaming_by_invoking|renaming_by_invoking]]</code>, <code>[[#renaming_by_magic|renaming_by_magic]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code><!--, <code>[[#renaming_to_values|renaming_to_values]]</code>-->, <code>[[#grouping_by_calling|grouping_by_calling]]</code>, <code>[[#mixing_names_and_values|mixing_names_and_values]]</code><!--, <code>[[#swapping_names_and_values|swapping_names_and_values]]</code>-->
}}
 
; Brief
: ''Rename all parameters, replacing their former names with the expansion of a custom string containing the <code>$#</code> and <code>$@</code> placeholders''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|renaming_by_mixing|mixing string|pipe function name}}</syntaxhighlight>
 
This modifier (temporarily) changes the content of the parameters the current template is being called with, replacing each of them with the expansion of a custom string that expects the same syntax as the <code>[[#for_each|for_each]]</code> function.
 
For instance, the following code will wrap all parameter names in quotes
 
<syntaxhighlight lang="wikitext">...|renaming_by_mixing|“$#”|...</syntaxhighlight>
 
whereas the following code will replace all parameter names with the string <code>&#91;NAME::VALUE&#93;</code>, where <code>NAME</code> and <code>VALUE</code> are each parameter's name and value:
 
<syntaxhighlight lang="wikitext">...|renaming_by_mixing|[$#::$@]|...</syntaxhighlight>
<!--
If you need to rename all parameters exactly matching their values, please use <code>[[#renaming_to_values|renaming_to_values]]</code>.
-->
{{vpad|clear=none}}
 
{{A note}} The ''mixing string'' argument passed to this modifier will not be trimmed of its leading and trailing spaces. The <code>renaming_by_mixing</code> modifier name itself, however, will be trimmed of their surrounding spaces.
 
{{vpad|1.5em|clear=none}}
<!--
=== <code>renaming_to_values</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>renaming_to_values</code> <span style="nowrap">({{module:params/doc/link to the code|renaming_to_values|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#mapping_to_names|mapping_to_names]]</code>, <code>[[#mapping_by_mixing|mapping_by_mixing]]</code>, <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#renaming_by_calling|renaming_by_calling]]</code>, <code>[[#renaming_by_invoking|renaming_by_invoking]]</code>, <code>[[#renaming_by_magic|renaming_by_magic]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>, <code>[[#renaming_by_mixing|renaming_by_mixing]]</code>, <code>[[#grouping_by_calling|grouping_by_calling]]</code>, <code>[[#mixing_names_and_values|mixing_names_and_values]]</code>, <code>[[#swapping_names_and_values|swapping_names_and_values]]</code>
}}
 
; Brief
: ''Rename all parameters, replacing their name with their current value''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|renaming_to_values|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
After calling this modifier, all parameters will have their name identical to their value. It is a shortcut for <code>...&#124;[[#renaming_by_mixing|renaming_by_mixing]]&#124;$@&#124;...</code>, but slightly more efficient.
 
{{vpad|clear=none}}
 
{{A note}} The <code>renaming_to_values</code> modifier name will be trimmed of its surrounding spaces.
 
{{vpad|1.5em|clear=none}}
-->
=== <code>grouping_by_calling</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>grouping_by_calling</code> <span style="nowrap">({{module:params/doc/link to the code|grouping_by_calling|code}})</span>
| label1 = Num. of arguments | data1 = ''Ad libitum''
| label2 = Repeatable | data2 = Yes<ref>Unless followed by <code>[[#renaming_by_replacing|renaming_by_replacing]]</code> in few bizarre situations, there is virtually no use in calling this modifier more than once.</ref>
| header3 = See also
| data4 = <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#call_for_each_group|call_for_each_group]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#mapping_by_replacing|mapping_by_replacing]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#renaming_by_calling|renaming_by_calling]]</code>, <code>[[#renaming_by_invoking|renaming_by_invoking]]</code>, <code>[[#renaming_by_magic|renaming_by_magic]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>
}}
 
; Brief
: ''Group the parameters that have the same numeric suffix into novel parameters, whose names will be numbers and whose values will be decided by a custom template''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|grouping_by_calling|template name|[let]|[...]|[number of additional arguments]|[argument 1]|[argument 2]|[...]|[argument N]|pipe function name}}</syntaxhighlight>
 
This is the piping version of <code>[[#call_for_each_group|call_for_each_group]]</code>. This means that after calling this modifier the old parameters will be (temporarily) gone and the only parameters left will be novel parameters whose names will be numbers (or an empty string if parameters without a numeric suffix were present) and whose content will be decided by a custom template.
 
Like other modifiers in the <code>mapping_*</code> and <code>renaming_*</code> family, it is possible to impose own parameters on the callback template by using the syntax <code>...|[let]|[...]|[number of additional arguments]|[argument 1]|[argument 2]|[...]|[argument N]|...</code>. Unlike the other <code>mapping_*</code> and <code>renaming_*</code> modifiers, however (but like <code>[[#call_for_each_group|call_for_each_group]]</code>), sequential parameters here will not be prepended, but will ''replace'' possible parsed parameters.
 
And so, writing
 
<syntaxhighlight lang="wikitext">{{#invoke:params|...|grouping_by_calling|MY TEMPLATE|let|foo|bar|let|hello|world|3|one|two|three|list_values}}</syntaxhighlight>
 
is identical to writing
 
<syntaxhighlight lang="wikitext">{{#invoke:params|...|call_for_each_group|MY TEMPLATE|foo=bar|hello=world|one|two|three}}</syntaxhighlight>
 
In the example above the main difference will be that the first solution will allow to pass the newly grouped parameters at once to another template or module (via <code>[[#concat_and_call|concat_and_call]]</code> or <code>[[#concat_and_invoke|concat_and_invoke]]</code>) or, if needed, perform further fine-tuning operations concerning the new parameters.
 
Please refer to the documentation of <code>[[#call_for_each_group|call_for_each_group]]</code> for further information on the parameters passed to the callback template.
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this modifier except the <code>grouping_by_calling</code> modifier name itself, the ''template name'', the <code>let</code> keyword, the passed parameter names, and the number of additional parameters will not be trimmed of their leading and trailing spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>parsing</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>parsing</code> <span style="nowrap">({{module:params/doc/link to the code|parsing|code}})</span>
| label1 = Num. of arguments | data1 = 1–6
| label2 = Repeatable | data2 = Yes
| label3 = Often accompanied by | data3 = <code>[[#new|new]]</code>
| header4 = See also
| data5 = <code>[[#new|new]]</code>, <code>{{mfl|ArrayList}}</code>, <code>{{tl|Array}}</code>
}}
 
; Brief
: ''Create new parameters by parsing a parameter string''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|parsing|string to parse|[trim flag]|[iteration delimiter setter]|[...]|[key-value delimiter setter]|[...]|pipe function name}}</syntaxhighlight>
 
This modifier allows to add an infinity of new parameters by using a parameter string. By default this expects <code>&#124;</code> as separator between parameters and <code>&#61;</code> as separator between keys and values, but it is possible to specify other strings or patterns. The parsed parameters will overwrite existing parameters of the same name. For this reason, the <code>[[#new|new]]</code> directive often accompanies this modifier.
 
Examples:
 
* <syntaxhighlight lang="wikitext" inline>{{#invoke:params|new|parsing|one{{!}}two{{!}}three{{!}}foo{{=}}bar{{!}}hello{{=}}world|for_each|[$#:$@]}}</syntaxhighlight>
*: ↳ {{#invoke:params|new|parsing|one{{!}}two{{!}}three{{!}}foo{{=}}bar{{!}}hello{{=}}world|for_each|[$#:$@]}}
* <syntaxhighlight lang="wikitext" inline>{{#invoke:params|new|parsing|one, two; three. foo: bar, hello: world|trim_all|splitter_pattern|[,;.]|setter_string|:|for_each|[$#:$@]}}</syntaxhighlight>
*: ↳ {{#invoke:params|new|parsing|one, two; three. foo: bar, hello: world|trim_all|splitter_pattern|[,;.]|setter_string|:|for_each|[$#:$@]}}
* <syntaxhighlight lang="wikitext" inline>{{#invoke:params|new|parsing|one/two/ three / foo % bar /hello%world|setter_string|%|trim_none|splitter_string|/|for_each|[$#:$@]}}</syntaxhighlight>
*: ↳ {{#invoke:params|new|parsing|one/two/ three / foo % bar /hello%world|setter_string|%|trim_none|splitter_string|/|for_each|[$#:$@]}}
 
The ''trim flag'' argument can be placed in any position after the ''string to parse'' (not necessarily in second position) and can have one of the following values: <code>trim_none</code>, <code>trim_named</code>, <code>trim_positional</code>, <code>trim_all</code>. If omitted, it defaults to <code>trim_named</code>.
 
The ''iteration delimiter setter'' can be placed in any position after the ''string to parse'' (not necessarily in third position), must be ''immediately'' followed by a user-given string, and can be either <code>splitter_string</code> or <code>splitter_pattern</code>. If omitted, the two arguments default to <code>splitter_string&#124;&#123;&#123;!&#125;&#125;</code>. If the custom string is empty (but not if it is blank but not empty) the string to parse will be assumed not to have any iteration delimiters (this will result in one single parameter being parsed).
 
The ''key-value delimiter setter'' can be placed in any position after the ''string to parse'' (not necessarily in fifth position), must be ''immediately'' followed by a user-given string, and can be either <code>setter_string</code> or <code>setter_pattern</code>. If omitted, the two arguments default to <code>setter_string&#124;&#123;&#123;&#61;&#125;&#125;</code>. If the custom string is empty (but not if it is blank but not empty) the string to parse will be assumed not to have any key-value delimiters (this will result in a sequence-only list of parameters being parsed).
 
{| class="wikitable" style="margin-left: auto; margin-right: auto;"
|+ Possible options
|-
! Setting a trim flag
! Setting an iteration delimiter
! Setting a key-value delimiter
|-
| <code>trim_none</code><br /> <code>trim_named</code><br /> <code>trim_positional</code><br /> <code>trim_all</code>
| <code>splitter_string&#124;...</code><br /> <code>splitter_pattern&#124;...</code>
| <code>setter_string&#124;...</code><br /> <code>setter_pattern&#124;...</code>
|}
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this modifier except the <code>parsing</code> modifier name itself, the ''trim flag'', ''iteration delimiter setter'' and ''key-value delimiter setter'' arguments will not be trimmed of their leading and trailing spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>reinterpreting</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>reinterpreting</code> <span style="nowrap">({{module:params/doc/link to the code|reinterpreting|code}})</span>
| label1 = Num. of arguments | data1 = 1–6
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#parsing|parsing]]</code>, <code>{{mfl|ArrayList}}</code>, <code>{{tl|Array}}</code>
}}
 
; Brief
: ''Use the content of a parameter as a parameter string to parse, after removing the parameter itself''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|reinterpreting|parameter name|[trim flag]|[iteration delimiter setter]|[...]|[key-value delimiter setter]|[...]|pipe function name}}</syntaxhighlight>
 
This modifier works exactly like <code>[[#parsing|parsing]]</code>, but takes the content of a disposable parameter as input. See there for further information. The parameter passed to this modifier will be immediately deleted. The parsed parameters will overwrite existing parameters of the same name.
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|trimmednew|0pulling|21|sequentialreinterpreting|call_for_each_value1|examplesplitter_string|,|trim_all|concat_and_call|See templatealso}}</syntaxhighlight>
 
An example that shows how to use this function to transclude a custom template with custom parameters is available at &#123;&#123;{{rel|Module:Params/doc/examples/constructed transclusion}}&#125;&#125;.
 
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this modifier except the <code>reinterpreting</code> modifier name itself, the ''parameter name'', the ''trim flag'', ''iteration delimiter setter'' and ''key-value delimiter setter'' arguments will not be trimmed of their leading and trailing spaces.
 
{{vpad|1.5em|clear=none}}
 
=== <code>mixing_names_and_values</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>mixing_names_and_values</code> <span style="nowrap">({{module:params/doc/link to the code|mixing_names_and_values|code}})</span>
| label1 = Num. of arguments | data1 = 2
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <!--<code>[[#mapping_to_names|mapping_to_names]]</code>, --><code>[[#mapping_by_mixing|mapping_by_mixing]]</code>, <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#renaming_by_calling|renaming_by_calling]]</code>, <code>[[#renaming_by_invoking|renaming_by_invoking]]</code>, <code>[[#renaming_by_magic|renaming_by_magic]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>, <code>[[#renaming_by_mixing|renaming_by_mixing]]</code><!--, <code>[[#renaming_to_values|renaming_to_values]]</code>-->, <code>[[#grouping_by_calling|grouping_by_calling]]</code><!--, <code>[[#swapping_names_and_values|swapping_names_and_values]]</code>-->
}}
 
; Brief
: ''Rewrite all parameters, replacing names and values with the expansion of two custom strings containing the <code>$#</code> and <code>$@</code> placeholders''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mixing_names_and_values|name mixing string|value mixing string|pipe function name}}</syntaxhighlight>
 
This modifier (temporarily) changes names and values of the parameters the current template is being called with, replacing each of them with the expansion of two custom strings that expect the same syntax as the <code>[[#for_each|for_each]]</code> function.
 
For instance, the following code will wrap all parameter names and values in quotes
 
<syntaxhighlight lang="wikitext">...|mixing_names_and_values|“$#”|“$@”|...</syntaxhighlight>
 
whereas the following code will replace all names with the string <code>VALUE/NAME</code> and all values with the string <code>&#91;NAME::VALUE&#93;</code>, where <code>NAME</code> and <code>VALUE</code> are each parameter's name and value:
 
<syntaxhighlight lang="wikitext">...|mixing_names_and_values|$@/$#|[$#::$@]|...</syntaxhighlight>
<!--
If you need to swap names and values verbatim, please use <code>[[#swapping_names_and_values|swapping_names_and_values]]</code>.
-->
{{vpad|clear=none}}
 
{{A note}} The ''value mixing string'' argument passed to this modifier will not be trimmed of its leading and trailing spaces. The ''name mixing string'' argument and <code>mixing_names_and_values</code> modifier name itself, however, will be trimmed of their surrounding spaces.
 
{{vpad|1.5em|clear=none}}
<!--
=== <code>swapping_names_and_values</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>swapping_names_and_values</code> <span style="nowrap">({{module:params/doc/link to the code|swapping_names_and_values|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#mapping_to_names|mapping_to_names]]</code>, <code>[[#mapping_by_mixing|mapping_by_mixing]]</code>, <code>[[#converting_values_to_lowercase|converting_values_to_lowercase]]</code>, <code>[[#converting_values_to_uppercase|converting_values_to_uppercase]]</code>, <code>[[#mapping_by_calling|mapping_by_calling]]</code>, <code>[[#mapping_by_invoking|mapping_by_invoking]]</code>, <code>[[#mapping_by_magic|mapping_by_magic]]</code>, <code>[[#converting_names_to_lowercase|converting_names_to_lowercase]]</code>, <code>[[#converting_names_to_uppercase|converting_names_to_uppercase]]</code>, <code>[[#renaming_by_calling|renaming_by_calling]]</code>, <code>[[#renaming_by_invoking|renaming_by_invoking]]</code>, <code>[[#renaming_by_magic|renaming_by_magic]]</code>, <code>[[#renaming_by_replacing|renaming_by_replacing]]</code>, <code>[[#renaming_by_mixing|renaming_by_mixing]]</code>, <code>[[#renaming_to_values|renaming_to_values]]</code>, <code>[[#grouping_by_calling|grouping_by_calling]]</code>, <code>[[#mixing_names_and_values|mixing_names_and_values]]</code>
}}
 
; Brief
: ''Rewrite all parameters swapping their names and values''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|swapping_names_and_values|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
This modifier is a shortcut for <code>...&#124;[[#mixing_names_and_values|mixing_names_and_values]]&#124;$@&#124;$#&#124;...</code>, but slightly more efficient.
 
{{vpad|clear=none}}
 
{{A note}} The <code>swapping_names_and_values</code> modifier name will be trimmed of its surrounding spaces.
 
{{vpad|1.5em|clear=none}}
-->
 
=== <code>combining_by_calling</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>combining_by_calling</code> <span style="nowrap">({{module:params/doc/link to the code|combining_by_calling|code}})</span>
| label1 = Num. of arguments | data1 = 2
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#entering_substack|entering_substack]]</code>, <code>[[#snapshotting|snapshotting]]</code>, <code>[[#remembering|remembering]]</code>, <code>[[#concat_and_call|concat_and_call]]</code>
}}
 
; Brief
: ''Pass all current parameters to a custom template and save the returned output as a new parameter''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|combining_by_calling|template name|new parameter name|pipe function name}}</syntaxhighlight>
 
This is the piping version of <code>[[#concat_and_call|concat_and_call]]</code>. This means that after calling this modifier the old parameters will be (temporarily) gone and the only parameter left will be what is specified in the ''new parameter name'' argument.
 
Since after using this modifier all parameters will be grouped into one single parameter, to pass additional parameters to the callback template you can safely use <code>[[#imposing|imposing]]</code> or <code>[[#parsing|parsing]]</code>.
 
For instance, using {{rel|Module:Params/testcases/tdummy echo sb}} as callback template, a template named <syntaxhighlight lang="wikitext" inline>{{example template}}</syntaxhighlight> with the following content,
 
<syntaxhighlight lang="wikitext">{{#invoke:params|combining_by_calling|module:params/testcases/tdummy echo sb|my_new_param|for_each|[$#:$@]}}</syntaxhighlight>
 
when transcluded as <syntaxhighlight lang="wikitext" inline>{{example template|one|two|three|hello=world|foo=bar}}</syntaxhighlight> will produce
 
: {{#invoke:params|new|
imposing|1|one|
imposing|2|two|
imposing|3|three|
imposing|hello|world|
imposing|foo|bar|
combining_by_calling|module:params/testcases/tdummy echo sb|my_new_param|for_each|[$#:$@]}}
 
{{vpad|1.5em|clear=none}}
 
=== <code>snapshotting</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>snapshotting</code> <span style="nowrap">({{module:params/doc/link to the code|snapshotting|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| label3 = Eventually followed by | data3 = Either <code>[[#entering_substack|entering_substack]]</code> or <code>[[#flushing|flushing]]</code>
| header4 = See also
| data5 = <code>[[#remembering|remembering]]</code>, <code>[[#entering_substack|entering_substack]]</code>, <code>[[#pulling|pulling]]</code>, <code>[[#merging_substack|merging_substack]]</code>, <code>[[#detaching_substack|detaching_substack]]</code>, <code>[[#leaving_substack|leaving_substack]]</code>, <code>[[#flushing|flushing]]</code>
}}
 
; Brief
: ''Push a copy of the current parameter list to the queue of parameter lists''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|snapshotting|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
This module has a stacking mechanism that allows to isolate groups of parameters, work separately on them, and then merge them back to the original stack. The modifiers dedicated to this mechanism are:
 
* <code>[[#snapshotting|snapshotting]]</code>
* <code>[[#remembering|remembering]]</code>
* <code>[[#entering_substack|entering_substack]]</code>
* <code>[[#pulling|pulling]]</code>
* <code>[[#detaching_substack|detaching_substack]]</code>
* <code>[[#leaving_substack|leaving_substack]]</code>
* <code>[[#merging_substack|merging_substack]]</code>
* <code>[[#flushing|flushing]]</code>
 
Every time the <code>snapshotting</code> modifier is used, the current list of parameters (together with their values) will be copied and added to a queue. When the <code>[[#entering_substack|entering_substack]]</code> modifier is used, the list of parameters on top of the queue will temporarily become the current parameters, and all other modifiers will affect only this substack. After completing the job, the <code>[[#merging_substack|merging_substack]]</code> will merge the current substack to the parent stack.
 
If no parameter lists have been snapshotted before calling <code>[[#entering_substack|entering_substack]]</code>, the latter will automatically make a snapshot of the current parameters. Once inside a substack, it is possible to enter a subsubstack using the same machinery.
 
The <code>[[#detaching_substack|detaching_substack]]</code> modifier erases the current parameters from the parent stack, allowing the current stack to rename its parameters freely and merge them back to the parent stack, renamed.
 
It is possible to leave a substack without merging it to the parent by using the <code>[[#leaving_substack|leaving_substack]]</code> modifier. In this case, at some point it will be necessary to call <code>[[#flushing|flushing]]</code> in order to merge the stack previously left unmerged. Alternatively, it will be possible to enter it again by calling <code>[[#entering_substack|entering_substack]]</code>, and finally merge it via <code>[[#merging_substack|merging_substack]]</code>.
 
An example will probably clarify the mechanism better than anything else:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|new|<!-- Ignore the incoming parameters and manually assign some parameters (we will simulate the following incoming parameters: |one|two|three|four|foo=bar|hello=world ...) -->
imposing|1|one|
imposing|2|two|
imposing|3|three|
imposing|4|four|
imposing|foo|bar|
imposing|hello|world|
entering_substack|<!-- Enter into a substack (the `snapshotting` modifier will be automatically invoked for us) -->
excluding_numeric_names|<!-- Exclude numeric parameters -->
detaching_substack|<!-- Remove the current parameters from the parent stack -->
renaming_by_replacing|^.*$|This was called “%0”|1|<!-- Rename all parameters -->
merging_substack|
entering_substack|new|<!-- Enter into a new empty substack -->
pulling|1|<!-- Pull the parameter named “1” from the parent stack -->
mapping_by_replacing|^.*$|This value once was “%0”|1|<!-- Replace the content of all parameters -->
merging_substack|
for_each|[$#:$@]}}</syntaxhighlight>
 
The code above will result in:
 
: {{#invoke:params|new|<!-- Ignore the incoming parameters and manually assign some parameters (we will simulate the following incoming parameters: |one|two|three|four|foo=bar|hello=world ...) -->
imposing|1|one|
imposing|2|two|
imposing|3|three|
imposing|4|four|
imposing|foo|bar|
imposing|hello|world|
entering_substack|<!-- Enter into a substack (the `snapshotting` modifier will be automatically invoked for us) -->
excluding_numeric_names|<!-- Exclude numeric parameters -->
detaching_substack|<!-- Remove the current parameters from the parent stack -->
renaming_by_replacing|^.*$|This was called “%0”|1|<!-- Rename all parameters -->
merging_substack|
entering_substack|new|<!-- Enter into a new empty substack -->
pulling|1|<!-- Pull the parameter named “1” from the parent stack -->
mapping_by_replacing|^.*$|This value once was “%0”|1|<!-- Replace the content of all parameters -->
merging_substack|
for_each|[$#:$@]}}
 
{{vpad|1.5em|clear=none}}
 
=== <code>remembering</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>remembering</code> <span style="nowrap">({{module:params/doc/link to the code|remembering|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| label3 = Eventually followed by | data3 = Either <code>[[#entering_substack|entering_substack]]</code> or <code>[[#flushing|flushing]]</code>
| header4 = See also
| data5 = <code>[[#snapshotting|snapshotting]]</code>, <code>[[#entering_substack|entering_substack]]</code>, <code>[[#pulling|pulling]]</code>, <code>[[#merging_substack|merging_substack]]</code>, <code>[[#detaching_substack|detaching_substack]]</code>, <code>[[#leaving_substack|leaving_substack]]</code>, <code>[[#flushing|flushing]]</code>
}}
 
; Brief
: ''Push a copy of the original (unmodified) parameter list to the queue of snapshots''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|remembering|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
This modifier is somewhat similar to <code>[[#snapshotting|snapshotting]]</code>, except that it retrieves the parameters that were originally passed to the calling template before being affected by the module's modifiers. The modifier works also after the <code>[[#new|new]]</code> directive. See <code>[[#snapshotting|snapshotting]]</code> for more information on the stacking mechanism.
 
{{vpad|1.5em|clear=none}}
 
=== <code>entering_substack</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>entering_substack</code> <span style="nowrap">({{module:params/doc/link to the code|entering_substack|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| label3 = May be immediately followed by | data3 = <code>[[#new|new]]</code>
| label4 = Eventually followed by | data4 = Either <code>[[#merging_substack|merging_substack]]</code> or <code>[[#leaving_substack|leaving_substack]]</code> followed by <code>[[#flushing|flushing]]</code>
| header5 = See also
| data6 = <code>[[#snapshotting|snapshotting]]</code>, <code>[[#remembering|remembering]]</code>, <code>[[#pulling|pulling]]</code>, <code>[[#merging_substack|merging_substack]]</code>, <code>[[#detaching_substack|detaching_substack]]</code>, <code>[[#leaving_substack|leaving_substack]]</code>, <code>[[#flushing|flushing]]</code>
}}
 
; Brief
: ''Enter the first stack in the queue of parameter lists, or copy the current parameters into a substack if the queue is empty''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|entering_substack|[new]|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
See <code>[[#snapshotting|snapshotting]]</code> for more information on the stacking mechanism. Once in a substack, it is possible to go back to the parent stack using two different modifiers: <code>[[#merging_substack|merging_substack]]</code> and <code>[[#leaving_substack|leaving_substack]]</code>.
 
{{vpad|1.5em|clear=none}}
 
=== <code>pulling</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>pulling</code> <span style="nowrap">({{module:params/doc/link to the code|pulling|code}})</span>
| label1 = Num. of arguments | data1 = 1
| label2 = Repeatable | data2 = Yes
| label3 = Often preceeded by | data3 = <code>[[#new|new]]</code>
| header4 = See also
| data5 = <code>[[#snapshotting|snapshotting]]</code>, <code>[[#remembering|remembering]]</code>, <code>[[#merging_substack|merging_substack]]</code>, <code>[[#detaching_substack|detaching_substack]]</code>, <code>[[#leaving_substack|leaving_substack]]</code>, <code>[[#flushing|flushing]]</code>
}}
 
; Brief
: ''Pull a single parameter from the parent stack or from the stack of the original parameters''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|pulling|parameter name|pipe function name}}</syntaxhighlight>
 
See <code>[[#snapshotting|snapshotting]]</code> for more information on the stacking mechanism. If this modifer is not used in a substack, the parameter will be pulled from the original (unmodified) parameter list.
 
{{vpad|1.5em|clear=none}}
 
=== <code>detaching_substack</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>detaching_substack</code> <span style="nowrap">({{module:params/doc/link to the code|detaching_substack|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| label3 = Restrictions | data3 = Usable only inside substacks
| header4 = See also
| data5 = <code>[[#snapshotting|snapshotting]]</code>, <code>[[#remembering|remembering]]</code>, <code>[[#entering_substack|entering_substack]]</code>, <code>[[#pulling|pulling]]</code>, <code>[[#merging_substack|merging_substack]]</code>, <code>[[#leaving_substack|leaving_substack]]</code>, <code>[[#flushing|flushing]]</code>
}}
 
; Brief
: ''Remove from the parent stack the parameters that are present in the current stack''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|detaching_substack|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
This modifer can only be used in a substack. See <code>[[#snapshotting|snapshotting]]</code> for more information on the stacking mechanism.
 
{{vpad|1.5em|clear=none}}
 
=== <code>leaving_substack</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>leaving_substack</code> <span style="nowrap">({{module:params/doc/link to the code|leaving_substack|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| label3 = Restrictions | data3 = Usable only inside substacks
| header4 = See also
| data5 = <code>[[#snapshotting|snapshotting]]</code>, <code>[[#remembering|remembering]]</code>, <code>[[#entering_substack|entering_substack]]</code>, <code>[[#pulling|pulling]]</code>, <code>[[#merging_substack|merging_substack]]</code>, <code>[[#detaching_substack|detaching_substack]]</code>, <code>[[#flushing|flushing]]</code>
}}
 
; Brief
: ''Leave the current substack without merging it, and return to the parent stack''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|leaving_substack|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
This modifer can only be used in a substack. See <code>[[#snapshotting|snapshotting]]</code> for more information on the stacking mechanism.
 
See <code>[[#flushing|flushing]]</code> for an example of how to use this modifier.
 
{{vpad|1.5em|clear=none}}
 
=== <code>merging_substack</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>merging_substack</code> <span style="nowrap">({{module:params/doc/link to the code|merging_substack|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| label3 = Restrictions | data3 = Usable only inside substacks
| header4 = See also
| data5 = <code>[[#snapshotting|snapshotting]]</code>, <code>[[#remembering|remembering]]</code>, <code>[[#entering_substack|entering_substack]]</code>, <code>[[#pulling|pulling]]</code>, <code>[[#detaching_substack|detaching_substack]]</code>, <code>[[#leaving_substack|leaving_substack]]</code>, <code>[[#flushing|flushing]]</code>
}}
 
; Brief
: ''Leave the current stack after merging it with the parent stack, then return to the latter''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|merging_substack|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
This modifer can only be used in a substack. See <code>[[#snapshotting|snapshotting]]</code> for more information on the stacking mechanism.
 
{{vpad|1.5em|clear=none}}
 
=== <code>flushing</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>flushing</code> <span style="nowrap">({{module:params/doc/link to the code|flushing|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = Yes
| header3 = See also
| data4 = <code>[[#snapshotting|snapshotting]]</code>, <code>[[#remembering|remembering]]</code>, <code>[[#entering_substack|entering_substack]]</code>, <code>[[#pulling|pulling]]</code>, <code>[[#merging_substack|merging_substack]]</code>, <code>[[#detaching_substack|detaching_substack]]</code>, <code>[[#leaving_substack|leaving_substack]]</code>
}}
 
; Brief
: ''Merge the first stack in the queue of snapshotted parameters with the current stack.''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|flushing|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
This modifier is used in conjunction with either <code>[[#leaving_substack|leaving_substack]]</code> or <code>[[#snapshotting|snapshotting]]</code>. See <code>[[#snapshotting|snapshotting]]</code> for more information on the stacking mechanism.
 
In the following wrapper of an <syntaxhighlight lang="wikitext" inline>{{example template}}</syntaxhighlight>, the three parameters {{para|1}}, {{para|2}}, and {{para|3}} are used as aliases for {{para|title}}, {{para|author}}, and {{para|language}} respectively. The <code>flushing</code> modifier ensures that in case both are present, the named alias will have the precedence over the positional alias.
 
<syntaxhighlight lang="wikitext">{{#invoke:params|
entering_substack|
discarding|1|
discarding|2|
discarding|3|
leaving_substack|
renaming_by_replacing|1|title|strict|
renaming_by_replacing|2|author|strict|
renaming_by_replacing|3|language|strict|
flushing|
concat_and_call|example template}}</syntaxhighlight>
 
{{vpad|1.5em|clear=none}}
 
=== <code>new</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>new</code> <span style="nowrap">({{module:params/doc/link to the code|new|code}})</span>
| label1 = Num. of arguments | data1 = 0
| label2 = Repeatable | data2 = No
| label3 = Restrictions | data3 = First position only
| header4 = See also
| data5 = <code>[[#parsing|parsing]]</code>, <code>[[#imposing|imposing]]</code>, <code>[[#providing|providing]]</code><!--, <code>[[#inserting|inserting]]</code>-->, <code>[[#discarding|discarding]]</code>
}}
 
; Brief
: ''Get rid of all the incoming parameters and create a new (empty) parameter stack''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|new|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
 
This modifier can only appear in first position, or if substacks are present, immediately after the <code>[[#entering_substack|entering_substack]]</code> directive. When in first position its main purpose is that of extending the facilities offered by this module (e.g. <code>[[#mapping_by_replacing|mapping_by_replacing]]</code>, <code>[[#with_value_matching|with_value_matching]]</code>, etc.) to custom lists of strings, independently of the incoming parameters. When inside a stack, it signals that the snapshot of the current parameters must be ignored for that stack. The existence of the <code>new</code> modifier also facilitates debugging the module.
 
The newly created parameter stack can be populated via <code>[[#parsing|parsing]]</code>, <code>[[#imposing|imposing]]</code> or <code>[[#providing|providing]]</code>. The incoming parameters can always be retrieved back using the <code>[[#remembering|remembering]]</code> and <code>[[#pulling|pulling]]</code> modifiers.
 
Examples:
* <syntaxhighlight lang="wikitext" inline>{{#invoke:params|new|imposing|1|foo|imposing|2|bar|mapping_by_replacing|^.|!%1|list_values}}</syntaxhighlight>
*: ↳ {{#invoke:params|new|imposing|1|foo|imposing|2|bar|mapping_by_replacing|^.|!%1|list_values}}
 
{{vpad|1.5em|clear=none}}
 
== Subpages ==
* [[Module:Params/ChangeLog]] – Record of the most important changes in the module's code
* [[Module:Params/testcases]] – Testing the module's capabilities
* [[Module:Params/doc/examples]] – Some of the examples mentioned in this documentation
 
The complete list of subpages is available [[Special:PrefixIndex/Module:Params/|here]].
 
== Notes ==
<references />
 
== See also ==
* {{ml|TemplatePar|}}
* {{ml|ParameterCount|}}
* {{ml|Separated entries|main}}
* {{ml|Enumerate|main}}
* {{ml|Check for unknown parameters|check}}
* {{ml|Check for deprecated parameters|check}}
* {{ml|Check for clobbered parameters|check}}
* {{ml|Parameter validation|}}
* {{ml|Expand wikitext|main}}
* {{ml|SeparatedFor entriesloop|main}} and {{tl|For loop}}
* {{ml|For nowiki|template}} and {{tl|For nowiki}}
* {{ml|Template wrapper|wrap}}
* {{ml|ArrayList}}
* [[Project:TemplateData]]
 
<includeonly>{{Sandbox other||
<!-- Categories below this line; interwikis at Wikidata -->
[[Category:UnknownTemplate parametersmetamodules|{{PAGENAME}}]]
[[Category:WikipediaUnknown parameters| metatemplates]]
[[Category:WikipediaModules utilitythat modulesmanipulate strings|{{PAGENAME}}]]
}}</includeonly>