Dominion Atlantic Railway Digital Preservation Initiative - Wiki

Use of this site is subject to our Terms & Conditions.

Template:Linked/doc

From DARwiki
< Template:Linked
Revision as of 04:00, 9 February 2012 by Stem (talk | contribs) (Created page with "{{Documentation subpage}} <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> This template can be used to simplify the inclusion of links in templates where...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

{{#if: |

40px This is the template documentation page for Template:Linked.
This page may not be intended to be viewed directly.
Links using variables may appear broken; do not replace these with hardcoded page names or URLs.

{{#if:x||

}} |{{#ifeq: doc | doc

 | 

{{

   #ifeq: show | show
   | {{
 {{#switch:
 {{#if: 
   | 
   | {{#if: 
     | 
       {{#ifeq:|
       | talk
       |  
       }}
     | 
       {{#ifeq:template|template talk
       | talk
       | template 
       }}
     }}
   }}

| main | = ambox | talk = tmbox | user = ombox | wikipedia = ombox | file | image = imbox | mediawiki = ombox | template = ombox | help = ombox | category = cmbox | portal = ombox | book = ombox | other | #default = ombox

}} | type = notice | image = none | imageright = | class = | style = | textstyle = | text = This is a documentation subpage for Template:Linked (see that page for the {{ #if: Template | template | article }} itself).
It contains usage information, categories and other content that is not part of the original {{ #if: Template |template page|article}}. | small = | smallimage = | smallimageright = | smalltext = | subst = | date = }}

   }}{{
   #if: 
   | 
   | [[Category:{{
     #if: Template
     | Template
     | Article
   }} documentation]]
 }}

| }} }} This template can be used to simplify the inclusion of links in templates where users may use several different forms of syntax. It accepts a parameter and returns it linked, unless it already is. Works both with wikilinks and with http links.

It is primarily of use in templates and should not be used in articles directly.

This template can be substituted.

Usage

Wiki links

|Foo }}{{#if:| |{{{3}}} }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = Foo
| { = Foo
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:| {{{2}}}}}]
 | #default={{ safesubst:#switch: 
  | File | Category = [[:Foo{{ safesubst:#if:||{{{2}}}}}]]
  | #default=[[Foo{{ safesubst:#if:||{{{2}}}}}]]
 }}
}}

}}

|Foo }}{{#if:Bar| |Bar }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = Foo
| { = Foo
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:Bar| Bar}}]
 | #default={{ safesubst:#switch: 
  | File | Category = [[:Foo{{ safesubst:#if:Bar||Bar}}]]
  | #default=[[Foo{{ safesubst:#if:Bar||Bar}}]]
 }}
}}

}}

|[[Foo]] }}{{#if:Bar| |Bar }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = Foo
| { = [[:Foo]]
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:Bar| Bar}}]
 | #default={{ safesubst:#switch: 
  | File | Category = [[:{{ safesubst:#if:Bar||Bar}}]]
  | #default=[[{{ safesubst:#if:Bar||Bar}}]]
 }}
}}

}}

|:Foo }}{{#if:| |{{{3}}} }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = :Foo
| { = [[::Foo]]
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:| {{{2}}}}}]
 | #default={{ safesubst:#switch: 
  | File | Category = [[:Foo{{ safesubst:#if:||{{{2}}}}}]]
  | #default=[[Foo{{ safesubst:#if:||{{{2}}}}}]]
 }}
}}

}}

|File:Example.jpg }}{{#if:| |{{{3}}} }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = File:Example.jpg
| { = File:Example.jpg
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:| {{{2}}}}}]
 | #default={{ safesubst:#switch: File
  | File | Category = [[:File:Example.jpg{{ safesubst:#if:||{{{2}}}}}]]
  | #default=[[File:Example.jpg{{ safesubst:#if:||{{{2}}}}}]]
 }}
}}

}}

|:File:Example.jpg }}{{#if:| |{{{3}}} }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = :File:Example.jpg
| { = [[::File:Example.jpg]]
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:| {{{2}}}}}]
 | #default={{ safesubst:#switch: File
  | File | Category = [[:File:Example.jpg{{ safesubst:#if:||{{{2}}}}}]]
  | #default=[[File:Example.jpg{{ safesubst:#if:||{{{2}}}}}]]
 }}
}}

}}

|Category:Food }}{{#if:| |{{{3}}} }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = Category:Food
| { = Category:Food
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:| {{{2}}}}}]
 | #default={{ safesubst:#switch: Category
  | File | Category = [[:Category:Food{{ safesubst:#if:||{{{2}}}}}]]
  | #default=[[Category:Food{{ safesubst:#if:||{{{2}}}}}]]
 }}
}}

}}

