<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mywikibiz.com/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://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AFRS_notification"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:FRS_notification&amp;action=history"/>
	<updated>2026-06-14T11:32:57Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.3</generator>
	<entry>
		<id>https://mywikibiz.com/index.php?title=Module:FRS_notification&amp;diff=471633&amp;oldid=prev</id>
		<title>Zoran: Pywikibot 6.4.0</title>
		<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:FRS_notification&amp;diff=471633&amp;oldid=prev"/>
		<updated>2021-07-15T21:35:19Z</updated>

		<summary type="html">&lt;p&gt;Pywikibot 6.4.0&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'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's multiple of a single type and header, i.e.&lt;br /&gt;
		-- the next item is of the same header, don't&lt;br /&gt;
		-- write the type every time; it'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'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'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've been multiple in the header, queue this&lt;br /&gt;
				-- as the last one, so it'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't the last in the list, but it'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 = 'FRS notification/content',&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 'data', and&lt;br /&gt;
	-- 'data1', 'data2', and 'data5' 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('^' .. prefix .. '([0-9]%d*)$')&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>Zoran</name></author>
	</entry>
</feed>