Module:PersonPage: Difference between revisions
From The Seven Sages of Rome
Created page with "local p = {} function p.redirect(frame) local target = frame.args[1] or frame:getParent().args[1] -- Basic validation if not target or target == '' then return 'No target page specified.' end -- Return the redirect with no extra whitespace return '#REDIRECT ' .. target .. '' end return p" |
No edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
function p. | function p.render(frame) | ||
local | local args = frame:getParent().args | ||
local canonicalName = args['Has Canonical Name'] | |||
if | if canonicalName and canonicalName ~= '' then | ||
return ' | 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 | 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