packages feed

fromhtml 0.1.0.2 → 0.1.0.3

raw patch · 4 files changed

+18/−31 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

app/Main.hs view
@@ -3,6 +3,8 @@ import Prelude hiding (writeFile) import Data.ByteString (writeFile) import System.Environment+import System.Exit+ import Text.FromHTML  main :: IO ()@@ -14,4 +16,6 @@   html <- readFile infile   case fromHTML format html of     Just bs -> writeFile outfile bs-    Nothing -> putStrLn "Couldn't transform that document..."+    Nothing -> do+      putStrLn "Couldn't transform that document..."+      exitFailure
fromhtml.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 413af0a60b6c440ea079116a600662b218b5105d19367f3d1a245101ba62f82a+-- hash: 662db110fe335a315c910ebacb59676374dd70900365c0911455c54a4731ce94  name:           fromhtml-version:        0.1.0.2+version:        0.1.0.3 synopsis:       Simple adapter for transformation of HTML to other formats description:    Please see the README on GitHub at <https://github.com/MarekSuchanek/FromHTML#readme> category:       Text@@ -47,22 +47,6 @@       Paths_fromhtml   hs-source-dirs:       app-  build-depends:-      base >=4.7 && <5-    , bytestring-    , fromhtml-    , process-    , text-  default-language: Haskell2010--test-suite transdoc-test-  type: exitcode-stdio-1.0-  main-is: Spec.hs-  other-modules:-      Paths_fromhtml-  hs-source-dirs:-      test-  ghc-options: -threaded -rtsopts -with-rtsopts=-N   build-depends:       base >=4.7 && <5     , bytestring
src/Text/FromHTML.hs view
@@ -16,7 +16,7 @@    , ExportType(..)    ) where --- import Debug.Trace+--import Debug.Trace  import qualified Data.Char as C import qualified Data.Text as T@@ -24,6 +24,7 @@ import qualified Data.ByteString as B  import           GHC.IO.Handle+import           System.Exit import           System.Process import           System.IO.Unsafe @@ -60,10 +61,10 @@ -- | Transform given HTML as String to selected format fromHTML :: ExportType -> String -> Maybe B.ByteString fromHTML HTML html = Just . str2BS $ html  -- HTML is already provided!-fromHTML PDF html = makePDF (str2BS html)-fromHTML extp html = makePD extp (str2BS html)+fromHTML PDF html = makePDF html+fromHTML extp html = makePD extp html -type Input = B.ByteString+type Input = String type Output = B.ByteString type Command = Input -> IO (Maybe Output) type Process = IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)@@ -92,12 +93,12 @@  perform :: CreateProcess -> Input -> IO (Maybe Output) perform cprocess input = do-    (Just stdin, Just stdout, Just stderr, _) <- createProcess cprocess-    B.hPutStr stdin input >> hClose stdin-    errors <- B.hGetContents stderr-    case errors of-      "" -> Just <$> B.hGetContents stdout-      _  -> return Nothing+    (Just stdin, Just stdout, _, p) <- createProcess cprocess+    hPutStr stdin input >> hClose stdin+    exitCode <- waitForProcess p+    case exitCode of+      ExitSuccess -> Just <$> B.hGetContents stdout+      _           -> return Nothing   procWith p = p { std_out = CreatePipe
− test/Spec.hs
@@ -1,2 +0,0 @@-main :: IO ()-main = putStrLn "Test suite not yet implemented"