packages feed

web-output 0.3.0.1 → 0.4.0.0

raw patch · 2 files changed

+28/−3 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- WebOutput: writeResource :: Resource -> IO ()

Files

WebOutput.hs view
@@ -1,5 +1,19 @@-module WebOutput where+{-| +This module provides simple utility functions useful to present web+content to the user via their default browser, creating temporary+files. Use 'toTheBrowser' in order to simply show some markup (HTML)+to the user, and use 'manyToTheBrowser' with an array of 'Resource' in+order to show a page linking to multiple files, for example a page+linking to a local style file and a local Javascript file++-}+module WebOutput (+  toTheBrowser,+  Resource(..),+  manyToTheBrowser,+  ) where+ import System.IO.Temp (openTempFile, createTempDirectory) import Web.Browser (openBrowser) import System.IO (hPutStr, hFlush)@@ -8,6 +22,8 @@ import qualified Data.Text as T import qualified Data.Text.IO as T +-- | Writes its argument to a temporary file and opens the user's browser +-- to show that file. The returned boolean can be ignored toTheBrowser content = do   dir <- getTemporaryDirectory   path <- writeContentToTempFile dir content "output.html"@@ -19,13 +35,22 @@         hFlush handle         return path +-- | Use the Resource type to create resources that are linking to+-- each other, and you want to show to the user all together. For+-- example one resource could contain some HTML linking to another+-- resource containing Javascript or other.  data Resource = Resource {-  location :: FilePath,+  location :: FilePath, -- ^ 'location' should contain a relative URL where the resource will be placed. For example this could be @"script.js"@ for a Javascript file   content :: T.Text }  writeResource (Resource loc con) = T.writeFile loc con +-- | Present multiple files via the user's browser, so that they can+-- reference each other. A temporary directory is created, the files+-- are written there, and the browser is opened on the first resource+-- passed as an argument to this function. The returned boolean can be+-- ignored manyToTheBrowser resources = do   dir <- getTemporaryDirectory   containing <- createTempDirectory dir "output"
web-output.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                web-output-version:             0.3.0.1+version:             0.4.0.0 synopsis:            Library to present content to an user via their browser description:         Library to present content to an user via their browser homepage:            https://github.com/danse/web-output