Please remember that WiKirby contains spoilers, which you read at your own risk! See our general disclaimer for details.


From WiKirby, your independent source of Kirby knowledge.
Jump to navigationJump to search

Documentation for this module may be created at Module:Sandbox/Video/doc

local v = {}
local result = {}

-- base table
local root = mw.html.create('table')

function (frame)
	-- video code
	local code = frame:getParent().args[1]
	-- video size/resolution
	local size = frame:getParent().args[2] or '300px'
	-- alignment of the video
	local float = frame:getParent().args[3] or 'left'
	-- optional caption
	local caption = frame:getParent().args[4]
	-- defines the margin of the table
	-- if float == center, then the table will be X-centered
	local margins = '0 .5rem .5rem .5rem'
	if float == 'center' then
		float = 'none'
		margins = '0 auto'
	-- the table itself
	root:css('display', 'inline-table')
		:css('margin', margins)
		:css('padding', '3px 0 3px')
		:css('background-color', '#'.. frame:preprocess('{{WKColor4}}'))
		:css('border', '2px solid #'.. frame:preprocess('{{WKColor2}}'))
		:css('float', float)
		:tag('th'):wikitext(frame:callParserFunction('#ev:youtube', {code, size}))
	-- if caption is defined, add a new row, a new cell and the caption itself
	if caption then
	return tostring(root)

return v