Module:Hu-nominals

Frae Wikipedia, the free beuk o knawledge
local m_utilities = require("Module:utilities")
local m_links = require("Module:links")

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

local export = {}

-- Functions that do the actual inflecting by creating the forms of a basic term.
local inflections = {}

-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
	local infl_type = frame.args[1] or error("Inflection type has not been specified. Please pass parameter 1 to the module invocation")
	local args = frame:getParent().args
	
	if not inflections[infl_type] then
		error("Unknown inflection type '" .. infl_type .. "'")
	end
	
	local data = {forms = {}, title = nil, categories = {}}
	
	-- Generate the forms
	inflections[infl_type](args, data)
	
	-- Postprocess
	postprocess(args, data)
	
	if args["form"] then
		table.insert(data.categories, "hu-decl with form")
	end
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end


-- Inflection functions

local function check_acc(stem, acc_sg_vowel, acc_sg_vowel2)
	if (mw.ustring.find(stem, "[nsz]$") or mw.ustring.find(stem, "[aáeéiíoóöőuúüű][lr]$") or mw.ustring.find(stem, "ny$") or mw.ustring.find(stem, "[aáeéiíoóöőuúüű]ly$")) and not mw.ustring.find(stem, "cs$") then
		acc_sg_vowel2 = ""
	end
	
	if acc_sg_vowel ~= acc_sg_vowel2 then
		require("Module:debug").track("hu-nominals/acc")
	end
end

local function make_stems(stem)
	local stems = {normal = stem}
	stems.b = mw.ustring.gsub(stem, "bb$", "b") .. "b"
	stems.k = mw.ustring.gsub(stem, "kk$", "k") .. "k"
	stems.n = mw.ustring.gsub(stem, "nn$", "n") .. "n"
	stems.r = mw.ustring.gsub(stem, "rr$", "r") .. "r"
	stems.t = mw.ustring.gsub(stem, "tt$", "t") .. "t"
	
	stems.v = stem .. "v"
	
	-- Remove v after a long consonant
	stems.v = mw.ustring.gsub(stems.v, "(ccs)v$", "%1")
	stems.v = mw.ustring.gsub(stems.v, "(ddz)v$", "%1")
	stems.v = mw.ustring.gsub(stems.v, "(ddzs)v$", "%1")
	stems.v = mw.ustring.gsub(stems.v, "(ggy)v$", "%1")
	stems.v = mw.ustring.gsub(stems.v, "(lly)v$", "%1")
	stems.v = mw.ustring.gsub(stems.v, "(nny)v$", "%1")
	stems.v = mw.ustring.gsub(stems.v, "(ssz)v$", "%1")
	stems.v = mw.ustring.gsub(stems.v, "(tty)v$", "%1")
	stems.v = mw.ustring.gsub(stems.v, "(zzs)v$", "%1")
	stems.v = mw.ustring.gsub(stems.v, "([bcdfghjklmnpqrstvwz])%1v$", "%1%1")
	
	-- Assimilate v to preceding short consonant
	stems.v = mw.ustring.gsub(stems.v, "csv$", "ccs")
	stems.v = mw.ustring.gsub(stems.v, "dzv$", "ddz")
	stems.v = mw.ustring.gsub(stems.v, "dzsv$", "ddzs")
	stems.v = mw.ustring.gsub(stems.v, "gyv$", "ggy")
	stems.v = mw.ustring.gsub(stems.v, "lyv$", "lly")
	stems.v = mw.ustring.gsub(stems.v, "nyv$", "nny")
	stems.v = mw.ustring.gsub(stems.v, "szv$", "ssz")
	stems.v = mw.ustring.gsub(stems.v, "thv$", "tht")
	stems.v = mw.ustring.gsub(stems.v, "tyv$", "tty")
	stems.v = mw.ustring.gsub(stems.v, "xv$", "xsz")
	stems.v = mw.ustring.gsub(stems.v, "zsv$", "zzs")
	stems.v = mw.ustring.gsub(stems.v, "([bcdfghjklmnpqrstvwz])v$", "%1%1")
	
	return stems
