<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://salisford.net/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://salisford.net/index.php?action=history&amp;feed=atom&amp;title=Module%3ANUMBEROFSECTIONS"/>
	<link rel="alternate" type="text/html" href="https://salisford.net/index.php?title=Module:NUMBEROFSECTIONS&amp;action=history"/>
	<updated>2026-06-15T21:17:01Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>https://salisford.net/index.php?title=Module:NUMBEROFSECTIONS&amp;diff=778&amp;oldid=prev</id>
		<title>Cascadia: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://salisford.net/index.php?title=Module:NUMBEROFSECTIONS&amp;diff=778&amp;oldid=prev"/>
		<updated>2023-04-05T14:39:42Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&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&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 14:39, 5 April 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&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>Cascadia</name></author>
	</entry>
	<entry>
		<id>https://salisford.net/index.php?title=Module:NUMBEROFSECTIONS&amp;diff=777&amp;oldid=prev</id>
		<title>wp&gt;Fred Gandt: slight improvement for handling unexpected-and-wanted whitespace around the # delimiters; %s? --&gt; %s* i.e. possible single whitespace char --&gt; zero or more whitespace chars</title>
		<link rel="alternate" type="text/html" href="https://salisford.net/index.php?title=Module:NUMBEROFSECTIONS&amp;diff=777&amp;oldid=prev"/>
		<updated>2023-02-04T21:15:26Z</updated>

		<summary type="html">&lt;p&gt;slight improvement for handling unexpected-and-wanted whitespace around the # delimiters; %s? --&amp;gt; %s* i.e. possible single whitespace char --&amp;gt; zero or more whitespace chars&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;amp;#(%d+);', string.char)&lt;br /&gt;
	str = string.gsub(str, '&amp;amp;#x(%d+);', 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 = ''&lt;br /&gt;
	-- Separate page names from # delimited string into table&lt;br /&gt;
	local pages = mw.text.split(unescape(frame.args[1]), '%s*#%s*')&lt;br /&gt;
	-- Separate whitespace delimited section level numbers into table&lt;br /&gt;
	local levels = mw.text.split(frame.args['level'], '%s*')&lt;br /&gt;
	-- Iterate through levels&lt;br /&gt;
	for level in mw.text.gsplit(table.concat(levels), '') do&lt;br /&gt;
		-- and add the level needle to needles&lt;br /&gt;
		needles[#needles + 1] = '\n'..string.rep('=', tonumber(level))..'[^=]'&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'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('\n' .. 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>wp&gt;Fred Gandt</name></author>
	</entry>
</feed>