Module:ibe-nouns: Difference between revisions

From Linguifex
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(9 intermediate revisions by the same user not shown)
Line 4: Line 4:
local export = {}
local export = {}


--[[ local lang = require("Module:languages").getByCode("") ]]
local lang = require("Module:languages").getByCode("ibe-pro")




Line 49: Line 49:
local args = require("Module:parameters").process(frame:getParent().args, params)
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {forms = {}, info = "feminine ā-stem", categories = "Proto-Iberian ā-stem nouns"}
local data = {forms = {}, info = "feminine ā-stem", categories = {lang:getCanonicalName() .. " ā-stem nouns"}}
data.forms["nom_sg"] = {args[1] .. "ā"}
data.forms["nom_sg"] = {args[1] .. "ā"}
Line 76: Line 76:
postprocess(args, data)
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories)
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
end


Line 90: Line 90:
local args = require("Module:parameters").process(frame:getParent().args, params)
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {forms = {}, info = "masculine/feminine/neuter consonant stem", categories = "Proto-Iberian consonant stem nouns"}
local data = {forms = {}, info = "masculine/feminine/neuter consonant stem", categories = {lang:getCanonicalName() .. " consonant stem nouns"}}
data.forms["nom_sg"] = {args[1] .. "s"}
data.forms["nom_sg"] = {args[1] .. "s"}
Line 104: Line 104:
data.forms["acc_du"] = {args[1] .. "e"}
data.forms["acc_du"] = {args[1] .. "e"}
data.forms["gen_du"] = {args[1] .. "om"}
data.forms["gen_du"] = {args[1] .. "om"}
data.forms["dat_du"] = {args[1] .. "mos"}
data.forms["dat_du"] = {args[1] .. "emos"}
data.forms["com_du"] = {args[1] .. "vi(s)"}
data.forms["com_du"] = {args[1] .. "evi(s)"}
data.forms["nom_pl"] = {args[1] .. "es"}
data.forms["nom_pl"] = {args[1] .. "es"}
Line 111: Line 111:
data.forms["acc_pl"] = {args[1] .. "ans"}
data.forms["acc_pl"] = {args[1] .. "ans"}
data.forms["gen_pl"] = {args[1] .. "om"}
data.forms["gen_pl"] = {args[1] .. "om"}
data.forms["dat_pl"] = {args[1] .. "mos"}
data.forms["dat_pl"] = {args[1] .. "emos"}
data.forms["com_pl"] = {args[1] .. "vi(s)"}
data.forms["com_pl"] = {args[1] .. "evi(s)"}
end
end
postprocess(args, data)
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories)
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
end


Line 131: Line 131:
local args = require("Module:parameters").process(frame:getParent().args, params)
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {forms = {}, info = "masculine/feminine i-stem", categories = "Proto-Iberian i-stem nouns"}
local data = {forms = {}, info = "masculine/feminine i-stem", categories = {lang:getCanonicalName() .. " i-stem nouns"}}
data.forms["nom_sg"] = {args[1] .. "is"}
data.forms["nom_sg"] = {args[1] .. "is"}
Line 158: Line 158:
postprocess(args, data)
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories)
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
end


Line 172: Line 172:
local args = require("Module:parameters").process(frame:getParent().args, params)
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {forms = {}, info = "neuter i-stem", categories = "Proto-Iberian i-stem nouns"}
local data = {forms = {}, info = "neuter i-stem", categories = {lang:getCanonicalName() .. " i-stem nouns"}}
data.forms["nom_sg"] = {args[1]}
data.forms["nom_sg"] = {args[1]}
Line 199: Line 199:
postprocess(args, data)
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories)
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
end


Line 214: Line 214:
-- local delabial = mw.ustring.gsub(args[1], "ʷ$", "")
-- local delabial = mw.ustring.gsub(args[1], "ʷ$", "")
local data = {forms = {}, info = "masculine/feminine n-stem", categories = "Proto-Iberian n-stem nouns"}
local data = {forms = {}, info = "masculine/feminine n-stem", categories = {lang:getCanonicalName() .. " n-stem nouns"}}
data.forms["nom_sg"] = {args[1] .. "ō"}
data.forms["nom_sg"] = {args[1] .. "ō"}
Line 241: Line 241:
postprocess(args, data)
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories)
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
end


