This wiki is a XML full dump clone of "Heroes Wiki", the main wiki about the Heroes saga that has been shut down permanently since June 1, 2020. The purpose of this wiki is to keep online an exhaustive and accurate database about the franchise.

Template:PartialDelink: Difference between revisions

From Heroes Wiki
Jump to navigation Jump to search
Content deleted Content added
imported>MiamiVolts
Undo test
imported>MiamiVolts
test using urldecode
 
Line 1: Line 1:
<includeonly>{{{precede|}}}{{#if:{{PartialDelink/Linkstart|{{{text}}}}}|{{#if:{{PartialDelink/Linkend|{{{text}}}}}|<!-- before link text
<includeonly>{{{precede|}}}{{#if:{{PartialDelink/Linkstart|{{{text}}}}}|{{#if:{{PartialDelink/Linkend|{{{text}}}}}|{{#urldecode:<!-- before link text
-->{{#sub:{{{text}}}|0|{{PartialDelink/Linkstart|{{{text}}}}}}}<!--delink call
-->{{#sub:{{{text}}}|0|{{PartialDelink/Linkstart|{{{text}}}}}}}<!--delink call
-->{{Delink|noprecede=1|linktext={{#sub:{{{text}}}|{{PartialDelink/Linkstart|{{{text}}}}}|{{#expr:{{PartialDelink/Linkend|{{{text}}}}}-{{PartialDelink/Linkstart|{{{text}}}}}+2<!--close expr-->}}<!--close sub-->}}<!--close delink-->}}<!--after link text
-->{{Delink|noprecede=1|linktext={{#sub:{{{text}}}|{{PartialDelink/Linkstart|{{{text}}}}}|{{#expr:{{PartialDelink/Linkend|{{{text}}}}}-{{PartialDelink/Linkstart|{{{text}}}}}+2<!--close expr-->}}<!--close sub-->}}<!--close delink-->}}<!--after link text
-->{{#ifeq:{{PartialDelink/Linkend|{{{text}}}}}|{{#expr:{{#length:{{{text}}}}}-2}}||<!--hardcode space if present
-->{{#ifeq:{{PartialDelink/Linkend|{{{text}}}}}|{{#expr:{{#length:{{{text}}}}}-2}}||<!--hardcode space if present
-->{{#ifeq:{{#sub:{{{text}}}|{{#expr:{{PartialDelink/Linkend|{{{text}}}}}+2}}|1}}| | |}}{{#sub:{{{text}}}|{{#expr:{{PartialDelink/Linkend|{{{text}}}}}+2}}<!--close sub-->}}<!--close ifeq-->}}|<!--closeif
-->{{#ifeq:{{#sub:{{{text}}}|{{#expr:{{PartialDelink/Linkend|{{{text}}}}}+2}}|1}}| |+|}}{{#sub:{{{text}}}|{{#expr:{{PartialDelink/Linkend|{{{text}}}}}+2}}<!--close sub-->}}<!--close ifeq-->}}<!--close urldecode-->}}|<!--closeif
-->{{{text}}}}}|<!--closeif-->{{{text}}}}}</includeonly><noinclude>
-->{{{text}}}}}|<!--closeif-->{{{text}}}}}</includeonly><noinclude>
== Usage ==
== Usage ==

Latest revision as of 20:50, 15 January 2008

Usage

{{PartialDelink
  |text=<string with link and optionally other text in it>
  |precede=<Optional character(s) to precede string by; default is the empty string>
}}

This template returns a string with the first substring (partial string), which is a link, replaced with the text inside the link.

Notes

  • This template calls the 'Delink' template, which can be used by itself if it is known that the link spans the entire input string.