summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2025-03-24 23:18:25 +0000
committerArun Isaac2025-03-25 01:05:32 +0000
commit5481562aa2517829456be1d570b51ed76b6caaf6 (patch)
tree35db50a1a49d4fb89e2c0784faa4d6c9da537180
parent62116be7fca25c78d1a72ddbc19282676b2ac729 (diff)
downloadtissue-5481562aa2517829456be1d570b51ed76b6caaf6.tar.gz
tissue-5481562aa2517829456be1d570b51ed76b6caaf6.tar.lz
tissue-5481562aa2517829456be1d570b51ed76b6caaf6.zip
web: Allow setting multiple customizations on engine.
* tissue/web/static.scm: Import (ice-9 match). (engine-custom-set): Accept key-value pairs instead of a single key and value. (html-engine): Update engine-custom-set call.
-rw-r--r--tissue/web/static.scm22
1 files changed, 13 insertions, 9 deletions
diff --git a/tissue/web/static.scm b/tissue/web/static.scm
index 2b910cb..ad9849b 100644
--- a/tissue/web/static.scm
+++ b/tissue/web/static.scm
@@ -1,5 +1,5 @@
;;; tissue --- Text based issue tracker
-;;; Copyright © 2022, 2023 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2022, 2023, 2025 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of tissue.
;;;
@@ -26,6 +26,7 @@
#:use-module (srfi srfi-28)
#:use-module (srfi srfi-171)
#:use-module (ice-9 filesystem)
+ #:use-module (ice-9 match)
#:use-module (skribilo engine)
#:use-module (skribilo evaluator)
#:use-module (skribilo reader)
@@ -75,12 +76,15 @@ read from and the output port to write to."
get-bytevector-some
in))))
-(define (engine-custom-set engine key value)
- "Set custom @var{key} of @var{engine} to @var{value}. This is a purely
+(define (engine-custom-set engine . key-value-pairs)
+ "Set custom @var{key-value-pairs} of @var{engine}. This is a purely
functional setter that operates on a copy of @var{engine}. It does not
mutate @var{engine}."
(let ((clone (copy-engine (engine-ident engine) engine)))
- (engine-custom-set! clone key value)
+ (for-each (match-lambda
+ ((key . value)
+ (engine-custom-set! clone key value)))
+ key-value-pairs)
clone))
(define* (html-engine #:key css)
@@ -88,11 +92,11 @@ mutate @var{engine}."
@var{css} is the URI to a CSS stylesheet. If it is @code{#f}, no
stylesheet is included in the generated web pages."
- (if css
- (engine-custom-set (find-engine 'html)
- 'css
- (list css))
- (find-engine 'html)))
+ (apply engine-custom-set
+ (find-engine 'html)
+ (if css
+ `((css . ,(list css)))
+ '())))
(define (gemtext-reader)
"Return a skribilo reader for gemtext."