diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-02-10 10:00:23 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-02-10 10:00:23 +0100 |
commit | c76eec97d4a8f78d3c1c212664364015a21b7404 (patch) | |
tree | b0290991c1a4c0e75062d2bea132d9a28e93d7d1 /src/Text/Pandoc | |
parent | 29b1ed0b8494a74799a2ceacf6c2a5bddf1cac4d (diff) | |
download | pandoc-c76eec97d4a8f78d3c1c212664364015a21b7404.tar.gz |
LaTeX reader: Improved messages for skipped environments.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 8745437a4..cc69786cf 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -938,12 +938,20 @@ inlineEnvironment = try $ do rawEnv :: PandocMonad m => String -> LP m Blocks rawEnv name = do exts <- getOption readerExtensions + let parseRaw = extensionEnabled Ext_raw_tex exts rawOptions <- mconcat <$> many rawopt - let addBegin x = "\\begin{" ++ name ++ "}" ++ rawOptions ++ x - if extensionEnabled Ext_raw_tex exts - then (rawBlock "latex" . addBegin) <$> - (withRaw (env name blocks) >>= applyMacros' . snd) - else env name blocks + let beginCommand = "\\begin{" ++ name ++ "}" ++ rawOptions + unless parseRaw $ do + pos1 <- getPosition + warningWithPos pos1 $ "Skipped " ++ beginCommand + (bs, raw) <- withRaw $ env name blocks + raw' <- applyMacros' raw + if parseRaw + then return $ rawBlock "latex" $ beginCommand ++ raw' + else do + pos2 <- getPosition + warningWithPos pos2 $ "Skipped \\end{" ++ name ++ "}" + return bs ---- |