Lua: make fetch return mime type first and then content.
This commit is contained in:
parent
17583cd99d
commit
9451d83058
2 changed files with 10 additions and 1 deletions
|
@ -1135,6 +1135,10 @@ storage. The "media bag" is used when pandoc is called with the
|
||||||
: Returns a filename with a basename based on the SHA1 has of the
|
: Returns a filename with a basename based on the SHA1 has of the
|
||||||
contents and an extension based on the mime type.
|
contents and an extension based on the mime type.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
- Filename based on SHA1 hash.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
local fp = pandoc.mediabag.hashname("plain/text", "foobar")
|
local fp = pandoc.mediabag.hashname("plain/text", "foobar")
|
||||||
|
@ -1145,6 +1149,11 @@ storage. The "media bag" is used when pandoc is called with the
|
||||||
Returns two values: the contents of the file and the mime
|
Returns two values: the contents of the file and the mime
|
||||||
type (or an empty string).
|
type (or an empty string).
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
- the entries MIME type, or nil if the file was not found.
|
||||||
|
- contents of the file, or nil if the file was not found.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
local diagram_url = "https://pandoc.org/diagram.jpg"
|
local diagram_url = "https://pandoc.org/diagram.jpg"
|
||||||
|
|
|
@ -163,8 +163,8 @@ fetch commonState mbRef src = do
|
||||||
putCommonState commonState
|
putCommonState commonState
|
||||||
setMediaBag mediaBag
|
setMediaBag mediaBag
|
||||||
fetchItem src
|
fetchItem src
|
||||||
Lua.push bs
|
|
||||||
Lua.push $ fromMaybe "" mimeType
|
Lua.push $ fromMaybe "" mimeType
|
||||||
|
Lua.push bs
|
||||||
return 2 -- returns 2 values: contents, mimetype
|
return 2 -- returns 2 values: contents, mimetype
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
Loading…
Add table
Reference in a new issue