aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-01-28 06:31:33 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-01-28 07:51:38 +0300
commit4bfab8f04c105f111d8d4e1c3ed7f7b5c75dbd19 (patch)
treee13f5d8eda66eac1c81cf0ad4d5a34f300ca21ca /src/Text/Pandoc
parent248f6076bc1df7f3dd55d7402707233ae08d3cdb (diff)
downloadpandoc-4bfab8f04c105f111d8d4e1c3ed7f7b5c75dbd19.tar.gz
Muse reader: parse directives without parseFromString
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs
index f4aca92d0..995a3ae9e 100644
--- a/src/Text/Pandoc/Readers/Muse.hs
+++ b/src/Text/Pandoc/Readers/Muse.hs
@@ -157,16 +157,14 @@ parseEmacsDirective = do
parseAmuseDirective :: PandocMonad m => MuseParser m (String, F Inlines)
parseAmuseDirective = do
key <- parseDirectiveKey
- space
- spaces
- first <- manyTill anyChar eol
- rest <- manyTill anyLine endOfDirective
+ many1 spaceChar
+ value <- trimInlinesF . mconcat <$> many1Till inline endOfDirective
many blankline
- value <- parseFromString (trimInlinesF . mconcat <$> many inline) $ unlines (first : rest)
return (key, value)
where
- endOfDirective = lookAhead $ endOfInput <|> try (void blankline) <|> try (void parseDirectiveKey)
- endOfInput = try $ skipMany blankline >> skipSpaces >> eof
+ endOfDirective = lookAhead $ try (eof <|>
+ void (newline >> blankline) <|>
+ void (newline >> parseDirectiveKey))
directive :: PandocMonad m => MuseParser m ()
directive = do