git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: Handle \caption for images in figures.
52ee096John MacFarlane
src/Text/Pandoc/Readers/LaTeX.hs+6−3
@@ -498,12 +498,15 @@ inlineCommands = M.fromList $
498 [ "noindent", "index", "nocite" ]
498 [ "noindent", "index", "nocite" ]
499
499
500mkImage :: String -> LP Inlines
500mkImage :: String -> LP Inlines
501−mkImage src =
501+mkImage src = do
502+ -- try for a caption
503+ alt <- option (str "image") $ try $ spaces >>
504+ controlSeq "caption" >> optional (char '*') >> grouped inline
502 case takeExtension src of
505 case takeExtension src of
503 "" -> do
506 "" -> do
504 defaultExt <- getOption readerDefaultImageExtension
507 defaultExt <- getOption readerDefaultImageExtension
505− return $ image (addExtension src defaultExt) "" (str "image")
508+ return $ image (addExtension src defaultExt) "" alt
506− _ -> return $ image src "" (str "image")
509+ _ -> return $ image src "" alt
507
510
508inNote :: Inlines -> Inlines
511inNote :: Inlines -> Inlines
509inNote ils =
512inNote ils =