Bu modul uchun Modul:la-adj/data/doc nomli hujjat sahifasini yaratishingiz mumkin

local decl = {}

local lang = require("Module:languages").getByCode("la")
local m_links = require("Module:links")
local m_utilities = require("Module:utilities")

NAMESPACE = NAMESPACE or mw.title.getCurrentTitle().nsText
PAGENAME = PAGENAME or mw.title.getCurrentTitle().text

decl["1&2"] = function(data, args)
	local title = {}
	table.insert(title, "[[Appendix:Latin first declension|First]]/[[Appendix:Latin second declension|second declension]]")
	
	local stem = args[1]
	local original = ""
	local er = false
	
	if (not stem or stem == "") and not data.allow_empty then
		if NAMESPACE ~= "" and NAMESPACE ~= "Appendix" then
			stem = "{{{1}}}"
		else
			error('Please provide a stem')
		end
	end
	
	if lang:makeEntryName(data.prefix .. stem .. data.suffix) == PAGENAME then
		table.insert(title, "masculine nominative singular in -er")
		table.insert(data.categories, "Latin first and second declension adjectives with masculine nominative singular in -er")
		original = stem
		stem = args[2] or stem
		er = true
	end
	
	local us = "us"
	local um = "um"
	local am = "am"
	
	if data.subtype:find("greek") then
		table.insert(title, "Greek type")
		table.insert(data.categories, "Latin first and second declension adjectives with Greek declension")
		us = "os"
		um = "on"
		am = "ān"
	end

	local ae = data.subtype:find("ae") and "æ" or "ae"
	
	data.forms["nom_sg_m"] = stem .. us
	data.forms["nom_sg_f"] = stem .. "a"
	data.forms["nom_sg_n"] = stem .. um
	data.forms["nom_pl_m"] = stem .. "ī"
	data.forms["nom_pl_f"] = stem .. ae
	data.forms["nom_pl_n"] = stem .. "a"
	
	data.forms["gen_sg_m"] = stem .. "ī"
	data.forms["gen_sg_f"] = stem .. ae
	data.forms["gen_sg_n"] = stem .. "ī"
	data.forms["gen_pl_m"] = stem .. "ōrum"
	data.forms["gen_pl_f"] = stem .. "ārum"
	data.forms["gen_pl_n"] = stem .. "ōrum"
	
	data.forms["dat_sg_m"] = stem .. "ō"
	data.forms["dat_sg_f"] = stem .. ae
	data.forms["dat_sg_n"] = stem .. "ō"
	data.forms["dat_pl_m"] = stem .. "īs"
	data.forms["dat_pl_f"] = stem .. "īs"
	data.forms["dat_pl_n"] = stem .. "īs"
	
	data.forms["acc_sg_m"] = stem .. um
	data.forms["acc_sg_f"] = stem .. am
	data.forms["acc_sg_n"] = stem .. um
	data.forms["acc_pl_m"] = stem .. "ōs"
	data.forms["acc_pl_f"] = stem .. "ās"
	data.forms["acc_pl_n"] = stem .. "a"
	
	data.forms["abl_sg_m"] = stem .. "ō"
	data.forms["abl_sg_f"] = stem .. "ā"
	data.forms["abl_sg_n"] = stem .. "ō"
	data.forms["abl_pl_m"] = stem .. "īs"
	data.forms["abl_pl_f"] = stem .. "īs"
	data.forms["abl_pl_n"] = stem .. "īs"
	
	data.forms["voc_sg_m"] = stem .. "e"
	data.forms["voc_sg_f"] = stem .. "a"
	data.forms["voc_sg_n"] = stem .. um
	data.forms["voc_pl_m"] = stem .. "ī"
	data.forms["voc_pl_f"] = stem .. ae
	data.forms["voc_pl_n"] = stem .. "a"
	
	if er then
		data.forms["nom_sg_m"] = original
		data.forms["voc_sg_m"] = original
	end
	if data.subtype:find("ius") then
		table.insert(title, "with the genitive singular in ''-īus'' and the dative singular in ''-ī''")
		table.insert(data.categories, "Latin first and second declension adjectives with genitive singular in -īus")
		data.forms["gen_sg_m"] = stem .. "īus"
		data.forms["gen_sg_f"] = stem .. "īus"
		data.forms["gen_sg_n"] = stem .. "īus"
		data.forms["dat_sg_m"] = stem .. "ī"
		data.forms["dat_sg_f"] = stem .. "ī"
		data.forms["dat_sg_n"] = stem .. "ī"
	end
	if stem == "me" then
		table.insert(title, "with irregular vocative masculine singular ''mī''")
		
		data.forms["voc_sg_m"] = "mī"
	end
	if data.subtype:find("%-n%-") or data.subtype:find("%-n$") or data.subtype:find("^n%-") or data.subtype:find("^n$") then
		table.insert(title, "with ''m'' → ''n'' in compounds")
		for key,val in pairs(data.forms) do
			data.forms[key] = mw.ustring.gsub(val,"m$","n")
		end
	end
	
	data.title = table.concat(title, ", ") .. "."
	
	table.insert(data.categories, "Latin first and second declension adjectives")
