aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-01-17 09:22:35 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2018-01-17 09:22:35 -0800
commitca8cd38bdca72d1db4ba740481c48e3705b6ee63 (patch)
treec2ce07f9d7c1f869f33f34a647eef20401301b24 /src/Text/Pandoc/Readers
parentfcbec16e573e6f6bcab2775f48a3ad0a2e1a540f (diff)
downloadpandoc-ca8cd38bdca72d1db4ba740481c48e3705b6ee63.tar.gz
Markdown reader: don't coalesce adjacent raw LaTeX blocks...
if they are separated by a blank line. See lierdakil/pandoc-crossref#160 for motivation.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index b76ff498b..94f04eee7 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -122,6 +122,13 @@ spnl = try $ do
skipSpaces
notFollowedBy (char '\n')
+spnl' :: PandocMonad m => ParserT [Char] st m String
+spnl' = try $ do
+ xs <- many spaceChar
+ ys <- option "" $ try $ (:) <$> newline
+ <*> (many spaceChar <* notFollowedBy (char '\n'))
+ return (xs ++ ys)
+
indentSpaces :: PandocMonad m => MarkdownParser m String
indentSpaces = try $ do
tabStop <- getOption readerTabStop
@@ -1125,10 +1132,9 @@ rawTeXBlock = do
lookAhead $ try $ char '\\' >> letter
result <- (B.rawBlock "context" . trim . concat <$>
many1 ((++) <$> (rawConTeXtEnvironment <|> conTeXtCommand)
- <*> (blanklines <|> many spaceChar)))
+ <*> spnl'))
<|> (B.rawBlock "latex" . trim . concat <$>
- many1 ((++) <$> rawLaTeXBlock
- <*> (blanklines <|> many spaceChar)))
+ many1 ((++) <$> rawLaTeXBlock <*> spnl'))
return $ case B.toList result of
[RawBlock _ cs]
| all (`elem` [' ','\t','\n']) cs -> return mempty