Wikipedia:TemplateData/Tutorial: Difference between revisions
Content deleted Content added
CaroleHenson (talk | contribs) removed in use tag |
CaroleHenson (talk | contribs) consolidate info from 2 areas |
||
Line 25:
===Completing the templatedata information===
The first value in the templatedata section is the description. The first tag is a "description", which is fairly self-explanatory; it describes what the template does. Use information that you glean from the top of the main or subpage for the template to describe how the template is used and put that information in quotes {" "}.
Then, for each parameter used by the template, complete the following "params" information:
:* Enter the parameter being used. For example, per the [[Template:Str left]] information, <nowiki>{{Str left|<string>|<count>}}</nowiki>, the template has two parameters: string and count.
:* Enter the "params" value. In this example, the first parameter entered was "count"
:* Then add the information about each parameter.
:** The "label" is a human-readable title for the parameter that will be displayed within the template editor. Capitalize the first character of the label (since it will be the leftmost value in the resulting table. In this case, it is Quantity.
:** Enter the "description", this time a description of the parameter, not of the template as a whole. This is also likely on the main or subpage.
:** The "type", which controls how the template editor will interpret that parameter. This can be "string" (a set of characters, like this sentence!), "number" (a set of digits), "string/wiki-user-name" or "string/wiki-page-name".indicates if it's a number or a string.
:** "Required" controls whether filling out the parameter is mandatory for that template. Enter "true" if the value is required for the template and "false" if it is not required. In this case, both count and sub_string are required values.
:* Where there are more than one parameter passed to the template, add a comma after the close bracket, "}," between the parms values.
Line 54 ⟶ 58:
</templatedata>
</pre>
===Save===
Once you're done, hit "save". If you've made errors, it will not let you save - which we appreciate is disruptive, but means you can't break anything. Some commons things to look for are matched sets of quotes {""}, matched brackets ({}), and comma between multiple params sections.
Should you run into errors, explain on the feedback page what you were trying to do, and we'll be happy to help.
This would display in the template like so:
Line 109 ⟶ 119:
------>
===
Should you run into errors, explain on the [[Wikipedia:VisualEditor/Feedback|feedback page]] what you were trying to do, and we'll be happy to help.
== Limitations and questions ==
|