end

local function make_plural(data, stem, vh)
	if vh == "o" then
		vh = {a = "a", aa = "á", o = "o", oo = "ó", u = "u"}
	elseif vh == "ö" then
		vh = {a = "e", aa = "é", o = "ö", oo = "ő", u = "ü"}
	elseif vh == "e" then
		vh = {a = "e", aa = "é", o = "e", oo = "ő", u = "ü"}
	end
	
	data.forms["nom_pl"] = {stem .. "k"}
	data.forms["acc_pl"] = {stem .. "k" .. vh.a .. "t"}
	data.forms["dat_pl"] = {stem .. "kn" .. vh.a .. "k"}
	data.forms["ins_pl"] = {stem .. "kk" .. vh.a .. "l"}
	data.forms["cfi_pl"] = {stem .. "kért"}
	data.forms["tra_pl"] = {stem .. "kk" .. vh.aa}
	data.forms["ter_pl"] = {stem .. "kig"}
	data.forms["esf_pl"] = {stem .. "kként"}
	data.forms["esm_pl"] = {stem .. "k" .. vh.u .. "l"}
	data.forms["ine_pl"] = {stem .. "kb" .. vh.a .. "n"}
	data.forms["spe_pl"] = {stem .. "k" .. vh.o .. "n"}
	data.forms["ade_pl"] = {stem .. "kn" .. vh.aa .. "l"}
	data.forms["ill_pl"] = {stem .. "kb" .. vh.a}
	data.forms["sbl_pl"] = {stem .. "kr" .. vh.a}
	data.forms["all_pl"] = {stem .. "kh" .. vh.o .. "z"}
	data.forms["ela_pl"] = {stem .. "kb" .. vh.oo .. "l"}
	data.forms["del_pl"] = {stem .. "kr" .. vh.oo .. "l"}
	data.forms["abl_pl"] = {stem .. "kt" .. vh.oo .. "l"}
end

local function make_singular_short(data, stem, stem2, spe_sg_stem, acc_sg_vowel, v, vh)
	if vh == "o" then
		vh = {a = "a", aa = "á", o = "o", oo = "ó", u = "u"}
	elseif vh == "ö" then
		vh = {a = "e", aa = "é", o = "ö", oo = "ő", u = "ü"}
	elseif vh == "e" then
		vh = {a = "e", aa = "é", o = "e", oo = "ő", u = "ü"}
	end
	
	stem2 = make_stems(stem2 or mw.ustring.gsub(stem, "[aeoö]$", ""))
	
	if v then
		stem2.v = stem2.normal .. v
	end
	
	local stem_no_vowel = mw.ustring.gsub(stem, "[aeoö]$", "")
	spe_sg_stem = spe_sg_stem or stem2.normal
	spe_sg_stem = spe_sg_stem .. (mw.ustring.find(spe_sg_stem, "[aáeéiíoóöőuúüű]$") and "" or vh.o)
	
	local acc_sg_stem = stem
	
	if acc_sg_vowel == "-" then
		acc_sg_stem = stem2.normal
	elseif acc_sg_vowel then
		acc_sg_stem = stem_no_vowel .. acc_sg_vowel
	end
	
	data.forms["nom_sg"] = {mw.title.getCurrentTitle().text}
	data.forms["acc_sg"] = {acc_sg_stem .. "t"}
	data.forms["dat_sg"] = {stem2.n .. vh.a .. "k"}
	data.forms["ins_sg"] = {stem2.v .. vh.a .. "l"}
	data.forms["cfi_sg"] = {stem2.normal .. "ért"}
	data.forms["tra_sg"] = {stem2.v .. vh.aa}
	data.forms["ter_sg"] = {stem2.normal .. "ig"}
	data.forms["esf_sg"] = {stem2.k .. "ént"}
	data.forms["esm_sg"] = {stem2.normal .. vh.u .. "l"}
	data.forms["ine_sg"] = {stem2.b .. vh.a .. "n"}
	data.forms["spe_sg"] = {spe_sg_stem .. "n"}
	data.forms["ade_sg"] = {stem2.n .. vh.aa .. "l"}
	data.forms["ill_sg"] = {stem2.b .. vh.a}
	data.forms["sbl_sg"] = {stem2.r .. vh.a}
	data.forms["all_sg"] = {stem2.normal .. "h" .. vh.o .. "z"}
	data.forms["ela_sg"] = {stem2.b .. vh.oo .. "l"}
	data.forms["del_sg"] = {stem2.r .. vh.oo .. "l"}
	data.forms["abl_sg"] = {stem2.t .. vh.oo .. "l"}
