diff options
author | John MacFarlane <jgm@berkeley.edu> | 2012-09-29 11:57:32 -0400 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2012-09-29 11:57:32 -0400 |
commit | b75a5b631b08871ea58a0c464e3cfef2e436f930 (patch) | |
tree | 810eb619b15104f527a6676d9998af9967afdee8 /src/Text/Pandoc | |
parent | c416ff98bc6c1bf84bd64630df0add490c5cf8e8 (diff) | |
download | pandoc-b75a5b631b08871ea58a0c464e3cfef2e436f930.tar.gz |
Markdown reader: Worked around some sepBy's.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index a1f069059..adf24588b 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -291,11 +291,11 @@ noteBlock = try $ do char ':' optional blankline optional indentSpaces - raw <- sepBy rawLines - (try (blankline >> indentSpaces >> - notFollowedBy blankline)) + first <- rawLines + rest <- many $ try $ blanklines >> indentSpaces >> rawLines + let raw = unlines (first:rest) ++ "\n" optional blanklines - parsed <- parseFromString parseBlocks $ unlines raw ++ "\n" + parsed <- parseFromString parseBlocks raw let newnote = (ref, parsed) updateState $ \s -> s { stateNotes' = newnote : stateNotes' s } return mempty @@ -517,10 +517,13 @@ emailBlockQuoteStart = try $ skipNonindentSpaces >> char '>' >>~ optional (char emailBlockQuote :: Parser [Char] ParserState [String] emailBlockQuote = try $ do emailBlockQuoteStart - raw <- sepBy (many (nonEndline <|> - (try (endline >> notFollowedBy emailBlockQuoteStart >> - return '\n')))) - (try (newline >> emailBlockQuoteStart)) + let emailLine = many $ nonEndline <|> try + (endline >> notFollowedBy emailBlockQuoteStart >> + return '\n') + let emailSep = try (newline >> emailBlockQuoteStart) + first <- emailLine + rest <- many $ try $ emailSep >> emailLine + let raw = first:rest newline <|> (eof >> return '\n') optional blanklines return raw |