Template:!

From Gentoo Wiki
Jump to: navigation, search
[edit

Documentation

Note
This page is a template. It contains some standardized, often used text, which can be transcluded inside other pages.

As this template is widely used in our wiki, it may be protected in which case only staff members can change it. Use the discussion page to propose enhancements or fixes, or to voice your opinion.

This template is used to insert a pipe (or vertical bar) character, |, in a template call where it would normally be interpreted as a parameter separator.

As shown in the test cases below, it can be used to pass to a template:

  1. a literal pipe character;
  2. a pipe character that the template can use to form a piped link;
  3. table wiki-markup containing one or more pipe characters.

In most cases where a literal pipe character is desired, it is better to use the HTML entity | instead (or the template {{!!}}, which outputs this entity), since this is displayed as a pipe character and will never be interpreted as wiki markup.

Note
Actually, this template has been deprecated by the addition, in MediaWiki version 1.24, of the "{{!}}" magic word. Because of this fact, nothing placed on the page Template:! has any effect on the result obtained by calling {{!}}, since the result is now "hardcoded" into the MediaWiki software itself. This means that template editors can no longer change the functionality of this template. Template users, however, can continue to use the template as they always have.

Parameters

None.

Usage

{{!}}

If this does not have the desired effect, try {{!!}} instead (which outputs the HTML entity | instead of the character |).

See the template's testcases:

Note: There is no sandbox version shown for this template because the effect of {{!}} cannot be changed.

Correct

Used alone
Wiki code
{{!}}
Main version
|
Sandbox version


↑ As seen in some of the examples below, the pipe character generated by this template call will be parsed as table markup if used in a table, or as a link pipe if passed to a template that forms a wikilink from its input. To get a literal pipe character in such cases, use {{!!}} instead.


Used in a template parameter to show a pipe character
Wiki code
{{cmd|mount {{!}} sort}}
Main version
user $mount | sort
Sandbox version


Used in a template parameter to create a piped link
Wiki code
{{confused|Project:LLVM{{!}}LLVM}}
Main version

Not to be confused with LLVM.

Sandbox version


↑ The {{confused}} template simply wraps its input inside of [[double-brackets]] to form a wikilink.


Used in a template parameter to allow for a piped link (more complicated example)
Wiki code
{{tl|RootCmd{{!}}<nowiki>{{RootCmd|umount /mnt/gentoo}}</nowiki>}}
Main version
Sandbox version


↑ Because the {{tl}} template forms a wikilink from its input (displaying it with surrounding double-braces), the code shown above is equivalent to [[Template:RootCmd|<nowiki>{{RootCmd|umount /mnt/gentoo}}</nowiki>]] (which might be better to use, as it is easier to understand than this template call). Note that this template call does not produce two sets of enclosing double-braces, as one may expect.


Used in a template parameter to be parsed as table wiki markup
Wiki code
{{noop|{{{!}} class{{=}}"wikitable"
{{!}} cell contents
{{!}}}
}}
Main version
cell contents
Sandbox version


↑ This example uses the {{noop}} template, the only active content of which is {{{1}}} (meaning its output is just its input with no additional processing). For more information, see a similar example at Wikimedia's Meta-Wiki and our own Help:Tables.

Incorrect

Anonymous parameter (no error, but not supported)
Wiki code
{{!|anything}}
Main version
|
Sandbox version


Used in a table, trying to display a pipe character (pipe is instead interpreted as table markup)
Wiki code
{| class="wikitable"
| this {{!}} that
|}
Main version
that
Sandbox version


↑ This would work as expected if {{!!}} were used in place of {{!}}. See that template's test cases.

See also

Note
The above documentation is transcluded from Template:!/doc. (edit | history)
Editors can experiment in this template's sandbox (create) and testcases (edit) pages.
Please add categories and interwikis to the /doc subpage. (See the subpages of this template.)