diff options
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 6 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/RST.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index ce8a4b8eb..df84c0ac7 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -142,14 +142,16 @@ parseMarkdown = do startPos <- getPosition -- go through once just to get list of reference keys -- docMinusKeys is the raw document with blanks where the keys were... - docMinusKeys <- many (referenceKey <|> lineClump) >>= return . concat + docMinusKeys <- manyTill (referenceKey <|> lineClump) eof >>= + return . concat setInput docMinusKeys setPosition startPos st <- getState -- go through again for notes unless strict... if stateStrict st then return () - else do docMinusNotes <- many (noteBlock <|> lineClump) >>= return . concat + else do docMinusNotes <- manyTill (noteBlock <|> lineClump) eof >>= + return . concat st <- getState let reversedNotes = stateNotes st updateState $ \st -> st { stateNotes = reverse reversedNotes } diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index d1139ebd0..1239eb688 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -86,7 +86,7 @@ parseRST = do startPos <- getPosition -- go through once just to get list of reference keys -- docMinusKeys is the raw document with blanks where the keys were... - docMinusKeys <- many (referenceKey <|> lineClump) >>= return . concat + docMinusKeys <- manyTill (referenceKey <|> lineClump) eof >>= return . concat setInput docMinusKeys setPosition startPos st <- getState diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 593311b01..f27c3ae75 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -298,10 +298,8 @@ parseFromString parser str = do -- | Parse raw line block up to and including blank lines. lineClump :: GenParser Char st String -lineClump = do - lns <- many1 (notFollowedBy blankline >> anyLine) - blanks <- blanklines <|> (eof >> return "\n") - return $ (unlines lns) ++ blanks +lineClump = blanklines + <|> (many1 (notFollowedBy blankline >> anyLine) >>= return . unlines) -- | Parse a string of characters between an open character -- and a close character, including text between balanced |