Modul:Infocasetă: Diferență între versiuni
Aspect
Pagină înlocuită cu „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 rows = args.rows 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 #5b8...” Etichetă: Înlocuit |
mFără descriere a modificării |
||
| Linia 8: | Linia 8: | ||
local image = args.image or "" | local image = args.image or "" | ||
local caption = args.caption or "" | local caption = args.caption or "" | ||
local root = mw.html.create("table") | local root = mw.html.create("table") | ||
| Linia 29: | Linia 28: | ||
if image ~= "" then | if image ~= "" then | ||
local | 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 | if caption ~= "" then | ||
| Linia 44: | Linia 47: | ||
end | end | ||
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 | return p | ||
Versiunea de la data 7 iunie 2026 15:26
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