Module:inflection table

From Linguifex
Jump to navigation Jump to search

Documentation for this module may be created at Module:inflection table/doc

local export = {}

local inflection_table_bottom_args = {
	["notes"] = true
}

--[==[
A simple Lua wrapper for {{tl|inflection-table-top}} and {{tl|inflection-table-bottom}}.
{frame} should be the frame object, {args} are appropriately split between
{{tl|inflection-table-top}} and {{tl|inflection-table-bottom}} and
{contents} are the contents placed between the two templates.
]==]
function export.inflection_table(frame, args, contents)
	local top_args = {}
	local bottom_args = {}
	
	for k, v in pairs(args) do
		if inflection_table_bottom_args[k] then
			bottom_args[k] = v
		else
			top_args[k] = v
		end
	end
	
	return frame:expandTemplate{ title = "inflection-table-top", args = top_args }
			.. contents
			.. frame:expandTemplate{ title = "inflection-table-bottom", args = bottom_args }
end

local inflection_box_bottom_args = {
}

--[==[
A simple Lua wrapper for {{tl|inflection-box-top}} and {{tl|inflection-box-bottom}}.
{frame} should be the frame object, {args} are appropriately split between
{{tl|inflection-box-top}} and {{tl|inflection-box-bottom}}, and
{contents} are the contents placed between the two templates.
]==]
function export.inflection_box(frame, args, contents)
	local top_args = {}
	local bottom_args = {}
	
	for k, v in pairs(args) do
		if inflection_box_bottom_args[k] then
			bottom_args[k] = v
		else
			top_args[k] = v
		end
	end
	
	return frame:expandTemplate{ title = "inflection-box-top", args = top_args }
			.. contents
			.. frame:expandTemplate{ title = "inflection-box-bottom", args = bottom_args }
end

return export