Skip to content

Commit

Permalink
Add path manipulation functions
Browse files Browse the repository at this point in the history
  • Loading branch information
gabyx committed Jul 26, 2020
1 parent 6448bd3 commit 40e9ee8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pandoc.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.2
name: pandoc
version: 2.10.1
version: 2.10.2
build-type: Simple
license: GPL-2.0-or-later
license-file: COPYING.md
Expand Down Expand Up @@ -414,7 +414,7 @@ library
blaze-markup >= 0.8 && < 0.9,
jira-wiki-markup >= 1.3.2 && < 1.4,
hslua >= 1.1 && < 1.2,
hslua-module-system >= 0.2 && < 0.3,
hslua-module-system >= 0.2.2 && < 0.3,
hslua-module-text >= 0.2.1 && < 0.3,
binary >= 0.5 && < 0.11,
SHA >= 1.6 && < 1.7,
Expand Down
36 changes: 34 additions & 2 deletions src/Text/Pandoc/Lua/Module/System.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,25 @@ module Text.Pandoc.Lua.Module.System
) where

import Foreign.Lua (Lua, NumResults)
import Foreign.Lua.Module.System (arch, env, getwd, os,
with_env, with_tmpdir, with_wd)
import Foreign.Lua.Module.System (arch,
os,
-- * General functions
env,
getwd,
with_env,
with_tmpdir,
with_wd,
-- * Path manipulation functions
take_directory,
take_filename,
take_extensions,
split_directories,
has_extension,
drop_extensions,
join_path,
is_relative,
is_absolute,
normalise)
import Text.Pandoc.Lua.Util (addFunction, addField)

import qualified Foreign.Lua as Lua
Expand All @@ -23,11 +40,26 @@ import qualified Foreign.Lua as Lua
pushModule :: Lua NumResults
pushModule = do
Lua.newtable

-- * General functions
addField "arch" arch
addField "os" os
addFunction "environment" env
addFunction "get_working_directory" getwd
addFunction "with_environment" with_env
addFunction "with_temporary_directory" with_tmpdir
addFunction "with_working_directory" with_wd

-- * Path manipulation functions
addfunction "take_directory" take_directory
addfunction "take_filename" take_filename
addfunction "take_extensions" take_extensions
addfunction "split_directories" split_directories
addfunction "has_extension" has_extension
addfunction "drop_extensions" drop_extensions
addfunction "join_path" join_path
addfunction "is_relative" is_relative
addfunction "is_absolute" is_absolute
addfunction "normalise" normalise

return 1

0 comments on commit 40e9ee8

Please sign in to comment.