@@ -60,7 +60,6 @@ attrToMap (id',classes,keyvals) = M.fromList
6060 : ("class", unwords classes)
6161 : keyvals
6262
63−#if MIN_VERSION_hslua(0,4,0)
6463#if MIN_VERSION_base(4,8,0)
6564instance {-# OVERLAPS #-} StackValue [Char] where
6665#else
@@ -71,37 +70,6 @@ instance StackValue [Char] where
7170 res <- Lua.peek lua i
7271 return $ UTF8.toString `fmap` res
7372 valuetype _ = Lua.TSTRING
74−#else
75−#if MIN_VERSION_base(4,8,0)
76−instance {-# OVERLAPS #-} StackValue a => StackValue [a] where
77−#else
78−instance StackValue a => StackValue [a] where
79−#endif
80− push lua xs = do
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
84− peek lua i = do
85− top <- Lua.gettop lua
86− let i' = if i < 0 then top + i + 1 else i
87− Lua.pushnil lua
88− lst <- getList lua i'
89− Lua.pop lua 1
90− return (Just lst)
91− valuetype _ = Lua.TTABLE
92−
93−getList :: StackValue a => LuaState -> Int -> IO [a]
94−getList lua i' = do
95− continue <- Lua.next lua i'
96− if continue
97− then do
98− next <- Lua.peek lua (-1)
99− Lua.pop lua 1
100− x <- maybe (fail "peek returned Nothing") return next
101− rest <- getList lua i'
102− return (x : rest)
103− else return []
104−#endif
10573
10674instance StackValue Format where
10775 push lua (Format f) = Lua.push lua (map toLower f)
@@ -191,11 +159,7 @@ writeCustom luaFile opts doc@(Pandoc meta _) = do
191159 -- check for error in lua script (later we'll change the return type
192160 -- to handle this more gracefully):
193161 when (status /= 0) $
194−#if MIN_VERSION_hslua(0,4,0)
195162 Lua.tostring lua 1 >>= throw . PandocLuaException . UTF8.toString
196−#else
197− Lua.tostring lua 1 >>= throw . PandocLuaException
198−#endif
199163 Lua.call lua 0 0
200164 -- TODO - call hierarchicalize, so we have that info
201165 rendered <- docToCustom lua opts doc