pandoc-2.5: Conversion between markup formats

Copyright | Copyright (C) 2016-17 Jesse Rosenthal John MacFarlane
License | GNU GPL, version 2 or above
Maintainer | Jesse Rosenthal <jrosenthal@jhu.edu>
Stability | alpha
Portability | portable
Safe Haskell | None
Language | Haskell2010

Text.Pandoc.Class

Description

This module defines a type class, `PandocMonad`, for pandoc readers and writers. A pure instance `PandocPure` and an impure instance `PandocIO` are provided. This allows users of the library to choose whether they want conversions to perform IO operations (such as reading include files or images).

Synopsis

- class (Functor m, Applicative m, Monad m, MonadError PandocError m) => PandocMonad m where
  - lookupEnv :: String -> m (Maybe String)
  - getCurrentTime :: m UTCTime
  - getCurrentTimeZone :: m TimeZone
  - newStdGen :: m StdGen
  - newUniqueHash :: m Int
  - openURL :: String -> m (ByteString, Maybe MimeType)
  - readFileLazy :: FilePath -> m ByteString
  - readFileStrict :: FilePath -> m ByteString
  - glob :: String -> m [FilePath]
  - fileExists :: FilePath -> m Bool
  - getDataFileName :: FilePath -> m FilePath
  - getModificationTime :: FilePath -> m UTCTime
  - getCommonState :: m CommonState
  - putCommonState :: CommonState -> m ()
  - getsCommonState :: (CommonState -> a) -> m a
  - modifyCommonState :: (CommonState -> CommonState) -> m ()
  - logOutput :: LogMessage -> m ()
  - trace :: String -> m ()
- data CommonState = CommonState {
  - stLog :: [LogMessage]
  - stUserDataDir :: Maybe FilePath
  - stSourceURL :: Maybe String
  - stRequestHeaders :: [(String, String)]
  - stMediaBag :: MediaBag
  - stTranslations :: Maybe (Lang, Maybe Translations)
  - stInputFiles :: [FilePath]
  - stOutputFile :: Maybe FilePath
  - stResourcePath :: [FilePath]
  - stVerbosity :: Verbosity
  - stTrace :: Bool
  }
- data PureState = PureState {
  - stStdGen :: StdGen
  - stWord8Store :: [Word8]
  - stUniqStore :: [Int]
  - stEnv :: [(String, String)]
  - stTime :: UTCTime
  - stTimeZone :: TimeZone
  - stReferenceDocx :: Archive
  - stReferencePptx :: Archive
  - stReferenceODT :: Archive
  - stFiles :: FileTree
  - stUserDataFiles :: FileTree
  - stCabalDataFiles :: FileTree
  }
- getPureState :: PandocPure PureState
- getsPureState :: (PureState -> a) -> PandocPure a
- putPureState :: PureState -> PandocPure ()
- modifyPureState :: (PureState -> PureState) -> PandocPure ()
- getPOSIXTime :: PandocMonad m => m POSIXTime
- getZonedTime :: PandocMonad m => m ZonedTime
- readFileFromDirs :: PandocMonad m => [FilePath] -> FilePath -> m (Maybe String)
- report :: PandocMonad m => LogMessage -> m ()
- setTrace :: PandocMonad m => Bool -> m ()
- setRequestHeader :: PandocMonad m => String -> String -> m ()
- getLog :: PandocMonad m => m [LogMessage]
- setVerbosity :: PandocMonad m => Verbosity -> m ()
- getVerbosity :: PandocMonad m => m Verbosity
- getMediaBag :: PandocMonad m => m MediaBag
- setMediaBag :: PandocMonad m => MediaBag -> m ()
- insertMedia :: PandocMonad m => FilePath -> Maybe MimeType -> ByteString -> m ()
- setUserDataDir :: PandocMonad m => Maybe FilePath -> m ()
- getUserDataDir :: PandocMonad m => m (Maybe FilePath)
- fetchItem :: PandocMonad m => String -> m (ByteString, Maybe MimeType)
- getInputFiles :: PandocMonad m => m [FilePath]
- setInputFiles :: PandocMonad m => [FilePath] -> m ()
- getOutputFile :: PandocMonad m => m (Maybe FilePath)
- setOutputFile :: PandocMonad m => Maybe FilePath -> m ()
- setResourcePath :: PandocMonad m => [FilePath] -> m ()
- getResourcePath :: PandocMonad m => m [FilePath]
- newtype PandocIO a = PandocIO {
  - unPandocIO :: ExceptT PandocError (StateT CommonState IO) a
  }
