模板:Tlx:修订间差异
创建页面,内容为“<noinclude>{{Documentation}}</noinclude> <includeonly><!-- --><code><!-- --><nowiki>{{</nowiki>{{#if:{{{subst|}}} |subst:}}<!--…” |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
<noinclude>{{Documentation}}</noinclude> | <noinclude>{{Documentation}}</noinclude><includeonly><!-- | ||
<includeonly><!-- | |||
--><code><!-- | --><code><!-- | ||
--><nowiki>{{</nowiki>{{#if:{{{subst|}}} |[[Help:Substitution|subst]]:}}<!-- | --><nowiki>{{</nowiki>{{#if:{{{subst|}}} |[[Help:Substitution|subst]]:}}<!-- | ||
2020年3月2日 (一) 17:47的最新版本
This template is used to show example template usage without expanding the template itself.
Basic use
(Note: In the following examples, ellipses (groups of three dots) indicate where parameters have been omitted.)
{{tlx|Template|first parameter|second parameter|third|...|twentieth}}produces:{{Template|first parameter|second parameter|third|...|twentieth}}
Where parameters might contain one or more equals-signs ("="), replace each equals-sign with {{=}}:
{{tlx|Template|first{{=}}something|second|third{{=}}something|...|twentieth}}produces:{{Template|first=something|second|third=something|...|twentieth}}
For more than ten parameters, possibly also containing equals-signs, use ... thus:
{{tlx|Template|<nowiki>''first''|''second''|''third=something''|...|''999th''</nowiki>}}produces:{{Template|first|second|third=something|...|999th}}
Purpose and naming
- If the only parameter supplied is {{{1}}}, i.e. a template's name,
{{tlx}}'s output is the same as{{tl}}– i.e. a link within braces – but in a monospaced font:- {{tl|tl}} produces:
{{tl}}
- {{tlx|tl}} produces:
{{tl}}
- {{tlx|tl}} produces:
{{tl}}will also not take nor display additional parameters.
- Named parameters
|subst
- Setting this parameter to any non-blank value will prefix the string
subst:linked to Help:Substitution. This is useful to indicate when a template should be substituted. For example,{{tlx|Welcome|subst=Y}}produces:{{subst:Welcome}}. This is similar to the action of the{{tlxs}}template:{{tlxs|Welcome}}produces: Welcome.
|SISTER
- For an interwiki link to other sister projects, such as: |SISTER=M, |SISTER=Q, |SISTER=S, etc, facilitating interwiki template documentation and/or discussion.
Documentation
{{Tlx}} is a generalization of
{{tl}},
{{tlp}} etc., with output that is arguably more legible. This depends on the browser, but narrow gaps between characters such as " { ", " | ", " } " and links can be hard to read when not monospaced (and hard to click on; for uses like {{!}}, see
{{tlw}}, which makes the click target bigger).
Usage
{{tlx|Templatename}}{{tlx|Templatename|param}}{{tlx|Templatename|1|2|3|4|5|6|7|8|9|10}}{{tlx|Templatename|1|2|3|4|5|6|7|8|9|10|more}}{{tlx|Templatename|param=value}}
There are up to 10 placeholders for parameters of the specified template.
Examples
- Note
- At the en.wikipedia and Meta sites, 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 | Remarks |
{{tlx|x0}} | {{x0}} | |
{{tlx|Abc}} | {{Abc}} | |
{{tlx|ABC}} | {{ABC}} | |
{{tlx|AbC}} | {{AbC}} | |
{{tlx|x1|one}} | {{x1|one}} | |
{{tlx|x2|one|two}} | {{x2|one|two}} | |
{{tlx|x3|1|2|3|4|5|6|7|8|9|10}} | {{x3|1|2|3|4|5|6|7|8|9|10}} | |
{{tlx|x4|1|2|3|4|5|6|7|8|9|10|11}} | {{x4|1|2|3|4|5|6|7|8|9|10|11}} | up to 10 parameters... |
{{tlx|x5|1|2|3|4|5|6|7|8|9|10|11}} | {{x5|1|2|3|4|5|6|7|8|9|10|11}} | ...| for more |
{{tlx|x1|x=u}} | {{x1}} | the straightforward equals-sign won't work... |
{{tlx|x1|x=u}} | {{x1|x=u}} | ...but = is okay |
{{tlx|x1|x{{=}}u}} | {{x1|x=u}} | ...and {{=}} is okay |
{{tlx|x1|<nowiki>x=u</nowiki>}} | {{x1|x=u}} | sticky nowiki also okay |
{{tlx|x2| |two}} | {{x2|two}} | empty won't work... |
{{tlx|x2| |two}} | {{x2| |two}} | ...but   is okay |
{{tlx|x2| |two}} | {{x2| |two}} | ... is also okay |
{{tlx|x2|<nowiki />|two}} | {{x2||two}} | <nowiki /> handles the space |
{{tlx|x2| | two}} | {{x2| | two}} | | is okay |
{{tlx|x2| {{!}} two}} | {{x2 | | two}} | {{!}} is dubious |
{{tlx|x2|2=|3=two}} | {{x2|two}} | empty really doesn't work |
{{tlx|x2|2=one|two}} | {{x2|two}} | "two" overrides "2=one" |
{{tlx|x2|3=two|2=one}} | {{x2|one|two}} | irregular parameter order is okay |
- Unlimited parameters as one <nowiki>...</nowiki> string
{{tlx|convert|<nowiki>14|m|ftin|abbr=out|sp=us</nowiki>}}