Module:Album: Difference between revisions

From The Coffin of Andy and Leyley

(Create Album Module)
 
m (oops 2)
Line 10: Line 10:
local args = frame:getParent().args
local args = frame:getParent().args
local retval = capiunto.create( {
local retval = capiunto.create( {
title = args.name,
title = args.title,
} )
} )



Revision as of 17:50, 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,
	} )

	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