refactoring: replace navbar-pages & sidebar-pages by pages

This commit is contained in:
Michael Jerger 2017-03-11 21:32:58 +01:00
parent da84c946c9
commit 593766a603
3 changed files with 10 additions and 15 deletions

0
CHANGELOG.md Normal file
View file

View file

@ -1,4 +1,4 @@
(defproject org.domaindrivenarchitecture/cryogen-core "0.1.53-SNAPSHOT" (defproject org.domaindrivenarchitecture/cryogen-core "0.1.53.1-SNAPSHOT"
:description "Cryogen's compiler" :description "Cryogen's compiler"
:url "https://github.com/cryogen-project/cryogen-core" :url "https://github.com/cryogen-project/cryogen-core"
:license {:name "Eclipse Public License" :license {:name "Eclipse Public License"

View file

@ -466,7 +466,7 @@
(update-in [:post-date-format] (fnil str "yyyy-MM-dd")) (update-in [:post-date-format] (fnil str "yyyy-MM-dd"))
(update-in [:keep-files] (fnil seq [])) (update-in [:keep-files] (fnil seq []))
(update-in [:ignored-files] (fnil seq [#"^\.#.*" #".*\.swp$"])) (update-in [:ignored-files] (fnil seq [#"^\.#.*" #".*\.swp$"]))
(update-in [:navbar-mode] (fnil keyword :flat)) (update-in [:pages-mode] (fnil keyword :flat))
)] )]
(merge (merge
config config
@ -489,7 +489,7 @@
[] []
(println (green "compiling assets...")) (println (green "compiling assets..."))
(let [{:keys [^String site-url blog-prefix rss-name recent-posts sass-dest keep-files ignored-files previews? (let [{:keys [^String site-url blog-prefix rss-name recent-posts sass-dest keep-files ignored-files previews?
author-root-uri theme debug? navbar-mode] author-root-uri theme debug? pages-mode]
:as config} (read-config) :as config} (read-config)
posts (map klipsify (add-prev-next (read-posts config))) posts (map klipsify (add-prev-next (read-posts config)))
posts-by-tag (group-by-tags posts) posts-by-tag (group-by-tags posts)
@ -502,19 +502,16 @@
other-pages (->> pages other-pages (->> pages
(remove #{home-page}) (remove #{home-page})
(add-prev-next)) (add-prev-next))
[navbar-pages
sidebar-pages] (group-pages other-pages)
params (merge config params (merge config
{:today (java.util.Date.) {:today (java.util.Date.)
:title (:site-title config) :title (:site-title config)
:active-page "home" :active-page "home"
:tags (map (partial tag-info config) (keys posts-by-tag)) :tags (map (partial tag-info config) (keys posts-by-tag))
:latest-posts latest-posts :latest-posts latest-posts
:navbar-pages (cond :pages (cond
(= navbar-mode :flat) navbar-pages (= pages-mode :flat) other-pages
(= navbar-mode :hierarchic) (hierarchic/build-hierarchic-map navbar-pages) (= pages-mode :hierarchic) (hierarchic/build-hierarchic-map other-pages)
) )
:sidebar-pages sidebar-pages
:home-page (if home-page :home-page (if home-page
home-page home-page
(assoc (first latest-posts) :layout "home.html")) (assoc (first latest-posts) :layout "home.html"))
@ -524,12 +521,10 @@
:rss-uri (cryogen-io/path "/" blog-prefix rss-name) :rss-uri (cryogen-io/path "/" blog-prefix rss-name)
:site-url (if (.endsWith site-url "/") (.substring site-url 0 (dec (count site-url))) site-url)})] :site-url (if (.endsWith site-url "/") (.substring site-url 0 (dec (count site-url))) site-url)})]
(when debug? (when debug?
(println (blue "debug: navbar-mode:")) (println (blue "debug: pages-mode:"))
(println "\t-->" (cyan navbar-mode)) (println "\t-->" (cyan pages-mode))
(println (blue "debug: navbar-pages:")) (println (blue "debug: pages:"))
(println "\t-->" (cyan (-> params :navbar-pages))) (println "\t-->" (cyan (-> params :pages)))
(println (blue "debug: sidebar-pages:"))
(println "\t-->" (cyan (-> params :sidebar-pages)))
(println (blue "debug: home-page:")) (println (blue "debug: home-page:"))
(println "\t-->" (cyan (-> params :home-page))) (println "\t-->" (cyan (-> params :home-page)))
) )