Module:StripLink

From Trans People Together Wiki
Revision as of 02:56, 11 May 2025 by Admin (talk | contribs) (Created page with "local p = {} -- Main function. Expects the link as the first unnamed argument. function p.strip(frame) -- Get the input string (could be a link like url) local input = frame.args[1] or '' -- Use pattern matching to strip and -- This will capture the minimal content between and local stripped = input:match('%[%[%s*(.-)%s*%]%]') -- If a match was found, return it; otherwise, return the original input return stripped or input end...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local p = {}

-- Main function. Expects the link as the first unnamed argument.
function p.strip(frame)
    -- Get the input string (could be a link like [[url]])
    local input = frame.args[1] or ''
    -- Use pattern matching to strip [[ and ]]
    -- This will capture the minimal content between [[ and ]]
    local stripped = input:match('%[%[%s*(.-)%s*%]%]')
    -- If a match was found, return it; otherwise, return the original input
    return stripped or input
end

return p