about summary refs log tree commit diff
diff options
context:
space:
mode:
-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")