Module:eu-noun

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

local export = {}

local function postprocess(args, data) data.lemma = data.forms["absv|indef"][1] -- Check if the lemma form matches the page name if (lang:makeEntryName(data.lemma)) ~= mw.title.getCurrentTitle.text then table.insert(data.categories, lang:getCanonicalName .. " entries with inflection not matching pagename") end end

-- Table-generating functions -- st: default table (indefinite, singular and plural columns; single animacy) -- both: same as before, but rows for two animacies -- both-indef: one column (indefinite) and rows for two animacies -- both-pl: two columns (indefinite and plural) and rows for two animacies -- ind: one column (indefinite) and a single animacy -- sing: two columns (indefinite and singular) and a single animacy -- pl: two columns (indefinite and singular) and a single animacy -- hiru-lau: only used for the numerals hiru and lau local function make_table(data, tbl_type) local function repl(param) local accel = true local no_store = false if param == "info" then return mw.getContentLanguage:ucfirst(data.info or "") elseif string.sub(param, 1, 1) == "!" then no_store = true param = string.sub(param, 2) elseif string.sub(param, 1, 1) == "#" then accel = false param = string.sub(param, 2) end local forms = data.forms[param] if not forms then return "&mdash;" end local ret = {} for key, subform in ipairs(forms) do			table.insert(ret, require("Module:links").full_link({lang = lang, term = subform, accel = accel and {form = param, lemma = data.lemma, no_store = no_store} or nil})) end return table.concat(ret, " ") end local wikicode if tbl_type == "st" then wikicode = [=[ elseif tbl_type == "both" then wikicode = [=[ elseif tbl_type == "both-indef" then wikicode = [=[ elseif tbl_type == "both-pl" then wikicode = [=[ elseif tbl_type == "ind" then wikicode = [=[ elseif tbl_type == "sing" then wikicode = [=[ elseif tbl_type == "pl" then wikicode = [=[ elseif tbl_type == "hiru-lau" then wikicode = [=[ end return mw.ustring.gsub(wikicode, "", repl) .. require("Module:utilities").format_categories(data.categories, lang) end --normal table

-- Inflection functions (common nouns) function export.anim(frame) local args = frame:getParent.args local data = { forms = {}, info = "Declension of ", categories = {}, }	local ending_text = 0 -- add the lemma form local base = mw.title.getCurrentTitle.text data.forms["absv|indef"] = {base} data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (animate, ending in "

-- add the prolative data.forms["pro|indef"] = {base .. "tzat"} if	base:sub(-2,-1) == "tz" then data.forms["pro|indef"] = {base:sub(1,-3) .. "ztzat"} elseif base:sub(-2,-1) == "ts" then data.forms["pro|indef"] = {base:sub(1,-3) .. "stzat"} elseif base:sub(-2,-1) == "tx" then data.forms["pro|indef"] = {base:sub(1,-3) .. "xtzat"} elseif base:sub(-1) == "t" then data.forms["pro|indef"] = {base .. "-tzat"} end if args.hyph then data.forms["pro|indef"] = {base .. "-tzat"} end -- epenthetic "e" and "r", ending in vowel/-a local e = "e" if base:sub(-1) == "a" then e = "" ending_text = 1 elseif base:sub(-1) == "e" or base:sub(-1) == "i" or base:sub(-1) == "o" or base:sub(-1) == "u" or args.ending == "V" or args.ending == "orthV" then -- FIXME, this can be written in a cleaner way for sure e = "" ending_text = 2 if args.ending == "orthV" then ending_text = 5 end elseif args.ending == "orthC" then ending_text = 6 end local r = "r" if e == "e" then r = "" end -- exception for monosyllabic nouns ending in a dipthong local e2 = "" if args.dip then e2 = "e" end --modifications if a hyphen is needed if args.hyph then base = base .. "-"	end

-- modifications if the word ends in -r if	base:sub(-1) == "r" then if args.tap then ending_text = 3 else base = base .. 'r' --add an r if the word ends in r			ending_text = 4 end else end -- modifications if the word ends in -a local base_pl = base if base:sub(-1) == "a" then base_pl = base:sub(1,-2) end -- write "ending in ..." if ending_text == 0 then data.info = data.info .. "consonant) "	elseif ending_text == 1 then		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-a"}, "term") .. ") " elseif ending_text == 2 then data.info = data.info .. "vowel" .. ") "	elseif ending_text == 3 then		data.info = data.info .. "tap " .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ") " elseif ending_text == 4 then data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ") "	elseif ending_text == 5 then		data.info = data.info .. "orthographical vowel) " elseif ending_text == 6 then data.info = data.info .. "orthographical consonant) "

end data.forms["absv|s"] = {base_pl .. "a"} data.forms["absv|p"] = {base_pl .. "ak"}

data.forms["erg|indef"] = {base .. e .. "k"} data.forms["erg|s"] = {base_pl .. "ak"} data.forms["erg|p"] = {base_pl .. "ek"} data.forms["dat|indef"] = {base .. r .. "i"} data.forms["dat|s"] = {base_pl .. "ari"} data.forms["dat|p"] = {base_pl .. "ei"} data.forms["gen|indef"] = {base .. r .. "en"} data.forms["gen|s"] = {base_pl .. "aren"} data.forms["gen|p"] = {base_pl .. "en"} data.forms["com|indef"] = {base .. r .. "ekin"} data.forms["com|s"] = {base_pl .. "arekin"} data.forms["com|p"] = {base_pl .. "ekin"} data.forms["caus|indef"] = {base .. r .. "engatik"} data.forms["caus|s"] = {base_pl .. "arengatik"} data.forms["caus|p"] = {base_pl .. "engatik"} data.forms["ben|indef"] = {base .. r .. "entzat"} data.forms["ben|s"] = {base_pl .. "arentzat"} data.forms["ben|p"] = {base_pl .. "entzat"} data.forms["ins|indef"] = {base .. e .. e2 .. "z"} data.forms["ins|s"] = {base_pl .. "az"} data.forms["ins|p"] = {base_pl .. "ez"} data.forms["ine|indef"] = {base .. r .. "engan"} data.forms["ine|s"] = {base_pl .. "arengan"} data.forms["ine|p"] = {base_pl .. "engan"} data.forms["all|indef"] = {base .. r .. "engana"} data.forms["all|s"] = {base_pl .. "arengana"} data.forms["all|p"] = {base_pl .. "engana"} data.forms["ter|indef"] = {base .. r .. "enganaino"} data.forms["ter|s"] = {base_pl .. "arenganaino"} data.forms["ter|p"] = {base_pl .. "enganaino"} data.forms["directive|indef"] = {base .. r .. "enganantz"} data.forms["directive|s"] = {base_pl .. "arenganantz"} data.forms["directive|p"] = {base_pl .. "enganantz"} data.forms["destinative|indef"] = {base .. r .. "enganako"} data.forms["destinative|s"] = {base_pl .. "arenganako"} data.forms["destinative|p"] = {base_pl .. "enganako"} data.forms["abl|indef"] = {base .. r .. "engandik"} data.forms["abl|s"] = {base_pl .. "arengandik"} data.forms["abl|p"] = {base_pl .. "engandik"} data.forms["par|indef"] = {base .. r .. "ik"}

postprocess(args, data) return make_table(data, "st") end

function export.inanim(frame) local args = frame:getParent.args local data = { forms = {}, info = "Declension of ", categories = {}, }	local ending_text = 0 -- add the lemma form local base = mw.title.getCurrentTitle.text data.forms["absv|indef"] = {base} if args.s then data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (inanimate, singular only, ending in "	elseif args.p then		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (inanimate, plural only, ending in " else data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (inanimate, ending in "	end	-- add the prolative	data.forms["pro|indef"] = {base .. "tzat"}	if	base:sub(-2,-1) == "tz" then		data.forms["pro|indef"] = {base:sub(1,-3) .. "ztzat"}	elseif base:sub(-2,-1) == "ts" then		data.forms["pro|indef"] = {base:sub(1,-3) .. "stzat"}	elseif base:sub(-2,-1) == "tx" then		data.forms["pro|indef"] = {base:sub(1,-3) .. "xtzat"}	elseif base:sub(-1) == "t" then		data.forms["pro|indef"] = {base .. "-tzat"}	end	if args.hyph then 		data.forms["pro|indef"] = {base .. "-tzat"}	end	-- epenthetic "e" and "r", ending in vowel/-a. The vocalic ending can be forced in acronyms	local e = "e"	if base:sub(-1) == "a" then 		e = ""		ending_text = 1	elseif base:sub(-1) == "e" or base:sub(-1) == "i" or base:sub(-1) == "o" or base:sub(-1) == "u" or args.ending == "V" or args.ending == "orthV" then -- FIXME, this can be written in a cleaner way for sure		e = ""		ending_text = 2 if args.ending == "orthV" then ending_text = 5 end elseif args.ending == "orthC" then ending_text = 6 end local r = "r" if e == "e" then r = "" end -- exception for monosyllabic nouns ending in a dipthong and the word "gau" local e2 = "" if args.dip then e2 = "e" end local e3 = "" if args.gau then e3 = "e" end --modifications if a hyphen is needed if args.hyph then base = base .. "-"	end -- modifications if the word ends in -r if	base:sub(-1) == "r" then if args.tap then ending_text = 3 else base = base .. 'r' --add an r if the word ends in r			ending_text = 4 end else end -- modifications if the word ends in -a local base_pl = base if base:sub(-1) == "a" then base_pl = base:sub(1,-2) end -- write "ending in ..." if ending_text == 0 then data.info = data.info .. "consonant) "	elseif ending_text == 1 then		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-a"}, "term") .. ") " elseif ending_text == 2 then data.info = data.info .. "vowel" .. ") "	elseif ending_text == 3 then		data.info = data.info .. "tap " .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ") " elseif ending_text == 4 then data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ") "	elseif ending_text == 5 then		data.info = data.info .. "orthographical vowel) " elseif ending_text == 6 then data.info = data.info .. "orthographical consonant) "	end	if not args.s then -- ignore these forms in singular-only nouns		data.forms["absv|p"] = {base_pl .. "ak"}		data.forms["erg|indef"] = {base .. e .. "k"}		data.forms["erg|p"] = {base_pl .. "ek"}		data.forms["dat|indef"] = {base .. r .. "i"}		data.forms["dat|p"] = {base_pl .. "ei"}		data.forms["gen|indef"] = {base .. r .. "en"}		data.forms["gen|p"] = {base_pl .. "en"}		data.forms["com|indef"] = {base .. r .. "ekin"}		data.forms["com|p"] = {base_pl .. "ekin"}		data.forms["caus|indef"] = {base .. r .. "engatik"}		data.forms["caus|p"] = {base_pl .. "engatik"}		data.forms["ben|indef"] = {base .. r .. "entzat"}		data.forms["ben|p"] = {base_pl .. "entzat"}		data.forms["ins|p"] = {base_pl .. "ez"}		data.forms["ine|indef"] = {base .. e .. "tan"}		data.forms["ine|p"] = {base_pl .. "etan"}		data.forms["loc|indef"] = {base .. e .. "tako"}		data.forms["loc|s"] = {base .. e .. e3 .. "ko"} data.forms["loc|p"] = {base_pl .. "etako"} data.forms["all|indef"] = {base .. e .. "tara"} data.forms["all|s"] = {base .. e .. e3 .. "ra"} data.forms["all|p"] = {base_pl .. "etara"} data.forms["ter|indef"] = {base .. e .. "taraino"} data.forms["ter|s"] = {base .. e .. e3 .. "raino"} data.forms["ter|p"] = {base_pl .. "etaraino"} data.forms["directive|indef"] = {base .. e .. "tarantz"} data.forms["directive|s"] = {base .. e .. e3 .. "rantz"} data.forms["directive|p"] = {base_pl .. "etarantz"} data.forms["destinative|indef"] = {base .. e .. "tarako"} data.forms["destinative|s"] = {base .. e .. e3 .. "rako"} data.forms["destinative|p"] = {base_pl .. "etarako"} data.forms["abl|indef"] = {base .. e .. "tatik"} data.forms["abl|s"] = {base .. e .. e3 .. "tik"} data.forms["abl|p"] = {base_pl .. "etatik"} end data.forms["absv|s"] = {base_pl .. "a"} data.forms["erg|s"] = {base_pl .. "ak"} data.forms["dat|s"] = {base_pl .. "ari"} data.forms["gen|s"] = {base_pl .. "aren"} data.forms["com|s"] = {base_pl .. "arekin"} data.forms["caus|s"] = {base_pl .. "arengatik"} data.forms["ben|s"] = {base_pl .. "arentzat"} data.forms["ins|indef"] = {base .. e .. e2 .. e3 .. "z"} data.forms["ins|s"] = {base_pl .. "az"} data.forms["ine|s"] = {base_pl .. e .. e3 .. "an"} data.forms["par|indef"] = {base .. r .. "ik"}

postprocess(args, data) if args.s then return make_table(data, "sing") elseif args.p then table.insert(data.categories, "Basque pluralia tantum") return make_table(data, "pl") else return make_table(data, "st") end end

function export.both(frame) local args = frame:getParent.args local data = { forms = {}, info = "Declension of ", categories = {}, }	local ending_text = 0 -- add the lemma form local base = mw.title.getCurrentTitle.text data.forms["absv|indef"] = {base} if frame.args["adj"] then data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (adjective, ending in "	elseif frame.args["num"] then		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (numeral, ending in " elseif frame.args["det"] then data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (determiner, ending in "	else		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (animate and inanimate, ending in " end -- add the prolative data.forms["pro|indef"] = {base .. "tzat"} if	base:sub(-2,-1) == "tz" then data.forms["pro|indef"] = {base:sub(1,-3) .. "ztzat"} elseif base:sub(-2,-1) == "ts" then data.forms["pro|indef"] = {base:sub(1,-3) .. "stzat"} elseif base:sub(-2,-1) == "tx" then data.forms["pro|indef"] = {base:sub(1,-3) .. "xtzat"} elseif base:sub(-1) == "t" then data.forms["pro|indef"] = {base .. "-tzat"} end -- epenthetic "e" and "r", ending in vowel/-a local e = "e" if base:sub(-1) == "a" then e = "" ending_text = 1 elseif base:sub(-1) == "e" or base:sub(-1) == "i" or base:sub(-1) == "o" or base:sub(-1) == "u" then -- FIXME, this can be written in a cleaner way for sure e = "" ending_text = 2 end local r = "r" if e == "e" then r = "" end -- exception for monosyllabic nouns ending in a dipthong and the word "gau" local e2 = "" if args.dip then e2 = "e" end local e3 = "" if args.gau then e3 = "e" end -- modifications if the word ends in -r if	base:sub(-1) == "r" then if args.tap then ending_text = 3 else base = base .. 'r' --add an r if the word ends in r			ending_text = 4 end else end -- modifications if the word ends in -a local base_pl = base local base_plp = base .. "r" if base:sub(-1) == "a" then base_pl = base:sub(1,-2) end -- write "ending in ..." if ending_text == 0 then data.info = data.info .. "consonant) "	elseif ending_text == 1 then		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-a"}, "term") .. ") " elseif ending_text == 2 then data.info = data.info .. "vowel" .. ") "	elseif ending_text == 3 then		data.info = data.info .. "tap " .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ") " elseif ending_text == 4 then data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ") "	end	data.forms["absv|s"] = {base_pl .. "a"}	data.forms["absv|p"] = {base_pl .. "ak"}	data.forms["absvp|p"] = {base_plp .. "ak"}	data.forms["erg|indef"] = {base .. e .. "k"}	data.forms["erg|s"] = {base_pl .. "ak"}	data.forms["erg|p"] = {base_pl .. "ek"}	data.forms["ergp|p"] = {base_plp .. "ek"}	data.forms["dat|indef"] = {base .. r .. "i"}	data.forms["dat|s"] = {base_pl .. "ari"}	data.forms["dat|p"] = {base_pl .. "ei"}	data.forms["datp|p"] = {base_plp .. "ei"}	data.forms["gen|indef"] = {base .. r .. "en"}	data.forms["gen|s"] = {base_pl .. "aren"}	data.forms["gen|p"] = {base_pl .. "en"}	data.forms["genp|p"] = {base_plp .. "en"}	data.forms["com|indef"] = {base .. r .. "ekin"}	data.forms["com|s"] = {base_pl .. "arekin"}	data.forms["com|p"] = {base_pl .. "ekin"}	data.forms["comp|p"] = {base_plp .. "ekin"}	data.forms["caus|indef"] = {base .. r .. "engatik"}	data.forms["caus|s"] = {base_pl .. "arengatik"} data.forms["caus|p"] = {base_pl .. "engatik"} data.forms["causp|p"] = {base_plp .. "engatik"} data.forms["ben|indef"] = {base .. r .. "entzat"} data.forms["ben|s"] = {base_pl .. "arentzat"} data.forms["ben|p"] = {base_pl .. "entzat"} data.forms["benp|p"] = {base_plp .. "entzat"} data.forms["ins|indef"] = {base .. e .. e2 .. e3 .. "z"} data.forms["ins|s"] = {base_pl .. "az"} data.forms["ins|p"] = {base_pl .. "ez"} data.forms["insp|p"] = {base_plp .. "ez"} if base == "hiru" then data.forms["insp|indef"] = {"hirurez"} elseif base == "lau" then data.forms["insp|indef"] = {"laurez"} end data.forms["ine|inanimate|indef"] = {base .. e .. "tan"} data.forms["ine|inanimate|s"] = {base_pl .. e .. e3 .. "an"} data.forms["ine|inanimate|p"] = {base_pl .. "etan"} data.forms["inep|inanimate|p"] = {base_plp .. "etan"} data.forms["ine|animate|indef"] = {base .. r .. "engan"} data.forms["ine|animate|s"] = {base_pl .. "arengan"} data.forms["ine|animate|p"] = {base_pl .. "engan"} data.forms["inep|animate|p"] = {base_plp .. "engan"}

data.forms["loc|inanimate|indef"] = {base .. e .. "tako"} data.forms["loc|inanimate|s"] = {base .. e .. e3 .. "ko"} data.forms["loc|inanimate|p"] = {base_pl .. "etako"} data.forms["locp|inanimate|p"] = {base_plp .. "etako"} data.forms["all|inanimate|indef"] = {base .. e .. "tara"} data.forms["all|inanimate|s"] = {base .. e .. e3 .. "ra"} data.forms["all|inanimate|p"] = {base_pl .. "etara"} data.forms["allp|inanimate|p"] = {base_plp .. "etara"} data.forms["all|animate|indef"] = {base .. r .. "engana"} data.forms["all|animate|s"] = {base_pl .. "arengana"} data.forms["all|animate|p"] = {base_pl .. "engana"} data.forms["allp|animate|p"] = {base_plp .. "engana"}

data.forms["ter|inanimate|indef"] = {base .. e .. "taraino"} data.forms["ter|inanimate|s"] = {base .. e .. e3 .. "raino"} data.forms["ter|inanimate|p"] = {base_pl .. "etaraino"} data.forms["terp|inanimate|p"] = {base_plp .. "etaraino"} data.forms["ter|animate|indef"] = {base .. r .. "enganaino"} data.forms["ter|animate|s"] = {base_pl .. "arenganaino"} data.forms["ter|animate|p"] = {base_pl .. "enganaino"} data.forms["terp|animate|p"] = {base_plp .. "enganaino"}

data.forms["directive|inanimate|indef"] = {base .. e .. "tarantz"} data.forms["directive|inanimate|s"] = {base .. e .. e3 .. "rantz"} data.forms["directive|inanimate|p"] = {base_pl .. "etarantz"} data.forms["directivep|inanimate|p"] = {base_plp .. "etarantz"} data.forms["directive|animate|indef"] = {base .. r .. "enganantz"} data.forms["directive|animate|s"] = {base_pl .. "arenganantz"} data.forms["directive|animate|p"] = {base_pl .. "enganantz"} data.forms["directivep|animate|p"] = {base_plp .. "enganantz"}

data.forms["destinative|inanimate|indef"] = {base .. e .. "tarako"} data.forms["destinative|inanimate|s"] = {base .. e .. e3 .. "rako"} data.forms["destinative|inanimate|p"] = {base_pl .. "etarako"} data.forms["destinativep|inanimate|p"] = {base_plp .. "etarako"} data.forms["destinative|animate|indef"] = {base .. r .. "enganako"} data.forms["destinative|animate|s"] = {base_pl .. "arenganako"} data.forms["destinative|animate|p"] = {base_pl .. "enganako"} data.forms["destinativep|animate|p"] = {base_plp .. "enganako"}

data.forms["abl|inanimate|indef"] = {base .. e .. "tatik"} data.forms["abl|inanimate|s"] = {base .. e .. e3 .. "tik"} data.forms["abl|inanimate|p"] = {base_pl .. "etatik"} data.forms["ablp|inanimate|p"] = {base_plp .. "etatik"} data.forms["abl|animate|indef"] = {base .. r .. "engandik"} data.forms["abl|animate|s"] = {base_pl .. "arengandik"} data.forms["abl|animate|p"] = {base_pl .. "engandik"} data.forms["ablp|animate|p"] = {base_plp .. "engandik"}

data.forms["par|indef"] = {base .. r .. "ik"}

postprocess(args, data) if frame.args.num and (base == "hiru" or base == "lau") then return make_table(data, "hiru-lau") elseif frame.args.det then if args.p then return make_table(data, "both-pl") else return make_table(data, "both-indef") end else return make_table(data, "both") end end

-- Inflection functions (proper nouns) function export.proper_anim(frame) local args = frame:getParent.args local data = { forms = {}, info = "Declension of ", categories = {}, }	local ending_text = 0 -- add the lemma form local base = mw.title.getCurrentTitle.text if args.s then data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (animate with article, ending in "		base = args[1]	else		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (animate, ending in " end data.forms["absv|indef"] = {base}

-- add the prolative data.forms["pro|indef"] = {base .. "tzat"} if	base:sub(-2,-1) == "tz" then data.forms["pro|indef"] = {base:sub(1,-3) .. "ztzat"} elseif base:sub(-2,-1) == "ts" then data.forms["pro|indef"] = {base:sub(1,-3) .. "stzat"} elseif base:sub(-2,-1) == "tx" then data.forms["pro|indef"] = {base:sub(1,-3) .. "xtzat"} elseif base:sub(-1) == "t" then data.forms["pro|indef"] = {base .. "-tzat"} end -- epenthetic "e" and "r", ending in vowel/-a local e = "e" if base:sub(-1) == "a" then e = "" ending_text = 1 elseif base:sub(-1) == "e" or base:sub(-1) == "i" or base:sub(-1) == "o" or base:sub(-1) == "u" then -- FIXME, this can be written in a cleaner way for sure e = "" ending_text = 2 end local r = "r" if e == "e" then r = "" end -- modifications if the word ends in -r if	base:sub(-1) == "r" then base = base .. "r" ending_text = 4 else end -- write "ending in ..." if ending_text == 0 then data.info = data.info .. "consonant) "	elseif ending_text == 1 then		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-a"}, "term") .. ") " elseif ending_text == 2 then data.info = data.info .. "vowel" .. ") "	elseif ending_text == 3 then		data.info = data.info .. "tap " .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ") " elseif ending_text == 4 then data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ") "	end

if args.s then data.forms["absv|s"] = {base .. "a"} data.forms["erg|s"] = {base .. "ak"} data.forms["dat|s"] = {base .. "ari"} data.forms["gen|s"] = {base .. "aren"} data.forms["com|s"] = {base .. "arekin"} data.forms["caus|s"] = {base .. "arengatik"} data.forms["ben|s"] = {base .. "arentzat"} data.forms["ins|s"] = {base .. "az"} data.forms["ine|s"] = {base .. "arengan"} data.forms["all|s"] = {base .. "arengana"} data.forms["ter|s"] = {base .. "arenganaino"} data.forms["directive|s"] = {base .. "arenganantz"} data.forms["destinative|s"] = {base .. "arenganako"} data.forms["abl|s"] = {base .. "arengandik"} else data.forms["erg|indef"] = {base .. e .. "k"} data.forms["dat|indef"] = {base .. r .. "i"} data.forms["gen|indef"] = {base .. r .. "en"} data.forms["com|indef"] = {base .. r .. "ekin"} data.forms["caus|indef"] = {base .. r .. "engatik"} data.forms["ben|indef"] = {base .. r .. "entzat"} data.forms["ins|indef"] = {base .. e .. "z"} data.forms["ine|indef"] = {base .. r .. "engan"} data.forms["all|indef"] = {base .. r .. "engana"} data.forms["ter|indef"] = {base .. r .. "enganaino"} data.forms["directive|indef"] = {base .. r .. "enganantz"} data.forms["destinative|indef"] = {base .. r .. "enganako"} data.forms["abl|indef"] = {base .. r .. "engandik"} end data.forms["par|indef"] = {base .. r .. "ik"}

if args.s then return make_table(data, "sing") else return make_table(data, "ind") end end

function export.proper_inanim(frame) local args = frame:getParent.args local data = { forms = {}, info = "Declension of ", categories = {}, }	local ending_text = 0 -- add the lemma form local base = mw.title.getCurrentTitle.text if args.s then data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (inanimate with article, ending in "		base = args[1]	elseif args.p then		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (inanimate, plural only, ending in " base = args[1] else data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (inanimate, ending in "	end	data.forms["absv|indef"] = {base}

-- add the prolative data.forms["pro|indef"] = {base .. "tzat"} if	base:sub(-2,-1) == "tz" then data.forms["pro|indef"] = {base:sub(1,-3) .. "ztzat"} elseif base:sub(-2,-1) == "ts" then data.forms["pro|indef"] = {base:sub(1,-3) .. "stzat"} elseif base:sub(-2,-1) == "tx" then data.forms["pro|indef"] = {base:sub(1,-3) .. "xtzat"} elseif base:sub(-1) == "t" then data.forms["pro|indef"] = {base .. "-tzat"} end if args.hyph and args.ending == "V" then data.forms["pro|indef"] = {base .. "-tzat"} end -- epenthetic "e" and "r", ending in vowel/-a. The vocalic ending can be forced in acronyms local e = "e" if base:sub(-1) == "a" or args.ending == "A" then e = "" ending_text = 1 elseif base:sub(-1) == "e" or base:sub(-1) == "i" or base:sub(-1) == "o" or base:sub(-1) == "u" or args.ending == "V" then -- FIXME, this can be written in a cleaner way for sure e = "" ending_text = 2 end local r = "r" if e == "e" then r = "" end --modifications if a hyphen is needed if args.hyph then base = base .. "-"	end -- modifications if the word ends in -r if	base:sub(-1) == "r" then if args.tap then ending_text = 3 else base = base .. 'r' --add an r if the word ends in r			ending_text = 4 end else end -- modifications if the word ends in -a local base_pl = base if base:sub(-1) == "a" then base_pl = base:sub(1,-2) end -- write "ending in ..." if ending_text == 0 then data.info = data.info .. "consonant) "	elseif ending_text == 1 then		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-a"}, "term") .. ") " elseif ending_text == 2 then data.info = data.info .. "vowel" .. ") "	elseif ending_text == 3 then		data.info = data.info .. "tap " .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ") " elseif ending_text == 4 then data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ") "	end	data.forms["par|indef"] = {base .. r .. "ik"}

if args.p then data.forms["absv|p"] = {base_pl .. "ak"} data.forms["erg|p"] = {base_pl .. "ek"} data.forms["dat|p"] = {base_pl .. "ei"} data.forms["gen|p"] = {base_pl .. "en"} data.forms["com|p"] = {base_pl .. "ekin"} data.forms["caus|p"] = {base_pl .. "engatik"} data.forms["ben|p"] = {base_pl .. "entzat"} data.forms["ine|p"] = {base_pl .. "etan"} data.forms["ins|p"] = {base_pl .. "ez"} data.forms["loc|p"] = {base_pl .. "etako"} data.forms["all|p"] = {base_pl .. "etara"} data.forms["ter|p"] = {base_pl .. "etaraino"} data.forms["directive|p"] = {base_pl .. "etarantz"} data.forms["destinative|p"] = {base_pl .. "etarako"} data.forms["abl|p"] = {base_pl .. "etatik"} elseif args.s then data.forms["absv|s"] = {base_pl .. "a"} data.forms["erg|s"] = {base_pl .. "ak"} data.forms["dat|s"] = {base_pl .. "ari"} data.forms["gen|s"] = {base_pl .. "aren"} data.forms["com|s"] = {base_pl .. "arekin"} data.forms["caus|s"] = {base_pl .. "arengatik"} data.forms["ben|s"] = {base_pl .. "arentzat"} data.forms["ins|s"] = {base_pl .. "az"} data.forms["ine|s"] = {base_pl .. e .. "an"} data.forms["loc|s"] = {base .. e .. "ko"} data.forms["all|s"] = {base .. e .. "ra"} data.forms["ter|s"] = {base .. e .. "raino"} data.forms["directive|s"] = {base .. e .. "rantz"} data.forms["destinative|s"] = {base .. e .. "rako"} data.forms["abl|s"] = {base .. e .. "tik"} else data.forms["erg|indef"] = {base .. e .. "k"} data.forms["dat|indef"] = {base .. r .. "i"} data.forms["gen|indef"] = {base .. r .. "en"} data.forms["com|indef"] = {base .. r .. "ekin"} data.forms["caus|indef"] = {base .. r .. "engatik"} data.forms["ben|indef"] = {base .. r .. "entzat"} data.forms["ins|indef"] = {base .. e .. "z"} data.forms["ine|indef"] = {base .. e .. "n"} data.forms["loc|indef"] = {base .. e .. "ko"} data.forms["all|indef"] = {base .. e .. "ra"} data.forms["ter|indef"] = {base .. e .. "raino"} data.forms["directive|indef"] = {base .. e .. "rantz"} data.forms["destinative|indef"] = {base .. e .. "rako"} data.forms["abl|indef"] = {base .. e .. "tik"} if	base:sub(-2,-1) == "tz" then data.forms["loc|indef"] = {base:sub(1,-3) .. "zko"} data.forms["abl|indef"] = {base:sub(1,-3) .. "ztik"} elseif base:sub(-1,-1) == "z" or base:sub(-1,-1) == "s" then data.forms["loc|indef"] = {base .. "ko"} data.forms["abl|indef"] = {base .. "tik"} elseif base:sub(-1,-1) == "r" then data.forms["loc|indef"] = {base:sub(1,-2) .. "ko"} data.forms["abl|indef"] = {base:sub(1,-2) .. "tik"} elseif base:sub(-1,-1) == "n" or base:sub(-1,-1) == "l" then data.forms["loc|indef"] = {base .. "go"} data.forms["abl|indef"] = {base .. "dik"} end end if args.s then return make_table(data, "sing") elseif args.p then return make_table(data, "pl") else return make_table(data, "ind") end end

function export.proper_both(frame) local args = frame:getParent.args local data = { forms = {}, info = "Declension of ", categories = {}, }	local ending_text = 0 -- add the lemma form local base = mw.title.getCurrentTitle.text if args.s then data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (animate and inanimate, singular only, ending in "		base = args[1]	elseif args.p then		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (animate and inanimate, plural only, ending in " base = args[1] else data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (animate and inanimate, ending in "	end	data.forms["absv|indef"] = {base}

-- add the prolative data.forms["pro|indef"] = {base .. "tzat"} if	base:sub(-2,-1) == "tz" then data.forms["pro|indef"] = {base:sub(1,-3) .. "ztzat"} elseif base:sub(-2,-1) == "ts" then data.forms["pro|indef"] = {base:sub(1,-3) .. "stzat"} elseif base:sub(-2,-1) == "tx" then data.forms["pro|indef"] = {base:sub(1,-3) .. "xtzat"} elseif base:sub(-1) == "t" then data.forms["pro|indef"] = {base .. "-tzat"} end if args.hyph and args.ending == "V" then data.forms["pro|indef"] = {base .. "-tzat"} end -- epenthetic "e" and "r", ending in vowel/-a. The vocalic ending can be forced in acronyms local e = "e" if base:sub(-1) == "a" then e = "" ending_text = 1 elseif base:sub(-1) == "e" or base:sub(-1) == "i" or base:sub(-1) == "o" or base:sub(-1) == "u" or args.ending == "V" then -- FIXME, this can be written in a cleaner way for sure e = "" ending_text = 2 end local r = "r" if e == "e" then r = "" end --modifications if a hyphen is needed if args.hyph then base = base .. "-"	end -- modifications if the word ends in -r if	base:sub(-1) == "r" then if args.tap then ending_text = 3 else base = base .. 'r' --add an r if the word ends in r			ending_text = 4 end end -- write "ending in ..." if ending_text == 0 then data.info = data.info .. "consonant) "	elseif ending_text == 1 then		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-a"}, "term") .. ") " elseif ending_text == 2 then data.info = data.info .. "vowel" .. ") "	elseif ending_text == 3 then		data.info = data.info .. "tap " .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ") " elseif ending_text == 4 then data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ") "	end	data.forms["par|indef"] = {base .. r .. "ik"}

data.forms["erg|indef"] = {base .. e .. "k"} data.forms["dat|indef"] = {base .. r .. "i"} data.forms["gen|indef"] = {base .. r .. "en"} data.forms["com|indef"] = {base .. r .. "ekin"} data.forms["caus|indef"] = {base .. r .. "engatik"} data.forms["ben|indef"] = {base .. r .. "entzat"} data.forms["ins|indef"] = {base .. e .. "z"} data.forms["ine|inanimate|indef"] = {base .. e .. "n"} data.forms["loc|inanimate|indef"] = {base .. e .. "ko"} data.forms["all|inanimate|indef"] = {base .. e .. "ra"} data.forms["ter|inanimate|indef"] = {base .. e .. "raino"} data.forms["directive|inanimate|indef"] = {base .. e .. "rantz"} data.forms["destinative|inanimate|indef"] = {base .. e .. "rako"} data.forms["abl|inanimate|indef"] = {base .. e .. "tik"} data.forms["ine|animate|indef"] = {base .. r .. "engan"} data.forms["all|animate|indef"] = {base .. r .. "engana"} data.forms["ter|animate|indef"] = {base .. r .. "enganaino"} data.forms["directive|animate|indef"] = {base .. r .. "enganantz"} data.forms["destinative|animate|indef"] = {base .. r .. "enganako"} data.forms["abl|animate|indef"] = {base .. r .. "engandik"} if	base:sub(-2,-1) == "tz" then data.forms["loc|inanimate|indef"] = {base:sub(1,-3) .. "zko"} data.forms["abl|inanimate|indef"] = {base:sub(1,-3) .. "ztik"} elseif base:sub(-1,-1) == "z" or base:sub(-1,-1) == "s" then data.forms["loc|inanimate|indef"] = {base .. "ko"} data.forms["abl|inanimate|indef"] = {base .. "tik"} elseif base:sub(-1,-1) == "r" then data.forms["loc|inanimate|indef"] = {base:sub(1,-2) .. "ko"} data.forms["abl|inanimate|indef"] = {base:sub(1,-2) .. "tik"} elseif base:sub(-1,-1) == "n" or base:sub(-1,-1) == "l" then data.forms["loc|inanimate|indef"] = {base .. "go"} data.forms["abl|inanimate|indef"] = {base .. "dik"} end return make_table(data, "both-indef") end

return export