Difference between revisions of "Template:Tlg"

From annadreambrush.com/wiki
Jump to navigation Jump to search
imported>Benwing
(Add code parameter, update docs)
imported>Zyxw
(add optional parameter "a" which if set to any value displays an asterisk before template code)
 
(29 intermediate revisions by 16 users not shown)
Line 1: Line 1:
__NOTOC__<includeonly><!--
+
<includeonly><!--
  -- begin tt style if tt=yes given
+
-->{{#if:{{{nowrap|}}}       |<span class="nowrap">}}<!--
-->{{#if:{{{tt|}}}|<tt>}}<!--
+
-->{{#if:{{{code|{{{tt|}}}}}} |<code> |{{#if:{{{plaincode|}}}|<code style="border:none;background:transparent;">}} }}<!--
  -- begin code style if code=yes given
+
-->{{#if:{{{kbd|}}}           |<kbd>}}<!--
-->{{#if:{{{code|}}}|<code>}}<!--
+
-->{{#if:{{{nowrapname|}}}   |<span class="nowrap">}}<!--
  -- opening brace unless braceinside=yes
+
-->{{#if:{{{a|}}}             |<nowiki>*</nowiki>&nbsp;}}<!--
-->{{#if:{{{braceinside|}}}||<nowiki>{{</nowiki>}}<!--
+
-->{{#if:{{{brace|}}}{{{braceinside|}}} | |<nowiki>{{</nowiki>}}<!--
  -- add subst prefix, if subst=yes given
+
-->{{#if:{{{subst|}}}         |[[Help:Substitution|subst]]:}}<!--
-->{{#if:{{{subst|}}}|[[Help:Substitution|subst]]:}}<!--
 
  -- begin boldface if bold=yes given
 
-->{{#if:{{{bold|}}}|'''}}<!--
 
  -- begin link if not nolink=yes; add any LANG and SISTER prefixes
 
-->{{#if:{{{nolink|}}}||{{!(}}{{!(}}{{{LANG|}}}{{{SISTER|}}}<!--
 
  -- specify page to link to (unless nolink=yes)
 
-->{{#if:{{{1|}}}|{{#if:{{{anypage|}}}||{{ns:Template}}:}}{{{1|}}}|{{FULLPAGENAME}}}}{{!}}}}<!--
 
  -- opening brace if braceinside=yes
 
-->{{#if:{{{braceinside|}}}|<nowiki>{{</nowiki>}}<!--
 
  -- surface text of link
 
-->{{{alttext|{{{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
 
-->{{#if:{{{bold|}}}|'''}}<!--
 
  -- add the remaining parameters
 
-->{{#if:{{{2|}}}|
 
&#124;{{{2}}}
 
}}<!--
 
-->{{#if:{{{3|}}}|
 
&#124;{{{3}}}
 
}}<!--
 
-->{{#if:{{{4|}}}|
 
&#124;{{{4}}}
 
}}<!--
 
-->{{#if:{{{5|}}}|
 
&#124;{{{5}}}
 
}}<!--
 
-->{{#if:{{{6|}}}|
 
&#124;{{{6}}}
 
}}<!--
 
-->{{#if:{{{7|}}}|
 
&#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 code style if code=yes given
 
-->{{#if:{{{code|}}}|</code>}}<!--
 
  -- end tt style if tt=yes given
 
-->{{#if:{{{tt|}}}|</tt>}}<!--
 
  -- end
 
--></includeonly><noinclude>
 
  
==Explanation==
+
-->{{#if:{{{bold|{{{boldlink|{{{boldname|}}}}}}}}} |'''}}<!--
This template is a general template for inserting a template link. It can be used to replace or implement any of the more specific <code><nowiki>{{tl*}}</nowiki></code> templates.  Parameters are:
+
-->{{#if:{{{nolink|}}} |<!--then omit template link, else:
* {{code|bold{{=}}yes}}: Boldface the text, like for {{tlx|tlb}} and {{tlx|tlxb}}
+
  -->| {{#if:{{{braceinside|}}} |<nowiki>{</nowiki>}}<!--
* {{code|tt{{=}}yes}}: Use a monospaced font, like for {{tlx|tlx}} and {{tlx|tlxb}}
+
      -->{{!((}}:<!--(start building link with "[[:")
* {{code|tt{{=}}yes}}: Use the <code><nowiki><code>...</code></nowiki></code> HTML attribute (usually a monospaced font), like for {{tlx|tlc}}
+
                  -->{{#ifeq:{{padleft:|1|{{{1}}}}}|: <!--i.e. if {{{1}}}'s first character is a colon,
* {{code|nolink{{=}}yes}}: Don't insert a template link, like for {{tlx|tlf}}, {{tlx|tld}}, and {{tlx|tlc}}
+
              then:--> |{{FULLPAGENAME:{{{1}}}}}<!--
* {{code|anypage{{=}}yes}}: Allow linking to arbitrary page (not just template), as with {{tlx|tlu}}
+
              else:--> |{{#switch:{{NAMESPACE:{{#if:{{{1|}}}|{{{1}}}|{{FULLPAGENAME}}}}}}
* {{code|braceinside{{=}}yes}}: Put braces inside the link, like for {{tlx|tn}}
+
                        | {{ns:0}} = {{ns:10}}:{{#if:{{{1|}}}|{{PAGENAME:{{{1}}}}}|{{PAGENAME}}}}
* {{code|subst{{=}}yes}}: Add a {{code|subst:}} prefix, like for {{tlx|tls}}
+
                        | #default = {{#if:{{{1|}}}|{{FULLPAGENAME:{{{1}}}}}|{{FULLPAGENAME}}}}
* {{code|alttext{{=}}FOO}}: Specify alternative surface text for a link, like for {{tlx|tla}}
+
                      }}}}<!--
 +
      -->{{!}}<!--(pipe between link and label, i.e. [[:link|label]])
 +
-->}}<!--
 +
-->{{#if:{{{brace|}}} |<nowiki>{{</nowiki>}}<!--
 +
-->{{#if:{{{braceinside|}}} |<nowiki>{</nowiki>}}<!--
 +
label / template name:
 +
-->{{{alttext|{{#if:{{{1|}}}|{{{1}}}|{{#ifeq:{{NAMESPACE}}|{{ns:Template}}|{{PAGENAME}}|{{FULLPAGENAME}}}}}}}}}<!--
 +
-->{{#if:{{{brace|}}} |<nowiki>}}</nowiki>}}<!--
 +
-->{{#if:{{{braceinside|}}} |<nowiki>}</nowiki>}}<!--
 +
-->{{#if:{{{nolink|}}} | |<!--
 +
      -->{{))!}}<!--(end link)
 +
    -->{{#if:{{{braceinside|}}} |<nowiki>}</nowiki>}}<!--
 +
-->}}<!--
 +
-->{{#if:{{{bold|{{{boldlink|{{{boldname|}}}}}}}}} |'''}}<!--
 +
-->{{#if:{{{nowrapname|}}} |</span>}}<!--
  
{| class="wikitable"
+
-->{{#if:{{{italic|{{{italics|}}}}}} |<span style="font-style:italic;">}}<!--
! Code
+
-->{{#ifeq:{{{2|¬}}}|¬ | |&#124;{{#tag:nowiki|{{{2}}}}}}}<!--
! Result
+
-->{{#ifeq:{{{3|¬}}}|¬ | |&#124;{{#tag:nowiki|{{{3}}}}}}}<!--
! Remark
+
-->{{#ifeq:{{{4|¬}}}|¬ | |&#124;{{#tag:nowiki|{{{4}}}}}}}<!--
|-
+
-->{{#ifeq:{{{5|¬}}}|¬ | |&#124;{{#tag:nowiki|{{{5}}}}}}}<!--
| <code><nowiki>{{tlxb|Template name}}</nowiki></code>
+
-->{{#ifeq:{{{6|¬}}}|¬ | |&#124;{{#tag:nowiki|{{{6}}}}}}}<!--
| {{tlxb|Template name}}
+
-->{{#ifeq:{{{7|¬}}}|¬ | |&#124;{{#tag:nowiki|{{{7}}}}}}}<!--
|
+
-->{{#ifeq:{{{8|¬}}}|¬ | |&#124;{{#tag:nowiki|{{{8}}}}}}}<!--
|-
+
-->{{#ifeq:{{{9|¬}}}|¬ | |&#124;{{#tag:nowiki|{{{9}}}}}}}<!--
| <code><nowiki>{{tlxb|Template name|parameter1|parameter2}}</nowiki></code>
+
-->{{#ifeq:{{{10|¬}}}|¬ | |&#124;{{#tag:nowiki|{{{10}}}}}}}<!--
| {{tlxb|Template name|parameter1|parameter2}}
+
  -->{{#ifeq:{{{11|¬}}}|¬ | |&#124;{{#tag:nowiki|{{{11}}}}}}}<!--
|
+
-->{{#if:{{{12|}}} |&#124;…}}<!--
|-
+
-->{{#if:{{{italic|{{{italics|}}}}}} |</span>}}<!--
| <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.
+
-->{{#if:{{{brace|}}}{{{braceinside|}}} | |<nowiki>}}</nowiki>}}<!--
 
+
-->{{#if:{{{kbd|}}} |</kbd>}}<!--
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).
+
-->{{#if:{{{code|{{{tt|}}}}}}{{{plaincode|}}} |</code>}}<!--
 
+
-->{{#if:{{{nowrap|}}} |</span>}}<!--
{{Documentation|Template:Tlx/doc}}
+
--></includeonly><noinclude>
<!-- Add categories and interwikis to the /doc subpage, not here! -->
+
{{Documentation}}
 
</noinclude>
 
</noinclude>

Latest revision as of 19:31, 23 February 2020

Template documentation[create]