git.iko.soy/typeable/pandoc
on master help sign in
Changed macro parser so it returns raw macro if stateApplyMacros false.
9d5230cJohn MacFarlane
src/Text/Pandoc/Parsing.hs+8−5
@@ -868,14 +868,17 @@ emDashOld = do
868-- | Parse a \newcommand or \renewcommand macro definition.
868-- | Parse a \newcommand or \renewcommand macro definition.
869macro :: GenParser Char ParserState Block
869macro :: GenParser Char ParserState Block
870macro = do
870macro = do
871− getState >>= guard . stateApplyMacros
871+ apply <- stateApplyMacros `fmap` getState
872 inp <- getInput
872 inp <- getInput
873 case parseMacroDefinitions inp of
873 case parseMacroDefinitions inp of
874 ([], _) -> pzero
874 ([], _) -> pzero
875− (ms, rest) -> do count (length inp - length rest) anyChar
875+ (ms, rest) -> do def <- count (length inp - length rest) anyChar
876+ if apply
877+ then do
876− updateState $ \st ->
878+ updateState $ \st ->
877− st { stateMacros = ms ++ stateMacros st }
879+ st { stateMacros = ms ++ stateMacros st }
878− return Null
880+ return Null
881+ else return $ RawBlock "latex" def
879
882
880-- | Apply current macros to string.
883-- | Apply current macros to string.
881applyMacros' :: String -> GenParser Char ParserState String
884applyMacros' :: String -> GenParser Char ParserState String