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:
parent
6611ec399c
commit
f449dfd55d
1 changed files with 8 additions and 4 deletions
|
@ -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 =
|
||||
|
|
Loading…
Add table
Reference in a new issue