aboutsummaryrefslogtreecommitdiff
path: root/pandoc-cli/no-lua/PandocCLI/Lua.hs
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2022-09-29 17:59:31 +0200
committerJohn MacFarlane <[email protected]>2022-09-30 08:33:40 -0700
commitb6a571d5774176202c1719f626c497f1bcdbaf2c (patch)
tree2eb50335ee48bdf22286cc898403ccc1d9be979b /pandoc-cli/no-lua/PandocCLI/Lua.hs
parent5be9052f5fb7283372b3d5497bef499718a34992 (diff)
pandoc-cli: Allow building a binary without Lua support
Disabling the `lua` cabal flag will result in a binary without Lua.
Diffstat (limited to 'pandoc-cli/no-lua/PandocCLI/Lua.hs')
-rw-r--r--pandoc-cli/no-lua/PandocCLI/Lua.hs26
1 files changed, 26 insertions, 0 deletions
diff --git a/pandoc-cli/no-lua/PandocCLI/Lua.hs b/pandoc-cli/no-lua/PandocCLI/Lua.hs
new file mode 100644
index 000000000..350a4cdbc
--- /dev/null
+++ b/pandoc-cli/no-lua/PandocCLI/Lua.hs
@@ -0,0 +1,26 @@
+{-# LANGUAGE OverloadedStrings #-}
+{- |
+ Module : PandocCLI.Lua
+ Copyright : © 2022 Albert Krewinkel
+ License : GPL-2.0-or-later
+ Maintainer : Albert Krewinkel <[email protected]>
+
+Placeholder values to be used when pandoc is compiled without support
+for the Lua scripting engine.
+-}
+module PandocCLI.Lua (runLuaInterpreter, getEngine) where
+
+import Control.Monad.IO.Class (MonadIO)
+import Text.Pandoc.Error (PandocError (PandocNoScriptingEngine), handleError)
+import Text.Pandoc.Scripting (ScriptingEngine, noEngine)
+
+-- | Raises an error, reporting that the scripting engine is unavailable.
+runLuaInterpreter :: String -- ^ Program name
+ -> [String] -- ^ Command line arguments
+ -> IO ()
+runLuaInterpreter _progName _args = do
+ handleError (Left PandocNoScriptingEngine)
+
+-- | Placeholder scripting engine.
+getEngine :: MonadIO m => m ScriptingEngine
+getEngine = pure noEngine