pandoc-3.2.1: Conversion between markup formats
CopyrightCopyright (C) 2016-2020 Jesse Rosenthal John MacFarlane
LicenseGNU GPL, version 2 or above
MaintainerJesse Rosenthal <jrosenthal@jhu.edu>
Stabilityalpha
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Text.Pandoc.Class.IO

Description

Default ways to perform PandocMonad actions in a MonadIO type.

These functions are used to make the PandocIO type an instance of PandocMonad, but can be reused for any other MonadIO-conforming types.

Synopsis

Documentation

fileExists :: (PandocMonad m, MonadIO m) => FilePath -> m Bool Source #

Returns True if file exists.

getCurrentTime :: MonadIO m => m UTCTime Source #

Get the current (UTC) time.

getCurrentTimeZone :: MonadIO m => m TimeZone Source #

Get the locale's time zone.

getDataFileName :: (PandocMonad m, MonadIO m) => FilePath -> m FilePath Source #

Returns the path of data file.

getModificationTime :: (PandocMonad m, MonadIO m) => FilePath -> m UTCTime Source #

Return the modification time of a file.

glob :: (PandocMonad m, MonadIO m) => String -> m [FilePath] Source #

Return a list of paths that match a glob, relative to the working directory. See Glob for the glob syntax.

logOutput :: (PandocMonad m, MonadIO m) => LogMessage -> m () Source #

Output a log message.

logIOError :: (PandocMonad m, MonadIO m) => IO () -> m () Source #

Show potential IO errors to the user continuing execution anyway

lookupEnv :: MonadIO m => Text -> m (Maybe Text) Source #

Lookup an environment variable in the programs environment.

newStdGen :: MonadIO m => m StdGen Source #

Return a new generator for random numbers.

newUniqueHash :: MonadIO m => m Int Source #

Return a new unique integer.

readFileLazy :: (PandocMonad m, MonadIO m) => FilePath -> m ByteString Source #

Read the lazy ByteString contents from a file path, raising an error on failure.

readFileStrict :: (PandocMonad m, MonadIO m) => FilePath -> m ByteString Source #

Read the strict ByteString contents from a file path, raising an error on failure.

readStdinStrict :: (PandocMonad m, MonadIO m) => m ByteString Source #

Read the strict ByteString contents from stdin, raising an error on failure.

extractMedia :: (PandocMonad m, MonadIO m) => FilePath -> Pandoc -> m Pandoc Source #

Extract media from the mediabag into a directory.

writeMedia :: (PandocMonad m, MonadIO m) => FilePath -> (FilePath, MimeType, ByteString) -> m () Source #

Write the contents of a media bag to a path. If the path contains URI escape sequences (percent-encoding), these are resolved.