<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="he">
	<id>https://chabadpedia.co.il/index.php?action=history&amp;feed=atom&amp;title=%D7%99%D7%97%D7%99%D7%93%D7%94%3AParamValidator%2F%D7%AA%D7%99%D7%A2%D7%95%D7%93</id>
	<title>יחידה:ParamValidator/תיעוד - היסטוריית גרסאות</title>
	<link rel="self" type="application/atom+xml" href="https://chabadpedia.co.il/index.php?action=history&amp;feed=atom&amp;title=%D7%99%D7%97%D7%99%D7%93%D7%94%3AParamValidator%2F%D7%AA%D7%99%D7%A2%D7%95%D7%93"/>
	<link rel="alternate" type="text/html" href="https://chabadpedia.co.il/index.php?title=%D7%99%D7%97%D7%99%D7%93%D7%94:ParamValidator/%D7%AA%D7%99%D7%A2%D7%95%D7%93&amp;action=history"/>
	<updated>2026-04-15T02:07:57Z</updated>
	<subtitle>היסטוריית הגרסאות של הדף הזה בוויקי</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://chabadpedia.co.il/index.php?title=%D7%99%D7%97%D7%99%D7%93%D7%94:ParamValidator/%D7%AA%D7%99%D7%A2%D7%95%D7%93&amp;diff=433175&amp;oldid=prev</id>
		<title>שיע.ק: יצירת דף עם התוכן &quot;&lt;div class=&quot;mw-content-ltr&quot;&gt; This module is based on idea and original code of User:IKhitron. &lt;br/&gt; the source of this module is in //he.wikipedia.org/wiki/M...&quot;</title>
		<link rel="alternate" type="text/html" href="https://chabadpedia.co.il/index.php?title=%D7%99%D7%97%D7%99%D7%93%D7%94:ParamValidator/%D7%AA%D7%99%D7%A2%D7%95%D7%93&amp;diff=433175&amp;oldid=prev"/>
		<updated>2020-11-17T19:53:50Z</updated>

		<summary type="html">&lt;p&gt;יצירת דף עם התוכן &amp;quot;&amp;lt;div class=&amp;quot;mw-content-ltr&amp;quot;&amp;gt; This module is based on idea and original code of &lt;a href=&quot;/index.php?title=%D7%9E%D7%A9%D7%AA%D7%9E%D7%A9:IKhitron&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;משתמש:IKhitron (הדף אינו קיים)&quot;&gt;User:IKhitron&lt;/a&gt;. &amp;lt;br/&amp;gt; the source of this module is in //he.wikipedia.org/wiki/M...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;דף חדש&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;div class=&amp;quot;mw-content-ltr&amp;quot;&amp;gt;&lt;br /&gt;
This module is based on idea and original code of [[User:IKhitron]].&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
the source of this module is in //he.wikipedia.org/wiki/Module:ParamValidator&lt;br /&gt;
&lt;br /&gt;
This module exports two functions: calculateViolations( frame, subpages ), and validateParams( frame ). &lt;br /&gt;
&lt;br /&gt;
calculateViolations( frame, subpages ) finds templatedata, in template page or in one of its subpages in the list, if provided.&lt;br /&gt;
it returns a table with the violations. if there are none, the table is empty. otherwise it has the structure&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
	violation1 = { param1 = value1, param2 = value2 },&lt;br /&gt;
	violation2 = { ... },&lt;br /&gt;
	...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
violation1, violation2 etc. are one of the names of specific violations, as described below. &lt;br /&gt;
param1, param2 etc. are either the names of parameter passed to the template, or defined in templatedata.&lt;br /&gt;
value1, value2 etc. are the values passed to the template, or an empty string if no such parameter was passed.&lt;br /&gt;
&lt;br /&gt;
the different violations are as follow:&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;no-templatedata&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;no valid tempaltedata was found in tempalte page, or documentation subpage&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;undeclared&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;named parameters with non-empty value, does not exist in templatedata&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;empty-undeclared&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;named parameters with empty value, does not exist in templatedata&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;undeclared-numeric&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;numeric parameters with non-empty value, does not exist in templatedata&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;empty-undeclared-numeric&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;numeric parameters with empty value, does not exist in templatedata&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;deprecated&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;parameters with non-empty value, marked as &amp;quot;deprecated&amp;quot; in tempaltedata&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;empty-deprecated&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;parameters with empty value, marked as &amp;quot;deprecated&amp;quot; in tempaltedata&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;empty-required&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;missing or empty parameter marked as &amp;quot;required&amp;quot; in tempaltedata&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;incompatible&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;a non-empty parameter passed to the template, incompatible with the parameter type defined in templatedata &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second function, validateParams( frame ), can be called from the tempalte&amp;#039; using #invoke.&lt;br /&gt;
it expects a parameter named &amp;quot;options&amp;quot;, which contains the definition of the output. typically, it&amp;#039;s used by placing something like so:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{#invoke:ParamValidator | validateParams | options = {{PV default options}} }}&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
at the top of the template (be mindful not to add extra spaces and newlines to the template).&lt;br /&gt;
&lt;br /&gt;
the options parameter should be a JSON-encoded string, defining the output, and some special behaviors. &lt;br /&gt;
the example above assumes that a wiki page named &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;Template:PV default options&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;&amp;#039; exists, and contains valid JSON string. &lt;br /&gt;
for each of the violations defined above, &amp;quot;options&amp;quot; may define an output string, so basically, &amp;quot;options&amp;quot; looks like so:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
	violation1: outputstring1,&lt;br /&gt;
	violation2: outputstring2,&lt;br /&gt;
	.... ,&lt;br /&gt;
	behavior1: some value,&lt;br /&gt;
	....&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
