aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-01-19 12:12:06 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-01-19 12:12:06 +0300
commit4a5801b823e1fbd3d5b208b97acce78859c45b0d (patch)
tree53abf3e3e5df2e554581a0d07588fc7716a8cc20 /src/Text/Pandoc/Readers
parent4d3f787d6365006021e637d301904a7a68646861 (diff)
downloadpandoc-4a5801b823e1fbd3d5b208b97acce78859c45b0d.tar.gz
Muse reader: parse verse without parseFromString
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs
index 4d5f9ba90..a23ac239c 100644
--- a/src/Text/Pandoc/Readers/Muse.hs
+++ b/src/Text/Pandoc/Readers/Muse.hs
@@ -390,21 +390,23 @@ emacsNoteBlock = try $ do
-- Verse markup
--
-lineVerseLine :: PandocMonad m => MuseParser m String
+lineVerseLine :: PandocMonad m => MuseParser m (F Inlines)
lineVerseLine = try $ do
- char '>'
- white <- many1 (char ' ' >> pure '\160')
- rest <- anyLine
- return $ tail white ++ rest
+ string "> "
+ indent <- B.str <$> many (char ' ' >> pure '\160')
+ rest <- manyTill (choice inlineList) eol
+ return $ trimInlinesF $ mconcat (pure indent : rest)
-blanklineVerseLine :: PandocMonad m => MuseParser m Char
-blanklineVerseLine = try $ char '>' >> blankline
+blanklineVerseLine :: PandocMonad m => MuseParser m (F Inlines)
+blanklineVerseLine = try $ do
+ char '>'
+ blankline
+ pure mempty
lineBlock :: PandocMonad m => MuseParser m (F Blocks)
lineBlock = try $ do
- lns <- many1 (pure <$> blanklineVerseLine <|> lineVerseLine)
- lns' <- mapM (parseFromString' (trimInlinesF . mconcat <$> many inline)) lns
- return $ B.lineBlock <$> sequence lns'
+ lns <- many1 (blanklineVerseLine <|> lineVerseLine)
+ return $ B.lineBlock <$> sequence lns
--
-- lists