Created
March 3, 2015 19:07
-
-
Save cap10morgan/a7df909b1b7f16b8cc39 to your computer and use it in GitHub Desktop.
hbs Issue #3 w/ Java HashMap workaround
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns hbs-test.core | |
(:require [hbs.core :refer :all] | |
[hbs.helper :refer :all]) | |
(:gen-class)) | |
(def broken-template | |
"Hello, World! | |
{{#parent}} | |
{{child}} says hi too. | |
{{/parent}}") | |
(def working-template | |
"Hello, World! | |
{{#with parent}} | |
{{child}} says hi too. | |
{{/with}}") | |
(defn -main | |
[& args] | |
(println "Broken template:\n\n" (render broken-template | |
{:parent {:child "The kid"}})) | |
(println "Working template:\n\n" (render working-template | |
{:parent {:child "The kid"}})) | |
(println "String keyed broken template:\n\n" (render broken-template | |
{"parent" {"child" "The kid"}})) | |
(println "Java HashMap broken template:\n\n" (render broken-template | |
(doto (java.util.HashMap.) | |
(.put "parent" | |
(doto (java.util.HashMap.) | |
(.put "child" "The kid"))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment