r2162 - initial RackCode syntax highlight by means of CodePress
authorDenis Ovsienko <infrastation@yandex.ru>
Thu, 21 Aug 2008 14:10:20 +0000 (14:10 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Thu, 21 Aug 2008 14:10:20 +0000 (14:10 +0000)
inc/interface.php
js/codepress/codepress.js
js/codepress/languages/rackcode.css [new file with mode: 0644]
js/codepress/languages/rackcode.js [new file with mode: 0644]

index 46fb28d890ffb93e5d4555fd8d9aeac698ccf981..05d6cb3fd30d5cd622789297d40ce2ccd06d60f8 100644 (file)
@@ -5002,7 +5002,7 @@ function renderRackCodeEditor ()
        showMessageOrError();
        printOpFormIntro ('saveRackCode');
        echo '<table border=0 align=center>';
-       echo "<tr><td><textarea rows=40 cols=100 name=rackcode id=RCTA class='codepress text'>";
+       echo "<tr><td><textarea rows=40 cols=100 name=rackcode id=RCTA class='codepress rackcode'>";
        echo $text . "</textarea></td></tr>\n";
        echo "<tr><td align=center>";
        echo "<input type='submit' value='Proceed' onclick='RCTA.toggleEditor();'>";
index 96ea2e3995097756edd01504f571e127e47842e8..6b9914eb3266f6bee783c6ce4fda8b9553598ba4 100644 (file)
@@ -112,7 +112,8 @@ CodePress.languages = {
        php : 'PHP', \r
        text : 'Text', \r
        sql : 'SQL',\r
-       vbscript : 'VBScript'\r
+       vbscript : 'VBScript',\r
+       rackcode : 'RackCode'\r
 }\r
 \r
 \r
diff --git a/js/codepress/languages/rackcode.css b/js/codepress/languages/rackcode.css
new file mode 100644 (file)
index 0000000..ea57eb1
--- /dev/null
@@ -0,0 +1,3 @@
+b {color:#7F0055;font-weight:bold;font-style:normal;} /* keywords */
+i, i b, i s {color:gray;font-weight:normal;} /* comments */
+s, s b {color:green;font-weight:normal;} /* tags and predicates */
diff --git a/js/codepress/languages/rackcode.js b/js/codepress/languages/rackcode.js
new file mode 100644 (file)
index 0000000..cbaba6c
--- /dev/null
@@ -0,0 +1,9 @@
+Language.snippets = []
+Language.complete = []
+Language.shortcuts = []
+Language.syntax = [
+       { input : /{(.*?)(}|<br>|<\/P>)/g, output : '<s>{$1$2</s>'}, // tags
+       { input : /\[(.*?)(\]|<br>|<\/P>)/g, output : '<s>[$1$2</s>'}, // predicatess
+       { input : /\b(define|allow|deny|and|not|or)\b/g, output : '<b>$1</b>'}, // keywords
+       { input : /([^:]|^)#(.*?)(<br|<\/P)/g, output : '$1<i>#$2</i>$3'} // comments //        
+]