Difference between revisions of "Template:PipeTrick"

From AtlasWiki
Jump to: navigation, search
(must check whether there's a colon or not, if not, we need to continue with the original argument.)
(#arraysize, not just arraysize, also the size to treat specially is 1 not 0)
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
 
This template emulates the "pipe trick", producing a link whose displayed text excludes the namespace (if any), and excludes everything after the first open parenthesis.
 
This template emulates the "pipe trick", producing a link whose displayed text excludes the namespace (if any), and excludes everything after the first open parenthesis.
</noinclude>{{#arraydefine:colonSplit|{{{1}}}|:}}[[{{{1}}}|{{#switch:{{arraysize:colonSplit}}| 0 = {{#explode:{{{1}}}|(|0}} | #default = {{#explode:{{#arrayindex:colonSplit|1}}|)|0}} }}]]
+
</noinclude>{{#arraydefine:colonSplit|{{{1}}}|:}}[[{{{1}}}|{{#switch:{{#arraysize:colonSplit}}| 1 = {{#explode:{{{1}}}|(|0}} | #default = {{#explode:{{#arrayindex:colonSplit|1}}|)|0}} }}]]

Revision as of 15:17, 12 May 2014

This template emulates the "pipe trick", producing a link whose displayed text excludes the namespace (if any), and excludes everything after the first open parenthesis. [[{{{1}}}|{{{1}}}]]