Module:Lang: Difference between revisions

remove <br> processing
No edit summary
Line 35: Line 35:
end
end


local function process_html_tags(text)
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
      
 
    -- Replace <span class="highlight">...</span> with '''...'''
     text = text:gsub("{g:citadel_inline_attribute:'SpiritDamage'}",
        frame:preprocess("{{Monster_Domosed/Sandbox|icon=AttributeIconTechShieldHealth.png|link=Spirit Damage|size=12px}}") ..
        ' <span style="color:#bc8ee8;">spirit damage</span>')
 
     text = text:gsub('<span class="highlight">(.-)</span>', "'''%1'''")
     text = text:gsub('<span class="highlight">(.-)</span>', "'''%1'''")
   
    -- Replace <span class="diminish">...</span> with gray text
     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>')
   
    -- Remove all other span tags (keeping only content)
     text = text:gsub('<span class=".-">(.-)</span>', '%1')
     text = text:gsub('<span class=".-">(.-)</span>', '%1')
   
 
     return text
     return text
end
end


function p.get_string(key, lang_code_override, fallback_str, remove_var_index)
function p.get_string(key, lang_code_override, fallback_str, remove_var_index)
Line 100: Line 100:
     -- Process HTML and return as "raw" HTML
     -- Process HTML and return as "raw" HTML
     label = process_newlines(label)
     label = process_newlines(label)
     label = process_html_tags(label)
     label = process_html_tags(label, frame)
     -- Create HTML object for safe output
     -- Create HTML object for safe output
     local html = mw.html.create()
     local html = mw.html.create()