<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://themidnight.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ASection_link</id>
	<title>Module:Section link - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://themidnight.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ASection_link"/>
	<link rel="alternate" type="text/html" href="https://themidnight.wiki/index.php?title=Module:Section_link&amp;action=history"/>
	<updated>2026-04-03T20:24:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://themidnight.wiki/index.php?title=Module:Section_link&amp;diff=6030&amp;oldid=prev</id>
		<title>Timothy: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://themidnight.wiki/index.php?title=Module:Section_link&amp;diff=6030&amp;oldid=prev"/>
		<updated>2023-05-28T19:08:59Z</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 15:08, 28 May 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>Timothy</name></author>
	</entry>
	<entry>
		<id>https://themidnight.wiki/index.php?title=Module:Section_link&amp;diff=6029&amp;oldid=prev</id>
		<title>wikipedia&gt;WOSlinker: use require(&#039;strict&#039;) instead of require(&#039;Module:No globals&#039;)</title>
		<link rel="alternate" type="text/html" href="https://themidnight.wiki/index.php?title=Module:Section_link&amp;diff=6029&amp;oldid=prev"/>
		<updated>2022-10-22T09:09:53Z</updated>

		<summary type="html">&lt;p&gt;use require(&amp;#039;strict&amp;#039;) instead of require(&amp;#039;Module:No globals&amp;#039;)&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 05:09, 22 October 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- This module implements {{section link}}.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- This module implements {{section link}}.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;require(&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Module:No globals&lt;/del&gt;&#039;);&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;require(&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;strict&lt;/ins&gt;&#039;);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local checkType = require(&amp;#039;libraryUtil&amp;#039;).checkType&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local checkType = require(&amp;#039;libraryUtil&amp;#039;).checkType&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>wikipedia&gt;WOSlinker</name></author>
	</entry>
	<entry>
		<id>https://themidnight.wiki/index.php?title=Module:Section_link&amp;diff=2128&amp;oldid=prev</id>
		<title>Timothy: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://themidnight.wiki/index.php?title=Module:Section_link&amp;diff=2128&amp;oldid=prev"/>
		<updated>2022-03-24T16:57:35Z</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 12:57, 24 March 2022&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>Timothy</name></author>
	</entry>
	<entry>
		<id>https://themidnight.wiki/index.php?title=Module:Section_link&amp;diff=2127&amp;oldid=prev</id>
		<title>wikipedia&gt;Primefac: fix error for when {{}} are used inside of the slink (TPER)</title>
		<link rel="alternate" type="text/html" href="https://themidnight.wiki/index.php?title=Module:Section_link&amp;diff=2127&amp;oldid=prev"/>
		<updated>2020-06-30T19:17:25Z</updated>

		<summary type="html">&lt;p&gt;fix error for when {{}} are used inside of the slink (TPER)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements {{section link}}.&lt;br /&gt;
require(&amp;#039;Module:No globals&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
local checkType = require(&amp;#039;libraryUtil&amp;#039;).checkType&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function makeSectionLink(page, section, display)&lt;br /&gt;
	display = display or section&lt;br /&gt;
	page = page or &amp;#039;&amp;#039;&lt;br /&gt;
	-- MediaWiki doesn&amp;#039;t allow these in `page`, so only need to do for `section`&lt;br /&gt;
	if type(section) == &amp;#039;string&amp;#039; then&lt;br /&gt;
		section = string.gsub(section, &amp;quot;{&amp;quot;, &amp;quot;&amp;amp;#x7B;&amp;quot;)&lt;br /&gt;
		section = string.gsub(section, &amp;quot;}&amp;quot;, &amp;quot;&amp;amp;#x7D;&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	return string.format(&amp;#039;[[%s#%s|%s]]&amp;#039;, page, section, display)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function normalizeTitle(title)&lt;br /&gt;
	title = mw.ustring.gsub(mw.ustring.gsub(title, &amp;quot;&amp;#039;&amp;quot;, &amp;quot;&amp;quot;), &amp;#039;&amp;quot;&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
	title = mw.ustring.gsub(title, &amp;quot;%b&amp;lt;&amp;gt;&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
	return mw.title.new(title).prefixedText&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._main(page, sections, options, title)&lt;br /&gt;
	-- Validate input.&lt;br /&gt;
	checkType(&amp;#039;_main&amp;#039;, 1, page, &amp;#039;string&amp;#039;, true)&lt;br /&gt;
	checkType(&amp;#039;_main&amp;#039;, 3, options, &amp;#039;table&amp;#039;, true)&lt;br /&gt;
	if sections == nil then&lt;br /&gt;
		sections = {}&lt;br /&gt;
	elseif type(sections) == &amp;#039;string&amp;#039; then&lt;br /&gt;
		sections = {sections}&lt;br /&gt;
	elseif type(sections) ~= &amp;#039;table&amp;#039; then&lt;br /&gt;
		error(string.format(&lt;br /&gt;
			&amp;quot;type error in argument #2 to &amp;#039;_main&amp;#039; &amp;quot; ..&lt;br /&gt;
			&amp;quot;(string, table or nil expected, got %s)&amp;quot;,&lt;br /&gt;
			type(sections)&lt;br /&gt;
		), 2)&lt;br /&gt;
	end&lt;br /&gt;
	options = options or {}&lt;br /&gt;
	title = title or mw.title.getCurrentTitle()&lt;br /&gt;
&lt;br /&gt;
	-- Deal with blank page names elegantly&lt;br /&gt;
	if page and not page:find(&amp;#039;%S&amp;#039;) then&lt;br /&gt;
		page = nil&lt;br /&gt;
		options.nopage = true&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Make the link(s).&lt;br /&gt;
	local isShowingPage = not options.nopage&lt;br /&gt;
	if #sections &amp;lt;= 1 then&lt;br /&gt;
		local linkPage = page or &amp;#039;&amp;#039;&lt;br /&gt;
		local section = sections[1] or &amp;#039;Notes&amp;#039;&lt;br /&gt;
		local display = &amp;#039;§&amp;amp;nbsp;&amp;#039; .. section&lt;br /&gt;
		if isShowingPage then&lt;br /&gt;
			page = page or title.prefixedText&lt;br /&gt;
			if options.display and options.display ~= &amp;#039;&amp;#039; then&lt;br /&gt;
				if normalizeTitle(options.display) == normalizeTitle(page) then&lt;br /&gt;
					display = options.display .. &amp;#039; &amp;#039; .. display&lt;br /&gt;
				else&lt;br /&gt;
					error(string.format(&lt;br /&gt;
						&amp;#039;Display title &amp;quot;%s&amp;quot; was ignored since it is &amp;#039; ..&lt;br /&gt;
						&amp;quot;not equivalent to the page&amp;#039;s actual title&amp;quot;,&lt;br /&gt;
						options.display&lt;br /&gt;
					), 0)&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				display = page .. &amp;#039; &amp;#039; .. display&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		return makeSectionLink(linkPage, section, display)&lt;br /&gt;
	else&lt;br /&gt;
		-- Multiple sections. First, make a list of the links to display.&lt;br /&gt;
		local ret = {}&lt;br /&gt;
		for i, section in ipairs(sections) do&lt;br /&gt;
			ret[i] = makeSectionLink(page, section)&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		-- Assemble the list of links into a string with mw.text.listToText.&lt;br /&gt;
		-- We use the default separator for mw.text.listToText, but a custom&lt;br /&gt;
		-- conjunction. There is also a special case conjunction if we only&lt;br /&gt;
		-- have two links.&lt;br /&gt;
		local conjunction&lt;br /&gt;
		if #sections == 2 then&lt;br /&gt;
			conjunction = &amp;#039;&amp;amp;#8203; and &amp;#039;&lt;br /&gt;
		else&lt;br /&gt;
			conjunction = &amp;#039;, and &amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		ret = mw.text.listToText(ret, nil, conjunction)&lt;br /&gt;
&lt;br /&gt;
		-- Add the intro text.&lt;br /&gt;
		local intro = &amp;#039;§§&amp;amp;nbsp;&amp;#039;&lt;br /&gt;
		if isShowingPage then&lt;br /&gt;
			intro = (page or title.prefixedText) .. &amp;#039; &amp;#039; .. intro&lt;br /&gt;
		end&lt;br /&gt;
		ret = intro .. ret&lt;br /&gt;
&lt;br /&gt;
		return ret&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local yesno = require(&amp;#039;Module:Yesno&amp;#039;)&lt;br /&gt;
	local args = require(&amp;#039;Module:Arguments&amp;#039;).getArgs(frame, {&lt;br /&gt;
		wrappers = &amp;#039;Template:Section link&amp;#039;,&lt;br /&gt;
		valueFunc = function (key, value)&lt;br /&gt;
			value = value:match(&amp;#039;^%s*(.-)%s*$&amp;#039;) -- Trim whitespace&lt;br /&gt;
			-- Allow blank first parameters, as the wikitext template does this.&lt;br /&gt;
			if value ~= &amp;#039;&amp;#039; or key == 1 then&lt;br /&gt;
				return value&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	})&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs(args) do													-- replace underscores in the positional parameter values&lt;br /&gt;
		if &amp;#039;number&amp;#039; == type(k) then&lt;br /&gt;
			if not yesno (args[&amp;#039;keep-underscores&amp;#039;]) then						-- unless |keep-underscores=yes&lt;br /&gt;
				args[k] = mw.uri.decode (v, &amp;#039;WIKI&amp;#039;);							-- percent-decode; replace underscores with space characters&lt;br /&gt;
			else&lt;br /&gt;
				args[k] = mw.uri.decode (v, &amp;#039;PATH&amp;#039;);							-- percent-decode; retain underscores&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Sort the arguments.&lt;br /&gt;
	local page&lt;br /&gt;
	local sections, options = {}, {}&lt;br /&gt;
	for k, v in pairs(args) do&lt;br /&gt;
		if k == 1 then&lt;br /&gt;
			-- Doing this in the loop because of a bug in [[Module:Arguments]]&lt;br /&gt;
			-- when using pairs with deleted arguments.&lt;br /&gt;
			page = mw.text.decode(v, true)&lt;br /&gt;
		elseif type(k) == &amp;#039;number&amp;#039; then&lt;br /&gt;
			sections[k] = v&lt;br /&gt;
		else&lt;br /&gt;
			options[k] = v&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	options.nopage = yesno (options.nopage);									-- make boolean&lt;br /&gt;
	&lt;br /&gt;
	-- Extract section from page, if present&lt;br /&gt;
	if page then&lt;br /&gt;
		local p, s = page:match(&amp;#039;^(.-)#(.*)$&amp;#039;)&lt;br /&gt;
		if p then page, sections[1] = p, s end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Compress the sections array.&lt;br /&gt;
	local function compressArray(t)&lt;br /&gt;
		local nums, ret = {}, {}&lt;br /&gt;
		for num in pairs(t) do&lt;br /&gt;
			nums[#nums + 1] = num&lt;br /&gt;
		end&lt;br /&gt;
		table.sort(nums)&lt;br /&gt;
		for i, num in ipairs(nums) do&lt;br /&gt;
			ret[i] = t[num]&lt;br /&gt;
		end&lt;br /&gt;
		return ret&lt;br /&gt;
	end&lt;br /&gt;
	sections = compressArray(sections)&lt;br /&gt;
&lt;br /&gt;
	return p._main(page, sections, options)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>wikipedia&gt;Primefac</name></author>
	</entry>
</feed>