Line 255: Line 255:
local args = require("Module:parameters").process(frame:getParent().args, params)
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {forms = {}, info = "neuter n-stem", categories = "Proto-Iberian n-stem nouns"}
local data = {forms = {}, info = "neuter n-stem", categories = {lang:getCanonicalName() .. " n-stem nouns"}}
data.forms["nom_sg"] = {args[1] .. "an"}
data.forms["nom_sg"] = {args[1] .. "an"}
Line 282: Line 282:
postprocess(args, data)
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories)
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
end


Line 297: Line 297:
-- local delabial = mw.ustring.gsub(args[1], "ʷ$", "")
-- local delabial = mw.ustring.gsub(args[1], "ʷ$", "")
local data = {forms = {}, info = "masculine o-stem", categories = "Proto-Iberian o-stem nouns"}
local data = {forms = {}, info = "masculine o-stem", categories = {lang:getCanonicalName() .. " o-stem nouns"}}
data.forms["nom_sg"] = {args[1] .. "os"}
data.forms["nom_sg"] = {args[1] .. "os"}
Line 323: Line 323:
postprocess(args, data)
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories, "und")
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
end


Line 338: Line 338:
-- local delabial = mw.ustring.gsub(args[1], "ʷ$", "")
-- local delabial = mw.ustring.gsub(args[1], "ʷ$", "")
local data = {forms = {}, info = "neuter o-stem", categories =  "Proto-Iberian o-stem nouns"}
local data = {forms = {}, info = "neuter o-stem", categories =  {lang:getCanonicalName() .. " o-stem nouns"}}
data.forms["nom_sg"] = {args[1] .. "om"}
data.forms["nom_sg"] = {args[1] .. "om"}
Line 365: Line 365:
postprocess(args, data)
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories)
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
end


Line 379: Line 379:
local args = require("Module:parameters").process(frame:getParent().args, params)
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {forms = {}, info = "masculine/feminine/neuter r-stem", categories = "Proto-Iberian r-stem nouns"}
local data = {forms = {}, info = "masculine/feminine/neuter r-stem", categories = {lang:getCanonicalName() .. " r-stem nouns"}}
data.forms["nom_sg"] = {args[1] .. "er"}
data.forms["nom_sg"] = {args[1] .. "er"}
Line 406: Line 406:
postprocess(args, data)
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories)
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
end


Line 420: Line 420:
local args = require("Module:parameters").process(frame:getParent().args, params)
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {forms = {}, info = "masculine/feminine u-stem", categories = "Proto-Iberian u-stem nouns"}
local data = {forms = {}, info = "masculine/feminine u-stem", categories = {lang:getCanonicalName() .. " u-stem nouns"}}
data.forms["nom_sg"] = {args[1] .. "us"}
data.forms["nom_sg"] = {args[1] .. "us"}
Line 447: Line 447:
postprocess(args, data)
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories)
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
end


Line 460: Line 460:
local args = require("Module:parameters").process(frame:getParent().args, params)
local args = require("Module:parameters").process(frame:getParent().args, params)
if string.find(args[1], "a") then
    vowel = mw.ustring.gsub(args[1], "ar$", "r")
elseif string.find(args[1], "e") then
    vowel = mw.ustring.gsub(args[1], "er$", "r")
elseif string.find(args[1], "i") then
    vowel = mw.ustring.gsub(args[1], "ir$", "r")
elseif string.find(args[1], "o") then
    vowel = mw.ustring.gsub(args[1], "or$", "r")
elseif string.find(args[1], "u") then
    vowel = mw.ustring.gsub(args[1], "ur$", "r")
end
local data = {forms = {}, info = "neuter u-stem", categories = "Proto-Iberian u-stem nouns"}
local data = {forms = {}, info = "neuter u-stem", categories = {lang:getCanonicalName() .. " u-stem nouns"}}
data.forms["nom_sg"] = {args[1] .. "u"}
data.forms["nom_sg"] = {args[1] .. "u"}
data.forms["voc_sg"] = {args[1] .. "u"}
data.forms["voc_sg"] = {args[1] .. "u"}
data.forms["acc_sg"] = {args[1] .. "u"}
data.forms["acc_sg"] = {args[1] .. "u"}
data.forms["gen_sg"] = {args[1] .. "eus"}
data.forms["gen_sg"] = {vowel .. "eus"}
data.forms["dat_sg"] = {args[1] .. "ewei"}
data.forms["dat_sg"] = {vowel .. "ewei"}
data.forms["com_sg"] = {args[1] .. "ū"}
data.forms["com_sg"] = {args[1] .. "ū"}


