<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="he">
	<id>https://text.chabadpedia.com/index.php?action=history&amp;feed=atom&amp;title=%D7%99%D7%97%D7%99%D7%93%D7%94%3AParamValidator</id>
	<title>יחידה:ParamValidator - היסטוריית גרסאות</title>
	<link rel="self" type="application/atom+xml" href="https://text.chabadpedia.com/index.php?action=history&amp;feed=atom&amp;title=%D7%99%D7%97%D7%99%D7%93%D7%94%3AParamValidator"/>
	<link rel="alternate" type="text/html" href="https://text.chabadpedia.com/index.php?title=%D7%99%D7%97%D7%99%D7%93%D7%94:ParamValidator&amp;action=history"/>
	<updated>2026-05-02T21:00:33Z</updated>
	<subtitle>היסטוריית הגרסאות של הדף הזה בוויקי</subtitle>
	<generator>MediaWiki 1.40.3</generator>
	<entry>
		<id>https://text.chabadpedia.com/index.php?title=%D7%99%D7%97%D7%99%D7%93%D7%94:ParamValidator&amp;diff=23681&amp;oldid=prev</id>
		<title>מ. רובין: גרסה אחת יובאה</title>
		<link rel="alternate" type="text/html" href="https://text.chabadpedia.com/index.php?title=%D7%99%D7%97%D7%99%D7%93%D7%94:ParamValidator&amp;diff=23681&amp;oldid=prev"/>
		<updated>2025-09-07T08:02:24Z</updated>

		<summary type="html">&lt;p&gt;גרסה אחת יובאה&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;he&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;→ הגרסה הקודמת&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;גרסה מ־11:02, 7 בספטמבר 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;he&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(אין הבדלים)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>מ. רובין</name></author>
	</entry>
	<entry>
		<id>https://text.chabadpedia.com/index.php?title=%D7%99%D7%97%D7%99%D7%93%D7%94:ParamValidator&amp;diff=23680&amp;oldid=prev</id>
		<title>ויקיטקסט&gt;Nahum: 7 גרסאות של הדף :w:יחידה:ParamValidator יובאו: על פי בקשה במזנון</title>
		<link rel="alternate" type="text/html" href="https://text.chabadpedia.com/index.php?title=%D7%99%D7%97%D7%99%D7%93%D7%94:ParamValidator&amp;diff=23680&amp;oldid=prev"/>
		<updated>2024-09-09T14:16:34Z</updated>

		<summary type="html">&lt;p&gt;7 גרסאות של הדף &lt;a href=&quot;https://chabadpedia.co.il/index.php/%D7%99%D7%97%D7%99%D7%93%D7%94:ParamValidator&quot; class=&quot;extiw&quot; title=&quot;w:יחידה:ParamValidator&quot;&gt;w:יחידה:ParamValidator&lt;/a&gt; יובאו: על פי בקשה במזנון&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;he&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;→ הגרסה הקודמת&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;גרסה מ־17:16, 9 בספטמבר 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;he&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(אין הבדלים)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>ויקיטקסט&gt;Nahum</name></author>
	</entry>
	<entry>
		<id>https://text.chabadpedia.com/index.php?title=%D7%99%D7%97%D7%99%D7%93%D7%94:ParamValidator&amp;diff=459&amp;oldid=prev</id>
		<title>חלוקת קונטרסים: גרסה אחת יובאה: ייבוא תבניות ראשוני מחב&quot;דפדיה. קרדיט לויקיפדיה על מה שהועתק מהם לחב&quot;דפדיה</title>
		<link rel="alternate" type="text/html" href="https://text.chabadpedia.com/index.php?title=%D7%99%D7%97%D7%99%D7%93%D7%94:ParamValidator&amp;diff=459&amp;oldid=prev"/>
		<updated>2024-06-20T20:28:11Z</updated>

		<summary type="html">&lt;p&gt;גרסה אחת יובאה: ייבוא תבניות ראשוני מחב&amp;quot;דפדיה. קרדיט לויקיפדיה על מה שהועתק מהם לחב&amp;quot;דפדיה&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;he&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;→ הגרסה הקודמת&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;גרסה מ־23:28, 20 ביוני 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;he&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(אין הבדלים)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>חלוקת קונטרסים</name></author>
	</entry>
	<entry>
		<id>https://text.chabadpedia.com/index.php?title=%D7%99%D7%97%D7%99%D7%93%D7%94:ParamValidator&amp;diff=458&amp;oldid=prev</id>
		<title>חלוקת קונטרסים: עדכון</title>
		<link rel="alternate" type="text/html" href="https://text.chabadpedia.com/index.php?title=%D7%99%D7%97%D7%99%D7%93%D7%94:ParamValidator&amp;diff=458&amp;oldid=prev"/>
		<updated>2021-09-09T23:23:07Z</updated>

		<summary type="html">&lt;p&gt;עדכון&lt;/p&gt;
