Module:StripLink

From Trans People Together Wiki

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