Module:category tree/poscatboiler/data/modules

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This data submodule defines part of Wiktionary's category structure.

For an introduction to the poscatboiler system and a description of how to add or modify categories, see Module:category tree/poscatboiler/data/documentation.


local labels = {}
local raw_categories = {}
local raw_handlers = {}



-----------------------------------------------------------------------------
--                                                                         --
--                                  LABELS                                 --
--                                                                         --
-----------------------------------------------------------------------------


labels["modules"] = {
	description = "{{{langname}}} [[Wiktionary:Modules|modules]], which contain Lua code to create and manage entries.",
	umbrella = {
		parents = {{name = "Modules", sort = " "}},
		breadcrumb = "by language",
	},
	parents = {{name = "{{{langcat}}}", raw = true}},
}

labels["data modules"] = {
	description = "{{{langname}}} [[Wiktionary:Modules|modules]] containing data used by other modules.",
	umbrella = {
		parents = {{name = "Data modules", sort = " "}},
		breadcrumb = "by language",
	},
	breadcrumb = "data",
	parents = {"modules"},
}

labels["dialect synonyms data modules"] = {
	description = "{{{langname}}} [[Wiktionary:Modules|modules]] containing data used by {{tl|dialect synonyms}}.",
	umbrella = {
		parents = {{name = "Dialect synonyms data modules", sort = " "}},
		breadcrumb = "by language",
	},
	breadcrumb = "dialect synonyms",
	parents = {"data modules"},
}

labels["inflection modules"] = {
	description = "{{{langname}}} [[inflection]] [[Wiktionary:Modules|modules]], which contain Lua code for generating conjugation and declension tables.",
	umbrella = {
		parents = {{name = "Inflection modules", sort = " "}},
		breadcrumb = "by language",
	},
	breadcrumb = "inflection",
	parents = {"modules"},
}

labels["testcase modules"] = {
	description = "{{{langname}}} [[testcase]] [[Wiktionary:Modules|modules]], which contain Lua code for testing other modules.",
	umbrella = {
		parents = {{name = "Testcase modules", sort = " "}},
		breadcrumb = "by language",
	},
	breadcrumb = "testcase",
	parents = {"modules"},
}



-----------------------------------------------------------------------------
--                                                                         --
--                              RAW CATEGORIES                             --
--                                                                         --
-----------------------------------------------------------------------------

--[=[
Correctly defining a new module type here:
1. The breadcrumb generally does not need to be given because there is code at the bottom of this file
   to generate the breadcrumb in a smart fashion by chopping off a suffix derived from the parent or any of
   its ancestors.
2. Module types can be nested under other module types, but also list them directly under 'Modules' as a
   secondary parent. (This violates a principle of non-duplication of categories but makes it much easier to
   locate a given module type.)
]=]

raw_categories["Modules"] = {
	description = "This is a general holder category for modules.",
	additional = "For more information on what modules are and how they work, see [[Wiktionary:Scribunto]]. For a complete list of all modules, see [[Special:PrefixIndex/Module:|here]].",
	parents = {"Category:Wiktionary"},
}

raw_categories["Uncategorized modules"] = {
	description = "Uncategorized modules.",
	additional = "Modules are placed here by [[Module:documentation]] under certain circumstances. See the documentation of that module for more info.",
	parents = { {name = "Modules", sort = " "} },
}

raw_categories["Appendix modules"] = {
	preceding = "{{also|:Category:Appendix templates}}",
	description = "Modules with functions that generate content for or extract information from pages in the Appendix namespace.",
	parents = { "Modules" },
}

raw_categories["Bot support modules"] = {
	description = "Modules for supporting individual bot accounts.",
	parents = { "Modules" },
}

raw_categories["Category modules"] = {
	preceding = "{{also|:Category:Categorization templates|:Category:Category templates}}",
	description = "Modules for adding categories to pages or generating the description and subcategories of category pages.",
	parents = { "Modules" },
}

raw_categories["Character info modules"] = {
	preceding = "{{also|:Category:Character info templates}}",
	description = "Modules containing information on individual characters, or containing functions generating such information.",
	parents = { "Modules" },
}

raw_categories["Character insertion modules"] = {
	preceding = "{{also|:Category:Character insertion templates}}",
	description = "Modules that implement templates that provide easier ways to type characters that are not found in most keyboard layouts.",
	parents = { "Page generation modules", "Modules" },
}

raw_categories["Collections modules"] = {
	description = "Modules containing functions used to implement collections (arrays, maps, etc.).",
	parents = { "Utility modules", "Modules" },
}

