Module:CIB: Difference between revisions

From The Satanic Wiki
Jump to navigation Jump to search
(Created page with "local capiunto = require 'capiunto' local p = {} function p.main(frame) local args = frame:getParent().args local headerStyle if args.headerstyle and args.headerstyle ~=...")
 
No edit summary
Line 1: Line 1:
local capiunto = require 'capiunto'
local p = {}
local p = {}
 
function p.main(frame)
function p.run()
local args = frame:getParent().args
local capiunto = require 'capiunto'
local headerStyle
return capiunto.create( {
if args.headerstyle and args.headerstyle ~= '' then
title = tostring(mw.title.getCurrentTitle()) ,
headerStyle = string.format('background-color:%s;', args.headerstyle)
top = 'Above text',
else
topStyle = 'background:#cfc;',
headerStyle = 'background-color:grey;'
bottom = 'Below text'
end
local retval = capiunto.create( {
title = args.title,
headerStyle = headerStyle,
} )
} )
:addImage( args.image, args.caption )
:addRow('H', 'Hydrogen')
:addRow( 'Foo', args.foo )
:addRow('He','Helium')
:addHeader( 'A header between the data rows' )
:addRow('Li','Lithium')
:addRow( 'Bar', args.bar )
:addImage(
return retval
'[[File:Keyhole Nebula - Hubble 1999.jpg|200px|alt=Keyhole Nebula - Hubble 1999]]',  
'Caption displayed below'
)
end
end
 
return p
return p

Revision as of 22:01, 21 June 2021

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

local p = {}
 
function p.run()
	local capiunto = require 'capiunto'
	return capiunto.create( {
		title = tostring(mw.title.getCurrentTitle()) ,
		top = 'Above text',
		topStyle = 'background:#cfc;',
		bottom = 'Below text'
	} )
	:addRow('H', 'Hydrogen')
	:addRow('He','Helium')
	:addRow('Li','Lithium')
	:addImage(
		'[[File:Keyhole Nebula - Hubble 1999.jpg|200px|alt=Keyhole Nebula - Hubble 1999]]', 
		'Caption displayed below'
	)
end
 
return p