Difference between revisions of "Template:Linked"

From blackwiki
Jump to navigation Jump to search
imported>NeilN
m (Changed protection level of Template:Linked: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite)))
imported>Sceptre
(per edit request)
 
Line 1: Line 1:
 
{{ {{{|safesubst:}}}#switch:{{ {{{|safesubst:}}}str left|{{{1}}}}}
 
{{ {{{|safesubst:}}}#switch:{{ {{{|safesubst:}}}str left|{{{1}}}}}
  | [ = {{{1|}}}
+
  | [ = {{ {{{|safesubst:}}}#switch:{{ {{{|safesubst:}}}str left|{{{1}}}|2}}
 +
  | [<noinclude />[ = {{ {{{|safesubst:}}}#switch:{{ {{{|safesubst:}}}str left|{{{1}}}|3}}
 +
  | [<noinclude />[: = {{{1|}}}
 +
  | #default=[[:{{ {{{|safesubst:}}}str crop|{{ {{{|safesubst:}}}str right|{{{1|}}}|2}}|2}}]]
 +
  }}
 +
  |#default={{{1|}}}
 +
  }}
 
  | { = [[:{{{1}}}]]
 
  | { = [[:{{{1}}}]]
  | {{ {{{|safesubst:}}}#switch:{{ {{{|safesubst:}}}str left|{{{1}}}|7}}
+
  | #default={{ {{{|safesubst:}}}#switch:{{ {{{|safesubst:}}}str left|{{{1}}}|2}}
   | http://|https:/=[{{ {{{|safesubst:}}}str trim|{{{1}}}}}{{ {{{|safesubst:}}}#if:{{{2|}}}|<nowiki/> {{{2}}}}}]
+
   | // = {{ {{{|safesubst:}}}#if:{{{2|}}}|[{{{1|}}} {{{2|}}}]|[{{{1|}}}]}}
   | #default={{ {{{|safesubst:}}}#switch: {{ {{{|safesubst:}}}NAMESPACE:{{{1|}}}}}
+
   | #default={{ {{{|safesubst:}}}#switch:{{ {{{|safesubst:}}}str left|{{{1}}}|7}}
   | {{ {{{|safesubst:}}}ns:File}} | {{ {{{|safesubst:}}}ns:Category}} = [[:{{ {{{|safesubst:}}}FULLPAGENAME:{{{1|}}}}}{{ {{{|safesubst:}}}#if:{{{2|}}}|{{ {{{|safesubst:}}}!}}{{{2}}}}}]]
+
   | http://|https:/=[{{ {{{|safesubst:}}}str trim|{{{1}}}}}{{ {{{|safesubst:}}}#if:{{{2|}}}|<nowiki/> {{{2}}}}}]
   | #default=[[{{ {{{|safesubst:}}}FULLPAGENAME:{{{1|}}}}}{{ {{{|safesubst:}}}#if:{{{2|}}}|{{ {{{|safesubst:}}}!}}{{{2}}}}}]]
+
   | #default=[[:{{ {{{|safesubst:}}}FULLPAGENAME:{{{1|}}}}}{{ {{{|safesubst:}}}#if:{{{2|}}}|{{ {{{|safesubst:}}}!}}{{{2}}}}}]]
 
   }}
 
   }}
 
  }}
 
  }}

Latest revision as of 08:56, 28 May 2020

[[:{{{1}}}]]

Template documentation[view] [edit] [history] [purge]

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

Http links

  • {{linked| http://example.org}} → [[[:Template:Str trim]]]
  • {{linked|http://example.org|Bar}} → [[[:Template:Str trim]] Bar]
  • {{linked|[http://example.org Foo]|Bar}}Foo

Https links

  • {{linked|https://example.org}} → [[[:Template:Str trim]]]
  • {{linked|https://example.org|Bar}} → [[[:Template:Str trim]] Bar]
  • {{linked|[https://example.org Foo]|Bar}}Foo

Protocol-relative // links

  • {{linked|//example.org}}[1]
  • {{linked|//example.org|Bar}}Bar
  • {{linked|[//example.org Foo]|Bar}}Foo

See also