Jump to content

မေႃႇၵျူး:inflection table

လုၵ်ႉတီႈ ဝိၵ်ႇသျိၼ်ႇၼရီႇ မႃး

A simple Lua wrapper for {{inflection-table-top}} ({{inflection-table-bottom}}) and {{inflection-box-top}} ({{inflection-box-bottom}}).

By using this module, it's possible to avoid having to write manual expandTemplate calls and splitting arguments manually between the top and bottom templates.

The parameter order is designed such that the contents argument is intended to be supplied from a variable, or at most a short expression (using e.g. table.concat).

export.inflection_table

[မႄးထတ်း]

function export.inflection_table(frame, contents, args)

A simple Lua wrapper for {{inflection-table-top}} and {{inflection-table-bottom}}. frame should be the frame object, contents are the contents placed between the two templates, while args are appropriately split between {{inflection-table-top}} and {{inflection-table-bottom}}.

export.inflection_box

[မႄးထတ်း]

function export.inflection_box(frame, contents, args)

A simple Lua wrapper for {{inflection-box-top}} and {{inflection-box-bottom}}. frame should be the frame object, contents are the contents placed between the two templates, while args are appropriately split between {{inflection-box-top}} and {{inflection-box-bottom}}.


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, {contents} are the contents placed between
the two templates, while {args} are appropriately split between
{{tl|inflection-table-top}} and {{tl|inflection-table-bottom}}.
]==]
function export.inflection_table(frame, contents, args)
	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, {contents} are the contents placed between
the two templates, while {args} are appropriately split between
{{tl|inflection-box-top}} and {{tl|inflection-box-bottom}}.
]==]
function export.inflection_box(frame, contents, args)
	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