Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 02:18, 21 July 2025 by Redheadkelly (talk | contribs) (Redheadkelly moved page Module:NRS collection reference number to Module:TrimID without leaving a redirect)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

-- Module:TrimID
local p = {}

function p.remove_last_id(frame)
    local id = frame.args[1] or ''
    if id == '' then return '' end

    -- Split by '/'
    local parts = mw.text.split(id, '/')

    -- Remove last part if there's more than one
    if #parts > 1 then
        table.remove(parts) -- remove the last element
    end

    -- Recombine and return
    return table.concat(parts, '/')
end

return p