Wikipedia:TemplateData/Tutorial: Difference between revisions

Content deleted Content added
consolidate info from 2 areas
TemplateData
Line 4:
== How to use TemplateData ==
===The structure of TemplateData ===
TemplateData's structure is based around the "JSON" standard, and is fairly simple. The first thing to do is to type out a pair of <nowiki><templatedataTemplateData></nowiki> tags, anywhere on the template's /doc subpage, like so:
 
<pre>
<TemplateData>
<templatedata>
TemplateData goes here
</TemplateData>
</templatedata>
</pre>
 
This tells the software that everything between the two tags is TemplateData, and should be referenced when the template is used. The TemplateData itself follows a standard layout that identifies the parameters that may be set within the template.
 
===TemplatedataTemplateData===
The templatedataTemplateData is added to either the template itself, or the /doc documentation page - anywhere that is transcluded into the template will do. In some cases, the main template page will be locked to prevent editing by unauthorized users. In that situation, the templatedataTemplateData may be added to the /doc page. The link to that page is at the bottom of the main page.
 
Although it may go anywhere on the template pages, some editors enter the data after the descriptive information about the template and before the "See also" section.
Line 24:
Determine what parameters are or may be used in the template. In some cases, it's values within < >, (e.g., in "<nowiki>{{Str left|<string>|<count>}}</nowiki>", it's string and count.) It could also be parameters passed with equal signs. For instance, the <nowiki>{{cite web...</nowiki> template is passed values to complete a citation, such as url=, title=, accessdate=, etc. The template documentation may summarize what parameters are or may be set for the template.
 
===Completing the templatedataTemplateData information===
The first value in the templatedataTemplateData 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:
Line 65:
 
This would display in the template like so:
 
<templatedata>
{