{-# LANGUAGE OverloadedStrings    #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{- |
Module      : Text.Pandoc.Lua.Marshal.Template
Copyright   : © 2021-2022 Albert Krewinkel
License     : GNU GPL, version 2 or above
Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>

Marshal 'Template' 'Text'.
-}
module Text.Pandoc.Lua.Marshal.Template
  ( pushTemplate
  , peekTemplate
  , typeTemplate
  ) where

import Data.Text (Text)
import HsLua as Lua
import Text.DocTemplates (Template)

-- | Pushes a 'Template' as a an opaque userdata value.
pushTemplate :: LuaError e => Pusher e (Template Text)
pushTemplate :: forall e. LuaError e => Pusher e (Template Text)
pushTemplate = UDTypeWithList e (DocumentedFunction e) (Template Text) Void
-> Template Text -> LuaE e ()
forall e fn a itemtype.
LuaError e =>
UDTypeWithList e fn a itemtype -> a -> LuaE e ()
pushUD UDTypeWithList e (DocumentedFunction e) (Template Text) Void
forall e. LuaError e => DocumentedType e (Template Text)
typeTemplate

-- | Retrieves a 'Template' 'Text' value from the stack.
peekTemplate :: LuaError e => Peeker e (Template Text)
peekTemplate :: forall e. LuaError e => Peeker e (Template Text)
peekTemplate = UDTypeWithList e (DocumentedFunction e) (Template Text) Void
-> Peeker e (Template Text)
forall e fn a itemtype.
LuaError e =>
UDTypeWithList e fn a itemtype -> Peeker e a
peekUD UDTypeWithList e (DocumentedFunction e) (Template Text) Void
forall e. LuaError e => DocumentedType e (Template Text)
typeTemplate

-- | Template object type.
typeTemplate :: LuaError e => DocumentedType e (Template Text)
typeTemplate :: forall e. LuaError e => DocumentedType e (Template Text)
typeTemplate = Name
-> [(Operation, DocumentedFunction e)]
-> [Member e (DocumentedFunction e) (Template Text)]
-> DocumentedType e (Template Text)
forall e a.
LuaError e =>
Name
-> [(Operation, DocumentedFunction e)]
-> [Member e (DocumentedFunction e) a]
-> DocumentedType e a
deftype Name
"pandoc Template" [] []