Module:collapsible category tree

Hello, you have come here looking for the meaning of the word Module:collapsible category tree. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:collapsible category tree, but we will also tell you about its etymology, its characteristics and you will know how to say Module:collapsible category tree in singular and plural. Everything you need to know about the word Module:collapsible category tree you have here. The definition of the word Module:collapsible category tree will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:collapsible category tree, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

Creates a category tree with list-switcher-style collapsibility à la {{col}}.

{{#invoke:collapsible category tree|make_wt|category=English terms suffixed with -ism}}

The main users of this module are {{prefixsee}}, {{suffixsee}} and other {{*see}} templates based on Module:affix/templates.


local export = {}

local m_utilities = require("Module:utilities")

function export.make(args)
	local lang = args.lang
	local sc = args.sc
	
	-- Add a span which records information to be used by the catfix gadget.
	local catfix_info = lang and m_utilities.catfix(lang, sc) or ""
	
	-- Only provide collapsibility if 5 or more elements
	local pages_in_cat = mw.site.stats.pagesInCategory(args.category, "pages")
	local collapsible = pages_in_cat >= 5
	
	-- CategoryTree only shows the first 200 categories. How many pages are left over?
	local pages_left_over = ((pages_in_cat <= 200) and 0 or (pages_in_cat - 200))
	
	local output = mw.getCurrentFrame():callParserFunction{
		name = "#categorytree",
		args = {
			args.category,
			type = "pages",
			depth = 1,
			class = "\"columns-bg term-list" .. (sc and " " .. sc:getCode() or "") .. "\"",
			style = "counter-reset: pagesleftover " .. pages_left_over,
			namespaces = "-" .. (mw.title.getCurrentTitle().nsText == "Reconstruction" and " Reconstruction" or ""),
			 = pages_in_cat,
			 = pages_left_over,
		}
	}
	
	if collapsible then
		output = mw.html.create("div")
			:addClass("list-switcher-wrapper")
			:node(
				mw.html.create("div")
					:addClass("list-switcher list-switcher-category-tree")
					:wikitext(output)
			)
	else
		output = mw.html.create("div")
			:addClass("list-switcher-category-tree")
			:wikitext(output)
	end
	
	-- Maintenance categories
	local categories = ""
	if pages_in_cat == 0 and not mw.title.new(args.category, 'Category').exists then
		categories = categories ..
			require("Module:utilities").format_categories('Entries with collapsible category trees for nonexistent categories')
	end

	return require("Module:TemplateStyles")("Module:collapsible category tree/style.css") ..
		catfix_info .. tostring(output) .. categories
end

-- for direct invocation from a wikitext ("wt") template
function export.make_wt(frame)
	return export.make(frame.args)
end

return export