end

local function make_singular_long(data, stem, vh)
	if not mw.ustring.find(stem, "%-$") then
		if not mw.ustring.find(stem, "[iuüáéíóőúű]$") then
			require("Module:debug").track("hu-nominals/vowel")
		elseif stem ~= mw.ustring.gsub(mw.title.getCurrentTitle().text, "([aeoö])$", {["a"] = "á", ["e"] = "é", ["o"] = "ó", ["ö"] = "ő"}) then
			require("Module:debug").track("hu-nominals/pagename")
		end
	end
	
	if vh == "o" then
		vh = {a = "a", aa = "á", o = "o", oo = "ó", u = "u"}
	elseif vh == "ö" then
		vh = {a = "e", aa = "é", o = "ö", oo = "ő", u = "ü"}
	elseif vh == "e" then
		vh = {a = "e", aa = "é", o = "e", oo = "ő", u = "ü"}
	end
	
	local stems = make_stems(stem)
	
	data.forms["nom_sg"] = {mw.title.getCurrentTitle().text}
	data.forms["acc_sg"] = {stems.normal .. "t"}
	data.forms["dat_sg"] = {stems.n .. vh.a .. "k"}
	data.forms["ins_sg"] = {stems.v .. vh.a .. "l"}
	data.forms["cfi_sg"] = {stems.normal .. "ért"}
	data.forms["tra_sg"] = {stems.v .. vh.aa}
	data.forms["ter_sg"] = {stems.normal .. "ig"}
	data.forms["esf_sg"] = {mw.title.getCurrentTitle().text .. (mw.ustring.find(stems.normal, "%-$") and "-" or "") .. "ként"}
	data.forms["esm_sg"] = {stems.normal .. vh.u .. "l"}
	data.forms["ine_sg"] = {stems.b .. vh.a .. "n"}
	data.forms["spe_sg"] = {stems.normal .. "n"}
	data.forms["ade_sg"] = {stems.n .. vh.aa .. "l"}
	data.forms["ill_sg"] = {stems.b .. vh.a}
	data.forms["sbl_sg"] = {stems.r .. vh.a}
	data.forms["all_sg"] = {stems.normal .. "h" .. vh.o .. "z"}
	data.forms["ela_sg"] = {stems.b .. vh.oo .. "l"}
	data.forms["del_sg"] = {stems.r .. vh.oo .. "l"}
	data.forms["abl_sg"] = {stems.t .. vh.oo .. "l"}
end

