Module:Album: Difference between revisions

From The Coffin of Andy and Leyley

m (oops 2)
(might fix image issue)
Tag: Reverted
Line 13: Line 13:
} )
} )


retval:addImage( args.image, args.imagecaption )
if v(args.imagecaption) then
retval:addImage( args.image, "" )
else
retval:addImage( args.image, args.imagecaption )
end
if v(args.artist) then retval:addRow( 'Artist', args.artist ) end
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.released) then retval:addRow( 'Released', args.released ) end

Revision as of 18:03, 2 January 2024

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,
	} )

	if v(args.imagecaption) then
		retval:addImage( args.image, "" )
	else
		retval:addImage( args.image, args.imagecaption )
	end
	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