|
@@ -48,19 +48,22 @@
|
48
|
48
|
(unless (string= (read-line in) ";;;;;")
|
49
|
49
|
(error "The provided file lacks the expected header.")))
|
50
|
50
|
(parse-field (str)
|
51
|
|
- (nth-value 1 (cl-ppcre:scan-to-strings "[a-zA-Z]+: (.*)" str))))
|
|
51
|
+ (nth-value 1 (cl-ppcre:scan-to-strings "[a-zA-Z]+: (.*)" str)))
|
|
52
|
+ (slurp-remainder ()
|
|
53
|
+ (read-sequence (make-string (- (file-length in) (file-position in)))
|
|
54
|
+ in :start (file-position in))))
|
52
|
55
|
(check-header)
|
53
|
56
|
(let ((args (loop for field in '("title" "tags" "date" "format")
|
54
|
57
|
for line = (read-line in nil)
|
55
|
58
|
appending (list (make-keyword (string-upcase field))
|
56
|
59
|
(aref (parse-field line) 0)))))
|
57
|
|
- (check-header)
|
58
|
|
- (setf (getf args :tags) (cl-ppcre:split ", " (getf args :tags))
|
59
|
|
- (getf args :format) (make-keyword (string-upcase (getf args :format))))
|
60
|
|
- (apply 'make-instance 'post
|
61
|
|
- (append args (list :content (render-content (read-line in nil)
|
62
|
|
- (getf args :format))
|
63
|
|
- :slug (slugify (getf args :title))))))))
|
|
60
|
+ (check-header)
|
|
61
|
+ (setf (getf args :tags) (cl-ppcre:split ", " (getf args :tags))
|
|
62
|
+ (getf args :format) (make-keyword (string-upcase (getf args :format))))
|
|
63
|
+ (apply 'make-instance 'post
|
|
64
|
+ (append args (list :content (render-content (slurp-remainder)
|
|
65
|
+ (getf args :format))
|
|
66
|
+ :slug (slugify (getf args :title))))))))
|
64
|
67
|
|
65
|
68
|
(defun write-post (post &key prev next)
|
66
|
69
|
"Write out the HTML for POST in SLUG.html."
|