blaze-markup 0.7.0.3 → 0.7.1.0
raw patch · 4 files changed
+54/−3 lines, 4 filesdep ~QuickCheckPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: QuickCheck
API changes (from Hackage documentation)
+ Text.Blaze: instance Text.Blaze.ToMarkup Data.Text.Internal.Builder.Builder
+ Text.Blaze: instance Text.Blaze.ToValue Data.Text.Internal.Builder.Builder
+ Text.Blaze.Internal: preEscapedTextBuilder :: Builder -> Markup
+ Text.Blaze.Internal: preEscapedTextBuilderValue :: Builder -> AttributeValue
+ Text.Blaze.Internal: textBuilder :: Builder -> Markup
+ Text.Blaze.Internal: textBuilderValue :: Builder -> AttributeValue
Files
- CHANGELOG +4/−0
- blaze-markup.cabal +2/−2
- src/Text/Blaze.hs +13/−0
- src/Text/Blaze/Internal.hs +35/−1
CHANGELOG view
@@ -1,3 +1,7 @@+- 0.7.1.0+ * Relax `QuickCheck` dependency to allow 2.9+ * Add text builder instances+ - 0.7.0.3 * Relax `HUnit` dependency to allow 1.3
blaze-markup.cabal view
@@ -1,5 +1,5 @@ Name: blaze-markup-Version: 0.7.0.3+Version: 0.7.1.0 Homepage: http://jaspervdj.be/blaze Bug-Reports: http://github.com/jaspervdj/blaze-markup/issues License: BSD3@@ -51,7 +51,7 @@ Build-depends: HUnit >= 1.2 && < 1.4,- QuickCheck >= 2.4 && < 2.9,+ QuickCheck >= 2.4 && < 2.10, containers >= 0.3 && < 0.6, test-framework >= 0.4 && < 0.9, test-framework-hunit >= 0.3 && < 0.4,
src/Text/Blaze.hs view
@@ -93,6 +93,7 @@ import Data.Text (Text) import qualified Data.Text.Lazy as LT+import qualified Data.Text.Lazy.Builder as LTB import Text.Blaze.Internal @@ -129,6 +130,12 @@ preEscapedToMarkup = preEscapedLazyText {-# INLINE preEscapedToMarkup #-} +instance ToMarkup LTB.Builder where+ toMarkup = textBuilder+ {-# INLINE toMarkup #-}+ preEscapedToMarkup = preEscapedTextBuilder+ {-# INLINE preEscapedToMarkup #-}+ instance ToMarkup String where toMarkup = string {-# INLINE toMarkup #-}@@ -206,6 +213,12 @@ toValue = lazyTextValue {-# INLINE toValue #-} preEscapedToValue = preEscapedLazyTextValue+ {-# INLINE preEscapedToValue #-}++instance ToValue LTB.Builder where+ toValue = textBuilderValue+ {-# INLINE toValue #-}+ preEscapedToValue = preEscapedTextBuilderValue {-# INLINE preEscapedToValue #-} instance ToValue String where
src/Text/Blaze/Internal.hs view
@@ -31,6 +31,8 @@ , preEscapedText , lazyText , preEscapedLazyText+ , textBuilder+ , preEscapedTextBuilder , string , preEscapedString , unsafeByteString@@ -52,6 +54,8 @@ , preEscapedTextValue , lazyTextValue , preEscapedLazyTextValue+ , textBuilderValue+ , preEscapedTextBuilderValue , stringValue , preEscapedStringValue , unsafeByteStringValue@@ -85,6 +89,7 @@ import qualified Data.Text as T import qualified Data.Text.Encoding as T import qualified Data.Text.Lazy as LT+import qualified Data.Text.Lazy.Builder as LTB -- | A static string that supports efficient output to all possible backends. --@@ -245,7 +250,7 @@ -- -- > <p data-foo="bar">Hello.</p> ----- We support this in BlazeMarkup using this funcion. The above fragment could+-- We support this in BlazeMarkup using this function. The above fragment could -- be described using BlazeMarkup with: -- -- > p ! dataAttribute "foo" "bar" $ "Hello."@@ -303,7 +308,22 @@ preEscapedLazyText :: LT.Text -- ^ Text to insert -> Markup -- ^ Resulting HTML fragment preEscapedLazyText = mconcat . map preEscapedText . LT.toChunks+{-# INLINE preEscapedLazyText #-} +-- | A variant of 'text' for text 'LTB.Builder'.+--+textBuilder :: LTB.Builder -- ^ Text to insert+ -> Markup -- ^ Resulting HTML fragment+textBuilder = lazyText . LTB.toLazyText+{-# INLINE textBuilder #-}++-- | A variant of 'preEscapedText' for lazy 'LT.Text'+--+preEscapedTextBuilder :: LTB.Builder -- ^ Text to insert+ -> Markup -- ^ Resulting HTML fragment+preEscapedTextBuilder = preEscapedLazyText . LTB.toLazyText+{-# INLINE preEscapedTextBuilder #-}+ -- | Create an HTML snippet from a 'String'. -- string :: String -- ^ String to insert.@@ -408,6 +428,20 @@ -> AttributeValue -- ^ Resulting attribute value preEscapedLazyTextValue = mconcat . map preEscapedTextValue . LT.toChunks {-# INLINE preEscapedLazyTextValue #-}++-- | A variant of 'textValue' for text 'LTB.Builder'+--+textBuilderValue :: LTB.Builder -- ^ The actual value+ -> AttributeValue -- ^ Resulting attribute value+textBuilderValue = lazyTextValue . LTB.toLazyText+{-# INLINE textBuilderValue #-}++-- | A variant of 'preEscapedTextValue' for text 'LTB.Builder'+--+preEscapedTextBuilderValue :: LTB.Builder -- ^ The actual value+ -> AttributeValue -- ^ Resulting attribute value+preEscapedTextBuilderValue = preEscapedLazyTextValue . LTB.toLazyText+{-# INLINE preEscapedTextBuilderValue #-} -- | Create an attribute value from a 'String'. --