pandoc-2.9.2.1: Conversion between markup formats

Copyright | Copyright (C) 2014-2015 2017–2020 John MacFarlane
License | GNU GPL, version 2 or above
Maintainer | John MacFarlane <jgm@berkeley.edu>
Stability | alpha
Portability | portable
Safe Haskell | None
Language | Haskell2010

Text.Pandoc.MediaBag

Description

Definition of a MediaBag object to hold binary resources, and an interface for interacting with it.

Synopsis

- data MediaBag
- deleteMedia :: FilePath -> MediaBag -> MediaBag
- lookupMedia :: FilePath -> MediaBag -> Maybe (MimeType, ByteString)
- insertMedia :: FilePath -> Maybe MimeType -> ByteString -> MediaBag -> MediaBag
- mediaDirectory :: MediaBag -> [(FilePath, MimeType, Int)]
- mediaItems :: MediaBag -> [(FilePath, MimeType, ByteString)]

# Documentation

data MediaBag Source #

A container for a collection of binary resources, with names and mime types. Note that a `MediaBag` is a Monoid, so `mempty` can be used for an empty `MediaBag`, and `<>` can be used to append two `MediaBag`s.

#### Instances

Instances details

Data MediaBag Source # |

Instance details

Defined in Text.Pandoc.MediaBag

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> MediaBag -> c MediaBag Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c MediaBag Source #

toConstr :: MediaBag -> Constr Source #

dataTypeOf :: MediaBag -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c MediaBag) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MediaBag) Source #

gmapT :: (forall b. Data b => b -> b) -> MediaBag -> MediaBag Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MediaBag -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MediaBag -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> MediaBag -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> MediaBag -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> MediaBag -> m MediaBag Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> MediaBag -> m MediaBag Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> MediaBag -> m MediaBag Source #

Show MediaBag Source # |
Instance details Defined in Text.Pandoc.MediaBag Methods showsPrec :: Int -> MediaBag -> ShowS Source # show :: MediaBag -> String Source # showList :: [MediaBag] -> ShowS Source #
Semigroup MediaBag Source # |
Instance details Defined in Text.Pandoc.MediaBag Methods (<>) :: MediaBag -> MediaBag -> MediaBag Source # sconcat :: NonEmpty MediaBag -> MediaBag Source # stimes :: Integral b => b -> MediaBag -> MediaBag Source #
Monoid MediaBag Source # |
Instance details Defined in Text.Pandoc.MediaBag Methods mempty :: MediaBag Source # mappend :: MediaBag -> MediaBag -> MediaBag Source # mconcat :: [MediaBag] -> MediaBag Source #

deleteMedia Source #

Arguments

:: FilePath | relative path and canonical name of resource
-> MediaBag |
-> MediaBag |

Delete a media item from a `MediaBag`, or do nothing if no item corresponds to the given path.

lookupMedia :: FilePath -> MediaBag -> Maybe (MimeType, ByteString) Source #

Lookup a media item in a `MediaBag`, returning mime type and contents.

insertMedia Source #

Arguments

:: FilePath | relative path and canonical name of resource
-> Maybe MimeType | mime type (Nothing = determine from extension)
-> ByteString | contents of resource
-> MediaBag |
-> MediaBag |

Insert a media item into a `MediaBag`, replacing any existing value with the same name.

mediaDirectory :: MediaBag -> [(FilePath, MimeType, Int)] Source #

Get a list of the file paths stored in a `MediaBag`, with their corresponding mime types and the lengths in bytes of the contents.

mediaItems :: MediaBag -> [(FilePath, MimeType, ByteString)] Source #