« Module:Message box » : différence entre les versions

mAucun résumé des modifications
Balise : Révocation manuelle
m fix typo
 
(6 versions intermédiaires par le même utilisateur non affichées)
Ligne 7 : Ligne 7 :
     local root = mw.html.create('div')
     local root = mw.html.create('div')


    root:addClass('box')
     root:wikitext(
     root:wikitext(
         mw.getCurrentFrame():extensionTag( 'templatestyles', '', { src = 'Module:Message_box/style.css' } )
         mw.getCurrentFrame():extensionTag( 'templatestyles', '', { src = 'Module:Message_box/style.css' } )
     )
     )
    root:addClass('box')
    if self.class ~= nil then
        root:addClass(self.class)
    end
    local left = root:tag('div'):addClass('left')
    local right = root:tag('div'):addClass('right')
     if self.image ~= nil then
     if self.image ~= nil then
         root:wikitext('[[' .. self.image .. ']]')
         left:wikitext('[[File:' .. self.image .. ']]')
     end
     end
     root:tag('h4'):wikitext(self.title)
     left:tag('h4'):wikitext(self.title)
     root:tag('p'):wikitext(self.content)
     right:tag('p'):wikitext(self.content)


     return tostring(root)
     return tostring(root)
Ligne 21 : Ligne 26 :


-- Define class
-- Define class
function MessageBox:new (title, content, image)
function MessageBox:new (title, content, image, class)
     self.__index = self
     self.__index = self
     self.title = title
     self.title = title
    self.content = content
     self.image = image
     self.image = image
     self.content = content
     self.class = class


     return self
     return self
Ligne 31 : Ligne 37 :


function p.main(frame)
function p.main(frame)
     local box = MessageBox:new(frame.args[1], frame.args[2], frame.args[3])
     local box = MessageBox:new(frame.args[1], frame.args[2], frame.args[3], frame.args[4])
     return box:export()
     return box:export()
end
end


return p
return p