Module:Article history/doc: Difference between revisions

Content deleted Content added
finish documenting ArticleHistory objects
Object documentation: add Message class documentation
Line 1:
This module implements {{lt|Article history}}. It has a configuration module at {{lmd|Article history/config}}, and a Category class at {{lmd|Article history/Category}}.
 
== ObjectClass documentation ==
 
=== Message ===
 
Methods from the Message mixin are available in all classes. They are:
 
* <code>Message:message(key, ...)</code> - fetches a message with the key <var>key</var> from the config's msg table, and substitutes parameters $1, $2 etc. with the subsequent values it is passed.
* <code>Message:raiseError(msg, help)</code> - formats <var>msg</var> and uses it to raise an error. <var>help</var> is an optional page that will provide help for the error that the user encountered. This is intended to be caught with ArticleHistory:try, and is for errors after which further processing in that object becomes impossible.
* <code>Message:addWarning(msg, help)</code> - formats <var>msg</var> and uses it to add a warning. <var>help</var> is an optional page that will provide help for the error that the user encountered. This is for errors that should be fixed, but that do not prevent the module from outputting something useful for that object.
* <code>Message:getWarnings()</code> - returns an array of all warnings added for the object.
 
=== ArticleHistory ===
Line 22 ⟶ 31:
* <code>ArticleHistory:getNoticeObjects()</code> - returns an array containing the template's Notice objects.
* <code>ArticleHistory:getCollapsibleNoticeObjects()</code> - returns an array containing the template's CollapsibleNotice objects.
* <code>ArticleHistory:getAllObjects(addSelf)</code> - returns an array containing all Status/MultiStatus, Notice, Action and CollapsibleNotice objects. if <var>addSelf</var> is true, the ArticleHistory object is appended to the array as well.
* <code>ArticleHistory:getErrorMessages()</code> - returns an array containing all error and warning strings. Errors are typically raised with Message:raiseError and caught with ArticleHistory:try, and warnings are added to individual objects with Message:addWarning.
* <code>ArticleHistory:renderHtml()</code> - renders the HTML table comprising all the visible output of the template, including status, notices, actions, collapsible notices, error messages and warnings. The result is returned as a string.