Template:TPU/doc
This is a documentation subpage for Template:TPU. It contains usage information, categories and other content that is not part of the original template page. |
This template is used on many pages, so changes to it will be widely noticed. Please test any changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Please consider discussing changes on the talk page before implementing them. |
The Template Parameters tool is available for viewing template parameter usage in articles. It works with TemplateData to show the frequency of parameter name usage in a template's mainspace transclusions, along with whether or not each parameter is listed in that template's TemplateData code as a supported parameter. For a required parameter, it can display a list of pages where the template is missing that parameter. The tool also shows commonly used values for each parameter. Each report is updated monthly and does not reflect changes made to articles or to the TemplateData code after the report's generation.
Usage
Example:
- {{Infobox lighthouse}}/documentation: Template:Infobox lighthouse § TemplateData → "Click here to see a monthly parameter usage report ..." → [1].
Parameters
| 1 = <!-- template:name, default=pagename -->
| lc = <!-- yes/no -->
| label = <!-- keywords like "for", or free labeltext -->
}}
- All parameters are optional, and have a default
By default, the template links for the template page:
- {{Template parameter usage}} → See the monthly parameter usage report for this template. [for this page]
One can enter a template name:
- {{Template parameter usage|Infobox film}} → See the monthly parameter usage report for Template:Infobox film.
Optional:
|lc=yes
for lowercase "click": see the monthly parameter usage report for Template:Infobox film.- Entering
|1=Template:Infobox film
is accepted (namespace is removed). Editor friendly, using a positional parameter.
- When
|1=
is used, "this template" text changes: → See the monthly parameter usage report for Template:Infobox film.
|label=
sets the visible text; it does not change the target link:
|label=
default → See the monthly parameter usage report for Template:Infobox film.|label=none
→ Parameter usage report|label=for
→ Parameter usage report for Template:Infobox film.|label=FooBar
→ FooBar
|based=yes
adds the text "based on this TemplateData" to the end of the template (or "based on its TemplateData" if|1=
is also used).
The template is included in transclusions of {{TemplateData header}}.
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:
{{Template parameter usage|Example}}
makes a link to the error report for Template:Example:
- → See the monthly parameter usage report for Template:Example.
The first character can be made lowercase to follow on at the end of a sentence:
Blah, {{Template parameter usage|lc=yes}}
→ Blah, see the monthly parameter usage report for this template.
TemplateData
TemplateData for TPU
<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
- {{TemplateData header}} -- major user of this template
- en:User:Bamyers99/TemplateParametersTool - the tool