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

Content deleted Content added
Sardanaphalus (talk | contribs)
category
Wikify table; transparent background to highlight code
Line 71:
=== 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
|-
<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|||three|four}} <td>|| {{tlsc|name|||three|four}} <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>| {{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 class="wikitable">
<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|||three|four}} <td>{{tlsc|name|||three|four}} <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>{{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>.