Template:Tlg: Difference between revisions

From Sarkarverse
Jump to navigation Jump to search
m (1 revision)
 
m (1 revision)
 
(5 intermediate revisions by the same user not shown)
Line 2: Line 2:
   -- begin span of class "nowrap" if nowrap=yes
   -- begin span of class "nowrap" if nowrap=yes
-->{{#if:{{{nowrap|}}}|<span class="nowrap">}}<!--
-->{{#if:{{{nowrap|}}}|<span class="nowrap">}}<!--
   -- begin tt style if tt=yes or code=yes
   -- begin code style if code=yes or tt=yes
-->{{#if:{{{tt|}}}{{{code|}}}|<code>}}<!--
-->{{#if:{{{code|{{{tt|}}}}}}|<code>}}<!--
   -- opening brace unless braceinside=yes
   -- opening brace unless braceinside=yes
-->{{#if:{{{braceinside|}}}||<nowiki>{{</nowiki>}}<!--
-->{{#if:{{{braceinside|}}}||<nowiki>{{</nowiki>}}<!--
Line 14: Line 14:
-->{{#if:{{{nolink|}}}
-->{{#if:{{{nolink|}}}
       |<!-- nolink=yes -->
       |<!-- nolink=yes -->
       |{{!((}}:<!-- opening brackets of link
       |{{#if:{{{braceinside|}}}|<nowiki>{</nowiki>}}<!-- first opening brace before link if braceinside=yes
    -->{{!((}}:<!-- opening brackets of link
     -->{{#ifeq:{{padleft:|1|{{{1}}}}} <!-- check whether we have a colon at the beginning -->
     -->{{#ifeq:{{padleft:|1|{{{1}}}}} <!-- check whether we have a colon at the beginning -->
         |:
         |:
Line 26: Line 27:


-- create link text
-- create link text
   -- opening brace if braceinside=yes
   -- second opening brace if braceinside=yes
-->{{#if:{{{braceinside|}}}|<nowiki>{{</nowiki>}}<!--
-->{{#if:{{{braceinside|}}}|<nowiki>{</nowiki>}}<!--
   -- surface text of link
   -- surface text of link
-->{{{alttext|{{#if:{{{1|}}}|{{{1}}}|{{#ifeq:{{NAMESPACE}}|{{ns:Template}}|{{PAGENAME}}|{{FULLPAGENAME}}}}}}}}}<!--
-->{{{alttext|{{#if:{{{1|}}}|{{{1}}}|{{#ifeq:{{NAMESPACE}}|{{ns:Template}}|{{PAGENAME}}|{{FULLPAGENAME}}}}}}}}}<!--
   -- closing brace if braceinside=yes
   -- first closing brace if braceinside=yes
-->{{#if:{{{braceinside|}}}|<nowiki>}}</nowiki>}}<!--
-->{{#if:{{{braceinside|}}}|<nowiki>}</nowiki>}}<!--
   -- end of link, unless nolink=yes
   -- end of link, unless nolink=yes
-->{{#if:{{{nolink|}}}||]]}}<!--
-->{{#if:{{{nolink|}}}||]]<!--
  -- second closing brace after link if braceinside=yes
-->{{#if:{{{braceinside|}}}|<nowiki>}</nowiki>}}<!--
-->}}<!--


   -- end boldface if bold=yes
   -- end boldface if bold=yes
Line 58: Line 62:
-->{{#if:{{{braceinside|}}}||<nowiki>}}</nowiki>}}<!--
-->{{#if:{{{braceinside|}}}||<nowiki>}}</nowiki>}}<!--
   -- end code style if code=yes or tt=yes
   -- end code style if code=yes or tt=yes
-->{{#if:{{{code|}}}{{{tt|}}}|</code>}}<!--
-->{{#if:{{{code|{{{tt|}}}}}}|</code>}}<!--
   -- end span of class "nowrap" if nowrap=yes
   -- end span of class "nowrap" if nowrap=yes
-->{{#if:{{{nowrap|}}}|</span>}}<!--
-->{{#if:{{{nowrap|}}}|</span>}}<!--

Latest revision as of 06:30, 23 August 2014

Documentation icon Template documentation[view] [edit] [history] [purge]

Explanation

{{tlg}} (template link, general) is a general template for inserting a template link. It can be used to replace or implement any of the more specific {{tl*}} templates, e.g. {{tl}}, {{tlx}} or {{tlb}}. Parameters are:

  • code=yes: Use the <code>…</code> HTML attribute (usually a monospaced font), like for {{tlc}} {{tlx}} and {{tlxb}}
  • bold=yes: Boldface the text, like for {{tlb}} and {{tlxb}}
  • italic=yes: Italicizes the parameters, like for {{tlxi}}
  • nolink=yes: Don't insert a template link, like for {{tlf}}, {{tld}}, and {{tlc}}
  • braceinside=yes: Put braces inside the link, like for {{tn}}
  • subst=yes: Add a subst: prefix, like for {{tls}}
  • alttext=FOO: Specify alternative surface text for a link, like for {{tla}}
  • nowrap=yes: Prevent line breaks in output

Examples

Note
On the source sister projects, en.wikipedia and Meta, X0, X1, X2, …, X9 are sandbox templates for experimentation on involved templates that need be in template space. An auto-cleansing software facility exists that might be used to duplicate the facility on other Sister projects.
Code Result Remark
{{Tlg|Abc}} {{Abc}}  
{{Tlg|abC}} {{abC}} template names are case-sensitive
{{Tlg|abc}} {{abc}} first letter is case-insensitive though
{{Tlg|x0}} {{x0}}  
{{Tlg|x0|code=yes}} {{x0}} code style
{{Tlg|x0|bold=yes}} {{x0}} bold style
{{Tlg|x1|one|italic=yes}} {{x1|one}} italic style
{{Tlg|x0|nolink=yes}} {{x0}}  
{{Tlg|x0|subst=yes}} {{subst:x0}}  
{{Tlg|x0|braceinside=yes}} {{x0}}  
{{Tlg|x0|alttext=Link to x0 template}} {{Link to x0 template}}  
{{Tlg|x0|bold=yes|code=yes|braceinside=yes}} {{x0}} No reason you can't combine multiple parameter settings.
{{Tlg|x1|one}} {{x1|one}}  
{{Tlg|x2|one|two}} {{x2|one|two}}  
{{Tlg|x2|bold=yes|code=yes|one|two}} {{x2|one|two}} Can combine named and anonymous parameters …
{{Tlg|x2|one|two|bold=yes|code=yes}} {{x2|one|two}} … in any order …
{{Tlg|x2|one|code=yes|two|bold=yes|three}} {{x2|one|two|three}} … even intermixed …
{{Tlg|x2|one|code=yes|two|bold=yes|three|italic=yes}} {{x2|one|two|three}} … with many different configurations.
{{Tlg|x3|1|2|3|4|5|6|7|8|9|10}} {{x3|1|2|3|4|5|6|7|8|9|10}}  
{{Tlg|x4|1|2|3|4|5|6|7|8|9|10|11}} {{x4|1|2|3|4|5|6|7|8|9|10|…}} up to 10 parameters, then …
{{Tlg|x5|1|2|3|4|5|6|7|8|9|10&#124;11}} {{x5|1|2|3|4|5|6|7|8|9|10|11}} &#124; for more
{{Tlg|convert|<nowiki>14|m|ftin|abbr=out|sp=us</nowiki>}} unlimited parameters as one nowiki string
{{Tlg}} {{Tlg}} with no arguments, the current page name is substituted
{{Tlg|x1|x=u}} {{x1}} = won't work
{{Tlg|x1|x&#61;u}} {{x1|x=u}} &#61; is okay
{{Tlg|x1|x{{=}}u}} {{x1|x=u}} {{=}} is okay
{{Tlg|x1|x<nowiki>=</nowiki>u}} {{x1|x=u}} sticky nowiki is okay
{{Tlg|x2||two||}} {{x2||two||}} empty parameters work too, even at the end
{{Tlg|x2|2=one|two}} {{x2|two}} two clobbers 2=one
{{Tlg|x2|3=two|2=one}} {{x2|one|two}} right to left okay

General-purpose formatting

  • 1 {{tlg}} is the most general, allowing any combination of text style and/or link style options.
  • 2 Prevents wrapping of text by placing it inside <span class="nowrap">...</span> tags.
  • 3 Uses monospace font but not <code>...</code>.

Other formatting templates

Code example Effect Notes
{{tl2|Hatnote|lang=fr}} {{hatnote}} Supports linking to sister projects (e.g., fr:Hatnote)
{{tlu|User:Ahunt/SSHFS}} {{User:Ahunt/SSHFS}} Supports linking to any namespace
{{xpd|Hatnote|Some hatnote text}} "{{hatnote|Some hatnote text}}" gives "
Some hatnote text
" [1]
Shows code, example and a link to expand the template code

With utility links

Code example Effect
{{lts|Hatnote}} Template:Hatnote (edit talk links history)
{{t links|Hatnote}} Hatnote (edit · talk · history · links · /subpages · /doc · /doc edit · /sbox · /sbox diff · /test · Module:hatnote)
{{tfd links|Hatnote}}
{{tiw|Hatnote}}
{{tltt|Hatnote}} {{Hatnote}}
{{tetl|Hatnote}} {{ Hatnote }}
links talk view
{{Tlsetl|Hatnote}} {{ subst:Hatnote }}
links talk view
{{ti|Hatnote}} Template:Hatnote (talk, links, edit)
{{tic|Hatnote}} Template:Hatnote (talk, links, edit)
{{tiw|Hatnote}}
{{tlt|Hatnote}} {{Hatnote}} (talk)
{{ttl|Hatnote}} {{Hatnote}} (t/l)
{{Twlh|Hatnote}} Template:Hatnote (links, talk)