模組:Fi-headword

維基詞典,自由的多語言詞典


local export = {}
local lang = require("Module:languages").getByCode("fi")
local m_utilities = require("Module:utilities")

export.adj = function(frame)
	local title = mw.title.getCurrentTitle().text
	local args = frame:getParent().args
	local data = {lang = lang, pos_category = "形容詞"}
	local categories = {}
	
	if args["head"] then
		data.heads = {args["head"]}
	end
	
	if not args[1] then
		table.insert(categories, "fi-adj with no 1 or 2")
	elseif args[1] == "-" then
		data.inflections = {{ label = "無比較級" }}
		table.insert(categories, "芬蘭語無比較級形容詞")
	elseif not args[2] then
		table.insert(categories, "fi-adj with no 1 or 2")
	else
		local stem = args[1]
		local comp = {{term = stem .. args[2], accel = {form = "比較級"}}}
		local sup = {}
		
		for i = 3, 10 do
			if not args[i] then break end
			table.insert(sup, {term = stem .. args[i], accel = {form = "最高級"}})
		end
		
		if args["c2"] then
			table.insert(comp, {term = args["c2"], accel = {form = "比較級"}})
		elseif args["comp2"] then
			table.insert(comp, {term = args["comp2"], accel = {form = "比較級"}})
		end
		
		if args["c3"] then
			table.insert(comp, {term = args["c3"], accel = {form = "比較級"}})
		elseif args["comp3"] then
			table.insert(comp, {term = args["comp3"], accel = {form = "比較級"}})
		end
		
		data.inflections = {{label = "比較級", unpack(comp)}, {label = "最高級", unpack(sup)}}
	end
	
	data.categories = categories
	return require("Module:headword").full_headword(data)
end

return export