Module:Album

From The Coffin of Andy and Leyley

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

local capiunto = require 'capiunto'

local p = {}

local function v( val, name )
	return (val ~= nil) and ((type( val ) == 'string' and val ~= '') or type( val ) == 'number')
end

function p.main(frame)
	local args = frame:getParent().args
	local retval = capiunto.create( {
		title = args.title,
	} )

	retval:addImage( args.image, args.imagecaption )
	if v(args.artist) then retval:addRow( 'Artist', args.artist ) end
	if v(args.released) then retval:addRow( 'Released', args.released ) end
	if v(args.recorded) then retval:addRow( 'Recorded', args.recorded ) end
	if v(args.length) then retval:addRow( 'Length', args.length ) end
	if v(args.label) then retval:addRow( 'Label', args.label ) end
	if v(args.producer) then retval:addRow( 'Producer', args.producer ) end

	return retval
end

return p