Permalink
Browse files

Minor updates

  • Loading branch information...
1 parent 21b386b commit 0a2fb35639e0618f1b36d125e79c3b1f316ee39c @Flamefork committed Jan 21, 2013
Showing with 19 additions and 28 deletions.
  1. +1 −8 README.md
  2. +4 −3 project.clj
  3. +1 −2 src/fleet/builder.clj
  4. +1 −2 src/fleet/loader.clj
  5. +12 −13 src/fleet/runtime.clj
View
@@ -10,13 +10,6 @@ Templating System for Clojure
0. Clojure is good :)
0. HTML isn't the only language that needs templating.
-## Why Fleet?
-
-Because
-— I wanted template engine for Clojure
-— close to Clojure
-— and I hate writing HTML not in HTML (clj-html, haml, etc).
-
## Brief
Write
@@ -255,4 +248,4 @@ Use 0.10.x for Clojure 1.4+
## License
-Copyright (c) 2010 Ilia Ablamonov, released under the MIT license.
+Copyright (c) 2010 Ilia Ablamonov, released under the [MIT license](http://www.opensource.org/licenses/mit-license.php).
View
@@ -1,7 +1,8 @@
-(defproject fleet "0.10.0"
+(defproject fleet "0.10.1"
:description "Templating System for Clojure"
:url "http://github.com/Flamefork/fleet"
+ :license {:name "MIT License"
+ :url "http://www.opensource.org/licenses/mit-license.php"}
:dependencies [[org.clojure/clojure "1.4.0"]]
- :java-source-paths ["src"]
- :dev-dependencies [[lein-clojars "0.9.1"]])
+ :java-source-paths ["src"])
View
@@ -8,10 +8,9 @@
(def ^:private consumers {
:text #(str "(raw \"" (escape-clj-string %) "\")")
- :clj bypass
:embed #(str "(screen (" (apply str (map consume %)) "))")
:tpl #(str "(screen [" (apply str (map consume %)) "])")
- })
+ :clj bypass})
(defn- consume
[ast]
View
@@ -40,10 +40,9 @@
(let [ns (ns-from-path (relative-path root (.getParentFile file)))]
{:content (slurp (.getPath file))
:names (names-from-filename (.getName file))
- :ns ns
:file-path (.getAbsolutePath file)
:file-name (.getName file)
- }))
+ :ns ns}))
(defn make-tpl-infos
[root-path file-filter]
View
@@ -8,33 +8,32 @@
(:escaped-with (meta s) {}))
(defn raw
- "Prevent encoding of string."
+ "Prevent escaping of string by escaping-fn."
[escaping-fn s]
(let [obj (-> s .toString CljString.)
new-escw (assoc (escaped-with s) escaping-fn true)
new-meta (assoc (meta obj) :escaped-with new-escw)]
(with-meta obj new-meta)))
(defn raw?
+ "Check if string is already escaped by escaping-fn."
[escaping-fn s]
(get (escaped-with s) escaping-fn))
(defprotocol Screenable
(screen [s escaping-fn] "Process and collect template string(s)."))
-(extend CharSequence Screenable
- {:screen (fn [s f] (raw f (if (raw? f s) s (f s))))})
-
-(extend Sequential Screenable
- {:screen (fn [s f] (raw f (apply str (map #(screen %1 f) s))))})
-
-(extend Object Screenable
- {:screen (fn [s f] (raw f (str s)))})
+(extend-protocol Screenable
+ CharSequence
+ (screen [s f] (raw f (if (raw? f s) s (f s))))
+ Sequential
+ (screen [s f] (raw f (apply str (map #(screen %1 f) s))))
+ Object
+ (screen [s f] (raw f (str s))))
(defn make-runtime
"Create runtime functions applied to specified escaping-fn."
[escaping-fn]
- { :raw (partial raw escaping-fn)
- :raw? (partial raw? escaping-fn)
- :screen #(screen %1 escaping-fn)
- })
+ {:raw (partial raw escaping-fn)
+ :raw? (partial raw? escaping-fn)
+ :screen #(screen %1 escaping-fn)})

0 comments on commit 0a2fb35

Please sign in to comment.