end

decl["3-1"] = function(data, args)
	data.title = "[[Appendix:Latin third declension|Third declension]], neuter nominative singular like masculine/feminine."
	
	local stem1 = args[1]
	local stem2 = args[2] or stem1; if stem2 == "" then stem2 = stem1 end
	
	if not stem1 or stem1 == "" then
		if NAMESPACE ~= "" and NAMESPACE ~= "Appendix" then
			stem1 = "{{{1}}}"
			stem2 = "{{{2}}}"
		else
			error('Please provide a stem')
		end
	end
	
	data.forms["nom_sg_m"] = stem1
	data.forms["nom_sg_n"] = stem1
	data.forms["nom_pl_m"] = stem2 .. "ēs"
	data.forms["nom_pl_n"] = stem2 .. "ia"
	
	data.forms["gen_sg_m"] = stem2 .. "is"
	data.forms["gen_sg_n"] = stem2 .. "is"
	data.forms["gen_pl_m"] = stem2 .. "ium"
	data.forms["gen_pl_n"] = stem2 .. "ium"
	
	data.forms["dat_sg_m"] = stem2 .. "ī"
	data.forms["dat_sg_n"] = stem2 .. "ī"
	data.forms["dat_pl_m"] = stem2 .. "ibus"
	data.forms["dat_pl_n"] = stem2 .. "ibus"
	
	data.forms["acc_sg_m"] = stem2 .. "em"
	data.forms["acc_sg_n"] = stem1
	data.forms["acc_pl_m"] = stem2 .. "ēs"
	data.forms["acc_pl_n"] = stem2 .. "ia"
	
	data.forms["abl_sg_m"] = stem2 .. "ī"
	data.forms["abl_sg_n"] = stem2 .. "ī"
	data.forms["abl_pl_m"] = stem2 .. "ibus"
	data.forms["abl_pl_n"] = stem2 .. "ibus"
	
	data.forms["voc_sg_m"] = stem1
	data.forms["voc_sg_n"] = stem1
	data.forms["voc_pl_m"] = stem2 .. "ēs"
	data.forms["voc_pl_n"] = stem2 .. "ia"
	
	if data.subtype:find("par") then
		data.title = "[[Appendix:Latin third declension|Third declension]], non-i-stem (genitive plural in -um)."
		data.forms["nom_pl_n"] = stem2 .. "a"
		data.forms["gen_pl_m"] = stem2 .. "um"
		data.forms["gen_pl_n"] = stem2 .. "um"
		data.forms["abl_sg_m"] = stem2 .. "e"
		data.forms["abl_sg_n"] = stem2 .. "e"
		data.forms["acc_pl_n"] = stem2 .. "a"
		data.forms["voc_pl_n"] = stem2 .. "a"
	end
	
	table.insert(data.categories, "Latin third declension adjectives")
end

decl["3-C"] = function(data, args)
	local stem = args[1]
	
	if not stem or stem == "" then
		if NAMESPACE ~= "" and NAMESPACE ~= "Appendix" then
			stem = "{{{1}}}"
		else
			error('Please provide a stem')
		end
	end
	
	if args[2] and args[2] ~= "" then
		stem = stem .. args[2]
	else
		stem = stem .. "i"
	end
	
	data.subtype = data.subtype and data.subtype .. "-par" or "par"
	decl["3-1"](data, {stem .. "or", stem .. "ōr"})
	
	data.title = "[[Appendix:Latin third declension|Third declension]], comparative variant."
	
	data.forms["nom_sg_n"] = stem .. "us"
	data.forms["acc_sg_n"] = stem .. "us"
	data.forms["voc_sg_n"] = stem .. "us"
end

decl["3-P"] = function(data, args)
	local stem1 = args[1]
	local stem2 = args[2] or stem1
	
	if not stem1 or stem1 == "" then
		if NAMESPACE ~= "" and NAMESPACE ~= "Appendix" then
			stem1 = "{{{1}}}"
			stem2 = "{{{2}}}"
		else
			error('Please provide a stem')
		end
	end
	
	decl["3-1"](data, {stem1, stem2})
	
	
	data.forms["abl_sg_m"] = {stem2 .. "e", stem2 .. "ī"}
	data.forms["abl_sg_n"] = {stem2 .. "e", stem2 .. "ī"}
	
	data.notes["abl_sg_m2"] = "When used purely as an adjective."
	data.notes["abl_sg_n2"] = "When used purely as an adjective."
end

decl["3-2"] = function(data, args)
	data.title = "[[Appendix:Latin third declension|Third declension]], neuter nominative singular in -e."
	
	local stem = args[1]
	
	if not stem or stem == "" then
		if NAMESPACE ~= "" and NAMESPACE ~= "Appendix" then
			stem = "{{{1}}}"
		else
			error('Please provide a stem')
		end
	end
	
	data.forms["nom_sg_m"] = stem .. "is"
	data.forms["nom_sg_n"] = stem .. "e"
	data.forms["nom_pl_m"] = stem .. "ēs"
	data.forms["nom_pl_n"] = stem .. "ia"
	
	data.forms["gen_sg_m"] = stem .. "is"
	data.forms["gen_sg_n"] = stem .. "is"
	data.forms["gen_pl_m"] = stem .. "ium"
	data.forms["gen_pl_n"] = stem .. "ium"
	
	data.forms["dat_sg_m"] = stem .. "ī"
	data.forms["dat_sg_n"] = stem .. "ī"
	data.forms["dat_pl_m"] = stem .. "ibus"
	data.forms["dat_pl_n"] = stem .. "ibus"
	
	data.forms["acc_sg_m"] = stem .. "em"
	data.forms["acc_sg_n"] = stem .. "e"
	data.forms["acc_pl_m"] = stem .. "ēs"
	data.forms["acc_pl_n"] = stem .. "ia"
	
	data.forms["abl_sg_m"] = stem .. "ī"
	data.forms["abl_sg_n"] = stem .. "ī"
	data.forms["abl_pl_m"] = stem .. "ibus"
	data.forms["abl_pl_n"] = stem .. "ibus"
	
	data.forms["voc_sg_m"] = stem .. "is"
	data.forms["voc_sg_n"] = stem .. "e"
	data.forms["voc_pl_m"] = stem .. "ēs"
	data.forms["voc_pl_n"] = stem .. "ia"
	
	table.insert(data.categories, "Latin third declension adjectives")
end

