Cleanup imports and use write-document.

This commit is contained in:
Brit Butler 2014-04-28 13:42:44 -04:00
parent 4f6006cfcf
commit cba6776afd
2 changed files with 8 additions and 5 deletions

View file

@ -1,24 +1,26 @@
(defpackage :coleslaw-static-pages (defpackage :coleslaw-static-pages
(:use :cl) (:use :cl)
(:export #:enable) (:export #:enable)
(:import-from :coleslaw #:content (:import-from :coleslaw #:*config*
#:content
#:page-url #:page-url
#:find-all #:find-all
#:render #:render
#:publish)) #:publish
#:write-document))
(in-package :coleslaw-static-pages) (in-package :coleslaw-static-pages)
(defclass page (content) (defclass page (content)
((:url :initarg :url :reader page-url))) ((url :initarg :url :reader page-url)))
(defmethod render ((object page)) (defmethod render ((object page) &key next prev)
;; For now, we'll re-use the normal post theme. ;; For now, we'll re-use the normal post theme.
(funcall (theme-fn 'post) (list :config *config* (funcall (theme-fn 'post) (list :config *config*
:post object))) :post object)))
(defmethod publish ((doc-type (eql (find-class 'page)))) (defmethod publish ((doc-type (eql (find-class 'page))))
(dolist (page (find-all 'page)) (dolist (page (find-all 'page))
(write-file (page-path page) (render-page page nil)))) (write-document page)))
(defun enable ()) (defun enable ())

View file

@ -15,6 +15,7 @@
#:index #:index
#:render-text #:render-text
#:add-injection #:add-injection
#:theme-fn
;; The Document Protocol ;; The Document Protocol
#:add-document #:add-document
#:find-all #:find-all