git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: Add "fig:" as title for images with captions.

This is needed for them to be rendered as figures. Closes #766.

commitf449dfd55d5abb6613f1fd4eb8a0b705d3d463bb authorJohn MacFarlane <jgm@berkeley.edu> dateFri 1 Mar 2013, 12:21 (14 years ago) parent6611ec3
1 file changed+8−4
src/Text/Pandoc/Readers/LaTeX.hs+8−4
src/Text/Pandoc/Readers/LaTeX.hs+8−4
@@ -500,13 +500,17 @@ inlineCommands = M.fromList $
500500mkImage :: String -> LP Inlines
501501mkImage src = do
502502 -- try for a caption
503− alt <- option (str "image") $ try $ spaces >>
504− controlSeq "caption" >> optional (char '*') >> grouped inline
503+ (alt, tit) <- option (str "image", "") $ try $ do
504+ spaces
505+ controlSeq "caption"
506+ optional (char '*')
507+ ils <- grouped inline
508+ return (ils, "fig:")
505509 case takeExtension src of
506510 "" -> do
507511 defaultExt <- getOption readerDefaultImageExtension
508− return $ image (addExtension src defaultExt) "" alt
509− _ -> return $ image src "" alt
512+ return $ image (addExtension src defaultExt) tit alt
513+ _ -> return $ image src tit alt
510514
511515inNote :: Inlines -> Inlines
512516inNote ils =