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:Delink: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
imported>MiamiVolts test including pipe |
imported>MiamiVolts add noprecede option |
||
| Line 1: | Line 1: | ||
<includeonly>{{#if:{{{noprecede}}} |
|||
|{{#sub:{{#ifeq:{{#sub:{{{linktext}}}|0|2}}|{{#sub:[[ ]]|0|2}}|{{#ifeq:{{#sub:{{{linktext}}}|{{#len:{{{linktext}}}}}|1}}|{{#sub:[[ ]]|10|1}}<!-- The ]] of a link is a single wiki character -->|{{#sub:{{{linktext}}}|{{#ifeq:{{#pos:{{{linktext}}}|{{pipe}}}}||{{#ifeq:{{#sub:{{{linktext}}}|2|6}}|:Image|2|1}}<!-- Image links are preceded with the : character -->|{{#pos:{{{linktext}}}|{{pipe}}}}}}|-2}}|{{{nolink|X}}}{{{linktext}}}}}|{{{nolink|X}}}{{{linktext}}}}}|1}} |
|||
|{{#ifeq:{{#sub:{{{linktext}}}|0|2}}|{{#sub:[[ ]]|0|2}}|{{#ifeq:{{#sub:{{{linktext}}}|{{#len:{{{linktext}}}}}|1}}|{{#sub:[[ ]]|10|1}}<!-- The ]] of a link is a single wiki character -->|{{#sub:{{{linktext}}}|{{#ifeq:{{#pos:{{{linktext}}}|{{pipe}}}}||{{#ifeq:{{#sub:{{{linktext}}}|2|6}}|:Image|2|1}}<!-- Image links are preceded with the : character -->|{{#pos:{{{linktext}}}|{{pipe}}}}}}|-2}}|{{{nolink|X}}}{{{linktext}}}}}|{{{nolink|X}}}{{{linktext}}}}} |
|||
}}</includeonly> |
|||
<noinclude> |
<noinclude> |
||
== Usage == |
== Usage == |
||
<pre>{{Delink |
<pre>{{Delink |
||
|linktext=<string with link in it> |
|linktext=<string with link in it> |
||
|nolink=<Optional |
|nolink=<Optional character(s) to precede string if it didn't contain a link to begin with; |
||
default is the X character> |
|||
|noprecede=<Optional; set true to trim off the first character> |
|||
}}</pre> |
}}</pre> |
||
This template returns the string inside a link, or the original string if not a link. |
This template returns the string inside a link, or the original string if not a link. |
||
==Notes== |
==Notes== |
||
* If the link destination is different from the shown text, only the shown text is returned. |
* If the link destination is different from the shown text, only the shown text is returned. |
||
* The |
* The extra character is useful to combine with an external sub call to trim whitespace. For normal links, this template returns the [ character plus the link string. For piped links, it returns the {{pipe}} character plus the display text. If the preceding character is not desired, set noprecede to true. |
||
* This template only delinks if the link occupies the entire string (beginning to end). |
* This template only delinks if the link occupies the entire string (beginning to end). |
||
{{Nousercat|Page Elements}} |
{{Nousercat|Page Elements}} |
||
Revision as of 21:05, 13 January 2008
Usage
{{Delink
|linktext=<string with link in it>
|nolink=<Optional character(s) to precede string if it didn't contain a link to begin with;
default is the X character>
|noprecede=<Optional; set true to trim off the first character>
}}
This template returns the string inside a link, or the original string if not a link.
Notes
- If the link destination is different from the shown text, only the shown text is returned.
- The extra character is useful to combine with an external sub call to trim whitespace. For normal links, this template returns the [ character plus the link string. For piped links, it returns the | character plus the display text. If the preceding character is not desired, set noprecede to true.
- This template only delinks if the link occupies the entire string (beginning to end).