git.iko.soy/typeable/pandoc
on master help sign in
Lua: make fetch return mime type first and then content.
commit9451d83058fa0b237514e618ebe6140a69fe13db authorJohn MacFarlane <jgm@berkeley.edu> dateSat 30 Sep 2017, 23:00 (9 years ago) parent17583cd
2 files changed+10−1
doc/lua-filters.md+9 src/Text/Pandoc/Lua/PandocModule.hs+1−1
doc/lua-filters.md+9
@@ -1135,6 +1135,10 @@ storage. The "media bag" is used when pandoc is called with the
11351135: Returns a filename with a basename based on the SHA1 has of the
11361136 contents and an extension based on the mime type.
11371137
1138+ Returns:
1139+
1140+ - Filename based on SHA1 hash.
1141+
11381142 Usage:
11391143
11401144 local fp = pandoc.mediabag.hashname("plain/text", "foobar")
@@ -1145,6 +1149,11 @@ storage. The "media bag" is used when pandoc is called with the
11451149 Returns two values: the contents of the file and the mime
11461150 type (or an empty string).
11471151
1152+ Returns:
1153+
1154+ - the entries MIME type, or nil if the file was not found.
1155+ - contents of the file, or nil if the file was not found.
1156+
11481157 Usage:
11491158
11501159 local diagram_url = "https://pandoc.org/diagram.jpg"
src/Text/Pandoc/Lua/PandocModule.hs+1−1
@@ -163,8 +163,8 @@ fetch commonState mbRef src = do
163163 putCommonState commonState
164164 setMediaBag mediaBag
165165 fetchItem src
166− Lua.push bs
167166 Lua.push $ fromMaybe "" mimeType
167+ Lua.push bs
168168 return 2 -- returns 2 values: contents, mimetype
169169
170170--