From ccfbf97f6b42383bd0f0bfc14b05d2a37375f8d5 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sat, 26 Aug 2023 15:03:22 +0100 Subject: 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. --- src/guile/skribilo/engine/html.scm | 16 +++++++--------- 1 file 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 \n") -- cgit v1.2.3