Module:category tree/topic cat/data

Dokumentasie vir hierdie module kan geskep word by: Module:category tree/topic cat/data/doc

local labels = {}
local handlers = {}

local subpages = {
	"Body",
	"Buildings and structures",
	"Communication",
	"Culture",
	"Earth",
	"Food and drink",
	"History",
	"Human",
	"Lifeforms",
		"Animals",
		"Plants",
	"Mathematics",
	"Miscellaneous",
	"Names",
	"Nature",
	"Numbers",
	"People",
	"Philosophy",
	"Places",
	"Sciences",
	"Sex",
	"Social acts",
	"Society",
	"Sports",
	"Technology",
	"Time",
	"Transport",
}

labels["all topics"] = {
	description = "{{{langname}}} terms organized by topic, such as \"Family\" or \"Chemistry\".",
	parents = {{template = "langcatboiler"}},
}

labels["list of topics"] = {
	description = "All topics currently available in {{{langname}}}.",
	parents = {{name = "all topics", sort = " *"}},
}

labels["all sets"] = {
	description = "{{{langname}}} terms that belong to a particular set of things, such as \"Planets\" or \"Canids\".",
	parents = {{template = "langcatboiler"}},
}

labels["list of sets"] = {
	description = "All sets currently available in {{{langname}}}.",
	parents = {{name = "all sets", sort = " *"}},
}

for label, data in pairs(labels) do
	data.edit = "Module:category tree/topic cat/data"
end

-- Import subpages
for _, subpage in ipairs(subpages) do
	local datamodule = "Module:category tree/topic cat/data/" .. subpage
	local retval = require(datamodule)
	if not retval["LABELS"] then
		retval = {LABELS = retval}
	end
	for label, data in pairs(retval["LABELS"]) do
		if labels[label] and not retval["IGNOREDUP"] then
			error("Label " .. label .. " defined in both [["
				.. datamodule .. "]] and [[" .. labels[label].edit .. "]].")
		end
		data.edit = datamodule
		labels[label] = data
	end
	if retval["HANDLERS"] then
		for _, handler in ipairs(retval["HANDLERS"]) do
			table.insert(handlers, { module = datamodule, handler = handler })
		end
	end
end

return {LABELS = labels, HANDLERS = handlers}