Please remember that WiKirby contains spoilers, which you read at your own risk! See our general disclaimer for details.
Module:Sandbox/Video: Difference between revisions
From WiKirby, your independent source of Kirby knowledge.
Jump to navigationJump to search
(let's see if this works) |
m (oops, forgot to specify YouTube) |
||
Line 31: | Line 31: | ||
:css('border', '2px solid #'.. frame:preprocess('{{WKColor2}}')) | :css('border', '2px solid #'.. frame:preprocess('{{WKColor2}}')) | ||
:css('float', float) | :css('float', float) | ||
:tag('th'):wikitext('{{#ev|'.. code ..'|'.. size ..'}}') -- the video | :tag('th'):wikitext('{{#ev:youtube|'.. code ..'|'.. size ..'}}') -- the video | ||
-- if caption is defined, add a new row, a new cell and the caption itself | -- if caption is defined, add a new row, a new cell and the caption itself |
Revision as of 19:03, 16 April 2023
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 v.youtube (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' end -- the table itself root:tag('tr') :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('{{#ev:youtube|'.. code ..'|'.. size ..'}}') -- the video -- if caption is defined, add a new row, a new cell and the caption itself if caption then root:tag('tr') :tag('td'):wikitext(caption) end return tostring(root) end return v