summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/user/infoe.skb7
-rw-r--r--src/guile/skribilo/engine/info.scm21
2 files changed, 25 insertions, 3 deletions
diff --git a/doc/user/infoe.skb b/doc/user/infoe.skb
index d11e0b6..5297f3d 100644
--- a/doc/user/infoe.skb
+++ b/doc/user/infoe.skb
@@ -39,9 +39,10 @@ conflicts, using the ,(param :info-node) option of ,(markup-ref
"chapter"), etc.]))
Most markups shown in ,(numref :text [Chapter] :ident "std-markups") are
-meaningfully rendered in Info, including tables. However, since Info is
-a text-only format, markups such as ,(markup-ref "image") do not yield a
-graphical output as with other engines.]))
+meaningfully rendered in Info, including tables. The ,(markup-ref
+"image") markup is also implemented: the Info reader in Emacs 23 and
+later is able to display them, or to display the alternate text (the
+body of the ,(markup-ref "image") markup) when running in text mode.]))
;;; Local Variables:
;;; ispell-local-dictionary: "american"
diff --git a/src/guile/skribilo/engine/info.scm b/src/guile/skribilo/engine/info.scm
index d25e584..06916d2 100644
--- a/src/guile/skribilo/engine/info.scm
+++ b/src/guile/skribilo/engine/info.scm
@@ -784,6 +784,27 @@
(output (markup-body n) e)
(output-flush *margin*)))
+;*---------------------------------------------------------------------*/
+;* info ::%image ... */
+;*---------------------------------------------------------------------*/
+(markup-writer 'image info-engine
+ :options '(:file :url :width :height)
+ :validate (lambda (n e)
+ (string? (markup-option n :file)))
+ :action (lambda (n e)
+ (if (markup-option n :url)
+ (skribe-warning/ast 1 n (_ "image URLs not supported"))
+ (let ((f (markup-option n :file))
+ (h (markup-option n :height))
+ (w (markup-option n :width)))
+ ;; The Info mode in Emacs 23+ supports just a few
+ ;; properties of the `image' tag, such as `alt' and `text';
+ ;; it doesn't support `height' and `width' (yet?).
+ (and (string? f)
+ (format #t "\n\0\b[image alt=\"~a\" ~:[~*~;width=\"~a\" ~]~:[~*~;height=\"~a\" ~]src=\"~a\"\0\b]~%"
+ (ast->string (markup-body n))
+ w w h h f))))))
+
;;; Local Variables:
;;; eval: (put 'markup-writer 'scheme-indent-function 2)
;;; End: