模組:Category tree/poscatboiler/data/lang-specific/el


This module handles generating the descriptions and categorization for 希臘語 category pages of the format "希臘語 LABEL" where LABEL can be any text. Examples are Category:Bulgarian conjugation 2.1 verbs and Category:Russian velar-stem neuter-form nouns. 該模块是 poscatboiler 系統的一部分,該系統是用於生成分類頁面的描述和分類的通用框架。

有關更多資訊,請參閱Module:category tree/poscatboiler/data/lang-specific/doc

注意:如果您新增了特定語言的模块,請將語言代碼新增至 Module:category tree/poscatboiler/data/lang-specific 頂部的清單中,使程式碼能識別該模块。


local labels = {}

local lang = require("Module:languages").getByCode("el")

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

-- version of rsubn() that discards all but the first return value
local function rsub(term, foo, bar)
	local retval = rsubn(term, foo, bar)
	return retval
end


--------------------------------- Verbs --------------------------------

labels["依屈折分類的第一類變位動詞"] = {
	description = "依屈折分類的第一類變位動詞。參見[[Appendix:希臘語動詞#第一類變位|Appendix:現代希臘語動詞]]。",
	breadcrumb = "第一類變位",
	parents = {"依屈折分類的動詞"},
}

labels["第一類變位組"] = { -- this is[[:Category:Greek 第一類變位組]]
	description = "希臘語第一類變位動詞組,依其'''[[詞幹]]的特徵詞尾'''按字母序列出。",
	additional = "參見[[Appendix:希臘語動詞|Appendix:現代希臘語動詞]]中的[[Appendix:希臘語動詞#元音結尾詞幹|元音結尾]]、[[Appendix:希臘語動詞#輔音結尾詞幹|輔音結尾]]詞幹。",
	breadcrumb = "變位組",
	parents = {"依屈折分類的第一類變位動詞"}, -- [[:Category:Greek 1st conjugation verbs by inflection type]]
}


labels["元音詞幹動詞"] = {
	description = "希臘語第一類變位組中詞幹以元音結尾的動詞。參見[[Appendix:希臘語動詞#元音結尾詞幹|Appendix:現代希臘語動詞]]。",
	breadcrumb = "元音詞幹",
	parents = {"第一類變位組"},
}

local cons_stems = {
	{"v(1)", "v<sup>1</sup>", "v1"},
	{"v(2)", "v<sup>2</sup>", "v2"},
	{"γ", "γ", "g"},
	{"δ", "δ", "d"},
	{"z", "z", "z"},
	{"k", "k", "k"},
	{"l", "l", "l"},
	{"n", "n", "n"},
	{"pt", "pt", "pt"},
	{"p", "p", "p"},
	{"r", "r", "r"},
	{"s", "s", "s"},
	{"ft", "ft", "ft"},
	{"f", "f", "f"},
}

for _, cons_stem_data in ipairs(cons_stems) do
	local cat_marker, display_form, appendix_anchor = unpack(cons_stem_data)
	labels["帶-" .. cat_marker .. "-的輔音詞幹動詞"] = {
		description = "希臘語第一類變位組中詞幹以-" .. display_form .. "結尾的動詞。參見[[Appendix:希臘語動詞#" .. appendix_anchor .. "|Appendix:現代希臘語動詞]]。",
		breadcrumb = {name = display_form .. "-詞幹", nocap = true},
		parents = {"第一類變位組"},
	}
end

--------------------------------- Verb group data --------------------------------

groups = {}
like_verbs = {}

