মডিউল:goh-decl-noun
অবয়ব
এই মডিউলের জন্য মডিউল:goh-decl-noun/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে
local export = {}
local m_links = require("Module:links")
local m_utils = require("Module:utilities")
local lang = require("Module:languages").getByCode("goh")
local decl_data = {}
decl_data["a-m"] = {
params = {
[1] = {},
[2] = {},
["alt1"] = {},
["alt2"] = {},
},
}
setmetatable(decl_data["a-m"], {__call = function(self, args, data)
data.decl_type = "masculine a-stem"
local a2 = args.alt2 or args[2] or args.alt1 or args[1]
data.forms["nom_sg"] = {args.alt1 or args[1]}
data.forms["acc_sg"] = {args.alt1 or args[1]}
data.forms["gen_sg"] = {a2 .. "es"}
data.forms["dat_sg"] = {a2 .. "e"}
data.forms["ins_sg"] = {a2 .. "u"}
data.forms["nom_pl"] = {a2 .. "a"}
data.forms["acc_pl"] = {a2 .. "a"}
data.forms["gen_pl"] = {a2 .. "o"}
data.forms["dat_pl"] = {a2 .. "um"}
table.insert(data.categories, "Old High German a-stem nouns")
end
})
decl_data["a-n"] = {
params = {
[1] = {},
[2] = {},
["alt1"] = {},
["alt2"] = {},
},
}
setmetatable(decl_data["a-n"], {__call = function(self, args, data)
decl_data["a-m"](args, data)
data.decl_type = "neuter a-stem"
data.forms["nom_pl"] = {args.alt1 or args[1]}
data.forms["acc_pl"] = {args.alt1 or args[1]}
end
})
decl_data["i-f"] = {
params = {
[1] = {},
[2] = {},
["alt1"] = {},
["alt2"] = {},
["nom_sg"] = {},
},
}
setmetatable(decl_data["i-f"], {__call = function(self, args, data)
data.decl_type = "feminine i-stem"
local a2 = args.alt2 or args[2] or args.alt1 or args[1]
data.forms["nom_sg"] = {args.nom_sg or args.alt1 or args[1]}
data.forms["acc_sg"] = {args.nom_sg or args.alt1 or args[1]}
data.forms["gen_sg"] = {a2 .. "i"}
data.forms["dat_sg"] = {a2 .. "i"}
data.forms["nom_pl"] = {a2 .. "i"}
data.forms["acc_pl"] = {a2 .. "i"}
data.forms["gen_pl"] = {a2 .. "o"}
data.forms["dat_pl"] = {a2 .. "en"}
table.insert(data.categories, "Old High German i-stem nouns")
end
})
decl_data["i-m"] = {
params = {
[1] = {},
[2] = {},
["alt1"] = {},
["alt2"] = {},
["nom_sg"] = {},
},
}
setmetatable(decl_data["i-m"], {__call = function(self, args, data)
data.decl_type = "masculine i-stem"
local a2 = args.alt2 or args[2] or args.alt1 or args[1]
data.forms["nom_sg"] = {args.nom_sg or args.alt1 or args[1]}
data.forms["acc_sg"] = {args.nom_sg or args.alt1 or args[1]}
data.forms["gen_sg"] = {args.alt1 or args[1] .. "es"}
data.forms["dat_sg"] = {args.alt1 or args[1] .. "e"}
data.forms["ins_sg"] = {args.alt1 or args[1] .. "u"}
data.forms["nom_pl"] = {a2 .. "i"}
data.forms["acc_pl"] = {a2 .. "i"}
data.forms["gen_pl"] = {a2 .. "o"}
data.forms["dat_pl"] = {a2 .. "en"}
table.insert(data.categories, "Old High German i-stem nouns")
end
})
decl_data["ja-m"] = {
params = {
[1] = {},
[2] = {},
["alt1"] = {},
["alt2"] = {},
},
}
setmetatable(decl_data["ja-m"], {__call = function(self, args, data)
data.decl_type = "masculine ja-stem"
local a2 = args.alt2 or args[2] or args.alt1 or args[1]
data.forms["nom_sg"] = {(args.alt1 or args[1]) .. "i"}
data.forms["acc_sg"] = {(args.alt1 or args[1]) .. "i"}
data.forms["gen_sg"] = {a2 .. "es"}
data.forms["dat_sg"] = {a2 .. "e"}
data.forms["ins_sg"] = {a2 .. "u"}
data.forms["nom_pl"] = {a2 .. "a"}
data.forms["acc_pl"] = {a2 .. "a"}
data.forms["gen_pl"] = {a2 .. "o"}
data.forms["dat_pl"] = {a2 .. "im"}
table.insert(data.categories, "Old High German ja-stem nouns")
end
})
decl_data["ja-n"] = {
params = {
[1] = {},
[2] = {},
["alt1"] = {},
["alt2"] = {},
},
}
setmetatable(decl_data["ja-n"], {__call = function(self, args, data)
decl_data["ja-m"](args, data)
data.decl_type = "neuter ja-stem"
data.forms["nom_pl"] = {(args.alt1 or args[1]) .. "i"}
data.forms["acc_pl"] = {(args.alt1 or args[1]) .. "i"}
end
})
decl_data["n-m"] = {
params = {
[1] = {},
[2] = {},
["alt1"] = {},
["alt2"] = {},
},
}
setmetatable(decl_data["n-m"], {__call = function(self, args, data)
data.decl_type = "masculine n-stem"
local a2 = args.alt2 or args[2] or args.alt1 or args[1]
data.forms["nom_sg"] = {args.alt1 or args[1] .. "o"}
data.forms["acc_sg"] = {args.alt1 or args[1] .. "on"}
data.forms["gen_sg"] = {a2 .. "en"}
data.forms["dat_sg"] = {a2 .. "en"}
data.forms["nom_pl"] = {a2 .. "on"}
data.forms["acc_pl"] = {a2 .. "on"}
data.forms["gen_pl"] = {a2 .. "ōno"}
data.forms["dat_pl"] = {a2 .. "ōm"}
table.insert(data.categories, "Old High German n-stem nouns")
end
})
decl_data["n-n"] = {
params = {
[1] = {},
[2] = {},
["alt1"] = {},
["alt2"] = {},
},
}
setmetatable(decl_data["n-n"], {__call = function(self, args, data)
data.decl_type = "neuter n-stem"
local a2 = args.alt2 or args[2] or args.alt1 or args[1]
data.forms["nom_sg"] = {args.alt1 or args[1] .. "a"}
data.forms["acc_sg"] = {args.alt1 or args[1] .. "a"}
data.forms["gen_sg"] = {a2 .. "en"}
data.forms["dat_sg"] = {a2 .. "en"}
data.forms["nom_pl"] = {a2 .. "un"}
data.forms["acc_pl"] = {a2 .. "un"}
data.forms["gen_pl"] = {a2 .. "ōno"}
data.forms["dat_pl"] = {a2 .. "ōm"}
table.insert(data.categories, "Old High German n-stem nouns")
end
})
decl_data["n-f"] = {
params = {
[1] = {},
[2] = {},
["alt1"] = {},
["alt2"] = {},
},
}
setmetatable(decl_data["n-f"], {__call = function(self, args, data)
decl_data["n-n"](args, data)
data.decl_type = "feminine n-stem"
local a2 = args.alt2 or args[2] or args.alt1 or args[1]
data.forms["acc_sg"] = {args.alt1 or args[1] .. "ūn"}
data.forms["gen_sg"] = {a2 .. "ūn"}
data.forms["dat_sg"] = {a2 .. "ūn"}
end
})
decl_data["o-f"] = {
params = {
[1] = {},
["alt1"] = {},
},
}
setmetatable(decl_data["o-f"], {__call = function(self, args, data)
data.decl_type = "ō-stem"
local a1 = args.alt1 or args[1]
data.forms["nom_sg"] = {a1 .. "a"}
data.forms["acc_sg"] = {a1 .. "a"}
data.forms["gen_sg"] = {a1 .. "a"}
data.forms["dat_sg"] = {a1 .. "u"}
data.forms["nom_pl"] = {a1 .. "ā"}
data.forms["acc_pl"] = {a1 .. "ā"}
data.forms["gen_pl"] = {a1 .. "ōno"}
data.forms["dat_pl"] = {a1 .. "ōm"}
table.insert(data.categories, "Old High German ō-stem nouns")
end
})
decl_data["wa-m"] = {
params = {
[1] = {},
[2] = {},
["alt1"] = {},
["alt2"] = {},
["nomsg"] = {},
},
}
setmetatable(decl_data["wa-m"], {__call = function(self, args, data)
data.decl_type = "masculine wa-stem"
local ns = args.nomsg or args.alt1 or args[1]
local a2 = args.alt2 or args[2] or args.alt1 or args[1]
data.forms["nom_sg"] = {ns}
data.forms["acc_sg"] = {ns}
data.forms["gen_sg"] = {a2 .. "wes"}
data.forms["dat_sg"] = {a2 .. "we"}
data.forms["nom_pl"] = {(args.alt1 or args[1]) .. "wa"}
data.forms["acc_pl"] = {(args.alt1 or args[1]) .. "wa"}
data.forms["gen_pl"] = {a2 .. "wo"}
data.forms["dat_pl"] = {a2 .. "wum"}
table.insert(data.categories, "Old High German wa-stem nouns")
end
})
decl_data["wa-n"] = {
params = {
[1] = {},
[2] = {},
["alt1"] = {},
["alt2"] = {},
["nomsg"] = {},
},
}
setmetatable(decl_data["wa-n"], {__call = function(self, args, data)
decl_data["wa-m"](args, data)
data.decl_type = "neuter wa-stem"
local ns = args.nomsg or args.alt1 or args[1]
data.forms["nom_pl"] = {ns}
data.forms["acc_pl"] = {ns}
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 "{{{" .. key .. "}}}"
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 wikicode = [=[<div class="NavFrame" style="width:30em">
<div class="NavHead" style="">Declension of {{{nom_sg}}} ({{{decl_type}}})</div>
<div class="NavContent">
{| style="background:#F5FFFA;text-align:center;width:30em" class="inflection-table"
|-
! style="background:#F5FFFA" | case
! style="background:#93C572; width: 37.5%" | singular
! style="background:#93C572; width: 37.5%" | plural
|-
! style="background:#90EE90" | [[Appendix:Glossary#nominative case|nominative]]
| {{{nom_sg}}}
| {{{nom_pl}}}
|-
! style="background:#90EE90" | [[Appendix:Glossary#accusative case|accusative]]
| {{{acc_sg}}}
| {{{acc_pl}}}
|-
! style="background:#90EE90" | [[Appendix:Glossary#genitive case|genitive]]
| {{{gen_sg}}}
| {{{gen_pl}}}
|-
! style="background:#90EE90" | [[Appendix:Glossary#dative case|dative]]
| {{{dat_sg}}}
| {{{dat_pl}}}
]=]
if data.forms.ins_sg or data.forms.ins_pl then
wikicode = wikicode .. [=[|-
! style="background:#90EE90" | [[Appendix:Glossary#instrumental case|instrumental]]
| {{{ins_sg}}}
| {{{ins_pl}}}
]=]
end
wikicode = wikicode .. "|}</div></div>"
return (mw.ustring.gsub(wikicode, "{{{([a-z0-9_]+)}}}", repl)) .. m_utils.format_categories(data.categories, lang)
end
return export