Module:Lang: Difference between revisions

Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 135: Line 135:
     text = text:gsub('</Panel>', '')
     text = text:gsub('</Panel>', '')
      
      
     -- Process panel tags (Optimized: Using internal Lua function call instead of frame:preprocess #invoke)
     -- Process panel tags
     text = text:gsub('<Panel class=\"AbilityPropertyIcon prop_(.-)\">', function(key)
     text = text:gsub('<Panel class=\"AbilityPropertyIcon prop_(.-)\">', function(key)
         local replacement = REPLACEMENTS[key]
         local replacement = REPLACEMENTS[key]
Line 156: Line 156:
     end)
     end)
          
          
     -- Process citadel_inline_attribute tags (Optimized: Internal function call instead of frame:preprocess #invoke)
     -- Process citadel_inline_attribute tags
     text = text:gsub("{g:citadel_inline_attribute:'(.-)'}", function(key)
     text = text:gsub("{g:citadel_inline_attribute:'(.-)'}", function(key)
         local replacement = REPLACEMENTS[key]
         local replacement = REPLACEMENTS[key]
Line 177: Line 177:
     end)
     end)
      
      
     -- Process citadel_binding/citadel_keybind tags (Optimized: Internal function call instead of frame:preprocess #invoke)
     -- Process citadel_binding/citadel_keybind tags
     text = text:gsub("{g:citadel_binding:'(.-)'}", function(key)
     text = text:gsub("{g:citadel_binding:'(.-)'}", function(key)
         local lower_key = key:lower()
         local lower_key = key:lower()
Line 247: Line 247:
     end
     end
      
      
    -- Optimized: Using efficient string processing instead of converting to table array via mw.text.split
     if type(label) == "string" and label:find("|") then
     if type(label) == "string" and label:find("|") then
         label = label:gsub("^.*|", "")
         label = label:gsub("^.*|", "")
Line 304: Line 303:
     end
     end
      
      
    -- Optimized: Lazy build the reverse key index cache.
    -- This turns an O(N) loop into an O(1) table lookup map.
     if not en_reverse_cache then
     if not en_reverse_cache then
         en_reverse_cache = {}
         en_reverse_cache = {}