<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://www.verzauberte-welten.de/index.php?action=history&amp;feed=atom&amp;title=Modul%3AHatnote%2Fdoc</id>
	<title>Modul:Hatnote/doc - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://www.verzauberte-welten.de/index.php?action=history&amp;feed=atom&amp;title=Modul%3AHatnote%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://www.verzauberte-welten.de/index.php?title=Modul:Hatnote/doc&amp;action=history"/>
	<updated>2026-04-05T23:45:24Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Verzauberte Welten e.V.</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://www.verzauberte-welten.de/index.php?title=Modul:Hatnote/doc&amp;diff=411&amp;oldid=prev</id>
		<title>mw&gt;Oetterer am 4. Februar 2015 um 15:46 Uhr</title>
		<link rel="alternate" type="text/html" href="https://www.verzauberte-welten.de/index.php?title=Modul:Hatnote/doc&amp;diff=411&amp;oldid=prev"/>
		<updated>2015-02-04T15:46:40Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{documentation subpage}}&lt;br /&gt;
{{module rating|protected}}&lt;br /&gt;
&lt;br /&gt;
This is a meta-module that provides various functions for making hatnotes. It implements the {{tl|hatnote}} 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]] 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;source lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local mHatnote = require('Module:Hatnote')&lt;br /&gt;
&amp;lt;/source&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;source lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mHatnote._hatnote(s, options)&lt;br /&gt;
&amp;lt;/source&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 [[MediaWiki:Common.css]].&lt;br /&gt;
&lt;br /&gt;
; Example 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mHatnote._hatnote('This is a hatnote.')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Produces:&lt;br /&gt;
{{tag|div|content=This is a hatnote.|params=class=&amp;quot;dablink&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;source lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mHatnote._hatnote('This is a hatnote.', {extraclasses = 'boilerplate seealso', selfref = true})&lt;br /&gt;
&amp;lt;/source&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;
=== Format link ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mHatnote._formatLink(link, display)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Formats &amp;lt;var&amp;gt;link&amp;lt;/var&amp;gt; as a wikilink for display in hatnote templates, with optional display value &amp;lt;var&amp;gt;display&amp;lt;/var&amp;gt;. Categories and files are automatically escaped with the [[wpen:Help:Colon trick|colon trick]], and links to sections are automatically formatted as ''page § section'', rather than the MediaWiki default of ''page#section''.&lt;br /&gt;
&lt;br /&gt;
;Examples:&lt;br /&gt;
: {{code snippet|mHatnote._formatLink('Lion')|lua}} &amp;amp;rarr; &amp;lt;nowiki&amp;gt;[[Lion]]&amp;lt;/nowiki&amp;gt; &amp;amp;rarr; ...missing&lt;br /&gt;
: {{code snippet|mHatnote._formatLink('Lion#Etymology')|lua}} &amp;amp;rarr; &amp;lt;nowiki&amp;gt;[[Lion#Etymology|Lion § Etymology]]&amp;lt;/nowiki&amp;gt; &amp;amp;rarr; ...missing&lt;br /&gt;
: {{code snippet|mHatnote._formatLink('Category:Lions')|lua}} &amp;amp;rarr; &amp;lt;nowiki&amp;gt;[[:Category:Lions]]&amp;lt;/nowiki&amp;gt; &amp;amp;rarr; ...missing&lt;br /&gt;
: {{code snippet|mHatnote._formatLink('Lion#Etymology', 'Etymology of lion')|lua}} &amp;amp;rarr; &amp;lt;nowiki&amp;gt;[[Lion#Etymology|Etymology of lion]]&amp;lt;/nowiki&amp;gt; &amp;amp;rarr; ...missing&lt;br /&gt;
&lt;br /&gt;
=== Format pages ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mHatnote.formatPages(...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Formats a list of pages using the [[#Format link|_formatLink]] function, and returns the result as an array. For example, the code {{code snippet|mHatnote.formatPages('Lion', 'Category:Lions', 'Lion#Etymology')|lua}} would produce an array like {{code snippet|{'[[Lion]]', '[[:Category:Lions]]', '[[Lion#Etymology|Lion § Etymology]]'}|lua}}.&lt;br /&gt;
&lt;br /&gt;
=== Format page tables ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mHatnote.formatPageTables(...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Takes a list of page/display tables, formats them with the [[#Format link|_formatLink]] function, and returns the result as an array. Each item in the list must be a table. The first value in the table is the link, and is required. The second value in the table is the display value, and is optional. For example, the code {{code snippet|mHatnote.formatPages({'Lion', 'the Lion article'}, {'Category:Lions'}, {'Lion#Etymology', 'the etymology of lion'})|lua}} would produce an array like {{code snippet|{'[[Lion|the Lion article]]', '[[:Category:Lions]]', '[[Lion#Etymology|the etymology of lion]]'}|lua}}.&lt;br /&gt;
&lt;br /&gt;
=== Find namespace id ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mHatnote.findNamespaceId(link, removeColon)&lt;br /&gt;
&amp;lt;/source&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 snippet|mHatnote.findNamespaceId('Lion')|lua}} &amp;amp;rarr; 0&lt;br /&gt;
: {{code snippet|mHatnote.findNamespaceId('Category:Lions')|lua}} &amp;amp;rarr; 14&lt;br /&gt;
: {{code snippet|mHatnote.findNamespaceId(':Category:Lions')|lua}} &amp;amp;rarr; 14&lt;br /&gt;
: {{code snippet|mHatnote.findNamespaceId(':Category:Lions', 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;source lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mHatnote.makeWikitextError(msg, helpLink, addTrackingCategory)&lt;br /&gt;
&amp;lt;/source&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 ''Category:Hatnote templates with errors''; however, if &amp;lt;var&amp;gt;addTrackingCategory&amp;lt;/var&amp;gt; is not false after being passed through [[Module:Yesno]], then the category is suppressed. This means that the category can be suppressed with &amp;lt;var&amp;gt;addTrackingCategory&amp;lt;/var&amp;gt; values including &amp;quot;no&amp;quot;, &amp;quot;n&amp;quot;, 0, &amp;quot;false&amp;quot;, and {{code snippet|false|lua}}.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
:{{code snippet|mHatnote.makeWikitextError('an error has occurred')|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 snippet|mHatnote.makeWikitextError('an error has occurred', 'Template:Example#Errors')|lua}} &amp;amp;rarr; &amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;Error: an error has occurred ([[wpen:Template:Example#Errors|help]]).&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
For examples of how this module is used in other Lua modules, see the following (listed in order of complexity):&lt;br /&gt;
&lt;br /&gt;
* [[Module:Further]]&lt;br /&gt;
* [[Module:Main]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{#ifeq:{{SUBPAGENAME}}|sandbox||&lt;br /&gt;
&amp;lt;!-- Categories go here and interwikis go in Wikidata. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>mw&gt;Oetterer</name></author>
	</entry>
</feed>