Module:form of/templates: Difference between revisions

From Laenkea
Jump to navigation Jump to search
(Created page with "local export = {} local m_form_of = require("Module:form of") local m_languagse = require("Module:languages") local m_parameters = require("Module:parameters") local inflection_params = { [1] = {required = true}, [2] = {required = true}, [3] = {list = true}, ["alt"] = {}, ["t"] = {}, ["pos"] = {}, } local form_params = { [1] = {required = true}, [2] = {required = true}, ["form"] = {aliases={3}}, ["alt"] = {}, ["t"] = {}, ["pos"] = {}, } function export.in...")
 
No edit summary
 
(12 intermediate revisions by 2 users not shown)
Line 2: Line 2:


local m_form_of = require("Module:form of")
local m_form_of = require("Module:form of")
local m_languagse = require("Module:languages")
local m_languages = require("Module:languages")
local m_parameters = require("Module:parameters")
local m_parameters = require("Module:parameters")


Line 17: Line 17:
[1] = {required = true},
[1] = {required = true},
[2] = {required = true},
[2] = {required = true},
["form"] = {aliases={3}},
[3] = {alias_of = "form"},
["form"] = {},
["alt"] = {},
["alt"] = {},
["t"] = {},
["t"] = {},
["pos"] = {},
["pos"] = {},
["nocat"] = {},
["post"] = {},
["note"] = {},
["q"] = {alias_of = "note"}
}
local list_params = {
[1] = {list = true},
["alt"] = {},
}
}


Line 44: Line 54:
gloss = args["t"],
gloss = args["t"],
pos = args["pos"],
pos = args["pos"],
nocat = args["nocat"],
post = args["post"],
note = args["note"]
}
end
function export.inflection_list(frame)
local args = m_parameters.process(frame:getParent().args, list_params)
return m_form_of.list_form{
inflection = args[1],
alt = args["alt"],
}
}
end
end


return export
return export

Latest revision as of 12:21, 17 August 2024

Documentation for this module may be created at Module:form of/templates/documentation

local export = {}

local m_form_of = require("Module:form of")
local m_languages = require("Module:languages")
local m_parameters = require("Module:parameters")

local inflection_params = {
	[1] = {required = true},
	[2] = {required = true},
	[3] = {list = true},
	["alt"] = {},
	["t"] = {},
	["pos"] = {},
}

local form_params = {
	[1] = {required = true},
	[2] = {required = true},
	[3] = {alias_of = "form"},
	["form"] = {},
	["alt"] = {},
	["t"] = {},
	["pos"] = {},
	["nocat"] = {},
	["post"] = {},
	["note"] = {},
	["q"] = {alias_of = "note"}
}

local list_params = {
	[1] = {list = true},
	["alt"] = {},
}

function export.inflection_of(frame)
	local args = m_parameters.process(frame:getParent().args, inflection_params)
	return m_form_of.make_form_of{
		language = m_languages.get_by_code(args[1]),
		term = args[2],
		inflection = args[3],
		alt = args["alt"],
		gloss = args["t"],
		pos = args["pos"],
	}
end

function export.form_of(frame)
	local args = m_parameters.process(frame:getParent().args, form_params)
	return m_form_of.make_form_of{
		language = m_languages.get_by_code(args[1]),
		term = args[2],
		form = args["form"],
		alt = args["alt"],
		gloss = args["t"],
		pos = args["pos"],
		nocat = args["nocat"],
		post = args["post"],
		note = args["note"]
	}
end

function export.inflection_list(frame)
	local args = m_parameters.process(frame:getParent().args, list_params)
	return m_form_of.list_form{
		inflection = args[1],
		alt = args["alt"],
	}
end

return export