Help:Template: Difference between revisions

Content deleted Content added
m Reverted edits by Ser Amantio di Nicolao (talk) to last version by Tule-hog
Line 98:
** To specify an unnamed parameter including an equals sign (for example in a [[URL]] with [[name–value pair]]s), replace the equals sign with the [[mw:Help:Magic words#Other|magic word]] {{tlx|{{=}}}}, which expands to an equals sign that will not be interpreted.
** Another method is to explicitly specify the positional parameters. The first unnamed parameter is named "1" and so on. To call template {{tl|done}} with <code>a=b</code> as the literal value for the first parameter, type either <code><nowiki>{{done|a{{=}}b}}</nowiki></code> or <code><nowiki>{{done|1=a=b}}</nowiki></code>.
* {{anchor|Pipe}}Similarly, it is not possible to use an ordinary pipe character <code>&#124;</code> in a template parameter specification, as it would be interpreted as separating one parameter specification from another.{{efn|Again, this does not apply if it comes within another separately parsed item, such as a piped wikilink.}} This problem can similarly be solved by using the magic word {{tlx|!}} in place of the pipe, or—if the pipe is not intended to be parsed at a higher level—using the [[List of XML and HTML character entity references|HTML entity]] <code>&amp;#124;</code>. Alternatively, for embedding [[Help:Table|wikitables]] in templates, you may use {{tlx|Wikitable}} to avoid excessive {{tlx|!}}.
* Remember that whitespace characters (spaces, tabs, carriage returns, and line feeds) are not automatically stripped from the start and end of unnamed parameters, unlike with named parameters. Including such characters (or any other non-visible characters in any parameters) may in some cases affect the template's behavior in unexpected ways. (Template designers can use {{tl|Trim}} to remove unwanted whitespace in unnamed parameters).
* In documentation and discussions, it is customary to put the name of a template in double braces to emphasize the reference to a template (for example, use {{tl|Trim}} as the name of Template:Trim). If you just type <code><nowiki>{{Trim}}</nowiki></code> in the source page, that will of course call the template, so to make it easy to display the name with the braces, and also make the name a link to the template for the reader's convenience, there is the {{tl|tl}} template (the "'''t'''emplate '''l'''ink" template). For example, {{tnull|tl|Example}} produces {{tl|Example}}. There are various other [[Template:Template-linking templates|template-linking templates]] available with other functions.