Module:Chronology

local p = {}; local data = { ['The Smashing Pumpkins'] = { ['albums'] = { { title = 'Nothing Ever Changes', year = 1988 }, { title = 'The Smashing Pumpkins', year = 1989, link = 'The Smashing Pumpkins (album)' }, { title = 'Moon Demo', year = 1989 }, { title = 'Gish', year = 1991 }, { title = 'Lull', year = 1991 }, { title = 'Peel Sessions', year = 1992 }, { title = 'Siamese Dream', year = 1993 }, { title = 'Siamese Singles', year = 1994 }, { title = 'Pisces Iscariot', year = 1994 }, { title = 'Mellon Collie and the Infinite Sadness', year = 1995 }, { title = 'The Aeroplane Flies High', year = 1996 }, { title = 'Adore', year = 1998 }, { title = 'Machina/The Machines of God', year = 2000}, { title = 'Machina II/The Friends & Enemies of Modern Music', year = 2000 }, { title = 'Live at Cabaret Metro 10-5-88', year = 2000 }, { title = 'Rotten Apples', year = 2001 }, { title = 'Judas O', year = 2001 }, { title = 'Earphoria', year = 2002 }, { title = 'Rarities and B-Sides', year = 2005 }, { title = 'Zeitgeist', year = 2007 }, { title = 'American Gothic', year = 2007 }, { title = 'Teargarden by Kaleidyscope', year = 2009 }, { title = 'Oceania', year = 2011 }, { title = 'Monuments to an Elegy', year = 2014 }, { title = 'Shiny and Oh So Bright, Vol. 1 / LP: No Past. No Future. No Sun.', year = 2018 } },		['singles'] = { { title = 'I Am One', year = 1990 }, { title = 'Tristessa', year = 1990 }, { title = 'Siva', year = 1991 }, { title = 'Rhinoceros', year = 1991 }, { title = 'Drown', year = 1992 }, { title = 'Cherub Rock', year = 1993 }, { title = 'Today', year = 1993 }, { title = 'Disarm', year = 1994 }, { title = 'Rocket', year = 1994 }, { title = 'Bullet with Butterfly Wings', year = 1995 }, { title = '1979', year = 1996 }, { title = 'Zero', year = 1996 }, { title = 'Tonight, Tonight', year = 1996 }, { title = 'Muzzle', year = 1996 }, { title = 'Thirty-Three', year = 1996 }, { title = 'Eye', year = 1997 }, { title = 'The End Is the Beginning Is the End', year = 1997 }, { title = 'Ava Adore', year = 1998 }, { title = 'Perfect', year = 1998 }, { title = 'Crestfallen', year = 1998 }, { title = 'To Sheila', year = 1999 }, { title = 'The Everlasting Gaze', year = 1999 }, { title = 'Stand Inside Your Love', year = 2000 }, { title = 'I of the Mourning', year = 2000 }, { title = 'Try, Try, Try', year = 2000 }, { title = 'Heavy Metal Machine', year = 2000 }, { title = 'Untitled', year = 2000 }, { title = 'Tarantula', year = 2007 }, { title = "That's the Way (My Love Is)", year = 2007 }, { title = 'G.L.O.W.', year = 2008 }, { title = 'Widow Wake My Mind', year = 2010 }, { title = 'Freak', year = 2010 }, { title = 'Owata', year = 2011 }, { title = 'The Celestials', year = 2012 }, { title = 'Panopticon', year = 2012 }, { title = 'Being Beige', year = 2014 }, { title = 'One and All (We Are)', year = 2014 }, { title = 'Drum + Fife', year = 2014 }, { title = 'Run2me', year = 2015 }, { title = 'Solara', year = 2018 }, { title = 'Silvery Sometimes (Ghosts)', year = 2018 } }	},	['Billy Corgan'] = { ['albums'] = { { title = 'TheFutureEmbrace', year = 2005 }, { title = 'Ogilala', year = 2017 }, { title = 'Cotillions', year = 2019 } },		['singles'] = { { title = 'Walking Shade', year = 2005 }, { title = 'Mina Loy (M.O.H.)', year = 2005 }, { title = 'Aeronaut', year = 2017 } }	},	['James Iha'] = { ['albums'] = { { title = 'Let It Come Down', year = 1998 }, { title = 'Look to the Sky', year = 2012 } },		['singles'] = { { title = 'Be Strong Now', year = 1998 }, { title = 'Jealousy', year = 1998 }, { title = 'To Who Knows Where', year = 2012 } }	},	['Jimmy Chamberlin Complex'] = { ['albums'] = { { title = 'Life Begins Again', year = 2005 }, { title = 'The Parable', year = 2017 } }	},	['Tribute'] = { ['albums'] = { { title = 'Ghost Children: A Tribute To The Smashing Pumpkins', year = 2001 }, { title = 'Ghost Children/Friends and Enemies', year = 2006 }, { title = 'MySpace Smashing Pumpkins Tribute', year = 2007 } }	} }

