Jump to content

Module:oui-decl

From Wiktionary, the free dictionary


local export = {}

local full_link = require("Module:links").full_link
local lang = require("Module:languages").getByCode("oui")
local sc = require("Module:scripts").getByCode("Ougr")

local function link(term, tr)
	return full_link({
		term = term,
		lang = lang,
		sc = sc,
		tr = tr
	})
end

local html = [[
<div class="NavFrame oui-decl">
<div class="NavHead"><b>Declension of %s</b></div>
<div class="NavContent">
{| class="inflection-table"
|-
! !! singular !! definite plural
|-
! nominative
| %s || %s
|-
! genitive
| %s || %s
|-
! dative
| %s || %s
|-
! accusative
| %s, %s || %s, %s
|-
! locative
| %s || %s
|-
! ablative
| %s || %s
|-
! instrumental
| %s || %s
|-
! equative
| %s ||
|-
! directive
| %s ||
|-
! similative
| %s ||
|}
</div>
</div>
]]

function export.main(frame)
	local lemma = frame.args[1]
	local type = frame.args[2]:lower() -- "a" or "u"
	local ends_in = frame.args[3]:lower() -- "c" (consonant) or "v" (vowel)
	local tr = frame.args["tr"]

	return string.format(html,
		link(lemma), -- title
		link(lemma), -- nominative singular
		link(lemma .. "𐾁𐽰𐽾"), -- nominative plural
		link((type == "a" and (lemma .. "𐽺𐽶𐽺𐽷")) or (lemma .. "𐽺𐽳𐽺𐽷")), -- genitive singular
		link(lemma .. "𐾁𐽰𐽾𐽺𐽶𐽺𐽷"), -- genitive plural
		link(lemma .. "𐽷𐽰"), -- dative singular
		link(lemma .. "𐾁𐽰𐽾𐽷𐽰"), -- dative plural
		link((ends_in == "c" and (type == "a" and (lemma .. "𐽶𐽲") or (lemma .. "𐽳𐽲"))) or (lemma .. "𐽲")), -- accusative singular 1
		link(lemma .. "𐽺𐽶"), -- accusative singular 2
		link(lemma .. "𐾁𐽰𐽾𐽶𐽲"), -- accusative plural 1
		link(lemma .. "𐾁𐽰𐽾𐽺𐽶"), -- accusative plural 2
		link(lemma .. "𐾀𐽰"), -- locative singular
		link(lemma .. "𐾁𐽰𐽾𐾀𐽰"), -- locative plural
		link(lemma .. "𐾀𐽶𐽺"), -- ablative singular
		link(lemma .. "𐾁𐽰𐽾𐾀𐽶𐽺"), -- ablative plural
		link((ends_in == "c" and (type == "a" and (lemma .. "𐽶𐽺") or (lemma .. "𐽳𐽺"))) or (lemma .. "𐽺")), -- instrumental singular
		link(lemma .. "𐾁𐽰𐽾𐽶𐽺"), -- instrumental plural
		link(lemma .. "𐽽𐽰"), -- equative singular
		link(lemma .. "𐽷𐽰𐽾𐽳"), -- directive singular
		link(lemma .. "𐾁𐽰𐽶𐽳") -- similative singular
	)
end

return export