<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.filipefonseca.pt/index.php?action=history&amp;feed=atom&amp;title=Module%3ACat_main</id>
	<title>Module:Cat main - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.filipefonseca.pt/index.php?action=history&amp;feed=atom&amp;title=Module%3ACat_main"/>
	<link rel="alternate" type="text/html" href="http://wiki.filipefonseca.pt/index.php?title=Module:Cat_main&amp;action=history"/>
	<updated>2026-04-19T13:05:13Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>http://wiki.filipefonseca.pt/index.php?title=Module:Cat_main&amp;diff=7806&amp;oldid=prev</id>
		<title>FilipeFonseca: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="http://wiki.filipefonseca.pt/index.php?title=Module:Cat_main&amp;diff=7806&amp;oldid=prev"/>
		<updated>2021-07-11T12:23:28Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements {{cat main}}.&lt;br /&gt;
&lt;br /&gt;
local mHatnote = require('Module:Hatnote')&lt;br /&gt;
local yesno = require('Module:Yesno')&lt;br /&gt;
local mTableTools -- lazily initialise&lt;br /&gt;
local mArguments -- lazily initialise&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.catMain(frame)&lt;br /&gt;
	mTableTools = require('Module:TableTools')&lt;br /&gt;
	mArguments = require('Module:Arguments')&lt;br /&gt;
	local args = mArguments.getArgs(frame, {wrappers = 'Template:Cat main'})&lt;br /&gt;
	local pages = mTableTools.compressSparseArray(args)&lt;br /&gt;
	local options = {&lt;br /&gt;
		article = args.article,&lt;br /&gt;
		selfref = args.selfref&lt;br /&gt;
	}&lt;br /&gt;
	return p._catMain(options, unpack(pages))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._catMain(options, ...)&lt;br /&gt;
	options = options or {}&lt;br /&gt;
&lt;br /&gt;
	-- Get the links table.&lt;br /&gt;
	local links = mHatnote.formatPages(...)&lt;br /&gt;
	if not links[1] then&lt;br /&gt;
		local page = mw.title.getCurrentTitle().text&lt;br /&gt;
		links[1] = mHatnote._formatLink{link = page}&lt;br /&gt;
	end&lt;br /&gt;
	for i, link in ipairs(links) do&lt;br /&gt;
		links[i] = string.format(&amp;quot;'''%s'''&amp;quot;, link)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Get the pagetype.&lt;br /&gt;
	local pagetype&lt;br /&gt;
	if yesno(options.article) ~= false then&lt;br /&gt;
		pagetype = 'article'&lt;br /&gt;
	else&lt;br /&gt;
		pagetype = 'page'&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Work out whether we need to be singular or plural.&lt;br /&gt;
	local stringToFormat&lt;br /&gt;
	if #links &amp;gt; 1 then&lt;br /&gt;
		stringToFormat = 'The main %ss for this [[Help:Categories|category]] are %s.'&lt;br /&gt;
	else&lt;br /&gt;
		stringToFormat = 'The main %s for this [[Help:Categories|category]] is %s.'&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Get the text.&lt;br /&gt;
	local text = string.format(&lt;br /&gt;
		stringToFormat,&lt;br /&gt;
		pagetype,&lt;br /&gt;
		mw.text.listToText(links)&lt;br /&gt;
	)&lt;br /&gt;
	&lt;br /&gt;
	-- Pass it through to Module:Hatnote.&lt;br /&gt;
	local hnOptions = {}&lt;br /&gt;
	hnOptions.selfref = options.selfref&lt;br /&gt;
	hnOptions.extraclasses = 'relarticle mainarticle'&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>FilipeFonseca</name></author>
	</entry>
</feed>