Module:smn-verbs

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

local export = {}

-- Inflection functions

function export.even(frame) local fparams = { }	local fargs = require("Module:parameters").process(frame.args, fparams) local params = { [1] = {required = true, default = ""}, }	local args = require("Module:parameters").process(frame:getParent.args, params) local stem = require("Module:smn-common").Stem(args[1], not fargs["nograd"]) local data = { forms = {}, info = "even " .. require("Module:links").full_link({lang = lang, alt = stem.uvowel}, "term") .. "-stem", categories = {}, }	if stem.gradation then data.info = data.info .. ", " ..			require("Module:links").full_link({lang = lang, alt = stem.gradation.strong.scons}, "term") .. "-" ..			require("Module:links").full_link({lang = lang, alt = stem.gradation.weak.scons}, "term") .. " gradation" else data.info = data.info .. ", no gradation" end if not mw.ustring.find(stem.uvowel, "^[â]$") and mw.title.getCurrentTitle.nsText ~= "Template" then --error("The final vowel(s) of the stem must be one of â.") end table.insert(data.categories, lang:getCanonicalName .. " even verbs") table.insert(data.categories, lang:getCanonicalName .. " even " .. (stem.uvowel or "") .. "-stem verbs") data.forms["inf"]      = {stem:make_form{grade = "strong", ending = "đ", variant = "per"}} data.forms["pres|ptcp"] = {stem:make_form{grade = "strong", variant = "j_contr"}} data.forms["past|ptcp"] = {stem:make_form{grade = "strong", ending = "m", variant = "per"}} data.forms["1|s|pres|indc"] = {stem:make_form{grade = "weak", ending = "m"}} data.forms["2|s|pres|indc"] = {stem:make_form{grade = "weak", ending = "h", variant = "nom_pl"}} data.forms["3|s|pres|indc"] = {stem:make_form{grade = "strong", variant = "f3_s_pres_indc"}} data.forms["1|d|pres|indc"] = {stem:make_form{grade = "strong", ending = "n", variant = "j_contr"}} data.forms["2|d|pres|indc"] = {stem:make_form{grade = "strong", ending = "vettee", variant = "abe_sg"}} data.forms["3|d|pres|indc"] = {stem:make_form{grade = "strong", ending = "v", variant = "per"}} data.forms["1|p|pres|indc"] = {stem:make_form{grade = "strong", ending = "p", variant = "per"}} data.forms["2|p|pres|indc"] = {stem:make_form{grade = "strong", ending = "vetteđ", variant = "abe_sg"}} data.forms["3|p|pres|indc"] = {stem:make_form{grade = "strong", ending = "h", variant = "f3_p_pres_indc"}} data.forms["pres|indc|conn"] = {stem:make_form{grade = "weak"}} data.forms["1|s|past|indc"] = {stem:make_form{grade = "strong", ending = "m", variant = "f12_s_past_indc"}} data.forms["2|s|past|indc"] = {stem:make_form{grade = "strong", ending = "h", variant = "f12_s_past_indc"}} data.forms["3|s|past|indc"] = {stem:make_form{grade = "weak", ending = "j"}} data.forms["1|d|past|indc"] = {stem:make_form{grade = "weak", ending = "jm", variant = "com_sg"}} data.forms["2|d|past|indc"] = {stem:make_form{grade = "weak", ending = "jd", variant = "com_sg"}} data.forms["3|d|past|indc"] = {stem:make_form{grade = "weak", ending = "jn", variant = "com_sg"}} data.forms["1|p|past|indc"] = {stem:make_form{grade = "weak", ending = "jm"}} data.forms["2|p|past|indc"] = {stem:make_form{grade = "weak", ending = "jd"}} data.forms["3|p|past|indc"] = {stem:make_form{grade = "strong", variant = "f3_p_past_indc"}} data.forms["past|indc|conn"] = {stem:make_form{grade = "strong", ending = "m", variant = "per"}} data.forms["2|s|impr"] = {stem:make_form{grade = "weak"}} data.forms["3|s|impr"] = {stem:make_form{grade = "weak", ending = "s", variant = "f3_s_impr"}} data.forms["1|d|impr"] = {stem:make_form{grade = "strong", ending = "n", variant = "f1_d_impr"}} data.forms["2|d|impr"] = {stem:make_form{grade = "strong", variant = "j_contr"}} data.forms["3|d|impr"] = {stem:make_form{grade = "strong", ending = "s", variant = "f3_dp_impr"}} data.forms["1|p|impr"] = {stem:make_form{grade = "strong", ending = "p", variant = "f3_dp_impr"}} data.forms["2|p|impr"] = {stem:make_form{grade = "strong", ending = "đ", variant = "per"}} data.forms["3|p|impr"] = {stem:make_form{grade = "strong", ending = "s", variant = "f3_dp_impr"}} data.forms["impr|conn"] = {stem:make_form{grade = "weak"}} data.forms["1|s|cond"] = {stem:make_form{grade = "weak", ending = "ččim", variant = "abe_sg"}} data.forms["2|s|cond"] = {stem:make_form{grade = "weak", ending = "ččih", variant = "abe_sg"}} data.forms["3|s|cond"] = {stem:make_form{grade = "weak", ending = "ččij", variant = "abe_sg"}} data.forms["1|d|cond"] = {stem:make_form{grade = "weak", ending = "ččáim", variant = "abe_sg"}} data.forms["2|d|cond"] = {stem:make_form{grade = "weak", ending = "ččáid", variant = "abe_sg"}} data.forms["3|d|cond"] = {stem:make_form{grade = "weak", ending = "ččáin", variant = "abe_sg"}} data.forms["1|p|cond"] = {stem:make_form{grade = "weak", ending = "ččijm", variant = "abe_sg"}} data.forms["2|p|cond"] = {stem:make_form{grade = "weak", ending = "ččijd", variant = "abe_sg"}} data.forms["3|p|cond"] = {stem:make_form{grade = "weak", ending = "ččii", variant = "abe_sg"}} data.forms["cond|conn"] = {stem:make_form{grade = "weak", ending = "ččii", variant = "abe_sg"}} data.forms["1|s|potn"] = {stem:make_form{grade = "strong", ending = "m", variant = "j_contr"}} data.forms["2|s|potn"] = {stem:make_form{grade = "strong", ending = "h", variant = "j_contr"}} data.forms["3|s|potn"] = {stem:make_form{grade = "weak", ending = "š"}} data.forms["1|d|potn"] = {stem:make_form{grade = "weak", ending = "žeen", variant = "abe_sg"}} data.forms["2|d|potn"] = {stem:make_form{grade = "weak", ending = "švettee"}} data.forms["3|d|potn"] = {stem:make_form{grade = "weak", ending = "žává", variant = "abe_sg"}} data.forms["1|p|potn"] = {stem:make_form{grade = "weak", ending = "žep", variant = "abe_sg"}} data.forms["2|p|potn"] = {stem:make_form{grade = "weak", ending = "švetteđ"}} data.forms["3|p|potn"] = {stem:make_form{grade = "weak", ending = "žeh", variant = "abe_sg"}} data.forms["potn|conn"] = {stem:make_form{grade = "weak", variant = "potn_conn"}} postprocess(args, data) return make_table(data) end

function postprocess(args, data) data.lemma = data.forms["inf"][1] -- Check if the lemma form matches the page name if (lang:makeEntryName(data.lemma)) ~= mw.title.getCurrentTitle.text then table.insert(data.categories, lang:getCanonicalName .. " entries with inflection not matching pagename") end end

-- Make the table function make_table(data) local function repl(param) local accel = true local no_store = false if param == "info" then return mw.getContentLanguage:ucfirst(data.info or "") elseif string.sub(param, 1, 1) == "!" then no_store = true param = string.sub(param, 2) elseif string.sub(param, 1, 1) == "#" then accel = false param = string.sub(param, 2) end local forms = data.forms[param] if not forms then return "&mdash;" end local ret = {} for key, subform in ipairs(forms) do			table.insert(ret, require("Module:links").full_link({lang = lang, term = subform, accel = accel and {form = param, lemma = data.lemma, no_store = no_store} or nil})) end return table.concat(ret, " ") end local wikicode = [=[

return mw.ustring.gsub(wikicode, "", repl) .. require("Module:utilities").format_categories(data.categories, lang) end

return export