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
 
(One intermediate revision by the same user not shown)
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
         if frame.args['returnIsRedirect'] == '1' then
         return '#REDIRECT [[' .. canonicalName .. ']]'
            return '1' -- Return "true" for the flag check
        end
         return '#REDIRECT [[' .. canonicalName .. ']]' -- The actual redirect output
     end
     end


     -- Otherwise return nothing and allow page content to be displayed
     if frame.args['returnIsRedirect'] == '1' then
     return ''
        return '0' -- Return "false" if no redirect is needed
    end
 
     return '' -- Normal case: no redirect, no output here
end
end


return p
return p

Latest revision as of 17:26, 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
        if frame.args['returnIsRedirect'] == '1' then
            return '1' -- Return "true" for the flag check
        end
        return '#REDIRECT [[' .. canonicalName .. ']]' -- The actual redirect output
    end

    if frame.args['returnIsRedirect'] == '1' then
        return '0' -- Return "false" if no redirect is needed
    end

    return '' -- Normal case: no redirect, no output here
end

return p