Module:Article history: Difference between revisions

Content deleted Content added
m fix function name typo
take into account possible errors in generating collapsible notice rows
Line 1,006:
-- Get action objects and the collapsible notice objects, and generate the
-- HTML objects for the action objects. We need the action HTML objects so
-- that we can accurately calculcatecalculate the number of collapsible rows, as some
-- action objects may generate errors when the HTML is generated. For
local actions = self:getActionObjects() or {}
-- collapsible notices this isn't a problem, as the errors are caught when
local collapsibleNotices = self:getCollapsibleNoticeObjects() or {}
-- the objects are created.
local collapsibleNoticeHtmlObjects, actionHtmlObjects = {}, {}
local actions = self:getActionObjects()
for _, obj in ipairs(actions or {}) do
local actionHtmlObjects = {}
for _, obj in ipairs(actions or {}) do
table.insert(
actionHtmlObjects,
Line 1,018 ⟶ 1,017:
)
end
for _, obj in ipairs(collapsibleNotices) do
local collapsibleNotices = self:getCollapsibleNoticeObjects()
table.insert(
local noCollapsibleRows = #actionHtmlObjects + #collapsibleNotices
collapsibleNoticeHtmlObjects,
self:try(obj.exportHtml, obj, self, true) -- Render the collapsed version
)
end
local noCollapsibleRows = #actionHtmlObjects + #collapsibleNoticescollapsibleNoticeHtmlObjects
-- Find out if we are collapsed or not.
Line 1,029 ⟶ 1,033:
else
isCollapsed = noCollapsibleRows > (tonumber(self.cfg.uncollapsedRows) or 3)
end
 
-- If we are not collapsed, re-render the collapsible notices in the
-- non-collapsed version.
if not isCollapsed then
collapsibleNoticeHtmlObjects = {}
for _, obj in ipairs(collapsibleNotices) do
table.insert(
collapsibleNoticeHtmlObjects,
self:try(obj.exportHtml, obj, self, false)
)
end
end