@@ -54,6 +54,7 @@ module Text.Pandoc.Parsing ( (>>~),
5454 anyOrderedListMarker,
5555 orderedListMarker,
5656 charRef,
57+ lineBlockLines,
5758 tableWith,
5859 widthsFromIndices,
5960 gridTableWith,
@@ -550,6 +551,23 @@ charRef = do
550551 c <- characterReference
551552 return $ Str [c]
552553
554+lineBlockLine :: Parser [Char] st String
555+lineBlockLine = try $ do
556+ char '|'
557+ char ' '
558+ white <- many (spaceChar >> return '\160')
559+ notFollowedBy newline
560+ line <- anyLine
561+ continuations <- many (try $ char ' ' >> anyLine)
562+ return $ white ++ unwords (line : continuations)
563+
564+-- | Parses an RST-style line block and returns a list of strings.
565+lineBlockLines :: Parser [Char] st [String]
566+lineBlockLines = try $ do
567+ lines' <- many1 lineBlockLine
568+ skipMany1 $ blankline <|> try (char '|' >> blankline)
569+ return lines'
570+
553571-- | Parse a table using 'headerParser', 'rowParser',
554572-- 'lineParser', and 'footerParser'.
555573tableWith :: Parser [Char] ParserState ([[Block]], [Alignment], [Int])