Module:Documentation: Difference between revisions

don't use pp-template for move-protected pages, to avoid them being wrongly categorised in Category:Wikipedia pages with incorrect protection templates
m>Mr. Stradivarius
(don't cause a script error if p.makeExperimentBlurb returns nil)
m>Mr. Stradivarius
(don't use pp-template for move-protected pages, to avoid them being wrongly categorised in Category:Wikipedia pages with incorrect protection templates)
Line 405: Line 405:
-- 'protection-template' --> 'pp-template'
-- 'protection-template' --> 'pp-template'
-- 'protection-template-args' --> {docusage = 'yes'}
-- 'protection-template-args' --> {docusage = 'yes'}
local protectionLevels, mProtectionBanner
local title = env.title
local title = env.title
local protectionLevels
if title.namespace ~= 10 and title.namespace ~= 828 then
local protectionTemplate = message('protection-template')
local namespace = title.namespace
if not (protectionTemplate and (namespace == 10 or namespace == 828)) then
-- Don't display the protection template if we are not in the template or module namespaces.
-- Don't display the protection template if we are not in the template or module namespaces.
return nil
return nil
Line 417: Line 415:
return nil
return nil
end
end
local editLevels = protectionLevels.edit
local editProt = protectionLevels.edit and protectionLevels.edit[1]
local moveLevels = protectionLevels.move
local moveProt = protectionLevels.move and protectionLevels.move[1]
if moveLevels and moveLevels[1] == 'sysop' or editLevels and editLevels[1] then
if editProt then
-- The page is full-move protected, or full, template, or semi-protected.
-- The page is edit-protected.
local frame = mw.getCurrentFrame()
mProtectionBanner = require('Module:Protection banner')
return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')}
local reason = message('protection-reason-edit')
return mProtectionBanner._main{reason, small = true}
elseif moveProt and moveProt ~= 'autoconfirmed' then
-- The page is move-protected but not edit-protected. Exclude move
-- protection with the level "autoconfirmed", as this is equivalent to
-- no move protection at all.
mProtectionBanner = require('Module:Protection banner')
return mProtectionBanner._main{action = 'move', small = true}
else
else
return nil
return nil
Anonymous user