モジュール:aot-headword

出典: フリー多機能辞典『ウィクショナリー日本語版(Wiktionary)』
ナビゲーションに移動 検索に移動

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

local export = {}
local pos_functions = {}

local lang = require("モジュール:languages").getByCode("aot")
local PAGENAME = mw.title.getCurrentTitle().text
local script = require("モジュール:scripts").findBestScript(PAGENAME, lang) -- Latn or Beng

function export.show(frame)

	local args = frame:getParent().args
	local poscat = frame.args[1] or error("品詞が指定されていません。引数1にモジュール呼び出しを渡して下さい。")

	local data = {lang = lang, sc = script, pos_category = poscat, sccat = true, categories = {}, heads = {args["head"] or PAGENAME}, translits = {args["tr"]}, inflections = {}}

	local beng = {label = "ベンガル文字", lang = lang, sc = require("モジュール:scripts").getByCode("Beng")}
	if args[1] then table.insert(beng, args[1]) end
	if args[2] then table.insert(beng, args[2]) end
	if args[3] then table.insert(beng, args[3]) end
	if args[4] then table.insert(beng, args[4]) end
	if #beng > 0 then table.insert(data.inflections, beng) end

	if pos_functions[poscat] then
		pos_functions[poscat](args, data)
	end

	return require("モジュール:headword").full_headword(data)

end

pos_functions["verbs"] = function(args, data)

	--verb is always prefix
	data.heads[1] = data.heads[1] .. "-"

end

pos_functions["classifiers"] = function(args, data)

	--classifier is always prefix
	data.heads[1] = data.heads[1] .. "-"

end

pos_functions["adjectives"] = function(args, data)

	--adjective can be either type 1 or type 2
	if args["t"] ~= "1" and args["t"] ~= "2" then
		args["t"] = "?"
	end

	--adjective type 1 is prefix
	if args["t"] == "1" then
		data.heads[1] = data.heads[1] .. "-"
	end
	table.insert(data.inflections, {label = "type " .. args["t"]})

end

return export