aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Lua
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-10-27 20:28:29 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2017-10-27 20:28:29 -0700
commitff16db1aa306113132cc6cfaa70791a0db75e0a5 (patch)
treeb5a016232c62645a1276c30eb4b69356662c060e /src/Text/Pandoc/Lua
parentbf54a6335a0d2ae3fdf03e60a84448476f651d59 (diff)
downloadpandoc-ff16db1aa306113132cc6cfaa70791a0db75e0a5.tar.gz
Automatic reformating by stylish-haskell.
Diffstat (limited to 'src/Text/Pandoc/Lua')
-rw-r--r--src/Text/Pandoc/Lua/PandocModule.hs18
-rw-r--r--src/Text/Pandoc/Lua/StackInstances.hs11
-rw-r--r--src/Text/Pandoc/Lua/Util.hs4
3 files changed, 17 insertions, 16 deletions
diff --git a/src/Text/Pandoc/Lua/PandocModule.hs b/src/Text/Pandoc/Lua/PandocModule.hs
index 3c27ecffb..c42e180c6 100644
--- a/src/Text/Pandoc/Lua/PandocModule.hs
+++ b/src/Text/Pandoc/Lua/PandocModule.hs
@@ -34,24 +34,24 @@ module Text.Pandoc.Lua.PandocModule
import Control.Monad (unless, zipWithM_)
import Data.ByteString.Char8 (unpack)
import Data.Default (Default (..))
+import Data.Digest.Pure.SHA (sha1, showDigest)
import Data.IORef
import Data.Maybe (fromMaybe)
import Data.Text (pack)
-import Foreign.Lua (Lua, FromLuaStack, NumResults, liftIO)
+import Foreign.Lua (FromLuaStack, Lua, NumResults, liftIO)
import Foreign.Lua.FunctionCalling (ToHaskellFunction)
-import Text.Pandoc.Class (readDataFile, runIO,
- runIOorExplode, setUserDataDir, CommonState(..),
- putCommonState, fetchItem, setMediaBag)
-import Text.Pandoc.Options (ReaderOptions(readerExtensions))
+import System.Exit (ExitCode (..))
+import Text.Pandoc.Class (CommonState (..), fetchItem, putCommonState,
+ readDataFile, runIO, runIOorExplode, setMediaBag,
+ setUserDataDir)
import Text.Pandoc.Lua.StackInstances ()
-import Text.Pandoc.Readers (Reader (..), getReader)
import Text.Pandoc.MIME (MimeType)
+import Text.Pandoc.Options (ReaderOptions (readerExtensions))
import Text.Pandoc.Process (pipeProcess)
-import System.Exit (ExitCode(..))
-import Data.Digest.Pure.SHA (sha1, showDigest)
+import Text.Pandoc.Readers (Reader (..), getReader)
-import qualified Foreign.Lua as Lua
import qualified Data.ByteString.Lazy as BL
+import qualified Foreign.Lua as Lua
import qualified Text.Pandoc.MediaBag as MB
-- | Push the "pandoc" on the lua stack.
diff --git a/src/Text/Pandoc/Lua/StackInstances.hs b/src/Text/Pandoc/Lua/StackInstances.hs
index 73b04e50f..0a7b61578 100644
--- a/src/Text/Pandoc/Lua/StackInstances.hs
+++ b/src/Text/Pandoc/Lua/StackInstances.hs
@@ -33,10 +33,11 @@ StackValue instances for pandoc types.
module Text.Pandoc.Lua.StackInstances () where
import Control.Applicative ((<|>))
-import Foreign.Lua (Lua, LuaInteger, LuaNumber, Type (..), FromLuaStack (peek),
- ToLuaStack (push), StackIndex, throwLuaError, tryLua)
+import Foreign.Lua (FromLuaStack (peek), Lua, LuaInteger, LuaNumber, StackIndex,
+ ToLuaStack (push), Type (..), throwLuaError, tryLua)
import Text.Pandoc.Definition
-import Text.Pandoc.Lua.Util (addValue, adjustIndexBy, getTable, pushViaConstructor)
+import Text.Pandoc.Lua.Util (addValue, adjustIndexBy, getTable,
+ pushViaConstructor)
import Text.Pandoc.Shared (safeRead)
import qualified Foreign.Lua as Lua
@@ -139,7 +140,7 @@ instance FromLuaStack Int where
safeRead' :: Read a => String -> Lua a
safeRead' s = case safeRead s of
Nothing -> throwLuaError ("Could not read: " ++ s)
- Just x -> return x
+ Just x -> return x
-- | Push an meta value element to the top of the lua stack.
pushMetaValue :: MetaValue -> Lua ()
@@ -293,7 +294,7 @@ getTag idx = do
Lua.settop top
case r of
Left (Lua.LuaException err) -> throwLuaError err
- Right res -> return res
+ Right res -> return res
withAttr :: (Attr -> a -> b) -> (LuaAttr, a) -> b
withAttr f (attributes, x) = f (fromLuaAttr attributes) x
diff --git a/src/Text/Pandoc/Lua/Util.hs b/src/Text/Pandoc/Lua/Util.hs
index 6b1d51159..7960c0670 100644
--- a/src/Text/Pandoc/Lua/Util.hs
+++ b/src/Text/Pandoc/Lua/Util.hs
@@ -40,8 +40,8 @@ module Text.Pandoc.Lua.Util
, pushViaConstructor
) where
-import Foreign.Lua (Lua, FromLuaStack (..), ToLuaStack (..), NumArgs,
- StackIndex, getglobal')
+import Foreign.Lua (FromLuaStack (..), Lua, NumArgs, StackIndex,
+ ToLuaStack (..), getglobal')
import Foreign.Lua.Api (call, pop, rawget, rawgeti, rawset, rawseti)
-- | Adjust the stack index, assuming that @n@ new elements have been pushed on