Template:Template shortcut/doc: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
m (add cat)
m (65 revisions imported)
 
(46 intermediate revisions by 32 users not shown)
Line 1: Line 1:
{{Documentation subpage}}
{{Documentation subpage}}
{{tlr|clear=right|Template shortcuts|Templateshortcut}}{{tsh|tsh}}
{{high-use}}
{{lua|Module:Shortcut}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
This template displays one or more of a template's shortcuts (that is, redirects, also known as aliases, as in the box appearing at the right. {{tl|Tsh}} is a shortcut to this template, {{tlf|template shortcut}}, and can be used in its place, as it is in this documentation's [[Wikipedia:View source|source]] [[wikitext]].


== Usage ==
This is the {{tl|template shortcut}} template.
Place this template and its list of few to one, carefully selected shortcut(s) at the top of the template documentation page's [[Wikipedia:Wikitext|wikitext]], right underneath {{tl|Documentation subpage}}. In the saved, rendered text, those shortcuts will appear in this template's Shortcut(s) box, whose title will reflect the number of list items by automatically being singular or plural in form.


===Which ones to display here===
It can be used to show the names of shortcuts to a template.
Although the template can show up to ten shortcuts, you are ''encouraged to choose well'' which ones to display in this template's box. Even if many redirects exist, ''two or three at the most'' is almost always enough. By keeping the number of redirects presented in the Shortcut box small, it makes it easier to remember them, and the documentation is kept well organized.


===Where to list any others===
It can take up to three shortcuts as parameters.
List others in the Redirects section of the [[Wikipedia:Template documentation|template documentation]]. Again, not all of them need to be listed; some shortcuts are there just for historical reasons, and others differ only in minor points such as white spaces or capitalization. Such shortcut-name variations are unnecessary to list at all—just list the standard, most common version of such a variation.


=== Usage ===
===Optional parameters===
This template has several optional parameters:
* '''float''' – if set to "left", then the box will float to the left of the page, instead of the default float "right".
* '''clear''' – if set to "right" (when float also is set to "right"), the box will be pushed to the right margin of the page, and {{clarify|text=prevent it from nest to the left of other right-floating elements.}} Similarly, if set to "left" (when float also is set to "left"), the box will be pushed to the left margin of the page.
* '''pre''' – can be used to show some text before the shortcut links, but within the braces. This is mostly used to add the text "subst:". This shows the proper syntax for using the template with [[Wikipedia:Substitution|substitution]].
* '''pre1, pre2 ...''' – like above, but adds the prefix only to the nth shortcut.


==Examples of basic code==
If you want to indicate that {{tl|uw-vandalism1}} has shortcuts named {{tl|uw-v1}}, {{tl|uw-vandal1}}, and {{tl|uw-vand1}}, then you could use one of:
To display one template shortcut named {{tl|uw-v1}}:


{{template shortcut|uw-v1}}
{{tlc|template shortcut|uw-v1}}
{{tlc|template shortcut|uw-v1}}
{{template shortcut|uw-v1}}
{{clear}}
{{clear}}


To display three template shortcuts for {{tl|uw-vandalism1}} named {{tl|uw-v1}}, {{tl|uw-vand1}}, and {{tl|uw-vandal1}}:
{{template shortcut|uw-v1|uw-vand1}}
{{tlc|template shortcut|uw-v1|uw-vand1}}
{{clear}}


{{tlc|template shortcut|uw-v1|uw-vand1|uw-vandal1}}
{{template shortcut|uw-v1|uw-vand1|uw-vandal1}}
{{template shortcut|uw-v1|uw-vand1|uw-vandal1}}
{{tlc|template shortcut|uw-v1|uw-vand1|uw-vandal1}}
{{clear}}
{{clear}}


==Example with the float parameter==
=== Additional parameters ===
Using {{para|float|<var>left</var>}} makes this template flow to the left of the page:


<code><nowiki>{{template shortcut|float=left|uw-v1}}</nowiki></code>
This template has some additional parameters.
{{template shortcut|float=left|uw-v1}}

"float=left" makes this template flow to the left of the page instead:

{{template shortcut | float=left | uw-v1 }}
<code><nowiki>{{template shortcut | float=left | uw-v1 }}</nowiki></code>
{{clear}}
{{clear}}


==Example with text ("subst:") within the braces==
"pre=something", "pre2=something" and "pre3=something" feeds some text to show before the shortcut links but within the braces. This is mostly used to indicate that the template should be used with substitution. Then you can do like this:
This is mostly used to add text to show how the template could be used with [[Wikipedia:Substitution|substitution]].


Use {{para|pre2|<var>subst:</var>}} and {{para|pre3|<var>subst:</var>}} to show "subst:" before the shortcut links, but within the braces:
{{template shortcut | pre=subst: | uw-v1 | uw-vand1 }}
<code><nowiki>{{template shortcut | pre=subst: | uw-v1 | uw-vand1 }}</nowiki></code>
{{clear}}


{{template shortcut | uw-v1 | pre2=subst: | uw-vand1 | pre3=subst: | uw-vandal1 }}
<code><nowiki>{{template shortcut|uw-v1|pre2=subst:|uw-vand1|pre3=subst:|uw-vandal1}}</nowiki></code>
<code><nowiki>{{template shortcut | uw-v1 | pre2=subst: | uw-vand1 | pre3=subst: | uw-vandal1 }}</nowiki></code>
{{template shortcut|uw-v1|pre2=subst:|uw-vand1|pre3=subst:|uw-vandal1}}
{{clear}}
{{clear}}


If you use {{para|pre|<var>subst:</var>}}, it applies to all of the shortcuts:
=== See also ===


<code><nowiki>{{template shortcut|pre=subst:|uw-v1|uw-vand1|uw-vandal1}}</nowiki></code>
* {{tl|shortcut}} – The normal shortcut.
{{template shortcut|pre=subst:|uw-v1|uw-vand1|uw-vandal1}}
* {{tl|shortcut-l}} – For left aligned normal shortcuts.
{{clear}}
* {{tl|policy shortcut}} – For shortcuts to sections of policy pages.


== TemplateData ==
<includeonly>
{{Format TemplateData|<templatedata>
<!-- ADD CATEGORIES BELOW THIS LINE -->
{
[[Category:Disambiguation and redirection templates|{{PAGENAME}}]]
"description": "This template displays one or more of a template's shortcuts.",
[[Category:Templates for redirects to templates|{{PAGENAME}}]]
"format": "inline",
"params": {
"redirect": {
"label": "Redirect?",
"description": "Whether to refer to the \"shortcut/s\" as \"redirect/s\" instead.",
"default": "0",
"type": "boolean"
},
"target": {
"label": "Target?",
"description": "Whether to not add the <code>redirect=no</code> URL parameter.",
"default": "0",
"type": "boolean"
},
"float": {
"label": "Float",
"description": "The CSS <code>float</code> property value.",
"default": "right",
"suggestedvalues": [
"left",
"right"
],
"type": "string"
},
"clear": {
"label": "Clear",
"description": "The CSS <code>clear</code> property value.",
"suggestedvalues": [
"left",
"right",
"both"
],
"type": "string"
},
"category": {
"label": "Categorize",
"description": "Whether to add pages to the error category if no alias or <code>msg</code> is specified.",
"default": "1",
"type": "boolean"
},
"msg": {
"label": "Message",
"description": "An unlinked message that goes after the shortcut links.",
"type": "content"
},
"pre": {
"label": "Default prefix",
"description": "The default prefix",
"example": "subst:",
"type": "string"
},
"pre1": {
"label": "Prefix 1",
"description": "Prefix for template shortcut 1",
"example": "subst:",
"type": "string"
},
"1": {
"label": "Shortcut 1",
"description": "Template shortcut 1",
"required": true,
"type": "wiki-template-name"
},
"pre2": {
"label": "Prefix 2",
"description": "Prefix for template shortcut 2",
"example": "subst:",
"type": "string"
},
"2": {
"label": "Shortcut 2",
"description": "Template shortcut 2",
"type": "wiki-template-name"
},
"pre3": {
"label": "Prefix 3",
"description": "Prefix for template shortcut 3",
"example": "subst:",
"type": "string"
},
"3": {
"label": "Shortcut 3",
"description": "Template shortcut 3",
"type": "wiki-template-name"
},
"pre4": {
"label": "Prefix 4",
"description": "Prefix for template shortcut 4",
"example": "subst:",
"type": "string"
},
"4": {
"label": "Shortcut 4",
"description": "Template shortcut 4",
"type": "wiki-template-name"
},
"pre5": {
"label": "Prefix 5",
"description": "Prefix for template shortcut 5",
"example": "subst:",
"type": "string"
},
"5": {
"label": "Shortcut 5",
"description": "Template shortcut 5",
"type": "wiki-template-name"
},
"pre6": {
"label": "Prefix 6",
"description": "Prefix for template shortcut 6",
"example": "subst:",
"type": "string"
},
"6": {
"label": "Shortcut 6",
"description": "Template shortcut 6",
"type": "wiki-template-name"
},
"pre7": {
"label": "Prefix 7",
"description": "Prefix for template shortcut 7",
"example": "subst:",
"type": "string"
},
"7": {
"label": "Shortcut 7",
"description": "Template shortcut 7",
"type": "wiki-template-name"
},
"pre8": {
"label": "Prefix 8",
"description": "Prefix for template shortcut 8",
"example": "subst:",
"type": "string"
},
"8": {
"label": "Shortcut 8",
"description": "Template shortcut 8",
"type": "wiki-template-name"
},
"pre9": {
"label": "Prefix 9",
"description": "Prefix for template shortcut 9",
"example": "subst:",
"type": "string"
},
"9": {
"label": "Shortcut 9",
"description": "Template shortcut 9",
"type": "wiki-template-name"
}
}
}
</templatedata>}}


== See also ==
<!-- ADD INTERWIKIS BELOW THIS LINE -->
* {{tl|shortcut}}, the standard shortcut notice.
[[ka:თარგი:თარგის მალხმობა]]
* {{tl|policy shortcut}}, for shortcuts to sections of policy pages.
[[mk:Шаблон:Кратенка за шаблон]]
* {{tl|R to redirect template}}, the [[WP:RCAT|rcat]] template for redirects to rcat templates
* {{tl|template redirect}}, automatically sets <code>redirect=yes</code>


</includeonly>
<includeonly>{{Sandbox other||
<!----CATEGORIES BELOW THIS LINE, PLEASE:---->
[[Category:Shortcut templates]]
[[Category:Template documentation]]<!--Yes, this is intended for the template page – this template is used IN template docs.-->
}}</includeonly>

Latest revision as of 20:50, January 25, 2022

Template:Tlr

This template displays one or more of a template's shortcuts (that is, redirects, also known as aliases, as in the box appearing at the right. {{Tsh}} is a shortcut to this template, {{template shortcut}}, and can be used in its place, as it is in this documentation's source wikitext.

Usage

Place this template and its list of few to one, carefully selected shortcut(s) at the top of the template documentation page's wikitext, right underneath {{Documentation subpage}}. In the saved, rendered text, those shortcuts will appear in this template's Shortcut(s) box, whose title will reflect the number of list items by automatically being singular or plural in form.

Which ones to display here

Although the template can show up to ten shortcuts, you are encouraged to choose well which ones to display in this template's box. Even if many redirects exist, two or three at the most is almost always enough. By keeping the number of redirects presented in the Shortcut box small, it makes it easier to remember them, and the documentation is kept well organized.

Where to list any others

List others in the Redirects section of the template documentation. Again, not all of them need to be listed; some shortcuts are there just for historical reasons, and others differ only in minor points such as white spaces or capitalization. Such shortcut-name variations are unnecessary to list at all—just list the standard, most common version of such a variation.

Optional parameters

This template has several optional parameters:

  • float – if set to "left", then the box will float to the left of the page, instead of the default float "right".
  • clear – if set to "right" (when float also is set to "right"), the box will be pushed to the right margin of the page, and Template:Clarify Similarly, if set to "left" (when float also is set to "left"), the box will be pushed to the left margin of the page.
  • pre – can be used to show some text before the shortcut links, but within the braces. This is mostly used to add the text "subst:". This shows the proper syntax for using the template with substitution.
  • pre1, pre2 ... – like above, but adds the prefix only to the nth shortcut.

Examples of basic code

To display one template shortcut named {{uw-v1}}:

{{template shortcut|uw-v1}}

To display three template shortcuts for {{uw-vandalism1}} named {{uw-v1}}, {{uw-vand1}}, and {{uw-vandal1}}:

{{template shortcut|uw-v1|uw-vand1|uw-vandal1}}

Example with the float parameter

Using |float=left makes this template flow to the left of the page:

{{template shortcut|float=left|uw-v1}}

Example with text ("subst:") within the braces

This is mostly used to add text to show how the template could be used with substitution.

Use |pre2=subst: and |pre3=subst: to show "subst:" before the shortcut links, but within the braces:

{{template shortcut|uw-v1|pre2=subst:|uw-vand1|pre3=subst:|uw-vandal1}}

If you use |pre=subst:, it applies to all of the shortcuts:

{{template shortcut|pre=subst:|uw-v1|uw-vand1|uw-vandal1}}

TemplateData

Template:Format TemplateData

See also