diff options
author | John MacFarlane <jgm@berkeley.edu> | 2013-03-01 12:21:23 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2013-03-01 12:22:01 -0800 |
commit | f449dfd55d5abb6613f1fd4eb8a0b705d3d463bb (patch) | |
tree | eb6c3eeed9a7a11fdaa56238a3ad96065496114e /src/Text | |
parent | 6611ec399c0e32cc4890c5aa058f1dd25f22b9e8 (diff) | |
download | pandoc-f449dfd55d5abb6613f1fd4eb8a0b705d3d463bb.tar.gz |
LaTeX reader: Add "fig:" as title for images with captions.
This is needed for them to be rendered as figures.
Closes #766.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 12 |
1 files changed, 8 insertions, 4 deletions
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 = |