Module:Protection banner/config: Difference between revisions

(add more comments)
 
(61 intermediate revisions by 25 users not shown)
Line 41: Line 41:
--
--
-- ${EDITREQUEST} - a link to create an edit request for the current page.
-- ${EDITREQUEST} - a link to create an edit request for the current page.
--
-- ${EXPIRY} - the protection expiry date in the format DD Month YYYY. If
-- protection is indefinite or is not set, this is the blank string.
--
--
-- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes
-- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes
Line 83: Line 80:
-- ${VANDAL} - links for the specified username (or the root page name)
-- ${VANDAL} - links for the specified username (or the root page name)
-- using Module:Vandal-m.
-- using Module:Vandal-m.
--
--                                Functions
--
-- For advanced users, it is possible to use Lua functions instead of strings
-- in the banner config tables. Using functions gives flexibility that is not
-- possible just by using parameters. Functions take two arguments, the
-- protection object and the template arguments, and they must output a string.
--
-- For example:
--
-- text = function (protectionObj, args)
--    if protectionObj.level == 'autoconfirmed' then
--        return 'foo'
--    else
--        return 'bar'
--    end
-- end
--
-- Some protection object properties and methods that may be useful:
-- protectionObj.action - the protection action
-- protectionObj.level - the protection level
-- protectionObj.reason - the protection reason
-- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set
--    to indefinite, and the protection time in unix time if temporary.
-- protectionObj.protectionDate - the protection date in unix time, or nil if
--    unspecified.
-- protectionObj.bannerConfig - the banner config found by the module. Beware
--    of editing the config field used by the function, as it could create an
--    infinite loop.
-- protectionObj:isProtected - returns a boolean showing whether the page is
--    protected.
-- protectionObj:isTemporary - returns a boolean showing whether the expiry is
--    temporary.
-- protectionObj:isIncorrect - returns a boolean showing whether the protection
--    template is incorrect.
--]]
--]]


Line 90: Line 122:
text = '${INTROBLURB}',
text = '${INTROBLURB}',
explanation = '${EXPLANATIONBLURB}',
explanation = '${EXPLANATIONBLURB}',
tooltip = '${TOOLTIPBLURB}.',
tooltip = '${TOOLTIPBLURB}',
link = '${IMAGELINK}',
link = '${IMAGELINK}',
alt = 'Page ${PROTECTIONLEVEL}'
alt = 'Page ${PROTECTIONLEVEL}'
Line 97: Line 129:
-- The default banner data. This holds banner data for different protection
-- The default banner data. This holds banner data for different protection
-- levels.
-- levels.
-- *required* - this table needs edit, move, and autoreview subtables.
-- *required* - this table needs edit, move, autoreview and upload subtables.
defaultBanners = {
defaultBanners = {
edit = {},
edit = {},
move = {},
move = {},
autoreview = {
autoreview = {
autoconfirmed = {
alt = 'Page protected with pending changes level 1',
tooltip = 'All edits by unregistered and new users are subject to review',
image = 'Padlock-silver-light.svg'
},
default = {
default = {
alt = 'Page protected with pending changes level 2',
alt = 'Page protected with pending changes',
tooltip = 'All edits by users who are not reviewers or administrators are'
tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users',
.. ' subject to review',
image = 'Pending-protection-shackle.svg'
}
}
}
},
upload = {}
},
},


Line 118: Line 146:
-- In fact, the reasons specified in this table control which reasons are
-- In fact, the reasons specified in this table control which reasons are
-- valid inputs to the first positional parameter.
-- valid inputs to the first positional parameter.
-- *required* - this table needs edit, move, and autoreview subtables.
--
-- There is also a non-standard "description" field that can be used for items
-- in this table. This is a description of the protection reason for use in the
-- module documentation.
--
-- *required* - this table needs edit, move, autoreview and upload subtables.
banners = {
banners = {
edit = {
edit = {
Line 124: Line 157:
description = 'For pages protected to promote compliance with the'
description = 'For pages protected to promote compliance with the'
.. ' [[Wikipedia:Biographies of living persons'
.. ' [[Wikipedia:Biographies of living persons'
.. '|biographies of living persons]] policy.',
.. '|biographies of living persons]] policy',
text = '${INTROFRAGMENT} to promote compliance with'
text = '${INTROFRAGMENT} to promote compliance with'
.. ' [[Wikipedia:Biographies of living persons'
.. ' [[Wikipedia:Biographies of living persons'
.. "|Wikipedia's policy on the biographies"
.. "|Wikipedia's policy on the biographies"
.. ' of living people]].',
.. ' of living people]].',
tooltip = '${TOOLTIPBLURB} to promote compliance with the policy on'
tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on'
.. ' biographies of living people',
.. ' biographies of living persons',
},
},
dmca = {
dmca = {
description = 'For pages protected by the Wikimedia Foundation'
description = 'For pages protected by the Wikimedia Foundation'
.. ' due to Digital Millennium Copyright Act takedown requests.',
.. ' due to [[Digital Millennium Copyright Act]] takedown requests',
explanation = function (protectionObj, args)
explanation = function (protectionObj, args)
local ret = 'Pursuant to a rights owner notice under the Digital'
local ret = 'Pursuant to a rights owner notice under the Digital'
Line 152: Line 185:
return ret
return ret
end,
end,
image = 'Padlock-black.svg',
image = 'Office-protection-shackle.svg',
},
},
dispute = {
dispute = {
description = 'For pages protected due to editing disputes.',
description = 'For pages protected due to editing disputes',
text = function (protectionObj, args)
text = function (protectionObj, args)
-- Find the value of "disputes".
-- Find the value of "disputes".
Line 183: Line 216:
explanation = "This protection is '''not''' an endorsement of the"
explanation = "This protection is '''not''' an endorsement of the"