Content deleted Content added
No edit summary Tag: Reverted |
m Reverted edits by 201.162.168.35 (talk) (HG) (3.4.13) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 2:
{{Module rating|p}}
{{cascade-protected template|page=module}}
{{Lua|Module:If preview|noprotcat=
'''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:
* {{mlx|Check for unknown parameters|check|unknown{{=}}<nowiki>[</nowiki>[Category:Some tracking category|_VALUE_]]|arg1|arg2|arg3|argN}
To sort the entries into a tracking category by parameter with a preview error message, use:
* {{mlx|Check for unknown parameters|check|unknown{{=}}<nowiki>[</nowiki>[Category:Some tracking category|_VALUE_]]|preview{{=}}unknown parameter "_VALUE_"|arg1|arg2|
For an explicit red error message, use:
* {{mlx|Check for unknown parameters|check|unknown{{=}}<span class{{=}}"error">Sorry, I don't recognize _VALUE_</span>|arg1|arg2|...|argN}}
To use Lua patterns, use:
Line 31 ⟶ 32:
* <code>arg1</code>, <code>arg2</code>, ..., <code>argN</code>, are the known parameters.
* Unnamed (positional) parameters can be added too: <code>|1|2|arg1|arg2|...</code>.
* [[:mw:Extension:Scribunto/Lua reference manual#Patterns|Lua patterns]] (similar to [[regular expression]]s) usage with parameters is also supported (such as: {{para|regexp1|header[%d]+}}, {{para|regexp2|date[1-
* {{para|unknown}} – what happens when an unknown parameter is used. Typically use either a tracking category to place pages that use unknown parameters, or an error.
* {{para|preview}} – the text to be displayed when in preview mode and an unknown parameter is used.
|