Module:Check for unknown parameters/doc explained
Module:Check for unknown parameters is used to check for uses of unknown parameters in a template or module. It may be appended to a template at the end or called directly from a module.
Usage
From a template
To sort entries into a tracking category by parameter, use:
From a module
To call from a module, use:local checkForUnknownParameters = require("Module:Check for unknown parameters")local result = checkForUnknownParameters._check(validArgs, args)
Where the first set of args are the module args below and the second set of args are the parameters that are checked.
Parameters
arg1
, arg2
, ..., argN
, are the known parameters.
- Unnamed (positional) parameters can be added too:
|1|2|arg1|arg2|...
.
- Lua patterns (similar to regular expressions) usage with parameters is also supported (such as:,,). This is useful when there are many known parameters which use a systematic pattern.
- – what happens when an uknown parameter is used. Typically use either a tracking category to place pages that use unknown parameters, or an error.
- – the text to be displayed when in preview mode and an unknown parameter is used.
- The
_VALUE_
keyword, if used, will be changed to the name of the parameter. This is useful for either sorting the entries in a tracking category, or for provide more explicit information.
- – by default, the module makes no distinction between a defined-but-blank parameter and a non-blank parameter. That is, both unlisted and are reported. To only track non-blank parameters use .
- – by default, the module ignores blank positional parameters. That is, an unlisted is ignored. To blank positional parameters in the tracking use .
Example
Label1: | Height |
Label2: | Weight |
Label3: | Website |
Call from within Lua code
See the end of for a simple example or or for more complicated examples.
See also
- (category page can have header)
- – for complex operations involving parameters
- – adds documentation to templates using this module
- – similar module that checks for deprecated parameters
- – module that checks for conflicting parameters
- – similar function (originally from dewiki)
- and – generates a list of parameter names for a given template
- based template parameter validation
- checks a lot more
- - A tool for checking usage of template parameters