local function make_singular_Vk(data, stem, stem2, spe_sg_stem, acc_t, v, vh)
	if vh == "o" then
		vh = {a = "a", aa = "á", o = "o", oo = "ó", u = "u"}
	elseif vh == "ö" then
		vh = {a = "e", aa = "é", o = "ö", oo = "ő", u = "ü"}
	elseif vh == "e" then
		vh = {a = "e", aa = "é", o = "e", oo = "ő", u = "ü"}
	end
	
	local stems = make_stems(stem)
	
	if v then
		stems.v = stems.normal .. v
	end
	
	stem2 = stem2 or stem
	spe_sg_stem = spe_sg_stem or stem2
	acc_t = acc_t or "t"
	local fill_vowel = mw.ustring.find(spe_sg_stem, "[aáeéiíoóöőuúüű]$") and "" or vh.o
	
	data.forms["nom_sg"] = {mw.title.getCurrentTitle().text}
	data.forms["acc_sg"] = {stem2 .. acc_t}
	data.forms["dat_sg"] = {stems.n .. vh.a .. "k"}
	data.forms["ins_sg"] = {stems.v .. vh.a .. "l"}
	data.forms["cfi_sg"] = {stems.normal .. "ért"}
	data.forms["tra_sg"] = {stems.v .. vh.aa}
	data.forms["ter_sg"] = {stems.normal .. "ig"}
	data.forms["esf_sg"] = {stems.k .. "ént"}
	data.forms["esm_sg"] = {stems.normal .. vh.u .. "l"}
	data.forms["ine_sg"] = {stems.b .. vh.a .. "n"}
	data.forms["spe_sg"] = {spe_sg_stem .. fill_vowel .. "n"}
	data.forms["ade_sg"] = {stems.n .. vh.aa .. "l"}
	data.forms["ill_sg"] = {stems.b .. vh.a}
	data.forms["sbl_sg"] = {stems.r .. vh.a}
	data.forms["all_sg"] = {stems.normal .. "h" .. vh.o .. "z"}
	data.forms["ela_sg"] = {stems.b .. vh.oo .. "l"}
	data.forms["del_sg"] = {stems.r .. vh.oo .. "l"}
	data.forms["abl_sg"] = {stems.t .. vh.oo .. "l"}
end


inflections["regular"] = function(args, data)
	local stem = args[1] or (mw.title.getCurrentTitle().nsText == "Template" and "{{{1}}}") or ""; if stem == "" then error("Parameter 1 (base stem) may not be empty.") end
	local vh = args[2] or (mw.title.getCurrentTitle().nsText == "Template" and "o")
	local acc_sg_vowel = args[3]; if acc_sg_vowel == "" then acc_sg_vowel = nil end
	local stem2 = args["stem2"]; if stem2 == "" then stem2 = nil end
	local spe_sg_stem = args["spe_sg_stem"]; if spe_sg_stem == "" then spe_sg_stem = nil end
	local v = args["v"]; if v == "" then v = nil end
	
	if not (vh == "o" or vh == "ö" or vh == "e") then
		error("Vowel harmony type must be \"o\", \"ö\" or \"e\".")
	end
	
	local vh_pl = vh
	
	if mw.ustring.find(stem, "[aeoö]$") then
		data.title = "stem in " .. m_links.full_link({lang = lang, alt = "-" .. mw.ustring.match(stem, "([aeoö])$") .. "-"}, "term")
		
		if vh == "ö" and mw.ustring.find(stem, "e$") then
			vh_pl = "e"
		end
		
		make_singular_short(data, stem, stem2, spe_sg_stem, acc_sg_vowel, v, vh)
	elseif mw.ustring.find(stem, "[iuüáéíóőúű%-]$") or mw.title.getCurrentTitle().nsText == "Template" then
		data.title = "stem in long/high vowel"
		make_singular_long(data, stem, vh)
	else
		error("The stem must end in vowel or \"-\".")
	end
	
	if vh == "o" then
		data.title = data.title .. ", back harmony"
	elseif vh == "ö" then
		data.title = data.title .. ", front rounded harmony"
	elseif vh == "e" then
		data.title = data.title .. ", front unrounded harmony"
	end

	make_plural(data, stem, vh_pl)
end


inflections["ak"] = function(args, data)
	data.title = "plural in " .. m_links.full_link({lang = lang, alt = "-ak"}, "term") .. ", back harmony"
	
	local base = args[1] or (mw.title.getCurrentTitle().nsText == "Template" and "{{{1}}}") or ""; if base == "" then error("Parameter 1 (base stem) may not be empty.") end
	local final = args[2] or ""
	local acc_t = args[3]; if acc_t == "" then acc_t = nil end
	local stem2 = args["stem"]; if stem2 == "" then stem2 = nil end
	local spe_sg_stem = args["sup"]; if spe_sg_stem == "" then spe_sg_stem = nil end
	local v = args["v"]; if v == "" then v = nil end
	
	if acc_t and not mw.ustring.find(acc_t, "^[aeoö]t$") then
		error("Invalid accusative singular")
	end
	
	make_singular_Vk(data, base .. final, stem2, spe_sg_stem, acc_t, v, "o")
	make_plural(data, (stem2 or base .. final) .. "a", "o")
