Module:Article history: Difference between revisions

Content deleted Content added
turn debug mode off
cache the results of all exportHtml methods
Line 239:
 
function Row:exportHtml(articleHistoryObj)
if self._html then
return self._html
end
local text = self:getText(articleHistoryObj)
if not text then
Line 252 ⟶ 255:
:addClass('mbox-text')
:wikitext(text)
self._html = html
return html
end
Line 599 ⟶ 603:
 
function Action:exportHtml(articleHistoryObj)
if self._html then
return self._html
end
 
local row = mw.html.create('tr')
 
Line 629 ⟶ 637:
:wikitext(self:getResult(articleHistoryObj))
 
self._html = row
return row
end
Line 644 ⟶ 653:
local obj = Row.new(data)
setmetatable(obj, CollapsibleNotice)
 
-- Make cache for exportHtml
self._htmlCache = {}
 
obj:setIconValues(
Line 684 ⟶ 696:
 
function CollapsibleNotice:exportHtml(articleHistoryObj, isInCollapsibleTable)
local cacheKey = isInCollapsibleTable and 'collapsible' or 'default'
if self._htmlCache[cacheKey] then
return self._htmlCache[cacheKey]
end
 
local text = self:getText(articleHistoryObj)
if not text then
Line 746 ⟶ 763:
end
 
self._htmlCache[cacheKey] = html
return html
end