コンテンツにスキップ

モジュール:oui-decl

出典: フリー多機能辞典『ウィクショナリー日本語版(Wiktionary)』

このモジュールについての説明文ページを モジュール:oui-decl/doc に作成できます

local export = {}

local full_link = require("モジュール:links").full_link
local lang = require("モジュール:languages").getByCode("oui")
local sc = require("モジュール:scripts").getByCode("Ougr")

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

local wikicode = mw.getCurrentFrame():expandTemplate {
	title = 'inflection-table-top',
	args = {
		title = '%s の格変化',
		palette = 'grey',
		tall = 'yes',
		class = "tr-alongside"
	}
}

wikicode = wikicode .. [=[
! —
! 単数
! 複数
|-
! 主格
| %s
| %s
|-
! 属格
| %s
| %s
|-
! 与格
| %s
| %s
|-
! 対格
| %s<br>%s
| %s<br> %s
|-
! 処格
| %s
| %s
|-
! 奪格
| %s
| %s
|-
! 具格
| %s
| %s
|-
! 等格
| %s
| —
|-
! 方向格
| %s
| —
|-
! 類似格
| %s 
| —
]=]

wikicode = wikicode .. mw.getCurrentFrame():expandTemplate {
	title = 'inflection-table-bottom',
}

function export.show(frame)
	
	local params = {
		[1] = { required = true },
		[2] = { required = true },
		[3] = { required = true },
		["tr"] = {},
		["pagename"] = {},
	}

	local args = require("モジュール:parameters").process(frame:getParent().args, params, nil)
	
	local lemma = args.pagename or mw.loadData("モジュール:headword/data").pagename
	local f = args[1]:lower() == "f" -- "f" (front) or "b" (back)
	local a = args[2]:lower() == "a" -- "a" or "u"
	local c = args[3]:lower() == "c" -- "c" (consonant) or "v" (vowel)
	local tr = args["tr"]
	

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

return export