|
|
|
|
28
|
(format nil "~a-~2,'0d-~2,'0d ~a" year (position month +short-month-names+
|
28
|
(format nil "~a-~2,'0d-~2,'0d ~a" year (position month +short-month-names+
|
29
|
:test #'string=) date time)))
|
29
|
:test #'string=) date time)))
|
30
|
|
30
|
|
31
|
-(defun import-post (post output &optional (since nil since-supplied-p))
|
|
|
|
|
31
|
+(defun import-post (post output &optional since)
|
32
|
(when (and (string= "publish" (node-val "wp:status" post)) ; is it public?
|
32
|
(when (and (string= "publish" (node-val "wp:status" post)) ; is it public?
|
33
|
(string= "post" (node-val "wp:post_type" post)) ; is it a post?
|
33
|
(string= "post" (node-val "wp:post_type" post)) ; is it a post?
|
34
|
- (or (not since-supplied-p) (string>= (get-timestamp post) since)))
|
|
|
|
|
34
|
+ (or (null since) (string>= (get-timestamp post) since)))
|
35
|
(let ((slug (slugify (node-val "title" post))))
|
35
|
(let ((slug (slugify (node-val "title" post))))
|
36
|
(when (string= "" slug)
|
36
|
(when (string= "" slug)
|
37
|
(error "No valid slug-title for post ~a." (get-timestamp post)))
|
37
|
(error "No valid slug-title for post ~a." (get-timestamp post)))
|
|
|
|
|
58
|
(ensure-directories-exist (or output (repo *config*)))
|
58
|
(ensure-directories-exist (or output (repo *config*)))
|
59
|
(let* ((xml (cxml:parse-file filepath (cxml-dom:make-dom-builder)))
|
59
|
(let* ((xml (cxml:parse-file filepath (cxml-dom:make-dom-builder)))
|
60
|
(posts (dom:get-elements-by-tag-name xml "item")))
|
60
|
(posts (dom:get-elements-by-tag-name xml "item")))
|
61
|
- (loop for post across posts do (if since (import-post post output since)
|
|
|
62
|
- (import-post post output)))
|
|
|
|
|
61
|
+ (loop for post across posts do (import-post post output since))
|
63
|
(delete-file filepath))))
|
62
|
(delete-file filepath))))
|
64
|
|
63
|
|
65
|
(defun enable (&key filepath output)
|
64
|
(defun enable (&key filepath output)
|