Template:Template link general: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
class="nowrap"; {{!((}} instead of {{!(}}{{!(}}; simpler (lighter on the parser) empty parameter checks
(Add alttext if called for)
(class="nowrap"; {{!((}} instead of {{!(}}{{!(}}; simpler (lighter on the parser) empty parameter checks)
 
(16 intermediate revisions by 8 users not shown)
Line 1:
__NOTOC__
<includeonly><!--
Templates tlc, tld, tlf have the following wrapping everything; do we need it?
-- begin tt face if tt=yes given
<span class="nowrap">
-->{{#if:{{{tt|}}}|<tt>}}<!--
--><!--
 
-- begin tt style if tt=yes or code=yes given
-->{{#if:{{{tt|}}}{{{code|}}}|<code>}}<!--
-- opening brace unless braceinside=yes
-->{{#if:{{{braceinside|}}}||<nowiki>{{</nowiki>}}<!--
Line 9 ⟶ 12:
-- begin boldface if bold=yes given
-->{{#if:{{{bold|}}}|'''}}<!--
 
-- begin link if not nolink=yes; add any LANG and SISTER prefixes
-- create actual link (if not nolink=yes)
-->{{#if:{{{nolink|}}}||{{!(}}{{!(}}{{{LANG|}}}{{{SISTER|}}}<!--
-->{{#if:{{{nolink|}}}
-- specify page to link to (unless nolink=yes)
|<!-- nolink=yes -->
-->{{#if:{{{1|}}}|{{#if:{{{anypage|}}}||{{ns:Template}}:}}{{{1|}}}|{{FULLPAGENAME}}}}{{!}}}}<!--
|{{!((}}:<!-- opening brackets of link
-->{{#ifeq:{{padleft:|1|{{{1}}}}} <!-- check whether we have a colon at the beginning -->
|:
|{{FULLPAGENAME:{{{1}}}}} <!-- if yes: link to article ns or assume other valid link, e.g. Interwikilink -->
|{{#switch:{{NAMESPACE:{{#if:{{{1|}}}|{{{1}}}|{{FULLPAGENAME}}}}}}
|{{ns:0}}={{ns:10}}:{{#if:{{{1|}}}|{{PAGENAME:{{{1}}}}}|{{PAGENAME}}}} <!-- No ns given: we want to link to template ns -->
|#default={{#if:{{{1|}}}|{{FULLPAGENAME:{{{1}}}}}|{{FULLPAGENAME}}}}<!--
-->}}<!--
-->}}{{!}}<!-- <<--- pipe character in link
-->}}<!--
 
-- create link text
-- opening brace if braceinside=yes
-->{{#if:{{{braceinside|}}}|<nowiki>{{</nowiki>}}<!--
-- surface text of link
-->{{{alttext|{{#if:{{{1|}}}|{{{1}}}|{{#ifeq:{{NAMESPACE}}|{{ns:Template}}|{{PAGENAME}}|{{FULLPAGENAME}}}}}}}}}}<!--
-- closing brace if braceinside=yes
-->{{#if:{{{braceinside|}}}|<nowiki>}}</nowiki>}}<!--
-- end of link, unless nolink=yes
-->{{#if:{{{nolink|}}}||]]}}<!--
 
-- end boldface if bold=yes
-- end boldface if bold=yes given
-->{{#if:{{{bold|}}}|'''}}<!--
-- begin italic style if italic=yes given
-- add the remaining parameters
-->{{#if:{{{2italic|}}}|<span style="font-style: italic;">}}<!--
 
&#124;{{{2}}}
-- add parameters
}}<!--
-->{{#ififeq:{{{32|¬}}}|¬||&#124;{{{2}}}}}<!--
-->{{#ifeq:{{{3|¬}}}|¬||&#124;{{{3}}}}}<!--
-->{{#ifeq:{{{4|¬}}}|¬||&#124;{{{4}}}}}<!--
}}<!--
-->{{#ififeq:{{{45|¬}}}|¬||&#124;{{{5}}}}}<!--
-->{{#ifeq:{{{6|¬}}}|¬||&#124;{{{46}}}}}<!--
-->{{#ifeq:{{{7|¬}}}|¬||&#124;{{{7}}}}}<!--
}}<!--
-->{{#ififeq:{{{58|¬}}}|¬||&#124;{{{8}}}}}<!--
-->{{#ifeq:{{{9|¬}}}|¬||&#124;{{{59}}}}}<!--
-->{{#ifeq:{{{10|¬}}}|¬||&#124;{{{10}}}}}<!--
}}<!--
-->{{#ififeq:{{{611|¬}}}|¬||&#124;{{{11}}}}}<!--
-->{{#if:{{{12|}}}|&#124;''...''}}<!--
&#124;{{{6}}}
 
}}<!--
-- end italic style if italic=yes given
-->{{#if:{{{7|}}}|
-->{{#if:{{{italic|}}}|</span>}}<!--
&#124;{{{7}}}
}}<!--
-->{{#if:{{{8|}}}|
&#124;{{{8}}}
}}<!--
-->{{#if:{{{9|}}}|
&#124;{{{9}}}
}}<!--
-->{{#if:{{{10|}}}|
&#124;{{{10}}}
}}<!--
-->{{#if:{{{11|}}}|
&#124;{{{11}}}
}}<!--
-->{{#if:{{{12|}}}|
&#124;''...''
}}<!--
-- closing brace unless braceinside=yes
-->{{#if:{{{braceinside|}}}||<nowiki>}}</nowiki>}}<!--
-- end ttcode facestyle if code=yes or tt=yes given
-->{{#if:{{{code|}}}{{{tt|}}}|</ttcode>}}<!--
-- end
--></includeonly><noinclude>
{{Documentation}}
 
==Explanation==
This template is a general template for inserting a template link.
 
copy of {{tl|tlb}} except that it uses a non-proportional, monospaced font instead of normal text:
{| class="wikitable"
! Code
! Result
! Remark
|-
| <code><nowiki>{{tlxb|Template name}}</nowiki></code>
| {{tlxb|Template name}}
|
|-
| <code><nowiki>{{tlxb|Template name|parameter1|parameter2}}</nowiki></code>
| {{tlxb|Template name|parameter1|parameter2}}
|
|-
| <code><nowiki>{{tlxb|Template name|parm1|parm2{{=}}foo}}</nowiki></code>
| {{tlxb|Template name|parm1|parm2{{=}}foo}}
| Equal signs need to be escaped using <code><nowiki>{{=}}</nowiki></code>.
|-
| <code><nowiki>{{tlxb}}</nowiki></code>
| {{tlxb}}
| This actually substitutes the current page name. Useful as a self-reference; won't be linked.
|-
| <code><nowiki>{{tlxb|SISTER=m:|3x}}</nowiki></code>
| {{tlxb|SISTER=m:|3x}}
| Link to page on another wiki.
|}
 
I.e., it's a {{tl|tl}}-style ''template-link'' tag that boldfaces the template name, and accepts parameters. It's main use is in distinguishing between multiple templates with similar names, in documentation, talk page discussions, etc.
 
The rest of the documentation is for {{tl|tlx}}, which works the same way (although it doesn't currently behave sanely when no parameters are given; use {{tl|tlu}} instead).
 
{{Documentation|Template:Tlx/doc}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
0

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu