Difference between revisions of "Template:!/doc"

From Xen
(Created page with "{{Documentation subpage}} <!-- DO NOT move the "pp-template" to the template page since the ! template should be as short as possible to save server load (to not break template i…")
 
m
 
Line 17: Line 17:
 
=== Substitution ===
 
=== Substitution ===
 
It is possible to [[Wikipedia:Substitution|substitute]] <nowiki>{{!}}</nowiki> only if an unescaped "'''<code>|</code>'''" works as expected, i.e. after substituting the template containing <nowiki>{{!}}</nowiki>, or after eliminating an
 
It is possible to [[Wikipedia:Substitution|substitute]] <nowiki>{{!}}</nowiki> only if an unescaped "'''<code>|</code>'''" works as expected, i.e. after substituting the template containing <nowiki>{{!}}</nowiki>, or after eliminating an
[[mw:Help:Extension:ParserFunctions#.23if|#if]] containing <nowiki>{{!}}</nowiki>.
+
[[mediawikiwiki:Help:Extension:ParserFunctions#.23if|#if]] containing <nowiki>{{!}}</nowiki>.
   
 
=== A simple example ===
 
=== A simple example ===
   
 
The following template code for {{tl|Quotation}} using an ordinary pipe character,
 
The following template code for {{tl|Quotation}} using an ordinary pipe character,
* <code><nowiki>{{Quotation|It is not possible to use an ordinary pipe character | in template parameters, as it will be interpreted as a separator.|[[Help:Template#Usage hints and workarounds]]}}</nowiki></code>
+
* <code><nowiki>{{Quotation|It is not possible to use an ordinary pipe character | in template parameters, as it will be interpreted as a separator.|[[mediawikiwiki:Help:Template#Usage hints and workarounds]]}}</nowiki></code>
   
 
produces:
 
produces:
{{Quotation|It is not possible to use an ordinary pipe character | in template parameters, as it will be interpreted as a separator.|[[Help:Template#Usage hints and workarounds]]}}
+
{{Quotation|It is not possible to use an ordinary pipe character | in template parameters, as it will be interpreted as a separator.|[[mediawikiwiki:Help:Template#Usage hints and workarounds]]}}
   
 
whereas this code using the <nowiki>{{!}}</nowiki> meta-template,
 
whereas this code using the <nowiki>{{!}}</nowiki> meta-template,
* <code><nowiki>{{Quotation|It is not possible to use an ordinary pipe character {{!}} in template parameters, as it will be interpreted as a separator.|[[Help:Template#Usage hints and workarounds]]}}</nowiki></code>
+
* <code><nowiki>{{Quotation|It is not possible to use an ordinary pipe character {{!}} in template parameters, as it will be interpreted as a separator.|[[mediawikiwiki:Help:Template#Usage hints and workarounds]]}}</nowiki></code>
   
 
produces:
 
produces:
{{Quotation|It is not possible to use an ordinary pipe character {{!}} in template parameters, as it will be interpreted as a separator.|[[Help:Template#Usage hints and workarounds]]}}
+
{{Quotation|It is not possible to use an ordinary pipe character {{!}} in template parameters, as it will be interpreted as a separator.|[[mediawikiwiki:Help:Template#Usage hints and workarounds]]}}
   
 
=== See also ===
 
=== See also ===

Latest revision as of 10:27, 5 December 2011


Usage

This is the {{!}} meta-template. Its use is analogous to an escape character.

This is an auxiliary template allowing the encoding of "|" within template parameters, because the pipe character is normally interpreted as a separator. This template is necessary if the character is used in wiki table syntax, or if the parameter is automatically wikilinked and you wish to use a pipe to specify different link text from the target page name. In other cases it is better to use "&#124;".

This template cannot be used for putting the character as text in a wiki table; in that case, again, "&#124;" can be used.

Note that no special template is needed for "!" (exclamation mark).

This is a high-risk template, and it usually cannot be substituted (see conditions for substing on the section below).

Substitution

It is possible to substitute {{!}} only if an unescaped "|" works as expected, i.e. after substituting the template containing {{!}}, or after eliminating an #if containing {{!}}.

A simple example

The following template code for {{Quotation}} using an ordinary pipe character,

  • {{Quotation|It is not possible to use an ordinary pipe character | in template parameters, as it will be interpreted as a separator.|[[mediawikiwiki:Help:Template#Usage hints and workarounds]]}}

produces:

Quote.png It is not possible to use an ordinary pipe character

in template parameters, as it will be interpreted as a separator., mediawikiwiki:Help:Template#Usage hints and workarounds

whereas this code using the {{!}} meta-template,

  • {{Quotation|It is not possible to use an ordinary pipe character {{!}} in template parameters, as it will be interpreted as a separator.|[[mediawikiwiki:Help:Template#Usage hints and workarounds]]}}

produces:

Quote.png in template parameters, as it will be interpreted as a separator.

mediawikiwiki:Help:Template#Usage hints and workarounds

See also