    {-# LANGUAGE OverloadedStrings #-}
    {- |
       Module      : Text.Pandoc.Lua.Module.Types
       Copyright   : © 2019-2024 Albert Krewinkel
       License     : GNU GPL, version 2 or above

       Maintainer  : Albert Krewinkel <albert+pandoc@tarleb.com>
       Stability   : alpha

    Pandoc data type constructors.
    -}
    module Text.Pandoc.Lua.Module.Types
      ( documentedModule
      ) where

    import Data.Version (makeVersion)
    import HsLua ( Module (..), (###), (<#>), (=#>)
                 , defun, functionResult, parameter, since)
    import HsLua.Module.Version (peekVersionFuzzy, pushVersion)
    import Text.Pandoc.Error (PandocError)
    import Text.Pandoc.Lua.PandocLua ()

    -- | Push the pandoc.types module on the Lua stack.
    documentedModule :: Module PandocError
    documentedModule :: Module PandocError
    documentedModule = Module
      { moduleName :: Name
    moduleName = Name
    "pandoc.types"
      , moduleDescription :: Text
    moduleDescription =
          Text
    "Constructors for types that are not part of the pandoc AST."
      , moduleFields :: [Field PandocError]
    moduleFields = []
      , moduleFunctions :: [DocumentedFunction PandocError]
    moduleFunctions =
          [ Name
    -> (Version -> LuaE PandocError Version)
    -> HsFnPrecursor PandocError (Version -> LuaE PandocError Version)
    forall a e. Name -> a -> HsFnPrecursor e a
    defun Name
    "Version"
            ### return
            HsFnPrecursor PandocError (Version -> LuaE PandocError Version)
    -> Parameter PandocError Version
    -> HsFnPrecursor PandocError (LuaE PandocError Version)
    forall e a b.
    HsFnPrecursor e (a -> b) -> Parameter e a -> HsFnPrecursor e b
    <#> Peeker PandocError Version
    -> TypeSpec -> Text -> Text -> Parameter PandocError Version
    forall e a. Peeker e a -> TypeSpec -> Text -> Text -> Parameter e a
    parameter Peeker PandocError Version
    forall e. LuaError e => Peeker e Version
    peekVersionFuzzy TypeSpec
    "string|number|{integer,...}|Version"
                  Text
    "version_specifier"
                  ([Text] -> Text
    forall a. Monoid a => [a] -> a
    mconcat [ Text
    "A version string like `'2.7.3'`, "
                           , Text
    "a Lua number like `2.0`, "
                           , Text
    "a list of integers like `{2,7,3}`, "
                           , Text
    "or a Version object."
                           ])
            HsFnPrecursor PandocError (LuaE PandocError Version)
    -> FunctionResults PandocError Version
    -> DocumentedFunction PandocError
    forall e a.
    HsFnPrecursor e (LuaE e a)
    -> FunctionResults e a -> DocumentedFunction e
    =#> Pusher PandocError Version
    -> TypeSpec -> Text -> FunctionResults PandocError Version
    forall e a. Pusher e a -> TypeSpec -> Text -> FunctionResults e a
    functionResult Pusher PandocError Version
    forall e. LuaError e => Pusher e Version
    pushVersion TypeSpec
    "Version" Text
    "New Version object."
            DocumentedFunction PandocError
    -> Version -> DocumentedFunction PandocError
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    makeVersion [Int
    2,Int
    7,Int
    3]
          ]
      , moduleOperations :: [(Operation, DocumentedFunction PandocError)]
    moduleOperations = []
      , moduleTypeInitializers :: [LuaE PandocError Name]
    moduleTypeInitializers = []
      }