Merge branch 'development'
Conflicts: project.clj
This commit is contained in:
commit
9e548cc4f5
3 changed files with 39 additions and 31 deletions
12
CHANGELOG.md
Normal file
12
CHANGELOG.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Changelog
|
||||
|
||||
## Version 0.1.53.1-SNAPSHOT
|
||||
### New Features
|
||||
|
||||
Support of hierarchic menus & page structures:
|
||||
1. on configuration scope an additional parameter {:page-model [:flat | :hierarchic]} - flat will be the default. Flat mode is backward compatible.
|
||||
2. on page scope we respect {:navbar? [true|false]} in flat & hierarchic mode also.
|
||||
3. params now contain hierarchic pages. Pages is replacing no longer supported navbar-pages / sidebar-pages. Hierarchic pages may contain a sequence of children `{:children ({:title "child-page", :layout "page.html", :content " <p>child</p>"}) }
|
||||
|
||||
### Breaking Changes
|
||||
Pages is replacing no longer supported navbar-pages / sidebar-pages. In order to realice navbar / sidebar functionality, you've now to write filters.
|
|
@ -251,7 +251,9 @@
|
|||
:home false
|
||||
:servlet-context (cryogen-io/path "/" blog-prefix "/")
|
||||
:page page
|
||||
:uri uri}))))))
|
||||
:uri uri})))
|
||||
(compile-pages params (:children page)))
|
||||
))
|
||||
|
||||
(defn compile-posts
|
||||
"Compiles all the posts into html and spits them out into the public folder"
|
||||
|
@ -466,7 +468,7 @@
|
|||
(update-in [:post-date-format] (fnil str "yyyy-MM-dd"))
|
||||
(update-in [:keep-files] (fnil seq []))
|
||||
(update-in [:ignored-files] (fnil seq [#"^\.#.*" #".*\.swp$"]))
|
||||
(update-in [:navbar-mode] (fnil keyword :flat))
|
||||
(update-in [:page-model] (fnil keyword :flat))
|
||||
)]
|
||||
(merge
|
||||
config
|
||||
|
@ -489,32 +491,30 @@
|
|||
[]
|
||||
(println (green "compiling assets..."))
|
||||
(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? page-model]
|
||||
:as config} (read-config)
|
||||
posts (map klipsify (add-prev-next (read-posts config)))
|
||||
posts-by-tag (group-by-tags posts)
|
||||
posts (tag-posts posts config)
|
||||
latest-posts (->> posts (take recent-posts) vec)
|
||||
pages (map klipsify (read-pages config))
|
||||
home-page (->> pages
|
||||
klipsified-pages (map klipsify (read-pages config))
|
||||
modelled-pages (cond
|
||||
(= page-model :flat) klipsified-pages
|
||||
(= page-model :hierarchic) (hierarchic/build-hierarchic-map klipsified-pages)
|
||||
)
|
||||
home-page (->> modelled-pages
|
||||
(filter #(boolean (:home? %)))
|
||||
(first))
|
||||
other-pages (->> pages
|
||||
other-pages (->> modelled-pages
|
||||
(remove #{home-page})
|
||||
(add-prev-next))
|
||||
[navbar-pages
|
||||
sidebar-pages] (group-pages other-pages)
|
||||
params (merge config
|
||||
{:today (java.util.Date.)
|
||||
:title (:site-title config)
|
||||
:active-page "home"
|
||||
:tags (map (partial tag-info config) (keys posts-by-tag))
|
||||
:latest-posts latest-posts
|
||||
:navbar-pages (cond
|
||||
(= navbar-mode :flat) navbar-pages
|
||||
(= navbar-mode :hierarchic) (hierarchic/build-hierarchic-map navbar-pages)
|
||||
)
|
||||
:sidebar-pages sidebar-pages
|
||||
:pages other-pages
|
||||
:home-page (if home-page
|
||||
home-page
|
||||
(assoc (first latest-posts) :layout "home.html"))
|
||||
|
@ -524,12 +524,8 @@
|
|||
: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)})]
|
||||
(when debug?
|
||||
(println (blue "debug: navbar-mode:"))
|
||||
(println "\t-->" (cyan navbar-mode))
|
||||
(println (blue "debug: navbar-pages:"))
|
||||
(println "\t-->" (cyan (-> params :navbar-pages)))
|
||||
(println (blue "debug: sidebar-pages:"))
|
||||
(println "\t-->" (cyan (-> params :sidebar-pages)))
|
||||
(println (blue "debug: page-model:"))
|
||||
(println "\t-->" (cyan page-model))
|
||||
(println (blue "debug: home-page:"))
|
||||
(println "\t-->" (cyan (-> params :home-page)))
|
||||
)
|
||||
|
@ -540,7 +536,7 @@
|
|||
(println (blue "copying resources"))
|
||||
(cryogen-io/copy-resources config)
|
||||
(copy-resources-from-markup-folders config)
|
||||
(compile-pages params other-pages)
|
||||
(compile-pages params modelled-pages)
|
||||
(compile-posts params posts)
|
||||
(compile-tags params posts-by-tag)
|
||||
(compile-tags-page params)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
)
|
||||
|
||||
(defn build-hierarchic-level
|
||||
"builds one level of nav-map and recurs to next level."
|
||||
"builds one level of hierarchic tree recurs to next level."
|
||||
[parent-uri pages]
|
||||
(let [current-level (+ 1 (uri-level parent-uri))
|
||||
pages-of-parent (filter-pages-for-uri parent-uri pages)
|
||||
|
@ -36,7 +36,7 @@
|
|||
))
|
||||
|
||||
(defn build-hierarchic-map
|
||||
"builds a nav-map from pages"
|
||||
"builds a hierarchic tree from pages"
|
||||
[pages]
|
||||
(let [sorted-pages (sort-by :uri pages)]
|
||||
(build-hierarchic-level "/pages/" sorted-pages)
|
||||
|
|
Loading…
Reference in a new issue