Module:PersonPage: Difference between revisions

From The Seven Sages of Rome
m Noeth moved page Module:RedirectTo to Module:PersonPage without leaving a redirect
No edit summary
Line 6: Line 6:


     if canonicalName and canonicalName ~= '' then
     if canonicalName and canonicalName ~= '' then
         -- This outputs ONLY the redirect if Has Canonical Name is set
         -- Return the redirect
        if frame.args['returnIsRedirect'] == '1' then
            return '1'
        end
         return '#REDIRECT [[' .. canonicalName .. ']]'
         return '#REDIRECT [[' .. canonicalName .. ']]'
     end
     end


     -- Otherwise return nothing and allow page content to be displayed
     -- Return normal behavior
    if frame.args['returnIsRedirect'] == '1' then
        return '0'
    end
 
     return ''
     return ''
end
end


return p
return p

Revision as of 17:25, 14 March 2025

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

local p = {}

function p.render(frame)
    local args = frame:getParent().args
    local canonicalName = args['Has Canonical Name']

    if canonicalName and canonicalName ~= '' then
        -- Return the redirect
        if frame.args['returnIsRedirect'] == '1' then
            return '1'
        end
        return '#REDIRECT [[' .. canonicalName .. ']]'
    end

    -- Return normal behavior
    if frame.args['returnIsRedirect'] == '1' then
        return '0'
    end

    return ''
end

return p