git.iko.soy/typeable/pandoc
on master help sign in
Expand \newenvironment macros.

Closes #987. Depends on still unreleased texmath 0.9.3.

commitc46febaaeef1c203f5bbb88d845ad5554622f609 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 10 Mar 2017, 09:46 (10 years ago) parenta088d67
3 files changed+25−11
pandoc.cabal+1−1 src/Text/Pandoc/Readers/LaTeX.hs+12−10 test/command/987.md+12
pandoc.cabal+1−1
@@ -269,7 +269,7 @@ Library
269269 text >= 0.11 && < 1.3,
270270 zip-archive >= 0.2.3.4 && < 0.4,
271271 HTTP >= 4000.0.5 && < 4000.4,
272− texmath >= 0.9 && < 0.10,
272+ texmath >= 0.9.3 && < 0.10,
273273 xml >= 1.3.12 && < 1.4,
274274 random >= 1 && < 1.2,
275275 extensible-exceptions >= 0.1 && < 0.2,
src/Text/Pandoc/Readers/LaTeX.hs+12−10
@@ -971,17 +971,19 @@ rawEnv name = do
971971 let parseRaw = extensionEnabled Ext_raw_tex exts
972972 rawOptions <- mconcat <$> many rawopt
973973 let beginCommand = "\\begin{" ++ name ++ "}" ++ rawOptions
974− unless parseRaw $ do
975− pos1 <- getPosition
976− report $ SkippedContent beginCommand pos1
974+ pos1 <- getPosition
977975 (bs, raw) <- withRaw $ env name blocks
978− raw' <- applyMacros' raw
979− if parseRaw
980− then return $ rawBlock "latex" $ beginCommand ++ raw'
981− else do
982− pos2 <- getPosition
983− report $ SkippedContent ("\\end{" ++ name ++ "}") pos2
984− return bs
976+ raw' <- applyMacros' $ beginCommand ++ raw
977+ if raw' /= beginCommand ++ raw
978+ then parseFromString blocks raw'
979+ else if parseRaw
980+ then return $ rawBlock "latex" $ beginCommand ++ raw'
981+ else do
982+ unless parseRaw $ do
983+ report $ SkippedContent beginCommand pos1
984+ pos2 <- getPosition
985+ report $ SkippedContent ("\\end{" ++ name ++ "}") pos2
986+ return bs
985987
986988----
987989
test/command/987.mdnew file+12
@@ -0,0 +1,12 @@
1+```
2+pandoc -f latex -t markdown
3+\documentclass{article}
4+\newenvironment{flubble}{FOO}{BAR}
5+\begin{document}
6+ \begin{flubble}
7+ grr
8+ \end{flubble}
9+\end{document}
10+^D
11+FOO grr BAR
12+```