Vorlage:Code/doc

This is [[MediaWiki:Tagline]]. Set to <code>display:none</code> by chameleon skin.
< Vorlage:Code
Version vom 11. Oktober 2014, 16:30 Uhr von mw>Oetterer (→‎See also)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu:Navigation, Suche

Description

This is a combination of the templates {{code}} and {{pre2}}. It allows for code coloring depending on programming language conventions (like {{code}}) and inherits {{pre2}}'s ability for creating a horizontal slider if necessary (and requested).

Parameters

1
lang
The language used for color coding. Consult extension syntaxhighlight's documentation for a list of supported programming languages
2
code
The actual code displayed in the box. Warning: If your code contains an equal sign (=), you have to specify the parameter name as either code= or 2=, otherwise the display of text will be botched up.
3
optional If you don't want a horizontal slider for long text, set this to no

Usage

{{code|bash|code=#!/bin/bash
mysql --defaults-file=/etc/mysql/debian.cnf}}

renders as

#!/bin/bash
mysql --defaults-file=/etc/mysql/debian.cnf


If you omit the paramater name (code=), thus writing

{{code|bash|#!/bin/bash
mysql --defaults-file=/etc/mysql/debian.cnf}}

your output will look like this:

sample text


See also

  • {{code snippet}} for short code text in sentences
  • {{pre}} for a pre box with line wraps
  • {{pre2}} for a pre box with horizontal slider
  • <pre>...</pre>