Module:Params/doc/examples/check for unknown parameters/doc: Difference between revisions
Appearance
Content deleted Content added
Grufo moved page Module:Params/doc/examples/check for unknown parameters/doc to Module:Params/testcases/sandbox over redirect: Create a template documentation page Tag: New redirect |
First draft Tag: Removed redirect |
||
Line 1: | Line 1: | ||
This example template shows to use {{mfl|params|with_name_not_matching|...}} to check for unknown parameters. |
|||
#REDIRECT [[Module:Params/testcases/sandbox]] |
|||
== Usage == |
|||
{{Redirect category shell| |
|||
For instance, writing |
|||
{{R from move}} |
|||
<syntaxhighlight lang="wikitext">{{module:params/doc/examples/check for unknown parameters |
|||
| hello = world |
|||
| wind = surfing |
|||
}}</syntaxhighlight> |
|||
will generate |
|||
{{module:params/doc/examples/check for unknown parameters |
|||
| hello = world |
|||
| wind = surfing |
|||
}} |
}} |
||
while writing |
|||
<syntaxhighlight lang="wikitext">{{module:params/doc/examples/check for unknown parameters |
|||
| hello = world |
|||
| wind = surfing |
|||
}}</syntaxhighlight> |
|||
will generate |
|||
{{module:params/doc/examples/check for unknown parameters |
|||
| hello = world |
|||
| wind = surfing |
|||
| wrong = ups! |
|||
}} |
|||
For simple cases like this specialized modules are available; you might want to have a look at: |
|||
* {{ml|Check for unknown parameters|check}} |
|||
* {{ml|Check for deprecated parameters|check}} |
|||
* {{ml|Check for clobbered parameters|check}} |
|||
* {{ml|Parameter validation|validateparams}} |
|||
* {{ml|TemplatePar|valid}} |
|||
<includeonly>{{Sandbox other|| |
|||
<!-- Categories below this line; interwikis at Wikidata --> |
|||
}}</includeonly> |
Revision as of 05:35, 17 May 2024
This example template shows to use {{#invoke:params|with_name_not_matching|...}} to check for unknown parameters.
Usage
For instance, writing
{{module:params/doc/examples/check for unknown parameters
| hello = world
| wind = surfing
}}
will generate
Everything is good: do something
while writing
{{module:params/doc/examples/check for unknown parameters
| hello = world
| wind = surfing
}}
will generate
Error: The only parameters accepted are |hello=
and |wind=
.
For simple cases like this specialized modules are available; you might want to have a look at:
- {{#invoke:Check for unknown parameters|check}}
- {{#invoke:Check for deprecated parameters|check}}
- {{#invoke:Check for clobbered parameters|check}}
- {{#invoke:Parameter validation|validateparams}}
- {{#invoke:TemplatePar|valid}}