Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Deformat

From Trackmania Wiki
Revision as of 22:12, 20 August 2025 by Skycrafter (talk | contribs)

Documentation for this module may be created at Module:Deformat/doc

-- Module:Deformat
-- Removes dollar-sign based formatting codes from a string.

local p = {}

function p.run(frame)
    local text = frame.args[1] or ''
    if not text or text == '' then
        return ''
    end

    local deformattedText = text

    deformattedText = mw.ustring.gsub(deformattedText, '%$%$', '$')
    deformattedText = mw.ustring.gsub(deformattedText, '%$[lh]%[.-%]', '')
    deformattedText = mw.ustring.gsub(deformattedText, '%$%x%x%x?', '')
    deformattedText = mw.ustring.gsub(deformattedText, '%$[lh]%[', '')
    deformattedText = mw.ustring.gsub(deformattedText, '%$..', '')

    return deformattedText
end

return p