aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-07-19 17:30:22 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-07-19 17:30:22 +0200
commit56f63af3f6776d8f3d6466f928b0c294032444c6 (patch)
tree545b0d13a3677452b99026433b22382f5d7b60f4
parent3267af23f058f65f5d26f2e55b1e8a861837c988 (diff)
downloadpandoc-56f63af3f6776d8f3d6466f928b0c294032444c6.tar.gz
LaTeX reader: fixed regression with starred environment names.
Closes #3803.
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs17
-rw-r--r--test/command/3803.md10
2 files changed, 13 insertions, 14 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index f5e387429..ab3994770 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -1456,22 +1456,14 @@ begin_ :: PandocMonad m => Text -> LP m ()
begin_ t = (try $ do
controlSeq "begin"
spaces
- symbol '{'
- spaces
- Tok _ Word txt <- satisfyTok isWordTok
- spaces
- symbol '}'
+ txt <- untokenize <$> braced
guard (t == txt)) <?> ("\\begin{" ++ T.unpack t ++ "}")
end_ :: PandocMonad m => Text -> LP m ()
end_ t = (try $ do
controlSeq "end"
spaces
- symbol '{'
- spaces
- Tok _ Word txt <- satisfyTok isWordTok
- spaces
- symbol '}'
+ txt <- untokenize <$> braced
guard $ t == txt) <?> ("\\end{" ++ T.unpack t ++ "}")
preamble :: PandocMonad m => LP m Blocks
@@ -1571,11 +1563,8 @@ newenvironment = do
controlSeq "renewenvironment" <|>
controlSeq "provideenvironment"
optional $ symbol '*'
- symbol '{'
- spaces
- Tok _ Word name <- satisfyTok isWordTok
spaces
- symbol '}'
+ name <- untokenize <$> braced
spaces
numargs <- option 0 $ try bracketedNum
spaces
diff --git a/test/command/3803.md b/test/command/3803.md
new file mode 100644
index 000000000..a2e60359d
--- /dev/null
+++ b/test/command/3803.md
@@ -0,0 +1,10 @@
+```
+% pandoc -f markdown+raw_tex -t latex
+\begin{blah*}
+*ok*
+\end{blah*}
+^D
+\begin{blah*}
+*ok*
+\end{blah*}
+```