- newtype PandocPure a = PandocPure {
  - unPandocPure :: ExceptT PandocError (StateT CommonState (State PureState)) a
  }
- data FileTree
- data FileInfo = FileInfo {
  - infoFileMTime :: UTCTime
  - infoFileContents :: ByteString
  }
- addToFileTree :: FileTree -> FilePath -> IO FileTree
- insertInFileTree :: FilePath -> FileInfo -> FileTree -> FileTree
- runIO :: PandocIO a -> IO (Either PandocError a)
- runIOorExplode :: PandocIO a -> IO a
- runPure :: PandocPure a -> Either PandocError a
- readDefaultDataFile :: PandocMonad m => FilePath -> m ByteString
- readDataFile :: PandocMonad m => FilePath -> m ByteString
- fetchMediaResource :: PandocMonad m => String -> m (FilePath, Maybe MimeType, ByteString)
- fillMediaBag :: PandocMonad m => Pandoc -> m Pandoc
- extractMedia :: FilePath -> Pandoc -> PandocIO Pandoc
- toLang :: PandocMonad m => Maybe String -> m (Maybe Lang)
- setTranslations :: PandocMonad m => Lang -> m ()
- translateTerm :: PandocMonad m => Term -> m String
- data Translations

# Documentation

class (Functor m, Applicative m, Monad m, MonadError PandocError m) => PandocMonad m where Source #

The PandocMonad typeclass contains all the potentially IO-related functions used in pandoc's readers and writers. Instances of this typeclass may implement these functions in IO (as in `PandocIO`) or using an internal state that represents a file system, time, and so on (as in `PandocPure`).

Minimal complete definition

lookupEnv, getCurrentTime, getCurrentTimeZone, newStdGen, newUniqueHash, openURL, readFileLazy, readFileStrict, glob, fileExists, getDataFileName, getModificationTime, getCommonState, putCommonState, logOutput

Methods

lookupEnv :: String -> m (Maybe String) Source #

Lookup an environment variable.

getCurrentTime :: m UTCTime Source #

Get the current (UTC) time.

getCurrentTimeZone :: m TimeZone Source #

Get the locale's time zone.

newStdGen :: m StdGen Source #

Return a new generator for random numbers.

newUniqueHash :: m Int Source #

Return a new unique integer.

openURL :: String -> m (ByteString, Maybe MimeType) Source #

Retrieve contents and mime type from a URL, raising an error on failure.

readFileLazy :: FilePath -> m ByteString Source #

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

readFileStrict :: FilePath -> m ByteString Source #

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

glob :: String -> m [FilePath] Source #

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

fileExists :: FilePath -> m Bool Source #

Returns True if file exists.

getDataFileName :: FilePath -> m FilePath Source #

Returns the path of data file.

getModificationTime :: FilePath -> m UTCTime Source #

Return the modification time of a file.

getCommonState :: m CommonState Source #

Get the value of the `CommonState` used by all instances of `PandocMonad`.

putCommonState :: CommonState -> m () Source #

Set the value of the `CommonState` used by all instances of `PandocMonad`. | Get the value of a specific field of `CommonState`.

getsCommonState :: (CommonState -> a) -> m a Source #

Get the value of a specific field of `CommonState`.

