aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorAlexander <ilabdsf@gmail.com>2017-08-07 07:43:59 +0300
committerJohn MacFarlane <jgm@berkeley.edu>2017-08-06 21:43:59 -0700
commit1b5bfced558d28d45caadc6171f9e7448f3deae1 (patch)
treed84c7fd7e1b0f6012d1bbc61225ee57b972a6353 /src/Text/Pandoc
parenta67a96b932344f5677be2fb810fb788a1988bd0b (diff)
downloadpandoc-1b5bfced558d28d45caadc6171f9e7448f3deae1.tar.gz
Muse reader: debug indented paragraph support (#3839)
Take only first line indentation into account and do not start new paragraph on indentation change.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs
index 201a59fc0..6e4aed94e 100644
--- a/src/Text/Pandoc/Readers/Muse.hs
+++ b/src/Text/Pandoc/Readers/Muse.hs
@@ -186,7 +186,6 @@ blockElements = choice [ comment
, orderedList
, table
, commentTag
- , indentedBlock
, noteBlock
]
@@ -249,27 +248,12 @@ quoteTag = withQuoteContext InDoubleQuote $ blockTag B.blockQuote "quote"
commentTag :: PandocMonad m => MuseParser m (F Blocks)
commentTag = parseHtmlContent "comment" anyChar >> return mempty
--- Indented block is either center, right or quote
-indentedLine :: PandocMonad m => MuseParser m (Int, String)
-indentedLine = try $ do
- indent <- length <$> many1 spaceChar
- line <- anyLine
- return (indent, line)
-
-rawIndentedBlock :: PandocMonad m => MuseParser m (Int, String)
-rawIndentedBlock = try $ do
- lns <- many1 indentedLine
- let indent = minimum $ map fst lns
- return (indent, unlines $ map snd lns)
-
-indentedBlock :: PandocMonad m => MuseParser m (F Blocks)
-indentedBlock = try $ do
- (indent, raw) <- rawIndentedBlock
- contents <- withQuoteContext InDoubleQuote $ parseFromString parseBlocks raw
- return $ (if indent >= 2 && indent < 6 then B.blockQuote else id) <$> contents
-
+-- Indented paragraph is either center, right or quote
para :: PandocMonad m => MuseParser m (F Blocks)
-para = liftM B.para . trimInlinesF . mconcat <$> many1Till inline endOfParaElement
+para = do
+ indent <- length <$> many spaceChar
+ let f = if indent >= 2 && indent < 6 then B.blockQuote else id
+ liftM (f . B.para) . trimInlinesF . mconcat <$> many1Till inline endOfParaElement
where
endOfParaElement = lookAhead $ endOfInput <|> endOfPara <|> newBlockElement
endOfInput = try $ skipMany blankline >> skipSpaces >> eof