Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Syntax highlight clojure examples in Readme #33

Merged
merged 2 commits into from

2 participants

Joseph Wilk Stephen C. Gilardi
Joseph Wilk

Makes the Readme examples much easier to parse on Github!

Stephen C. Gilardi scgilardi merged commit c9b0f2e into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 38 additions and 32 deletions.
  1. +38 −32 README.md
70 README.md
View
@@ -102,38 +102,44 @@ Enhanced throw and catch for Clojure
Usage
-----
- project.clj
-
- [slingshot "0.10.3"]
-
- tensor/parse.clj
-
- (ns tensor.parse
- (:use [slingshot.slingshot :only [throw+]]))
-
- (defn parse-tree [tree hint]
- (if (bad-tree? tree)
- (throw+ {:type ::bad-tree :tree tree :hint hint})
- (parse-good-tree tree hint)))
-
- math/expression.clj
-
- (ns math.expression
- (:require [tensor.parse]
- [clojure.tools.logging :as log])
- (:use [slingshot.slingshot :only [throw+ try+]]))
-
- (defn read-file [file]
- (try+
- [...]
- (tensor.parse/parse-tree tree)
- [...]
- (catch [:type :tensor.parse/bad-tree] {:keys [tree hint]}
- (log/error "failed to parse tensor" tree "with hint" hint)
- (throw+))
- (catch Object _
- (log/error (:throwable &throw-context) "unexpected error")
- (throw+))))
+project.clj
+
+```clojure
+[slingshot "0.10.3"]
+```
+
+tensor/parse.clj
+
+```clojure
+(ns tensor.parse
+ (:use [slingshot.slingshot :only [throw+]]))
+
+(defn parse-tree [tree hint]
+ (if (bad-tree? tree)
+ (throw+ {:type ::bad-tree :tree tree :hint hint})
+ (parse-good-tree tree hint)))
+```
+
+math/expression.clj
+
+```clojure
+(ns math.expression
+ (:require [tensor.parse]
+ [clojure.tools.logging :as log])
+ (:use [slingshot.slingshot :only [throw+ try+]]))
+
+(defn read-file [file]
+ (try+
+ [...]
+ (tensor.parse/parse-tree tree)
+ [...]
+ (catch [:type :tensor.parse/bad-tree] {:keys [tree hint]}
+ (log/error "failed to parse tensor" tree "with hint" hint)
+ (throw+))
+ (catch Object _
+ (log/error (:throwable &throw-context) "unexpected error")
+ (throw+))))
+```
Credits
-------
Something went wrong with that request. Please try again.