diff --git a/src/com/ebaxt/enlive_partials.clj b/src/com/ebaxt/enlive_partials.clj index c753ca6..6e99e64 100644 --- a/src/com/ebaxt/enlive_partials.clj +++ b/src/com/ebaxt/enlive_partials.clj @@ -20,16 +20,16 @@ (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) (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))))