@@ -14,6 +14,7 @@ module Text.Pandoc.Lua.Module.Pandoc
1414 ( pushModule
1515 ) where
1616
17+import Prelude hiding (read)
1718import Control.Monad (when)
1819import Control.Monad.Except (throwError)
1920import Data.Default (Default (..))
@@ -43,10 +44,10 @@ import Text.Pandoc.Error
4344pushModule :: PandocLua NumResults
4445pushModule = do
4546 loadDefaultModule "pandoc"
46− addFunction "read" readDoc
47− addFunction "pipe" pipeFn
48− addFunction "walk_block" walkBlock
49− addFunction "walk_inline" walkInline
47+ addFunction "read" read
48+ addFunction "pipe" pipe
49+ addFunction "walk_block" walk_block
50+ addFunction "walk_inline" walk_inline
5051 return 1
5152
5253walkElement :: (Walkable (SingletonsList Inline) a,
@@ -54,14 +55,14 @@ walkElement :: (Walkable (SingletonsList Inline) a,
5455 => a -> LuaFilter -> PandocLua a
5556walkElement x f = liftPandocLua $ walkInlines f x >>= walkBlocks f
5657
57−walkInline :: Inline -> LuaFilter -> PandocLua Inline
58−walkInline = walkElement
58+walk_inline :: Inline -> LuaFilter -> PandocLua Inline
59+walk_inline = walkElement
5960
60−walkBlock :: Block -> LuaFilter -> PandocLua Block
61−walkBlock = walkElement
61+walk_block :: Block -> LuaFilter -> PandocLua Block
62+walk_block = walkElement
6263
63−readDoc :: T.Text -> Optional T.Text -> PandocLua NumResults
64−readDoc content formatSpecOrNil = liftPandocLua $ do
64+read :: T.Text -> Optional T.Text -> PandocLua NumResults
65+read content formatSpecOrNil = liftPandocLua $ do
6566 let formatSpec = fromMaybe "markdown" (Lua.fromOptional formatSpecOrNil)
6667 res <- Lua.liftIO . runIO $
6768 getReader formatSpec >>= \(rdr,es) ->
@@ -79,11 +80,11 @@ readDoc content formatSpecOrNil = liftPandocLua $ do
7980 Left e -> Lua.raiseError $ show e
8081
8182-- | Pipes input through a command.
82−pipeFn :: String
83− -> [String]
84− -> BL.ByteString
85− -> PandocLua NumResults
86−pipeFn command args input = liftPandocLua $ do
83+pipe :: String -- ^ path to executable
84+ -> [String] -- ^ list of arguments
85+ -> BL.ByteString -- ^ input passed to process via stdin
86+ -> PandocLua NumResults
87+pipe command args input = liftPandocLua $ do
8788 (ec, output) <- Lua.liftIO $ pipeProcess Nothing command args input
8889 case ec of
8990 ExitSuccess -> 1 <$ Lua.push output