Module:gmh-decl-adj

local export = {}

local m_links = require("Module:links") local m_utils = require("Module:utilities") local rmatch = mw.ustring.match

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

local decl_data = {}

decl_data["adj"] = { params = { [1] = {},		[2] = {},		["alt1"] = {}, ["alt2"] = {}, ["comp"] = {}, ["sup"] = {}, ["sup2"] = {}, ["umlaut"] = {}, ["lr"] = {} }, } setmetatable(decl_data["adj"], {__call = function(self, args, data)	data.decl_type = "masculine, a-stem"	local a1 = args.alt1 or args[1]	local a2 = args.alt2 or args[2] or a1	local a3 = args.umlaut or a2	comp = args.comp	local sup = args.sup	local sup2 = args.sup2 or sup	data.forms["bare"] = {a1} if args.lr == "+" then

data.forms["snsm"] = {a2 .. "er"} data.forms["snsf"] = {a3 .. "iu"} data.forms["snsn"] = {a2 .. "ȥ", a2 .. "eȥ"} data.forms["sgsm"] = {a2 .. "s", a2 .. "es"} data.forms["sgsf"] = {a2 .. "re", a2 .. "er"} data.forms["sdsm"] = {a2 .. "m", a2 .. "me", a2 .. "em"} data.forms["sasm"] = {a2 .. "n", a2 .. "en"} data.forms["sasf"] = {a2, a2 .. "e"}

data.forms["wns"] = {a2, a2 .. "e"} data.forms["wnp"] = {a2 .. "n", a2 .. "en"}

else

data.forms["snsm"] = {a2 .. "er"} data.forms["snsf"] = {a3 .. "iu"} data.forms["snsn"] = {a2 .. "eȥ"} data.forms["sgsm"] = {a2 .. "es"} data.forms["sgsf"] = {a2 .. "er"} data.forms["sdsm"] = {a2 .. "em"} data.forms["sasm"] = {a2 .. "en"} data.forms["sasf"] = {a2 .. "e"}

data.forms["wns"] = {a2 .. "e"} data.forms["wnp"] = {a2 .. "en"}

end

if comp then

data.forms["cwns"] = {comp .. "e"} data.forms["cwnp"] = {comp .. "en"}

data.forms["ssnsm"] = {sup2 .. "er"} data.forms["ssnsf"] = {sup2 .. "iu"} data.forms["ssnsn"] = {sup2 .. "eȥ"} data.forms["ssgsm"] = {sup2 .. "es"} data.forms["ssgsf"] = {sup2 .. "er"} data.forms["ssdsm"] = {sup2 .. "em"} data.forms["ssasm"] = {sup2 .. "en"} data.forms["ssasf"] = {sup2 .. "e"}

data.forms["swns"] = {sup2 .. "e"} data.forms["swnp"] = {sup2 .. "en"}

end end })

-- The main entry point. -- This is the only function that can be invoked from a template. function export.show(frame)

local parent_args = frame:getParent.args local decl_type = (frame.args["decl"] or parent_args["decl"]) or "a-m"

if not decl_data[decl_type] then error("Unknown declension '" .. decl_type .. "'") end local data = {forms = {}, categories = {}} data.head = parent_args["head"] or nil

local args = require("Module:parameters").process(parent_args, decl_data[decl_type].params, true) -- Override for templates if not args[1] then setmetatable(args, {__index = function(self, key)			return ""		end		}) end -- Generate the forms if parent_args.irr then table.insert(data.categories, "Old High German irregular nouns") if decl_data.irregular[parent_args.irr] then decl_data.irregular[parent_args.irr](data) else decl_data[decl_type](args, data) end else decl_data[decl_type](args, data) end

-- Make the table return make_table(data) end

function make_table(data) local function show_form(form) if not form then return "—" end local ret = {} for key, subform in ipairs(form) do			if mw.title.getCurrentTitle.nsText == "Reconstruction" and subform ~= "—" then subform = "*" .. subform end table.insert(ret, m_links.full_link({lang = lang, term = subform})) end return table.concat(ret, ", ") end local function repl(param) if param == "decl_type" then return data.decl_type else return show_form(data.forms[param]) end end

local wikicode1 = [=[ Positive forms of

{| style="background:#F9F9F9;text-align:center;width:30em" class="inflection-table" border="1px solid #505050" ! colspan="2" rowspan="2" style="background:#C0C0C0" | number & gender ! colspan="3" style="background:#C0C0C0" | singular ! colspan="2" style="background:#C0C0C0" | plural ! style="background:#C0C0C0" | masculine ! style="background:#C0C0C0" | feminine ! style="background:#C0C0C0" | neuter ! style="background:#C0C0C0" | nonneuter ! style="background:#C0C0C0" | neuter ! rowspan="4" style="background:#c0cfe4" | strong declension ! style="background:#c0cfe4" | nominative ! style="background:#c0cfe4" | genitive ! style="background:#c0cfe4" | dative ! style="background:#c0cfe4" | accusative ! rowspan="4" style="background:#c0e4c0" | weak declension ! style="background:#c0e4c0" | nominative ! style="background:#c0e4c0" | genitive ! style="background:#c0e4c0" | dative ! style="background:#c0e4c0" | accusative ]=]
 * (e)
 * colspan="2" | (e)
 * colspan="2" | (e)
 * colspan="2" | (e)
 * (e)
 * (e)
 * (e)
 * colspan="2" |
 * dër
 * diu
 * daȥ
 * die
 * diu
 * dës
 * dër
 * dës
 * colspan="2" | dër
 * dëm
 * dër
 * dëm
 * colspan="2" | dën
 * dën
 * die
 * daȥ
 * die
 * diu

local wikicode2 = [=[ Positive forms of

Comparative forms of

Superlative forms of

{| style="background:#F9F9F9;text-align:center;width:30em" class="inflection-table" border="1px solid #505050" ! colspan="2" rowspan="2" style="background:#C0C0C0" | number & gender ! colspan="3" style="background:#C0C0C0" | singular ! colspan="2" style="background:#C0C0C0" | plural ! style="background:#C0C0C0" | masculine ! style="background:#C0C0C0" | feminine ! style="background:#C0C0C0" | neuter ! style="background:#C0C0C0" | nonneuter ! style="background:#C0C0C0" | neuter ! rowspan="4" style="background:#c0cfe4" | strong declension ! style="background:#c0cfe4" | nominative ! style="background:#c0cfe4" | genitive ! style="background:#c0cfe4" | dative ! style="background:#c0cfe4" | accusative ! rowspan="4" style="background:#c0e4c0" | weak declension ! style="background:#c0e4c0" | nominative ! style="background:#c0e4c0" | genitive ! style="background:#c0e4c0" | dative ! style="background:#c0e4c0" | accusative ]=]
 * (e)
 * colspan="2" | (e)
 * colspan="2" | (e)
 * colspan="2" | (e)
 * (e)
 * (e)
 * (e)
 * colspan="2" |
 * dër
 * diu
 * daȥ
 * die
 * diu
 * dës
 * dër
 * dës
 * colspan="2" | dër
 * dëm
 * dër
 * dëm
 * colspan="2" | dën
 * dën
 * die
 * daȥ
 * die
 * diu

if comp then wikicode = wikicode2 .. "|} " else wikicode = wikicode1 .. "|} " end

return (mw.ustring.gsub(wikicode, "", repl)) .. m_utils.format_categories(data.categories, lang) end

return export