diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-06-29 18:30:22 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-06-29 18:30:53 -0700 |
commit | 9d5230c0f699b1cc575eb211df9f016c41b6ba11 (patch) | |
tree | c4749016d2f1fe7e68d72e25567a46e6779c5ee4 /src/Text | |
parent | 11aea4bd3f4bbf4f6e434a64f6a7e49713f0ba6a (diff) | |
download | pandoc-9d5230c0f699b1cc575eb211df9f016c41b6ba11.tar.gz |
Changed macro parser so it returns raw macro if stateApplyMacros false.
Closes #554.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Parsing.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs index 140b96cfa..cac2b71ca 100644 --- a/src/Text/Pandoc/Parsing.hs +++ b/src/Text/Pandoc/Parsing.hs @@ -868,14 +868,17 @@ emDashOld = do -- | Parse a \newcommand or \renewcommand macro definition. macro :: GenParser Char ParserState Block macro = do - getState >>= guard . stateApplyMacros + apply <- stateApplyMacros `fmap` getState inp <- getInput case parseMacroDefinitions inp of ([], _) -> pzero - (ms, rest) -> do count (length inp - length rest) anyChar - updateState $ \st -> - st { stateMacros = ms ++ stateMacros st } - return Null + (ms, rest) -> do def <- count (length inp - length rest) anyChar + if apply + then do + updateState $ \st -> + st { stateMacros = ms ++ stateMacros st } + return Null + else return $ RawBlock "latex" def -- | Apply current macros to string. applyMacros' :: String -> GenParser Char ParserState String |