Difference between revisions of "Template:Autolink"
Dinoguy1000 (talk | contribs) (update array name to be template-specific and reduce chance of collisions) |
Dinoguy1000 (talk | contribs) (support Template:Nolink) |
||
Line 1: | Line 1: | ||
− | {{ #arraydefine: @template:autolink-links | {{{1<noinclude>|{{int:Mainpage}}</noinclude>}}} | * | unique }}{{ #arrayprint: @template:autolink-links || $x$ | {{ #if: {{ #pos: {{{1}}} | * }} | <nowiki/> | + | {{ #ifeq: {{ #pos: {{{1}}} | ‌ }} | 0 |
+ | | {{{1}}} | ||
+ | | {{ #arraydefine: @template:autolink-links | {{{1<noinclude>|{{int:Mainpage}}</noinclude>}}} | * | unique }}{{ #arrayprint: @template:autolink-links || $x$ | {{ #if: {{ #pos: {{{1}}} | * }} | <nowiki/> | ||
* }}{{ | * }}{{ | ||
− | + | #if: {{ #pos: $x$ | {{!((}} }} | |
− | + | | $x$ | |
− | + | | {{ #ifeq: {{ #pos: $x$ | ‌ }} | {{ #expr: {{ #len: $x$ }} - 6 }} | |
− | }} }}<noinclude>{{Documentation}}</noinclude> | + | | $x$ |
+ | | [[:{{ #replace: {{ #replace: {{ #replace: $x$ | ''' }} | '' }} | "" }}|{{ #if: {{{2|}}} | {{{2}}} | {{ #replace: $x$ | "" | " }} }}]] | ||
+ | }} | ||
+ | }} }} | ||
+ | }}<noinclude>{{Documentation}}</noinclude> |
Revision as of 04:24, 3 December 2014
This template uses Lua: |
{{Autolink}} is used to automatically link input while allowing for link syntax and bold, italics, and unlinked quotes.
Usage
Code | Output | Notes |
---|---|---|
{{autolink|Test}} |
Test | Unlinked input |
{{autolink|[[Test]]}} |
Test | Linked input |
{{autolink|[[Test|Foobar]]}} |
Foobar | Linked input with custom link text |
{{autolink|This is a ''test''}} |
This is a test | Unlinked input with italics |
{{autolink|This is a '''test'''}} |
This is a test | Unlinked input with bold |
{{autolink|This is a ""test""}} |
This is a "test" | Unlinked input with quotes |
{{autolink|""This is a test""}} |
"This is a test" | Unlinked input, whole input is quoted |
{{autolink|This is a#test}} |
This is a § test | Unlinked input with a section link |
{{autolink|This is a ""'''''test'''''""}} |
This is a "test" | Unlinked input with quotes, bold, and italics |
{{autolink| * This * That }} |
Unlinked input as a list | |
{{autolink| * This * [[is|a]] * ""'''''test'''''"" }} |
Everything, almost |
See also
- {{Unlink}}, a template that unlinks input
- {{Delink}}, a template that removes all links from input
- {{Formatted link}}, a template for formatting a single link
- Template:Section link on Wikipedia