Content deleted Content added
→trimmed: Update doc |
→trimmed: Add example |
||
Line 294:
<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
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:
<syntaxhighlight lang="wikitext">{{Hatnote|{{{altphrase|Foobar see also}}}: {{#if:{{{1|}}}
|[[{{{1}}}]]{{#invoke:params|sequential|trimmed|1|1|for_each|, [[$@]]}}{{#invoke:params|sequential|trimmed|1|0|trimmed|-1|0|for_each| and [[$@]]|{{#if:{{{3|}}}|,}}}}
|{{Error|{{tl|Foobar see also}} requires at least one page name}}
}}
}}</syntaxhighlight>
{{vpad}}
|