<?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%3AFRS_notification</id>
	<title>Module:FRS notification - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AFRS_notification"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:FRS_notification&amp;action=history"/>
	<updated>2026-05-24T19:01:08Z</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:FRS_notification&amp;diff=136143&amp;oldid=prev</id>
		<title>imported&gt;Naypta: Moving space into the actual template</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:FRS_notification&amp;diff=136143&amp;oldid=prev"/>
		<updated>2020-07-08T17:39:32Z</updated>

		<summary type="html">&lt;p&gt;Moving space into the actual template&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.notification(frame)&lt;br /&gt;
	local args = frame:getParent().args&lt;br /&gt;
	local argNums = getArgNums(args, &amp;quot;title&amp;quot;)&lt;br /&gt;
	local out = &amp;quot;&amp;quot;&lt;br /&gt;
	local multipleInHeader = false&lt;br /&gt;
	for index, num in ipairs(argNums) do&lt;br /&gt;
		num = tostring(num)&lt;br /&gt;
		&lt;br /&gt;
		local ending = &amp;quot;&amp;quot;&lt;br /&gt;
		&lt;br /&gt;
		local argsForOutput = {&lt;br /&gt;
				title = args[&amp;quot;title&amp;quot; .. num],&lt;br /&gt;
				rfcid = args[&amp;quot;rfcid&amp;quot; .. num],&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		if index == 1&lt;br /&gt;
		or not isOffsetItemSameHeader(args, argNums, index, -1)&lt;br /&gt;
		then&lt;br /&gt;
			-- it&amp;#039;s the first in the header! pass firstInHeader&lt;br /&gt;
			argsForOutput[&amp;quot;firstInHeader&amp;quot;] = true&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- if there&amp;#039;s multiple of a single type and header, i.e.&lt;br /&gt;
		-- the next item is of the same header, don&amp;#039;t&lt;br /&gt;
		-- write the type every time; it&amp;#039;s just not needed&lt;br /&gt;
		if index ~= #argNums&lt;br /&gt;
		and isOffsetItemSameHeader(args, argNums, index, 1)&lt;br /&gt;
		then&lt;br /&gt;
			multipleInHeader = true&lt;br /&gt;
			&lt;br /&gt;
			if index == #argNums - 1&lt;br /&gt;
			or not isOffsetItemSameHeader(args, argNums, index, 2)&lt;br /&gt;
			then&lt;br /&gt;
				-- it&amp;#039;s the penultimate in the header; set the ending to &amp;quot; and &amp;quot;&lt;br /&gt;
				ending = frame:expandTemplate{title=&amp;quot;MediaWiki:Word-separator&amp;quot;} ..&lt;br /&gt;
					frame:expandTemplate{title=&amp;quot;MediaWiki:And&amp;quot;} ..&lt;br /&gt;
					frame:expandTemplate{title=&amp;quot;MediaWiki:Word-separator&amp;quot;}&lt;br /&gt;
			else&lt;br /&gt;
				-- it&amp;#039;s not the last or penultimate in the header;&lt;br /&gt;
				-- set the ending to &amp;quot;, &amp;quot;&lt;br /&gt;
				ending = frame:expandTemplate{title=&amp;quot;MediaWiki:Comma-separator&amp;quot;} ..&lt;br /&gt;
					frame:expandTemplate{title=&amp;quot;MediaWiki:Word-separator&amp;quot;}&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			argsForOutput[&amp;quot;type&amp;quot;] = args[&amp;quot;type&amp;quot; .. num]&lt;br /&gt;
			argsForOutput[&amp;quot;header&amp;quot;] = args[&amp;quot;header&amp;quot; .. num]&lt;br /&gt;
			&lt;br /&gt;
			if multipleInHeader then&lt;br /&gt;
				-- if there&amp;#039;ve been multiple in the header, queue this&lt;br /&gt;
				-- as the last one, so it&amp;#039;ll include the multiple end&lt;br /&gt;
				-- with the header name and type&lt;br /&gt;
				multipleInHeader = false&lt;br /&gt;
				argsForOutput[&amp;quot;multipleEnd&amp;quot;] = true&lt;br /&gt;
			end&lt;br /&gt;
			if index ~= #argNums then&lt;br /&gt;
				-- this isn&amp;#039;t the last in the list, but it&amp;#039;s clearly the&lt;br /&gt;
				-- last in the header; start the next header with an&lt;br /&gt;
				-- &amp;quot;and&amp;quot; to separate the headers&lt;br /&gt;
				ending = frame:expandTemplate{title=&amp;quot;MediaWiki:Comma-separator&amp;quot;} ..&lt;br /&gt;
					frame:expandTemplate{title = &amp;quot;MediaWiki:And&amp;quot;} ..&lt;br /&gt;
					frame:expandTemplate{title=&amp;quot;MediaWiki:Word-separator&amp;quot;}&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		argsForOutput[&amp;quot;multipleInHeader&amp;quot;] = multipleInHeader&lt;br /&gt;
		out = out .. frame:expandTemplate{&lt;br /&gt;
			title = &amp;#039;FRS notification/content&amp;#039;,&lt;br /&gt;
			args = argsForOutput&lt;br /&gt;
		} .. ending&lt;br /&gt;
	end&lt;br /&gt;
    return out&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function getArgNums(args, prefix)&lt;br /&gt;
	-- Returns a table containing the numbers of the arguments that exist&lt;br /&gt;
	-- for the specified prefix. For example, if the prefix was &amp;#039;data&amp;#039;, and&lt;br /&gt;
	-- &amp;#039;data1&amp;#039;, &amp;#039;data2&amp;#039;, and &amp;#039;data5&amp;#039; exist, it would return {1, 2, 5}.&lt;br /&gt;
	&lt;br /&gt;
	-- This function is adapted from [[Module:Infobox]], and is released under&lt;br /&gt;
	-- the Creative Commons Attribution-Share-Alike License 3.0.&lt;br /&gt;
	-- https://creativecommons.org/licenses/by-sa/3.0/&lt;br /&gt;
	local nums = {}&lt;br /&gt;
	for k, v in pairs(args) do&lt;br /&gt;
		local num = tostring(k):match(&amp;#039;^&amp;#039; .. prefix .. &amp;#039;([0-9]%d*)$&amp;#039;)&lt;br /&gt;
		if num then table.insert(nums, tonumber(num)) end&lt;br /&gt;
	end&lt;br /&gt;
	table.sort(nums)&lt;br /&gt;
	return nums&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- isOffsetItemSameHeader takes the args, the argument numbers gathered,&lt;br /&gt;
-- the current index, and a given offset, and checks whether the item at that&lt;br /&gt;
-- offset is from the same type and the same header.&lt;br /&gt;
function isOffsetItemSameHeader(args, argNums, index, offset)&lt;br /&gt;
	return args[&amp;quot;type&amp;quot; .. argNums[index + offset]] == args[&amp;quot;type&amp;quot; .. argNums[index]]&lt;br /&gt;
		and args[&amp;quot;header&amp;quot; .. argNums[index + offset]] == args[&amp;quot;header&amp;quot; .. argNums[index]]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Naypta</name></author>
	</entry>
</feed>