PerfSONAR Wiki Syntax Highlighting
From GEANT2-JRA1 Wiki
Contents |
[edit]
Usage
- Script for syntax highlighting: http://mercury.it.swin.edu.au/swinbrain/index.php/CodeSyntaxHighlight_MediaWiki_Extension
- more editing help on: http://mercury.it.swin.edu.au/swinbrain/index.php/Help:Editing
<code>[java,N,10]
public class X {
int i;
}
</code>
Where [language,line_no_on (Y/N),line_no_start].
- language - programming language/script
- line_no_on - line numbering - Y-yes, N-no
- line_no_start - initial line number
The default for line_no_on is Y, and line_no_start is 1, so we can just write a simple
[edit]
Examples
[edit]
Java
- Put code inside <code>[java,N] ... </code>
public class abc { int a; public geta() { return a; } }
- with line numbering (from 20)
public class abc { int a; public geta() { return a; } }
[edit]
XML
- Put code inside <code>[xml,N] ... </code>
<nmwg:message type="LSDeregisterRequest" id="msg1" xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"> <nmwg:metadata id="key_to_remove"> <nmwg:key> <nmwg:parameters id="keys"> <nmwg:parameter name="lsKey">http://reed.man.poznan.pl:8080/axis/services/MA</nmwg:parameter> </nmwg:parameters> </nmwg:key> </nmwg:metadata> <nmwg:data/> </nmwg:message>
[edit]
Python
- Put code inside <code>[python,N] ... </code>
def quicksort(list, start, end): if start < end: # If there are two or more elements... split = partition(list, start, end) # ... partition the sublist... quicksort(list, start, split-1) # ... and sort both halves. quicksort(list, split+1, end) else: return
[edit]
Perl
- Put code inside <code>[perl,N] ... </code>
# guarantee stability, regardless of algorithm use sort 'stable'; @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old;
[edit]
SQL
- Put code inside <code>[sql,N] ... </code>
CREATE TABLE a ( id INT PRIMARY KEY, value VARCHAR(255) ); INSERT INTO a VALUES (1,"first"); INSERT INTO a VALUES (2,"second"); SELECT * FROM a;
[edit]
HTML
- Put code inside <code>[html,N] ... </code>
<html> <head> <title>abc</title> </head> <body> <h1>Header</h1> <p>content</p> </body> </html>
[edit]
Bash
#!/bin/bash echo "Convert aaa to bbb" echo "from file $1 to file $2" sed -e "s/aaa/bbb/g" $1 > $2
[edit]
Other
Supported lanaguages are:
- bash,
- c,
- cpp,
- csharp,
- css,
- delphi,
- dos,
- html,
- java,
- javascript,
- js,
- pascal,
- perl,
- php,
- pseudocode,
- python,
- sql,
- vb,
- vbnet,
- xhtml,
- xml,
- and maybe some other - depending on GeShI script and CodeSyntaxHighlight extension
