Module:dum-conj

local export = {}

local m_links = require("Module:links") local m_utils = require("Module:utilities")

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

local conj_data = {}

conj_data["st"] = { params = { [1] = {},		[2] = {},		[3] = {},		[4] = {},		["class"] = {}, ["head"] = {}, }, } setmetatable(conj_data["st"], {__call = function(self, args, data)	if not args.class then		error("Class parameter required for strong verbs")	end	data.conj_type = "strong class " .. args.class	if args[1]:sub(1,1) == "*" then		error("Redundant asterisks")	end	data.forms["inf"] = {args.head or (args[1] .. "en")}	data.forms["pres_ind_1s"] = {args[1] .. "e"}	data.forms["pres_ind_2s"] = {args[1] .. "es"}	data.forms["pres_ind_3s"] = {args[1] .. "et"}	data.forms["pres_ind_1p"] = {args[1] .. "en"}	data.forms["pres_ind_2p"] = {args[1] .. "et"}	data.forms["pres_ind_3p"] = {args[1] .. "en"}

data.forms["past_ind_1s"] = {args[2]} data.forms["past_ind_2s"] = {args[2] .. "s"} data.forms["past_ind_3s"] = {args[2]} data.forms["past_ind_1p"] = {args[3] .. "en"} data.forms["past_ind_2p"] = {args[3] .. "et"} data.forms["past_ind_3p"] = {args[3] .. "en"}

data.forms["pres_sub_1s"] = {args[1] .. "e"} data.forms["pres_sub_2s"] = {args[1] .. "es"} data.forms["pres_sub_3s"] = {args[1] .. "e"} data.forms["pres_sub_1p"] = {args[1] .. "en"} data.forms["pres_sub_2p"] = {args[1] .. "et"} data.forms["pres_sub_3p"] = {args[1] .. "en"} data.forms["past_sub_1s"] = {args[3] .. "e"} data.forms["past_sub_2s"] = {args[3] .. "es"} data.forms["past_sub_3s"] = {args[3] .. "e"} data.forms["past_sub_1p"] = {args[3] .. "en"} data.forms["past_sub_2p"] = {args[3] .. "et"} data.forms["past_sub_3p"] = {args[3] .. "en"} data.forms["imp_s"] = {args[1] .. "e"} data.forms["imp_p"] = {args[1] .. "et"} data.forms["pres_part"] = {args[1] .. "ende"} data.forms["past_part"] = {args[4]} if args.class ~= 0 then table.insert(data.categories, "Middle Dutch class " .. args.class .. " strong verbs") end end })