decl["3-3"] = function(data, args)
	local title = {}
	table.insert(title, "[[Appendix:Latin third declension|Third declension]]")
	table.insert(title, "masculine nominative singular in -er")
	table.insert(title, "neuter in -e")
	
	local stem1 = args[1]
	local stem2 = args[2] or stem1
	
	if not stem1 or stem1 == "" then
		if NAMESPACE ~= "" and NAMESPACE ~= "Appendix" then
			stem1 = "{{{1}}}"
			stem2 = "{{{2}}}"
		else
			error('Please provide a stem')
		end
	end
	
	data.forms["nom_sg_m"] = stem1
	data.forms["nom_sg_f"] = stem2 .. "is"
	data.forms["nom_sg_n"] = stem2 .. "e"
	data.forms["nom_pl_m"] = stem2 .. "ēs"
	data.forms["nom_pl_f"] = stem2 .. "ēs"
	data.forms["nom_pl_n"] = stem2 .. "ia"
	
	data.forms["gen_sg_m"] = stem2 .. "is"
	data.forms["gen_sg_f"] = stem2 .. "is"
	data.forms["gen_sg_n"] = stem2 .. "is"
	data.forms["gen_pl_m"] = stem2 .. "ium"
	data.forms["gen_pl_f"] = stem2 .. "ium"
	data.forms["gen_pl_n"] = stem2 .. "ium"
	
	data.forms["dat_sg_m"] = stem2 .. "ī"
	data.forms["dat_sg_f"] = stem2 .. "ī"
	data.forms["dat_sg_n"] = stem2 .. "ī"
	data.forms["dat_pl_m"] = stem2 .. "ibus"
	data.forms["dat_pl_f"] = stem2 .. "ibus"
	data.forms["dat_pl_n"] = stem2 .. "ibus"
	
	data.forms["acc_sg_m"] = stem2 .. "em"
	data.forms["acc_sg_f"] = stem2 .. "em"
	data.forms["acc_sg_n"] = stem2 .. "e"
	data.forms["acc_pl_m"] = stem2 .. "ēs"
	data.forms["acc_pl_f"] = stem2 .. "ēs"
	data.forms["acc_pl_n"] = stem2 .. "ia"
	
	data.forms["abl_sg_m"] = stem2 .. "ī"
	data.forms["abl_sg_f"] = stem2 .. "ī"
	data.forms["abl_sg_n"] = stem2 .. "ī"
	data.forms["abl_pl_m"] = stem2 .. "ibus"
	data.forms["abl_pl_f"] = stem2 .. "ibus"
	data.forms["abl_pl_n"] = stem2 .. "ibus"
	
	data.forms["voc_sg_m"] = stem1
	data.forms["voc_sg_f"] = stem2 .. "is"
	data.forms["voc_sg_n"] = stem2 .. "e"
	data.forms["voc_pl_m"] = stem2 .. "ēs"
	data.forms["voc_pl_f"] = stem2 .. "ēs"
	data.forms["voc_pl_n"] = stem2 .. "ia"
	
	data.title = table.concat(title, ", ") .. "."
	
	table.insert(data.categories, "Latin third declension adjectives")
end

