Skip to content

Commit 5ae8241

Browse files
committed
Use simpleFigureWith in Org reader
1 parent 7cd9a6f commit 5ae8241

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/Text/Pandoc/Readers/Org/Blocks.hs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -474,15 +474,16 @@ figure = try $ do
474474
figCaption = fromMaybe mempty $ blockAttrCaption figAttrs
475475
figKeyVals = blockAttrKeyValues figAttrs
476476
attr = (figLabel, mempty, figKeyVals)
477-
figTitle = (if isFigure then withFigPrefix else id) figName
478-
in
479-
B.para . B.imageWith attr imgSrc figTitle <$> figCaption
480-
481-
withFigPrefix :: Text -> Text
482-
withFigPrefix cs =
483-
if "fig:" `T.isPrefixOf` cs
484-
then cs
485-
else "fig:" <> cs
477+
in if isFigure
478+
then (\c ->
479+
B.simpleFigureWith
480+
attr c imgSrc (unstackFig figName)) <$> figCaption
481+
else B.para . B.imageWith attr imgSrc figName <$> figCaption
482+
unstackFig :: Text -> Text
483+
unstackFig figName =
484+
if "fig:" `T.isPrefixOf` figName
485+
then T.drop 4 figName
486+
else figName
486487

487488
-- | Succeeds if looking at the end of the current paragraph
488489
endOfParagraph :: Monad m => OrgParser m ()

0 commit comments

Comments
 (0)