From 364fe4a03b97f04586194c49e15891ba9a639944 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Thu, 4 Feb 2021 15:29:39 +0100 Subject: doc/lua-filters.md: fix, improve docs for `pandoc.mediabag.fetch` --- doc/lua-filters.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/lua-filters.md b/doc/lua-filters.md index 0c86d6109..3b3c03727 100644 --- a/doc/lua-filters.md +++ b/doc/lua-filters.md @@ -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 -- cgit v1.2.3