modifyCommonState :: (CommonState -> CommonState) -> m () Source #

Modify the `CommonState`.

logOutput :: LogMessage -> m () Source #

trace :: String -> m () Source #

Instances

PandocMonad PandocPure Source # |

Instance details

Defined in Text.Pandoc.Class

Methods

lookupEnv :: String -> PandocPure (Maybe String) Source #

getCurrentTime :: PandocPure UTCTime Source #

getCurrentTimeZone :: PandocPure TimeZone Source #

newStdGen :: PandocPure StdGen Source #

newUniqueHash :: PandocPure Int Source #

openURL :: String -> PandocPure (ByteString, Maybe MimeType) Source #

readFileLazy :: FilePath -> PandocPure ByteString Source #

readFileStrict :: FilePath -> PandocPure ByteString Source #

glob :: String -> PandocPure [FilePath] Source #

fileExists :: FilePath -> PandocPure Bool Source #

getDataFileName :: FilePath -> PandocPure FilePath Source #

getModificationTime :: FilePath -> PandocPure UTCTime Source #

getCommonState :: PandocPure CommonState Source #

putCommonState :: CommonState -> PandocPure () Source #

getsCommonState :: (CommonState -> a) -> PandocPure a Source #

modifyCommonState :: (CommonState -> CommonState) -> PandocPure () Source #

logOutput :: LogMessage -> PandocPure () Source #

trace :: String -> PandocPure () Source #

PandocMonad PandocIO Source # |

Instance details

Defined in Text.Pandoc.Class

Methods

lookupEnv :: String -> PandocIO (Maybe String) Source #

getCurrentTime :: PandocIO UTCTime Source #

getCurrentTimeZone :: PandocIO TimeZone Source #

newStdGen :: PandocIO StdGen Source #

newUniqueHash :: PandocIO Int Source #

openURL :: String -> PandocIO (ByteString, Maybe MimeType) Source #

readFileLazy :: FilePath -> PandocIO ByteString Source #

readFileStrict :: FilePath -> PandocIO ByteString Source #

glob :: String -> PandocIO [FilePath] Source #

fileExists :: FilePath -> PandocIO Bool Source #

getDataFileName :: FilePath -> PandocIO FilePath Source #

getModificationTime :: FilePath -> PandocIO UTCTime Source #

getCommonState :: PandocIO CommonState Source #

putCommonState :: CommonState -> PandocIO () Source #

getsCommonState :: (CommonState -> a) -> PandocIO a Source #

modifyCommonState :: (CommonState -> CommonState) -> PandocIO () Source #

logOutput :: LogMessage -> PandocIO () Source #

trace :: String -> PandocIO () Source #

(MonadTrans t, PandocMonad m, Functor (t m), MonadError PandocError (t m), Monad (t m), Applicative (t m)) => PandocMonad (t m) Source # |

Instance details

Defined in Text.Pandoc.Class

Methods

lookupEnv :: String -> t m (Maybe String) Source #

getCurrentTime :: t m UTCTime Source #

getCurrentTimeZone :: t m TimeZone Source #

newStdGen :: t m StdGen Source #

newUniqueHash :: t m Int Source #

openURL :: String -> t m (ByteString, Maybe MimeType) Source #

readFileLazy :: FilePath -> t m ByteString Source #

readFileStrict :: FilePath -> t m ByteString Source #

glob :: String -> t m [FilePath] Source #

fileExists :: FilePath -> t m Bool Source #

getDataFileName :: FilePath -> t m FilePath Source #

getModificationTime :: FilePath -> t m UTCTime Source #

getCommonState :: t m CommonState Source #

putCommonState :: CommonState -> t m () Source #

getsCommonState :: (CommonState -> a) -> t m a Source #

modifyCommonState :: (CommonState -> CommonState) -> t m () Source #

logOutput :: LogMessage -> t m () Source #

trace :: String -> t m () Source #

