<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mindpowe.red/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://mindpowe.red/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ACategory_see_also"/>
	<link rel="alternate" type="text/html" href="https://mindpowe.red/wiki/index.php?title=Module:Category_see_also&amp;action=history"/>
	<updated>2026-04-09T00:14:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://mindpowe.red/wiki/index.php?title=Module:Category_see_also&amp;diff=2914&amp;oldid=prev</id>
		<title>imported&gt;Mr. Stradivarius: Protected &quot;Module:Category see also&quot;: High-risk Lua module: 50,000+ transclusions ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))</title>
		<link rel="alternate" type="text/html" href="https://mindpowe.red/wiki/index.php?title=Module:Category_see_also&amp;diff=2914&amp;oldid=prev"/>
		<updated>2018-01-27T05:50:30Z</updated>

		<summary type="html">&lt;p&gt;Protected &amp;quot;&lt;a href=&quot;/wiki/index.php/Module:Category_see_also&quot; title=&quot;Module:Category see also&quot;&gt;Module:Category see also&lt;/a&gt;&amp;quot;: &lt;a href=&quot;/wiki/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;High-risk Lua module&lt;/a&gt;: 50,000+ transclusions ([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;-- This module implements {{Category see also}}&lt;br /&gt;
&lt;br /&gt;
local mHatnote = require('Module:Hatnote')&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;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;Error: %s ([[Template:Category see also]])&amp;lt;/strong&amp;gt;',&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 = '[[:' .. options.project .. ':Category:%s]]'&lt;br /&gt;
		else&lt;br /&gt;
			formatString = '[[:' .. options.project .. ':Category:%s|%s]]'&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		if options.showPrefix then&lt;br /&gt;
			formatString = '[[:Category:%s]]'&lt;br /&gt;
		else&lt;br /&gt;
			formatString = '[[:Category:%s|%s]]'&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;'%s' 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('at least one parameter required')&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 = '%s: %s.'&lt;br /&gt;
	else&lt;br /&gt;
		formatString = '%s: the categories %s.'&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Don'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 = ' and '&lt;br /&gt;
	else&lt;br /&gt;
		conjunction = ', and '&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local hatnoteText = formatString:format(&lt;br /&gt;
		args.LABEL or 'See also',&lt;br /&gt;
		mw.text.listToText(links, ', ', 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('Module:Arguments').getArgs(frame, {&lt;br /&gt;
		wrappers = 'Template:Category see also',&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>imported&gt;Mr. Stradivarius</name></author>
		
	</entry>
</feed>