pandoc-lua-engine 0.3.2 → 0.3.3
raw patch · 6 files changed
+36/−18 lines, 6 filesdep +cryptondep −SHAdep ~hslua-module-doclayoutdep ~pandocdep ~pandoc-lua-marshal
Dependencies added: crypton
Dependencies removed: SHA
Dependency ranges changed: hslua-module-doclayout, pandoc, pandoc-lua-marshal
Files
- pandoc-lua-engine.cabal +6/−6
- src/Text/Pandoc/Lua/Filter.hs +4/−1
- src/Text/Pandoc/Lua/Marshal/WriterOptions.hs +10/−0
- src/Text/Pandoc/Lua/Module.hs +10/−2
- src/Text/Pandoc/Lua/Module/Utils.hs +6/−7
- test/lua/single-to-double-quoted.lua +0/−2
pandoc-lua-engine.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: pandoc-lua-engine-version: 0.3.2+version: 0.3.3 build-type: Simple license: GPL-2.0-or-later license-file: COPYING.md@@ -105,9 +105,9 @@ , Text.Pandoc.Lua.Writer.Classic , Text.Pandoc.Lua.Writer.Scaffolding - build-depends: SHA >= 1.6 && < 1.7- , aeson+ build-depends: aeson , bytestring >= 0.9 && < 0.13+ , crypton >= 0.30 && < 1.1 , citeproc >= 0.8 && < 0.9 , containers >= 0.6.0.1 && < 0.8 , data-default >= 0.4 && < 0.8@@ -115,7 +115,7 @@ , doctemplates >= 0.11 && < 0.12 , exceptions >= 0.8 && < 0.11 , hslua >= 2.3 && < 2.4- , hslua-module-doclayout>= 1.1 && < 1.2+ , hslua-module-doclayout>= 1.2 && < 1.3 , hslua-module-path >= 1.1 && < 1.2 , hslua-module-system >= 1.1 && < 1.2 , hslua-module-text >= 1.1 && < 1.2@@ -124,8 +124,8 @@ , hslua-repl >= 0.1.1 && < 0.2 , lpeg >= 1.1 && < 1.2 , mtl >= 2.2 && < 2.4- , pandoc >= 3.4 && < 3.5- , pandoc-lua-marshal >= 0.2.7 && < 0.3+ , pandoc >= 3.5 && < 3.6+ , pandoc-lua-marshal >= 0.2.9 && < 0.3 , pandoc-types >= 1.22 && < 1.24 , parsec >= 3.1 && < 3.2 , text >= 1.1.1 && < 2.2
src/Text/Pandoc/Lua/Filter.hs view
@@ -43,7 +43,10 @@ -- filter if nothing was returned. luaFilters <- forcePeek $ if newtop - oldtop >= 1- then peekList peekFilter top -- get from explicit filter table+ then liftLua (rawlen top) >>= \case+ -- explicitly returned filter, either a single one or a list+ 0 -> (:[]) <$!> peekFilter top -- single filter+ _ -> peekList peekFilter top -- list of explicit filters else (:[]) <$!> peekFilter envIdx -- get the implicit filter in _ENV settop oldtop runAll luaFilters doc
src/Text/Pandoc/Lua/Marshal/WriterOptions.hs view
@@ -145,6 +145,16 @@ (pushBool, writerIncremental) (peekBool, \opts x -> opts{ writerIncremental = x }) + , property "list_of_figures"+ "Include list of figures"+ (pushBool, writerListOfFigures)+ (peekBool, \opts x -> opts{ writerListOfFigures = x })++ , property "list_of_tables"+ "Include list of tables"+ (pushBool, writerListOfTables)+ (peekBool, \opts x -> opts{ writerListOfTables = x })+ , property "listings" "Use listings package for code" (pushBool, writerListings)
src/Text/Pandoc/Lua/Module.hs view
@@ -91,8 +91,10 @@ , Pandoc.Text.documentedModule , Pandoc.Types.documentedModule , Pandoc.Utils.documentedModule- , Module.Layout.documentedModule { moduleName = "pandoc.layout" }- `allSince` [2,18]+ , ((Module.Layout.documentedModule { moduleName = "pandoc.layout" }+ `allSince` [2,18])+ `functionsSince` ["bold", "italic", "underlined", "strikeout", "fg", "bg"])+ [3, 4, 1] , Module.Path.documentedModule { moduleName = "pandoc.path" } `allSince` [2,12] , Module.Zip.documentedModule { moduleName = "pandoc.zip" }@@ -101,6 +103,12 @@ where allSince mdl version = mdl { moduleFunctions = map (`since` makeVersion version) $ moduleFunctions mdl+ }+ functionsSince mdl fns version = mdl+ { moduleFunctions = map (\fn ->+ if (functionName fn) `elem` fns+ then fn `since` makeVersion version+ else fn) $ moduleFunctions mdl } -- | Load all global modules and set them to their global variables.
src/Text/Pandoc/Lua/Module/Utils.hs view
@@ -19,6 +19,7 @@ import Control.Applicative ((<|>)) import Control.Monad ((<$!>))+import Crypto.Hash (hashWith, SHA1(SHA1)) import Data.Data (showConstr, toConstr) import Data.Default (def) import Data.Maybe (fromMaybe)@@ -34,8 +35,6 @@ import Text.Pandoc.Lua.Marshal.Reference import Text.Pandoc.Lua.PandocLua (PandocLua (unPandocLua)) -import qualified Data.Digest.Pure.SHA as SHA-import qualified Data.ByteString.Lazy as BSL import qualified Data.Map as Map import qualified Data.Text as T import qualified Text.Pandoc.Builder as B@@ -54,16 +53,16 @@ , moduleFields = [] , moduleOperations = [] , moduleTypeInitializers = []- , moduleFunctions = -- FIXME: order alphabetically+ , moduleFunctions = [ blocks_to_inlines `since` v[2,2,3] , citeproc `since` v[2,19,1] , equals `since` v[2,5] , from_simple_table `since` v[2,11] , make_sections `since` v[2,8]+ , normalize_date `since` v[2,0,6] , references `since` v[2,17]- , run_lua_filter `since` v[3,2,1] , run_json_filter `since` v[2,1,1]- , normalize_date `since` v[2,0,6]+ , run_lua_filter `since` v[3,2,1] , sha1 `since` v[2,0,6] , stringify `since` v[2,0,6] , to_roman_numeral `since` v[2,0,6]@@ -301,8 +300,8 @@ -- | Documented Lua function to compute the hash of a string. sha1 :: DocumentedFunction e sha1 = defun "sha1"- ### liftPure (SHA.showDigest . SHA.sha1)- <#> parameter (fmap BSL.fromStrict . peekByteString) "string" "input" ""+ ### liftPure (show . hashWith SHA1)+ <#> parameter peekByteString "string" "input" "" =#> functionResult pushString "string" "hexadecimal hash value" #? "Computes the SHA1 hash of the given string input."
test/lua/single-to-double-quoted.lua view
@@ -1,10 +1,8 @@ return {- { Quoted = function (elem) if elem.quotetype == "SingleQuote" then elem.quotetype = "DoubleQuote" end return elem end,- } }