--[=[

The format of a group category [[:Category:Greek verb conjugation group 'GROUP']] is as follows:

groups[GROUP] = {CONJ, SORT_KEY, PARENT_CATEGORY, DESCRIPTION}

where
-- CONJ is the conjugation class (1st, 2nd);
-- SORT_KEY is the sort key used in the conjugation-group parent category
   (e.g. [[:Category:Greek 1st-conjugation groups]]);
-- PARENT_CATEGORY is the parent category used in the breadcrumbs at the top (minus the
   word "Greek " at the beginning);
-- DESCRIPTION is the description text. COMPULSORY

In the description text, you can use templates, and you can also use the following:

-- "like<<VERB>>" expands to "[[:Category:Greek verbs conjugating like 'LINK'|'''like''']] <<VERB>>",
   where LINK is the same as VERB minus any boldface in it, and <<VERB>> is expanded as below;
-- <<VERB>> expands to "[[LINK#Greek|VERB]]", where LINK is the same as VERB minus any
   boldface in it;
-- "like(VERB)" expands to "[[:Category:Greek verbs conjugating like 'LINK'|'''like''']]"",
   where LINK is the same as VERB minus any boldface in it.


The format of a "like-verb" category [[:Category:Greek verbs conjugating like 'VERB']] is as follows:

like_verbs[VERB] = {CONJ, GROUP (or consonant category), BREADCRUMB_TEXT, DESCRIPTION} -- sort needed here, manual

where
-- CONJ is the conjugation class (1st, 2nd);
-- GROUP is the conjugation group (e.g. "κλείω", "κόβω");
	-- or, links directly to cat-marker e.g. Category:Greek consonant-stem verbs in -X-
-- BREADCRUMB_TEXT is text that will appear in the breadcrumb at the top (e.g. the text
   "僅主動語態動詞" in the like-verb "ισχύω" will produce the breadcrumb text
   "active only verbs, like ισχύω", while the value 'nil' (without quotes around it)
   in the like-verb "ισχύω" will result in just the breadcrumb text "ισχύω);
   -- nil,  = erases the comma
-- DESCRIPTION is not compulsory.

With like-verbs, you can leave out the BREADCRUMB_TEXT and/or DESCRIPTION. but an automatic text will be added.
]=]

-- 1st vowels [[:Category:Greek verb conjugation group 'κλείω']]  -- [[:Category:Greek verbs conjugating like 'αποκλείω']]
groups["κλείω"] = {"第一類", "元音", "元音詞幹動詞", "" }
like_verbs["αποκλείω"] = {"第一類", "κλείω", nil, "" } -- breadcrumv adds an unwanted comma


groups["λύω"] = {"第一類", "元音", "元音詞幹動詞", "" }
like_verbs["διαλύω"] = {"第一類", "λύω", "", ""}
like_verbs["ισχύω"] = {"第一類", "λύω", "僅主動語態動詞", "" }
like_verbs["καταδύομαι"] = {"第一類", "λύω", "僅被動語態動詞",	"" }
like_verbs["φύομαι"] = {"第一類", "λύω", "僅被動語態動詞非完整體", "" }

groups["πνέω"] = {"第一類", "元音", "元音詞幹動詞", ""}
like_verbs["εμπνέω"] = {"第一類", "πνέω", nil, ""}
like_verbs["επιπλέω"] = {"第一類", "πνέω", "僅主動語態動詞", ""}

-- CONSONANT STEM ENDINGS as in international phonetic alphabet

-- v(1) with beta Category:Greek consonant-stem verbs in -v(1)-
groups["κόβω"] = {"第一類", "βω", "帶-v(1)-的輔音詞幹動詞", "" }
like_verbs["κόβω"] = {"第一類", "κόβω", nil, ""}

groups["σκάβω"] = {"第一類", "βω", "帶-v(1)-的輔音詞幹動詞", ""}
like_verbs["σκάβω"] = {"第一類", "σκάβω", nil, ""}

groups["τρίβω"] = {"第一類", "βω", "帶-v(1)-的輔音詞幹動詞", "" }

-- v(2) with upsilon Category:Greek 帶-v(2)-的輔音詞幹動詞
groups["-εύω combinations"] = {"第一類", "βω2", "帶-v(2)-的輔音詞幹動詞",	""}
like_verbs["γοητεύω"] = {"第一類", "-εύω combinations", "verbs"}

groups["δημοσιεύω"] = {"第一類", "βω2", "帶-v(2)-的輔音詞幹動詞",	""}
like_verbs["αγορεύω"] = {"第一類", "δημοσιεύω", "僅主動語態動詞"}
like_verbs["δημοσιεύω"] = {"第一類", "δημοσιεύω", nil,	""}
like_verbs["ερωτεύομαι"] = {"第一類", "δημοσιεύω", "僅被動語態動詞"}

groups["μαζεύω"] = {"第一類", "βω2", "帶-v(2)-的輔音詞幹動詞",	"" }
like_verbs["μαζεύω"] = {"第一類", "μαζεύω"}
like_verbs["ονειρεύομαι"] = {"第一類", "μαζεύω", "僅被動語態動詞"}
like_verbs["ταξιδεύω"] = {"第一類", "μαζεύω", "僅主動語態動詞"}

-- γ greek Category:Greek consonant-stem verbs in -γ-
groups["τυλίγω"] = {"第一類", "γω", "帶-γ-的輔音詞幹動詞",	"" }
like_verbs["λήγω"] = {"第一類", "τυλίγω", "僅主動形式"}
like_verbs["τυλίγω"] = {"第一類", "τυλίγω", "主動和被動形式"}
groups["εκλέγω"] = {"第一類", "γω", "帶-γ-的輔音詞幹動詞",	"" } -- + Category:Greek irregular verbs
like_verbs["εκλέγω"] = {"第一類", "εκλέγω", "主動和被動形式"}

-- δ greek Category:Greek consonant-stem verbs in -δ-
groups["διαψεύδω"] = {"第一類", "δω", "帶-δ-的輔音詞幹動詞",	"" }

-- z for greek zeta Category:Greek 帶-z-的輔音詞幹動詞
groups["-άζω, -ίζω"] = {"第一類", "ζω", "帶-z-的輔音詞幹動詞",	"" }
like_verbs["αξίζω"] = {"第一類", "-άζω, -ίζω", nil, "" }
like_verbs["εργάζομαι"] = {"第一類", "-άζω, -ίζω", "僅被動語態動詞,不含被動完成分詞", "" }
like_verbs["καθίζω"] = {"第一類", "-άζω, -ίζω", "僅用於主動形式", "" }
like_verbs["κατεργάζομαι"] = {"第一類", "-άζω, -ίζω", "僅用於被動形式,加上被動完成分詞",	"" }
like_verbs["ορίζω"] = {"第一類", "-άζω, -ίζω", nil, "" }

groups["αγγίζω"] = {"第一類", "ζω", "帶-z-的輔音詞幹動詞",	"" }
like_verbs["αγγίζω"] = {"第一類", "αγγίζω"}
like_verbs["γκαρίζω"] = {"第一類", "αγγίζω", "僅主動語態動詞"}

groups["αλλάζω"] = {"第一類", "ζω", "帶-z-的輔音詞幹動詞",	"" }
like_verbs["παίζω"] = {"第一類", "αλλάζω"}
like_verbs["τρομάζω"] = {"第一類", "αλλάζω", "僅主動語態動詞"}

groups["πρήζω"] = {"第一類", "ζω", "帶-z-的輔音詞幹動詞", "" }

-- Category:Greek consonant-stem verbs in -k-
groups["περιπλέκω"] = {"第一類", "κω", "帶-k-的輔音詞幹動詞", "" }

groups["πλέκω"] = {"第一類", "κω", "帶-k-的輔音詞幹動詞", ""}
like_verbs["πλέκω"] = {"第一類", "πλέκω"}

groups["-σκω"] = {"第一類", "κω2", "帶-k-的輔音詞幹動詞", "" }

-- Category:Greek consonant-stem verbs in -l-
groups["αγγέλλω"] = {"第一類", "λω", "帶-l-的輔音詞幹動詞", "" }
like_verbs["αναγγέλλω"] = {"第一類", "αγγέλλω", "主動和被動形式"}

-- Category:Greek consonant-stem verbs in -n-
-- groups["-νω"] = {"第一類", "νω", "帶-n-的輔音詞幹動詞", "" } -- this is identical to [[:Category:Greek consonant-stem verbs in -n-]]
-- directly to  "帶-n-的輔音詞幹動詞"   TEST [[:Category:Greek verbs conjugating like 'λύνω']]
-- sort parameter is needed for all like_verbs. manual (could be auto if there were tables of converting characters)
like_verbs["αφοσιώνομαι"] = {"第一類", "-", "僅用於被動形式"}
like_verbs["δηλώνω"] = {"第一類", "-"}
like_verbs["θυμώνω"] = {"第一類", "-", "僅用於主動形式"}
like_verbs["λύνω"] = {"第一類", "-"}

groups["κλείνω"] = {"第一類", "νω", "帶-n-的輔音詞幹動詞",	""}
like_verbs["κλείνω"] = {"第一類", "κλείνω"}

-- Category:Greek consonant-stem verbs in -p-
groups["άπτω"] = {"第一類", "πτω", "帶-pt-的輔音詞幹動詞",	"" }

groups["κόπτω"] = {"第一類", "πτω", "帶-pt-的輔音詞幹動詞", "" }

groups["καλύπτω"] = {"第一類", "πτω", "帶-pt-的輔音詞幹動詞", ""}
like_verbs["καλύπτω"] = {"第一類", "καλύπτω"}

groups["κλέπτω"] = {"第一類", "πτω", "帶-pt-的輔音詞幹動詞", ""}

groups["σκάπτω"] = {"第一類", "πτω", "帶-pt-的輔音詞幹動詞", "" }

groups["λείπω"] = {"第一類", "πω", "帶-p-的輔音詞幹動詞", "" }
like_verbs["λείπω"] = {"第一類", "λείπω", "僅主動語態動詞"}
like_verbs["παραλείπω"] = {"第一類", "λείπω"}

groups["τρέπω"] = {"第一類", "πω", "帶-p-的輔音詞幹動詞", "" }
like_verbs["τρέπω"] = {"第一類", "τρέπω"}

-- Category:Greek consonant-stem verbs in -r-
groups["μαρκάρω"] = {"第一類", "ρω", "帶-r-的輔音詞幹動詞", "" }
like_verbs["καλμάρω"] = {"第一類", "μαρκάρω", nil,	"" }
like_verbs["μαρκάρω"] = {"第一類", "μαρκάρω"}

groups["πακετάρω"] = {"第一類", "ρω", "帶-r-的輔音詞幹動詞", "" }
like_verbs["μπιζάρω"] = {"第一類", "πακετάρω", "僅主動語態動詞"}
like_verbs["πακετάρω"] = {"第一類", "πακετάρω"}

-- Category:Greek consonant-stem verbs in -f-
groups["βλάφτω"] = {"第一類", "φτω", "帶-ft-的輔音詞幹動詞", "" }

groups["αλείφω"] = {"第一類", "φω", "帶-f-的輔音詞幹動詞", "" }
like_verbs["αλείφω"] = {"第一類", "αλείφω"}

groups["γράφω"] = {"第一類", "φω", "帶-f-的輔音詞幹動詞",	"" }
like_verbs["γράφω"] = {"第一類", "γράφω"}

groups["στρέφω"] = {"第一類", "φω", "帶-f-的輔音詞幹動詞",	"" }
like_verbs["στρέφω"] = {"第一類", "στρέφω"}


--------------------------------- Process verb group data --------------------------------

local function link_el(link, display)
	-- For some reason, boldfaced characters don't display properly when done this way.
	--return require("Module:links").full_link { lang = lang, term = link, alt = display, tr = "-" }
	return "[[" .. link .. "#希臘語|" .. (display or link) .. "]]"
end

local function expand_desc(desc)
	desc = rsub(desc, "like<<(.-)>>", function(like)
		return "like(" .. like:gsub("'", "") .. ") <<" .. like .. ">>"
	end)
	desc = rsub(desc, "like%((.-)%)", function(like)
		return "[[:Category:變位形式類似「" .. like .. "」的希臘語動詞|'''like''']]"
	end)
	desc = rsub(desc, "<<([^<>]-)|([^<>]-)>>", function(link, display)
		return link_el(link, display)
	end)
	desc = rsub(desc, "<<([^<>]-)>>", function(link)
		return link_el(link:gsub("'", ""), link)
	end)
	return mw.getCurrentFrame():preprocess(desc)
end


for group, groupdata in pairs(groups) do
	local conj, conj_sort, breadcrumb_parent, desc = unpack(groupdata)
	labels["動詞變位組「" .. group .. "」"] = {
		description = "Greek verb categories in conjugation group '" .. group .. "', in the " .. conj .. " conjugation.",
		additional = expand_desc(desc),
		breadcrumb = { name = group, nocap = true}, 		
			-- if group == '-' then  parents = {
			-- { name = "consonant-stem verbs in -" .. cat_marker .. "-", sort = sort },
		--	}, else 
		parents = {
			{ name = breadcrumb_parent, sort = group },
--			{ name = conj .. " conjugation groups", sort = conj_sort },
		},
	}
end


for likeverb, likedata in pairs(like_verbs) do
	-- Don't use unpack because it can't handle nil in the middle (e.g. in breadcrumb_desc).
	local conj = likedata[1]
	local group = likedata[2] -- needed: option group = '-', only parent = 'Category:Greek consonant-stem verbs in -' .. cat_marker .. '-''
	local breadcrumb_desc = likedata[3]
	local like_desc = likedata[4]
	local additional

	local desc = "變位形式類似 " .. link_el(likeverb) .. " 的希臘語動詞,屬於" .. conj .. "變位的「" .. group .. "」變位組。"
		
	if like_desc then
		additional = expand_desc(like_desc)
	end

	local breadcrumb
	if breadcrumb_desc then
		breadcrumb = breadcrumb_desc .. ",類似 " .. likeverb -- need free text too without 'like blah blah'
	else
		breadcrumb = {name = likeverb, nocap = true}
	end

	labels["變位形式類似「" .. likeverb .. "」的動詞"] = {
		description = desc,
		additional = additional,
		breadcrumb = breadcrumb,
		-- if group == '-' then  parents = {
			-- { name = "consonant-stem verbs in -" .. cat_marker .. "-", sort = sort },
		--	}, else 
		parents = {
			{ name = "動詞變位組「" .. group .. "」", sort = likeverb },
--			{ name = conj .. " conjugation verbs by inflection type", sort = likeverb }, -- no repetition
		},
	}
end


return {LABELS = labels}