Template:FileBox
From Gentoo Wiki
[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 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 a file contents, optionally providing syntax highlighting. A list of recognized languages for syntax highlighting can be found here.
Important
File contents may contain the special characters
File contents may contain the special characters
|
or =
which are incompatible with MediaWiki's templating system. Substitute |
with {{!}}
and =
with {{=}}
for arguments to the 1=
parameter for correct template usage. If substitution is ignored, then formatting will not work correctly with this template.Parameters
Displays a block element with a file contents, optionally providing syntax highlighting
Parameter | Description | Type | Status | |
---|---|---|---|---|
File Content | 1 | no description | Content | required |
Filename | filename | File name to display in the box header | String | required |
Title | title | Additional title to display in the box header | String | suggested |
Language | lang | Language of the contents, used for syntax highlighting
| String | optional |
Usage
See the template's testcases:
No parameter | |
---|---|
Wiki code | {{FileBox}}
|
Main version | {{{1}}}
|
Sandbox version |
|
Parameters: filename=/tmp/file, 1=Some text/code. | |
---|---|
Wiki code | {{FileBox|filename=/tmp/file|1=Some text/code.}}
|
Main version | Some text/code.
|
Sandbox version |
|
Parameters: title=FileBox example, 1=Some text/code. | |
---|---|
Wiki code | {{FileBox|title=FileBox example|1=Some text/code.}}
|
Main version | Some text/code.
|
Sandbox version |
|
Parameters: title=FileBox example, filename=/tmp/file, 1=Some text/code. | |
---|---|
Wiki code | {{FileBox|title=FileBox example|filename=/tmp/file|1=Some text/code.}}
|
Main version | Some text/code.
|
Sandbox version |
|
Parameters: title=FileBox example, filename=/tmp/file, lang=bash, 1=#!/bin/bash echo "Hello, world!" | |
---|---|
Wiki code | {{FileBox|title=FileBox example|filename=/tmp/file|lang=bash|1=#!/bin/bash
echo "Hello, world!"
}}
|
Main version | #!/bin/bash
echo "Hello, world!"
|
Sandbox version |
|
Parameters: title=FileBox example, filename=/tmp/file, lang=bash, collapse-output=true, 1=#!/bin/bash echo "Hello, world!" | |
---|---|
Wiki code | {{FileBox|title=FileBox example|filename=/tmp/file|collapse-output=true|lang=bash|1=#!/bin/bash
echo "Hello, world!"
echo "my third line"
echo "my fourth line"
}}
|
Main version | #!/bin/bash
echo "Hello, world!"
echo "my third line"
echo "my fourth line"
|
Sandbox version |
|
See also
Note
The above documentation is transcluded from Template:FileBox/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.)
The above documentation is transcluded from Template:FileBox/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.)