git.iko.soy/typeable/pandoc
on master help sign in
Update to hslua-0.8.0

hslua no longer provides lua stack instances for Int and Double, the necessary instances are added to the Custom writer and the lua filtering system.

commit9b318355300ca43aadede728c179785f40326d5c authorAlbert Krewinkel <albert@zeitkraut.de> dateWed 16 Aug 2017, 15:47 (9 years ago) parentf8b6a22
6 files changed+23−7
pandoc.cabal+2−2 src/Text/Pandoc/Lua/StackInstances.hs+12−2 src/Text/Pandoc/Writers/Custom.hs+6 stack.full.yaml+1−1 stack.pkg.yaml+1−1 stack.yaml+1−1
pandoc.cabal+2−2
@@ -316,7 +316,7 @@ Library
316316 yaml >= 0.8.8.2 && < 0.9,
317317 scientific >= 0.2 && < 0.4,
318318 vector >= 0.10 && < 0.13,
319− hslua >= 0.7 && < 0.8,
319+ hslua >= 0.8 && < 0.9,
320320 binary >= 0.5 && < 0.9,
321321 SHA >= 1.6 && < 1.7,
322322 haddock-library >= 1.1 && < 1.5,
@@ -542,7 +542,7 @@ Test-Suite test-pandoc
542542 text >= 0.11 && < 1.3,
543543 directory >= 1 && < 1.4,
544544 filepath >= 1.1 && < 1.5,
545− hslua >= 0.7 && < 0.8,
545+ hslua >= 0.8 && < 0.9,
546546 process >= 1.2.3 && < 1.7,
547547 skylighting >= 0.3.3 && < 0.4,
548548 temporary >= 1.1 && < 1.3,
src/Text/Pandoc/Lua/StackInstances.hs+12−2
@@ -33,8 +33,8 @@ StackValue instances for pandoc types.
3333module Text.Pandoc.Lua.StackInstances () where
3434
3535import Control.Applicative ((<|>))
36−import Foreign.Lua (Lua, Type (..), FromLuaStack (peek), ToLuaStack (push),
37− StackIndex, throwLuaError, tryLua)
36+import Foreign.Lua (Lua, LuaInteger, LuaNumber, Type (..), FromLuaStack (peek),
37+ ToLuaStack (push), StackIndex, throwLuaError, tryLua)
3838import Foreign.Lua.Api (getmetatable, ltype, newtable, pop, rawget, rawlen)
3939import Text.Pandoc.Definition
4040import Text.Pandoc.Lua.Util (addValue, adjustIndexBy, getTable, pushViaConstructor)
@@ -125,6 +125,16 @@ instance ToLuaStack QuoteType where
125125instance FromLuaStack QuoteType where
126126 peek idx = safeRead' =<< peek idx
127127
128+instance ToLuaStack Double where
129+ push = push . (realToFrac :: Double -> LuaNumber)
130+instance FromLuaStack Double where
131+ peek = fmap (realToFrac :: LuaNumber -> Double) . peek
132+
133+instance ToLuaStack Int where
134+ push = push . (fromIntegral :: Int -> LuaInteger)
135+instance FromLuaStack Int where
136+ peek = fmap (fromIntegral :: LuaInteger-> Int) . peek
137+
128138safeRead' :: Read a => String -> Lua a
129139safeRead' s = case safeRead s of
130140 Nothing -> throwLuaError ("Could not read: " ++ s)
src/Text/Pandoc/Writers/Custom.hs+6
@@ -60,6 +60,12 @@ attrToMap (id',classes,keyvals) = M.fromList
6060 : ("class", unwords classes)
6161 : keyvals
6262
63+instance ToLuaStack Double where
64+ push = push . (realToFrac :: Double -> LuaNumber)
65+
66+instance ToLuaStack Int where
67+ push = push . (fromIntegral :: Int -> LuaInteger)
68+
6369instance ToLuaStack Format where
6470 push (Format f) = push (map toLower f)
6571
stack.full.yaml+1−1
@@ -20,6 +20,6 @@ packages:
2020- '../pandoc-types'
2121- '../texmath'
2222extra-deps:
23−- hslua-0.7.0
23+- hslua-0.8.0
2424- skylighting-0.3.3
2525resolver: lts-8.12
stack.pkg.yaml+1−1
@@ -17,7 +17,7 @@ packages:
1717 commit: 6930cd18087190133e600533a8d335a718cddf76
1818 extra-dep: false
1919extra-deps:
20−- hslua-0.7.0
20+- hslua-0.8.0
2121- skylighting-0.3.3
2222- cmark-gfm-0.1.1
2323- QuickCheck-2.10.0.1
stack.yaml+1−1
@@ -7,7 +7,7 @@ flags:
77packages:
88- '.'
99extra-deps:
10−- hslua-0.7.0
10+- hslua-0.8.0
1111- skylighting-0.3.3
1212- cmark-gfm-0.1.1
1313- QuickCheck-2.10.0.1