aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-07-19 13:58:02 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2018-07-19 17:44:16 -0700
commit34b229dd5a8493bad62498e5485f2775e2289ce8 (patch)
treef67e970484dd47785cbf2ea1ca2209e065dbf0fd /src/Text/Pandoc/Readers
parentac1a46b0cb4206eb3d46e2f29f29d53b0489c184 (diff)
downloadpandoc-34b229dd5a8493bad62498e5485f2775e2289ce8.tar.gz
Fix for bug in parsing `\include` in markdown.
Starting in 2.2.2, everything after an `\input` (or `\include`) in a markdown file would be parsed as raw LaTeX. This commit fixes the issue and adds a regression test. Closes #4781.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index c15312cd8..1dd31d402 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -286,6 +286,12 @@ rawLaTeXBlock :: (PandocMonad m, HasMacros s, HasReaderOptions s)
rawLaTeXBlock = do
lookAhead (try (char '\\' >> letter))
snd <$> (rawLaTeXParser False macroDef blocks
+ <|> (rawLaTeXParser True
+ (do choice (map controlSeq
+ ["include", "input", "subfile", "usepackage"])
+ skipMany opt
+ braced
+ return mempty) blocks)
<|> rawLaTeXParser True
(environment <|> blockCommand)
(mconcat <$> (many (block <|> beginOrEndCommand))))
@@ -308,7 +314,10 @@ rawLaTeXInline :: (PandocMonad m, HasMacros s, HasReaderOptions s)
=> ParserT String s m String
rawLaTeXInline = do
lookAhead (try (char '\\' >> letter))
- snd <$> rawLaTeXParser True (inlineEnvironment <|> inlineCommand') inlines
+ snd <$> ( rawLaTeXParser True
+ (mempty <$ (controlSeq "input" >> skipMany opt >> braced))
+ inlines
+ <|> rawLaTeXParser True (inlineEnvironment <|> inlineCommand') inlines)
inlineCommand :: PandocMonad m => ParserT String ParserState m Inlines
inlineCommand = do