From 47c36bb935d13fa63e1acf32f1822a45b4d53d41 Mon Sep 17 00:00:00 2001 From: Jonathan Abbey Date: Mon, 23 Jun 2014 06:12:55 -0500 Subject: [PATCH 1/2] tagsoup will insert .. around template pieces that contain elements --- src/com/ebaxt/enlive_partials.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/ebaxt/enlive_partials.clj b/src/com/ebaxt/enlive_partials.clj index c753ca6..3f73033 100644 --- a/src/com/ebaxt/enlive_partials.clj +++ b/src/com/ebaxt/enlive_partials.clj @@ -26,10 +26,10 @@ (html-resource resource) (throw (Exception. (format "Template doesn't exist: %s" path)))))) -(defn- html-body [name] +(defn- html-unwrapped [name] (-> name find-html-resource - (select [:body]) + (select [#{:body :head}]) first :content)) @@ -39,7 +39,7 @@ includes (seq includes)] (if includes (let [file (-> (first includes) :attrs :file) - include (construct-html (html-body file))] + include (construct-html (html-unwrapped file))] (recur (transform h [[:_include (attr= :file file)]] (substitute include)) (next includes))) h)))) From 6a423ab404fcecdfa22d843d0e19a0272dedba54 Mon Sep 17 00:00:00 2001 From: Jonathan Abbey Date: Mon, 23 Jun 2014 06:19:21 -0500 Subject: [PATCH 2/2] Allow *template-path* to be nil. If *template-path* is nil, the template path will be rooted at the top of the web resource path. --- src/com/ebaxt/enlive_partials.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/ebaxt/enlive_partials.clj b/src/com/ebaxt/enlive_partials.clj index 3f73033..6e99e64 100644 --- a/src/com/ebaxt/enlive_partials.clj +++ b/src/com/ebaxt/enlive_partials.clj @@ -20,7 +20,7 @@ (defn- find-html-resource [file] (let [file (.replaceAll file "^/" "") - path (str *template-path* "/" file) + path (if *template-path* (str *template-path* "/" file) file) resource (io/resource path)] (if resource (html-resource resource)