Use default-initargs, switch some accessors to readers.
This commit is contained in:
parent
c0447fd7d0
commit
414b221e6b
3 changed files with 27 additions and 22 deletions
|
@ -1,20 +1,24 @@
|
|||
(in-package :coleslaw)
|
||||
|
||||
(defclass blog ()
|
||||
((author :initarg :author :accessor author)
|
||||
(deploy-dir :initarg :deploy-dir :accessor deploy-dir)
|
||||
(domain :initarg :domain :accessor domain)
|
||||
(feeds :initarg :feeds :accessor feeds)
|
||||
(license :initarg :license :accessor license)
|
||||
(page-ext :initarg :page-ext :accessor page-ext :initform "html")
|
||||
(plugins :initarg :plugins :accessor plugins)
|
||||
(repo :initarg :repo :accessor repo)
|
||||
(routing :initarg :routing :accessor routing)
|
||||
(separator :initarg :separator :accessor separator :initform ";;;;;")
|
||||
(sitenav :initarg :sitenav :accessor sitenav)
|
||||
(staging-dir :initarg :staging-dir :accessor staging-dir :initform "/tmp/coleslaw/")
|
||||
(theme :initarg :theme :accessor theme)
|
||||
(title :initarg :title :accessor title)))
|
||||
((author :initarg :author :reader author)
|
||||
(deploy-dir :initarg :deploy-dir :reader deploy-dir)
|
||||
(domain :initarg :domain :reader domain)
|
||||
(feeds :initarg :feeds :reader feeds)
|
||||
(license :initarg :license :reader license)
|
||||
(page-ext :initarg :page-ext :reader page-ext)
|
||||
(plugins :initarg :plugins :reader plugins)
|
||||
(repo :initarg :repo :reader repo)
|
||||
(routing :initarg :routing :reader routing)
|
||||
(separator :initarg :separator :reader separator)
|
||||
(sitenav :initarg :sitenav :reader sitenav)
|
||||
(staging-dir :initarg :staging-dir :reader staging-dir)
|
||||
(theme :initarg :theme :reader theme)
|
||||
(title :initarg :title :reader title))
|
||||
(:default-initargs
|
||||
:page-ext "html"
|
||||
:separator ";;;;;"
|
||||
:staging-dir "/tmp/coleslaw"))
|
||||
|
||||
(defparameter *config* nil
|
||||
"A variable to store the blog configuration and plugin settings.")
|
||||
|
|
|
@ -31,11 +31,12 @@
|
|||
;; Content Types
|
||||
|
||||
(defclass content ()
|
||||
((file :initform nil :initarg :file :accessor content-file)
|
||||
(tags :initform nil :initarg :tags :accessor content-tags)
|
||||
(slug :initform nil :initarg :slug :accessor content-slug)
|
||||
(date :initform nil :initarg :date :accessor content-date)
|
||||
(text :initform nil :initarg :text :accessor content-text)))
|
||||
((file :initarg :file :reader content-file)
|
||||
(date :initarg :date :reader content-date)
|
||||
(tags :initarg :tags :accessor content-tags)
|
||||
(slug :initarg :slug :accessor content-slug)
|
||||
(text :initarg :text :accessor content-text))
|
||||
(:default-initargs :tags nil :date nil :slug nil))
|
||||
|
||||
(defmethod initialize-instance :after ((object content) &key)
|
||||
(with-accessors ((tags content-tags)) object
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
(in-package :coleslaw)
|
||||
|
||||
(defclass post (content)
|
||||
((title :initform nil :initarg :title :accessor title-of)
|
||||
(author :initform nil :initarg :author :accessor author-of)
|
||||
(format :initform nil :initarg :format :accessor post-format)))
|
||||
((title :initarg :title :reader title-of)
|
||||
(author :initarg :author :accessor author-of)
|
||||
(format :initarg :format :accessor post-format)))
|
||||
|
||||
(defmethod initialize-instance :after ((object post) &key)
|
||||
(with-accessors ((title title-of)
|
||||
|
|
Loading…
Add table
Reference in a new issue