Template:shortcut

From Homestar Runner Wiki

(Difference between revisions)
Jump to: navigation, search
m (Added {{{float}}} parameter to manually set the CSS float attribute, hasty remedy for HRW:CUN's __TOC__ and {{shortcut}} offset after several tries.)
(less complex syntax for parameter with default value)
Line 1: Line 1:
-
<div id="shortcut" style="border: 1px dashed blue; background: #FFF; margin: 0em 1em 0em 1em; text-align: center; padding:5px; float: {{#if:{{{float|}}}|{{{float}}}|right}}; 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{{#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:{{{1}}}]]|}}{{#if:{{{2|}}}|<br>[[HRW:{{{2}}}]]|}}{{#if:{{{3|}}}|<br>{{{3}}}|}}</div><noinclude>
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:{{{1}}}]]|}}{{#if:{{{2|}}}|<br>[[HRW:{{{2}}}]]|}}{{#if:{{{3|}}}|<br>{{{3}}}|}}</div><noinclude>
===Usage:===
===Usage:===

Revision as of 23:58, 30 December 2010

Shortcut:

Usage:

When linking to a shortcut in the HRW pseudo-namespace, simply enter the target name (without the namespace) as a template parameter:

{{shortcut|SHORTCUT1}} — automatically links to HRW:SHORTCUT1 (Note that the HRW: pseudo-namespace 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 may set float=left:

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