Module:Redirect hatnote: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
allow passing a custom title object to the p._redirect function
(create a formatUseTable to reduce code redundancy)
(allow passing a custom title object to the p._redirect function)
Line 102:
end
 
function p._redirect(redirect, data, options, titleObj)
-- Validate the input. Don't bother checking titleObj as it is only used
-- for testing purposes.
checkType('_redirect', 1, redirect, 'string')
checkType('_redirect', 2, data, 'table', true)
Line 131 ⟶ 133:
local category
if not redirect:find('^REDIRECT%d*$') and redirect ~= 'TERM' then
local currentTitletitleObj = titleObj or mw.title.getCurrentTitle()
if currentTitletitleObj.namespace == 0 then
local success, redirectTitle = pcall(mw.title.new, redirect)
if success and not redirectTitle.exists then
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu