<?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%3ANUMBEROFSECTIONS</id>
	<title>Module:NUMBEROFSECTIONS - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ANUMBEROFSECTIONS"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:NUMBEROFSECTIONS&amp;action=history"/>
	<updated>2026-05-28T07:28:35Z</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:NUMBEROFSECTIONS&amp;diff=144049&amp;oldid=prev</id>
		<title>imported&gt;Primefac: Changed protection level for &quot;Module:NUMBEROFSECTIONS&quot;: High-risk template ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:NUMBEROFSECTIONS&amp;diff=144049&amp;oldid=prev"/>
		<updated>2020-08-29T23:26:39Z</updated>

		<summary type="html">&lt;p&gt;Changed protection level for &amp;quot;&lt;a href=&quot;/research/Module:NUMBEROFSECTIONS&quot; title=&quot;Module:NUMBEROFSECTIONS&quot;&gt;Module:NUMBEROFSECTIONS&lt;/a&gt;&amp;quot;: &lt;a href=&quot;https://en.wikipedia.org/wiki/High-risk_templates&quot; class=&quot;extiw&quot; title=&quot;wikipedia:High-risk templates&quot;&gt;High-risk template&lt;/a&gt; ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))&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;
-- Unescape functionality grabbed from https://stackoverflow.com/a/14899740/1832568&lt;br /&gt;
local function unescape(str)&lt;br /&gt;
	str = string.gsub(str, &amp;#039;&amp;amp;#(%d+);&amp;#039;, string.char)&lt;br /&gt;
	str = string.gsub(str, &amp;#039;&amp;amp;#x(%d+);&amp;#039;, function(n) return string.char(tonumber(n, 16)) end)&lt;br /&gt;
	return str&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Counting function accepting a string haystack and table of needles&lt;br /&gt;
local function count(haystack, needles)&lt;br /&gt;
	local number = 0&lt;br /&gt;
	-- While we have needles to look for&lt;br /&gt;
	for index, needle in ipairs(needles) do&lt;br /&gt;
		-- find them all in our haystack&lt;br /&gt;
		for m in string.gmatch(haystack, needle) do&lt;br /&gt;
			number = number + 1&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return number&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Function takes any number of # delimited page names and section level numbers&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local total = 0&lt;br /&gt;
	local needles = {}&lt;br /&gt;
	local haystack = &amp;#039;&amp;#039;&lt;br /&gt;
	-- Separate page names from # delimited string into table&lt;br /&gt;
	local pages = mw.text.split(unescape(frame.args[1]), &amp;#039;%s?#%s?&amp;#039;)&lt;br /&gt;
	-- Separate whitespace delimited section level numbers into table&lt;br /&gt;
	local levels = mw.text.split(frame.args[&amp;#039;level&amp;#039;], &amp;#039;%s*&amp;#039;)&lt;br /&gt;
	-- Iterate through levels&lt;br /&gt;
	for level in mw.text.gsplit(table.concat(levels), &amp;#039;&amp;#039;) do&lt;br /&gt;
		-- and add the level needle to needles&lt;br /&gt;
		needles[#needles + 1] = &amp;#039;\n&amp;#039;..string.rep(&amp;#039;=&amp;#039;, tonumber(level))..&amp;#039;[^=]&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	-- For each page name in pages&lt;br /&gt;
	for index, page in ipairs(pages) do&lt;br /&gt;
		-- create a haystack to search from the page content&lt;br /&gt;
		haystack = mw.title.new(page):getContent()&lt;br /&gt;
		-- If we&amp;#039;ve requested the content of a legitimate page&lt;br /&gt;
		if haystack then&lt;br /&gt;
			--[[ pass the raw markup and needles to count&lt;br /&gt;
				 and add the return to total ]]&lt;br /&gt;
			total = total + count(&amp;#039;\n&amp;#039; .. haystack, needles)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	--[[ then return how many sections of the required level&lt;br /&gt;
		 are in all the pages passed ]]&lt;br /&gt;
	return total&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Primefac</name></author>
	</entry>
</feed>