@@ -41,9 +41,9 @@ import Text.Pandoc.Readers (Reader (..), getReader)
41import Text.Pandoc.Shared (readDataFile)
41import Text.Pandoc.Shared (readDataFile)
43-- | Push the "pandoc" on the lua stack.
43-- | Push the "pandoc" on the lua stack.
44−pushPandocModule :: LuaState -> IO ()
44+pushPandocModule :: Maybe FilePath -> LuaState -> IO ()
45−pushPandocModule lua = do
45+pushPandocModule datadir lua = do
46− script <- pandocModuleScript
46+ script <- pandocModuleScript datadir
47 status <- loadstring lua script "pandoc.lua"
47 status <- loadstring lua script "pandoc.lua"
48 unless (status /= 0) $ call lua 0 1
48 unless (status /= 0) $ call lua 0 1
49 push lua "__read"
49 push lua "__read"
@@ -51,8 +51,8 @@ pushPandocModule lua = do
51 rawset lua (-3)
51 rawset lua (-3)
53-- | Get the string representation of the pandoc module
53-- | Get the string representation of the pandoc module
54−pandocModuleScript :: IO String
54+pandocModuleScript :: Maybe FilePath -> IO String
55−pandocModuleScript = unpack <$> readDataFile Nothing "pandoc.lua"
55+pandocModuleScript datadir = unpack <$> readDataFile datadir "pandoc.lua"
57read_doc :: String -> String -> IO (Either String Pandoc)
57read_doc :: String -> String -> IO (Either String Pandoc)
58read_doc formatSpec content = do
58read_doc formatSpec content = do