Template:PreBox

From Gentoo Wiki
Jump to:navigation Jump to:search
{{{title}}}
{{{1}}}
[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.

Displays a block element with for use with the following child templates: {{CodeBox}}, {{FileBox}}, and {{KernelBox}}.

Important
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:
  1. {{PreBox|1=contents}}
  2. {{PreBox|1=<nowiki>contents</nowiki>}}
  3. {{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-0000000D-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 &lt &gt
{{#tag:syntaxhighlight|<nowiki ><></nowiki>|lang=text}}
&lt;&gt;
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
{{{title}}}
foo
Sandbox version
{{{title}}}
foo


Named parameter title, unnamed parameter with value foo
Wiki code {{PreBox|title=bar|foo}}

Main version
bar
foo
Sandbox version
bar
foo


title=bar, collapse-output=true, unnamed parameter with value foo
Wiki code {{PreBox|title=bar|collapse-output=true|foo}}

Main version
bar
foo
Sandbox version
bar
foo


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
bar
foo
futon
foo-fighters
Sandbox version
bar
foo
futon
foo-fighters


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
bar
foo
futon
foo-fighters
Sandbox version
bar
foo
futon
foo-fighters


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
bash syntax
src_install() {
  local foo=$bar
  default
}
exec /bin/init
Sandbox version
bash syntax
src_install() {
  local foo=$bar
  default
}
exec /bin/init


See also

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