doc/lua-filters.md: fix, improve docs for pandoc.mediabag.fetch

This commit is contained in:
Albert Krewinkel 2021-02-04 15:29:39 +01:00
parent b79aba6ea1
commit 364fe4a03b
No known key found for this signature in database
GPG key ID: 388DC0B21F631124

View file

@ -3176,12 +3176,22 @@ Usage:
### fetch {#pandoc.mediabag.fetch}
`fetch (source, base_url)`
`fetch (source)`
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).
The function will first try to retrieve `source` from the
mediabag; if that fails, it will try to download it or read it
from the local file system while respecting pandoc's "resource
path" setting.
Parameters:
`source`:
: path to a resource; either a local file path or URI
Returns:
- the entries MIME type, or nil if the file was not found.
@ -3190,7 +3200,7 @@ Returns:
Usage:
local diagram_url = "https://pandoc.org/diagram.jpg"
local mt, contents = pandoc.mediabag.fetch(diagram_url, ".")
local mt, contents = pandoc.mediabag.fetch(diagram_url)
# Module pandoc.List