Jump to content

Module:Params/testcases/tmulti/doc: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m Grufo moved page Module:Params/testcases/multi/doc to Module:Params/testcases/tmulti/doc: Add a “t” to the title for marking it as a template
Documentation update
Line 4: Line 4:
For instance, writing
For instance, writing


<syntaxhighlight lang="wikitext">{{module:params/testcases/multi|
<syntaxhighlight lang="wikitext">{{module:params/testcases/tmulti|
setting|i/p|<br />|: |list|
setting|i/p|<br />|: |list|
-|hello|world|foo=bar}}</syntaxhighlight>
-|hello|world|foo=bar}}</syntaxhighlight>
Line 10: Line 10:
will simulate a call with {{para|1|hello}}, {{para|2|world}}, and {{para|foo|bar}} to a template whose content is <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|i/p|<br />|: |list}}</syntaxhighlight>, thus producing:
will simulate a call with {{para|1|hello}}, {{para|2|world}}, and {{para|foo|bar}} to a template whose content is <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|i/p|<br />|: |list}}</syntaxhighlight>, thus producing:


{{module:params/testcases/multi|
{{module:params/testcases/tmulti|
setting|i/p|<br />|: |list|
setting|i/p|<br />|: |list|
-|hello|world|foo=bar}}
-|hello|world|foo=bar}}

Revision as of 04:07, 31 January 2024

This test template allows to simulate in one single call both the incoming parameters and the parameters possibly concatenated to {{#invoke:params|...|function|...}}, using a single hyphen (-) as a delimiter between the two groups. This allows to make general experiments directly from the preview window without having to edit separate templates.

Usage

For instance, writing

{{module:params/testcases/tmulti|
	setting|i/p|<br />|: |list|
	-|hello|world|foo=bar}}

will simulate a call with |1=hello, |2=world, and |foo=bar to a template whose content is {{#invoke:params|setting|i/p|<br />|: |list}}, thus producing:

1: hello
2: world
foo: bar