Halo Esports Wiki

We are currently performing extensive maintenance to this wiki and as a result there will likely be errors. Please be patient while we work to fix all problems.

READ MORE

Halo Esports Wiki
Advertisement

Documentation for this module may be created at Module:SubpageAfter/doc

local util_form = require('Module:FormUtil')
local util_cargo = require('Module:CargoUtil')

-- this module is to be wiki-specific

local p = {}
function p.after(frame, fulltitle, tabstype)
	local titletbl = mw.text.split(fulltitle, '/')
	local text = {}
	if tabstype == 'Player' then
		p.after_player(text, frame, titletbl)
	elseif tabstype == 'Team' then
		p.after_team(text, frame, titletbl)
	end
	if not mw.title.makeTitle('',titletbl[1]).exists then
		text[#text+1] = '[[Category:Player Secondary Pages Without Primary Pages]]'
	end
	local output = table.concat(text)
	return output
end

function p.after_player(text, frame, titletbl)
	if titletbl[2] then
		if p.doWeLowercase('InfoboxPlayer', titletbl[1]) then
			text[#text+1] = frame:expandTemplate({ title = 'lowercase' })
		end
	end
	return
end

function p.after_team(text, frame, titletbl)
	if titletbl[2] then
		if p.doWeLowercase('InfoboxTeam', titletbl[1]) then
			text[#text+1] = frame:expandTemplate({ title = 'lowercase' })
		end
	end
	return
end

function p.doWeLowercase(tbl, title)
	local where = string.format('_pageName="%s"',title)
	return util_cargo.getOneResult(tbl,'IsLowercase', {where = where}) == 'Yes'
end
return p
Advertisement