diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2018-01-07 13:43:03 +0100 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2018-01-07 13:43:03 +0100 |
commit | 043740d32baa9bf5c58409c2a8ace5a196283fa8 (patch) | |
tree | ef5dc4c1adef655e689c8b6bb13c0877068c03b6 /src/Text/Pandoc | |
parent | 458e633bc40e1dc1dd2547fe1cc77677599c26d5 (diff) | |
download | pandoc-043740d32baa9bf5c58409c2a8ace5a196283fa8.tar.gz |
Lua: make pandoc version available as PANDOC_VERSION
The current pandoc version is made available to Lua programs in the
global PANDOC_VERSION. It contains the version as a list of numbers.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Lua/Init.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Lua/Init.hs b/src/Text/Pandoc/Lua/Init.hs index 25869bf91..5e879114f 100644 --- a/src/Text/Pandoc/Lua/Init.hs +++ b/src/Text/Pandoc/Lua/Init.hs @@ -35,8 +35,10 @@ module Text.Pandoc.Lua.Init import Control.Monad.Trans (MonadIO (..)) import Data.IORef (newIORef, readIORef) +import Data.Version (Version (versionBranch)) import Foreign.Lua (Lua, LuaException (..)) import GHC.IO.Encoding (getForeignEncoding, setForeignEncoding, utf8) +import Paths_pandoc (version) import Text.Pandoc.Class (PandocIO, getCommonState, getUserDataDir, getMediaBag, setMediaBag) import Text.Pandoc.Lua.Packages (LuaPackageParams (..), @@ -75,5 +77,7 @@ initLuaState :: LuaPackageParams -> Lua () initLuaState luaPkgParams = do Lua.openlibs Lua.preloadTextModule "text" + Lua.push (versionBranch version) + Lua.setglobal "PANDOC_VERSION" installPandocPackageSearcher luaPkgParams loadScriptFromDataDir (luaPkgDataDir luaPkgParams) "init.lua" |