Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 3: | Zeile 3: | ||
local getArgs = require('Module:Arguments').getArgs | local getArgs = require('Module:Arguments').getArgs | ||
function buch.render(frame | function buch.render(frame) | ||
-- Argumente aus dem Frame extrahieren | |||
local args = frame.args | |||
local output = '<table class="publikation buch">' | local output = '<table class="publikation buch">' | ||
-- Coverbild | -- Coverbild | ||
output = output .. '<tr><td colspan="2" style="text-align: center;">' .. | output = output .. '<tr><td colspan="2" style="text-align: center;">' .. p.getCoverImage(args["Coverbild"], "Library:Cover:DefaultBuchCover.webp") .. '</td></tr>' | ||
-- Titel | -- Titel | ||
Zeile 23: | Zeile 24: | ||
-- Verlag | -- Verlag | ||
if args["Verlag"] then | |||
output = output .. '<tr><td><strong>Verlag</strong></td><td>[[Verlag::' .. args["Verlag"] .. ']]</td></tr>' | |||
end | |||
-- Band und Serie | -- Band und Serie | ||
Zeile 31: | Zeile 34: | ||
if seriesID then | if seriesID then | ||
local | local seriesQuery = "[[SerienID::" .. seriesID .. "]]" | ||
local seriesPageTitle = helper.getSeriesPageTitle({ args = { seriesQuery } }) | |||
local completeVolumes = "Keine Ergebnisse gefunden." | local completeVolumes = "Keine Ergebnisse gefunden." | ||
Zeile 45: | Zeile 49: | ||
-- Erscheinungsjahr | -- Erscheinungsjahr | ||
if args["Erscheinungsjahr"] then | |||
output = output .. '<tr><td><strong>Erscheinungsjahr</strong></td><td>[[Erscheinungsjahr::' .. args["Erscheinungsjahr"] .. ']]</td></tr>' | |||
end | |||
-- ISBN | -- ISBN | ||
if args["ISBN-10"] or args["ISBN-13"] then | if args["ISBN-10"] or args["ISBN-13"] then | ||
local isbn10 = | local isbn10 = p.getIsbnLink(args["ISBN-10"], "ISBN-10") | ||
local isbn13 = | local isbn13 = p.getIsbnLink(args["ISBN-13"], "ISBN-13") | ||
output = output .. '<tr><td><strong>ISBN</strong></td><td>' .. isbn10 .. (isbn10 ~= "" and isbn13 ~= "" and " / " or "") .. isbn13 .. '</td></tr>' | output = output .. '<tr><td><strong>ISBN</strong></td><td>' .. isbn10 .. (isbn10 ~= "" and isbn13 ~= "" and " / " or "") .. isbn13 .. '</td></tr>' | ||
end | end | ||
-- Sprache | -- Sprache | ||
if args["Sprache"] then | |||
output = output .. '<tr><td><strong>Sprache</strong></td><td>[[Sprache::' .. args["Sprache"] .. ']]</td></tr>' | |||
end | |||
-- Standort | -- Standort | ||
if args["Standort"] then | |||
output = output .. '<tr><td><strong>Standort</strong></td><td>[[Standort::' .. args["Standort"] .. ']]</td></tr>' | |||
end | |||
-- Umfang (Seitenanzahl) | -- Umfang (Seitenanzahl) | ||
if args["Umfang"] then | |||
output = output .. '<tr><td><strong>Umfang</strong></td><td>[[Umfang::' .. args["Umfang"] .. ']] Seiten</td></tr>' | |||
end | |||
-- Preis | -- Preis | ||
if args["Preis"] then | |||
output = output .. '<tr><td><strong>Preis</strong></td><td>[[Preis::' .. args["Preis"] .. ']]</td></tr>' | |||
end | |||
-- Inhaltszusammenfassung | -- Inhaltszusammenfassung | ||
if args["Inhaltszusammenfassung"] then | |||
output = output .. '<tr><td><strong>Inhaltszusammenfassung</strong></td><td>' .. args["Inhaltszusammenfassung"] .. '</td></tr>' | |||
end | |||
output = output .. '</table>' | output = output .. '</table>' | ||
return output | return output | ||
end | end | ||
return buch | return buch |
Version vom 23. November 2024, 00:47 Uhr
Die Dokumentation für dieses Modul kann unter Modul:Publikation/Buch/Doku erstellt werden
local buch = {}
local helper = require("Modul:Publikation/SerieHelper")
local getArgs = require('Module:Arguments').getArgs
function buch.render(frame)
-- Argumente aus dem Frame extrahieren
local args = frame.args
local output = '<table class="publikation buch">'
-- Coverbild
output = output .. '<tr><td colspan="2" style="text-align: center;">' .. p.getCoverImage(args["Coverbild"], "Library:Cover:DefaultBuchCover.webp") .. '</td></tr>'
-- Titel
output = output .. '<tr><td><strong>Titel</strong></td><td>[[Hat Titel::' .. (args["Titel"] or "Unbekannt") .. ']]</td></tr>'
-- Autoren (Mehrfachwerte als Liste)
if args["Autor"] then
output = output .. '<tr><td><strong>Autor(en)</strong></td><td>'
for author in mw.text.gsplit(args["Autor"], ",") do
output = output .. '[[Hat Autor::' .. mw.text.trim(author) .. ']], '
end
output = output:sub(1, -3) .. '</td></tr>' -- Entfernt das letzte Komma
end
-- Verlag
if args["Verlag"] then
output = output .. '<tr><td><strong>Verlag</strong></td><td>[[Verlag::' .. args["Verlag"] .. ']]</td></tr>'
end
-- Band und Serie
if args["Band"] then
local seriesID = args["SerienID"]
local bandText = args["Band"]
if seriesID then
local seriesQuery = "[[SerienID::" .. seriesID .. "]]"
local seriesPageTitle = helper.getSeriesPageTitle({ args = { seriesQuery } })
local completeVolumes = "Keine Ergebnisse gefunden."
if seriesPageTitle ~= "Keine Ergebnisse gefunden." then
completeVolumes = helper.getCompleteVolumesByTitle({ args = { seriesPageTitle, "Complete volumes" } })
end
bandText = bandText .. " von " .. (completeVolumes or "?") .. ' ([[Library:Serie:' .. mw.uri.anchorEncode(seriesPageTitle) .. '|' .. (args["Hat Serie"] or "Serie") .. "]])"
end
output = output .. '<tr><td><strong>Band</strong></td><td>' .. bandText .. '</td></tr>'
end
-- Erscheinungsjahr
if args["Erscheinungsjahr"] then
output = output .. '<tr><td><strong>Erscheinungsjahr</strong></td><td>[[Erscheinungsjahr::' .. args["Erscheinungsjahr"] .. ']]</td></tr>'
end
-- ISBN
if args["ISBN-10"] or args["ISBN-13"] then
local isbn10 = p.getIsbnLink(args["ISBN-10"], "ISBN-10")
local isbn13 = p.getIsbnLink(args["ISBN-13"], "ISBN-13")
output = output .. '<tr><td><strong>ISBN</strong></td><td>' .. isbn10 .. (isbn10 ~= "" and isbn13 ~= "" and " / " or "") .. isbn13 .. '</td></tr>'
end
-- Sprache
if args["Sprache"] then
output = output .. '<tr><td><strong>Sprache</strong></td><td>[[Sprache::' .. args["Sprache"] .. ']]</td></tr>'
end
-- Standort
if args["Standort"] then
output = output .. '<tr><td><strong>Standort</strong></td><td>[[Standort::' .. args["Standort"] .. ']]</td></tr>'
end
-- Umfang (Seitenanzahl)
if args["Umfang"] then
output = output .. '<tr><td><strong>Umfang</strong></td><td>[[Umfang::' .. args["Umfang"] .. ']] Seiten</td></tr>'
end
-- Preis
if args["Preis"] then
output = output .. '<tr><td><strong>Preis</strong></td><td>[[Preis::' .. args["Preis"] .. ']]</td></tr>'
end
-- Inhaltszusammenfassung
if args["Inhaltszusammenfassung"] then
output = output .. '<tr><td><strong>Inhaltszusammenfassung</strong></td><td>' .. args["Inhaltszusammenfassung"] .. '</td></tr>'
end
output = output .. '</table>'
return output
end
return buch