Implement find-by-date, improve tag handling, minor cleanups and TODO updates.
This commit is contained in:
parent
ae9d51c79b
commit
1e34b55483
4 changed files with 26 additions and 13 deletions
8
TODO
8
TODO
|
@ -12,14 +12,12 @@ Ideas:
|
|||
;;;; DYNAMIC
|
||||
|
||||
;;;; STATIC
|
||||
;;;; implement *output-dir*, render-site.
|
||||
;;; posts
|
||||
;; Implement find-by-date.
|
||||
;; Make post-url not suck.
|
||||
;; Consider having find-by-range collect all the hash-values in :posts
|
||||
;; and return the range of that list rather than the posts matching start->end.
|
||||
;; Consider storing tags as a list.
|
||||
;; Make find-by-date, post-url not suck.
|
||||
|
||||
;;;; PLUGINS
|
||||
;;;; implement disqus support
|
||||
;;; import
|
||||
;; add comment handling ... (when comments ...)
|
||||
;; support old URLs via use of post-aliases?
|
||||
|
|
|
@ -42,12 +42,12 @@ object is determined by SERVICE."))
|
|||
(parse-integer (third date)))))) ; year
|
||||
(when (public-p)
|
||||
(let ((new-post (make-post (node-val "title")
|
||||
(format nil "~{~A~^, ~}" (node-val "category"))
|
||||
(node-val "category")
|
||||
(make-timestamp (node-val "pubDate"))
|
||||
(regex-replace-all (string #\Newline)
|
||||
(node-val "content:encoded")
|
||||
"<br>")
|
||||
:aliases (node-val "wp:post_id")))
|
||||
:aliases (parse-integer (node-val "wp:post_id"))))
|
||||
(comments (nodes "wp:comment")))
|
||||
(add-post new-post (post-id new-post))))))
|
||||
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
:aliases aliases))
|
||||
|
||||
(defmethod add-post ((post post) id)
|
||||
(setf (gethash id (gethash :posts *storage*)) post))
|
||||
(setf (gethash id (gethash :posts *storage*)) post)
|
||||
(loop for tag in (post-tags post)
|
||||
do (pushnew tag (gethash :tags-index *storage*) :test #'string=)))
|
||||
|
||||
(defmethod remove-post (id)
|
||||
(setf (gethash id (gethash :posts *storage*)) nil))
|
||||
|
@ -18,16 +20,18 @@
|
|||
(flet ((fn (name)
|
||||
(find-symbol name (theme-package)))
|
||||
(pretty-date (date)
|
||||
(subseq (local-time:format-rfc1123-timestring nil date) 0 16)))
|
||||
(subseq (local-time:format-rfc1123-timestring nil date) 0 16))
|
||||
(pretty-tags (tags)
|
||||
(format nil "~{~A~^, ~}" tags)))
|
||||
(let* ((post (find-post id))
|
||||
(result (funcall (fn "POST")
|
||||
(list :title (post-title post)
|
||||
:tags (post-tags post)
|
||||
:tags (pretty-tags (post-tags post))
|
||||
:date (pretty-date (post-date post))
|
||||
:content (post-content post)
|
||||
:prev (when (find-post (1- id))
|
||||
(post-url (1- id)))
|
||||
:next (when (find-post (1+ oid))
|
||||
:next (when (find-post (1+ id))
|
||||
(post-url (1+ id)))))))
|
||||
result)))
|
||||
|
||||
|
@ -41,6 +45,17 @@
|
|||
(push post results)))
|
||||
results))
|
||||
|
||||
(defmethod find-by-date (date)
|
||||
(let ((results nil)
|
||||
(year (parse-integer (subseq date 0 4)))
|
||||
(month (parse-integer (subseq date 5))))
|
||||
(loop for post being the hash-values in (gethash :posts *storage*)
|
||||
do (let ((post-date (post-date post)))
|
||||
(when (and (= year (local-time:timestamp-year post-date))
|
||||
(= month (local-time:timestamp-month post-date)))
|
||||
(push post results))))
|
||||
results))
|
||||
|
||||
(defmethod find-by-range (start end)
|
||||
(loop for id from start upto end collecting (find-post id)))
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
{template index}
|
||||
{if $taglinks}
|
||||
<div id="tagsoup">
|
||||
<p>This blog covers: {$taglinks |noAutoescape}
|
||||
<p>This blog covers {$taglinks |noAutoescape}
|
||||
</div>
|
||||
{/if}
|
||||
{if $monthlinks}
|
||||
<div id="monthsoup">
|
||||
<p>View blogs from: {$monthlinks |noAutoescape}
|
||||
<p>View posts from {$monthlinks |noAutoescape}
|
||||
</div>
|
||||
{/if}
|
||||
<h1>{$title}</h1>
|
||||
|
|
Loading…
Add table
Reference in a new issue