Content deleted Content added
Fix Linter errors. |
update |
||
Line 6:
== Usage ==
=== From a template ===
* {{mlx|Check for unknown parameters|check|unknown{{=}}<nowiki>[</nowiki>[Category:Some tracking category]]|arg1|arg2|arg3|argN}}▼
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
* {{mlx|Check for unknown parameters|check|unknown{{=}}<nowiki>[</nowiki>[Category:Some tracking category|_VALUE_]]|preview{{=}}unknown parameter "_VALUE_"|arg1|arg2|...|argN}}
Line 14 ⟶ 16:
* {{mlx|Check for unknown parameters|check|unknown{{=}}<span class{{=}}"error">Sorry, I don't recognize _VALUE_</span>|arg1|arg2|...|argN}}
* {{mlx|Check for unknown parameters|check|unknown{{=}}<nowiki>[</nowiki>[Category:Some tracking category|_VALUE_]]|preview{{=}}unknown parameter "_VALUE_"|arg1|arg2|...|argN|regexp1{{=}}header[%d]+|regexp2{{=}}date[1-9]}}
===From a module===
To call from a module, use:
<syntaxhighlight lang="wikitext">
local checkForUnknownParameters = require("Module:Check for unknown parameters")
local result = checkForUnknownParameters._check(validArgs, args)
</syntaxhighlight>
Where the first set of args are the module args below and the second set of args are the parameters that are checked.
== Parameters ==
Line 21 ⟶ 32:
* 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. {{para|regexp1|header[%d]+}}, {{para|regexp2|date[1-9]}}, {{para|regexp3|data[%d]+[abc]?}}. This is useful when there are many known parameters which use a systematic pattern.
* {{para|unknown}} –
* {{para|preview}} – the text to be displayed when in preview mode and an unknown parameter is used.
* The <code>_VALUE_</code> 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.
Line 44 ⟶ 55:
-->{{#invoke:Check for unknown parameters|check
| unknown = {{Main other|[[Category:Some tracking category|_VALUE_]]}}
| preview = unknown parameter "_VALUE_" | name | height | weight | website
}}
</syntaxhighlight>
|