{-# LANGUAGE OverloadedStrings #-}
module Text.Pandoc.Lua.Marshal.CommonState
( typeCommonState
, peekCommonState
, pushCommonState
) where
import HsLua
import Text.Pandoc.Class (CommonState (..))
import Text.Pandoc.Logging (LogMessage, showLogMessage)
import Text.Pandoc.Lua.Marshal.List (pushPandocList)
typeCommonState :: LuaError e => DocumentedType e CommonState
typeCommonState :: forall e. LuaError e => DocumentedType e CommonState
typeCommonState = forall e a.
LuaError e =>
Name
-> [(Operation, DocumentedFunction e)]
-> [Member e (DocumentedFunction e) a]
-> DocumentedType e a
deftype Name
"pandoc CommonState" []
[ forall e b a fn.
Name -> Text -> (Pusher e b, a -> b) -> Member e fn a
readonly Name
"input_files" Text
"input files passed to pandoc"
(forall e a. LuaError e => Pusher e a -> Pusher e [a]
pushPandocList forall e. String -> LuaE e ()
pushString, CommonState -> [String]
stInputFiles)
, forall e b a fn.
Name -> Text -> (Pusher e b, a -> b) -> Member e fn a
readonly Name
"output_file" Text
"the file to which pandoc will write"
(forall b a. b -> (a -> b) -> Maybe a -> b
maybe forall e. LuaE e ()
pushnil forall e. String -> LuaE e ()
pushString, CommonState -> Maybe String
stOutputFile)
, forall e b a fn.
Name -> Text -> (Pusher e b, a -> b) -> Member e fn a
readonly Name
"log" Text
"list of log messages"
(forall e a. LuaError e => Pusher e a -> Pusher e [a]
pushPandocList (forall e fn a itemtype.
LuaError e =>
UDTypeWithList e fn a itemtype -> a -> LuaE e ()
pushUD forall e. LuaError e => DocumentedType e LogMessage
typeLogMessage), CommonState -> [LogMessage]
stLog)
, forall e b a fn.
Name -> Text -> (Pusher e b, a -> b) -> Member e fn a
readonly Name
"request_headers" Text
"headers to add for HTTP requests"
(forall e a. LuaError e => Pusher e a -> Pusher e [a]
pushPandocList (forall e a b.
LuaError e =>
Pusher e a -> Pusher e b -> (a, b) -> LuaE e ()
pushPair forall e. Pusher e Text
pushText forall e. Pusher e Text
pushText), CommonState -> [(Text, Text)]
stRequestHeaders)
, forall e b a fn.
Name -> Text -> (Pusher e b, a -> b) -> Member e fn a
readonly Name
"resource_path"
Text
"path to search for resources like included images"
(forall e a. LuaError e => Pusher e a -> Pusher e [a]
pushPandocList forall e. String -> LuaE e ()
pushString, CommonState -> [String]
stResourcePath)
, forall e b a fn.
Name -> Text -> (Pusher e b, a -> b) -> Member e fn a
readonly Name
"source_url" Text
"absolute URL + dir of 1st source file"
(forall b a. b -> (a -> b) -> Maybe a -> b
maybe forall e. LuaE e ()
pushnil forall e. Pusher e Text
pushText, CommonState -> Maybe Text
stSourceURL)
, forall e b a fn.
Name -> Text -> (Pusher e b, a -> b) -> Member e fn a
readonly Name
"user_data_dir" Text
"directory to search for data files"
(forall b a. b -> (a -> b) -> Maybe a -> b
maybe forall e. LuaE e ()
pushnil forall e. String -> LuaE e ()
pushString, CommonState -> Maybe String
stUserDataDir)
, forall e b a fn.
Name -> Text -> (Pusher e b, a -> b) -> Member e fn a
readonly Name
"trace" Text
"controls whether tracing messages are issued"
(forall e. Pusher e Bool
pushBool, CommonState -> Bool
stTrace)
, forall e b a fn.
Name -> Text -> (Pusher e b, a -> b) -> Member e fn a
readonly Name
"verbosity" Text
"verbosity level"
(forall e. String -> LuaE e ()
pushString forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String
show, CommonState -> Verbosity
stVerbosity)
]
peekCommonState :: LuaError e => Peeker e CommonState
peekCommonState :: forall e. LuaError e => Peeker e CommonState
peekCommonState = forall e fn a itemtype.
LuaError e =>
UDTypeWithList e fn a itemtype -> Peeker e a
peekUD forall e. LuaError e => DocumentedType e CommonState
typeCommonState
pushCommonState :: LuaError e => Pusher e CommonState
pushCommonState :: forall e. LuaError e => Pusher e CommonState
pushCommonState = forall e fn a itemtype.
LuaError e =>
UDTypeWithList e fn a itemtype -> a -> LuaE e ()
pushUD forall e. LuaError e => DocumentedType e CommonState
typeCommonState
typeLogMessage :: LuaError e => DocumentedType e LogMessage
typeLogMessage :: forall e. LuaError e => DocumentedType e LogMessage
typeLogMessage = forall e a.
LuaError e =>
Name
-> [(Operation, DocumentedFunction e)]
-> [Member e (DocumentedFunction e) a]
-> DocumentedType e a
deftype Name
"pandoc LogMessage"
[ forall e.
Operation
-> DocumentedFunction e -> (Operation, DocumentedFunction e)
operation Operation
Index forall a b. (a -> b) -> a -> b
$ forall a e. Name -> a -> HsFnPrecursor e a
defun Name
"__tostring"
### liftPure showLogMessage
forall e a b.
HsFnPrecursor e (a -> b) -> Parameter e a -> HsFnPrecursor e b
<#> forall e a itemtype.
LuaError e =>
DocumentedTypeWithList e a itemtype
-> Text -> Text -> Parameter e a
udparam forall e. LuaError e => DocumentedType e LogMessage
typeLogMessage Text
"msg" Text
"object"
forall e a.
HsFnPrecursor e (LuaE e a)
-> FunctionResults e a -> DocumentedFunction e
=#> forall e a. Pusher e a -> Text -> Text -> FunctionResults e a
functionResult forall e. Pusher e Text
pushText Text
"string" Text
"stringified log message"
]
forall a. Monoid a => a
mempty