Module:fur-conj

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

local m_infl = require("Module:fur-conj/data")

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

local export = {}

local function make_table(data) local function show_form(form) if not form then return "–" end local ret = {} for key, subform in ipairs(form) do			table.insert(ret, m_links.full_link({lang = lang, term = subform})) end return table.concat(ret, ", ") end local function repl(param) if param == "conj" then return data.conj else return show_form(data.forms[param]) end end local wikicode = [=[ Conjugation of ]=]	return mw.ustring.gsub(wikicode, "", repl) end

-- Main entry point function export.show(frame) local args = mw.clone(frame:getParent.args) -- Create the forms local data = {forms = {}, categories = {}} if mw.title.getCurrentTitle.nsText ~= "" then return end args[1] = mw.title.getCurrentTitle.text local last2 = mw.ustring.sub(args[1], -2) local ending = mw.ustring.sub(args[1], -1) if m_infl.irregular[args[1]] then m_infl.irregular[args[1]](args, data) elseif m_infl[last2] then args[1] = mw.ustring.sub(args[1], 1, -3) m_infl[last2](args, data) elseif m_infl[ending] then args[1] = mw.ustring.sub(args[1], 1, -2) m_infl[ending](args, data) else error("Inflection for " .. word .. " not found.") end return make_table(data) .. m_utilities.format_categories(data.categories, lang) end

return export