Content deleted Content added
write ArticleHistory:renderBox and add ArticleHistory:message |
turn the Header class into a Row class, and add methods to it |
||
Line 13:
-- Load required modules.
local yesno = require('Module:Yesno')
Line 60 ⟶ 59:
-------------------------------------------------------------------------------
--
--
-------------------------------------------------------------------------------
local
function
local obj = setmetatable({},
obj.cfg = data.cfg
obj.categories = {}
return obj
end
function
if caption then
caption = '|' .. caption
else
caption = ''
end
return string.format('[[File:%s|%s%s]]', image, size, caption)
end
function
self.icon = icon
self.caption = caption
self.size = size
end
function Row:setText(text)
self.text = text
end
function Row:exportHtml()
local html = mw.html.create('tr')
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
function Row:addCategory(category, sortKey)
local categoryObj = Category.new(category, sortKey)
table.insert(self.categories, categoryObj)
end
function Row:exportCategories()
return self.categories
end
function Row:setNoticeBarIcon(icon, caption, size)
self.noticeBarIcon = icon
self.noticeBarCaption = caption
self.noticeBarIconSize = size
end
function Row:exportNoticeBarIcon()
if not self.noticeBarIcon then
return nil
end
local size = self.noticeBarIconSize or self.cfg.defaultNoticeBarIconSize or '15px'
return self.renderImage(self.noticeBarIcon, size, self.noticeBarCaption)
end
Line 84 ⟶ 137:
-------------------------------------------------------------------------------
local Status = setmetatable({},
Status.__index = Status
function Status.new(data)
local obj =
setmetatable(obj, Status)
return obj
Line 99 ⟶ 152:
-------------------------------------------------------------------------------
local DoubleStatus = setmetatable({},
DoubleStatus.__index = DoubleStatus
function DoubleStatus.new(data)
local obj =
setmetatable(obj, DoubleStatus)
return obj
Line 114 ⟶ 167:
-------------------------------------------------------------------------------
local Notice = setmetatable({},
Notice.__index = Notice
function Notice.new(data)
local obj =
setmetatable(obj, Notice)
return obj
Line 133 ⟶ 186:
-------------------------------------------------------------------------------
local Action = setmetatable({}, Row)
Action.__index = Action
Line 147 ⟶ 200:
-- Valid data table keys:
-- code, result, link, paramNum, cfg, currentTitle
local obj = Row.new(data)
setmetatable( obj.cfg = data.cfg
Line 184 ⟶ 238:
function Action:exportHtml()
local row = mw.html.create('tr')
end
Line 195 ⟶ 250:
-------------------------------------------------------------------------------
local CollapsibleNotice = setmetatable({}, Row)
CollapsibleNotice.__index = CollapsibleNotice
function CollapsibleNotice.new(data)
local obj = Row.new(data)
setmetatable(obj, CollapsibleNotice)
return obj
end
-------------------------------------------------------------------------------
|