<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2Ftrappist_the_monk%2Fparameter_match_test</id>
	<title>Module:Sandbox/trappist the monk/parameter match test - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2Ftrappist_the_monk%2Fparameter_match_test"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/trappist_the_monk/parameter_match_test&amp;action=history"/>
	<updated>2026-05-25T23:00:14Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Sandbox/trappist_the_monk/parameter_match_test&amp;diff=146624&amp;oldid=prev</id>
		<title>imported&gt;Legoktm: Replace Module:No globals with require( &quot;strict&quot; )</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/trappist_the_monk/parameter_match_test&amp;diff=146624&amp;oldid=prev"/>
		<updated>2022-10-23T21:11:57Z</updated>

		<summary type="html">&lt;p&gt;Replace &lt;a href=&quot;/research/Module:No_globals&quot; title=&quot;Module:No globals&quot;&gt;Module:No globals&lt;/a&gt; with require( &amp;quot;strict&amp;quot; )&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[[--------------------------&amp;lt; P A R A M E T E R   M A T C H   T E S T &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
this module is a hack intended to be run from the debug console.  The module assembles and then compares lists&lt;br /&gt;
of cs1|2 parameters extracted from the cs1|2 whitelist module and from the cs1|2 configuration module.  In general,&lt;br /&gt;
these lists should match.&lt;br /&gt;
&lt;br /&gt;
the module returns one of five tables.  In the debug console the commands are:&lt;br /&gt;
	=p.aliases – returns the list of parameters and their associated meta parameter from the ~/Configuration module&lt;br /&gt;
	=p.aliases_dups – returns a list of parameters that appear in more than one meta parameter (not necessarily a bad thing depending on the version of the cs1|2 module suite)&lt;br /&gt;
	=p.whitelist – returns the list of parameters from the ~/Whitelist module&lt;br /&gt;
	=p.alias_params_not_in_whitelist – returns a list of parameters found in the ~/Configuration module but not found in the ~/Whitelist module&lt;br /&gt;
	=p.wh_params_not_in_aliases – returns a list of parameters found in the ~/Whitelist module but not found in the ~/Configuration module&lt;br /&gt;
&lt;br /&gt;
set &amp;lt;use_sandboxen&amp;gt; to true to run the above comparisons against the module suite&amp;#039;s sandboxen.  if sandboxen don&amp;#039;t exist, &amp;lt;use_sandboxen&amp;gt; is ignored&lt;br /&gt;
&lt;br /&gt;
copies of this module are located at:&lt;br /&gt;
	da:Modul:Sandkasse/trappist the monk/parameter match test&lt;br /&gt;
	en:Module:Sandbox/trappist_the_monk/parameter_match_test&lt;br /&gt;
	es:Módulo:Zona de pruebas/trappist_the_monk/parameter_match_test			-- couldn&amp;#039;t create there; I don&amp;#039;t have permission&lt;br /&gt;
	it:Modulo:Sandbox/trappist_the_monk/parameter_match_test&lt;br /&gt;
	no:Modul:Sandbox/trappist the monk/parameter match test&lt;br /&gt;
	pt:Módulo:Usuário(a)/trappist the monk/parameter match test&lt;br /&gt;
	tr:																			-- couldn&amp;#039;t create there; I don&amp;#039;t have permission?&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
require(&amp;#039;strict&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
local lang_code = mw.language.getContentLanguage():getCode();					-- so that this can be used at multiple wikis&lt;br /&gt;
--lang_code = &amp;#039;TR&amp;#039;;																-- for those wikis where I do not have permission to create this module; uppercase to use local copies&lt;br /&gt;
local use_sandboxen = false;													-- set to true to evaluate the modules suite&amp;#039;s sandboxen&lt;br /&gt;
&lt;br /&gt;
local module;																	-- name of module to be loaded is assembled here&lt;br /&gt;
&lt;br /&gt;
local modules = {&lt;br /&gt;
	da = {whitelist = &amp;#039;Modul:Citation/CS1/Whitelist&amp;#039;, configuration = &amp;#039;Modul:Citation/CS1/Configuration&amp;#039;},&lt;br /&gt;
	en = {whitelist = &amp;#039;Module:Citation/CS1/Whitelist&amp;#039;, configuration = &amp;#039;Module:Citation/CS1/Configuration&amp;#039;},&lt;br /&gt;
	es = {whitelist = &amp;#039;Módulo:Citas/Whitelist&amp;#039;, configuration = &amp;#039;Módulo:Citas/Configuración&amp;#039;},				-- can&amp;#039;t create this module at es.wiki; no permission&lt;br /&gt;
	it = {whitelist = &amp;#039;Modulo:Citazione/Whitelist&amp;#039;, configuration = &amp;#039;Modulo:Citazione/Configurazione&amp;#039;},&lt;br /&gt;
	nb = {whitelist = &amp;#039;Modul:Citation/CS1/Whitelist&amp;#039;, configuration = &amp;#039;Modul:Citation/CS1/Configuration&amp;#039;},	-- language code different from interwiki code for no.wiki&lt;br /&gt;
	tr = {whitelist = &amp;#039;Modül:Kaynak/KB1/Beyazliste&amp;#039;, configuration = &amp;#039;Modül:Kaynak/KB1/Yapılandırma&amp;#039;},		-- can&amp;#039;t create this module at tr.wiki; no permission?&lt;br /&gt;
																											-- local copies for when I can&amp;#039;t create this module at xx.wiki&lt;br /&gt;
	ES = {whitelist = &amp;#039;Module:Sandbox/trappist_the_monk/parameter_match_test/Whitelist/es&amp;#039;, configuration = &amp;#039;Module:Sandbox/trappist_the_monk/parameter_match_test/Configuration/es&amp;#039;},&lt;br /&gt;
	TR = {whitelist = &amp;#039;Module:Sandbox/trappist_the_monk/parameter_match_test/Whitelist/tr&amp;#039;, configuration = &amp;#039;Module:Sandbox/trappist_the_monk/parameter_match_test/Configuration/tr&amp;#039;},&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local sandboxen = {&lt;br /&gt;
	da = &amp;#039;/sandkasse&amp;#039;,&lt;br /&gt;
	en = &amp;#039;/sandbox&amp;#039;,&lt;br /&gt;
	es = nil,																	-- apparently &amp;#039;/zona de pruebas&amp;#039; but as of 2021-08-30 only Módulo:Citas/zona de pruebas exists&lt;br /&gt;
	it = &amp;#039;/sandbox&amp;#039;,&lt;br /&gt;
	nb = &amp;#039;/sandkasse&amp;#039;,&lt;br /&gt;
	tr = nil,																	-- apparently &amp;#039;/deneme&amp;#039; or possibly &amp;#039;/sandbox&amp;#039;; as of 2021-08-30 none exist&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local whitelist_m = mw.loadData (table.concat ({modules[lang_code].whitelist, use_sandboxen and sandboxen[lang_code] or &amp;#039;&amp;#039;}));&lt;br /&gt;
local whitelist_t = {};															-- a master list of all whitelist parameters&lt;br /&gt;
&lt;br /&gt;
local simple_sections = {&lt;br /&gt;
	&amp;#039;basic_arguments&amp;#039;,&lt;br /&gt;
	&amp;#039;numbered_arguments&amp;#039;,&lt;br /&gt;
	&amp;#039;limited_basic_arguments&amp;#039;,&lt;br /&gt;
	&amp;#039;limited_numbered_arguments&amp;#039;,&lt;br /&gt;
	&amp;#039;arxiv_basic_arguments&amp;#039;,&lt;br /&gt;
	&amp;#039;biorxiv_basic_arguments&amp;#039;,&lt;br /&gt;
	&amp;#039;citeseerx_basic_arguments&amp;#039;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local special_sections = {&amp;#039;preprint_arguments&amp;#039;, &amp;#039;unique_arguments&amp;#039;};&lt;br /&gt;
&lt;br /&gt;
local configuration_m = mw.loadData (table.concat ({modules[lang_code].configuration, use_sandboxen and sandboxen[lang_code] or &amp;#039;&amp;#039;}));&lt;br /&gt;
local aliases_t = {};															-- a master k/v table of all parameter aliases&lt;br /&gt;
local aliases_dups_t = {};														-- a sequence table of parameter aliases that are used in multiple metaparameters&lt;br /&gt;
&lt;br /&gt;
local wh_params_not_in_aliases_t = {};											-- a sequence table of whitelist parameters not found in the master aliases list&lt;br /&gt;
local alias_params_not_in_whitelist_t = {};										-- a sequence table of alias list parameters not found in the master whitelist&lt;br /&gt;
&lt;br /&gt;
for _, section in ipairs (simple_sections) do&lt;br /&gt;
	if whitelist_m[section] then												-- not all simple sections used in every cs1|2 implementation&lt;br /&gt;
		for k, _ in pairs (whitelist_m[section]) do								-- for each of the whitelist tables that do not have subtables&lt;br /&gt;
			whitelist_t[k] = section;											-- save the parameter name with section name (just because and all  = true is boring)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
if whitelist_m[special_sections[1]] or whitelist_m[special_sections[1]] then	-- not all implementations of cs1|2 have these sections&lt;br /&gt;
	for _, section in ipairs (special_sections) do&lt;br /&gt;
		for k1, v1_t in pairs (whitelist_m[section]) do&lt;br /&gt;
			for k, v in pairs (whitelist_m[section][k1]) do&lt;br /&gt;
				whitelist_t[k] = table.concat ({section, &amp;#039;[&amp;#039;, k1, &amp;#039;]&amp;#039;});		-- save the parameter name with section name (just because and all  = true is boring)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
for meta, params_t in pairs (configuration_m.aliases) do						-- build a list of all parameters in the ~/Configuration aliases table&lt;br /&gt;
	if &amp;#039;table&amp;#039; == type (params_t) then											-- when only one parameter assigned to &amp;lt;meta&amp;gt;(parameter) it is type string&lt;br /&gt;
		for _, param in ipairs (params_t) do									-- loop through the sequence table of parameters associated with &amp;lt;meta&amp;gt; &lt;br /&gt;
			if aliases_t[param] then											-- if already in &amp;lt;aliases_t&amp;gt;&lt;br /&gt;
				table.insert (aliases_dups_t, table.concat ({&amp;#039;\&amp;#039;&amp;#039;, param, &amp;#039;\&amp;#039; in: \&amp;#039;&amp;#039;, meta, &amp;#039;\&amp;#039; duplicated in: \&amp;#039;&amp;#039;, aliases_t[param], &amp;#039;\&amp;#039;&amp;#039;}));	-- make a note&lt;br /&gt;
			else&lt;br /&gt;
				aliases_t[param] = meta;										-- add this &amp;lt;param&amp;gt; with its associated &amp;lt;meta&amp;gt; to &amp;lt;aliases_t&amp;gt;&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			if param:find (&amp;#039;#&amp;#039;, 1, true) then									-- if this is an enumerated parameter&lt;br /&gt;
				param = param:gsub (&amp;#039;#&amp;#039;, &amp;#039;&amp;#039;);									-- make a parameter without enumeration&lt;br /&gt;
				if aliases_t[param] then										-- if already in &amp;lt;aliases_t&amp;gt;&lt;br /&gt;
					if meta ~= aliases_t[param] then&lt;br /&gt;
						table.insert (aliases_dups_t, table.concat ({&amp;#039;\&amp;#039;&amp;#039;, param, &amp;#039;\&amp;#039;,  in: \&amp;#039;&amp;#039;, meta, &amp;#039;\&amp;#039; duplicated in: \&amp;#039;&amp;#039;, aliases_t[param], &amp;#039;\&amp;#039; (enumneration)&amp;#039;}));	-- make a note&lt;br /&gt;
					end&lt;br /&gt;
				else&lt;br /&gt;
					aliases_t[param] = meta;									-- add this &amp;lt;param&amp;gt; with its associated &amp;lt;meta&amp;gt; to &amp;lt;aliases_t&amp;gt;&lt;br /&gt;
				end&lt;br /&gt;
			end	&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif &amp;#039;string&amp;#039; == type (params_t) then										-- here when &amp;lt;params_t&amp;gt; is a string&lt;br /&gt;
		local param = params_t;&lt;br /&gt;
		if aliases_t[param] then												-- if already in &amp;lt;aliases_t&amp;gt;&lt;br /&gt;
			table.insert (aliases_dups_t, table.concat ({&amp;#039;\&amp;#039;&amp;#039;, param, &amp;#039;\&amp;#039; in: \&amp;#039;&amp;#039;, meta, &amp;#039;\&amp;#039; duplicated in: \&amp;#039;&amp;#039;, aliases_t[param], &amp;#039;\&amp;#039;&amp;#039;}));	-- make a note&lt;br /&gt;
		else&lt;br /&gt;
			aliases_t[param] = meta;											-- add this &amp;lt;param&amp;gt; with its associated &amp;lt;meta&amp;gt; to &amp;lt;aliases_t&amp;gt;&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif &amp;#039;number&amp;#039; == type (params_t) then										-- here when &amp;lt;params_t&amp;gt; is a number&lt;br /&gt;
		local param = params_t;&lt;br /&gt;
		param = table.concat ({&amp;#039;error: alias &amp;#039;, tostring (param), &amp;#039; in metaparameter: &amp;#039;, meta, &amp;#039; is not a string or table&amp;#039;});&lt;br /&gt;
		aliases_t[param] = meta;												-- add this &amp;lt;param&amp;gt; with its error message to &amp;lt;aliases_t&amp;gt;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
for id, v_t in pairs (configuration_m.id_handlers) do&lt;br /&gt;
	for k, param in ipairs (v_t.parameters) do&lt;br /&gt;
		if aliases_t[param] then												-- if already in &amp;lt;aliases_t&amp;gt;&lt;br /&gt;
			table.insert (aliases_dups_t, table.concat ({param, &amp;#039; in: id_handlers[&amp;#039;, id, &amp;#039;].parameters&amp;#039;, &amp;#039; duplicated in: &amp;#039;, aliases_t[param]}));	-- make a note&lt;br /&gt;
		else&lt;br /&gt;
			aliases_t[param] = table.concat ({&amp;#039;id_handlers[&amp;#039;, id, &amp;#039;].parameters&amp;#039;});	-- add this &amp;lt;param&amp;gt; with its associated id_hamdler to &amp;lt;aliases_t&amp;gt;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local param = v_t.custom_access;&lt;br /&gt;
	if param and aliases_t[param] then											-- if already in &amp;lt;aliases_t&amp;gt;&lt;br /&gt;
		table.insert (aliases_dups_t, table.concat ({param, &amp;#039; in: id_handlers.&amp;#039;, &amp;#039;custom_access&amp;#039;, &amp;#039; duplicated in: &amp;#039;, aliases_t[param]}));	-- make a note&lt;br /&gt;
	elseif param then&lt;br /&gt;
		aliases_t[param] = table.concat ({&amp;#039;id_handlers.&amp;#039;, &amp;#039;custom_access&amp;#039;});	-- add this &amp;lt;param&amp;gt; with its associated id_hamdler to &amp;lt;aliases_t&amp;gt;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
for wl_param, _ in pairs (whitelist_t) do&lt;br /&gt;
	if not aliases_t[wl_param] then&lt;br /&gt;
		table.insert (wh_params_not_in_aliases_t, wl_param);&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
for alias, meta in pairs (aliases_t) do&lt;br /&gt;
	if not whitelist_t[alias] then&lt;br /&gt;
		table.insert (alias_params_not_in_whitelist_t, table.concat ({alias, &amp;#039; (&amp;#039;, meta, &amp;#039;)&amp;#039;}));&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
table.sort (wh_params_not_in_aliases_t);										-- sort so the lists are more pretty-like&lt;br /&gt;
table.sort (alias_params_not_in_whitelist_t);&lt;br /&gt;
table.sort (aliases_dups_t);&lt;br /&gt;
&lt;br /&gt;
table.insert (wh_params_not_in_aliases_t, 1,									-- insert headers to describe the lists&lt;br /&gt;
	table.concat ({&lt;br /&gt;
		&amp;#039;~/Whitelist&amp;#039;,&lt;br /&gt;
		use_sandboxen and sandboxen[lang_code] or &amp;#039;&amp;#039;,&lt;br /&gt;
		&amp;#039; parameters not found in ~/Configuration&amp;#039;,&lt;br /&gt;
		use_sandboxen and sandboxen[lang_code] or &amp;#039;&amp;#039;&lt;br /&gt;
		, &amp;#039; aliases list:&amp;#039;&lt;br /&gt;
		}));&lt;br /&gt;
table.insert (alias_params_not_in_whitelist_t, 1,&lt;br /&gt;
	table.concat ({&lt;br /&gt;
		&amp;#039;~/Configuration&amp;#039;,&lt;br /&gt;
		use_sandboxen and sandboxen[lang_code] or &amp;#039;&amp;#039;,&lt;br /&gt;
		&amp;#039; alias parameters not found in ~/Whitelist&amp;#039;,&lt;br /&gt;
		use_sandboxen and sandboxen[lang_code] or &amp;#039;&amp;#039;,&lt;br /&gt;
		&amp;#039;:&amp;#039;&lt;br /&gt;
		}));&lt;br /&gt;
table.insert (aliases_dups_t, 1,&lt;br /&gt;
	table.concat({&lt;br /&gt;
		&amp;#039;parameters found in multiple ~/Configuration&amp;#039;,&lt;br /&gt;
		use_sandboxen and sandboxen[lang_code] or &amp;#039;&amp;#039;,&lt;br /&gt;
		&amp;#039; metaparameters:&amp;#039;&lt;br /&gt;
		}));&lt;br /&gt;
&lt;br /&gt;
local aliases = mw.dumpObject (aliases_t);&lt;br /&gt;
local aliases_dups = table.concat (aliases_dups_t, &amp;#039;\n\t&amp;#039;);&lt;br /&gt;
local wh_params_not_in_aliases = table.concat (wh_params_not_in_aliases_t, &amp;#039;\n\t&amp;#039;);&lt;br /&gt;
local whitelist = mw.dumpObject (whitelist_t);&lt;br /&gt;
local alias_params_not_in_whitelist = table.concat (alias_params_not_in_whitelist_t, &amp;#039;\n\t&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	aliases = aliases,&lt;br /&gt;
	aliases_dups = aliases_dups,&lt;br /&gt;
	whitelist = whitelist,&lt;br /&gt;
	alias_params_not_in_whitelist = alias_params_not_in_whitelist,&lt;br /&gt;
	wh_params_not_in_aliases = wh_params_not_in_aliases,&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>imported&gt;Legoktm</name></author>
	</entry>
</feed>