diff --git a/src/cryogen_core/compiler.clj b/src/cryogen_core/compiler.clj index ee1fe84..cccec50 100644 --- a/src/cryogen_core/compiler.clj +++ b/src/cryogen_core/compiler.clj @@ -251,7 +251,10 @@ [^String content] (let [index (.indexOf content "")] (if (pos? index) - (subs content 0 index)))) + (let [s (subs content 0 index)] + (->> ((tagsoup/parse-string s) 2) + (drop 2) + hiccup/html))))) (defn create-preview "Creates a single post preview" diff --git a/test/cryogen_core/compiler_test.clj b/test/cryogen_core/compiler_test.clj new file mode 100644 index 0000000..e7e77ca --- /dev/null +++ b/test/cryogen_core/compiler_test.clj @@ -0,0 +1,23 @@ +(ns cryogen-core.compiler-test + (:require [clojure.test :refer :all] + [cryogen-core.compiler :refer :all])) + +; Test that the content-until-more-marker return nil or correct html text. +(deftest test-content-until-more-marker + ; text without more marker, return nil + (is (nil? (content-until-more-marker "