summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès2012-05-26 16:36:56 +0200
committerLudovic Courtès2012-05-27 22:34:41 +0200
commit5bf87ad42c1e4c361401af7786f552ee1242698f (patch)
treef0bd96c14a874a9a7beb2866d2215aff91eb572d
parent5c69154f8ef9c10425d26ecb3a2c65f01b76959b (diff)
downloadskribilo-5bf87ad42c1e4c361401af7786f552ee1242698f.tar.gz
skribilo-5bf87ad42c1e4c361401af7786f552ee1242698f.tar.lz
skribilo-5bf87ad42c1e4c361401af7786f552ee1242698f.zip
info: Implement the `image' markup.
* src/guile/skribilo/engine/info.scm (image): New markup writer. * doc/user/infoe.skb (Info Engine): Mention image rendering.
-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: