local m_utilities = require("Module:utilities")
local m_links = require("Module:links")
local export = {}
local lang = require("Module:languages").getByCode("cel-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] .. "ā"}
data.forms["acc_sg"] = {args[1] .. "am"}
data.forms["gen_sg"] = {args[1] .. "ās"}
data.forms["dat_sg"] = {args[1] .. "āi"}
data.forms["loc_sg"] = {args[1] .. "ai"}
data.forms["ins_sg"] = {"?"}
if not args.nopl then
data.forms["nom_du"] = {args[1] .. "ai"}
data.forms["voc_du"] = {args[1] .. "ai"}
data.forms["acc_du"] = {args[1] .. "ai"}
data.forms["gen_du"] = {args[1] .. "ous"}
data.forms["dat_du"] = {args[1] .. "ābom"}
data.forms["loc_du"] = {"?"}
data.forms["ins_du"] = {args[1] .. "ābim"}
data.forms["nom_pl"] = {args[1] .. "ās"}
data.forms["voc_pl"] = {args[1] .. "ās"}
data.forms["acc_pl"] = {args[1] .. "āms"}
data.forms["gen_pl"] = {args[1] .. "om"}
data.forms["dat_pl"] = {args[1] .. "ābos"}
data.forms["loc_pl"] = {"?"}
data.forms["ins_pl"] = {args[1] .. "ābis"}
end
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
export["iya-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 ī/yā-stem", categories = {lang:getCanonicalName() .. " ī/yā-stem nouns"}}
data.forms["nom_sg"] = {args[1] .. "ī"}
data.forms["voc_sg"] = {args[1] .. "ī"}
data.forms["acc_sg"] = {args[1] .. "īm"}
data.forms["gen_sg"] = {args[1] .. "yās"}
data.forms["dat_sg"] = {args[1] .. "yai"}
data.forms["loc_sg"] = {"?"}
data.forms["ins_sg"] = {"?"}
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] .. "yous"}
data.forms["dat_du"] = {args[1] .. "yābom"}
data.forms["loc_du"] = {"?"}
data.forms["ins_du"] = {args[1] .. "yābim"}
data.forms["nom_pl"] = {args[1] .. "iyās"}
data.forms["voc_pl"] = {args[1] .. "iyās"}
data.forms["acc_pl"] = {args[1] .. "īms"}
data.forms["gen_pl"] = {args[1] .. "yom"}
data.forms["dat_pl"] = {args[1] .. "yābos"}
data.forms["loc_pl"] = {"?"}
data.forms["ins_pl"] = {args[1] .. "yābis"}
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 nomsg = mw.ustring.gsub(args[1], "[bdgkɸst]$", {["b"] = "x", ["d"] = "s", ["g"] = "x", ["k"] = "x", ["ɸ"] = "x", ["s"] = ""})
local data = {forms = {}, info = "masculine/feminine consonant stem", categories = {lang:getCanonicalName() .. " consonant stem nouns"}}
data.forms["nom_sg"] = {args[2] or nomsg .. "s"}
data.forms["voc_sg"] = {args[2] or nomsg .. "s"}
data.forms["acc_sg"] = {args[1] .. "am"}
data.forms["gen_sg"] = {args[1] .. "os"}
data.forms["dat_sg"] = {args[1] .. "ei"}
data.forms["loc_sg"] = {args[1] .. "i"}
data.forms["ins_sg"] = {args[1] .. "e?"}
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] .. "ou"}
data.forms["dat_du"] = {args[1] .. "obom"}
data.forms["ins_du"] = {args[1] .. "obim"}
data.forms["nom_pl"] = {args[1] .. "es"}
data.forms["voc_pl"] = {args[1] .. "es"}
data.forms["acc_pl"] = {args[1] .. "ams"}
data.forms["gen_pl"] = {args[1] .. "om"}
data.forms["dat_pl"] = {args[1] .. "obos"}
data.forms["ins_pl"] = {args[1] .. "obis"}
end
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
export["cons-n"] = 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 = "neuter consonant stem", categories = {lang:getCanonicalName() .. " consonant stem nouns"}}
data.forms["nom_sg"] = {args[2] or args[1]}
data.forms["voc_sg"] = {args[2] or args[1]}
data.forms["acc_sg"] = {args[2] or args[1]}
data.forms["gen_sg"] = {args[1] .. "os"}
data.forms["dat_sg"] = {args[1] .. "ē"}
data.forms["loc_sg"] = {args[1] .. "i"}
data.forms["ins_sg"] = {args[1] .. "e?"}
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] .. "ou"}
data.forms["dat_du"] = {args[1] .. "obom"}
data.forms["loc_du"] = {"?"}
data.forms["ins_du"] = {args[1] .. "obim"}
data.forms["nom_pl"] = {args[1] .. "a"}
data.forms["voc_pl"] = {args[1] .. "a"}
data.forms["acc_pl"] = {args[1] .. "a"}
data.forms["gen_pl"] = {args[1] .. "om"}
data.forms["dat_pl"] = {args[1] .. "obos"}
data.forms["loc_pl"] = {"?"}
data.forms["ins_pl"] = {args[1] .. "obis"}
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] .. "i"}
data.forms["acc_sg"] = {args[1] .. "im"}
data.forms["gen_sg"] = {args[1] .. "eis"}
data.forms["dat_sg"] = {args[1] .. "ei"}
data.forms["loc_sg"] = {args[1] .. "ei"}
data.forms["ins_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] .. "yow"}
data.forms["dat_du"] = {args[1] .. "ibom"}
data.forms["loc_du"] = {"?"}
data.forms["ins_du"] = {args[1] .. "ibim"}
data.forms["nom_pl"] = {args[1] .. "īs"}
data.forms["voc_pl"] = {args[1] .. "īs"}
data.forms["acc_pl"] = {args[1] .. "ims"}
data.forms["gen_pl"] = {args[1] .. "yom"}
data.forms["dat_pl"] = {args[1] .. "ibos"}
data.forms["loc_pl"] = {"?"}
data.forms["ins_pl"] = {args[1] .. "ibis"}
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] .. "i"}
data.forms["voc_sg"] = {args[1] .. "i"}
data.forms["acc_sg"] = {args[1] .. "i"}
data.forms["gen_sg"] = {args[1] .. "ois"}
data.forms["dat_sg"] = {args[1] .. "ei"}
data.forms["loc_sg"] = {args[1] .. "ei"}
data.forms["ins_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] .. "ois"}
data.forms["dat_du"] = {args[1] .. "ibom"}
data.forms["loc_du"] = {"?"}
data.forms["ins_du"] = {args[1] .. "ibim"}
data.forms["nom_pl"] = {args[1] .. "yā"}
data.forms["voc_pl"] = {args[1] .. "yā"}
data.forms["acc_pl"] = {args[1] .. "yā"}
data.forms["gen_pl"] = {args[1] .. "yom"}
data.forms["dat_pl"] = {args[1] .. "ibos"}
data.forms["loc_pl"] = {"?"}
data.forms["ins_pl"] = {args[1] .. "ibis"}
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"] = {delabial .. "ū"}
data.forms["voc_sg"] = {delabial .. "ū"}
data.forms["acc_sg"] = {args[1] .. "onam"}
data.forms["gen_sg"] = {args[1] .. "onos"}
data.forms["dat_sg"] = {args[1] .. "onei"}
data.forms["loc_sg"] = {args[1] .. "on(i)"}
data.forms["ins_sg"] = {args[1] .. "onei"}
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] .. "onows?"}
data.forms["dat_du"] = {args[1] .. "ombom"}
data.forms["loc_du"] = {"?"}
data.forms["ins_du"] = {args[1] .. "ombim"}
data.forms["nom_pl"] = {args[1] .. "ones"}
data.forms["voc_pl"] = {args[1] .. "ones"}
data.forms["acc_pl"] = {args[1] .. "onams"}
data.forms["gen_pl"] = {args[1] .. "onom"}
data.forms["dat_pl"] = {args[1] .. "ombos"}
data.forms["loc_pl"] = {"?"}
data.forms["ins_pl"] = {args[1] .. "ombis"}
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] .. "ens"}
data.forms["dat_sg"] = {args[1] .. "enē"}
data.forms["loc_sg"] = {args[1] .. "en(i)"}
data.forms["ins_sg"] = {args[1] .. "enē"}
if not args.nopl then
data.forms["nom_du"] = {args[1] .. "ane?"}
data.forms["voc_du"] = {args[1] .. "ane?"}
data.forms["acc_du"] = {args[1] .. "ane?"}
data.forms["gen_du"] = {args[1] .. "enous?"}
data.forms["dat_du"] = {args[1] .. "embom"}
data.forms["loc_du"] = {"?"}
data.forms["ins_du"] = {args[1] .. "embim"}
data.forms["nom_pl"] = {args[1] .. "ana"}
data.forms["voc_pl"] = {args[1] .. "ana"}
data.forms["acc_pl"] = {args[1] .. "ana"}
data.forms["gen_pl"] = {args[1] .. "enom"}
data.forms["dat_pl"] = {args[1] .. "embos"}
data.forms["loc_pl"] = {"?"}
data.forms["ins_pl"] = {args[1] .. "embis"}
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] .. "ī"}
data.forms["dat_sg"] = {delabial .. "ūi"}
data.forms["loc_sg"] = {args[1] .. "ei"}
data.forms["ins_sg"] = {delabial .. "ū"}
if not args.nopl then
data.forms["nom_du"] = {args[1] .. "ou"}
data.forms["voc_du"] = {args[1] .. "ou"}
data.forms["acc_du"] = {args[1] .. "ou"}
data.forms["gen_du"] = {args[1] .. "ous"}
data.forms["dat_du"] = {args[1] .. "obom"}
data.forms["loc_du"] = {"?"}
data.forms["ins_du"] = {args[1] .. "obim"}
data.forms["nom_pl"] = {args[1] .. "oi"}
data.forms["voc_pl"] = {delabial .. "ūs"}
data.forms["acc_pl"] = {delabial .. "oms"}
data.forms["gen_pl"] = {args[1] .. "om"}
data.forms["dat_pl"] = {args[1] .. "obos"}
data.forms["loc_pl"] = {"?"}
data.forms["ins_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] .. "ī"}
data.forms["dat_sg"] = {delabial .. "ūi"}
data.forms["loc_sg"] = {args[1] .. "ei"}
data.forms["ins_sg"] = {delabial .. "ū"}
if not args.nopl then
data.forms["nom_du"] = {args[1] .. "ou"}
data.forms["voc_du"] = {args[1] .. "ou"}
data.forms["acc_du"] = {args[1] .. "ou"}
data.forms["gen_du"] = {args[1] .. "ous"}
data.forms["dat_du"] = {args[1] .. "obom"}
data.forms["loc_du"] = {"?"}
data.forms["ins_du"] = {args[1] .. "obim"}
data.forms["nom_pl"] = {args[1] .. "ā"}
data.forms["voc_pl"] = {args[1] .. "ā"}
data.forms["acc_pl"] = {args[1] .. "ā"}
data.forms["gen_pl"] = {args[1] .. "om"}
data.forms["dat_pl"] = {args[1] .. "obos"}
data.forms["loc_pl"] = {"?"}
data.forms["ins_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 r-stem", categories = {lang:getCanonicalName() .. " r-stem nouns"}}
data.forms["nom_sg"] = {args[1] .. "īr"}
data.forms["voc_sg"] = {args[1] .. "er"}
data.forms["acc_sg"] = {args[1] .. "eram"}
data.forms["gen_sg"] = {args[1] .. "ros"}
data.forms["dat_sg"] = {args[1] .. "rē"}
data.forms["loc_sg"] = {args[1] .. "ri"}
data.forms["ins_sg"] = {args[1] .. "rē"}
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] .. "rous"}
data.forms["dat_du"] = {args[1] .. "arbom"}
data.forms["loc_du"] = {"?"}
data.forms["ins_du"] = {args[1] .. "arbim"}
data.forms["nom_pl"] = {args[1] .. "eres"}
data.forms["voc_pl"] = {args[1] .. "eres"}
data.forms["acc_pl"] = {args[1] .. "erams"}
data.forms["gen_pl"] = {args[1] .. "rom"}
data.forms["dat_pl"] = {args[1] .. "arbos"}
data.forms["loc_pl"] = {"?"}
data.forms["ins_pl"] = {args[1] .. "arbis"}
end
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
export["s-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 s-stem", categories = {lang:getCanonicalName() .. " s-stem nouns"}}
data.forms["nom_sg"] = {args[1] .. "os"}
data.forms["voc_sg"] = {args[1] .. "os"}
data.forms["acc_sg"] = {args[1] .. "os"}
data.forms["gen_sg"] = {args[1] .. "esos"}
data.forms["dat_sg"] = {args[1] .. "esē"}
data.forms["loc_sg"] = {args[1] .. "esi"}
data.forms["ins_sg"] = {args[1] .. "esē"}
if not args.nopl then
data.forms["nom_du"] = {args[1] .. "ese?"}
data.forms["voc_du"] = {args[1] .. "ese?"}
data.forms["acc_du"] = {args[1] .. "ese?"}
data.forms["gen_du"] = {args[1] .. "esous?"}
data.forms["dat_du"] = {args[1] .. "esbom"}
data.forms["loc_du"] = {"?"}
data.forms["ins_du"] = {args[1] .. "esbim"}
data.forms["nom_pl"] = {args[1] .. "esa"}
data.forms["voc_pl"] = {args[1] .. "esa"}
data.forms["acc_pl"] = {args[1] .. "esa"}
data.forms["gen_pl"] = {args[1] .. "esom"}
data.forms["dat_pl"] = {args[1] .. "esbos"}
data.forms["loc_pl"] = {"?"}
data.forms["ins_pl"] = {args[1] .. "esbis"}
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] .. "ous"}
data.forms["dat_sg"] = {args[1] .. "ou"}
data.forms["loc_sg"] = {"?"}
data.forms["ins_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] .. "ubom"}
data.forms["loc_du"] = {"?"}
data.forms["ins_du"] = {args[1] .. "ubim"}
data.forms["nom_pl"] = {args[1] .. "owes"}
data.forms["voc_pl"] = {args[1] .. "ūs"}
data.forms["acc_pl"] = {args[1] .. "ums"}
data.forms["gen_pl"] = {args[1] .. "owom"}
data.forms["dat_pl"] = {args[1] .. "ubos"}
data.forms["loc_pl"] = {"?"}
data.forms["ins_pl"] = {args[1] .. "ubis"}
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)
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"] = {args[1] .. "ous"}
data.forms["dat_sg"] = {args[1] .. "ou"}
data.forms["loc_sg"] = {"?"}
data.forms["ins_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] .. "ubom"}
data.forms["loc_du"] = {"?"}
data.forms["ins_du"] = {args[1] .. "ubim"}
data.forms["nom_pl"] = {args[1] .. "wā"}
data.forms["voc_pl"] = {args[1] .. "wā"}
data.forms["acc_pl"] = {args[1] .. "wā"}
data.forms["gen_pl"] = {args[1] .. "owom"}
data.forms["dat_pl"] = {args[1] .. "ubos"}
data.forms["loc_pl"] = {"?"}
data.forms["ins_pl"] = {args[1] .. "ubis"}
end
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
-- Irregular nouns
export["benā"] = function(frame)
local params = {
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {forms = {}, info = "ā-stem, irregular", categories = {lang:getCanonicalName() .. " ā-stem nouns", lang:getCanonicalName() .. " irregular nouns"}}
data.forms["nom_sg"] = {"benā"}
data.forms["voc_sg"] = {"benā"}
data.forms["acc_sg"] = {"benam"}
data.forms["gen_sg"] = {"bnās"}
data.forms["dat_sg"] = {"bnāi"}
data.forms["loc_sg"] = {"bnai"}
data.forms["ins_sg"] = {"?"}
data.forms["nom_du"] = {"bnai?"}
data.forms["voc_du"] = {"bnai?"}
data.forms["acc_du"] = {"bnai?"}
data.forms["gen_du"] = {"bnous"}
data.forms["dat_du"] = {"bnābom"}
data.forms["loc_du"] = {"?"}
data.forms["ins_du"] = {"bnābim"}
data.forms["nom_pl"] = {"bnās"}
data.forms["voc_pl"] = {"bnās"}
data.forms["acc_pl"] = {"bnams"}
data.forms["gen_pl"] = {"banom"}
data.forms["dat_pl"] = {"bnābos"}
data.forms["loc_pl"] = {"?"}
data.forms["ins_pl"] = {"bnābis"}
postprocess(args, data)
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
local names = {
["nom"] = "nominative",
["voc"] = "vocative",
["acc"] = "accusative",
["gen"] = "genitive",
["dat"] = "dative",
["loc"] = "locative",
["ins"] = "instrumental",
["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", "loc", "ins"}
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, "|- style=\"background: #CCCCFF;\"\n! class=\"vsToggleElement\" style=\"min-width: 41em;\" colspan=\"" .. (#numbers + 1) .. "\" | {{{info}}}")
table.insert(wikicode, "|- class=\"vsHide\" style=\"background: #CCCCFF;\"")
table.insert(wikicode, "!")
for _, number in ipairs(numbers) do
table.insert(wikicode, "! style=\"min-width: 11em; background: #CCCCFF;\" | " .. names[number])
end
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])
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