<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://test.st34an.tech/index.php?action=history&amp;feed=atom&amp;title=Module%3AUtilities%2Fformat_categories</id>
	<title>Module:Utilities/format categories - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://test.st34an.tech/index.php?action=history&amp;feed=atom&amp;title=Module%3AUtilities%2Fformat_categories"/>
	<link rel="alternate" type="text/html" href="https://test.st34an.tech/index.php?title=Module:Utilities/format_categories&amp;action=history"/>
	<updated>2026-04-10T22:20:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://test.st34an.tech/index.php?title=Module:Utilities/format_categories&amp;diff=339&amp;oldid=prev</id>
		<title>Jsrs701: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://test.st34an.tech/index.php?title=Module:Utilities/format_categories&amp;diff=339&amp;oldid=prev"/>
		<updated>2026-04-10T07:29:40Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&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 07:29, 10 April 2026&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 mediawikidb:diff:1.41:old-338:rev-339 --&gt;
&lt;/table&gt;</summary>
		<author><name>Jsrs701</name></author>
	</entry>
	<entry>
		<id>https://test.st34an.tech/index.php?title=Module:Utilities/format_categories&amp;diff=338&amp;oldid=prev</id>
		<title>bob&gt;Juelos: Created page with &quot;local data = mw.loadData(&quot;Module:utilities/format_categories/data&quot;)  --[[ Format the categories with the appropriate sort key. CATEGORIES is a list of categories. 	-- LANG is...&quot;</title>
		<link rel="alternate" type="text/html" href="https://test.st34an.tech/index.php?title=Module:Utilities/format_categories&amp;diff=338&amp;oldid=prev"/>
		<updated>2022-04-10T07:39:39Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local data = mw.loadData(&amp;quot;Module:utilities/format_categories/data&amp;quot;)  --[[ Format the categories with the appropriate sort key. CATEGORIES is a list of categories. 	-- LANG is...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local data = mw.loadData(&amp;quot;Module:utilities/format_categories/data&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Format the categories with the appropriate sort key. CATEGORIES is a list of&lt;br /&gt;
categories.&lt;br /&gt;
	-- LANG is an object encapsulating a language; if nil, the object for&lt;br /&gt;
	   language code &amp;#039;und&amp;#039; (undetermined) will be used.&lt;br /&gt;
	-- SORT_KEY is placed in the category invocation, and indicates how the&lt;br /&gt;
	   page will sort in the respective category. Normally this should be nil,&lt;br /&gt;
	   and a default sort key based on the subpage name (the part after the&lt;br /&gt;
	   colon) will be used.&lt;br /&gt;
	-- SORT_BASE lets you override the default sort key used when SORT_KEY is&lt;br /&gt;
	   nil. Normally, this should be nil, and a language-specific default sort&lt;br /&gt;
	   key is computed from the subpage name (e.g. for Russian this converts&lt;br /&gt;
	   Cyrillic ё to a string consisting of Cyrillic е followed by U+10FFFF,&lt;br /&gt;
	   so that effectively ё sorts after е instead of the default Wikimedia&lt;br /&gt;
	   sort, which (I think) is based on Unicode sort order and puts ё after я,&lt;br /&gt;
	   the last letter of the Cyrillic alphabet.&lt;br /&gt;
	-- FORCE_OUTPUT forces normal output in all namespaces. Normally, nothing&lt;br /&gt;
	   is output if the page isn&amp;#039;t in the main, Appendix:, Reconstruction: or&lt;br /&gt;
	   Citations: namespaces.&lt;br /&gt;
]]&lt;br /&gt;
return function(categories, lang, sort_key, sort_base, force_output, sc)&lt;br /&gt;
	if type(lang) == &amp;quot;table&amp;quot; and not lang.getCode then&lt;br /&gt;
		error(&amp;quot;The second argument to format_categories should be a language object.&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local title_obj = mw.title.getCurrentTitle()	&lt;br /&gt;
&lt;br /&gt;
	if force_output or data.allowedNamespaces[title_obj.nsText] or data.allowedPrefixedPages[title_obj.prefixedText] then&lt;br /&gt;
		local PAGENAME = title_obj.text&lt;br /&gt;
		local SUBPAGENAME = title_obj.subpageText&lt;br /&gt;
		&lt;br /&gt;
		if not lang then&lt;br /&gt;
			lang = require(&amp;quot;Module:languages&amp;quot;).getByCode(&amp;quot;und&amp;quot;)&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- Generate a default sort key&lt;br /&gt;
		sort_base = lang:makeSortKey(sort_base or SUBPAGENAME, sc)&lt;br /&gt;
		&lt;br /&gt;
		if sort_key and sort_key ~= &amp;quot;&amp;quot; then&lt;br /&gt;
			-- Gather some statistics regarding sort keys&lt;br /&gt;
			if mw.ustring.upper(sort_key) == sort_base then&lt;br /&gt;
				table.insert(categories, &amp;quot;Sort key tracking/redundant&amp;quot;)&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			sort_key = sort_base&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- If the sortkey is empty, remove it.&lt;br /&gt;
		-- Leave the sortkey if it is equal to PAGENAME, because it still&lt;br /&gt;
		-- might be different from DEFAULTSORT and therefore have an effect; see&lt;br /&gt;
		-- [[Wiktionary:Grease pit/2020/April#Module:utilities#format categories]].&lt;br /&gt;
		if sort_key == &amp;quot;&amp;quot; then&lt;br /&gt;
			sort_key = nil&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		local out_categories = {}&lt;br /&gt;
		for key, cat in ipairs(categories) do&lt;br /&gt;
			out_categories[key] = &amp;quot;[[Category:&amp;quot; .. cat .. (sort_key and &amp;quot;|&amp;quot; .. sort_key or &amp;quot;&amp;quot;) .. &amp;quot;]]&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		return table.concat(out_categories, &amp;quot;&amp;quot;)&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;/div&gt;</summary>
		<author><name>bob&gt;Juelos</name></author>
	</entry>
</feed>