Content deleted Content added
Produce error in draft space (as Requested moves is not the process for submitting drafts for review) and tweak error message |
Adding HTML comment with transclusion in error messages to make it easier to fix errors rather than rewriting the whole request from scratch |
||
Line 15:
--------------------------------------------------------------------------------
local function err(msg, numargs, reason, count)
-- Generates a wikitext error message
local commented = '<!-- {{subst:requested move|'
return string.format('{{error|%s}}', msg)▼
if count ~= 1 then
commented = commented .. 'new1='
end
commented = commented .. numargs[1]['new']
for i = 2,count do
commented = commented .. '|current' .. tostring(i) .. '=' .. (numargs[i]['current'] or '')
commented = commented .. '|new' .. tostring(i) .. '=' .. (numargs[i]['new'] or '')
end
if reason then
commented = commented .. '|reason=' .. reason
end
commented = commented .. '}} -->'
▲ return string.format('{{error|%s}}', msg) .. commented
end
Line 202 ⟶ 215:
local msg = '[[Template:Requested move]] must be used in a TALKSPACE, e.g., [[%s:%s]]'
msg = string.format(msg, mw.site.namespaces[title.namespace].talk.name, title.text)
return err(msg, argsByNum, args.reason, argsByNumCount)
end
Line 222 ⟶ 235:
.. ' please add it or remove the "new%d" parameter'
msg = string.format(msg, num, num)
return err(msg, argsByNum, args.reason, argsByNumCount)
end
Line 232 ⟶ 245:
-- If invalid, the second parameter is the error message.
local msg = currentTitle
return err(msg, argsByNum, args.reason, argsByNumCount)
end
Line 240 ⟶ 253:
local msg = '[[Template:Requested move]] is not for categories,'
.. ' see [[Wikipedia:Categories for discussion]]'
return err(msg, argsByNum, args.reason, argsByNumCount)
-- File namespace check
Line 247 ⟶ 260:
.. ' see [[Wikipedia:Moving a page#Moving a file page]]'
.. ' (use [[Template:Rename media]] instead)'
return err(msg, argsByNum, args.reason, argsByNumCount)
-- Draft and User namespace check
Line 256 ⟶ 269:
.. '<br>Otherwise, see [[Help:How to move a page]] for instructions.'
.. '<br>If you cannot move it yourself, see [[Wikipedia:Requested moves#Requesting technical moves|Requesting technical moves]].'
return err(msg, argsByNum, args.reason, argsByNumCount)
end
Line 263 ⟶ 276:
local msg = 'Must create [[:%s]] before requesting that it be moved'
msg = string.format(msg, current)
return err(msg, argsByNum, args.reason, argsByNumCount)
end
Line 274 ⟶ 287:
.. currentTitle.prefixedText
.. '"); cannot move the same page to two different places'
return err(msg, argsByNum, args.reason, argsByNumCount)
else
currentDupes[currentId] = true
Line 290 ⟶ 303:
-- If invalid, the second parameter is the error message.
local msg = newTitle
return err(msg, argsByNum, args.reason, argsByNumCount)
end
Line 305 ⟶ 318:
.. newTitle.prefixedText
.. '"); cannot move two different pages to the same place'
return err(msg, argsByNum, args.reason, argsByNumCount)
else
newDupes[newPrefixedText] = true
|