Module:Article history/doc: Difference between revisions

Content deleted Content added
Row: add note about errors in Row:getData
Class documentation: add Category class
Line 2:
 
== Class documentation ==
 
This is technical documentation for Lua programmers who are looking to adapt this module for use on different wikis.
 
=== Category ===
 
The Category class is used to generate all of the module's categories. It is loaded in both [[Module:Article history]] and [[Module:Article history/config]]. You can create a category with Category.new:
 
<source lang="lua">Category.new(cat, sort)</source>
 
The <var>cat</var> variable is the category text, and <var>sort</var> is its sort key.
 
Once category objects are created, they have the following properties:
* <code>category</code> - the category name
* <code>sortKey</code> - the sort key
 
They can be rendered into category links by calling <code>tostring()</code> on them.
 
=== Message ===
 
The Message mixin contains common message-related methods which areavailable in all classes apart from the Category class. These methods 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.