git.iko.soy/typeable/pandoc
on master help sign in
RST writer: handle images in figures.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1899 788f1e2b-df1e-0410-8736-df70ead52e1b

commit874b57403846f2cfcab87100ed19a6c2c8a8db87 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateThu 18 Mar 2010, 02:38 (17 years ago) parent97bff3f
2 files changed+11−2
src/Text/Pandoc/Writers/RST.hs+6 tests/writer.rst+5−2
src/Text/Pandoc/Writers/RST.hs+6
@@ -145,6 +145,12 @@ blockToRST Null = return empty
145145blockToRST (Plain inlines) = do
146146 opts <- get >>= (return . stOptions)
147147 wrappedRST opts inlines
148+blockToRST (Para [Image txt (src,tit)]) = do
149+ capt <- inlineListToRST txt
150+ let fig = text "figure:: " <> text src
151+ let align = text ":align: center"
152+ let alt = text ":alt: " <> if null tit then capt else text tit
153+ return $ (text ".. " <> (fig $$ align $$ alt $$ text "" $$ capt)) $$ text ""
148154blockToRST (Para inlines) = do
149155 opts <- get >>= (return . stOptions)
150156 contents <- wrappedRST opts inlines
tests/writer.rst+5−2
@@ -834,7 +834,11 @@ Images
834834
835835From "Voyage dans la Lune" by Georges Melies (1902):
836836
837−|lalune|
837+.. figure:: lalune.jpg
838+ :align: center
839+ :alt: Voyage dans la Lune
840+
841+ lalune
838842
839843Here is a movie |movie| icon.
840844
@@ -885,6 +889,5 @@ indented.
885889 In list.
886890
887891
888−.. |lalune| image:: lalune.jpg
889892.. |movie| image:: movie.jpg
890893