mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateData
synced 2024-11-23 23:43:54 +00:00
53e48a98d5
This is to help differentiate between <input type="text" /> and <textarea> fields. We need this for UploadWizard in particular because we intend to build a form for the Information template on Commons, and it has both small fields (for which we'll use <input>) and big ones like description (for which we need <textarea>). Change-Id: Ib9b381816d18f2723a9f715c54f6a64ff4b69847
109 lines
3.2 KiB
JSON
109 lines
3.2 KiB
JSON
/*
|
|
Specification for the JSON descriptor as used in the
|
|
TemplateData extension for MediaWiki.
|
|
|
|
Author: Timo Tijhof
|
|
Author: Trevor Parscal
|
|
|
|
@structure {Object} Root
|
|
@property {null|InterfaceText} [description]
|
|
@property {Object} params Contains all parameters.
|
|
Keyed by parameter name, contains #Param objects.
|
|
@property {Array} sets List of groups of parameters that should be used
|
|
together. A parameter can be in multiple sets. Not every parameter has to be
|
|
in a set. The array contains #Set objects.
|
|
|
|
@structure {Object} Param
|
|
@property {null|InterfaceText} [label] Defaults to key of object in `Root.params`.
|
|
@property {boolean} [required=false]
|
|
@property {null|InterfaceText} [description]
|
|
@property {boolean|string} [deprecated=false] Tooltip for the user detailing
|
|
the intent for the deprecated parameters.
|
|
@property {Array} [aliases] List of aliases.
|
|
An alias is an alternative name for the parameter that may be used instead of
|
|
(not in addition to) the primary name. Aliases are not documented in a
|
|
separate Param object. If they need more information, they should be in their
|
|
own property marked "deprecated".
|
|
@property {string} [default] The default value or description thereof.
|
|
@property {Type} [type] The type of the expected parameter value.
|
|
@property {string} [inherits] Key to another object in `Root.params`.
|
|
The current Param object will inherit from that one, with local properties
|
|
overriding the inherited ones.
|
|
|
|
@structure {Object} Set
|
|
@property {InterfaceText} label Label of this set.
|
|
@property {Array} params A subset of the parameter's names that belong to this set.
|
|
|
|
@structure {string} Type
|
|
One of the following:
|
|
- unknown
|
|
When no type is specified.
|
|
- string
|
|
Any textual value.
|
|
- number
|
|
Any numerical value (without decimal points or thousand separators).
|
|
- string/wiki-page-name
|
|
A valid MediaWiki page name for the current wiki. Doesn't have to exist,
|
|
but if not, should be a valid page name to create.
|
|
- string/wiki-user-name
|
|
A valid MediaWiki user name for the current wiki. Doesn't have to exist,
|
|
but if not should be a valid user name to create.
|
|
- string/line
|
|
Short text field - use for names, labels, and other short-form fields.
|
|
|
|
@structure {string|Object} InterfaceText
|
|
A free-form string (no wikitext) in the content-language of the wiki, or,
|
|
an object containing those strings keyed by language code.
|
|
|
|
|
|
Examples:
|
|
*/
|
|
|
|
/**
|
|
* [[Template:Unsigned]]
|
|
*
|
|
* Example usage:
|
|
* {{unsigned|JohnDoe|2012-10-18}}
|
|
* {{unsigned|user=JohnDoe|year=2012|month=10|day=18|comment=blabla}}
|
|
*/
|
|
{
|
|
"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": {
|
|
"required": false
|
|
}
|
|
},
|
|
"sets": [
|
|
{
|
|
"label": "Date",
|
|
"params": ["year", "month", "day"]
|
|
}
|
|
]
|
|
}
|