FANDOM


(...but now it won't return an unlinked input =/ )
(this is horrible)
Line 1: Line 1:
{{ #if: {{ #pos: {{{1}}} | ]] }} | {{ #explode: {{ #explode: {{ #explode: {{{1}}} | {{!((}} | 1 }} | ]] }} | {{!}} }} | {{{1}}} }}<noinclude>{{Documentation}}</noinclude>
+
{{ #if: {{ #pos: {{{1}}} | ]] }} | {{ #vardefine: $template:unlink-link | {{ #explode: {{ #explode: {{ #explode: {{{1}}} | {{!((}} | 1 }} | ]] }} | {{!}} }} }}{{ #ifeq: {{ #pos: {{ #var: $template:unlink-link }} | : }} | 0 | {{ #sub: {{ #var: $template:unlink-link }} | 1 }} | {{ #var: $template:unlink-link }} }} | {{{1}}} }}<noinclude>{{Documentation}}</noinclude>

Revision as of 03:25, February 24, 2015

{{{1}}}
[edit] [purge] Template-info.svg Template documentation

{{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

See also

  • {{Autolink}}, a template that links input while handling bold, italics, and unlinked quotes
  • {{Nolink}}, a template that prevents automatic linking by {{Autolink}}
*Disclosure: Some of the links above are affiliate links, meaning, at no additional cost to you, Fandom will earn a commission if you click through and make a purchase. Community content is available under CC-BY-SA unless otherwise noted.