82.367
Bearbeitungen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
| Zeile 5: | Zeile 5: | ||
local title = mw.title.getCurrentTitle().text | local title = mw.title.getCurrentTitle().text | ||
local extension = p.getExtension(title) | local extension = p.getExtension(title) | ||
local filekind = p.getFilekind(extension) | |||
local a, w, z | local a, w, z | ||
| Zeile 61: | Zeile 62: | ||
if not c.isEmpty(args['Straße']) then | if not c.isEmpty(args['Straße']) then | ||
t=t..'<tr>'.. | t = t .. '<tr>' .. | ||
'<td>[[Attribut:Straße|Straße]]</td>'.. | '<td>[[Attribut:Straße|Straße]]</td>' .. | ||
'<td>'..frame:callParserFunction( | '<td>' .. frame:callParserFunction( | ||
'#arraymap', args['Straße'], ';', 'x', '[[Straße::x]]') | '#arraymap', args['Straße'], ';', 'x', '[[Straße::x]]') | ||
t=t..'</td>'.. | t = t .. '</td>' .. | ||
'<td><b>ausblenden:</b></td>' | '<td><b>ausblenden:</b></td>' | ||
z = '<td>[[ZeigeNichtInStraße::Nein]]</td>' | z = '<td>[[ZeigeNichtInStraße::Nein]]</td>' | ||
| Zeile 71: | Zeile 72: | ||
z = '<td>[[ZeigeNichtInStraße::'..args['ZeigeNichtInStraße']..']]</td>' | z = '<td>[[ZeigeNichtInStraße::'..args['ZeigeNichtInStraße']..']]</td>' | ||
end | end | ||
t=t..z..'</tr>' | t = t .. z .. '</tr>' | ||
end | end | ||
if not c.isEmpty(args.Erstellungsdatum) then | if not c.isEmpty(args.Erstellungsdatum) then | ||
t=t..'<tr>'.. | t = t .. '<tr>' .. | ||
'<td>[[Attribut:Erstellungsdatum|Erstellungsdatum]]</td>'.. | '<td>[[Attribut:Erstellungsdatum|Erstellungsdatum]]</td>' .. | ||
'<td colspan="3">'..frame:expandTemplate{title='LinkFormDatum', args={ | '<td colspan="3">' .. frame:expandTemplate{title='LinkFormDatum', args={ | ||
args.Erstellungsdatum, | args.Erstellungsdatum, | ||
'Erstellungsdatum', | 'Erstellungsdatum', | ||
'Erstellungstag', | 'Erstellungstag', | ||
'Erstellungsjahr'}}..'</td>'.. | 'Erstellungsjahr'}} .. '</td>' .. | ||
'</tr>' | '</tr>' | ||
end | end | ||
| Zeile 114: | Zeile 115: | ||
t=t..'<tr>'.. | t=t..'<tr>'.. | ||
'<td>[[Attribut:Dateityp|Dateityp]]</td>'.. | '<td>[[Attribut:Dateityp|Dateityp]]</td>'.. | ||
'<td | '<td>[[Dateityp::' .. extension .. ']]</td>'.. | ||
'<td>[[Attribut:Dateiart|Dateiart]]</td>'.. | |||
'<td>[[Dateiart::' .. filekind .. ']]</td>'.. | |||
'</tr>' | '</tr>' | ||
end | end | ||
| Zeile 128: | Zeile 131: | ||
t=t..'<tr>'.. | t=t..'<tr>'.. | ||
'<td>[[Attribut:Lizenz|Lizenz]]</td>'.. | '<td>[[Attribut:Lizenz|Lizenz]]</td>'.. | ||
'<td colspan="3">[[Lizenz::'..args.Lizenz..']]</td>'.. | '<td colspan="3">[[Lizenz::' .. args.Lizenz .. ']]</td>'.. | ||
'</tr>' | '</tr>' | ||
end | end | ||
| Zeile 135: | Zeile 138: | ||
t=t..'<tr>'.. | t=t..'<tr>'.. | ||
'<td>[[Attribut:Beschreibung|Beschreibung]]</td>'.. | '<td>[[Attribut:Beschreibung|Beschreibung]]</td>'.. | ||
'<td colspan="3">[[Beschreibung::'..args.Beschreibung..']]</td>'.. | '<td colspan="3">[[Beschreibung::' ..args.Beschreibung .. ']]</td>'.. | ||
'</tr>' | '</tr>' | ||
end | end | ||
| Zeile 142: | Zeile 145: | ||
t=t..'<tr>'.. | t=t..'<tr>'.. | ||
'<td>[[Attribut:UploadCommons|Upload zu Wikimedia Commons]]</td>'.. | '<td>[[Attribut:UploadCommons|Upload zu Wikimedia Commons]]</td>'.. | ||
'<td colspan="3">[[UploadCommons::'..args.UploadCommons..']]</td>'.. | '<td colspan="3">[[UploadCommons::' .. args.UploadCommons .. ']]</td>'.. | ||
'</tr>' | '</tr>' | ||
end | end | ||
| Zeile 155: | Zeile 158: | ||
function p.getExtension(filename) | function p.getExtension(filename) | ||
local extension = filename:match("^.+%.([^%.]+)$") | |||
return mw.ustring.lower(extension) | |||
end | |||
function p.getFilekind(filetype) | |||
local t = { | |||
["Bild"] = {"webp", "png", "gif", "jpg", "jpeg", "svg"}, | |||
["Dokument"] = {"pdf"}, | |||
["Audio"] = {"mp3", "ogg", "oga", "flac", "opus", "wav"}, | |||
["Midi"] = {"midi", "mid"}, | |||
["Video"] = {"webm", "mp4", "m4v", "ogv", "mpg", "mpeg"}, | |||
["3D-Modell"] = {"obj", "glb", "gltf"}, | |||
} | |||
for key, values in pairs(t) do | |||
for _, value in ipairs(values) do | |||
if value == filetype then | |||
return key -- Bricht beide Schleifen ab und gibt den Key zurück | |||
end | |||
end | |||
end | |||
return "" -- Gib leeren String zurück, wenn nichts gefunden wurde | |||
end | end | ||
return p | return p | ||