We're currently performing an overhaul of our entire tournament results system so results will be missing from team and player pages for a while, and there may be some errors on tournament pages. Please bear with us as we complete this update.


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

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

local util_args = require("Module:ArgsUtil")
local util_text = require('Module:TextUtil')

local p = {}

function p.makeBox(data)
	local title = mw.title.getCurrentTitle().prefixedText
	local links = {}
	for k, v in ipairs(data.replace) do
		link = data.targetpage and data.targetpage[k] or string.gsub(title,
			util_text.escape(data.find[k] or data.find[1]),
		display = data.display and data.display[k] or string.format('View the corresponding %s page',(data.tournament and data.tournament[k] or ''))
		links[k] = string.format('[[%s|%s]]', link, display)
	local tbl = mw.html.create('div'):addClass('correspondingpagebox')
	tbl:wikitext(table.concat(links,' | '))
	return tostring(tbl)

function p.main(frame)
	local args = util_args.merge()
	for k, v in pairs(args) do
		args[k] = util_text.split(args[k], args.sep)
		for k2, v2 in ipairs(args[k]) do
			args[k][k2] = mw.text.trim(v2)
	return p.makeBox(args)
return p