<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.shroudforge.net/index.php?action=history&amp;feed=atom&amp;title=Module%3AHatnote</id>
	<title>Module:Hatnote - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.shroudforge.net/index.php?action=history&amp;feed=atom&amp;title=Module%3AHatnote"/>
	<link rel="alternate" type="text/html" href="https://wiki.shroudforge.net/index.php?title=Module:Hatnote&amp;action=history"/>
	<updated>2026-11-05T07:26:56Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://wiki.shroudforge.net/index.php?title=Module:Hatnote&amp;diff=72&amp;oldid=prev</id>
		<title>Bonsaibauer: 1 revision imported: Import Star Citizen Modules</title>
		<link rel="alternate" type="text/html" href="https://wiki.shroudforge.net/index.php?title=Module:Hatnote&amp;diff=72&amp;oldid=prev"/>
		<updated>2026-11-04T22:22:06Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported: Import Star Citizen Modules&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&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-GB&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 22:22, 4 November 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key mediawiki-mediawiki:diff:1.41:old-71:rev-72 --&gt;
&lt;/table&gt;</summary>
		<author><name>Bonsaibauer</name></author>
	</entry>
	<entry>
		<id>https://wiki.shroudforge.net/index.php?title=Module:Hatnote&amp;diff=71&amp;oldid=prev</id>
		<title>starcitizen&gt;Alistar Bot: Sync from Git (15b58aa) (via update-page on MediaWiki MCP Server)</title>
		<link rel="alternate" type="text/html" href="https://wiki.shroudforge.net/index.php?title=Module:Hatnote&amp;diff=71&amp;oldid=prev"/>
		<updated>2026-09-23T18:08:09Z</updated>

		<summary type="html">&lt;p&gt;Sync from Git (15b58aa) (via update-page on MediaWiki MCP Server)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require(&amp;#039;strict&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
--                              Module:Hatnote                                --&lt;br /&gt;
--                                                                            --&lt;br /&gt;
-- This module produces hatnote links and links to related articles. It       --&lt;br /&gt;
-- implements the {{hatnote}} and {{format link}} meta-templates and includes --&lt;br /&gt;
-- helper functions for other Lua hatnote modules. The box is drawn by        --&lt;br /&gt;
-- [[Module:Mbox]].                                                           --&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local libraryUtil = require(&amp;#039;libraryUtil&amp;#039;)&lt;br /&gt;
local checkType = libraryUtil.checkType&lt;br /&gt;
local mArguments -- lazily initialise [[Module:Arguments]]&lt;br /&gt;
local yesno -- lazily initialise [[Module:Yesno]]&lt;br /&gt;
local mbox = require(&amp;#039;Module:Mbox&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Helper functions&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local function getArgs(frame)&lt;br /&gt;
	-- Fetches the arguments from the parent frame. Whitespace is trimmed and&lt;br /&gt;
	-- blanks are removed.&lt;br /&gt;
	mArguments = require(&amp;#039;Module:Arguments&amp;#039;)&lt;br /&gt;
	return mArguments.getArgs(frame, { parentOnly = true })&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function removeInitialColon(s)&lt;br /&gt;
	-- Removes the initial colon from a string, if present.&lt;br /&gt;
	return s:match(&amp;#039;^:?(.*)&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.defaultClasses(inline)&lt;br /&gt;
	-- The classes every hatnote carries, for hatnote-manipulation modules.&lt;br /&gt;
	-- `inline` is accepted for signature compatibility; both shapes share them.&lt;br /&gt;
	return &amp;#039;navigation-not-searchable&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.disambiguate(page, disambiguator)&lt;br /&gt;
	-- Formats a page title with a disambiguation parenthetical,&lt;br /&gt;
	-- i.e. &amp;quot;Example&amp;quot; → &amp;quot;Example (disambiguation)&amp;quot;.&lt;br /&gt;
	checkType(&amp;#039;disambiguate&amp;#039;, 1, page, &amp;#039;string&amp;#039;)&lt;br /&gt;
	checkType(&amp;#039;disambiguate&amp;#039;, 2, disambiguator, &amp;#039;string&amp;#039;, true)&lt;br /&gt;
	disambiguator = disambiguator or &amp;#039;disambiguation&amp;#039;&lt;br /&gt;
	return string.format(&amp;#039;%s (%s)&amp;#039;, page, disambiguator)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.findNamespaceId(link, removeColon)&lt;br /&gt;
	-- Finds the namespace id (namespace number) of a link or a pagename. This&lt;br /&gt;
	-- function will not work if the link is enclosed in double brackets. Colons&lt;br /&gt;
	-- are trimmed from the start of the link by default. To skip colon&lt;br /&gt;
	-- trimming, set the removeColon parameter to false.&lt;br /&gt;
	checkType(&amp;#039;findNamespaceId&amp;#039;, 1, link, &amp;#039;string&amp;#039;)&lt;br /&gt;
	checkType(&amp;#039;findNamespaceId&amp;#039;, 2, removeColon, &amp;#039;boolean&amp;#039;, true)&lt;br /&gt;
	if removeColon ~= false then&lt;br /&gt;
		link = removeInitialColon(link)&lt;br /&gt;
	end&lt;br /&gt;
	local namespace = link:match(&amp;#039;^(.-):&amp;#039;)&lt;br /&gt;
	if namespace then&lt;br /&gt;
		local nsTable = mw.site.namespaces[namespace]&lt;br /&gt;
		if nsTable then&lt;br /&gt;
			return nsTable.id&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return 0&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.makeWikitextError(msg, helpLink, addTrackingCategory, title)&lt;br /&gt;
	-- Formats an error message to be returned to wikitext. If&lt;br /&gt;
	-- addTrackingCategory is not false after being returned from&lt;br /&gt;
	-- [[Module:Yesno]], and if we are not on a talk page, a tracking category&lt;br /&gt;
	-- is added.&lt;br /&gt;
	checkType(&amp;#039;makeWikitextError&amp;#039;, 1, msg, &amp;#039;string&amp;#039;)&lt;br /&gt;
	checkType(&amp;#039;makeWikitextError&amp;#039;, 2, helpLink, &amp;#039;string&amp;#039;, true)&lt;br /&gt;
	yesno = require(&amp;#039;Module:Yesno&amp;#039;)&lt;br /&gt;
	title = title or mw.title.getCurrentTitle()&lt;br /&gt;
	-- Make the help link text.&lt;br /&gt;
	local helpText&lt;br /&gt;
	if helpLink then&lt;br /&gt;
		helpText = &amp;#039; ([[&amp;#039; .. helpLink .. &amp;#039;|help]])&amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		helpText = &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	-- Make the category text.&lt;br /&gt;
	local category&lt;br /&gt;
	if&lt;br /&gt;
		not title.isTalkPage -- Don&amp;#039;t categorise talk pages&lt;br /&gt;
		and title.namespace ~= 2 -- Don&amp;#039;t categorise userspace&lt;br /&gt;
		and yesno(addTrackingCategory) ~= false -- Allow opting out&lt;br /&gt;
	then&lt;br /&gt;
		category = &amp;#039;Hatnote templates with errors&amp;#039;&lt;br /&gt;
		category = string.format(&amp;#039;[[%s:%s]]&amp;#039;, mw.site.namespaces[14].name, category)&lt;br /&gt;
	else&lt;br /&gt;
		category = &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	return string.format(&amp;#039;&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;Error: %s%s.&amp;lt;/strong&amp;gt;%s&amp;#039;, msg, helpText, category)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local curNs = mw.title.getCurrentTitle().namespace&lt;br /&gt;
p.missingTargetCat =&lt;br /&gt;
	--Default missing target category, exported for use in related modules&lt;br /&gt;
	((curNs == 0) or (curNs == 14)) and &amp;#039;Articles with hatnote templates targeting a nonexistent page&amp;#039; or nil&lt;br /&gt;
&lt;br /&gt;
function p.quote(title)&lt;br /&gt;
	--Wraps titles in quotation marks. If the title starts/ends with a quotation&lt;br /&gt;
	--mark, kerns that side as with {{-&amp;#039;}}&lt;br /&gt;
	local quotationMarks = {&lt;br /&gt;
		[&amp;quot;&amp;#039;&amp;quot;] = true,&lt;br /&gt;
		[&amp;#039;&amp;quot;&amp;#039;] = true,&lt;br /&gt;
		[&amp;#039;“&amp;#039;] = true,&lt;br /&gt;
		[&amp;#039;‘&amp;#039;] = true,&lt;br /&gt;
		[&amp;#039;”&amp;#039;] = true,&lt;br /&gt;
		[&amp;#039;’&amp;#039;] = true,&lt;br /&gt;
	}&lt;br /&gt;
	local quoteLeft, quoteRight = -- Test if start/end are quotation marks&lt;br /&gt;
		quotationMarks[string.sub(title, 1, 1)], quotationMarks[string.sub(title, -1, -1)]&lt;br /&gt;
	if quoteLeft or quoteRight then&lt;br /&gt;
		title = mw.html.create(&amp;#039;span&amp;#039;):wikitext(title)&lt;br /&gt;
	end&lt;br /&gt;
	if quoteLeft then&lt;br /&gt;
		title:css(&amp;#039;padding-left&amp;#039;, &amp;#039;0.15em&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	if quoteRight then&lt;br /&gt;
		title:css(&amp;#039;padding-right&amp;#039;, &amp;#039;0.15em&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	return &amp;#039;&amp;quot;&amp;#039; .. tostring(title) .. &amp;#039;&amp;quot;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Hatnote&lt;br /&gt;
--&lt;br /&gt;
-- Produces standard hatnote text. Implements the {{hatnote}} template.&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
function p.hatnote(frame)&lt;br /&gt;
	local args = getArgs(frame)&lt;br /&gt;
	local s = args[1]&lt;br /&gt;
	if not s then&lt;br /&gt;
		return p.makeWikitextError(&amp;#039;no text specified&amp;#039;, &amp;#039;Template:Hatnote#Errors&amp;#039;, args.category)&lt;br /&gt;
	end&lt;br /&gt;
	return p._hatnote(s, {&lt;br /&gt;
		extraclasses = args.extraclasses,&lt;br /&gt;
		selfref = args.selfref,&lt;br /&gt;
	})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._hatnote(s, options)&lt;br /&gt;
	checkType(&amp;#039;_hatnote&amp;#039;, 1, s, &amp;#039;string&amp;#039;)&lt;br /&gt;
	checkType(&amp;#039;_hatnote&amp;#039;, 2, options, &amp;#039;table&amp;#039;, true)&lt;br /&gt;
	options = options or {}&lt;br /&gt;
	local classes = {}&lt;br /&gt;
	if type(options.extraclasses) == &amp;#039;string&amp;#039; and options.extraclasses ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		classes[#classes + 1] = options.extraclasses&lt;br /&gt;
	end&lt;br /&gt;
	if options.selfref then&lt;br /&gt;
		classes[#classes + 1] = &amp;#039;selfref&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	if options.inline == 1 then&lt;br /&gt;
		-- An inline hatnote sits inside running text, so it gets no box.&lt;br /&gt;
		local span = mw.html&lt;br /&gt;
			.create(&amp;#039;span&amp;#039;)&lt;br /&gt;
			:attr(&amp;#039;role&amp;#039;, &amp;#039;note&amp;#039;)&lt;br /&gt;
			:addClass(p.defaultClasses(1))&lt;br /&gt;
			:addClass(#classes &amp;gt; 0 and table.concat(classes, &amp;#039; &amp;#039;) or nil)&lt;br /&gt;
			:wikitext(s)&lt;br /&gt;
		return tostring(span)&lt;br /&gt;
	end&lt;br /&gt;
	return mbox.render({&lt;br /&gt;
		title = s,&lt;br /&gt;
		icon = options.icon,&lt;br /&gt;
		class = #classes &amp;gt; 0 and table.concat(classes, &amp;#039; &amp;#039;) or nil,&lt;br /&gt;
	})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>starcitizen&gt;Alistar Bot</name></author>
	</entry>
</feed>