Moduł:InfoboxCreator
Wygląd
Dokumentacja dla tego modułu może zostać utworzona pod nazwą Moduł:InfoboxCreator/opis
local p = {}
function p.infobox(frame)
local args = frame:getParent().args
local title = args["nazwa"] or frame:getParent():getTitle()
local image = args["zdjęcie"] or args["obrazek"] or ""
local rows = ""
local fields = {
{"Alias", "alias"},
{"Geneza", "geneza"},
{"Inspiracja", "inspiracja"},
{"YouTube", "youtube"},
{"Discord", "discord"},
{"Narodowość", "narodowość"},
{"Język filmów", "język"},
{"Aktywność", "aktywność"},
{"Subskrybenci", "suby"},
}
for _, field in ipairs(fields) do
local label, key = field[1], field[2]
if args[key] and args[key] ~= "" then
rows = rows .. string.format("|-\n| '''%s:''' || %s\n", label, args[key])
end
end
local imageHTML = ""
if image ~= "" then
imageHTML = string.format("|-\n| colspan='2' style='text-align:center;' | [[File:%s|200px]]\n", image)
end
local out = string.format([[
{| class="infobox" style="width:270px; border:2px solid #aaa; background:#f9f9f9; float:right; margin:0 0 1em 1em; font-size:90%%;"
|-
! colspan="2" style="background:#e6e6e6; text-align:center; font-size:110%%;" | %s
%s
%s
|}]], title, imageHTML, rows)
return out
end
return p