From 4f260c96d9b84fb90d4e9b7c611556b1708b90fe Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 3 May 2019 10:18:16 -0700 Subject: LaTeX reader: Allow newlines in `\mintinline`. --- src/Text/Pandoc/Readers/LaTeX.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/Text/Pandoc/Readers') diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index b619a3a89..6aa0f1205 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -511,11 +511,11 @@ doverb = do _ -> mzero withVerbatimMode $ (code . T.unpack . untokenize) <$> - manyTill (verbTok marker) (symbol marker) + manyTill (notFollowedBy newlineTok >> verbTok marker) (symbol marker) verbTok :: PandocMonad m => Char -> LP m Tok verbTok stopchar = do - t@(Tok pos toktype txt) <- satisfyTok (not . isNewlineTok) + t@(Tok pos toktype txt) <- anyTok case T.findIndex (== stopchar) txt of Nothing -> return t Just i -> do @@ -545,9 +545,13 @@ doinlinecode classes = do _ -> mzero let stopchar = if marker == '{' then '}' else marker withVerbatimMode $ - (codeWith ("",classes,[]) . T.unpack . untokenize) <$> + (codeWith ("",classes,[]) . map nlToSpace . T.unpack . untokenize) <$> manyTill (verbTok stopchar) (symbol stopchar) +nlToSpace :: Char -> Char +nlToSpace '\n' = ' ' +nlToSpace x = x + keyval :: PandocMonad m => LP m (String, String) keyval = try $ do Tok _ Word key <- satisfyTok isWordTok -- cgit v1.2.3