|
@@ -70,7 +70,7 @@
|
70
|
70
|
(defun discover (content-type)
|
71
|
71
|
"Load all content of the given CONTENT-TYPE from disk."
|
72
|
72
|
(purge-all content-type)
|
73
|
|
- (let ((file-type (string-downcase (princ-to-string content-type))))
|
|
73
|
+ (let ((file-type (string-downcase (symbol-name content-type))))
|
74
|
74
|
(do-files (file (repo *config*) file-type)
|
75
|
75
|
(let ((obj (construct content-type (read-content file))))
|
76
|
76
|
(if (gethash (content-slug obj) *content*)
|
|
@@ -78,16 +78,10 @@
|
78
|
78
|
(content-slug obj))
|
79
|
79
|
(setf (gethash (content-slug obj) *content*) obj))))))
|
80
|
80
|
|
81
|
|
-(defmacro do-ctypes (&body body)
|
82
|
|
- "Iterate over the subclasses of CONTENT performing BODY with ctype lexically
|
83
|
|
-bound to the current subclass."
|
84
|
|
- (alexandria:with-gensyms (ctypes)
|
85
|
|
- `(let ((,ctypes (closer-mop:class-direct-subclasses (find-class 'content))))
|
86
|
|
- (loop for ctype in (mapcar #'class-name ,ctypes) do ,@body))))
|
87
|
|
-
|
88
|
81
|
(defun load-content ()
|
89
|
82
|
"Load all content stored in the blog's repo."
|
90
|
|
- (do-ctypes (discover ctype)))
|
|
83
|
+ (do-subclasses (ctype content)
|
|
84
|
+ (discover ctype)))
|
91
|
85
|
|
92
|
86
|
(defun by-date (content)
|
93
|
87
|
"Sort CONTENT in reverse chronological order."
|