From 313405f59aa09b6f1a027002d35bc75cb15c976e Mon Sep 17 00:00:00 2001
From: fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>
Date: Thu, 25 Jun 2009 02:01:41 +0000
Subject: Allow continuation lines in line blocks.

Also added test cases for line blocks for RST reader.
Resolves Issue #149.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1583 788f1e2b-df1e-0410-8736-df70ead52e1b
---
 src/Text/Pandoc/Readers/RST.hs | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'src/Text')

diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index ae025f4ea..4fe6ada5e 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -125,8 +125,8 @@ block = choice [ codeBlock
                , unknownDirective
                , header
                , hrule
+               , lineBlock     -- must go before definitionList
                , list
-               , lineBlock
                , lhsCodeBlock
                , para
                , plain
@@ -183,14 +183,15 @@ lineBlockLine :: GenParser Char ParserState [Inline]
 lineBlockLine = try $ do
   string "| "
   white <- many (oneOf " \t")
-  line <- manyTill inline newline
-  return $ (if null white then [] else [Str white]) ++ line ++ [LineBreak]
+  line <- many $ (notFollowedBy newline >> inline) <|> (try $ endline >>~ char ' ')
+  optional endline
+  return $ normalizeSpaces $ (if null white then [] else [Str white]) ++ line
 
 lineBlock :: GenParser Char ParserState Block
 lineBlock = try $ do
   lines' <- many1 lineBlockLine
   blanklines
-  return $ Para (concat lines')
+  return $ Para (intercalate [LineBreak] lines')
 
 --
 -- paragraph block
-- 
cgit v1.2.3