decl["irreg"] = function(data,args)
	if not args[1] or args[1] == "" then
		if NAMESPACE ~= "" and NAMESPACE ~= "Appendix" then
			args[1] = "plus"
		else
			error('please provide the adjective')
		end
	end
	if args[1] == "plus" then
		data.title = "[[Appendix:Latin third declension|Third declension]], comparative variant. Several missing or irregular forms."
		
		data.forms["nom_sg_m"] = ""
		data.forms["nom_sg_n"] = "plūs"
		data.forms["nom_pl_m"] = "plūrēs"
		data.forms["nom_pl_n"] = "plūra"
		
		data.forms["gen_sg_m"] = ""
		data.forms["gen_sg_n"] = "plūris"
		data.forms["gen_pl_m"] = "plūrium"
		data.forms["gen_pl_n"] = "plūrium"
		
		data.forms["dat_sg_m"] = ""
		data.forms["dat_sg_n"] = ""
		data.forms["dat_pl_m"] = "plūribus"
		data.forms["dat_pl_n"] = "plūribus"
		
		data.forms["acc_sg_m"] = ""
		data.forms["acc_sg_n"] = "plūs"
		data.forms["acc_pl_m"] = "plūrēs"
		data.forms["acc_pl_n"] = "plūra"
		
		data.forms["abl_sg_m"] = ""
		data.forms["abl_sg_n"] = "plūre"
		data.forms["abl_pl_m"] = "plūribus"
		data.forms["abl_pl_n"] = "plūribus"
		
		data.forms["voc_sg_m"] = ""
		data.forms["voc_sg_n"] = "plūs"
		data.forms["voc_pl_m"] = "plūrēs"
		data.forms["voc_pl_n"] = "plūra"
		
		data.footnote = "''Note:'' Singular forms take the genitive of the whole and do not function as adjectives."
		
		table.insert(data.categories, "Latin third declension adjectives")
	elseif args[1] == "is" then
		data.title = "Irregular: similar to first and second declensions, except for singular genitives ending in \"-ius\" and singular datives ending in \"\"."
		
		local m = "m"
		local i = "i"
		if data.suffix == "dem" then
			data.title = "Irregular declension. Similar to the declension of ''is, ea, id''."
			m = "n"
			i = ""
		end
		
		data.forms["nom_sg_m"] = "is"
		data.forms["nom_sg_f"] = "ea"
		data.forms["nom_sg_n"] = "id"
		data.forms["nom_pl_m"] = {"eī", "iī"}
		data.forms["nom_pl_f"] = "eae"
		data.forms["nom_pl_n"] = "ea"
		
		data.forms["gen_sg_m"] = {"eius", "ejus"}
		data.forms["gen_sg_f"] = {"eius", "ejus"}
		data.forms["gen_sg_n"] = {"eius", "ejus"}
		data.forms["gen_pl_m"] = "eōru"..m
		data.forms["gen_pl_f"] = "eāru"..m
		data.forms["gen_pl_n"] = "eōru"..m
		
		data.forms["dat_sg_m"] = "eī"
		data.forms["dat_sg_f"] = "eī"
		data.forms["dat_sg_n"] = "eī"
		data.forms["dat_pl_m"] = {"eīs", i.."īs"}
		data.forms["dat_pl_f"] = {"eīs", i.."īs"}
		data.forms["dat_pl_n"] = {"eīs", i.."īs"}
		
		data.forms["acc_sg_m"] = "eu"..m
		data.forms["acc_sg_f"] = "ea"..m
		data.forms["acc_sg_n"] = "id"
		data.forms["acc_pl_m"] = "eōs"
		data.forms["acc_pl_f"] = "eās"
		data.forms["acc_pl_n"] = "ea"
		
		data.forms["abl_sg_m"] = "eō"
		data.forms["abl_sg_f"] = "eā"
		data.forms["abl_sg_n"] = "eō"
		data.forms["abl_pl_m"] = {"eīs", i.."īs"}
		data.forms["abl_pl_f"] = {"eīs", i.."īs"}
		data.forms["abl_pl_n"] = {"eīs", i.."īs"}
		
		data.voc = false
		
		if data.suffix == "dem" then
			data.forms["nom_sg_m"] = "ī"
			data.forms["nom_sg_n"] = "i"
			data.forms["nom_pl_m"] = "ī"
			
			data.forms["gen_sg_m"] = "eius"
			data.forms["gen_sg_f"] = "eius"
			data.forms["gen_sg_n"] = "eius"
			
			data.forms["acc_sg_n"] = "i"
		end
	elseif args[1] == "ille" then
		data.subtype = data.subtype .. "-ius"
		
		decl["1&2"](data, {"ill"})
		
		data.title = "Irregular: similar to first and second declensions but with singular genitives ending in \"-īus\" and singular datives ending in \"\"."
		
		data.forms["nom_sg_m"] = "ille"
		data.forms["nom_sg_n"] = "illud"
		
		data.forms["acc_sg_n"] = "illud"
		
		data.voc = false
		
		data.categories = {}
	elseif args[1] == "iste" then
		data.subtype = data.subtype .. "-ius"
		
		decl["1&2"](data, {"ist"})
		
		data.title = "Irregular: similar to first and second declensions but with singular genitives ending in \"-īus\" and singular datives ending in \"\"."
		
		data.forms["nom_sg_m"] = "iste"
		data.forms["nom_sg_n"] = "istud"
		
		data.forms["acc_sg_n"] = "istud"
		
		data.voc = false
		
		data.categories = {}
	elseif args[1] == "ic" then
		data.allow_empty = true
			
		decl["1&2"](data, {""})
		
		data.title = "Irregular: Roughly similar to first and second declensions, but with singular genitives ending in \"-ius\" and singular datives ending in \"-ic\"."
		
		local oc = "oc"
		local oc_macron = "ōc"
		if data.prefix == "ill" then
			oc = "uc"
			oc_macron = "ūc"
		end
		
		data.forms["nom_sg_m"] = "ic"
		data.forms["nom_sg_f"] = "aec"
		data.forms["nom_sg_n"] = oc
		data.forms["nom_pl_n"] = "aec"
		
		data.forms["gen_sg_m"] = {"uius", "ujus"}
		data.forms["gen_sg_f"] = {"uius", "ujus"}
		data.forms["gen_sg_n"] = {"uius", "ujus"}
		
		data.forms["dat_sg_m"] = "uic"
		data.forms["dat_sg_f"] = "uic"
		data.forms["dat_sg_n"] = "uic"
		
		data.forms["acc_sg_m"] = "unc"
		data.forms["acc_sg_f"] = "anc"
		data.forms["acc_sg_n"] = oc
		data.forms["acc_pl_n"] = "aec"
		
		data.forms["abl_sg_m"] = "ōc"
		data.forms["abl_sg_f"] = "āc"
		data.forms["abl_sg_n"] = oc_macron
		
		data.voc = false
	elseif args[1] == "quis" or args[1] == "qui" then
		local id = "id"
		local em = "em"
		local o = "ō"
		if args[1] == "qui" then
			id = "od"
			em = "am"
			o = "ā"
		end
		
		data.forms["nom_sg_m"] = "quis"
		data.forms["nom_sg_f"] = "quis"
		data.forms["nom_sg_n"] = "qu"..id
		data.forms["nom_pl_m"] = "quī"
		data.forms["nom_pl_f"] = "quae"
		data.forms["nom_pl_n"] = "quae"
		
		data.forms["gen_sg_m"] = {"cuius", "cujus"}
		data.forms["gen_sg_f"] = {"cuius", "cujus"}
		data.forms["gen_sg_n"] = {"cuius", "cujus"}
		data.forms["gen_pl_m"] = "quōrum"
		data.forms["gen_pl_f"] = "quārum"
		data.forms["gen_pl_n"] = "quōrum"
		
		data.forms["dat_sg_m"] = "cui"
		data.forms["dat_sg_f"] = "cui"
		data.forms["dat_sg_n"] = "cui"
		data.forms["dat_pl_m"] = "quibus"
		data.forms["dat_pl_f"] = "quibus"
		data.forms["dat_pl_n"] = "quibus"
		
		data.forms["acc_sg_m"] = "quem"
		data.forms["acc_sg_f"] = "qu"..em
		data.forms["acc_sg_n"] = "qu"..id
		data.forms["acc_pl_m"] = "quōs"
		data.forms["acc_pl_f"] = "quās"
		data.forms["acc_pl_n"] = "quae"
		
		data.forms["abl_sg_m"] = "quō"
		data.forms["abl_sg_f"] = "qu"..o
		data.forms["abl_sg_n"] = "quō"
		data.forms["abl_pl_m"] = "quibus"
		data.forms["abl_pl_f"] = "quibus"
		data.forms["abl_pl_n"] = "quibus"
		
		data.voc = false
		
		if args[1] == "qui" then
			data.forms["nom_sg_m"] = "quī"
			data.forms["nom_sg_f"] = "quae"
		end
		if data.subtype:find("duplicate") then
			data.forms["gen_sg_m"] = "cuius"
			data.forms["gen_sg_f"] = "cuius"
			data.forms["gen_sg_n"] = "cuius"
			
			data.forms["acc_sg_f"] = "quam"
			
			data.forms["abl_sg_f"] = "quā"
			
			data.forms["voc_sg_m"] = "quis"
			data.forms["voc_sg_f"] = "quis"
			data.forms["voc_sg_n"] = "quid"
			data.forms["voc_pl_m"] = "quī"
			data.forms["voc_pl_f"] = "quae"
			data.forms["voc_pl_n"] = "quae"
			
			for key,val in pairs(data.forms) do
				data.forms[key] = val .. val
			end
			
			data.subtype = data.subtype:gsub("duplicate","") --the "pl" is causing trouble
			
			data.voc = true
		end
	else
		error('adjective not recognized')
	end
end

return decl