Modul:Saison: Unterschied zwischen den Versionen

Aus LASK Wiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 2: Zeile 2:


function p.main(frame)
function p.main(frame)
     local args = frame:getParent().args
     local args = frame:getParent().args


    -- Parameter auslesen
     local titel = args.titel or ""
     local titel = args.titel or ""
    local bild = args.bild or ""
    local bildbeschreibung = args.bildbeschreibung or ""
     local beruf = args.beruf or ""
     local beruf = args.beruf or ""
     local geburt = args.geburt or ""
     local geburt = args.geburt or ""
    local geburtsort = args.geburtsort or ""
    local land = args.land or ""


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


     box
     -- Titel
         :tag("caption")
    if titel ~= "" then
         :wikitext(titel)
        box
            :tag("caption")
            :wikitext(titel)
            :done()
    end
 
    -- Bild
    if bild ~= "" then
 
         local bildzeile = box
            :tag("tr")
 
        bildzeile
            :tag("td")
            :attr("colspan", "2")
            :addClass("infobox-bild")
            :wikitext("[[Datei:" .. bild .. "|250px]]")
            :done()
 
        bildzeile:done()
 
        -- Bildbeschreibung
         if bildbeschreibung ~= "" then
            box
                :tag("tr")
                    :tag("td")
                    :attr("colspan", "2")
                    :addClass("infobox-bild")
                    :wikitext(bildbeschreibung)
                    :done()
                :done()
        end
    end


    -- Beruf
     if beruf ~= "" then
     if beruf ~= "" then
         box
         box
Zeile 27: Zeile 67:
     end
     end


    -- Geburtsdatum
     if geburt ~= "" then
     if geburt ~= "" then
         box
         box
Zeile 35: Zeile 76:
                 :tag("td")
                 :tag("td")
                     :wikitext(geburt)
                     :wikitext(geburt)
                    :done()
            :done()
    end
    -- Geburtsort
    if geburtsort ~= "" then
        box
            :tag("tr")
                :tag("th")
                    :wikitext("Geburtsort")
                    :done()
                :tag("td")
                    :wikitext(geburtsort)
                    :done()
            :done()
    end
    -- Land
    if land ~= "" then
        box
            :tag("tr")
                :tag("th")
                    :wikitext("Land")
                    :done()
                :tag("td")
                    :wikitext(land)
                     :done()
                     :done()
             :done()
             :done()

Version vom 2. September 2026, 07:45 Uhr

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

local p = {}

function p.main(frame)

    local args = frame:getParent().args

    -- Parameter auslesen
    local titel = args.titel or ""
    local bild = args.bild or ""
    local bildbeschreibung = args.bildbeschreibung or ""
    local beruf = args.beruf or ""
    local geburt = args.geburt or ""
    local geburtsort = args.geburtsort or ""
    local land = args.land or ""

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

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

    -- Bild
    if bild ~= "" then

        local bildzeile = box
            :tag("tr")

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

        bildzeile:done()

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

    -- Beruf
    if beruf ~= "" then
        box
            :tag("tr")
                :tag("th")
                    :wikitext("Beruf")
                    :done()
                :tag("td")
                    :wikitext(beruf)
                    :done()
            :done()
    end

    -- Geburtsdatum
    if geburt ~= "" then
        box
            :tag("tr")
                :tag("th")
                    :wikitext("Geboren")
                    :done()
                :tag("td")
                    :wikitext(geburt)
                    :done()
            :done()
    end

    -- Geburtsort
    if geburtsort ~= "" then
        box
            :tag("tr")
                :tag("th")
                    :wikitext("Geburtsort")
                    :done()
                :tag("td")
                    :wikitext(geburtsort)
                    :done()
            :done()
    end

    -- Land
    if land ~= "" then
        box
            :tag("tr")
                :tag("th")
                    :wikitext("Land")
                    :done()
                :tag("td")
                    :wikitext(land)
                    :done()
            :done()
    end

    return tostring(box)
end

return p