From b2ba922638a296887fa29b780d12ea40814a86bb Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Sun, 12 Apr 2015 00:34:03 +0300 Subject: ODT Writer: Figure captions Works pretty much the same as Word writer. Following styles are used for figures: Figure -- for figure with empty caption FigureWithCaption (based on Figure) -- for figure with caption FigureCaption (based on Caption) -- for figure captions Also, TableCaption (based on Caption) is used for table captions. We need FigureWithCaption to set keepWithNext, in order to keep caption with figure. --- src/Text/Pandoc/Writers/ODT.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/Text/Pandoc/Writers/ODT.hs') diff --git a/src/Text/Pandoc/Writers/ODT.hs b/src/Text/Pandoc/Writers/ODT.hs index 2a4129512..81bbdaf3f 100644 --- a/src/Text/Pandoc/Writers/ODT.hs +++ b/src/Text/Pandoc/Writers/ODT.hs @@ -127,7 +127,7 @@ writeODT opts doc@(Pandoc meta _) = do return $ fromArchive archive'' transformPicMath :: WriterOptions -> IORef [Entry] -> Inline -> IO Inline -transformPicMath opts entriesRef (Image lab (src,_)) = do +transformPicMath opts entriesRef (Image lab (src,t)) = do res <- fetchItem' (writerMediaBag opts) (writerSourceURL opts) src case res of Left (_ :: E.SomeException) -> do @@ -145,7 +145,9 @@ transformPicMath opts entriesRef (Image lab (src,_)) = do epochtime <- floor `fmap` getPOSIXTime let entry = toEntry newsrc epochtime $ toLazy img modifyIORef entriesRef (entry:) - return $ Image lab (newsrc, tit') + let fig | "fig:" `isPrefixOf` t = "fig:" + | otherwise = "" + return $ Image lab (newsrc, fig++tit') transformPicMath _ entriesRef (Math t math) = do entries <- readIORef entriesRef let dt = if t == InlineMath then DisplayInline else DisplayBlock -- cgit v1.2.3