Module:vec-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:vec-conj/data")

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

local clitics = {["2sg"] = "(te) ", ["3sg"] = "(el/ła) ", ["3pl"] = "(i/łe) "}

local export = {}

-- Shows forms with links, or a dash if empty local function show_form(subforms, form_name) 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 = {} local form_cl = "" if clitics[form_name] then form_cl = clitics[form_name] end -- Go over each subform and insert links for key, subform in ipairs(subforms) do table.insert(ret, form_cl .. 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 = {[=[* Venetian conjugation varies from one region to another. Hence, the following conjugation should be considered as typical, not as exhaustive. Conjugation of ]=]} table.insert(ret, m_links.full_link({lang = lang, alt = data.forms.inf[1]}, "term") .. " (" .. data.conj .. ") \n") table.insert(ret, [=[  ]=])

return table.concat(ret) 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 local word = args[1] or mw.title.getCurrentTitle.text local last3 = mw.ustring.sub(word, -3, -1) local last2 = mw.ustring.sub(word, -2, -1) if m_infl[word] then args[1] = m_infl[word].get_stem(word) m_infl[word](args, data) elseif m_infl[last3] then args[1] = m_infl[last3].get_stem(word) m_infl[last3](args, data) elseif m_infl[last2] then args[1] = m_infl[last2].get_stem(word) -- Distinguishing first and second conjugation -ar verbs if mw.ustring.match(word, "[àèéìòó][bcdfgjłmnprstvxz][bcdfgjłmnprstvxz]?ar$") or args.conj == "2nd" then m_infl["ar-2nd"](args, data) else m_infl[last2](args, data) end else error("Inflection for " .. word .. " not found.") end return make_table(data) .. m_utilities.format_categories(data.categories, lang) end

return export