Modul:Saison

Aus LASK Wiki
Zur Navigation springen Zur Suche springen

Die Dokumentation für dieses Modul kann unter Modul:Saison/Doku erstellt werden

local p = {}

local function addRow(box, label, value)

    if value and value ~= "" then

        box
            :tag("tr")
                :tag("th")
                    :wikitext(label)
                    :done()
                :tag("td")
                    :wikitext(value)
                    :done()
            :done()

    end

end


function p.main(frame)

    local args = frame:getParent().args

    local titel = args.titel or ""
    local bild = args.bild or ""
    local bildbeschreibung = args.bildbeschreibung or ""

    local box = mw.html.create("table")
        :addClass("infobox")


    -- Titel
    if titel ~= "" then
        box
            :tag("caption")
            :wikitext(titel)
            :done()
    end


    -- Bild
    if bild ~= "" then

        box
            :tag("tr")
                :tag("td")
                :attr("colspan", "2")
                :addClass("infobox-bild")
                :wikitext("[[Datei:" .. bild .. "|250px]]")
                :done()
            :done()

        if bildbeschreibung ~= "" then
            box
                :tag("tr")
                    :tag("td")
                    :attr("colspan", "2")
                    :addClass("infobox-bild")
                    :wikitext(bildbeschreibung)
                    :done()
                :done()
        end
    end


    -- Informationen
    addRow(box, "Beruf", args.beruf)
    addRow(box, "Geboren", args.geburt)
    addRow(box, "Geburtsort", args.geburtsort)
    addRow(box, "Land", args.land)
    addRow(box, "Wohnort", args.wohnort)
    addRow(box, "Website", args.website)


    return tostring(box)

end

return p