Moduł:Osoba
Wygląd
Dokumentacja dla tego modułu może zostać utworzona pod nazwą Moduł:Osoba/opis
local p = {}
local function notEmpty(v)
return v ~= nil and v ~= ""
end
local function formatDate(frame, d)
if notEmpty(d) then
return frame:callParserFunction("#time", "j xg Y", d)
end
return ""
end
local function row(label, value)
if notEmpty(value) then
return "|-\n! " .. label .. "\n| " .. value .. "\n"
end
return ""
end
local function section(title, content)
if notEmpty(content) then
return "|-\n! colspan='2' style='background:#eaecf0; text-align:center;' | " .. title .. "\n" ..
"|-\n| colspan='2' | " .. content .. "\n"
end
return ""
end
function p.infobox(frame)
local a = frame:getParent().args
local txt = "{| class='infobox' style='float:right; width:270px; border:1px solid #a2a9b1; background:#f8f9fa;'\n"
txt = txt .. "|+ style='background:#3366cc; color:white; text-align:center;' | '''" ..
(a.imie or "") .. " " .. (a.nazwisko or "") .. "'''\n"
if notEmpty(a.zdjecie) then
txt = txt .. "|-\n| colspan='2' style='text-align:center;' | [[Plik:" .. a.zdjecie .. "|250px]]\n"
end
local dane = ""
dane = dane .. row("Data urodzenia", formatDate(frame, a.data_urodzenia))
dane = dane .. row("Miejsce urodzenia", a.miejsce_urodzenia)
dane = dane .. row("Data śmierci", formatDate(frame, a.data_smierci))
dane = dane .. row("Miejsce śmierci", a.miejsce_smierci)
dane = dane .. row("Obywatelstwo", a.obywatelstwo)
dane = dane .. row("Wzrost", a.wzrost)
dane = dane .. row("Pozycja", a.pozycja)
if dane ~= "" then
txt = txt .. "|-\n! colspan='2' style='background:#eaecf0; text-align:center;' | Dane osobowe\n"
txt = txt .. dane
end
local klub = ""
klub = klub .. row("Klub", a.klub)
klub = klub .. row("Numer", a.numer)
if klub ~= "" then
txt = txt .. "|-\n! colspan='2' style='background:#eaecf0; text-align:center;' | Informacje klubowe\n"
txt = txt .. klub
end
txt = txt .. section("Kariera juniorska", a.kariera_juniorska)
txt = txt .. section("Kariera klubowa", a.kariera_klubowa)
txt = txt .. section("Kariera reprezentacyjna", a.kariera_reprezentacyjna)
txt = txt .. section("Kariera trenerska", a.kariera_trenerska)
txt = txt .. section("Osiągnięcia", a.osiagniecia)
txt = txt .. "|}"
return txt
end
return p