if not args.nopl then
if not args.nopl then
data.forms["nom_du"] = {args[1] .. "ī"}
data.forms["nom_du"] = {args[1] .. ""}
data.forms["voc_du"] = {args[1] .. "ī"}
data.forms["voc_du"] = {args[1] .. ""}
data.forms["acc_du"] = {args[1] .. "ī"}
data.forms["acc_du"] = {args[1] .. ""}
data.forms["gen_du"] = {args[1] .. "ewom"}
data.forms["gen_du"] = {vowel .. "ewom"}
data.forms["dat_du"] = {args[1] .. "umos"}
data.forms["dat_du"] = {vowel .. "umos"}
data.forms["com_du"] = {args[1] .. "uvi(s)"}
data.forms["com_du"] = {args[1] .. "uvi(s)"}
Line 481: Line 492:
data.forms["voc_pl"] = {args[1] .. "ū"}
data.forms["voc_pl"] = {args[1] .. "ū"}
data.forms["acc_pl"] = {args[1] .. "ū"}
data.forms["acc_pl"] = {args[1] .. "ū"}
data.forms["gen_pl"] = {args[1] .. "ewom"}
data.forms["gen_pl"] = {vowel .. "ewom"}
data.forms["dat_pl"] = {args[1] .. "umos"}
data.forms["dat_pl"] = {vowel .. "umos"}
data.forms["com_pl"] = {args[1] .. "uvi(s)"}
data.forms["com_pl"] = {args[1] .. "uvi(s)"}
end
end
Line 488: Line 499:
postprocess(args, data)
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories, "und")
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
end


