File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -1013,19 +1013,18 @@ normalDefinitionList = do
10131013para :: PandocMonad m => MarkdownParser m (F Blocks )
10141014para = try $ do
10151015 exts <- getOption readerExtensions
1016- let implicitFigures x
1017- | extensionEnabled Ext_implicit_figures exts = do
1018- x' <- x
1019- case B. toList x' of
1020- [Image attr alt (src,tit)]
1021- | not (null alt) ->
1022- -- the fig: at beginning of title indicates a figure
1023- return $ B. singleton
1024- $ Image attr alt (src, " fig:" <> tit)
1025- _ -> return x'
1026- | otherwise = x
1027- result <- implicitFigures . trimInlinesF <$> inlines1
1028- option (B. plain <$> result)
1016+
1017+ result <- trimInlinesF <$> inlines1
1018+ let figureOr constr inlns =
1019+ case B. toList inlns of
1020+ [Image attr figCaption (src, tit)]
1021+ | extensionEnabled Ext_implicit_figures exts
1022+ , not (null figCaption) -> do
1023+ B. simpleFigureWith attr (B. fromList figCaption) src tit
1024+
1025+ _ -> constr inlns
1026+
1027+ option (figureOr B. plain <$> result)
10291028 $ try $ do
10301029 newline
10311030 (mempty <$ blanklines)
@@ -1047,7 +1046,7 @@ para = try $ do
10471046 if divLevel > 0
10481047 then lookAhead divFenceEnd
10491048 else mzero
1050- return $ B. para <$> result
1049+ return $ figureOr B. para <$> result
10511050
10521051plain :: PandocMonad m => MarkdownParser m (F Blocks )
10531052plain = fmap B. plain . trimInlinesF <$> inlines1
You can’t perform that action at this time.
0 commit comments