<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.ban-covert-modeling.org/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ALabelled_list_hatnote</id>
	<title>Module:Labelled list hatnote - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ban-covert-modeling.org/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ALabelled_list_hatnote"/>
	<link rel="alternate" type="text/html" href="https://wiki.ban-covert-modeling.org/w/index.php?title=Module:Labelled_list_hatnote&amp;action=history"/>
	<updated>2026-04-10T03:25:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://wiki.ban-covert-modeling.org/w/index.php?title=Module:Labelled_list_hatnote&amp;diff=1293&amp;oldid=prev</id>
		<title>Juho Kunsola: 1 revision imported: Importing CS-1 templates and Template:Citation with the &quot;include templates ticked&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.ban-covert-modeling.org/w/index.php?title=Module:Labelled_list_hatnote&amp;diff=1293&amp;oldid=prev"/>
		<updated>2020-12-06T19:17:27Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported: Importing CS-1 templates and Template:Citation with the &amp;quot;include templates ticked&amp;quot;&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 19:17, 6 December 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&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 bcmenwiki:diff:1.41:old-1292:rev-1293 --&gt;
&lt;/table&gt;</summary>
		<author><name>Juho Kunsola</name></author>
	</entry>
	<entry>
		<id>https://wiki.ban-covert-modeling.org/w/index.php?title=Module:Labelled_list_hatnote&amp;diff=1292&amp;oldid=prev</id>
		<title>w&gt;Nihiltres: Protected &quot;Module:Labelled list hatnote&quot;: Highly visible template ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))</title>
		<link rel="alternate" type="text/html" href="https://wiki.ban-covert-modeling.org/w/index.php?title=Module:Labelled_list_hatnote&amp;diff=1292&amp;oldid=prev"/>
		<updated>2017-02-02T05:26:53Z</updated>

		<summary type="html">&lt;p&gt;Protected &amp;quot;&lt;a href=&quot;/wiki/Module:Labelled_list_hatnote&quot; title=&quot;Module:Labelled list hatnote&quot;&gt;Module:Labelled list hatnote&lt;/a&gt;&amp;quot;: &lt;a href=&quot;/w/index.php?title=WP:High-risk_templates&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;WP:High-risk templates (page does not exist)&quot;&gt;Highly visible template&lt;/a&gt; ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--------------------------------------------------------------------------------&lt;br /&gt;
--                               Labelled list                                --&lt;br /&gt;
--                                                                            --&lt;br /&gt;
-- This module does the core work of creating a hatnote composed of a list    --&lt;br /&gt;
-- prefixed by a colon-terminated label, i.e. &amp;quot;LABEL: [andList of pages]&amp;quot;,    --&lt;br /&gt;
-- for {{see also}} and similar templates.                                    --&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local mHatnote = require(&amp;#039;Module:Hatnote&amp;#039;)&lt;br /&gt;
local mHatlist = require(&amp;#039;Module:Hatnote list&amp;#039;)&lt;br /&gt;
local mArguments --initialize lazily&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Defaults global to this module&lt;br /&gt;
local defaults = {&lt;br /&gt;
	label = &amp;#039;See also&amp;#039;, --Final fallback for label argument&lt;br /&gt;
	labelForm = &amp;#039;%s: %s&amp;#039;,&lt;br /&gt;
	prefixes = {&amp;#039;label&amp;#039;, &amp;#039;label &amp;#039;, &amp;#039;l&amp;#039;},&lt;br /&gt;
	template = &amp;#039;Module:Labelled list hatnote&amp;#039;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- Helper function that pre-combines display parameters into page arguments.&lt;br /&gt;
-- Also compresses sparse arrays, as a desirable side-effect.&lt;br /&gt;
function p.preprocessDisplays (args, prefixes)&lt;br /&gt;
	-- Prefixes specify which parameters, in order, to check for display options&lt;br /&gt;
	-- They each have numbers auto-appended, e.g. &amp;#039;label1&amp;#039;, &amp;#039;label 1&amp;#039;, &amp;amp; &amp;#039;l1&amp;#039;&lt;br /&gt;
	prefixes = prefixes or defaults.prefixes&lt;br /&gt;
	local pages = {}&lt;br /&gt;
	for k, v in pairs(args) do&lt;br /&gt;
		if type(k) == &amp;#039;number&amp;#039; then&lt;br /&gt;
			local display&lt;br /&gt;
			for i = 1, #prefixes do&lt;br /&gt;
				display = args[prefixes[i] .. k]&lt;br /&gt;
				if display then break end&lt;br /&gt;
			end&lt;br /&gt;
			local page = display and&lt;br /&gt;
				string.format(&amp;#039;%s|%s&amp;#039;, string.gsub(v, &amp;#039;|.*$&amp;#039;, &amp;#039;&amp;#039;), display) or v&lt;br /&gt;
			pages[#pages + 1] = page&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return pages&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Produces a labelled pages-list hatnote.&lt;br /&gt;
-- The main frame (template definition) takes 1 or 2 arguments, for a singular&lt;br /&gt;
-- and (optionally) plural label respectively:&lt;br /&gt;
-- * {{#invoke:Labelled list hatnote|labelledList|Singular label|Plural label}}&lt;br /&gt;
-- The resulting template takes pagename &amp;amp; label parameters normally.&lt;br /&gt;
function p.labelledList (frame)&lt;br /&gt;
	mArguments = require(&amp;#039;Module:Arguments&amp;#039;)&lt;br /&gt;
	local labels = {frame.args[1] or defaults.label}&lt;br /&gt;
	labels[2] = frame.args[2] or labels[1]&lt;br /&gt;
	local template = frame:getParent():getTitle()&lt;br /&gt;
	local args = mArguments.getArgs(frame, {parentOnly = true})&lt;br /&gt;
	local pages = p.preprocessDisplays(args)&lt;br /&gt;
	local options = {&lt;br /&gt;
		extraclasses = frame.args.extraclasses,&lt;br /&gt;
		category = args.category,&lt;br /&gt;
		selfref = frame.args.selfref or args.selfref,&lt;br /&gt;
		template = template&lt;br /&gt;
	}&lt;br /&gt;
	return p._labelledList(pages, labels, options)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._labelledList (pages, labels, options)&lt;br /&gt;
	labels = labels or {}&lt;br /&gt;
	if #pages == 0 then&lt;br /&gt;
		return mHatnote.makeWikitextError(&lt;br /&gt;
			&amp;#039;no page names specified&amp;#039;,&lt;br /&gt;
			(options.template or defaults.template) .. &amp;#039;#Errors&amp;#039;,&lt;br /&gt;
			options.category&lt;br /&gt;
		)&lt;br /&gt;
	end&lt;br /&gt;
	label = (#pages == 1 and labels[1] or labels[2]) or defaults.label&lt;br /&gt;
	local text = string.format(&lt;br /&gt;
		options.labelForm or defaults.labelForm,&lt;br /&gt;
		label,&lt;br /&gt;
		mHatlist.andList(pages, true)&lt;br /&gt;
	)&lt;br /&gt;
	local hnOptions = {&lt;br /&gt;
		extraclasses = options.extraclasses,&lt;br /&gt;
		selfref = options.selfref&lt;br /&gt;
	}&lt;br /&gt;
	return mHatnote._hatnote(text, hnOptions)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>w&gt;Nihiltres</name></author>
	</entry>
</feed>