function p.track_listing( album, song ) local cargo = mw.ext.cargo local results = cargo.query(		'track_listings',		'track, song, length',		{ where = 'work = "' .. album .. '" AND main_listing = 1' }	)

for r = 1, #results do		local result = results[r] if result.song == song then local wikitext = "{| style='background: transparent; width: 100%; min-width: 100%; border-collapse: collapse'" wikitext = wikitext .. "\n|- style='line-height: 1.4em;'" wikitext = wikitext .. "\n| style='width: 33%; text-align: center; vertical-align: top; padding: .2em .1em .2em 0' |" if r > 1 then local prev_song = results[r - 1] wikitext = wikitext .. prev_song.track .. '. "' .. prev_song.song .. '" (' .. prev_song.length .. ')' end wikitext = wikitext .. "\n| style='width: 33%; text-align: center; vertical-align: top; padding: .2em .1em' |" wikitext = wikitext .. result.track .. '. "' .. result.song .. '" (' .. result.length .. ')' wikitext = wikitext .. "\n| style='width: 33%; text-align: center; vertical-align: top; padding: .2em 0 .2em .1em' |" if results[r + 1] ~= nil then local next_song = results[r + 1] wikitext = wikitext .. next_song.track .. '. "' .. next_song.song .. '" (' .. next_song.length .. ')' end

return wikitext .. "\n|}" end end return '' end

function p.check( frame ) local artist = frame.args[1] local kind = frame.args[2] local title = frame.args[3]

if data[artist] == nil then return '' end if data[artist][kind] == nil then return '' end

for _i, subject in ipairs(data[artist][kind]) do		if title == subject.title then return 'true' end end return '' end

local function entry(row, kind, current) local formatting = "''" -- For albums if kind == 'singles' then formatting = '"'	end	if current then		formatting = formatting .. "'''"	end	local link = row.title	if row.link ~= nil then		link = row.link .. "|" .. row.title	end	return formatting .. "" .. link .. "" .. formatting .. " (" .. row.year .. ")" end

function p.main( frame ) local artist = frame.args[1] local kind = frame.args[2] local title = frame.args[3]

if data[artist] == nil then return '' end local collection = data[artist][kind] if collection == nil then return '' end

for i, subject in ipairs(collection) do		if title == subject.title then local wikitext = "{| style='background: transparent; width: 100%; min-width: 100%; border-collapse: collapse'" wikitext = wikitext .. "\n|- style='line-height: 1.4em;'" wikitext = wikitext .. "\n| style='width: 33%; text-align: center; vertical-align: top; padding: .2em .1em .2em 0' |" if i > 1 then wikitext = wikitext .. entry(collection[i - 1], kind, false) end wikitext = wikitext .. "\n| style='width: 33%; text-align: center; vertical-align: top; padding: .2em .1em' |" wikitext = wikitext .. entry(subject, kind, true) wikitext = wikitext .. "\n| style='width: 33%; text-align: center; vertical-align: top; padding: .2em 0 .2em .1em' |" if collection[i + 1] ~= nil then wikitext = wikitext .. entry(collection[i + 1], kind, false) end

return wikitext .. "\n|}" end end return '' end

return p