@@ -376,7 +376,7 @@ convertWithOpts opts = do
377 else optTabStop opts)
377 else optTabStop opts)
379− readSources :: (Functor m, MonadIO m) => [FilePath] -> m String
379+ readSources :: [FilePath] -> PandocIO String
380 readSources srcs = convertTabs . intercalate "\n" <$>
380 readSources srcs = convertTabs . intercalate "\n" <$>
381 mapM readSource srcs
381 mapM readSource srcs
@@ -751,6 +751,11 @@ fillMedia sourceURL d = walkM handleImage d
751 "replacing image with description"
751 "replacing image with description"
752 -- emit alt text
752 -- emit alt text
753 return $ Span ("",["image"],[]) lab
753 return $ Span ("",["image"],[]) lab
754+ PandocHttpError u er -> do
755+ report $ CouldNotFetchResource u
756+ (show er ++ "\rReplacing image with description.")
758+ return $ Span ("",["image"],[]) lab
754 _ -> throwError e)
759 _ -> throwError e)
755 handleImage x = return x
760 handleImage x = return x
@@ -800,7 +805,7 @@ applyFilters mbDatadir filters args d = do
800 expandedFilters <- mapM (expandFilterPath mbDatadir) filters
805 expandedFilters <- mapM (expandFilterPath mbDatadir) filters
801 foldrM ($) d $ map (flip externalFilter args) expandedFilters
806 foldrM ($) d $ map (flip externalFilter args) expandedFilters
803−readSource :: MonadIO m => FilePath -> m String
808+readSource :: FilePath -> PandocIO String
804readSource "-" = liftIO UTF8.getContents
809readSource "-" = liftIO UTF8.getContents
805readSource src = case parseURI src of
810readSource src = case parseURI src of
806 Just u | uriScheme u `elem` ["http:","https:"] ->
811 Just u | uriScheme u `elem` ["http:","https:"] ->
@@ -809,8 +814,12 @@ readSource src = case parseURI src of
809 liftIO $ UTF8.readFile (uriPath u)
814 liftIO $ UTF8.readFile (uriPath u)
810 _ -> liftIO $ UTF8.readFile src
815 _ -> liftIO $ UTF8.readFile src
812−readURI :: MonadIO m => FilePath -> m String
817+readURI :: FilePath -> PandocIO String
813−readURI src = liftIO $ (UTF8.toString . fst) <$> openURL src
818+readURI src = do
819+ res <- liftIO $ openURL src
821+ Left e -> throwError $ PandocHttpError src e
822+ Right (contents, _) -> return $ UTF8.toString contents
815readFile' :: MonadIO m => FilePath -> m B.ByteString
824readFile' :: MonadIO m => FilePath -> m B.ByteString
816readFile' "-" = liftIO B.getContents
825readFile' "-" = liftIO B.getContents