User:Banri/TemplateData
When a template is used or edited in VisualEditor, VisualEditor tries to guess what parameters the template has. You can make this easier by adding "TemplateData" to templates, especially more complex ones, so that people using VisualEditor can find it easier to add and edit those templates.
This project is dedicated to adding TemplateData to every user-facing template on the wiki.
How to add TemplateData
1. Go on the template documentation page (for consistency, don't add TemplateData to the template itself) and click Edit source
2. Click Manage TemplateData
3. Set the language (should be English), add a description of the template, and then change the wikitext formatting.
| Format | Description |
|---|---|
| Unspecified | This is the default formatting. It indicates that there isn't an specific format for the template. |
| Inline | This template should be inserted inline. This means that it'll look like {{Template|param1=|param2=|param3=}} on the page when inserted with VisualEditor.
|
| Block | This template should be inserted as a block across multiple lines. This means that it'll look like
{{Template
|param1=
|param2=
|param3=
}}
on the page when inserted with VisualEditor. |
| Custom | Allows specification of a custom format for displaying the template in wikitext. Do not use this unless you know what you're doing. |
4. For each parameter an editor can give to a template, press the Add parameter button at the bottom, enter its name (e.g 'param1'). Click on it when its added to the list and fill out the information:
| Field | Description | Example |
|---|---|---|
| Name | The name of the parameter | param1 |
| Aliases | Other names that can be used for this parameter | |
| Label | Human-readable name for the parameter | My parameter 1 |
| Description | Description of what the parameter is | This gives the target... |
| Example | An example of what can be given to the parameter | This Mod |
| Type | The type of parameter | String |
| Default | The default value of the parameter | |
| Auto value | The value to use when adding the template to VisualEditor, etc | 360 |
| Deprecated | Tick whether or not the parameter is deprecated/will be removed in the future) | N/A |
| Required | Tick whether or not the parameter is required | N/A |
| Suggested | Tick whether or not users should be suggested to fill in this parameter (you should always have at least one suggested parameter) | N/A |
5. When done with adding parameters, press Apply at the top right of the interface. The TemplateData will be added to your cursor position on the page between the <TemplateData> tags. Move this to somewhere more convenient if necessary.
6. Surround the <TemplateData> tags with {{TemplateData}} to keep consistency across the wiki. Your finished code will look something like:
{{TemplateData|<templatedata>
{
"params": {
"param1": {
"type": "unknown"
}
},
"description": "Creates a table listing all of the achievements for the given category",
"format": "block"
}
</templatedata>}}
This is how a template with TemplateData displays in VisualEditor