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.
---
 NEWS                               |  1 +
 po/POTFILES.in                     |  1 +
 src/guile/skribilo/engine/lout.scm | 33 +++++++++++++++++++++------------
 3 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/NEWS b/NEWS
index 8395eb1..5db8603 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Copyright (C) 2005, 2006, 2007, 2008  Ludovic Courtès <ludo@gnu.org>
 ** Improved configure-time diagnostics
 ** `skribilo' now displays a call stack trace upon error when possible
 ** New `--custom' compiler option
+** Using `(image :url ...)' with `lout' yields a warning, not an error
 
 * New in Skribilo 0.9.1
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4880ebc..3132e9a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -12,3 +12,4 @@ src/guile/skribilo/index.scm
 src/guile/skribilo/source.scm
 src/guile/skribilo/sui.scm
 src/guile/skribilo/verify.scm
+src/guile/skribilo/engine/lout.scm
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