Template:Plain link/doc

From TrainzOnline
< Template:Plain link(Difference between revisions)
Jump to: navigation, search
(expand and translate)
(Caution on url insides: tweak)
Line 31: Line 31:
 
*<code><nowiki>{{ Plainlink | url=http://en.wikipedia.org/w/index.php?title=Equals_sign&oldid=282228764 | name="this edit" }}</nowiki></code> gives {{Plain link|url=http://en.wikipedia.org/w/index.php?title=Equals_sign&oldid=282228764 |name="this edit"}}
 
*<code><nowiki>{{ Plainlink | url=http://en.wikipedia.org/w/index.php?title=Equals_sign&oldid=282228764 | name="this edit" }}</nowiki></code> gives {{Plain link|url=http://en.wikipedia.org/w/index.php?title=Equals_sign&oldid=282228764 |name="this edit"}}
 
whereas  
 
whereas  
*<code><nowiki>{{Plain link|http://forums.auran.com/trainz/showthread.php?14511-Having-Problems-with-Multiple-industry-New-Setup&highlight=%26lt%3Bkuid%3A107727%3A100012%26gt%3B Having Problems}}</nowiki></code> gives {{Plain link|http://forums.auran.com/trainz/showthread.php?14511-Having-Problems-with-Multiple-industry-New-Setup&highlight=%26lt%3Bkuid%3A107727%3A100012%26gt%3B Having Problems}} '''is broken''', ''whilst:  
+
*<code><nowiki>{{Plain link|http://forums.auran.com/trainz/showthread.php?14511-Having-Problems-with-Multiple-industry-New-Setup&highlight=%26lt%3Bkuid%3A107727%3A100012%26gt%3B |Having Problems}}</nowiki></code> gives <br
 +
/>{{Plain link|http://forums.auran.com/trainz/showthread.php?14511-Having-Problems-with-Multiple-industry-New-Setup&highlight=%26lt%3Bkuid%3A107727%3A100012%26gt%3B |Having Problems}} ''''which link-to-be'... is ''clearly broken'' with a mal-formed url due to the internal equals sign''', ''whilst:  
 
*<code><nowiki>{{Plain link|url=http://forums.auran.com/trainz/showthread.php?14511-Having-Problems-with-Multiple-industry-New-Setup&highlight=%26lt%3Bkuid%3A107727%3A100012%26gt%3B |2=Having Problems}}</nowiki></code> gives {{Plain link|url=http://forums.auran.com/trainz/showthread.php?14511-Having-Problems-with-Multiple-industry-New-Setup&highlight=%26lt%3Bkuid%3A107727%3A100012%26gt%3B |2=Having Problems}}'' works the same as if default parameter ''''|1='''' and ''''|name='''' are defined, since url is just an alternative that is a bit more explicit to <nowiki> {{{1}}}, and the default parameter {{{2}}}</nowiki> is used (mapped) the same as the ''''|name='''' parameter.
 
*<code><nowiki>{{Plain link|url=http://forums.auran.com/trainz/showthread.php?14511-Having-Problems-with-Multiple-industry-New-Setup&highlight=%26lt%3Bkuid%3A107727%3A100012%26gt%3B |2=Having Problems}}</nowiki></code> gives {{Plain link|url=http://forums.auran.com/trainz/showthread.php?14511-Having-Problems-with-Multiple-industry-New-Setup&highlight=%26lt%3Bkuid%3A107727%3A100012%26gt%3B |2=Having Problems}}'' works the same as if default parameter ''''|1='''' and ''''|name='''' are defined, since url is just an alternative that is a bit more explicit to <nowiki> {{{1}}}, and the default parameter {{{2}}}</nowiki> is used (mapped) the same as the ''''|name='''' parameter.
 
<!--
 
<!--

Revision as of 08:53, 18 November 2013



 
It contains usage information, categories and other informational content that is best arranged so that it is not part of the original template page, such as in many cases, examples of how to use the template in question.
  • Documentation subpages were developed to reduce server demands, or to protect the code version of widely used templates.
     

Purpose of Template:Plain link (edit talk links history)
  • Create a 'Pretty-Print' external url link inside text.

Caution

You can use [MW magicword] to generate URLs to Wikipedia pages.

Pass parameters

Arguments or 'positional/default pass parameters' are separated by the pipe character in Wiki markup language, so the first default parameter (placeholder is {{{1}}}) is assigned the link url address. The second ( {{{2}}}) is the 'pretty text' for how you want to have it appear.

  1. '|1=' is the same as '| url = ' (or in wiki template code: {{{1}}} = {{{url}}})
  2. '|2=' is the same as '|name=' (or in wiki template code: {{{2}}} = {{name}}})

Examples

  • {{Plain link|http://www.google.co.uk|Google}} gives Google

Caution on url insides

Note that if your url or link title contains an equals sign = you must use named parameters:

  • {{ Plainlink | url=http://en.wikipedia.org/w/index.php?title=Equals_sign&oldid=282228764 | name="this edit" }} gives "this edit"

whereas

  • {{Plain link|http://forums.auran.com/trainz/showthread.php?14511-Having-Problems-with-Multiple-industry-New-Setup&highlight=%26lt%3Bkuid%3A107727%3A100012%26gt%3B |Having Problems}} gives
    [Having Problems ] 'which link-to-be'... is clearly broken with a mal-formed url due to the internal equals sign, whilst:
  • {{Plain link|url=http://forums.auran.com/trainz/showthread.php?14511-Having-Problems-with-Multiple-industry-New-Setup&highlight=%26lt%3Bkuid%3A107727%3A100012%26gt%3B |2=Having Problems}} gives Having Problems works the same as if default parameter '|1=' and '|name=' are defined, since url is just an alternative that is a bit more explicit to {{{1}}}, and the default parameter {{{2}}} is used (mapped) the same as the '|name=' parameter.
Personal tools