Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

update example and added inline block

  • Loading branch information...
commit 85f433c999e7fd0b2bbd5eecb55fca8214c38cda 1 parent b54f64b
Sun Ning authored
Showing with 9 additions and 2 deletions.
  1. +2 −2 project.clj
  2. +3 −0  src/hbs/ext.clj
  3. +4 −0 test/hbs/ext_test.clj
View
4 project.clj
@@ -1,9 +1,9 @@
-(defproject hbs "0.3.0-SNAPSHOT"
+(defproject hbs "0.4.0-SNAPSHOT"
:description "Clojure templating by Handlebars.java"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.4.0"]
- [com.github.jknack/handlebars "0.8.0"]]
+ [com.github.jknack/handlebars "0.9.0"]]
:java-source-paths ["java"]
:javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"])
View
3  src/hbs/ext.clj
@@ -29,3 +29,6 @@
(contains? ctx (keyword (.hash options "item"))))
(.fn options ctx)
(.inverse options ctx)))
+
+(defhelper uppercase [^Object ctx ^Options options]
+ (clojure.string/upper-case ctx))
View
4 test/hbs/ext_test.clj
@@ -21,3 +21,7 @@
(let [tpl "{{#ifcontains set item=\"hello\"}}hello{{/ifcontains}}"]
(is (= "hello" (render tpl {:set #{:hello}})))
(is (= "hello" (render tpl {:set #{"hello"}})))))
+
+(deftest test-uppercase
+ (let [tpl "{{uppercase tom.cat}}"]
+ (is (= "HELLO" (render tpl {:tom {:cat "hello"}})))))
Please sign in to comment.
Something went wrong with that request. Please try again.