summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-02-05 01:44:31 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-02-05 01:44:31 +0300
commit1a06f0ecfb5a4898daf2769f4c072fa12bae6d39 (patch)
tree041cb4d5caff56d1d2481551f11851ef1b65de46 /src/Text/Pandoc/Readers
parent6c45f8c8f6db57536db95a040ab30aae75684321 (diff)
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/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs8
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