<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://the-democratika.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ACategory_see_also</id>
	<title>Module:Category see also - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://the-democratika.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ACategory_see_also"/>
	<link rel="alternate" type="text/html" href="https://the-democratika.com/wiki/index.php?title=Module:Category_see_also&amp;action=history"/>
	<updated>2026-04-04T18:01:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://the-democratika.com/wiki/index.php?title=Module:Category_see_also&amp;diff=6109&amp;oldid=prev</id>
		<title>&gt;Fayenatic london: better without the colon before &quot;the categories&quot;</title>
		<link rel="alternate" type="text/html" href="https://the-democratika.com/wiki/index.php?title=Module:Category_see_also&amp;diff=6109&amp;oldid=prev"/>
		<updated>2021-06-02T21:14:44Z</updated>

		<summary type="html">&lt;p&gt;better without the colon before &amp;quot;the categories&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements {{Category see also}}&lt;br /&gt;
&lt;br /&gt;
local mHatnote = require(&amp;#039;Module:Hatnote&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function makeWikitextError(msg)&lt;br /&gt;
	return string.format(&lt;br /&gt;
		&amp;#039;&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;Error: %s ([[Template:Category see also]])&amp;lt;/strong&amp;gt;&amp;#039;,&lt;br /&gt;
		msg&lt;br /&gt;
	)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Gets the length of the sequence seq. Usually this should be done with the #&lt;br /&gt;
-- operator, but we need to work with tables that get their values through an&lt;br /&gt;
-- __index metamethod.&lt;br /&gt;
local function getSequenceLength(seq)&lt;br /&gt;
	local length = 0&lt;br /&gt;
	for i in ipairs(seq) do&lt;br /&gt;
		length = i&lt;br /&gt;
	end&lt;br /&gt;
	return length&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Given a table of options, returns a function that formats categories for&lt;br /&gt;
-- those options.&lt;br /&gt;
--&lt;br /&gt;
-- Options:&lt;br /&gt;
-- project - a project code such as &amp;quot;fr&amp;quot; (for the French Wikipedia)&lt;br /&gt;
-- showPrefix - a boolean value for whether to show the &amp;quot;Category:&amp;quot; prefix&lt;br /&gt;
--              (and the project prefix if specified)&lt;br /&gt;
--&lt;br /&gt;
-- This is implemented as a function generator rather than a simple function&lt;br /&gt;
-- so that we can just process the options once, instead of every time we&lt;br /&gt;
-- generate a category.&lt;br /&gt;
local function newCategoryLinker(options)&lt;br /&gt;
	local formatString&lt;br /&gt;
	if options.project then&lt;br /&gt;
		if options.showPrefix then&lt;br /&gt;
			formatString = &amp;#039;[[:&amp;#039; .. options.project .. &amp;#039;:Category:%s]]&amp;#039;&lt;br /&gt;
		else&lt;br /&gt;
			formatString = &amp;#039;[[:&amp;#039; .. options.project .. &amp;#039;:Category:%s|%s]]&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		if options.showPrefix then&lt;br /&gt;
			formatString = &amp;#039;[[:Category:%s]]&amp;#039;&lt;br /&gt;
		else&lt;br /&gt;
			formatString = &amp;#039;[[:Category:%s|%s]]&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return function (category)&lt;br /&gt;
		local title = mw.title.new(category)&lt;br /&gt;
		local pageName, display&lt;br /&gt;
		if not title then&lt;br /&gt;
			-- category is not a valid title, usually because of invalid&lt;br /&gt;
			-- characters like &amp;lt; or [. Raise an error and suppress the stack&lt;br /&gt;
			-- level information so that we can catch it and format the error&lt;br /&gt;
			-- message as wikitext.&lt;br /&gt;
			error(string.format(&lt;br /&gt;
				&amp;quot;&amp;#039;%s&amp;#039; is not a valid category name&amp;quot;,&lt;br /&gt;
				category&lt;br /&gt;
			), 0)&lt;br /&gt;
		elseif title.namespace == 14 then -- Category namespace&lt;br /&gt;
			pageName = title.text&lt;br /&gt;
			display = title.text&lt;br /&gt;
		else&lt;br /&gt;
			pageName = title.prefixedText&lt;br /&gt;
			display = category&lt;br /&gt;
		end&lt;br /&gt;
		-- We can get away with using two arguments even when&lt;br /&gt;
		-- options.showDisplay is false, as string.format ignores extra&lt;br /&gt;
		-- arguments as long as there is an argument for each flag in the&lt;br /&gt;
		-- format string.&lt;br /&gt;
		return formatString:format(pageName, display)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._main(args)&lt;br /&gt;
	local nLinks = getSequenceLength(args)&lt;br /&gt;
&lt;br /&gt;
	if nLinks &amp;lt; 1 then&lt;br /&gt;
		return makeWikitextError(&amp;#039;at least one parameter required&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local makeCategoryLink = newCategoryLinker{&lt;br /&gt;
		project = args.project,&lt;br /&gt;
		showPrefix = nLinks == 1,&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	local links = {}&lt;br /&gt;
	for i, cat in ipairs(args) do&lt;br /&gt;
		local success, categoryLink = pcall(makeCategoryLink, cat)&lt;br /&gt;
		if success then&lt;br /&gt;
			links[i] = categoryLink&lt;br /&gt;
		else&lt;br /&gt;
			-- If there was an error, then categoryLink is the error message.&lt;br /&gt;
			return makeWikitextError(categoryLink)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local formatString&lt;br /&gt;
	if nLinks == 1 then&lt;br /&gt;
		formatString = &amp;#039;%s: %s&amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		formatString = &amp;#039;%s the categories %s&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Don&amp;#039;t output a comma before the &amp;quot;and&amp;quot; if we have only two links.&lt;br /&gt;
	local conjunction&lt;br /&gt;
	if nLinks == 2 then&lt;br /&gt;
		conjunction = &amp;#039; and &amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		conjunction = &amp;#039;, and &amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local hatnoteText = formatString:format(&lt;br /&gt;
		args.LABEL or &amp;#039;See also&amp;#039;,&lt;br /&gt;
		mw.text.listToText(links, &amp;#039;, &amp;#039;, conjunction)&lt;br /&gt;
	)&lt;br /&gt;
	return mHatnote._hatnote(hatnoteText, {selfref = true})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local args = require(&amp;#039;Module:Arguments&amp;#039;).getArgs(frame, {&lt;br /&gt;
		wrappers = &amp;#039;Template:Category see also&amp;#039;,&lt;br /&gt;
	})&lt;br /&gt;
	return p._main(args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>&gt;Fayenatic london</name></author>
	</entry>
</feed>