Flexible Lisp Blogware. Fork for personal use. Mirrored from https://github.com/kingcons/coleslaw originally.

posts.lisp 979B

12345678910111213141516171819202122232425
  1. (in-package :coleslaw)
  2. (defclass post (content)
  3. ((title :initarg :title :reader title-of)
  4. (author :initarg :author :reader author-of)
  5. (format :initarg :format :reader post-format))
  6. (:default-initargs :author nil))
  7. (defmethod initialize-instance :after ((object post) &key)
  8. (with-slots (url title author format text) object
  9. (setf url (compute-url object (slugify title))
  10. format (make-keyword (string-upcase format))
  11. text (render-text text format)
  12. author (or author (author *config*)))))
  13. (defmethod render ((object post) &key prev next)
  14. (funcall (theme-fn 'post) (list :config *config*
  15. :post object
  16. :prev prev
  17. :next next)))
  18. (defmethod publish ((doc-type (eql (find-class 'post))))
  19. (loop for (next post prev) on (append '(nil) (by-date (find-all 'post)))
  20. while post do (write-document post nil :prev prev :next next)))