Module:SubpageAfter

local util_cargo = require('Module:CargoUtil') local util_esports = require("Module:EsportsUtil") local util_form = require('Module:FormUtil') local util_text = require("Module:TextUtil") local util_title = require("Module:TitleUtil")

local FORM_INFO = { form = 'TournamentStatistics', template = 'TS' }

-- this module is to be wiki-specific

local p = {} function p.after(tabstype) local titletbl = util_title.titleTable local text = {} if tabstype == 'Player' then p.after_player(text, titletbl) elseif tabstype == 'Team' then p.after_team(text, titletbl) end if not mw.title.makeTitle('',titletbl[1]).exists then text[#text+1] = '' end local output = table.concat(text) return output end

function p.after_player(text, titletbl) if titletbl[2] == 'Statistics' and titletbl[3] then text[#text+1] = p.playerConcept(titletbl) or '' end if titletbl[2] then if p.doWeLowercase('Players', titletbl[1]) then util_title.lowercase end end return end

function p.playerConcept(titletbl) local player = titletbl[1] local year = titletbl[3] local formlink = util_form.fullURL(FORM_INFO, {preload = 'PlayerByChampion', link = player, year = year}) return ("\n:''This page shows all of %s statistics from %s separated by tournament. To see combined stats, [%s Click Here] ."):format(		util_text.possessive(util_esports.playerLinked(player)),		year,		formlink	) end

function p.after_team(text, titletbl) if titletbl[2] then if p.doWeLowercase('Teams', titletbl[1]) then util_title.lowercase end end return end

function p.doWeLowercase(tbl, title) local query = { tables = tbl, fields = 'IsLowercase', where = string.format('_pageName="%s"',title), types = { IsLowercase = 'boolean' } }	return util_cargo.getOneResult(query) end return p