diff options
Diffstat (limited to 'src/Text/ParserCombinators')
-rw-r--r-- | src/Text/ParserCombinators/Pandoc.hs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Text/ParserCombinators/Pandoc.hs b/src/Text/ParserCombinators/Pandoc.hs index 5b1742975..a965159ed 100644 --- a/src/Text/ParserCombinators/Pandoc.hs +++ b/src/Text/ParserCombinators/Pandoc.hs @@ -40,12 +40,13 @@ module Text.ParserCombinators.Pandoc ( enclosed, nullBlock, stringAnyCase, - parseFromStr + parseFromStr, + lineClump ) where import Text.ParserCombinators.Parsec import Text.Pandoc.Definition import Text.Pandoc.Shared -import Char ( toUpper, toLower ) +import Data.Char ( toUpper, toLower ) --- | Parse any line of text anyLine :: GenParser Char st [Char] @@ -132,4 +133,11 @@ parseFromStr parser str = try $ do setInput oldInput return result +-- | Parse raw line block up to and including blank lines. +lineClump :: GenParser Char st String +lineClump = do + lines <- many1 (do{notFollowedBy blankline; anyLine}) + blanks <- blanklines <|> (do{eof; return "\n"}) + return ((unlines lines) ++ blanks) + |