aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-11-02 11:04:21 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-11-02 11:04:21 -0700
commit7fac39528497b35915a5573c1ac3faf875476272 (patch)
tree69fccf888bc057378d75926d837806f6cf86be2b /src
parent15e1ca6441e3f2e8fd6f3c39cde409e014bcd46e (diff)
downloadpandoc-7fac39528497b35915a5573c1ac3faf875476272.tar.gz
LaTeX reader: Don't omit macro definitions defined in the preamble.
These were formerly omitted (though they still affected macro resolution if `latex_macros` was set). Now they are included in the document.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index a8df5dd03..b4e9de258 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -1462,13 +1462,14 @@ end_ t = try (do
guard $ t == txt) <?> ("\\end{" ++ T.unpack t ++ "}")
preamble :: PandocMonad m => LP m Blocks
-preamble = mempty <$ many preambleBlock
- where preambleBlock = spaces1
- <|> macroDef (const ())
- <|> void blockCommand
- <|> void braced
+preamble = mconcat <$> many preambleBlock
+ where preambleBlock = (mempty <$ spaces1)
+ <|> macroDef (rawBlock "latex")
+ <|> (mempty <$ blockCommand)
+ <|> (mempty <$ braced)
<|> (do notFollowedBy (begin_ "document")
- void anyTok)
+ anyTok
+ return mempty)
paragraph :: PandocMonad m => LP m Blocks
paragraph = do