diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-09-30 22:54:12 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-09-30 22:54:12 -0700 |
commit | 17583cd99d0ea2cb4a5dcb3eecf2735395ebc3d6 (patch) | |
tree | 123a0a72e96554e7def0b973b23588889ca44610 /doc | |
parent | 73c47a44d86f5075e3635e90574de12ac5f0b2eb (diff) | |
download | pandoc-17583cd99d0ea2cb4a5dcb3eecf2735395ebc3d6.tar.gz |
Lua: simply mediabag module.
Now 'fetch' simply fetches content and mime type.
A new 'hashname' function is provided to get a filename based
on the sha1 hash of the contents and the mime type.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/lua-filters.md | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md index e1007f452..3a6695f9f 100644 --- a/doc/lua-filters.md +++ b/doc/lua-filters.md @@ -1130,14 +1130,22 @@ storage. The "media bag" is used when pandoc is called with the local filename = "media/diagram.png" local mt, contents = pandoc.mediabag.lookup(filename) +[`hashname (mime_type, contents)`]{#mediabag-hashname} + +: Returns a filename with a basename based on the SHA1 has of the + contents and an extension based on the mime type. + + Usage: + + local fp = pandoc.mediabag.hashname("plain/text", "foobar") + [`fetch (source, base_url)`]{#mediabag-fetch} -: Fetches the given source and inserts it into the media bag - using a SHA1 hash of the content as filename. Returns two - values: the filename (based on SHA1 hash) and the mime +: Fetches the given source from a URL or local file. + Returns two values: the contents of the file and the mime type (or an empty string). Usage: local diagram_url = "https://pandoc.org/diagram.jpg" - pandoc.mediabag.fetch(diagram_url, ".") + local contents = pandoc.mediabag.fetch(diagram_url, ".") |