Lua: move sha1 from pandoc.mediabag to pandoc.
This commit is contained in:
parent
8768f7e5b0
commit
4c3b3bf65a
2 changed files with 16 additions and 13 deletions
|
@ -1063,6 +1063,19 @@ Lua functions for pandoc scripts.
|
|||
-- the above is equivallent to
|
||||
-- return {{Str = Str}}
|
||||
|
||||
[`sha1 (contents)`]{#mediabag-sha1}
|
||||
|
||||
: Returns the SHA1 has of the contents.
|
||||
|
||||
Returns:
|
||||
|
||||
- SHA1 hash of the contents.
|
||||
|
||||
Usage:
|
||||
|
||||
local fp = pandoc.mediabag.sha1("foobar")
|
||||
|
||||
|
||||
# Submodule mediabag
|
||||
|
||||
The submodule `mediabag` allows accessing pandoc's media
|
||||
|
@ -1130,18 +1143,6 @@ storage. The "media bag" is used when pandoc is called with the
|
|||
local filename = "media/diagram.png"
|
||||
local mt, contents = pandoc.mediabag.lookup(filename)
|
||||
|
||||
[`sha1 (contents)`]{#mediabag-sha1}
|
||||
|
||||
: Returns the SHA1 has of the contents.
|
||||
|
||||
Returns:
|
||||
|
||||
- SHA1 hash of the contents.
|
||||
|
||||
Usage:
|
||||
|
||||
local fp = pandoc.mediabag.sha1("foobar")
|
||||
|
||||
[`fetch (source, base_url)`]{#mediabag-fetch}
|
||||
|
||||
: Fetches the given source from a URL or local file.
|
||||
|
|
|
@ -63,6 +63,9 @@ pushPandocModule datadir = do
|
|||
Lua.push "__read"
|
||||
Lua.pushHaskellFunction readDoc
|
||||
Lua.rawset (-3)
|
||||
Lua.push "sha1"
|
||||
Lua.pushHaskellFunction sha1HashFn
|
||||
Lua.rawset (-3)
|
||||
|
||||
-- | Get the string representation of the pandoc module
|
||||
pandocModuleScript :: Maybe FilePath -> IO String
|
||||
|
@ -93,7 +96,6 @@ pushMediaBagModule commonState mediaBagRef = do
|
|||
addFunction "lookup" (lookupMediaFn mediaBagRef)
|
||||
addFunction "list" (mediaDirectoryFn mediaBagRef)
|
||||
addFunction "fetch" (fetch commonState mediaBagRef)
|
||||
addFunction "sha1" sha1HashFn
|
||||
return ()
|
||||
where
|
||||
addFunction name fn = do
|
||||
|
|
Loading…
Add table
Reference in a new issue