"Fossies" - the Fresh Open Source Software Archive

Member "pandoc-2.7.3/src/Text/Pandoc/Lua/Module/System.hs" (12 Jun 2019, 966 Bytes) of package /linux/www/pandoc-2.7.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Haskell source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 {- |
    2    Module      : Text.Pandoc.Lua.Module.System
    3    Copyright   : © 2019 Albert Krewinkel
    4    License     : GNU GPL, version 2 or above
    5 
    6    Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
    7    Stability   : alpha
    8 
    9 Pandoc's system Lua module.
   10 -}
   11 module Text.Pandoc.Lua.Module.System
   12   ( pushModule
   13   ) where
   14 
   15 import Prelude
   16 import Foreign.Lua (Lua, NumResults)
   17 import Foreign.Lua.Module.System (arch, env, getwd, os,
   18                                   with_env, with_tmpdir, with_wd)
   19 import Text.Pandoc.Lua.Util (addFunction, addField)
   20 
   21 import qualified Foreign.Lua as Lua
   22 
   23 -- | Push the pandoc.system module on the Lua stack.
   24 pushModule :: Lua NumResults
   25 pushModule = do
   26   Lua.newtable
   27   addField "arch" arch
   28   addField "os" os
   29   addFunction "environment" env
   30   addFunction "get_current_directory" getwd
   31   addFunction "with_environment" with_env
   32   addFunction "with_temp_directory" with_tmpdir
   33   addFunction "with_working_directory" with_wd
   34   return 1