Module:Icon: Difference between revisionsGive feedback
Jump to navigation
Jump to search
Fixed "Icon not found" errors for unused items by adding legacyItems fallback logic and image overrides for Bullet/Spirit Armor. |
Changed ability icon links to point to the #Abilities section of hero pages instead of the main page. |
||
| Line 81: | Line 81: | ||
local function getLink(iconInfo) | local function getLink(iconInfo) | ||
if iconInfo.type == "ability" then | if iconInfo.type == "ability" then | ||
local hero = iconInfo.hero_name or iconInfo.name | |||
return hero .. "#Abilities" | |||
end | end | ||
return linkOverrides[iconInfo.name] or iconInfo.name | return linkOverrides[iconInfo.name] or iconInfo.name | ||
| Line 134: | Line 135: | ||
local baseLink = getLink(iconInfo) | local baseLink = getLink(iconInfo) | ||
local fragment = "" | |||
-- Split the fragment (#Abilities) from the base link | |||
if baseLink:find("#") then | |||
local parts = mw.text.split(baseLink, "#", true) | |||
baseLink = parts[1] | |||
fragment = "#" .. (parts[2] or "") | |||
end | |||
local link = baseLink | local link = baseLink | ||
if langCode ~= "en" and baseLink ~= "" then | if langCode ~= "en" and baseLink ~= "" then | ||
link = baseLink .. "/" .. langCode | link = baseLink .. "/" .. langCode | ||
end | end | ||
-- Re-attach the fragment at the very end | |||
link = link .. fragment | |||
-- Abilities get the module-icon-ability class for light/dark theme filter support | -- Abilities get the module-icon-ability class for light/dark theme filter support | ||