diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2010-03-17 06:53:43 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2010-03-17 06:53:43 +0000 |
commit | 16e5b15cae3c96c185c6be64a5f7256e402067df (patch) | |
tree | d31c0f362dc8dc70678853a362ae5f69b456369d | |
parent | 1a09a9d40f9f956045c9d3daaa0c1316310e6d17 (diff) | |
download | pandoc-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.hs | 8 | ||||
-rw-r--r-- | tests/writer.docbook | 15 |
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> |