conj_data["wk"] = { params = { [1] = {},		[2] = {},		[3] = {},		["head"] = {}, }, } setmetatable(conj_data["wk"], {__call = function(self, args, data)	data.conj_type = "weak"	if args[1]:sub(1,1) == "*" then		error("Redundant asterisks")	end	data.forms["inf"] = {args.head or (args[1] .. "en")}	data.forms["pres_ind_1s"] = {args[1] .. "e"}	data.forms["pres_ind_2s"] = {args[1] .. "es"}	data.forms["pres_ind_3s"] = {args[1] .. "et"}	data.forms["pres_ind_1p"] = {args[1] .. "en"}	data.forms["pres_ind_2p"] = {args[1] .. "et"}	data.forms["pres_ind_3p"] = {args[1] .. "en"}

data.forms["past_ind_1s"] = {(args[2] or (args[1] .. "d")) .. "e"} data.forms["past_ind_2s"] = {(args[2] or (args[1] .. "d")) .. "es"} data.forms["past_ind_3s"] = {(args[2] or (args[1] .. "d")) .. "e"} data.forms["past_ind_1p"] = {(args[2] or (args[1] .. "d")) .. "en"} data.forms["past_ind_2p"] = {(args[2] or (args[1] .. "d")) .. "et"} data.forms["past_ind_3p"] = {(args[2] or (args[1] .. "d")) .. "en"}

data.forms["pres_sub_1s"] = {args[1] .. "e"} data.forms["pres_sub_2s"] = {args[1] .. "es"} data.forms["pres_sub_3s"] = {args[1] .. "e"} data.forms["pres_sub_1p"] = {args[1] .. "en"} data.forms["pres_sub_2p"] = {args[1] .. "et"} data.forms["pres_sub_3p"] = {args[1] .. "en"} data.forms["past_sub_1s"] = {(args[2] or (args[1] .. "d")) .. "e"} data.forms["past_sub_2s"] = {(args[2] or (args[1] .. "d")) .. "es"} data.forms["past_sub_3s"] = {(args[2] or (args[1] .. "d")) .. "e"} data.forms["past_sub_1p"] = {(args[2] or (args[1] .. "d")) .. "en"} data.forms["past_sub_2p"] = {(args[2] or (args[1] .. "d")) .. "et"} data.forms["past_sub_3p"] = {(args[2] or (args[1] .. "d")) .. "en"} data.forms["imp_s"] = {args[1] .. "e"} data.forms["imp_p"] = {args[1] .. "et"} data.forms["pres_part"] = {args[1] .. "ende"} data.forms["past_part"] = {"ghe" .. (args[3] or args[2] or (args[1] .. "t"))} table.insert(data.categories, "Middle Dutch weak verbs") end })

conj_data.irregular = {}

conj_data.irregular["doen"] = function(data) conj_data.st({"do", "dede", "dad", "gedaen", ["class"] = 0}, data) data.conj_type = "irregular" data.forms["past_sub_2s"] = {"daets"} table.insert(data.categories, "Middle Dutch irregular verbs") end

conj_data.irregular["gaen"] = function(data) data.conj_type = "irregular, suppletive" data.forms["inf"] = {"gaen"} data.forms["pres_ind_1s"] = {"ga"} data.forms["pres_ind_2s"] = {"gaes"} data.forms["pres_ind_3s"] = {"gaet"} data.forms["pres_ind_1p"] = {"gaen"} data.forms["pres_ind_2p"] = {"gaet"} data.forms["pres_ind_3p"] = {"gaen"}

data.forms["past_ind_1s"] = {"ginc"} data.forms["past_ind_2s"] = {"gings"} data.forms["past_ind_3s"] = {"ginc"} data.forms["past_ind_1p"] = {"gingen"} data.forms["past_ind_2p"] = {"ginget"} data.forms["past_ind_3p"] = {"gingen"} data.forms["pres_sub_1s"] = {"ga"} data.forms["pres_sub_2s"] = {"gaes"} data.forms["pres_sub_3s"] = {"ga"} data.forms["pres_sub_1p"] = {"gaen"} data.forms["pres_sub_2p"] = {"gaet"} data.forms["pres_sub_3p"] = {"gaen"}

data.forms["past_sub_1s"] = {"ginge"} data.forms["past_sub_2s"] = {"ginges"} data.forms["past_sub_3s"] = {"ginge"} data.forms["past_sub_1p"] = {"gingen"} data.forms["past_sub_2p"] = {"ginget"} data.forms["past_sub_3p"] = {"gingen"} data.forms["imp_s"] = {"ga"} data.forms["imp_p"] = {"gaet"} data.forms["pres_part"] = {"gaende"} data.forms["past_part"] = {"gegaen"} table.insert(data.categories, "Middle Dutch irregular verbs") table.insert(data.categories, "Middle Dutch suppletive verbs") end

conj_data.irregular["sien"] = function(data) conj_data.st({"si", "sach", "sag", "si", ["class"] = 5}, data) data.conj_type = "strong class 5, irregular" table.insert(data.categories, "Middle Dutch irregular verbs") end

