(Die Seite wurde neu angelegt: „local player = {} local helper = require('Module:LPON/Helper') local getArgs = require('Module:Arguments').getArgs local transcluder = require('Module:Transcluder') function player.render(frame) local args = getArgs(frame) local output = "" local playerName = args["Name"] or mw.title.getCurrentTitle().subpageText local cleanPlayerName = helper.cleanString(playerName) -- DISPLAYTITLE setzen helper.setDisplayTitle({title = playerN…“) |
Keine Bearbeitungszusammenfassung |
||
Zeile 1: | Zeile 1: | ||
local player = {} | local player = {} | ||
local helper = require( | local helper = require("Module:LPON/Helper") | ||
local | local transcluder = require("Module:Transcluder") | ||
local | local getArgs = require("Module:Arguments").getArgs | ||
function player.render(frame) | function player.render(frame) | ||
local args = getArgs(frame) | local args = getArgs(frame) | ||
local output = | local output = '' | ||
local name = args["Name"] or mw.title.getCurrentTitle().text | |||
local | local cleanName = helper.cleanString(name) | ||
local | |||
-- DISPLAYTITLE setzen | -- DISPLAYTITLE setzen | ||
helper.setDisplayTitle({title = | helper.setDisplayTitle({ title = name }) | ||
-- | -- Semantische Eigenschaften | ||
helper.setProperty({ args = { ["LPON:Spieler"] = name } }) | |||
if args["Status"] then helper.setProperty({ args = { ["LPON:Status"] = args["Status"] } }) end | |||
if args["Beitritt"] then helper.setProperty({ args = { ["LPON:Beitritt"] = args["Beitritt"] } }) end | |||
if args["Rolle"] then helper.setProperty({ args = { ["LPON:Rolle"] = args["Rolle"] } }) end | |||
if args["Projekte"] then | |||
for projekt in mw.text.gsplit(args["Projekte"], ",") do | |||
helper.setProperty({ args = { ["LPON:Projekt"] = mw.text.trim(projekt) } }) | |||
end | |||
end | |||
-- | -- Container für alle Boxen | ||
output = output .. '<div class=" | output = output .. '<div class="lpon-player-container">' | ||
-- | -- Über mich | ||
output = output .. '<div class=" | output = output .. '<div class="lpon-player-box">\n' | ||
output = output .. '< | output = output .. ' <h2>Über mich</h2>\n' | ||
output = output .. '<p | output = output .. ' <p>' .. (args["Über"] or "Keine Beschreibung vorhanden.") .. '</p>\n' | ||
output = output .. '</div>\n' | |||
output = output .. '</div>' | |||
-- | -- Allgemein + Statistiken | ||
output = output .. '<div class=" | local episoden = args["Episoden"] or "-" | ||
output = output .. '< | local projekte = args["Projekte"] and select(2, string.gsub(args["Projekte"], ",", "")) + 1 or "-" | ||
output = output .. '<div class="lpon-player-box">\n' | |||
output = output .. ' <h2>Allgemein</h2>\n' | |||
output = output .. '< | output = output .. ' <ul>\n' | ||
output = output .. '</div>' | output = output .. ' <li><b>Status:</b> ' .. (args["Status"] or "Unbekannt") .. '</li>\n' | ||
output = output .. ' <li><b>Beitritt:</b> ' .. (args["Beitritt"] or "Unbekannt") .. '</li>\n' | |||
output = output .. ' <li><b>Rolle:</b> ' .. (args["Rolle"] or "Unbekannt") .. '</li>\n' | |||
output = output .. ' </ul>\n' | |||
output = output .. ' <h2>Statistiken</h2>\n' | |||
output = output .. ' <ul>\n' | |||
output = output .. ' <li><b>Projekte:</b> ' .. projekte .. '</li>\n' | |||
output = output .. ' <li><b>Episoden:</b> ' .. episoden .. '</li>\n' | |||
output = output .. ' </ul>\n' | |||
output = output .. '</div>\n' | |||
-- | -- Projekte | ||
output = output .. '<div class=" | output = output .. '<div class="lpon-player-box">\n' | ||
output = output .. '< | output = output .. ' <h2>Projekte</h2>\n' | ||
output = output .. ' <ul>' | |||
if args["Projekte"] then | |||
for projekt in mw.text.gsplit(args["Projekte"], ",") do | |||
projekt = mw.text.trim(projekt) | |||
output = output .. '<li>[[LetsPlayOrNot:' .. projekt .. '|' .. projekt .. ']]</li>' | |||
end | |||
else | |||
output = output .. '<li>Keine Projekte hinterlegt.</li>' | |||
end | |||
output = output .. '</ul>\n' | |||
output = output .. '</div>\n' | |||
output = output .. | output = output .. '</div>' -- Ende von .lpon-player-container | ||
output = output .. | |||
output = output .. '</div>' | |||
output = output .. '</div>' -- Ende | |||
-- | -- Links (falls aktiviert) | ||
if args[" | if args["Links"] == "true" then | ||
output = output .. '<div class=" | output = output .. '<div class="lpon-player-links">\n' | ||
output = output .. '<h2> | output = output .. ' <h2>Links</h2>' | ||
output = output .. | local linkPage = 'LetsPlayOrNot:' .. name .. '/Links' | ||
local rawContent = transcluder.get(linkPage) | |||
output = output .. frame:preprocess(rawContent) | |||
output = output .. '</div>' | output = output .. '</div>' | ||
end | end | ||
return output | return output |
Aktuelle Version vom 30. April 2025, 00:40 Uhr
Die Dokumentation für dieses Modul kann unter Modul:LPON/Player/Doku erstellt werden
local player = {}
local helper = require("Module:LPON/Helper")
local transcluder = require("Module:Transcluder")
local getArgs = require("Module:Arguments").getArgs
function player.render(frame)
local args = getArgs(frame)
local output = ''
local name = args["Name"] or mw.title.getCurrentTitle().text
local cleanName = helper.cleanString(name)
-- DISPLAYTITLE setzen
helper.setDisplayTitle({ title = name })
-- Semantische Eigenschaften
helper.setProperty({ args = { ["LPON:Spieler"] = name } })
if args["Status"] then helper.setProperty({ args = { ["LPON:Status"] = args["Status"] } }) end
if args["Beitritt"] then helper.setProperty({ args = { ["LPON:Beitritt"] = args["Beitritt"] } }) end
if args["Rolle"] then helper.setProperty({ args = { ["LPON:Rolle"] = args["Rolle"] } }) end
if args["Projekte"] then
for projekt in mw.text.gsplit(args["Projekte"], ",") do
helper.setProperty({ args = { ["LPON:Projekt"] = mw.text.trim(projekt) } })
end
end
-- Container für alle Boxen
output = output .. '<div class="lpon-player-container">'
-- Über mich
output = output .. '<div class="lpon-player-box">\n'
output = output .. ' <h2>Über mich</h2>\n'
output = output .. ' <p>' .. (args["Über"] or "Keine Beschreibung vorhanden.") .. '</p>\n'
output = output .. '</div>\n'
-- Allgemein + Statistiken
local episoden = args["Episoden"] or "-"
local projekte = args["Projekte"] and select(2, string.gsub(args["Projekte"], ",", "")) + 1 or "-"
output = output .. '<div class="lpon-player-box">\n'
output = output .. ' <h2>Allgemein</h2>\n'
output = output .. ' <ul>\n'
output = output .. ' <li><b>Status:</b> ' .. (args["Status"] or "Unbekannt") .. '</li>\n'
output = output .. ' <li><b>Beitritt:</b> ' .. (args["Beitritt"] or "Unbekannt") .. '</li>\n'
output = output .. ' <li><b>Rolle:</b> ' .. (args["Rolle"] or "Unbekannt") .. '</li>\n'
output = output .. ' </ul>\n'
output = output .. ' <h2>Statistiken</h2>\n'
output = output .. ' <ul>\n'
output = output .. ' <li><b>Projekte:</b> ' .. projekte .. '</li>\n'
output = output .. ' <li><b>Episoden:</b> ' .. episoden .. '</li>\n'
output = output .. ' </ul>\n'
output = output .. '</div>\n'
-- Projekte
output = output .. '<div class="lpon-player-box">\n'
output = output .. ' <h2>Projekte</h2>\n'
output = output .. ' <ul>'
if args["Projekte"] then
for projekt in mw.text.gsplit(args["Projekte"], ",") do
projekt = mw.text.trim(projekt)
output = output .. '<li>[[LetsPlayOrNot:' .. projekt .. '|' .. projekt .. ']]</li>'
end
else
output = output .. '<li>Keine Projekte hinterlegt.</li>'
end
output = output .. '</ul>\n'
output = output .. '</div>\n'
output = output .. '</div>' -- Ende von .lpon-player-container
-- Links (falls aktiviert)
if args["Links"] == "true" then
output = output .. '<div class="lpon-player-links">\n'
output = output .. ' <h2>Links</h2>'
local linkPage = 'LetsPlayOrNot:' .. name .. '/Links'
local rawContent = transcluder.get(linkPage)
output = output .. frame:preprocess(rawContent)
output = output .. '</div>'
end
return output
end
return player