&lt;p&gt;&lt;b&gt;דף חדש&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[=[&lt;br /&gt;
&lt;br /&gt;
This module is based on idea and original code of [[User:IKhitron]].&lt;br /&gt;
&lt;br /&gt;
the source of this module is in //he.wikipedia.org/wiki/Module:ParamValidator&lt;br /&gt;
&lt;br /&gt;
main purpose: use &amp;quot;templatedata&amp;quot; to verify the parameters passed to a template&lt;br /&gt;
&lt;br /&gt;
Terminology: &amp;quot;numeric parameter&amp;quot; means order-based parameter. e.g. if the template is transcluded like so {{x  | k |  | a = m | b = }}&lt;br /&gt;
&amp;quot;a&amp;quot; and &amp;quot;b&amp;quot; are &amp;quot;named&amp;quot; parameters, and there are 2 &amp;quot;numeric&amp;quot;, or order based parameters, 1 and 2. &lt;br /&gt;
we say that the value of a is &amp;quot;m&amp;quot;, the value of 1 is &amp;quot;k&amp;quot;, and &amp;quot;b&amp;quot; and 2 are &amp;quot;empty&amp;quot;.&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;
{&lt;br /&gt;
	violation1 = { param1 = value1, param2 = value2 },&lt;br /&gt;
	violation2 = { ... },&lt;br /&gt;
	...&lt;br /&gt;
}&lt;br /&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;quot;no-templatedata&amp;quot;: 			no valid tempaltedata was found in tempalte page, or documentation subpage&lt;br /&gt;
	* &amp;quot;undeclared&amp;quot;: 				named parameters with non-empty value, does not exist in templatedata&lt;br /&gt;
	* &amp;quot;empty-undeclared&amp;quot;: 			named parameters with empty value, does not exist in templatedata&lt;br /&gt;
	* &amp;quot;undeclared-numeric&amp;quot;: 		numeric parameters with non-empty value, does not exist in templatedata&lt;br /&gt;
	* &amp;quot;empty-undeclared-numeric&amp;quot;: 	numeric parameters with empty value, does not exist in templatedata&lt;br /&gt;
	* &amp;quot;deprecated&amp;quot;:  				parameters with non-empty value, marked as &amp;quot;deprecated&amp;quot; in tempaltedata&lt;br /&gt;
	* &amp;quot;empty-deprecated&amp;quot;:  			parameters with empty value, marked as &amp;quot;deprecated&amp;quot; in tempaltedata&lt;br /&gt;
	* &amp;quot;empty-required&amp;quot;: 			missing or empty parameter marked as &amp;quot;required&amp;quot; in tempaltedata&lt;br /&gt;
	* &amp;quot;incompatible&amp;quot;:				a non-empty parameter passed to the template, incompatible with the parameter type defined in templatedata &lt;br /&gt;
	* &amp;quot;duplicate&amp;quot;:					a value is passed for the same parameter (or any of its aliases) more than once&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;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{#invoke:ParamValidator | validateParams | options = {{PV default options}} }}&amp;lt;/includeonly&amp;gt;&lt;br /&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;
to bypass some mediawiki limitation, it is also possible to pass the options as &amp;quot;module&amp;quot;, like so (use one of the two, but not both):&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{#invoke:ParamValidator | validateParams | module_options = Module:PV default options}} }}&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the first form expects a template named &amp;quot;Template:PV default options&amp;quot; which contains the options, and the 2nd form expects a module, &lt;br /&gt;
suitable for mw.loadData(), which returns a map of namespace =&amp;gt; options (i.e. { [0] = &amp;lt;options&amp;gt;, [2] =&amp;gt; &amp;lt;options&amp;gt; } .... )&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 [[Template:PV default options]] 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;
{&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;
&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;
1) several tokens are replaced with calculated values. these are described below.&lt;br /&gt;
2) some &amp;quot;meta&amp;quot; violations are calculated: when any none-ignored violation occured, &lt;br /&gt;
	the &amp;quot;any&amp;quot; meta-violation is added to the output in the same way, &lt;br /&gt;
	i.e. the string keyed by &amp;quot;any&amp;quot; in the options is appended to output with appropriate substitutions.&lt;br /&gt;
	similarly, &amp;quot;multiple&amp;quot; meta-violation is created when more than one type of non-ignored violations occured.&lt;br /&gt;
3) 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;quot;templatename&amp;quot;:	full template name, including namespace.&lt;br /&gt;
	* &amp;quot;tname_naked&amp;quot;:	template name without namespace.&lt;br /&gt;
	* &amp;quot;paramname&amp;quot;:  	comma-separated list of parameters&lt;br /&gt;
	* &amp;quot;paramandvalue&amp;quot;: 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;quot;doc-subpage&amp;quot;: can be either a string, or a list (in square bracktes) of strings, indicating subpages of the template &lt;br /&gt;
			that may contain templatedata. &lt;br /&gt;
	* &amp;quot;ignore&amp;quot;: list of patterns. any parameter whose name matches any pattern, will not considered in violation of any of the rules.&lt;br /&gt;
	* &amp;quot;skip-empty-numeric&amp;quot;: if a quoted number, the module will ignore non-declared empty numeric parameters up to this number&lt;br /&gt;
	* &amp;quot;wrapper-prefix&amp;quot;: openning wrapper element of outpot (defaults to &amp;quot;&amp;lt;div class = &amp;#039;paramvalidator-wrapper&amp;#039;&amp;gt;&amp;quot;) &lt;br /&gt;
	* &amp;quot;wrapper-suffix&amp;quot;: closing wrapper element of output (defaults to &amp;quot;&amp;lt;/div&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;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;quot;key&amp;quot; can override any of the options fields described above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local util = {&lt;br /&gt;
	empty = function( s ) &lt;br /&gt;
		return s == nil  or type( s ) == &amp;#039;string&amp;#039; and mw.text.trim( s ) == &amp;#039;&amp;#039;   &lt;br /&gt;
	end&lt;br /&gt;
	, &lt;br /&gt;
	extract_options = function( frame, optionsPrefix )&lt;br /&gt;
		optionsPrefix = optionsPrefix or &amp;#039;options&amp;#039; &lt;br /&gt;
		&lt;br /&gt;
&lt;br /&gt;
		local options, n, more = {}&lt;br /&gt;
		if frame.args[&amp;#039;module_options&amp;#039;] then&lt;br /&gt;
			local module_options = mw.loadData( frame.args[&amp;#039;module_options&amp;#039;] ) &lt;br /&gt;
			if type( module_options ) ~= &amp;#039;table&amp;#039; then return {} end&lt;br /&gt;
			local title = mw.title.getCurrentTitle()&lt;br /&gt;
			local local_ptions = module_options[ title.namespace ] or module_options[ title.nsText ] or {} &lt;br /&gt;
			for k, v in pairs( local_ptions ) do options[k] = v end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		repeat&lt;br /&gt;
			ok, more = pcall( mw.text.jsonDecode, frame.args[optionsPrefix .. ( n or &amp;#039;&amp;#039; )] )&lt;br /&gt;
			if ok and type( more ) == &amp;#039;table&amp;#039; then&lt;br /&gt;
				for k, v in pairs( more ) do options[k] = v end&lt;br /&gt;
			end&lt;br /&gt;
			n = ( n or 0 ) + 1&lt;br /&gt;
		until not ok&lt;br /&gt;
&lt;br /&gt;
		return options&lt;br /&gt;
	end&lt;br /&gt;
	, &lt;br /&gt;
	build_namelist = function ( template_name, sp )&lt;br /&gt;
		local res = { template_name }&lt;br /&gt;
		if sp then&lt;br /&gt;
			if type( sp ) == &amp;#039;string&amp;#039; then sp = { sp } end&lt;br /&gt;
			for _, p in ipairs( sp ) do table.insert( res, template_name .. &amp;#039;/&amp;#039; .. p ) end&lt;br /&gt;
		end&lt;br /&gt;
		return res&lt;br /&gt;
	end&lt;br /&gt;
	,&lt;br /&gt;
	table_empty = function( t ) -- normally, test if next(t) is nil, but for some perverse reason, non-empty tables returned by loadData return nil...&lt;br /&gt;
		if type( t ) ~= &amp;#039;table&amp;#039; then return true end&lt;br /&gt;
		for a, b in pairs( t ) do return false end&lt;br /&gt;
		return true&lt;br /&gt;
	end&lt;br /&gt;
	,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local function _readTemplateData( templateName ) &lt;br /&gt;
	local title = mw.title.makeTitle( 0, templateName )  &lt;br /&gt;
	local templateContent = title and title.exists and title:getContent() -- template&amp;#039;s raw content&lt;br /&gt;
	local capture =  templateContent and mw.ustring.match( templateContent, &amp;#039;&amp;lt;templatedata%s*&amp;gt;(.*)&amp;lt;/templatedata%s*&amp;gt;&amp;#039; ) -- templatedata as text&lt;br /&gt;
--	capture = capture and mw.ustring.gsub( capture, &amp;#039;&amp;quot;(%d+)&amp;quot;&amp;#039;, tonumber ) -- convert &amp;quot;1&amp;quot;: {} to 1: {}. frame.args uses numerical indexes for order-based params.&lt;br /&gt;
	local trailingComma = capture and mw.ustring.find( capture, &amp;#039;,%s*[%]%}]&amp;#039; ) -- look for ,] or ,} : jsonDecode allows it, but it&amp;#039;s verbotten in json&lt;br /&gt;
	if capture and not trailingComma then return pcall( mw.text.jsonDecode, capture ) end&lt;br /&gt;
	return false&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function readTemplateData( templateName )&lt;br /&gt;
	if type( templateName ) == &amp;#039;string&amp;#039; then &lt;br /&gt;
		templateName = { templateName, templateName .. &amp;#039;/&amp;#039; .. docSubPage }&lt;br /&gt;
	end&lt;br /&gt;
	if type( templateName ) == &amp;quot;table&amp;quot; then&lt;br /&gt;
		for _, name in ipairs( templateName ) do&lt;br /&gt;
			local td, result = _readTemplateData( name ) &lt;br /&gt;
			if td then return result end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- this is the function to be called by other modules. it expects the frame, and then an optional list of subpages, e.g. { &amp;quot;Documentation&amp;quot; }.&lt;br /&gt;
-- if second parameter is nil, only tempalte page will be searched for templatedata.&lt;br /&gt;
local function calculateViolations( frame, subpages )&lt;br /&gt;
-- used for parameter type validy test. keyed by TD &amp;#039;type&amp;#039; string. values are function(val) returning bool.&lt;br /&gt;
	local type_validators = { &lt;br /&gt;
		[&amp;#039;number&amp;#039;] = function( s ) return mw.language.getContentLanguage():parseFormattedNumber( s ) end&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	local function compatible( typ, val )&lt;br /&gt;
		local func = type_validators[typ]&lt;br /&gt;
		return type( func ) ~= &amp;#039;function&amp;#039; or util.empty( val ) or func( val )&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local function list_empty_or_contains(ar, searched) &lt;br /&gt;
		if not ar or #ar == 0 then return true end &lt;br /&gt;
		for _, val in ipairs(ar) do if val == searched then return true end end&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local t_frame = frame:getParent()&lt;br /&gt;
	local t_args, template_name = t_frame.args, t_frame:getTitle()&lt;br /&gt;
	local td_source = util.build_namelist( template_name, subpages )&lt;br /&gt;
	local templatedata = readTemplateData( td_source )&lt;br /&gt;
	local td_params = templatedata and templatedata.params&lt;br /&gt;
	local all_aliases, all_series = {}, {}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	if not td_params then return { [&amp;#039;no-templatedata&amp;#039;] = { [&amp;#039;&amp;#039;] = &amp;#039;&amp;#039; } } end&lt;br /&gt;
	-- from this point on, we know templatedata is valid.&lt;br /&gt;
&lt;br /&gt;
	local res = {} -- before returning to caller, we&amp;#039;ll prune empty tables&lt;br /&gt;
&lt;br /&gt;
	-- allow for aliases&lt;br /&gt;
	for _, p in pairs( td_params ) do for _, alias in ipairs( p.aliases or {} ) do &lt;br /&gt;
		all_aliases[alias] = p&lt;br /&gt;
		if tonumber(alias) then all_aliases[tonumber(alias)] = p end&lt;br /&gt;
	end end&lt;br /&gt;
&lt;br /&gt;
	-- handle undeclared and deprecated&lt;br /&gt;
	local already_seen = {}&lt;br /&gt;
	local series = frame.args[&amp;#039;series&amp;#039;]&lt;br /&gt;
	for p_name, value in pairs( t_args ) do&lt;br /&gt;
		local tp_param, noval, numeric, table_name = td_params[p_name] or all_aliases[p_name], util.empty( value ), tonumber( p_name )&lt;br /&gt;
		local hasval = not noval&lt;br /&gt;
&lt;br /&gt;
		if not tp_param and series then -- 2nd chance. check to see if series&lt;br /&gt;
			for s_name, p in pairs(td_params) do &lt;br /&gt;
				if mw.ustring.match( p_name, &amp;#039;^&amp;#039; .. s_name .. &amp;#039;%d+&amp;#039; .. &amp;#039;$&amp;#039;) then &lt;br /&gt;
					-- mw.log(&amp;#039;found p_name &amp;#039;.. p_name .. &amp;#039;  s_name:&amp;#039; .. s_name, &amp;#039; p is:&amp;#039;, p) debugging series support&lt;br /&gt;
					tp_param = p &lt;br /&gt;
				end -- don&amp;#039;t bother breaking. td always correct.&lt;br /&gt;
			end 				&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if not tp_param then -- not in TD: this is called undeclared&lt;br /&gt;
			-- calculate the relevant table for this undeclared parameter, based on parameter and value types&lt;br /&gt;
			table_name = &lt;br /&gt;
				noval and numeric and &amp;#039;empty-undeclared-numeric&amp;#039; or&lt;br /&gt;
				noval and not numeric and &amp;#039;empty-undeclared&amp;#039; or&lt;br /&gt;
				hasval and numeric and &amp;#039;undeclared-numeric&amp;#039; or&lt;br /&gt;
				&amp;#039;undeclared&amp;#039; -- tzvototi nishar.&lt;br /&gt;
		else -- in td: test for deprecation and mistype. if deprecated, no further tests&lt;br /&gt;
			table_name = tp_param.deprecated and hasval and &amp;#039;deprecated&amp;#039; &lt;br /&gt;
				or tp_param.deprecated and noval and &amp;#039;empty-deprecated&amp;#039; &lt;br /&gt;
				or not compatible( tp_param.type, value ) and &amp;#039;incompatible&amp;#039; &lt;br /&gt;
				or not series and already_seen[tp_param] and hasval and &amp;#039;duplicate&amp;#039;&lt;br /&gt;
				or hasval and not list_empty_or_contains(tp_param.suggestedvalues , value) and &amp;#039;unsuggested-value&amp;#039;&lt;br /&gt;
&lt;br /&gt;
				&lt;br /&gt;
			already_seen[tp_param] = hasval&lt;br /&gt;
		end&lt;br /&gt;
		-- report it.&lt;br /&gt;
		if table_name then &lt;br /&gt;
			res[table_name] = res[table_name] or {}&lt;br /&gt;
			res[table_name][p_name] = value &lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- test for empty/missing paraeters declared &amp;quot;required&amp;quot; &lt;br /&gt;
	for p_name, param in pairs( td_params ) do &lt;br /&gt;
		if param.required and util.empty( t_args[p_name] ) then&lt;br /&gt;
			local is_alias&lt;br /&gt;
			for _, alias in ipairs( param.aliases or {} ) do is_alias = is_alias or not util.empty( t_args[alias] ) end&lt;br /&gt;
			if not is_alias then&lt;br /&gt;
				res[&amp;#039;empty-required&amp;#039;] = res[&amp;#039;empty-required&amp;#039;] or {} &lt;br /&gt;
				res[&amp;#039;empty-required&amp;#039;][p_name] = &amp;#039;&amp;#039; &lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return res&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- wraps report in hidden frame&lt;br /&gt;
local function wrapReport(report, template_name, options)&lt;br /&gt;
	if util.empty( report ) then return &amp;#039;&amp;#039; end&lt;br /&gt;
	local naked = mw.title.new( template_name )[&amp;#039;text&amp;#039;] &lt;br /&gt;
	&lt;br /&gt;
	mw.log(report)&lt;br /&gt;
	report = ( options[&amp;#039;wrapper-prefix&amp;#039;] or &amp;quot;&amp;lt;div class = &amp;#039;paramvalidator-wrapper&amp;#039;&amp;gt;&amp;lt;span class=&amp;#039;paramvalidator-error&amp;#039;&amp;gt;&amp;quot; )&lt;br /&gt;
			.. report&lt;br /&gt;
			.. ( options[&amp;#039;wrapper-suffix&amp;#039;] or &amp;quot;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&amp;quot; )&lt;br /&gt;
	&lt;br /&gt;
	report = mw.ustring.gsub( report, &amp;#039;tname_naked&amp;#039;, naked )&lt;br /&gt;
	report = mw.ustring.gsub( report, &amp;#039;templatename&amp;#039;, template_name )&lt;br /&gt;
	return report&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- this is the &amp;quot;user&amp;quot; version, called with {{#invoke:}} returns a string, as defined by the options parameter&lt;br /&gt;
local function validateParams( frame )&lt;br /&gt;
	&lt;br /&gt;
	-- for purple pages:&lt;br /&gt;
	if frame:getParent().args[&amp;#039;skip parameters validation&amp;#039;] then return &amp;#039;[[ קטגוריה:דפים עם שגיאות פרמטריות שקיבלו חנינה]]&amp;#039; end&lt;br /&gt;
	local options, report, template_name = util.extract_options( frame ), &amp;#039;&amp;#039;, frame:getParent():getTitle()&lt;br /&gt;
&lt;br /&gt;
	local ignore = function( p_name )&lt;br /&gt;
		for _, pattern in ipairs( options[&amp;#039;ignore&amp;#039;] or {} ) do&lt;br /&gt;
			if mw.ustring.match( p_name, &amp;#039;^&amp;#039; .. pattern .. &amp;#039;$&amp;#039; ) then return true end&lt;br /&gt;
		end&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local replace_macros = function( s, param_names )&lt;br /&gt;
		local function concat_and_escape( t ) &lt;br /&gt;
			local s = table.concat( t, &amp;#039;, &amp;#039; )&lt;br /&gt;
			return ( mw.ustring.gsub( s, &amp;#039;%%&amp;#039;, &amp;#039;%%%%&amp;#039; ) )&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if s and ( type( param_names ) == &amp;#039;table&amp;#039; ) then&lt;br /&gt;
			local k_ar, kv_ar = {}, {}&lt;br /&gt;
			for k, v in pairs( param_names ) do&lt;br /&gt;
				table.insert( k_ar, k )&lt;br /&gt;
				table.insert( kv_ar, k .. &amp;#039;: &amp;#039; .. v)&lt;br /&gt;
			end&lt;br /&gt;
			s = mw.ustring.gsub( s, &amp;#039;paramname&amp;#039;, concat_and_escape( k_ar ) ) &lt;br /&gt;
			s = mw.ustring.gsub( s, &amp;#039;paramandvalue&amp;#039;, concat_and_escape( kv_ar ) )&lt;br /&gt;
		end&lt;br /&gt;
		return s&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local report_params = function( key, param_names )&lt;br /&gt;
		local res = replace_macros( options[key], param_names )&lt;br /&gt;
		report = report ..  ( res or &amp;#039;&amp;#039; )&lt;br /&gt;
		return res&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- no option no work.&lt;br /&gt;
	if util.table_empty( options ) then return &amp;#039;&amp;#039; end&lt;br /&gt;
&lt;br /&gt;
	-- get the errors.&lt;br /&gt;
	local violations = calculateViolations( frame, options[&amp;#039;doc-subpage&amp;#039;] )&lt;br /&gt;
	-- special request of bora: use skip_empty_numeric&lt;br /&gt;
	if violations[&amp;#039;empty-undeclared-numeric&amp;#039;] then &lt;br /&gt;
		for i = 1, tonumber( options[&amp;#039;skip-empty-numeric&amp;#039;] ) or 0 do &lt;br /&gt;
			violations[&amp;#039;empty-undeclared-numeric&amp;#039;][i] = nil &lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- handle ignore list, and prune empty violations - in that order!&lt;br /&gt;
	local offenders = 0&lt;br /&gt;
	for name, tab in pairs( violations ) do &lt;br /&gt;
		-- remove ignored parameters from all violations&lt;br /&gt;
		for pname in pairs( tab ) do if ignore( pname ) then tab[pname] = nil end end&lt;br /&gt;
		-- prune empty violations&lt;br /&gt;
		if util.table_empty( tab ) then violations[name] = nil end&lt;br /&gt;
	-- WORK IS DONE. report the errors.&lt;br /&gt;
	-- if report then count it.&lt;br /&gt;
		if violations[name] and report_params( name, tab ) then offenders = offenders + 1 end &lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if offenders &amp;gt; 1 then report_params( &amp;#039;multiple&amp;#039; ) end&lt;br /&gt;
	if offenders ~= 0 then report_params( &amp;#039;any&amp;#039; ) end -- could have tested for empty( report ), but since we count them anyway...&lt;br /&gt;
	return wrapReport(report, template_name, options)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	[&amp;#039;validateparams&amp;#039;] = validateParams,&lt;br /&gt;
	[&amp;#039;calculateViolations&amp;#039;] = calculateViolations,&lt;br /&gt;
	[&amp;#039;wrapReport&amp;#039;] = wrapReport&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>חלוקת קונטרסים</name></author>
	</entry>
</feed>