commit 9dff21e148affc7c38cfaec3ebe72d7be3713770
parent ed8913217ce52cace03b7f5c45fabd7440fa9887
Author: Adriel Dumas--Jondeau <leirda@disroot.org>
Date: Mon, 4 Nov 2024 12:56:06 +0100
Ajoute un containeur pour des images dans le site
Diffstat:
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/duper.scm b/duper.scm
@@ -6,6 +6,8 @@
#:use-module (sxml match)
#:use-module (sxml simple)
+ #:use-module (srfi srfi-19)
+
#:re-export (xml->sxml))
(define (svg-uns sxml)
@@ -25,11 +27,26 @@
`((ns . ,ns)))))))
(svg-uns (caddr sxml))))
+(define-public (post-date->string post)
+ (date->string (post-date post)"~Y-~m-~d"))
+
+(define-public (make-slug post)
+ (string-append/shared
+ (post-date->string post) "-" (post-slug-v2 post)))
+
+(define-public (duper-photos srcs)
+ `(ul (@ (class "media-container"))
+ ,@(map (lambda (src)
+ `(li (a (@ (href ,src))
+ (img (@ (src ,src))))))
+ srcs)))
+
(define-public (duper-gallery-template post medias)
(let ((media-src (lambda (media)
(sxml-match media
((img (@ (src ,src))) src)))))
- `((h2 ,(post-title post))
+ `((h2 (a (@ (href ,(string-append "/blog/" (make-slug post) ".html")))
+ ,(post-title post)))
(ul (@ (class "media-container"))
,@(map (lambda (media)
`(li (a (@ (href ,(media-src media)))
diff --git a/haunt.scm b/haunt.scm
@@ -14,7 +14,6 @@
#:use-module (haunt site)
#:use-module (srfi srfi-1)
- #:use-module (srfi srfi-19)
#:use-module (srfi srfi-26))
(define post-prefix
@@ -23,13 +22,6 @@
(define event-prefix
"/évènements")
-(define (post-date->string post)
- (date->string (post-date post)"~Y-~m-~d"))
-
-(define (make-slug post)
- (string-append/shared
- (post-date->string post) "-" (post-slug-v2 post)))
-
(define (duper-post-template post)
`((div (@ (class "post-title"))
(h1 ,(post-title post))