Move CONSTRUCT into util, it's more general than CONTENT.
This commit is contained in:
parent
3ee8f43325
commit
74ac87d4e5
3 changed files with 6 additions and 6 deletions
|
@ -55,14 +55,14 @@ if necessary. DIR is ~ by default."
|
|||
(let ((config-form (read in)))
|
||||
(if (symbolp (car config-form))
|
||||
;; Single site config: ignore CONFIG-KEY.
|
||||
(setf *config* (apply #'make-instance 'blog config-form))
|
||||
(setf *config* (construct 'blog config-form))
|
||||
;; Multi-site config: load config section for CONFIG-KEY.
|
||||
(let* ((config-key-pathname (cl-fad:pathname-as-directory config-key))
|
||||
(section (assoc config-key-pathname config-form
|
||||
:key #'cl-fad:pathname-as-directory
|
||||
:test #'equal)))
|
||||
(if section
|
||||
(setf *config* (apply #'make-instance 'blog (cdr section))
|
||||
(setf *config* (construct 'blog (cdr section))
|
||||
(repo *config*) config-key)
|
||||
(error 'unknown-config-section-error
|
||||
:text (format nil "In ~A: No such key: '~A'." in config-key)))))
|
||||
|
|
|
@ -22,10 +22,6 @@
|
|||
(date :initform nil :initarg :date :accessor content-date)
|
||||
(text :initform nil :initarg :text :accessor content-text)))
|
||||
|
||||
(defun construct (content-type args)
|
||||
"Create an instance of CONTENT-TYPE with the given ARGS."
|
||||
(apply 'make-instance content-type args))
|
||||
|
||||
(defun tag-p (tag obj)
|
||||
"Test if OBJ is tagged with TAG."
|
||||
(member tag (content-tags obj) :test #'tag-slug=))
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
(in-package :coleslaw)
|
||||
|
||||
(defun construct (class-name args)
|
||||
"Create an instance of CLASS-NAME with the given ARGS."
|
||||
(apply 'make-instance class-name args))
|
||||
|
||||
(defun fmt (fmt-str args)
|
||||
"A convenient FORMAT interface for string building."
|
||||
(apply 'format nil fmt-str args))
|
||||
|
|
Loading…
Add table
Reference in a new issue