projects
/
~bandali
/
bndl.org
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
08d93db
)
avoid repetition of post list table code
author
Amin Bandali
<bandali@gnu.org>
Fri, 6 Dec 2019 17:49:23 +0000
(12:49 -0500)
committer
Amin Bandali
<bandali@gnu.org>
Fri, 6 Dec 2019 17:49:23 +0000
(12:49 -0500)
haunt.scm
patch
|
blob
|
blame
|
history
diff --git
a/haunt.scm
b/haunt.scm
index
7b2d740
..
7948659
100644
(file)
--- a/
haunt.scm
+++ b/
haunt.scm
@@
-137,12
+137,25
@@
resulting list is of an odd length and every second element is DELIM."
"https://man.sr.ht/lists.sr.ht/etiquette.md") "]")
".")))
"https://man.sr.ht/lists.sr.ht/etiquette.md") "]")
".")))
+(define* (post-uri site post #:optional prefix)
+ (string-append (or prefix "") "/"
+ (site-post-slug site post) ".html"))
+
+(define* (post-list-table site posts #:optional prefix)
+ `((table
+ (@ (class "post-list"))
+ (tbody
+ ,@(map
+ (lambda (post)
+ `(tr
+ (td ,(aa (post-ref post 'title)
+ (post-uri site post prefix)))
+ (td (small ,(date->string (post-date post)
+ my-date-format)))))
+ posts)))))
+
(define* (my-collection-template site title posts prefix
#:optional all-posts tag)
(define* (my-collection-template site title posts prefix
#:optional all-posts tag)
- (define (post-uri post)
- (string-append (or prefix "") "/"
- (site-post-slug site post) ".html"))
-
`((h2 ,title
,(if tag
(aa `(img (@ (class "feed-icon-h2")
`((h2 ,title
,(if tag
(aa `(img (@ (class "feed-icon-h2")
@@
-150,16
+163,7
@@
resulting list is of an odd length and every second element is DELIM."
(alt "subscribe to atom feed")))
(tag-uri my-tag-prefix tag ".xml"))
'()))
(alt "subscribe to atom feed")))
(tag-uri my-tag-prefix tag ".xml"))
'()))
- (table
- (@ (class "post-list"))
- (tbody
- ,@(map (lambda (post)
- `(tr
- (td ,(aa (post-ref post 'title) (post-uri post)))
- (td (small
- ,(date->string (post-date post)
- my-date-format)))))
- posts)))
+ ,(post-list-table site posts prefix)
(h2 "Tags")
,(tag-links (or all-posts posts))
,(if tag
(h2 "Tags")
,(tag-links (or all-posts posts))
,(if tag
@@
-297,19
+301,7
@@
resulting list is of an odd length and every second element is DELIM."
(src "/icon-12px.png")
(alt "subscribe to rss feed")))
"RSS") "notes.rss") " feeds.")
(src "/icon-12px.png")
(alt "subscribe to rss feed")))
"RSS") "notes.rss") " feeds.")
- (table
- (@ (class "post-list"))
- (tbody
- ,@(map
- (lambda (post)
- (define (post-uri post)
- (string-append "/"
- (site-post-slug site post) ".html"))
- `(tr
- (td ,(aa (post-ref post 'title) (post-uri post)))
- (td (small
- ,(date->string (post-date post) my-date-format)))))
- (take-up-to 10 (posts/reverse-chronological posts)))))))
+ ,(post-list-table site posts)))
(define (index-page site posts)
(make-page
(define (index-page site posts)
(make-page