Allow arbitrary layout of blog repos.
This commit is contained in:
parent
04619d57ad
commit
40c00b9708
3 changed files with 13 additions and 16 deletions
5
NEWS.md
5
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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue