diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-08-13 23:11:33 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-08-13 23:11:33 -0700 |
commit | f6b5735d095dcfe2b0ef4aab02ff85acb47140c6 (patch) | |
tree | fbfb22b2c47c934796a7f79bdafab57326cf5d53 /pandoc.hs | |
parent | bd73d73a28acc2863bd52bdc6f0f9d850fa34d84 (diff) |
Added module for writing python scripts, with several examples.
See scripts subdirectory.
Diffstat (limited to 'pandoc.hs')
-rw-r--r-- | pandoc.hs | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -91,14 +91,16 @@ isTextFormat :: String -> Bool isTextFormat s = takeWhile (`notElem` "+-") s `notElem` ["odt","docx","epub","epub3"] externalFilter :: FilePath -> [String] -> Pandoc -> IO Pandoc -externalFilter f args' d = E.catch - (do (exitcode, outbs, errbs) <- pipeProcess Nothing f args' $ encode d +externalFilter f args' d = E.handle filterException $ + do (exitcode, outbs, errbs) <- pipeProcess Nothing f args' $ encode d case exitcode of ExitSuccess -> return $ either error id $ eitherDecode' outbs - ExitFailure _ -> err 83 $ "Error running filter `" ++ UTF8.toStringLazy outbs ++ - UTF8.toStringLazy errbs ++ "'") - (\e -> let _ = (e :: E.SomeException) - in err 83 $ "Error running filter `" ++ f ++ "'") + ExitFailure _ -> err 83 $ "Error running filter " ++ f ++ "\n" ++ + UTF8.toStringLazy outbs ++ + UTF8.toStringLazy errbs + where filterException :: E.SomeException -> IO Pandoc + filterException e = err 83 $ "Error running filter " ++ f ++ + "\n" ++ show e -- | Data structure for command line options. data Opt = Opt |