@@ -2411,11 +2411,11 @@ doubleQuoted = do
24112411 <|> (return (return (B. str " \8220" )))
24122412
24132413-- | Extract a block with a specific ID from a list of blocks
2414- extractBlockById :: Text -> Blocks -> F Inlines
2414+ extractBlockById :: Text -> Blocks -> Inlines
24152415extractBlockById targetId blocks =
24162416 case findBlockById targetId (B. toList blocks) of
2417- Just block -> return $ blocksToInlines' [block]
2418- Nothing -> return mempty
2417+ Just block -> blocksToInlines' [block]
2418+ Nothing -> mempty
24192419
24202420-- | Find a block with a specific ID in a list of blocks
24212421findBlockById :: Text -> [Block ] -> Maybe Block
@@ -2430,11 +2430,11 @@ findBlockById targetId = go
24302430 _ -> go rest
24312431
24322432-- | Extract content under a specific heading from a list of blocks
2433- extractHeadingById :: Text -> Blocks -> F Inlines
2433+ extractHeadingById :: Text -> Blocks -> Inlines
24342434extractHeadingById targetHeading blocks =
24352435 case extractContentUnderHeading targetHeading (B. toList blocks) of
2436- [] -> return mempty
2437- content -> return $ blocksToInlines' content
2436+ [] -> mempty
2437+ content -> blocksToInlines' content
24382438
24392439-- | Parse a file and convert all blocks to inlines for transclusion
24402440parseTranscludedInlines :: PandocMonad m => MarkdownParser m (F Inlines )
@@ -2446,13 +2446,13 @@ parseTranscludedInlines = do
24462446parseBlockTransclusion :: PandocMonad m => Text -> MarkdownParser m (F Inlines )
24472447parseBlockTransclusion blockId = do
24482448 blocks <- parseBlocks
2449- return $ blocks >>= extractBlockById blockId
2449+ return $ fmap ( extractBlockById blockId) blocks
24502450
24512451-- | Parse a file and extract content under a specific heading for transclusion
24522452parseHeadingTransclusion :: PandocMonad m => Text -> MarkdownParser m (F Inlines )
24532453parseHeadingTransclusion headingText = do
24542454 blocks <- parseBlocks
2455- return $ blocks >>= extractHeadingById headingText
2455+ return $ fmap ( extractHeadingById headingText) blocks
24562456
24572457-- | Extract all content under a heading until the next heading of same or higher level
24582458extractContentUnderHeading :: Text -> [Block ] -> [Block ]
0 commit comments