not all violations have to be defined. a violation not defined in &amp;quot;options&amp;quot; will be ignored.&lt;br /&gt;
&lt;br /&gt;
when invoked, it extract &amp;quot;subpages&amp;quot; from the options parameter, and calls:&lt;br /&gt;
* calculateViolations( frame, subpages )&lt;br /&gt;
if the returned table is empty, no violation were found, and an empty string is returned and nothing else happens.&lt;br /&gt;
&lt;br /&gt;
otherwise, for each of the violations, i.e., the keys of the returned table, when &amp;quot;options&amp;quot; contains this key,&lt;br /&gt;
the corresonding value is appended to the output.&lt;br /&gt;
&lt;br /&gt;
some further processing is done:&lt;br /&gt;
# several tokens are replaced with calculated values. these are described below.&lt;br /&gt;
# some &amp;quot;meta&amp;quot; violations are calculated: when any none-ignored violation occured, the &amp;quot;any&amp;quot; meta-violation is added to the output in the same way, i.e. the string keyed by &amp;quot;any&amp;quot; in the options is appended to output with appropriate substitutions. 	similarly, &amp;quot;multiple&amp;quot; meta-violation is created when more than one type of non-ignored violations occured.&lt;br /&gt;
# if the output is not empty, a prefix and suffix strings are prepended and appended to it. &lt;br /&gt;
&lt;br /&gt;
these are the tokens and the replacement. &lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;templatename&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;full template name, including namespace.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;tname_naked&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;template name without namespace.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;paramname&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;comma-separated list of parameters&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;paramandvalue&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;is replaced by comma-separated list of &amp;quot;name: value&amp;quot; pairs of parameters and values&lt;br /&gt;
the first two are applied to the whole output, including the suffux and prefix,&lt;br /&gt;
and the rest are applied to the individual violations, each with its own list of offending parameters and values.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
the rest of the if the value of some keys is null, this error condition will be ignored, and not counted when calculating &amp;quot;any&amp;quot; and &amp;quot;multiple&amp;quot; conditions.&lt;br /&gt;
&lt;br /&gt;
some other optional fields can be passed via options:&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;doc-subpage&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;can be either a string, or a list (in square bracktes) of strings, indicating subpages of the template 		that may contain templatedata. &lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;ignore&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;list of patterns. any parameter whose name matches any pattern, will not considered in violation of any of the rules.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;skip-empty-numeric&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;if a quoted number, the module will ignore non-declared empty numeric parameters up to this number&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;wrapper-prefix&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;openning wrapper element of outpot (defaults to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;div class = &amp;#039;paramvalidator-wrapper&amp;#039;&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;) &lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;wrapper-suffix&amp;#039;&amp;#039;&amp;#039;&amp;lt;br/&amp;gt;closing wrapper element of output (defaults to &amp;quot;&amp;lt;nowiki&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;quot;) &lt;br /&gt;
&lt;br /&gt;
additional option parameters, named options1, options2, etc. can be passed. any entry defined in these options will &lt;br /&gt;
override the previous value. a typical use may be like so:&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
typically, this JSON structure will be placed in a separate template, and retrieved for the module-use as shown above.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{#invoke:ParamValidator | validateParams | options = {{PV default options}} | options1 = {&amp;quot;key&amp;quot;:&amp;quot;value&amp;quot;} }}&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;quot;key&amp;quot; can override any of the options fields described above.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;includeonly&amp;gt;[[קטגוריה:ניהול פרמטרים|*]]&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>שיע.ק</name></author>
	</entry>
</feed>