Template:!/testcases

From Gentoo Wiki
Jump to: navigation, search
Note
This is the template test case page for Template:! and its sandbox version. You may have to purge this page to update the examples.

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.