Module:Musician Infobox

From NOISZ Wiki
Revision as of 17:15, 25 December 2025 by RiceEmpress (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This module is intended to create infoboxes on the musician pages on each of their categories, using Capiunto's infobox capabilities.


local capiunto = require 'capiunto'
local p = {}
function p.main(frame) 
	local infobox_name = ""
	local args = frame:getParent().args
	if args.name then 
		infobox_name = args.name 
	else
		infobox_name = string.gsub(tostring(mw.title.getCurrentTitle()),"Category:Songs featuring","")
	end
    local infobox = capiunto.create( {
	title = infobox_name
		
    } )
	if args.image1 then
		infobox:addImage('[[File:' .. args.image1 .. '|200px]]', args.caption )
	end
	local attributes = 
	{
		{ 'Website', args. website },
		{ 'Carrd', args.carrd },
		{ 'Linktree', args.linktree },
		{ 'Lit.link', args.litlink },
		{ 'Pronouns', args.pronouns },
		{ 'about.me', args.aboutme },
		{ 'Active from', args.active_from }
	}
	local music = 
	{
		{ 'Spotify', args.spotify },
		{ 'YouTube', args.youtube },
		{ 'Bandcamp', args.bandcamp },
		{ 'Soundcloud', args.soundcloud },
		{ 'Apple Music', args.apple_music },
		{ 'iTunes', args.itunes },
		{ 'Niconico', args.niconico }
	}
	local socials = 
	{
		{ 'Twitter', args.twitter},
		{ 'Bluesky', args.bluesky },
		{ 'Instagram', args.instagram },
		{ 'Facebook', args.facebook },
		{ 'Threads', args.threads },
		{ 'Twitch', args.twitch },
		{ 'TikTok', args.tiktok },
		{ 'Mastodon', args.mastodon },
		{ 'Tumblr', args.tumblr },
		{ 'Ameblo', args.ameblo },
		{ 'Misskey', args.misskey },
		{ 'Newgrounds', args.newgrounds },
		{ 'Blogspot', args.blogspot },
		{ 'Artstation', args.artstation },
		{ 'Pixiv', args.pixiv },
		{ 'Other', args.other }
	}
	local stores = 
	{
		{ 'Booth', args.booth },
		{ 'Fanbox', args.fanbox },
		{ 'skeb', args.skeb },
		{ 'Vgen', args.vgen },
		{ 'Ko-Fi', args.kofi },
		{ 'Patreon', args.patreon }
	}
	if args.website or args.pronouns or args.active_from or args.litlink or args.carrd or args.linktree or args.aboutme then
		for _, row in ipairs(attributes) do
			local label, value = row[1], row[2]
			if value and value ~= '' then
           		infobox:addRow(label, value)
			end
		end
	end
	if args.spotify or args.bandcamp or args.youtube or args.itunes or args.apple_music or args.niconico or args.soundcloud then
		infobox:addHeader( 'Music' )
		for _, row in ipairs(music) do
			local label, value = row[1], row[2]
			if value and value ~= '' then
           		infobox:addRow(label, value)
			end
		end
	end
	if args.twitter or args.bluesky or args.instagram or args.facebook or args.threads or args.twitch or args.tiktok or args.mastodon or args.tumblr or args.ameblo or args.newgrounds or args.aboutme or args.blogspot or args.other or args.misskey or args.pixiv then
		infobox:addHeader( 'Socials' )
		for _, row in ipairs(socials) do
			local label, value = row[1], row[2]
			if value  and value ~= '' then
           		infobox:addRow(label, value)
			end
		end
	end
	if args.booth or args.fanbox or args.vgen or args.kofi or args.skeb or args.patreon then
		infobox:addHeader( 'Stores/Support' )
		for _, row in ipairs(stores) 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