git.iko.soy/typeable/pandoc
on master help sign in
Changed macro parser so it returns raw macro if stateApplyMacros false.

Closes #554.

commit9d5230c0f699b1cc575eb211df9f016c41b6ba11 authorJohn MacFarlane <fiddlosopher@gmail.com> dateFri 29 Jun 2012, 18:30 (14 years ago) parent11aea4b
1 file changed+8−5
src/Text/Pandoc/Parsing.hs+8−5
src/Text/Pandoc/Parsing.hs+8−5
@@ -868,14 +868,17 @@ emDashOld = do
868868-- | Parse a \newcommand or \renewcommand macro definition.
869869macro :: GenParser Char ParserState Block
870870macro = do
871− getState >>= guard . stateApplyMacros
871+ apply <- stateApplyMacros `fmap` getState
872872 inp <- getInput
873873 case parseMacroDefinitions inp of
874874 ([], _) -> pzero
875− (ms, rest) -> do count (length inp - length rest) anyChar
876− updateState $ \st ->
877− st { stateMacros = ms ++ stateMacros st }
878− return Null
875+ (ms, rest) -> do def <- count (length inp - length rest) anyChar
876+ if apply
877+ then do
878+ updateState $ \st ->
879+ st { stateMacros = ms ++ stateMacros st }
880+ return Null
881+ else return $ RawBlock "latex" def
879882
880883-- | Apply current macros to string.
881884applyMacros' :: String -> GenParser Char ParserState String