Module:Message box: Difference between revisions
From Chalo Chatu, Zambia online encyclopedia
Chalochatu (talk | contribs) No edit summary |
Chalochatu (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
-- Simple Message box module for Chalo Chatu | |||
local p = {} | local p = {} | ||
function p.imbox(frame) | |||
local args = frame:getParent().args | |||
local text = args['text'] or '' | |||
local type = args['type'] or 'notice' | |||
local colors = { | |||
notice = '#f9f9f9', | |||
warning = '#fff2cc', | |||
error = '#fdd', | |||
info = '#eaf3ff' | |||
} | |||
local border = { | |||
notice = '#aaa', | |||
warning = '#fc3', | |||
error = '#d33', | |||
info = '#36c' | |||
} | |||
local style = string.format( | |||
"border:1px solid %s; background:%s; padding:0.5em; margin:0.5em 0;", | |||
border[type] or '#aaa', | |||
colors[type] or '#f9f9f9' | |||
) | |||
return string.format('<div style="%s">%s</div>', style, text) | |||
end | end | ||
return p | return p | ||
