aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-02-26 22:16:03 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-02-26 22:16:03 -0800
commit52ee09608a3ada9ce465f2a0b0feef62bd7a9bde (patch)
tree077f6c3ba6ff730512433401c645f9eca6daf24e
parent3fca434737f0eee706c02fba6a2a2629338a1065 (diff)
downloadpandoc-52ee09608a3ada9ce465f2a0b0feef62bd7a9bde.tar.gz
LaTeX reader: Handle \caption for images in figures.
Closes #766.
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index af912c28e..f35d1ebf5 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -498,12 +498,15 @@ inlineCommands = M.fromList $
[ "noindent", "index", "nocite" ]
mkImage :: String -> LP Inlines
-mkImage src =
+mkImage src = do
+ -- try for a caption
+ alt <- option (str "image") $ try $ spaces >>
+ controlSeq "caption" >> optional (char '*') >> grouped inline
case takeExtension src of
"" -> do
defaultExt <- getOption readerDefaultImageExtension
- return $ image (addExtension src defaultExt) "" (str "image")
- _ -> return $ image src "" (str "image")
+ return $ image (addExtension src defaultExt) "" alt
+ _ -> return $ image src "" alt
inNote :: Inlines -> Inlines
inNote ils =