@@ -67,7 +67,6 @@ module Text.Pandoc.Parsing ( anyLine,
6767 widthsFromIndices,
6868 gridTableWith,
6969 readWith,
70− readWithWarnings,
7170 readWithM,
7271 testStringWith,
7372 guardEnabled,
@@ -165,7 +164,6 @@ module Text.Pandoc.Parsing ( anyLine,
165164 setSourceColumn,
166165 setSourceLine,
167166 newPos,
168− addWarning,
169167 (<+?>),
170168 extractIdClass
171169 )
@@ -895,15 +893,6 @@ readWith :: Parser [Char] st a
895893 -> Either PandocError a
896894readWith p t inp = runIdentity $ readWithM p t inp
897895
898−readWithWarnings :: Parser [Char] ParserState a
899− -> ParserState
900− -> String
901− -> Either PandocError (a, [String])
902−readWithWarnings p = readWith $ do
903− doc <- p
904− warnings <- stateWarnings <$> getState
905− return (doc, warnings)
906−
907896-- | Parse a string with @parser@ (for testing).
908897testStringWith :: (Show a)
909898 => ParserT [Char] ParserState Identity a
@@ -940,8 +929,7 @@ data ParserState = ParserState
940929 -- roles), 3) Additional classes (rest of Attr is unused)).
941930 stateCaption :: Maybe Inlines, -- ^ Caption in current environment
942931 stateInHtmlBlock :: Maybe String, -- ^ Tag type of HTML block being parsed
943− stateMarkdownAttribute :: Bool, -- ^ True if in markdown=1 context
944− stateWarnings :: [String] -- ^ Warnings generated by the parser
932+ stateMarkdownAttribute :: Bool -- ^ True if in markdown=1 context
945933 }
946934
947935instance Default ParserState where
@@ -1036,8 +1024,8 @@ defaultParserState =
10361024 stateRstCustomRoles = M.empty,
10371025 stateCaption = Nothing,
10381026 stateInHtmlBlock = Nothing,
1039− stateMarkdownAttribute = False,
1040− stateWarnings = []}
1027+ stateMarkdownAttribute = False
1028+ }
10411029
10421030-- | Succeed only if the extension is enabled.
10431031guardEnabled :: (Stream s m a, HasReaderOptions st) => Extension -> ParserT s st m ()
@@ -1274,12 +1262,6 @@ applyMacros' target = do
12741262 return $ applyMacros macros target
12751263 else return target
12761264
1277−-- | Append a warning to the log.
1278−addWarning :: Maybe SourcePos -> String -> Parser [Char] ParserState ()
1279−addWarning mbpos msg =
1280− updateState $ \st -> st{
1281− stateWarnings = (msg ++ maybe "" (\pos -> " " ++ show pos) mbpos) :
1282− stateWarnings st }
12831265infixr 5 <+?>
12841266(<+?>) :: (Monoid a) => ParserT s st m a -> ParserT s st m a -> ParserT s st m a
12851267a <+?> b = a >>= flip fmap (try b <|> return mempty) . (<>)