Module:PlayerPageEnd

From Call of Duty Esports Wiki
Jump to: navigation, search

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

local util_args = require('Module:ArgsUtil')
local util_map = require("Module:MapUtil")
local util_text = require("Module:TextUtil")
local util_vars = require("Module:VarsUtil")
local i18n = require('Module:i18nUtil')

local h = {}

local p = {}
function p.redirects(frame)
	i18n.init('PlayerPageEnd')
	local listOfRedirects = util_vars.getVar('whatredirectshere')
	return h.makeIntro(), h.makeContent(listOfRedirects)
end

function h.makeIntro()
	return i18n.print('redirectIntro')
end

function h.makeContent(listOfRedirects)
	if not listOfRedirects then return h.makeNoContent() end
	local output = mw.html.create('ul')
	util_map.split(
		listOfRedirects,
		';',
		h.printOneRedirect,
		output
	)
	return output
end

function h.makeNoContent()
	return mw.html.create('dl'):tag('dd'):wikitext(i18n.print('redirectNoInfo'))
end

function h.printOneRedirect(redirect, output)
	output:tag('li'):wikitext(util_text.intLinkOrText(redirect))
end

return p