@@ -294,24 +294,22 @@ verseBlock blockType = try $ do
294codeBlock :: PandocMonad m => BlockAttributes -> Text -> OrgParser m (F Blocks)
294codeBlock :: PandocMonad m => BlockAttributes -> Text -> OrgParser m (F Blocks)
295codeBlock blockAttrs blockType = do
295codeBlock blockAttrs blockType = do
296 skipSpaces
296 skipSpaces
297− (classes, kv) <- codeHeaderArgs <|> (mempty <$ ignHeaders)
297+ (classes, kv) <- codeHeaderArgs <|> (mempty <$ ignHeaders)
298− content <- rawBlockContent blockType
298+ content <- rawBlockContent blockType
299− resultsContent <- option mempty babelResultsBlock
299+ resultsContent <- option mempty babelResultsBlock
300− let id' = fromMaybe mempty $ blockAttrName blockAttrs
300+ let identifier = fromMaybe mempty $ blockAttrName blockAttrs
301− let codeBlck = B.codeBlockWith ( id', classes, kv ) content
301+ let codeBlk = B.codeBlockWith (identifier, classes, kv) content
302− let labelledBlck = maybe (pure codeBlck)
304− (blockAttrCaption blockAttrs)
302+ let wrap = maybe pure addCaption (blockAttrCaption blockAttrs)
306− (if exportsCode kv then labelledBlck else mempty) <>
304+ (if exportsCode kv then wrap codeBlk else mempty) <>
307 (if exportsResults kv then resultsContent else mempty)
305 (if exportsResults kv then resultsContent else mempty)
309− labelDiv :: Blocks -> F Inlines -> F Blocks
307+ addCaption :: F Inlines -> Blocks -> F Blocks
310− labelDiv blk value =
308+ addCaption caption blk = B.divWith ("", ["captioned-content"], [])
311− B.divWith nullAttr <$> (mappend <$> labelledBlock value <*> pure blk)
309+ <$> (mkCaptionBlock caption <> pure blk)
313− labelledBlock :: F Inlines -> F Blocks
311+ mkCaptionBlock :: F Inlines -> F Blocks
314− labelledBlock = fmap (B.plain . B.spanWith ("", ["label"], []))
312+ mkCaptionBlock = fmap (B.divWith ("", ["caption"], []) . B.plain)
316 exportsResults :: [(Text, Text)] -> Bool
314 exportsResults :: [(Text, Text)] -> Bool
317 exportsResults = maybe False (`elem` ["results", "both"]) . lookup "exports"
315 exportsResults = maybe False (`elem` ["results", "both"]) . lookup "exports"