Module:Lang: Difference between revisions

Jump to navigation Jump to search
Fixed issue with coloring of spirit icon
No edit summary
Line 37: Line 37:
local function process_html_tags(text, frame)
local function process_html_tags(text, frame)
     if not text or type(text) ~= "string" then return text end
     if not text or type(text) ~= "string" then return text end
 
   
     text = text:gsub("{g:citadel_inline_attribute:'SpiritDamage'}", "{{Monster_Domosed/Sandbox|color=purple}}" .. ' <span style="color:#bc8ee8;">spirit damage</span>')
     local replacements = {
 
        SpiritIcon = '{{Icon/Purple|[[File:AttributeIconTechShieldHealth.png|link=Spirit Damage|12px]]}}',
     text = text:gsub('<span class="highlight">(.-)</span>', "'''%1'''")
        SpiritDamage = '{{Icon/Purple|[[File:AttributeIconTechShieldHealth.png|link=Spirit Damage|12px]]}}<span style="color:#bc8ee8;font-weight: bold;">spirit damage</span>',
        FireRate = '{{Icon/Grey|[[File:Fire_Rate.png|link=Fire Rate|20px]]}}<span style="color:#ffefd7;font-weight: bold;">fire rate</span>',
        MeleeDamage = '{{Icon/Brown|[[File:Melee damage.png|link=Melee Damage|20px]]}}<span style="font-weight: bold;">melee damage</span>',
    WeaponDamage = '{{Icon/Brown|[[File:Damage.png|link=Weapon Damage|20px]]}}<span style="color:#ec981a;font-weight: bold;">weapon damage</span>'
   
    }
   
    -- Process citadel_inline_attribute tags
    text = text:gsub("{g:citadel_inline_attribute:'(.-)'}", function(key)
        if replacements[key] then
            return replacements[key]
        else
            return '<span style="color:red;font-weight:bold;border-bottom:1px dotted red;" title="Missing attribute definition - Add \''..key..'\' to local replacements in [Module:Lang]">['..key..']</span>'
        end
    end)
   
    -- Process HTML spans
     text = text:gsub('<span class="highlight">(.-)</span>', "<span style= font-weight:bold>%1</span>")
     text = text:gsub('<span class="diminish">(.-)</span>', '<span style="color:#777777">%1</span>')
     text = text:gsub('<span class="diminish">(.-)</span>', '<span style="color:#777777">%1</span>')
     text = text:gsub('<span class=".-">(.-)</span>', '%1')
     text = text:gsub('<span class=".-">(.-)</span>', '%1')