Content deleted Content added
No edit summary |
namespace checks before other checks |
||
Line 126:
local current = t.current
local num = t.num
local currentTitle = mw.title.new(current)▼
local subjectSpace = mw.site.namespaces[currentTitle.namespace].subject.id ▼
-- Category namespace check▼
if subjectSpace == 14 then▼
local msg = '[[Template:Requested move]] is not for categories,'▼
.. ' see [[Wikipedia:Categories for discussion]]'▼
return err(msg)▼
-- File namespace check▼
elseif subjectSpace == 6 then▼
local msg = '[[Template:Requested move]] is not for files;'▼
.. ' see [[Wikipedia:Moving a page#Moving a file page]]'▼
.. ' (use [[Template:Rename media]] instead)'▼
return err(msg)▼
-- User namespace check▼
elseif subjectSpace == 2 then▼
local msg = '[[Template:Requested move]] is not for moves from user space;'▼
.. ' see [[Wikipedia:Articles for creation]]'▼
.. ' (use '▼
.. mw.text.nowiki('{{')▼
.. '[[Wikipedia:Substitution|subst]]:[[Template:Submit|submit]]'▼
.. mw.text.nowiki('}}')▼
.. ' instead),'▼
.. ' or [[Help:How to move a page|move it yourself]]'▼
return err(msg)▼
end▼
-- Check for invalid or missing currentn parameters
Line 136 ⟶ 164:
-- Check for invalid currentn titles
▲ local currentTitle = mw.title.new(current)
if not currentTitle then
local msg = 'Invalid title detected in parameter "current' .. num .. '";'
Line 165 ⟶ 192:
currentDupes[currentId] = true
end
▲ -- Category namespace check
▲ local subjectSpace = mw.site.namespaces[currentTitle.namespace].subject.id
▲ if subjectSpace == 14 then
▲ local msg = '[[Template:Requested move]] is not for categories,'
▲ .. ' see [[Wikipedia:Categories for discussion]]'
▲ return err(msg)
▲ -- File namespace check
▲ elseif subjectSpace == 6 then
▲ local msg = '[[Template:Requested move]] is not for files;'
▲ .. ' see [[Wikipedia:Moving a page#Moving a file page]]'
▲ .. ' (use [[Template:Rename media]] instead)'
▲ return err(msg)
▲ -- User namespace check
▲ elseif subjectSpace == 2 then
▲ local msg = '[[Template:Requested move]] is not for moves from user space;'
▲ .. ' see [[Wikipedia:Articles for creation]]'
▲ .. ' (use '
▲ .. mw.text.nowiki('{{')
▲ .. '[[Wikipedia:Substitution|subst]]:[[Template:Submit|submit]]'
▲ .. mw.text.nowiki('}}')
▲ .. ' instead),'
▲ .. ' or [[Help:How to move a page|move it yourself]]'
▲ return err(msg)
▲ end
end
|