Modul:Infocasetă
Documentația acestui modul poate fi creată la Modul:Infocasetă/doc
local p = {}
function p.infobox(frame)
local args = frame.args
local title = args.title or args.nume or mw.title.getCurrentTitle().text
local image = args.image or ""
local caption = args.caption or ""
local root = mw.html.create("table")
:addClass("infocaseta")
:css("width", "320px")
:css("float", "right")
:css("margin", "0 0 1em 1em")
:css("border", "1px solid #5b8a3c")
:css("background", "#f8fff5")
root:tag("tr")
:tag("th")
:attr("colspan", "2")
:css("background", "#6aa84f")
:css("color", "white")
:css("font-size", "120%")
:css("padding", "8px")
:wikitext(title)
if image ~= "" then
local td = root:tag("tr")
:tag("td")
:attr("colspan","2")
:css("text-align","center")
td:wikitext(
string.format(
'<img src="%s" style="max-width:300px;width:100%%;height:auto;border-radius:4px;">',
image
)
)
if caption ~= "" then
row:tag("div")
:css("font-size", "90%")
:css("color", "#666")
:wikitext(caption)
end
end
return tostring(root)
end
local function addRow(table, label, value)
if value and value ~= "" then
local tr = table:tag("tr")
tr:tag("th")
:css("text-align","left")
:css("padding","4px")
:wikitext(label)
tr:tag("td")
:css("padding","4px")
:wikitext(value)
end
end
return p