Module:Mainspace editnotice
Appearance
![]() | This Lua module is used in system messages. Changes to it can cause immediate changes to the Wikipedia user interface. To avoid major disruption, 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. Please discuss changes on the talk page before implementing them. |
![]() | This module depends on the following other modules: |
This module is for use in Template:Editnotices/Namespace/Main. It conditionally includes other editnotice templates.
It has testcases at Module:Mainspace editnotice/testcases.
Usage
{{#invoke:Mainspace editnotice|main}}
No parameters are required. For testing what editnotice would be generated for a specific page, you can pass |page=
.
local Arguments = require('Module:Arguments')
local Disambiguation = require('Module:Disambiguation')
local TfaTitle = require('Module:TFA title')
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
local function draft_notice(page, frame)
if page.exists
and (page.isRedirect or Disambiguation._isDisambiguationPage(page.fullText))
and mw.title.new('Draft:'..page).exists then
return frame:expandTemplate{ title = "Draft at" }
end
end
local function blp_notice(page, frame)
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
end
local function disambig_notice(page, frame)
if Disambiguation._isDisambiguationPage(page.fullText) then
return frame:expandTemplate{ title = "Disambig editintro" }
end
end
local function tfa_notice(page, frame)
if TfaTitle.is_tfa_on(page.fullText, os.date("%Y-%m-%d")) then
return frame:expandTemplate{ title = "TFA editnotice" }
end
end
local function refideas_notice(page, frame)
return frame:expandTemplate{ title = "Refideas editnotice if exists" }
end
p.core = function(page, frame)
return
(draft_notice(page, frame) or '') ..
(blp_notice(page, frame) or '') ..
(disambig_notice(page, frame) or '') ..
(tfa_notice(page, frame) or '') ..
(refideas_notice(page, frame) or '')
end
return p