Leaguepedia | League of Legends Esports Wiki
Advertisement

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

-- <nowiki>
local util_args = require('Module:ArgsUtil')
local util_cargo = require("Module:CargoUtil")
local util_html = require("Module:HtmlUtil")
local util_map = require('Module:MapUtil')
local util_table = require("Module:TableUtil")
local util_text = require("Module:TextUtil")
local util_vars = require("Module:VarsUtil")
local i18n = require("Module:I18nUtil")
local lang = mw.getLanguage('en')
local h = {}
local p = require('Module:LuaClassSystem').class()

function p:init()
	i18n.init('TableErrors')
	self.introText = i18n.print('introText')
end

function p:setIntroText(text)
	self.introText = text
end

function p:report(text)
	if not self._tableErrors then self._tableErrors = {} end
	self._tableErrors[#self._tableErrors+1] = text
end

function p:hasErrors()
	return self._tableErrors
end

function p:output(len)
	local tr = mw.html.create('tr')
	local td = tr:tag('td')
		:attr('colspan', len)
	td:wikitext('[[Category:Pages with script errors]]')
	td:wikitext(self.introText)
		:addClass('lua-table-error')
	local ul = td:tag('ul')
	util_map.inPlace(self._tableErrors, h.printOneError, ul)
	return tr
end

function h.printOneError(errorText, ul)
	ul:tag('li')
		:wikitext(errorText)
end

return p
-- </nowiki>
Advertisement