Template:Syntax

From James Dooley's Wiki
Revision as of 11:15, 9 May 2013 by Smsldoo (talk | contribs)
Jump to: navigation, search

Overview

This is a simple wrapper template for use with <source></source> since it does not provide any styles. The same styles that are used on the <pre></pre> will be applied to a <div></div> tag

Usage

{{syntax
|style= Allows for style overrides
|<Code to put inside the div tag>}}

Please note that new lines will be processed as such, so you will want to put the template close at the very end of the code


Info icon.png
If the source has strange spacing it is likely due to the <pre> tags.

You can fix this by including enclose='div' in the <source>

Without enclose it may look like this:

Usage:
pvcreate ${drbd_backing_device}
vgcreate drbd-${purpose} ${drbd_backing_device}
 
lvcreate -L 4G drbd-${purpose} -n metadata
lvcreate -L 4G drbd-${purpose} -n data
lvextend -l +95%FREE /dev/drbd-${purpose}/data

Example:
pvcreate /dev/sdb1
vgcreate drbd-os /dev/sdb1
 
lvcreate -L 4G drbd-os -n metadata
lvcreate -L 4G drbd-os -n data
lvextend -l +95%FREE /dev/drbd-os/data

With enclose it will look like this:

Usage:
pvcreate ${drbd_backing_device}
vgcreate drbd-${purpose} ${drbd_backing_device}
 
lvcreate -L 4G drbd-${purpose} -n metadata
lvcreate -L 4G drbd-${purpose} -n data
lvextend -l +95%FREE /dev/drbd-${purpose}/data

Example:
pvcreate /dev/sdb1
vgcreate drbd-os /dev/sdb1
 
lvcreate -L 4G drbd-os -n metadata
lvcreate -L 4G drbd-os -n data
lvextend -l +95%FREE /dev/drbd-os/data


Example

{{syntax
|style=border-width:3px;
|<syntaxhighlight lang=bash>echo "test" | less</syntaxhighlight>}}
echo "test" | less

Example with usage

Providing a second line of code will put it inside the same block, this is useful if you are displaying the usage and then the example code


{{syntax
|style=border-width:3px;
|<syntaxhighlight lang=bash>echo $message | less</syntaxhighlight>
|<syntaxhighlight lang=bash>echo "test" | less</syntaxhighlight>}}
Usage:
echo $message |\
 less

Example:
echo "test" |\
 less