Module:dum-definite-article

local m_links = require("Module:links") local m_common = require("Module:dum-common")

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

local export = {}

function export.show(frame) local data = {forms = {}, info = "article", categories = {}} data.forms["m_nom"] = {"die"} data.forms["m_acc"] = {"den"} data.forms["m_gen"] = {"des"} data.forms["m_dat"] = {"den"} data.forms["f_nom"] = {"die"} data.forms["f_acc"] = {"die"} data.forms["f_gen"] = {"der"} data.forms["f_dat"] = {"der"} data.forms["n_nom"] = {"dat"} data.forms["n_acc"] = {"dat"} data.forms["n_gen"] = {"des"} data.forms["n_dat"] = {"den"} data.forms["p_nom"] = {"die"} data.forms["p_acc"] = {"die"} data.forms["p_gen"] = {"der"} data.forms["p_dat"] = {"den"} return make_table(data) end

-- Make the table function make_table(data) local function repl(param) if param == "info" then return mw.getContentLanguage:ucfirst(data.info or "") end local form = data.forms[param] if not form or #form == 0 then return "&mdash;" end local ret = {} for key, subform in ipairs(form) do			table.insert(ret, m_links.full_link({lang = lang, alt = subform})) end return table.concat(ret, ", ") end local names = { ["m"] = "masculine", ["f"] = "feminine", ["n"] = "neuter", ["nom"] = "nominative", ["acc"] = "accusative", ["gen"] = "genitive", ["dat"] = "dative", ["s"] = "singular", ["p"] = "plural", }	local cases = {"nom", "acc", "gen", "dat"} local genders = {"m", "f", "n", "p"} local wikicode = {} table.insert(wikicode, "{| class=\"inflection-table vsSwitcher\" data-toggle-category=\"inflection\" style=\"border: 1px solid #CCCCFF;\" cellspacing=\"1\" cellpadding=\"3\"") table.insert(wikicode, "|- style=\"background: #CCCCFF;\"") table.insert(wikicode, "! class=\"vsToggleElement\" style=\"text-align: left; min-width: " .. tostring(8 + 6 + 12 * #genders) .. "em;\" colspan=\"" .. tostring(#genders + 2) .. "\" | ") table.insert(wikicode, "|- class=\"vsHide\" style=\"background: #CCCCFF;\"") table.insert(wikicode, "| style=\"background: #E6E6FF;\" colspan=\"2\" |") for _, g in ipairs(genders) do table.insert(wikicode, "! style=\"background: #CCCCFF; min-width: 12em;\" | " .. mw.getContentLanguage:ucfirst(names[g])) end for _, case in ipairs(cases) do		table.insert(wikicode, "|- class=\"vsHide\" style=\"background: #F2F2FF;\"") table.insert(wikicode, "! style=\"background: #CCCCFF;\" colspan=\"2\" | " .. mw.getContentLanguage:ucfirst(names[case])) for _, g in ipairs(genders) do			table.insert(wikicode, "| ") end end table.insert(wikicode, "|}") wikicode = table.concat(wikicode, "\n") return (mw.ustring.gsub(wikicode, "", repl)) .. require("Module:utilities").format_categories(data.categories, lang) end

return export