Modul:Publikation: Unterschied zwischen den Versionen
(Umstellung Publikation) |
(wob.mehrzahl()) |
||
| (4 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 3: | Zeile 3: | ||
local com = require("Modul:Common") | local com = require("Modul:Common") | ||
local str = require("Modul:String") | local str = require("Modul:String") | ||
local | local wob = require("Modul:Wörterbuch") | ||
local wik = require("Modul:Wiki") | |||
local fab = require("Modul:Faktenbox") | local fab = require("Modul:Faktenbox") | ||
function p.Faktenbox(frame) | function p.Faktenbox(frame) | ||
-- mw.log("Faktenbox(frame)") | -- mw.log("Faktenbox(frame)") | ||
-- mw.logObject(frame) | -- mw.logObject(frame, "frame") | ||
-- Konsolenzeile zum Debuggen: | -- Konsolenzeile zum Debuggen: | ||
-- =p.Faktenbox{pargs={Titel="Bla",Ausfuehrung="1234",Genre="Stadtgeschichte;Biografie"}} | -- =p.Faktenbox{pargs={Titel="Bla",Ausfuehrung="1234",Genre="Stadtgeschichte;Biografie"}} | ||
| Zeile 17: | Zeile 18: | ||
if frame.args["KategorieEinzahl"] ~= nil then | if frame.args["KategorieEinzahl"] ~= nil then | ||
fbdata.kategorie_einzahl = {frame.args["KategorieEinzahl"]} | fbdata.kategorie_einzahl = {frame.args["KategorieEinzahl"]} | ||
fbdata.kategorie = { | fbdata.kategorie = {wob.mehrzahl(frame.args["KategorieEinzahl"])} | ||
else | else | ||
fbdata.kategorie = {frame.args["Kategorie"] or "Publikationen"} | fbdata.kategorie = {frame.args["Kategorie"] or "Publikationen"} | ||
| Zeile 36: | Zeile 37: | ||
-- Sonstige gemeinsame Dinge anfügen (Klasse, Formular, Kategorien, Wartung, ...) | -- Sonstige gemeinsame Dinge anfügen (Klasse, Formular, Kategorien, Wartung, ...) | ||
box = box .. fab.common(fbdata) | box = box .. fab.common(fbdata) | ||
-- mw. | -- mw.logObject(box, "box") | ||
-- Pre-Processing und String-Länge checken | -- Pre-Processing und String-Länge checken | ||
box = fbdata.frame:preprocess(box) | box = fbdata.frame:preprocess(box) | ||
box = box .. com.returnStringCheck(box) | box = box .. com.returnStringCheck(box) | ||
-- mw. | -- mw.logObject(box, "box") | ||
return box | return box | ||
end | end | ||
| Zeile 57: | Zeile 58: | ||
-- Zusammenbau | -- Zusammenbau | ||
t = t .. "<dl class = 'dataTable'>" | t = t .. "<dl class = 'dataTable'>" | ||
t = t .. | t = t .. p.zeileKategorieSeite(fbdata) | ||
t = t .. fab.zeile{attr_name = "Untertitel", fbdata = fbdata, delimiter = ";"} | t = t .. fab.zeile{attr_name = "Untertitel", fbdata = fbdata, delimiter = ";"} | ||
t = t .. fab.zeile{attr_name = " | t = t .. p.zeileReihe(fbdata) | ||
t = t .. fab.zeile{attr_name = "Band", fbdata = fbdata, attr_text = "Lfd. Nummer (Band)"} | |||
t = t .. p.zeileGenre(fbdata) | t = t .. p.zeileGenre(fbdata) | ||
t = t .. fab.zeile{attr_name = "Ausfuehrung", fbdata = fbdata} | t = t .. fab.zeile{attr_name = "Ausfuehrung", fbdata = fbdata} | ||
| Zeile 77: | Zeile 78: | ||
-- Tab draus machen | -- Tab draus machen | ||
t = fab.tab(t, "Daten") | t = fab.tab(t, "Daten") | ||
-- mw. | -- mw.logObject(t, "t") | ||
return t | return t | ||
end | |||
function p.zeileKategorieSeite(fbdata, kindex) | |||
-- mw.log(fbdata, "zeileKategorieSeite(fbdata, " .. (kindex or 1) .. ")") | |||
-- mw.logObject(fbdata, "fbdata") | |||
-- Konsolenzeile zum Debuggen: | |||
-- =p.zeileKategorieSeite({pagename="fpn",kategorie={"kat1","kat2"},kategorie_einzahl={"k1","k2"},klasse={"kla1","kla2"},pargs={["Titel"]="T"}}, 2) | |||
local t = "" | |||
local kategorie_einzahl | |||
if fbdata.kategorie_einzahl ~= nil then | |||
kategorie_einzahl = fbdata.kategorie_einzahl[kindex or 1] | |||
else | |||
kategorie_einzahl = fbdata.klasse[kindex or 1] | |||
end | |||
t = t .. "<dt>[[:Kategorie:" .. fbdata.kategorie[kindex or 1] .. "|" .. kategorie_einzahl .. "-Titel]]</dt>" | |||
t = t .. "<dd>'''[[Publikationstitel::" .. (fbdata.pargs["Titel"] or fbdata.pagename) .. "]]'''{{#set:Seite=" .. fbdata.pagename .. "}}</dd>" | |||
-- mw.logObject(t, "t") | |||
return t | |||
end | |||
function p.zeileReihe(fbdata) | |||
-- mw.log("zeileReihe(fbdata)") | |||
-- mw.logObject(fbdata.pargs, "fbdata.pargs") | |||
-- Konsolenzeile zum Debuggen: | |||
-- =p.zeileReihe{pargs={Reihe=" Chronik Geschichtswerkstatt ; Durch Fürth geführt (Buchreihe) ; BlaBla "}} | |||
local t = "" | |||
local reihe = str.splitAndStrip(fbdata.pargs["Reihe"] or "", ";") | |||
if #reihe > 0 then | |||
if #reihe > 1 then | |||
t = t .. "<dt>" .. "[[Attribut:Reihe|Reihen]]</dt><dd>" | |||
else | |||
t = t .. "<dt>" .. "[[Attribut:Reihe|Reihe]]</dt><dd>" | |||
end | |||
for i, r in ipairs(reihe) do | |||
if i > 1 then | |||
t = t .. ", " | |||
end | |||
-- "(Buchreihe)" abschneiden (r_ohne) bzw. zu r hinzufügen | |||
local r_ohne | |||
if string.find(r, "(Buchreihe)") ~= nil then | |||
r_ohne = str.strip(string.sub(r, 1, string.len(r) - 11)) | |||
else | |||
r_ohne = r | |||
local r_mit = r .. " (Buchreihe)" | |||
if wik.pageExists(r_mit) or not wik.pageExists(r) then | |||
r = r_mit | |||
end | |||
end | |||
if wik.pageExists(r) then | |||
t = t .. "[[Reihe::" .. r .. "|" .. r_ohne .. "]]" | |||
else | |||
t = t .. r_ohne .. "{{#set:Reihe=" .. r .. "}}" | |||
end | |||
end | |||
t = t .. "</dd>" | |||
end | |||
-- mw.logObject(t, "t") | |||
return t | |||
end | end | ||
function p.zeileGenre(fbdata) | function p.zeileGenre(fbdata) | ||
-- mw.log("zeileGenre(fbdata)") | -- mw.log("zeileGenre(fbdata)") | ||
-- mw.logObject(fbdata.pargs) | -- mw.logObject(fbdata.pargs, "fbdata.pargs") | ||
-- Konsolenzeile zum Debuggen: | -- Konsolenzeile zum Debuggen: | ||
-- =p.zeileGenre{pargs={Genre="Stadtgeschichte;Biografie"}} | -- =p.zeileGenre{pargs={Genre="Stadtgeschichte;Biografie"}} | ||
| Zeile 102: | Zeile 161: | ||
t = t .. "</dd>" | t = t .. "</dd>" | ||
end | end | ||
-- mw. | -- mw.logObject(t, "t") | ||
return t | return t | ||
end | end | ||
return p | return p | ||
Aktuelle Version vom 27. November 2025, 17:50 Uhr
Seiten-Übersicht
| Hauptseite | Unterseiten | ||
|---|---|---|---|
| Allgemein | |||
| Faktenbox | Vorlagen | ||
| Formulare |
|
||
| Module | |||
| Abfrage | Vorlagen |
| |
| Formulare |
| ||
| Sonstige | |||
Siehe auch
local p = {}
local com = require("Modul:Common")
local str = require("Modul:String")
local wob = require("Modul:Wörterbuch")
local wik = require("Modul:Wiki")
local fab = require("Modul:Faktenbox")
function p.Faktenbox(frame)
-- mw.log("Faktenbox(frame)")
-- mw.logObject(frame, "frame")
-- Konsolenzeile zum Debuggen:
-- =p.Faktenbox{pargs={Titel="Bla",Ausfuehrung="1234",Genre="Stadtgeschichte;Biografie"}}
-- Basis-Faktenbox-Daten (Klasse/Kategorie/Formular)
local fbdata = fab.fbdata(frame)
fbdata.klasse = {frame.args["Klasse"] or "Publikation"}
if frame.args["KategorieEinzahl"] ~= nil then
fbdata.kategorie_einzahl = {frame.args["KategorieEinzahl"]}
fbdata.kategorie = {wob.mehrzahl(frame.args["KategorieEinzahl"])}
else
fbdata.kategorie = {frame.args["Kategorie"] or "Publikationen"}
end
fbdata.formular = frame.args["Formular"] or frame.args["KategorieEinzahl"] or "Publikation" -- ggf. "Publikation/Work"
fbdata.positionscheck = false
-- Tabs einsammeln und zusammenfügen
local box =
"<div class = factbox><tabs>" ..
fab.bildTab(fbdata) ..
p.datenTab(fbdata) ..
"</tabs></div>"
-- Buch-spezifische Kategorien usw.
-- siehe Genre-Kategorisierung in function p.zeileGenre()
-- Sonstige gemeinsame Dinge anfügen (Klasse, Formular, Kategorien, Wartung, ...)
box = box .. fab.common(fbdata)
-- mw.logObject(box, "box")
-- Pre-Processing und String-Länge checken
box = fbdata.frame:preprocess(box)
box = box .. com.returnStringCheck(box)
-- mw.logObject(box, "box")
return box
end
function p.datenTab(fbdata)
-- mw.log("datenTab(fbdata)")
-- mw.logObject(fbdata)
--[[ Konsolenzeile zum Debuggen:
fab=require("Modul:Faktenbox"); fbdata=fab.fbdata{pargs={Titel="Bla",Ausfuehrung="1234"}};
fbdata.klasse={"Buch"}; fbdata.kategorie={"Bücher"}; fbdata.fullpagename="Pegnitz"; fbdata.subpagename="Pegnitz";
print(p.datenTab(fbdata))
]]
local t = ""
-- Zusammenbau
t = t .. "<dl class = 'dataTable'>"
t = t .. p.zeileKategorieSeite(fbdata)
t = t .. fab.zeile{attr_name = "Untertitel", fbdata = fbdata, delimiter = ";"}
t = t .. p.zeileReihe(fbdata)
t = t .. fab.zeile{attr_name = "Band", fbdata = fbdata, attr_text = "Lfd. Nummer (Band)"}
t = t .. p.zeileGenre(fbdata)
t = t .. fab.zeile{attr_name = "Ausfuehrung", fbdata = fbdata}
t = t .. fab.zeile{attr_name = "Autor", fbdata = fbdata, delimiter = ";"}
t = t .. fab.zeile{attr_name = "Herausgeber", fbdata = fbdata, delimiter = ";"}
t = t .. fab.zeile{attr_name = "Erscheinungsjahr", fbdata = fbdata, delimiter = ";"}
t = t .. fab.zeile{attr_name = "Verlag", fbdata = fbdata, delimiter = ";"}
t = t .. fab.zeile{attr_name = "Auflage", fbdata = fbdata}
t = t .. fab.zeile{attr_name = "Seitenzahl", fbdata = fbdata, delimiter = ";"}
t = t .. fab.zeile{attr_name = "ISBNnr", fbdata = fbdata, delimiter = ";"}
t = t .. fab.zeile{attr_name = "Besonderheit", fbdata = fbdata, delimiter = ";"}
t = t .. fab.zeile{attr_name = "BestandArchivFuerthWiki", fbdata = fbdata, delimiter = ";"}
t = t .. "</dl>"
t = t .. fab.zeileSemantikBrowsenAbfrage(fbdata)
-- Tab draus machen
t = fab.tab(t, "Daten")
-- mw.logObject(t, "t")
return t
end
function p.zeileKategorieSeite(fbdata, kindex)
-- mw.log(fbdata, "zeileKategorieSeite(fbdata, " .. (kindex or 1) .. ")")
-- mw.logObject(fbdata, "fbdata")
-- Konsolenzeile zum Debuggen:
-- =p.zeileKategorieSeite({pagename="fpn",kategorie={"kat1","kat2"},kategorie_einzahl={"k1","k2"},klasse={"kla1","kla2"},pargs={["Titel"]="T"}}, 2)
local t = ""
local kategorie_einzahl
if fbdata.kategorie_einzahl ~= nil then
kategorie_einzahl = fbdata.kategorie_einzahl[kindex or 1]
else
kategorie_einzahl = fbdata.klasse[kindex or 1]
end
t = t .. "<dt>[[:Kategorie:" .. fbdata.kategorie[kindex or 1] .. "|" .. kategorie_einzahl .. "-Titel]]</dt>"
t = t .. "<dd>'''[[Publikationstitel::" .. (fbdata.pargs["Titel"] or fbdata.pagename) .. "]]'''{{#set:Seite=" .. fbdata.pagename .. "}}</dd>"
-- mw.logObject(t, "t")
return t
end
function p.zeileReihe(fbdata)
-- mw.log("zeileReihe(fbdata)")
-- mw.logObject(fbdata.pargs, "fbdata.pargs")
-- Konsolenzeile zum Debuggen:
-- =p.zeileReihe{pargs={Reihe=" Chronik Geschichtswerkstatt ; Durch Fürth geführt (Buchreihe) ; BlaBla "}}
local t = ""
local reihe = str.splitAndStrip(fbdata.pargs["Reihe"] or "", ";")
if #reihe > 0 then
if #reihe > 1 then
t = t .. "<dt>" .. "[[Attribut:Reihe|Reihen]]</dt><dd>"
else
t = t .. "<dt>" .. "[[Attribut:Reihe|Reihe]]</dt><dd>"
end
for i, r in ipairs(reihe) do
if i > 1 then
t = t .. ", "
end
-- "(Buchreihe)" abschneiden (r_ohne) bzw. zu r hinzufügen
local r_ohne
if string.find(r, "(Buchreihe)") ~= nil then
r_ohne = str.strip(string.sub(r, 1, string.len(r) - 11))
else
r_ohne = r
local r_mit = r .. " (Buchreihe)"
if wik.pageExists(r_mit) or not wik.pageExists(r) then
r = r_mit
end
end
if wik.pageExists(r) then
t = t .. "[[Reihe::" .. r .. "|" .. r_ohne .. "]]"
else
t = t .. r_ohne .. "{{#set:Reihe=" .. r .. "}}"
end
end
t = t .. "</dd>"
end
-- mw.logObject(t, "t")
return t
end
function p.zeileGenre(fbdata)
-- mw.log("zeileGenre(fbdata)")
-- mw.logObject(fbdata.pargs, "fbdata.pargs")
-- Konsolenzeile zum Debuggen:
-- =p.zeileGenre{pargs={Genre="Stadtgeschichte;Biografie"}}
local t = ""
local genre = str.splitAndStrip(fbdata.pargs["Genre"] or "", ";")
if #genre > 0 then
if #genre > 1 then
t = t .. "<dt>" .. "[[Attribut:Genre|Genres]]</dt><dd>"
else
t = t .. "<dt>" .. "[[Attribut:Genre|Genre]]</dt><dd>"
end
for i, g in ipairs(genre) do
if i > 1 then
t = t .. ", "
end
t = t .. "[[:Kategorie:" .. g .. "|" .. g .. "]][[Kategorie:" .. g .. "]]{{#set:Genre=" .. g .. "}}"
end
t = t .. "</dd>"
end
-- mw.logObject(t, "t")
return t
end
return p