Template:Template parameter usage/doc: Difference between revisions

Content deleted Content added
template parameters tool moved to new website
m top: {{High-use}}
 
(30 intermediate revisions by 8 users not shown)
Line 1:
{{Documentation subpage}}
{{High-use}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{shortcut|1=WP:TPU}}
 
The [https://bambots.brucemyers.com/TemplateParam.php Template Parameters tool] is available for viewing template parameter usage in articles. It works with [[Wikipedia:TemplateData|TemplateData]] to show the validityfrequency of parameter namesname thatusage arein useda template's mainspace transclusions, along with whether or not each parameter is listed in that template's transclusionsTemplateData code as a supported parameter. For a required parameter, it can display a list of pages where the template is missing thethat parameter. The tool also shows commonly used values for each parameter. TheEach datareport is updated monthly and does not reflect changes made to articles or to the TemplateData code after the report's generation.
 
== Usage ==
Example:
<div style="background:#ddd">
* {{tl|Infobox lighthouse}}/documentation: {{Slink|Template:Infobox_lighthouse|TemplateData}} &rarr; "''[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template=Infobox+lighthouse Click here] to see a monthly parameter usage report ...''" &rarr; [https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template=Infobox+lighthouse].
</div>
 
===Parameters===
The template is included in transclusions of {{Tl|TemplateData header}}. If it's needed elsewhere, simply place the following in the template's documentation:
{{tj|Template parameter usage
| 1: &lt;!-- template:name, default{{=}}pagename --&gt;
| lc: &lt;!-- yes/no --&gt;
| label: &lt;!-- keywords like "for", or free labeltext --&gt;
}}
:All parameters are optional, and have a default
 
By default, the template links for the template page:
<code><pre><nowiki>
:<nowiki>{{Template parameter usage}}</nowiki> &rarr; {{Template parameter usage}} [for this page]
== Error reports ==
One can enter a template name:
:<nowiki>{{Template parameter usage|Infobox film}}</nowiki> &rarr; {{Template parameter usage|Infobox film}}
 
Optional:
{{Template error report}}
* {{para|lc|yes}} for lowercase "click": {{Template parameter usage|lc=yes|Infobox film}}
* Entering {{para|1|Template:Infobox film}} is accepted (namespace is removed). Editor friendly, using a positional parameter.
: When {{para|1}} is used, "this template" text changes: &rarr; {{Template parameter usage|1=Infobox film}}
* {{para|label}} sets the visible text; it does not change the target link:
::{{para|label}} default &rarr; {{Template parameter usage|1=Infobox film}}
::{{para|label|none}} &rarr; {{Template parameter usage|1=Infobox film|label=none}}
::{{para|label|for}} &rarr; {{Template parameter usage|1=Infobox film|label=for}}
::{{para|label|FooBar}} &rarr; {{Template parameter usage|1=Infobox film|label=FooBar}}
* {{para|based|yes}} adds the text "based on this TemplateData" to the end of the template (or "based on its TemplateData" if {{para|1}} is also used).
 
The template is included in transclusions of {{Tl|TemplateData header}}. If it's needed elsewhere, simply place the following in the template's documentation:
</nowiki></pre></code>
 
== Error reports ==
By default, it links a report for the template-page being viewed. To link a report for a different template-page, pass it as the first parameter:
 
:{{tlxtl|Template errorparameter report|Exampleusage}}
 
By default, it links a report for the template-page being viewed. To link a report for a different template-page, pass it as the first parameter:
makes a link to the error report for [[Template:Example]]:
 
:{{tlx|Template errorparameter reportusage|Example}} makes a link to the error report for [[Template:Example]]:
 
:&rarr; {{Template parameter usage|Example}}
 
The first character can be made lowercase to follow on at the end of a sentence:
:<code>Blah, {{tlp|Template errorparameter reportusage|2=lc=yes}}</code> → Blah, {{Template errorparameter reportusage|lc=yes}}
 
== TemplateData ==
{{TemplateData header}}
<templatedata>
{
"description": "Short line of text providing a link to a monthly parameter usage report for a template based on its TemplateData",
"format": "inline",
"params": {
"lc": {
"label": "Lowercase",
"description": "Enter \"y\", \"yes\", \"true\", \"on\" or \"1\" here to make the text begin with a lowercase character.",
"type": "line",
"autovalue": "y",
"example": "y"
},
"1": {
"label": "Custom template",
"description": "Enter any template here to change the usage report link to that of that template",
"type": "wiki-template-name",
"example": "Anchor"
},
"label": {
"label": "Custom text",
"description": "Enter any text here to make the template just the usage report link with the given custom text. Alternatively, enter \"none\" to include only the usage report link, or enter \"for\" to include only the usage report link followed by \"for <template name>\".",
"type": "string"
},
"based": {
"label": "Append \"based on this[/its] TemplateData\"",
"description": "Enter \"y\", \"yes\", \"true\", \"on\" or \"1\" here to append the text \"based on this TemplateData\" (or \"based on its TemplateData\" if \"Custom template\" is also used).",
"type": "line",
"autovalue": "y",
"example": "y"
}
},
"paramOrder": [
"lc",
"1",
"label",
"based"
]
}
</templatedata>
 
==See also==
* {{tl|TemplateData header}} -- major user of this template
* [[User:Bamyers99/TemplateParametersTool]] - the tool
<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:External link templates]]
 
}}</includeonly>