Difference between revisions of "Template:Unlink"
Dinoguy1000 (talk | contribs) (if there's preceding unlinked text, ensure that it is not returned along with the link target) |
Dinoguy1000 (talk | contribs) (...but now it won't return an unlinked input =/ ) |
||
Line 1: | Line 1: | ||
− | {{ #explode: {{ #explode: {{ #explode: {{{1}}} | {{!((}} | 1 }} | ]] }} | {{!}} }}<noinclude>{{Documentation}}</noinclude> | + | {{ #if: {{ #pos: {{{1}}} | ]] }} | {{ #explode: {{ #explode: {{ #explode: {{{1}}} | {{!((}} | 1 }} | ]] }} | {{!}} }} | {{{1}}} }}<noinclude>{{Documentation}}</noinclude> |
Revision as of 00:45, 24 July 2013
{{{1}}}
{{Unlink}} is a template that automatically unlinks input, and returns the target of the first link. It takes a single unnamed parameter.
Usage
Code | Output | Notes |
---|---|---|
{{Unlink|test}}
|
test | Unlinked input shouldn't change |
{{Unlink|[[test]]}}
|
test | A single link gets unlinked |
{{Unlink|[[test|word]]}}
|
test | Only the link target is returned, custom link text is discarded |
{{Unlink|[[test]]ing}}
|
test | Link postfixes are also discarded... |
{{Unlink|[[test]] words}}
|
test | ...as is any following text... |
{{Unlink|wordy [[test]]}}
|
test | ...and any preceding text |
{{Unlink|[[test]]ing some [[links]]}}
|
test | Only the first link is returned |