aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-12-22 16:57:52 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2017-12-22 18:03:51 -0800
commit3679d8d0bd0969d08142a2f6eb40b3a4bd0522d4 (patch)
tree43b6b018bb904e7925c2f4e4094569f58a97d153 /src/Text
parent9daf22fa615ad49b675e4e3aae722c982eb4cce3 (diff)
downloadpandoc-3679d8d0bd0969d08142a2f6eb40b3a4bd0522d4.tar.gz
LaTeX reader: use applyMacros in rawLaTeXBlock, rawLaTeXInline.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index a43f3d572..5299b964f 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -270,13 +270,16 @@ rawLaTeXBlock :: (PandocMonad m, HasMacros s, HasReaderOptions s)
=> ParserT String s m String
rawLaTeXBlock = do
lookAhead (try (char '\\' >> letter))
- snd <$> rawLaTeXParser (environment <|> macroDef <|> blockCommand)
+ -- we don't want to apply newly defined latex macros to their own
+ -- definitions:
+ (snd <$> rawLaTeXParser macroDef) <|>
+ ((snd <$> rawLaTeXParser (environment <|> blockCommand)) >>= applyMacros)
rawLaTeXInline :: (PandocMonad m, HasMacros s, HasReaderOptions s)
=> ParserT String s m String
rawLaTeXInline = do
lookAhead (try (char '\\' >> letter) <|> char '$')
- snd <$> rawLaTeXParser (inlineEnvironment <|> inlineCommand')
+ rawLaTeXParser (inlineEnvironment <|> inlineCommand') >>= applyMacros . snd
inlineCommand :: PandocMonad m => ParserT String ParserState m Inlines
inlineCommand = do