Extension:TemplateData

The TemplateData extension introduces a  tag and an API which together allow editors to specify how templates should be invoked. This information is available as a nicely-formatted table for end-users, and as a JSON API, which enables other systems (e.g. VisualEditor) to build interfaces for working with templates and their parameters.

Defining a TemplateData block
The TemplateData extension works through having a  block defined in the wikitext of a template, or of a page transcluded onto it. This is designed to work with the common sub-page documentation use cases on many wikis. This block is written in JSON using a format as follows; note that none of the parameters take wikitext:


 * Parameter blocks


 * Set blocks

Example use
{   "description": "Label unsigned comments in a conversation.", "params": {       "user": {           "label"       : "User's name", "type"       : "string/wiki-user-name", "required"   : true, "description" : "User name of person who forgot to sign their comment.", "aliases"    : ["1"] },       "date": {           "label"       : "Date", "description" : {               "en"      : "Timestamp of when the comment was posted, in YYYY-MM-DD format." },           "aliases"     : ["2"] },       "year": {           "label"       : "Year", "type"       : "number" },       "month": {           "label"       : "Month", "inherits"   : "year" },       "day": {           "label"       : "Day", "inherits"   : "year" },       "comment": {           "type"        : "string", "required"   : false }   },    "sets": [       {            "label"       : "Date", "params"     : ["year", "month", "day"] }   ] }

Using the TemplateData API
To come.