Module:Params/doc: Difference between revisions

Content deleted Content added
mNo edit summary
mNo edit summary
Line 52:
=== <code>count</code> ===
; Brief
: ''Counts the number of parameters whereby a template was called''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|count}}</syntaxhighlight>
Line 62:
=== <code>list</code> ===
; Brief
: ''Lists the template parameters (both their names and their values)''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|list|[argument separator]|[key-value separator]|[header]|[footer]}}</syntaxhighlight>
Line 74:
=== <code>list_values</code> ===
; Brief
: ''Lists the template parameter values''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|list_values|[argument separator]|[header]|[footer]}}</syntaxhighlight>
Line 86:
=== <code>concat_and_call</code> ===
; Brief
: ''Prepends user-given unnamed arguments to the current parameters, or impose user-given named arguments; then propagate everything to a custom template''
; Syntax
: <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]|[...]
Line 111:
=== <code>concat_and_invoke</code> ===
; Brief
: ''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|concat_and_invoke|module name|function name|[prepend 1]|[prepend 2]|[...]|[prepend n]|[named item 1=value 1]|[...]|[named item n=value n]|[...]
Line 124:
=== <code>call_for_each</code> ===
; Brief
: ''For each parameter passed to the caller template, calls 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]|[...]
Line 137:
=== <code>invoke_for_each</code> ===
; Brief
: ''For each parameter passed to the caller template, invokes 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>
Line 149:
=== <code>call_for_each_value</code> ===
; Brief
: ''For each parameter passed to the caller template, calls 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>
Line 161:
=== <code>invoke_for_each_value</code> ===
; Brief
: ''For each parameter passed to the caller template, invokes 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>
Line 173:
=== <code>for_each</code> ===
; Brief
: ''For each parameter passed to the caller template, expands 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>
Line 192:
=== <code>sequential</code> ===
; Brief
: ''Reduces the parameter list to the subgroup of consecutive parameters that follow {{para|1}}''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|sequential|pipe function name}}</syntaxhighlight>
Line 206:
=== <code>non-sequential</code> ===
; Brief
: ''Reduces the parameter list by subtracting the subgroup of consecutive parameters that follow {{para|1}}''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|non-sequential|pipe function name}}</syntaxhighlight>
Line 220:
=== <code>with_name_matching</code> ===
; Brief
: ''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|pattern|pipe function name}}</syntaxhighlight>
Line 236:
=== <code>with_name_not_matching</code> ===
; Brief
: ''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|pattern|pipe function name}}</syntaxhighlight>
Line 252:
=== <code>with_value_matching</code> ===
; Brief
: ''Removes from the parameter list all the parameters whose value ''does not match'' the given pattern''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|with_value_matching|pattern|pipe function name}}</syntaxhighlight>
Line 268:
=== <code>with_value_not_matching</code> ===
; Brief
: ''Removes from the parameter list all the parameters whose value ''matches'' the given pattern''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|with_value_not_matching|pattern|pipe function name}}</syntaxhighlight>
Line 284:
=== <code>trimmed</code> ===
; Brief
: ''Removes zero or more parameters from the beginning and the end of the parameter list''
; Syntax
: <syntaxhighlight lang="wikitext" inline>{{#invoke:params|trimmed|left trim|right trim|pipe function name}}</syntaxhighlight>