aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2021-11-05 03:25:29 +0100
committerGitHub <noreply@github.com>2021-11-04 19:25:29 -0700
commita1b6bf69f2266f6b1beb0db4383915a9c4a4eb83 (patch)
tree4cc8c8f22e0e3f61714669d8a86033d2bb76c7d8 /src
parent0b254ea4af38cf53c027eb5e9977e96c2b7975c7 (diff)
downloadpandoc-a1b6bf69f2266f6b1beb0db4383915a9c4a4eb83.tar.gz
Lua: include lpeg module (#7649)
Compiles the 'lpeg' library (Parsing Expression Grammars For Lua) into the program. Package maintainers may choose to rely on package dependencies to make lpeg available, in which case they can compile the with the constraint `lpeg +rely-on-shared-lpeg-library`.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Lua/Packages.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Lua/Packages.hs b/src/Text/Pandoc/Lua/Packages.hs
index 3a481886a..4fb11a646 100644
--- a/src/Text/Pandoc/Lua/Packages.hs
+++ b/src/Text/Pandoc/Lua/Packages.hs
@@ -22,6 +22,7 @@ import Text.Pandoc.Lua.PandocLua (PandocLua, liftPandocLua, loadDefaultModule)
import qualified HsLua as Lua
import qualified HsLua.Module.Path as Path
import qualified HsLua.Module.Text as Text
+import qualified Lua.LPeg as LPeg
import qualified Text.Pandoc.Lua.Module.Pandoc as Pandoc
import qualified Text.Pandoc.Lua.Module.MediaBag as MediaBag
import qualified Text.Pandoc.Lua.Module.System as System
@@ -35,6 +36,9 @@ installPandocPackageSearcher = liftPandocLua $ do
shiftArray
Lua.pushHaskellFunction $ Lua.toHaskellFunction pandocPackageSearcher
Lua.rawseti (Lua.nth 2) 1
+ -- add lpeg searcher as last searcher
+ Lua.pushHaskellFunction $ Lua.state >>= Lua.liftIO . LPeg.lpeg_searcher
+ Lua.rawseti (Lua.nth 2) 6
Lua.pop 1 -- remove 'package.searchers' from stack
where
shiftArray = forM_ [4, 3, 2, 1] $ \i -> do