Module:dum-determiner-strong

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 params = { [1] = {required = true, default = ""}, [2] = {required = false, default = ""}, }	local args = require("Module:parameters").process(frame:getParent.args, params) local data = {forms = {}, info = "determiner", categories = {}} local stem = mw.ustring.gsub(args[1], "([^aeiouâêîôûāēōë])e$", "%1") local s_ending = "" if string.sub(stem, -1)=="s" then s_ending = {stem .. hatch .. "es"} else s_ending = {m_common.devoiced(m_common.checked(args[1])) .. "s"} end data.forms["m_nom"] = {m_common.devoiced(m_common.checked(args[1]))} data.forms["m_acc"] = {stem .. "en"} data.forms["m_gen"] = s_ending data.forms["m_dat"] = {stem .. "en"} data.forms["f_nom"] = {stem .. "e"} data.forms["f_acc"] = {stem .. "e"} data.forms["f_gen"] = er_stem(stem, args[2]) data.forms["f_dat"] = er_stem(stem, args[2]) data.forms["n_nom"] = {m_common.devoiced(m_common.checked(args[1]))} data.forms["n_acc"] = {m_common.devoiced(m_common.checked(args[1]))} data.forms["n_gen"] = s_ending data.forms["n_dat"] = {stem .. "en"} data.forms["p_nom"] = {stem .. "e"} data.forms["p_acc"] = {stem .. "e"} data.forms["p_gen"] = er_stem(stem, args[2]) data.forms["p_dat"] = {stem .. "en"} return make_table(data) end

function er_stem(stem, exception) if exception=="" then return 	{stem .. "er"} else return {exception} end 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