@@ -18,7 +18,7 @@ import Text.Pandoc.Class (runIOorExplode, setUserDataDir)
18import Text.Pandoc.Definition (Block (BlockQuote, Div, Para), Inline (Emph, Str),
18import Text.Pandoc.Definition (Block (BlockQuote, Div, Para), Inline (Emph, Str),
19 Attr, Meta, Pandoc, pandocTypesVersion)
19 Attr, Meta, Pandoc, pandocTypesVersion)
20import Text.Pandoc.Filter (Filter (LuaFilter), applyFilters)
20import Text.Pandoc.Filter (Filter (LuaFilter), applyFilters)
21−import Text.Pandoc.Lua (runPandocLua)
21+import Text.Pandoc.Lua (runLua)
22import Text.Pandoc.Options (def)
22import Text.Pandoc.Options (def)
23import Text.Pandoc.Shared (pandocVersion)
23import Text.Pandoc.Shared (pandocVersion)
@@ -128,7 +128,7 @@ tests = map (localOption (QuickCheckTests 20))
128 (doc $ para "ignored")
128 (doc $ para "ignored")
129 (doc $ para (str $ "lua" </> "script-name.lua"))
129 (doc $ para (str $ "lua" </> "script-name.lua"))
131− , testCase "Pandoc version is set" . runPandocLua' $ do
131+ , testCase "Pandoc version is set" . runLua' $ do
132 Lua.getglobal' "table.concat"
132 Lua.getglobal' "table.concat"
133 Lua.getglobal "PANDOC_VERSION"
133 Lua.getglobal "PANDOC_VERSION"
134 Lua.push ("." :: String) -- separator
134 Lua.push ("." :: String) -- separator
@@ -136,13 +136,13 @@ tests = map (localOption (QuickCheckTests 20))
136 Lua.liftIO . assertEqual "pandoc version is wrong" pandocVersion
136 Lua.liftIO . assertEqual "pandoc version is wrong" pandocVersion
137 =<< Lua.peek Lua.stackTop
137 =<< Lua.peek Lua.stackTop
139− , testCase "Pandoc types version is set" . runPandocLua' $ do
139+ , testCase "Pandoc types version is set" . runLua' $ do
140 let versionNums = versionBranch pandocTypesVersion
140 let versionNums = versionBranch pandocTypesVersion
141 Lua.getglobal "PANDOC_API_VERSION"
141 Lua.getglobal "PANDOC_API_VERSION"
142 Lua.liftIO . assertEqual "pandoc-types version is wrong" versionNums
142 Lua.liftIO . assertEqual "pandoc-types version is wrong" versionNums
143 =<< Lua.peek Lua.stackTop
143 =<< Lua.peek Lua.stackTop
145− , testCase "Allow singleton inline in constructors" . runPandocLua' $ do
145+ , testCase "Allow singleton inline in constructors" . runLua' $ do
146 Lua.liftIO . assertEqual "Not the exptected Emph" (Emph [Str "test"])
146 Lua.liftIO . assertEqual "Not the exptected Emph" (Emph [Str "test"])
147 =<< Lua.callFunc "pandoc.Emph" (Str "test")
147 =<< Lua.callFunc "pandoc.Emph" (Str "test")
148 Lua.liftIO . assertEqual "Unexpected element" (Para [Str "test"])
148 Lua.liftIO . assertEqual "Unexpected element" (Para [Str "test"])
@@ -156,14 +156,14 @@ tests = map (localOption (QuickCheckTests 20))
156 Lua.peek Lua.stackTop
156 Lua.peek Lua.stackTop
159− , testCase "Elements with Attr have `attr` accessor" . runPandocLua' $ do
159+ , testCase "Elements with Attr have `attr` accessor" . runLua' $ do
160 Lua.push (Div ("hi", ["moin"], [])
160 Lua.push (Div ("hi", ["moin"], [])
161 [Para [Str "ignored"]])
161 [Para [Str "ignored"]])
162 Lua.getfield Lua.stackTop "attr"
162 Lua.getfield Lua.stackTop "attr"
163 Lua.liftIO . assertEqual "no accessor" (("hi", ["moin"], []) :: Attr)
163 Lua.liftIO . assertEqual "no accessor" (("hi", ["moin"], []) :: Attr)
164 =<< Lua.peek Lua.stackTop
164 =<< Lua.peek Lua.stackTop
166− , testCase "informative error messages" . runPandocLua' $ do
166+ , testCase "informative error messages" . runLua' $ do
167 Lua.pushboolean True
167 Lua.pushboolean True
168 err <- Lua.peekEither Lua.stackTop
168 err <- Lua.peekEither Lua.stackTop
169 case (err :: Either String Pandoc) of
169 case (err :: Either String Pandoc) of
@@ -185,7 +185,7 @@ roundtripEqual :: (Eq a, Lua.Peekable a, Lua.Pushable a) => a -> IO Bool
185roundtripEqual x = (x ==) <$> roundtripped
185roundtripEqual x = (x ==) <$> roundtripped
187 roundtripped :: (Lua.Peekable a, Lua.Pushable a) => IO a
187 roundtripped :: (Lua.Peekable a, Lua.Pushable a) => IO a
188− roundtripped = runPandocLua' $ do
188+ roundtripped = runLua' $ do
189 oldSize <- Lua.gettop
189 oldSize <- Lua.gettop
190 Lua.push x
190 Lua.push x
191 size <- Lua.gettop
191 size <- Lua.gettop
@@ -196,10 +196,10 @@ roundtripEqual x = (x ==) <$> roundtripped
196 Left e -> error (show e)
196 Left e -> error (show e)
197 Right y -> return y
197 Right y -> return y
199−runPandocLua' :: Lua.Lua a -> IO a
199+runLua' :: Lua.Lua a -> IO a
200−runPandocLua' op = runIOorExplode $ do
200+runLua' op = runIOorExplode $ do
201 setUserDataDir (Just "../data")
201 setUserDataDir (Just "../data")
202− res <- runPandocLua op
202+ res <- runLua op
203 case res of
203 case res of
204 Left e -> error (show e)
204 Left e -> error (show e)
205 Right x -> return x
205 Right x -> return x