 | This template uses Lua:
|
 | This template is used on 1,180,000+ pages. To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.
Transclusion count updated automatically (see documentation). |
This template removes links from wikitext. It de-links wikilinks and URL links, removes HTML comments, and normalises whitespace. It handles most wikitext correctly, including category links, the colon trick, the pipe trick (normal and reverse), nested wikilinks, and invalid link characters.
Usage
- Basic
{{delink|text}}
- All parameters
{{delink
| 1 =
| wikilinks = no
| urls = no
| comments = no
| whitespace = no
| refs = yes
}}
Parameters
1 - the text to be de-linked.
wikilinks - if set to "no", "n", "false", or "0", wikilinks are not de-linked.
urls - if set to "no", "n", "false", or "0", URL links are not de-linked.
comments - if set to "no", "n", "false", or "0", HTML comments are not removed.
whitespace - if set to "no", "n", "false", or "0", whitespace is not normalised. The normalisation makes the whitespace of the resulting text look as if it had been put through the MediaWiki parser. For example, single newlines are converted to a single space, but double newlines are left alone.
refs - (experimental) if set to "yes", "y", "true", or "1", removes references. This is not recommended, as only the [1], [2], etc. markers will be removed - the references themselves will still appear at the end of the page. There is no known workaround for this problem as of April 2014.
Examples
| Code
|
Output
|
{{delink|[[Foo]]}}
|
Foo
|
{{delink|[[Foo|Bar]]}}
|
Bar
|
{{delink|[[Foo]], [[bar]], and [[baz]].}}
|
Foo, bar, and baz.
|
{{delink|I visited [https://www.example.com example.com].}}
|
I visited example.com.
|
{{delink|Foo}}
|
Foo
|
Non-examples
See also
String-handling templates (help page) |
|---|
Substring (select chunk of string by its position) |
|---|
| Template:Tl | Select a substring based on starting and ending index counted in either direction. | | Template:Tl | Keep the first N characters of a string, or duplicate it to N characters. | | Template:Tl | Return all but the last N characters of a string. | | Template:Tl | Return the N-th character of a string. |
| | Template:Tl | Return substring starting at N-th character to end of string. | | Template:Tl | Return the last N characters of a string; or a given value if empty. | | Template:Tl | Return substring of given length starting at N-th character. |
|
|
|
Trimming (select/remove chunk of string by character type) |
|---|
|
|
Select/remove specific item from string |
|---|
| Template:Tl, Template:Tl | Removes wikilink brackets (wikicode); all or outer only. | | Template:Tl | Removes wikicode (formatting and brackets) | | Template:Tl | Trim off any parenthesis text at the end of a string (disambiguation). | | Template:Tl | Returns text in parentheses at the end of a string (disambiguation). |
| | Template:Tl | Returns the 3-or-4-digit year from a pagename, if any. | | Template:Tl | Returns the 4-digit decade from a pagename (e.g. "1740" from "Foo 1740s bar"), if any. | | Template:Tl | Returns any number from a pagename. | | Template:Tl | Removes "WikiProject" from a pagename. |
|
|
|
Insertion, replacement, and length |
|---|
| Template:Tl | Repeat character string a specified number of times. | | Template:Tl | Returns the string, after replacing all occurrences of a specified string with another string. | | Template:Tl | Returns the string, after replacing the first occurrence of a specified string with another string. | | Template:Tl | Returns the string, after removing all characters that are not digits 0–9 | | Template:Tl | Displays wikitext as plain text. |
|
| Template:Tl | Returns a string's length. | | Template:Tl | Check if a string is "longer or equally long" or "shorter" than a given length. | | Template:Tl | Check if a string is "shorter or equally long" or "longer" than a given length. | | Template:Tl | Check if a string is "not equal" or "equal" to a given length. |
|
|
|
Analysis and searching |
|---|
|
|
| Template:Tl | Array item manipulation and retrieval. | | Template:Tl | Takes a noun and produces the appropriate indefinite article, based on whether the first letter is a vowel. | | Template:Tl | Returns optional string when given string is not found | | Template:Tl | Returns number when true, blank when not numeric. | | Template:Tl | Returns the number of letters that begin a string. | | Template:Tl | Returns the number of numbers that begin a string. |
|
|
|
Modules and built-in functions |
|---|
|
|
|