Module:User:ObsequiousNewt/grc-conj-old

local m_utilities = require("Module:utilities") local m_links = require("Module:links") local m_accent = require("Module:grc-accent") local m_dialects = require("Module:grc:Dialects")

local export = {}

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

local conjugations = {} -- The tense (and system) local fulltense = "" -- Simple tense local tense = ""

local args = {}

local categories = {}

-- The main entry point. -- This is the only function that can be invoked from a template. function export.show(frame) args = frame:getParent.args fulltense = args[1] or error("Conjugation type has not been specified. Please pass parameter 1 to the module invocation") tense = fulltense:sub(1,(fulltense:find("-") or fulltense:len+1)-1) PAGENAME = mw.title.getCurrentTitle.text FULLPAGENAME = mw.title.getCurrentTitle.prefixedText if args['indonly'] then require('Module:debug').track('grc test tracking 2') end local data = {forms = {}, title = {}, notes = {}} if (tense == "pres" or tense == "imperf") and fulltense ~= "pres-irreg" and fulltense ~= "imperf-irreg" then conjugations["pres"](data) else conjugations[fulltense](data) end --	checkexist(data) _,contracted = mw.ustring.find(fulltense,"con") if fulltense == "fut-ln" then contracted = true end local titleapp = args.titleapp or "" if contracted then args.titleapp = "(Contracted) " .. titleapp end local out = '' if not (args["cform"] == "con") then out = make_table(data) .. m_utilities.format_categories(categories, lang) end if contracted and not (args["cform"] == "uncon") then local data = {forms = {}, title = {}, notes = {}} local vowel = "e" if fulltense ~= "fut-ln" then vowel = mw.ustring.sub(fulltense,contracted+2) end if vowel == "eta" or vowel == "omega" then return out elseif vowel == "a" then args[2] = args[2] .. "α" elseif vowel == "e" or vowel == "e-mono" then args[2] = args[2] .. "ε" elseif vowel == "o" then args[2] = args[2] .. "ο" end if fulltense == "fut-ln" then conjugations["fut"](data) else fulltense = tense conjugations["pres"](data) end args.titleapp = "(Uncontracted) " .. titleapp out = out .. make_table(data) end return out end

local contr = { --				Ê	 E	 É	   Ĵ	Ĥ	Ḥ	 Ô	  O	   Ó	Û	  Ŵ	   Ẃ	Î	  I		Í --			  "ε" ,"ε" ,"έ" ,"ει","η","ῃ" ,"ο" ,"ο" ,"ό" ,"ου" ,"ω" ,"ώ" ,"οι" ,"οι" ,"οί" ["a"]		= {"ᾶ" ,"ᾱ" ,"ά" ,"ᾷ" ,"ᾶ","ᾷ" ,"ῶ" ,"ω" ,"ώ" ,"ῶ" ,"ῶ" ,"ώ" ,"ῷ"  ,"ῳ"  ,"ῴ"  }, ["eta"]		= {"ῆ" ,"η" ,"ή" ,"ῇ" ,"ῆ","ῇ" ,"ῶ" ,"ω" ,"ώ" ,"ῶ" ,"ῶ" ,"ώ" ,"ῷ"  ,"ῳ"  ,"ῴ"  }, ["e"]		= {"εῖ","ει","εί","εῖ","ῆ","ῇ" ,"οῦ","ου","ού","οῦ" ,"ῶ" ,"ώ" ,"οῖ" ,"οι" ,"οί" }, ["e-mono"]	= {"εῖ","εῖ","εί","εῖ","ῆ","ῇ" ,"έο","εο","εό","έου","έω","εώ","έοι","εοι","εοί"}, ["o"]		= {"οῦ","ου","ού","οῖ","ῶ","οῖ","οῦ","ου","ού","οῦ" ,"ῶ" ,"ώ" ,"οῖ" ,"οι" ,"οί" }, ["omega"]	= {"ῶ" ,"ω" ,"ώ" ,"ῷ" ,"ῶ","ῷ" ,"ῶ" ,"ω" ,"ώ" ,"ῶ" ,"ῶ" ,"ώ" ,"ῷ"  ,"ῳ"  ,"ῷ"  }, }

