Template:Plain link/doc: Difference between revisions
From TrainzOnline
Jump to navigationJump to search
m tweak usage |
→Examples: tweak |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<noinclude>{{Documentation subpage}} | <noinclude>{{Documentation subpage}} | ||
</noinclude> | </noinclude><includeonly>{{Usage-style}}</includeonly> | ||
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE --> | <!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE --> | ||
;Purpose of {{Lts|{{BASEPAGENAME}}}} | ;Purpose of {{Lts|{{BASEPAGENAME}}}} | ||
| Line 14: | Line 14: | ||
---> | ---> | ||
You can use {{Plain link|MW|magicword}} to generate URLs to Wikipedia pages. | You can use {{Plain link|MW|magicword}} to generate URLs to Wikipedia pages. | ||
==Pass parameters== | |||
__NOTOC__ | |||
Arguments or ''''positional/default pass parameters'''' are separated by the pipe character in Wiki markup language, so the first default parameter (placeholder is <nowiki> {{{1}}}</nowiki>) is assigned the link url address. The second (<nowiki> {{{2}}}</nowiki>) is the 'pretty text' for how you want to have it appear. | |||
# ''''|1='''' is the same as ''''| url = '''' (or in wiki template code: <nowiki> {{{1}}}</nowiki> = <nowiki> {{{url}}}</nowiki>) | |||
# ''''|2='''' is the same as ''''|name='''' (or in wiki template code: <nowiki> {{{2}}}</nowiki> = <nowiki> {{name}}}</nowiki>) | |||
==Examples== | ==Examples== | ||
<!-- | <big><!-- | ||
*<code><nowiki>{{Plain link|url=//www.wikipedia.org}}</nowiki></code> gives {{Plain link|url=//www.wikipedia.org}} | * <code><nowiki>{{Plain link|url=//www.wikipedia.org}}</nowiki></code> gives {{Plain link|url=//www.wikipedia.org}} | ||
*<code><nowiki>{{Plain link|//www.wikipedia.org Wikipedia}}</nowiki></code> gives {{Plain link|//www.wikipedia.org Wikipedia}} | * <code><nowiki>{{Plain link|//www.wikipedia.org Wikipedia}}</nowiki></code> gives {{Plain link|//www.wikipedia.org Wikipedia}} | ||
*<code><nowiki>{{Plain link|//www.wikipedia.org | Wikipedia}}</nowiki></code> gives {{Plain link|//www.wikipedia.org|Wikipedia}} --> | * <code><nowiki>{{Plain link|//www.wikipedia.org | Wikipedia}}</nowiki></code> gives {{Plain link|//www.wikipedia.org|Wikipedia}} --> | ||
*<code><nowiki>{{Plain link|http://www.google.co.uk|Google}}</nowiki></code> gives {{Plain link|http://www.google.co.uk|Google}} | * <code><nowiki>{{Plain link|http://www.google.co.uk|Google}}</nowiki></code> gives <code> {{Plain link|http://www.google.co.uk|Google}} </code> | ||
:: compare normal external wiki-link: | |||
* <code><nowiki>[http://www.google.co.uk Google]</nowiki></code> gives <code> [http://www.google.co.uk Google] </code> | |||
</big> | |||
==Caution on url insides== | |||
Note that if your url or link title contains an equals sign <code>=</code> you must use named parameters: | Note that if your url or link title contains an equals sign <code>=</code> you must use named parameters: | ||
*<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 | |||
*<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. | |||
<!-- | <!-- | ||
To be more concise, you can use <code><nowiki>{{scp}}</nowiki></code> and numbers as parameter names e.g. | To be more concise, you can use <code><nowiki>{{scp}}</nowiki></code> and numbers as parameter names e.g. | ||
Latest revision as of 22:58, 17 November 2013
|
- Purpose of Template:Plain link (edit talk links history)
- Create a 'Pretty-Print' external url link inside text.
- This template will allow you to create a local or interwiki link (such as a link to the history of a page) on a page without having the [" Error creating thumbnail: /bin/bash: line 1: /usr/bin/convert: No such file or directory Error code: 127 "] follow the link.
- This can be used, for example, when internal or interwiki links appear as external links.
- See Help:URL#URLs on_other Wikimedia projects for more information.
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=' is the same as '| url = ' (or in wiki template code: {{{1}}} = {{{url}}})
- '|2=' is the same as '|name=' (or in wiki template code: {{{2}}} = {{name}}})
Examples
{{Plain link|http://www.google.co.uk|Google}}givesGoogle
- compare normal external wiki-link:
[http://www.google.co.uk Google]givesGoogle
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.