Module:Infobox live show

local p = {} local cargo = mw.ext.cargo

local members = { ['Aronoff'] = 'Kenny Aronoff', ['Auf der Maur'] = 'Melissa Auf der Maur', ['Bates'] = 'Jack Bates', ['Billy Corgan'] = 'Billy Corgan', ['Bradley'] = 'Stephen Bradley', ['Byrne'] = 'Mike Byrne', ['Chamberlin'] = 'Jimmy Chamberlin', ['Cole'] = 'Katie Cole', ['Corgan'] = 'Billy Corgan', ['Fiorentino'] = 'Nicole Fiorentino', ['Flemion'] = 'Dennis Flemion', ['Garson'] = 'Mike Garson', ['Harriton'] = 'Lisa Harriton', ['Hodges'] = 'Stephen Hodges', ['Holmes'] = 'Chris Holmes', ['Iha'] = 'James Iha', ['McNair'] = 'Gabrial McNair', ['Melvoin'] = 'Jonathan Melvoin', ['Morris'] = 'Dan Morris', ['Pooley'] = 'Kristopher Pooley', ['Remschneider'] = 'Eric Remschneider', ['Reyes'] = 'Ginger Pooley', ['Schroeder'] = 'Jeff Schroeder', ['Shankar'] = 'Gingger Shankar', ['Stoermer'] = 'Mark Stoermer', ['Strawberry'] = 'Linda Strawberry', ['Swan'] = 'Sierra Swan', ['Tulis'] = 'Mark Tulin', ['Walker'] = 'Matt Walker', ['Wilk'] = 'Brad Wilk', ['Wretzky'] = "D'arcy Wretzky", ['William Patrick Corgan'] = 'Billy Corgan' }

function p._normalizeMembers(names, linkIfExists) t = {} for m in string.gmatch(names, "([^,]+)") do		m = mw.text.trim(m) local member = m		if members[m] ~= nil then member = members[m] end

if linkIfExists then local mw_title = mw.title.makeTitle(0, member) if mw_title.exists then member =  .. member ..  end end table.insert(t, member) end return table.concat(t, ', ') end

function p.normalizeMembers(frame) local names = frame.args[1] local linkIfExists = frame.args[2] return p._normalizeMembers(names, linkIfExists) end

function p._prevShowLink(target) local span = mw.html.create('span') span:wikitext('Prev. show') return tostring(span) end

function p._prevShow(showDate, pageName) local prevShow = cargo.query('shows', '_pageName',		{			where = 'date < "' .. showDate .. '" OR (date = "' .. showDate .. '" AND _pageName < "' .. pageName .. '")',			limit = 1,			orderBy = 'date DESC, _pageName DESC'		}	)[1]

if prevShow == nil then return '' end

return p._prevShowLink(prevShow['_pageName']) end

function p.prevShowLink(frame) return p.prevShowLink(frame.args[1]) end

function p.prevShow(frame) local showDate = frame.args[1] local pageName = frame.args[2] return p._prevShow(showDate, pageName) end

function p._nextShowLink(target) local span = mw.html.create('span') span:wikitext('Next show') return tostring(span) end

function p.nextShowLink(frame) return p._nextShowLink(frame.args[1]) end

function p._nextShow(showDate, pageName) local nextShow = cargo.query('shows', '_pageName',		{			where = 'date > "' .. showDate .. '" OR (date = "' .. showDate .. '" AND _pageName > "' .. pageName .. '")',			limit = 1,			orderBy = 'date ASC, _pageName ASC'		}	)[1]

if nextShow == nil then return '' end return p._nextShowLink(nextShow['_pageName']) end

function p.nextShow(frame) local showDate = frame.args[1] local pageName = frame.args[2] return p._nextShow(showDate, pageName) end

function p._venueInfo(name, location) local info = cargo.query('venues', '_pageName, name, coords, type, capacity',		{			where = 'name = "' .. name .. '" AND location = "' .. location .. '"',			limit = 1,			orderBy = 'date ASC, _pageName ASC'		}	)[1]

if info == nil then return '' end

return info end

function p.venueInfo(frame) local showDate = frame.args[1] local pageName = frame.args[2] return p._venueInfo(showDate, pageName) end

return p