From f449dfd55d5abb6613f1fd4eb8a0b705d3d463bb Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 1 Mar 2013 12:21:23 -0800 Subject: LaTeX reader: Add "fig:" as title for images with captions. This is needed for them to be rendered as figures. Closes #766. --- src/Text/Pandoc/Readers/LaTeX.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index f35d1ebf5..da21b67ea 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -500,13 +500,17 @@ inlineCommands = M.fromList $ mkImage :: String -> LP Inlines mkImage src = do -- try for a caption - alt <- option (str "image") $ try $ spaces >> - controlSeq "caption" >> optional (char '*') >> grouped inline + (alt, tit) <- option (str "image", "") $ try $ do + spaces + controlSeq "caption" + optional (char '*') + ils <- grouped inline + return (ils, "fig:") case takeExtension src of "" -> do defaultExt <- getOption readerDefaultImageExtension - return $ image (addExtension src defaultExt) "" alt - _ -> return $ image src "" alt + return $ image (addExtension src defaultExt) tit alt + _ -> return $ image src tit alt inNote :: Inlines -> Inlines inNote ils = -- cgit v1.2.3