aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2013-03-01 12:21:23 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2013-03-01 12:22:01 -0800
commitf449dfd55d5abb6613f1fd4eb8a0b705d3d463bb (patch)
treeeb6c3eeed9a7a11fdaa56238a3ad96065496114e /src/Text/Pandoc
parent6611ec399c0e32cc4890c5aa058f1dd25f22b9e8 (diff)
downloadpandoc-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/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs12
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 =