Fix oversight from page-path refactor. Thanks to Xach for the report.

This commit is contained in:
Brit Butler 2012-12-14 14:34:45 -05:00
parent d8e79c7a0a
commit 6dc400c91c
4 changed files with 14 additions and 11 deletions

View file

@ -26,12 +26,15 @@ Additional args to render CONTENT can be passed via RENDER-ARGS."
:injections (find-injections content))))
(defun write-page (filepath page)
"Write the given PAGE to FILEPATH."
(ensure-directories-exist filepath)
(with-open-file (out filepath
:direction :output
:if-does-not-exist :create)
(write-line page out)))
"Write the given PAGE to FILEPATH.html unless an extension is present."
(let ((path (if (position #\. filepath)
filepath
(concatenate 'string filepath ".html"))))
(ensure-directories-exist path)
(with-open-file (out path
:direction :output
:if-does-not-exist :create)
(write-line page out))))
(defun compile-blog (staging)
"Compile the blog to a STAGING directory as specified in .coleslawrc."

View file

@ -19,6 +19,6 @@
(write-page (page-path atom) (render-page atom :atom-feed))
(dolist (feed feeds)
(let ((index (index-by-tag feed by-date)))
(setf (index-id index) (format nil "tag/~a.xml" feed)
(setf (index-id index) (format nil "~a-rss.xml" feed)
(index-posts index) (first-10 (index-posts index)))
(write-page (page-path index) (render-page index :rss-feed)))))))

View file

@ -20,11 +20,11 @@
(defmethod page-path ((object index))
(rel-path (staging *config*) (index-id object)))
(defmethod page-path ((object tag-index))
(rel-path (staging *config*) "tag/~a.html" (index-id object)))
(rel-path (staging *config*) "tag/~a" (index-id object)))
(defmethod page-path ((object date-index))
(rel-path (staging *config*) "date/~a.html" (index-id object)))
(rel-path (staging *config*) "date/~a" (index-id object)))
(defmethod page-path ((object int-index))
(rel-path (staging *config*) "~d.html" (index-id object)))
(rel-path (staging *config*) "~d" (index-id object)))
(defun all-months ()
"Retrieve a list of all months with published posts."

View file

@ -18,7 +18,7 @@
:next next)))
(defmethod page-path ((object post))
(rel-path (staging *config*) "posts/~a.html" (post-slug object)))
(rel-path (staging *config*) "posts/~a" (post-slug object)))
(defun read-post (in)
"Make a POST instance based on the data from the stream IN."