Module:SisterTeams

local m_team = require('Module:Team') local sep = '%s*,%s*'

local p = {}

function p.ccSisterTeams(frame) local args = frame if frame == mw.getCurrentFrame then args = require( 'Module:ProcessArgs' ).merge( true ) else frame = mw.getCurrentFrame end teams = { Active = mw.text.split(args.active or '',sep), Inactive = mw.text.split(args.inactive or '',sep), Active_markup = {}, Inactive_markup = {}, allteams = {}, allteams_markup = {} }	teamscopy = {} -- standardize input names & make markup tables for _, list in pairs{"Active", "Inactive"} do		for i, team in ipairs(teams[list]) do			if team ~= '' then teams[list][i] = m_team.teamlinkname(team) teams[list .. '_markup'][i] = m_team.rightlonglinked(team, {size=45}) teams.allteams[#teams.allteams+1] = teams[list][i] teams.allteams_markup[#teams.allteams_markup+1] = teams[list .. '_markup'][i] end end end -- store cargo other = { Active = "Inactive", Inactive = "Active" } for _, list in pairs{"Active", "Inactive"} do		for i, team in ipairs(teams[list]) do			if team ~= '' then table.remove(teams[list],i) team_markup = table.remove(teams[list .. '_markup'],i) data = { Team = team, Team_Markup = team_markup, Status = list, ActiveList = table.concat(teams.Active,','), InactiveList = table.concat(teams.Inactive,','), Active_Markup = table.concat(teams.Active_markup,','), Inactive_Markup = table.concat(teams.Inactive_markup,','), AllTeams = table.concat(teams.allteams,','), AllTeams_Markup = table.concat(teams.allteams_markup,','), _table = 'SisterTeams' }				frame:callParserFunction('#cargo_store:',data) table.insert(teams[list],i,team) table.insert(teams[list .. '_markup'],i,team_markup) end end end tbl = mw.html.create tbl:tag('tr') :tag('td') :wikitext(table.concat(teams.Active_markup,' &#8226; ')) :done :tag('td') :wikitext(table.concat(teams.Inactive_markup,' &#8226; ')) :done :done return tostring(tbl) end return p