<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://thehillside.info/index.php?action=history&amp;feed=atom&amp;title=Module%3ACheck_for_unknown_parameters</id>
	<title>Module:Check for unknown parameters - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://thehillside.info/index.php?action=history&amp;feed=atom&amp;title=Module%3ACheck_for_unknown_parameters"/>
	<link rel="alternate" type="text/html" href="https://thehillside.info/index.php?title=Module:Check_for_unknown_parameters&amp;action=history"/>
	<updated>2026-04-07T04:20:20Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://thehillside.info/index.php?title=Module:Check_for_unknown_parameters&amp;diff=2284&amp;oldid=prev</id>
		<title>SheldonBole: 1 revision imported: Import Template:Sp</title>
		<link rel="alternate" type="text/html" href="https://thehillside.info/index.php?title=Module:Check_for_unknown_parameters&amp;diff=2284&amp;oldid=prev"/>
		<updated>2020-06-18T06:56:21Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported: Import Template:Sp&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;en-GB&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 08:56, 18 June 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>SheldonBole</name></author>
	</entry>
	<entry>
		<id>https://thehillside.info/index.php?title=Module:Check_for_unknown_parameters&amp;diff=2283&amp;oldid=prev</id>
		<title>en&gt;Gonnym: Added entry point for modules per talk page discussion. Report any errors on talk page.</title>
		<link rel="alternate" type="text/html" href="https://thehillside.info/index.php?title=Module:Check_for_unknown_parameters&amp;diff=2283&amp;oldid=prev"/>
		<updated>2020-01-07T17:25:33Z</updated>

		<summary type="html">&lt;p&gt;Added entry point for modules per talk page discussion. Report any errors on talk page.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module may be used to compare the arguments passed to the parent&lt;br /&gt;
