From 414b221e6b19f1477e2ac318f0fa0d485af51649 Mon Sep 17 00:00:00 2001 From: Brit Butler Date: Thu, 15 May 2014 10:43:08 -0400 Subject: [PATCH] Use default-initargs, switch some accessors to readers. --- src/config.lisp | 32 ++++++++++++++++++-------------- src/content.lisp | 11 ++++++----- src/posts.lisp | 6 +++--- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/config.lisp b/src/config.lisp index f484ff9..ec5ffe7 100644 --- a/src/config.lisp +++ b/src/config.lisp @@ -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.") diff --git a/src/content.lisp b/src/content.lisp index a4124ce..aa7cf72 100644 --- a/src/content.lisp +++ b/src/content.lisp @@ -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 diff --git a/src/posts.lisp b/src/posts.lisp index 5c22047..3cd8663 100644 --- a/src/posts.lisp +++ b/src/posts.lisp @@ -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)