raw_categories["Data modules"] = {
	description = "Modules that do not contain functions, but only export a table of data that is used by other modules.",
	additional = "Modules that are in this category should be imported using <code>mw.loadData</code> rather than <code>require</code>.",
	parents = { "Modules" },
}

raw_categories["Character insertion data modules"] = {
	preceding = "{{also|:Category:Character insertion templates}}",
	description = "Modules containing data for use by {{temp|chars}}.",
	parents = { "Data modules", "Character insertion modules" },
}

raw_categories["Dialect synonyms data modules"] = {
	preceding = "{{also|:Category:Character insertion templates}}",
	description = "Modules containing data for use by {{tl|dialect synonyms}}.",
	parents = { "Data modules" },
}

raw_categories["Date modules"] = {
	description = "Modules that implement functionality to convert or otherwise manipulate dates in various calendar systems.",
	parents = { "Utility modules", "Modules" },
}

raw_categories["Debugging modules"] = {
	description = "Modules used for debugging.",
	additional = "Some should only be used in sandbox modules or when using the " ..
	"[[mw:Extension:TemplateSandbox|{{MediaWiki:Templatesandbox-editform-legend}}]] button in the edit page of modules and templates.",
	parents = { "Modules" },
}

raw_categories["Definition modules"] = {
	preceding = "{{also|:Category:Definition templates}}",
	description = "Modules that implement templates used in [[Wiktionary:Glossary#definition line|definition lines]] of entries.",
	parents = { "Page generation modules", "Modules" },
}

raw_categories["Deprecated modules"] = {
	description = "Modules that should not be used, as their functions are performed by newer modules.",
	parents = { "Modules", "Category:Wiktionary maintenance" },
}

raw_categories["Discussion modules"] = {
	preceding = "{{also|:Category:Discussion templates}}",
	description = "Modules concerning discussion pages.",
	parents = { "Modules" },
}

raw_categories["Display text-generating modules"] = {
	description = "Modules that are used to generate display text.",
	additional = "Display text determines what is shown to the reader. In some languages it must be normalized, " ..
	"due to common errors caused by confusable characters, or so as to ensure a consistent display format.",
	parents = { "Modules" },
}

raw_categories["Documentation modules"] = {
	preceding = "{{also|:Category:Documentation templates}}",
	description = "Modules for generating documentation pages.",
	parents = { "Modules" },
}

raw_categories["Encoding modules"] = {
	description = "Modules for converting between different textual encodings.",
	parents = { "Utility modules", "Modules" },
}

raw_categories["Entry-generating modules"] = {
	preceding = "{{also|:Category:Entry templates}}",
	description = "Modules with functions that are used to generate new entries.",
	parents = { "Modules" },
}

raw_categories["Entry name-generating modules"] = {
	description = "Modules that generate entry names, which typically have certain diacritics stripped compared with the form in links and headwords.",
	parents = { "Modules" },
}

raw_categories["External link modules"] = {
	preceding = "{{also|:Category:External link templates}}",
	description = "Modules that are used in [[:Category:External link templates|external link templates]], i.e. which link to websites outside of the MediaWiki Foundation purview.",
	parents = { "Page generation modules", "Modules" },
}

raw_categories["Etymology modules"] = {
	preceding = "{{also|:Category:Etymology templates}}",
	description = "Modules that implement templates that define the etymology of entries.",
	parents = { "Page generation modules", "Modules" },
}

raw_categories["Form-of modules"] = {
	preceding = "{{also|:Category:Form-of templates}}",
	description = "Modules that generate the definition line of non-lemma forms, e.g. verb forms and noun forms.",
	parents = { "Definition modules", "Page generation modules", "Modules" },
}

raw_categories["Headword-line modules"] = {
	preceding = "{{also|:Category:Headword-line templates}}",
	description = "Modules that support [[:Category:Headword-line templates by language|headword-line templates]] for a specific language.",
	additional = "See also [[:Category:Headword-line templates]].",
	parents = { "Page generation modules", "Modules" },
}

raw_categories["Inflection modules"] = {
	description = "Modules used to support [[:Category:Inflection-table templates by language|inflection templates]] for a specific language.",
	parents = { "Page generation modules", "Modules" },
}

raw_categories["Internal link modules"] = {
	preceding = "{{also|:Category:Internal link templates}}",
	description = "Modules that are used in [[:Category:Internal link templates|internal link templates]], i.e. which link between Wiktionary entries.",
	parents = { "Page generation modules", "Modules" },
}

