@@ -64,6 +64,7 @@ module Text.Pandoc.Shared (
64 compactify,
64 compactify,
65 compactify',
65 compactify',
66 compactify'DL,
66 compactify'DL,
67 Element (..),
68 Element (..),
68 hierarchicalize,
69 hierarchicalize,
69 uniqueIdent,
70 uniqueIdent,
@@ -630,6 +631,15 @@ compactify'DL items =
630 | otherwise -> items
631 | otherwise -> items
631 _ -> items
632 _ -> items
634+-- | Combine a list of lines by adding hard linebreaks.
635+combineLines :: [[Inline]] -> [Inline]
636+combineLines = intercalate [LineBreak]
638+-- | Convert a list of lines into a paragraph with hard line breaks. This is
639+-- useful e.g. for rudimentary support of LineBlock elements in writers.
640+linesToPara :: [[Inline]] -> Block
641+linesToPara = Para . combineLines
633isPara :: Block -> Bool
643isPara :: Block -> Bool
634isPara (Para _) = True
644isPara (Para _) = True
635isPara _ = False
645isPara _ = False
@@ -1035,6 +1045,7 @@ collapseFilePath = Posix.joinPath . reverse . foldl go [] . splitDirectories
1035blockToInlines :: Block -> [Inline]
1045blockToInlines :: Block -> [Inline]
1036blockToInlines (Plain ils) = ils
1046blockToInlines (Plain ils) = ils
1037blockToInlines (Para ils) = ils
1047blockToInlines (Para ils) = ils
1048+blockToInlines (LineBlock lns) = combineLines lns
1038blockToInlines (CodeBlock attr str) = [Code attr str]
1049blockToInlines (CodeBlock attr str) = [Code attr str]
1039blockToInlines (RawBlock fmt str) = [RawInline fmt str]
1050blockToInlines (RawBlock fmt str) = [RawInline fmt str]
1040blockToInlines (BlockQuote blks) = blocksToInlines blks
1051blockToInlines (BlockQuote blks) = blocksToInlines blks