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

Module:TrimID: Difference between revisions

From Ross Surname Project
m Redheadkelly moved page Module:NRS collection reference number to Module:TrimID without leaving a redirect
 
m 1 revision imported
 
(No difference)

Latest revision as of 19:57, 21 July 2025

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