Permalink
Browse files

Added PROPPER highlighting.

  • Loading branch information...
Licenser committed May 20, 2010
1 parent 70cf19b commit 441af377f233baa6914f0f951ab85568f5996778
View
@@ -6,6 +6,7 @@
[ring/ring-jetty-adapter "0.2.0"]
[commons-lang/commons-lang "2.5"]
[clj-sandbox "0.3.7"]
[clj-highlight "0.1.0-SNAPSHOT"]
[hiccup "0.2.3"]
[clj-gist "1.0.0-SNAPSHOT"]]
:dev-dependencies [[swank-clojure "1.2.1"]
@@ -49,3 +49,126 @@ div.console div.jquery-console-message-success
{ color:#187718; font-family:monospace;
padding:0.1em; }
div.console span.jquery-console-prompt-label { font-weight:bold }
/* Coderay alpha style */
.code {
background-color: #f8f8f8;
border: 1px solid silver;
/* font-family: 'Courier New', 'Terminal', monospace; */
color: #000;
}
.code pre { margin: 0px; }
span.code { white-space: pre; border: 0px; padding: 2px; }
table.code { border-collapse: collapse; width: 100%; padding: 2px; }
table.code td { padding: 2px 4px; vertical-align: top; }
.code .line_numbers, .code .no {
background-color: #def;
color: gray;
text-align: right;
}
.code .line_numbers a:target, .code .no a:target { color: blue; }
.code .line_numbers .highlighted, .code .no .highlighted { color: red; }
.code .no { padding: 0px 4px; }
.code .code { width: 100%; }
.code .code pre { overflow: auto; }
.debug { color:white ! important; background:blue ! important; }
.an { color:#007 }
.at { color:#f08 }
.av { color:#700 }
.bi { color:#509; font-weight:bold }
.c { color:#888; }
.c .dl { color:#444; }
.c .ch { color:#444; }
.ch { color:#04D }
.ch .k { color:#04D }
.ch .dl { color:#039 }
.cl { color:#B06; font-weight:bold }
.cm { color:#A08; font-weight:bold }
.co { color:#036; font-weight:bold }
.cr { color:#0A0 }
.cv { color:#369 }
.de { color:#B0B; }
.df { color:#099; font-weight:bold }
.di { color:#088; font-weight:bold }
.dl { color:black }
.do { color:#970 }
.dt { color:#34b }
.ds { color:#D42; font-weight:bold }
.e { color:#666; font-weight:bold }
.en { color:#800; font-weight:bold }
.er { color:#F00; background-color:#FAA }
.ex { color:#C00; font-weight:bold }
.fl { color:#60E; font-weight:bold }
.fu { color:#06B; font-weight:bold }
.gv { color:#d70; font-weight:bold }
.hx { color:#058; font-weight:bold }
.i { color:#00D; font-weight:bold }
.ic { color:#B44; font-weight:bold }
.il { background-color: hsla(0,0%,0%,0.1); color: black }
.il .idl { font-weight: bold; color: #666 }
.idl { font-weight: bold; color: #666; }
.im { color:#f00; }
.in { color:#B2B; font-weight:bold }
.iv { color:#33B }
.la { color:#970; font-weight:bold }
.lv { color:#963 }
.ns { color:#707; font-weight:bold }
.oc { color:#40E; font-weight:bold }
.op { }
.pc { color:#058; font-weight:bold }
.pd { color:#369; font-weight:bold }
.pp { color:#579; }
.ps { color:#00C; font-weight:bold }
.pt { color:#074; font-weight:bold }
.r, .kw { color:#080; font-weight:bold }
.ke { color: #808; }
.ke .dl { color: #606; }
.ke .ch { color: #80f; }
.vl { color: #088; }
.rx { background-color:hsla(300,100%,50%,0.1); color:#808 }
.rx .k { }
.rx .dl { color:#404 }
.rx .mod { color:#C2C }
.rx .fu { color:#404; font-weight: bold }
.s { background-color:hsla(0,100%,50%,0.1); color: #D20; }
.s .k { }
.s .ch { color: #b0b; }
.s .dl { color: #710; }
.sh { background-color:hsla(120,100%,50%,0.1); color:#2B2 }
.sh .k { }
.sh .dl { color:#161 }
.sy { color:#A60 }
.sy .k { color:#A60 }
.sy .dl { color:#630 }
.ta { color:#070 }
.ts { color:#D70; font-weight:bold }
.ty { color:#339; font-weight:bold }
.v { color:#036 }
.xt { color:#444 }
.ins { background: #afa; }
.del { background: #faa; }
.chg { color: #aaf; background: #007; }
.head { color: #f8f; background: #505 }
.head .filename { color: white; }
.ins .ins { color: #080; font-weight:bold }
.del .del { color: #800; font-weight:bold }
.chg .chg { color: #66f; }
.head .head { color: #f4f; }
@@ -392,7 +392,7 @@
function message(msg,className) {
var mesg = $('<div class="jquery-console-message"></div>');
if (className) mesg.addClass(className);
mesg.filledText(msg).hide();
mesg.html(msg).hide();
inner.append(mesg);
mesg.show();
};
View
@@ -15,8 +15,6 @@
(whitelist
(function-matcher 'println 'print 'pr 'prn 'var 'print-doc 'doc 'throw
'def 'def* 'dosync 'alter '.))))
(def state-tester
(new-tester (whitelist (constantly '(true)))
(blacklist (function-matcher 'def 'def*
@@ -39,7 +37,7 @@
(recur (next history)))))
(with-open [writer (java.io.StringWriter.)]
(let [r (pr-str ((sc form) {'*out* writer}))]
[(str writer r)
[(str (.replace (escape-html writer) "\n" "<br/>") (highlight (str r)))
(if (has-state? form) (conj history form) history)]))
(catch TimeoutException _ ["Execution Timed Out!" history])
(catch SecurityException _ ["Disabled for security purposes." history])
@@ -1,7 +1,22 @@
(ns tryclojure.tutorial
(:use hiccup.core))
(:use hiccup.core
clj-highlight.core))
(defn code [s] (html [:code.code s]))
(def clj-tokenizer
(mangle-tokens
:space
(fn [k t s]
[k (.replace t "\n" "<br/>") s])
(mangle-tokens
nil
(fn [k t s]
[k (escape-html t) s])
(tokenizer clj-syntax))))
(defn highlight [code]
(html (to-html default-stype-map "code" (clj-tokenizer code))))
(defn code [s] (highlight s))
(def tutorial0-text
(html

0 comments on commit 441af37

Please sign in to comment.