User:JaydenKieran/TemplateData

From the RuneScape Wiki, the wiki for all things RuneScape
Jump to: navigation, search

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[edit | edit source]

1. Go on the template documentation page (for consistency, don't add TemplateData to the template itself) and click Edit source

loqJujc.png

2. Click Manage TemplateData

2AKQzKp.png

3. Set the language (should be British 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.

WzLcIsj.png

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 The name of the target item
Example An example of what can be given to the parameter Dragon dagger
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 Drygore mace
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

nZJZOzP.png

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:

jSRuwGo.png

Further help[edit | edit source]