17.832
Bearbeitungen
(+ namespace check) |
(+ Media Viewer Infos, Korrektur Lizenz-Schreibweise) |
||
| Zeile 7: | Zeile 7: | ||
local lfd = require("Modul:LinkFormDatum") | local lfd = require("Modul:LinkFormDatum") | ||
local wob = require("Modul:Wörterbuch") | local wob = require("Modul:Wörterbuch") | ||
local kal = require("Modul:Kalender/Work") | |||
local license_url = { | |||
-- Quelle: https://creativecommons.org/licenses/list.en | |||
["CC BY 3.0"] = "https://creativecommons.org/licenses/by/3.0/de/deed.de", | |||
["CC BY-NC 3.0"] = "https://creativecommons.org/licenses/by-nc/3.0/de/deed.de", | |||
["CC BY-NC-ND 3.0"] = "https://creativecommons.org/licenses/by-nc-nd/3.0/de/deed.de", | |||
["CC BY-NC-SA 3.0"] = "https://creativecommons.org/licenses/by-nc-sa/3.0/de/deed.de", | |||
["CC BY-ND 3.0"] = "https://creativecommons.org/licenses/by-nd/3.0/de/deed.de", | |||
["CC BY-SA 3.0"] = "https://creativecommons.org/licenses/by-sa/3.0/de/deed.de", | |||
["CC BY 4.0"] = "https://creativecommons.org/licenses/by/4.0/deed.de", | |||
["CC BY-NC 4.0"] = "https://creativecommons.org/licenses/by-nc/4.0/deed.de", | |||
["CC BY-NC-ND 4.0"] = "https://creativecommons.org/licenses/by-nc-nd/4.0/deed.de", | |||
["CC BY-NC-SA 4.0"] = "https://creativecommons.org/licenses/by-nc-sa/4.0/deed.de", | |||
["CC BY-ND 4.0"] = "https://creativecommons.org/licenses/by-nd/4.0/deed.de", | |||
["CC BY-SA 4.0"] = "https://creativecommons.org/licenses/by-sa/4.0/deed.de"} | |||
function p.Dateibox(frame) | function p.Dateibox(frame) | ||
| Zeile 93: | Zeile 109: | ||
-- normale Zeilen | -- normale Zeilen | ||
t = t .. p.attrZeile("Urheber", p.attrValList("Urheber", pargs)) | 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 112: | Zeile 128: | ||
-- Erstellungsdatum/ÜberDatum | -- Erstellungsdatum/ÜberDatum | ||
local erstellungsdatum = pargs["Erstellungsdatum"] or "" | |||
if erstellungsdatum ~= "" then | |||
t = t .. p.attrZeile("Erstellungsdatum", lfd.linkFormDate(erstellungsdatum, "Erstellungsdatum", "Erstellungstag", "Erstellungsjahr")) | |||
end | |||
ueberdatum = pargs["ÜberDatum"] or "" | |||
if ueberdatum ~= "" then | |||
t = t .. p.attrZeile("ÜberDatum", lfd.linkFormDate(ueberdatum, "ÜberDatum", "ÜberTag", "ÜberJahr")) | |||
end | end | ||
| Zeile 125: | Zeile 141: | ||
t = t .. p.attrZeile("Signatur", p.attrVal("Signatur", pargs)) | t = t .. p.attrZeile("Signatur", p.attrVal("Signatur", pargs)) | ||
t = t .. p.attrZeile("Länge", p.attrVal("Länge", pargs)) | t = t .. p.attrZeile("Länge", p.attrVal("Länge", pargs)) | ||
-- Lizenz mit Setzen der Medienbetracher-Tags | |||
local lizenz, is_cc_license = p.ccLicenseCorrection(pargs["Lizenz"] or "") | |||
if not is_cc_license then | |||
lizenz = p.nocNcLicenseCorrection(lizenz) | |||
end | |||
if not com.isEmpty(lizenz) then | |||
t = t .. | |||
"<tr>" .. | |||
"<td class=\"fileinfo-paramfield\">'''[[Attribut:Lizenz|Lizenz]]'''</td>" .. | |||
"<td colspan = \"3\">" .. | |||
"<span class=\"licensetpl\">" .. | |||
"<span class=\"licensetpl_short\">" .. | |||
lizenz .. | |||
"</span>" .. | |||
"</span>" .. | |||
"</td>" .. | |||
"</tr>" | |||
end | |||
-- 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)) | 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 | 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 138: | Zeile 174: | ||
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 156: | Zeile 192: | ||
infotext = infotext .. "<br>" | infotext = infotext .. "<br>" | ||
end | end | ||
-- infotext = infotext .. wob.attr_text(d) .. ": " .. lfd.linkFormDate(date) | |||
end | end | ||
end | end | ||
| Zeile 174: | Zeile 210: | ||
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") | |||
--[[ funktioniert nicht ... | |||
if is_cc_license then | |||
t = t .. | |||
"<tr>" .. | |||
"<td class=\"fileinfo-paramfield\">'''Lizenz-URL'''<br>(automatisch erstellt)</td>" .. | |||
"<td colspan = \"3\">" .. | |||
"<span class=\"licensetpl\">" .. | |||
"<span class=\"licensetpl_link\">" .. | |||
license_url[lizenz] .. | |||
"</span>" .. | |||
"</span>" .. | |||
"</td>" .. | |||
"</tr>" | |||
end ]] | |||
if erstellungsdatum ~= "" then | |||
t = t .. p.zeile("Erstellungsdatum,<br>'''(ISO-Notation automatisch erstellt)''' ", | |||
kal.date2ISO(erstellungsdatum), nil, nil, "fileinfotpl_date") | |||
end | |||
-- Tabellenende mit sem. Browsen | -- Tabellenende mit sem. Browsen | ||
t = t .. p.zeile("[[Bild:IconSearch.svg|16px| | t = t .. p.zeile("[[Bild:IconSearch.svg|16px|Semantisches Browsen|link=Spezial:Durchsuchen/{{FULLPAGENAME}}]]", | ||
"[[Spezial:Durchsuchen/{{FULLPAGENAME}}| | "[[Spezial:Durchsuchen/{{FULLPAGENAME}}|Semantisches Browsen]] / {{#queryformlink:form=Abfrage Bilder|link text=Bilder-Suche}}") | ||
t = t .. "</table>" | t = t .. "</table>" | ||
| Zeile 237: | Zeile 295: | ||
end | end | ||
function p.attrZeile(a1, v1, a2, v2) | function p.attrZeile(a1, v1, a2, v2, id1) -- Tabellenzeile mit max. 2 Attributen | ||
local t = "" | local t = "" | ||
if v1 ~= "" then | if v1 ~= "" then | ||
| Zeile 244: | Zeile 302: | ||
a2 = "[[Attribut:" .. a2 .. "|" .. wob.attr_text(a2) .. "]]" | a2 = "[[Attribut:" .. a2 .. "|" .. wob.attr_text(a2) .. "]]" | ||
end | end | ||
t = t .. p.zeile(a1, v1, a2, v2) | t = t .. p.zeile(a1, v1, a2, v2, id1) | ||
end | end | ||
return t | return t | ||
end | end | ||
function p.zeile(a1, v1, a2, v2) | function p.zeile(a1, v1, a2, v2, id1) -- Tabellenzeile mit max. 2x2 Einträgen | ||
local t = "" | local t = "" | ||
if v1 ~= "" then | if v1 ~= "" then | ||
t = t .. "<tr>" | t = t .. "<tr>" | ||
t = t .. "<td>'''" .. a1 .. "'''</td>" | if id1 == nil then | ||
t = t .. "<td>'''" .. a1 .. "'''</td>" | |||
else | |||
t = t .. "<td id=\"" .. id1 .. "\" class=\"fileinfo-paramfield\">'''" .. a1 .. "'''</td>" | |||
end | |||
if a2 == nil or v2 == nil or v2 == "" then | if a2 == nil or v2 == nil or v2 == "" then | ||
t = t .. "<td colspan = \"3\">" .. v1 .. "</td>" | t = t .. "<td colspan = \"3\">" .. v1 .. "</td>" | ||
| Zeile 264: | Zeile 326: | ||
end | end | ||
return t | return t | ||
end | |||
function p.ccLicenseCorrection(lic_text) | |||
local lic_text_fixed = string.upper(lic_text) | |||
local is_cc_license = false | |||
if string.sub(lic_text_fixed, 1, 3) == "CC " or -- Beginn mit "CC " or "CC-"? | |||
string.sub(lic_text_fixed, 1, 3) == "CC-" then | |||
is_cc_license = true | |||
if string.sub(lic_text_fixed, 3, 3) == "-" then -- Bindestrich hinter "CC" entfernen | |||
lic_text_fixed = "CC " .. string.sub(lic_text_fixed, 4) | |||
end | |||
local version_hyphen_start, version_hyphen_end = -- Bindestrich vor Version entfernen | |||
string.find(lic_text_fixed,"-%d") | |||
if version_hyphen_start ~= nil then | |||
lic_text_fixed = | |||
string.sub(lic_text_fixed, 1, version_hyphen_start - 1) .. | |||
" " .. string.sub(lic_text_fixed, version_hyphen_start + 1) | |||
end | |||
else | |||
lic_text_fixed = lic_text | |||
end | |||
return lic_text_fixed, is_cc_license | |||
end | |||
function p.nocNcLicenseCorrection(lic_text) | |||
local lic_text_fixed = lic_text | |||
if string.upper(lic_text) == "NOC-NC-1.0" or | |||
string.upper(lic_text) == "NOC-NC 1.0" then | |||
lic_text_fixed = "NoC-NC 1.0" | |||
end | |||
return lic_text_fixed | |||
end | end | ||
return p | return p | ||