12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- (define-module (builders gallery-builder)
- #:use-module (theme theme)
- #:use-module (haunt site)
- #:use-module (haunt post)
- #:use-module (haunt page)
- #:use-module (haunt html)
- #:use-module (haunt utils)
- #:use-module (utils utils)
- #:use-module (ice-9 match)
- #:use-module (ice-9 ftw)
- #:declarative? #f
- #:export (gallery-builder))
- (define remove-stat
-
-
- (match-lambda
- ((name stat)
- name)
- ((name stat children ...)
- (list name (map remove-stat children)))))
- (define (gallery-images-list)
- (car
- (cdr
- (let ([dir "./images/gallery/"])
- (remove-stat (file-system-tree dir))))))
- (define (gallery-images-html list)
- (let loop ([list list])
- (if (null? list)
- '()
- `((img (@ (src ,(string-append "./images/gallery/" (car list)) )))
- ,(loop (cdr list))))))
- (define (gallery-builder)
- (lambda (site posts)
- (make-page "gallery.html"
- (gnucode-layout site "Gallery"
- `((div (@ (class "gallery-flex"))
- ,(gallery-images-html (gallery-images-list))
- )))
- sxml->html)))
|