Paste number 134453: Shouts

Paste number 134453: Shouts
Pasted by: redline6561
When:1 year, 6 months ago
Share:Tweet this! | http://paste.lisp.org/+2VQT
Channel:None
Paste contents:
Raw Source | XML | Display As
(in-package :coleslaw)

(defclass shout (content)
  ((via :initform nil :initarg :via :accessor shout-via)
   (target :initform nil :initarg :target :accessor shout-target)))

;; TODO: How do we want it to look?
(defmethod render ((object shout)))

(defmethod page-path ((object shout))
  (rel-path (staging *config*) "shouts/~d.html" (content-slug object)))

;; TODO: Need a initialize-instance :after method here to set the slug.

(defmethod discover ((content-type (eql :shout)))
  (purge-all 'shout)
  (do-files (file (repo *config*) "shout")
    (let ((shout (construct 'shout (read-content file t))))
      (if (gethash (content-slug shout) *content*)
          (error "There is already existing content with the slug ~a."
                 (content-slug shout))
          (setf (gethash (content-slug shout) *content*) shout)))))

(defmethod publish ((content-type (eql :post)))
  (dolist (shout (by-date (find-all 'shout)))
    (write-page (page-path shout) (render-page shout))))

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.