diff options
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 8100a6823..dc460684e 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -859,8 +859,14 @@ tok = try $ grouped inline <|> inlineCommand <|> str <$> count 1 inlineChar opt :: LP Inlines opt = bracketed inline +rawopt :: LP String +rawopt = do + contents <- bracketed (many1 (noneOf "]") <|> try (string "\\]")) + optional sp + return $ "[" ++ contents ++ "]" + skipopts :: LP () -skipopts = skipMany (opt *> optional sp) +skipopts = skipMany rawopt inlineText :: LP Inlines inlineText = str <$> many1 inlineChar @@ -883,8 +889,9 @@ inlineEnvironment = try $ do rawEnv :: String -> LP Blocks rawEnv name = do - let addBegin x = "\\begin{" ++ name ++ "}" ++ x parseRaw <- getOption readerParseRaw + rawOptions <- mconcat <$> many rawopt + let addBegin x = "\\begin{" ++ name ++ "}" ++ rawOptions ++ x if parseRaw then (rawBlock "latex" . addBegin) <$> (withRaw (env name blocks) >>= applyMacros' . snd) |