Difference between revisions of "Template:Syntax"
From James Dooley's Wiki
| Line 1: | Line 1: | ||
| − | {{#if: {{{2|}}}|'''Usage:'''|}}<div style="font-family: monospace,sans-serif; background-color:#F9F9F9; border: 1px solid #2F6FAB; overflow: auto; padding: 1em; word-wrap: break-word; {{{style|}}}">{{{1|}}}</div>{{#if: {{{2|}}}|<hr>'''Example:'''<div style="font-family: monospace,sans-serif; background-color:#F9F9F9; border: 1px solid #2F6FAB; overflow: auto; padding: 1em; word-wrap: break-word; {{{style|}}}"><div style=' | + | {{#if: {{{2|}}}|'''Usage:'''|}}<div style="font-family: monospace,sans-serif; background-color:#F9F9F9; border: 1px solid #2F6FAB; overflow: auto; padding: 1em; word-wrap: break-word; {{{style|}}}">{{{1|}}}</div>{{#if: {{{2|}}}|<hr>'''Example:'''<div style="font-family: monospace,sans-serif; background-color:#F9F9F9; border: 1px solid #2F6FAB; overflow: auto; padding: 1em; word-wrap: break-word; {{{style|}}}"><div style='-webkit-user-select: none; -moz-user-select: none; -ms-user-select: none;' >{{{2}}}</div></div>|}}<noinclude> |
==Overview== | ==Overview== | ||
This is a simple wrapper template for use with <nowiki><source></source></nowiki> since it does not provide any styles. | This is a simple wrapper template for use with <nowiki><source></source></nowiki> since it does not provide any styles. | ||
Latest revision as of 11:26, 9 May 2013
Contents
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
| 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