Module:Sandbox/Aurelain/Link

From Heroes of Might and Magic: Olden Era Official Wiki
Revision as of 17:01, 25 August 2026 by Aurelain (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This module is intended as a supporting muscle for the LinkIcon template.

clean()

Removes the following words from a text:

  • Basic 
  • Advanced 
  • Expert 
  • _special
  • Masterful 

Afterwords, appends a language code, if provided and necessary.

Input:

{{#invoke:Sandbox/Aurelain/Link|clean
|Lorem,Basic ,Advanced ,Expert ,_special,Masterful ,Ipsum
}}

Output: Lorem,,,,,,Ipsum


-- Usage: see Module:Link/doc
local p = {}

-- Displays a variable
------------------------------------------------------------------------------------------------------------------------
local function dump(target)
    return '<pre>' .. mw.dumpObject(target) .. '</pre>'
end

------------------------------------------------------------------------------------------------------------------------
function p.clean(frame)
    local text = frame.args[1]
    text = text:gsub('Basic ', '')
    text = text:gsub('Advanced ', '')
    text = text:gsub('Expert ', '')
    text = text:gsub('_special', '')
    text = text:gsub('Masterful ', '')
    return text
end

return p