Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

#38 update misaki.compiler.default.config/plugin-config to handle def…

…ault layout directory: layouts/, and change default detailed-log config to True
  • Loading branch information...
commit ea2008ee9c446e8ad863c3cfef2f148f79ffd867 1 parent 0cb3529
@liquidz authored
View
7 src/misaki/compiler/default/config.clj
@@ -12,6 +12,9 @@
;; ## Default Value
+(def DEFAULT_LAYOUT_DIRECTORY
+ "Default layout directory."
+ "layouts/")
(def POST_FILENAME_REGEXP
"Default regexp to parse post filename."
#"(\d{4})[-_](\d{1,2})[-_](\d{1,2})[-_](.+)$")
@@ -40,12 +43,12 @@
{:pre [(map? config)]
:post [#(map? %)]}
(let [{:keys [template-dir public-dir url-base detailed-log]} config
- layout (path template-dir (:layout-dir config))]
+ layout (path template-dir (:layout-dir config DEFAULT_LAYOUT_DIRECTORY))]
(assoc
config
:layout-dir layout
:tag-layout (str layout (:tag-layout config) ".clj")
- :detailed-log (:detailed-log config false)
+ :detailed-log (:detailed-log config true)
:post-sort-type (:post-sort-type config :date-desc))))
; =with-config
View
1  test/files/core_empty/_config.clj
@@ -0,0 +1 @@
+{}
View
6 test/files/core_empty/index.html.clj
@@ -0,0 +1,6 @@
+; @title foo
+[:html
+ [:head
+ [:title (:title site)]]
+ [:body
+ [:h1 "hello " (:title site)]]]
View
2  test/misaki/test/core_clostache.clj
@@ -4,7 +4,7 @@
[misaki [core :refer :all]
[config :refer :all]
[tester :refer :all]]
- [clojure.test :refer :all]))
+ [clojure.test :refer :all]))
(set-base-dir! "test/files/core_clostache/")
View
27 test/misaki/test/core_empty.clj
@@ -0,0 +1,27 @@
+(ns misaki.test.core-empty
+ (require
+ [misaki [core :refer :all]
+ [config :refer :all]
+ [tester :refer :all]]
+ [clojure.test :refer :all]))
+
+(set-base-dir! "test/files/core_empty/")
+
+; -config
+(deftest* config-with-empty_config.clj
+ (let [config (get-config)]
+ (are [x y] (= x y)
+ true (contains? config :detailed-log)
+ true (contains? config :layout-dir)
+ true (:detailed-log config)
+ "test/files/core_empty/layouts/" (:layout-dir config))))
+
+; -compile
+(deftest* compile-with-compty-_config.clj
+ (test-index-compile (template-file "index.html.clj"))
+ (let [p1 (public-file "index.html")]
+ (is (.exists p1))
+ (is (.exists (public-file "_config.clj")))
+ (is (not (.exists (public-file "_config"))))
+ (.delete p1)))
+
Please sign in to comment.
Something went wrong with that request. Please try again.