Modul:category tree/topic cat/data

Daripada Wiktionary

Pendokumenan untuk modul ini boleh diciptakan di Modul:category tree/topic cat/data/doc

local labels = {}
local handlers = {}

local top_level_data_module = "Module:category tree/topic cat/data"
local data_module_prefix = top_level_data_module .. "/"

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",
	"Religion",
		"Islam",
	"Sciences",
	"Sex",
	"Social acts",
	"Society",
	"Sports",
	"Technology",
	"Time",
	"Transport",
}
labels["semua topik"] = {
	type = "toplevel",
	description = "Perkataan {{{langname}}} dikategorikan mengikut topik seperti \"Keluarga\" atau \"Kimia\".",
	parents = {{module = "poscatboiler", args = {label = "{{{langcat}}}", raw = true, called_from_inside = true}}},
}

for _, typ in ipairs { "berkenaan", "set", "jenis", "nama", "grouping" } do
	labels["Senarai kategori " .. typ] = {
		type = "toplevel",
		description = "Semua jenis kategori " .. typ .. " kini sudah sedia ada dalam {{{langname}}}.",
		parents = {{name = "Semua topik", sort = " *"}},
	}
end

labels["senarai kategori gabungan"] = {
	type = "toplevel",
	description = "Semua kategori kini sudah sedia ada dalam {{{langname}}} yang dimiliki lebih dari satu jenis.",
	parents = {{name = "semua topik", sort = " *"}},
}

for label, data in pairs(labels) do
	data.module = top_level_data_module
end

-- Import subpages
for _, subpage in ipairs(subpages) do
	local datamodule = data_module_prefix .. 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].module .. "]].")
		end
		data.module = 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}