@@ -1093,24 +1093,25 @@ figure = try $ do
10931093
10941094addImageCaption :: PandocMonad m => Blocks -> LP m Blocks
10951095addImageCaption = walkM go
1096- where go ( Image attr@ (_, cls, kvs) alt (src,tit))
1096+ where go p @ ( Para [ Image attr@ (_, cls, kvs) _ (src,tit)] )
10971097 | not (" fig:" `T.isPrefixOf` tit) = do
10981098 st <- getState
1099- let (alt', tit') = case sCaption st of
1100- Just ils -> (toList ils, " fig:" <> tit)
1101- Nothing -> (alt, tit)
1102- attr' = case sLastLabel st of
1103- Just lab -> (lab, cls, kvs)
1104- Nothing -> attr
1105- case attr' of
1106- (" " , _, _) -> return ()
1107- (ident, _, _) -> do
1108- num <- getNextNumber sLastFigureNum
1109- setState
1110- st{ sLastFigureNum = num
1111- , sLabels = M. insert ident
1112- [Str (renderDottedNum num)] (sLabels st) }
1113- return $ Image attr' alt' (src, tit')
1099+ case sCaption st of
1100+ Nothing -> return p
1101+ Just figureCaption -> do
1102+ let attr' = case sLastLabel st of
1103+ Just lab -> (lab, cls, kvs)
1104+ Nothing -> attr
1105+ case attr' of
1106+ (" " , _, _) -> return ()
1107+ (ident, _, _) -> do
1108+ num <- getNextNumber sLastFigureNum
1109+ setState
1110+ st{ sLastFigureNum = num
1111+ , sLabels = M. insert ident
1112+ [Str (renderDottedNum num)] (sLabels st) }
1113+
1114+ return $ B. SimpleFigure attr' (B. toList figureCaption) src tit
11141115 go x = return x
11151116
11161117coloredBlock :: PandocMonad m => Text -> LP m Blocks
0 commit comments