Browse Source

Use write-document throughout. Render-function cleanup done.

Brit Butler 11 years ago
parent
commit
7e028d354e
3 changed files with 8 additions and 25 deletions
  1. 0 8
      docs/hacking.md
  2. 7 15
      src/indexes.lisp
  3. 1 2
      src/posts.lisp

+ 0 - 8
docs/hacking.md

@@ -184,14 +184,6 @@ changes to at least the post templates and the `read-content`
184 184
 function. There may be other areas where it was assumed tags/dates
185 185
 will always be present.
186 186
 
187
-### Render Function Cleanup
188
-
189
-There are currently 3 render-foo* functions and 3 implementations of the
190
-render method. Only the render-foo* functions call `write-file` so there
191
-should be some room for cleanup here. The render method implementations
192
-are probably necessary unless we want to start storing their arguments
193
-on the models. There may be a different way to abstract the data flow.
194
-
195 187
 ### User-Defined Routing
196 188
 
197 189
 There is no reason *coleslaw* should be in charge of the site layout or

+ 7 - 15
src/indexes.lisp

@@ -33,7 +33,7 @@
33 33
 
34 34
 (defmethod publish ((doc-type (eql (find-class 'tag-index))))
35 35
   (dolist (index (find-all 'tag-index))
36
-    (render-index index)))
36
+    (write-document index)))
37 37
 
38 38
 ;;; Index by Month
39 39
 
@@ -55,7 +55,7 @@
55 55
 
56 56
 (defmethod publish ((doc-type (eql (find-class 'month-index))))
57 57
   (dolist (index (find-all 'month-index))
58
-    (render-index index)))
58
+    (write-document index)))
59 59
 
60 60
 ;;; Reverse Chronological Index
61 61
 
@@ -81,8 +81,9 @@
81 81
     (dolist (index indexes)
82 82
       (let ((prev (1- (index-slug index)))
83 83
             (next (1+ (index-slug index))))
84
-        (render-index index :prev (when (plusp prev) prev)
85
-                            :next (when (<= next (length indexes)) next))))))
84
+        (write-document index nil
85
+                        :prev (when (plusp prev) prev)
86
+                        :next (when (<= next (length indexes)) next))))))
86 87
 
87 88
 ;;; Atom and RSS Feeds
88 89
 
@@ -100,7 +101,7 @@
100 101
 
101 102
 (defmethod publish ((doc-type (eql (find-class 'feed))))
102 103
   (dolist (feed (find-all 'feed))
103
-    (render-feed feed)))
104
+    (write-document feed (theme-fn (feed-format feed) "feeds"))))
104 105
 
105 106
 ;;; Tag Feeds
106 107
 
@@ -121,7 +122,7 @@
121 122
 
122 123
 (defmethod publish ((doc-type (eql (find-class 'tag-feed))))
123 124
   (dolist (feed (find-all 'tag-feed))
124
-    (render-feed feed)))
125
+    (write-document feed (theme-fn (feed-format feed) "feeds"))))
125 126
 
126 127
 ;;; Helper Functions
127 128
 
@@ -136,12 +137,3 @@
136 137
   (let* ((dupes (mappend #'content-tags (find-all 'post)))
137 138
          (tags (remove-duplicates dupes :test #'string= :key #'tag-slug)))
138 139
     (sort tags #'string< :key #'tag-name)))
139
-
140
-(defun render-feed (feed)
141
-  "Render the given FEED to both RSS and ATOM."
142
-  (let ((theme-fn (theme-fn (feed-format feed) "feeds")))
143
-    (write-file (page-path feed) (render-page feed theme-fn))))
144
-
145
-(defun render-index (index &rest render-args)
146
-  "Render the given INDEX using RENDER-ARGS if provided."
147
-  (write-file (page-path index) (apply #'render-page index nil render-args)))

+ 1 - 2
src/posts.lisp

@@ -26,5 +26,4 @@
26 26
 
27 27
 (defmethod publish ((doc-type (eql (find-class 'post))))
28 28
   (loop for (next post prev) on (append '(nil) (by-date (find-all 'post)))
29
-     while post do (write-file (page-path post)
30
-                               (render-page post nil :prev prev :next next))))
29
+     while post do (write-document post nil :prev prev :next next)))