aboutsummaryrefslogtreecommitdiff
path: root/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Path.hs
blob: efe00e03c55c47055ca6a11d931e967c0c228566 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications    #-}
{- |
   Module      : Text.Pandoc.Lua.Module.Path
   Copyright   : © 2019-2024 Albert Krewinkel
   License     : GNU GPL, version 2 or above

   Maintainer  : Albert Krewinkel <[email protected]>
   Stability   : alpha

Pandoc's system Lua module.
-}
module Text.Pandoc.Lua.Module.Path
  ( documentedModule
  ) where

import Data.Version (makeVersion)
import HsLua
import qualified HsLua.Module.Path   as MPath
import qualified HsLua.Module.System as MSystem

-- | Push the pandoc.system module on the Lua stack.
documentedModule :: forall e. LuaError e => Module e
documentedModule = defmodule "pandoc.path"
  `withDescription` moduleDescription @e MPath.documentedModule
  `withFields`
      [ MPath.separator
      , MPath.search_path_separator
      ]
  `withFunctions`
      [ MPath.directory              `since` v[2,12]
      , MSystem.exists               `since` v[3,7,1]
      , MPath.filename               `since` v[2,12]
      , MPath.is_absolute            `since` v[2,12]
      , MPath.is_relative            `since` v[2,12]
      , MPath.join                   `since` v[2,12]
      , MPath.make_relative          `since` v[2,12]
      , MPath.normalize              `since` v[2,12]
      , MPath.split                  `since` v[2,12]
      , MPath.split_extension        `since` v[2,12]
      , MPath.split_search_path      `since` v[2,12]
      , MPath.treat_strings_as_paths `since` v[2,12]
      ]
 where
  v = makeVersion