aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Lua/Global.hs
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2019-05-19 15:26:00 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2019-05-29 10:07:43 +0200
commit505f5bf5d951a5c4342f7acce9bea5f260dc9d78 (patch)
tree3b201baedf4003cdb17fa58c444bbb158faf213d /src/Text/Pandoc/Lua/Global.hs
parentd07ed83d705df491bba7b295bd5e80629d971685 (diff)
downloadpandoc-505f5bf5d951a5c4342f7acce9bea5f260dc9d78.tar.gz
Lua: add Version type to simplify comparisons
Version specifiers like `PANDOC_VERSION` and `PANDOC_API_VERSION` are turned into `Version` objects. The objects simplify version-appropriate comparisons while maintaining backward-compatibility. A function `pandoc.types.Version` is added as part of the newly introduced module `pandoc.types`, allowing users to create version objects in scripts.
Diffstat (limited to 'src/Text/Pandoc/Lua/Global.hs')
-rw-r--r--src/Text/Pandoc/Lua/Global.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Lua/Global.hs b/src/Text/Pandoc/Lua/Global.hs
index f303af6c5..b9b6c9cd9 100644
--- a/src/Text/Pandoc/Lua/Global.hs
+++ b/src/Text/Pandoc/Lua/Global.hs
@@ -17,7 +17,6 @@ module Text.Pandoc.Lua.Global
import Prelude
import Data.Data (Data)
-import Data.Version (Version (versionBranch))
import Foreign.Lua (Lua, Peekable, Pushable)
import Foreign.Lua.Userdata ( ensureUserdataMetatable, pushAnyWithMetatable
, metatableName)
@@ -52,7 +51,7 @@ setGlobal global = case global of
Lua.push format
Lua.setglobal "FORMAT"
PANDOC_API_VERSION -> do
- Lua.push (versionBranch pandocTypesVersion)
+ Lua.push pandocTypesVersion
Lua.setglobal "PANDOC_API_VERSION"
PANDOC_DOCUMENT doc -> do
Lua.push (LazyPandoc doc)
@@ -67,7 +66,7 @@ setGlobal global = case global of
Lua.push commonState
Lua.setglobal "PANDOC_STATE"
PANDOC_VERSION -> do
- Lua.push (versionBranch version)
+ Lua.push version
Lua.setglobal "PANDOC_VERSION"
-- | Readonly and lazy pandoc objects.