blaze-html 0.4.3.0 → 0.4.3.1
raw patch · 2 files changed
+17/−9 lines, 2 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Text.Blaze.Renderer.Text: renderHtmlBuilder :: Html -> Builder
+ Text.Blaze.Renderer.Text: renderHtmlBuilderWith :: (ByteString -> Text) -> Html -> Builder
Files
- Text/Blaze/Renderer/Text.hs +16/−8
- blaze-html.cabal +1/−1
Text/Blaze/Renderer/Text.hs view
@@ -2,7 +2,9 @@ -- | A renderer that produces a lazy 'L.Text' value, using the Text Builder. -- module Text.Blaze.Renderer.Text- ( renderHtml+ ( renderHtmlBuilder+ , renderHtmlBuilderWith+ , renderHtml , renderHtmlWith ) where @@ -59,12 +61,18 @@ fromChoiceString _ EmptyChoiceString = mempty {-# INLINE fromChoiceString #-} +-- | Render HTML to a text builder+renderHtmlBuilder :: Html+ -> Builder+renderHtmlBuilder = renderHtmlBuilderWith decodeUtf8+{-# INLINE renderHtmlBuilder #-}+ -- | Render some 'Html' to a Text 'Builder'. ---renderBuilder :: (ByteString -> Text) -- ^ Decoder for bytestrings- -> Html -- ^ HTML to render- -> Builder -- ^ Resulting builder-renderBuilder d = go mempty +renderHtmlBuilderWith :: (ByteString -> Text) -- ^ Decoder for bytestrings+ -> Html -- ^ HTML to render+ -> Builder -- ^ Resulting builder+renderHtmlBuilderWith d = go mempty where go :: Builder -> HtmlM b -> Builder go attrs (Parent _ open close content) =@@ -73,7 +81,7 @@ `mappend` B.singleton '>' `mappend` go mempty content `mappend` B.fromText (getText close)- go attrs (Leaf _ begin end) = + go attrs (Leaf _ begin end) = B.fromText (getText begin) `mappend` attrs `mappend` B.fromText (getText end)@@ -91,7 +99,7 @@ go attrs (Append h1 h2) = go attrs h1 `mappend` go attrs h2 go _ Empty = mempty {-# NOINLINE go #-}-{-# INLINE renderBuilder #-}+{-# INLINE renderHtmlBuilderWith #-} -- | Render HTML to a lazy Text value. If there are any ByteString's in the -- input HTML, this function will consider them as UTF-8 encoded values and@@ -109,4 +117,4 @@ renderHtmlWith :: (ByteString -> Text) -- ^ Decoder for ByteString's. -> Html -- ^ HTML to render -> L.Text -- Resulting lazy text-renderHtmlWith d = B.toLazyText . renderBuilder d+renderHtmlWith d = B.toLazyText . renderHtmlBuilderWith d
blaze-html.cabal view
@@ -1,5 +1,5 @@ Name: blaze-html-Version: 0.4.3.0+Version: 0.4.3.1 Homepage: http://jaspervdj.be/blaze Bug-Reports: http://github.com/jaspervdj/blaze-html/issues License: BSD3