This is the documentation page for ਮੌਡਿਊਲ:Class

This module implements Template:Class, Template:Class/icon and Template:Class/colour.

Since it's not practical to include documentation directly on the page, these notes document the prototype definition object model so far. This is all subject to change, and this documentation might be out of date as the model is better defined, but particularly tentative properties are noted as such.

  • The top-level JSON object contains a number of objects. Each is either a class definition, or an alias. The keys are "class codes" that can be used as input. The keys containing class definitions are the canonical class codes. Class codes should be lowercase (except the special code DEFAULT) and canonical class codes are, so far, strictly alphabetic (bplus, not b+)
  • An alias should be an object with exactly one property alias that contains the canonical class code string.
  • A class definition can have a number of properties:
    categoryRoot
    (string) The root of a category name for articles of the quality class. For example, the top-level category for featured articles is Category:FA-Class articles, and subject-level categories might exist at "Category:FA-Class subject articles", so its root is FA-Class.
    colour
    (string) A string that can be used as a CSS colour value, e.g. #6699ff
    icon
    (object) An object containing icon-related properties:
    file
    (string) A filename, without File: prefix, preferably formatted with underscores,[model 1] e.g. Featured_article_star.svg
    default
    (boolean) Whether the icon should be displayed by default—usually only high quality ranks display icons by default
    requiresAttribution
    (boolean) true if the file property refers to a file that is not public domain or CC0-licensed. When a file is PD/CC0 and thus this property false, we can disable image linking and alt text, which is good for accessibility for purely-decorative images.
    labels
    (object) An object containing label strings. All the label properties are particularly tentative.
    adjective
    (string) A label string describing an adjective that could be used to describe a page with this class. Prefer lowercase or title case.[model 2] This property is highly tentative.
    full
    (string) A label string describing a noun phrase that could be used to describe a page with this class. Prefer lowercase or title case.[model 2] This property is highly tentative.
    short
    (string) A label string describing a short name for the class that can be used in context. This may frequently be the same as the class code, but should usually be capitalized (e.g. Redirect or GA). One particular precedent imported to this property is that class code unassessed uses ??? as its short label. This property is highly tentative.
    tooltip
    (string) A label string with a tooltip that should be used to describe the class if more details are needed. This property is optional and probably should only be specified if needed.
    page
    (string) The full page name of a wiki page describing the quality class, preferably formatted with spaces,[model 3] e.g. Wikipedia:Featured articles
  • At the moment, there's no definition of which properties might be mandatory or optional for class definitions; for now, it's probably safest to assume that "label" properties are mandatory.
  • Tentatively a special DEFAULT object, using capitalization to separate it from other keys, defines defaults that can be used. This should either be a complete object (all properties mandatory) or an alias to a complete object. In English Wikipedia's case this is currently an alias to the unassessed class definition.

Object model notes

ਸੋਧੋ
  1. Underscores are probably better for file names because they're more easily used in URLs, and don't hurt anything being used in wikitext.
  2. 2.0 2.1 Lowercase is better for full or generic words, e.g. "featured", but title case is better for constructed values, e.g. "Start-Class".
  3. Spaces are probably better for referencing wiki pages because they're easily used as strings or in wikitext; use in URLs would have to do other transformations anyway.