Module:Check blp parameter
Appearance
![]() | This Lua module is used on approximately 2,730,000 pages, or roughly 4% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
![]() | This module is rated as ready for general use. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing. |
![]() | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
Usage
This module is used by Template:WikiProject Biography to check for issues with the |blp=
, |BLP=
and |living=
parameters.
require('strict')
local p = {}
p.main = function(frame)
local yesno = require('Module:Yesno')
local page = mw.title.getCurrentTitle().fullText
local templates = mw.loadData('Module:WikiProject banner/config').banner_shell.redirects
local getparam = function(p)
local TPVmodule = require('Module:Template parameter value').getParameter
local success, param = TPVmodule(page, templates, p, {ignore_subtemplates=true, ignore_blank=true})
return success and param
end
local check = function(p1, p2)
local b1, b2 = yesno(p1), yesno(p2)
local conflict = false
local resolved
if b1==nil then
resolved = b2
elseif b2==nil then
resolved = b1
elseif b1==b2 then
resolved = b1
else
conflict = true
end
return resolved, conflict
end
local shell_resolved, conflict = check(getparam('blp'), getparam('living'))
if not conflict then
local bio_resolved, conflict2 = check(frame.args.blp, frame.args.living)
if not conflict2 then
local resolved, conflict3 = check(shell_resolved, bio_resolved)
end
end
return conflict or conflict2 or conflict3 and '[[:Category:Pages using WikiProject Biography with conflicting living parameter]]'
or shell_resolved==bio_resolved and '[[:Category:Pages using WikiProject Biography with redundant living parameter]]'
or shell-resolved==nil and bio_resolved~=nil and '[[:Category:Pages using WikiProject Biography which need living parameter transferring]]'
or shell-resolved==nil and bio_resolved==nil and '[[:Category:Biography articles without living parameter]]'
end
return p