Jump to content

Module:Check blp parameter/sandbox

From Wikipedia, the free encyclopedia
require('strict')
local p = {}

p.main = function(frame)
	local args = frame:getParent().args
	local yesno = require('Module:Yesno')
	local current_title = mw.title.getCurrentTitle()
	local pagetype = require('Module:Pagetype')._main{page = current_title.prefixedText}
	local templates = mw.loadData('Module:WikiProject banner/config').banner_shell.redirects
	local getparam = function(pa)
		local TPVmodule = require('Module:Template parameter value').getParameter
		local success, param = TPVmodule(current_title.fullText, templates, pa, {ignore_subtemplates=true, ignore_blank=true})
		return success and param or nil
	end
	local blp = getparam('blp')
	if args.category~='no' and pagetype=='article' and yesno(blp)==nil and blp~='other' and blp~='activepol' then
		local warning = require('Module:If preview')._warning
		local msg = 'Banner shell requires valid blp parameter! See [[:Category:Biography articles without blp parameter]] for guidance.'
		return '[[Category:Biography articles without blp parameter]]' .. warning{[1] = msg}
	end
end

return p