Wikipedia:TemplateData/Tutorial: Difference between revisions

Content deleted Content added
Tools: Isn't English by default -> adding eng language param in URL
m Completing the TemplateData information: fix doubled quote character around the word 'autovalue'
Line 57:
:*** <code>"'''deprecated'''"</code> can be set to flag whether or not this parameter is in regular use – as well as setting to <code>true</code>, you can write a brief description about what users should do instead. Rare.
:** The <code>"'''aliases'''"</code> group lets you list other names for this parameter which have been set to work equally well, and its entry is enclosed by a single bracket, i.e., <code>"aliases": [ "2", "Caption", "imagecaption" ]</code>. An alias is an alternative name for the parameter that the template is willing to accept instead of (not in addition to) the primary name. Aliases are not documented in a separate parameter object.
:* The <code>"'''autovalue'''"</code> entry lets you tell VisualEditor and other tools to pre-fill this parameter with a standard value (in wikitext); this text will show up in the parameter box when users edit, and will be added to the template invocation when saved. This may be useful for cleanup templates to automatically set the date the user adds a template. For example, add <code><nowiki>""autovalue": "{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}"</nowiki></code> as the autovalue to have the relevant date, "{{CURRENTMONTHNAME}} {{CURRENTYEAR}}" automatically added when an editor uses the template([https://en.wikipedia.org/w/index.php?title=Template:Citation_needed/doc&diff=631687918&oldid=628385301 example edit]). Autovalues may be changed by the editor simply by removing the supplied value in the template dialog. Note that this subst-based method [[bugzilla:2700|does '''not''' work]] for any templates that are used inside <nowiki><ref></nowiki> tags, gallery tags, or other extension-specific tags. Whether or not set by the person creating the TemplateData code, this entry, whatever it is, will appear as an entry in the resulting TemplateData table; if not created manually, it will be followed by the word "Empty".
:* The <code>"'''default'''"</code> setting lets you show what the template will do if this parameter is not set (or is set but left blank); this text will show up as light gray text in the parameter box when users edit, but will not add the value to the template invocation when saved unless the user manually overrides it. Rare. This entry will always appear in the resulting TemplateData table, and if not manually created by the person writing the TemplateData code, will be followed by the word "Empty".
:* The <code>"'''example'''"</code> entry allows you to display an example of an entry that a person might make for this variable, written exactly as a person might type it, character-for-character; if the type of entry has already been set with the <code>"'''type'''"</code> parameter (see below), then the example should reflect this (i.e., if the type has been set to "wiki-page-name" then your example should ''not'' include a prefix like "File:" or "Image:"). Be sure to enclose the entire text of the example with quotes. Obviously, this means the actual example may not contain quotation marks itself. If not created by the person writing the TemplateData code, will be followed by the word "Empty".