<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://isekai.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AHatnote%2Fdoc</id>
	<title>Module:Hatnote/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://isekai.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AHatnote%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://isekai.wiki/index.php?title=Module:Hatnote/doc&amp;action=history"/>
	<updated>2026-05-16T01:32:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.1</generator>
	<entry>
		<id>https://isekai.wiki/index.php?title=Module:Hatnote/doc&amp;diff=6369&amp;oldid=prev</id>
		<title>FaeriMagic at 14:49, 30 July 2025</title>
		<link rel="alternate" type="text/html" href="https://isekai.wiki/index.php?title=Module:Hatnote/doc&amp;diff=6369&amp;oldid=prev"/>
		<updated>2025-07-30T14:49:03Z</updated>

		<summary type="html">&lt;p&gt;&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 14:49, 30 July 2025&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-l82&quot;&gt;Line 82:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 82:&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;&amp;lt;!-- MODULE CATEGORIES --&amp;gt;&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;&amp;lt;!-- MODULE CATEGORIES --&amp;gt;&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;div&gt;&amp;lt;includeonly&amp;gt;&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;&amp;lt;includeonly&amp;gt;&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;[[Category:Hatnote modules]]&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;[[Category:Hatnote modules&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]] [[Category:Modules imported from Wikipedia&lt;/ins&gt;]]&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;div&gt;[[Category:Modules that add a tracking category]]&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;[[Category:Modules that add a tracking category]]&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;div&gt;&amp;lt;/includeonly&amp;gt;&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;&amp;lt;/includeonly&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key isekai_wiki:diff::1.12:old-6364:rev-6369 --&gt;
&lt;/table&gt;</summary>
		<author><name>FaeriMagic</name></author>
	</entry>
	<entry>
		<id>https://isekai.wiki/index.php?title=Module:Hatnote/doc&amp;diff=6364&amp;oldid=prev</id>
		<title>FaeriMagic: Created page with &quot;This is a meta-module that provides various functions for making hatnotes. It implements the &lt;code&gt;&lt;nowiki&gt;{{hatnote}}&lt;/code&gt; template, for use in hatnotes at the top of pages. It also contains a number of helper functions for use in other Lua hatnote modules.  == Use from wikitext ==  The functions in this module cannot be used directly from #invoke, and must be used through templates instead. Please see Template:Hatnote and Template:Format link for documentatio...&quot;</title>
		<link rel="alternate" type="text/html" href="https://isekai.wiki/index.php?title=Module:Hatnote/doc&amp;diff=6364&amp;oldid=prev"/>
		<updated>2025-07-30T09:44:48Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This is a meta-module that provides various functions for making hatnotes. It implements the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{hatnote}}&amp;lt;/code&amp;gt; template, for use in hatnotes at the top of pages. It also contains a number of helper functions for use in other Lua hatnote modules.  == Use from wikitext ==  The functions in this module cannot be used directly from #invoke, and must be used through templates instead. Please see &lt;a href=&quot;/index.php?title=Template:Hatnote&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Template:Hatnote (page does not exist)&quot;&gt;Template:Hatnote&lt;/a&gt; and &lt;a href=&quot;/index.php?title=Template:Format_link&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Template:Format link (page does not exist)&quot;&gt;Template:Format link&lt;/a&gt; for documentatio...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This is a meta-module that provides various functions for making hatnotes. It implements the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{hatnote}}&amp;lt;/code&amp;gt; template, for use in hatnotes at the top of pages. It also contains a number of helper functions for use in other Lua hatnote modules.&lt;br /&gt;
