From 27e8ed05901d7fb67399c7d664d619f17d5113fe Mon Sep 17 00:00:00 2001 From: Brit Butler Date: Thu, 13 Sep 2012 01:10:43 -0400 Subject: [PATCH] Minor bugfixes and RENDER-POSTS cleanup. --- example.post-receive | 2 +- src/indices.lisp | 2 +- src/posts.lisp | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/example.post-receive b/example.post-receive index 44aee27..a18ff80 100644 --- a/example.post-receive +++ b/example.post-receive @@ -5,6 +5,6 @@ LISP=sbcl git clone $GIT_REPO $TMP_GIT_CLONE # Only ccl and sbcl support the eval switch, other lisps require a patch here -$LISP --eval "(ql:quickload 'coleslaw)" --eval "(coleslaw:main)" --eval "(trival-shell:exit)" +$LISP --eval "(ql:quickload 'coleslaw)" --eval "(coleslaw:main)" --eval "(trivial-shell:exit)" rm -Rf $TMP_GIT_CLONE exit diff --git a/src/indices.lisp b/src/indices.lisp index 292db58..7c59802 100644 --- a/src/indices.lisp +++ b/src/indices.lisp @@ -66,5 +66,5 @@ (dotimes (i (ceiling (length posts) 10)) (render-page (index-by-n i posts) nil :prev (and (plusp i) i) - :next (and (< (* i 10) (length posts)) (+ 2 i))))) + :next (and (< (* (1+ i) 10) (length posts)) (+ 2 i))))) (update-symlink "index.html" "1.html")) diff --git a/src/posts.lisp b/src/posts.lisp index b6fd0e2..3099090 100644 --- a/src/posts.lisp +++ b/src/posts.lisp @@ -30,12 +30,9 @@ (defun render-posts () "Iterate through the files in the repo to render+write the posts out to disk." - (loop with posts = (sort (hash-table-values *posts*) #'string< :key #'post-date) - for i from 1 upto (length posts) - for prev = nil then post - for post = (nth (1- i) posts) - for next = (nth i posts) - do (render-page post nil :prev prev :next next))) + (loop for (prev post next) on (append '(nil) (sort (hash-table-values *posts*) + #'string< :key #'post-date)) + while post do (render-page post nil :prev prev :next next))) (defgeneric render-content (text format) (:documentation "Compile TEXT from the given FORMAT to HTML for display.")