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 transcluder = require('Module:Transcluder')
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:LetsPlayOrNot:' .. 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.")
-- Spieler Links
output = output .. '<h2>Links</h2>\n'
local output = output ..'<div class="lpon-links">\n'
if args["Spieler"] and args["Spieler"] ~= "" then
for player in mw.text.gsplit(args["Spieler"], ",") do
player = mw.text.trim(player)
local linkPage = "LetsPlayOrNot:" .. player .. "/Links"
local transcludedContent = transcluder.main(linkPage)
output = output .. '<div class="lpon-player-links">' .. transcludedContent .. '</div>\n'
end
else
output = output .. '<p>Keine Links verfügbar.</p>\n'
end
output = output .. '</div>\n'
-- 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