Module:Check blp parameter
Appearance
| This Lua module is used on approximately 2,840,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 state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing. |
| This module is currently protected from editing. See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected. |
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 args = frame:getParent().args
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(p_table)
local conflict = false
local resolved
for _, p in ipairs(p_table) do
local yn = yesno(p)
if yn~=nil then
if resolved~=nil then
if yn~=resolved then
conflict = true
end
else
resolved = yn
end
end
end
return resolved, conflict
end
local conflict, shell_resolved, bio_resolved, resolved
shell_resolved, conflict = check({getparam('blp'), getparam('living')})
if not conflict then
bio_resolved, conflict = check({args.blp, args.living, args.BLP})
if not conflict then
resolved, conflict = check({shell_resolved, bio_resolved})
end
end
local out
if conflict then
out = 'Pages using WikiProject Biography with conflicting living parameter'
elseif shell_resolved==nil then
if bio_resolved==nil then
out = 'Biography articles without living parameter'
else
out = 'Pages using WikiProject Biography which need living parameter transferring'
end
elseif shell_resolved==bio_resolved then
out = 'Pages using WikiProject Biography with redundant living parameter'
end
return out and '[[Category:' .. out .. ']]'
end
return p