|:Category:Food }}{{#if:| |{{{3}}} }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = :Category:Food
| { = [[::Category:Food]]
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:| {{{2}}}}}]
 | #default={{ safesubst:#switch: Category
  | File | Category = [[:Category:Food{{ safesubst:#if:||{{{2}}}}}]]
  | #default=[[Category:Food{{ safesubst:#if:||{{{2}}}}}]]
 }}
}}

}}

Http links

| http://example.org }}{{#if:| |{{{3}}} }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ =  http://example.org
| { =  http://example.org
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:| {{{2}}}}}]
 | #default={{ safesubst:#switch: 
  | File | Category = [[:Http://example.org{{ safesubst:#if:||{{{2}}}}}]]
  | #default=[[Http://example.org{{ safesubst:#if:||{{{2}}}}}]]
 }}
}}

}}

| http://example.org }}{{#if:Bar| |Bar }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = http://example.org
| { = http://example.org
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:Bar| Bar}}]
 | #default={{ safesubst:#switch: 
  | File | Category = [[:Http://example.org{{ safesubst:#if:Bar||Bar}}]]
  | #default=[[Http://example.org{{ safesubst:#if:Bar||Bar}}]]
 }}
}}

}}

  • {{{{#if:|subst:}}linked{{#if: [http://example.org Foo]|

| [http://example.org Foo] }}{{#if:Bar| |Bar }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = Foo
| { = [[:Foo]]
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:Bar| Bar}}]
 | #default={{ safesubst:#switch: 
  | File | Category = [[:{{ safesubst:#if:Bar||Bar}}]]
  | #default=[[{{ safesubst:#if:Bar||Bar}}]]
 }}
}}

}}

Https links

|https://example.org }}{{#if:| |{{{3}}} }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = https://example.org
| { = https://example.org
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:| {{{2}}}}}]
 | #default={{ safesubst:#switch: 
  | File | Category = [[:Https://example.org{{ safesubst:#if:||{{{2}}}}}]]
  | #default=[[Https://example.org{{ safesubst:#if:||{{{2}}}}}]]
 }}
}}

}}

|https://example.org }}{{#if:Bar| |Bar }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = https://example.org
| { = https://example.org
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:Bar| Bar}}]
 | #default={{ safesubst:#switch: 
  | File | Category = [[:Https://example.org{{ safesubst:#if:Bar||Bar}}]]
  | #default=[[Https://example.org{{ safesubst:#if:Bar||Bar}}]]
 }}
}}

}}

  • {{{{#if:|subst:}}linked{{#if:[https://example.org Foo]|

|[https://example.org Foo] }}{{#if:Bar| |Bar }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = Foo
| { = [[:Foo]]
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:Bar| Bar}}]
 | #default={{ safesubst:#switch: 
  | File | Category = [[:{{ safesubst:#if:Bar||Bar}}]]
  | #default=[[{{ safesubst:#if:Bar||Bar}}]]
 }}
}}

}}

Protocol-relative // links

| //example.org }}{{#if:| |{{{3}}} }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = //example.org
| { = //example.org
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:| {{{2}}}}}]
 | #default={{ safesubst:#switch: 
  | File | Category = [[://example.org{{ safesubst:#if:||{{{2}}}}}]]
  | #default=[safesubst:#if:||{{{2}}}}}]
 }}
}}

}}

| //example.org }}{{#if:Bar| |Bar }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = //example.org
| { = //example.org
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:Bar| Bar}}]
 | #default={{ safesubst:#switch: 
  | File | Category = [[://example.org{{ safesubst:#if:Bar||Bar}}]]
  | #default=[safesubst:#if:Bar||Bar}}]
 }}
}}

}}

| [//example.org Foo] }}{{#if:Bar| |Bar }}{{#if:| |{{{4}}} }}{{#if:| |{{{5}}} }}{{#if:| |{{{6}}} }}{{#if:| |{{{7}}} }}{{#if:| |{{{8}}} }}{{#if:| |{{{9}}} }}{{#if:| |{{{10}}} }}{{#if:| |{{{11}}} }}{{#if:| |... }}}} → {{ safesubst:#switch:Template:Str left

| [ = Foo
| { = [[:Foo]]
| {{ safesubst:#switch:Template:Str left
 | http://%7Chttps:/=[[[:Template:Str trim]]{{ safesubst:#if:Bar| Bar}}]
 | #default={{ safesubst:#switch: 
  | File | Category = [[:{{ safesubst:#if:Bar||Bar}}]]
  | #default=[[{{ safesubst:#if:Bar||Bar}}]]
 }}
}}

}}

See also