Text.Pandoc.Lua

pandoc-lua-engine-0.2.1.2: Lua engine to power custom pandoc conversions

Copyright | Copyright © 2017-2023 Albert Krewinkel
License | GNU GPL, version 2 or above
Maintainer | Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
Stability | alpha
Safe Haskell | Safe-Inferred
Language | Haskell2010

Text.Pandoc.Lua

Contents

- High-level functions
- Low-level functions
- Engine

Description

Running pandoc Lua filters.

Synopsis

- applyFilter :: (PandocMonad m, MonadIO m) => Environment -> [String] -> FilePath -> Pandoc -> m Pandoc
- loadCustom :: (PandocMonad m, MonadIO m) => FilePath -> m (CustomComponents m)
- data Global
  - = FORMAT Text
  - | PANDOC_API_VERSION
  - | PANDOC_DOCUMENT Pandoc
  - | PANDOC_READER_OPTIONS ReaderOptions
  - | PANDOC_WRITER_OPTIONS WriterOptions
  - | PANDOC_SCRIPT_FILE FilePath
  - | PANDOC_STATE CommonState
  - | PANDOC_VERSION
- setGlobals :: [Global] -> LuaE PandocError ()
- runLua :: (PandocMonad m, MonadIO m) => LuaE PandocError a -> m (Either PandocError a)
- runLuaNoEnv :: (PandocMonad m, MonadIO m) => LuaE PandocError a -> m (Either PandocError a)
- getEngine :: MonadIO m => m ScriptingEngine

# High-level functions

applyFilter :: (PandocMonad m, MonadIO m) => Environment -> [String] -> FilePath -> Pandoc -> m Pandoc #

Run the Lua filter in `filterPath` for a transformation to the target format (first element in args). Pandoc uses Lua init files to setup the Lua interpreter.

loadCustom :: (PandocMonad m, MonadIO m) => FilePath -> m (CustomComponents m) #

Convert custom markup to Pandoc.

# Low-level functions

data Global #

Permissible global Lua variables.

Constructors

FORMAT Text |
PANDOC_API_VERSION |
PANDOC_DOCUMENT Pandoc |
PANDOC_READER_OPTIONS ReaderOptions |
PANDOC_WRITER_OPTIONS WriterOptions |
PANDOC_SCRIPT_FILE FilePath |
PANDOC_STATE CommonState |
PANDOC_VERSION |

setGlobals :: [Global] -> LuaE PandocError () #

Set all given globals.

runLua :: (PandocMonad m, MonadIO m) => LuaE PandocError a -> m (Either PandocError a) #

Run the Lua interpreter, using pandoc's default way of environment initialization.

runLuaNoEnv :: (PandocMonad m, MonadIO m) => LuaE PandocError a -> m (Either PandocError a) #

Like `runLua`, but ignores all environment variables like `LUA_PATH`.

# Engine

getEngine :: MonadIO m => m ScriptingEngine #

Constructs the Lua scripting engine.