<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FNihiltres%2FCategory_manager%2Fdoc</id>
	<title>Module:Sandbox/Nihiltres/Category manager/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FNihiltres%2FCategory_manager%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Nihiltres/Category_manager/doc&amp;action=history"/>
	<updated>2026-05-27T20:20:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Sandbox/Nihiltres/Category_manager/doc&amp;diff=145918&amp;oldid=prev</id>
		<title>imported&gt;Trialpears: Trialpears moved page Module:Category manager/doc to Module:Sandbox/Nihiltres/Category manager/doc without leaving a redirect: Userfying per Wikipedia:Templates_for_discussion/Log/2019_December_31#Module:Category_manager</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Nihiltres/Category_manager/doc&amp;diff=145918&amp;oldid=prev"/>
		<updated>2020-01-08T08:19:20Z</updated>

		<summary type="html">&lt;p&gt;Trialpears moved page &lt;a href=&quot;/index.php?title=Module:Category_manager/doc&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Module:Category manager/doc (page does not exist)&quot;&gt;Module:Category manager/doc&lt;/a&gt; to &lt;a href=&quot;/research/Module:Sandbox/Nihiltres/Category_manager/doc&quot; title=&quot;Module:Sandbox/Nihiltres/Category manager/doc&quot;&gt;Module:Sandbox/Nihiltres/Category manager/doc&lt;/a&gt; without leaving a redirect: Userfying per &lt;a href=&quot;https://en.wikipedia.org/wiki/Templates_for_discussion/Log/2019_December_31#Module:Category_manager&quot; class=&quot;extiw&quot; title=&quot;wikipedia:Templates for discussion/Log/2019 December 31&quot;&gt;Wikipedia:Templates_for_discussion/Log/2019_December_31#Module:Category_manager&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Module rating |beta}}&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 implements a simple tool for managing category output in modules.&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
The module cannot be used from wikitext. It can be imported to another module using code similar to the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;local catMan = require(&amp;quot;Module:Category manager&amp;quot;)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Category-list table format===&lt;br /&gt;
Each function in the module takes a table as its first parameter, and that table is used as the list of categories. These tables are assumed to only be manipulated by this module&amp;#039;s functions, but there is no protection against external manipulation; there&amp;#039;s just basic type/value validation. Each item in a category-list table has its category name (without prefix) as its key; duplicate categories are therefore impossible. Values for each key can either be &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; (no sort key) or a string containing that sort key. A &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; value or any other type of value will cause errors. There are three functions for manipulating a category list table, and their individual documentation follows.&lt;br /&gt;
&lt;br /&gt;
==Functions==&lt;br /&gt;
&lt;br /&gt;
===addCategory===&lt;br /&gt;
Usage:&lt;br /&gt;
* &amp;lt;code&amp;gt;catMan.addCategory(catList, name)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;catMan.addCategory(catList, name, sortKey)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;addCategory&amp;lt;/code&amp;gt; function adds a category by setting the key from &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;catList&amp;lt;/code&amp;gt; table to either &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; or the provided &amp;lt;code&amp;gt;sortKey&amp;lt;/code&amp;gt; value if present.&lt;br /&gt;
&lt;br /&gt;
If an existing category is added a second time, its value will be overwritten with the new value; for this reason the module does not include a separate function for setting sort keys.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;catList&amp;lt;/code&amp;gt; parameter must be a table, the &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt; parameter must be a non-empty, non-whitespace string, and &amp;lt;code&amp;gt;sortKey&amp;lt;/code&amp;gt; must be either a string or nil.&lt;br /&gt;
&lt;br /&gt;
===removeCategory===&lt;br /&gt;
Usage:&lt;br /&gt;
* &amp;lt;code&amp;gt;catMan.removeCategory(catList, name)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;removeCategory&amp;lt;/code&amp;gt; function removes a category by setting the key from &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt; to nil in the &amp;lt;code&amp;gt;catList&amp;lt;/code&amp;gt; table.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;catList&amp;lt;/code&amp;gt; parameter must be a table, and the &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt; parameter must be a non-empty, non-whitespace string.&lt;br /&gt;
&lt;br /&gt;
===writeCategoryList===&lt;br /&gt;
Usage:&lt;br /&gt;
* &amp;lt;code&amp;gt;catMan.writeCategoryList(catList)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;catMan.writeCategoryList(catList, nullify)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;writeCategoryList&amp;lt;/code&amp;gt; function produces a string containing all the categories in the table formatted as wikitext. Optionally, a boolean &amp;lt;code&amp;gt;nullify&amp;lt;/code&amp;gt; parameter may be provided, and if true, it will cause the function to output an empty string. This is useful as it makes it easy to disable category output through a parameter, probably in conjunction with [[Module:Yesno]].&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;catList&amp;lt;/code&amp;gt; parameter must be a table formatted according to the category-list table format, and the &amp;lt;code&amp;gt;nullify&amp;lt;/code&amp;gt; parameter must be either a boolean or nil.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{#ifeq:{{SUBPAGENAME}}|sandbox ||&lt;br /&gt;
&amp;lt;!-- Categories below this line, please; interwikis at Wikidata --&amp;gt;&lt;br /&gt;
[[Category:Lua metamodules]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>imported&gt;Trialpears</name></author>
	</entry>
</feed>