Jump to content

Module:Mainspace editnotice

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SD0001 (talk | contribs) at 09:28, 27 January 2024 (fix passing frame reference). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local Arguments = require('Module:Arguments')
local Disambiguation = require('Module:Disambiguation')

local p = {}

p.main = function(frame)
	local args = Arguments.getArgs(frame)
	return p.core(args.page and mw.title.new(args.page) or mw.title.getCurrentTitle(), frame)
end

p.core = function(page, frame)
	if page.namespace == 0 then
		local content = page:getContent()
		
		if content:find("%[%[%s*[Cc]ategory:%s*[Ll]iving[ _]people%s*%]%]") or 
			content:find("%[%[%s*[Cc]ategory:%s*[Pp]ossibly[ _]living[ _]people%s*%]%]") then
			return frame:expandTemplate{ title = "BLP editintro" }
		end
		
		if Disambiguation._isDisambiguationPage(page.fullText) then
			return frame:expandTemplate{ title = "Disambig editintro" }	
		end
	end
end

return p