Module:Params/doc: Difference between revisions

Content deleted Content added
m Briefs: use the imperative mood instead of the third person indicative
trimmed: Move suggestion below and expand it
Line 309:
 
<syntaxhighlight lang="wikitext">{{#invoke:params|trimmed|0|2|sequential|call_for_each_value|example template}}</syntaxhighlight>
 
{{A note}} Although <syntaxhighlight lang="wikitext" inline>{{#invoke:params|trimmed|-1|1|...}}</syntaxhighlight> de facto gets rid of all sequential parameters, it is more efficient to do <syntaxhighlight lang="wikitext" inline>{{#invoke:params|non-sequential|...}}</syntaxhighlight> to obtain the same effect.
 
In some cases it might be necessary to concatenate more than one invocation of the <code>trimmed</code> function. For instance, notice the <code><nowiki>|trimmed|1|0|trimmed|-1|0</nowiki></code> code in the following imaginary <code><nowiki>{{Foobar see also}}</nowiki></code> template in order to properly show the “and” conjunction and possibly an [[Serial comma|Oxford comma]] when more than two page names are provided:
Line 319 ⟶ 317:
}}
}}</syntaxhighlight>
 
{{A note|Suggestion:}} Although <syntaxhighlight lang="wikitext" inline>{{#invoke:params|trimmed|-1|1|...}}</syntaxhighlight> de facto gets rid of all sequential parameters, it is clearer and more efficientidiomatic to dowrite <syntaxhighlight lang="wikitext" inline>{{#invoke:params|non-sequential|...}}</syntaxhighlight> to obtain the same effect. Writing <syntaxhighlight lang="wikitext" inline>{{#invoke:params|sequential|trimmed|-1|1|...}}</syntaxhighlight> will have zero arguments left.
 
{{vpad}}