Template:shortcut

From Homestar Runner Wiki

(Difference between revisions)
Jump to: navigation, search
(control of clear)
(add shortcut to talk pages)
 
(includes 9 intermediate revisions)
Line 1: Line 1:
-
<div id="shortcut" style="border: 1px dashed blue; margin: 0em 1em 0em 1em; text-align: center; padding:5px; float: right; {{#if:{{{clear|}}}||clear: both;}}">
+
<div id="shortcut" style="border: 1px dashed blue; background: #FFF; margin: 0em 1em 0em 1em; text-align: center; padding:5px; float: {{{float|right}}}; clear: both;">
-
Shortcut:<br>[[HRW:{{{1}}}]]{{#if:{{{2|}}}|<br>[[HRW:{{{2}}}]]|}}{{#if:{{{3|}}}|<br>{{{3}}}|}}</div>
+
Shortcut{{#ifeq:{{{plural}}}|false||{{#ifexpr: ( ( {{#if:{{{1|}}}|1|0}} + {{#if:{{{2|}}}|1|0}} + {{#if:{{{3|}}}|1|0}} ) > 1 ) or {{#if:{{{plural|}}}|1|0}}|s||}}}}:{{#if:{{{1|}}}|<br>[[HRW{{#ifeq:{{NAMESPACE}}|{{TALKSPACE}}|T|}}:{{{1}}}]]|}}{{#if:{{{2|}}}|<br>[[HRW{{#ifeq:{{NAMESPACE}}|{{TALKSPACE}}|T|}}:{{{2}}}]]|}}{{#if:{{{3|}}}|<br>{{{3}}}|}}</div><noinclude>
 +
===Usage:===
 +
When linking to a shortcut using the '''HRW''' or '''HRWT''' namespace aliases, simply enter the target name (without the namespace) as a template parameter. In all of the examples below, '''HRWT''' would automatically be used instead of '''HRW''' if the template is used on a talk page:
 +
:<code><nowiki>{{shortcut|SHORTCUT1}}</nowiki></code> &mdash; automatically links to '''HRW:SHORTCUT1''' ''(Note that the '''HRW:''' namespace alias is automatically added)''
 +
::or
 +
:<code><nowiki>{{shortcut|SHORTCUT1|SHORTCUT2}}</nowiki></code> &mdash; automatically links to '''HRW:SHORTCUT1''' and '''HRW:SHORTCUT2'''
 +
::or
 +
:<code><nowiki>{{shortcut|SHORTCUT1|SHORTCUT2|[[HRW:SHORTCUT3]]}}</nowiki></code> &mdash; same as above, except the third parameter requires extra formatting since it's a free-for-all. As shown, it links to '''HRW:SHORTCUT3''', but you could string any number of extra links in the form:
 +
::<code><nowiki>[[HRW:SHORTCUT3]]<br>[[HRW:SHORTCUT4]]</nowiki></code> &mdash; adds links to '''HRW:SHORTCUT3''' and '''HRW:SHORTCUT4'''
 +
::<code><nowiki>[[SHORTCUT3]]<br>[[HRWiki:SHORTCUT4]]</nowiki></code> &mdash; adds links to '''SHORTCUT3''' and '''HRWiki:SHORTCUT4'''
 +
This last parameter is used when you need to link to '''non-HRW''' pages or the page contains more than two shortcuts.  You may link to an '''HRW''' shortcut page and a '''non-HRW''' page like so (note in the following example that the second parameter is empty):
 +
:<code><nowiki>{{shortcut|SHORTCUT1||[[SHORTCUT3]]}}</nowiki></code> &mdash; will link to '''HRW:SHORTCUT1''' and '''SHORTCUT3''' respectively
 +
If there are not currently any '''HRW''' namespace links, you can skip straight to the third parameter (although creating at least one '''HRW''' link is strongly preferred).
 +
:<code><nowiki>{{shortcut|3=[[SHORTCUT]]}}</nowiki></code> &mdash; will link to '''SHORTCUT'''
 +
The word "Shortcut" is automatically made plural if it can tell that there is more than one link. To set the value manually, set <code>plural=true</code> or <code>plural=false</code>:
 +
:<code><nowiki>{{shortcut|3=[[SHORTCUT1]]<br>[[SHORTCUT2]]|plural=true}}</nowiki></code>
 +
[[Category:Internal link templates|{{PAGENAME}}]]
 +
If the shortcuts are better placed on the left side of the page, you can set <code>float=left</code>:
 +
:<code><nowiki>{{shortcut|SHORTCUT1|float=left}}</nowiki></code>
 +
</noinclude>

Current revision as of 19:45, 5 January 2011

Shortcut:

[edit] Usage:

When linking to a shortcut using the HRW or HRWT namespace aliases, simply enter the target name (without the namespace) as a template parameter. In all of the examples below, HRWT would automatically be used instead of HRW if the template is used on a talk page:

{{shortcut|SHORTCUT1}} — automatically links to HRW:SHORTCUT1 (Note that the HRW: namespace alias is automatically added)
or
{{shortcut|SHORTCUT1|SHORTCUT2}} — automatically links to HRW:SHORTCUT1 and HRW:SHORTCUT2
or
{{shortcut|SHORTCUT1|SHORTCUT2|[[HRW:SHORTCUT3]]}} — same as above, except the third parameter requires extra formatting since it's a free-for-all. As shown, it links to HRW:SHORTCUT3, but you could string any number of extra links in the form:
[[HRW:SHORTCUT3]]<br>[[HRW:SHORTCUT4]] — adds links to HRW:SHORTCUT3 and HRW:SHORTCUT4
[[SHORTCUT3]]<br>[[HRWiki:SHORTCUT4]] — adds links to SHORTCUT3 and HRWiki:SHORTCUT4

This last parameter is used when you need to link to non-HRW pages or the page contains more than two shortcuts. You may link to an HRW shortcut page and a non-HRW page like so (note in the following example that the second parameter is empty):

{{shortcut|SHORTCUT1||[[SHORTCUT3]]}} — will link to HRW:SHORTCUT1 and SHORTCUT3 respectively

If there are not currently any HRW namespace links, you can skip straight to the third parameter (although creating at least one HRW link is strongly preferred).

{{shortcut|3=[[SHORTCUT]]}} — will link to SHORTCUT

The word "Shortcut" is automatically made plural if it can tell that there is more than one link. To set the value manually, set plural=true or plural=false:

{{shortcut|3=[[SHORTCUT1]]<br>[[SHORTCUT2]]|plural=true}}

If the shortcuts are better placed on the left side of the page, you can set float=left:

{{shortcut|SHORTCUT1|float=left}}
Personal tools