Template:W/doc: Difference between revisions
No edit summary |
mNo edit summary Tag: sourceedit |
||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
'''{{tl|w}}''' is a handly little shortcut that equates the following markup: | '''{{tl|w}}''' is a handly little shortcut that equates the following markup: | ||
<pre>[[wikipedia:article name]] --> {{w|article name}}</pre> | <pre>[[wikipedia:article name]] --> {{w|article name}}</pre> | ||
== Usage == | |||
{{tl|w}} incorporates one kind of [[pipe trick]]. As long as the wikipedia article is '''not [[dab|disambiguated]]''', then it will automatically get rid of the prepending "wikipedia:". Hence, | |||
:<code><nowiki>{{w|London}}</nowiki></code> results in {{w|London}}. | |||
However, if the wikipedia title ''is'' disambiguated, you must type a little more. For instance, | |||
:<code><nowiki>{{w|London (band)}}</nowiki></code> renders {{w|London (band)}} | |||
::''but'' | |||
:<code><nowiki>{{w|London (band)|London}}</nowiki></code> renders {{w|London (band)|London}} | |||
== Note for editors from other wikis == | |||
Other wikis use something similar to this template. [[memoryalpha:Memory Alpha|Memory Alpha]], for instance, uses a template with exactly the same name. However, our {{tl|w}} is a bit different to [[memoryalpha:template:w]], in that it defaults to the name of the page if you don't add your own variable name. In essence, Memory Alpha use {{tl|w}} to do not only what this one does, but also what {{tl|wikipediainfo}} does. The default value of the second variable in this template is the value of ''first'' variable — not the name of the page on which you're working. That's why :<code><nowiki>{{w|London}}</nowiki></code> renders {{w|London}}. | |||
For those interested in technical details, when you type <code><nowiki>{{w|London}}</nowiki></code>, ''our'' template is actually delivering the following code: <code><nowiki>[[wikipedia:London|London]]</nowiki></code>. | |||
In ''other'' iterations of this template around Wikia, it might instead be delivering ''this'' code: <code><nowiki>[[wikipedia:London|{{PAGENAME}}]]</nowiki></code>, which is sometimes a very different thing. | |||
<noinclude>[[category:template documentation|{{PAGENAME}}]]</noinclude> |
Latest revision as of 07:31, 11 February 2017
{{w}} is a handly little shortcut that equates the following markup:
[[wikipedia:article name]] --> {{w|article name}}
Usage
{{w}} incorporates one kind of pipe trick. As long as the wikipedia article is not disambiguated, then it will automatically get rid of the prepending "wikipedia:". Hence,
{{w|London}}
results in London.
However, if the wikipedia title is disambiguated, you must type a little more. For instance,
{{w|London (band)}}
renders London (band)- but
{{w|London (band)|London}}
renders London
Note for editors from other wikis
Other wikis use something similar to this template. Memory Alpha, for instance, uses a template with exactly the same name. However, our {{w}} is a bit different to memoryalpha:template:w, in that it defaults to the name of the page if you don't add your own variable name. In essence, Memory Alpha use {{w}} to do not only what this one does, but also what {{wikipediainfo}} does. The default value of the second variable in this template is the value of first variable — not the name of the page on which you're working. That's why :{{w|London}}
renders London.
For those interested in technical details, when you type {{w|London}}
, our template is actually delivering the following code: [[wikipedia:London|London]]
.
In other iterations of this template around Wikia, it might instead be delivering this code: [[wikipedia:London|{{PAGENAME}}]]
, which is sometimes a very different thing.