Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 30: | Zeile 30: | ||
-- Infobox | -- Infobox | ||
-- Infobox Container | -- Infobox Container | ||
output = output .. '<div class="infobox lpnon-infobox">' | output = output .. '<div class="infobox lpnon-infobox">\n' | ||
-- Coverbild in der Infobox | -- Coverbild in der Infobox | ||
local coverImage = args["Coverbild"] or "DefaultProjektCover.webp" | local coverImage = args["Coverbild"] or "DefaultProjektCover.webp" | ||
output = output .. | output = output .. '[[File:' .. coverImage .. '|250px|center|alt=Cover von ' .. (args["Titel"] or "Projekt") .. ']]\n' | ||
-- Titel in der Infobox | -- Titel in der Infobox | ||
output = output .. | output = output .. '<div class="infobox-title">' .. (args["Titel"] or "Unbekannt") .. '</div>\n' | ||
-- Tabelleninhalt der Infobox | -- Tabelleninhalt der Infobox | ||
output = output .. '<table class="infobox-table">' | output = output .. '<table class="infobox-table">\n' | ||
-- Status | -- Status | ||
if args["Status"] and args["Status"] ~= "" then | if args["Status"] and args["Status"] ~= "" then | ||
helper.setProperty({ args = { ["LPON:Status"] = args["Status"] } }) | helper.setProperty({ args = { ["LPON:Status"] = args["Status"] } }) | ||
output = output .. | output = output .. '<tr><th>Status</th><td>' .. args["Status"] .. '</td></tr>\n' | ||
end | end | ||
Zeile 60: | Zeile 56: | ||
table.insert(playerList, player) | table.insert(playerList, player) | ||
end | end | ||
output = output .. | output = output .. '<tr><th>Spieler</th><td>' .. table.concat(playerList, ", ") .. '</td></tr>\n' | ||
end | end | ||
Zeile 66: | Zeile 62: | ||
if args["Startdatum"] and args["Startdatum"] ~= "" then | if args["Startdatum"] and args["Startdatum"] ~= "" then | ||
helper.setProperty({ args = { ["LPON:Startdatum"] = args["Startdatum"] } }) | helper.setProperty({ args = { ["LPON:Startdatum"] = args["Startdatum"] } }) | ||
output = output .. | output = output .. '<tr><th>Startdatum</th><td>' .. args["Startdatum"] .. '</td></tr>\n' | ||
end | end | ||
output = output .. '</table>' -- Ende der Tabelle | output = output .. '</table>\n' -- Ende der Tabelle | ||
output = output .. '</div>' -- Ende der Infobox | output = output .. '</div>\n' -- Ende der Infobox | ||
-- Beschreibung | -- Beschreibung | ||
output = output .. string.format('<div class="lpnon-description">%s</div>', args["Beschreibung"] or "Keine Beschreibung verfügbar.") | output = output .. string.format('<div class="lpnon-description">%s</div>', args["Beschreibung"] or "Keine Beschreibung verfügbar.") |
Version vom 30. November 2024, 23:35 Uhr
Die Dokumentation für dieses Modul kann unter Modul:LPON/Projekt/Doku erstellt werden
local getArgs = require('Module:Arguments').getArgs
local helper = require('Module:LPON/Helper')
local projekt = {}
function projekt.render(frame)
local args = getArgs(frame)
local output = ""
-- DISPLAYTITLE setzen
if args["Titel"] then
helper.setDisplayTitle({title = args["Titel"]})
end
-- Semantische Daten setzen
if args["Status"] then
helper.setProperty({args = {["LPON:Status"] = args["Status"]}})
end
if args["Spieler"] then
for player in mw.text.gsplit(args["Spieler"], ",") do
helper.setProperty({args = {["LPON:Spieler"] = mw.text.trim(player)}})
end
end
if args["Beschreibung"] then
local truncatedDesc = mw.ustring.sub(args["Beschreibung"], 1, 250)
helper.setProperty({args = {["LPON:Beschreibung"] = truncatedDesc}})
end
-- Infobox
-- Infobox Container
output = output .. '<div class="infobox lpnon-infobox">\n'
-- Coverbild in der Infobox
local coverImage = args["Coverbild"] or "DefaultProjektCover.webp"
output = output .. '[[File:' .. coverImage .. '|250px|center|alt=Cover von ' .. (args["Titel"] or "Projekt") .. ']]\n'
-- Titel in der Infobox
output = output .. '<div class="infobox-title">' .. (args["Titel"] or "Unbekannt") .. '</div>\n'
-- Tabelleninhalt der Infobox
output = output .. '<table class="infobox-table">\n'
-- Status
if args["Status"] and args["Status"] ~= "" then
helper.setProperty({ args = { ["LPON:Status"] = args["Status"] } })
output = output .. '<tr><th>Status</th><td>' .. args["Status"] .. '</td></tr>\n'
end
-- Spieler
if args["Spieler"] and args["Spieler"] ~= "" then
local playerList = {}
for player in mw.text.gsplit(args["Spieler"], ",") do
player = mw.text.trim(player)
helper.setProperty({ args = { ["LPON:Spieler"] = player } })
table.insert(playerList, player)
end
output = output .. '<tr><th>Spieler</th><td>' .. table.concat(playerList, ", ") .. '</td></tr>\n'
end
-- Startdatum
if args["Startdatum"] and args["Startdatum"] ~= "" then
helper.setProperty({ args = { ["LPON:Startdatum"] = args["Startdatum"] } })
output = output .. '<tr><th>Startdatum</th><td>' .. args["Startdatum"] .. '</td></tr>\n'
end
output = output .. '</table>\n' -- Ende der Tabelle
output = output .. '</div>\n' -- Ende der Infobox
-- Beschreibung
output = output .. string.format('<div class="lpnon-description">%s</div>', args["Beschreibung"] or "Keine Beschreibung verfügbar.")
-- Mods (optional Subseite oder direkt)
if args["useSubpage"] == "true" then
output = output .. string.format('<div class="lpnon-mods"><a href="%s/Mods">Zur Modliste</a></div>', mw.title.getCurrentTitle().text)
else
output = output .. '<div class="lpnon-mods"><ul><li>Mod 1</li><li>Mod 2</li></ul></div>'
end
-- Folgen (optional Subseite oder direkt)
if args["useEpisodesSubpage"] == "true" then
output = output .. string.format('<div class="lpnon-episodes"><a href="%s/Folgen">Zur Folgenübersicht</a></div>', mw.title.getCurrentTitle().text)
else
output = output .. '<div class="lpnon-episodes"><ul><li>Folge 1</li><li>Folge 2</li></ul></div>'
end
-- Kategorien setzen
local categories = {} -- Korrekte Initialisierung der Tabelle
if args["Spieler"] then
for player in mw.text.gsplit(args["Spieler"], ",") do
table.insert(categories, "LPON:Spieler:" .. mw.text.trim(player))
end
end
if args["Status"] then
table.insert(categories, "LPON:Status:" .. args["Status"])
end
if args["Titel"] then
table.insert(categories, "LPON:Projekte:" .. args["Titel"])
end
-- Hinzufügen allgemeiner Kategorien
table.insert(categories, "All LPON")
output = output .. helper.addCategories({categories = categories, sortkey = args["Titel"]})
return output
end
return projekt