Content deleted Content added
Fix Linter errors. |
m Reverted edits by 201.162.168.35 (talk) (HG) (3.4.13) |
||
(16 intermediate revisions by 12 users not shown) | |||
Line 1:
{{Used in system}}
{{Module rating|p}}
{{cascade-protected template|page=module}}
{{Lua|Module:If preview|noprotcat=yes}}
Line 6 ⟶ 7:
== 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 ⟶ 17:
* {{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="lua">
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 ==
* <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
* {{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 ⟶ 56:
-->{{#invoke:Check for unknown parameters|check
| unknown = {{Main other|[[Category:Some tracking category|_VALUE_]]}}
| preview = unknown parameter "_VALUE_" | height | name | website | weight
}}
</syntaxhighlight>
Line 69 ⟶ 78:
<!-- Categories go here and interwikis go in Wikidata. -->
[[Category:Modules that add a tracking category]]
[[Category:Template metamodules]]
}}</includeonly>
<noinclude>
[[Category:Module documentation pages]]
</noinclude>
|