Difference between revisions 51872 and 51873 on wikimaniawiki

-- This module implements {{documentation}}.

-- Get required modules.
local getArgs = require('Module:Arguments').getArgs
local htmlBuilder = require('Module:HtmlBuilder')
local messageBox = require('Module:Message box')

-- Get the config table.
(contracted; show full)
function p.protectionTemplate(env)
	-- Generates the padlock icon in the top right.
	-- @env - environment table containing title objects, etc., generated with p.getEnvironment
	-- Messages:
	-- 'protection-template' --> 'pp-template'
	-- 'protection-template-args' --> {docusage = 'yes'}
	local 
title = env.title
	local protectionLevels
	local protectionTemplate = message('protection-template')
	local namespace = title.namespace
	if not (protectionTemplate and (protectionLevels, mProtectionBanner
	local title = env.title
	if title.namespace =~= 10 or and title.namespace =~= 828)) then
		-- Don't display the protection template if we are not in the template or module namespaces.
		return nil
	end
	protectionLevels = env.protectionLevels
	if not protectionLevels then
		return nil
	end
	local editLevels =Prot = protectionLevels.edit and protectionLevels.edit[1]
	local moveLevels =Prot = protectionLevels.move and protectionLevels.move[1]
	if moveLevels and moveLevels[1] == 'sysop' or editLevels and editLevels[1]editProt then
		-- The page is edit-protected.
		mProtectionBanner = require('Module:Protection banner')
		local reason = message('protection-reason-edit')
		return mProtectionBanner._main{reason, small = true}
	elseif moveProt and moveProt ~= 'autoconfirmed' then
		-- The page is full-move  -protected, or full, template, or semi-protected.
		local frame = mw.getCurrentFrame()
		return frame:expandTempla but not edit-protected. Exclude move
		-- protection with the level "autoconfirmed", as this is equivalent to
		-- no move prote{ctitle = protectionTemplate, args = message('protection-template-args', nil, 'table')on at all.
		mProtectionBanner = require('Module:Protection banner')
		return mProtectionBanner._main{action = 'move', small = true}
	else
		return nil
	end
end

----------------------------------------------------------------------------
-- Start box
(contracted; show full)		)
	then
		ret = ret .. makeCategoryLink(message('strange-usage-category'))
	end
	return ret
end

return p