<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://pool.calebcooper.ie/index.php?action=history&amp;feed=atom&amp;title=Module%3ALabelled_list_hatnote%2Fdoc</id>
	<title>Module:Labelled list hatnote/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pool.calebcooper.ie/index.php?action=history&amp;feed=atom&amp;title=Module%3ALabelled_list_hatnote%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=Module:Labelled_list_hatnote/doc&amp;action=history"/>
	<updated>2026-04-08T00:26:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://pool.calebcooper.ie/index.php?title=Module:Labelled_list_hatnote/doc&amp;diff=12041&amp;oldid=prev</id>
		<title>Caleb Cooper: Created page with &quot;{{module rating|protected}} {{high-risk}} {{used in system|in MediaWiki:Wantedpages-summary}} {{Commons Import}} &lt;!-- Please place categories where indicated at the bottom...&quot;</title>
		<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=Module:Labelled_list_hatnote/doc&amp;diff=12041&amp;oldid=prev"/>
		<updated>2020-10-18T08:55:47Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{module rating|protected}} {{high-risk}} {{used in system|in &lt;a href=&quot;/MediaWiki:Wantedpages-summary&quot; title=&quot;MediaWiki:Wantedpages-summary&quot;&gt;MediaWiki:Wantedpages-summary&lt;/a&gt;}} {{Commons Import}} &amp;lt;!-- Please place categories where indicated at the bottom...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{module rating|protected}}&lt;br /&gt;
{{high-risk}}&lt;br /&gt;
{{used in system|in [[MediaWiki:Wantedpages-summary]]}}&lt;br /&gt;
{{Commons Import}}&lt;br /&gt;
&amp;lt;!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This module provides a handful of functions that make it easy to implement hatnotes that take the form of a label in front of a list of pages, e.g. {{hatnote|LABEL: [[A]], [[B]], and [[C]]}}&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
===labelledList===&lt;br /&gt;
Invoking the &amp;lt;code&amp;gt;labelledList()&amp;lt;/code&amp;gt; function is enough to implement most such templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Labelled list hatnote|labelledList|Universal label}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Labelled list hatnote|labelledList|Singular label|Plural label}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, providing &amp;quot;See also&amp;quot; instead of &amp;quot;Universal label&amp;quot; duplicates the functionality of {{tl|see also}}, while providing &amp;quot;Main article&amp;quot; and &amp;quot;Main articles&amp;quot; instead of &amp;quot;Singular label&amp;quot; and &amp;quot;Plural label&amp;quot; duplicates the (article namespace) functionality of {{tl|main}}.&lt;br /&gt;
&lt;br /&gt;
===preprocessDisplays===&lt;br /&gt;
The &amp;lt;code&amp;gt;preprocessDisplays()&amp;lt;/code&amp;gt; function takes a raw list of arguments and combines in any display arguments. For example, {{tlx|see also|1|&amp;lt;nowiki&amp;gt;l1=One&amp;lt;/nowiki&amp;gt;}} initially has the arguments table &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{&amp;#039;1&amp;#039;, [&amp;#039;l1&amp;#039;] = &amp;#039;One&amp;#039;}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;; this table would combine those into the table &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{&amp;#039;1|One&amp;#039;}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. It overrides manual piping (e.g. {{tlx|see also|&amp;lt;nowiki&amp;gt;1{{!}}2&amp;lt;/nowiki&amp;gt;|&amp;lt;nowiki&amp;gt;l1=One&amp;lt;/nowiki&amp;gt;}} → &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{&amp;#039;1|One&amp;#039;}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;) and compresses sparse arrays if a parameter is skipped or left empty.&lt;br /&gt;
&lt;br /&gt;
Example: &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local mLabelledList = require(&amp;#039;Module:Labelled list hatnote&amp;#039;)&lt;br /&gt;
local pages = mLabelledList.preprocessDisplays(args)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===_labelledList===&lt;br /&gt;
For modules that need to modify the functionality slightly while still using it, &amp;lt;code&amp;gt;_labelledList()&amp;lt;/code&amp;gt; provides some flexibility. It takes three parameters:&lt;br /&gt;
# A pages list, preferably preprocessed and compressed by &amp;lt;code&amp;gt;preprocessDisplays&amp;lt;/code&amp;gt;&lt;br /&gt;
# A labels table, where the first item is the singular or universal label, and the second either a plural label or a copy of the first.&lt;br /&gt;
# An options table, preferably containing:&lt;br /&gt;
#* a &amp;lt;code&amp;gt;template&amp;lt;/code&amp;gt; string with the full title of the template. Defaults to the title of this module.&lt;br /&gt;
#* a &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt; string (or nil) as taken by &amp;lt;code&amp;gt;makeWikitextError&amp;lt;/code&amp;gt; from [[Module:Hatnote]], to optionally disable error categories&lt;br /&gt;
#* a &amp;lt;code&amp;gt;selfref&amp;lt;/code&amp;gt; string (or nil) as taken by &amp;lt;code&amp;gt;_hatnote&amp;lt;/code&amp;gt; to enable the selfref option&lt;br /&gt;
&lt;br /&gt;
Example: &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local mLabelledList = require(&amp;#039;Module:Labelled list hatnote&amp;#039;)&lt;br /&gt;
return mLabelledList._labelledList(pages, labels, options)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Errors==&lt;br /&gt;
This module causes templates based on it to produce an error message if no page names are provided as template parameters. Normally, these should lead back to &amp;quot;Errors&amp;quot; sections in the documentation of those templates. However, if those templates use a module with &amp;lt;code&amp;gt;_labelledList()&amp;lt;/code&amp;gt; and don&amp;#039;t provide a &amp;lt;code&amp;gt;template&amp;lt;/code&amp;gt; item in their options table, that error defaults to leading back here. The error can be solved by providing at least one valid page-name parameter to the template in question; the problem in the template can be fixed by providing some value to the &amp;lt;code&amp;gt;template&amp;lt;/code&amp;gt; item of the &amp;lt;code&amp;gt;_labelledList()&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;options&amp;lt;/code&amp;gt; table.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{sandbox other||&lt;br /&gt;
&amp;lt;!-- Categories below this line, please; interwikis at Wikidata --&amp;gt;&lt;br /&gt;
[[Category:Hatnote modules| ]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Caleb Cooper</name></author>
	</entry>
</feed>