end

inflections["ek"] = function(args, data)
	data.title = "plural in " .. m_links.full_link({lang = lang, alt = "-ek"}, "term") .. ", front unrounded harmony"
	
	local base = args[1] or (mw.title.getCurrentTitle().nsText == "Template" and "{{{1}}}") or ""; if base == "" then error("Parameter 1 (base stem) may not be empty.") end
	local final = args[2] or ""
	local acc_t = args[3]; if acc_t == "" then acc_t = nil end
	local stem2 = args["stem"]; if stem2 == "" then stem2 = nil end
	local spe_sg_stem = args["sup"]; if spe_sg_stem == "" then spe_sg_stem = nil end
	local v = args["v"]; if v == "" then v = nil end
	
	if acc_t and not mw.ustring.find(acc_t, "^[aeoö]t$") then
		error("Invalid accusative singular")
	end
	
	make_singular_Vk(data, base .. final, stem2, spe_sg_stem, acc_t, v, "e")
	make_plural(data, (stem2 or base .. final) .. "e", "e")
end

inflections["ek2"] = function(args, data)
	data.title = "plural in " .. m_links.full_link({lang = lang, alt = "-ek"}, "term") .. ", front rounded harmony"
	
	local base = args[1] or (mw.title.getCurrentTitle().nsText == "Template" and "{{{1}}}") or ""; if base == "" then error("Parameter 1 (base stem) may not be empty.") end
	local final = args[2] or ""
	local acc_t = args[3]; if acc_t == "" then acc_t = nil end
	local stem2 = args["stem"]; if stem2 == "" then stem2 = nil end
	local spe_sg_stem = args["sup"]; if spe_sg_stem == "" then spe_sg_stem = nil end
	local v = args["v"]; if v == "" then v = nil end
	
	if acc_t and not mw.ustring.find(acc_t, "^[aeoö]t$") then
		error("Invalid accusative singular")
	end
	
	make_singular_Vk(data, base .. final, stem2, spe_sg_stem, acc_t, v, "ö")
	make_plural(data, (stem2 or base .. final) .. "e", "e")
end

inflections["ok"] = function(args, data)
	data.title = "plural in " .. m_links.full_link({lang = lang, alt = "-ok"}, "term") .. ", back harmony"
	
	local base = args[1] or (mw.title.getCurrentTitle().nsText == "Template" and "{{{1}}}") or ""; if base == "" then error("Parameter 1 (base stem) may not be empty.") end
	local final = args[2] or ""
	local acc_t = args[3]; if acc_t == "" then acc_t = nil end
	local stem2 = args["stem"]; if stem2 == "" then stem2 = nil end
	local spe_sg_stem = args["sup"]; if spe_sg_stem == "" then spe_sg_stem = nil end
	local v = args["v"]; if v == "" then v = nil end
	
	if acc_t and not mw.ustring.find(acc_t, "^[aeoö]t$") then
		error("Invalid accusative singular")
	end
	
	make_singular_Vk(data, base .. final, stem2, spe_sg_stem, acc_t, v, "o")
	make_plural(data, (stem2 or base .. final) .. "o", "o")
end

inflections["ök"] = function(args, data)
	data.title = "plural in " .. m_links.full_link({lang = lang, alt = "-ök"}, "term") .. ", front rounded harmony"
	
	local base = args[1] or (mw.title.getCurrentTitle().nsText == "Template" and "{{{1}}}") or ""; if base == "" then error("Parameter 1 (base stem) may not be empty.") end
	local final = args[2] or ""
	local acc_t = args[3]; if acc_t == "" then acc_t = nil end
	local stem2 = args["stem"]; if stem2 == "" then stem2 = nil end
	local spe_sg_stem = args["sup"]; if spe_sg_stem == "" then spe_sg_stem = nil end
	local v = args["v"]; if v == "" then v = nil end
	
	if acc_t and not mw.ustring.find(acc_t, "^[aeoö]t$") then
		error("Invalid accusative singular")
	end

	make_singular_Vk(data, base .. final, stem2, spe_sg_stem, acc_t, v, "ö")
	make_plural(data, (stem2 or base .. final) .. "ö", "ö")
