Difference between revisions of "Module:Pp-move-indef"

From annadreambrush.com/wiki
Jump to navigation Jump to search
en>Mr. Stradivarius
(make fixes for when we are called from #invoke - the title parameter becomes a frame object)
m (1 revision imported)
(No difference)

Latest revision as of 17:56, 9 March 2020

Documentation for this module may be created at Module:Pp-move-indef/doc

-- This module implements [[Template:Pp-move-indef]].

local p = {}

function p.main(title)
	if type(title) == 'string' then
		title = mw.title.new(title)
	elseif type(title) ~= 'table' or not title.text or not title.getContent then
		-- The title parameter is absent or not a title object. It could be a
		-- frame object if we are being called from #invoke.
		title = mw.title.getCurrentTitle()
	local level = title
		and title.protectionLevels
		and title.protectionLevels.move
		and title.protectionLevels.move[1]
	local namespace = title and title.namespace

	local category
	if level == 'sysop' or level == 'templateeditor' then
		if namespace == 2 or namespace == 3 then
			category = 'Wikipedia move-protected user and user talk pages'
		elseif namespace == 4 or namepace == 12 then
			category = 'Wikipedia move-protected project pages'
		elseif namespace == 100 then
			category = 'Wikipedia move-protected portals'
		elseif title.isTalkPage then
			category = 'Wikipedia move-protected talk pages'
			category = 'Wikipedia indefinitely move-protected pages'
		category = 'Wikipedia pages with incorrect protection templates'

	return string.format(
		mw.site.namespaces[14].name, -- "Category"
		title.text -- equivalent of {{PAGENAME}}

return p