Module:lld-conj

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

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

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

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 = {[=[* Ladin 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 = mw.title.getCurrentTitle.text}, "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 = mw.title.getCurrentTitle.text if m_infl[word] then args[1] = m_infl[word].get_stem(word) m_infl[word](args, data) elseif mw.ustring.sub(word, -2, -1) == "ir" then args[1] = m_infl["ir"].get_stem(word) m_infl["ir"](args, data) else local conj = frame.args["conj"] if m_infl[conj] then m_infl[conj](args, data) else error("Inflection for " .. word .. " not found.") end end return make_table(data) .. m_utilities.format_categories(data.categories, lang) end

return export