aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-03-17 06:53:43 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-03-17 06:53:43 +0000
commit16e5b15cae3c96c185c6be64a5f7256e402067df (patch)
treed31c0f362dc8dc70678853a362ae5f69b456369d
parent1a09a9d40f9f956045c9d3daaa0c1316310e6d17 (diff)
downloadpandoc-16e5b15cae3c96c185c6be64a5f7256e402067df.tar.gz
Docbook writer: support images as figures.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1897 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r--src/Text/Pandoc/Writers/Docbook.hs8
-rw-r--r--tests/writer.docbook15
2 files changed, 14 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/src/Text/Pandoc/Writers/Docbook.hs
index 63647e3aa..fc97ed3ac 100644
--- a/src/Text/Pandoc/Writers/Docbook.hs
+++ b/src/Text/Pandoc/Writers/Docbook.hs
@@ -124,6 +124,14 @@ blockToDocbook :: WriterOptions -> Block -> Doc
blockToDocbook _ Null = empty
blockToDocbook _ (Header _ _) = empty -- should not occur after hierarchicalize
blockToDocbook opts (Plain lst) = wrap opts lst
+blockToDocbook opts (Para [Image txt (src,_)]) =
+ let capt = inlinesToDocbook opts txt
+ in inTagsIndented "figure" $
+ inTagsSimple "title" capt $$
+ (inTagsIndented "mediaobject" $
+ (inTagsIndented "imageobject"
+ (selfClosingTag "imagedata" [("fileref",src)])) $$
+ inTagsSimple "textobject" (inTagsSimple "phrase" capt))
blockToDocbook opts (Para lst) = inTagsIndented "para" $ wrap opts lst
blockToDocbook opts (BlockQuote blocks) =
inTagsIndented "blockquote" $ blocksToDocbook opts blocks
diff --git a/tests/writer.docbook b/tests/writer.docbook
index d4d771bc3..f771bf4af 100644
--- a/tests/writer.docbook
+++ b/tests/writer.docbook
@@ -1377,18 +1377,15 @@ or here: &lt;http://example.com/&gt;
<para>
From <quote>Voyage dans la Lune</quote> by Georges Melies (1902):
</para>
- <para>
- <inlinemediaobject>
+ <figure>
+ <title>lalune</title>
+ <mediaobject>
<imageobject>
- <objectinfo>
- <title>
- Voyage dans la Lune
- </title>
- </objectinfo>
<imagedata fileref="lalune.jpg" />
</imageobject>
- </inlinemediaobject>
- </para>
+ <textobject><phrase>lalune</phrase></textobject>
+ </mediaobject>
+ </figure>
<para>
Here is a movie
<inlinemediaobject>