Template:FileBox/doc

From Gentoo Wiki
Jump to: navigation, 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.

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 | 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

Parameter name Required? Default value Description
Anonymous parameter 1 Yes (n/a) File content
filename Yes (n/a) File name to display in the box header
title No (n/a) Additional title to display in the box header
lang No text Language of the contents, used for syntax highlighting

(here is a list of available languages)

Usage

See the template's testcases:

No parameter
Wiki code {{FileBox}}

Main version
FILE {{{filename}}}
{{{1}}}
Sandbox version
FILE {{{filename}}}
{{{1}}}
Parameters: filename=/tmp/file, 1=Some text/code.
Wiki code {{FileBox|filename=/tmp/file|1=Some text/code.}}

Main version
FILE /tmp/file
Some text/code.
Sandbox version
FILE /tmp/file
Some text/code.
Parameters: title=FileBox example, 1=Some text/code.
Wiki code {{FileBox|title=FileBox example|1=Some text/code.}}

Main version
FILE {{{filename}}}FileBox example
Some text/code.
Sandbox version
FILE {{{filename}}}FileBox example
Some text/code.
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
FILE /tmp/fileFileBox example
Some text/code.
Sandbox version
FILE /tmp/fileFileBox example
Some text/code.
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
FILE /tmp/fileFileBox example
#!/bin/bash
echo "Hello, world!"
Sandbox version
FILE /tmp/fileFileBox example
#!/bin/bash
echo "Hello, world!"
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
FILE /tmp/fileFileBox example
#!/bin/bash
echo "Hello, world!"
echo "my third line"
echo "my fourth line"
Sandbox version
FILE /tmp/fileFileBox example
#!/bin/bash
echo "Hello, world!"
echo "my third line"
echo "my fourth line"

See also