モジュール:hrx-cell

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

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

local m_links = require("モジュール:links")
local lang = require("モジュール:languages").getByCode("hrx")
local export = {}

local accel_forms = {
	--NOUNS
	ncs = "nom|s",
	ds = "dat|s",
	ncp = "nom|p",
	dp = "dat|p",
}

function export.create(frame)
	local args = frame:getParent().args
	local links = {}
	if not args[1] or args[1] == "" then
		return "―"
	else
		local accel_form = args[2]
		local accel
		if accel_form then
			local mode = args[3]
			if mode and mode_prefix[mode] then
				accel_form = mode_prefix[mode] .. accel_form
			end
			if accel_forms[accel_form] then
				if mode and mode_prepend[mode] then
					accel_form = mode_prepend[mode] .. accel_forms[accel_form]
				else
					accel_form = accel_forms[accel_form]
				end
			end
			accel = {form = accel_form}
		end
		local words = mw.text.split(args[1], "%s*,%s*")
		if words then
			for i,j in ipairs(words) do
				table.insert(links, m_links.full_link({lang = lang, term = j, accel = accel}))
			end
		end
	end
	return table.concat(links, ", ")
end

return export