@@ -1525,11 +1525,11 @@ defmacro = try $
15251525
15261526argspecArg :: PandocMonad m => LP m ArgSpec
15271527argspecArg = do
1528− Tok _ (Arg i) _ <- withVerbatimMode $ satisfyTok isArgTok
1528+ Tok _ (Arg i) _ <- satisfyTok isArgTok
15291529 return $ ArgNum i
15301530
15311531argspecPattern :: PandocMonad m => LP m ArgSpec
1532−argspecPattern = withVerbatimMode $
1532+argspecPattern =
15331533 Pattern <$> many1 (satisfyTok (\(Tok _ toktype' txt) ->
15341534 (toktype' == Symbol || toktype' == Word) &&
15351535 (txt /= "{" && txt /= "\\" && txt /= "}")))
@@ -1566,25 +1566,23 @@ newenvironment = do
15661566 Tok _ (CtrlSeq mtype) _ <- controlSeq "newenvironment" <|>
15671567 controlSeq "renewenvironment" <|>
15681568 controlSeq "provideenvironment"
1569− name <- withVerbatimMode $ do
1569+ withVerbatimMode $ do
15701570 optional $ symbol '*'
15711571 spaces
1572− untokenize <$> braced
1573− numargs <- withVerbatimMode $ do
1572+ name <- untokenize <$> braced
15741573 spaces
1575− option 0 $ try bracketedNum
1576− let argspecs = map (\i -> ArgNum i) [1..numargs]
1577− optarg <- withVerbatimMode $ do
1574+ numargs <- option 0 $ try bracketedNum
15781575 spaces
1579− option Nothing $ Just <$> try bracketedToks
1580− startcontents <- withVerbatimMode $ spaces >> bracedOrToken
1581− endcontents <- withVerbatimMode $ spaces >> bracedOrToken
1582− when (mtype == "newenvironment") $ do
1583− macros <- sMacros <$> getState
1584− case M.lookup name macros of
1585− Just _ -> report $ MacroAlreadyDefined (T.unpack name) pos
1586− Nothing -> return ()
1587− return (name, Macro ExpandWhenUsed argspecs optarg startcontents,
1576+ optarg <- option Nothing $ Just <$> try bracketedToks
1577+ let argspecs = map (\i -> ArgNum i) [1..numargs]
1578+ startcontents <- spaces >> bracedOrToken
1579+ endcontents <- spaces >> bracedOrToken
1580+ when (mtype == "newenvironment") $ do
1581+ macros <- sMacros <$> getState
1582+ case M.lookup name macros of
1583+ Just _ -> report $ MacroAlreadyDefined (T.unpack name) pos
1584+ Nothing -> return ()
1585+ return (name, Macro ExpandWhenUsed argspecs optarg startcontents,
15881586 Macro ExpandWhenUsed [] Nothing endcontents)
15891587
15901588bracketedNum :: PandocMonad m => LP m Int