Jump to content

Module:category tree/poscatboiler/data/lang-specific/rue

From Wiktionary, the free dictionary

This module handles generating the descriptions and categorization for Carpathian Rusyn category pages of the format "Carpathian Rusyn LABEL" where LABEL can be any text. Examples are Category:Bulgarian conjugation 2.1 verbs and Category:Russian velar-stem neuter-form nouns. This module is part of the poscatboiler system, which is a general framework for generating the descriptions and categorization of category pages.

For more information, see Module:category tree/poscatboiler/data/lang-specific/documentation.

NOTE: If you add a new language-specific module, you must add the language code to the list at the top of Module:category tree/poscatboiler/data/lang-specific in order for the module to be recognized.


local labels = {}
local handlers = {}

local rfind = mw.ustring.find
local rmatch = mw.ustring.match

--------------------------------- Adjectives --------------------------------

labels["adjectives by stem type and stress"] = {
	description = "Carpathian Rusyn adjectives categorized by stem type and stress. " ..
		"Unlike for nouns, adjectives are consistently either stem-stressed or ending-stressed.",
	parents = {{name = "adjectives by inflection type", sort = "stem type and stress"}},
}


local adj_stem_expl = {
	["soft-stem"] = "a soft consonant",
	["hard-stem"] = "a hard consonant",
	["possessive"] = "-їв, -ів or -ин",
}

local adj_decl_endings = {
	["hard stem-stressed"] = {"-ый", "-а", "-е", "-ы"},
	["hard ending-stressed"] = {"-ы́й", "-а́", "-е́", "-ы́"},
	["soft"] = {"-їй/ій", "-я", "-є", "-ї"},
	["possessive"] = {"-", "-а", "-е", "-ы"},
}

table.insert(handlers, function(data)
	-- FIXME! Harmonize stem types here with stem types in 'adj_decl_endings' (used
	-- directly in adjectival nouns).
	local function stem_to_ending_type(stem, stress)
		if stem == "hard-stem" and stress == "stem" then
			return "hard stem-stressed"
		elseif stem == "hard-stem" and stress == "ending" then
			return "hard ending-stressed"
		elseif stress == "" then
			if stem == "soft-stem" then
				return "soft"
			elseif stem == "possessive" then
				return "possessive"
			end
		end
		return nil
	end

	local breadcrumb, stem, stress = rmatch(data.label, "^(([^ ]*) ([^ *]*)-stressed) adjectives")
	if not breadcrumb then
		breadcrumb, stem = rmatch(data.label, "^(([^ ]*)) adjectives")
		stress = ""
	end
	if breadcrumb then
		local ending_type = stem_to_ending_type(stem, stress)
		if ending_type and adj_stem_expl[stem] then
			local m, f, n, p = unpack(adj_decl_endings[ending_type])
			local stresstext = stress == "stem" and
				"The adjectives in this category have stress on the stem." or
				stress == "ending" and
				"The adjectives in this category have stress on the endings." or
				"All adjectives of this type have stress on the stem."
			local endingtext = "ending in the nominative in masculine singular " .. m ..
				", feminine singular " .. f .. ", neuter singular " .. p .. " and plural " ..
				p .. "."
			local stemtext = " The stem ends in " .. adj_stem_expl[stem] .. "."
			return {
				description = "Carpathian Rusyn " .. stem .. " adjectives, " .. endingtext .. stemtext .. " " .. stresstext,
				breadcrumb = breadcrumb,
				parents = {"adjectives by stem type and stress"},
			}
		end
	end
end)


return {LABELS = labels, HANDLERS = handlers}