diff --git a/NEWS.md b/NEWS.md index 73b4057..1a377d5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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): * **INCOMPATIBLE CHANGE**: `page-path` and the `blog` config class are no longer exported. diff --git a/docs/hacking.md b/docs/hacking.md index d08f06f..060e398 100644 --- a/docs/hacking.md +++ b/docs/hacking.md @@ -168,14 +168,6 @@ freshly built site. ## 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 Several users have expected to be able to not supply tags or a date diff --git a/src/util.lisp b/src/util.lisp index 9f10fe3..0e17399 100644 --- a/src/util.lisp +++ b/src/util.lisp @@ -16,16 +16,16 @@ lexically bound to the current subclass." (loop for ,var in ,klasses do ,@body))))) (defmacro do-files ((var path &optional extension) &body body) - "For each file on PATH, run BODY. If EXTENSION is provided, only run BODY -on files that match the given extension." - (alexandria:with-gensyms (extension-p files) + "For each file under PATH, run BODY. If EXTENSION is provided, only run +BODY on files that match the given extension." + (alexandria:with-gensyms (extension-p) `(flet ((,extension-p (file) (string= (pathname-type file) ,extension))) - (let ((,files (cl-fad:list-directory ,path))) - (dolist (,var ,(if extension - `(remove-if-not #',extension-p ,files) - files)) - ,@body))))) + (cl-fad:walk-directory ,path (lambda (,var) ,@body) + :follow-symlinks nil + :test (if ,extension + #',extension-p + (constantly t)))))) (defmacro with-current-directory (path &body body) "Change the current directory to PATH and execute BODY in