Module:Album: Difference between revisions

From The Coffin of Andy and Leyley

(might fix image issue)
Tag: Reverted
No edit summary
Tag: Reverted
Line 14: Line 14:


if v(args.imagecaption) then
if v(args.imagecaption) then
retval:addImage( args.image, "" )
retval:addImage( args.image )
else
else
retval:addImage( args.image, args.imagecaption )
retval:addImage( args.image, args.imagecaption )

Revision as of 18:04, 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