Line 527: Line 538:
for key, subform in ipairs(form) do
for key, subform in ipairs(form) do
table.insert(ret, m_links.full_link({lang = "und", alt = "*" .. subform}))
table.insert(ret, m_links.full_link({lang = lang, alt = "" .. subform}))
end
end
Line 538: Line 549:
local wikicode = {}
local wikicode = {}
table.insert(wikicode, "{| class=\"inflection-table vsSwitcher\" data-toggle-category=\"inflection\" style=\"background: #FAFAFA; border: 1px solid #d0d0d0; text-align: left;\" cellspacing=\"1\" cellpadding=\"2\"")
table.insert(wikicode, "{| class=\"inflection-table vsSwitcher mw-collapsible mw-collapsed\" data-toggle-category=\"inflection\" style=\"background: #FAFAFA; border: 1px solid #d0d0d0; text-align: left;\" cellspacing=\"1\" cellpadding=\"2\"")
table.insert(wikicode, "|- style=\"background: #CCCCFF;\"\n! class=\"vsToggleElement\" style=\"min-width: 41em;\" colspan=\"" .. (#numbers + 1) .. "\" | {{{info}}}")
table.insert(wikicode, "|- style=\"background: #FFCCCC;\"\n! class=\"vsToggleElement\" style=\"min-width: 41em;\" colspan=\"" .. (#numbers + 1) .. "\" | {{{info}}}")
table.insert(wikicode, "|- class=\"vsHide\" style=\"background: #CCCCFF;\"")
table.insert(wikicode, "|- class=\"vsHide\" style=\"background: #FFCCCC;\"")
table.insert(wikicode, "!")
table.insert(wikicode, "!")
for _, number in ipairs(numbers) do
for _, number in ipairs(numbers) do
table.insert(wikicode, "! style=\"min-width: 11em; background: #CCCCFF;\" | " .. names[number])
table.insert(wikicode, "! style=\"min-width: 11em; background: #FFCCCC;\" | " .. names[number])
end
end
for _, case in ipairs(cases) do
for _, case in ipairs(cases) do
table.insert(wikicode, "|- class=\"vsHide\" style=\"background-color: #F2F2FF;\"\n! style=\"min-width: 8em; background-color: #E6E6FF;\" | " .. names[case])
table.insert(wikicode, "|- class=\"vsHide\" style=\"background-color: #FFF2F2;\"\n! style=\"min-width: 8em; background-color: #FFE6E6;\" | " .. names[case])
for _, number in ipairs(numbers) do
for _, number in ipairs(numbers) do

Latest revision as of 21:24, 5 September 2022



local m_utilities = require("Module:utilities")
local m_links = require("Module:links")

local export = {}

local lang = require("Module:languages").getByCode("ibe-pro")


local function postprocess(args, data)
	data.sg = true
	data.du = true
	data.pl = true
	
	if args["n"] then
		if not mw.ustring.find(args["n"], "s") then
			data.sg = false
		end
		
		if not mw.ustring.find(args["n"], "d") then
			data.du = false
		end
		
		if not mw.ustring.find(args["n"], "p") then
			data.pl = false
		end
	end
	
	for key, form in pairs(data.forms) do
		-- Do not show singular, dual or plural forms for nouns that don't have them
		if (not data.sg and key:find("_sg$")) or (not data.du and key:find("_du$")) or (not data.pl and key:find("_pl$")) then
			form = nil
		end
		
		data.forms[key] = form
	end
end


-- Inflection functions

export["a-f"] = function(frame)
	local params = {
		[1] = {required = true, default = "{{{1}}}"},
		
		["n"] = {},
		["nopl"] = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local data = {forms = {}, info = "feminine ā-stem", categories = {lang:getCanonicalName() .. " ā-stem nouns"}}
	
	data.forms["nom_sg"] = {args[1] .. "ā"}
	data.forms["voc_sg"] = {args[1] .. "e"}
	data.forms["acc_sg"] = {args[1] .. "ām"}
	data.forms["gen_sg"] = {args[1] .. "ās"}
	data.forms["dat_sg"] = {args[1] .. "āe"}
	data.forms["com_sg"] = {args[1] .. "āē"}

	if not args.nopl then	
		data.forms["nom_du"] = {args[1] .. "aī"}
		data.forms["voc_du"] = {args[1] .. "aī"}
		data.forms["acc_du"] = {args[1] .. "aī"}
		data.forms["gen_du"] = {args[1] .. "ous"}
		data.forms["dat_du"] = {args[1] .. "āvām"}
		data.forms["com_du"] = {args[1] .. "āvām"}
		
		data.forms["nom_pl"] = {args[1] .. "ās"}
		data.forms["voc_pl"] = {args[1] .. "ās"}
		data.forms["acc_pl"] = {args[1] .. "āns"}
		data.forms["gen_pl"] = {args[1] .. "om"}
		data.forms["dat_pl"] = {args[1] .. "āvos"}
		data.forms["com_pl"] = {args[1] .. "āvis"}
	end
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end

export["cons-mf"] = function(frame)
	local params = {
		[1] = {required = true, default = "{{{1}}}"},
		[2] = {},
		
		["n"] = {},
		["nopl"] = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local data = {forms = {}, info = "masculine/feminine/neuter consonant stem", categories = {lang:getCanonicalName() .. " consonant stem nouns"}}
	
	data.forms["nom_sg"] = {args[1] .. "s"}
	data.forms["voc_sg"] = {args[1]}
	data.forms["acc_sg"] = {args[1] .. "am"}
	data.forms["gen_sg"] = {args[1] .. "es"}
	data.forms["dat_sg"] = {args[1] .. "e"}
	data.forms["com_sg"] = {args[1] .. "ē"}

	if not args.nopl then	
		data.forms["nom_du"] = {args[1] .. "e"}
		data.forms["voc_du"] = {args[1] .. "e"}
		data.forms["acc_du"] = {args[1] .. "e"}
		data.forms["gen_du"] = {args[1] .. "om"}
		data.forms["dat_du"] = {args[1] .. "emos"}
		data.forms["com_du"] = {args[1] .. "evi(s)"}
		
		data.forms["nom_pl"] = {args[1] .. "es"}
		data.forms["voc_pl"] = {args[1] .. "es"}
		data.forms["acc_pl"] = {args[1] .. "ans"}
		data.forms["gen_pl"] = {args[1] .. "om"}
		data.forms["dat_pl"] = {args[1] .. "emos"}
		data.forms["com_pl"] = {args[1] .. "evi(s)"}
	end
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end


export["i-mf"] = function(frame)
	local params = {
		[1] = {required = true, default = "{{{1}}}"},
		
		["n"] = {},
		["nopl"] = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local data = {forms = {}, info = "masculine/feminine i-stem", categories = {lang:getCanonicalName() .. " i-stem nouns"}}
	
	data.forms["nom_sg"] = {args[1] .. "is"}
	data.forms["voc_sg"] = {args[1] .. "e"}
	data.forms["acc_sg"] = {args[1] .. "im"}
	data.forms["gen_sg"] = {args[1] .. "ois"}
	data.forms["dat_sg"] = {args[1] .. "eie"}
	data.forms["com_sg"] = {args[1] .. "iē"}

	if not args.nopl then	
		data.forms["nom_du"] = {args[1] .. "ī"}
		data.forms["voc_du"] = {args[1] .. "ī"}
		data.forms["acc_du"] = {args[1] .. "ī"}
		data.forms["gen_du"] = {args[1] .. "jom"}
		data.forms["dat_du"] = {args[1] .. "ivos"}
		data.forms["com_du"] = {args[1] .. "ivis"}
		
		data.forms["nom_pl"] = {args[1] .. "eies"}
		data.forms["voc_pl"] = {args[1] .. "eies"}
		data.forms["acc_pl"] = {args[1] .. "ins"}
		data.forms["gen_pl"] = {args[1] .. "jom"}
		data.forms["dat_pl"] = {args[1] .. "ivos"}
		data.forms["com_pl"] = {args[1] .. "ivis"}
	end
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end


export["i-n"] = function(frame)
	local params = {
		[1] = {required = true, default = "{{{1}}}"},
		
		["n"] = {},
		["nopl"] = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local data = {forms = {}, info = "neuter i-stem", categories = {lang:getCanonicalName() .. " i-stem nouns"}}
	
	data.forms["nom_sg"] = {args[1]}
	data.forms["voc_sg"] = {args[1]}
	data.forms["acc_sg"] = {args[1]}
	data.forms["gen_sg"] = {args[1] .. "ois"}
	data.forms["dat_sg"] = {args[1] .. "eie"}
	data.forms["com_sg"] = {args[1] .. "iē"}

	if not args.nopl then	
		data.forms["nom_du"] = {args[1] .. "ī"}
		data.forms["voc_du"] = {args[1] .. "ī"}
		data.forms["acc_du"] = {args[1] .. "ī"}
		data.forms["gen_du"] = {args[1] .. "jom"}
		data.forms["dat_du"] = {args[1] .. "ivos"}
		data.forms["com_du"] = {args[1] .. "ivis"}
		
		data.forms["nom_pl"] = {args[1] .. "ī"}
		data.forms["voc_pl"] = {args[1] .. "ī"}
		data.forms["acc_pl"] = {args[1] .. "ī"}
		data.forms["gen_pl"] = {args[1] .. "jom"}
		data.forms["dat_pl"] = {args[1] .. "ivos"}
		data.forms["com_pl"] = {args[1] .. "ivis"}
	end
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end


export["n-mf"] = function(frame)
	local params = {
		[1] = {required = true, default = "{{{1}}}"},
		
		["n"] = {},
		["nopl"] = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
--	local delabial = mw.ustring.gsub(args[1], "ʷ$", "")
	
	local data = {forms = {}, info = "masculine/feminine n-stem", categories = {lang:getCanonicalName() .. " n-stem nouns"}}
	
	data.forms["nom_sg"] = {args[1] .. "ō"}
	data.forms["voc_sg"] = {args[1] .. "on"}
	data.forms["acc_sg"] = {args[1] .. "onam"}
	data.forms["gen_sg"] = {args[1] .. "ōnes"}
	data.forms["dat_sg"] = {args[1] .. "one"}
	data.forms["com_sg"] = {args[1] .. "ōne"}

	if not args.nopl then	
		data.forms["nom_du"] = {args[1] .. "one"}
		data.forms["voc_du"] = {args[1] .. "one"}
		data.forms["acc_du"] = {args[1] .. "one"}
		data.forms["gen_du"] = {args[1] .. "ōnom"}
		data.forms["dat_du"] = {args[1] .. "ōmos"}
		data.forms["com_du"] = {args[1] .. "ōvi(s)"}
		
		data.forms["nom_pl"] = {args[1] .. "ones"}
		data.forms["voc_pl"] = {args[1] .. "ones"}
		data.forms["acc_pl"] = {args[1] .. "onans"}
		data.forms["gen_pl"] = {args[1] .. "ōnom"}
		data.forms["dat_pl"] = {args[1] .. "ōmos"}
		data.forms["com_pl"] = {args[1] .. "ōvi(s)"}
	end
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end


export["n-n"] = function(frame)
	local params = {
		[1] = {required = true, default = "{{{1}}}"},
		
		["n"] = {},
		["nopl"] = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local data = {forms = {}, info = "neuter n-stem", categories = {lang:getCanonicalName() .. " n-stem nouns"}}
	
	data.forms["nom_sg"] = {args[1] .. "an"}
	data.forms["voc_sg"] = {args[1] .. "an"}
	data.forms["acc_sg"] = {args[1] .. "an"}
	data.forms["gen_sg"] = {args[1] .. "an(e)s"}
	data.forms["dat_sg"] = {args[1] .. "ane"}
	data.forms["com_sg"] = {args[1] .. "ane"}

	if not args.nopl then	
		data.forms["nom_du"] = {args[1] .. "anī"}
		data.forms["voc_du"] = {args[1] .. "anī"}
		data.forms["acc_du"] = {args[1] .. "anī"}
		data.forms["gen_du"] = {args[1] .. "ōnom"}
		data.forms["dat_du"] = {args[1] .. "ōmos"}
		data.forms["com_du"] = {args[1] .. "ōvi(s)"}
		
		data.forms["nom_pl"] = {args[1] .. "anā"}
		data.forms["voc_pl"] = {args[1] .. "anā"}
		data.forms["acc_pl"] = {args[1] .. "anā"}
		data.forms["gen_pl"] = {args[1] .. "ōnom"}
		data.forms["dat_pl"] = {args[1] .. "ōmos"}
		data.forms["com_pl"] = {args[1] .. "ōvi(s)"}
	end
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end


export["o-m"] = function(frame)
	local params = {
		[1] = {required = true, default = "{{{1}}}"},
		
		["n"] = {},
		["nopl"] = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
--	local delabial = mw.ustring.gsub(args[1], "ʷ$", "")
	
	local data = {forms = {}, info = "masculine o-stem", categories = {lang:getCanonicalName() .. " o-stem nouns"}}
	
	data.forms["nom_sg"] = {args[1] .. "os"}
	data.forms["voc_sg"] = {args[1] .. "e"}
	data.forms["acc_sg"] = {args[1] .. "om"}
	data.forms["gen_sg"] = {args[1] .. "osjo"}
	data.forms["dat_sg"] = {args[1] .. "ō"}
	data.forms["com_sg"] = {args[1] .. "ō"}
	
	if not args.nopl then
		data.forms["nom_du"] = {args[1] .. "ō"}
		data.forms["voc_du"] = {args[1] .. "ō"}
		data.forms["acc_du"] = {args[1] .. "ō"}
		data.forms["gen_du"] = {args[1] .. "ous"}
		data.forms["dat_du"] = {args[1] .. "ovām"}
		data.forms["com_du"] = {args[1] .. "ovām"}
	
		data.forms["nom_pl"] = {args[1] .. "ōs"}
		data.forms["voc_pl"] = {args[1] .. "ōs"}
		data.forms["acc_pl"] = {args[1] .. "ons"}
		data.forms["gen_pl"] = {args[1] .. "ōm"}
		data.forms["dat_pl"] = {args[1] .. "ōis"}
		data.forms["com_pl"] = {args[1] .. "ōis"}
	end
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end


export["o-n"] = function(frame)
	local params = {
		[1] = {required = true, default = "{{{1}}}"},
		
		["n"] = {},
		["nopl"] = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
--	local delabial = mw.ustring.gsub(args[1], "ʷ$", "")
	
	local data = {forms = {}, info = "neuter o-stem", categories =  {lang:getCanonicalName() .. " o-stem nouns"}}
	
	data.forms["nom_sg"] = {args[1] .. "om"}
	data.forms["voc_sg"] = {args[1] .. "om"}
	data.forms["acc_sg"] = {args[1] .. "om"}
	data.forms["gen_sg"] = {args[1] .. "osjo"}
	data.forms["dat_sg"] = {args[1] .. "ō"}
	data.forms["com_sg"] = {args[1] .. "ō"}

	if not args.nopl then	
		data.forms["nom_du"] = {args[1] .. "oī"}
		data.forms["voc_du"] = {args[1] .. "oī"}
		data.forms["acc_du"] = {args[1] .. "oī"}
		data.forms["gen_du"] = {args[1] .. "ous"}
		data.forms["dat_du"] = {args[1] .. "ovām"}
		data.forms["com_du"] = {args[1] .. "ovām"}
	
		data.forms["nom_pl"] = {args[1] .. "ā"}
		data.forms["voc_pl"] = {args[1] .. "ā"}
		data.forms["acc_pl"] = {args[1] .. "ā"}
		data.forms["gen_pl"] = {args[1] .. "ōm"}
		data.forms["dat_pl"] = {args[1] .. "ōis"}
		data.forms["com_pl"] = {args[1] .. "ōis"}
	end
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end


export["r-mf"] = function(frame)
	local params = {
		[1] = {required = true, default = "{{{1}}}"},
		
		["n"] = {},
		["nopl"] = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local data = {forms = {}, info = "masculine/feminine/neuter r-stem", categories = {lang:getCanonicalName() .. " r-stem nouns"}}
	
	data.forms["nom_sg"] = {args[1] .. "er"}
	data.forms["voc_sg"] = {args[1] .. "er"}
	data.forms["acc_sg"] = {args[1] .. "eram"}
	data.forms["gen_sg"] = {args[1] .. "eres"}
	data.forms["dat_sg"] = {args[1] .. "ere"}
	data.forms["com_sg"] = {args[1] .. "ere"}

	if not args.nopl then
		data.forms["nom_du"] = {args[1] .. "ere"}
		data.forms["voc_du"] = {args[1] .. "ere"}
		data.forms["acc_du"] = {args[1] .. "ere"}
		data.forms["gen_du"] = {args[1] .. "erom"}
		data.forms["dat_du"] = {args[1] .. "ermos"}
		data.forms["com_du"] = {args[1] .. "ervi(s)"}

		data.forms["nom_pl"] = {args[1] .. "eres"}
		data.forms["voc_pl"] = {args[1] .. "eres"}
		data.forms["acc_pl"] = {args[1] .. "erans"}
		data.forms["gen_pl"] = {args[1] .. "rom"}
		data.forms["dat_pl"] = {args[1] .. "ermos"}
		data.forms["com_pl"] = {args[1] .. "ervi(s)"}
	end
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end


export["u-mf"] = function(frame)
	local params = {
		[1] = {required = true, default = "{{{1}}}"},
		
		["n"] = {},
		["nopl"] = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local data = {forms = {}, info = "masculine/feminine u-stem", categories = {lang:getCanonicalName() .. " u-stem nouns"}}
	
	data.forms["nom_sg"] = {args[1] .. "us"}
	data.forms["voc_sg"] = {args[1] .. "u"}
	data.forms["acc_sg"] = {args[1] .. "um"}
	data.forms["gen_sg"] = {args[1] .. "eus"}
	data.forms["dat_sg"] = {args[1] .. "ewei"}
	data.forms["com_sg"] = {args[1] .. "ū"}

	if not args.nopl then	
		data.forms["nom_du"] = {args[1] .. "ū"}
		data.forms["voc_du"] = {args[1] .. "ū"}
		data.forms["acc_du"] = {args[1] .. "ū"}
		data.forms["gen_du"] = {args[1] .. "ewom"}
		data.forms["dat_du"] = {args[1] .. "umos"}
		data.forms["com_du"] = {args[1] .. "uvi(s)"}
		
		data.forms["nom_pl"] = {args[1] .. "ewes"}
		data.forms["voc_pl"] = {args[1] .. "ewes"}
		data.forms["acc_pl"] = {args[1] .. "uns"}
		data.forms["gen_pl"] = {args[1] .. "ewom"}
		data.forms["dat_pl"] = {args[1] .. "umos"}
		data.forms["com_pl"] = {args[1] .. "uvi(s)"}
	end
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end


export["u-n"] = function(frame)
	local params = {
		[1] = {required = true, default = "{{{1}}}"},
		
		["n"] = {},
		["nopl"] = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	if string.find(args[1], "a") then
	    vowel = mw.ustring.gsub(args[1], "ar$", "r")
	elseif string.find(args[1], "e") then
	    vowel = mw.ustring.gsub(args[1], "er$", "r")
	elseif string.find(args[1], "i") then
	    vowel = mw.ustring.gsub(args[1], "ir$", "r")
	elseif string.find(args[1], "o") then
	    vowel = mw.ustring.gsub(args[1], "or$", "r")
	elseif string.find(args[1], "u") then
	    vowel = mw.ustring.gsub(args[1], "ur$", "r")
	end
	
	local data = {forms = {}, info = "neuter u-stem", categories = {lang:getCanonicalName() .. " u-stem nouns"}}
	
	data.forms["nom_sg"] = {args[1] .. "u"}
	data.forms["voc_sg"] = {args[1] .. "u"}
	data.forms["acc_sg"] = {args[1] .. "u"}
	data.forms["gen_sg"] = {vowel .. "eus"}
	data.forms["dat_sg"] = {vowel .. "ewei"}
	data.forms["com_sg"] = {args[1] .. "ū"}

	if not args.nopl then	
		data.forms["nom_du"] = {args[1] .. "wī"}
		data.forms["voc_du"] = {args[1] .. "wī"}
		data.forms["acc_du"] = {args[1] .. "wī"}
		data.forms["gen_du"] = {vowel .. "ewom"}
		data.forms["dat_du"] = {vowel .. "umos"}
		data.forms["com_du"] = {args[1] .. "uvi(s)"}
		
		data.forms["nom_pl"] = {args[1] .. "ū"}
		data.forms["voc_pl"] = {args[1] .. "ū"}
		data.forms["acc_pl"] = {args[1] .. "ū"}
		data.forms["gen_pl"] = {vowel .. "ewom"}
		data.forms["dat_pl"] = {vowel .. "umos"}
		data.forms["com_pl"] = {args[1] .. "uvi(s)"}
	end
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end


-- Irregular nouns

local names = {
	["nom"] = "nominative",
	["voc"] = "vocative",
	["acc"] = "accusative",
	["gen"] = "genitive",
	["dat"] = "dative",
	["com"] = "comitative",
	
	["sg"] = "singular",
	["du"] = "dual",
	["pl"] = "plural",
	
	["m"] = "masculine",
	["f"] = "feminine",
	["n"] = "neuter",
}

-- 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 "—"
		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 numbers = {"sg", "du", "pl"}
	local cases = {"nom", "voc", "acc", "gen", "dat", "com"}
	
	local wikicode = {}
	
	table.insert(wikicode, "{| class=\"inflection-table vsSwitcher mw-collapsible mw-collapsed\" data-toggle-category=\"inflection\" style=\"background: #FAFAFA; border: 1px solid #d0d0d0; text-align: left;\" cellspacing=\"1\" cellpadding=\"2\"")
	table.insert(wikicode, "|- style=\"background: #FFCCCC;\"\n! class=\"vsToggleElement\" style=\"min-width: 41em;\" colspan=\"" .. (#numbers + 1) .. "\" | {{{info}}}")
	
	table.insert(wikicode, "|- class=\"vsHide\" style=\"background: #FFCCCC;\"")
	table.insert(wikicode, "!")
	
	for _, number in ipairs(numbers) do
		table.insert(wikicode, "! style=\"min-width: 11em; background: #FFCCCC;\" | " .. names[number])
	end
	
	for _, case in ipairs(cases) do
		table.insert(wikicode, "|- class=\"vsHide\" style=\"background-color: #FFF2F2;\"\n! style=\"min-width: 8em; background-color: #FFE6E6;\" | " .. names[case])
		
		for _, number in ipairs(numbers) do
			table.insert(wikicode, "| {{{" .. case .. "_" .. number .. "}}}")
		end
	end
	
	table.insert(wikicode, "|}")
	
	wikicode = table.concat(wikicode, "\n")
	
	return (mw.ustring.gsub(wikicode, "{{{([a-z0-9_]+)}}}", repl))
end

return export