PandocMonad m => PandocMonad (ParsecT s st m) Source # |

Instance details

Defined in Text.Pandoc.Class

Methods

lookupEnv :: String -> ParsecT s st m (Maybe String) Source #

getCurrentTime :: ParsecT s st m UTCTime Source #

getCurrentTimeZone :: ParsecT s st m TimeZone Source #

newStdGen :: ParsecT s st m StdGen Source #

newUniqueHash :: ParsecT s st m Int Source #

openURL :: String -> ParsecT s st m (ByteString, Maybe MimeType) Source #

readFileLazy :: FilePath -> ParsecT s st m ByteString Source #

readFileStrict :: FilePath -> ParsecT s st m ByteString Source #

glob :: String -> ParsecT s st m [FilePath] Source #

fileExists :: FilePath -> ParsecT s st m Bool Source #

getDataFileName :: FilePath -> ParsecT s st m FilePath Source #

getModificationTime :: FilePath -> ParsecT s st m UTCTime Source #

getCommonState :: ParsecT s st m CommonState Source #

putCommonState :: CommonState -> ParsecT s st m () Source #

getsCommonState :: (CommonState -> a) -> ParsecT s st m a Source #

modifyCommonState :: (CommonState -> CommonState) -> ParsecT s st m () Source #

logOutput :: LogMessage -> ParsecT s st m () Source #

trace :: String -> ParsecT s st m () Source #

data CommonState Source #

`CommonState` represents state that is used by all instances of `PandocMonad`. Normally users should not need to interact with it directly; instead, auxiliary functions like `setVerbosity` and `withMediaBag` should be used.

Constructors

CommonState |

Fields

- stLog :: [LogMessage]

  A list of log messages in reverse order

- stUserDataDir :: Maybe FilePath

  Directory to search for data files

- stSourceURL :: Maybe String

  Absolute URL + dir of 1st source file

- stRequestHeaders :: [(String, String)]

  Headers to add for HTTP requests

- stMediaBag :: MediaBag

  Media parsed from binary containers

- stTranslations :: Maybe (Lang, Maybe Translations)

  Translations for localization

- stInputFiles :: [FilePath]

  List of input files from command line

- stOutputFile :: Maybe FilePath

  Output file from command line

- stResourcePath :: [FilePath]

  Path to search for resources like included images

- stVerbosity :: Verbosity

  Verbosity level

- stTrace :: Bool

  Controls whether tracing messages are issued.

Instances

Default CommonState Source # |
Instance details Defined in Text.Pandoc.Class Methods def :: CommonState #
Peekable CommonState Source # |
Instance details Defined in Text.Pandoc.Lua.StackInstances Methods peek :: StackIndex -> Lua CommonState Source #
Pushable CommonState Source # |
Instance details Defined in Text.Pandoc.Lua.StackInstances Methods push :: CommonState -> Lua () Source #

data PureState Source #

The `PureState` contains ersatz representations of things that would normally be obtained through IO.

Constructors

PureState |

Fields

- stStdGen :: StdGen
- stWord8Store :: [Word8]
- stUniqStore :: [Int]
- stEnv :: [(String, String)]
- stTime :: UTCTime
- stTimeZone :: TimeZone
- stReferenceDocx :: Archive
- stReferencePptx :: Archive
- stReferenceODT :: Archive
- stFiles :: FileTree
- stUserDataFiles :: FileTree
- stCabalDataFiles :: FileTree

Instances

Default PureState Source # |
Instance details Defined in Text.Pandoc.Class Methods def :: PureState #

getPureState :: PandocPure PureState Source #

getsPureState :: (PureState -> a) -> PandocPure a Source #

putPureState :: PureState -> PandocPure () Source #

modifyPureState :: (PureState -> PureState) -> PandocPure () Source #

getPOSIXTime :: PandocMonad m => m POSIXTime Source #

getZonedTime :: PandocMonad m => m ZonedTime Source #

readFileFromDirs :: PandocMonad m => [FilePath] -> FilePath -> m (Maybe String) Source #

Read file, checking in any number of directories.

report :: PandocMonad m => LogMessage -> m () Source #

Log a message using `logOutput`. Note that `logOutput` is called only if the verbosity level exceeds the level of the message, but the message is added to the list of log messages that will be retrieved by `getLog` regardless of its verbosity level.

setTrace :: PandocMonad m => Bool -> m () Source #

Determine whether tracing is enabled. This affects the behavior of `trace`. If tracing is not enabled, `trace` does nothing.

setRequestHeader Source #

Arguments

:: PandocMonad m |
=> String | Header name
-> String | Value
-> m () |

Set request header to use in HTTP requests.

getLog :: PandocMonad m => m [LogMessage] Source #

setVerbosity :: PandocMonad m => Verbosity -> m () Source #

Set the verbosity level.

getVerbosity :: PandocMonad m => m Verbosity Source #

Get the verbosity level.

getMediaBag :: PandocMonad m => m MediaBag Source #

setMediaBag :: PandocMonad m => MediaBag -> m () Source #

Initialize the media bag.

insertMedia :: PandocMonad m => FilePath -> Maybe MimeType -> ByteString -> m () Source #

setUserDataDir :: PandocMonad m => Maybe FilePath -> m () Source #

Set the user data directory in common state.

getUserDataDir :: PandocMonad m => m (Maybe FilePath) Source #

Get the user data directory from common state.

fetchItem :: PandocMonad m => String -> m (ByteString, Maybe MimeType) Source #

Fetch an image or other item from the local filesystem or the net. Returns raw content and maybe mime type.

getInputFiles :: PandocMonad m => m [FilePath] Source #

setInputFiles :: PandocMonad m => [FilePath] -> m () Source #

getOutputFile :: PandocMonad m => m (Maybe FilePath) Source #

setOutputFile :: PandocMonad m => Maybe FilePath -> m () Source #

setResourcePath :: PandocMonad m => [FilePath] -> m () Source #

getResourcePath :: PandocMonad m => m [FilePath] Source #

newtype PandocIO a Source #

Constructors

PandocIO |

Fields

- unPandocIO :: ExceptT PandocError (StateT CommonState IO) a

Instances

Monad PandocIO Source # |
Instance details Defined in Text.Pandoc.Class Methods (>>=) :: PandocIO a -> (a -> PandocIO b) -> PandocIO b Source # (>>) :: PandocIO a -> PandocIO b -> PandocIO b Source # return :: a -> PandocIO a Source # fail :: String -> PandocIO a Source #
Functor PandocIO Source # |
Instance details Defined in Text.Pandoc.Class Methods fmap :: (a -> b) -> PandocIO a -> PandocIO b Source # (<$) :: a -> PandocIO b -> PandocIO a Source #
Applicative PandocIO Source # |
Instance details Defined in Text.Pandoc.Class Methods pure :: a -> PandocIO a Source # (<*>) :: PandocIO (a -> b) -> PandocIO a -> PandocIO b Source # liftA2 :: (a -> b -> c) -> PandocIO a -> PandocIO b -> PandocIO c Source # (*>) :: PandocIO a -> PandocIO b -> PandocIO b Source # (<*) :: PandocIO a -> PandocIO b -> PandocIO a Source #
MonadIO PandocIO Source # |
Instance details Defined in Text.Pandoc.Class Methods liftIO :: IO a -> PandocIO a Source #
PandocMonad PandocIO Source # |

Instance details

Defined in Text.Pandoc.Class

Methods

lookupEnv :: String -> PandocIO (Maybe String) Source #

getCurrentTime :: PandocIO UTCTime Source #

getCurrentTimeZone :: PandocIO TimeZone Source #

newStdGen :: PandocIO StdGen Source #

