LaTeX reader: Add "fig:" as title for images with captions.

This is needed for them to be rendered as figures.
Closes #766.
This commit is contained in:
John MacFarlane 2013-03-01 12:21:23 -08:00
parent 6611ec399c
commit f449dfd55d

View file

@ -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 =