65 lines
2.6 KiB
Text
65 lines
2.6 KiB
Text
|
(lambda (res posts)
|
||
|
(let ([article
|
||
|
`(article
|
||
|
,(cond
|
||
|
[(equal? res "settled")
|
||
|
'(hgroup (h1 "settled* thoughts")
|
||
|
(p (em "*-ish, something like a portfolio of projects")))]
|
||
|
[(equal? res "unsettled")
|
||
|
'(hgroup (h1 "unsettled thoughts")
|
||
|
(p (em "just doing some thinking aloud")))]
|
||
|
;; if res is tagged, build index of tags
|
||
|
[(equal? res "tagged")
|
||
|
'(hgroup (h1 "all the tags")
|
||
|
(p (em "you looking for a flavor of something?")))]
|
||
|
[(string-prefix? res "tagged/")
|
||
|
(let ([tag (string-replace res "tagged/" "#")])
|
||
|
`(hgroup (h1 ,(~a "stuff what's tagged like \"~a\"" tag))
|
||
|
(p (em (~a "everything (or maybe just some things) i've ever said about \"~a\"" tag)))))]
|
||
|
[else
|
||
|
'(hgroup (h1 "i'm lost")
|
||
|
(p (em "you weren't meant to be here")))]))])
|
||
|
(define (settled-post post)
|
||
|
`((div ((class "post-preview"))
|
||
|
(h4 ,(second post))
|
||
|
(p ,(third post))
|
||
|
(a ((href ,(~a "/settled/" (first post))))
|
||
|
,(~a "go! to " (second post) " page")))))
|
||
|
(define (unsettled-post post)
|
||
|
`((div ((class "post-preview"))
|
||
|
(h4 ,(second post))
|
||
|
(p ,(third post))
|
||
|
(a ((href ,(~a "/unsettled/" (first post))))
|
||
|
,(~a "go! to " (second post) " page")))))
|
||
|
(define (tag-post post)
|
||
|
`((div ((class "post-preview"))
|
||
|
(h4 ,(second post))
|
||
|
(p ,(third post))
|
||
|
(a ((href ,(~a "/tagged/" (first post))))
|
||
|
,(~a "go! to " (second post) " page")))))
|
||
|
(define (tagged-post post)
|
||
|
`((div ((class "post-preview"))
|
||
|
(h4 ,(second post))
|
||
|
(p ,(third post))
|
||
|
;; tagged posts will insert href instead of id
|
||
|
(a ((href ,first post))
|
||
|
,(~a "go! to " (second post) " page")))))
|
||
|
|
||
|
|
||
|
(if
|
||
|
(< 0 (length posts))
|
||
|
(for-each
|
||
|
(lambda (post)
|
||
|
(set! article
|
||
|
(append article
|
||
|
(cond
|
||
|
[(equal? res "settled") (settled-post post)]
|
||
|
[(equal? res "unsettled") (unsettled-post post)]
|
||
|
[(equal? res "tagged") (tag-post post)]
|
||
|
[(string-prefix? res "tagged/") (tagged-post post)]))))
|
||
|
posts)
|
||
|
(set! article
|
||
|
(append article
|
||
|
`((p "there's nothing here yet")))))
|
||
|
article))
|