diff options
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Filter.hs | 4 | ||||
-rw-r--r-- | src/Text/Pandoc/Filter/JSON.hs (renamed from src/Text/Pandoc/Filter/Json.hs) | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Lua/Module/Utils.hs | 10 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Filter.hs b/src/Text/Pandoc/Filter.hs index 30c99cc28..67b3a5f2c 100644 --- a/src/Text/Pandoc/Filter.hs +++ b/src/Text/Pandoc/Filter.hs @@ -39,7 +39,7 @@ import Data.Foldable (foldrM) import Text.Pandoc.Class (PandocIO) import Text.Pandoc.Definition (Pandoc) import Text.Pandoc.Options (ReaderOptions) -import qualified Text.Pandoc.Filter.Json as JsonFilter +import qualified Text.Pandoc.Filter.JSON as JSONFilter import qualified Text.Pandoc.Filter.Lua as LuaFilter data Filter = LuaFilter FilePath @@ -54,7 +54,7 @@ applyFilters :: ReaderOptions applyFilters ropts filters args d = do foldrM ($) d $ map applyFilter filters where - applyFilter (JSONFilter f) = JsonFilter.apply ropts args f + applyFilter (JSONFilter f) = JSONFilter.apply ropts args f applyFilter (LuaFilter f) = LuaFilter.apply ropts args f $(deriveJSON defaultOptions ''Filter) diff --git a/src/Text/Pandoc/Filter/Json.hs b/src/Text/Pandoc/Filter/JSON.hs index 681c52720..5772c2c41 100644 --- a/src/Text/Pandoc/Filter/Json.hs +++ b/src/Text/Pandoc/Filter/JSON.hs @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Programmatically modifications of pandoc documents via JSON filters. -} -module Text.Pandoc.Filter.Json (apply) where +module Text.Pandoc.Filter.JSON (apply) where import Control.Monad (unless, when) import Control.Monad.Trans (MonadIO (liftIO)) diff --git a/src/Text/Pandoc/Lua/Module/Utils.hs b/src/Text/Pandoc/Lua/Module/Utils.hs index ab29cc0c7..f8eb96dc7 100644 --- a/src/Text/Pandoc/Lua/Module/Utils.hs +++ b/src/Text/Pandoc/Lua/Module/Utils.hs @@ -40,7 +40,7 @@ import Text.Pandoc.Lua.Util (addFunction, popValue) import qualified Data.Digest.Pure.SHA as SHA import qualified Data.ByteString.Lazy as BSL import qualified Foreign.Lua as Lua -import qualified Text.Pandoc.Filter.Json as JsonFilter +import qualified Text.Pandoc.Filter.JSON as JSONFilter import qualified Text.Pandoc.Shared as Shared -- | Push the "pandoc.utils" module to the lua stack. @@ -49,7 +49,7 @@ pushModule mbDatadir = do Lua.newtable addFunction "hierarchicalize" hierarchicalize addFunction "normalize_date" normalizeDate - addFunction "run_json_filter" (runJsonFilter mbDatadir) + addFunction "run_json_filter" (runJSONFilter mbDatadir) addFunction "sha1" sha1 addFunction "stringify" stringify addFunction "to_roman_numeral" toRomanNumeral @@ -67,12 +67,12 @@ normalizeDate :: String -> Lua (Lua.Optional String) normalizeDate = return . Lua.Optional . Shared.normalizeDate -- | Run a JSON filter on the given document. -runJsonFilter :: Maybe FilePath +runJSONFilter :: Maybe FilePath -> Pandoc -> FilePath -> Lua.Optional [String] -> Lua NumResults -runJsonFilter mbDatadir doc filterFile optArgs = do +runJSONFilter mbDatadir doc filterFile optArgs = do args <- case Lua.fromOptional optArgs of Just x -> return x Nothing -> do @@ -80,7 +80,7 @@ runJsonFilter mbDatadir doc filterFile optArgs = do (:[]) <$> popValue filterRes <- Lua.liftIO . runIO $ do setUserDataDir mbDatadir - JsonFilter.apply def args filterFile doc + JSONFilter.apply def args filterFile doc case filterRes of Left err -> Lua.raiseError (show err) Right d -> (1 :: NumResults) <$ Lua.push d |