|
@@ -15,6 +15,12 @@
|
15
|
15
|
(defgeneric page-path (object)
|
16
|
16
|
(:documentation "The path to store OBJECT at once rendered."))
|
17
|
17
|
|
|
18
|
+(defmethod page-path :around ((object object))
|
|
19
|
+ (let ((result (namestring (call-next-method))))
|
|
20
|
+ (if (position #\. result)
|
|
21
|
+ result
|
|
22
|
+ (concatenate 'string result ".html"))))
|
|
23
|
+
|
18
|
24
|
(defun render-page (content &optional theme-fn &rest render-args)
|
19
|
25
|
"Render the given CONTENT to disk using THEME-FN if supplied.
|
20
|
26
|
Additional args to render CONTENT can be passed via RENDER-ARGS."
|
|
@@ -26,15 +32,12 @@ Additional args to render CONTENT can be passed via RENDER-ARGS."
|
26
|
32
|
:injections (find-injections content))))
|
27
|
33
|
|
28
|
34
|
(defun write-page (filepath page)
|
29
|
|
- "Write the given PAGE to FILEPATH.html unless an extension is present."
|
30
|
|
- (let ((path (if (position #\. filepath)
|
31
|
|
- filepath
|
32
|
|
- (concatenate 'string filepath ".html"))))
|
33
|
|
- (ensure-directories-exist path)
|
34
|
|
- (with-open-file (out path
|
35
|
|
- :direction :output
|
36
|
|
- :if-does-not-exist :create)
|
37
|
|
- (write-line page out))))
|
|
35
|
+ "Write the given PAGE to FILEPATH."
|
|
36
|
+ (ensure-directories-exist filepath)
|
|
37
|
+ (with-open-file (out filepath
|
|
38
|
+ :direction :output
|
|
39
|
+ :if-does-not-exist :create)
|
|
40
|
+ (write-line page out)))
|
38
|
41
|
|
39
|
42
|
(defun compile-blog (staging)
|
40
|
43
|
"Compile the blog to a STAGING directory as specified in .coleslawrc."
|