From 0e4c9b0ea6b6fd702083eaa4f42ea3cb6c9a556e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 4 Nov 2025 13:12:27 +0100 Subject: T.P.LaTeX.Parsing: change type on rawLaTeXParser. The preparser doesn't need to return a value. --- src/Text/Pandoc/Readers/LaTeX.hs | 6 +++--- src/Text/Pandoc/Readers/LaTeX/Parsing.hs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index c9d2d62d3..11419b15f 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -151,7 +151,7 @@ rawLaTeXBlock = do braced return mempty) blocks <|> rawLaTeXParser toks - (environment <|> blockCommand) + (void (environment <|> blockCommand)) (mconcat <$> many (block <|> beginOrEndCommand))) -- See #4667 for motivation; sometimes people write macros @@ -177,7 +177,7 @@ rawLaTeXInline = do ( rawLaTeXParser toks (mempty <$ (controlSeq "input" >> skipMany rawopt >> braced)) inlines - <|> rawLaTeXParser toks inline inlines + <|> rawLaTeXParser toks (void inline) inlines ) finalbraces <- mconcat <$> many (try (string "{}")) -- see #5439 return $ raw <> T.pack finalbraces @@ -186,7 +186,7 @@ inlineCommand :: PandocMonad m => ParsecT Sources ParserState m Inlines inlineCommand = do lookAhead (try (char '\\' >> letter)) toks <- getInputTokens - fst <$> rawLaTeXParser toks (inlineEnvironment <|> inlineCommand') + fst <$> rawLaTeXParser toks (void (inlineEnvironment <|> inlineCommand')) inlines -- inline elements: diff --git a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs index bb76f6e18..54c43ef2e 100644 --- a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs +++ b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs @@ -279,7 +279,7 @@ withVerbatimMode parser = do return result rawLaTeXParser :: (PandocMonad m, HasMacros s, HasReaderOptions s, Show a) - => [Tok] -> LP m a -> LP m a + => [Tok] -> LP m () -> LP m a -> ParsecT Sources s m (a, Text) rawLaTeXParser toks parser valParser = do pstate <- getState -- cgit v1.2.3