aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/LaTeX
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-09-09 21:33:16 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-09-09 21:33:16 -0700
commit4778d034734e4848688c1fb5fa196b8bda8f08f2 (patch)
treeb2f7e2da454ffb8a3949cc8070aa4d473fbd1f14 /src/Text/Pandoc/Readers/LaTeX
parent4dad7c5e86d9b6661f00912c4443245de6a636a4 (diff)
downloadpandoc-4778d034734e4848688c1fb5fa196b8bda8f08f2.tar.gz
LaTeX reader: Fix parsing of optional arguments that contain braced text.
Closes #5740.
Diffstat (limited to 'src/Text/Pandoc/Readers/LaTeX')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX/Parsing.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
index 547b855e2..a0d604ea8 100644
--- a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
+++ b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
@@ -93,8 +93,6 @@ import Text.Pandoc.Readers.LaTeX.Types (ExpansionPoint (..), Macro (..),
import Text.Pandoc.Shared
import Text.Parsec.Pos
--- import Debug.Trace (traceShowId)
-
newtype DottedNum = DottedNum [Int]
deriving (Show)
@@ -447,7 +445,7 @@ doMacros' n inp = do
args <- case optarg of
Nothing -> getargs M.empty argspecs
Just o -> do
- x <- option o bracketedToks
+ x <- option o $ bracketedToks
getargs (M.singleton 1 x) $ drop 1 argspecs
rest <- getInput
return (args, rest)
@@ -644,7 +642,8 @@ bracketed parser = try $ do
bracketedToks :: PandocMonad m => LP m [Tok]
bracketedToks = do
symbol '['
- mconcat <$> manyTill (braced <|> (:[]) <$> anyTok) (symbol ']')
+ concat <$> manyTill ((snd <$> withRaw (try braced)) <|> count 1 anyTok)
+ (symbol ']')
parenWrapped :: PandocMonad m => Monoid a => LP m a -> LP m a
parenWrapped parser = try $ do