Module:Article history: Difference between revisions

Content deleted Content added
turn the Header class into a Row class, and add methods to it
set a different icon size if we are outputting a small template
Line 60:
-------------------------------------------------------------------------------
-- Row class
-- This is a super-class representingrepresents one row in the template.
-------------------------------------------------------------------------------
 
Line 69:
local obj = setmetatable({}, Row)
obj.cfg = data.cfg
obj.isSmall = data.isSmall
obj.categories = {}
return obj
Line 85 ⟶ 86:
self.icon = icon
self.caption = caption
self.sizeiconSize = size
end
 
Line 94 ⟶ 95:
function Row:exportHtml()
local html = mw.html.create('tr')
 
-- Render the icon link.
local icon
if self.icon, then
local iconSize
if self.isSmall then
iconSize = self.iconSize or self.cfg.defaultSmallIconSize or '15px'
else
iconSize = self.sizeiconSize or self.cfg.defaultIconSize or '30px'
end
icon = self.renderImage(self.icon, self.caption, iconSize)
end
 
-- Render the HTML
html
:tag('td')
:addClass('mbox-image')
:wikitext(self.icon and self.renderImage()
self.icon,
self.caption,
self.size or self.cfg.defaultIconSize or '30px'
))
:done()
:tag('td')
:addClass('mbox-text')
:wikitext(self.text)
 
return html
end