/
image-post.scm
37 lines (34 loc) · 1.71 KB
/
image-post.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
;; +--------------------------------------------------------------------------+
;; +-+----------------------------------------------------------------------+-+
;; +-| IMAGE POSTS |-+
;; +-| TYPE TAG: picture |-+
;; +-+----------------------------------------------------------------------+-+
;; +-| POST TAGS |-+
;; +-| - type |-+
;; +-| - date |-+
;; +-| - image |-+
;; +-| - tags |-+
;; +-+----------------------------------------------------------------------+-+
;; +-| For posting images as the body of the post with nothing else; the |-+
;; +-| title and date are included as one might expect. |-+
;; +-+----------------------------------------------------------------------+-+
;; +--------------------------------------------------------------------------+
(define parse-image-post
(lambda (post)
(let* ((date (extract-date post))
(image (list->string (cdr (assq 'image post)))))
(string-append
(make-content-div (picture-body image))
"<div align=\"left\">"
(parse-date date)
"</div>"
))))
(define picture-body
(lambda (img)
(string-append
"<div id=\"image\"><a href=\"img/"
img
"\"> <img src=\"img/"
img
"\" /></a></div>")))
(set! post-types (cons `(picture . ,parse-image-post) post-types))