Module:ast-conj

local m_gen_num = require("Module:gender and number") local m_links = require("Module:links") local m_utilities = require("Module:utilities")

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

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

local export = {}

-- Shows forms with links, or a dash if empty local function show_form(subforms) if not subforms then return "&mdash;" elseif type(subforms) ~= "table" then error("a non-table value was given in the list of inflected forms.") elseif #subforms == 0 then return "&mdash;" end local ret = {} -- Go over each subform and insert links for key, subform in ipairs(subforms) do		table.insert(ret, m_links.full_link({lang = lang, term = subform})) end return table.concat(ret, ", ") end

-- Shows the table with the given forms local function make_table(data) local ret = {[=[ Conjugation of ]=]} table.insert(ret, m_links.full_link({lang = lang, alt = data.forms.infinitive[1]}, "term") .. " \n") table.insert(ret, [=[  ]=])

return table.concat(ret) end

-- Main entry point function export.show(frame) local args = frame:getParent.args -- Create the forms local data = {forms = {}, categories = {}, refl = false} -- Find what type of verb is it (hard-coded in the template). -- m_gen_numerate standard conjugated forms for each type of verb, local infl_type = frame.args["conj"] if not args[1] then args[1] = "" end -- Provisional code to prevent arg 2 from being blank, to avoid		the following forms from ending up as blank stems with their		inflectional endings in cases where this is invoked with only		args 1 and 3:			* 1st sg. ind. (would result in "o")			* 3rd sg. ind. (would result in "a")			* 2nd. sg. imp. (would result in "a")	-- if (args[2] == "" or not args[2]) then args[2] = args[1] end if not infl_type then data.forms.infinitive = {args["inf"]}; if data.forms.infinitive[1] == "" then data.forms.infinitive = nil end elseif m_infl[infl_type] then m_infl[infl_type](args, data) else error("Verb type " .. infl_type .. " not supported.") end return make_table(data) .. m_utilities.format_categories(data.categories, lang) end

return export