newUniqueHash :: PandocIO Int Source #

openURL :: String -> PandocIO (ByteString, Maybe MimeType) Source #

readFileLazy :: FilePath -> PandocIO ByteString Source #

readFileStrict :: FilePath -> PandocIO ByteString Source #

glob :: String -> PandocIO [FilePath] Source #

fileExists :: FilePath -> PandocIO Bool Source #

getDataFileName :: FilePath -> PandocIO FilePath Source #

getModificationTime :: FilePath -> PandocIO UTCTime Source #

getCommonState :: PandocIO CommonState Source #

putCommonState :: CommonState -> PandocIO () Source #

getsCommonState :: (CommonState -> a) -> PandocIO a Source #

modifyCommonState :: (CommonState -> CommonState) -> PandocIO () Source #

logOutput :: LogMessage -> PandocIO () Source #

trace :: String -> PandocIO () Source #

MonadError PandocError PandocIO Source # |
Instance details Defined in Text.Pandoc.Class Methods throwError :: PandocError -> PandocIO a Source # catchError :: PandocIO a -> (PandocError -> PandocIO a) -> PandocIO a Source #

newtype PandocPure a Source #

Constructors

PandocPure |

Fields

- unPandocPure :: ExceptT PandocError (StateT CommonState (State PureState)) a

Instances

Monad PandocPure Source # |
Instance details Defined in Text.Pandoc.Class Methods (>>=) :: PandocPure a -> (a -> PandocPure b) -> PandocPure b Source # (>>) :: PandocPure a -> PandocPure b -> PandocPure b Source # return :: a -> PandocPure a Source # fail :: String -> PandocPure a Source #
Functor PandocPure Source # |
Instance details Defined in Text.Pandoc.Class Methods fmap :: (a -> b) -> PandocPure a -> PandocPure b Source # (<$) :: a -> PandocPure b -> PandocPure a Source #
Applicative PandocPure Source # |
Instance details Defined in Text.Pandoc.Class Methods pure :: a -> PandocPure a Source # (<*>) :: PandocPure (a -> b) -> PandocPure a -> PandocPure b Source # liftA2 :: (a -> b -> c) -> PandocPure a -> PandocPure b -> PandocPure c Source # (*>) :: PandocPure a -> PandocPure b -> PandocPure b Source # (<*) :: PandocPure a -> PandocPure b -> PandocPure a Source #
PandocMonad PandocPure Source # |

Instance details

Defined in Text.Pandoc.Class

Methods

lookupEnv :: String -> PandocPure (Maybe String) Source #

getCurrentTime :: PandocPure UTCTime Source #

getCurrentTimeZone :: PandocPure TimeZone Source #

newStdGen :: PandocPure StdGen Source #

newUniqueHash :: PandocPure Int Source #

openURL :: String -> PandocPure (ByteString, Maybe MimeType) Source #

readFileLazy :: FilePath -> PandocPure ByteString Source #

readFileStrict :: FilePath -> PandocPure ByteString Source #

glob :: String -> PandocPure [FilePath] Source #

fileExists :: FilePath -> PandocPure Bool Source #

getDataFileName :: FilePath -> PandocPure FilePath Source #

getModificationTime :: FilePath -> PandocPure UTCTime Source #

getCommonState :: PandocPure CommonState Source #

putCommonState :: CommonState -> PandocPure () Source #

getsCommonState :: (CommonState -> a) -> PandocPure a Source #

modifyCommonState :: (CommonState -> CommonState) -> PandocPure () Source #

logOutput :: LogMessage -> PandocPure () Source #

trace :: String -> PandocPure () Source #

MonadError PandocError PandocPure Source # |
Instance details Defined in Text.Pandoc.Class Methods throwError :: PandocError -> PandocPure a Source # catchError :: PandocPure a -> (PandocError -> PandocPure a) -> PandocPure a Source #

data FileTree Source #

Instances

