DO-CTYPES bugfix.

This commit is contained in:
Brit Butler 2013-01-06 15:34:52 -05:00
parent 1ee5402179
commit 88c0adc0af
3 changed files with 8 additions and 5 deletions

View file

@ -49,7 +49,7 @@ Additional args to render CONTENT can be passed via RENDER-ARGS."
(merge-pathnames "static" (repo *config*)))) (merge-pathnames "static" (repo *config*))))
(when (probe-file dir) (when (probe-file dir)
(run-program "cp -R ~a ." dir))) (run-program "cp -R ~a ." dir)))
(do-ctypes (publish (class-name ctype))) (do-ctypes (publish ctype))
(render-indices) (render-indices)
(render-feeds (feeds *config*)))) (render-feeds (feeds *config*))))

View file

@ -59,12 +59,14 @@ If PLIST-P is non-nil, a single plist is returned with :content holding the text
(defmacro do-ctypes (&body body) (defmacro do-ctypes (&body body)
"Iterate over the subclasses of CONTENT performing BODY with ctype lexically "Iterate over the subclasses of CONTENT performing BODY with ctype lexically
bound to the current subclass." bound to the current subclass."
`(loop for ctype in (closer-mop:class-direct-subclasses (find-class 'content)) (alexandria:with-gensyms (ctypes)
do ,@body)) `(let ((,ctypes (closer-mop:class-direct-subclasses (find-class 'content))))
(loop for ctype in (mapcar (compose 'make-keyword 'class-name) ,ctypes)
do ,@body))))
(defun load-content () (defun load-content ()
"Load all content stored in the blog's repo." "Load all content stored in the blog's repo."
(do-ctypes (discover (class-name ctype)))) (do-ctypes (discover ctype)))
(defun by-date (content) (defun by-date (content)
"Sort CONTENT in reverse chronological order." "Sort CONTENT in reverse chronological order."

View file

@ -3,7 +3,8 @@
(:use :cl) (:use :cl)
(:import-from :alexandria #:hash-table-values (:import-from :alexandria #:hash-table-values
#:make-keyword #:make-keyword
#:mappend) #:mappend
#:compose)
(:import-from :closure-template #:compile-template) (:import-from :closure-template #:compile-template)
(:export #:main (:export #:main
#:blog #:blog