summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-12-22 17:33:02 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2017-12-22 18:03:51 -0800
commit4a07977715021da241b1bf5ab3e1ee62fef89fa1 (patch)
treee19b77b6f16262ece0aa5a15ea18d4060d0b2665 /src
parent3679d8d0bd0969d08142a2f6eb40b3a4bd0522d4 (diff)
Markdown reader: improved raw tex parsing.
+ Preserve original whitespace between blocks. + Recognize `\placeformula` as context.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 9ffdbf00d..af020261b 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1120,14 +1120,17 @@ rawVerbatimBlock = htmlInBalanced isVerbTag
rawTeXBlock :: PandocMonad m => MarkdownParser m (F Blocks)
rawTeXBlock = do
guardEnabled Ext_raw_tex
- result <- (B.rawBlock "context" . concat <$>
- rawConTeXtEnvironment `sepEndBy1` blankline)
- <|> (B.rawBlock "latex" . concat <$>
- rawLaTeXBlock `sepEndBy1` blankline)
-
- optional blanklines
+ result <- (B.rawBlock "context" . trimr . concat <$>
+ many1 ((++) <$> (rawConTeXtEnvironment <|> conTeXtCommand)
+ <*> (blanklines <|> many spaceChar)))
+ <|> (B.rawBlock "latex" . trimr . concat <$>
+ many1 ((++) <$> rawLaTeXBlock
+ <*> (blanklines <|> many spaceChar)))
return $ return result
+conTeXtCommand :: PandocMonad m => MarkdownParser m String
+conTeXtCommand = oneOfStrings ["\\placeformula"]
+
rawHtmlBlocks :: PandocMonad m => MarkdownParser m (F Blocks)
rawHtmlBlocks = do
(TagOpen tagtype _, raw) <- htmlTag isBlockTag