Module:Params/doc: Difference between revisions

Content deleted Content added
m cutting: emphasis
 
(29 intermediate revisions by 4 users not shown)
Line 168:
| 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>
}}
 
Line 176:
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|concat_and_call|template name|[prepend 1]|[prepend 2]|[...]|[prepend n]|[named item 1=value 1]|[...]|[named item n=value n]|[...]}}</syntaxhighlight>
 
This function comes in handy in case of [[Wikipedia:Wrapper templates|wrapper templates]]. For example, if our <syntaxhighlight lang="wikitext" inline>{{examplewrapper template}}</syntaxhighlight> had the following code,
 
<syntaxhighlight lang="wikitext">{{#invoke:params|concat_and_call|foobar|elbow|earth|room|7=classy|hello=not today}}</syntaxhighlight>
Line 182:
and were called with,
 
{{tj|examplewrapper template|one|two|three|hello: world|wind: spicy}}
 
the following call to the <syntaxhighlight lang="wikitext" inline>{{foobar}}</syntaxhighlight> template would be performed:
Line 389:
 
<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
Line 634:
}}</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).
Line 732:
}}
 
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}}
Line 869:
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 displayddisplayed 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:
Line 1,046:
 
; Brief
: ''Assign an empty string to all undefined numeric parameters between 1 or thea lowestlower numeric parameter name provided and the maximum numeric parameter provided''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|filling_the_gaps|pipe function name}}</syntaxhighlight>
Line 1,132:
| 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>[[#rotatingreversing_numeric_names|rotatingreversing_numeric_names]]</code><!--, <code>[[#mirroringmirroring_numeric_names|mirroringmirroring_numeric_names]]</code>, <code>[[#pivotingpivoting_numeric_names|pivotingpivoting_numeric_names]]</code>, <code>[[#swappingswapping_numeric_names|swappingswapping_numeric_names]]</code>-->, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
Line 1,146:
<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:
Line 1,164:
| 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>[[#rotatingreversing_numeric_names|rotatingreversing_numeric_names]]</code><!--, <code>[[#mirroringmirroring_numeric_names|mirroringmirroring_numeric_names]]</code>, <code>[[#pivotingpivoting_numeric_names|pivotingpivoting_numeric_names]]</code>, <code>[[#swappingswapping_numeric_names|swappingswapping_numeric_names]]</code>-->, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
Line 1,204:
| 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>[[#rotatingreversing_numeric_names|rotatingreversing_numeric_names]]</code><!--, <code>[[#mirroringmirroring_numeric_names|mirroringmirroring_numeric_names]]</code>, <code>[[#pivotingpivoting_numeric_names|pivotingpivoting_numeric_names]]</code>, <code>[[#swappingswapping_numeric_names|swappingswapping_numeric_names]]</code>-->, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
Line 1,232:
| 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>[[#rotatingreversing_numeric_names|rotatingreversing_numeric_names]]</code><!--, <code>[[#mirroringmirroring_numeric_names|mirroringmirroring_numeric_names]]</code>, <code>[[#pivotingpivoting_numeric_names|pivotingpivoting_numeric_names]]</code>, <code>[[#swappingswapping_numeric_names|swappingswapping_numeric_names]]</code>-->, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
Line 1,252:
{{vpad|1.5em|clear=none}}
 
=== <code>rotatingreversing_numeric_names</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>rotatingreversing_numeric_names</code> <span style="nowrap">({{module:params/doc/link to the code|rotatingreversing_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>[[#mirroringmirroring_numeric_names|mirroringmirroring_numeric_names]]</code>, <code>[[#pivotingpivoting_numeric_names|pivotingpivoting_numeric_names]]</code>, <code>[[#swappingswapping_numeric_names|swappingswapping_numeric_names]]</code>-->, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
Line 1,266:
: ''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|rotatingreversing_numeric_names|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
Line 1,272:
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|rotatingreversing_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|rotatingreversing_numeric_names|rotatingreversing_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>mirroringmirroring_numeric_names</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>mirroringmirroring_numeric_names</code> <span style="nowrap">({{module:params/doc/link to the code|mirroringmirroring_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>[[#rotatingreversing_numeric_names|rotatingreversing_numeric_names]]</code>, <code>[[#pivotingpivoting_numeric_names|pivotingpivoting_numeric_names]]</code>, <code>[[#swappingswapping_numeric_names|swappingswapping_numeric_names]]</code>, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
Line 1,292:
: ''Reverse the order of all numeric parameters (not only sequential ones)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|mirroringmirroring_numeric_names|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
Line 1,300:
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|mirroringmirroring_numeric_names|for_each|[$#: $@]}}</syntaxhighlight>
 
{{vpad|1.5em|clear=none}}
 
=== <code>pivotingpivoting_numeric_names</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>pivotingpivoting_numeric_names</code> <span style="nowrap">({{module:params/doc/link to the code|pivotingpivoting_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>[[#rotatingreversing_numeric_names|rotatingreversing_numeric_names]]</code>, <code>[[#mirroringmirroring_numeric_names|mirroringmirroring_numeric_names]]</code>, <code>[[#swappingswapping_numeric_names|swappingswapping_numeric_names]]</code>, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
Line 1,318:
: ''Reverse the order of all numeric parameters (not only sequential ones), '''keeping the parameters' sequence always centered'''''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|pivotingpivoting_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>[[#mirroringmirroring_numeric_names|mirroringmirroring_numeric_names]]</code>.
 
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|pivotingpivoting_numeric_names|for_each|[$#: $@]}}</syntaxhighlight>
 
{{vpad|1.5em|clear=none}}
 
=== <code>swappingswapping_numeric_names</code> ===
{{Infobox|headerstyle=background:lavender
| titlestyle = font-weight:normal; font-size:100%;
| title = Modifier <code>swappingswapping_numeric_names</code> <span style="nowrap">({{module:params/doc/link to the code|swappingswapping_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>[[#mirroringmirroring_numeric_names|mirroringmirroring_numeric_names]]</code>, <code>[[#pivotingpivoting_numeric_names|pivotingpivoting_numeric_names]]</code>, <code>[[#sorting_sequential_values|sorting_sequential_values]]</code>
}}
 
Line 1,344:
: ''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|swappingswapping_numeric_names|pipe function name}}</syntaxhighlight>
 
This modifier does not take arguments besides the name of the function that will follow.
Line 1,350:
Example:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|swappingswapping_numeric_names|for_each|[$#: $@]}}</syntaxhighlight>
-->
{{vpad|1.5em|clear=none}}
Line 1,362:
| 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>[[#rotatingreversing_numeric_names|rotatingreversing_numeric_names]]</code><!--, <code>[[#mirroringmirroring_numeric_names|mirroringmirroring_numeric_names]]</code>, <code>[[#pivotingpivoting_numeric_names|pivotingpivoting_numeric_names]]</code>, <code>[[#swappingswapping_numeric_names|swappingswapping_numeric_names]]</code>-->, <code>[[#all_sorted|all_sorted]]</code>, <code>[[#reassorted|reassorted]]</code>
}}
 
Line 1,391:
| 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>[[#rotatingreversing_numeric_names|rotatingreversing_numeric_names]]</code>, <code>[[#mirroringmirroring_numeric_names|mirroringmirroring_numeric_names]]</code>, <code>[[#pivotingpivoting_numeric_names|pivotingpivoting_numeric_names]]</code>, <code>[[#swappingswapping_numeric_names|swappingswapping_numeric_names]]</code>, <code>[[#discarding|discarding]]</code>, <code>[[#all_sorted|all_sorted]]</code>, <code>[[#reassorted|reassorted]]</code>, <code>[[#new|new]]</code>
}}
 
Line 1,410:
backpurging|0|0|
detaching_substack|
reversing_numeric_names|
rotating|
inserting|1|3|added parameter 3|added parameter 2|added parameter 1|
reversing_numeric_names|
rotating|
merging_substack|
for_each|[$#:$@]}}</syntaxhighlight>
Line 1,423:
clearing|
detaching_substack|
reversing_numeric_names|
rotating|
inserting|1|3|added parameter 3|added parameter 2|added parameter 1|
reversing_numeric_names|
rotating|
leaving_substack|
inserting|1|3||||
Line 1,797:
 
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}}
Line 1,807 ⟶ 1,849:
| 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>
}}
 
Line 1,821 ⟶ 1,863:
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 hasare 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.
Line 1,893 ⟶ 1,935:
| 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>
}}
 
Line 1,907 ⟶ 1,949:
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 hasare 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.
Line 1,936 ⟶ 1,978:
| 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>
}}
 
Line 1,950 ⟶ 1,992:
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 hasare 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.
Line 1,979 ⟶ 2,021:
| 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>
}}
 
Line 1,993 ⟶ 2,035:
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>.
Almost everything this modifier can do can also be done via <syntaxhighlight lang="wikitext" inline>...|mapping_by_invoking|string|replace|4|...</syntaxhighlight>. And so, writing
 
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.
<syntaxhighlight lang="wikitext">...|mapping_by_renaming|foo|bar|1|plain|...</syntaxhighlight>
 
{| 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|truefalse|...</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]].
Line 2,008 ⟶ 2,074:
 
{{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}}
Line 2,018 ⟶ 2,189:
| 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>
}}
 
Line 2,035 ⟶ 2,206:
 
<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).
Line 2,051 ⟶ 2,226:
| 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>
}}
 
Line 2,080 ⟶ 2,255:
| 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>
}}
 
Line 2,090 ⟶ 2,265:
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):
This modifier can be particularly useful for sanitizing parameter names (e.g. changing the [[letter case]], or URL encoding/decoding, and so on).
 
<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>
For instance, the following example uses &#123;&#123;[[:mw:Help:Magic words#lc|lc]]&#125;&#125; to sanitize all parameter names confining them to their lower case version:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|sequential|setting|h/i/p/f|[|][|: |]|renaming_by_magic|lc|list}}</syntaxhighlight>
 
Or, 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|with_name_matching|^%-?%d+$|renaming_by_replacing|^.*$|%0 * 2|1|renaming_by_magic|#expr|setting|h/i/p/f|[|][|: |]|list}}</syntaxhighlight>
 
{{vpad|clear=none}}
Line 2,113 ⟶ 2,282:
| 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>
}}
 
Line 2,130 ⟶ 2,299:
 
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}}
Line 2,137 ⟶ 2,330:
{{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
Line 2,144 ⟶ 2,395:
| 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>
}}
 
Line 2,250 ⟶ 2,501:
{{vpad|clear=none}}
 
{{A note}} All arguments passed to this modifier except the <code>reinterpreting</code> modifier name itself, the ''parmeterparameter 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> ===
Line 2,556 ⟶ 2,866:
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>, <code>[[#reinterpreting|reinterpreting]]</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: