{-# 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 <albert+pandoc@tarleb.com>
   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 :: forall e. LuaError e => Module e
documentedModule = Module
  { moduleName :: Name
moduleName = Name
"pandoc.path"
  , moduleDescription :: Text
moduleDescription = forall e. Module e -> Text
moduleDescription @e Module e
forall e. LuaError e => Module e
MPath.documentedModule
  , moduleFields :: [Field e]
moduleFields =
      [ Field e
forall e. Field e
MPath.separator
      , Field e
forall e. Field e
MPath.search_path_separator
      ]
  , moduleFunctions :: [DocumentedFunction e]
moduleFunctions =
      [ DocumentedFunction e
forall e. DocumentedFunction e
MPath.directory              DocumentedFunction e -> Version -> DocumentedFunction e
forall e. DocumentedFunction e -> Version -> DocumentedFunction e
`since` [Int] -> Version
v[Int
2,Int
12]
      , DocumentedFunction e
forall e. LuaError e => DocumentedFunction e
MSystem.exists               DocumentedFunction e -> Version -> DocumentedFunction e
forall e. DocumentedFunction e -> Version -> DocumentedFunction e
`since` [Int] -> Version
v[Int
3,Int
7,Int
1]
      , DocumentedFunction e
forall e. DocumentedFunction e
MPath.filename               DocumentedFunction e -> Version -> DocumentedFunction e
forall e. DocumentedFunction e -> Version -> DocumentedFunction e
`since` [Int] -> Version
v[Int
2,Int
12]
      , DocumentedFunction e
forall e. DocumentedFunction e
MPath.is_absolute            DocumentedFunction e -> Version -> DocumentedFunction e
forall e. DocumentedFunction e -> Version -> DocumentedFunction e
`since` [Int] -> Version
v[Int
2,Int
12]
      , DocumentedFunction e
forall e. DocumentedFunction e
MPath.is_relative            DocumentedFunction e -> Version -> DocumentedFunction e
forall e. DocumentedFunction e -> Version -> DocumentedFunction e
`since` [Int] -> Version
v[Int
2,Int
12]
      , DocumentedFunction e
forall e. LuaError e => DocumentedFunction e
MPath.join                   DocumentedFunction e -> Version -> DocumentedFunction e
forall e. DocumentedFunction e -> Version -> DocumentedFunction e
`since` [Int] -> Version
v[Int
2,Int
12]
      , DocumentedFunction e
forall e. DocumentedFunction e
MPath.make_relative          DocumentedFunction e -> Version -> DocumentedFunction e
forall e. DocumentedFunction e -> Version -> DocumentedFunction e
`since` [Int] -> Version
v[Int
2,Int
12]
      , DocumentedFunction e
forall e. DocumentedFunction e
MPath.normalize              DocumentedFunction e -> Version -> DocumentedFunction e
forall e. DocumentedFunction e -> Version -> DocumentedFunction e
`since` [Int] -> Version
v[Int
2,Int
12]
      , DocumentedFunction e
forall e. LuaError e => DocumentedFunction e
MPath.split                  DocumentedFunction e -> Version -> DocumentedFunction e
forall e. DocumentedFunction e -> Version -> DocumentedFunction e
`since` [Int] -> Version
v[Int
2,Int
12]
      , DocumentedFunction e
forall e. DocumentedFunction e
MPath.split_extension        DocumentedFunction e -> Version -> DocumentedFunction e
forall e. DocumentedFunction e -> Version -> DocumentedFunction e
`since` [Int] -> Version
v[Int
2,Int
12]
      , DocumentedFunction e
forall e. LuaError e => DocumentedFunction e
MPath.split_search_path      DocumentedFunction e -> Version -> DocumentedFunction e
forall e. DocumentedFunction e -> Version -> DocumentedFunction e
`since` [Int] -> Version
v[Int
2,Int
12]
      , DocumentedFunction e
forall e. LuaError e => DocumentedFunction e
MPath.treat_strings_as_paths DocumentedFunction e -> Version -> DocumentedFunction e
forall e. DocumentedFunction e -> Version -> DocumentedFunction e
`since` [Int] -> Version
v[Int
2,Int
12]
      ]
  , moduleOperations :: [(Operation, DocumentedFunction e)]
moduleOperations = []
  , moduleTypeInitializers :: [LuaE e Name]
moduleTypeInitializers = []
  }
 where
  v :: [Int] -> Version
v = [Int] -> Version
makeVersion