Module:head/languages/lfv: Difference between revisions

From Laenkea
Jump to navigation Jump to search
No edit summary
No edit summary
Line 34: Line 34:
language = lfv,
language = lfv,
pos = "verb",
pos = "verb",
genders = args["g"],
genders = args[1],
inflections = inflections,
inflections = inflections,
}
}
Line 60: Line 60:
language = lfv,
language = lfv,
pos = "noun",
pos = "noun",
genders = args["g"],
genders = args[1],
inflections = inflections,
inflections = inflections,
}
}

Revision as of 19:11, 6 August 2023

Documentation for this module may be created at Module:head/languages/lfv/documentation

local export = {}

local m_head = require("Module:head")
local m_parameters = require("Module:parameters")
local lfv = require("Module:languages").get_by_code("lfv")

local function insert_if_any(inflections, arg, label, glossary)
	if not arg or #arg < 1 then return end
	local inflection = {["label"] = label}
	if glossary then inflection["glossary"] = glossary end
	for _, v in ipairs(arg) do table.insert(inflection, v) end
	table.insert(inflections, inflection)
end

function export.verb(frame)
	local args = m_parameters.process(frame:getParent().args, {
		[1] = {list = true},
		head = {},
		pfv = {list = true},
		impfv = {list = true},
		pass = {list = true},
		["pres-3s"] = {list = true},
		["rem-3s"] = {list = true},
	})
	local inflections = {}
	insert_if_any(inflections, args["pfv"], "perfective", true)
	insert_if_any(inflections, args["impfv"], "imperfective", true)
	insert_if_any(inflections, args["pres-3s"], "3rd person singular present")
	insert_if_any(inflections, args["rem-3s"], "3rd person singular remote past")
	insert_if_any(inflections, args["pass"], "passive participle")
	return m_head.full_head{
		term = mw.title.getCurrentTitle().text,
		head = args["head"],
		language = lfv,
		pos = "verb",
		genders = args[1],
		inflections = inflections,
	}
end

function export.noun(frame)
	local args = m_parameters.process(frame:getParent().args, {
		[1] = {list = true},
		head = {},
		du = {list = true},
		pl = {list = true},
		dim = {list = true},
		aug = {list = true},
		pej = {list = true},
	})
	local inflections = {}
	insert_if_any(inflections, args["du"], "dual", true)
	insert_if_any(inflections, args["pl"], "plural", true)
	insert_if_any(inflections, args["dim"], "diminutive", true)
	insert_if_any(inflections, args["aug"], "augmentative", true)
	insert_if_any(inflections, args["pej"], "pejorative", true)
	return m_head.full_head{
		term = mw.title.getCurrentTitle().text,
		head = args["head"],
		language = lfv,
		pos = "noun",
		genders = args[1],
		inflections = inflections,
	}
end

return export