Module:SPI archive notice
Appearance
| This module is rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing. |
| This module is currently protected from editing. See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected. |
| This Lua module is used on approximately 37,000 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
| This module depends on the following other modules: |
Used by Template:SPI archive notice to automatically categorise if the master may not exist.
local mRedirect = require('Module:Redirect')
local getArgs = require('Module:Arguments').getArgs
local isIPOrRange = require('Module:IPAddress').isIpOrRange
local p = {}
-- function p.checkIfSPIMayNeedRename(frame)
-- local args = getArgs(frame)
-- return p._checkIfSPIMayNeedRename(args)
-- end
function p.checkIfSPIMayNeedRename(frame)
local args = getArgs(frame)
-- Fix capitlisation of the username
args[1] = mw.ustring.upper(args[1]:sub(1, 1)) .. args[1]:sub(2)
if (isIPOrRange(frame) ~= '') then
return 'no'
elseif (mw.title.new('User talk:' .. args[1]):getContent() == nil and mw.title.new('User:' .. args[1]):getContent() == nil) then
return 'yes_no_user_content'
else
local redirectTarget = mRedirect.getTarget('User talk:' .. args[1])
if (redirectTarget ~= nil) then
if (mw.ustring.find(redirectTarget, '^User:' .. args[1]) or mw.ustring.find(redirectTarget, '^User talk:' .. args[1])) then
return 'no'
else
return 'yes_redirected_elsewhere'
end
else
return 'no'
end
end
end
return p