diff options
author | Alexander Krotov <ilabdsf@gmail.com> | 2018-02-05 01:44:31 +0300 |
---|---|---|
committer | Alexander Krotov <ilabdsf@gmail.com> | 2018-02-05 01:44:31 +0300 |
commit | 1a06f0ecfb5a4898daf2769f4c072fa12bae6d39 (patch) | |
tree | 041cb4d5caff56d1d2481551f11851ef1b65de46 /src | |
parent | 6c45f8c8f6db57536db95a040ab30aae75684321 (diff) | |
download | pandoc-1a06f0ecfb5a4898daf2769f4c072fa12bae6d39.tar.gz |
Muse reader: make block parsers responsible for parsing newline
Block parsers must always stop after newline or at the end of file.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/Muse.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index 1d4b9cc89..63dcac122 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -166,6 +166,7 @@ parseHtmlContent :: PandocMonad m parseHtmlContent tag = do (attr, content) <- htmlElement tag parsedContent <- parseContent (content ++ "\n") + manyTill spaceChar eol -- closing tag must be followed by optional whitespace and newline return (attr, mconcat parsedContent) where parseContent = parseFromString $ manyTill parseBlock endOfContent @@ -229,7 +230,6 @@ directive = do parseBlock :: PandocMonad m => MuseParser m (F Blocks) parseBlock = do res <- blockElements <|> para - optionMaybe blankline trace (take 60 $ show $ B.toList $ runF res def) return res @@ -338,7 +338,7 @@ quoteTag = do st <- getState let oldInQuote = museInQuote st setState $ st{ museInQuote = True } - res <- snd <$> (parseHtmlContent "quote") + res <- snd <$> parseHtmlContent "quote" setState $ st{ museInQuote = oldInQuote } return $ B.blockQuote <$> res @@ -373,7 +373,9 @@ para = do indent <- length <$> many spaceChar st <- museInList <$> getState let f = if not st && indent >= 2 && indent < 6 then B.blockQuote else id - fmap (f . B.para) . trimInlinesF . mconcat <$> many1Till inline endOfParaElement + res <- fmap (f . B.para) . trimInlinesF . mconcat <$> many1Till inline endOfParaElement + manyTill spaceChar eol + return res where endOfParaElement = lookAhead $ try (eof <|> newBlockElement) newBlockElement = blankline >> void blockElements |