end

inflections["k-back"] = function(args, data)
	if args["stem"] or args["sup"] then
		require("Module:debug").track("hu-nominals/stem2")
	end
	
	data.title = "plural in " .. m_links.full_link({lang = lang, alt = "-k"}, "term") .. ", back harmony"
	
	local base = args[1] or (mw.title.getCurrentTitle().nsText == "Template" and "{{{1}}}") or ""; if base == "" then error("Parameter 1 (base stem) may not be empty.") end
	local final = args[2] or ""
	
	make_singular_long(data, base .. final, "o")
	make_plural(data, base .. final, "o")
end

inflections["k-front1"] = function(args, data)
	if args["stem"] or args["sup"] then
		require("Module:debug").track("hu-nominals/stem2")
	end
	
	data.title = "plural in " .. m_links.full_link({lang = lang, alt = "-k"}, "term") .. ", front unrounded harmony"
	
	local base = args[1] or (mw.title.getCurrentTitle().nsText == "Template" and "{{{1}}}") or ""; if base == "" then error("Parameter 1 (base stem) may not be empty.") end
	local final = args[2] or ""
	
	make_singular_long(data, base .. final, "e")
	make_plural(data, base .. final, "e")
end

inflections["k-front2"] = function(args, data)
	if args["stem"] or args["sup"] then
		require("Module:debug").track("hu-nominals/stem2")
	end
	
	data.title = "plural in " .. m_links.full_link({lang = lang, alt = "-k"}, "term") .. ", front rounded harmony"
	
	local base = args[1] or (mw.title.getCurrentTitle().nsText == "Template" and "{{{1}}}") or ""; if base == "" then error("Parameter 1 (base stem) may not be empty.") end
	local final = args[2] or ""
	
	make_singular_long(data, base .. final, "ö")
	make_plural(data, base .. final, "ö")
end


function postprocess(args, data)
	local n = args["n"] or args["form"]; if n == "" then n = nil end
	
	if n and not (n == "sg" or n == "sing" or n == "pl") then
		error("The parameter \"n\" must be \"sg\", \"pl\" or empty.")
	end
	
	for key, form in pairs(data.forms) do
		-- Do not show singular or plural forms for nominals that don't have them
		if (n == "pl" and key:find("_sg$")) or ((n == "sg" or n == "sing") and key:find("_pl$")) then
			form = nil
		end
		
		data.forms[key] = form
	end
	
	local has_esm_sg = args["esm_sg"] or args["ul"] or args["ül"] or ""; if has_esm_sg == "" then has_esm_sg = false else has_esm_sg = true end
	local has_esm_pl = args["esm_pl"] or args["akul"] or args["ekül"] or args["okul"] or args["ökül"] or args["kul"] or args["kül"] or ""; if has_esm_pl == "" then has_esm_pl = false else has_esm_pl = true end
	
	if not has_esm_sg then
		data.forms["esm_sg"] = nil
	end
	
	if not has_esm_pl then
		data.forms["esm_pl"] = nil
	end
end


