packages feed

yesod-content-pdf 0.2.0.0 → 0.2.0.1

raw patch · 3 files changed

+23/−6 lines, 3 filesdep +hspecdep +hspec-expectationsdep +utf8-stringPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

Dependencies added: hspec, hspec-expectations, utf8-string

API changes (from Hackage documentation)

+ Yesod.Content.PDF: [pdfBytes] :: PDF -> ByteString
+ Yesod.Content.PDF: instance GHC.Classes.Eq Yesod.Content.PDF.PDF
+ Yesod.Content.PDF: instance GHC.Classes.Ord Yesod.Content.PDF.PDF
+ Yesod.Content.PDF: instance GHC.Read.Read Yesod.Content.PDF.PDF
+ Yesod.Content.PDF: instance GHC.Show.Show Yesod.Content.PDF.PDF

Files

src/Yesod/Content/PDF.hs view
@@ -31,6 +31,7 @@ import Blaze.ByteString.Builder.ByteString import Control.Monad.IO.Class (MonadIO(..)) import Data.ByteString+import Data.ByteString.Builder (hPutBuilder) import Data.Conduit import Data.Default (Default(..)) import Network.URI@@ -38,10 +39,11 @@ import System.IO.Temp import System.Process import Text.Blaze.Html-import Text.Blaze.Html.Renderer.String+import Text.Blaze.Html.Renderer.Utf8 import Yesod.Core.Content -newtype PDF = PDF ByteString+newtype PDF = PDF { pdfBytes :: ByteString }+            deriving (Eq, Ord, Read, Show)  -- | Provide MIME type "application/pdf" as a ContentType for Yesod. typePDF :: ContentType@@ -66,8 +68,10 @@ html2PDF opts html =   wkhtmltopdf opts $ \inner ->   withSystemTempFile "input.html" $ \tempHtmlFp tempHtmlHandle -> do-    System.IO.hPutStrLn tempHtmlHandle $ renderHtml html-    hClose tempHtmlHandle+    hSetBinaryMode tempHtmlHandle True+    hSetBuffering  tempHtmlHandle $ BlockBuffering Nothing+    hPutBuilder    tempHtmlHandle $ renderHtmlBuilder html+    hClose         tempHtmlHandle     inner tempHtmlFp  -- | (Internal) Call wkhtmltopdf.
test/Spec.hs view
@@ -1,2 +1,9 @@+import Test.Hspec+import qualified Yesod.Content.PDFSpec+ main :: IO ()-main = putStrLn "Test suite not yet implemented"+main = hspec spec++spec :: Spec+spec = do+  describe "Yesod.Content.PDF" Yesod.Content.PDFSpec.spec
yesod-content-pdf.cabal view
@@ -1,5 +1,5 @@ name:                yesod-content-pdf-version:             0.2.0.0+version:             0.2.0.1 synopsis:            PDF Content Type for Yesod description:         Please see README.md homepage:            https://github.com/alexkyllo/yesod-content-pdf#readme@@ -19,6 +19,7 @@   default-extensions:  OverloadedStrings                      , TypeSynonymInstances                      , FlexibleInstances+                     , GeneralizedNewtypeDeriving    build-depends:       base >= 4.7 && < 5                      , blaze-builder@@ -39,8 +40,13 @@   type:                exitcode-stdio-1.0   hs-source-dirs:      test   main-is:             Spec.hs+  default-extensions:  OverloadedStrings   build-depends:       base                      , yesod-content-pdf+                     , hspec+                     , hspec-expectations+                     , utf8-string+                     , blaze-html   ghc-options:         -threaded -rtsopts -with-rtsopts=-N   default-language:    Haskell2010