@@ -61,6 +61,7 @@ module Text.Pandoc.Parsing ( (>>~),
62 testStringWith,
62 testStringWith,
63 ParserState (..),
63 ParserState (..),
64 defaultParserState,
65 defaultParserState,
65 HeaderType (..),
66 HeaderType (..),
66 ParserContext (..),
67 ParserContext (..),
@@ -390,9 +391,7 @@ nullBlock = anyChar >> return Null
391-- | Fail if reader is in strict markdown syntax mode.
392-- | Fail if reader is in strict markdown syntax mode.
392failIfStrict :: Parsec [a] ParserState ()
393failIfStrict :: Parsec [a] ParserState ()
393−failIfStrict = do
394+failIfStrict = getOption readerStrict >>= guard . not
395− if readerStrict (stateOptions state) then fail "strict mode" else return ()
397-- | Fail unless we're in literate haskell mode.
396-- | Fail unless we're in literate haskell mode.
398failUnlessLHS :: Parsec [tok] ParserState ()
397failUnlessLHS :: Parsec [tok] ParserState ()
@@ -750,6 +749,9 @@ defaultParserState =
750 stateMacros = [],
749 stateMacros = [],
751 stateRstDefaultRole = "title-reference"}
750 stateRstDefaultRole = "title-reference"}
752+getOption :: (ReaderOptions -> a) -> Parser [t] ParserState a
753+getOption f = (f . stateOptions) `fmap` getState
753data HeaderType
755data HeaderType
754 = SingleHeader Char -- ^ Single line of characters underneath
756 = SingleHeader Char -- ^ Single line of characters underneath
755 | DoubleHeader Char -- ^ Lines of characters above and below
757 | DoubleHeader Char -- ^ Lines of characters above and below
@@ -795,7 +797,7 @@ lookupKeySrc table key = case M.lookup key table of
796-- | Fail unless we're in "smart typography" mode.
798-- | Fail unless we're in "smart typography" mode.
797failUnlessSmart :: Parsec [tok] ParserState ()
799failUnlessSmart :: Parsec [tok] ParserState ()
798−failUnlessSmart = getState >>= guard . readerSmart . stateOptions
800+failUnlessSmart = getOption readerSmart >>= guard
800smartPunctuation :: Parsec [Char] ParserState Inline
802smartPunctuation :: Parsec [Char] ParserState Inline
801 -> Parsec [Char] ParserState Inline
803 -> Parsec [Char] ParserState Inline