26.714
Bearbeitungen
(- KlassenBild) |
(+ getAttrData()) |
||
| Zeile 1: | Zeile 1: | ||
local p = {} | local p = {} | ||
local | |||
local com = require("Module:Common") | |||
local str = require("Module:String") | |||
local atr = require("Module:Attribut") | |||
function p.Faktenbox( frame ) | function p.Faktenbox( frame ) | ||
| Zeile 18: | Zeile 21: | ||
t=t..'<tr>'.. | t=t..'<tr>'.. | ||
'<td>[[Attribut:Bild|Bild dieser Klasse]]</td>' | '<td>[[Attribut:Bild|Bild dieser Klasse]]</td>' | ||
if not | if not com.isEmpty(args.Bild) then | ||
t=t..'<td colspan="3"><div class="ImageLink">[[Datei:'.. | t=t..'<td colspan="3"><div class="ImageLink">[[Datei:'.. | ||
args.Bild..'|48px]]</div></td>' | args.Bild..'|48px]]</div></td>' | ||
| Zeile 34: | Zeile 37: | ||
t=t..'</tr><tr>'.. | t=t..'</tr><tr>'.. | ||
'<td>[[Attribut:KlassenKategorie|Kategorie]]</td>' | '<td>[[Attribut:KlassenKategorie|Kategorie]]</td>' | ||
if not | if not com.isEmpty(args.KlassenKategorie) then | ||
t=t..'<td colspan="3">[[KlassenKategorie::Kategorie:'..args.KlassenKategorie..']]</td>' | t=t..'<td colspan="3">[[KlassenKategorie::Kategorie:'..args.KlassenKategorie..']]</td>' | ||
end | end | ||
| Zeile 44: | Zeile 47: | ||
t=t..'</tr><tr>'.. | t=t..'</tr><tr>'.. | ||
'<td>[[Attribut:Suchformular|Suchformular]]</td>' | '<td>[[Attribut:Suchformular|Suchformular]]</td>' | ||
if not | if not com.isEmpty(args.KlassenKategorie) then | ||
t=t..'<td colspan="2">[[Suchformular::Abfrage_'..args.KlassenKategorie..']]</td>'.. | t=t..'<td colspan="2">[[Suchformular::Abfrage_'..args.KlassenKategorie..']]</td>'.. | ||
'<td>[[Formular:Abfrage_'..args.KlassenKategorie..']]</td>' | '<td>[[Formular:Abfrage_'..args.KlassenKategorie..']]</td>' | ||
| Zeile 51: | Zeile 54: | ||
t=t..'</tr><tr>'.. | t=t..'</tr><tr>'.. | ||
'<td>[[Attribut:Suchvorlage|Suchvorlage]]</td>' | '<td>[[Attribut:Suchvorlage|Suchvorlage]]</td>' | ||
if not | if not com.isEmpty(args.KlassenKategorie) then | ||
t=t..'<td colspan="2">[[Suchvorlage::Abfrage_'..args.KlassenKategorie..']]</td>'.. | t=t..'<td colspan="2">[[Suchvorlage::Abfrage_'..args.KlassenKategorie..']]</td>'.. | ||
'<td>[[Spezial:Abfrage_ausführen/Abfrage_'..args.KlassenKategorie..']]</td>' | '<td>[[Spezial:Abfrage_ausführen/Abfrage_'..args.KlassenKategorie..']]</td>' | ||
| Zeile 58: | Zeile 61: | ||
t=t..'</tr><tr>'.. | t=t..'</tr><tr>'.. | ||
'<td>[[Attribut:AttributListe|AttributListe]]</td>' | '<td>[[Attribut:AttributListe|AttributListe]]</td>' | ||
if not | if not com.isEmpty(args.AttributListe) then | ||
t=t..'<td colspan="3">[[AttributListe::'..args.AttributListe..']]</td>' | t=t..'<td colspan="3">[[AttributListe::'..args.AttributListe..']]</td>' | ||
end | end | ||
| Zeile 68: | Zeile 71: | ||
t=t..'</table>' | t=t..'</table>' | ||
return t | return t | ||
end | |||
function p.getAttrData(klasse) | |||
local attr_data = {} | |||
local query = {"[[Klasse:" .. klasse .. "]]", | |||
"?AttributListe"} | |||
query = mw.smw.ask(query) | |||
if query ~= nil then | |||
local attributliste = query[1]["AttributListe"] | |||
attributliste = str.splitAndStrip(attributliste, ";") | |||
if #attributliste > 0 then | |||
attr_data.list = {} | |||
for i, a in ipairs(attributliste) do | |||
attr_data.list[i] = atr.getAttrAttributes(a, klasse) | |||
attr_data.list[i]["Attribut"] = a | |||
end | |||
end | |||
end | |||
return attr_data | |||
end | end | ||
return p | return p | ||