git.iko.soy/typeable/pandoc
on master help sign in
Changed parseWithWarnings to the more general returnWarnings parser transformer
5dc902cMatthew Pickering
src/Text/Pandoc/Parsing.hs+5−6
@@ -65,7 +65,7 @@ module Text.Pandoc.Parsing ( anyLine,
65 widthsFromIndices,
65 widthsFromIndices,
66 gridTableWith,
66 gridTableWith,
67 readWith,
67 readWith,
68− readWithWarnings,
68+ returnWarnings,
69 readWithM,
69 readWithM,
70 testStringWith,
70 testStringWith,
71 guardEnabled,
71 guardEnabled,
@@ -885,11 +885,10 @@ readWith :: Parser [Char] st a
885 -> a
885 -> a
886readWith p t inp = runIdentity $ readWithM p t inp
886readWith p t inp = runIdentity $ readWithM p t inp
887
887
888−readWithWarnings :: Parser [Char] ParserState a
888+returnWarnings :: (Stream s m c)
889− -> ParserState
889+ => ParserT s ParserState m a
890− -> String
891− -> (a, [String])
890+ -> ParserT s ParserState m (a, [String])
892−readWithWarnings p = readWith $ do
891+returnWarnings p = do
893 doc <- p
892 doc <- p
894 warnings <- stateWarnings <$> getState
893 warnings <- stateWarnings <$> getState
895 return (doc, warnings)
894 return (doc, warnings)
src/Text/Pandoc/Readers/RST.hs+1−1
@@ -58,7 +58,7 @@ readRST :: ReaderOptions -- ^ Reader options
58readRST opts s = (readWith parseRST) def{ stateOptions = opts } (s ++ "\n\n")
58readRST opts s = (readWith parseRST) def{ stateOptions = opts } (s ++ "\n\n")
59
59
60readRSTWithWarnings :: ReaderOptions -> String -> (Pandoc, [String])
60readRSTWithWarnings :: ReaderOptions -> String -> (Pandoc, [String])
61−readRSTWithWarnings opts s = (readWithWarnings parseRST) def{ stateOptions = opts } (s ++ "\n\n")
61+readRSTWithWarnings opts s = (readWith (returnWarnings parseRST)) def{ stateOptions = opts } (s ++ "\n\n")
62
62
63type RSTParser = Parser [Char] ParserState
63type RSTParser = Parser [Char] ParserState
64
64