更改

添加1,666字节 、 2020年11月13日 (五) 19:37
无编辑摘要
第1行: 第1行: −
<div role="note" class="shortcutbox shortcutbox-left plainlist plainlinks noprint" style="<!--
+
{{Documentation subpage}}
-->{{#switch:{{{clear|}}} |true=clear:{{{float|right}}}; |left|right|both=clear:{{{clear|}}}; |#default=}}<!--
+
{{tsh|tsh}}
-->float: {{#ifeq:{{{float|}}}|left|left|right}};<!--
+
{{high-use}}
-->margin: {{{top|0em}}} {{#ifeq:{{{float|}}}|left|1em 0em 0em|0em 0em 1em}};<!--
+
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
-->border: 1px solid #aaa; background: #fff; padding: 0.3em 0.6em 0.2em 0.6em; text-align: center; font-size: 85%; font-weight: bold;"><!--
+
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, {{<nowiki />template shortcut}}, and can be used in its place, as it is in this documentation's [[Wikipedia:View source|source]] [[wikitext]].
   −
Adding the shortcut links:
+
== Usage ==
--><div style="display: inline-block; border-bottom: 1px solid #aaa; line-height: 1.5em; font-weight: normal; margin-bottom: .2em;">{{#if:{{{redirect|}}} |Redirect |Shortcut}}{{#if:{{{2|}}}|s}}</div> {{bulleted list
+
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.
    | {{#if: {{{1|<noinclude>{{PAGENAME}}</noinclude>}}} | &#123;&#123;{{{pre|}}}{{#ifexist:Template:{{{1}}}  |[{{fullurl:Template:{{{1}}}|redirect=no}} {{#if:true|{{{1}}}}}] |[[Template:{{{1|<noinclude>{{PAGENAME}}</noinclude>}}}|{{#if:true|{{{1|<noinclude>{{PAGENAME}}</noinclude>}}}}}]]}}&#125;&#125; }}<!--
     −
--> | {{#if:{{{2|}}} | &#123;&#123;{{{pre2|}}}{{#ifexist:Template:{{{2}}} |[{{fullurl:Template:{{{2}}}|redirect=no}} {{#if:true|{{{2}}}}}]  |[[Template:{{{2}}}|{{#if:true|{{{2}}}}}]]}}&#125;&#125; }}<!--
+
===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.
   −
--> | {{#if:{{{3|}}} | &#123;&#123;{{{pre3|}}}{{#ifexist:Template:{{{3}}} |[{{fullurl:Template:{{{3}}}|redirect=no}} {{#if:true|{{{3}}}}}]  |[[Template:{{{3}}}|{{#if:true|{{{3}}}}}]]}}&#125;&#125; }}<!--
+
===Where to list any others===
 +
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.
   −
--> | {{#if:{{{4|}}} | &#123;&#123;{{{pre4|}}}{{#ifexist:Template:{{{4}}} |[{{fullurl:Template:{{{4}}}|redirect=no}} {{#if:true|{{{4}}}}}]  |[[Template:{{{4}}}|{{#if:true|{{{4}}}}}]]}}&#125;&#125; }}<!--
+
===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, pre2, pre3 ... up to pre10''' – 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]].
   −
--> | {{#if:{{{5|}}} | &#123;&#123;{{{pre5|}}}{{#ifexist:Template:{{{5}}} |[{{fullurl:Template:{{{5}}}|redirect=no}} {{#if:true|{{{5}}}}}]  |[[Template:{{{5}}}|{{#if:true|{{{5}}}}}]]}}&#125;&#125; }}<!--
+
:As with the other shortcuts in the saved, rendered version of this template, this shortcut code can be copied from its line in the box on the documentation page, as it is, and pasted in the [[wikitext]] of another page where you wish its rendered version to appear.
 +
* '''top''' – to change the padding above the box (e.g. {{para|top|0}} for no padding, {{para|top|0.2em}}, {{para|top|4}}{{\}}{{para|top|4px}}).
   −
--> | {{#if:{{{6|}}} | &#123;&#123;{{{pre6|}}}{{#ifexist:Template:{{{6}}} |[{{fullurl:Template:{{{6}}}|redirect=no}} {{#if:true|{{{6}}}}}]  |[[Template:{{{6}}}|{{#if:true|{{{6}}}}}]]}}&#125;&#125; }}<!--
+
==Examples of basic code==
   −
--> | {{#if:{{{7|}}} | &#123;&#123;{{{pre7|}}}{{#ifexist:Template:{{{7}}} |[{{fullurl:Template:{{{7}}}|redirect=no}} {{#if:true|{{{7}}}}}]  |[[Template:{{{7}}}|{{#if:true|{{{7}}}}}]]}}&#125;&#125; }}<!--
+
To display one template shortcut named {{tl|uw-v1}}:  
   −
--> | {{#if:{{{8|}}} | &#123;&#123;{{{pre8|}}}{{#ifexist:Template:{{{8}}} |[{{fullurl:Template:{{{8}}}|redirect=no}} {{#if:true|{{{8}}}}}]  |[[Template:{{{8}}}|{{#if:true|{{{8}}}}}]]}}&#125;&#125; }}<!--
+
{{tlc|template shortcut|uw-v1}}
 +
{{template shortcut|uw-v1}}
 +
{{clear}}
   −
--> | {{#if:{{{9|}}} | &#123;&#123;{{{pre9|}}}{{#ifexist:Template:{{{9}}} |[{{fullurl:Template:{{{9}}}|redirect=no}} {{#if:true|{{{9}}}}}]  |[[Template:{{{9}}}|{{#if:true|{{{9}}}}}]]}}&#125;&#125; }}<!--
+
To display three template shortcuts for {{tl|uw-vandalism1}} named {{tl|uw-v1}}, {{tl|uw-vand1}}, and {{tl|uw-vandal1}}:
   −
--> | {{#if:{{{10|}}} | &#123;&#123;{{{pre10|}}}{{#ifexist:Template:{{{10}}} |[{{fullurl:Template:{{{10}}}|redirect=no}} {{#if:true|{{{10}}}}}]  |[[Template:{{{10}}}|{{#if:true|{{{10}}}}}]]}}&#125;&#125; }}<!--
+
{{tlc|template shortcut|uw-v1|uw-vand1|uw-vandal1}}
 +
{{template shortcut|uw-v1|uw-vand1|uw-vandal1}}
 +
{{clear}}
   −
-->}}<!--
+
==Example with the float parameter==
--></div><noinclude>{{Documentation}}</noinclude>
+
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>
 +
{{template shortcut|float=left|uw-v1}}
 +
{{clear}}
 +
 
 +
==Example with text ("subst:") within the braces==
 +
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:
 +
 
 +
<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}}
 +
 
 +
== See also ==
 +
* {{tl|shortcut}}, the standard shortcut notice.
 +
** {{tl|shortcut-l}}, for a left-aligned standard shortcut notice.
 +
* {{tl|policy shortcut}}, for shortcuts to sections of policy pages.
 +
* {{tl|R to redirect template}}, the [[WP:RCAT|rcat]] template for redirects to rcat templates
 +
 
 +
<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>
7,129

个编辑