raw_categories["Interwiki modules"] = {
	preceding = "{{also|:Category:Interwiki templates}}",
	description = "Modules that are used in [[:Category:Interwiki templates|interwiki templates]], i.e. which link to other MediaWiki projects.",
	parents = { "Page generation modules", "Modules" },
}

raw_categories["JSON-generating modules"] = {
	description = "Modules with functions that generate data in JSON format.",
	parents = { "Modules" },
}

raw_categories["Language and script modules"] = {
	description = "Modules that process language and script codes and return data on them.",
	parents = { "Modules" },
}

raw_categories["List modules"] = {
	preceding = "{{also|:Category:List templates}}",
	description = "Modules that generate lists, tables or tree diagrams of entries or other structured data.",
	parents = { "Page generation modules", "Modules" },
}

raw_categories["Maintenance modules"] = {
	preceding = "{{also|:Category:Maintenance templates}}",
	description = "Modules that implement templates used for maintaining entries.",
	additional = "Examples are cleanup templates (e.g. {{tl|attention}}), deletion templates (e.g. {{tl|rfd}}) and " ..
	"verification templates (e.g. {{tl|rfv}}).",
	parents = { "Modules" },
}

raw_categories["Number modules"] = {
	preceding = "{{also|:Category:Number templates}}",
	description = "Modules that handle conversion and/or formatting of numbers and numerals in various representations.",
	parents = { "Utility modules", "Modules" },
}

raw_categories["Page generation modules"] = {
	description = "Modules that generate parts of a mainspace page (e.g. headword line, definition, inflection, links, etc.).",
	parents = { "Modules" },
}

raw_categories["Parameter parsing modules"] = {
	description = "Modules containing functions used to parse template parameters.",
	parents = { "Utility modules", "Modules" },
}

raw_categories["Pronunciation modules"] = {
	preceding = "{{also|:Category:Pronunciation templates}}",
	description = "Modules that implement templates used to create the language-specific pronunciation of entries.",
	parents = { "Page generation modules", "Modules" },
}

raw_categories["Pronunciation testcase modules"] = {
	description = "Modules used to test other pronunciation modules.",
	parents = { "Testcase modules", {name = "Pronunciation modules", sort = "Testcase"} },
}

raw_categories["Quotation and usage example modules"] = {
	description = "Modules that implement templates used to format quotations and usage examples.",
	parents = { "Definition modules", "Page generation modules", "Modules" },
}

raw_categories["Reference modules"] = {
	preceding = "{{also|:Category:Reference templates}}",
	description = "Modules that are used for [[:Category:Reference templates|reference templates]].",
	parents = { "Page generation modules", "Modules" },
}

raw_categories["Sandbox modules"] = {
	description = "Test versions of modules intended for production use.",
	parents = { "Modules" },
}

raw_categories["Semantic relation modules"] = {
	preceding = "{{also|:Category:Semantic relation templates}}",
	description = "Modules that implement templates used to indicate other terms semantically related to a " ..
	"particular sense, e.g. [[synonym]]s or [[antonym]]s.",
	parents = { "Page generation modules", "Modules" },
}

raw_categories["Sortkey-generating modules"] = {
	description = "Modules that generate sortkeys, which determine the order of entry names in categories.",
	parents = { "Modules" },
}

raw_categories["String modules"] = {
	description = "Modules containing functions used to manipulate strings.",
	parents = { "Utility modules", "Modules" },
}

raw_categories["Swadesh modules"] = {
	description = "Modules containing [[Swadesh list]]s.",
	parents = { "Modules" },
}

raw_categories["Template interface modules"] = {
	description = "Modules whose purpose is to provide an interface between templates and the functions of a module.",
	additional = "They are usually named <code>.../templates</code>, and the functions present within them usually all " ..
	"have only a \"frame\" parameter.",
	parents = { "Modules" },
}

raw_categories["Testcase modules"] = {
	description = "Modules used to test other modules.",
	parents = { "Modules" },
}

raw_categories["Failing testcase modules"] = {
	description = "Modules which contain failures in their unit tests.",
	additional = "This category is added automatically by [[Module:UnitTests]] when a test case fails.",
	parents = { "Testcase modules" },
}

raw_categories["Tracking modules"] = {
	description = "Modules that add tracking templates.",
	parents = { "Debugging modules", "Modules" },
}

