From a18292538f1d45d3f2dce8da530e031b91ac3739 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 21 Dec 2008 23:12:03 +0100 Subject: lout: Issue a warning instead of an error for `(image :url ...)'. * src/guile/skribilo/engine/lout.scm (image): Produce a warning, not an error, if URL is provided. Use SRFI-35 conditions for invalid arguments. * po/POTFILES.in: Add. * NEWS: Update. --- src/guile/skribilo/engine/lout.scm | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/guile/skribilo/engine/lout.scm b/src/guile/skribilo/engine/lout.scm index 64e8634..7a9e871 100644 --- a/src/guile/skribilo/engine/lout.scm +++ b/src/guile/skribilo/engine/lout.scm @@ -24,6 +24,7 @@ :use-module (skribilo config) :use-module (skribilo engine) :use-module (skribilo writer) + :use-module (skribilo condition) :use-module (skribilo utils keywords) :use-module (skribilo utils strings) :use-module (skribilo utils syntax) @@ -37,6 +38,8 @@ :use-module (srfi srfi-11) :use-module (srfi srfi-13) :use-module (srfi srfi-14) + :autoload (srfi srfi-34) (raise) + :use-module (srfi srfi-35) :autoload (ice-9 popen) (open-output-pipe) :autoload (ice-9 rdelim) (read-line) @@ -2399,18 +2402,24 @@ (if (list? efmt) efmt '("eps")))))) - (if url ;; maybe we should run `wget' then? :-) - (skribe-error 'lout "Image URLs not supported" url)) - (if (not (string? img)) - (skribe-error 'lout "Illegal image" file) - (begin - (if width - (format #t "\n~a @Wide" (lout-width width))) - (if height - (format #t "\n~a @High" (lout-width height))) - (if zoom - (format #t "\n~a @Scale" zoom)) - (format #t "\n@IncludeGraphic { \"~a\" }\n" img)))))) + (cond (url ;; maybe we should run `wget' then? :-) + (skribe-warning/ast 1 n + (_ "image URLs not supported"))) + + ((string? img) + (if width + (format #t "\n~a @Wide" (lout-width width))) + (if height + (format #t "\n~a @High" (lout-width height))) + (if zoom + (format #t "\n~a @Scale" zoom)) + (format #t "\n@IncludeGraphic { \"~a\" }\n" img)) + + (else + (raise (condition + (&invalid-argument-error + (proc-name "image/lout") + (argument img))))))))) ;*---------------------------------------------------------------------*/ ;* Ornaments ... */ -- cgit v1.2.3