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

Also, DON'T put image in figure (as was done previously) when it's an inline image. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1893 788f1e2b-df1e-0410-8736-df70ead52e1b

commit9562390d6883110bd00d5b667761ec6b615eb5d7 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateTue 16 Mar 2010, 06:45 (17 years ago) parentda117c9
2 files changed+9−16
src/Text/Pandoc/Writers/ConTeXt.hs+6−4 tests/writer.context+3−12
src/Text/Pandoc/Writers/ConTeXt.hs+6−4
@@ -109,6 +109,10 @@ blockToConTeXt (Plain lst) = do
109109 let options = stOptions st
110110 contents <- wrapTeXIfNeeded options False inlineListToConTeXt lst
111111 return $ Reg contents
112+blockToConTeXt (Para [Image txt (src,_)]) = do
113+ capt <- inlineListToConTeXt txt
114+ return $ Pad $ text "\\placefigure[here,nonumber]{" <> capt <>
115+ text "}{\\externalfigure[" <> text src <> text "]}"
112116blockToConTeXt (Para lst) = do
113117 st <- get
114118 let options = stOptions st
@@ -265,10 +269,8 @@ inlineToConTeXt (Link txt (src, _)) = do
265269 label <- inlineListToConTeXt txt
266270 return $ text "\\useURL[" <> text ref <> text "][" <> text src <>
267271 text "][][" <> label <> text "]\\from[" <> text ref <> char ']'
268−inlineToConTeXt (Image alternate (src, tit)) = do
269− alt <- inlineListToConTeXt alternate
270− return $ text "\\placefigure\n[]\n[fig:" <> alt <> text "]\n{" <>
271− text tit <> text "}\n{\\externalfigure[" <> text src <> text "]}"
272+inlineToConTeXt (Image _ (src, _)) = do
273+ return $ text "{\\externalfigure[" <> text src <> text "]}"
272274inlineToConTeXt (Note contents) = do
273275 contents' <- blockListToConTeXt contents
274276 let rawnote = stripTrailingNewlines $ render contents'
tests/writer.context+3−12
@@ -862,18 +862,9 @@ or here: <http://example.com/>
862862
863863From \quotation{Voyage dans la Lune} by Georges Melies (1902):
864864
865−\placefigure
866−[]
867−[fig:lalune]
868−{Voyage dans la Lune}
869−{\externalfigure[lalune.jpg]}
870−
871−Here is a movie
872−\placefigure
873−[]
874−[fig:movie]
875−{}
876−{\externalfigure[movie.jpg]} icon.
865+\placefigure[here,nonumber]{lalune}{\externalfigure[lalune.jpg]}
866+
867+Here is a movie {\externalfigure[movie.jpg]} icon.
877868
878869\thinrule
879870