Split out LOAD-POSTS.

This commit is contained in:
Brit Butler 2012-08-21 16:19:04 -04:00
parent 34c05403e9
commit 01d6b97974

View file

@ -11,8 +11,8 @@
(format :initform nil :initarg :format :accessor post-format)
(content :initform nil :initarg :content :accessor post-content)))
(defun render-posts ()
"Iterate through the files in the repo to render+write the posts out to disk."
(defun load-posts ()
"Read the stored .post files from the repo."
(clrhash *posts*)
(do-files (file (repo *config*) "post")
(with-open-file (in file)
@ -20,7 +20,11 @@
(if (gethash (post-slug post) *posts*)
(error "There is already an existing post with the slug ~a."
(post-slug post))
(setf (gethash (post-slug post) *posts*) post)))))
(setf (gethash (post-slug post) *posts*) post))))))
(defun render-posts ()
"Iterate through the files in the repo to render+write the posts out to disk."
(load-posts)
(maphash #'write-post *posts*))
(defgeneric render-content (text format)