5.423
Bearbeitungen
Stewie (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
Stewie (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
Zeile 11: | Zeile 11: | ||
local p = {} | local p = {} | ||
-- String-Bereinigung für robuste Vergleiche | |||
local function clean(str) | |||
if not str then return "" end | |||
return mw.ustring.lower( | |||
mw.text.trim( | |||
mw.ustring.gsub(str, '[%c%s]+', '') | |||
) | |||
) | |||
end | |||
-- Holt alle Zauber einer Magieschule, gruppiert nach Grad | -- Holt alle Zauber einer Magieschule, gruppiert nach Grad | ||
Zeile 68: | Zeile 78: | ||
local imageTag = string.format('[[Datei:%s|50px]]', image) | local imageTag = string.format('[[Datei:%s|50px]]', image) | ||
local function safeString(value) | local function safeString(value) | ||
if type(value) == "table" then | if type(value) == "table" then | ||
Zeile 84: | Zeile 93: | ||
local option = safeString(spell["Zauberoption"]) | local option = safeString(spell["Zauberoption"]) | ||
-- Magieschulen bereinigt anzeigen | -- Magieschulen bereinigt anzeigen | ||
local magieschule = spell["Magieschule"] | local magieschule = spell["Magieschule"] | ||
local schuleAnzeigen = "–" | local schuleAnzeigen = "–" | ||
if magieschule then | |||
if magieschule then | if type(magieschule) == "table" then | ||
local andere = {} | |||
for _, s in ipairs(magieschule) do | |||
if clean(s) ~= clean(pageTitle) then | |||
table.insert(andere, s) | |||
end | |||
end | |||
if #andere > 0 then | |||
schuleAnzeigen = table.concat(andere, ", ") | |||
end | |||
elseif clean(magieschule) ~= clean(pageTitle) then | |||
schuleAnzeigen = magieschule | |||
end | |||
end | |||
end | |||
table.insert(output, string.format( | table.insert(output, string.format( |
Bearbeitungen