Module:Article history: Difference between revisions

Content deleted Content added
don't try and render rows if there is no text set; this enables us to use objects only for categories
make collapsible notices available to the article history object
Line 578:
return obj
end
 
--[==[
If collapsed and without DYK text:
 
<tr>
<td colspan="3" width=100%>
[[File:DYK questionmark icon.svg|Did You Know|''size''px]] DYK blurb.
</td>
</tr>
[[Category:Wikipedia Did you know articles level]]
 
If uncollapsed with without DYK text:
 
<tr>
<td class="mbox-image">
[[File:DYK questionmark icon.svg|Did You Know|''size''px]]
</td>
<td class="mbox-text">
DYK Blurb.
</td>
</tr>
[[Category:Wikipedia Did you know articles level]]
 
If collapsed and with DYK text:
 
<tr>
<td colspan="3" width=100%>
<table class="collapsible collapsed" style="margin:0; padding:0; border-collapse:collapse; width:100%; background:transparent;">
<tr><th style="font-weight:normal; text-align:left; width:100%;">
[[File:DYK questionmark icon.svg|Did You Know|''size''px]] DYK blurb.
</th></tr>
<tr><td style="border:1px silver solid;">The text of the entry was: ''Did you know {{{dykentry}}}''
</td></tr></table>
</td>
</tr>
[[Category:Wikipedia Did you know articles level]]
 
If uncollapsed and with DYK text:
 
<tr>
<td class="mbox-image">[[File:DYK questionmark icon.svg|Did You Know|''size''px]]</td>
<td class="mbox-text">
<table class="collapsible collapsed" style="margin:0; padding:0; border-collapse:collapse; width:100%; background:transparent;">
<tr><th style="font-weight:normal; text-align:left; width:100%;">
DYK Blurb.
</th></tr>
<tr><td style="border:1px silver solid;">The text of the entry was: ''Did you know {{{dykentry}}}''
</td>
</tr>
</table>
</td>
</tr>
[[Category:Wikipedia Did you know articles level]]
--]==]
 
function CollapsibleNotice:exportHtml(isCollapsed)
Line 942 ⟶ 888:
function ArticleHistory:getCollapsibleNoticeObjects()
-- Returns an array of collapsible notice objects to be output.
if self.collapsibleNotices ~= nil then
return self.collapsibleNotices
end
local ret = {}
for i, func in ipairs(self.cfg.collapsibleNotices or {}) do
local data = func(self)
if data then
data.cfg = self.cfg
data.currentTitle = self.currentTitle
ret[#ret + 1] = CollapsibleNotice.new(data)
end
end
self.collapsibleNotices = ret
return ret
end