Template:Tlx: Difference between revisions
Jump to navigation
Jump to search
m (mn recat) |
(install /doc page w/merged documentation) |
||
Line 1: | Line 1: | ||
<includeonly><tt><nowiki>{{</nowiki>[[{{ns:Template}}:{{{1|}}}|{{{1|}}}]]<!-- | <includeonly><tt><nowiki>{{</nowiki>[[{{{SISTER}}}{{ns:Template}}:{{{1|}}}|{{{1|}}}]]<!-- | ||
-->{{#if:{{{2|}}}| | -->{{#if:{{{2|}}}| | ||
|{{{2}}} | |{{{2}}} | ||
Line 14: | Line 14: | ||
-->{{#if:{{{6|}}}| | -->{{#if:{{{6|}}}| | ||
|<i>...</i> | |<i>...</i> | ||
}}<nowiki>}}</nowiki></tt></includeonly><noinclude> | }}<nowiki>}}</nowiki></tt></includeonly><noinclude>{{Tlx/doc}}<!--- Place Interwiki's beneath this line ---> | ||
{{ | |||
[[ko:틀:Tlx]] | [[ko:틀:Tlx]] | ||
[[ru:Template:Tlx]] | [[ru:Template:Tlx]] | ||
</noinclude> | </noinclude> |
Revision as of 03:37, 15 February 2007
Wiki markup | Output | |
---|---|---|
{{Tlx|Template|first parameter|second|third|…|tenth}} | ⇒ | {{[[{{{SISTER}}}Template:Template|Template]]|first parameter|second|third|…|...}} |
{{Tlx|first parameter|…|third|tenth}} | ⇒ | {{[[{{{SISTER}}}Template:Template|Template]]|first parameter|second|third|…|...}} if they might contain an equality sign (= )
|
{{Tlx|Template|<nowiki>first|second|…|999th</nowiki>}} | ⇒ | {{[[{{{SISTER}}}Template:Template|Template]]|first|second|…|999th}} (when you need to show more than ten parameters) |
Purpose and naming
Mnemonically 'Template link expanded', after {{[[{{{SISTER}}}Template:Tl|Tl]]}}'s 'Template link'.
This template takes another template's name and some associated pipe-tricked positional parameters (or 'pass parameters'), and displays them as a demonstrative example of how the template could be coded, literally. Its primary use is in instruction and documentation.
- Specifics: Up to ten pass parameters (numbered or nowiki'd keywords) for the specified template are displayed as 'placeholders', and more than ten parameters can be displayed using a coded vertical-bar (
|
/|
/|
/|…
). A keyword parameter can be used with the equality sign HTML entity (=
,=
or{{=}}
or in nowiki tags: "<nowiki>param=value</nowiki>"; see § Examples below. - Exceptions: If the intended template lists numerous parameters, then perhaps this template should really not be used, and just hardcode the usage with
<code>
, for example:<nowiki>...</nowiki>
</code><code>
. If a vertical display with parameters on their own lines is desired, this can also be laid out manually in this manner, or more rapidly done with<nowiki>{{Template|param1=23|size=250px|otherparams…}}</nowiki>
</code><pre>...</pre>
tags.
- If given no additional parameters except the template name, as in
{{Tlx|Template name}}
or{{Tlx|1=Template name}}
, the output is functionally equivalent to the {{Tl}} macro template: a blue hyperlink nested in double braces — the same as a user would apply the template (without parameters) — but with a noticably clearer font and more character spacing on most modern browsers.- Comparing the output of the two templates side-by-side: Tl ⇒ {{Template}} versus Tlx ⇒ {{[[{{{SISTER}}}Template:Template|Template]]}}
- Comparatively, {{[[{{{SISTER}}}Template:Tl|Tl]]}} will not take or display additional parameters, and for minor technical reasons, may be preferred for mere listing and referencing in long pages involving a lot of template expansions.
- {{[[{{{SISTER}}}Template:Tlx|Tlx]]}} has a named parameter,
|subst=
, which when set to any value will place the stringsubst:
before the template name, linked to Help:Substitution. This is useful to indicate when a template should be substituted; for example {{[[{{{SISTER}}}Template:Tlx|Tlx]]|Template|subst=y}} will display {{[[{{{SISTER}}}Template:Template|Template]]}}.
Usage
{{Tlx}} is a generalization of {{Tl|x}}, et cetera, with arguably more readable output. This depends on the browser, but most of them use too narrow a form of {
, |
and }
in conjunction with hyperlinks tend to be hard to read.
Invocation
- {{Tlx|Template name}}
- {{Tlx|Template name|param}}
- {{Tlx|Template name|1|2|3|4|5|6|7|8|9|10}}
- {{Tlx|Template name|1|2|3|4|5|6|7|8|9|10|more}}
- {{Tlx|Template name|param=value}}
Up to 10 placeholders for parameters of the specified template
Examples
Code | Result | Remark |
---|---|---|
{{Tlx|Template}} | {{[[{{{SISTER}}}Template:Template|Template]]}} | |
{{Tlx|Abc}} | {{Abc}} | |
{{Tlx|ABC}} | {{ABC}} | |
{{Tlx|AbC}} | {{AbC}} | |
{{Tlx|Template|one}} | {{Template|one}} | |
{{Tlx|Template|one|two}} | {{Template|one|two}} | |
{{Tlx|Template|1|2|3|4|5|6|7|8|9|10}} | {{Template|1|2|3|4|5|6|7|8|9|10}} | |
{{Tlx|Template|1|2|3|4|5|6|7|8|9|10|11}} | {{Template|1|2|3|4|5|6|7|8|9|10|…}} | Accepts up to ten parameters, then …
|
{{Tlx|Template|1|2|3|4|5|6|7|8|9|10|11}} | {{Template|1|2|3|4|5|6|7|8|9|10|11}} | But | instead of the pipe character will let you simulate more
|
{{Tlx|Template|<nowiki>14|m|ftin|abbr=out|sp=us</nowiki>}} | {{Template|14|m|ftin|abbr=out|sp=us}} | You can also show an unlimited no. of parameters as a single <nowiki>...</nowiki> string
|
{{Tlx|Template|x=u}} | {{Template}} | Trying to show parameters with set values using a normal = won't work
|
{{Tlx|Template|x=u}} | {{Template|x=u}} | However, using the HTML entity for the equality sign (= or = ) works just fine for that
|
{{Tlx|Template|x{{=}}u}} | {{Template|x=u}} | {{=}} costs a few more ms of parser time per page load, but is okay too
|
{{Tlx|Template|<nowiki>x=u</nowiki>}} | {{Template|x=u}} | Sticky <nowiki>...</nowiki> is a little messy, but works all the same
|
{{Tlx|Template| |two}} | {{Template|two}} | Trying to show an empty positional parameter won't work using just a space |
{{Tlx|Template|2=|3=two}} | {{Template|two}} | Setting a named positional parameter to a null value is sneaky, but doesn't work either |
{{Tlx|Template| |two}} | {{Template| |two}} | But the HTML entity for a non-breaking space ( ) will get it done
|
{{Tlx|Template|⁠|two}} | {{Template||two}} | A true WikiNinja™ will always prefer the invisible Word Joiner character (⁠ ) for that, though
|
{{Tlx|Template||two}} | {{Template||two}} | The HTML entity for a pipe (| /| /| /| ), though a kludge, looks okay too
|
{{Tlx|Template|{{!}}two}} | {{Template||two}} | And speaking of kludges, {{[[{{{SISTER}}}Template:!|!]]}} is much worse, since it costs extra parser time on each page load again |
{{Tlx|Template|2=one|two}} | {{Template|two}} | If a named and an unnamed positional parameter end up in a knife fight, the last one supplied always wins |
{{Tlx|Template|3=two|2=one}} | {{Template|one|two}} | The order they're specified in doesn't matter, positional parameters are shown in numerical order by name |