« Module:Message box » : différence entre les versions
mAucun résumé des modifications |
mAucun résumé des modifications |
||
| Ligne 5 : | Ligne 5 : | ||
function MessageBox:export() | function MessageBox:export() | ||
local root = | local root = mw.html.create('div') | ||
if self.image ~= nil then | if self.image ~= nil then | ||
root:wikitext('[[' .. self.image .. ']]') | |||
end | end | ||
root:tag('h4'):wikitext(self.title) | |||
root:tag('p'):wikitext(self.content) | |||
return tostring(root) | return tostring(root) | ||
| Ligne 18 : | Ligne 17 : | ||
-- Define class | -- Define class | ||
function MessageBox:new ( | function MessageBox:new (title, content, image) | ||
self.__index = self | self.__index = self | ||
self.title = title | self.title = title | ||
self.image = image | self.image = image | ||
self.content = content | self.content = content | ||
return self | return self | ||
end | end | ||
function p.main(frame | function p.main(frame) | ||
local box = MessageBox:new(frame, | local box = MessageBox:new(frame.args[1], frame.args[2], frame.args[3]) | ||
return box:export() | return box:export() | ||
end | end | ||
return p | return p | ||