aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Lua/Module/MediaBag.hs
AgeCommit message (Collapse)AuthorFilesLines
2021-05-24MediaBag improvements.John MacFarlane1-3/+3
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-04Lua filters: use same function names in Haskell and LuaAlbert Krewinkel1-13/+14
2021-01-08Update copyright notices for 2021 (#7012)Albert Krewinkel1-1/+1
2020-04-17API change: use new type PandocLua for all pandoc Lua operationsAlbert Krewinkel1-51/+26
The new type `PandocLua` is an instance of the `PandocMonad` typeclass and can thus be used in a way similar to `PandocIO`.
2020-03-29Clean up some fmaps (#6226)Joseph C. Sible1-1/+1
* Avoid fmapping when we're just binding right after anyway * Clean up unnecessary fmaps in the LaTeX reader
2020-03-22Finer grained imports of Text.Pandoc.Class submodules (#6203)Albert Krewinkel1-2/+3
This should speed-up recompilation after changes in `Text.Pandoc.Class`, as the number of modules affected by a change will be smaller in general. It also offers faster insights into the parts of `T.P.Class` used within a module.
2020-03-15Use implicit Prelude (#6187)Albert Krewinkel1-2/+0
* Use implicit Prelude The previous behavior was introduced as a fix for #4464. It seems that this change alone did not fix the issue, and `stack ghci` and `cabal repl` only work with GHC 8.4.1 or newer, as no custom Prelude is loaded for these versions. Given this, it seems cleaner to revert to the implicit Prelude. * PandocMonad: remove outdated check for base version Only base versions 4.9 and later are supported, the check for `MIN_VERSION_base(4,8,0)` is therefore unnecessary. * Always use custom prelude Previously, the custom prelude was used only with older GHC versions, as a workaround for problems with ghci. The ghci problems are resolved by replacing package `base` with `base-noprelude`, allowing for consistent use of the custom prelude across all GHC versions.
2020-03-13Update copyright year (#6186)Albert Krewinkel1-1/+1
* Update copyright year * Copyright: add notes for Lua and Jira modules
2020-01-04Add type annotations to assist ghci.John MacFarlane1-3/+4
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc1-3/+3
PR #5884. + Use pandoc-types 1.20 and texmath 0.12. + Text is now used instead of String, with a few exceptions. + In the MediaBag module, some of the types using Strings were switched to use FilePath instead (not Text). + In the Parsing module, new parsers `manyChar`, `many1Char`, `manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`, `mantyUntilChar` have been added: these are like their unsuffixed counterparts but pack some or all of their output. + `glob` in Text.Pandoc.Class still takes String since it seems to be intended as an interface to Glob, which uses strings. It seems to be used only once in the package, in the EPUB writer, so that is not hard to change.
2019-05-29pandoc.mediabag module: add function `delete`Albert Krewinkel1-1/+7
Function `pandoc.mediabag.delete` allows to remove a single item of the given name from the media bag.
2019-05-29pandoc.mediabag module: add function `empty`Albert Krewinkel1-0/+6
Function `pandoc.mediabag.empty` was added. It allows to clean-out the media bag, removing all entries.
2019-05-29pandoc.mediabag module: add items function iterating over mediabagAlbert Krewinkel1-1/+7
A new function `pandoc.mediabag.items` was added to Lua module pandoc.mediabag. This allows users to lazily iterate over all media bag items, loading items into Lua one-by-one. Example: for filename, mime_type, content in pandoc.mediabag.items() do -- use media bag item. end This is a convenient alternative to using `mediabag.list` in combination with `mediabag.lookup`.
2019-03-01Remove license boilerplate.John MacFarlane1-17/+0
The haddock module header contains essentially the same information, so the boilerplate is redundant and just one more thing to get out of sync.
2019-02-16T.P.Lua: split StackInstances into smaller Marshaling modulesAlbert Krewinkel1-1/+1
2019-02-16T.P.Lua: get CommonState from Lua globalAlbert Krewinkel1-25/+41
This allows more control over the common state from within Lua scripts.
2019-02-04Add missing copyright notices and remove license boilerplate (#5112)Albert Krewinkel1-2/+2
Quite a few modules were missing copyright notices. This commit adds copyright notices everywhere via haddock module headers. The old license boilerplate comment is redundant with this and has been removed. Update copyright years to 2019. Closes #4592.
2018-09-24Use hslua v1.0.0Albert Krewinkel1-1/+1
2018-03-18Use NoImplicitPrelude and explicitly import Prelude.John MacFarlane1-0/+2
This seems to be necessary if we are to use our custom Prelude with ghci. Closes #4464.
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2018-01-04Use hslua utils where possibleAlbert Krewinkel1-5/+5
Some helper functions and types have been moved to hslua. Change: minor
2017-12-21Lua modules: make a Haskell module for each Lua moduleAlbert Krewinkel1-0/+108
Definitions for the `pandoc.mediabag` modules are moved to a separate Haskell module. Change: minor