conj_data.irregular["slaen"] = function(data) conj_data.st({"sla", "sloech", "sloeg", "slagh", ["class"] = 6}, data) data.conj_type = "strong class 6, irregular" data.forms["pres_ind_1s"] = {"sla"} data.forms["pres_sub_1s"] = {"sla"} data.forms["pres_sub_3s"] = {"sla"} data.forms["imp_s"] = {"sla"}

table.insert(data.categories, "Middle Dutch irregular verbs") end

conj_data.irregular["staen"] = function(data) data.conj_type = "irregular" data.forms["inf"] = {"staen"} data.forms["pres_ind_1s"] = {"sta"} data.forms["pres_ind_2s"] = {"staes"} data.forms["pres_ind_3s"] = {"staet"} data.forms["pres_ind_1p"] = {"staen"} data.forms["pres_ind_2p"] = {"staet"} data.forms["pres_ind_3p"] = {"staen"}

data.forms["past_ind_1s"] = {"stont", "stoet"} data.forms["past_ind_2s"] = {"stonts", "stoets"} data.forms["past_ind_3s"] = {"stont", "stoet"} data.forms["past_ind_1p"] = {"stonden", "stoeden"} data.forms["past_ind_2p"] = {"stondet", "stoedet"} data.forms["past_ind_3p"] = {"stonden", "stoeden"} data.forms["pres_sub_1s"] = {"sta"} data.forms["pres_sub_2s"] = {"staes"} data.forms["pres_sub_3s"] = {"sta"} data.forms["pres_sub_1p"] = {"staen"} data.forms["pres_sub_2p"] = {"staet"} data.forms["pres_sub_3p"] = {"staen"}

data.forms["past_sub_1s"] = {"stonde", "stoede"} data.forms["past_sub_2s"] = {"stondes", "stoedes"} data.forms["past_sub_3s"] = {"stonde", "stoede"} data.forms["past_sub_1p"] = {"stonden", "stoeden"} data.forms["past_sub_2p"] = {"stondet", "stoedet"} data.forms["past_sub_3p"] = {"stonden", "stoeden"} data.forms["imp_s"] = {"sta"} data.forms["imp_p"] = {"staet"} data.forms["pres_part"] = {"staende"} data.forms["past_part"] = {"ghestaen"} table.insert(data.categories, "Middle Dutch irregular verbs") end

local function add_asterisks(forms, data) for _, form in ipairs(forms) do		for i, subform in ipairs(data.forms[form]) do data.forms[form][i] = "*" .. subform end end end

-- The main entry point. -- This is the only function that can be invoked from a template. function export.show(frame)

local parent_args = frame:getParent.args local conj_type = (frame.args["conj"] or parent_args["conj"]) or "st"

if not conj_data[conj_type] then error("Unknown conjugation '" .. conj_type .. "'") end local data = {forms = {}, categories = {}} data.head = parent_args["head"] or nil

local args = require("Module:parameters").process(parent_args, conj_data[conj_type].params, true) -- Override for templates if not args[1] then setmetatable(args, {__index = function(self, key)			return ""		end		}) end -- Generate the forms if parent_args.irr then table.insert(data.categories, "Middle Dutch irregular verbs") if conj_data.irregular[parent_args.irr] then conj_data.irregular[parent_args.irr](data) else conj_data[conj_type](args, data) end else conj_data[conj_type](args, data) end

-- Make the table return make_table(data) end

function make_table(data) local function show_form(form) if not form then return "—" end local ret = {} for key, subform in ipairs(form) do			if mw.title.getCurrentTitle.nsText == "Reconstruction" and subform ~= "—" then subform = "*" .. subform end table.insert(ret, m_links.full_link({lang = lang, term = subform})) end return table.concat(ret, ", ") end local function repl(param) if param == "conj_type" then return data.conj_type else return show_form(data.forms[param]) end end local wikicode = [=[ Conjugation of 

return (mw.ustring.gsub(wikicode, "", repl)) .. m_utils.format_categories(data.categories, lang) end

return export