Template:Txl/doc: Difference between revisions
| [checked revision] | [checked revision] |
Caleb Cooper (talk | contribs) Created page with "<includeonly>{{small |1=Note: This documentation for {{tlx|tlx}} is also transcluded by its derivatives {{tlx|tlxb}}, {{tlx|tlxc}} (<sp..." |
Caleb Cooper (talk | contribs) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
<includeonly>{{small |1=Note: This documentation for {{tlx|tlx}} is also [[Wikipedia:Template doc page pattern|transcluded]] by its derivatives {{tlx|tlxb}}, {{tlx|tlxc}} (<span class="plainlinks">[{{fullurl:Template:Tlx/doc |action=edit}} edit]</span>{{#ifeq:{{SITENAME}}|Meta |). |{{dot}}[[ |
<includeonly>{{small |1=Note: This documentation for {{tlx|tlx}} is also [[Wikipedia:Template doc page pattern|transcluded]] by its derivatives {{tlx|tlxb}}, {{tlx|tlxc}} (<span class="plainlinks">[{{fullurl:Template:Tlx/doc |action=edit}} edit]</span>{{#ifeq:{{SITENAME}}|Meta |). |{{dot}}[[Mediawikiwiki:template:{{PAGENAMEE}}|master page]]).}}<!--(end small:)-->}}</includeonly><noinclude>{{Documentation subpage}}{{clear}}</noinclude> |
||
{{#ifeq:{{BASEPAGENAME}}|Tlx |{{High-risk|2325910+}} {{Used in system}} }} |
{{#ifeq:{{BASEPAGENAME}}|Tlx |{{High-risk|2325910+}} {{Used in system}} }} |
||
| Line 5: | Line 5: | ||
==Basic use== |
==Basic use== |
||
''(Note: In the following examples, [[Ellipsis|ellipses (groups of three dots)]] indicate where parameters have been omitted.)'' |
''(Note: In the following examples, [[Wikipedia:Ellipsis|ellipses (groups of three dots)]] indicate where parameters have been omitted.)'' |
||
: {{tlx{{\sandbox}}|tlx|Template|''first parameter''|''second parameter''|''third parameter''|...|''tenth parameter''}} produces: {{tlx{{\sandbox}}|Template|''first parameter''|''second parameter''|''third parameter''|...|''tenth parameter''}} |
: {{tlx{{\sandbox}}|tlx|Template|''first parameter''|''second parameter''|''third parameter''|...|''tenth parameter''}} produces: {{tlx{{\sandbox}}|Template|''first parameter''|''second parameter''|''third parameter''|...|''tenth parameter''}} |
||
| Line 18: | Line 18: | ||
Mnemonically, ''template link expanded'' (after ''[[Template:tl|template link]]''). |
Mnemonically, ''template link expanded'' (after ''[[Template:tl|template link]]''). |
||
This template allows an example of calling a template, accompanied by one or more parameters<!-- ("pass parameters", i.e. [[Help:Pipe trick|pipe-tricked]] [[ |
This template allows an example of calling a template, accompanied by one or more parameters<!-- ("pass parameters", i.e. [[Wikipedia:Help:Pipe trick|pipe-tricked]] [[mediawikiwiki:Parameter#Parameters|parameters]])-->, to be displayed without also causing the template to be called. |
||
Up to 20 of the template's parameters (numbered or nowiki-keywords) may be displayed as placeholders, while more than over 20 parameters can be displayed using a coded vertical bar (pipe) symbol, as in <code>&#124;</code>. A keyword parameter can be used with equals code &#61; or <nowiki>{{=}}</nowiki> or in nowiki-text: "{{tag|nowiki|content=size=10}}" or all parameters as a string in "{{tag|nowiki|o}}" tags; see ''[[#Examples|Examples]]'' at bottom. For more details, see [[{{TALKPAGENAME}}|this talk]] page. If you use 21 or more parameters, all after the 20th will be replaced with a single {{para||...}} at the end of the parameter list. |
Up to 20 of the template's parameters (numbered or nowiki-keywords) may be displayed as placeholders, while more than over 20 parameters can be displayed using a coded vertical bar (pipe) symbol, as in <code>&#124;</code>. A keyword parameter can be used with equals code &#61; or <nowiki>{{=}}</nowiki> or in nowiki-text: "{{tag|nowiki|content=size=10}}" or all parameters as a string in "{{tag|nowiki|o}}" tags; see ''[[#Examples|Examples]]'' at bottom. For more details, see [[{{TALKPAGENAME}}|this talk]] page. If you use 21 or more parameters, all after the 20th will be replaced with a single {{para||...}} at the end of the parameter list. |
||
| Line 28: | Line 28: | ||
===Parameters=== |
===Parameters=== |
||
*If the only parameter supplied is {{param|1}}, 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]]: |
*If the only parameter supplied is {{param|1}}, i.e. a template's name, {{tlx|tlx}}'s output is the same as {{tlx|tl}} – i.e. a link within [[Wikipedia:Braces (punctuation)|braces]] – but in a [[Wikipedia:monospaced font|monospaced font]]: |
||
**{{tc|tl|tl}} produces: {{tl|tl}} |
**{{tc|tl|tl}} produces: {{tl|tl}} |
||
**{{tc|tlx|tl}} produces: {{tlx{{\sandbox}}|tl}} |
**{{tc|tlx|tl}} produces: {{tlx{{\sandbox}}|tl}} |
||
: {{tlx|tl}} will also not take nor display additional parameters. |
: {{tlx|tl}} will also not take nor display additional parameters. |
||
; Named parameters |
|||
{{para|subst}} |
|||
: 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{{\sandbox}}|tlx|Welcome|3=subst=Y}} produces: {{tlx{{\sandbox}}|Welcome|subst=Y}}. This is similar to the action of the {{tlx{{\sandbox}}|tlxs}} template: {{tlx{{\sandbox}}|tlxs|Welcome}} produces: {{tlxs|Welcome}}. |
|||
{{para|SISTER}} |
|||
: For an interwiki link to [[H:IW|other sister projects]], such as: {{para|SISTER|M:}} ([[m:|Meta]]), {{para|SISTER|Q:}} ([[q:|WikiQuote]]), {{para|SISTER|S:}} ([[s:|WikiSource]]), etc, facilitating interwiki template documentation and/or discussion. |
|||
{{para|LANG}} |
|||
: For a link to [[H:ILL|Wikipedias in other languages]], such as: {{para|LANG|de:}} ([[:de:|German]]), {{para|LANG|sv:}} ([[:sv:|Swedish]]), etc, facilitating cross-language 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 "{{thin space}}'''{'''{{thin space}}", "{{thin space}}'''|'''{{thin space}}", "{{thin space}}'''}'''{{thin space}}" 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). |
{{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 "{{thin space}}'''{'''{{thin space}}", "{{thin space}}'''|'''{{thin space}}", "{{thin space}}'''}'''{{thin space}}" 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). |
||
For documentation see wikipedia page [[wikipedia:Template:Txl]] |
|||
===Usage=== |
===Usage=== |
||
Latest revision as of 21:09, 24 October 2020
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 parameter|...|tenth parameter}}produces:{{Template:Example|first parameter|second parameter|third parameter|...|tenth parameter}}
When you want to indicate setting a value to one or more parameters, you would normally use the equals-sign ("="). This doesn't work here; instead use {{=}}, like so:
{{tlx|Template|first{{=}}first value|second|third{{=}}third value}}produces:{{Template:Example|first=first value|second|third=third value}}
For more than ten parameters – with or without equals-signs – instead wrap the entire list of parameters and their values in <nowiki>...</nowiki> tags. When you do, you don't need to replace equals-signs. For instance:
{{tlx|Template|<nowiki>''first''|''second''|''third=value''|...|''999th''</nowiki>}}produces:{{Template:Example|first|second|third=value|...|999th}}
Purpose and naming
Mnemonically, template link expanded (after template link).
This template allows an example of calling a template, accompanied by one or more parameters, to be displayed without also causing the template to be called.
Up to 20 of the template's parameters (numbered or nowiki-keywords) may be displayed as placeholders, while more than over 20 parameters can be displayed using a coded vertical bar (pipe) symbol, as in |. A keyword parameter can be used with equals code = or {{=}} or in nowiki-text: "<nowiki>size=10</nowiki>" or all parameters as a string in "<nowiki>" tags; see Examples at bottom. For more details, see this talk page. If you use 21 or more parameters, all after the 20th will be replaced with a single |... at the end of the parameter list.
- Exceptions
If the intended template lists numerous parameters, then perhaps this template should really not be used, and just hardcode the usage with <code><nowiki>. For example:
<code>.<nowiki>{{Anytemplate|arg1=23|size=250px|other parameters...}}</nowiki></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 <pre>...</pre>.
Parameters
- 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}}will also not take nor display additional parameters.
Documentation
{{Template:Template link expanded}} 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).
For documentation see wikipedia page wikipedia:Template:Txl
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
For examples see wikipedia page wikipedia:Template:Tx
TemplateData
TemplateData documentation used by VisualEditor and other tools
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Click here to see a monthly parameter usage report for this template based on this TemplateData.
TemplateData for Txl/doc Show example template usage without expanding the template itself. {{tnull}} is similar without linking the template.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
See also
For more detail see wikipedia page wikipedia:Template:Txl