@@ -464,22 +464,20 @@ plainToPara :: Block -> Block
464464plainToPara (Plain ils) = Para ils
465465plainToPara x = x
466466
467+
467468-- | Like @compactify@, but acts on items of definition lists.
468469compactifyDL :: [(Inlines, [Blocks])] -> [(Inlines, [Blocks])]
469470compactifyDL items =
470− let defs = concatMap snd items
471− in case reverse (concatMap B.toList defs) of
472− (Para x:xs)
473− | not (any isPara xs) ->
474− let (t,ds) = last items
475− lastDef = B.toList $ last ds
476− ds' = init ds ++
477− if null lastDef
478− then [B.fromList lastDef]
479− else [B.fromList $ init lastDef ++ [Plain x]]
480− in init items ++ [(t, ds')]
481− | otherwise -> items
482− _ -> items
471+ case reverse items of
472+ ((t,ds):ys) ->
473+ case reverse (map (reverse . B.toList) ds) of
474+ ((Para x:xs) : zs) | not (any isPara xs) ->
475+ reverse ys ++
476+ [(t, reverse (map B.fromList zs) ++
477+ [B.fromList (reverse (Plain x:xs))])]
478+ _ -> items
479+ _ -> items
480+
483481
484482-- | Combine a list of lines by adding hard linebreaks.
485483combineLines :: [[Inline]] -> [Inline]