Skip to content
Browse files

Add new renderer modules

  • Loading branch information...
1 parent 55f3bf7 commit f1a219433082c3a711b8eb8b9881f73b1e23f562 @jaspervdj committed Apr 20, 2012
View
4 blaze-html.cabal
@@ -28,6 +28,10 @@ Library
Exposed-modules:
Text.Blaze.Html
+ Text.Blaze.Html.Renderer.Pretty
+ Text.Blaze.Html.Renderer.String
+ Text.Blaze.Html.Renderer.Text
+ Text.Blaze.Html.Renderer.Utf8
Text.Blaze.Html4.FrameSet
Text.Blaze.Html4.FrameSet.Attributes
Text.Blaze.Html4.Strict
View
9 src/Text/Blaze/Html/Renderer/Pretty.hs
@@ -0,0 +1,9 @@
+module Text.Blaze.Html.Renderer.Pretty
+ ( renderHtml
+ ) where
+
+import Text.Blaze.Html (Html)
+import Text.Blaze.Renderer.Pretty (renderMarkup)
+
+renderHtml :: Html -> String
+renderHtml = renderMarkup
View
9 src/Text/Blaze/Html/Renderer/String.hs
@@ -0,0 +1,9 @@
+module Text.Blaze.Html.Renderer.String
+ ( renderHtml
+ ) where
+
+import Text.Blaze.Html (Html)
+import Text.Blaze.Renderer.String (renderMarkup)
+
+renderHtml :: Html -> String
+renderHtml = renderMarkup
View
25 src/Text/Blaze/Html/Renderer/Text.hs
@@ -0,0 +1,25 @@
+module Text.Blaze.Html.Renderer.Text
+ ( renderHtmlBuilder
+ , renderHtmlBuilderWith
+ , renderHtml
+ , renderHtmlWith
+ ) where
+
+import Data.ByteString (ByteString)
+import Data.Text (Text)
+import Data.Text.Lazy.Builder (Builder)
+import Text.Blaze.Html (Html)
+import qualified Data.Text.Lazy as TL
+import qualified Text.Blaze.Renderer.Text as R
+
+renderHtmlBuilder :: Html -> Builder
+renderHtmlBuilder = R.renderMarkupBuilder
+
+renderHtmlBuilderWith :: (ByteString -> Text) -> Html -> Builder
+renderHtmlBuilderWith = R.renderMarkupBuilderWith
+
+renderHtml :: Html -> TL.Text
+renderHtml = R.renderMarkup
+
+renderHtmlWith :: (ByteString -> Text) -> Html -> TL.Text
+renderHtmlWith = R.renderMarkupWith
View
20 src/Text/Blaze/Html/Renderer/Utf8.hs
@@ -0,0 +1,20 @@
+module Text.Blaze.Html.Renderer.Utf8
+ ( renderHtmlBuilder
+ , renderHtml
+ , renderHtmlToByteStringIO
+ ) where
+
+import Blaze.ByteString.Builder (Builder)
+import Data.ByteString (ByteString)
+import Text.Blaze.Html (Html)
+import qualified Data.ByteString.Lazy as BL
+import qualified Text.Blaze.Renderer.Utf8 as R
+
+renderHtmlBuilder :: Html -> Builder
+renderHtmlBuilder = R.renderMarkupBuilder
+
+renderHtml :: Html -> BL.ByteString
+renderHtml = R.renderMarkup
+
+renderHtmlToByteStringIO :: (ByteString -> IO ()) -> Html -> IO ()
+renderHtmlToByteStringIO = R.renderMarkupToByteStringIO
View
10 tests/Text/Blaze/Html/Tests/Util.hs
@@ -6,14 +6,14 @@ module Text.Blaze.Html.Tests.Util
, renderUsingUtf8
) where
-import Text.Blaze.Html5 hiding (map)
-import qualified Data.ByteString.Lazy as LB
-import qualified Text.Blaze.Renderer.Utf8 as Utf8 (renderHtml)
-import qualified Text.Blaze.Renderer.Text as Text (renderHtml)
-import qualified Text.Blaze.Renderer.String as String (renderHtml)
import Blaze.ByteString.Builder as B (toLazyByteString)
import Blaze.ByteString.Builder.Char.Utf8 as B (fromString)
import Data.Text.Lazy.Encoding (encodeUtf8)
+import Text.Blaze.Html (Html)
+import qualified Data.ByteString.Lazy as LB
+import qualified Text.Blaze.Html.Renderer.String as String (renderHtml)
+import qualified Text.Blaze.Html.Renderer.Text as Text (renderHtml)
+import qualified Text.Blaze.Html.Renderer.Utf8 as Utf8 (renderHtml)
-- | Render HTML to an UTF-8 encoded ByteString using the String renderer
--

0 comments on commit f1a2194

Please sign in to comment.
Something went wrong with that request. Please try again.