&lt;br /&gt;
== Use from wikitext ==&lt;br /&gt;
&lt;br /&gt;
The functions in this module cannot be used directly from #invoke, and must be used through templates instead. Please see [[Template:Hatnote]] and [[Template:Format link]] for documentation.&lt;br /&gt;
&lt;br /&gt;
== Use from other Lua modules ==&lt;br /&gt;
&lt;br /&gt;
To load this module from another Lua module, use the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local mHatnote = require(&amp;#039;Module:Hatnote&amp;#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then use the functions as documented below.&lt;br /&gt;
&lt;br /&gt;
=== Hatnote ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mHatnote._hatnote(s, options)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Formats the string &amp;lt;var&amp;gt;s&amp;lt;/var&amp;gt; as a hatnote. This encloses &amp;lt;var&amp;gt;s&amp;lt;/var&amp;gt; in the tags {{tag|div|params=class=&amp;quot;hatnote&amp;quot;}}. Options are provided in the &amp;lt;var&amp;gt;options&amp;lt;/var&amp;gt; table. Options include:&lt;br /&gt;
* &amp;lt;var&amp;gt;options.extraclasses&amp;lt;/var&amp;gt; - a string of extra classes to provide&lt;br /&gt;
* &amp;lt;var&amp;gt;options.selfref&amp;lt;/var&amp;gt; - if this is not nil or false, adds the class &amp;quot;selfref&amp;quot;, used to denote self-references to Wikipedia (see [[Template:Selfref]]))&lt;br /&gt;
The CSS of the hatnote class is defined in [[Module:Hatnote/styles.css]].&lt;br /&gt;
&lt;br /&gt;
; Example 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mHatnote._hatnote(&amp;#039;This is a hatnote.&amp;#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Produces:&lt;br /&gt;
{{tag|div|content=This is a hatnote.|params=class=&amp;quot;hatnote&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
Displays as:&lt;br /&gt;
{{hatnote|This is a hatnote.}}&lt;br /&gt;
&lt;br /&gt;
; Example 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mHatnote._hatnote(&amp;#039;This is a hatnote.&amp;#039;, {extraclasses = &amp;#039;boilerplate seealso&amp;#039;, selfref = true})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Produces:&lt;br /&gt;
{{tag|div|content=This is a hatnote.|params=class=&amp;quot;hatnote boilerplate seealso selfref&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
Displayed as:&lt;br /&gt;
{{hatnote|This is a hatnote.|extraclasses=boilerplate seealso|selfref=true}}&lt;br /&gt;
&lt;br /&gt;
=== Find namespace id ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mHatnote.findNamespaceId(link, removeColon)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finds the [[WP:NS|namespace id]] of the string &amp;lt;var&amp;gt;link&amp;lt;/var&amp;gt;, which should be a valid page name, with or without the section name. This function will not work if the page name is enclosed with square brackets. When trying to parse the namespace name, colons are removed from the start of the link by default. This is helpful if users have specified colons when they are not strictly necessary. If you do not need to check for initial colons, set &amp;lt;var&amp;gt;removeColon&amp;lt;/var&amp;gt; to false.&lt;br /&gt;
&lt;br /&gt;
;Examples:&lt;br /&gt;
: {{code|mHatnote.findNamespaceId(&amp;#039;Lion&amp;#039;)|lua}} &amp;amp;rarr; 0&lt;br /&gt;
: {{code|mHatnote.findNamespaceId(&amp;#039;Category:Lions&amp;#039;)|lua}} &amp;amp;rarr; 14&lt;br /&gt;
: {{code|mHatnote.findNamespaceId(&amp;#039;:Category:Lions&amp;#039;)|lua}} &amp;amp;rarr; 14&lt;br /&gt;
: {{code|mHatnote.findNamespaceId(&amp;#039;:Category:Lions&amp;#039;, false)|lua}} &amp;amp;rarr; 0 (the namespace is detected as &amp;quot;:Category&amp;quot;, rather than &amp;quot;Category&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Make wikitext error ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mHatnote.makeWikitextError(msg, helpLink, addTrackingCategory)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Formats the string &amp;lt;var&amp;gt;msg&amp;lt;/var&amp;gt; as a red wikitext error message, with optional link to a help page &amp;lt;var&amp;gt;helpLink&amp;lt;/var&amp;gt;. Normally this function also adds {{clc|Hatnote templates with errors}}. To suppress categorization, pass &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; as third parameter of the function (&amp;lt;code&amp;gt;addTrackingCategory&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
:{{code|mHatnote.makeWikitextError(&amp;#039;an error has occurred&amp;#039;)|lua}} &amp;amp;rarr; &amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;Error: an error has occurred.&amp;lt;/strong&amp;gt;&lt;br /&gt;
:{{code|mHatnote.makeWikitextError(&amp;#039;an error has occurred&amp;#039;, &amp;#039;Template:Example#Errors&amp;#039;)|lua}} &amp;amp;rarr; &amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;Error: an error has occurred ([[Template:Example#Errors|help]]).&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
For an example of how this module is used in other Lua modules, see [[Module:Labelled list hatnote]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- MODULE CATEGORIES --&amp;gt;&lt;br /&gt;
&amp;lt;includeonly&amp;gt;&lt;br /&gt;
[[Category:Hatnote modules]]&lt;br /&gt;
[[Category:Modules that add a tracking category]]&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- MODULE DOCUMENTATION CATEGORY --&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Module documentation subpages]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>FaeriMagic</name></author>
	</entry>
</feed>