Template:Delink
Appearance
File:Test Template Info-Icon - Version (2).svg Template documentationviewedithistorypurge
| Warning | This template is used on approximately 1,950,000 pages, or roughly 138494% of all 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. |
| File:Cascade-protection-shackle.svg | This template can only be edited by administrators because it is transcluded onto one or more cascade-protected pages. |
{{#ifeq:delink |doc
|
{{#ifeq:show |show
|| icon | This is a documentation subpage for Template:Terminate sentence It may contain usage information, categories and other content that is not part of the original {{#if: |{{{text2}}} |{{#if: |{{{text1}}} |{{#ifeq:Template |User |template template page |{{#if:Template |template page|article}}}}}}}}. |
}}{{#if:|
|{{#ifexist:Template:Delink
| [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
|
}}
}}
|
}}
| File:Lua-Logo.svg | This template uses Lua: |
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
- <syntaxhighlight lang="wikitext">
</syntaxhighlight>
Parameters
1- the text to be de-linked.wikilinks- - if set to "no", "n", "false", or "0", wikilinks are not de-linked.
- - if set to "target", wikilinks are reduced to the target portion of a wikilink (
[[⟨target⟩{{#if:⟨label⟩||⟨label⟩}}]]→ ⟨target⟩)
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 |
|---|---|
| <syntaxhighlight lang="wikitext" inline>Foo</syntaxhighlight> | Foo |
| <syntaxhighlight lang="wikitext" inline>Bar</syntaxhighlight> | Bar |
| <syntaxhighlight lang="wikitext" inline>Foo</syntaxhighlight> | Foo |
| <syntaxhighlight lang="wikitext" inline>Foo, bar, and baz.</syntaxhighlight> | Foo, bar, and baz. |
| <syntaxhighlight lang="wikitext" inline>I visited example.com.</syntaxhighlight> | I visited example.com. |
| <syntaxhighlight lang="wikitext" inline>Foo</syntaxhighlight> | Foo |
Non-examples
| Code | Output |
|---|---|
| <syntaxhighlight lang="wikitext" inline>https://www.example.com</syntaxhighlight> | https://www.example.com |
See also
- {{trim brackets}}
- {{delink question hyphen-minus}}
- {{Linked}} – links if not already linked
{{safesubst:#if:{{safesubst:#ifeq:Delink|sandbox|1}}{{safesubst:#ifeq:Delink|doc|1}}|| }}