Module:Album Infobox

From NOISZ Wiki
Revision as of 12:07, 17 December 2025 by RiceEmpress (talk | contribs) (Created page with "local capiunto = require 'capiunto' local p = {} function p.main(frame) local args = frame:getParent().args local infobox = capiunto.create( { title = args.title1 and args.title1 or tostring(mw.title.getCurrentTitle()) } ) if args.image1 and string.find(args.image1 .. "e","%p(tabber)%p") then infobox:addImage(args.image1, args.caption) elseif args.image1 then infobox:addImage('300px', args.caption) end local information=...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local capiunto = require 'capiunto'
local p = {}
function p.main(frame) 
	local args = frame:getParent().args
	local infobox = capiunto.create( {
		title = args.title1 and args.title1 or tostring(mw.title.getCurrentTitle())
    	} )
	if args.image1 and string.find(args.image1 .. "e","%p(tabber)%p") then
		infobox:addImage(args.image1, args.caption)
	elseif args.image1 then
		infobox:addImage('[[File:' .. args.image1 .. '|300px]]', args.caption)
	end
	local information= 
	{
		{'Release date', args.releasedate },
		{ 'Game(s)', args.games }
	}
	local links= 
	{
		{ 'Bandcamp', args.bandcamp },
		{ 'Spotify', args.spotify },
		{ 'Steam', args.steam },
		{ 'Soundcloud', args.soundcloud },
		{ 'Other', args.other}
	}

	if args.voice or args.jp_name or args.also_known_as then
		for _, row in ipairs(information) do
			local label, value = row[1], row[2]
			if value and value ~= '' then
           		infobox:addRow(label, value)
			end
		end
	end
	if args.bandcamp or args.spotify or args.steam or args.soundcloud or args.other then
		infobox:addHeader( 'Links' )
		for _, row in ipairs(links) do
			local label, value = row[1], row[2]
			if value and value ~= '' then
           		infobox:addRow(label, value)
			end
		end
	end
	
    return infobox
end

return p