Allow arbitrary layout of blog repos.

This commit is contained in:
Brit Butler 2014-04-28 17:49:37 -04:00
parent 04619d57ad
commit 40c00b9708
3 changed files with 13 additions and 16 deletions

View file

@ -1,3 +1,8 @@
## Changes for 0.9.4 (2013-05-05):
* Coleslaw no longer expects a particular repo layout. Use whatever
directory hierarchy you like.
## Changes for 0.9.3 (2013-04-16): ## Changes for 0.9.3 (2013-04-16):
* **INCOMPATIBLE CHANGE**: `page-path` and the `blog` config class are no longer exported. * **INCOMPATIBLE CHANGE**: `page-path` and the `blog` config class are no longer exported.

View file

@ -168,14 +168,6 @@ freshly built site.
## Areas for Improvement ## Areas for Improvement
### Allow Arbitrary Repo Structure
Currently, *coleslaw* expects all posts to be in the top-level of the
blog repo. There is no technical reason that coleslaw should care.
The only change that needs to be made is to the `do-files` macro
used during content discovery. In particular, it should probably
use `cl-fad:walk-directory` instead of `cl-fad:list-directory`.
### Allow Tagless or Dateless Content ### Allow Tagless or Dateless Content
Several users have expected to be able to not supply tags or a date Several users have expected to be able to not supply tags or a date

View file

@ -16,16 +16,16 @@ lexically bound to the current subclass."
(loop for ,var in ,klasses do ,@body))))) (loop for ,var in ,klasses do ,@body)))))
(defmacro do-files ((var path &optional extension) &body body) (defmacro do-files ((var path &optional extension) &body body)
"For each file on PATH, run BODY. If EXTENSION is provided, only run BODY "For each file under PATH, run BODY. If EXTENSION is provided, only run
on files that match the given extension." BODY on files that match the given extension."
(alexandria:with-gensyms (extension-p files) (alexandria:with-gensyms (extension-p)
`(flet ((,extension-p (file) `(flet ((,extension-p (file)
(string= (pathname-type file) ,extension))) (string= (pathname-type file) ,extension)))
(let ((,files (cl-fad:list-directory ,path))) (cl-fad:walk-directory ,path (lambda (,var) ,@body)
(dolist (,var ,(if extension :follow-symlinks nil
`(remove-if-not #',extension-p ,files) :test (if ,extension
files)) #',extension-p
,@body))))) (constantly t))))))
(defmacro with-current-directory (path &body body) (defmacro with-current-directory (path &body body)
"Change the current directory to PATH and execute BODY in "Change the current directory to PATH and execute BODY in