-- with a list of arguments, returning a specified result if an argument is&lt;br /&gt;
-- not on the list&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function trim(s)&lt;br /&gt;
	return s:match(&amp;#039;^%s*(.-)%s*$&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function isnotempty(s)&lt;br /&gt;
	return s and s:match(&amp;#039;%S&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function clean(text)&lt;br /&gt;
	-- Return text cleaned for display and truncated if too long.&lt;br /&gt;
	-- Strip markers are replaced with dummy text representing the original wikitext.&lt;br /&gt;
	local pos, truncated&lt;br /&gt;
	local function truncate(text)&lt;br /&gt;
		if truncated then&lt;br /&gt;
			return &amp;#039;&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		if mw.ustring.len(text) &amp;gt; 25 then&lt;br /&gt;
			truncated = true&lt;br /&gt;
			text = mw.ustring.sub(text, 1, 25) .. &amp;#039;...&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		return mw.text.nowiki(text)&lt;br /&gt;
	end&lt;br /&gt;
	local parts = {}&lt;br /&gt;
	for before, tag, remainder in text:gmatch(&amp;#039;([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()&amp;#039;) do&lt;br /&gt;
		pos = remainder&lt;br /&gt;
		table.insert(parts, truncate(before) .. &amp;#039;&amp;amp;lt;&amp;#039; .. tag .. &amp;#039;&amp;amp;gt;...&amp;amp;lt;/&amp;#039; .. tag .. &amp;#039;&amp;amp;gt;&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	table.insert(parts, truncate(text:sub(pos or 1)))&lt;br /&gt;
	return table.concat(parts)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._check(args, pargs)&lt;br /&gt;
	if type(args) ~= &amp;quot;table&amp;quot; or type(pargs) ~= &amp;quot;table&amp;quot; then&lt;br /&gt;
		-- TODO: error handling&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ignoreblank = isnotempty(args[&amp;#039;ignoreblank&amp;#039;])&lt;br /&gt;
	local showblankpos = isnotempty(args[&amp;#039;showblankpositional&amp;#039;])&lt;br /&gt;
	local knownargs = {}&lt;br /&gt;
	local unknown = args[&amp;#039;unknown&amp;#039;] or &amp;#039;Found _VALUE_, &amp;#039;&lt;br /&gt;
	local preview = args[&amp;#039;preview&amp;#039;]&lt;br /&gt;
&lt;br /&gt;
	local values = {}&lt;br /&gt;
	local res = {}&lt;br /&gt;
	local regexps = {}&lt;br /&gt;
&lt;br /&gt;
	-- create the list of known args, regular expressions, and the return string&lt;br /&gt;
	for k, v in pairs(args) do&lt;br /&gt;
		if type(k) == &amp;#039;number&amp;#039; then&lt;br /&gt;
			v = trim(v)&lt;br /&gt;
			knownargs[v] = 1&lt;br /&gt;
		elseif k:find(&amp;#039;^regexp[1-9][0-9]*$&amp;#039;) then&lt;br /&gt;
			table.insert(regexps, &amp;#039;^&amp;#039; .. v .. &amp;#039;$&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if isnotempty(preview) then&lt;br /&gt;
		preview = &amp;#039;&amp;lt;div class=&amp;quot;hatnote&amp;quot; style=&amp;quot;color:red&amp;quot;&amp;gt;&amp;lt;strong&amp;gt;Warning:&amp;lt;/strong&amp;gt; &amp;#039; .. preview .. &amp;#039; (this message is shown only in preview).&amp;lt;/div&amp;gt;&amp;#039;&lt;br /&gt;
	elseif preview == nil then&lt;br /&gt;
		preview = unknown&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- loop over the parent args, and make sure they are on the list&lt;br /&gt;
	for k, v in pairs(pargs) do&lt;br /&gt;
		if type(k) == &amp;#039;string&amp;#039; and knownargs[k] == nil then&lt;br /&gt;
			local knownflag = false&lt;br /&gt;
			for _, regexp in ipairs(regexps) do&lt;br /&gt;
				if mw.ustring.match(k, regexp) then&lt;br /&gt;
					knownflag = true&lt;br /&gt;
					break&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if not knownflag and ( not ignoreblank or isnotempty(v) )  then&lt;br /&gt;
				table.insert(values, clean(k))&lt;br /&gt;
			end&lt;br /&gt;
		elseif type(k) == &amp;#039;number&amp;#039; and&lt;br /&gt;
			knownargs[tostring(k)] == nil and&lt;br /&gt;
			( showblankpos or isnotempty(v) )&lt;br /&gt;
		then&lt;br /&gt;
			table.insert(values, k .. &amp;#039; = &amp;#039; .. clean(v))&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- add results to the output tables&lt;br /&gt;
	if #values &amp;gt; 0 then&lt;br /&gt;
		if mw.getCurrentFrame():preprocess( &amp;quot;{{REVISIONID}}&amp;quot; ) == &amp;quot;&amp;quot; then&lt;br /&gt;
			unknown = preview&lt;br /&gt;
		end&lt;br /&gt;
		for _, v in pairs(values) do&lt;br /&gt;
			if v == &amp;#039;&amp;#039; then&lt;br /&gt;
				-- Fix odd bug for | = which gets stripped to the empty string and&lt;br /&gt;
				-- breaks category links&lt;br /&gt;
				v = &amp;#039; &amp;#039;&lt;br /&gt;
			end&lt;br /&gt;
			-- avoid error with v = &amp;#039;example%2&amp;#039; (&amp;quot;invalid capture index&amp;quot;)&lt;br /&gt;
			local r =  unknown:gsub(&amp;#039;_VALUE_&amp;#039;, {_VALUE_ = v})&lt;br /&gt;
			table.insert(res, r)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return table.concat(res)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.check(frame)&lt;br /&gt;
	local args = frame.args&lt;br /&gt;
	local pargs = frame:getParent().args&lt;br /&gt;
	return p._check(args, pargs)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>en&gt;Gonnym</name></author>
	</entry>
</feed>