17,101
edits
m (Fix image override) |
(Icon: Expand support for 'section links' to include POIs; remove duplicate extension overrides) |
||
Line 102: | Line 102: | ||
["Mark"] = "svg", | ["Mark"] = "svg", | ||
["Astro"] = "svg", | ["Astro"] = "svg", | ||
-- Curses & spells, included to override the type level override above | -- Curses & spells, included to override the type level override above | ||
["Madness"] = "png", | ["Madness"] = "png", | ||
Line 546: | Line 542: | ||
} | } | ||
--If no other text override was specified for the given link, use these | -- If no other text override was specified for the given link, use these | ||
local txtOverrides = { | local txtOverrides = { | ||
['Spider2'] = 'Brown Spider', | ['Spider2'] = 'Brown Spider', | ||
['Earth Golem (AoD)'] = 'Earth Golem' | ['Earth Golem (AoD)'] = 'Earth Golem' | ||
} | } | ||
--Ambiguous overrides section | -- Ambiguous overrides section | ||
local ambiguousOverrides = { | local ambiguousOverrides = { | ||
['Golbin'] = true, | ['Golbin'] = true, | ||
Line 570: | Line 566: | ||
['Shipwreck Cove'] = true | ['Shipwreck Cove'] = true | ||
} | } | ||
--When calling for an icon for Key, add a css class | |||
-- For ambiguous overrides, determines the type text to be used in the page link | |||
local ambiguousTypeMap = { | |||
['mark'] = 'item', | |||
['combatArea'] = 'Combat Area', | |||
['poi'] = 'Dig Site' | |||
} | |||
-- Defines icon types for which a section or anchor on a static page should be linked to, rather | |||
-- than the usual page linking | |||
local sectionLinks = { | |||
['agility'] = { | |||
['link'] = 'Agility', | |||
['img'] = {'Agility', 'skill'}, | |||
['exclude'] = {} | |||
}, | |||
['poi'] = { | |||
['link'] = 'Cartography', | |||
['exclude'] = { | |||
['Ancient Market'] = true, | |||
['Ritual Site'] = true, | |||
['Melantis'] = true, | |||
['Cathedral'] = true, | |||
['Monuments'] = true, | |||
['Coral Wreckage'] = true, | |||
['Shipwreck Cove'] = true, | |||
['Watchtower'] = true, | |||
['Sacrificial Site'] = true, | |||
['Old Village'] = true, | |||
['Bazaar'] = true, | |||
['Glacia City Ruins'] = true, | |||
['Castle Ruins'] = true, | |||
['Ancient Forge'] = true, | |||
['Quarry'] = true, | |||
['Secret Mines'] = true, | |||
['Lost Temple'] = true, | |||
['Stoneworkers'] = true | |||
} | |||
} | |||
} | |||
-- When calling for an icon for Key, add a css class | |||
local imgClassOverrides = { | local imgClassOverrides = { | ||
-- Was previously used for Township stat icons prior to v1.1.2 | -- Was previously used for Township stat icons prior to v1.1.2 | ||
Line 605: | Line 642: | ||
-- of a page should instead be performed using the 'section' parameter. | -- of a page should instead be performed using the 'section' parameter. | ||
link = sgsub(link, '#', '') | link = sgsub(link, '#', '') | ||
-- | -- Handle types for which links should be to a section of a static page | ||
if | local sl = sectionLinks[iconType] | ||
if sl ~= nil and not sl.exclude[link] then | |||
if text == nil or text == '' then | if text == nil or text == '' then | ||
text = link | text = link | ||
end | end | ||
linkSection = string.gsub(link, ' ', '') | linkSection = string.gsub(link, ' ', '') | ||
link = | -- Link overwriting must occur after text & linkSection have been set | ||
link = sl.link | |||
if sl.img ~= nil then | |||
img = sl.img[1] | |||
if sl.img[2] ~= nil then | |||
iconType = sl.img[2] | |||
end | |||
end | |||
end | end | ||
Line 687: | Line 730: | ||
hasText = true | hasText = true | ||
end | end | ||
if isAmbig then | |||
if | link = link .. ' (' .. (ambiguousTypeMap[origType] or origType) .. ')' | ||
end | |||
if hasSection then | |||
link = link .. '#' .. linkSection | |||
end | end | ||
end | end | ||