local athem = { --			"eH","H" ,"Hi" ,"H:","Hn","Hā","Hō","Hē","Hēi" ["ami"]	 = {"η" ,"ᾰ" ,"αι" ,"η" ,"ᾱ" ,"ᾶ"  ,"ῶ"  ,"ῆ"  ,"ῇ"  }, ["emi"]	 = {"η" ,"ε" ,"ει" ,"ει","ει","εᾱ" ,"ῶ"  ,"ῆ"  ,"ῇ"  }, ["hmi"]	 = {"η" ,"η" ,"ῃ"  ,"η" ,"η" ,"ει" ,"ῶ"  ,"ῆ"  ,"ῇ"  }, ["omi"]	 = {"ω" ,"ο" ,"οι" ,"ου","ου","οᾱ" ,"ῶ"  ,"ῶ"  ,"ῷ"  }, ["numi"] = {"νῡ","νῠ","νυοι","νῡ","νῡ","νῠᾱ","νῠῶ","νῠῆ","νῠῇ"}, }

local conjs = require("Module:grc-conj/data")

--	Conjugation functions --

function addforms(data,ctable,stem) for code,suffix in pairs(ctable) do		if args[code] then data.forms[code] = args[code] else for i=1,#stem,1 do				suffix = mw.ustring.gsub(suffix,i,stem[i]) end data.forms[code] = suffix end end end

function addforms_futmid(data,ctable,stem) for codex,suffix in pairs(ctable) do code = "M" .. string.sub(codex,2) if args[code] then data.forms[code] = args[code] else for i=1,#stem,1 do				suffix = mw.ustring.gsub(suffix,i,stem[i]) end data.forms[code] = suffix end end end

function addforms_perfmp(data,ctable,euphon,stem) for code,suffix in pairs(ctable) do		if args[code] then data.forms[code] = args[code] else for i=1,#stem,1 do				suffix = mw.ustring.gsub(suffix,i,stem[i]) end suffix = mw.ustring.gsub(suffix,"M",euphon[1]) suffix = mw.ustring.gsub(suffix,"S",euphon[2]) suffix = mw.ustring.gsub(suffix,"T",euphon[3]) suffix = mw.ustring.gsub(suffix,"H",euphon[4]) data.forms[code] = suffix end end end

function addforms_contr(data,ctable,vowel,stem,futmid) for code,suffix in pairs(ctable) do		if futmid and code:sub(1,1) == "P" then code = "M" .. code:sub(2) end if args[code] then data.forms[code] = args[code] else for i=1,#stem,1 do				suffix = mw.ustring.gsub(suffix,i,stem[i]) end for i,j in ipairs({"Ê","E","É","Ĵ","Ĥ","Ḥ","Ô","O","Ó","Û","Ŵ","Ẃ","Î","I","Í"}) do				suffix = mw.ustring.gsub(suffix,j,contr[vowel][i]) data.forms[code] = suffix end end end end

function addforms_irreg(data,form) if form ~= "mp" then for i,mood in ipairs({"I","S","O","C"}) do			for j,pers in ipairs({"1S","2S","3S","2D","3D","1P","2P","3P"}) do				data.forms["A"..mood..pers] = args[1+(i-1)*8+j] end end data.forms["AI"] = args[34] data.forms["APM"] = args[35] data.forms["APF"] = args[36] data.forms["APN"] = args[37] end if form == "am" then for i,mood in ipairs({"I","S","O","C"}) do			for j,pers in ipairs({"1S","2S","3S","2D","3D","1P","2P","3P"}) do				data.forms["M"..mood..pers] = args[37+(i-1)*8+j] end end data.forms["MI"] = args[70] data.forms["MPM"] = args[71] data.forms["MPF"] = args[72] data.forms["MPN"] = args[73] end if form == "mp" then for i,mood in ipairs({"I","S","O","C"}) do			for j,pers in ipairs({"1S","2S","3S","2D","3D","1P","2P","3P"}) do				data.forms["P"..mood..pers] = args[1+(i-1)*8+j] end end data.forms["PI"] = args[34] data.forms["PPM"] = args[35] data.forms["PPF"] = args[36] data.forms["PPN"] = args[37] end end

local pres_index = { ["pres"]={conjs.pres_act,conjs.pres_mp}, ["pres-ami"]={conjs.pres_ami_act,conjs.pres_ami_mp}, ["pres-hmi"]={conjs.pres_hmi_act,conjs.pres_hmi_mp}, ["pres-emi"]={conjs.pres_emi_act,conjs.pres_emi_mp}, ["pres-omi"]={conjs.pres_omi_act,conjs.pres_omi_mp}, ["pres-numi"]={conjs.pres_numi_act,conjs.pres_numi_mp}, ["pres-irregular"]={{},{}}, ["imperf"]={conjs.imperf_act,conjs.imperf_mp}, ["imperf-ami"]={conjs.imperf_ami_act,conjs.imperf_ami_mp}, ["imperf-hmi"]={conjs.imperf_hmi_act,conjs.imperf_hmi_mp}, ["imperf-emi"]={conjs.imperf_emi_act,conjs.imperf_emi_mp}, ["imperf-omi"]={conjs.imperf_omi_act,conjs.imperf_omi_mp}, ["imperf-numi"]={conjs.imperf_numi_act,conjs.imperf_numi_mp}, ["imperf-irregular"]={{},{}}, }

