Module:Article history/config: Difference between revisions

Content deleted Content added
fix notice function comments
document the notice bar icon config and improve the status category table comment
Line 209:
-------------------------------------------------------------------------------
 
-- The statuses table containscontain validconfiguration tables for possible current statuses.
-- of the article.
-- Each statustable can have the following fields:
--
-- id: the main ID for the status. This should be the same as the configuration
Line 227 ⟶ 228:
-- $1 - The full page name of the article or subject page
-- $2 - The page name without the namespace name
-- categories: An array ofThe categories usedset by the status. This may be an array of
-- category names, or a function. If it is a function, it takes an article
-- history object as the first parameter, and the current status object as
-- the second parameter, and should return an array of category objects.
-- noticeBarIcon: the icon to use for the notice bar. This can be a string, or
-- a function, or true. If it is a function it takes an article history
-- object as the first parameter, and should output the icon filename. If it
-- is true, it uses the value of icon. If it is nil then no notice bar icon
-- will be displayed.
-- noticeBarIconCaption: the caption to use for the notice bar icon. The status
-- name is used by default. This can be a string or a function. If it is a
-- function, it takes an article history object as its first parameter, and
-- should return the caption text. If this is absent, the icon caption is
-- used instead.
-- noticeBarIconSize: the size of the notice bar icon, including "px" suffix.
-- The default is set by defaultNoticeBarIconSize.
 
statuses = {
Line 646 ⟶ 662:
-- category names, or a function. If it is a function, it takes an article
-- history object as the first parameter, and the current notice object as
-- the second parameter, and should return an array of Categorycategory objects.
-- noticeBarIcon: the icon to use for the notice bar. This can be a string, or
-- a function, or true. If it is a function it takes an article history
-- object as the first parameter, and should output the icon filename. If it
-- is true, it uses the value of icon. If it is nil then no notice bar icon
-- will be displayed.
-- noticeBarIconCaption: the caption to use for the notice bar icon. This can be
-- a string or a function. If it is a function, it takes an article history
-- object as its first parameter, and should return the caption text. If this
-- is absent, the icon caption is used instead.
-- noticeBarIconSize: the size of the notice bar icon, including "px" suffix.
-- The default is set by defaultNoticeBarIconSize.
 
notices = {
Line 1,017 ⟶ 1,044:
-- category names, or a function. If it is a function, it takes an article
-- history object as the first parameter and the current action object as the
-- second parameter, and should return an array of Categorycategory objects.
-- noticeBarIcon: the icon to use for the notice bar. This can be a string, or
-- a function, or true. If it is a function it takes an article history
-- object as the first parameter, and should output the icon filename. If it
-- is true, it uses the value of icon. If it is nil then no notice bar icon
-- will be displayed.
-- noticeBarIconCaption: the caption to use for the notice bar icon. This can be
-- a string or a function. If it is a function, it takes an article history
-- object as its first parameter, and should return the caption text. If this
-- is absent, the icon caption is used instead.
-- noticeBarIconSize: the size of the notice bar icon, including "px" suffix.
-- The default is set by defaultNoticeBarIconSize.
 
actions = {
Line 1,734 ⟶ 1,772:
-- category names, or a function. If it is a function, it takes an article
-- history object as the first parameter, and the current collapsible notice
-- object as the second parameter, and should return an array of Categorycategory
-- objects.
-- noticeBarIcon: the icon to use for the notice bar. This can be a string, or
-- a function, or true. If it is a function it takes an article history
-- object as the first parameter, and should output the icon filename. If it
-- is true, it uses the value of icon. If it is nil then no notice bar icon
-- will be displayed.
-- noticeBarIconCaption: the caption to use for the notice bar icon. This can be
-- a string or a function. If it is a function, it takes an article history
-- object as its first parameter, and should return the caption text. If this
-- is absent, the icon caption is used instead.
-- noticeBarIconSize: the size of the notice bar icon, including "px" suffix.
-- The default is set by defaultNoticeBarIconSize.
 
collapsibleNotices = {
Line 1,944 ⟶ 1,993:
-------------------------------------------------------------------------------
-- Notice bar icons
-- This table holds notice bar icons only for icons that don't appear as part
-- of a row.
-------------------------------------------------------------------------------
 
-- This table holds noticeconfiguration bartables iconsfor onlynotice forbar icons that don't appear as part
-- as part of a row. Other notice bar icons are handled in the statuses,
-- notices, actions, and collapsibleNotices tables.
-- It accepts the following fields:
-- isActive: a function that should return a truthy value if the notice should
-- be displayed, and a falsy value if not. (Falsy values are false and nil,
-- and truthy values are everything else.) The function takes an article
-- history object as its first parameter.
-- icon: the filename of the notice bar icon, minus the "File:" prefix.
 
noticeBarIcons = {
Line 1,971 ⟶ 2,028:
-------------------------------------------------------------------------------
-- Extra categories
-------------------------------------------------------------------------------
 
-- This table contains categories that don't appear as part of a row. It is an
-- array of functions; each function takes an article history object as input
-- and must return an array of category objects as output.
-------------------------------------------------------------------------------
 
extraCategories = {