aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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: <http://example.com/>
<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>