Modul:frame test

A Wikiszótárból, a nyitott szótárból

A modult a Modul:frame test/doc lapon tudod dokumentálni

local export = {}

local parent_frame = {}

-- parent_frame.args is set below.
local function get_parent_frame()
	return parent_frame
end

-- frame_args: table; parent_frame_args: table; title: string (full pagename)
function export.test_frame_function(func, frame_args, parent_frame_args, title)
	parent_frame.args = parent_frame_args
	local frame = { args = frame_args, getParent = get_parent_frame }
	if title then
		-- Not always reliable and maybe dangerous.
		mw.title.getCurrentTitle = function ()
			return mw.title.new(title)
		end
	end
	return func(frame)
end

return export