@@ -35,6 +35,7 @@ module Text.Pandoc.Readers.LaTeX ( readLaTeX,
36import Text.Pandoc.Definition
36import Text.Pandoc.Definition
37import Text.Pandoc.Shared
37import Text.Pandoc.Shared
38+import Text.Pandoc.Options
38import Text.Pandoc.Parsing hiding ((<|>), many, optional, space)
39import Text.Pandoc.Parsing hiding ((<|>), many, optional, space)
39import qualified Text.Pandoc.UTF8 as UTF8
40import qualified Text.Pandoc.UTF8 as UTF8
40import Data.Char ( chr, ord )
41import Data.Char ( chr, ord )
@@ -230,14 +231,14 @@ ignoreInlines name = (name, doraw <|> (mempty <$ optargs))
230 where optargs = skipopts *> skipMany (try $ optional sp *> braced)
231 where optargs = skipopts *> skipMany (try $ optional sp *> braced)
231 contseq = '\\':name
232 contseq = '\\':name
232 doraw = (rawInline "latex" . (contseq ++) . snd) <$>
233 doraw = (rawInline "latex" . (contseq ++) . snd) <$>
233− (getState >>= guard . stateParseRaw >> (withRaw optargs))
234+ (getOption readerParseRaw >>= guard >> (withRaw optargs))
235ignoreBlocks :: String -> (String, LP Blocks)
236ignoreBlocks :: String -> (String, LP Blocks)
236ignoreBlocks name = (name, doraw <|> (mempty <$ optargs))
237ignoreBlocks name = (name, doraw <|> (mempty <$ optargs))
237 where optargs = skipopts *> skipMany (try $ optional sp *> braced)
238 where optargs = skipopts *> skipMany (try $ optional sp *> braced)
238 contseq = '\\':name
239 contseq = '\\':name
239 doraw = (rawBlock "latex" . (contseq ++) . snd) <$>
240 doraw = (rawBlock "latex" . (contseq ++) . snd) <$>
240− (getState >>= guard . stateParseRaw >> (withRaw optargs))
241+ (getOption readerParseRaw >>= guard >> (withRaw optargs))
242blockCommands :: M.Map String (LP Blocks)
243blockCommands :: M.Map String (LP Blocks)
243blockCommands = M.fromList $
244blockCommands = M.fromList $
@@ -321,7 +322,7 @@ inlineCommand :: LP Inlines
321inlineCommand = try $ do
322inlineCommand = try $ do
322 name <- anyControlSeq
323 name <- anyControlSeq
323 guard $ not $ isBlockCommand name
324 guard $ not $ isBlockCommand name
324− parseRaw <- stateParseRaw `fmap` getState
325+ parseRaw <- getOption readerParseRaw
325 star <- option "" (string "*")
326 star <- option "" (string "*")
326 let name' = name ++ star
327 let name' = name ++ star
327 let rawargs = withRaw (skipopts *> option "" dimenarg
328 let rawargs = withRaw (skipopts *> option "" dimenarg
@@ -336,7 +337,7 @@ inlineCommand = try $ do
336 Nothing -> raw
337 Nothing -> raw
338unlessParseRaw :: LP ()
339unlessParseRaw :: LP ()
339−unlessParseRaw = getState >>= guard . not . stateParseRaw
340+unlessParseRaw = getOption readerParseRaw >>= guard . not
341isBlockCommand :: String -> Bool
342isBlockCommand :: String -> Bool
342isBlockCommand s = maybe False (const True) $ M.lookup s blockCommands
343isBlockCommand s = maybe False (const True) $ M.lookup s blockCommands
@@ -660,7 +661,7 @@ environment = do
660rawEnv :: String -> LP Blocks
661rawEnv :: String -> LP Blocks
661rawEnv name = do
662rawEnv name = do
662 let addBegin x = "\\begin{" ++ name ++ "}" ++ x
663 let addBegin x = "\\begin{" ++ name ++ "}" ++ x
663− parseRaw <- stateParseRaw `fmap` getState
664+ parseRaw <- getOption readerParseRaw
664 if parseRaw
665 if parseRaw
665 then (rawBlock "latex" . addBegin) <$>
666 then (rawBlock "latex" . addBegin) <$>
666 (withRaw (env name blocks) >>= applyMacros' . snd)
667 (withRaw (env name blocks) >>= applyMacros' . snd)