模板:Tlx/doc:修订间差异
无编辑摘要 |
无编辑摘要 |
||
| 第4行: | 第4行: | ||
''(Note: In the following examples, [[Ellipsis|ellipses (groups of three dots)]] indicate where parameters have been omitted.)'' | ''(Note: In the following examples, [[Ellipsis|ellipses (groups of three dots)]] indicate where parameters have been omitted.)'' | ||
: {{tlx | : {{tlx|tlx|Template|''first parameter''|''second parameter''|''third''|...|''twentieth''}} produces: {{tlx|Template|''first parameter''|''second parameter''|''third''|...|''twentieth''}} | ||
Where parameters might contain one or more equals-signs ("="), replace each equals-sign with {{tlf|{{=}}}}: | Where parameters might contain one or more equals-signs ("="), replace each equals-sign with {{tlf|{{=}}}}: | ||
: {{tlx | : {{tlx|tlx|Template|''first''<nowiki>{{=}}</nowiki>''something''|''second''|''third''<nowiki>{{=}}</nowiki>''something''|...|twentieth}} produces: {{tlx|Template|''first{{=}}something''|''second''|''third{{=}}something''|...|''twentieth''}} | ||
For more than ten parameters, possibly also containing equals-signs, use | For more than ten parameters, possibly also containing equals-signs, use <nowiki>...</nowiki> thus: | ||
: {{tlx | : {{tlx|tlx|Template|<nowiki><nowiki>''first''|''second''|''third=something''|...|''999th''</nowiki></nowiki>}} produces: {{tlx|Template|<nowiki>first|second|third=something|...|999th</nowiki>}} | ||
== Purpose and naming == | == Purpose and naming == | ||
* If the only parameter supplied is {{ | * If the only parameter supplied is <nowiki>{{{1}}}</nowiki>, i.e. a template's name, {{tlx|tlx}}'s output is the same as {{tlx|tl}} – i.e. a link within [[Braces (punctuation)|braces]] – but in a [[monospaced font]]: | ||
** {{ | ** <nowiki>{{tl|tl}}</nowiki> produces: {{tl|tl}} | ||
** {{ | ** <nowiki>{{tlx|tl}}</nowiki> produces: {{tlx|tl}} | ||
: {{tlx|tl}} will also not take nor display additional parameters. | : {{tlx|tl}} will also not take nor display additional parameters. | ||
; Named parameters | ; Named parameters | ||
<nowiki>|subst</nowiki> | |||
: Setting this parameter to any non-blank value will prefix the string <code>subst:</code> linked to [[Help:Substitution]]. This is useful to indicate when a template should be substituted. For example, {{tlx | : Setting this parameter to any non-blank value will prefix the string <code>subst:</code> linked to [[Help:Substitution]]. This is useful to indicate when a template should be substituted. For example, {{tlx|tlx|Welcome|3=subst=Y}} produces: {{tlx|Welcome|subst=Y}}. This is similar to the action of the {{tlx|tlxs}} template: {{tlx|tlxs|Welcome}} produces: Welcome. | ||
<nowiki>|SISTER</nowiki> | |||
: For an interwiki link to [[H:IW|other sister projects]], such as: | : For an interwiki link to [[H:IW|other sister projects]], such as: <nowiki>|SISTER=M</nowiki>, <nowiki>|SISTER=Q</nowiki>, <nowiki>|SISTER=S</nowiki>, etc, facilitating interwiki template documentation and/or discussion. | ||
== Documentation == | == Documentation == | ||
{{tl|Tlx}} is a generalization of {{tl|tl|x}}, {{tl|tlp|x|y}} etc., with output that is arguably more legible. This depends on the browser, but narrow gaps between characters such as " | {{tl|Tlx}} is a generalization of {{tl|tl|x}}, {{tl|tlp|x|y}} 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 <code><nowiki>{{!}}</nowiki></code>, see {{tl|tlw}}, which makes the click target bigger). | ||
===Usage=== | ===Usage=== | ||
| 第47行: | 第44行: | ||
|row1style=background:whitesmoke;font-weight:bold; | |row1style=background:whitesmoke;font-weight:bold; | ||
| Code | Result | Remarks | | Code | Result | Remarks | ||
| {{tlx|tlx|x0}} | {{tlx | | {{tlx|tlx|x0}} | {{tlx|x0}} |   | ||
| {{tlx|tlx|Abc}} | {{tlx | | {{tlx|tlx|Abc}} | {{tlx|Abc}} |   | ||
| {{tlx|tlx|ABC}} | {{tlx | | {{tlx|tlx|ABC}} | {{tlx|ABC}} |   | ||
| {{tlx|tlx|AbC}} | {{tlx | | {{tlx|tlx|AbC}} | {{tlx|AbC}} |   | ||
| {{tlx|tlx|x1|one}} | {{tlx | | {{tlx|tlx|x1|one}} | {{tlx|x1|one}} |   | ||
| {{tlx|tlx|x2|one|two}} | {{tlx | | {{tlx|tlx|x2|one|two}} | {{tlx|x2|one|two}} |   | ||
<!--(Parameter number:)--> | <!--(Parameter number:)--> | ||
| {{tlx|tlx|x3|1|2|3|4|5|6|7|8|9|10}} | {{tlx | | {{tlx|tlx|x3|1|2|3|4|5|6|7|8|9|10}} | {{tlx|x3|1|2|3|4|5|6|7|8|9|10}} |   | ||
| {{tlx|tlx|x4|1|2|3|4|5|6|7|8|9|10|11}} | {{tlx | | {{tlx|tlx|x4|1|2|3|4|5|6|7|8|9|10|11}} | {{tlx|x4|1|2|3|4|5|6|7|8|9|10|11}} | up to 10 parameters... | ||
| {{tlx|tlx|x5|1|2|3|4|5|6|7|8|9|10&#124;11}} | {{tlx | | {{tlx|tlx|x5|1|2|3|4|5|6|7|8|9|10&#124;11}} | {{tlx|x5|1|2|3|4|5|6|7|8|9|10|11}} | {{align|right|...<code>&#124;</code> for more}} | ||
<!--(Equals-sign:)--> | <!--(Equals-sign:)--> | ||
| {{tlx|tlx|x1|x=u}} | {{tlx | | {{tlx|tlx|x1|x=u}} | {{tlx|x1|x=u}} | the straightforward equals-sign won't work... | ||
| {{tlx|tlx|x1|x&#61;u}} | {{tlx | | {{tlx|tlx|x1|x&#61;u}} | {{tlx|x1|x=u}} | {{align|right|...but <code>&#61;</code> is okay}} | ||
| {{tlx|tlx|x1|x<nowiki>{{=}}</nowiki>u}} | {{tlx | | {{tlx|tlx|x1|x<nowiki>{{=}}</nowiki>u}} | {{tlx|x1|x{{=}}u}} | {{align|right|...and <code><nowiki>{{=}}</nowiki></code> is okay}} | ||
| {{tlx|tlx|x1|<nowiki>x=u</nowiki>}} | {{tlx | | {{tlx|tlx|x1|<nowiki>x=u</nowiki>}} | {{tlx|x1|<nowiki>x=u</nowiki>}} | {{align|right|sticky nowiki also okay}} | ||
<!--(Empty/space/pipe:)--> | <!--(Empty/space/pipe:)--> | ||
| {{tlx|tlx|x2| |two}} | {{tlx | | {{tlx|tlx|x2| |two}} | {{tlx|x2| |two}} | empty won't work... | ||
| {{tlx|tlx|x2|&#32;|two}} | {{tlx | | {{tlx|tlx|x2|&#32;|two}} | {{tlx|x2| |two}} | {{align|right|...but <code>&#32;</code> is okay}} | ||
| {{tlx|tlx|x2|&nbsp;|two}} | {{tlx | | {{tlx|tlx|x2|&nbsp;|two}} | {{tlx|x2| |two}} | {{align|right|...<code>&nbsp;</code> is also okay}} | ||
| {{tlx|tlx|x2| | | {{tlx|tlx|x2|<nowiki><nowiki /></nowiki>|two}} | {{tlx|x2|<nowiki/>|two}} | {{align|right|<nowiki><nowiki /></nowiki> handles the space}} | ||
| {{tlx|tlx|x2| &#124; two}} | {{tlx | | {{tlx|tlx|x2| &#124; two}} | {{tlx|x2| | two}} | {{align|right|<code>&#124;</code> is okay}} | ||
| {{tlx|tlx|x2| {{!}} two}} | {{tlx | | {{tlx|tlx|x2| {{!}} two}} | {{tlx|x2 | {{!}} two}} | {{align|right|<nowiki>{{!}}</nowiki> is dubious}} | ||
| {{tlx|tlx|x2|<nowiki>2=</nowiki>|<nowiki>3=two</nowiki>}} | {{tlx | | {{tlx|tlx|x2|<nowiki>2=</nowiki>|<nowiki>3=two</nowiki>}} | {{tlx|x2|2=|3=two}} | empty really doesn't work | ||
| {{tlx|tlx|x2|<nowiki>2=one</nowiki>|two}} | {{tlx | | {{tlx|tlx|x2|<nowiki>2=one</nowiki>|two}} | {{tlx|x2|two}} | "two" overrides "2{{=}}one" | ||
| {{tlx|tlx|x2|<nowiki>3=two</nowiki>|<nowiki>2=one</nowiki>}} | {{tlx | | {{tlx|tlx|x2|<nowiki>3=two</nowiki>|<nowiki>2=one</nowiki>}} | {{tlx|x2|3=two|2=one}} | {{align|right|irregular parameter order is okay}} | ||
}} | }} | ||
; Unlimited parameters as one | ; Unlimited parameters as one <nowiki><nowiki>...</nowiki></nowiki> string | ||
: {{tlx | : {{tlx|tlx|convert|<nowiki><nowiki>14|m|ftin|abbr=out|sp=us</nowiki></nowiki>}} | ||
<!-- 本行下加入模板(Documentation)的分类 --> | <!-- 本行下加入模板(Documentation)的分类 --> | ||
2020年3月2日 (一) 17:18的版本
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}} | 模板:Align |
{{tlx|x1|x=u}} | {{x1}} | the straightforward equals-sign won't work... |
{{tlx|x1|x=u}} | {{x1|x=u}} | 模板:Align |
{{tlx|x1|x{{=}}u}} | {{x1|x=u}} | 模板:Align |
{{tlx|x1|<nowiki>x=u</nowiki>}} | {{x1|x=u}} | 模板:Align |
{{tlx|x2| |two}} | {{x2|two}} | empty won't work... |
{{tlx|x2| |two}} | {{x2| |two}} | 模板:Align |
{{tlx|x2| |two}} | {{x2| |two}} | 模板:Align |
{{tlx|x2|<nowiki />|two}} | {{x2||two}} | 模板:Align |
{{tlx|x2| | two}} | {{x2| | two}} | 模板:Align |
{{tlx|x2| {{!}} two}} | {{x2 | | two}} | 模板:Align |
{{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}} | 模板:Align |
- Unlimited parameters as one <nowiki>...</nowiki> string
{{tlx|convert|<nowiki>14|m|ftin|abbr=out|sp=us</nowiki>}}