<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://culturality.museum/wiki/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://culturality.museum/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AHatnote"/>
	<link rel="alternate" type="text/html" href="https://culturality.museum/wiki/index.php?title=Module:Hatnote&amp;action=history"/>
	<updated>2026-04-04T03:43:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://culturality.museum/wiki/index.php?title=Module:Hatnote&amp;diff=72&amp;oldid=prev</id>
		<title>Iao: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://culturality.museum/wiki/index.php?title=Module:Hatnote&amp;diff=72&amp;oldid=prev"/>
		<updated>2024-04-09T09:57:04Z</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-GB&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 09:57, 9 April 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&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;/table&gt;</summary>
		<author><name>Iao</name></author>
	</entry>
	<entry>
		<id>https://culturality.museum/wiki/index.php?title=Module:Hatnote&amp;diff=71&amp;oldid=prev</id>
		<title>wikipedia&gt;Nihiltres: Reordered helper functions (first by export status, then alphabetically) and migrated p.quote upstream from Module:Redirect hatnote (includes contributions by Tamzin and Nihiltres)</title>
		<link rel="alternate" type="text/html" href="https://culturality.museum/wiki/index.php?title=Module:Hatnote&amp;diff=71&amp;oldid=prev"/>
		<updated>2022-09-05T18:18:32Z</updated>

		<summary type="html">&lt;p&gt;Reordered helper functions (first by export status, then alphabetically) and migrated p.quote upstream from &lt;a href=&quot;/wiki/index.php?title=Module:Redirect_hatnote&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Module:Redirect hatnote (page does not exist)&quot;&gt;Module:Redirect hatnote&lt;/a&gt; (includes contributions by Tamzin and Nihiltres)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&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.                            --&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local libraryUtil = require('libraryUtil')&lt;br /&gt;
local checkType = libraryUtil.checkType&lt;br /&gt;
local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg&lt;br /&gt;
local mArguments -- lazily initialise [[Module:Arguments]]&lt;br /&gt;
local yesno -- lazily initialise [[Module:Yesno]]&lt;br /&gt;
local formatLink -- lazily initialise [[Module:Format link]] ._formatLink&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('Module:Arguments')&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('^:?(.*)')&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.defaultClasses(inline)&lt;br /&gt;
	-- Provides the default hatnote classes as a space-separated string; useful&lt;br /&gt;
	-- for hatnote-manipulation modules like [[Module:Hatnote group]].&lt;br /&gt;
	return&lt;br /&gt;
		(inline == 1 and 'hatnote-inline' or 'hatnote') .. ' ' ..&lt;br /&gt;
		'navigation-not-searchable'&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('disambiguate', 1, page, 'string')&lt;br /&gt;
	checkType('disambiguate', 2, disambiguator, 'string', true)&lt;br /&gt;
	disambiguator = disambiguator or 'disambiguation'&lt;br /&gt;
	return mw.ustring.format('%s (%s)', 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('findNamespaceId', 1, link, 'string')&lt;br /&gt;
	checkType('findNamespaceId', 2, removeColon, 'boolean', 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('^(.-):')&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('makeWikitextError', 1, msg, 'string')&lt;br /&gt;
	checkType('makeWikitextError', 2, helpLink, 'string', true)&lt;br /&gt;
	yesno = require('Module:Yesno')&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 = ' ([[' .. helpLink .. '|help]])'&lt;br /&gt;
	else&lt;br /&gt;
		helpText = ''&lt;br /&gt;
	end&lt;br /&gt;
	-- Make the category text.&lt;br /&gt;
	local category&lt;br /&gt;
	if not title.isTalkPage -- Don't categorise talk pages&lt;br /&gt;
		and title.namespace ~= 2 -- Don't categorise userspace&lt;br /&gt;
		and yesno(addTrackingCategory) ~= false -- Allow opting out&lt;br /&gt;
	then&lt;br /&gt;
		category = 'Hatnote templates with errors'&lt;br /&gt;
		category = mw.ustring.format(&lt;br /&gt;
			'[[%s:%s]]',&lt;br /&gt;
			mw.site.namespaces[14].name,&lt;br /&gt;
			category&lt;br /&gt;
		)&lt;br /&gt;
	else&lt;br /&gt;
		category = ''&lt;br /&gt;
	end&lt;br /&gt;
	return mw.ustring.format(&lt;br /&gt;
		'&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;Error: %s%s.&amp;lt;/strong&amp;gt;%s',&lt;br /&gt;
		msg,&lt;br /&gt;
		helpText,&lt;br /&gt;
		category&lt;br /&gt;
	)&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&lt;br /&gt;
	'Articles with hatnote templates targeting a nonexistent page' 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 {{-'}}&lt;br /&gt;
	local quotationMarks = {&lt;br /&gt;
		[&amp;quot;'&amp;quot;]=true, ['&amp;quot;']=true, ['“']=true, [&amp;quot;‘&amp;quot;]=true, ['”']=true, [&amp;quot;’&amp;quot;]=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)],&lt;br /&gt;
		quotationMarks[string.sub(title, -1, -1)]&lt;br /&gt;
	if quoteLeft or quoteRight then&lt;br /&gt;
		title = mw.html.create(&amp;quot;span&amp;quot;):wikitext(title)&lt;br /&gt;
	end&lt;br /&gt;
	if quoteLeft  then title:css(&amp;quot;padding-left&amp;quot;,  &amp;quot;0.15em&amp;quot;) end&lt;br /&gt;
	if quoteRight then title:css(&amp;quot;padding-right&amp;quot;, &amp;quot;0.15em&amp;quot;) end&lt;br /&gt;
	return '&amp;quot;' .. tostring(title) .. '&amp;quot;'&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(&lt;br /&gt;
			'no text specified',&lt;br /&gt;
			'Template:Hatnote#Errors',&lt;br /&gt;
			args.category&lt;br /&gt;
		)&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('_hatnote', 1, s, 'string')&lt;br /&gt;
	checkType('_hatnote', 2, options, 'table', true)&lt;br /&gt;
	options = options or {}&lt;br /&gt;
	local inline = options.inline&lt;br /&gt;
	local hatnote = mw.html.create(inline == 1 and 'span' or 'div')&lt;br /&gt;
	local extraclasses&lt;br /&gt;
	if type(options.extraclasses) == 'string' then&lt;br /&gt;
		extraclasses = options.extraclasses&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	hatnote&lt;br /&gt;
		:attr('role', 'note')&lt;br /&gt;
		:addClass(p.defaultClasses(inline))&lt;br /&gt;
		:addClass(extraclasses)&lt;br /&gt;
		:addClass(options.selfref and 'selfref' or nil)&lt;br /&gt;
		:wikitext(s)&lt;br /&gt;
&lt;br /&gt;
	return mw.getCurrentFrame():extensionTag{&lt;br /&gt;
		name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' }&lt;br /&gt;
	} .. tostring(hatnote)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>wikipedia&gt;Nihiltres</name></author>
	</entry>
</feed>