<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.digitalcellulose.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ACategory_tree</id>
	<title>Module:Category tree - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.digitalcellulose.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ACategory_tree"/>
	<link rel="alternate" type="text/html" href="https://www.digitalcellulose.com/wiki/index.php?title=Module:Category_tree&amp;action=history"/>
	<updated>2026-05-14T20:30:58Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://www.digitalcellulose.com/wiki/index.php?title=Module:Category_tree&amp;diff=98364&amp;oldid=prev</id>
		<title>Adminsuzy: Created page with &quot;local export = {} local m_languages = require('Module:languages') local m_utilities = require('Module:utilities') local inFundamental = mw.loadData(&quot;Module:category tree/data&quot;...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.digitalcellulose.com/wiki/index.php?title=Module:Category_tree&amp;diff=98364&amp;oldid=prev"/>
		<updated>2018-08-28T03:46:42Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local export = {} local m_languages = require(&amp;#039;Module:languages&amp;#039;) local m_utilities = require(&amp;#039;Module:utilities&amp;#039;) local inFundamental = mw.loadData(&amp;quot;Module:category tree/data&amp;quot;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local export = {}&lt;br /&gt;
local m_languages = require('Module:languages')&lt;br /&gt;
local m_utilities = require('Module:utilities')&lt;br /&gt;
local inFundamental = mw.loadData(&amp;quot;Module:category tree/data&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local function capitalize(text)&lt;br /&gt;
	return mw.getContentLanguage():ucfirst(text)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- The main entry point.&lt;br /&gt;
-- This is the only function that can be invoked from a template.&lt;br /&gt;
function export.show(frame)&lt;br /&gt;
	if mw.title.getCurrentTitle().nsText == &amp;quot;Template&amp;quot; then&lt;br /&gt;
		return &amp;quot;(This template should be used on pages in the Category: namespace.)&amp;quot;&lt;br /&gt;
	elseif mw.title.getCurrentTitle().nsText ~= &amp;quot;Category&amp;quot; then&lt;br /&gt;
		error(&amp;quot;This template/module can only be used on pages in the Category: namespace.&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local template = frame.args[&amp;quot;template&amp;quot;]&lt;br /&gt;
	&lt;br /&gt;
	if not template or template == &amp;quot;&amp;quot; then&lt;br /&gt;
		error(&amp;quot;The \&amp;quot;template\&amp;quot; parameter was not specified.&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local submodule = require(&amp;quot;Module:category tree/&amp;quot; .. template)&lt;br /&gt;
	&lt;br /&gt;
	-- Get all the parameters and the label data&lt;br /&gt;
	local current&lt;br /&gt;
	&lt;br /&gt;
	if submodule.new_main then&lt;br /&gt;
		current = submodule.new_main(frame)&lt;br /&gt;
	else&lt;br /&gt;
		local info = {}&lt;br /&gt;
		&lt;br /&gt;
		for key, val in pairs(frame.args) do&lt;br /&gt;
			info[key] = val; if info[key] == &amp;quot;&amp;quot; then info[key] = nil end&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
		info.template = nil&lt;br /&gt;
		current = submodule.new(info, true)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local functions = {&lt;br /&gt;
		&amp;quot;getBreadcrumbName&amp;quot;,&lt;br /&gt;
		&amp;quot;getDataModule&amp;quot;,&lt;br /&gt;
		&amp;quot;canBeEmpty&amp;quot;,&lt;br /&gt;
		&amp;quot;getDescription&amp;quot;,&lt;br /&gt;
		&amp;quot;getParents&amp;quot;,&lt;br /&gt;
		&amp;quot;getChildren&amp;quot;,&lt;br /&gt;
		&amp;quot;getUmbrella&amp;quot;,&lt;br /&gt;
		&amp;quot;getAppendix&amp;quot;,&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	if current then&lt;br /&gt;
		for i, functionName in pairs(functions) do&lt;br /&gt;
			if type(current[functionName]) ~= &amp;quot;function&amp;quot; then&lt;br /&gt;
				require(&amp;quot;Module:debug&amp;quot;).track{ &amp;quot;category tree/missing function&amp;quot;, &amp;quot;category tree/missing function/&amp;quot; .. functionName }&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local boxes = {}&lt;br /&gt;
	local display = {}&lt;br /&gt;
	local categories = {}&lt;br /&gt;
&lt;br /&gt;
	if template == &amp;quot;topic cat&amp;quot; then&lt;br /&gt;
		table.insert(categories, &amp;quot;[[Category:topic cat]]&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Check if the category is empty&lt;br /&gt;
	local isEmpty = mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, &amp;quot;all&amp;quot;) == 0&lt;br /&gt;
	&lt;br /&gt;
	-- Are the parameters valid?&lt;br /&gt;
	if not current then&lt;br /&gt;
		table.insert(categories, &amp;quot;[[Category:Categories with invalid label]]&amp;quot;)&lt;br /&gt;
		table.insert(categories, isEmpty and &amp;quot;[[Category:Empty categories]]&amp;quot; or nil)&lt;br /&gt;
		table.insert(display, show_error(&lt;br /&gt;
			&amp;quot;The label given to the &amp;quot; ..&lt;br /&gt;
			require(&amp;quot;Module:template link&amp;quot;).format_link{template} ..&lt;br /&gt;
			&amp;quot; template is not valid. You may have mistyped it, or it simply has not been created yet. &amp;quot; ..&lt;br /&gt;
			&amp;quot;To add a new label, please consult the documentation of the template.&amp;quot;))&lt;br /&gt;
		&lt;br /&gt;
		-- Exit here, as all code beyond here relies on current not being nil&lt;br /&gt;
		return table.concat(categories, &amp;quot;&amp;quot;) .. table.concat(display, &amp;quot;\n\n&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Does the category have the correct name?&lt;br /&gt;
	if mw.title.getCurrentTitle().text ~= current:getCategoryName() then&lt;br /&gt;
		table.insert(categories, &amp;quot;[[Category:Categories with incorrect name]]&amp;quot;)&lt;br /&gt;
		table.insert(display, show_error(&lt;br /&gt;
			&amp;quot;Based on the parameters given to the &amp;quot; ..&lt;br /&gt;
			require(&amp;quot;Module:template link&amp;quot;).format_link{template} ..&lt;br /&gt;
			&amp;quot; template, this category should be called '''[[:Category:&amp;quot; .. current:getCategoryName() .. &amp;quot;]]'''.&amp;quot;))&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Add cleanup category for empty categories&lt;br /&gt;
	if isEmpty and not current:canBeEmpty() then&lt;br /&gt;
		table.insert(categories, &amp;quot;[[Category:Empty categories]]&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if current:isHidden() then&lt;br /&gt;
		table.insert(categories, &amp;quot;__HIDDENCAT__&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	table.insert(boxes, show_editlink(current))&lt;br /&gt;
	table.insert(boxes, show_pagelist(current))&lt;br /&gt;
	&lt;br /&gt;
	-- Generate the displayed information&lt;br /&gt;
	table.insert(display, show_breadcrumbs(current))&lt;br /&gt;
	table.insert(display, show_description(current))&lt;br /&gt;
	table.insert(display, show_appendix(current))&lt;br /&gt;
	table.insert(display, show_children(current))&lt;br /&gt;
	table.insert(display, show_TOC(current))&lt;br /&gt;
	table.insert(display, show_catfix(current))&lt;br /&gt;
	&lt;br /&gt;
	show_categories(current, categories)&lt;br /&gt;
	&lt;br /&gt;
	return table.concat(boxes, &amp;quot;\n&amp;quot;) .. &amp;quot;\n&amp;quot; .. table.concat(display, &amp;quot;\n\n&amp;quot;) .. table.concat(categories, &amp;quot;&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function show_error(text)&lt;br /&gt;
	return  mw.getCurrentFrame():expandTemplate{title = &amp;quot;maintenance box&amp;quot;, args = {&lt;br /&gt;
		&amp;quot;red&amp;quot;,&lt;br /&gt;
		image = &amp;quot;[[File:Ambox warning pn.svg|50px]]&amp;quot;,&lt;br /&gt;
		title = &amp;quot;The automatically-generated contents of this category has errors.&amp;quot;,&lt;br /&gt;
		text = text,&lt;br /&gt;
		}}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Check the name of the current page, and return an error if it's not right.&lt;br /&gt;
function check_name(current, template, info)&lt;br /&gt;
	local errortext = nil&lt;br /&gt;
	local category = nil&lt;br /&gt;
	&lt;br /&gt;
	if not current then&lt;br /&gt;
		errortext =&lt;br /&gt;
			&amp;quot;The label \&amp;quot;&amp;quot; .. (info.label or &amp;quot;&amp;quot;) .. &amp;quot;\&amp;quot; given to the &amp;quot; ..&lt;br /&gt;
			require(&amp;quot;Module:template link&amp;quot;).format_link{template} .. &amp;quot; template is not valid. &amp;quot; ..&lt;br /&gt;
			&amp;quot;You may have mistyped it, or it simply has not been created yet. To add a new label, please consult the documentation of the template.&amp;quot;&lt;br /&gt;
		category = &amp;quot;[[Category:Categories with invalid label]]&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if errortext then&lt;br /&gt;
		return (category or &amp;quot;&amp;quot;) .. show_error(errortext)&lt;br /&gt;
	else&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function show_catfix(current)&lt;br /&gt;
	if current._lang then&lt;br /&gt;
		return m_utilities.catfix(current._lang, (sc and require(&amp;quot;Module:scripts&amp;quot;).getByCode(info.sc) or nil))&lt;br /&gt;
	else&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Show the parent categories that the current category should be placed in.&lt;br /&gt;
function show_categories(current, categories)&lt;br /&gt;
	local parents = current:getParents()&lt;br /&gt;
	&lt;br /&gt;
	if not parents then&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	for _, parent in ipairs(parents) do&lt;br /&gt;
		if type(parent.name) == &amp;quot;string&amp;quot; then&lt;br /&gt;
			if not (current._lang and current:getCategoryName() == capitalize(current._lang:getCategoryName())) and not (current._sc and current:getCategoryName():find(capitalize(current._sc:getCategoryName()), nil, true)) and current:getInfo().code then&lt;br /&gt;
				require(&amp;quot;Module:debug&amp;quot;).track(&amp;quot;category tree/string&amp;quot;)&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			table.insert(categories, &amp;quot;[[&amp;quot; .. parent.name .. &amp;quot;|&amp;quot; .. parent.sort .. &amp;quot;]]&amp;quot;)&lt;br /&gt;
		else&lt;br /&gt;
			table.insert(categories, &amp;quot;[[Category:&amp;quot; .. parent.name:getCategoryName() .. &amp;quot;|&amp;quot; .. parent.sort .. &amp;quot;]]&amp;quot;)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Also put the category in its corresponding &amp;quot;umbrella&amp;quot; or &amp;quot;by language&amp;quot; category.&lt;br /&gt;
	local umbrella = current:getUmbrella()&lt;br /&gt;
	&lt;br /&gt;
	if umbrella then&lt;br /&gt;
		local sort&lt;br /&gt;
		if current._lang then&lt;br /&gt;
			sort = current._lang:getCanonicalName()&lt;br /&gt;
		else&lt;br /&gt;
			sort = current:getCategoryName()&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if type(umbrella) == &amp;quot;string&amp;quot; then&lt;br /&gt;
			table.insert(categories, &amp;quot;[[&amp;quot; .. umbrella .. &amp;quot;|&amp;quot; .. sort .. &amp;quot;]]&amp;quot;)&lt;br /&gt;
		else&lt;br /&gt;
			table.insert(categories, &amp;quot;[[Category:&amp;quot; .. umbrella:getCategoryName() .. &amp;quot;|&amp;quot; .. sort .. &amp;quot;]]&amp;quot;)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function show_editlink(current)&lt;br /&gt;
	return&lt;br /&gt;
		&amp;quot;&amp;lt;div class=\&amp;quot;noprint plainlinks\&amp;quot; style=\&amp;quot;float: right; clear: both; margin: 0 0 .5em 1em; background: #f9f9f9; border: 1px #aaaaaa solid; margin-top: -1px; padding: 5px; font-weight: bold;\&amp;quot;&amp;gt;[&amp;quot; ..&lt;br /&gt;
		tostring(mw.uri.fullUrl(current:getDataModule(), &amp;quot;action=edit&amp;quot;)) ..&lt;br /&gt;
		&amp;quot; Edit category data]&amp;lt;/div&amp;gt;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function show_pagelist(current)&lt;br /&gt;
	local namespace = &amp;quot;&amp;quot;&lt;br /&gt;
	local info = current:getInfo()&lt;br /&gt;
	&lt;br /&gt;
	if info.label == &amp;quot;citations&amp;quot; or info.label == &amp;quot;citations of undefined terms&amp;quot; then&lt;br /&gt;
		namespace = &amp;quot;Citations&amp;quot;&lt;br /&gt;
	elseif info.code then&lt;br /&gt;
		local lang = require(&amp;quot;Module:languages&amp;quot;).getByCode(info.code)&lt;br /&gt;
		&lt;br /&gt;
		if lang then&lt;br /&gt;
			if lang:getType() == &amp;quot;reconstructed&amp;quot; then&lt;br /&gt;
				namespace = &amp;quot;Reconstruction&amp;quot;&lt;br /&gt;
			elseif lang:getType() == &amp;quot;appendix-constructed&amp;quot; then&lt;br /&gt;
				namespace = &amp;quot;Appendix&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local recent = mw.getCurrentFrame():callParserFunction{&lt;br /&gt;
		name = &amp;quot;#tag&amp;quot;,&lt;br /&gt;
		args = {&lt;br /&gt;
			&amp;quot;DynamicPageList&amp;quot;,&lt;br /&gt;
			&amp;quot;category=&amp;quot; .. mw.title.getCurrentTitle().text .. &amp;quot;\n&amp;quot; ..&lt;br /&gt;
			&amp;quot;namespace=&amp;quot; .. namespace .. &amp;quot;\n&amp;quot; ..&lt;br /&gt;
			&amp;quot;count=10\n&amp;quot; ..&lt;br /&gt;
			&amp;quot;mode=ordered\n&amp;quot; ..&lt;br /&gt;
			&amp;quot;ordermethod=categoryadd\n&amp;quot; ..&lt;br /&gt;
			&amp;quot;order=descending&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	local oldest = mw.getCurrentFrame():callParserFunction{&lt;br /&gt;
		name = &amp;quot;#tag&amp;quot;,&lt;br /&gt;
		args = {&lt;br /&gt;
			&amp;quot;DynamicPageList&amp;quot;,&lt;br /&gt;
			&amp;quot;category=&amp;quot; .. mw.title.getCurrentTitle().text .. &amp;quot;\n&amp;quot; ..&lt;br /&gt;
			&amp;quot;namespace=&amp;quot; .. namespace .. &amp;quot;\n&amp;quot; ..&lt;br /&gt;
			&amp;quot;count=10\n&amp;quot; ..&lt;br /&gt;
			&amp;quot;mode=ordered\n&amp;quot; ..&lt;br /&gt;
			&amp;quot;ordermethod=lastedit\n&amp;quot; ..&lt;br /&gt;
			&amp;quot;order=ascending&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	return [=[&lt;br /&gt;
{| id=&amp;quot;newest-and-oldest-pages&amp;quot; class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float: right; clear: both; margin: 0 0 .5em 1em;&amp;quot;&lt;br /&gt;
! Recent additions to the category&lt;br /&gt;
|-&lt;br /&gt;
| id=&amp;quot;recent-additions&amp;quot; style=&amp;quot;font-size:0.9em;&amp;quot; | ]=] .. recent .. [=[&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! Oldest pages ordered by last edit&lt;br /&gt;
|-&lt;br /&gt;
| id=&amp;quot;oldest-pages&amp;quot; style=&amp;quot;font-size:0.9em;&amp;quot; | ]=] .. oldest .. [=[&lt;br /&gt;
&lt;br /&gt;
|}]=]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Show navigational &amp;quot;breadcrumbs&amp;quot; at the top of the page.&lt;br /&gt;
function show_breadcrumbs(current)&lt;br /&gt;
	local steps = {}&lt;br /&gt;
	&lt;br /&gt;
	-- Start at the current label and move our way up the &amp;quot;chain&amp;quot; from child to parent, until we can't go further.&lt;br /&gt;
	while current do&lt;br /&gt;
		local category = nil&lt;br /&gt;
		local display_name = nil&lt;br /&gt;
		&lt;br /&gt;
		if type(current) == &amp;quot;string&amp;quot; then&lt;br /&gt;
			category = current&lt;br /&gt;
			display_name = current:gsub(&amp;quot;^Category:&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
		else&lt;br /&gt;
			category = &amp;quot;Category:&amp;quot; .. current:getCategoryName()&lt;br /&gt;
			display_name = current:getBreadcrumbName()&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		display_name = capitalize(display_name)&lt;br /&gt;
		table.insert(steps, 1, &amp;quot;[[:&amp;quot; .. category .. &amp;quot;|&amp;quot; .. display_name .. &amp;quot;]]&amp;quot;)&lt;br /&gt;
		&lt;br /&gt;
		-- Move up the &amp;quot;chain&amp;quot; by one level.&lt;br /&gt;
		if type(current) == &amp;quot;string&amp;quot; then&lt;br /&gt;
			current = nil&lt;br /&gt;
		else&lt;br /&gt;
			current = current:getParents()&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if current then&lt;br /&gt;
			current = current[1].name&lt;br /&gt;
		elseif inFundamental[category] then&lt;br /&gt;
			current = &amp;quot;Category:Fundamental&amp;quot;&lt;br /&gt;
		end	&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	steps = table.concat(steps, &amp;quot; » &amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	return &amp;quot;&amp;lt;small&amp;gt;&amp;quot; .. steps .. &amp;quot;&amp;lt;/small&amp;gt;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Show a short description text for the category.&lt;br /&gt;
function show_description(current)&lt;br /&gt;
	return (current:getDescription() or &amp;quot;&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function show_appendix(current)&lt;br /&gt;
	local appendix&lt;br /&gt;
	&lt;br /&gt;
	if current.getAppendix then&lt;br /&gt;
		appendix = current:getAppendix()&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if appendix then&lt;br /&gt;
		return &amp;quot;For more information, see [[&amp;quot; .. appendix .. &amp;quot;]].&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Show a list of child categories.&lt;br /&gt;
function show_children(current)&lt;br /&gt;
	local children = current:getChildren()&lt;br /&gt;
	&lt;br /&gt;
	if not children then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	table.sort(children, function(first, second) return first.sort &amp;lt; second.sort end)&lt;br /&gt;
	&lt;br /&gt;
	local children_list = {}&lt;br /&gt;
	&lt;br /&gt;
	for _, child in ipairs(children) do&lt;br /&gt;
		local child_basic = child.name:getCategoryName()&lt;br /&gt;
		local child_page = mw.title.new(&amp;quot;Category:&amp;quot; .. child_basic)&lt;br /&gt;
		&lt;br /&gt;
		if child_page.exists then&lt;br /&gt;
			local child_description = child.name:getDescription(&amp;quot;child&amp;quot;)&lt;br /&gt;
			table.insert(children_list, &amp;quot;* [[:Category:&amp;quot; .. child_basic .. &amp;quot;]]: &amp;quot; .. child_description)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return table.concat(children_list, &amp;quot;\n&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Show a table of contents with links to each letter in the language's script.&lt;br /&gt;
function show_TOC(current)&lt;br /&gt;
	local code = current:getInfo().code&lt;br /&gt;
	&lt;br /&gt;
	if code and not require(&amp;quot;Module:languages&amp;quot;).getByCode(code) then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if not code then&lt;br /&gt;
		code = &amp;quot;en&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- If category can be empty, then it only contains subcategories.&lt;br /&gt;
	local hasPages = not current:canBeEmpty()&lt;br /&gt;
	&lt;br /&gt;
	local titleText = mw.title.getCurrentTitle().text&lt;br /&gt;
	&lt;br /&gt;
	local inCategory&lt;br /&gt;
&lt;br /&gt;
	if hasPages then&lt;br /&gt;
		inCategory = mw.site.stats.pagesInCategory(titleText, &amp;quot;pages&amp;quot;)&lt;br /&gt;
	else&lt;br /&gt;
		inCategory = mw.site.stats.pagesInCategory(titleText, &amp;quot;subcats&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- No need for a TOC if all pages or subcategories can fit on one page.&lt;br /&gt;
	if inCategory &amp;gt; 200 then&lt;br /&gt;
		&lt;br /&gt;
		-- This category is very large, see if there is an &amp;quot;extended&amp;quot; version of the TOC.&lt;br /&gt;
		if inCategory &amp;gt; 2500 then&lt;br /&gt;
			local TOC_template_extended = mw.title.new(&amp;quot;Template:&amp;quot; .. code .. &amp;quot;-categoryTOC/full&amp;quot;)&lt;br /&gt;
			&lt;br /&gt;
			if TOC_template_extended.exists then&lt;br /&gt;
				return mw.getCurrentFrame():expandTemplate{title = TOC_template_extended.text, args = {}}&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		local TOC_template = mw.title.new(&amp;quot;Template:&amp;quot; .. code .. &amp;quot;-categoryTOC&amp;quot;)&lt;br /&gt;
		&lt;br /&gt;
		if TOC_template.exists then&lt;br /&gt;
			return mw.getCurrentFrame():expandTemplate{title = TOC_template.text, args = {}}&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return export&lt;/div&gt;</summary>
		<author><name>Adminsuzy</name></author>
		
	</entry>
</feed>