Module:AbilitySection: Difference between revisions

Jump to navigation Jump to search
Vergir (talk | contribs)
Read the iconbox- data attributes from the box (with help from vergir-bot LLM)
Vergir (talk | contribs)
m update comments
Line 27: Line 27:
end
end


-- Process content in the Interactions tab to build list of icons to draw in ability hints beside ability card
local function process_interactions(html, ability_num)
local function process_interactions(html, ability_num)
local manual, idx, seen = {}, 0, {}
local manual, idx, seen = {}, 0, {}
-- Boxes are identified by their data-iconbox-* attributes, which are the
-- contract with Template:IconBox. Class names are presentational and
-- deliberately not matched here, so box styling can change without touching this.
local out = html:gsub('(<div)([^>]*data%-iconbox%-icon="[^"]*"[^>]*)(>)', function(pre, attrs, post)
local out = html:gsub('(<div)([^>]*data%-iconbox%-icon="[^"]*"[^>]*)(>)', function(pre, attrs, post)
local file = attrs:match('data%-iconbox%-icon="([^"]*)"')
local file = attrs:match('data%-iconbox%-icon="([^"]*)"')
Line 121: Line 119:
ability_key = ability.Key
ability_key = ability.Key
local ability_name = lang.get_string(ability.Key)
local ability_name = lang.get_string(ability.Key)
-- Use the English ability key for icon render; icon module indexes by English name
local ability_name_en = lang.get_string(ability.Key, 'en', ability.Key)
local ability_name_en = lang.get_string(ability.Key, 'en', ability.Key)
local icon_html = icon_module._render(ability_name_en, { size = '30px', ['icon-only'] = 'true', ['no-link'] = 'true' })
local icon_html = icon_module._render(ability_name_en, { size = '30px', ['icon-only'] = 'true', ['no-link'] = 'true' })