Use default-initargs, switch some accessors to readers.

This commit is contained in:
Brit Butler 2014-05-15 10:43:08 -04:00
parent c0447fd7d0
commit 414b221e6b
3 changed files with 27 additions and 22 deletions

View file

@ -1,20 +1,24 @@
(in-package :coleslaw) (in-package :coleslaw)
(defclass blog () (defclass blog ()
((author :initarg :author :accessor author) ((author :initarg :author :reader author)
(deploy-dir :initarg :deploy-dir :accessor deploy-dir) (deploy-dir :initarg :deploy-dir :reader deploy-dir)
(domain :initarg :domain :accessor domain) (domain :initarg :domain :reader domain)
(feeds :initarg :feeds :accessor feeds) (feeds :initarg :feeds :reader feeds)
(license :initarg :license :accessor license) (license :initarg :license :reader license)
(page-ext :initarg :page-ext :accessor page-ext :initform "html") (page-ext :initarg :page-ext :reader page-ext)
(plugins :initarg :plugins :accessor plugins) (plugins :initarg :plugins :reader plugins)
(repo :initarg :repo :accessor repo) (repo :initarg :repo :reader repo)
(routing :initarg :routing :accessor routing) (routing :initarg :routing :reader routing)
(separator :initarg :separator :accessor separator :initform ";;;;;") (separator :initarg :separator :reader separator)
(sitenav :initarg :sitenav :accessor sitenav) (sitenav :initarg :sitenav :reader sitenav)
(staging-dir :initarg :staging-dir :accessor staging-dir :initform "/tmp/coleslaw/") (staging-dir :initarg :staging-dir :reader staging-dir)
(theme :initarg :theme :accessor theme) (theme :initarg :theme :reader theme)
(title :initarg :title :accessor title))) (title :initarg :title :reader title))
(:default-initargs
:page-ext "html"
:separator ";;;;;"
:staging-dir "/tmp/coleslaw"))
(defparameter *config* nil (defparameter *config* nil
"A variable to store the blog configuration and plugin settings.") "A variable to store the blog configuration and plugin settings.")

View file

@ -31,11 +31,12 @@
;; Content Types ;; Content Types
(defclass content () (defclass content ()
((file :initform nil :initarg :file :accessor content-file) ((file :initarg :file :reader content-file)
(tags :initform nil :initarg :tags :accessor content-tags) (date :initarg :date :reader content-date)
(slug :initform nil :initarg :slug :accessor content-slug) (tags :initarg :tags :accessor content-tags)
(date :initform nil :initarg :date :accessor content-date) (slug :initarg :slug :accessor content-slug)
(text :initform nil :initarg :text :accessor content-text))) (text :initarg :text :accessor content-text))
(:default-initargs :tags nil :date nil :slug nil))
(defmethod initialize-instance :after ((object content) &key) (defmethod initialize-instance :after ((object content) &key)
(with-accessors ((tags content-tags)) object (with-accessors ((tags content-tags)) object

View file

@ -1,9 +1,9 @@
(in-package :coleslaw) (in-package :coleslaw)
(defclass post (content) (defclass post (content)
((title :initform nil :initarg :title :accessor title-of) ((title :initarg :title :reader title-of)
(author :initform nil :initarg :author :accessor author-of) (author :initarg :author :accessor author-of)
(format :initform nil :initarg :format :accessor post-format))) (format :initarg :format :accessor post-format)))
(defmethod initialize-instance :after ((object post) &key) (defmethod initialize-instance :after ((object post) &key)
(with-accessors ((title title-of) (with-accessors ((title title-of)