Module:StripLink

From Trans People Together Wiki
Revision as of 03:06, 11 May 2025 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local p = {}

function p.strip(frame)
    local input = frame.args[1] or ''
    -- Extract content inside single brackets
    local inner = input:match('%[%s*(.-)%s*%]')
    if inner then
        -- Return only the first whitespace-delimited segment (the URL)
        local url = inner:match('^(%S+)')
        return url or input
    end
    return input
end

return p