20.236
Bearbeitungen
(Modul:Kalender ohne Work) |
(fix Lizenz in Dateiinfo) |
||
| Zeile 36: | Zeile 36: | ||
local frame, pargs = dev.GetFrameAndParentArgs(frame) | local frame, pargs = dev.GetFrameAndParentArgs(frame) | ||
local title = pargs["fullpagename"] or wik.fullpagename() | local title = pargs["fullpagename"] or wik.fullpagename() -- pargs["fullpagename"] zum Testen/Debuggen | ||
local v = "" | local v = "" | ||
| Zeile 49: | Zeile 49: | ||
v = v .. ", " | v = v .. ", " | ||
end | end | ||
v = v .. "[[:Kategorie:" .. g .. "|" .. g .. "]]{{#set:Genre=" .. g .. "}}[[Kategorie:" .. g .. "]]" | v = v .. "[[:Kategorie:" .. g .. "|" .. g .. "]]" .. | ||
"{{#set:Genre=" .. g .. "}}[[Kategorie:" .. g .. "]]" | |||
end | end | ||
t = t .. p.attrZeile("Genre", v) | t = t .. p.attrZeile("Genre", v) | ||
| Zeile 60: | Zeile 61: | ||
local w = pargs["Wert" .. i] or "" | local w = pargs["Wert" .. i] or "" | ||
if a ~= "" and w ~= "" then | if a ~= "" and w ~= "" then | ||
aw[a] = (aw[a] or "") .. w .. ";" | aw[a] = (aw[a] or "") .. w .. ";" -- Werte zusammenführen | ||
elseif a ~= "" or w ~= "" then | elseif a ~= "" or w ~= "" then | ||
aw_fail = true | aw_fail = true | ||
| Zeile 69: | Zeile 70: | ||
end | end | ||
for a, w in pairs(aw) do | for a, w in pairs(aw) do | ||
if a == "Gebäude" then | if a == "Gebäude" then -- zusätzlich Gebäude nach StraßeHnr suchen und hinzufügen | ||
local gebaeude_wert = {} | local gebaeude_wert = {} | ||
for _, e in ipairs(str.splitAndStrip(w, ";")) do | for _, e in ipairs(str.splitAndStrip(w, ";")) do -- direkt über Wertx angegebene Gebäude | ||
gebaeude_wert[e] = true | gebaeude_wert[e] = true | ||
end | end | ||
local gebaeude_query = {} | local gebaeude_query = {} | ||
for g, _ in pairs(gebaeude_wert) do | for g, _ in pairs(gebaeude_wert) do -- über query ermittelte Gebäude | ||
local q = "[[:+]][[Kategorie:Gebäude]][[StraßeHnr::" .. g .. "]]|?#-" | local q = "[[:+]][[Kategorie:Gebäude]]" .. | ||
"[[StraßeHnr::" .. g .. "]]|?#-" | |||
q = mw.smw.ask(q) or {} | q = mw.smw.ask(q) or {} | ||
for _, qg in ipairs(q) do | for _, qg in ipairs(q) do | ||
qg = qg[1] | qg = qg[1] | ||
if gebaeude_wert[qg] ~= true then | if gebaeude_wert[qg] ~= true then -- nur, wenn nicht schon direkt angegeben (auch nil!) | ||
gebaeude_query[qg] = true | gebaeude_query[qg] = true | ||
end | end | ||
end | end | ||
end | end | ||
v = "" | v = "" -- jetzt den Anzeigetext zusammenbauen | ||
for g, _ in pairs(gebaeude_wert) do | for g, _ in pairs(gebaeude_wert) do -- erst die direkt angegebenen Gebäude | ||
if v ~= "" then | if v ~= "" then | ||
v = v .. ", " | v = v .. ", " | ||
| Zeile 92: | Zeile 94: | ||
v = v .. "[[" .. a .. "::" .. g .. "]]" | v = v .. "[[" .. a .. "::" .. g .. "]]" | ||
end | end | ||
local v_query = "" | local v_query = "" -- dann die via query ermittelten Gebäude | ||
for g, _ in pairs(gebaeude_query) do | for g, _ in pairs(gebaeude_query) do | ||
if v_query ~= "" then | if v_query ~= "" then | ||
| Zeile 100: | Zeile 102: | ||
end | end | ||
if v_query ~= "" then | if v_query ~= "" then | ||
v = v .. "<br>automatisch ermittelt über Straße/Hausnummer: " .. v_query | v = v .. "<br>automatisch ermittelt über Straße/Hausnummer: " .. | ||
v_query | |||
end | end | ||
else | else | ||
| Zeile 109: | Zeile 112: | ||
-- normale Zeilen | -- normale Zeilen | ||
t = t .. p.attrZeile("Urheber", p.attrValList("Urheber", pargs), nil, nil, "fileinfotpl_aut") -- mit Setzen der Medienbetracher-Tags | t = t .. p.attrZeile("Urheber", p.attrValList("Urheber", pargs), | ||
nil, nil, "fileinfotpl_aut") -- mit Setzen der Medienbetracher-Tags | |||
t = t .. p.attrZeile("Quellangaben", p.attrVal("Quellangaben", pargs)) | t = t .. p.attrZeile("Quellangaben", p.attrVal("Quellangaben", pargs)) | ||
| Zeile 116: | Zeile 120: | ||
v = p.attrValList(a[1], pargs) | v = p.attrValList(a[1], pargs) | ||
if v ~= "" then | if v ~= "" then | ||
t = t .. p.zeile("[[Attribut:" .. a[1] .. "|" .. wob.attr_text(a[1]) .. "]]", v, "ausgeblendet:", | t = t .. p.zeile("[[Attribut:" .. a[1] .. "|" .. wob.attr_text(a[1]) .. "]]", v, | ||
"ausgeblendet:", "[[" .. a[2] .. "::" .. (pargs[a[2]] or "Nein") .. "]]") | |||
end | end | ||
end | end | ||
| Zeile 130: | Zeile 134: | ||
local erstellungsdatum = pargs["Erstellungsdatum"] or "" | local erstellungsdatum = pargs["Erstellungsdatum"] or "" | ||
if erstellungsdatum ~= "" then | if erstellungsdatum ~= "" then | ||
t = t .. p.attrZeile("Erstellungsdatum", lfd.linkFormDate(erstellungsdatum, "Erstellungsdatum", "Erstellungstag", "Erstellungsjahr")) | t = t .. p.attrZeile("Erstellungsdatum", | ||
lfd.linkFormDate(erstellungsdatum, | |||
"Erstellungsdatum", "Erstellungstag", "Erstellungsjahr")) | |||
end | end | ||
ueberdatum = pargs["ÜberDatum"] or "" | ueberdatum = pargs["ÜberDatum"] or "" | ||
if ueberdatum ~= "" then | if ueberdatum ~= "" then | ||
t = t .. p.attrZeile("ÜberDatum", lfd.linkFormDate(ueberdatum, "ÜberDatum", "ÜberTag", "ÜberJahr")) | t = t .. p.attrZeile("ÜberDatum", | ||
lfd.linkFormDate(ueberdatum, "ÜberDatum", "ÜberTag", "ÜberJahr")) | |||
end | end | ||
| Zeile 143: | Zeile 150: | ||
-- Lizenz mit Setzen der Medienbetracher-Tags | -- Lizenz mit Setzen der Medienbetracher-Tags | ||
local lizenz, is_cc_license = p.ccLicenseCorrection(pargs["Lizenz"] or "") | local lizenz, is_cc_license = | ||
p.ccLicenseCorrection(pargs["Lizenz"] or "") -- ggf. CC-Schreibeweise korrigieren | |||
if not is_cc_license then | if not is_cc_license then | ||
lizenz = p.nocNcLicenseCorrection(lizenz) | lizenz = p.nocNcLicenseCorrection(lizenz) -- ggf. NoC-NC 1.0 Schreibweise korrigieren | ||
end | end | ||
if not com.isEmpty(lizenz) then | if not com.isEmpty(lizenz) then -- Spezial-Behandlung für Media Viewer | ||
t = t .. | t = t .. | ||
"<tr>" .. | "<tr>" .. | ||
| Zeile 163: | Zeile 171: | ||
-- normale Zeilen | -- normale Zeilen | ||
t = t .. p.attrZeile("UploadCommons", p.attrVal("UploadCommons", pargs)) | t = t .. p.attrZeile("UploadCommons", p.attrVal("UploadCommons", pargs)) | ||
t = t .. p.attrZeile("Beschreibung", p.attrVal("Beschreibung", pargs), nil, nil, "fileinfotpl_desc") -- mit Setzen der Medienbetracher-Tags | t = t .. p.attrZeile("Beschreibung", p.attrVal("Beschreibung", pargs), | ||
nil, nil, "fileinfotpl_desc") -- mit Setzen der Medienbetracher-Tags | |||
-- Dateiinfo erstellen | -- Dateiinfo erstellen | ||
local dateiinfo, infotext = "", "" | local dateiinfo, infotext = "", "" | ||
if not com.isEmpty(pargs["Beschreibung"]) then -- Beschreibung | if not com.isEmpty(pargs["Beschreibung"]) then -- Beschreibung | ||
dateiinfo = dateiinfo .. wik.wikiTextLimit(pargs["Beschreibung"], 100) -- max. Zeichenanzahl Bild-Unterschrift | dateiinfo = dateiinfo .. | ||
if mw.ustring.len(dateiinfo) ~= mw.ustring.len(pargs["Beschreibung"]) then | wik.wikiTextLimit(pargs["Beschreibung"], 100) -- max. Zeichenanzahl Bild-Unterschrift | ||
if mw.ustring.len(dateiinfo) ~= | |||
mw.ustring.len(pargs["Beschreibung"]) then | |||
dateiinfo = dateiinfo .. " ..." | dateiinfo = dateiinfo .. " ..." | ||
infotext = infotext .. pargs["Beschreibung"] | infotext = infotext .. pargs["Beschreibung"] | ||
| Zeile 184: | Zeile 195: | ||
infotext = infotext .. "<br>" | infotext = infotext .. "<br>" | ||
end | end | ||
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 192: | Zeile 204: | ||
infotext = infotext .. "<br>" | infotext = infotext .. "<br>" | ||
end | end | ||
end | end | ||
end | end | ||
if not com.isEmpty( | if not com.isEmpty(lizenz) then -- Lizenz | ||
if infotext ~= "" then | if infotext ~= "" then | ||
infotext = infotext .. "<br>" | infotext = infotext .. "<br>" | ||
end | end | ||
infotext = infotext .. wob.attr_text("Lizenz") .. ": " .. | infotext = infotext .. wob.attr_text("Lizenz") .. ": " .. lizenz | ||
end | end | ||
if infotext ~= "" then | if infotext ~= "" then | ||
| Zeile 208: | Zeile 219: | ||
end | end | ||
if dateiinfo ~= "" then | if dateiinfo ~= "" then | ||
t = t .. p.zeile("[[Attribut:Dateiinfo|Dateiinfo]] '''<br>(Bild-Unterschrift und Info-Box,<br>automatisch erstellt)''' ", "[[Dateiinfo::" .. dateiinfo .. "]]") | t = t .. p.zeile("[[Attribut:Dateiinfo|Dateiinfo]] '''<br>" .. | ||
"(Bild-Unterschrift und Info-Box,<br>automatisch erstellt)''' ", | |||
"[[Dateiinfo::" .. dateiinfo .. "]]") | |||
end | end | ||
t = t .. p.zeile("Medienbetrachter-Zeile'''<br>(automatisch erstellt)''' ", (pargs["Quellangaben"] or "") .. " ▽ mehr Infos ▽", nil, nil, "fileinfotpl_src") | -- Quellangaben plus Hinweis als Medienbetrachter-Zeile | ||
t = t .. p.zeile("Medienbetrachter-Zeile'''<br>(automatisch erstellt)''' ", | |||
(pargs["Quellangaben"] or "") .. | |||
" ▽ mehr Infos ▽", nil, nil, "fileinfotpl_src") | |||
--[[ funktioniert nicht | --[[ funktioniert nicht | ||
if is_cc_license then | if is_cc_license then | ||
t = t .. | t = t .. | ||
| Zeile 228: | Zeile 244: | ||
end ]] | end ]] | ||
-- Erstellungsdatum ISO-Notation für Media Viewer | |||
if erstellungsdatum ~= "" then | if erstellungsdatum ~= "" then | ||
t = t .. p.zeile("Erstellungsdatum,<br>'''(ISO-Notation automatisch erstellt)''' ", | t = t .. p.zeile("Erstellungsdatum,<br>'''(ISO-Notation automatisch erstellt)''' ", | ||
| Zeile 233: | Zeile 250: | ||
end | end | ||
-- Tabellenende mit sem. Browsen | -- Tabellenende mit sem. Browsen und Bilder-Suche | ||
t = t .. p.zeile("[[Bild:IconSearch.svg|16px|Semantisches Browsen|link=Spezial:Durchsuchen/{{FULLPAGENAME}}]]", | t = t .. p.zeile("[[Bild:IconSearch.svg|16px|Semantisches Browsen|link=Spezial:Durchsuchen/{{FULLPAGENAME}}]]", | ||
"[[Spezial:Durchsuchen/{{FULLPAGENAME}}|Semantisches Browsen]] / {{#queryformlink:form=Abfrage Bilder|link text=Bilder-Suche}}") | "[[Spezial:Durchsuchen/{{FULLPAGENAME}}|Semantisches Browsen]] / " .. | ||
"{{#queryformlink:form=Abfrage Bilder|link text=Bilder-Suche}}") | |||
t = t .. "</table>" | t = t .. "</table>" | ||
| Zeile 328: | Zeile 346: | ||
end | end | ||
function p.ccLicenseCorrection(lic_text) | function p.ccLicenseCorrection(lic_text) -- Schreibweise CC-Lizenzen korrigieren | ||
local lic_text_fixed = string.upper(lic_text) | local lic_text_fixed = string.upper(lic_text) | ||
local is_cc_license = false | local is_cc_license = false | ||
| Zeile 350: | Zeile 368: | ||
end | end | ||
function p.nocNcLicenseCorrection(lic_text) | function p.nocNcLicenseCorrection(lic_text) -- Schreibweise NoC-NC 1.0 Lizenz korrigieren | ||
local lic_text_fixed = lic_text | local lic_text_fixed = lic_text | ||
if string.upper(lic_text) == "NOC-NC-1.0" or | if string.upper(lic_text) == "NOC-NC-1.0" or | ||
| Zeile 359: | Zeile 377: | ||
end | end | ||
function p.LicenseCorrection(frame) | function p.LicenseCorrection(frame) -- Schreibweise CC- und NoC-NC 1.0 Lizenz korrigieren | ||
local lizenz = frame.args["Lizenz"] or "" | local lizenz = frame.args["Lizenz"] or "" | ||
lizenz = p.ccLicenseCorrection(lizenz) | lizenz = p.ccLicenseCorrection(lizenz) | ||