aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 2ec191154..9b6cc0e3f 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -559,9 +559,14 @@ tok = try $ spaces >> grouped inline <|> inlineCommand' <|> singleChar'
return $ str t
opt :: PandocMonad m => LP m Inlines
-opt = bracketed inline
- <|>
- (str . T.dropWhile (=='[') . T.dropWhileEnd (==']') <$> rawopt)
+opt = do
+ toks <- try (sp *> bracketedToks <* sp)
+ -- now parse the toks as inlines
+ st <- getState
+ parsed <- runParserT (mconcat <$> many inline) st "bracketed option" toks
+ case parsed of
+ Right result -> return result
+ Left e -> throwError $ PandocParsecError (untokenize toks) e
paropt :: PandocMonad m => LP m Inlines
paropt = parenWrapped inline