conjugations["pres"] = function(data) local stem = {m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘",""),m_accent.penult(args[2]),m_accent.circ(args[2])} present_system = mw.ustring.find(fulltense,"pres") if args["prefix"] and not present_system then -- 426a: accent cannot precede augment local root = mw.ustring.sub(stem[2],1+mw.ustring.len(args["prefix"])) stem[3] = args["prefix"] .. m_accent.penult(root) end local form = args["form"] or "full" _,contracted = mw.ustring.find(fulltense,"con") if contracted then contracted = mw.ustring.sub(fulltense,contracted+2) end if form == "act" or form == "full" then if contracted then addforms_contr(data,present_system and conjs.pres_contr_act or conjs.imperf_contr_act,contracted,stem,false) else addforms(data,pres_index[fulltense][1],stem) end table.insert(data.title, data.forms["AI1S"]) end if form == "mp" or form == "full" then if contracted then if contracted ~= "e" and j ~= "e-mono" then conjs.pres_contr_mp["PI2S"] = "2Ĵ" end addforms_contr(data,present_system and conjs.pres_contr_mp or conjs.imperf_contr_mp,contracted,stem,false) else addforms(data,pres_index[fulltense][2],stem) end table.insert(data.title, data.forms["PI1S"]) end end

conjugations["pres-irreg"] = function(data) -- εἰμί, εἶμι, ἧμαι local form = args["form"] addforms_irreg(data,form) if form == "act" then table.insert(data.title, data.forms["AI1S"]) elseif form == "mp" then table.insert(data.title, data.forms["PI1S"]) end end

conjugations["imperf-irreg"] = function(data) -- ἦ, ᾖα, ἥμην local form = args["form"] addforms_irreg(data,form) if form == "act" then table.insert(data.title, data.forms["AI1S"]) elseif form == "mp" then table.insert(data.title, data.forms["PI1S"]) end end

conjugations["fut"] = function(data) local stem = {m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘",""),m_accent.penult(args[2]),m_accent.penult(args[2])} local form = args["form"] or "full" local pstem = {} if not args[3] then form = args["form"] or "am" else pstem = {mw.ustring.gsub(args[3],"˘","") .. "ήσ",mw.ustring.gsub(args[3],"˘","") .. "ησ"} end if form == "act" or form == "am" or form == "full" then addforms(data,conjs.pres_act,stem) table.insert(data.title, data.forms["AI1S"]) if args["prefix"] then -- 426d: APN retains accent local root = mw.ustring.sub(stem[2],1+mw.ustring.len(args["prefix"])) data.forms["APN"] = args["APN"] or (args["prefix"] .. m_accent.penult(root) .. "ον") end end if form ~= "act" and form ~= "pass" then addforms_futmid(data,conjs.pres_mp,stem) table.insert(data.title, data.forms["MI1S"]) end if form == "pass" or form == "mp" or form == "full" then addforms(data,conjs.pres_mp,pstem) table.insert(data.title, data.forms["PI1S"]) end end

conjugations["fut-ln"] = function(data) local stem = {m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘","")} local form = args["form"] or "full" local pstem = {} if not args[3] then form = args["form"] or "am" else pstem = {mw.ustring.gsub(args[3],"˘","") .. "ήσ",mw.ustring.gsub(args[3],"˘","") .. "ησ"} end if form == "act" or form == "am" or form == "full" then addforms_contr(data,conjs.pres_contr_act,"e",stem,false) table.insert(data.title, data.forms["AI1S"]) end if form ~= "act" and form ~= "pass" then addforms_contr(data,conjs.pres_contr_mp,"e",stem,true) table.insert(data.title, data.forms["MI1S"]) end if form == "pass" or form == "mp" or form == "full" then addforms(data,conjs.pres_mp,pstem) table.insert(data.title, data.forms["PI1S"]) end data.notes[""] = "This inflection pattern originally had a sigma (i.e. *"..stem[2].."έσω), which was dropped early on in the history of Ancient Greek." end

conjugations["aor-1"] = function(data) local stem = {m_accent.penult(args[2]),m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘",""),m_accent.ult(args[3]),mw.ustring.gsub(args[3],"˘",""),m_accent.penult(args[3]),m_accent.circ(args[3])} if args["prefix"] then -- 426a: accent cannot precede augment local root = mw.ustring.sub(stem[3],1+mw.ustring.len(args["prefix"])) stem[1] = args["prefix"] .. m_accent.penult(root) end local form = args["form"] or "full" local pstem = {} if not args[4] then form = args["form"] or "am" else pstem = {m_accent.ult(args[4]),mw.ustring.gsub(args[4],"˘",""),mw.ustring.gsub(args[5],"˘",""),m_accent.ult(args[5])} end local mono = (stem[4] == stem[5]) if form == "act" or form == "am" or form == "full" then addforms(data,(mono and conjs.aor_1m_act or conjs.aor_1_act),stem) table.insert(data.title, data.forms["AI1S"]) if args["prefix"] then -- 426d: APN retains accent local root = mw.ustring.sub(stem[2],1+mw.ustring.len(args["prefix"])) data.forms["APN"] = args["APN"] or (args["prefix"] .. m_accent.penult(root) .. "ᾰν") end end if form ~= "act" and form ~= "pass" then addforms(data,(mono and conjs.aor_1m_mid or conjs.aor_1_mid),stem) table.insert(data.title, data.forms["MI1S"]) end if form == "pass" or form == "mp" or form == "full" then addforms(data,conjs.aor_pass,pstem) if (not args["PC2S"]) and mw.ustring.sub(data.forms["PC2S"],-4,-4) == "θ" then data.forms["PC2S"] = pstem[4] .. "ητῐ" end table.insert(data.title, data.forms["PI1S"]) end end

conjugations["aor-2"] = function(data) local stem = {m_accent.penult(args[2]),m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘",""),m_accent.ult(args[3]),mw.ustring.gsub(args[3],"˘",""),m_accent.penult(args[3]),m_accent.circ(args[3])} if args["prefix"] then -- 426a: accent cannot precede augment local root = mw.ustring.sub(stem[3],1+mw.ustring.len(args["prefix"])) stem[1] = args["prefix"] .. m_accent.penult(root) end local form = args["form"] or "full" local pstem = {} if not args[4] then form = args["form"] or "am" else pstem = {m_accent.ult(args[4]),mw.ustring.gsub(args[4],"˘",""),mw.ustring.gsub(args[5],"˘",""),m_accent.ult(args[5])} end local mono = (stem[4] == stem[5]) if form == "act" or form == "am" or form == "full" then addforms(data,(mono and conjs.aor_2m_act or conjs.aor_2_act),stem) table.insert(data.title, data.forms["AI1S"]) end if form ~= "act" and form ~= "pass" then addforms(data,(mono and conjs.aor_2m_mid or conjs.aor_2_mid),stem) table.insert(data.title, data.forms["MI1S"]) end if form == "pass" or form == "mp" or form == "full" then addforms(data,conjs.aor_pass,pstem) if (not args["PC2S"]) and mw.ustring.sub(data.forms["PC2S"],-4,-4) == "θ" then data.forms["PC2S"] = pstem[4] .. "ητῐ" end table.insert(data.title, data.forms["PI1S"]) end end

conjugations["aor-ami"] = function(data) local stem = {m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘",""),m_accent.ult(args[3]),mw.ustring.gsub(args[3],"˘","")} local form = args["form"] or "full" local pstem = {} if not args[4] then form = args["form"] or "am" else pstem = {m_accent.ult(args[4]),mw.ustring.gsub(args[4],"˘",""),mw.ustring.gsub(args[5],"˘",""),m_accent.ult(args[5])} end local mono = (stem[3] == stem[4]) if form == "act" or form == "am" or form == "full" then addforms(data,(mono and conjs.aor_amim_act or conjs.aor_ami_act),stem) table.insert(data.title, data.forms["AI1S"]) end if form ~= "act" and form ~= "pass" then addforms(data,(mono and conjs.aor_amim_mid or conjs.aor_ami_mid),stem) table.insert(data.title, data.forms["MI1S"]) end if form == "pass" or form == "mp" or form == "full" then addforms(data,conjs.aor_pass,pstem) if (not args["PC2S"]) and mw.ustring.sub(data.forms["PC2S"],-4,-4) == "θ" then data.forms["PC2S"] = pstem[4] .. "ητῐ" end table.insert(data.title, data.forms["PI1S"]) end end

conjugations["aor-hmi"] = function(data) local stem = {m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘",""),m_accent.ult(args[3]),mw.ustring.gsub(args[3],"˘","")} addforms(data,conjs.aor_hmim_mid,stem) table.insert(data.title, data.forms["MI1S"]) end

conjugations["aor-emi"] = function(data) local stem = {m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘",""),m_accent.ult(args[3]),mw.ustring.gsub(args[3],"˘","")} local form = args["form"] or "full" local pstem = {} if not args[4] then form = args["form"] or "am" else pstem = {m_accent.ult(args[4]),mw.ustring.gsub(args[4],"˘",""),mw.ustring.gsub(args[5],"˘",""),m_accent.ult(args[5])} end if form == "act" or form == "am" or form == "full" then addforms(data,conjs.aor_emi_act,stem) table.insert(data.title, data.forms["AI2D"]) end if form ~= "act" and form ~= "pass" then addforms(data,conjs.aor_emi_mid,stem) table.insert(data.title, data.forms["MI1S"]) end if form == "pass" or form == "mp" or form == "full" then addforms(data,conjs.aor_pass,pstem) if (not args["PC2S"]) and mw.ustring.sub(data.forms["PC2S"],-4,-4) == "θ" then data.forms["PC2S"] = pstem[4] .. "ητῐ" end table.insert(data.title, data.forms["PI1S"]) end end

conjugations["aor-omi"] = function(data) local stem = {m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘",""),m_accent.ult(args[3]),mw.ustring.gsub(args[3],"˘","")} local form = args["form"] or "full" local pstem = {} if not args[4] then form = args["form"] or "am" else pstem = {m_accent.ult(args[4]),mw.ustring.gsub(args[4],"˘",""),mw.ustring.gsub(args[5],"˘",""),m_accent.ult(args[5])} end local mono = (stem[3] == stem[4]) if form == "act" or form == "am" or form == "full" then addforms(data,(mono and conjs.aor_omim_act or conjs.aor_omi_act),stem) table.insert(data.title, data.forms["AI2D"]) end if form ~= "act" and form ~= "pass" then addforms(data,(mono and conjs.aor_omim_mid or conjs.aor_omi_mid),stem) table.insert(data.title, data.forms["MI1S"]) end if form == "pass" or form == "mp" or form == "full" then addforms(data,conjs.aor_pass,pstem) if (not args["PC2S"]) and mw.ustring.sub(data.forms["PC2S"],-4,-4) == "θ" then data.forms["PC2S"] = pstem[4] .. "ητῐ" end table.insert(data.title, data.forms["PI1S"]) end end

conjugations["aor-wmi"] = function(data) local stem = {m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘",""),m_accent.ult(args[3]),mw.ustring.gsub(args[3],"˘","")} addforms(data,conjs.aor_wmim_act,stem) table.insert(data.title, data.forms["AI1S"]) end

conjugations["aor-numi"] = function(data) local stem = {m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘",""),mw.ustring.gsub(args[3],"˘","")} addforms(data,conjs.aor_numim_act,stem) table.insert(data.title, data.forms["AI1S"]) end

conjugations["aor-irreg"] = function(data) -- εἷτον (ἵημι) local form = args["form"] addforms_irreg(data,form) table.insert(data.title, data.forms["AI2D"]) table.insert(data.title, data.forms["MI1S"]) end

conjugations["aor-hiemi-comp"] = function(data) local stem = {m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘",""),m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘","")} local form = args["form"] or "full" local pstem = {} if not args[3] then form = args["form"] or "am" else pstem = {m_accent.ult(args[3]),mw.ustring.gsub(args[3],"˘",""),mw.ustring.gsub(args[4],"˘",""),m_accent.ult(args[4])} end if form == "act" or form == "am" or form == "full" then addforms(data,conjs.aor_hiemic_act,stem) table.insert(data.title, data.forms["AI2D"]) end if form ~= "act" and form ~= "pass" then addforms(data,conjs.aor_hiemic_mid,stem) table.insert(data.title, data.forms["MI1S"]) end if form == "pass" or form == "mp" or form == "full" then addforms(data,conjs.aor_pass,pstem) if (not args["PC2S"]) and mw.ustring.sub(data.forms["PC2S"],-4,-4) == "θ" then data.forms["PC2S"] = pstem[4] .. "ητῐ" end table.insert(data.title, data.forms["PI1S"]) end end

conjugations["perf-ami"] = function(data) local stem = {m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘","")} addforms(data,conjs.perf_ami_act,stem) table.insert(data.title, data.forms["AI2D"]) end

conjugations["perf"] = function(data) local stem = {m_accent.penult(args[2]),m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘","")} if args["prefix"] then -- 426a: accent cannot precede reduplication local root = mw.ustring.sub(stem[3],1+mw.ustring.len(args["prefix"])) stem[1] = args["prefix"] .. m_accent.penult(root) end local form = args["form"] or "full" local pstem = {} local ctable = nil if not args[3] then form = "act" else local pass = mw.ustring.sub(args[3],1,-2) local final = mw.ustring.sub(args[3],-1,-1) if final == "π" or final == "β" or final == "φ" then if mw.ustring.sub(args[3],-2,-2) == "μ" then ctable = {"μμ","μψ","μπτ","μφθ"} pass = mw.ustring.sub(args[3],1,-3) else ctable = {"μμ","ψ","πτ","φθ"} end elseif final == "τ" or final == "δ" or final == "θ" or final == "σ" then ctable = {"σμ","σ","στ","σθ"} elseif final == "κ" or final == "γ" or final == "χ" then if mw.ustring.sub(args[3],-2,-2) == "γ" then ctable = {"γμ","γξ","γκτ","γχθ"} pass = mw.ustring.sub(args[3],1,-3) else ctable = {"γμ","ξ","κτ","χθ"} end elseif final == "ν" then ctable = {"σμ","νσ","ντ","νθ"} elseif final == "λ" or final == "ρ" then ctable = {"μ","σ","τ","θ"} pass = args[3] else pass = args[3] conjs.perf_mp["PI3P"]="1νται" ctable = {"μ","σ","τ","σθ"} end pstem = {m_accent.penult(pass),m_accent.ult(pass),mw.ustring.gsub(pass,"˘",""),m_accent.circ(pass)} if args["prefix"] then -- 426a: accent cannot precede reduplication local root = mw.ustring.sub(pstem[3],1+mw.ustring.len(args["prefix"])) pstem[1] = args["prefix"] .. m_accent.penult(root) end	end if form == "act" or form == "full" then addforms(data,conjs.perf_act,stem) table.insert(data.title, data.forms["AI1S"]) end if form == "mp" or form == "full" then addforms_perfmp(data,conjs.perf_mp,ctable,pstem) table.insert(data.title, data.forms["PI1S"]) end end

conjugations["perf-irreg"] = function(data) -- οἶδα local form = args["form"] addforms_irreg(data,form) table.insert(data.title, data.forms["AI1S"]) end

conjugations["plup-ami"] = function(data) local stem = {m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘","")} addforms(data,conjs.plup_ami_act,stem) table.insert(data.title, data.forms["AI2D"]) end

conjugations["plup"] = function(data) local stem = {m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘","")} local form = args["form"] or "full" local pstem = {} local ctable = nil if not args[3] then form = "act" else args[4] = args[4] or "" local pass = mw.ustring.sub(args[3],1,-2) local ppass = mw.ustring.sub(args[4],1,-2) local final = mw.ustring.sub(args[3],-1,-1) if final == "π" or final == "β" or final == "φ" then if mw.ustring.sub(args[3],-2,-2) == "μ" then ctable = {"μμ","μψ","μπτ","μφθ"} pass = mw.ustring.sub(args[3],1,-3) ppass = mw.ustring.sub(args[4],1,-3) else ctable = {"μμ","ψ","πτ","φθ"} end elseif final == "τ" or final == "δ" or final == "θ" or final == "σ" then ctable = {"σμ","σ","στ","σθ"} elseif final == "κ" or final == "γ" or final == "χ" then if mw.ustring.sub(args[3],-2,-2) == "γ" then ctable = {"γμ","γξ","γκτ","γχθ"} pass = mw.ustring.sub(args[3],1,-3) ppass = mw.ustring.sub(args[4],1,-3) else ctable = {"γμ","ξ","κτ","χθ"} end elseif final == "ν" then ctable = {"σμ","νσ","ντ","νθ"} elseif final == "λ" or final == "ρ" then ctable = {"μ","σ","τ","θ"} pass = args[3] ppass = args[4] else pass = args[3] ppass = args[4] conjs.plup_mp["PI3P"] = "2ντο" ctable = {"μ","σ","τ","σθ"} end pstem = {m_accent.ult(pass),m_accent.penult(pass),mw.ustring.gsub(ppass,"˘","")} if args["prefix"] then -- 426a: accent cannot precede reduplication local root = mw.ustring.sub(mw.ustring.gsub(pass),1+mw.ustring.len(args["prefix"])) pstem[2] = args["prefix"] .. m_accent.penult(root) end end if form == "act" or form == "full" then addforms(data,conjs.plup_act,stem) table.insert(data.title, data.forms["AI1S"]) end if form == "mp" or form == "full" then addforms_perfmp(data,conjs.plup_mp,ctable,pstem) table.insert(data.title, data.forms["PI1S"]) end end

conjugations["plup-irreg"] = function(data) -- ᾔδη (οἶδα) local form = args["form"] addforms_irreg(data,form) table.insert(data.title, data.forms["AI1S"]) end

conjugations["futp"] = function(data) local form = args["form"] or "mp" local stem = {m_accent.ult(args[2]),mw.ustring.gsub(args[2],"˘",""),m_accent.penult(args[2]),m_accent.circ(args[2])} if form == "act" or form == "full" then addforms(data,conjs.pres_act,stem) table.insert(data.title, data.forms["AI1S"]) end if form == "mp" or form == "full" then addforms(data,conjs.pres_mp,stem) table.insert(data.title, data.forms["PI1S"]) end end

local tenses = { ["pres"] = "Present", ["imperf"] = "Imperfect", ["fut"] = "Future", ["aor"] = "Aorist", ["perf"] = "Perfect", ["plup"] = "Pluperfect", ["futp"] = "Future perfect", }

local colors = { ["pres"] = "c0cfe4", ["imperf"] = "c0e4c0", ["fut"] = "e4d4c0", ["aor"] = "c0cfe4", ["perf"] = "c0e4c0", ["plup"] = "e4d4c0", ["futp"] = "c0cfe4", }

local moods = { ["pres"] = {"indicative","subjunctive","optative","imperative"}, ["imperf"] = {"indicative"}, ["fut"] = {"indicative","optative"}, ["aor"] = {"indicative","subjunctive","optative","imperative"}, ["perf"] = {"indicative","subjunctive","optative","imperative"}, ["plup"] = {"indicative"}, ["futp"] = {"indicative","optative"}, ["indicative"] = "I", ["subjunctive"] = "S", ["optative"] = "O", ["imperative"] = "C", }

-- Functions for generating the inflection table

-- Make the table function make_table(data) local dial_list = {} for _,d in ipairs({args["dial1"],args["dial2"],args["dial3"],args["dial4"],args["dial5"]}) do		if d then local dd = m_dialects.data[d] table.insert(dial_list,dd.link and (..dd.display..) or dd.display) end end local dial = "("..table.concat(dial_list,", ")..")" return [=[ ]=] .. tenses[tense] .. ": " .. table.concat(data.title, ", ") .. " " .. (args["titleapp"] or (args["dial1"] and dial or "")) .. [=[  ]=]

end

function link_form(data,form) local q = data.forms[form] if not q then return "| \n" end local s = {} for word in mw.ustring.gmatch(q,"[^/]+") do --split the word by "/" table.insert(s, m_links.full_link({lang = lang, term = word, tr = "-"}) .. "" .. (data.forms[form..'N'] or "") .. "") end return "| " .. table.concat(s,"/ ") .. "\n" end

function make_num_header local s = "|-\n! style=\"background:#" .. colors[tense] .. "\" colspan=\"2\" |\n" for _,num in ipairs({"first","second","third","second","third","first","second","third"}) do s = s .. "! style=\"background:#" .. colors[tense] .. ";width:12.5%\" |" .. num .. "\n" end return s end function make_rows(data) local s = "" local lmoods = args["indonly"] and {"indicative"} or moods[tense] if data.forms["AI1S"] then s = s .. "|-\n! rowspan=\"" .. #lmoods .. "\" style=\"background:#" .. colors[tense] .. "\" | active\n\n" for i,mood in ipairs(lmoods) do if i ~= 1 then s = s .. "|-\n" end s = s .. "! style=\"height:3em;background:#" .. colors[tense] .. "\" | " .. mood .. "\n" for _,j in ipairs({"1S","2S","3S","2D","3D","1P","2P","3P"}) do s = s .. link_form(data,"A"..moods[mood]..j)			end end end if data.forms["MI1S"] then s = s .. "|-\n! rowspan=\"" .. #lmoods .. "\" style=\"background:#" .. colors[tense] .. "\" | middle\n\n" for i,mood in ipairs(lmoods) do if i ~= 1 then s = s .. "|-\n" end s = s .. "! style=\"height:3em;background:#" .. colors[tense] .. "\" | " .. mood .. "\n" for _,j in ipairs({"1S","2S","3S","2D","3D","1P","2P","3P"}) do s = s .. link_form(data,"M"..moods[mood]..j)			end end end if data.forms["PI1S"] and tense ~= "fut" and tense ~= "aor" then s = s .. "|-\n! rowspan=\"" .. #lmoods .. "\" style=\"background:#" .. colors[tense] .. "\" | middle/ passive\n\n" for i,mood in ipairs(lmoods) do if i ~= 1 then s = s .. "|-\n" end s = s .. "! style=\"height:3em;background:#" .. colors[tense] .. "\" | " .. mood .. "\n" for _,j in ipairs({"1S","2S","3S","2D","3D","1P","2P","3P"}) do s = s .. link_form(data,"P"..moods[mood]..j)			end end end if data.forms["PI1S"] and (tense == "fut" or tense == "aor") then s = s .. "|-\n! rowspan=\"" .. #lmoods .. "\" style=\"background:#" .. colors[tense] .. "\" | passive\n\n" for i,mood in ipairs(lmoods) do if i ~= 1 then s = s .. "|-\n" end s = s .. "! style=\"height:3em;background:#" .. colors[tense] .. "\" | " .. mood .. "\n" for _,j in ipairs({"1S","2S","3S","2D","3D","1P","2P","3P"}) do s = s .. link_form(data,"P"..moods[mood]..j)			end end end return s end

function make_voice_header(data) local form = args["form"] local s = "" if tense == "imperf" or tense == "plup" or args["indonly"] then return s	end s = "|-\n! style=\"background:#" .. colors[tense] .. "\" colspan=\"2\" |\n" if tense == "fut" or tense == "aor" then s = s .. "! style=\"background:#" .. colors[tense] .. "\" colspan=\"3\" | " .. (data.forms["AI"] and "active\n" or "\n") s = s .. "! style=\"background:#" .. colors[tense] .. "\" colspan=\"2\" | " .. (data.forms["MI"] and "middle\n" or "\n") s = s .. "! style=\"background:#" .. colors[tense] .. "\" colspan=\"3\" | " .. (data.forms["PI"] and "passive\n" or "\n") else s = s .. "! style=\"background:#" .. colors[tense] .. "\" colspan=\"4\" | " .. (data.forms["AI"] and "active\n" or "\n") s = s .. "! style=\"background:#" .. colors[tense] .. "\" colspan=\"4\" | " .. (data.forms["PI"] and "middle/passive\n" or "\n") end return s end

function make_nonfin_forms(data) if tense == "imperf" or tense == "plup" or args["indonly"] then return "" end local s = "|-\n! style=\"background:#" .. colors[tense] .. "\" colspan=\"2\" | infinitive\n" local flag = (tense == "fut" or tense == "aor") s = s .. "| colspan=\"" .. (flag and 3 or 4) .. "\" " .. link_form(data,"AI") if flag then s = s .. "| colspan=\"2\" " .. link_form(data,"MI") end s = s .. "| colspan=\"" .. (flag and 3 or 4) .. "\" " .. link_form(data,"PI") s = s .. "|-\n! rowspan=\"3\" style=\"background:#" .. colors[tense] .. "\" | participle\n" for _,gender in ipairs({"m","f","n"}) do if gender ~= "m" then s = s .. "|-\n" end s = s .. "! style=\"background:#" .. colors[tense] .. "\" | " .. gender .. "\n" s = s .. "| colspan=\"" .. (flag and 3 or 4) .. "\" " .. link_form(data,"AP"..string.upper(gender)) if flag then s = s .. "| colspan=\"2\" " .. link_form(data,"MP"..string.upper(gender)) end s = s .. "| colspan=\"" .. (flag and 3 or 4) .. "\" " .. link_form(data,"PP"..string.upper(gender)) end return s end

function format_notes(data) s = "These conjugation tables should be treated as a guide. Not every form of the word is necessarily attested, and forms may vary widely by dialect. " for i,note in pairs(data.notes) do s = s .. " " .. i .. "" .. note end return s end

function checkexist(data) local result = {} for verb_form,conjugation in pairs(data.forms) do		if conjugation and type(conjugation) == 'string' and not mw.ustring.find(conjugation," ") then title = lang:makeEntryName(conjugation) local t = mw.title.new(title) if t and not t.exists then table.insert(categories,'Ancient Greek verbs with red links in their conjugation tables') return end end end end

return export