בדוקי עריכות אוטומטית, אינטערפעיס רעדאקטארן, אינטערפעיס אדמיניסטראַטאָרן, סיסאפן, מייבאים, מעדכנים, מייבא, אספקלריה רעדאקטארן
46,358
רעדאגירונגען
(געשאַפן בלאַט מיט '<div class="mw-content-ltr"> This module is based on idea and original code of User:IKhitron. <br/> the source of this module is in //he.wikipedia.org/wiki/Module:ParamValidator This module exports two functions: calculateViolations( frame, subpages ), and validateParams( frame ). calculateViolations( frame, subpages ) finds templatedata, in template page or in one of its subpages in the list, if provided. it returns a table with the violations. if...') |
אין תקציר עריכה |
||
| שורה 4: | שורה 4: | ||
the source of this module is in //he.wikipedia.org/wiki/Module:ParamValidator | the source of this module is in //he.wikipedia.org/wiki/Module:ParamValidator | ||
This module exports two functions: calculateViolations( frame, subpages ), and validateParams( frame ). | This module exports two functions: calculateViolations( frame, subpages ), and validateParams( frame ). | ||
calculateViolations( frame, subpages ) finds templatedata, in template page or in one of its subpages in the list, if provided. | calculateViolations( frame, subpages ) finds templatedata, in template page or in one of its subpages in the list, if provided. | ||
| שורה 15: | שורה 15: | ||
} | } | ||
</pre> | </pre> | ||
violation1, violation2 etc. are one of the names of specific violations, as described below. | violation1, violation2 etc. are one of the names of specific violations, as described below. | ||
param1, param2 etc. are either the names of parameter passed to the template, or defined in templatedata. | param1, param2 etc. are either the names of parameter passed to the template, or defined in templatedata. | ||
value1, value2 etc. are the values passed to the template, or an empty string if no such parameter was passed. | value1, value2 etc. are the values passed to the template, or an empty string if no such parameter was passed. | ||
| שורה 28: | שורה 28: | ||
* '''empty-deprecated'''<br/>parameters with empty value, marked as "deprecated" in tempaltedata | * '''empty-deprecated'''<br/>parameters with empty value, marked as "deprecated" in tempaltedata | ||
* '''empty-required'''<br/>missing or empty parameter marked as "required" in tempaltedata | * '''empty-required'''<br/>missing or empty parameter marked as "required" in tempaltedata | ||
* '''incompatible'''<br/>a non-empty parameter passed to the template, incompatible with the parameter type defined in templatedata | * '''incompatible'''<br/>a non-empty parameter passed to the template, incompatible with the parameter type defined in templatedata | ||
The second function, validateParams( frame ), can be called from the tempalte' using #invoke. | The second function, validateParams( frame ), can be called from the tempalte' using #invoke. | ||
| שורה 38: | שורה 37: | ||
at the top of the template (be mindful not to add extra spaces and newlines to the template). | at the top of the template (be mindful not to add extra spaces and newlines to the template). | ||
the options parameter should be a JSON-encoded string, defining the output, and some special behaviors. | the options parameter should be a JSON-encoded string, defining the output, and some special behaviors. | ||
the example above assumes that a wiki page named '''<code>Template:PV default options</code>''' exists, and contains valid JSON string. | the example above assumes that a wiki page named '''<code>Template:PV default options</code>''' exists, and contains valid JSON string. | ||
for each of the violations defined above, "options" may define an output string, so basically, "options" looks like so: | for each of the violations defined above, "options" may define an output string, so basically, "options" looks like so: | ||
<pre> | <pre> | ||
| שורה 62: | שורה 61: | ||
some further processing is done: | some further processing is done: | ||
# several tokens are replaced with calculated values. these are described below. | # several tokens are replaced with calculated values. these are described below. | ||
# some "meta" violations are calculated: when any none-ignored violation occured, the "any" meta-violation is added to the output in the same way, i.e. the string keyed by "any" in the options is appended to output with appropriate substitutions. | # some "meta" violations are calculated: when any none-ignored violation occured, the "any" meta-violation is added to the output in the same way, i.e. the string keyed by "any" in the options is appended to output with appropriate substitutions. similarly, "multiple" meta-violation is created when more than one type of non-ignored violations occured. | ||
# if the output is not empty, a prefix and suffix strings are prepended and appended to it. | # if the output is not empty, a prefix and suffix strings are prepended and appended to it. | ||
these are the tokens and the replacement. | these are the tokens and the replacement. | ||
* '''templatename'''<br/>full template name, including namespace. | * '''templatename'''<br/>full template name, including namespace. | ||
* '''tname_naked'''<br/>template name without namespace. | * '''tname_naked'''<br/>template name without namespace. | ||
| שורה 72: | שורה 71: | ||
the first two are applied to the whole output, including the suffux and prefix, | the first two are applied to the whole output, including the suffux and prefix, | ||
and the rest are applied to the individual violations, each with its own list of offending parameters and values. | and the rest are applied to the individual violations, each with its own list of offending parameters and values. | ||
the rest of the if the value of some keys is null, this error condition will be ignored, and not counted when calculating "any" and "multiple" conditions. | the rest of the if the value of some keys is null, this error condition will be ignored, and not counted when calculating "any" and "multiple" conditions. | ||
some other optional fields can be passed via options: | some other optional fields can be passed via options: | ||
* '''doc-subpage'''<br/>can be either a string, or a list (in square bracktes) of strings, indicating subpages of the template | * '''doc-subpage'''<br/>can be either a string, or a list (in square bracktes) of strings, indicating subpages of the template that may contain templatedata. | ||
* '''ignore'''<br/>list of patterns. any parameter whose name matches any pattern, will not considered in violation of any of the rules. | * '''ignore'''<br/>list of patterns. any parameter whose name matches any pattern, will not considered in violation of any of the rules. | ||
* '''skip-empty-numeric'''<br/>if a quoted number, the module will ignore non-declared empty numeric parameters up to this number | * '''skip-empty-numeric'''<br/>if a quoted number, the module will ignore non-declared empty numeric parameters up to this number | ||
* '''wrapper-prefix'''<br/>openning wrapper element of outpot (defaults to <code><nowiki><div class = 'paramvalidator-wrapper'></nowiki></code>) | * '''wrapper-prefix'''<br/>openning wrapper element of outpot (defaults to <code><nowiki><div class = 'paramvalidator-wrapper'></nowiki></code>) | ||
* '''wrapper-suffix'''<br/>closing wrapper element of output (defaults to "<nowiki></div></nowiki>") | * '''wrapper-suffix'''<br/>closing wrapper element of output (defaults to "<nowiki></div></nowiki>") | ||
additional option parameters, named options1, options2, etc. can be passed. any entry defined in these options will | additional option parameters, named options1, options2, etc. can be passed. any entry defined in these options will | ||
override the previous value. a typical use may be like so: | override the previous value. a typical use may be like so: | ||
| שורה 93: | שורה 91: | ||
"key" can override any of the options fields described above. | "key" can override any of the options fields described above. | ||
</div> | </div> | ||
<includeonly>[[ | <includeonly>[[קאטעגאריע:פאראמעטער פארוואלטונג|*]]</includeonly> | ||
רעדאגירונגען