@@ -60,7 +60,6 @@ attrToMap (id',classes,keyvals) = M.fromList
60 : ("class", unwords classes)
60 : ("class", unwords classes)
63−#if MIN_VERSION_hslua(0,4,0)
64#if MIN_VERSION_base(4,8,0)
63#if MIN_VERSION_base(4,8,0)
65instance {-# OVERLAPS #-} StackValue [Char] where
64instance {-# OVERLAPS #-} StackValue [Char] where
@@ -71,37 +70,6 @@ instance StackValue [Char] where
71 res <- Lua.peek lua i
70 res <- Lua.peek lua i
72 return $ UTF8.toString `fmap` res
71 return $ UTF8.toString `fmap` res
73 valuetype _ = Lua.TSTRING
72 valuetype _ = Lua.TSTRING
75−#if MIN_VERSION_base(4,8,0)
76−instance {-# OVERLAPS #-} StackValue a => StackValue [a] where
78−instance StackValue a => StackValue [a] where
81− Lua.createtable lua (length xs + 1) 0
82− let addValue (i, x) = Lua.push lua x >> Lua.rawseti lua (-2) i
83− mapM_ addValue $ zip [1..] xs
85− top <- Lua.gettop lua
86− let i' = if i < 0 then top + i + 1 else i
88− lst <- getList lua i'
91− valuetype _ = Lua.TTABLE
93−getList :: StackValue a => LuaState -> Int -> IO [a]
95− continue <- Lua.next lua i'
98− next <- Lua.peek lua (-1)
100− x <- maybe (fail "peek returned Nothing") return next
101− rest <- getList lua i'
106instance StackValue Format where
74instance StackValue Format where
107 push lua (Format f) = Lua.push lua (map toLower f)
75 push lua (Format f) = Lua.push lua (map toLower f)
@@ -191,11 +159,7 @@ writeCustom luaFile opts doc@(Pandoc meta _) = do
191 -- check for error in lua script (later we'll change the return type
159 -- check for error in lua script (later we'll change the return type
192 -- to handle this more gracefully):
160 -- to handle this more gracefully):
193 when (status /= 0) $
161 when (status /= 0) $
194−#if MIN_VERSION_hslua(0,4,0)
195 Lua.tostring lua 1 >>= throw . PandocLuaException . UTF8.toString
162 Lua.tostring lua 1 >>= throw . PandocLuaException . UTF8.toString
197− Lua.tostring lua 1 >>= throw . PandocLuaException
199 Lua.call lua 0 0
163 Lua.call lua 0 0
200 -- TODO - call hierarchicalize, so we have that info
164 -- TODO - call hierarchicalize, so we have that info
201 rendered <- docToCustom lua opts doc
165 rendered <- docToCustom lua opts doc