Template:PreBox/doc
From Gentoo Wiki
Jump to:navigation
Jump to:search
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 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.
Displays a block element with for use with the following child templates: {{CodeBox}}, {{FileBox}}, and {{KernelBox}}.
Important
The contents may contain special characters (
The contents may contain special characters (
|
or =
) that break the MediaWiki templating system. The following options are available to put the contents should the need arise to escape these characters:
{{PreBox|1=contents}}
{{PreBox|1=<nowiki>contents</nowiki>}}
{{PreBox|1=<pre>contents</pre>}}
Known problems
Example | Wiki code | How it looks | Possible solution |
---|---|---|---|
<pre> inside boxes will render '"`UNIQ--pre-000000XX-QINU`"'
|
{{#tag:syntaxhighlight|<pre>echo "Hello, world!"</pre>|lang=bash}} |
'"`UNIQ--pre-0000000B-QINU`"'
|
Don't use <pre> tags. |
<source> inside boxes will render '"`UNIQ--source-000000XX-QINU`"'
|
{{#tag:syntaxhighlight|<source type="git">bla-bla</source>|lang=xml}} |
'"`UNIQ--source-00000011-QINU`"'
|
If meant to be used in XML, then use <<nowiki />source> , otherwise the source tag is deprecated
|
if <> symbols inside boxes and <nowiki> is used than <> will be replaced with < > | {{#tag:syntaxhighlight|<nowiki ><></nowiki>|lang=text}} |
<>
|
Don't use lang parameter. Or don't use <nowiki> and replace all | with {{!}} |
Parameters
Parameter name | Required? | Default value | Description |
---|---|---|---|
Anonymous parameter 1 |
Yes | (n/a) | Kernel configuration. |
title |
No | (n/a) | Display's a title in the box header. Although not required when this template is called directly, this parameter is always set by the downstream consumers: CodeBox, FileBox, or KernelBox. |
Usage
See the template's testcases:
Unnamed parameter with value foo | |
---|---|
Wiki code | {{PreBox|foo}}
|
Main version | foo
|
Sandbox version |
|
Named parameter title, unnamed parameter with value foo | |
---|---|
Wiki code | {{PreBox|title=bar|foo}}
|
Main version | foo
|
Sandbox version |
|
title=bar, collapse-output=true, unnamed parameter with value foo | |
---|---|
Wiki code | {{PreBox|title=bar|collapse-output=true|foo}}
|
Main version | foo
|
Sandbox version |
|
title=bar, collapse-output=true, multi-line unnamed parameter with value "foo\nfuton\nfoo-fighters" | |
---|---|
Wiki code | {{PreBox|title=bar|collapse-output=true|foo
\nfuton
\nfoo-fighters
}}
|
Main version | foo
futon
foo-fighters
|
Sandbox version |
|
title=bar, collapse-output=true, multi-line unnamed parameter passed as 1= with the values of "foo\nfuton\nfoo-fighters" | |
---|---|
Wiki code | {{PreBox|title=bar|collapse-output=true|1=foo
\nfuton
\nfoo-fighters
}}
|
Main version | foo
futon
foo-fighters
|
Sandbox version |
|
language test | |
---|---|
Wiki code | {{PreBox|title=bash syntax|lang=bash|1=src_install() {
\n local foo=$bar
\n default
\n}
\nexec /bin/init
}}
|
Main version | src_install() {
local foo=$bar
default
}
exec /bin/init
|
Sandbox version |
|