Module:sju-verbs

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

local export = {}

-- Inflection functions

function export.odd(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:sju-common").Stem(args[1]) local data = { forms = {}, info = "odd, no gradation", categories = {}, }	if stem.ucons == "" and mw.title.getCurrentTitle.nsText ~= "Template" then error("The stem must end in a consonant.") end table.insert(data.categories, lang:getCanonicalName .. " odd verbs") data.forms["inf"]      = {stem:make_form{ending = "it"}} data.forms["pres|ptcp"] = {stem:make_form{ending = "ïjjá"}} data.forms["past|ptcp"] = {stem:make_form{ending = "ame"}} data.forms["conn"]     = {stem:make_form{ending = "h"}} data.forms["1|s|pres|indc"] = {stem:make_form{ending = "uv"}} data.forms["2|s|pres|indc"] = {stem:make_form{ending = "h"}} data.forms["3|s|pres|indc"] = {stem:make_form{ending = "e"}} data.forms["1|d|pres|indc"] = {stem:make_form{ending = "an"}} data.forms["2|d|pres|indc"] = {stem:make_form{ending = "iehpien"}} data.forms["3|d|pres|indc"] = {stem:make_form{ending = "iägán"}} data.forms["1|p|pres|indc"] = {stem:make_form{ending = "iebe"}} data.forms["2|p|pres|indc"] = {stem:make_form{ending = "ehpede"}} data.forms["3|p|pres|indc"] = {stem:make_form{ending = "eäh"}} data.forms["1|s|past|indc"] = {stem:make_form{ending = "ijjuv"}} data.forms["2|s|past|indc"] = {stem:make_form{ending = "ijjah"}} data.forms["3|s|past|indc"] = {stem:make_form{ending = "ij"}} data.forms["1|d|past|indc"] = {stem:make_form{ending = "ejmen"}} data.forms["2|d|past|indc"] = {stem:make_form{ending = "ejden"}} data.forms["3|d|past|indc"] = {stem:make_form{ending = "ejgan"}} data.forms["1|p|past|indc"] = {stem:make_form{ending = "ijmieh"}} data.forms["2|p|past|indc"] = {stem:make_form{ending = "ejdeh"}} data.forms["3|p|past|indc"] = {stem:make_form{ending = "ijjen"}} data.forms["2|s|impr"] = {stem:make_form{ending = "h"}} data.forms["2|d|impr"] = {stem:make_form{ending = "iehtin"}} data.forms["2|p|impr"] = {stem:make_form{ending = "ihte"}} 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