From 312d098d351a938d84ecf0e20c6235196f3669c8 Mon Sep 17 00:00:00 2001
From: fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>
Date: Thu, 18 Mar 2010 02:39:13 +0000
Subject: [PATCH] Texinfo writer: Handle images in figures.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1901 788f1e2b-df1e-0410-8736-df70ead52e1b
---
 src/Text/Pandoc/Writers/Texinfo.hs | 6 ++++++
 tests/writer.texinfo               | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/src/Text/Pandoc/Writers/Texinfo.hs b/src/Text/Pandoc/Writers/Texinfo.hs
index bd77c57bb..47a318631 100644
--- a/src/Text/Pandoc/Writers/Texinfo.hs
+++ b/src/Text/Pandoc/Writers/Texinfo.hs
@@ -107,6 +107,12 @@ blockToTexinfo Null = return empty
 blockToTexinfo (Plain lst) =
   inlineListToTexinfo lst
 
+blockToTexinfo (Para [Image txt (src,tit)]) = do
+  capt <- inlineListToTexinfo txt
+  img  <- inlineToTexinfo (Image txt (src,tit))
+  return $ text "@float" $$ img $$ (text "@caption{" <> capt <> char '}') $$
+           text "@end float"
+
 blockToTexinfo (Para lst) =
   inlineListToTexinfo lst    -- this is handled differently from Plain in blockListToTexinfo
 
diff --git a/tests/writer.texinfo b/tests/writer.texinfo
index 65f7aa457..149b5a737 100644
--- a/tests/writer.texinfo
+++ b/tests/writer.texinfo
@@ -977,7 +977,10 @@ or here: <http://example.com/>
 @chapter Images
 From ``Voyage dans la Lune'' by Georges Melies (1902):
 
+@float
 @image{lalune,,,lalune,jpg}
+@caption{lalune}
+@end float
 
 Here is a movie @image{movie,,,movie,jpg} icon.