GeSHiCodeTag
Contents
geshi
GeSHiCodeTag was the best Syntax-Highlighter MeatROme could find .. I added a definition for CubeScript right away, but only now added the example. The definition will need to be updated with a lot of commands that have become available since that first implementation was done. (2008-04-06) But at least this gives us the opportunity to have nice syntax-highlighting for our very own script examples - appropriate highlighting!
2011 November, 1st: Luc4s has made an effort on updating the file - it has now been put to use. Kudos! You can see the in-use file here: CubeScript for GeSHI
Usage
There are two code tags that you can use:
- Simple Tag Format: <'languages'>source code here</'language'>
- Advanced Tag Format: <code ['language'|list] [n] >source code here</code>
Tag Examples
- simple code tag
<php> echo "Hello World"; </php>
- advanced code tag
<code php>
echo "Hello World";
</code>
- advanced code tag with line numbers
<code php n>
echo "Hello World";
</code>
- default code tag
<code>
echo "Hello World";
</code>
- display a list of supported languages
<code list></code>
- if invalid language argument, return the language list
<code invalid> echo "Hello World"; </code>
<source lang="php"> <?php $v = "string"; // sample initialization ?> html text <? echo $v; // end of php code ?> </source>
CubeScript Example
<source lang="cubescript"> name "unarmed" // change! loadcrosshair default.png // choose another crosshair, see packages/misc/crosshairs/ skin 0 // change your look autoreload 1 // reload the guns automatically alias primary [ weapon (currentprimary) ] alias secondary [ weapon 1 ] alias melee [ weapon 0 ] alias grenades [ weapon 6 ] //for alternative weapon binding (more economic) see the end of this file lighterror 4 //set higher (for example 8) if you experience slowdown alias altaction [ (concatword altaction_ (curweapon)) ] alias quicknadethrow [ alias prevweapon (curweapon) if (> (magcontent 6) 0) [ grenades attack ] [] onrelease [ sleep 1 [ weapon $prevweapon ] ] ] loop i 8 [ alias (concatword altaction_ $i) quicknadethrow ] // quick nade throw is default alias altaction_4 [ zoom 1; onrelease [ zoom 0 ] ] // sniper alias altaction_6 [ attack ] // grenade // NOTE: by default this zoom script just devides your sensitivity by 2 while you use the scope // if you want to set your own value for it, go to the following line and // replace (div $sensitivity 2) by your desired sensitivity value: alias scopesens (div $sensitivity 2) alias oldsens $sensitivity alias zoom [ if (= $arg1 1) [ if (= $sensitivity $scopesens) [] [ alias oldsens $sensitivity sensitivity $scopesens setscope 1 ] ] [ sensitivity $oldsens setscope 0 ] ] </source>
Results in:
name "unarmed" // change!
loadcrosshair default.png // choose another crosshair, see packages/misc/crosshairs/
skin 0 // change your look
autoreload 1 // reload the guns automatically
alias primary [ weapon (currentprimary) ]
alias secondary [ weapon 1 ]
alias melee [ weapon 0 ]
alias grenades [ weapon 6 ]
//for alternative weapon binding (more economic) see the end of this file
lighterror 4 //set higher (for example 8) if you experience slowdown
alias altaction [
(concatword altaction_ (curweapon))
]
alias quicknadethrow [
alias prevweapon (curweapon)
if (> (magcontent 6) 0) [
grenades
attack
] []
onrelease [ sleep 1 [ weapon $prevweapon ] ]
]
loop i 8 [ alias (concatword altaction_ $i) quicknadethrow ] // quick nade throw is default
alias altaction_4 [ zoom 1; onrelease [ zoom 0 ] ] // sniper
alias altaction_6 [ attack ] // grenade
// NOTE: by default this zoom script just devides your sensitivity by 2 while you use the scope
// if you want to set your own value for it, go to the following line and
// replace (div $sensitivity 2) by your desired sensitivity value:
alias scopesens (div $sensitivity 2)
alias oldsens $sensitivity
alias zoom [
if (= $arg1 1) [
if (= $sensitivity $scopesens) [] [
alias oldsens $sensitivity
sensitivity $scopesens
setscope 1
]
] [
sensitivity $oldsens
setscope 0
]
]
C# Example
<source lang="csharp"> // Hello World in Microsoft C# ("C-Sharp"). using System; class HelloWorld { public static int Main(String[] args) { Console.WriteLine("Hello, World!"); return 0; } } </source>
Results in:
// Hello World in Microsoft C# ("C-Sharp").
using System;
class HelloWorld
{
public static int Main(String[] args)
{
Console.WriteLine("Hello, World!");
return 0;
}
}