Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 12: | Zeile 12: | ||
end | end | ||
-- Spiel: Entferne unerwünschte Zeichen | -- Spiel: Entferne unerwünschte Zeichen | ||
if args["Game"] then | if args["Game"] then | ||
local cleanGame = args["Game"]:gsub("[:/]", "") -- Entfernt ":" und "/" | local cleanGame = args["Game"]:gsub("[:/]", "") -- Entfernt ":" und "/" | ||
helper.setProperty({args = {["LPON:Game"] = cleanGame}}) | helper.setProperty({args = {["LPON:Game"] = cleanGame}}) | ||
end | end | ||
Zeile 34: | Zeile 24: | ||
output = output .. '<tr><th>Mod-Name</th><td>' .. (args["Titel"] or "Unbekannt") .. '</td></tr>\n' | output = output .. '<tr><th>Mod-Name</th><td>' .. (args["Titel"] or "Unbekannt") .. '</td></tr>\n' | ||
-- Projekte | |||
if args["Projekt"] then | if args["Projekt"] then | ||
output = output .. '<tr><th> | helper.setProperty({args = {["LPON:Projekt"] = args["Projekt"]}}) | ||
local projectList = {} | |||
for projekt in mw.text.gsplit(args["Projekt"], ",") do | |||
projekt = mw.text.trim(projekt) | |||
table.insert(projectList, projekt) | |||
end | |||
output = output .. '<tr><th>Projekte</th><td>' .. table.concat(projectList, ", ") .. '</td></tr>\n' | |||
end | end | ||
Zeile 47: | Zeile 43: | ||
if args["Kategorie"] then | if args["Kategorie"] then | ||
output = output .. '<tr><th>Kategorie</th><td>' .. args["Kategorie"] .. '</td></tr>\n' | output = output .. '<tr><th>Kategorie</th><td>' .. args["Kategorie"] .. '</td></tr>\n' | ||
helper.setProperty({args = {["LPON:Mod-Kategorie"] = args["Kategorie"]}}) | |||
end | end | ||
Zeile 57: | Zeile 54: | ||
if args["Modautor"] then | if args["Modautor"] then | ||
output = output .. '<tr><th>Modautor</th><td>' .. args["Modautor"] .. '</td></tr>\n' | output = output .. '<tr><th>Modautor</th><td>' .. args["Modautor"] .. '</td></tr>\n' | ||
helper.setProperty({args = {["LPON:Modautor"] = args["Modautor"]}}) | |||
end | end | ||
Version vom 2. Dezember 2024, 20:40 Uhr
Die Dokumentation für dieses Modul kann unter Modul:LPON/Mod/Doku erstellt werden
local getArgs = require('Module:Arguments').getArgs
local helper = require('Module:LPON/Helper')
local mod = {}
function mod.render(frame)
local args = getArgs(frame)
local output = ""
-- DISPLAYTITLE setzen
if args["Titel"] then
helper.setDisplayTitle({title = args["Titel"]})
end
-- Spiel: Entferne unerwünschte Zeichen
if args["Game"] then
local cleanGame = args["Game"]:gsub("[:/]", "") -- Entfernt ":" und "/"
helper.setProperty({args = {["LPON:Game"] = cleanGame}})
end
-- Tabelle erstellen
output = output .. '<table class="lpnon-mod-table">\n'
-- Titel
output = output .. '<tr><th>Mod-Name</th><td>' .. (args["Titel"] or "Unbekannt") .. '</td></tr>\n'
-- Projekte
if args["Projekt"] then
helper.setProperty({args = {["LPON:Projekt"] = args["Projekt"]}})
local projectList = {}
for projekt in mw.text.gsplit(args["Projekt"], ",") do
projekt = mw.text.trim(projekt)
table.insert(projectList, projekt)
end
output = output .. '<tr><th>Projekte</th><td>' .. table.concat(projectList, ", ") .. '</td></tr>\n'
end
-- Spiel
if args["Game"] then
output = output .. '<tr><th>Spiel</th><td>' .. args["Game"] .. '</td></tr>\n'
end
-- Kategorie
if args["Kategorie"] then
output = output .. '<tr><th>Kategorie</th><td>' .. args["Kategorie"] .. '</td></tr>\n'
helper.setProperty({args = {["LPON:Mod-Kategorie"] = args["Kategorie"]}})
end
-- Version
if args["Version"] then
output = output .. '<tr><th>Version</th><td>' .. args["Version"] .. '</td></tr>\n'
end
-- Modautor
if args["Modautor"] then
output = output .. '<tr><th>Modautor</th><td>' .. args["Modautor"] .. '</td></tr>\n'
helper.setProperty({args = {["LPON:Modautor"] = args["Modautor"]}})
end
-- Download
if args["Download"] and args["Download"] ~= "" then
local source = args["Quelle"] or "Unbekannt"
output = output .. '<tr><th>Download</th><td>[' .. args["Download"] .. ' ' .. source .. ']</td></tr>\n'
else
output = output .. '<tr><th>Download</th><td>PRIVAT</td></tr>\n'
end
-- Beschreibung
if args["Beschreibung"] then
output = output .. '<tr><th>Beschreibung</th><td>' .. args["Beschreibung"] .. '</td></tr>\n'
end
output = output .. '</table>\n' -- Ende der Tabelle
return output
end
return mod