Jump to content

Module:Params/doc/examples/check for unknown parameters/doc: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
First draft
Tag: Removed redirect
mNo edit summary
Line 11: Line 11:
will generate
will generate


{{module:params/doc/examples/check for unknown parameters
: {{module:params/doc/examples/check for unknown parameters
| hello = world
| hello = world
| wind = surfing
| wind = surfing
Line 21: Line 21:
| hello = world
| hello = world
| wind = surfing
| wind = surfing
| wrong = ups!
}}</syntaxhighlight>
}}</syntaxhighlight>


will generate
will generate


{{module:params/doc/examples/check for unknown parameters
: {{module:params/doc/examples/check for unknown parameters
| hello = world
| hello = world
| wind = surfing
| wind = surfing

Revision as of 05:47, 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
	| wrong = ups!
}}

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: