about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorArun Isaac2023-08-26 15:03:22 +0100
committerArun Isaac2023-08-29 17:08:45 +0100
commitccfbf97f6b42383bd0f0bfc14b05d2a37375f8d5 (patch)
treebe235fdb7c99efed301b68732e0f5ffbbc0e44ff /src
parentb38a7c9add4c299273779bab1f269b07aa9c2174 (diff)
downloadskribilo-ccfbf97f6b42383bd0f0bfc14b05d2a37375f8d5.tar.gz
skribilo-ccfbf97f6b42383bd0f0bfc14b05d2a37375f8d5.tar.lz
skribilo-ccfbf97f6b42383bd0f0bfc14b05d2a37375f8d5.zip
html: Use call-with-input-file to read inline CSS files.
* src/guile/skribilo/engine/html.scm: Import (rnrs exceptions).
(&html-header-style): Use call-with-input-file, instead of
open-input-file and close-input-port, to read inline CSS files.
Diffstat (limited to 'src')
-rw-r--r--src/guile/skribilo/engine/html.scm16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm
index 525567c..65eb9a9 100644
--- a/src/guile/skribilo/engine/html.scm
+++ b/src/guile/skribilo/engine/html.scm
@@ -47,6 +47,7 @@
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-39)
 
+  #:use-module (rnrs exceptions)
   #:use-module (rnrs io ports)
 
   #:export (html-engine html-title-engine html-file
@@ -879,15 +880,12 @@ unspecified or #f values are ignored."
                  (display "  li.skribilo-toc-item::marker { content: attr(skribilo-toc-item-marker) }\n")
 		 (when (pair? icss)
 		    (for-each (lambda (css)
-				 (let ((p (open-input-file css)))
-				    (if (not (input-port? p))
-					(skribe-error
-					 'html-css
-					 "Can't open CSS file for input"
-					 css)
-					(begin
-                                          (display (get-string-all p))
-					  (close-input-port p)))))
+                                (display (guard (c (else (skribe-error
+				                          'html-css
+				                          "Can't open CSS file for input"
+				                          css)))
+                                           (call-with-input-file css
+                                             get-string-all))))
 			      icss))))
    :after "  -->\n </style>\n")