User:Kephir/gadgets/rater/data-format

The WikiProject template data for Rater is a JSON object. It is kept on pages with a name of the form Template: name /rater-data.js. JSON is an abstract data format based on JavaScript, supporting basic data types like strings, numbers, logical values, lists and key-value associations.

JSON
In brief:


 * Strings
 * Strings of Unicode characters may be enclosed within either apostrophes or plain double quotes . Double quotes are recommended, because apostrophes can be embedded in them without problems. (otherwise they need to be prefixed with  )


 * Objects
 * Objects represent key-value associations. An object starts with a  character, contains zero or more   pairs separated by commas  and ends with a  . A value can be of any JSON-supported type, but a key is always a string.


 * Arrays
 * An array is an ordered list of JSON values of any type. An array starts with, contains zero or more values separated by commas, and ends with.


 * Booleans
 * There are two Boolean values:  and.


 * Null
 * JSON also has a unit type, whose only value is.

JSON can also describe numbers, but they were omitted from above, as Rater does not use numbers as values in its data.

Whitespace characters (spaces, tabs and newlines) may be put anywhere and will be ignored (except inside a string or a token like,   or  .)

Warning: Pay attention to punctuation. A comma or a colon in a wrong place may make Rater reject the data and fall back to defaults, which is probably undesired. Rater will show an alert box when this is the case.

Template data
Template data is an object in which the following keys may appear:
 * "name"
 * A string containing the WikiProject name. The default value is obtained by stripping " WikiProject " from the front of the template name, if present.


 * "params"
 * An object whose keys are template parameter names and values are described below. There is a predefined default parameter set, but it may not work, so putting it in is recommended. The default parameters are inherited from the default set even if this key is present; to explicitly mark a parameter as unavailable, set a value for its key to.


 * "taskforces"
 * Specifies project task forces (also called work groups, sometimes they are independent WikiProjects).
 * Task forces can be specified either with an object or with an array. When specified with an array, the array consists of objects having the following keys:
 * "desc"
 * A string containing the task force name.
 * "part" used
 * A string containing the name of a parameter, which when set to "yes" indicates that the page is covered by the task force. When omitted, it is assumed that the task force always covers the page covered by the WikiProject.
 * "prio"
 * A string containing the name of a parameter, which may contain priority for the workgroup. When omitted, it is assumed that the task force does not rate priority.
 * When taskforces are specified with an object, the keys are as follows:
 * "items"
 * An object mapping parameter name prefixes to task force names.
 * "partsuf"
 * A suffix, which when combined with a prefix which is a key in an object inside "items" gives the name of a parameter indicating whether an article is covered by the task force. Typical values are  (no suffix),   and.
 * "priosuf"
 * A suffix, which when combined with a prefix which is a key in an object inside "items" gives the name of a parameter specifying priority within the task force. Usually this value is  or  . If this key is omitted or , it means there are no priority parameters.
 * Specifying task forces with an object is recommended when task force parameter names all follow the same pattern.

Parameter data
A parameter datum is an object whose keys may be the following:
 * "desc"
 * A string containing parameter description. It will be used as a label for the parameter-changing control.


 * "mandatory"
 * if the parameter is mandatory. It will appear in the interface even if absent from the invocation.


 * "obsolete"
 * if the parameter is obsolete. Currently it means it is greyed out when present and not offered to be added when absent.


 * "alias"
 * A string containing the parameter for which the currently defined one is an alias. If the key is absent, the parameter is not an alias.


 * "helplink"
 * Specifies a page within Wikipedia explaining how to fill this parameter.


 * "implies"
 * Has no effect.


 * "shell"
 * Has no effect.


 * "group"
 * A string defining that a parameter belongs to a particular group. Available groups are:
 * "req": Requests
 * "vis": Appearance
 * "misc": Miscellaneous
 * The default is the main group, appearing right after the WikiProject name in the interface.


 * "values"
 * May be a string or an object. String values can be one of the following:
 * — either yes or no . The interface will be a checkbox.
 * — parameter either contains yes or is absent. The interface will be a checkbox; when unchecked, the parameter will disappear.
 * — the default; the interface will be a box allowing free-form input.
 * — standard importance scale: Top, High, Mid, Low, Bottom, NA. The interface will be a drop-down list (HTML select element).
 * — standard quality scale: FL, List, FA, A, GA, B, C, Start, Stub, NA. The interface will be a drop-down list.
 * — extended quality scale: FL, List, FA, A, GA, B, C, Start, Stub, NA, Category, Disambig, File, Portal, Project, Template. The interface will be a drop-down list.
 * When an object, it shall have the following keys:
 * "normalise"
 * When this equals, the value in the template is compared case-insensitively to the list of allowed values and considered equivalent to the first match. When it is  , the value is folded to lowercase.
 * "list"
 * List of allowable values. Can be either an array or an object. When an object, the keys are the actual values used in the template, and the values are labels shown, which may be different and more explanatory.