Модул:category tree/poscatboiler/data/lang-specific/afb

Документацију овог модула можете да направите на страници Модул:category tree/poscatboiler/data/lang-specific/afb/док

local labels = {}
local handlers = {}

local m_table = require("Module:table")


-----------------------------------------------------------------------------
--                                                                         --
--                           NOUNS AND ADJECTIVES                          --
--                                                                         --
-----------------------------------------------------------------------------


--------------------------------- Noun labels --------------------------------

labels["nouns by derivation type"] = {
	description = "{{{langname}}} nouns categorized by type of derivation.",
	parents = {{name = "nouns", sort = "derivation type"}},
	breadcrumb = "by derivation type",
}

labels["instance nouns"] = {
	description = "{{{langname}}} [[Appendix:Arabic nominals#Instance nouns|instance nouns]], i.e. nouns having the meaning \"an instance of doing X\" for some verb.",
	parents = {{name = "nouns by derivation type", sort = "instance nouns"}},
	breadcrumb = "instance nouns",
}

labels["nouns of place"] = {
	description = "{{{langname}}} [[Appendix:Arabic nominals#Nouns of place|nouns of place]], i.e. nouns having the approximate meaning \"the place for doing X\" for some verb.",
	parents = {{name = "nouns by derivation type", sort = "nouns of place"}},
	breadcrumb = "nouns of place",
}

labels["occupational nouns"] = {
	description = "{{{langname}}} [[Appendix:Arabic nominals#Occupational nouns|occupational nouns]], i.e. nouns referring to people employed in doing something.",
	parents = {{name = "nouns by derivation type", sort = "occupational nouns"}},
	breadcrumb = "occupational nouns",
}

labels["relative nouns (nisba)"] = {
	description = "{{{langname}}} [[Appendix:Arabic nominals#Relative nouns (nisba)|relative (nisba) nouns]], i.e. abstract nouns formed with the suffix {{m|afb|ـية|tr=-iyya}} and derived from an adjective or other noun (or occasionally other parts of speech).",
	parents = {{name = "nouns by derivation type", sort = "relative nouns (nisba)"}},
	breadcrumb = "relative nouns (nisba)",
}

labels["tool nouns"] = {
	description = "{{{langname}}} [[Appendix:Arabic nominals#Tool nouns|tool nouns]], i.e. nouns having the approximate meaning \"tool for doing X\" for some verb.",
	parents = {{name = "nouns by derivation type", sort = "tool nouns"}},
	breadcrumb = "tool nouns",
}

--------------------------------- Adjective labels --------------------------------

labels["adjectives by derivation type"] = {
	description = "{{{langname}}} adjectives categorized by type of derivation.",
	parents = {{name = "adjectives", sort = "derivation type"}},
	breadcrumb = "by derivation type",
}

labels["color/defect adjectives"] = {
	description = "{{{langname}}} [[Appendix:Arabic nominals#Color or defect adjectives|color/defect adjectives]], i.e. adjectives generally referring to colors and physical defects.",
	parents = {{name = "adjectives", sort = "color/defect"}},
	breadcrumb = "color/defect",
}

labels["relative adjectives (nisba)"] = {
	description = "{{{langname}}} [[Appendix:Arabic nominals#Relative adjectives (nisba)|relative (nisba) adjectives]], i.e. adjectives formed with the suffix {{m|afb|ـي|tr=-i}} and meaning \"related to X\" for some noun (or occasionally other parts of speech).",
	parents = {{name = "adjectives", sort = "relative (nisba)"}},
	breadcrumb = "relative (nisba)",
}


-----------------------------------------------------------------------------
--                                                                         --
--                                   VERBS                                 --
--                                                                         --
-----------------------------------------------------------------------------


--------------------------------- Verb labels --------------------------------

labels["verbs with quadriliteral roots"] = {
	description = "{{{langname}}} verbs built on roots consisting of four radicals (instead of the more common triliteral roots), categorized by form.",
	parents = {{name = "verbs by inflection type", sort = "quadriliteral roots"}},
	breadcrumb = "with quadriliteral roots",
}

--------------------------------- Verb handlers --------------------------------

local trilit_form_to_number = {
	["I"] = 1,
	["II"] = 2,
	["III"] = 3,
	["IV"] = 4,
	["V"] = 5,
	["VI"] = 6,
	["VII"] = 7,
	["VIII"] = 8,
	["IX"] = 9,
	["X"] = 10,
	["XI"] = 11,
}

local quadlit_form_to_number = {
	["Iq"] = 1,
}

local function form_to_sort_key(form, with_space)
	if trilit_form_to_number[form] then
		if with_space then
			return (" %02d"):format(trilit_form_to_number[form])
		else
			return "" .. trilit_form_to_number[form]
		end
	elseif quadlit_form_to_number[form] then
		if with_space then
			return (" %02dq"):format(quadlit_form_to_number[form])
		else
			return "" .. quadlit_form_to_number[form]
		end
	else
		return nil
	end
end

local function form_link(form)
	return "[[Appendix:Arabic verbs#Form " .. form .. "|form-" .. form .. "]]"
end

-- Handler for e.g. [[:Category:Arabic form-VIII verbs]].
table.insert(handlers, function(data)
	local form = data.label:match("^form%-([IVX]+q?) verbs$")
	if not form then
		return nil
	end
	local form_sort_key = form_to_sort_key(form, "with space")
	if not form_sort_key then
		return nil
	end
	local parents = {
		{name = "verbs by inflection type", sort = form_sort_key},
	}
	if form:find("q$") then
		table.insert(parents, {name = "verbs with quadriliteral roots", sort = form_sort_key})
	end
	return {
		description = "{{{langname}}} " .. form_link(form) .. " verbs.",
		parents = parents,
		breadcrumb = "form " .. form,
	}
end)

return {LABELS = labels, HANDLERS = handlers}