15.082
Bearbeitungen
(rework) |
(Vorlage:Datei/Gebäude eliminiert) |
||
| Zeile 15: | Zeile 15: | ||
-- =p.Dateibox{pargs={["fullpagename"]="Datei:test.jpg",["Beschreibung"]="Int. Tag gegen Gewalt an Frauen: Aktive vom ''Unabhängige Frauen Fürth e. V.'' an einem Infostand, Nov. 2019"}} | -- =p.Dateibox{pargs={["fullpagename"]="Datei:test.jpg",["Beschreibung"]="Int. Tag gegen Gewalt an Frauen: Aktive vom ''Unabhängige Frauen Fürth e. V.'' an einem Infostand, Nov. 2019"}} | ||
local frame, pargs = dev.GetFrameAndParentArgs(frame) | local frame, pargs = dev.GetFrameAndParentArgs(frame) | ||
local title = pargs["fullpagename"] or wik.fullpagename() -- pargs[" | local title = pargs["fullpagename"] or wik.fullpagename() -- pargs["fullpagename"] zum Testen/Debuggen | ||
local t, v = "", "" | local t, v = "", "" | ||
| Zeile 40: | Zeile 38: | ||
if a ~= "" then | if a ~= "" then | ||
if w ~= "" then | if w ~= "" then | ||
if a == "Gebäude" then -- zusätzlich Gebäude nach StraßeHnr suchen und hinzufügen | |||
if a == "Gebäude" then | for _, e in ipairs(str.splitAndStrip(w, ";")) do | ||
local q = mw.smw.ask("[[:+]][[StraßeHnr::" .. e .. "]]|?#-") | |||
for _, g in ipairs(q or {}) do | |||
w = w .. "; " .. g[1] | |||
end | |||
end | |||
end | end | ||
v = p.attrValList(a, {[a] = w}) | |||
t = t .. p.attrZeile(a, v) | t = t .. p.attrZeile(a, v) | ||
else | else | ||
| Zeile 69: | Zeile 70: | ||
-- Dateiart/Dateityp | -- Dateiart/Dateityp | ||
local extension = p.getExtension(title) | |||
local filekind = p.getFilekind(extension) | |||
t = t .. p.attrZeile("Dateiart", "[[Dateiart::" .. filekind .. "]]", | t = t .. p.attrZeile("Dateiart", "[[Dateiart::" .. filekind .. "]]", | ||
"Dateityp", "[[Dateityp::" .. extension .. "]]") | "Dateityp", "[[Dateityp::" .. extension .. "]]") | ||
| Zeile 92: | Zeile 95: | ||
-- Dateiinfo erstellen | -- Dateiinfo erstellen | ||
local dateiinfo, infotext = "", "" | local dateiinfo, infotext = "", "" | ||
if not com.isEmpty(pargs["Beschreibung"]) then | if not com.isEmpty(pargs["Beschreibung"]) then -- Beschreibung | ||
dateiinfo = dateiinfo .. wik.wikiTextLimit(pargs["Beschreibung"], 100) -- max. Zeichenanzahl Bild-Unterschrift | dateiinfo = dateiinfo .. wik.wikiTextLimit(pargs["Beschreibung"], 100) -- max. Zeichenanzahl Bild-Unterschrift | ||
if mw.ustring.len(dateiinfo) ~= mw.ustring.len(pargs["Beschreibung"]) then | if mw.ustring.len(dateiinfo) ~= mw.ustring.len(pargs["Beschreibung"]) then | ||
| Zeile 99: | Zeile 102: | ||
end | end | ||
end | end | ||
local urheber = str.splitAndStrip(pargs["Urheber"] or "", ";") | local urheber = str.splitAndStrip(pargs["Urheber"] or "", ";") -- Urheber | ||
if #urheber > 0 then | if #urheber > 0 then | ||
for u = 1, #urheber do | for u = 1, #urheber do | ||
| Zeile 111: | Zeile 114: | ||
infotext = infotext .. wob.attr_text("Urheber") .. ": " .. table.concat(urheber, ", ") | infotext = infotext .. wob.attr_text("Urheber") .. ": " .. table.concat(urheber, ", ") | ||
end | end | ||
for _, d in ipairs{"Erstellungsdatum", "ÜberDatum"} do | for _, d in ipairs{"Erstellungsdatum", "ÜberDatum"} do -- Erstellungsdatum, ÜberDatum | ||
date = pargs[d] or "" | date = pargs[d] or "" | ||
if date ~= "" then | if date ~= "" then | ||
| Zeile 120: | Zeile 123: | ||
end | end | ||
end | end | ||
if not com.isEmpty(pargs["Lizenz"]) then | if not com.isEmpty(pargs["Lizenz"]) then -- Lizenz | ||
if infotext ~= "" then | if infotext ~= "" then | ||
infotext = infotext .. "<br>" | infotext = infotext .. "<br>" | ||
| Zeile 137: | Zeile 140: | ||
-- Tabellenende mit sem. Browsen | -- Tabellenende mit sem. Browsen | ||
t = t .. | t = t .. p.zeile("[[Bild:IconSearch.svg|16px|semantisches Browsen|link=Spezial:Durchsuchen/{{FULLPAGENAME}}]]", | ||
"[[Spezial:Durchsuchen/{{FULLPAGENAME}}|semantisches Browsen]]") | |||
t = t .. "</table>" | t = t .. "</table>" | ||
| Zeile 177: | Zeile 177: | ||
end | end | ||
function p.attrVal(a, pargs) -- Wert zu Attribut wandeln | |||
function p.attrVal(a, pargs) | |||
local t = "" | local t = "" | ||
local v = pargs[a] or "" | local v = pargs[a] or "" | ||
| Zeile 190: | Zeile 186: | ||
end | end | ||
function p.attrValList(a, pargs) | function p.attrValList(a, pargs) -- Werteliste zu Attributen wandeln | ||
local t = "" | local t = "" | ||
local l = str.splitAndStrip(pargs[a] or "", ";") | local l = str.splitAndStrip(pargs[a] or "", ";") | ||
| Zeile 202: | Zeile 198: | ||
end | end | ||
function p.attrZeile(a1, v1, a2, v2) | function p.attrZeile(a1, v1, a2, v2) -- Tabellenzeile mit max. 2 Attributen | ||
local t = "" | local t = "" | ||
if v1 ~= "" then | if v1 ~= "" then | ||
| Zeile 214: | Zeile 210: | ||
end | end | ||
function p.zeile(a1, v1, a2, v2) | function p.zeile(a1, v1, a2, v2) -- Tabellenzeile mit max. 2x2 Einträgen | ||
local t = "" | local t = "" | ||
if v1 ~= "" then | if v1 ~= "" then | ||