-- Make the table
function make_table(data)
	local function show_form(form)
		if not form then
			return "—"
		elseif type(form) ~= "table" then
			error("a non-table value was given in the list of inflected forms.")
		end
		
		local ret = {}
		
		for key, subform in ipairs(form) do
			table.insert(ret, m_links.full_link({lang = lang, term = subform}))
		end
		
		return table.concat(ret, "<br/>")
	end
	
	local function repl(param)
		if param == "lemma" then
			return m_links.full_link({lang = lang, alt = mw.title.getCurrentTitle().text}, "term")
		elseif param == "info" then
			return data.title and " (" .. data.title .. ")" or ""
		else
			return show_form(data.forms[param])
		end
	end
	
	local wikicode = [=[
{| class="inflection-table vsSwitcher vsToggleCategory-inflection" style="color: rgb(0%,0%,30%); border: solid 1px rgb(80%,80%,100%); text-align: center;" cellspacing="1" cellpadding="2"
|- style="background: #e2f6e2;"
! class="vsToggleElement" style="min-width: 30em; text-align: left;" colspan="3" | Inflection{{{info}}}
|- class="vsHide"
! style="min-width: 11em; background:#c0e4c0" |
! style="min-width: 10em; background:#c0e4c0" | singular
! style="min-width: 10em; background:#c0e4c0" | plural
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | nominative
| <span class="form-of lang-hu nominative-singular-form-of">{{{nom_sg}}}</span>
| <span class="form-of lang-hu nominative-plural-form-of">{{{nom_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | accusative
| <span class="form-of lang-hu accusative-singular-form-of">{{{acc_sg}}}</span>
| <span class="form-of lang-hu accusative-plural-form-of">{{{acc_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | dative
| <span class="form-of lang-hu dative-singular-form-of">{{{dat_sg}}}</span>
| <span class="form-of lang-hu dative-plural-form-of">{{{dat_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | instrumental
| <span class="form-of lang-hu instrumental-singular-form-of">{{{ins_sg}}}</span>
| <span class="form-of lang-hu instrumental-plural-form-of">{{{ins_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | causal-final
| <span class="form-of lang-hu causal-final-singular-form-of">{{{cfi_sg}}}</span>
| <span class="form-of lang-hu causal-final-plural-form-of">{{{cfi_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | translative
| <span class="form-of lang-hu translative-singular-form-of">{{{tra_sg}}}</span>
| <span class="form-of lang-hu translative-plural-form-of">{{{tra_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | terminative
| <span class="form-of lang-hu terminative-singular-form-of">{{{ter_sg}}}</span>
| <span class="form-of lang-hu terminative-plural-form-of">{{{ter_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | essive-formal
| <span class="form-of lang-hu essive-formal-singular-form-of">{{{esf_sg}}}</span>
| <span class="form-of lang-hu essive-formal-plural-form-of">{{{esf_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | essive-modal
| <span class="form-of lang-hu essive-modal-singular-form-of">{{{esm_sg}}}</span>
| <span class="form-of lang-hu essive-modal-plural-form-of">{{{esm_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | inessive
| <span class="form-of lang-hu inessive-singular-form-of">{{{ine_sg}}}</span>
| <span class="form-of lang-hu inessive-plural-form-of">{{{ine_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | superessive
| <span class="form-of lang-hu superessive-singular-form-of">{{{spe_sg}}}</span>
| <span class="form-of lang-hu superessive-plural-form-of">{{{spe_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | adessive
| <span class="form-of lang-hu adessive-singular-form-of">{{{ade_sg}}}</span>
| <span class="form-of lang-hu adessive-plural-form-of">{{{ade_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | illative
| <span class="form-of lang-hu illative-singular-form-of">{{{ill_sg}}}</span>
| <span class="form-of lang-hu illative-plural-form-of">{{{ill_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | sublative
| <span class="form-of lang-hu sublative-singular-form-of">{{{sbl_sg}}}</span>
| <span class="form-of lang-hu sublative-plural-form-of">{{{sbl_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | allative
| <span class="form-of lang-hu allative-singular-form-of">{{{all_sg}}}</span>
| <span class="form-of lang-hu allative-plural-form-of">{{{all_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | elative
| <span class="form-of lang-hu elative-singular-form-of">{{{ela_sg}}}</span>
| <span class="form-of lang-hu elative-plural-form-of">{{{ela_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | delative
| <span class="form-of lang-hu delative-singular-form-of">{{{del_sg}}}</span>
| <span class="form-of lang-hu delative-plural-form-of">{{{del_pl}}}</span>
|- class="vsHide" style="background:rgb(95%,95%,100%)"
! style="background:#e2f6e2" | ablative
| <span class="form-of lang-hu ablative-singular-form-of">{{{abl_sg}}}</span>
| <span class="form-of lang-hu ablative-plural-form-of">{{{abl_pl}}}</span>
|}]=]

	return mw.ustring.gsub(wikicode, "{{{([a-z0-9_]+)}}}", repl)
end

return export