Semigroup FileTree Source # |
Instance details Defined in Text.Pandoc.Class Methods (<>) :: FileTree -> FileTree -> FileTree Source # sconcat :: NonEmpty FileTree -> FileTree Source # stimes :: Integral b => b -> FileTree -> FileTree Source #
Monoid FileTree Source # |
Instance details Defined in Text.Pandoc.Class Methods mempty :: FileTree Source # mappend :: FileTree -> FileTree -> FileTree Source # mconcat :: [FileTree] -> FileTree Source #

data FileInfo Source #

Constructors

FileInfo |

Fields

- infoFileMTime :: UTCTime
- infoFileContents :: ByteString

addToFileTree :: FileTree -> FilePath -> IO FileTree Source #

Add the specified file to the FileTree. If file is a directory, add its contents recursively.

insertInFileTree :: FilePath -> FileInfo -> FileTree -> FileTree Source #

Insert an ersatz file into the `FileTree`.

runIO :: PandocIO a -> IO (Either PandocError a) Source #

Evaluate a `PandocIO` operation.

runIOorExplode :: PandocIO a -> IO a Source #

Evaluate a `PandocIO` operation, handling any errors by exiting with an appropriate message and error status.

runPure :: PandocPure a -> Either PandocError a Source #

readDefaultDataFile :: PandocMonad m => FilePath -> m ByteString Source #

Read file from from Cabal data directory.

readDataFile :: PandocMonad m => FilePath -> m ByteString Source #

Read file from user data directory or, if not found there, from Cabal data directory.

fetchMediaResource :: PandocMonad m => String -> m (FilePath, Maybe MimeType, ByteString) Source #

Fetch local or remote resource (like an image) and provide data suitable for adding it to the MediaBag.

fillMediaBag :: PandocMonad m => Pandoc -> m Pandoc Source #

Traverse tree, filling media bag for any images that aren't already in the media bag.

extractMedia :: FilePath -> Pandoc -> PandocIO Pandoc Source #

Extract media from the mediabag into a directory.

toLang :: PandocMonad m => Maybe String -> m (Maybe Lang) Source #

Convert BCP47 string to a Lang, issuing warning if there are problems.

setTranslations :: PandocMonad m => Lang -> m () Source #

Select the language to use with `translateTerm`. Note that this does not read a translation file; that is only done the first time `translateTerm` is used.

translateTerm :: PandocMonad m => Term -> m String Source #

Get a translation from the current term map. Issue a warning if the term is not defined.

data Translations Source #

Instances

Show Translations Source # |
Instance details Defined in Text.Pandoc.Translations Methods showsPrec :: Int -> Translations -> ShowS Source # show :: Translations -> String Source # showList :: [Translations] -> ShowS Source #
Generic Translations Source # |
Instance details Defined in Text.Pandoc.Translations Associated Types type Rep Translations :: Type -> Type Source # Methods from :: Translations -> Rep Translations x Source # to :: Rep Translations x -> Translations Source #
Semigroup Translations Source # |
Instance details Defined in Text.Pandoc.Translations Methods (<>) :: Translations -> Translations -> Translations Source # sconcat :: NonEmpty Translations -> Translations Source # stimes :: Integral b => b -> Translations -> Translations Source #
Monoid Translations Source # |
Instance details Defined in Text.Pandoc.Translations Methods mempty :: Translations Source # mappend :: Translations -> Translations -> Translations Source # mconcat :: [Translations] -> Translations Source #
FromJSON Translations Source # |
Instance details Defined in Text.Pandoc.Translations Methods parseJSON :: Value -> Parser Translations Source # parseJSONList :: Value -> Parser [Translations] Source #
FromYAML Translations Source # |
Instance details Defined in Text.Pandoc.Translations Methods parseYAML :: Node -> Parser Translations
type Rep Translations Source # |
Instance details Defined in Text.Pandoc.Translations type Rep Translations