raw_categories["Transliteration modules"] = {
	description = "Modules that automatically convert text in one script to another.",
	additional = "Most of them convert non-Latin scripts to Latin (romanisation/romanization), and are used by " ..
	"templates or modules to generate transliteration of text that is tagged with a particular language. Each " ..
	"language's transliteration module is specified in its data table (for which, see the category {{catlink|Language data modules}}).",
	parents = { "Modules" },
}

raw_categories["Transliteration testcase modules"] = {
	description = "Modules used to test other transliteration modules.",
	parents = { "Testcase modules", {name = "Transliteration modules", sort = "Testcase"} },
}

raw_categories["Unused modules"] = {
	description = "Unused modules.",
	parents = { "Modules" },
}

raw_categories["User sandbox modules"] = {
	description = "Modules that are for personal use and testing by individual editors.",
	additional = "These should all begin with <code>User:</code> followed by the user's name. If several " ..
	"sandbox modules are needed by a single user, subpages can be created. These modules should not be used in real " ..
	"Wiktionary content pages, as all content on those pages should be editable by anyone and, if necessary, edit protected.",
	parents = { "Sandbox modules", "Modules" },
}

raw_categories["Utility modules"] = {
	description = "Modules that serve some sort of utility purpose in various entries.",
	additional = "Avoid categorizing directly into this category, but use one of the more specific (and semantically " ..
	"well-defined) module categories. Note also that modules used by multiple languages should go directly in this " ..
	"category if necessary, while modules only used by one language should be in [[:Category:Language-specific utility modules]].",
	parents = { "Modules" },
}

raw_categories["Language-specific utility modules"] = {
	description = "Modules that deal with several utilities needed by a certain language.",
	additional = "Usually their names end with {{cd|-utilities}} or {{cd|-common}} (preceded by the language code), " ..
	"although more specific utility modules that one language uses may reside here as well. If a utility is used by " ..
	"many languages, it should be in [[:Category:Utility modules]].",
	parents = {{name = "Utility modules", sort = " "}},
}

raw_categories["Vote modules"] = {
	description = "Modules used to manage Wiktionary votes.",
	parents = { "Modules" },
}

raw_categories["Wikitext parsing modules"] = {
	description = "Modules that contain functions that grab the wikitext of a page and get information from it by " ..
	"performing string operations on it.",
	parents = { "Modules" },
}

-- Don't modify `raw_categories` while processing it, or items may be skipped.
local new_cats = {}
for raw_cat, obj in pairs(raw_categories) do
	local by_script = raw_cat .. " by script"
	if raw_cat ~= "Modules" and raw_cat ~= "Data modules" and not raw_categories[by_script] then
		new_cats[by_script] = {
			description = raw_cat .. ", categorized by the script they operate on or with.",
			additional = raw_cat .. " are " .. mw.getContentLanguage():lcfirst(obj.description),
			breadcrumb = "by script",
			parents = {{name = raw_cat, sort = " "}},
		}
	end
end
for new_cat, obj in pairs(new_cats) do
	raw_categories[new_cat] = obj
end


-----------------------------------------------------------------------------
--                                                                         --
--                                RAW HANDLERS                             --
--                                                                         --
-----------------------------------------------------------------------------


for _, mod_type in ipairs { "Entry name-generating", "Sortkey-generating", "Transliteration" } do
	table.insert(raw_handlers, function(data)
		local count, languages = data.category:match(("^%s modules used by ([0-9]+) (languages?)$"):format(
			-- need to escape the hyphen in 'Entry name-generating' and 'Sortkey-generating'
			require("Module:string utilities").pattern_escape(mod_type)))
		if count then
			return {
				description = data.category .. ".",
				breadcrumb = "used by " .. count .. " " .. languages,
				parents = {
					{ name = mod_type .. " modules", sort = count },
				},
			}
		end
	end)
end


-- Add breadcrumb by chopping off the parent (or the parent's parent, etc.) from the end of the label, if possible.
for key, data in pairs(raw_categories) do
	if not data.breadcrumb then
		local parent = data.parents[1]
		while true do
			if type(parent) == "string" then
				local parent_re = " " .. require("Module:string utilities").pattern_escape(mw.getContentLanguage():lcfirst(parent)) .. "$"
				if key:find(parent_re) then
					data.breadcrumb = key:gsub(parent_re, "")
					break
				end
				if raw_categories[parent] then
					parent = raw_categories[parent].parents[1]
				else
					break
				end
			else
				break
			end
		end
	end
end


return {LABELS = labels, RAW_CATEGORIES = raw_categories, RAW_HANDLERS = raw_handlers}