Template:FileBox: Difference between revisions
From HPC Wiki
No edit summary |
m (Protected "Template:FileBox" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly>{{PreBox|{{{1}}}|title=<strong><code style="border: none; background: none; color: #54487A; margin-right: .5em;">{{{filename}}}</code></strong><strong>{{{title|}}}</strong>|label= | <includeonly>{{PreBox|{{{1}}}|title=<strong><code style="border: none; background: none; color: #54487A; margin-right: .5em;">{{{filename}}}</code></strong><strong>{{{title|}}}</strong>|label=FILE|lang={{{lang|text}}}}}</includeonly><noinclude> | ||
{{Documentation}} | {{Documentation}} | ||
</noinclude> | </noinclude> |
Latest revision as of 09:56, 16 December 2016
[edit]
Documentation
Note
This page is a template. It contains some standardized, often used text, which can be transcluded inside other pages.
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 special characters (| or =) that break the MediaWiki templating system. You have these options to put the file contents (in order from preferred to rather-not-use) if you need to escape these characters:
File contents may contain special characters (| or =) that break the MediaWiki templating system. You have these options to put the file contents (in order from preferred to rather-not-use) if you need to escape these characters:
{{FileBox|1=contents}}
{{FileBox|<nowiki>contents</nowiki>}}
{{FileBox|<pre>contents</pre>}}
(Syntax highlighting is broken using this invocation!)
Parameters
Parameter name | Required? | Default value | Description |
---|---|---|---|
Anonymous parameter 1 |
Yes | (n/a) | File content |
filename |
No | (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 |
|
Sandbox version |
|
Parameters: filename=/tmp/file, 1=Some text/code. | |
---|---|
Wiki code | {{FileBox|filename=/tmp/file|1=Some text/code.}}
|
Main version |
|
Sandbox version |
|
Parameters: title=FileBox example, 1=Some text/code. | |
---|---|
Wiki code | {{FileBox|title=FileBox example|1=Some text/code.}}
|
Main version |
|
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 |
|
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 |
|
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. 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. Subpages of this template.