commit 8f77168ccdf19e539881ed024e2f5a01d0cabc88
parent d9c6748afa906e99a068f28e6ff8796151e84f15
Author: Adriel Dumas--Jondeau <leirda@disroot.org>
Date: Sun, 8 Sep 2024 15:29:12 +0200
Only includes posts with media tags on gallery page
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/duper/builder/gallery.scm b/duper/builder/gallery.scm
@@ -4,6 +4,7 @@
#:use-module (haunt post)
#:use-module (sxml match)
#:use-module (sxml xpath)
+ #:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (gallery))
@@ -49,9 +50,12 @@ string, and an SXML tree of the page body. It returns one value: a new SXML tree
representing complete HTML page that presumably wraps the page body."
(lambda (site posts)
(serialized-artifact file-name
- (map (lambda (p)
- (section-template p ((sxml-filter media-tags)
- (post-sxml p))))
+ (filter-map (lambda (p)
+ (let ((m ((sxml-filter media-tags)
+ (post-sxml p))))
+ (if (null? m)
+ #f
+ (section-template p m))))
(filter posts))
(lambda (body port)
(sxml->html (template site title body) port)))))