@@ -2393,11 +2393,11 @@ doubleQuoted = do
23932393 <|> (return (return (B. str " \8220" )))
23942394
23952395-- | Extract a block with a specific ID from a list of blocks
2396- extractBlockById :: Text -> Blocks -> F Inlines
2396+ extractBlockById :: Text -> Blocks -> Inlines
23972397extractBlockById targetId blocks =
23982398 case findBlockById targetId (B. toList blocks) of
2399- Just block -> return $ blocksToInlines' [block]
2400- Nothing -> return mempty
2399+ Just block -> blocksToInlines' [block]
2400+ Nothing -> mempty
24012401
24022402-- | Find a block with a specific ID in a list of blocks
24032403findBlockById :: Text -> [Block ] -> Maybe Block
@@ -2412,11 +2412,11 @@ findBlockById targetId = go
24122412 _ -> go rest
24132413
24142414-- | Extract content under a specific heading from a list of blocks
2415- extractHeadingById :: Text -> Blocks -> F Inlines
2415+ extractHeadingById :: Text -> Blocks -> Inlines
24162416extractHeadingById targetHeading blocks =
24172417 case extractContentUnderHeading targetHeading (B. toList blocks) of
2418- [] -> return mempty
2419- content -> return $ blocksToInlines' content
2418+ [] -> mempty
2419+ content -> blocksToInlines' content
24202420
24212421-- | Parse a file and convert all blocks to inlines for transclusion
24222422parseTranscludedInlines :: PandocMonad m => MarkdownParser m (F Inlines )
@@ -2428,13 +2428,13 @@ parseTranscludedInlines = do
24282428parseBlockTransclusion :: PandocMonad m => Text -> MarkdownParser m (F Inlines )
24292429parseBlockTransclusion blockId = do
24302430 blocks <- parseBlocks
2431- return $ blocks >>= extractBlockById blockId
2431+ return $ fmap ( extractBlockById blockId) blocks
24322432
24332433-- | Parse a file and extract content under a specific heading for transclusion
24342434parseHeadingTransclusion :: PandocMonad m => Text -> MarkdownParser m (F Inlines )
24352435parseHeadingTransclusion headingText = do
24362436 blocks <- parseBlocks
2437- return $ blocks >>= extractHeadingById headingText
2437+ return $ fmap ( extractHeadingById headingText) blocks
24382438
24392439-- | Extract all content under a heading until the next heading of same or higher level
24402440extractContentUnderHeading :: Text -> [Block ] -> [Block ]
0 commit comments