Anonymous

Template:Tlx/doc: Difference between revisions

From Jenny Everywhere Wiki
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
{{tlx|tlx}} — an acronym for '''template link expanded''' — is a sort of more useful sister to {{tlx|tl}}.  It allows you do demonstrate templates more fully, by letting you show not just the template name, but ''also the parameters''.  It's almost always preferable to use {{tlx|tlx}} than {{tlx|tl}} — even when you're ''not'' demonstrating parameters — because it automatically converts to a highly readable monospaced font.  
{{tlx|tlx}} — an acronym for '''template link expanded''' — is a sort of more useful sister to {{tlx|tl}}.  It allows you do demonstrate templates more fully, by letting you show not just the template name, but ''also the parameters''.  It's almost always preferable to use {{tlx|tlx}} than {{tlx|tl}} — even when you're ''not'' demonstrating parameters — because it automatically converts to a highly readable monospaced font.  
Although our template pages automatically display mono-spaced fonts, no other commonly-used namespace does.  Look at the difference in display:
:<span style=font-family:sans-serif>
* This uses {{tlx|tl}}: {{Tl|Tl}}
* This uses {{tlx|tlx}}: {{Tlx|Tl}} </span>
   
   
Clearly, {{tlx|tlx}} is much more readable.  That's not to say there are no uses for {{tlx|tl}}, but {{tlx|tlx}} is often the clearest thing.  And, perhaps more importantly, it's the only one of the two that will allow the demonstration of parameters.   
== Details ==
== Details ==
* This template takes another ''template-name'' and some associated [[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.
* This template takes another ''template-name'' and some associated [[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:''''' Up to 10 pass parameters (numbered or nowiki-keywords) for the specified template are displayed as 'placeholders', and over 10 parameters can be displayed using a coded vertical-bar (as in "<small>&amp;#124;</small>''...''"). A keyword parameter can be used with equals code &amp;#61; or <nowiki>{{=}}</nowiki> or in nowiki-text: "&lt;nowiki>size=10&lt;/nowiki>" or all parameters as a string in <nowiki>"<nowiki>"</nowiki> tags; see ''[[#Examples|Examples]]'' at bottom. For more details, see [[{{TALKPAGENAME}}|this talk]] page.
* '''''Specifics:''''' Up to 10 pass parameters (numbered or nowiki-keywords) for the specified template are displayed as 'placeholders', and over 10 parameters can be displayed using a coded vertical-bar (as in "<small>&amp;#124;</small>''...''"). A keyword parameter can be used with equals code &amp;#61; or <nowiki>{{=}}</nowiki> or in nowiki-text: "&lt;nowiki>size=10&lt;/nowiki>" or all parameters as a string in <nowiki>"<nowiki>"</nowiki> tags; see ''[[#Examples|Examples]]'' at bottom. For more details, see [[{{TALKPAGENAME}}|this talk]] page.
* '''''Exceptions:''''' If the intended template lists numerous parameters, then perhaps this template should really ''not'' be used, and just hardcode the usage with {{nowrap|<code><nowiki>&lt;code&gt;&lt;nowiki&gt;</nowiki></code>}}, for example: {{nowrap|<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 {{nowrap|<code><nowiki><pre>...</pre></nowiki></code>}}.
* '''''Exceptions:''''' If the intended template lists numerous parameters, then perhaps this template should really ''not'' be used, and just hardcode the usage with {{nowrap|<code><nowiki>&lt;code&gt;&lt;nowiki&gt;</nowiki></code>}}, for example: {{nowrap|<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 {{nowrap|<code><nowiki><pre>...</pre></nowiki></code>}}.
* If given no additional parameters except ''<code>&nbsp;'template&nbsp;name'&nbsp;(<nowiki>{{{1}}}</nowiki>), </code>''&nbsp;it presents the same as the similar {{tl|Tl}} [[macro]] template -- a blue link nested in [[brackets|curly-braces]]-- the same as a user would apply the template without parameters, but with a noticably clearer font and spacing on most modern browsers.
:* <span style=font-family:sans-serif>{{Tlx|Tl|Tl}} display compared to {{Tlx|Tlx|Tl}}: (Tl: {{Tl|Tl}} versus Tlx: {{Tlx|Tl}})</span>
* Comparatively, {{Tlx|Tl}} will not take or display additional parameters, and for minor technical reasons, may be preferred for mere listing and referencing in long pages involving a lot of template expansions.
* Comparatively, {{Tlx|Tl}} will not take or display additional parameters, and for minor technical reasons, may be preferred for mere listing and referencing in long pages involving a lot of template expansions.
* {{tlx|Tlx}} has a named parameter ''subst''. Setting this parameter to any string of length 1 or greater will place the string "subst:" before the template name, linked to {{w|Help:Substitution}}. This is useful to indicate when a template should be substituted. For example {{tlx|Tlx|Welcome|<nowiki>subst=Y</nowiki>}} will display {{Tlx|Welcome|subst=Y}}.
* {{tlx|Tlx}} has a named parameter ''subst''. Setting this parameter to any string of length 1 or greater will place the string "subst:" before the template name, linked to {{w|Help:Substitution}}. This is useful to indicate when a template should be substituted. For example {{tlx|Tlx|Welcome|<nowiki>subst=Y</nowiki>}} will display {{Tlx|Welcome|subst=Y}}.
68,355

edits