aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Class/IO.hs
AgeCommit message (Collapse)AuthorFilesLines
2021-05-24MediaBag improvements.John MacFarlane1-5/+4
In the current dev version, we will sometimes add a version of an image with a hashed name, keeping the original version with the original name, which would leave to undesirable duplication. This change separates the media's filename from the media's canonical name (which is the path of the link in the document itself). Filenames are based on SHA1 hashes and assigned automatically. In Text.Pandoc.MediaBag: - Export MediaItem type [API change]. - Change MediaBag type to a map from Text to MediaItem [API change]. - `lookupMedia` now returns a `MediaItem` [API change]. - Change `insertMedia` so it sets the `mediaPath` to a filename based on the SHA1 hash of the contents. This will be used when contents are extracted. In Text.Pandoc.Class.PandocMonad: - Remove `fetchMediaResource` [API change]. Lua MediaBag module has been changed minimally. In the future it would be better, probably, to give Lua access to the full MediaItem type.
2021-02-22Text.Pandoc.UTF8: change IO functions to return Text, not String.John MacFarlane1-3/+3
[API change] This affects `readFile`, `getContents`, `writeFileWith`, `writeFile`, `putStrWith`, `putStr`, `putStrLnWith`, `putStrLn`. `hPutStrWith`, `hPutStr`, `hPutStrLnWith`, `hPutStrLn`, `hGetContents`. This avoids the need to uselessly create a linked list of characters when emiting output.
2020-10-19Normalize rewritten image paths with --extract-media.John MacFarlane1-1/+2
This change will avoid mixed paths like this one when `--extract-media` is used with a Word file: `![](C:\Git\TIJ4\Markdown/media/image30.wmf)` Instead we'll get `![](C:\Git\TIJ4\Markdown`media`image30.wmf)`. Closes #6761.
2020-04-17Class: generalize PandocIO functions to MonadIOAlbert Krewinkel1-0/+231