aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-05-03 10:18:16 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-05-03 10:18:16 -0700
commit4f260c96d9b84fb90d4e9b7c611556b1708b90fe (patch)
tree713a56a7b80242e1e1935129c7f4b80cc4471aa6 /src
parentcfb37262162eabdbe9461b2adffe33d780ee4c81 (diff)
downloadpandoc-4f260c96d9b84fb90d4e9b7c611556b1708b90fe.tar.gz
LaTeX reader: Allow newlines in `\mintinline`.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs10
1 files changed, 7 insertions, 3 deletions
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