Module:CurrentLeagueParticipantNavbox

-- CurrentLeagueParticipantNavbox local Team = require('Module:Team').team local util_navbox = require('Module:NavboxUtil') local p = {}

function p.formatTeam(teams, teamrow, suffix) if util_navbox.doesSuffixExist(teamrow.teamlink, suffix) then teams[#teams+1] = Team{ teamrow.teamlink, "rightmediumlinked", suffix = suffix } else teams[#teams+1] = string.format(' %s ',			Team{ teamrow.teamlink, "rightmediumlinked" }			) end return end

function p.CLPNavbox(frame) local args = frame if frame == mw.getCurrentFrame then args = require( 'Module:ProcessArgs' ).merge( true ) else frame = mw.getCurrentFrame end local text = {} local title = mw.title.getCurrentTitle local thisteam = Team{args[1] or title.baseText,"teamlinkname"} local suffix = (args.suffix == 'Yes') and util_navbox.getSuffix(args, title) local result = mw.ext.cargo.query("CurrentLeagues, TournamentRosters",		"CONCAT(CurrentLeagues.Page)=Page,CurrentLeagues.Event=Event",		{			where = 'TournamentRosters.TeamLink="' .. thisteam .. '" AND CurrentLeagues.Page IS NOT NULL',			groupBy = "CurrentLeagues.Page",			join = "TournamentRosters._pageName = CurrentLeagues.Page"		}) for _, row in ipairs(result) do		lineresult = mw.ext.cargo.query("TournamentRosters","TeamLink=teamlink", {			where = '_pageName = "' .. row.Page .. '"',			groupBy = "TeamLink"		}) teams = {} for _, teamrow in ipairs(lineresult) do			p.formatTeam(teams, teamrow, suffix) end text[#text+1] = frame:expandTemplate{ title = "Navbox", args = { name = "CurrentLeagueParticipantNavbox", title = "" .. row.Event .. " Participants", state = "mw-collapsible", list1 = table.concat(teams, "&ensp;") }}		frame:callParserFunction('#vardefine','navbox','true') end output = table.concat(text,"") return output end

return p