Template:Template link code with subst/doc: Difference between revisions

Content deleted Content added
EleoTager (talk | contribs)
m HouseBlaster moved page Template:Tlsc/doc to Template:Template link code with subst/doc: expand template name per WP:TPN
 
(8 intermediate revisions by 8 users not shown)
Line 1:
{{Documentation subpage}}
{{High-use}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
This is the '''{{tlc|tlsc}}''' template.
 
This page also provides the full documentation for the templates '''{{tlx|tlsd}}''' andtemplate '''{{tlx|tlsf}}''', which workworks almost exactly identically.
 
== Purpose and naming ==
 
When a template name with braces is to be shown in documentation, the braces have to be escaped in some way so it doesn't become an actual call to the template. Instead of using <code>&lt;nowiki&gt;&lt;/nowiki&gt;</code> tags you can write it more simply and concisely by using the {{tlc|tlsc}}, {{tlc|tlsd}}, or {{tlc|tlsf}} templates.
 
These templates work similarly to {{tlc|tls}} and {{tlc|tlsp}}, but don't make the template name into a link. When writing documentation you might want to avoid a lot of unnecessary links, since they can decrease readability. So on the first occurrence of a template name use {{tlx|tls}} or {{tlx|tlsp}}, and then use {{tlc|tlsc}}, {{tlc|tlsd}} or {{tlc|tlsf}} thereafter.
{| class="wikitable"
Line 20 ⟶ 21:
| {{tlc|tlsc}}
| '''T'''emplate '''l'''ink '''s'''ubstitution '''c'''ode
| Uses the <code><nowiki><code>...</code></nowiki></code> tags meant for showing programming code. Essentially the non-linking equivalent of {{tlx|tlsx}}.
|-
| {{tlc|tlsd}}
| '''T'''emplate '''l'''ink '''s'''ubstitution '''d'''ialup-host
| Uses the <code><nowiki><tt>...</tt></nowiki></code> tags sometimes used for showing programming code. Essentially the non-linking equivalent of {{tlx|tlsx}}.
|-
| {{tlc|tlsf}}
Line 31 ⟶ 28:
|}
 
The three names were based on {{tlx|tls}} '''t'''emplate '''s'''ubstitution '''l'''ink', despite the fact that, unlike the actual {{tlc|tls}} template, these three don't include an actual link. The mnemonics for {{tlc|tlsd}} and {{tlc|tlsf}} werewas invented after the fact, since the template creator used the single letters still available rather than the preferred {{tlc|tlt}} (using <nowiki><ttcode></nowiki>) and {{tlc|tln}} (using "normal", non-coded text style) monikers.
 
===Basic operation===
Line 38 ⟶ 35:
 
:{{tlc|tlsc|name|parameters}} = {{tlsc|name|parameters}}
:{{tlc|tlsd|name|parameters}} = {{tlsd|name|parameters}}
:{{tlc|tlsf|name|parameters}} = {{tlsf|name|parameters}}
 
Line 55 ⟶ 51:
* This template takes another ''template-name'' and some associated [[Help:Pipe trick|pipe-tricked]] [[m:Parameter#Parameters|(numbered) parameters]] (or 'pass parameters'), and displays them as an 'example demonstration' of how the ''template-name'' template could be coded, literally. Its primary use is in instruction and documentation.
*Specifics here??? <!-- Coding details, other parameters (SUBST?), other notes? Cf. [[Template:Tlx]] -->
*Features of {{tlc|tlsc}}, {{tlc|tlsd}} and {{tlc|tlsf}}:
** They show the "subst:" needed in order to substitute a template.
** They show a template name and up to eight parameters.
Line 71 ⟶ 67:
=== Examples ===
 
{| class="wikitable" style="background: transparent"
Note: Wikitables make the <code>&lt;code&gt;&lt;/code&gt;</code> tags transparent, unfortunately, so the "<code>code colouring</code>" is missing in these examples.
<tr><th>! Code<th> !! Result<th> !! Comment
 
|-
<table class="wikitable">
<tr><td>| {{tlc|tlsc}} <td>|| {{tlsc}} <td>|| Shows its own syntax.
<tr><th>Code<th>Result<th>Comment
|-
<tr><td>{{tlc|tlsc}} <td>{{tlsc}} <td>Shows its own syntax.
<tr><td>| {{tlc|tlsc|name}} <td>|| {{tlsc|name}} <td>||
|-
<tr><td>{{tlc|tlsc|name|one}} <td>{{tlsc|name|one}} <td>
<tr><td>| {{tlc|tlsc|name|one|two}} <td>|| {{tlsc|name|one|two}} <td>||
|-
<tr><td><code><nowiki>{{{tlsc|name|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u}}</nowiki></code> <td>{{tlsc|name|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u}} </td>Shows up to 16 parameters. The rest are dropped.
<tr><td>| {{tlc|tlsc|name|one||three|fourtwo}} <td>|| {{tlsc|name|one||three|fourtwo}} <td>Also shows empty|| parameters.
|-
<tr><td>{{tlc|tlsc|name|||three||}} <td>{{tlsc|name|||three||}} <td>Even shows empty parameters that come in the end.
<tr><td>| <code><nowiki>{{{tlsc|name|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u}}</nowiki></code> <td>|| {{tlsc|name|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u}} </td>|| Shows up to 16 parameters. The rest are dropped.
 
|-
<tr><td>{{tlc|tlsc|name|3=one=a|4=two=b}} <td>{{tlsc|name|one=a|two=b}} <td>The use of equals signs is a problem, but there is a fix; see next row.
| {{tlc|tlsc|name|||three|four}} || {{tlsc|name|||three|four}} || Also shows empty parameters.
<tr><td>{{tlc|tlsc|name|3=2=one=a|4=3=two=b}} <td>{{tlsc|name|2=one=a|3=two=b}} <td>Use numbered parameters to fix the problem with equals signs. Remember to start from 2, since the "name" is number 1.
|-
<tr><td>| {{tlc|tlsc|name|||three||}} <td>|| {{tlsc|name|||three||}} <td>|| Even shows empty parameters that come in the end.
|-
<tr><td>| {{tlc|tlsc|name|3=one=a|4=two=b}} <td>|| {{tlsc|name|one=a|two=b}} <td>|| The use of equals signs is a problem, but there is a fix; see next row.
|-
<tr><td>| {{tlc|tlsc|name|3=2=one=a|4=3=two=b}} <td>|| {{tlsc|name|2=one=a|3=two=b}} <td>|| Use numbered parameters to fix the problem with equals signs. Remember to start from 2, since the "name" is number 1.
|}
 
</table>
* '''''Exceptions:''''' If the intended template lists numerous/keyword parameters, then perhaps this template should really ''not'' be used, and just hardcode the usage with <code><nowiki>&lt;code&gt;&lt;nowiki&gt;</nowiki></code>, for example: <code><nowiki>&lt;code&gt;&lt;nowiki&gt;{{Anytemplate|arg1=23|size=250px|</nowiki><var>other parameters...</var><nowiki>}}&lt;/nowiki&gt;&lt;/code&gt;</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 <code><nowiki><pre>...</pre></nowiki></code>.
 
Line 93 ⟶ 95:
:<code><nowiki>&lt;nowiki&gt;{{subst:name|one=a|two=b}}&lt;/nowiki&gt;</nowiki></code> = <nowiki>{{subst:name|one=a|two=b}}</nowiki>
 
:<code><nowiki>&lt;tt&gt;&lt;nowiki&gt;{{subst:name|one=a|two=b}}&lt;/nowiki&gt;&lt;/tt&gt;</nowiki></code> = <ttcode><nowiki>{{subst:name|one=a|two=b}}</nowiki></ttcode>
 
:<code><nowiki>&lt;code&gt;&lt;nowiki&gt;{{subst:name|one=a|two=b}}&lt;/nowiki&gt;&lt;/code&gt;</nowiki></code> = <code><nowiki>{{subst:name|one=a|two=b}}</nowiki></code>
Line 100 ⟶ 102:
 
* {{tl|tlsc}} – Not linked, several parameters and text in <code>&lt;code&gt;&lt;/code&gt;</code> style.
* {{tl|tlsd}} – Not linked, several parameters and <tt>teletype</tt> text style.
* {{tl|tlsf}} – Not linked, several parameters and normal text style.
 
* {{tl|tls}} – Template link, no parameters and normal text style.
* {{tl|tlsp}} – Template link, several parameters and interwiki links.
* {{tl|tlsx}} – Template link, several parameters and interwiki links, <ttcode>teletype</ttcode> text style.
 
 
<includeonly>{{Sandbox other||
<!-- ADD CATEGORIES AND INTERWIKIS BELOW THIS LINE, PLEASE: -->
[[Category:TypingInternal template-aidlink templates|{{PAGENAME}}]]
[[Category:Wikitext typing-aid templates]]
 
[[sl:Predloga:Tlsc]]
}}</includeonly>