@@ -35,6 +35,7 @@ module Text.Pandoc.Readers.LaTeX ( readLaTeX,
3535
3636import Text.Pandoc.Definition
3737import Text.Pandoc.Shared
38+import Text.Pandoc.Options
3839import Text.Pandoc.Parsing hiding ((<|>), many, optional, space)
3940import qualified Text.Pandoc.UTF8 as UTF8
4041import Data.Char ( chr, ord )
@@ -230,14 +231,14 @@ ignoreInlines name = (name, doraw <|> (mempty <$ optargs))
230231 where optargs = skipopts *> skipMany (try $ optional sp *> braced)
231232 contseq = '\\':name
232233 doraw = (rawInline "latex" . (contseq ++) . snd) <$>
233− (getState >>= guard . stateParseRaw >> (withRaw optargs))
234+ (getOption readerParseRaw >>= guard >> (withRaw optargs))
234235
235236ignoreBlocks :: String -> (String, LP Blocks)
236237ignoreBlocks name = (name, doraw <|> (mempty <$ optargs))
237238 where optargs = skipopts *> skipMany (try $ optional sp *> braced)
238239 contseq = '\\':name
239240 doraw = (rawBlock "latex" . (contseq ++) . snd) <$>
240− (getState >>= guard . stateParseRaw >> (withRaw optargs))
241+ (getOption readerParseRaw >>= guard >> (withRaw optargs))
241242
242243blockCommands :: M.Map String (LP Blocks)
243244blockCommands = M.fromList $
@@ -321,7 +322,7 @@ inlineCommand :: LP Inlines
321322inlineCommand = try $ do
322323 name <- anyControlSeq
323324 guard $ not $ isBlockCommand name
324− parseRaw <- stateParseRaw `fmap` getState
325+ parseRaw <- getOption readerParseRaw
325326 star <- option "" (string "*")
326327 let name' = name ++ star
327328 let rawargs = withRaw (skipopts *> option "" dimenarg
@@ -336,7 +337,7 @@ inlineCommand = try $ do
336337 Nothing -> raw
337338
338339unlessParseRaw :: LP ()
339−unlessParseRaw = getState >>= guard . not . stateParseRaw
340+unlessParseRaw = getOption readerParseRaw >>= guard . not
340341
341342isBlockCommand :: String -> Bool
342343isBlockCommand s = maybe False (const True) $ M.lookup s blockCommands
@@ -660,7 +661,7 @@ environment = do
660661rawEnv :: String -> LP Blocks
661662rawEnv name = do
662663 let addBegin x = "\\begin{" ++ name ++ "}" ++ x
663− parseRaw <- stateParseRaw `fmap` getState
664+ parseRaw <- getOption readerParseRaw
664665 if parseRaw
665666 then (rawBlock "latex" . addBegin) <$>
666667 (withRaw (env name blocks) >>= applyMacros' . snd)