commit 1127b1ff991aa40d96c6ac91ae68b51f85822c8d
parent 6a27f0588f5f5add3756bbf40e97cb45de123a14
Author: Adriel Dumas--Jondeau <leirda@disroot.org>
Date: Sun, 23 Jun 2024 19:38:29 +0200
Permet de cliquer sur les images dans la galerie
Diffstat:
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/duper.scm b/duper.scm
@@ -1,4 +1,6 @@
(define-module (duper)
+ #:use-module (haunt post)
+
#:use-module (ice-9 match)
#:use-module (ice-9 textual-ports)
#:use-module (sxml match)
@@ -23,6 +25,17 @@
`((ns . ,ns)))))))
(svg-uns (caddr sxml))))
+(define-public (duper-gallery-template post medias)
+ (let ((media-src (lambda (media)
+ (sxml-match media
+ ((img (@ (src ,src))) src)))))
+ `((h2 ,(post-title post))
+ (ul (@ (class "media-container"))
+ ,@(map (lambda (media)
+ `(li (a (@ (href ,(media-src media)))
+ ,media)))
+ medias)))))
+
(define-public (urls xs)
`(ul ,@(map (match-lambda
((to . desc) `(li (a (@ (href ,to)) ,desc))))
diff --git a/haunt.scm b/haunt.scm
@@ -94,12 +94,6 @@
("https://creativecommons.org/licenses/by-sa/4.0/"
. "la licence CC BY-SA"))))))
-(define (duper-gallery-template post medias)
- `((h2 ,(post-title post))
- (ul (@ (class "media-container"))
- ,@(map (lambda (media)
- `(li ,media)) medias))))
-
(define duper-theme
(theme #:name "duper"
#:layout duper-layout