Module:dum-demonstrative-determiner

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 = "determiner", categories = {}} local params = { [1] = {required = false, default = "die"}, }	local args = require("Module:parameters").process(frame:getParent.args, params) if args[1]=="die" then data.forms["m_nom"] = {"die"} data.forms["m_acc"] = {"dien"} data.forms["m_gen"] = {"dies"} data.forms["m_dat"] = {"dien"} data.forms["f_nom"] = {"die"} data.forms["f_acc"] = {"die"} data.forms["f_gen"] = {"dier"} data.forms["f_dat"] = {"dier"} data.forms["n_nom"] = {"dat"} data.forms["n_acc"] = {"dat"} data.forms["n_gen"] = {"dies"} data.forms["n_dat"] = {"dien"} data.forms["p_nom"] = {"die"} data.forms["p_acc"] = {"die"} data.forms["p_gen"] = {"dier"} data.forms["p_dat"] = {"dien"} elseif args[1]=="dese" then data.forms["m_nom"] = {"dēse"} data.forms["m_acc"] = {"dēsen"} data.forms["m_gen"] = {"dēses"} data.forms["m_dat"] = {"dēsen"} data.forms["f_nom"] = {"dēse"} data.forms["f_acc"] = {"dēse"} data.forms["f_gen"] = {"dēser"} data.forms["f_dat"] = {"deser"} data.forms["n_nom"] = {"dit"} data.forms["n_acc"] = {"dit"} data.forms["n_gen"] = {"dēses"} data.forms["n_dat"] = {"dēsen"} data.forms["p_nom"] = {"dēse"} data.forms["p_acc"] = {"dēse"} data.forms["p_gen"] = {"dēser"} data.forms["p_dat"] = {"dēsen"} end 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