Module:head/languages: Difference between revisions

From Laenkea
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:
function export.get_args(args, params, inflection_params)
function export.get_args(args, params, inflection_params)
if inflection_params then
if inflection_params then
for k, _ in pairs(inflection_params) do
for _, v in ipairs(inflection_params) do
params[k] = {list = true}
params[v.param] = {list = true}
end
end
end
end
Line 10: Line 10:
local inflections = {}
local inflections = {}
if inflection_params then
if inflection_params then
for k, v in pairs(inflection_params) do
for _, v in ipairs(inflection_params) do
local inflection = p[k]
local inflection = p[v.param]
inflection["label"] = v["label"]
inflection["label"] = v.label
inflection["glossary"] = v["glossary"]
inflection["glossary"] = v.glossary
table.insert(inflections, inflection)
table.insert(inflections, inflection)
end
end

Revision as of 10:45, 12 August 2023

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

local export = {}

function export.get_args(args, params, inflection_params)
	if inflection_params then
		for _, v in ipairs(inflection_params) do
			params[v.param] = {list = true}
		end
	end
	local p = require("Module:parameters").process(args, params)
	local inflections = {}
	if inflection_params then
		for _, v in ipairs(inflection_params) do
			local inflection = p[v.param]
			inflection["label"] = v.label
			inflection["glossary"] = v.glossary
			table.insert(inflections, inflection)
		end
	end
	return p, inflections
end

function export.get_term()
	return mw.title.getCurrentTitle().text
end

return export